Ejemplo n.º 1
0
 private function _refreshOpera($name)
 {
     $criteriab = new CDbCriteria();
     $criteriab->addCondition("parent=:type");
     $criteriab->params[':type'] = $name;
     $models = Authitemchild::model()->findAll($criteriab);
     $assignedArr = array();
     foreach ($models as $value) {
         $assignedArr[] = $value['child'];
     }
     $criteria = new CDbCriteria();
     $criteria->addCondition("type=:type");
     $criteria->params[':type'] = 0;
     $role = AppAuthitem::model()->findAll($criteria);
     $assigningArr = array();
     foreach ($role as $value) {
         if (!in_array($value['name'], $assignedArr)) {
             $assigningArr[] = $value['name'];
         }
     }
     $this->renderPartial('assign/_task', array('models' => $assignedArr, 'opera' => $assigningArr));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Authitemchild the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Authitemchild::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 3
0
 protected function afterSave()
 {
     parent::afterSave();
     $this->data = unserialize($this->data);
     if ($this->oldName != $this->name) {
         //更新关联的三张表
         $this->model()->updateByPk($this->oldName, array("name" => $this->name));
         $criteria = new CDbCriteria();
         $criteria->condition = "itemname='" . $this->oldName . "'";
         Authassignment::model()->updateAll(array('itemname' => $this->name), $criteria);
         $criteria->condition = "parent='" . $this->oldName . "'";
         Authitemchild::model()->updateAll(array('parent' => $this->name), $criteria);
         $criteria->condition = "child='" . $this->oldName . "'";
         Authitemchild::model()->updateAll(array('child' => $this->name), $criteria);
     }
 }