Ejemplo n.º 1
0
 /**
  * beforeRender
  *
  * @param Controller $controller Controller
  * @return void
  * @throws NotFoundException
  */
 public function beforeRender(Controller $controller)
 {
     //RequestActionの場合、スキップする
     if (!empty($controller->request->params['requested'])) {
         return;
     }
     $this->controller = $controller;
     $this->__prepare();
     //pathからページデータ取得
     if (isset($this->controller->viewVars['page'])) {
         $page = $this->controller->viewVars['page'];
     } else {
         $this->Page = ClassRegistry::init('Pages.Page');
         $page = $this->Page->getPageWithFrame(Current::read('Page.permalink'));
         if (empty($page)) {
             throw new NotFoundException();
         }
     }
     if (Current::hasSettingMode() && Current::isSettingMode() && Current::permission('page_editable')) {
         $this->controller->request->data['ContainersPage'] = Hash::combine($page, 'Container.{n}.type', 'Container.{n}.ContainersPage');
     }
     ////cancelUrlをセット
     //if (! isset($this->controller->viewVars['cancelUrl'])) {
     //	$this->controller->set('cancelUrl', $page['Page']['permalink']);
     //}
     //Pluginデータ取得
     $pluginsRoom = ClassRegistry::init('PluginManager.PluginsRoom');
     $plugins = $pluginsRoom->getPlugins($page['Page']['room_id'], Current::read('Language.id'));
     //ページHelperにセット
     $results = array('containers' => Hash::combine($page['Container'], '{n}.type', '{n}'), 'boxes' => Hash::combine($page['Box'], '{n}.id', '{n}', '{n}.container_id'), 'plugins' => $plugins);
     $this->controller->helpers['Pages.PageLayout'] = $results;
 }
Ejemplo n.º 2
0
 /**
  * ブロックのステータスラベルを表示
  *
  * @param null|bool $isSetting 強制的にセッティングモード
  * @return string HTML
  */
 public function getBlockStatus($isSetting = null)
 {
     if (!Current::permission('block_editable')) {
         return '';
     }
     if (!isset($isSetting)) {
         $isSetting = Current::isSettingMode();
     }
     if (!$isSetting || !Current::read('Block.id')) {
         return '';
     }
     $block = Current::read('Block', array());
     $publicType = Hash::get($block, 'public_type');
     if ($publicType === Block::TYPE_PUBLIC) {
         return '';
     }
     $html = $this->__getBlockStatus();
     return $html;
 }
Ejemplo n.º 3
0
 /**
  * index method
  *
  * @throws NotFoundException
  * @return void
  */
 public function index()
 {
     if (Current::isSettingMode() && !Current::permission('page_editable')) {
         $paths = func_get_args();
         $path = implode('/', $paths);
         $this->redirect('/' . $path);
         return;
     }
     $paths = func_get_args();
     $path = implode('/', $paths);
     $page = $this->Page->getPageWithFrame($path);
     if (empty($page)) {
         throw new NotFoundException();
     }
     $this->set('page', $page);
     $page['Container'] = Hash::combine($page['Container'], '{n}.type', '{n}');
     $page['Box'] = Hash::combine($page['Box'], '{n}.id', '{n}', '{n}.container_id');
     $page['Container'] = array(Container::TYPE_MAIN => $page['Container'][Container::TYPE_MAIN]);
     $this->set('pageMainContainer', $page);
 }
Ejemplo n.º 4
0
 /**
  * The layout have container
  *
  * @param string $containerType Container type.
  *    e.g.) Container::TYPE_HEADER or TYPE_MAJOR or TYPE_MAIN or TYPE_MINOR or TYPE_FOOTER
  * @return bool The layout have container
  */
 public function hasContainer($containerType)
 {
     if (!($result = isset($this->__containers[$containerType]) && $this->__containers[$containerType]['ContainersPage']['is_published'])) {
         return false;
     }
     if (!Current::isSettingMode()) {
         $box = $this->getBox($containerType);
         $frames = Hash::combine($box, '{n}.Frame.{n}.id', '{n}.Frame.{n}');
         $result = count($frames);
     }
     return $result;
 }
Ejemplo n.º 5
0
<?php

/**
 * Registrations routes configuration
 *
 * @author Noriko Arai <*****@*****.**>
 * @author Shohei Nakajima <*****@*****.**>
 * @link http://www.netcommons.org NetCommons Project
 * @license http://www.netcommons.org/license.txt NetCommons License
 * @copyright Copyright 2014, NetCommons Project
 */
App::uses('Current', 'NetCommons.Utility');
$params = array('plugin' => 'registrations', 'controller' => 'registration_edit');
$options = array('block_id' => '[0-9]+', 'key' => '[a-zA-Z0-9_]+');
if (Current::isSettingMode()) {
    Router::connect('/' . Current::SETTING_MODE_WORD . '/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/:key/*', $params, $options);
    Router::connect('/' . Current::SETTING_MODE_WORD . '/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/*', $params, $options);
}
Router::connect('/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/:key/*', $params, $options);
Router::connect('/' . $params['plugin'] . '/' . $params['controller'] . '/:action/:block_id/*', $params, $options);
Ejemplo n.º 6
0
 /**
  * Check setting mode
  *
  * @return bool
  */
 public static function isSettingMode()
 {
     return Current::isSettingMode();
 }