/** * Manages all models. */ public function actionAll() { $criteria = new CDbCriteria(); $criteria->compare('top', '1', true); $model = Information::model()->findAll($criteria); $id = array(); $i = 0; foreach ($model as $value) { $id[$i] = $value->id; $i++; } $limit = 5; if (count($id) > $limit) { shuffle($id); $id = array_slice($id, 0, $limit); } $criteria1 = new CDbCriteria(); $criteria1->addInCondition('id', $id); $model1 = Information::model()->findAll($criteria1, array('top', '1', true)); $model = new Information('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Information'])) { $model->attributes = $_GET['Information']; } $this->render('admin', array('model' => $model, 'model1' => $model1)); }
/** * Manages all models. */ public function actionAdmin() { $model = new Information('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Information'])) { $model->attributes = $_GET['Information']; } $this->render('admin', array('model' => $model)); }