Пример #1
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $user = Usuario::model()->findbyPk(Yii::app()->user->getId());
     $acceso = Usuario::privilegiado($user->rol_id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Responsable'])) {
         $model->attributes = $_POST['Responsable'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $status = BmStatus::model()->findAll();
     $personas = Persona::model()->listAll();
     $this->render('update', array('model' => $model, 'status' => $status, 'personas' => $personas, 'acceso' => $acceso));
 }
Пример #2
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $this->pageTitle = 'Listar Bienes';
     $filtro = new BmFiltro();
     $user = Usuario::model()->findbyPk(Yii::app()->user->getId());
     $acceso = Usuario::privilegiado($user->rol_id);
     if (isset($_GET['BmFiltro'])) {
         $filtro->attributes = $_GET['BmFiltro'];
     }
     $vars = array();
     $vars['dps'] = Dependencia::model()->findAll(array('condition' => 'sede_id=1', 'order' => 'descripcion ASC'));
     $vars['clases'] = BmClasificacion::model()->listAll();
     $vars['tipos'] = BmTipo::model()->findAll(array('order' => 'descripcion'));
     $vars['conceptos'] = Concepto::model()->findAll();
     $vars['status'] = BmStatus::model()->findAll();
     $vars['anhos'] = array('1' => "2012", '2' => "2011");
     $dataProvider = $filtro->search();
     $this->render('index', array('dataProvider' => $dataProvider, 'filtro' => $filtro, 'vars' => $vars, 'acceso' => $acceso));
 }
Пример #3
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionEdit($id)
 {
     $model = $this->loadModel($id);
     if (isset($_POST['Persona'])) {
         $model->attributes = $_POST['Persona'];
         if ($model->update()) {
             $this->redirect(array('view', 'pid' => $model->pdata_id));
         }
     }
     if ($model->pdata->sexo_id == 1) {
         $cargos = Cargo::model()->findAll(array('order' => 'descripcion ASC'));
     } else {
         $cargos = Cargo::model()->findAll(array('select' => 'id, desc_f as descripcion', 'order' => 'descripcion ASC'));
     }
     $dps = Dependencia::model()->findAll(array('condition' => 'sede_id=1', 'order' => 'descripcion ASC'));
     $status = BmStatus::model()->findAll();
     $this->render('edit', array('model' => $model, 'cargos' => $cargos, 'dps' => $dps, 'status' => $status));
 }