Пример #1
0
 public function editAction()
 {
     $other = array('html', 'searchbar', 'image');
     $isedit = false;
     $model = $this->getInput('model', 'post');
     $moduleid = (int) $this->getInput('moduleid', 'post');
     Wind::import('SRV:design.bo.PwDesignModuleBo');
     $moduleBo = new PwDesignModuleBo($moduleid);
     if ($model) {
         $isedit = true;
         $moduleBo->setModel($model);
     } else {
         $model = $moduleBo->getModel();
     }
     $module = $moduleBo->getModule();
     if (!$model) {
         $this->showError('operate.fail');
     }
     Wekit::load('design.PwDesignPermissions');
     $permissions = $this->_getPermissionsService()->getPermissionsForModule($this->loginUser->uid, $moduleid, $module['page_id']);
     if ($permissions < PwDesignPermissions::IS_ADMIN && !in_array($module['model_flag'], $other)) {
         $this->showError("DESIGN:permissions.fail");
     }
     if ($permissions < PwDesignPermissions::IS_PUSH) {
         $this->showError("DESIGN:permissions.fail");
     }
     $cls = sprintf('PwDesign%sDataService', ucwords($model));
     Wind::import('SRV:design.srv.model.' . $model . '.' . $cls);
     $service = new $cls();
     $decorator = $service->decorateEditProperty($moduleBo);
     Wind::import('SRV:design.bo.PwDesignModelBo');
     $modelBo = new PwDesignModelBo($model);
     $property = $modelBo->getProperty();
     $vProperty = $isedit ? array() : $moduleBo->getProperty();
     //$isedit && $vProperty['compid'] = null;
     $service = $this->_getDesignService();
     $types = $service->getDesignModelType();
     $models = $service->getModelList();
     foreach ($models as $k => $v) {
         $_models[$v['type']][] = array('name' => $v['name'], 'model' => $k);
     }
     $this->setOutput($types, 'types');
     $this->setOutput($_models, 'models');
     $this->setOutput($model, 'model');
     $this->setOutput($modelBo->getProperty(), 'property');
     $this->setOutput($decorator, 'decorator');
     $this->setOutput($module, 'module');
     $this->setOutput($vProperty, 'vProperty');
     $this->setOutput($moduleBo->getCache(), 'cache');
     $this->setOutput($modelBo->getModel(), 'modelInfo');
     $this->setOutput($isedit, 'isedit');
 }
Пример #2
0
 public function editAction()
 {
     $isedit = false;
     $model = $this->getInput('model', 'get');
     //前台为post
     if ($model) {
         $isedit = true;
         $this->bo->setModel($model);
     } else {
         $model = $this->bo->getModel();
     }
     $module = $this->bo->getModule();
     if (!$model) {
         $this->showError('operate.fail');
     }
     $cls = sprintf('PwDesign%sDataService', ucwords($model));
     Wind::import('SRV:design.srv.model.' . $model . '.' . $cls);
     $service = new $cls();
     $decorator = $service->decorateEditProperty($this->bo);
     Wind::import('SRV:design.bo.PwDesignModelBo');
     $modelBo = new PwDesignModelBo($model);
     $property = $modelBo->getProperty();
     $vProperty = $isedit ? array() : $this->bo->getProperty();
     $isedit && ($vProperty['compid'] = null);
     $service = $this->_getDesignService();
     $types = $service->getDesignModelType();
     $models = $service->getModelList();
     foreach ($models as $k => $v) {
         $_models[$v['type']][] = array('name' => $v['name'], 'model' => $k);
     }
     $this->setOutput($types, 'types');
     $this->setOutput($_models, 'models');
     $this->setOutput($model, 'model');
     $this->setOutput($modelBo->getProperty(), 'property');
     $this->setOutput($decorator, 'decorator');
     $this->setOutput($module, 'module');
     $this->setOutput($vProperty, 'vProperty');
     $this->setOutput($this->bo->getCache(), 'cache');
     $this->setOutput($modelBo->getModel(), 'modelInfo');
     $this->setOutput($isedit, 'isedit');
 }