/** * edit a particular model. */ public function actionEdit() { $this->layout = '//layouts/notitle_main'; $infoType = $this->getInfoType(); $basicModelName = ucfirst(strtolower($infoType)) . 'InfoView'; $isPageDirty = 0; $actionType = 'view'; if (!empty($_GET['action'])) { $actionType = $_GET['action']; } list($productId, $model, $customInfo, $customFieldArr) = InfoService::initInfoPage($infoType, $this, $actionType, Yii::app()->request); if (!Info::isProductAccessable($productId)) { throw new CHttpException(400, Yii::t('Common', 'Required URL not found or permission denied.')); } if (isset($_POST[$basicModelName])) { if ('' == $_POST['templateTitle'] && empty($_POST['isPageDirty']) && !empty($model->id) && $this->isEditAction($actionType)) { $this->redirect(array('edit', 'type' => $infoType, 'id' => $model->id)); } else { $attachmentFile = CUploadedFile::getInstancesByName('attachment_file'); list($model, $customFieldArr) = InfoService::saveInfoPage($infoType, $model, $customInfo, $attachmentFile, $this, $actionType, Yii::app()->request); $isPageDirty = 1; } } $buttonList = InfoService::getButtonList($infoType, $actionType, $model); $this->render('edit', array('infoType' => $infoType, 'isPageDirty' => $isPageDirty, 'actionType' => $actionType, 'model' => $model, 'buttonList' => $buttonList, 'customfield' => $customFieldArr)); }