public function actionCreateIllust($mode) { /* validate all query string param */ $model = new Illust('create'); $model->categorize($mode); //this will throw new CHttpException(404,'test'); /*define the required variable for the controller base on the query string param */ $fileModel = new FileUploadFormModel(); $view; $scen; if ($model->Illust_cat_title == Illust::ILLUST_CAT_TITLE) { $scen = FileUploadFormModel::FILE_UPLOAD_MODE_SINGLE; $view = 'createIllust'; } else { $scen = FileUploadFormModel::FILE_UPLOAD_MODE_MULTI; $view = 'createManga'; } if (isset($_POST['Illust'])) { $model->setAttributes($_POST['Illust']); //$fileHandler->LoadUploadedeImageToModel(); //$model->photos = $fileHandler->photos; //$model->photos = CUploadedFile::getInstancesByName(BSMultiFileUploadWidget::fieldName); if ($model->validate()) { $fileModel->LoadUploadedeImage(); $fileModel->setScenario($scen); if ($fileModel->validate()) { if ($model->save()) { $ips = new ImageProcessService($fileModel, get_class($model), Yii::app()->user->user_name, $model->id); $ips->saveImage(150, 150); $SavedFileRelativePaths = $ips->getOriginalImageVirtualPath(); $SavedThumbnailFileRelativePaths = $ips->getThumbnailImageVirtualPath(); //$SavedFileRelativePaths = $fileModel->processImage(get_class($model),Yii::app()->user->user_name,$model->id); $model->save_img_src($SavedFileRelativePaths, $SavedThumbnailFileRelativePaths); $model->addOwnerUserId(Yii::app()->user->id); Yii::app()->user->setFlash(FlashMsg::SUCCESS, "投稿作品成功"); $this->redirect(SeoHelper::illustViewSEORouteArray($model)); } else { Yii::app()->user->setFlash(FlashMsg::ERROR, "投稿作品失敗"); } } } } $this->render($view, array('model' => $model, 'fileModel' => $fileModel)); }
public function getNewerIllustViewLink() { $illust_arr = $this->getNewerIllusts(); if (count($illust_arr) == 0) { return ''; } $illust = $illust_arr[0]; $link = CHtml::link(CHtml::encode('下一張作品: ' . $illust->illust_title), SeoHelper::illustViewSEORouteArray($illust)); return $link; }