Переделал виджет, более читаем
This commit is contained in:
@ -4,22 +4,29 @@ namespace backend\modules\calendar\controllers;
|
||||
|
||||
use backend\modules\card\models\UserCardSearch;
|
||||
use Yii;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\web\Response;
|
||||
|
||||
class AjaxController extends \yii\web\Controller
|
||||
{
|
||||
public function actionGetBirthdayByMonth($month )
|
||||
|
||||
public function actionGetBirthdayDate($date)
|
||||
{
|
||||
$searchModel = new UserCardSearch();
|
||||
$dataProvider = $searchModel->search(['date' => $date]);
|
||||
|
||||
return $this->render('_gridView', [
|
||||
'dataProvider' => $dataProvider
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionGetBirthdayDatesByMonth($month )
|
||||
{
|
||||
$searchModel = new UserCardSearch();
|
||||
$models = $searchModel->search(Yii::$app->request->queryParams)->getModels();
|
||||
$models_array = ArrayHelper::toArray($models, [
|
||||
'backend\modules\card\models\UserCard' => [
|
||||
'id',
|
||||
'dob',
|
||||
'fio'
|
||||
],
|
||||
]);
|
||||
$models_array = array_map(function ($date){return date('Y').substr($date, 4,6);},
|
||||
array_column($models, 'dob')
|
||||
);
|
||||
|
||||
|
||||
$response = Yii::$app->response;
|
||||
$response->format = Response::FORMAT_JSON;
|
||||
|
@ -42,11 +42,11 @@ class CalendarController extends Controller
|
||||
* Renders the index view for the module
|
||||
* @return string
|
||||
*/
|
||||
public function actionCalendar(){
|
||||
return $this->render('calendar');
|
||||
public function actionIndex(){
|
||||
return $this->render('index');
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
public function actionTable()
|
||||
{
|
||||
$searchModel = new UserCardSearch();
|
||||
$user_card = \common\models\UserCard::find()->all();
|
||||
@ -67,7 +67,7 @@ class CalendarController extends Controller
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
}
|
||||
|
||||
return $this->render('index', [
|
||||
return $this->render('table', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
|
Reference in New Issue
Block a user