Skip to content

Commit

Permalink
Merge dcc1e18 into 23afb09
Browse files Browse the repository at this point in the history
  • Loading branch information
ohga21 committed Aug 29, 2018
2 parents 23afb09 + dcc1e18 commit 4c2d062
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Controller/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public function index() {
$paths = $this->params->params['pass'];
$path = implode('/', $paths);

$spacePermalink = Hash::get($this->request->params, 'spacePermalink', '');
$spacePermalink = isset($this->request->params['spacePermalink'])
? $this->request->params['spacePermalink']
: '';
$space = $this->Space->find('first', array(
'recursive' => -1,
'conditions' => array('permalink' => $spacePermalink, 'id !=' => Space::WHOLE_SITE_ID)
Expand Down
5 changes: 4 additions & 1 deletion Controller/PagesEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ public function beforeFilter() {
public function index() {
$this->__setRedirectUrl();
$rooms = $this->Room->children(Current::read('Room.id'), false, 'Room.id', 'Room.rght');
$roomIds = Hash::merge(array(Current::read('Room.id')), Hash::extract($rooms, '{n}.Room.id'));
$roomIds = [Current::read('Room.id')];
foreach ($rooms as $room) {
$roomIds[] = $room['Room']['id'];
}
$this->__prepareIndex($roomIds, []);
}

Expand Down
12 changes: 9 additions & 3 deletions Model/Behavior/GetPageBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ public function getPageIdsWithM17n(Model $model, $pageIds) {
* @param string $permalink Permalink
* @param string $spaceId Space id
* @return array
*
* 速度改善の修正に伴って発生したため抑制
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function getPageWithFrame(Model $model, $permalink, $spaceId = null) {
$model->loadModels([
Expand Down Expand Up @@ -220,7 +223,7 @@ public function getPageWithFrame(Model $model, $permalink, $spaceId = null) {
'PagesLanguage.language_id' => Current::read('Language.id'),
),
));
$result = Hash::merge($page, $pagesLanguages);
$result = $page + $pagesLanguages;

$pageContainers = $model->PageContainer->find('all', array(
'recursive' => -1,
Expand All @@ -229,7 +232,10 @@ public function getPageWithFrame(Model $model, $permalink, $spaceId = null) {
),
'order' => array('container_type' => 'asc'),
));
$result['PageContainer'] = Hash::extract($pageContainers, '{n}.PageContainer');
$result['PageContainer'] = [];
foreach ($pageContainers as $pageContainer) {
$result['PageContainer'][] = $pageContainer['PageContainer'];
}
foreach ($result['PageContainer'] as $i => $pageContainer) {
$pageContainer['Box'] = $model->Box->getBoxWithFrame($pageContainer['id']);
$result['PageContainer'][$i] = $pageContainer;
Expand Down Expand Up @@ -260,7 +266,7 @@ public function getTopPageId(Model $model) {
)
));

return Hash::get($room, 'Room.page_id_top');
return $room['Room']['page_id_top'];
}

/**
Expand Down
5 changes: 4 additions & 1 deletion View/Pages/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
* @copyright Copyright 2014, NetCommons Project
*/

$pageContainer = Hash::combine($page['PageContainer'], '{n}.container_type', '{n}');
$pageContainer = [];
foreach ($page['PageContainer'] as $item) {
$pageContainer[$item['container_type']] = $item;
}
echo $this->element('Boxes.render_boxes', array(
'boxes' => $pageContainer[Container::TYPE_MAIN]['Box'],
'containerType' => Container::TYPE_MAIN
Expand Down

0 comments on commit 4c2d062

Please sign in to comment.