-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDefaultPageSettingsController.php
More file actions
86 lines (76 loc) · 2.14 KB
/
DefaultPageSettingsController.php
File metadata and controls
86 lines (76 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* DefaultPageSettings Controller
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('SiteManagerAppController', 'SiteManager.Controller');
App::uses('Room', 'Rooms.Model');
/**
* サイト管理【ページスタイル】
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\SiteManager\Controller
*/
class DefaultPageSettingsController extends SiteManagerAppController {
/**
* use helpers
*
* @var array
*/
public $helpers = array(
'ThemeSettings.ThemeSettings',
);
/**
* use model
*
* @var array
*/
public $uses = array(
'Rooms.Room',
'Rooms.RoomsLanguage',
'SiteManager.SiteSetting',
);
/**
* edit
*
* @return void
*/
public function edit() {
//ルームデータ取得
$rooms = $this->RoomsLanguage->find('all', array(
'recursive' => 0,
'conditions' => array(
'RoomsLanguage.room_id' => Room::getSpaceRooms(),
'RoomsLanguage.language_id' => Current::read('Language.id')
)
));
$this->set('rooms', Hash::combine($rooms, '{n}.RoomsLanguage.room_id', '{n}'));
$this->set('activeRoomId', Hash::get($this->request->pass, '0'));
//テーマセット
$themes = $this->SiteSetting->getThemes();
$this->set('themes', $themes);
//リクエストセット
if ($this->request->is('put')) {
$this->request->data = Hash::remove($this->request->data, 'save');
if ($this->Room->saveTheme($this->request->data)) {
//正常の場合
$this->NetCommons->setFlashNotification(__d('net_commons', 'Successfully saved.'), array(
'class' => 'success',
));
$this->redirect($this->referer());
} else {
$this->NetCommons->handleValidationError($this->Room->validationErrors);
}
} else {
$this->request->data['Room'] = $this->viewVars['rooms'][$this->viewVars['activeRoomId']]['Room'];
$this->theme = Hash::get(
$this->request->query, 'theme', Hash::get($this->request->data, 'Room.theme', $this->theme)
);
}
}
}