/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { $criteria = new CDbCriteria(); $criteria->with = array('projeto', 'patrimonio_items'); $criteria->together = true; $model = PatrimonioTermo::model()->findByPk((int) $id, $criteria); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } $pItem = new PatrimonioItem('search'); $pItem->unsetAttributes(); // clear any default values if (isset($_GET['PatrimonioItem'])) { $pItem->attributes = $_GET['PatrimonioItem']; } $pItem->cod_termo = $model->cod_termo; $this->render('view', array('model' => $model, 'pItem' => $pItem)); }
public function actionSearch($q = null) { $model = new PatrimonioItem(); $model->unsetAttributes(); // clear any default values if (isset($_GET['PatrimonioItem'])) { $model->attributes = $_GET['PatrimonioItem']; } if ($q != null) { $model->nro_patrimonio = $q; } $criteria = new CDbCriteria(); $criteria->compare('t.nro_patrimonio', (int) $model->nro_patrimonio); $dataProvider = new CActiveDataProvider('PatrimonioItem', array('criteria' => $criteria, 'pagination' => array('pageSize' => 10))); $this->render('index', array('dataProvider' => $dataProvider, 'model' => $model)); }