예제 #1
0
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     if (!$this->initLink()) {
         return;
     }
     $this->Categories->initCategories(true);
     $this->Paginator->settings = array('Link' => array('order' => array('LinkOrder.weight' => 'asc'), 'conditions' => array('Link.block_id' => $this->viewVars['blockId'], 'Link.is_latest' => true), 'limit' => -1));
     $links = $this->Paginator->paginate('Link');
     $links = Hash::combine($links, '{n}.LinkOrder.weight', '{n}', '{n}.Category.id');
     //POST処理
     $data = array();
     if ($this->request->isPost()) {
         //登録処理
         $data = $this->data;
         $this->LinkOrder->saveLinkOrders($data);
         //validationError
         if ($this->NetCommons->handleValidationError($this->LinkOrder->validationErrors)) {
             //リダイレクト
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
     }
     $data = Hash::merge(array('links' => $links), $data);
     $results = $this->camelizeKeyRecursive($data);
     $this->set($results);
 }
예제 #2
0
 /**
  * edit
  *
  * @throws BadRequestException
  * @return void
  */
 public function edit()
 {
     //Edumapデータを取得
     $this->__initEdumap();
     //コメントデータ取得
     $comments = $this->Comment->getComments(array('plugin_key' => $this->params['plugin'], 'content_key' => $this->viewVars['edumap']['key']));
     $data = array();
     if ($this->request->isPost()) {
         if (!($status = $this->NetCommonsWorkflow->parseStatus())) {
             return;
         }
         $data = $this->__parseRequestData();
         $data = Hash::merge($data, array('Edumap' => array('status' => $status)));
         unset($data['Edumap']['id']);
         if (!$this->viewVars['blockId']) {
             $visibilitySetting = $this->EdumapVisibilitySetting->create();
             $data = Hash::merge($data, $visibilitySetting);
         }
         //登録処理
         $this->Edumap->saveEdumap($data);
         if ($this->NetCommons->handleValidationError($this->Edumap->validationErrors)) {
             //正常の場合
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         $data['Edumap']['foundation_date'] = $this->data['Edumap']['foundation_date'];
         $data['Edumap']['closed_date'] = $this->data['Edumap']['closed_date'];
         $data['contentStatus'] = null;
         $data['comments'] = null;
         unset($data['Edumap']['status']);
     }
     $data = $this->camelizeKeyRecursive(Hash::merge($data, array('comments' => $comments, 'contentStatus' => $this->viewVars['edumap']['status'])));
     $results = Hash::merge($this->viewVars, $data);
     $this->set($results);
 }
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     if ($this->request->isPut() || $this->request->isPost()) {
         if ($this->BbsFrameSetting->saveBbsFrameSetting($this->data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         $this->NetCommons->handleValidationError($this->BbsFrameSetting->validationErrors);
     } else {
         $this->request->data = $this->BbsFrameSetting->getBbsFrameSetting(true);
         $this->request->data['Frame'] = Current::read('Frame');
     }
 }
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     if ($this->request->isPost()) {
         if ($this->FaqQuestionOrder->saveFaqQuestionOrders($this->data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         $this->NetCommons->handleValidationError($this->FaqQuestionOrder->validationErrors);
     } else {
         $this->Paginator->settings = array('FaqQuestion' => array('recursive' => 0, 'order' => array('FaqQuestionOrder.weight' => 'asc'), 'conditions' => $this->FaqQuestion->getWorkflowConditions(array('FaqQuestion.faq_id' => $this->viewVars['faq']['id'])), 'limit' => PHP_INT_MAX));
         $this->request->data['FaqQuestions'] = $this->Paginator->paginate('FaqQuestion');
         $this->request->data['Frame'] = Current::read('Frame');
         $this->request->data['Faq'] = $this->viewVars['faq'];
     }
 }
 /**
  * edit action
  *
  * @return void
  */
 public function edit()
 {
     if ($this->request->is(array('post', 'put'))) {
         $data = $this->request->data;
         if ($this->CircularNoticeFrameSetting->saveCircularNoticeFrameSetting($data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl(true));
             return;
         }
         $this->NetCommons->handleValidationError($this->CircularNoticeFrameSetting->validationErrors);
     } else {
         $this->request->data = $this->CircularNoticeFrameSetting->getCircularNoticeFrameSetting(true);
         $this->request->data['Frame'] = Current::read('Frame');
     }
     $this->set('circularNoticeFrameSetting', $this->request->data['CircularNoticeFrameSetting']);
 }
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     if ($this->request->isPut() || $this->request->isPost()) {
         //登録(PUT)処理
         $data = $this->data;
         $data['AccessCounterFrameSetting']['display_type'] = (int) $data['AccessCounterFrameSetting']['display_type'];
         if ($this->AccessCounterFrameSetting->saveAccessCounterFrameSetting($data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         $this->NetCommons->handleValidationError($this->AccessCounterFrameSetting->validationErrors);
     } else {
         //初期データセット
         $this->request->data = $this->AccessCounterFrameSetting->getAccessCounterFrameSetting(true);
         $this->request->data['Frame'] = Current::read('Frame');
     }
 }
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     $this->RoomsForm->setRoomsForCheckbox();
     $this->PluginsForm->setPluginsRoomForCheckbox($this, $this->PluginsForm->findOptions);
     $options = Hash::extract($this->viewVars['pluginsRoom'], '{n}.Plugin.key');
     $blocks = $this->TopicFrameSetting->getBlocks($options, array_keys($this->viewVars['rooms']));
     $this->set('selectBlocks', $blocks);
     if ($this->request->is('put') || $this->request->is('post')) {
         //登録処理
         $data = $this->data;
         $data['TopicFramesRoom']['room_id'] = Hash::get($data, 'TopicFramesRoom.room_id');
         if (!$data['TopicFramesRoom']['room_id']) {
             $data['TopicFramesRoom']['room_id'] = array();
         }
         $data['TopicFramesPlugin']['plugin_key'] = Hash::get($data, 'TopicFramesPlugin.plugin_key');
         if (!$data['TopicFramesPlugin']['plugin_key']) {
             $data['TopicFramesPlugin']['plugin_key'] = array();
         }
         $data['TopicFramesBlock'] = Hash::get($data, 'TopicFramesBlock');
         if ($this->TopicFrameSetting->saveTopicFrameSetting($data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl(true));
             return;
         }
         $this->NetCommons->handleValidationError($this->TopicFrameSetting->validationErrors);
     } else {
         //新着設定を取得
         $this->request->data = $this->TopicFrameSetting->getTopicFrameSetting();
         $this->request->data['Frame'] = Current::read('Frame');
         //表示するルームを取得
         $result = $this->TopicFramesRoom->find('list', array('recursive' => -1, 'fields' => array('id', 'room_id'), 'conditions' => ['frame_key' => Current::read('Frame.key')]));
         $this->request->data['TopicFramesRoom']['room_id'] = array_unique(array_values($result));
         //表示するプラグインを取得
         $result = $this->TopicFramesPlugin->find('list', array('recursive' => -1, 'fields' => array('id', 'plugin_key'), 'conditions' => ['frame_key' => Current::read('Frame.key')]));
         $this->request->data['TopicFramesPlugin']['plugin_key'] = array_unique(array_values($result));
         //表示するブロックを取得
         $result = $this->TopicFramesBlock->find('first', array('recursive' => -1, 'fields' => array('id', 'block_key', 'plugin_key', 'room_id'), 'conditions' => ['frame_key' => Current::read('Frame.key')]));
         $this->request->data['TopicFramesBlock'] = Hash::get($result, 'TopicFramesBlock', array());
         if (!$this->request->data['TopicFramesBlock']) {
             $block = Hash::extract($blocks, '{s}.{s}');
             $this->request->data['TopicFramesBlock'] = array('block_key' => Hash::get($block, '0.key'), 'plugin_key' => Hash::get($block, '0.plugin_key'), 'room_id' => Hash::get($block, '0.room_id'));
         }
     }
 }
 /**
  * edit method
  *
  * @return void
  */
 public function edit()
 {
     if ($this->request->isPost() || $this->request->isPut()) {
         $data = $this->data;
         $data['Announcement']['status'] = $this->Workflow->parseStatus();
         unset($data['Announcement']['id']);
         if ($this->Announcement->saveAnnouncement($data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         $this->NetCommons->handleValidationError($this->Announcement->validationErrors);
     } else {
         //初期データセット
         if (!($this->request->data = $this->Announcement->getAnnouncement())) {
             $this->request->data = $this->Announcement->createAll();
         }
         $this->request->data['Frame'] = Current::read('Frame');
     }
     $comments = $this->Announcement->getCommentsByContentKey($this->request->data['Announcement']['key']);
     $this->set('comments', $comments);
 }
예제 #9
0
 /**
  * 登録
  *
  * @return CakeResponse
  */
 public function add()
 {
     $this->set('video', null);
     $categories = $this->Category->getCategories(Current::read('Block.id'), Current::read('Room.id'));
     $this->set('categories', $categories);
     if ($this->request->is('post')) {
         //登録処理
         $data = $this->data;
         $data['Video']['status'] = $this->Workflow->parseStatus();
         unset($data['Video']['id']);
         // 登録
         if ($this->Video->saveVideo($data)) {
             return $this->redirect(NetCommonsUrl::backToPageUrl());
         }
         $this->NetCommons->handleValidationError($this->Video->validationErrors);
     } else {
         //表示処理
         $this->request->data = Hash::merge($this->request->data, $this->Video->create());
         $this->request->data['Frame'] = Current::read('Frame');
         $this->request->data['Block'] = Current::read('Block');
     }
 }
 /**
  * edit action
  *
  * @return void
  */
 public function edit()
 {
     if (!$this->NetCommonsFrame->validateFrameId()) {
         $this->throwBadRequest();
         return false;
     }
     $data = array();
     if ($this->request->isPost()) {
         $data = $this->data;
         $this->RssReaderFrameSetting->saveRssReaderFrameSetting($this->data);
         if ($this->NetCommons->handleValidationError($this->RssReaderFrameSetting->validationErrors)) {
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         unset($data['Frame']);
     }
     if (!($rssFrameSetting = $this->RssReaderFrameSetting->getRssReaderFrameSetting($this->viewVars['frameKey']))) {
         $rssFrameSetting = $this->RssReaderFrameSetting->create(['frame_key' => $this->viewVars['frameKey']]);
     }
     $results = $this->camelizeKeyRecursive(Hash::merge($rssFrameSetting, $data));
     $this->set($results);
 }
 /**
  * edit action
  *
  * @return void
  */
 public function edit()
 {
     $frameId = Current::read('Frame.id');
     if (!$frameId || !($setting = $this->CircularNoticeSetting->getCircularNoticeSetting($frameId))) {
         $this->setAction('throwBadRequest');
         return false;
     }
     $permissions = $this->Workflow->getBlockRolePermissions(array('content_creatable', 'content_publishable'));
     $this->set('roles', $permissions['Roles']);
     if ($this->request->is(array('post', 'put'))) {
         $data = $this->data;
         if ($this->CircularNoticeSetting->saveCircularNoticeSetting($data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl(true));
             return;
         }
         $this->NetCommons->handleValidationError($this->CircularNoticeSetting->validationErrors);
         $this->request->data['CircularNoticeRolePermission'] = Hash::merge($permissions['BlockRolePermissions'], $this->request->data['BlockRolePermission']);
     } else {
         $this->request->data['CircularNoticeSetting'] = $setting['CircularNoticeSetting'];
         $this->request->data['BlockRolePermission'] = $permissions['BlockRolePermissions'];
         $this->request->data['Frame'] = Current::read('Frame');
     }
 }
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     //フレームなしの場合、
     if (!Current::read('Frame.id')) {
         $this->autoRender = false;
         return;
     }
     if ($this->request->is(array('post', 'put'))) {
         //不要パラメータ除去
         $data = $this->data;
         unset($data['save']);
         if ($this->MenuFrameSetting->saveMenuFrameSetting($data)) {
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         $this->NetCommons->handleValidationError($this->MenuFrameSetting->validationErrors);
         $this->request->data = $data;
     } else {
         $this->request->data = Hash::merge($this->request->data, $this->MenuFrameSetting->find('first', array('recursive' => -1, 'conditions' => array('frame_key' => Current::read('Frame.key')))));
         $this->request->data['Frame'] = Current::read('Frame');
         $this->request->data['Menus'] = $this->MenuFramesPage->getMenuData();
     }
 }
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     if (!$this->NetCommonsFrame->validateFrameId()) {
         $this->throwBadRequest();
         return false;
     }
     if (!($linkFrameSetting = $this->LinkFrameSetting->getLinkFrameSetting($this->viewVars['frameKey']))) {
         $linkFrameSetting = $this->LinkFrameSetting->create(array('id' => null, 'display_type' => LinkFrameSetting::TYPE_DROPDOWN, 'frame_key' => $this->viewVars['frameKey'], 'category_separator_line' => null, 'list_style' => null));
     }
     $linkFrameSetting = $this->camelizeKeyRecursive($linkFrameSetting);
     $data = array();
     if ($this->request->isPost()) {
         $data = $this->data;
         $this->LinkFrameSetting->saveLinkFrameSetting($data);
         if ($this->NetCommons->handleValidationError($this->LinkFrameSetting->validationErrors)) {
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
     }
     $data = Hash::merge($linkFrameSetting, $data);
     $results = $this->camelizeKeyRecursive($data);
     $this->set($results);
 }
예제 #14
0
 /**
  * link
  *
  * @return void
  */
 public function link()
 {
     $linkKey = null;
     if (isset($this->data['Link']['key'])) {
         $linkKey = $this->data['Link']['key'];
     }
     $this->set('linkKey', $linkKey);
     //データ取得
     if (!$this->__initLink()) {
         return;
     }
     if (!$this->request->isPost()) {
         $this->throwBadRequest();
         return;
     }
     if (!$this->Link->updateCount($this->data['Link']['id'], $this->viewVars['blockId'])) {
         $this->throwBadRequest();
         return;
     }
     $this->redirect(NetCommonsUrl::backToPageUrl());
 }
 /**
  * メール設定 登録,編集
  *
  * @return mixed
  */
 public function edit()
 {
     $this->backUrl = NetCommonsUrl::backToPageUrl(true);
     parent::edit();
 }
 /**
  * __setupViewParameters method
  *
  * @param array $registration 登録フォームデータ
  * @param string $backUrl BACKボタン押下時の戻るパス
  * @return void
  */
 private function __setupViewParameters($registration, $backUrl)
 {
     //$isPublished = $this->Registration->hasPublished($registration);
     // エラーメッセージはページ、項目、選択肢要素のそれぞれの場所に割り当てる
     $this->NetCommons->handleValidationError($this->Registration->validationErrors);
     $flatError = Hash::flatten($this->Registration->validationErrors);
     $newFlatError = array();
     foreach ($flatError as $key => $val) {
         if (preg_match('/^(.*)\\.(.*)\\.(.*)$/', $key, $matches)) {
             $newFlatError[$matches[1] . '.error_messages.' . $matches[2] . '.' . $matches[3]] = $val;
         }
     }
     $registration = Hash::merge($registration, Hash::expand($newFlatError));
     $registration = $this->NetCommonsTime->toUserDatetimeArray($registration, array('Registration.answer_start_period', 'Registration.answer_end_period', 'Registration.total_show_start_period'));
     $this->set('postUrl', array('url' => $this->_getActionUrl($this->action)));
     if ($this->layout == 'NetCommons.setting') {
         $this->set('cancelUrl', array('url' => NetCommonsUrl::backToIndexUrl('default_setting_action')));
     } else {
         $this->set('cancelUrl', array('url' => NetCommonsUrl::backToPageUrl()));
     }
     $this->set('deleteUrl', array('url' => $this->_getActionUrl('delete')));
     $this->set('questionTypeOptions', $this->Registrations->getQuestionTypeOptionsWithLabel());
     $this->set('newPageLabel', __d('registrations', 'page'));
     $this->set('newQuestionLabel', __d('registrations', 'New Question'));
     $this->set('newChoiceLabel', __d('registrations', 'new choice'));
     $this->set('newChoiceColumnLabel', __d('registrations', 'new column choice'));
     $this->set('newChoiceOtherLabel', __d('registrations', 'other choice'));
     // 都道府県データ
     $prefectures = $this->_getPrefectures();
     $this->set('prefectures', $prefectures);
     //$this->set('isPublished', $isPublished);
     $this->set('isPublished', false);
     $this->request->data = $registration;
     $this->request->data['Frame'] = Current::read('Frame');
     $this->request->data['Block'] = Current::read('Block');
     // メール通知設定
     $conditions = ['plugin_key' => 'registrations', 'block_key' => Current::read('Block.key')];
     $mailSetting = $this->MailSetting->find('first', ['conditions' => $conditions]);
     $this->set('mailSetting', $mailSetting);
 }
예제 #17
0
 /**
  * edit
  *
  * @return void
  */
 public function edit()
 {
     $this->__initRssReader();
     $comments = $this->Comment->getComments(array('plugin_key' => $this->params['plugin'], 'content_key' => $this->viewVars['rssReader']['key']));
     $data = array();
     if ($this->request->isPost()) {
         if (!($status = $this->NetCommonsWorkflow->parseStatus())) {
             return;
         }
         $data = Hash::merge($this->data, ['RssReader' => ['status' => $status]]);
         if (isset($this->viewVars['rssReader']['key'])) {
             $data['RssReader']['key'] = $this->viewVars['rssReader']['key'];
         }
         if ($data['RssReader']['url']) {
             $data['RssReaderItem'] = $this->RssReaderItem->serializeXmlToArray($data['RssReader']['url']);
         }
         $this->RssReader->saveRssReader($data);
         if ($this->NetCommons->handleValidationError($this->RssReader->validationErrors)) {
             //正常の場合
             $this->redirect(NetCommonsUrl::backToPageUrl());
             return;
         }
         $data['comments'] = null;
         unset($data['RssReader']['status']);
     }
     $data = $this->camelizeKeyRecursive(Hash::merge($data, array('comments' => $comments, 'contentStatus' => $this->viewVars['rssReader']['status'])));
     $results = Hash::merge($this->viewVars, $data);
     $this->set($results);
 }
 /**
  * delete action
  *
  * @return void
  */
 public function delete()
 {
     $this->request->allowMethod('post', 'delete');
     $userId = Current::read('User.id');
     $contentKey = $this->request->params['key'];
     $this->CircularNotice->initCircularNotice($this);
     // 権限チェック
     // ※回覧板の場合は承認ワークフローがなく、編集可能であれば削除を許可
     $content = $this->CircularNoticeContent->getCircularNoticeContent($contentKey, $userId);
     //if ($this->CircularNoticeContent->canDeleteWorkflowContent($content) === false) {
     if ($this->CircularNoticeContent->canEditWorkflowContent($content) === false) {
         return $this->throwBadRequest();
     }
     $this->CircularNoticeContent->deleteCircularNoticeContent($contentKey);
     $this->redirect(NetCommonsUrl::backToPageUrl());
 }
 /**
  * 親フォルダのURLを返す
  *
  * @param array $currentFolder 現在位置のCabinetFileデータ(フォルダ)
  * @param array $folderPath 現在位置までのTreeパス
  * @return null|string 親フォルダのURL
  */
 protected function _getParentFolderUrl($currentFolder, $folderPath)
 {
     // 親フォルダのTreeIDがルートフォルダのTreeIDと違うなら親フォルダは通常フォルダ
     $isRootFolder = $currentFolder['CabinetFileTree']['parent_id'] === null;
     $hasParentFolder = $currentFolder['CabinetFileTree']['parent_id'] != $folderPath[0]['CabinetFileTree']['id'];
     if ($isRootFolder) {
         // root folder
         $url = null;
     } elseif ($hasParentFolder) {
         // 親フォルダあり
         $nestCount = count($folderPath);
         $url = NetCommonsUrl::actionUrl(['key' => $folderPath[$nestCount - 2]['CabinetFile']['key'], 'block_id' => Current::read('Block.id'), 'frame_id' => Current::read('Frame.id')]);
     } else {
         // 親はキャビネット(ルートフォルダ)
         $url = NetCommonsUrl::backToPageUrl();
     }
     return $url;
 }
예제 #20
0
 /**
  * delete
  *
  * @return void
  */
 public function delete()
 {
     if (!$this->request->isDelete()) {
         $this->throwBadRequest();
         return;
     }
     $bbsArticle = $this->BbsArticle->getWorkflowContents('first', array('recursive' => 0, 'conditions' => array($this->BbsArticle->alias . '.bbs_id' => $this->viewVars['bbs']['id'], $this->BbsArticle->alias . '.key' => $this->data['BbsArticle']['key'])));
     //削除権限チェック
     if (!$this->BbsArticle->canDeleteWorkflowContent($bbsArticle)) {
         $this->throwBadRequest();
         return false;
     }
     //親記事の取得
     if ($bbsArticle['BbsArticleTree']['parent_id'] > 0) {
         $parentBbsArticle = $this->BbsArticle->getWorkflowContents('first', array('recursive' => 0, 'conditions' => array($this->BbsArticleTree->alias . '.id' => $bbsArticle['BbsArticleTree']['parent_id'])));
         if (!$parentBbsArticle) {
             $this->throwBadRequest();
             return false;
         }
     }
     if (!$this->BbsArticle->deleteBbsArticle($this->data)) {
         $this->throwBadRequest();
         return;
     }
     if (isset($parentBbsArticle)) {
         $url = NetCommonsUrl::actionUrl(array('controller' => $this->params['controller'], 'action' => 'view', 'frame_id' => $this->data['Frame']['id'], 'key' => $parentBbsArticle['BbsArticle']['key']));
     } else {
         $url = NetCommonsUrl::backToPageUrl();
     }
     $this->redirect($url);
 }
 /**
  * add registration display method
  *
  * @return void
  */
 public function add()
 {
     // NetCommonsお約束:投稿権限のある人物しかこのアクションにアクセスできない
     // それは$componentsの組み込みでallow => add => content_creatableで担保される
     // アクション処理内でチェックする必要はない
     unset($this->helpers['Blocks.BlockTabs']['blockTabs']['role_permissions']);
     unset($this->helpers['Blocks.BlockTabs']['blockTabs']['mail_settings']);
     unset($this->helpers['Blocks.BlockTabs']['blockTabs']['answer_list']);
     // POSTされたデータを読み取り
     if ($this->request->is('post')) {
         // Postデータをもとにした新登録フォームデータの取得をModelに依頼する
         $actionModel = ClassRegistry::init('Registrations.ActionRegistrationAdd', 'true');
         if ($registration = $actionModel->createRegistration($this->request->data)) {
             $tm = $this->_getRegistrationEditSessionIndex();
             // 作成中登録フォームデータをセッションキャッシュに書く
             $this->Session->write('Registrations.registrationEdit.' . $tm, $registration);
             // 次の画面へリダイレクト
             $urlArray = array('controller' => 'registration_edit', 'action' => 'edit_question', Current::read('Block.id'), 'frame_id' => Current::read('Frame.id'), 's_id' => $tm);
             if ($this->layout == 'NetCommons.setting') {
                 $urlArray['q_mode'] = 'setting';
             }
             $this->redirect(NetCommonsUrl::actionUrl($urlArray));
             return;
         } else {
             // データに不備があった場合
             $this->NetCommons->handleValidationError($actionModel->validationErrors);
         }
     } else {
         // 新規に登録フォームを作成するときは最初にブロックをつくっておく
         $frame['Frame'] = Current::read('Frame');
         $this->Registration->createBlock($frame);
     }
     // 過去データ 取り出し
     $conditions = Hash::remove($this->Registration->getBaseCondition(), 'block_id');
     $conditions['Block.room_id'] = Current::read('Room.id');
     $pastRegistrations = $this->Registration->find('all', array('fields' => array('id', 'title', 'status', 'answer_timing', 'answer_start_period', 'answer_end_period'), 'conditions' => $conditions, 'offset' => 0, 'limit' => 1000, 'recursive' => 0, 'order' => array('Registration.modified DESC')));
     $this->set('pastRegistrations', $pastRegistrations);
     if ($this->layout == 'NetCommons.setting') {
         $this->set('cancelUrl', NetCommonsUrl::backToIndexUrl('default_setting_action'));
     } else {
         $this->set('cancelUrl', NetCommonsUrl::backToPageUrl());
     }
     //
     // NetCommonsお約束:投稿のデータはrequest dataに設定する
     //
     $this->request->data['Frame'] = Current::read('Frame');
     $this->request->data['Block'] = Current::read('Block');
     // create_optionが未設定のときは初期値として「NEW」を設定する
     if (!$this->request->data('ActionRegistrationAdd.create_option')) {
         $this->request->data('ActionRegistrationAdd.create_option', RegistrationsComponent::REGISTRATION_CREATE_OPT_NEW);
     }
 }
예제 #22
0
 /**
  * delete
  *
  * @return void
  */
 public function delete()
 {
     if (!$this->request->isDelete()) {
         $this->throwBadRequest();
         return;
     }
     //データ取得
     $faqQuestion = $this->FaqQuestion->getWorkflowContents('first', array('recursive' => -1, 'conditions' => array($this->FaqQuestion->alias . '.faq_id' => $this->data['FaqQuestion']['faq_id'], $this->FaqQuestion->alias . '.key' => $this->data['FaqQuestion']['key'])));
     //削除権限チェック
     if (!$this->FaqQuestion->canDeleteWorkflowContent($faqQuestion)) {
         $this->throwBadRequest();
         return false;
     }
     if (!$this->FaqQuestion->deleteFaqQuestion($this->data)) {
         $this->throwBadRequest();
         return;
     }
     $this->redirect(NetCommonsUrl::backToPageUrl());
 }
 /**
  * Initialize circular notices
  *
  * @param Controller $controller コントローラー
  * @return bool
  */
 public function initCircularNotice(Controller $controller)
 {
     $this->controller = $controller;
     $userId = Current::read('User.id');
     if (!$userId) {
         if ($this->controller->action === 'index') {
             $this->controller->setAction('emptyRender');
         } else {
             $this->controller->redirect(NetCommonsUrl::backToPageUrl());
         }
         return false;
     }
     $this->controller->CircularNoticeSetting = ClassRegistry::init('CircularNotices.CircularNoticeSetting');
     $this->controller->CircularNoticeFrameSetting = ClassRegistry::init('CircularNotices.CircularNoticeFrameSetting');
     $frameId = Current::read('Frame.id');
     $setting = $this->controller->CircularNoticeSetting->getCircularNoticeSetting($frameId);
     if (!$setting) {
         if ($this->controller->action === 'index') {
             $this->controller->setAction('emptyRender');
         } else {
             $this->controller->redirect(NetCommonsUrl::backToPageUrl());
         }
         return false;
     }
     $this->controller->set('circularNoticeSetting', $setting);
     $frameKey = Current::read('Frame.key');
     $frameSetting = $this->controller->CircularNoticeFrameSetting->getCircularNoticeFrameSetting($frameKey);
     if (!$frameSetting) {
         if ($this->controller->action === 'index') {
             $this->controller->setAction('emptyRender');
         } else {
             $this->controller->redirect(NetCommonsUrl::backToPageUrl());
         }
         return false;
     }
     $this->controller->set('circularNoticeFrameSetting', $frameSetting);
     // 一般権限で回覧登録を行えるようにするため、ステータス定義をオーバーライド
     WorkflowBehavior::$statusesForEditor = array(CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_PUBLISHED, CircularNoticeComponent::CIRCULAR_NOTICE_CONTENT_STATUS_IN_DRAFT);
     return true;
 }