готовый календарь, немного мусора
This commit is contained in:
@ -11,6 +11,7 @@ use yii\web\Response;
|
||||
|
||||
class AjaxController extends \yii\web\Controller
|
||||
{
|
||||
|
||||
public function actionGetReportsForMonthByIdYearMonth($id, $year=null, $month=null){
|
||||
if (!($year and $month)){
|
||||
$searchModel->month = date('m');
|
||||
@ -25,7 +26,13 @@ class AjaxController extends \yii\web\Controller
|
||||
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
$reports = ['reports'=>array_column($dataProvider->getModels(), 'attributes')];
|
||||
$reports = $dataProvider->getModels();
|
||||
$reports_no_task = array_column($reports, 'attributes');
|
||||
for ($i = 0; $i<count($reports); $i++){
|
||||
$reports_no_task[$i]['today'] = array_column( $reports[$i]->task, 'attributes');
|
||||
}
|
||||
$reports = $reports_no_task;
|
||||
|
||||
$month = new Month($year.'-'.$month.'-01');
|
||||
|
||||
|
||||
@ -33,7 +40,7 @@ class AjaxController extends \yii\web\Controller
|
||||
|
||||
$response->format = Response::FORMAT_JSON;
|
||||
|
||||
$response->content = json_encode(array_merge($reports,
|
||||
$response->content = json_encode(array_merge(['reports' => $reports_no_task],
|
||||
['month'=>(array)$month]));
|
||||
$response->getHeaders()->set('Content-Type', 'application/json; charset=utf-8');
|
||||
|
||||
|
@ -73,15 +73,21 @@ class ReportsController extends Controller
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
$reports = $dataProvider->getModels();
|
||||
// Debug::dd($dataProvider);
|
||||
|
||||
$ID = $reports[0]->user_card_id;
|
||||
|
||||
$reports_no_task = array_column($reports, 'attributes');
|
||||
for ($i = 0; $i < count($reports); $i++) {
|
||||
$reports_no_task[$i]['today'] = array_column($reports[$i]->task, 'attributes');
|
||||
}
|
||||
$month = new Month($date);
|
||||
|
||||
if (!Yii::$app->request->isAjax) {
|
||||
return $this->render('user', [
|
||||
'ID' => $reports[0]->id,
|
||||
'ID' => $ID,
|
||||
'reports' => $reports,
|
||||
'reports_month' => json_encode(array_merge(['reports'=>array_column($reports, 'attributes')],
|
||||
['month'=>(array)$month])),
|
||||
'reports_month' => json_encode(array_merge(['reports' => $reports_no_task],
|
||||
['month' => (array)$month])),
|
||||
'date' => $date
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user