Created
March 10, 2016 14:46
-
-
Save hscstudio/43664c92242852547df4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function actionIndex($year='') | |
{ | |
if(empty($year)) $year=date('Y'); | |
$searchModel = new TrainingSearch(); | |
$queryParams = Yii::$app->request->getQueryParams(); | |
if($year!='all'){ | |
$queryParams['TrainingSearch']=[ | |
'year' => $year, | |
]; | |
} | |
$queryParams=yii\helpers\ArrayHelper::merge(Yii::$app->request->getQueryParams(),$queryParams); | |
$dataProvider = $searchModel->search($queryParams); | |
$dataProvider->getSort()->defaultOrder = ['start'=>SORT_ASC,'end'=>SORT_ASC]; | |
return $this->render('index', [ | |
'searchModel' => $searchModel, | |
'dataProvider' => $dataProvider, | |
'year' => $year, | |
]); | |
} | |
// combobox | |
$year = ['all', 2016, 2015, 2014, 2013]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment