/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { unset($_SESSION['itens_start']); unset($_SESSION['itens_tot']); $number_of_itens = 6; $_SESSION['itens_start'] = 0; /* Trecho adaptável para que a model Itens receba os parâmetro vindo da url de paginação do Widget ClistView */ if (count($_GET)) { foreach ($_GET as $key => $values) { //echo $key.'-'.$values.'<br>'; if ($key != "Itens_page") { $_POST['Itens'][$key] = $values; } } } $model = new Itens('search'); $model_pesq = array(); $model->unsetAttributes(); // clear any default values if (isset($_POST['Itens'])) { $model->attributes = $_POST['Itens']; } $msg_error = false; /*$criteria=New CDbCriteria; $criteria->condition='cms_banner_excluido=\'N\' AND cms_banner_destaque=TRUE';*/ if (Yii::app()->user->getFlash('#usr_error') == 1) { $msg_error = true; } //echo count($model);{ //if(isset($_POST['Itens'])){ $model_pesq = $model->search(); $totItens = $model->totReg; /*if(count($model_pesq)>0){ $model_pesq=Itens::gerarLista($model_pesq); }*/ $this->render('index', array('model' => $model, 'model_pesq' => $model_pesq, '_msg_error' => $msg_error, 'number_of_itens' => $number_of_itens, 'totItens' => $totItens)); }
/** * Manages all models. */ public function actionAdmin() { $model = new Itens('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Itens'])) { $model->attributes = $_GET['Itens']; } $this->render('admin', array('model' => $model)); }