-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMultidatabaseMetadataSettingHelper.php
More file actions
185 lines (174 loc) · 4.25 KB
/
MultidatabaseMetadataSettingHelper.php
File metadata and controls
185 lines (174 loc) · 4.25 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
/**
* MultidatabaseMetadataSettingHelper Helper
* 汎用データベースコンテンツメタデータ設定ヘルパー
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Tomoyuki OHNO (Ricksoft Co., Ltd.) <ohno.tomoyuki@ricksoft.jp>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('AppHelper', 'View/Helper');
/**
* MultidatabaseMetadataSettingHelper Helper
*
* @author Tomoyuki OHNO (Ricksoft, Co., LTD.) <ohno.tomoyuki@ricksoft.jp>
* @package NetCommons\Multidatabase\View\Helper
*
*/
class MultidatabaseMetadataSettingHelper extends AppHelper {
/**
* 使用するHelpers
*
* @var array
*/
public $helpers = [
'NetCommons.Button',
'NetCommons.NetCommonsHtml',
'NetCommons.NetCommonsForm',
];
/**
* before render
*
* @param string $viewFile viewファイル
* @return void
* @link http://book.cakephp.org/2.0/ja/views/helpers.html#Helper::beforeRender Helper::beforeRender
*/
public function beforeRender($viewFile) {
parent::beforeRender($viewFile);
}
/**
* 汎用データベースメタデータレイアウト グループのHTMLを出力する(列)
*
* @param int $position グループ
* @param int $colSize 段の列数
* @return string HTML
*/
public function renderGroup($position, $colSize = 1) {
switch ($colSize) {
case 2:
// 2列レイアウト
$element = 'MultidatabaseBlocks/metadatas/edit_metadata_group_c2';
break;
default:
// 1列レイアウト
$element = 'MultidatabaseBlocks/metadatas/edit_metadata_group_c1';
}
switch ($position) {
case 0:
case 1:
case 2:
case 3:
return $this->_View->Element(
$element,
['gPos' => $position]
);
default:
return false;
}
}
/**
* 汎用データベースメタデータレイアウト アイテムのHTMLを出力する
*
* @param int $position グループ
* @return string HTML
*/
public function renderGroupItems($position) {
switch ($position) {
case 0:
case 1:
case 2:
case 3:
return $this->_View->Element(
'MultidatabaseBlocks/metadatas/edit_metadata_group_items',
['gPos' => $position]
);
default:
return false;
}
}
/**
* 汎用データベースメタデータレイアウト アイテムプロパティのHTMLを出力する
*
* @param int $position グループ
* @return string HTML
*/
public function renderGroupItemProperty($position) {
switch ($position) {
case 0:
case 1:
case 2:
case 3:
return $this->_View->Element(
'MultidatabaseBlocks/metadatas/edit_metadata_item_property',
['gPos' => $position]
);
default:
return false;
}
}
/**
* 汎用データベースメタデータレイアウト アイテムプロパティ 選択肢入力のHTMLを出力する
*
* @param int $position グループ
* @return string HTML
*/
public function renderGroupItemPropertySelections($position) {
switch ($position) {
case 0:
case 1:
case 2:
case 3:
return $this->_View->Element(
'MultidatabaseBlocks/metadatas/edit_metadata_item_property_selections',
['gPos' => $position]
);
default:
return false;
}
}
/**
* フィールド種別
*
* @return array
*/
public function fieldTypeList() {
return [
'text' => __d('multidatabases', 'Text'),
'textarea' => __d('multidatabases', 'Text area'),
'link' => __d('multidatabases', 'Link'),
'select' => __d('multidatabases', 'Select'),
'checkbox' => __d('multidatabases', 'Check box'),
'wysiwyg' => __d('multidatabases', 'WYSIWYG'),
'file' => __d('multidatabases', 'File'),
'image' => __d('multidatabases', 'Image'),
'autonumber' => __d('multidatabases', 'Auto number'),
'mail' => __d('multidatabases', 'E-mail address'),
'date' => __d('multidatabases', 'Date'),
'created' => __d('multidatabases', 'Create date'),
'updated' => __d('multidatabases', 'Update date'),
];
}
/**
* メタデータ設定項目一覧
*
* @return array
*/
public function fieldList() {
return [
'key',
'name',
'position',
'rank',
'type',
'selections',
'is_require',
'is_searchable',
'is_sortable',
'is_file_dl_require_auth',
'is_visible_list',
'is_visible_detail',
];
}
}