Esempio n. 1
0
 /**
  * 管理员组编辑
  *
  * @param  $id
  */
 public function actionGroupUpdate($id)
 {
     parent::_acl();
     $data = parent::_dataLoad(new AdminGroup(), $id);
     $acl = backendMenu();
     $this->groupEdite($data);
     $this->render('group_update', array('model' => $data, 'acl' => $acl));
     //        ppr($data);        ppr($acl);
 }
Esempio n. 2
0
 /**
  * 编辑
  *
  * @param  $id
  */
 public function actionUpdate($id)
 {
     parent::_acl();
     $model = parent::_dataLoad(new Catalog(), $id);
     $catalogAll = reqPost('Catalog');
     if (!empty($catalogAll)) {
         $catalogAll['create_time'] = $this->_thetime;
         //先判断是外链图片还是本地图片
         $imgtype = reqPost('imgtype', null);
         //ppr($_POST,1);
         if (!empty($imgtype)) {
             if ($imgtype == 'local') {
                 $catalogAll['image_link'] = $this->_doLocalImage('image_link');
             }
             if (empty($catalogAll['image_link'])) {
                 $catalogAll['image_link'] = null;
             }
         }
         $model->attributes = $catalogAll;
         //        ppr($_POST);        ppr($_FILES);        ppr($catalogAll,1);
         unset($catalogAll);
         if ($model->save()) {
             //检查父分类是否为N
             $fmodel = Catalog::model()->findByPk($model->attributes['parent_id'], "`status_is`='N'");
             if (empty($fmodel)) {
                 if ($model->attributes['status_is'] == 'N') {
                     //若该分类为N,则该分类所有子分类均为N
                     $this->subSetStatus($model->attributes['id']);
                 }
             } else {
                 //若是,则该父分类下面所有均为N
                 $this->subSetStatus($fmodel->attributes['id']);
             }
             XXcache::refresh('_catalog');
             XXcache::refresh('_catalogAll');
             parent::_backendLogger(array('catalog' => 'update', 'intro' => '编辑全局分类,ID:' . $model->id . ',名称:' . $model->catalog_name));
             $fid = $this->_getParentCatalogId($model->parent_id);
             $this->redirect(array('index', 'fid' => $fid));
         }
     }
     $this->render('update', array('model' => $model, 'id' => $id));
 }