Version Notes
Improvement
- Cleaned up the UMC code and the generated code. Now all files (almost) follow the zend coding standards.
Features
- Support for signed int attributes/fields
- Generating modman file
- Support for canonical URL in generated module
Bug fixes
- Removed calls to deprecated method htmlEscape
- Fixed wrong helper alias in Yes/No attribute display
- Fixed wrong display of multiselect attribute on frontend
- Fixed 2 status fields generated in the setup file
Download this release
Release Info
Developer | Marius |
Extension | Ultimate_ModuleCreator |
Version | 1.9.5.0 |
Comparing to | |
See all releases |
Code changes from version 1.9.4.4 to 1.9.5.0
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator.php +40 -38
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit.php +316 -260
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Form.php +51 -42
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Entities.php +105 -90
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Entities/Entity.php +68 -64
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Entities/Entity/Attribute.php +70 -66
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Help.php +367 -314
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Help/Fieldset.php +82 -78
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Relation.php +90 -77
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Settings.php +101 -89
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tabs.php +44 -42
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Grid.php +207 -174
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Grid/Column/Renderer/Download.php +83 -75
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Menu.php +108 -95
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Abstract.php +141 -128
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Attribute.php +38 -36
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Entity.php +38 -36
- app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Settings.php +38 -36
- app/code/community/Ultimate/ModuleCreator/Exception.php +21 -21
- app/code/community/Ultimate/ModuleCreator/Helper/Data.php +561 -487
- app/code/community/Ultimate/ModuleCreator/Model/Abstract.php +127 -108
- app/code/community/Ultimate/ModuleCreator/Model/Attribute.php +759 -628
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Abstract.php +510 -390
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Country.php +180 -122
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Decimal.php +54 -47
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown.php +412 -312
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Abstract.php +101 -87
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Category.php +33 -32
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Custom.php +133 -123
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Customer.php +33 -32
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Product.php +175 -157
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/File.php +161 -128
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Image.php +155 -122
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Int.php +69 -58
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Multiselect.php +193 -144
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Signedint.php +33 -0
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Text.php +48 -44
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Textarea.php +117 -97
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Timestamp.php +144 -111
- app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Yesno.php +200 -156
- app/code/community/Ultimate/ModuleCreator/Model/Config.php +81 -71
- app/code/community/Ultimate/ModuleCreator/Model/Entity.php +3502 -2992
- app/code/community/Ultimate/ModuleCreator/Model/Entity/Type/Abstract.php +644 -495
- app/code/community/Ultimate/ModuleCreator/Model/Entity/Type/Eav.php +971 -783
- app/code/community/Ultimate/ModuleCreator/Model/Entity/Type/Flat.php +28 -28
- app/code/community/Ultimate/ModuleCreator/Model/Module.php +2326 -1915
- app/code/community/Ultimate/ModuleCreator/Model/Module/Collection.php +102 -96
- app/code/community/Ultimate/ModuleCreator/Model/Relation.php +253 -211
- app/code/community/Ultimate/ModuleCreator/Model/Source/Attribute/Scope.php +64 -60
- app/code/community/Ultimate/ModuleCreator/Model/Source/Attribute/Type.php +67 -64
- app/code/community/Ultimate/ModuleCreator/Model/Source/Attribute/Value/Source.php +59 -55
- app/code/community/Ultimate/ModuleCreator/Model/Source/Codepool.php +76 -64
- app/code/community/Ultimate/ModuleCreator/Model/Source/Entity/Layout.php +57 -53
- app/code/community/Ultimate/ModuleCreator/Model/Source/Entity/Menu.php +62 -55
- app/code/community/Ultimate/ModuleCreator/Model/Source/Entity/Type.php +58 -53
- app/code/community/Ultimate/ModuleCreator/Model/Source/Install.php +83 -74
- app/code/community/Ultimate/ModuleCreator/Model/Writer.php +91 -83
- app/code/community/Ultimate/ModuleCreator/controllers/Adminhtml/ModulecreatorController.php +80 -262
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator.php
CHANGED
@@ -1,38 +1,40 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* main admin block - grid container.
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator
|
25 |
-
|
26 |
-
/**
|
27 |
-
* constructor
|
28 |
-
*
|
29 |
-
* @
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
$this->
|
35 |
-
|
36 |
-
$this->
|
37 |
-
|
38 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* main admin block - grid container.
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator extends Mage_Adminhtml_Block_Widget_Grid_Container
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* constructor
|
28 |
+
*
|
29 |
+
* @access public
|
30 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
31 |
+
*/
|
32 |
+
public function __construct()
|
33 |
+
{
|
34 |
+
$this->_controller = 'adminhtml_modulecreator';
|
35 |
+
$this->_blockGroup = 'modulecreator';
|
36 |
+
$this->_headerText = Mage::helper('modulecreator')->__('Manage modules');
|
37 |
+
parent::__construct();
|
38 |
+
$this->_updateButton('add', 'label', Mage::helper('modulecreator')->__('Create new module'));
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit.php
CHANGED
@@ -1,260 +1,316 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* module edit block
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit
|
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 |
-
$this->
|
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 |
-
* get the
|
167 |
-
*
|
168 |
-
* @
|
169 |
-
* @
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
*
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* module edit block
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* config path to expanded/collapsed fieldsets
|
29 |
+
*/
|
30 |
+
const XML_FIELDSET_COLLAPSED = 'modulecreator/general/collapsed';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* construct
|
34 |
+
*
|
35 |
+
* @access public
|
36 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
37 |
+
*/
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
parent::__construct();
|
41 |
+
$this->_blockGroup = 'adminhtml_modulecreator';
|
42 |
+
$this->_controller = 'modulecreator';
|
43 |
+
$this->setTemplate('ultimate_modulecreator/edit.phtml');
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* get current module
|
48 |
+
*
|
49 |
+
* @access public
|
50 |
+
* @return mixed
|
51 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
52 |
+
*/
|
53 |
+
public function getModule()
|
54 |
+
{
|
55 |
+
return Mage::registry('current_module');
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* get header text
|
60 |
+
*
|
61 |
+
* @access public
|
62 |
+
* @return string
|
63 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
64 |
+
*/
|
65 |
+
public function getHeaderText()
|
66 |
+
{
|
67 |
+
$module = $this->getModule();
|
68 |
+
if ($module) {
|
69 |
+
return Mage::helper('modulecreator')->__('Edit module "%s"', $module->getExtensionName());
|
70 |
+
}
|
71 |
+
return Mage::helper('modulecreator')->__('Create Module');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* prepare the layout
|
76 |
+
*
|
77 |
+
* @access protected
|
78 |
+
* @return Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit
|
79 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
80 |
+
*/
|
81 |
+
protected function _prepareLayout()
|
82 |
+
{
|
83 |
+
/** @var Mage_Adminhtml_Block_Widget_Button $backButton */
|
84 |
+
$backButton = $this->getLayout()
|
85 |
+
->createBlock('adminhtml/widget_button')
|
86 |
+
->setData(
|
87 |
+
array(
|
88 |
+
'label' => Mage::helper('modulecreator')->__('Back'),
|
89 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/').'\')',
|
90 |
+
'class' => 'back'
|
91 |
+
)
|
92 |
+
);
|
93 |
+
$this->setChild('back_button', $backButton);
|
94 |
+
|
95 |
+
/** @var Mage_Adminhtml_Block_Widget_Button $resetButton */
|
96 |
+
$resetButton = $this->getLayout()
|
97 |
+
->createBlock('adminhtml/widget_button')
|
98 |
+
->setData(
|
99 |
+
array(
|
100 |
+
'label' => Mage::helper('modulecreator')->__('Reset'),
|
101 |
+
'onclick' => 'setLocation(\''.$this->getUrl('*/*/*', array('_current'=>true)).'\')'
|
102 |
+
)
|
103 |
+
);
|
104 |
+
$this->setChild('reset_button', $resetButton);
|
105 |
+
|
106 |
+
/** @var Mage_Adminhtml_Block_Widget_Button $saveButton */
|
107 |
+
$saveButton = $this->getLayout()
|
108 |
+
->createBlock('adminhtml/widget_button')
|
109 |
+
->setData(
|
110 |
+
array(
|
111 |
+
'label' => Mage::helper('modulecreator')->__('Save'),
|
112 |
+
'onclick' => 'moduleForm.submit()',
|
113 |
+
'class' => 'save'
|
114 |
+
)
|
115 |
+
);
|
116 |
+
$this->setChild('save_button', $saveButton);
|
117 |
+
|
118 |
+
/** @var Mage_Adminhtml_Block_Widget_Button $saveEditButton */
|
119 |
+
$saveEditButton = $this->getLayout()
|
120 |
+
->createBlock('adminhtml/widget_button')
|
121 |
+
->setData(
|
122 |
+
array(
|
123 |
+
'label' => Mage::helper('modulecreator')->__('Save and Continue Edit'),
|
124 |
+
'onclick' => 'saveAndContinueEdit(\''.$this->getSaveAndContinueUrl().'\')',
|
125 |
+
'class' => 'save'
|
126 |
+
)
|
127 |
+
);
|
128 |
+
$this->setChild('save_and_edit_button', $saveEditButton);
|
129 |
+
|
130 |
+
/** @var Mage_Adminhtml_Block_Widget_Button $addEntityButton */
|
131 |
+
$addEntityButton = $this->getLayout()
|
132 |
+
->createBlock('adminhtml/widget_button')
|
133 |
+
->setData(
|
134 |
+
array(
|
135 |
+
'label' => Mage::helper('modulecreator')->__('Add entity'),
|
136 |
+
'class' => 'add add-entity'
|
137 |
+
)
|
138 |
+
);
|
139 |
+
$this->setChild('add-entity', $addEntityButton);
|
140 |
+
|
141 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity $block */
|
142 |
+
$block = Mage::app()->getLayout()
|
143 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_entities_entity');
|
144 |
+
$block->setTemplate('ultimate_modulecreator/edit/tab/entities/entity.phtml');
|
145 |
+
$block->setDefaultEntity();
|
146 |
+
$block->setIncrement('{{entity_id}}');
|
147 |
+
$this->setChild('entity-template', $block);
|
148 |
+
|
149 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute $block */
|
150 |
+
$block = Mage::app()->getLayout()
|
151 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_entities_entity_attribute');
|
152 |
+
$block->setTemplate('ultimate_modulecreator/edit/tab/entities/entity/attribute.phtml');
|
153 |
+
$block->setDefaultAttributeInstance();
|
154 |
+
$block->setIncrement('{{attribute_id}}');
|
155 |
+
$block->setEntityId('{{entity_id}}');
|
156 |
+
$this->setChild('attribute-template', $block);
|
157 |
+
|
158 |
+
$this->setChild(
|
159 |
+
'menu-selector',
|
160 |
+
Mage::app()->getLayout()->createBlock('modulecreator/adminhtml_modulecreator_menu')
|
161 |
+
);
|
162 |
+
return $this;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* get the back button html
|
167 |
+
*
|
168 |
+
* @access public
|
169 |
+
* @return string
|
170 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
171 |
+
*/
|
172 |
+
public function getBackButtonHtml()
|
173 |
+
{
|
174 |
+
return $this->getChildHtml('back_button');
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* get the cancel button html
|
179 |
+
*
|
180 |
+
* @access public
|
181 |
+
* @return string
|
182 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
183 |
+
*/
|
184 |
+
public function getCancelButtonHtml()
|
185 |
+
{
|
186 |
+
return $this->getChildHtml('reset_button');
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* get the save button html
|
191 |
+
*
|
192 |
+
* @access public
|
193 |
+
* @return string
|
194 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
195 |
+
*/
|
196 |
+
public function getSaveButtonHtml()
|
197 |
+
{
|
198 |
+
return $this->getChildHtml('save_button');
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* get the save and continue edit button html
|
203 |
+
*
|
204 |
+
* @access public
|
205 |
+
* @return string
|
206 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
207 |
+
*/
|
208 |
+
public function getSaveAndEditButtonHtml()
|
209 |
+
{
|
210 |
+
return $this->getChildHtml('save_and_edit_button');
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* get html for "add entity" button
|
215 |
+
*
|
216 |
+
* @access public
|
217 |
+
* @return string
|
218 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
219 |
+
*/
|
220 |
+
public function getAddEntityButtonHtml()
|
221 |
+
{
|
222 |
+
return $this->getChildHtml('add-entity');
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* get the save and continue edit url
|
227 |
+
*
|
228 |
+
* @access public
|
229 |
+
* @return string
|
230 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
231 |
+
*/
|
232 |
+
public function getSaveAndContinueUrl()
|
233 |
+
{
|
234 |
+
return $this->getUrl(
|
235 |
+
'*/*/save',
|
236 |
+
array(
|
237 |
+
'_current' => true,
|
238 |
+
'back' => 'edit',
|
239 |
+
'tab'=> '{{tab_id}}',
|
240 |
+
'active_tab' => null
|
241 |
+
)
|
242 |
+
);
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* get the validation url
|
247 |
+
*
|
248 |
+
* @access public
|
249 |
+
* @return string
|
250 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
251 |
+
*/
|
252 |
+
public function getValidationUrl()
|
253 |
+
{
|
254 |
+
return $this->getUrl('*/*/validate', array('_current'=>true));
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* check if edit mode is read only
|
259 |
+
*
|
260 |
+
* @access public
|
261 |
+
* @return bool
|
262 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
263 |
+
*/
|
264 |
+
public function isReadonly()
|
265 |
+
{
|
266 |
+
$module = $this->getModule();
|
267 |
+
if (!$module) {
|
268 |
+
return false;
|
269 |
+
}
|
270 |
+
if (Mage::registry('module_read_only')) {
|
271 |
+
return true;
|
272 |
+
}
|
273 |
+
if ($module = Mage::registry('current_module')) {
|
274 |
+
$installedModules = array_keys((array)Mage::getConfig()->getNode('modules')->children());
|
275 |
+
foreach ($installedModules as $installed) {
|
276 |
+
if ($installed == $module->getExtensionName()) {
|
277 |
+
Mage::register('module_read_only', true);
|
278 |
+
return true;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
}
|
282 |
+
return false;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* get select for relations
|
287 |
+
*
|
288 |
+
* @access public
|
289 |
+
* @return string
|
290 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
291 |
+
*/
|
292 |
+
public function getRelationSelectTemplate()
|
293 |
+
{
|
294 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
295 |
+
$helper = Mage::helper('modulecreator');
|
296 |
+
$types = $helper->getRelationTypes();
|
297 |
+
$template = '<select class="relation-select" name="relation[#{e1}][#{e2}]" id="relation_#{e1}_#{e2}">';
|
298 |
+
foreach ($types as $type=>$values) {
|
299 |
+
$template .= '<option value="'.$type.'">'.(string)$values->label.'</option>';
|
300 |
+
}
|
301 |
+
$template .= '</select>';
|
302 |
+
return $template;
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* check if fieldsets should be collapsed
|
307 |
+
*
|
308 |
+
* @access public
|
309 |
+
* @return int
|
310 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
311 |
+
*/
|
312 |
+
public function getShowFieldsetsCollapsed()
|
313 |
+
{
|
314 |
+
return (int)Mage::getStoreConfigFlag(self::XML_FIELDSET_COLLAPSED);
|
315 |
+
}
|
316 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Form.php
CHANGED
@@ -1,42 +1,51 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* admin form block
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Form
|
25 |
-
|
26 |
-
/**
|
27 |
-
* prepare form
|
28 |
-
*
|
29 |
-
* @
|
30 |
-
* @
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* admin form block
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* prepare form
|
28 |
+
*
|
29 |
+
* @access protected
|
30 |
+
* @return Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Form
|
31 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
32 |
+
*/
|
33 |
+
protected function _prepareForm()
|
34 |
+
{
|
35 |
+
$form = new Varien_Data_Form(
|
36 |
+
array(
|
37 |
+
'id' => 'edit_form',
|
38 |
+
'action' => $this->getUrl(
|
39 |
+
'*/modulecreator/save',
|
40 |
+
array(
|
41 |
+
'id' => $this->getRequest()->getParam('id')
|
42 |
+
)
|
43 |
+
),
|
44 |
+
'method' => 'post'
|
45 |
+
)
|
46 |
+
);
|
47 |
+
$form->setUseContainer(true);
|
48 |
+
$this->setForm($form);
|
49 |
+
return parent::_prepareForm();
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Entities.php
CHANGED
@@ -1,90 +1,105 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* entities tab
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Entities
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
* constructor
|
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 |
-
* @access public
|
69 |
-
* @return boolean
|
70 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
71 |
-
*/
|
72 |
-
public function
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
*
|
79 |
-
*
|
80 |
-
* @
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* entities tab
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Entities extends Mage_Adminhtml_Block_Widget implements
|
26 |
+
Mage_Adminhtml_Block_Widget_Tab_Interface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* constructor
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @return void
|
33 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
34 |
+
*/
|
35 |
+
public function _construct()
|
36 |
+
{
|
37 |
+
parent::_construct();
|
38 |
+
$this->setTemplate('ultimate_modulecreator/edit/tab/entities.phtml');
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Return Tab label
|
43 |
+
*
|
44 |
+
* @access public
|
45 |
+
* @return string
|
46 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
47 |
+
*/
|
48 |
+
public function getTabLabel()
|
49 |
+
{
|
50 |
+
return Mage::helper('modulecreator')->__('Entities');
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Return Tab title
|
55 |
+
*
|
56 |
+
* @access public
|
57 |
+
* @return string
|
58 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
59 |
+
*/
|
60 |
+
public function getTabTitle()
|
61 |
+
{
|
62 |
+
return Mage::helper('modulecreator')->__('Entities');
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Can show tab in tabs
|
67 |
+
*
|
68 |
+
* @access public
|
69 |
+
* @return boolean
|
70 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
71 |
+
*/
|
72 |
+
public function canShowTab()
|
73 |
+
{
|
74 |
+
return true;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Tab is hidden
|
79 |
+
*
|
80 |
+
* @access public
|
81 |
+
* @return boolean
|
82 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
83 |
+
*/
|
84 |
+
public function isHidden()
|
85 |
+
{
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* get the list of entities
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @return array()
|
94 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
95 |
+
*/
|
96 |
+
public function getEntities()
|
97 |
+
{
|
98 |
+
/** @var null|Ultimate_ModuleCreator_Model_Module $module */
|
99 |
+
$module = Mage::registry('current_module');
|
100 |
+
if ($module) {
|
101 |
+
return $module->getEntities();
|
102 |
+
}
|
103 |
+
return array();
|
104 |
+
}
|
105 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Entities/Entity.php
CHANGED
@@ -1,64 +1,68 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* add entity form
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity setEntity()
|
27 |
-
* @method Varien_Object getEntity()
|
28 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity setIncrement()
|
29 |
-
* @method int getIncrement()
|
30 |
-
*/
|
31 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity
|
32 |
-
|
33 |
-
/**
|
34 |
-
* prepare entity form
|
35 |
-
*
|
36 |
-
* @
|
37 |
-
* @
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
$
|
44 |
-
$form->
|
45 |
-
$this->
|
46 |
-
$form->
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
*
|
54 |
-
*
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
$
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* add entity form
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
/**
|
26 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity setEntity()
|
27 |
+
* @method Varien_Object getEntity()
|
28 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity setIncrement()
|
29 |
+
* @method int getIncrement()
|
30 |
+
*/
|
31 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity extends Mage_Adminhtml_Block_Widget_Form
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* prepare entity form
|
35 |
+
*
|
36 |
+
* @access protected
|
37 |
+
* @return string
|
38 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
39 |
+
*/
|
40 |
+
protected function _prepareForm()
|
41 |
+
{
|
42 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
43 |
+
$helper = Mage::helper('modulecreator');
|
44 |
+
$form = $helper->getXmlForm('entity');
|
45 |
+
$form->setHtmlIdPrefix('entity_'.$this->getIncrement().'_');
|
46 |
+
$form->addFieldNameSuffix('entity['.$this->getIncrement().']');
|
47 |
+
$this->setForm($form);
|
48 |
+
$form->addValues($this->getEntity()->getData());
|
49 |
+
return parent::_prepareForm();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* set an entity with default values
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @return Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity
|
57 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
58 |
+
*/
|
59 |
+
public function setDefaultEntity()
|
60 |
+
{
|
61 |
+
/** @var Ultimate_ModuleCreator_Model_Entity $entity */
|
62 |
+
$entity = Mage::getModel('modulecreator/entity');
|
63 |
+
$settings = Mage::getStoreConfig(Ultimate_ModuleCreator_Helper_Data::XML_ENTITY_CONFIG_PATH);
|
64 |
+
$entity->addData($settings);
|
65 |
+
$this->setEntity($entity);
|
66 |
+
return $this;
|
67 |
+
}
|
68 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Entities/Entity/Attribute.php
CHANGED
@@ -1,66 +1,70 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* add attribute form
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* @method Varien_Object getAttributeInstance()
|
27 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute setAttributeInstance()
|
28 |
-
* @method string getEntityId()
|
29 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute setIncrement()
|
30 |
-
* @method int getIncrement()
|
31 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute setEntityId()
|
32 |
-
*/
|
33 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute
|
34 |
-
|
35 |
-
/**
|
36 |
-
* prepare attribute form
|
37 |
-
*
|
38 |
-
* @
|
39 |
-
* @
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
$
|
46 |
-
$form->
|
47 |
-
$this->
|
48 |
-
$form->
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
$
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* add attribute form
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
/**
|
26 |
+
* @method Varien_Object getAttributeInstance()
|
27 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute setAttributeInstance()
|
28 |
+
* @method string getEntityId()
|
29 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute setIncrement()
|
30 |
+
* @method int getIncrement()
|
31 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute setEntityId()
|
32 |
+
*/
|
33 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity_Attribute extends Mage_Adminhtml_Block_Widget_Form
|
34 |
+
{
|
35 |
+
/**
|
36 |
+
* prepare attribute form
|
37 |
+
*
|
38 |
+
* @access protected
|
39 |
+
* @return string
|
40 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
41 |
+
*/
|
42 |
+
protected function _prepareForm()
|
43 |
+
{
|
44 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
45 |
+
$helper = Mage::helper('modulecreator');
|
46 |
+
$form = $helper->getXmlForm('attribute', false);
|
47 |
+
$form->setHtmlIdPrefix('attribute_'.$this->getEntityId().'_'.$this->getIncrement().'_');
|
48 |
+
$form->addFieldNameSuffix('entity['.$this->getEntityId().'][attributes]['.$this->getIncrement().']');
|
49 |
+
$this->setForm($form);
|
50 |
+
$form->addValues($this->getAttributeInstance()->getData());
|
51 |
+
return parent::_prepareForm();
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* set an entity with default values
|
56 |
+
*
|
57 |
+
* @access public
|
58 |
+
* @return Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Entities_Entity
|
59 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
60 |
+
*/
|
61 |
+
public function setDefaultAttributeInstance()
|
62 |
+
{
|
63 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attribute */
|
64 |
+
$attribute = Mage::getModel('modulecreator/attribute');
|
65 |
+
$settings = Mage::getStoreConfig(Ultimate_ModuleCreator_Helper_Data::XML_ATTRIBUTE_CONFIG_PATH);
|
66 |
+
$attribute->addData($settings);
|
67 |
+
$this->setAttributeInstance($attribute);
|
68 |
+
return $this;
|
69 |
+
}
|
70 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Help.php
CHANGED
@@ -1,314 +1,367 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* help tab block
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help
|
25 |
-
|
26 |
-
|
27 |
-
/**
|
28 |
-
* constructor
|
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 |
-
* @access public
|
68 |
-
* @return boolean
|
69 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
70 |
-
*/
|
71 |
-
public function
|
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 |
-
'header'=>Mage::helper('modulecreator')->__('
|
118 |
-
'key'
|
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 |
-
'field_types'=> array(
|
162 |
-
'label'=> Mage::helper('modulecreator')->__('
|
163 |
-
'fields' => $helper->
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
$
|
169 |
-
->
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
$
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
$
|
194 |
-
|
195 |
-
$
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
->
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
$
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
'
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
'
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
'
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
$
|
266 |
-
$
|
267 |
-
$
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
'
|
280 |
-
'
|
281 |
-
'
|
282 |
-
)
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
'
|
296 |
-
'
|
297 |
-
'
|
298 |
-
|
299 |
-
|
300 |
-
'
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
$this->setChild('
|
312 |
-
|
313 |
-
|
314 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* help tab block
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help extends Mage_Adminhtml_Block_Widget_Form implements
|
25 |
+
Mage_Adminhtml_Block_Widget_Tab_Interface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* constructor
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return void
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function _construct()
|
35 |
+
{
|
36 |
+
parent::_construct();
|
37 |
+
$this->setTemplate('ultimate_modulecreator/edit/tab/help.phtml');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Return Tab label
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @return string
|
45 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
46 |
+
*/
|
47 |
+
public function getTabLabel()
|
48 |
+
{
|
49 |
+
return Mage::helper('modulecreator')->__('Help');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Return Tab title
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @return string
|
57 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
58 |
+
*/
|
59 |
+
public function getTabTitle()
|
60 |
+
{
|
61 |
+
return Mage::helper('modulecreator')->__('Help');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Can show tab in tabs
|
66 |
+
*
|
67 |
+
* @access public
|
68 |
+
* @return boolean
|
69 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
70 |
+
*/
|
71 |
+
public function canShowTab()
|
72 |
+
{
|
73 |
+
return true;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Tab is hidden
|
78 |
+
*
|
79 |
+
* @access public
|
80 |
+
* @return boolean
|
81 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
82 |
+
*/
|
83 |
+
public function isHidden()
|
84 |
+
{
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
/**
|
88 |
+
* get UMC version
|
89 |
+
*
|
90 |
+
* @access public
|
91 |
+
* @return string
|
92 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
93 |
+
*/
|
94 |
+
public function getVersion()
|
95 |
+
{
|
96 |
+
$version = (string)Mage::app()->getConfig()->getNode('modules/Ultimate_ModuleCreator/version');
|
97 |
+
$build = (string)Mage::app()->getConfig()->getNode('modules/Ultimate_ModuleCreator/build');
|
98 |
+
if ($build) {
|
99 |
+
$version .= ' - '.$build;
|
100 |
+
}
|
101 |
+
return $version;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* prepare tab layout
|
106 |
+
*
|
107 |
+
* @return Mage_Core_Block_Abstract
|
108 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
109 |
+
*/
|
110 |
+
protected function _prepareLayout()
|
111 |
+
{
|
112 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
113 |
+
$helper = Mage::helper('modulecreator');
|
114 |
+
|
115 |
+
$columns = array(
|
116 |
+
'label' => array(
|
117 |
+
'header' => Mage::helper('modulecreator')->__('Field'),
|
118 |
+
'key' => 'label'
|
119 |
+
),
|
120 |
+
'type' => array(
|
121 |
+
'header' => Mage::helper('modulecreator')->__('Type'),
|
122 |
+
'key' => 'type'
|
123 |
+
),
|
124 |
+
'required' => array(
|
125 |
+
'header' => Mage::helper('modulecreator')->__('Required'),
|
126 |
+
'type' => 'bool',
|
127 |
+
'key' => 'required'
|
128 |
+
),
|
129 |
+
'system' => array(
|
130 |
+
'header' => Mage::helper('modulecreator')->__('Has default'),
|
131 |
+
'type' => 'bool',
|
132 |
+
'key' => 'system'
|
133 |
+
),
|
134 |
+
'tooltip' => array(
|
135 |
+
'header' => Mage::helper('modulecreator')->__('Description'),
|
136 |
+
'key' => 'tooltip'
|
137 |
+
),
|
138 |
+
);
|
139 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $settingsTabHelp */
|
140 |
+
$settingsTabHelp = $this->getLayout()
|
141 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
142 |
+
$settingsTabHelp->setFieldsets($helper->getFieldsetXmlData('settings'))
|
143 |
+
->setColumns($columns)
|
144 |
+
->setDescription(Mage::helper('modulecreator')->__('General settings tab.'));
|
145 |
+
|
146 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $entityTabHelp */
|
147 |
+
$entityTabHelp = $this->getLayout()
|
148 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
149 |
+
$entityTabHelp->setFieldsets($helper->getFieldsetXmlData('entity'))
|
150 |
+
->setColumns($columns)
|
151 |
+
->setDescription(Mage::helper('modulecreator')->__('Entity management.'));
|
152 |
+
|
153 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $attributeTabHelp */
|
154 |
+
$attributeTabHelp = $this->getLayout()
|
155 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
156 |
+
$attributeTabHelp->setFieldsets($helper->getFieldsetXmlData('attribute'))
|
157 |
+
->setColumns($columns)
|
158 |
+
->setDescription(Mage::helper('modulecreator')->__('Field/Attribute management.'));
|
159 |
+
|
160 |
+
$fieldTypes = array(
|
161 |
+
'field_types' => array(
|
162 |
+
'label' => Mage::helper('modulecreator')->__('Supported field / attribute types'),
|
163 |
+
'fields' => $helper->getAttributeTypes()
|
164 |
+
)
|
165 |
+
);
|
166 |
+
|
167 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $fieldTypesHelp */
|
168 |
+
$fieldTypesHelp = $this->getLayout()
|
169 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
170 |
+
$fieldTypesHelp->setFieldsets($fieldTypes)
|
171 |
+
->setColumns(
|
172 |
+
array(
|
173 |
+
'label' => array(
|
174 |
+
'header'=>Mage::helper('modulecreator')->__('Field'),
|
175 |
+
'key' =>'label'
|
176 |
+
),
|
177 |
+
'allow_is_name' => array(
|
178 |
+
'header'=>Mage::helper('modulecreator')->__('Can behave as name'),
|
179 |
+
'key' =>'allow_is_name',
|
180 |
+
'type' => 'bool'
|
181 |
+
),
|
182 |
+
)
|
183 |
+
)
|
184 |
+
->setDescription(Mage::helper('modulecreator')->__('Supported field / attribute types'));
|
185 |
+
$relationTypes = array(
|
186 |
+
'field_types'=> array(
|
187 |
+
'label'=> Mage::helper('modulecreator')->__('Relation types'),
|
188 |
+
'fields' => $helper->getRelationTypes()
|
189 |
+
)
|
190 |
+
);
|
191 |
+
|
192 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $relationsTypesHelp */
|
193 |
+
$relationsTypesHelp = $this->getLayout()
|
194 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
195 |
+
$relationsTypesHelp->setFieldsets($relationTypes)
|
196 |
+
->setColumns(
|
197 |
+
array(
|
198 |
+
'label' => array(
|
199 |
+
'header'=>Mage::helper('modulecreator')->__('Relation'),
|
200 |
+
'key' =>'label'
|
201 |
+
),
|
202 |
+
'description' => array(
|
203 |
+
'header'=>Mage::helper('modulecreator')->__('Description'),
|
204 |
+
'key' =>'description',
|
205 |
+
),
|
206 |
+
)
|
207 |
+
)
|
208 |
+
->setDescription(Mage::helper('modulecreator')->__('Entity Relations'));
|
209 |
+
|
210 |
+
$objN = new stdClass();
|
211 |
+
$objN->restricted = 'Mage';
|
212 |
+
$objN->label = Mage::helper('modulecreator')->__('Disallowed namespace names');
|
213 |
+
|
214 |
+
$routers = (array)Mage::getConfig()->getNode('frontend/routers');
|
215 |
+
$objM = new stdClass();
|
216 |
+
$objM->restricted = implode(', ', array_keys($routers));
|
217 |
+
$objM->label = Mage::helper('modulecreator')->__('Disallowed module names');
|
218 |
+
|
219 |
+
$entityRestrictedNames = implode(
|
220 |
+
', ',
|
221 |
+
array_keys((array)$helper->getConfig()->getNode('restricted/entity'))
|
222 |
+
);
|
223 |
+
$objE = new stdClass();
|
224 |
+
$objE->restricted = $entityRestrictedNames;
|
225 |
+
$objE->label = Mage::helper('modulecreator')->__('Disallowed entity names');
|
226 |
+
|
227 |
+
$attributeRestrictedNames = implode(
|
228 |
+
', ',
|
229 |
+
array_keys((array)$helper->getConfig()->getNode('restricted/attribute'))
|
230 |
+
);
|
231 |
+
$objA = new stdClass();
|
232 |
+
$objA->restricted = $attributeRestrictedNames;
|
233 |
+
$objA->label = Mage::helper('modulecreator')->__('Disallowed field/attribute names');
|
234 |
+
$restrictions = array(
|
235 |
+
'field_types'=> array(
|
236 |
+
'label' => Mage::helper('modulecreator')->__('Naming restrictions'),
|
237 |
+
'fields' => array($objN, $objM, $objE, $objA)
|
238 |
+
)
|
239 |
+
);
|
240 |
+
|
241 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $restrictionsHelp */
|
242 |
+
$restrictionsHelp = $this->getLayout()
|
243 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
244 |
+
$restrictionsHelp->setFieldsets($restrictions)
|
245 |
+
->setColumns(
|
246 |
+
array(
|
247 |
+
'label' => array(
|
248 |
+
'header'=>Mage::helper('modulecreator')->__('Entity'),
|
249 |
+
'key' =>'label'
|
250 |
+
),
|
251 |
+
'description' => array(
|
252 |
+
'header'=>Mage::helper('modulecreator')->__('Resticted'),
|
253 |
+
'key' =>'restricted',
|
254 |
+
),
|
255 |
+
)
|
256 |
+
)
|
257 |
+
->setDescription(Mage::helper('modulecreator')->__('Naming restrictions'));
|
258 |
+
|
259 |
+
/** @var null|Ultimate_ModuleCreator_Model_Module $currentModule */
|
260 |
+
$currentModule = Mage::registry('current_module');
|
261 |
+
if (!$currentModule) {
|
262 |
+
/** @var Ultimate_ModuleCreator_Model_Module $currentModule */
|
263 |
+
$currentModule = Mage::getModel('modulecreator/module');
|
264 |
+
}
|
265 |
+
$files = $currentModule->getConfig()->getNode('files');
|
266 |
+
$allowedFiles = array();
|
267 |
+
foreach ((array)$files as $file) {
|
268 |
+
if ($file->scope == 'disabled') {
|
269 |
+
continue;
|
270 |
+
}
|
271 |
+
$allowedFiles[] = $file;
|
272 |
+
}
|
273 |
+
|
274 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $filesHelp */
|
275 |
+
$filesHelp = $this->getLayout()
|
276 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
277 |
+
$filesHelp->setFieldsets(
|
278 |
+
array(
|
279 |
+
'files'=> array(
|
280 |
+
'label'=>Mage::helper('modulecreator')->__('Generated files'),
|
281 |
+
'fields' => $allowedFiles
|
282 |
+
)
|
283 |
+
)
|
284 |
+
)
|
285 |
+
->setColumns(
|
286 |
+
array(
|
287 |
+
'label' => array(
|
288 |
+
'header'=>Mage::helper('modulecreator')->__('File'),
|
289 |
+
'key' =>'title'
|
290 |
+
),
|
291 |
+
'destination'=> array(
|
292 |
+
'header'=>Mage::helper('modulecreator')->__('Path'),
|
293 |
+
'key' =>'destination'
|
294 |
+
),
|
295 |
+
'description' => array(
|
296 |
+
'header'=>Mage::helper('modulecreator')->__('Description'),
|
297 |
+
'key' =>'description',
|
298 |
+
),
|
299 |
+
'condition' => array(
|
300 |
+
'header'=>Mage::helper('modulecreator')->__('Condition'),
|
301 |
+
'key' =>'condition',
|
302 |
+
),
|
303 |
+
)
|
304 |
+
)
|
305 |
+
->setDescription(Mage::helper('modulecreator')->__('Created files'));
|
306 |
+
|
307 |
+
$this->setChild('settings_tab_help', $settingsTabHelp);
|
308 |
+
$this->setChild('entity_tab_help', $entityTabHelp);
|
309 |
+
$this->setChild('attribute_tab_help', $attributeTabHelp);
|
310 |
+
$this->setChild('attribute_types_help', $fieldTypesHelp);
|
311 |
+
$this->setChild('relation_types_help', $relationsTypesHelp);
|
312 |
+
$this->setChild('restrictions_help', $restrictionsHelp);
|
313 |
+
$this->setChild('files_help', $filesHelp);
|
314 |
+
|
315 |
+
$releaseNotes = (array)$helper->getReleaseNotes();
|
316 |
+
|
317 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $releaseNotesHelp */
|
318 |
+
$releaseNotesHelp = $this->getLayout()
|
319 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
320 |
+
$releaseNotesHelp->setFieldsets($releaseNotes)
|
321 |
+
->setColumns(
|
322 |
+
array(
|
323 |
+
'type' => array(
|
324 |
+
'header' => Mage::helper('modulecreator')->__('Type'),
|
325 |
+
'key' => 'type'
|
326 |
+
),
|
327 |
+
'label' => array(
|
328 |
+
'header' => Mage::helper('modulecreator')->__('Label'),
|
329 |
+
'key' => 'label'
|
330 |
+
),
|
331 |
+
'comment' => array(
|
332 |
+
'header' => Mage::helper('modulecreator')->__('Comment'),
|
333 |
+
'key' => 'comment'
|
334 |
+
),
|
335 |
+
)
|
336 |
+
)
|
337 |
+
->setDescription(Mage::helper('modulecreator')->__('Release notes'));
|
338 |
+
$this->setChild('release_notes', $releaseNotesHelp);
|
339 |
+
|
340 |
+
/** @var Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Help_Fieldset $thanks */
|
341 |
+
$thanks = $this->getLayout()
|
342 |
+
->createBlock('modulecreator/adminhtml_modulecreator_edit_tab_help_fieldset');
|
343 |
+
$thanks->setFieldsets(
|
344 |
+
array(
|
345 |
+
'files'=> array(
|
346 |
+
'label' =>Mage::helper('modulecreator')->__('Thanks'),
|
347 |
+
'fields' => (array)$helper->getThanks()
|
348 |
+
)
|
349 |
+
)
|
350 |
+
)
|
351 |
+
->setColumns(
|
352 |
+
array(
|
353 |
+
'type' => array(
|
354 |
+
'header'=>Mage::helper('modulecreator')->__('To'),
|
355 |
+
'key' =>'to'
|
356 |
+
),
|
357 |
+
'label' => array(
|
358 |
+
'header'=>Mage::helper('modulecreator')->__('Because'),
|
359 |
+
'key' =>'for'
|
360 |
+
),
|
361 |
+
)
|
362 |
+
)
|
363 |
+
->setDescription(Mage::helper('modulecreator')->__('Thank you for your help'));
|
364 |
+
$this->setChild('thanks', $thanks);
|
365 |
+
return parent::_prepareLayout();
|
366 |
+
}
|
367 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Help/Fieldset.php
CHANGED
@@ -1,78 +1,82 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* help fieldset
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset setFieldsets()
|
27 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset setColumns()
|
28 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset setDescription()
|
29 |
-
*/
|
30 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset
|
31 |
-
|
32 |
-
/**
|
33 |
-
* default column type
|
34 |
-
*/
|
35 |
-
const DEFAULT_COLUMN_TYPE = 'text';
|
36 |
-
|
37 |
-
/**
|
38 |
-
* constructor
|
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 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* help fieldset
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
/**
|
26 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset setFieldsets()
|
27 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset setColumns()
|
28 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset setDescription()
|
29 |
+
*/
|
30 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Edit_Tab_Help_Fieldset extends Mage_Adminhtml_Block_Template
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* default column type
|
34 |
+
*/
|
35 |
+
const DEFAULT_COLUMN_TYPE = 'text';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* constructor
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
42 |
+
*/
|
43 |
+
public function __construct()
|
44 |
+
{
|
45 |
+
parent::__construct();
|
46 |
+
$this->setTemplate('ultimate_modulecreator/edit/tab/help/fieldset.phtml');
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* format value
|
51 |
+
*
|
52 |
+
* @param $field
|
53 |
+
* @param $column
|
54 |
+
* @return string
|
55 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
56 |
+
*/
|
57 |
+
public function getFormatedValue($field, $column)
|
58 |
+
{
|
59 |
+
if (!isset($column['type'])) {
|
60 |
+
$column['type'] = self::DEFAULT_COLUMN_TYPE;
|
61 |
+
}
|
62 |
+
if (!isset($column['key'])) {
|
63 |
+
return '';
|
64 |
+
}
|
65 |
+
$key = $column['key'];
|
66 |
+
$rawValue = $field->$key;
|
67 |
+
switch($column['type']) {
|
68 |
+
case 'bool':
|
69 |
+
$value = (bool)(string)$rawValue;
|
70 |
+
if ($value == 1) {
|
71 |
+
return Mage::helper('modulecreator')->__('Yes');
|
72 |
+
}
|
73 |
+
return Mage::helper('modulecreator')->__('No');
|
74 |
+
break;
|
75 |
+
case 'text':
|
76 |
+
//intentional fall through
|
77 |
+
default:
|
78 |
+
return $rawValue;
|
79 |
+
break;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Relation.php
CHANGED
@@ -1,77 +1,90 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* relations tab block
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
/**
|
25 |
-
* @method array getRelations()
|
26 |
-
*/
|
27 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Relation
|
28 |
-
|
29 |
-
|
30 |
-
/**
|
31 |
-
* constructor
|
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 |
-
* @access public
|
71 |
-
* @return boolean
|
72 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
73 |
-
*/
|
74 |
-
public function
|
75 |
-
|
76 |
-
|
77 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* relations tab block
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
/**
|
25 |
+
* @method array getRelations()
|
26 |
+
*/
|
27 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Relation extends Mage_Adminhtml_Block_Widget_Form implements
|
28 |
+
Mage_Adminhtml_Block_Widget_Tab_Interface
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* constructor
|
32 |
+
*
|
33 |
+
* @access public
|
34 |
+
* @return void
|
35 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
36 |
+
*/
|
37 |
+
public function _construct()
|
38 |
+
{
|
39 |
+
parent::_construct();
|
40 |
+
$this->setTemplate('ultimate_modulecreator/edit/tab/relation.phtml');
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Return Tab label
|
45 |
+
*
|
46 |
+
* @access public
|
47 |
+
* @return string
|
48 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
49 |
+
*/
|
50 |
+
public function getTabLabel()
|
51 |
+
{
|
52 |
+
return Mage::helper('modulecreator')->__('Entity Relations');
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Return Tab title
|
57 |
+
*
|
58 |
+
* @access public
|
59 |
+
* @return string
|
60 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
61 |
+
*/
|
62 |
+
public function getTabTitle()
|
63 |
+
{
|
64 |
+
return Mage::helper('modulecreator')->__('Entity Relations');
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Can show tab in tabs
|
69 |
+
*
|
70 |
+
* @access public
|
71 |
+
* @return boolean
|
72 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
73 |
+
*/
|
74 |
+
public function canShowTab()
|
75 |
+
{
|
76 |
+
return true;
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Tab is hidden
|
81 |
+
*
|
82 |
+
* @access public
|
83 |
+
* @return boolean
|
84 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
85 |
+
*/
|
86 |
+
public function isHidden()
|
87 |
+
{
|
88 |
+
return count($this->getRelations()) == 0;
|
89 |
+
}
|
90 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tab/Settings.php
CHANGED
@@ -1,89 +1,101 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* settings tab block
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Settings
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
* Return Tab label
|
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 |
-
* @access public
|
68 |
-
* @return
|
69 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
70 |
-
*/
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
$
|
86 |
-
$
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* settings tab block
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Settings extends Mage_Adminhtml_Block_Widget_Form implements
|
26 |
+
Mage_Adminhtml_Block_Widget_Tab_Interface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Return Tab label
|
30 |
+
*
|
31 |
+
* @access public
|
32 |
+
* @return string
|
33 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
34 |
+
*/
|
35 |
+
public function getTabLabel()
|
36 |
+
{
|
37 |
+
return Mage::helper('modulecreator')->__('General Settings');
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Return Tab title
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @return string
|
45 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
46 |
+
*/
|
47 |
+
public function getTabTitle()
|
48 |
+
{
|
49 |
+
return Mage::helper('modulecreator')->__('General Settings');
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Can show tab in tabs
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @return boolean
|
57 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
58 |
+
*/
|
59 |
+
public function canShowTab()
|
60 |
+
{
|
61 |
+
return true;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Tab is hidden
|
66 |
+
*
|
67 |
+
* @access public
|
68 |
+
* @return boolean
|
69 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
70 |
+
*/
|
71 |
+
public function isHidden()
|
72 |
+
{
|
73 |
+
return false;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* prepare the form
|
78 |
+
*
|
79 |
+
* @access public
|
80 |
+
* @return Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tab_Settings
|
81 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
82 |
+
*/
|
83 |
+
protected function _prepareForm()
|
84 |
+
{
|
85 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
86 |
+
$helper = Mage::helper('modulecreator');
|
87 |
+
$form = $helper->getXmlForm('settings');
|
88 |
+
$form->setHtmlIdPrefix('settings_');
|
89 |
+
$module = Mage::registry('current_module');
|
90 |
+
$values = array();
|
91 |
+
if ($module) {
|
92 |
+
$values = $module->getData();
|
93 |
+
} else {
|
94 |
+
$values = Mage::getStoreConfig(Ultimate_ModuleCreator_Helper_Data::XML_SETTINGS_CONFIG_PATH);
|
95 |
+
}
|
96 |
+
$this->setForm($form);
|
97 |
+
$form->addFieldNameSuffix('settings');
|
98 |
+
$form->addValues($values);
|
99 |
+
return parent::_prepareForm();
|
100 |
+
}
|
101 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Edit/Tabs.php
CHANGED
@@ -1,42 +1,44 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* add/edit tabs
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tabs setTitle
|
27 |
-
*/
|
28 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tabs
|
29 |
-
|
30 |
-
/**
|
31 |
-
* construct
|
32 |
-
*
|
33 |
-
* @
|
34 |
-
* @
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
$this->
|
41 |
-
|
42 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* add/edit tabs
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
/**
|
26 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tabs setTitle
|
27 |
+
*/
|
28 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* construct
|
32 |
+
*
|
33 |
+
* @access public
|
34 |
+
* @return void
|
35 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
36 |
+
*/
|
37 |
+
public function _construct()
|
38 |
+
{
|
39 |
+
parent::_construct();
|
40 |
+
$this->setId('modulecreator_info_tabs');
|
41 |
+
$this->setDestElementId('edit_form');
|
42 |
+
$this->setTitle(Mage::helper('modulecreator')->__('Module information'));
|
43 |
+
}
|
44 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Grid.php
CHANGED
@@ -1,174 +1,207 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* modules grid.
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
/**
|
25 |
-
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Grid setUseAjax()
|
26 |
-
*/
|
27 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Grid
|
28 |
-
|
29 |
-
/**
|
30 |
-
* no filters
|
31 |
-
* @var bool
|
32 |
-
*/
|
33 |
-
protected $_filterVisibility = false;
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* modules grid.
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
/**
|
25 |
+
* @method Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Grid setUseAjax()
|
26 |
+
*/
|
27 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* no filters
|
31 |
+
* @var bool
|
32 |
+
*/
|
33 |
+
protected $_filterVisibility = false;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Initialize Grid block
|
37 |
+
*
|
38 |
+
* @access public
|
39 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
40 |
+
*/
|
41 |
+
public function __construct()
|
42 |
+
{
|
43 |
+
parent::__construct();
|
44 |
+
$this->_defaultLimit = 200;
|
45 |
+
$this->setId('ModuleCreator_grid');
|
46 |
+
$this->setUseAjax(true);
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Creates extension collection if it has not been created yet
|
51 |
+
*
|
52 |
+
* @access public
|
53 |
+
* @return Ultimate_ModuleCreator_Model_Module_Collection
|
54 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
55 |
+
*/
|
56 |
+
public function getCollection()
|
57 |
+
{
|
58 |
+
if (!$this->_collection) {
|
59 |
+
$this->_collection = Mage::getModel('modulecreator/module_collection');
|
60 |
+
}
|
61 |
+
return $this->_collection;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Prepare Collection for Grid
|
66 |
+
*
|
67 |
+
* @access protected
|
68 |
+
* @return Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Grid
|
69 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
70 |
+
*/
|
71 |
+
protected function _prepareCollection()
|
72 |
+
{
|
73 |
+
$this->setCollection($this->getCollection());
|
74 |
+
return parent::_prepareCollection();
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* Prepare grid columns
|
79 |
+
*
|
80 |
+
* @access protected
|
81 |
+
* @return Ultimate_ModuleCreator_Block_Adminhtml_ModuleCreator_Grid
|
82 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
83 |
+
*/
|
84 |
+
protected function _prepareColumns()
|
85 |
+
{
|
86 |
+
$this->addColumn(
|
87 |
+
'filename_id',
|
88 |
+
array(
|
89 |
+
'header' => Mage::helper('modulecreator')->__('Module'),
|
90 |
+
'index' => 'filename_id',
|
91 |
+
'filter' => false,
|
92 |
+
)
|
93 |
+
);
|
94 |
+
$actionColumnRenderer = 'modulecreator/adminhtml_modulecreator_grid_column_renderer_download';
|
95 |
+
$this->addColumn(
|
96 |
+
'action_edit',
|
97 |
+
array(
|
98 |
+
'header'=> Mage::helper('modulecreator')->__('Edit'),
|
99 |
+
'width' => '100',
|
100 |
+
'type' => 'action',
|
101 |
+
'getter'=> 'getSafeId',
|
102 |
+
'actions' => array(
|
103 |
+
array(
|
104 |
+
'caption' => Mage::helper('modulecreator')->__('Edit'),
|
105 |
+
'url' => array('base'=> '*/*/edit'),
|
106 |
+
'field' => 'id'
|
107 |
+
)
|
108 |
+
),
|
109 |
+
'filter' => false,
|
110 |
+
'is_system' => true,
|
111 |
+
'sortable' => false,
|
112 |
+
)
|
113 |
+
);
|
114 |
+
$this->addColumn(
|
115 |
+
'action_config',
|
116 |
+
array(
|
117 |
+
'header' => Mage::helper('modulecreator')->__('Download Config File'),
|
118 |
+
'label' => Mage::helper('modulecreator')->__('Download Config File'),
|
119 |
+
'width' => '150',
|
120 |
+
'renderer' => $actionColumnRenderer,
|
121 |
+
'filter' => false,
|
122 |
+
'is_system' => true,
|
123 |
+
'sortable' => false,
|
124 |
+
'what' => 'config'
|
125 |
+
)
|
126 |
+
);
|
127 |
+
$this->addColumn(
|
128 |
+
'action',
|
129 |
+
array(
|
130 |
+
'header' => Mage::helper('modulecreator')->__('Download Module'),
|
131 |
+
'label' => Mage::helper('modulecreator')->__('Download Module'),
|
132 |
+
'width' => '100',
|
133 |
+
'renderer' => $actionColumnRenderer,
|
134 |
+
'filter' => false,
|
135 |
+
'is_system' => true,
|
136 |
+
'sortable' => false,
|
137 |
+
)
|
138 |
+
);
|
139 |
+
$this->addColumn(
|
140 |
+
'action_list',
|
141 |
+
array(
|
142 |
+
'header' => Mage::helper('modulecreator')->__('Download List of Files'),
|
143 |
+
'label' => Mage::helper('modulecreator')->__('Download List of Files'),
|
144 |
+
'width' => '100',
|
145 |
+
'renderer' => $actionColumnRenderer,
|
146 |
+
'filter' => false,
|
147 |
+
'is_system' => true,
|
148 |
+
'sortable' => false,
|
149 |
+
'what' => 'list'
|
150 |
+
)
|
151 |
+
);
|
152 |
+
$this->addColumn(
|
153 |
+
'action_uninstall',
|
154 |
+
array(
|
155 |
+
'header' => Mage::helper('modulecreator')->__('Download Uninstall DB Script'),
|
156 |
+
'label' => Mage::helper('modulecreator')->__('Download Uninstall DB Script'),
|
157 |
+
'width' => '200',
|
158 |
+
'renderer' => $actionColumnRenderer,
|
159 |
+
'filter' => false,
|
160 |
+
'is_system' => true,
|
161 |
+
'sortable' => false,
|
162 |
+
'what' => 'uninstall'
|
163 |
+
)
|
164 |
+
);
|
165 |
+
return parent::_prepareColumns();
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Self URL getter
|
170 |
+
*
|
171 |
+
* @access public
|
172 |
+
* @param array() $params
|
173 |
+
* @return string
|
174 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
175 |
+
*/
|
176 |
+
public function getCurrentUrl($params = array())
|
177 |
+
{
|
178 |
+
if (!isset($params['_current'])) {
|
179 |
+
$params['_current'] = true;
|
180 |
+
}
|
181 |
+
return $this->getUrl('*/*/grid', $params);
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Row URL getter
|
186 |
+
*
|
187 |
+
* @access public
|
188 |
+
* @param Ultimate_ModuleCreator_Model_Module $row
|
189 |
+
* @return string
|
190 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
191 |
+
*/
|
192 |
+
public function getRowUrl($row)
|
193 |
+
{
|
194 |
+
return $this->getUrl(
|
195 |
+
'*/*/edit',
|
196 |
+
array(
|
197 |
+
'id' => strtr(
|
198 |
+
base64_encode(
|
199 |
+
$row->getFilenameId()
|
200 |
+
),
|
201 |
+
'+/=',
|
202 |
+
'-_,'
|
203 |
+
)
|
204 |
+
)
|
205 |
+
);
|
206 |
+
}
|
207 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Grid/Column/Renderer/Download.php
CHANGED
@@ -1,75 +1,83 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* download column renderer
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Grid_Column_Renderer_Download
|
26 |
-
|
27 |
-
/**
|
28 |
-
* render row
|
29 |
-
*
|
30 |
-
* @
|
31 |
-
* @
|
32 |
-
* @
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
/** @var string $
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* download column renderer
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Grid_Column_Renderer_Download extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* render row
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @param Varien_Object $row
|
32 |
+
* @return string
|
33 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
34 |
+
*/
|
35 |
+
public function render(Varien_Object $row)
|
36 |
+
{
|
37 |
+
/** @var string $what */
|
38 |
+
$what = $this->getColumn()->getWhat();
|
39 |
+
/** @var string $id */
|
40 |
+
$id = $row->getSafeId();
|
41 |
+
$packageName = base64_decode(strtr($id, '-_,', '+/='));
|
42 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
43 |
+
$helper = Mage::helper('modulecreator');
|
44 |
+
$path = $helper->getLocalModulesDir();
|
45 |
+
switch ($what) {
|
46 |
+
case 'config':
|
47 |
+
$file = $path.'package'.DS.$packageName . '.xml';
|
48 |
+
break;
|
49 |
+
case 'list':
|
50 |
+
$file = $path.'package'.DS.$packageName . DS. 'files.log';
|
51 |
+
break;
|
52 |
+
case 'uninstall' :
|
53 |
+
$file = $path.'package'.DS.$packageName . DS. 'uninstall.sql';
|
54 |
+
break;
|
55 |
+
default:
|
56 |
+
$file = $path . $packageName . '.tgz';
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
if (file_exists($file) && is_readable($file)) {
|
60 |
+
return '<a href="'.
|
61 |
+
$this->getUrl('*/*/download', array('type'=>$what, 'id'=>$id)).'">'.$this->_getLabel().
|
62 |
+
'</a>';
|
63 |
+
}
|
64 |
+
return '<span style="color:red;">'.
|
65 |
+
Mage::helper('modulecreator')->__('File does not exist or is not readable').
|
66 |
+
'</span>';
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* get the link label
|
71 |
+
*
|
72 |
+
* @access protected
|
73 |
+
* @return string
|
74 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
75 |
+
*/
|
76 |
+
protected function _getLabel()
|
77 |
+
{
|
78 |
+
if ($this->getColumn()->getLabel()) {
|
79 |
+
return $this->getColumn()->getLabel();
|
80 |
+
}
|
81 |
+
return Mage::helper('modulecreator')->__('Download');
|
82 |
+
}
|
83 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/Menu.php
CHANGED
@@ -1,95 +1,108 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* select menu block.
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Menu
|
26 |
-
|
27 |
-
/**
|
28 |
-
* don't cache
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* select menu block.
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_Menu extends Mage_Adminhtml_Block_Page_Menu
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* don't cache
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return int|null
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function getCacheLifetime()
|
35 |
+
{
|
36 |
+
return null;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* draw the menu
|
41 |
+
*
|
42 |
+
* @access public
|
43 |
+
* @param $menu
|
44 |
+
* @param string $parentId
|
45 |
+
* @param int $level
|
46 |
+
* @return string
|
47 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
48 |
+
*/
|
49 |
+
public function renderUmcMenu($menu, $parentId = '', $level = 0)
|
50 |
+
{
|
51 |
+
$html = '<ul ' . (!$level ? 'id="umc-nav"' : '') . '>';
|
52 |
+
$html .= $this->_renderSelector($parentId, 0);
|
53 |
+
$previousSortOrder = 0;
|
54 |
+
foreach ($menu as $key=> $item) {
|
55 |
+
$html .= '<li>';
|
56 |
+
$html .= '<span class="delete toggler collapsed"></span>';
|
57 |
+
$html .= '<a href="#" onclick="return false">' . $this->escapeHtml($item['label']) . '</a>';
|
58 |
+
if ($parentId) {
|
59 |
+
$nextParentId = $parentId.'/'.$key;
|
60 |
+
} else {
|
61 |
+
$nextParentId = $key;
|
62 |
+
}
|
63 |
+
if (!empty($item['children'])) {
|
64 |
+
$html .= $this->renderUmcMenu($item['children'], $nextParentId, $level + 1);
|
65 |
+
} else {
|
66 |
+
$html .= '<ul>'.$this->_renderSelector($nextParentId, 10).'</ul>';
|
67 |
+
}
|
68 |
+
$html .= '</li>';
|
69 |
+
$html .= $this->_renderSelector($parentId, (int)(($item['sort_order'] + $previousSortOrder)/2));
|
70 |
+
$previousSortOrder = $item['sort_order'];
|
71 |
+
}
|
72 |
+
$html .= '</ul>';
|
73 |
+
|
74 |
+
return $html;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* render the selection link
|
79 |
+
*
|
80 |
+
* @access protected
|
81 |
+
* @param $parentId
|
82 |
+
* @param $sortOrder
|
83 |
+
* @return string
|
84 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
85 |
+
*/
|
86 |
+
protected function _renderSelector($parentId, $sortOrder)
|
87 |
+
{
|
88 |
+
$html = '<li class="umc-menu-selector">';
|
89 |
+
$html .= '<a class="insert-menu" menu-data=\'{"parent":"'.$parentId.'", "sort_order": "'.$sortOrder.'"}\'';
|
90 |
+
$html .= 'title="'.Mage::helper('modulecreator')->__('Insert here').'">';
|
91 |
+
$html .= Mage::helper('modulecreator')->__('Insert here');
|
92 |
+
$html .= '</a>';
|
93 |
+
$html .= '</li>';
|
94 |
+
return $html;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* render menu
|
99 |
+
*
|
100 |
+
* @access protected
|
101 |
+
* @return string
|
102 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
103 |
+
*/
|
104 |
+
protected function _toHtml()
|
105 |
+
{
|
106 |
+
return $this->renderUmcMenu($this->getMenuArray());
|
107 |
+
}
|
108 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Abstract.php
CHANGED
@@ -1,128 +1,141 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* abstract system->config fieldset renderer
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
abstract class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Abstract
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var Varien_Object
|
29 |
-
*/
|
30 |
-
protected $_dummyElement;
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* abstract system->config fieldset renderer
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
abstract class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Abstract extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @var Varien_Object
|
29 |
+
*/
|
30 |
+
protected $_dummyElement;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var Mage_Adminhtml_Block_System_Config_Form_Field
|
34 |
+
*/
|
35 |
+
protected $_fieldRenderer;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
protected $_values;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* get the form name
|
44 |
+
* @return mixed
|
45 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
46 |
+
*/
|
47 |
+
public abstract function getFormName();
|
48 |
+
|
49 |
+
/**
|
50 |
+
* render the config section
|
51 |
+
*
|
52 |
+
* @access public
|
53 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
54 |
+
* @return string
|
55 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
56 |
+
*/
|
57 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
58 |
+
{
|
59 |
+
$html = $this->_getHeaderHtml($element);
|
60 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
61 |
+
$helper = Mage::helper('modulecreator');
|
62 |
+
$config = $helper->getConfig();
|
63 |
+
$formName = $this->getFormName();
|
64 |
+
if (!$config->getNode('forms/'.$formName)) {
|
65 |
+
return '';
|
66 |
+
}
|
67 |
+
$fieldsets = $config->getNode('forms/'.$formName.'/fieldsets');
|
68 |
+
$index = 0;
|
69 |
+
foreach ((array)$fieldsets as $key => $set) {
|
70 |
+
$positions = array();
|
71 |
+
foreach ((array)$set->fields as $id=>$field) {
|
72 |
+
if (!$field->system) {
|
73 |
+
continue;
|
74 |
+
}
|
75 |
+
$positions[(int)$field->position][$id] = $field;
|
76 |
+
}
|
77 |
+
ksort($positions);
|
78 |
+
$sorted = array();
|
79 |
+
foreach ($positions as $fields) {
|
80 |
+
$sorted = array_merge($sorted, $fields);
|
81 |
+
}
|
82 |
+
foreach($sorted as $id => $field) {
|
83 |
+
$html.= $this->_getFieldHtml($element, $id, $field);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
$html .= $this->_getFooterHtml($element);
|
87 |
+
return $html;
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* get field renderer.
|
92 |
+
*
|
93 |
+
* @access protected
|
94 |
+
* @return Mage_Adminhtml_Block_System_Config_Form_Field
|
95 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
96 |
+
*/
|
97 |
+
protected function _getFieldRenderer()
|
98 |
+
{
|
99 |
+
if (empty($this->_fieldRenderer)) {
|
100 |
+
$this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
|
101 |
+
}
|
102 |
+
return $this->_fieldRenderer;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* get HTML for the field
|
107 |
+
*
|
108 |
+
* @access protected
|
109 |
+
* @param Varien_Data_Form_Element_Fieldset $fieldset
|
110 |
+
* @param string $key
|
111 |
+
* @param $field
|
112 |
+
* @return mixed
|
113 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
114 |
+
*/
|
115 |
+
protected function _getFieldHtml($fieldset, $key, $field)
|
116 |
+
{
|
117 |
+
$formName = $this->getFormName();
|
118 |
+
$path = 'modulecreator/'.$formName.'/' . $key;
|
119 |
+
$data = Mage::getStoreConfig($path, 0);
|
120 |
+
$settings = array(
|
121 |
+
'name' => 'groups['.$formName.'][fields]['.$key.'][value]',
|
122 |
+
'label' => (string)$field->label,
|
123 |
+
'value' => $data,
|
124 |
+
'inherit' => false,
|
125 |
+
'can_use_default_value' => false,
|
126 |
+
'can_use_website_value' => false,
|
127 |
+
);
|
128 |
+
if (in_array((string)$field->type, array('select', 'multiselect'))) {
|
129 |
+
$settings['values'] = Mage::getModel((string)$field->source)->toArray(((string)$field->type == 'select'));
|
130 |
+
}
|
131 |
+
if ($field->tooltip) {
|
132 |
+
$settings['tooltip'] = (string)$field->tooltip;
|
133 |
+
}
|
134 |
+
$field = $fieldset->addField(
|
135 |
+
$formName.$key,
|
136 |
+
(string)$field->type, $settings
|
137 |
+
);
|
138 |
+
$field->setRenderer($this->_getFieldRenderer());
|
139 |
+
return $field->toHtml();
|
140 |
+
}
|
141 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Attribute.php
CHANGED
@@ -1,36 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* attribute system->config fieldset renderer
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Attribute
|
26 |
-
|
27 |
-
/**
|
28 |
-
* get the form name from umc.xml
|
29 |
-
*
|
30 |
-
* @
|
31 |
-
* @
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* attribute system->config fieldset renderer
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Attribute extends Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* get the form name from umc.xml
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return mixed|string
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function getFormName()
|
35 |
+
{
|
36 |
+
return 'attribute';
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Entity.php
CHANGED
@@ -1,36 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* entity system->config fieldset renderer
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Entity
|
26 |
-
|
27 |
-
/**
|
28 |
-
* get the form name from umc.xml
|
29 |
-
*
|
30 |
-
* @
|
31 |
-
* @
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* entity system->config fieldset renderer
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Entity extends Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* get the form name from umc.xml
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return mixed|string
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function getFormName()
|
35 |
+
{
|
36 |
+
return 'entity';
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Block/Adminhtml/Modulecreator/System/Config/Form/Fieldset/Settings.php
CHANGED
@@ -1,36 +1,38 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* module settings system->config fieldset renderer
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Settings
|
26 |
-
|
27 |
-
/**
|
28 |
-
* get the form name from umc.xml
|
29 |
-
*
|
30 |
-
* @
|
31 |
-
* @
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* module settings system->config fieldset renderer
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Settings extends Ultimate_ModuleCreator_Block_Adminhtml_Modulecreator_System_Config_Form_Fieldset_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* get the form name from umc.xml
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return mixed|string
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function getFormName()
|
35 |
+
{
|
36 |
+
return 'settings';
|
37 |
+
}
|
38 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Exception.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
class Ultimate_ModuleCreator_Exception
|
19 |
-
|
20 |
-
|
21 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
class Ultimate_ModuleCreator_Exception extends Mage_Core_Exception
|
19 |
+
{
|
20 |
+
|
21 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Helper/Data.php
CHANGED
@@ -1,487 +1,561 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* module main helper
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Helper_Data extends Mage_Core_Helper_Abstract
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
/**
|
43 |
-
* path to
|
44 |
-
*/
|
45 |
-
const
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
/**
|
63 |
-
* path to
|
64 |
-
*/
|
65 |
-
const
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
const
|
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 |
-
* @access public
|
129 |
-
* @return
|
130 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
131 |
-
*/
|
132 |
-
public function
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
*
|
259 |
-
*
|
260 |
-
* @
|
261 |
-
* @
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
$
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
$
|
369 |
-
}
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
*
|
451 |
-
*
|
452 |
-
*
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* module main helper
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Helper_Data extends Mage_Core_Helper_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* path to entity types
|
29 |
+
*/
|
30 |
+
const ENTITY_TYPES_PATH = 'types/umc_entity';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* path to attribute types
|
34 |
+
*/
|
35 |
+
const ATTRIBUTE_TYPES_PATH = 'types/umc_attribute';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* path to attribute types groups
|
39 |
+
*/
|
40 |
+
const ATTRIBUTE_TYPE_GROUPS_PATH = 'types/umc_attribute_group';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* path to relation types
|
44 |
+
*/
|
45 |
+
const RELATION_TYPES_PATH = 'types/umc_relation';
|
46 |
+
|
47 |
+
/**
|
48 |
+
* path to settings config
|
49 |
+
*/
|
50 |
+
const XML_SETTINGS_CONFIG_PATH = 'modulecreator/settings';
|
51 |
+
|
52 |
+
/**
|
53 |
+
* path to entity config
|
54 |
+
*/
|
55 |
+
const XML_ENTITY_CONFIG_PATH = 'modulecreator/entity';
|
56 |
+
|
57 |
+
/**
|
58 |
+
* path to attribute config
|
59 |
+
*/
|
60 |
+
const XML_ATTRIBUTE_CONFIG_PATH = 'modulecreator/attribute';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* xml path to release notes
|
64 |
+
*/
|
65 |
+
const XML_RELEASE_NOTES_PATH = 'release_notes';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* path to thanks
|
69 |
+
*/
|
70 |
+
const XML_THANKS_PATH = 'thanks';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* path to dropdown attribute subtypes
|
74 |
+
*/
|
75 |
+
const DROPDOWN_TYPES_PATH = 'types/umc_dropdown';
|
76 |
+
|
77 |
+
/**
|
78 |
+
* config path to show tooltips
|
79 |
+
*/
|
80 |
+
const SHOW_TOOLTIPS_PATH = 'modulecreator/general/tooltips';
|
81 |
+
|
82 |
+
/**
|
83 |
+
* nothing to see here
|
84 |
+
* just some constants
|
85 |
+
*/
|
86 |
+
const WE1MX1NZU1RFTV9G = 'c3lzdGVtL2Y=';
|
87 |
+
const WE1MX1NZU1RFTV9Q = 'c3lzdGVtL3A=';
|
88 |
+
const WE1MX1NZU1RFTV9QUA = 'c3lzdGVtL3Bw';
|
89 |
+
|
90 |
+
/**
|
91 |
+
* form xml cache
|
92 |
+
*
|
93 |
+
* @var null
|
94 |
+
*/
|
95 |
+
protected $_formXml = null;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* module creator config
|
99 |
+
*
|
100 |
+
* @var null
|
101 |
+
*/
|
102 |
+
protected $_config = null;
|
103 |
+
|
104 |
+
/**
|
105 |
+
* tooltip block
|
106 |
+
*
|
107 |
+
* @var Mage_Adminhtml_Block_Template
|
108 |
+
*/
|
109 |
+
protected $_tooltipBlock = null;
|
110 |
+
|
111 |
+
/**
|
112 |
+
* get the tooltip html
|
113 |
+
*
|
114 |
+
* @access public
|
115 |
+
* @param string $title
|
116 |
+
* @param string $text
|
117 |
+
* @return string
|
118 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
119 |
+
*/
|
120 |
+
public function getTooltipHtml($title, $text)
|
121 |
+
{
|
122 |
+
return $this->getTooltipBlock()->setTitle($title)->setMessage($text)->toHtml();
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* get the tooltip block for help messages
|
127 |
+
*
|
128 |
+
* @access public
|
129 |
+
* @return Mage_Adminhtml_Block_Template
|
130 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
131 |
+
*/
|
132 |
+
public function getTooltipBlock()
|
133 |
+
{
|
134 |
+
if (is_null($this->_tooltipBlock)) {
|
135 |
+
$this->_tooltipBlock = Mage::app()->getLayout()
|
136 |
+
->createBlock('adminhtml/template')
|
137 |
+
->setTemplate('ultimate_modulecreator/tooltip.phtml');
|
138 |
+
}
|
139 |
+
return $this->_tooltipBlock;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* get local extension packages path
|
144 |
+
*
|
145 |
+
* @access public
|
146 |
+
* @return string
|
147 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
148 |
+
*/
|
149 |
+
public function getLocalPackagesPath()
|
150 |
+
{
|
151 |
+
return $this->getLocalModulesDir().'package'.DS;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* get local extension path
|
156 |
+
*
|
157 |
+
* @access public
|
158 |
+
* @return string
|
159 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
160 |
+
*/
|
161 |
+
public function getLocalModulesDir()
|
162 |
+
{
|
163 |
+
return Mage::getBaseDir('var').DS.'modulecreator'.DS;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* get the umc config
|
168 |
+
*
|
169 |
+
* @access public
|
170 |
+
* @return Ultimate_ModuleCreator_Model_Config
|
171 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
172 |
+
*/
|
173 |
+
public function getConfig()
|
174 |
+
{
|
175 |
+
if (is_null($this->_config)) {
|
176 |
+
$this->_config = Mage::getConfig()->loadModulesConfiguration('umc.xml')->applyExtends();
|
177 |
+
}
|
178 |
+
return $this->_config;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* get a form
|
183 |
+
*
|
184 |
+
* @access public
|
185 |
+
* @param $formName
|
186 |
+
* @return Varien_Data_Form
|
187 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
188 |
+
*/
|
189 |
+
public function getXmlForm($formName)
|
190 |
+
{
|
191 |
+
$xmlForms = $this->getConfig();
|
192 |
+
$form = new Varien_Data_Form();
|
193 |
+
if (!$xmlForms->getNode('forms/'.$formName)) {
|
194 |
+
return $form;
|
195 |
+
}
|
196 |
+
$fieldsets = $xmlForms->getNode('forms/'.$formName.'/fieldsets');
|
197 |
+
$index = 0;
|
198 |
+
foreach ((array)$fieldsets as $key => $set) {
|
199 |
+
$fieldset = $form->addFieldset(
|
200 |
+
uniqid('fieldset_').'_'.$key,
|
201 |
+
array(
|
202 |
+
'legend'=>(string)$set->label
|
203 |
+
)
|
204 |
+
);
|
205 |
+
$positions = array();
|
206 |
+
foreach ((array)$set->fields as $id=>$field) {
|
207 |
+
$positions[(int)$field->position][$id] = $field;
|
208 |
+
}
|
209 |
+
ksort($positions);
|
210 |
+
$sorted = array();
|
211 |
+
foreach ($positions as $fields) {
|
212 |
+
$sorted = array_merge($sorted, $fields);
|
213 |
+
}
|
214 |
+
foreach ($sorted as $id => $field) {
|
215 |
+
$settings = array(
|
216 |
+
'name' => $id,
|
217 |
+
'label' => $field->label,
|
218 |
+
'title' => $field->label,
|
219 |
+
'required' => (string)$field->required,
|
220 |
+
'class' => (string)$field->class,
|
221 |
+
);
|
222 |
+
if ($field->readonly) {
|
223 |
+
$settings['readonly'] = "readonly";
|
224 |
+
}
|
225 |
+
if ($field->type != 'hidden') {
|
226 |
+
if (Mage::getStoreConfigFlag(self::SHOW_TOOLTIPS_PATH)) {
|
227 |
+
if ($field->tooltip) {
|
228 |
+
$settings['after_element_html'] = $this->getTooltipHtml(
|
229 |
+
$field->label,
|
230 |
+
(string)$field->tooltip
|
231 |
+
);
|
232 |
+
}
|
233 |
+
}
|
234 |
+
if ($field->note) {
|
235 |
+
$settings['note'] = $field->note;
|
236 |
+
}
|
237 |
+
}
|
238 |
+
if ($set->use_depends) {
|
239 |
+
$dependClass = (string)$field->depend_class;
|
240 |
+
if (empty($dependClass)) {
|
241 |
+
$dependClass = 'type-all';
|
242 |
+
}
|
243 |
+
$settings['class'] .=' '.$dependClass;
|
244 |
+
}
|
245 |
+
if (in_array((string)$field->type, array('select', 'multiselect'))) {
|
246 |
+
$settings['values'] = Mage::getModel((string)$field->source)
|
247 |
+
->toArray(((string)$field->type == 'select'));
|
248 |
+
}
|
249 |
+
|
250 |
+
$fieldset->addField($id, (string)$field->type, $settings);
|
251 |
+
}
|
252 |
+
$index++;
|
253 |
+
}
|
254 |
+
return $form;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* get data for xml form
|
259 |
+
*
|
260 |
+
* @param $formName
|
261 |
+
* @param null $fieldset
|
262 |
+
* @return array
|
263 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
264 |
+
*/
|
265 |
+
public function getFieldsetXmlData($formName, $fieldset = null)
|
266 |
+
{
|
267 |
+
$xmlForms = $this->getConfig();
|
268 |
+
if (!$xmlForms->getNode('forms/'.$formName)) {
|
269 |
+
return array();
|
270 |
+
}
|
271 |
+
$fieldsets = $xmlForms->getNode('forms/'.$formName.'/fieldsets');
|
272 |
+
$index = 0;
|
273 |
+
$data = array();
|
274 |
+
foreach ((array)$fieldsets as $key => $set) {
|
275 |
+
if (!is_null($fieldset) && $fieldset != $key ) {
|
276 |
+
continue;
|
277 |
+
}
|
278 |
+
$data[$key] = array();
|
279 |
+
$data[$key]['label'] = (string)$set->label;
|
280 |
+
$positions = array();
|
281 |
+
foreach ((array)$set->fields as $id=>$field) {
|
282 |
+
$positions[(int)$field->position][$id] = $field;
|
283 |
+
}
|
284 |
+
ksort($positions);
|
285 |
+
$sorted = array();
|
286 |
+
foreach ($positions as $fields) {
|
287 |
+
$sorted = array_merge($sorted, $fields);
|
288 |
+
}
|
289 |
+
foreach ($sorted as $field) {
|
290 |
+
$data[$key]['fields'][] = $field;
|
291 |
+
}
|
292 |
+
$index++;
|
293 |
+
}
|
294 |
+
return $data;
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* get all entity types
|
299 |
+
*
|
300 |
+
* @access public
|
301 |
+
* @return array
|
302 |
+
* @throws Ultimate_ModuleCreator_Exception
|
303 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
304 |
+
*/
|
305 |
+
public function getEntityTypes()
|
306 |
+
{
|
307 |
+
$types = $this->getConfig()->getNode(self::ENTITY_TYPES_PATH);
|
308 |
+
if (!$types) {
|
309 |
+
throw new Ultimate_ModuleCreator_Exception($this->__('No entity types configured'));
|
310 |
+
}
|
311 |
+
return (array)$types;
|
312 |
+
}
|
313 |
+
|
314 |
+
/**
|
315 |
+
* get relation types
|
316 |
+
*
|
317 |
+
* @access public
|
318 |
+
* @return array
|
319 |
+
* @throws Ultimate_ModuleCreator_Exception
|
320 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
321 |
+
*/
|
322 |
+
public function getRelationTypes()
|
323 |
+
{
|
324 |
+
$types = $this->getConfig()->getNode(self::RELATION_TYPES_PATH);
|
325 |
+
if (!$types) {
|
326 |
+
throw new Ultimate_ModuleCreator_Exception($this->__('No relation types configured'));
|
327 |
+
}
|
328 |
+
return (array)$types;
|
329 |
+
}
|
330 |
+
|
331 |
+
/**
|
332 |
+
* get attribute types
|
333 |
+
*
|
334 |
+
* @param bool $asArray
|
335 |
+
* @return array|Varien_Simplexml_Element
|
336 |
+
* @throws Ultimate_ModuleCreator_Exception
|
337 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
338 |
+
*/
|
339 |
+
public function getAttributeTypes($asArray = true)
|
340 |
+
{
|
341 |
+
$types = $this->getConfig()->getNode(self::ATTRIBUTE_TYPES_PATH);
|
342 |
+
if (!$types) {
|
343 |
+
throw new Ultimate_ModuleCreator_Exception($this->__('No attribute types configured'));
|
344 |
+
}
|
345 |
+
if ($asArray) {
|
346 |
+
return (array)$types;
|
347 |
+
}
|
348 |
+
return $types;
|
349 |
+
}
|
350 |
+
|
351 |
+
/**
|
352 |
+
* get available name attribute types
|
353 |
+
*
|
354 |
+
* @access public
|
355 |
+
* @param bool $onlyLabels
|
356 |
+
* @return array
|
357 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
358 |
+
*/
|
359 |
+
public function getNameAttributeTypes($onlyLabels = false)
|
360 |
+
{
|
361 |
+
$types = $this->getAttributeTypes();
|
362 |
+
$nameTypes = array();
|
363 |
+
foreach ($types as $type=>$values) {
|
364 |
+
if ((string)$values->allow_is_name == 1) {
|
365 |
+
if (!$onlyLabels) {
|
366 |
+
$nameTypes[$type] = $values;
|
367 |
+
} else {
|
368 |
+
$nameTypes[$type] = (string)$values->label;
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
return $nameTypes;
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* get the attribute type groups
|
377 |
+
*
|
378 |
+
* @access public
|
379 |
+
* @return array
|
380 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
381 |
+
*/
|
382 |
+
public function getAttributeTypeGroups()
|
383 |
+
{
|
384 |
+
$groups = $this->getConfig()->getNode(self::ATTRIBUTE_TYPE_GROUPS_PATH);
|
385 |
+
return (array)$groups;
|
386 |
+
}
|
387 |
+
|
388 |
+
/**
|
389 |
+
* load a module
|
390 |
+
*
|
391 |
+
* @access public
|
392 |
+
* @param Varien_Simplexml_Element $xml
|
393 |
+
* @return bool|Ultimate_ModuleCreator_Model_Module
|
394 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
395 |
+
*/
|
396 |
+
public function loadModule($xml)
|
397 |
+
{
|
398 |
+
/** @var Ultimate_ModuleCreator_Model_Module $module */
|
399 |
+
$module = Mage::getModel('modulecreator/module');
|
400 |
+
$moduleFields = $module->getXmlAttributes();
|
401 |
+
$data = array();
|
402 |
+
foreach ($moduleFields as $field) {
|
403 |
+
$data[$field] = (string)$xml->$field;
|
404 |
+
}
|
405 |
+
$module->setData($data);
|
406 |
+
/** @var Ultimate_ModuleCreator_Model_Entity $entity */
|
407 |
+
$entity = Mage::getModel('modulecreator/entity');
|
408 |
+
$entityFields = $entity->getXmlAttributes();
|
409 |
+
foreach ($xml->entities->entity as $entityNode) {
|
410 |
+
$data = array();
|
411 |
+
foreach ($entityFields as $field) {
|
412 |
+
$data[$field] = (string)$entityNode->$field;
|
413 |
+
}
|
414 |
+
$entity = Mage::getModel('modulecreator/entity');
|
415 |
+
$entity->setData($data);
|
416 |
+
$module->addEntity($entity);
|
417 |
+
foreach ($entityNode->attributes->attribute as $attributeNode) {
|
418 |
+
$attributeData = (array)$attributeNode;
|
419 |
+
foreach ($attributeData as $key=>$value) {
|
420 |
+
$attributeData[$key] = (string)$value;
|
421 |
+
}
|
422 |
+
$attribute = Mage::getModel('modulecreator/attribute');
|
423 |
+
$attribute->setData($attributeData);
|
424 |
+
$entity->addAttribute($attribute);
|
425 |
+
}
|
426 |
+
}
|
427 |
+
$relations = (array)$xml->descend('relations');
|
428 |
+
if ($relations) {
|
429 |
+
foreach ($relations as $key=>$type) {
|
430 |
+
$parts = explode('_', $key);
|
431 |
+
if (count($parts) == 2) {
|
432 |
+
$e1 = $module->getEntity($parts[0]);
|
433 |
+
$e2 = $module->getEntity($parts[1]);
|
434 |
+
if ($e1 && $e2) {
|
435 |
+
/** @var Ultimate_ModuleCreator_Model_Relation $relation */
|
436 |
+
$relation = Mage::getModel('modulecreator/relation');
|
437 |
+
$relation->setEntities($e1, $e2, (string)$type);
|
438 |
+
$module->addRelation($relation);
|
439 |
+
}
|
440 |
+
}
|
441 |
+
}
|
442 |
+
}
|
443 |
+
return $module;
|
444 |
+
}
|
445 |
+
|
446 |
+
/**
|
447 |
+
* get indentation.
|
448 |
+
*
|
449 |
+
* @access public
|
450 |
+
* @param int $count
|
451 |
+
* @return string
|
452 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
453 |
+
*/
|
454 |
+
public function getPadding($count = 1)
|
455 |
+
{
|
456 |
+
return str_repeat(" ", $count);
|
457 |
+
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* get end of line
|
461 |
+
*
|
462 |
+
* @access public
|
463 |
+
* @return string
|
464 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
465 |
+
*/
|
466 |
+
public function getEol()
|
467 |
+
{
|
468 |
+
return "\n";
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* get release notes config xml
|
473 |
+
*
|
474 |
+
* @access public
|
475 |
+
* @return Varien_Simplexml_Element
|
476 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
477 |
+
*/
|
478 |
+
public function getReleaseNotes()
|
479 |
+
{
|
480 |
+
$notes = (array)$this->getConfig()->getNode(self::XML_RELEASE_NOTES_PATH);
|
481 |
+
$releaseNotes = array();
|
482 |
+
foreach ($notes as $note) {
|
483 |
+
$_note = array();
|
484 |
+
$_note['label'] = Mage::helper('modulecreator')->__(
|
485 |
+
'v%s - %s',
|
486 |
+
$note->version,
|
487 |
+
$note->date
|
488 |
+
);
|
489 |
+
$_note['fields'] = (array)$note->data;
|
490 |
+
$releaseNotes[(string)$note->version] = $_note;
|
491 |
+
}
|
492 |
+
return $releaseNotes;
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* get dropdown attribute subtypes
|
497 |
+
*
|
498 |
+
* @param bool $asArray
|
499 |
+
* @return array|Varien_Simplexml_Element
|
500 |
+
* @throws Ultimate_ModuleCreator_Exception
|
501 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
502 |
+
*/
|
503 |
+
public function getDropdownSubtypes($asArray = true)
|
504 |
+
{
|
505 |
+
$types = $this->getConfig()->getNode(self::DROPDOWN_TYPES_PATH);
|
506 |
+
if (!$types) {
|
507 |
+
throw new Ultimate_ModuleCreator_Exception($this->__('No dropdown subtypes configured'));
|
508 |
+
}
|
509 |
+
if ($asArray) {
|
510 |
+
return (array)$types;
|
511 |
+
}
|
512 |
+
return $types;
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* this does nothing
|
517 |
+
* don't look through the code - go away
|
518 |
+
* I said it does nothing
|
519 |
+
*
|
520 |
+
* @access public
|
521 |
+
* @return string
|
522 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
523 |
+
*/
|
524 |
+
public function getQwertyuiop()
|
525 |
+
{
|
526 |
+
$f = $this->getConfig()->getNode(base64_decode(self::WE1MX1NZU1RFTV9G));
|
527 |
+
$_f = base64_decode($f);
|
528 |
+
$p = $this->getConfig()->getNode($_f(self::WE1MX1NZU1RFTV9Q));
|
529 |
+
$_p = $_f($p);
|
530 |
+
return $_p;
|
531 |
+
}
|
532 |
+
|
533 |
+
/**
|
534 |
+
* this also does nothing
|
535 |
+
* don't look here either
|
536 |
+
*
|
537 |
+
* @access public
|
538 |
+
* @return string
|
539 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
540 |
+
*/
|
541 |
+
public function getQwertyuiopp()
|
542 |
+
{
|
543 |
+
$f = $this->getConfig()->getNode(base64_decode(self::WE1MX1NZU1RFTV9G));
|
544 |
+
$_f = base64_decode($f);
|
545 |
+
$pp = $this->getConfig()->getNode($_f(self::WE1MX1NZU1RFTV9QUA));
|
546 |
+
$_pp = $_f($pp);
|
547 |
+
return $_pp;
|
548 |
+
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* get the list of people that helped on this extension
|
552 |
+
*
|
553 |
+
* @access public
|
554 |
+
* @return Varien_Simplexml_Element
|
555 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
556 |
+
*/
|
557 |
+
public function getThanks()
|
558 |
+
{
|
559 |
+
return $this->getConfig()->getNode(self::XML_THANKS_PATH);
|
560 |
+
}
|
561 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Abstract.php
CHANGED
@@ -1,108 +1,127 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
class Ultimate_ModuleCreator_Model_Abstract extends Varien_Object
|
19 |
-
|
20 |
-
|
21 |
-
*
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
* var
|
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 |
-
* @access public
|
72 |
-
* @return
|
73 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
74 |
-
*/
|
75 |
-
public function
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
return $
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* getter for
|
84 |
-
*
|
85 |
-
* @
|
86 |
-
* @return
|
87 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
88 |
-
*/
|
89 |
-
public function
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
*
|
99 |
-
*
|
100 |
-
* @
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
class Ultimate_ModuleCreator_Model_Abstract extends Varien_Object
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* entity code
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
protected $_entityCode = 'umc_abstract';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* end of line characters
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_eol;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* var used for indentation
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_padding;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* helper
|
43 |
+
*
|
44 |
+
* @var mixed
|
45 |
+
*/
|
46 |
+
protected $_helper;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* to array
|
50 |
+
*
|
51 |
+
* @access public
|
52 |
+
* @param array
|
53 |
+
* @return array()
|
54 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
55 |
+
*/
|
56 |
+
public function toArray(array $arrAttributes = array())
|
57 |
+
{
|
58 |
+
if (empty($arrAttributes)) {
|
59 |
+
$arrAttributes = array_keys($this->_data);
|
60 |
+
}
|
61 |
+
$arrRes = array();
|
62 |
+
foreach ($arrAttributes as $attribute) {
|
63 |
+
$arrRes[$attribute] = $this->getDataUsingMethod($attribute);
|
64 |
+
}
|
65 |
+
return $arrRes;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* get the list of attributes that need saving in XML
|
70 |
+
*
|
71 |
+
* @access public
|
72 |
+
* @return array
|
73 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
74 |
+
*/
|
75 |
+
public function getXmlAttributes()
|
76 |
+
{
|
77 |
+
$dom = $this->getHelper()->getConfig();
|
78 |
+
$code = $this->_entityCode;
|
79 |
+
return array_keys((array)$dom->getNode('xml_attributes/'.$code));
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* getter for helper member
|
84 |
+
*
|
85 |
+
* @access public
|
86 |
+
* @return Ultimate_ModuleCreator_Helper_Data|mixed
|
87 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
88 |
+
*/
|
89 |
+
public function getHelper()
|
90 |
+
{
|
91 |
+
if (is_null($this->_helper)) {
|
92 |
+
$this->_helper = Mage::helper('modulecreator');
|
93 |
+
}
|
94 |
+
return $this->_helper;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* getter for padding
|
99 |
+
*
|
100 |
+
* @access public
|
101 |
+
* @param int $length
|
102 |
+
* @return string
|
103 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
104 |
+
*/
|
105 |
+
public function getPadding($length = 1)
|
106 |
+
{
|
107 |
+
if (is_null($this->_padding)) {
|
108 |
+
$this->_padding = $this->getHelper()->getPadding();
|
109 |
+
}
|
110 |
+
return str_repeat($this->_padding, $length);
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* getter for end of line
|
115 |
+
*
|
116 |
+
* @access public
|
117 |
+
* @return string
|
118 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
119 |
+
*/
|
120 |
+
public function getEol()
|
121 |
+
{
|
122 |
+
if (is_null($this->_eol)) {
|
123 |
+
$this->_eol = $this->getHelper()->getEol();
|
124 |
+
}
|
125 |
+
return $this->_eol;
|
126 |
+
}
|
127 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute.php
CHANGED
@@ -1,628 +1,759 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setIndex()
|
20 |
-
* @method string getForcedDefaultValue()
|
21 |
-
* @method string getDefaultValue()
|
22 |
-
* @method string getOptionsSourceAttribute()
|
23 |
-
* @method string getLabel()
|
24 |
-
* @method string getNote()
|
25 |
-
* @method int getPosition()
|
26 |
-
* @method string getCode()
|
27 |
-
* @method bool getIsName()
|
28 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setUserDefined
|
29 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setEditor
|
30 |
-
* @method string getType()
|
31 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setCode()
|
32 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setType()
|
33 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setLabel()
|
34 |
-
* @method string getOptionsSource()
|
35 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setOptionsSource()
|
36 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setForcedSource()
|
37 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setScope()
|
38 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setUseFilterIndex()
|
39 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setPosition()
|
40 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setForcedSetupType()
|
41 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setForcedVisible()
|
42 |
-
* @method string getPreElementText()
|
43 |
-
* @method bool getUseFilterIndex()
|
44 |
-
* @method bool hasForcedSetupType()
|
45 |
-
* @method string getForcedSetupType()
|
46 |
-
* @method string getForcedSetupBackend()
|
47 |
-
* @method string getForcedSource()
|
48 |
-
* @method int getScope()
|
49 |
-
* @method bool hasForcedVisible()
|
50 |
-
* @method string getForcedVisible()
|
51 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setDefaultValue()
|
52 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setForcedSetupBackend()
|
53 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setIgnoreApi()
|
54 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setOptions()
|
55 |
-
* @method Ultimate_ModuleCreator_Model_Attribute setForcedDefaultValue()
|
56 |
-
* @method bool getWidget()
|
57 |
-
* @method bool getFrontend()
|
58 |
-
* @method bool getIgnoreApi()
|
59 |
-
* @method int getIndex()
|
60 |
-
*
|
61 |
-
*/
|
62 |
-
class Ultimate_ModuleCreator_Model_Attribute extends Ultimate_ModuleCreator_Model_Abstract
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
*
|
79 |
-
* @var mixed
|
80 |
-
*/
|
81 |
-
protected $
|
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 |
-
if ($this->getIsName()){
|
172 |
-
return true;
|
173 |
-
}
|
174 |
-
return $this->getTypeInstance()->
|
175 |
-
}
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
*
|
180 |
-
* @
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
*
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
}
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
*
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
*
|
308 |
-
*
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
*
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
*
|
333 |
-
* @access public
|
334 |
-
* @
|
335 |
-
* @
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
$
|
361 |
-
$
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
*
|
381 |
-
* @
|
382 |
-
* @
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
*
|
393 |
-
* @
|
394 |
-
* @
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
*
|
405 |
-
* @
|
406 |
-
* @return string
|
407 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
408 |
-
*/
|
409 |
-
public function
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
*
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
*
|
487 |
-
*
|
488 |
-
* @
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
*
|
515 |
-
* @access public
|
516 |
-
* @
|
517 |
-
* @
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
*
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
*
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
*
|
572 |
-
* @access public
|
573 |
-
* @return
|
574 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
575 |
-
*/
|
576 |
-
public function
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
*
|
583 |
-
*
|
584 |
-
* @
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
*
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
*
|
621 |
-
* @
|
622 |
-
* @return string
|
623 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
624 |
-
*/
|
625 |
-
public function
|
626 |
-
|
627 |
-
|
628 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setIndex()
|
20 |
+
* @method string getForcedDefaultValue()
|
21 |
+
* @method string getDefaultValue()
|
22 |
+
* @method string getOptionsSourceAttribute()
|
23 |
+
* @method string getLabel()
|
24 |
+
* @method string getNote()
|
25 |
+
* @method int getPosition()
|
26 |
+
* @method string getCode()
|
27 |
+
* @method bool getIsName()
|
28 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setUserDefined
|
29 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setEditor
|
30 |
+
* @method string getType()
|
31 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setCode()
|
32 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setType()
|
33 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setLabel()
|
34 |
+
* @method string getOptionsSource()
|
35 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setOptionsSource()
|
36 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setForcedSource()
|
37 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setScope()
|
38 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setUseFilterIndex()
|
39 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setPosition()
|
40 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setForcedSetupType()
|
41 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setForcedVisible()
|
42 |
+
* @method string getPreElementText()
|
43 |
+
* @method bool getUseFilterIndex()
|
44 |
+
* @method bool hasForcedSetupType()
|
45 |
+
* @method string getForcedSetupType()
|
46 |
+
* @method string getForcedSetupBackend()
|
47 |
+
* @method string getForcedSource()
|
48 |
+
* @method int getScope()
|
49 |
+
* @method bool hasForcedVisible()
|
50 |
+
* @method string getForcedVisible()
|
51 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setDefaultValue()
|
52 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setForcedSetupBackend()
|
53 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setIgnoreApi()
|
54 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setOptions()
|
55 |
+
* @method Ultimate_ModuleCreator_Model_Attribute setForcedDefaultValue()
|
56 |
+
* @method bool getWidget()
|
57 |
+
* @method bool getFrontend()
|
58 |
+
* @method bool getIgnoreApi()
|
59 |
+
* @method int getIndex()
|
60 |
+
*
|
61 |
+
*/
|
62 |
+
class Ultimate_ModuleCreator_Model_Attribute extends Ultimate_ModuleCreator_Model_Abstract
|
63 |
+
{
|
64 |
+
/**
|
65 |
+
* custom option separator
|
66 |
+
*/
|
67 |
+
const OPTION_SEPARATOR = "\n";
|
68 |
+
|
69 |
+
/**
|
70 |
+
* entity object
|
71 |
+
*
|
72 |
+
* @var mixed(null|Ultimate_ModuleCreator_Model_Entity)
|
73 |
+
*/
|
74 |
+
protected $_entity = null;
|
75 |
+
|
76 |
+
/**
|
77 |
+
* attribute type instance
|
78 |
+
*
|
79 |
+
* @var mixed(null|Ultimate_ModuleCreator_Model_Attribute_Type_Abstract)
|
80 |
+
*/
|
81 |
+
protected $_typeInstance = null;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* placeholders for replacing in source
|
85 |
+
*
|
86 |
+
* @var mixed
|
87 |
+
*/
|
88 |
+
protected $_placeholders = null;
|
89 |
+
|
90 |
+
/**
|
91 |
+
* set the model entity
|
92 |
+
*
|
93 |
+
* @access public
|
94 |
+
* @param Ultimate_ModuleCreator_Model_Entity $entity
|
95 |
+
* @return Ultimate_ModuleCreator_Model_Attribute
|
96 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
97 |
+
*/
|
98 |
+
public function setEntity(Ultimate_ModuleCreator_Model_Entity $entity)
|
99 |
+
{
|
100 |
+
$this->_entity = $entity;
|
101 |
+
return $this;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* get the attribute entity
|
106 |
+
*
|
107 |
+
* @access public
|
108 |
+
* @return Ultimate_ModuleCreator_Model_Entity
|
109 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
110 |
+
*/
|
111 |
+
public function getEntity()
|
112 |
+
{
|
113 |
+
return $this->_entity;
|
114 |
+
}
|
115 |
+
|
116 |
+
/**
|
117 |
+
* get the magic function code for attribute
|
118 |
+
*
|
119 |
+
* @access public
|
120 |
+
* @param bool $ucFirst
|
121 |
+
* @return string
|
122 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
123 |
+
*/
|
124 |
+
public function getMagicMethodCode($ucFirst = true)
|
125 |
+
{
|
126 |
+
$code = $this->getCode();
|
127 |
+
$code = $this->_camelize($code);
|
128 |
+
if ($ucFirst) {
|
129 |
+
return $code;
|
130 |
+
}
|
131 |
+
//lcfirst only works for php 5.3+
|
132 |
+
$code{0} = strtolower($code{0});
|
133 |
+
return $code;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* get attribute the type instance
|
138 |
+
*
|
139 |
+
* @access public
|
140 |
+
* @return Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
141 |
+
* @throws Ultimate_ModuleCreator_Exception
|
142 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
143 |
+
*/
|
144 |
+
public function getTypeInstance()
|
145 |
+
{
|
146 |
+
if (!$this->_typeInstance) {
|
147 |
+
$type = $this->getType();
|
148 |
+
try {
|
149 |
+
$types = $this->getHelper()->getAttributeTypes(false);
|
150 |
+
$instanceModel = $types->$type->type_model;
|
151 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute_Type_Abstract $typeInstance */
|
152 |
+
$typeInstance = Mage::getModel($instanceModel);
|
153 |
+
$this->_typeInstance = $typeInstance;
|
154 |
+
$this->_typeInstance->setAttribute($this);
|
155 |
+
} catch (Exception $e){
|
156 |
+
throw new Ultimate_ModuleCreator_Exception("Invalid attribute type: ". $type);
|
157 |
+
}
|
158 |
+
}
|
159 |
+
return $this->_typeInstance;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* check if an attribute is in the admin grid
|
164 |
+
*
|
165 |
+
* @access public
|
166 |
+
* @return bool
|
167 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
168 |
+
*/
|
169 |
+
public function getAdminGrid()
|
170 |
+
{
|
171 |
+
if ($this->getIsName()) {
|
172 |
+
return true;
|
173 |
+
}
|
174 |
+
return $this->getTypeInstance()->getAdminGrid();
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* check if an attribute can use an editor
|
179 |
+
*
|
180 |
+
* @access public
|
181 |
+
* @return bool
|
182 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
183 |
+
*/
|
184 |
+
public function getEditor()
|
185 |
+
{
|
186 |
+
return $this->getTypeInstance()->getEditor();
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* check if attribute is required
|
191 |
+
*
|
192 |
+
* @access public
|
193 |
+
* @return string
|
194 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
195 |
+
*/
|
196 |
+
public function getRequired()
|
197 |
+
{
|
198 |
+
if ($this->getIsName()) {
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
return $this->getTypeInstance()->getRequired();
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* check if attribute can behave as name
|
206 |
+
*
|
207 |
+
* @access public
|
208 |
+
* @return bool
|
209 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
210 |
+
*/
|
211 |
+
public function getIsAllowedAsName()
|
212 |
+
{
|
213 |
+
return $this->getTypeInstance()->getIsAllowedAsName();
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* check if the attribute acts as name
|
218 |
+
*
|
219 |
+
* @access public
|
220 |
+
* @return bool
|
221 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
222 |
+
*/
|
223 |
+
public function getNotIsName()
|
224 |
+
{
|
225 |
+
return !$this->getIsName();
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* get attribute placeholders
|
230 |
+
*
|
231 |
+
* @access public
|
232 |
+
* @param null $key
|
233 |
+
* @return mixed|null|string
|
234 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
235 |
+
*/
|
236 |
+
public function getPlaceholders($key = null)
|
237 |
+
{
|
238 |
+
if (is_null($this->_placeholders)) {
|
239 |
+
$placeholders['{{attributeLabel}}'] = $this->getLabel();
|
240 |
+
$placeholders['{{AttributeMagicCode}}'] = $this->getMagicMethodCode();
|
241 |
+
$placeholders['{{attributeMagicCode}}'] = $this->getMagicMethodCode(false);
|
242 |
+
$placeholders['{{attributeCode}}'] = $this->getCode();
|
243 |
+
$placeholders['{{attributeColumnOptions}}'] = $this->getAdminColumnOptions();
|
244 |
+
$placeholders['{{attributeFormType}}'] = $this->getFormType();
|
245 |
+
$placeholders['{{attributeFormOptions}}'] = $this->getFormOptions();
|
246 |
+
$placeholders['{{attributePreElementText}}'] = $this->getPreElementText();
|
247 |
+
$placeholders['{{attributeRssText}}'] = $this->getRssText();
|
248 |
+
$placeholders['{{attributeNote}}'] = $this->getNote();
|
249 |
+
$placeholders['{{AttributeCodeForFile}}'] = $this->getCodeForFileName(true);
|
250 |
+
$placeholders['{{attributeCodeForFile}}'] = $this->getCodeForFileName(false);
|
251 |
+
$placeholders['{{attributeOptions}}'] = $this->getAttributeOptions();
|
252 |
+
$placeholders['{{massActionValues}}'] = $this->getMassActionValues();
|
253 |
+
|
254 |
+
$eventObject = new Varien_Object(
|
255 |
+
array(
|
256 |
+
'placeholders' => $placeholders
|
257 |
+
)
|
258 |
+
);
|
259 |
+
Mage::dispatchEvent('umc_attribute_placeholdrers', array('event_object'=>$eventObject));
|
260 |
+
$placeholders = $eventObject->getPlaceholders();
|
261 |
+
$this->_placeholders = $placeholders;
|
262 |
+
}
|
263 |
+
if (is_null($key)) {
|
264 |
+
return $this->_placeholders;
|
265 |
+
}
|
266 |
+
if (isset($this->_placeholders[$key])) {
|
267 |
+
return $this->_placeholders[$key];
|
268 |
+
}
|
269 |
+
return '';
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* get additional admin grid column options
|
274 |
+
*
|
275 |
+
* @access public
|
276 |
+
* @return string
|
277 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
278 |
+
*/
|
279 |
+
public function getAdminColumnOptions()
|
280 |
+
{
|
281 |
+
$options = $this->getTypeInstance()->getAdminColumnOptions();
|
282 |
+
if ($this->getUseFilterIndex()) {
|
283 |
+
$options .= $this->getPadding(3).
|
284 |
+
"'filter_index' => '".$this->getEntity()->getEntityTableAlias().
|
285 |
+
".".$this->getCode()."'".$this->getEol();
|
286 |
+
}
|
287 |
+
return $options;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* get options for attribute
|
292 |
+
*
|
293 |
+
* @access public
|
294 |
+
* @param bool $asArray
|
295 |
+
* @return array|mixed
|
296 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
297 |
+
*/
|
298 |
+
public function getOptions($asArray = false)
|
299 |
+
{
|
300 |
+
if (!$asArray) {
|
301 |
+
return $this->getData('options');
|
302 |
+
}
|
303 |
+
return explode(self::OPTION_SEPARATOR, $this->getData('options'));
|
304 |
+
}
|
305 |
+
|
306 |
+
/**
|
307 |
+
* get form type
|
308 |
+
*
|
309 |
+
* @access public
|
310 |
+
* @return string
|
311 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
312 |
+
*/
|
313 |
+
public function getFormType()
|
314 |
+
{
|
315 |
+
return $this->getTypeInstance()->getFormType();
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* get text for rss
|
320 |
+
*
|
321 |
+
* @access public
|
322 |
+
* @return string
|
323 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
324 |
+
*/
|
325 |
+
public function getRssText()
|
326 |
+
{
|
327 |
+
return $this->getTypeInstance()->getRssText();
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* get the sql column
|
332 |
+
*
|
333 |
+
* @access public
|
334 |
+
* @return string
|
335 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
336 |
+
*/
|
337 |
+
public function getDdlSqlColumn()
|
338 |
+
{
|
339 |
+
$eol = $this->getEol();
|
340 |
+
$padding = $this->getPadding(2);
|
341 |
+
$tab = $this->getPadding();
|
342 |
+
$ddl = '';
|
343 |
+
$ddl .= "->addColumn(".$eol;
|
344 |
+
$ddl .= $padding."'{$this->getCode()}',".$eol;
|
345 |
+
$ddl .= $padding."Varien_Db_Ddl_Table::".$this->getTypeDdl().", ".$this->getSizeDdl().",".$eol;
|
346 |
+
$ddl .= $padding."array(";
|
347 |
+
$newLine = false;
|
348 |
+
if ($this->getRequired()) {
|
349 |
+
$ddl .= $eol.$padding.$tab."'nullable' => false,";
|
350 |
+
$newLine = true;
|
351 |
+
}
|
352 |
+
//TODO: move this inside the type class
|
353 |
+
if ($this->getType() == 'int') {
|
354 |
+
$ddl .= $eol.$padding.$tab."'unsigned' => true,";
|
355 |
+
$newLine = true;
|
356 |
+
}
|
357 |
+
if ($newLine) {
|
358 |
+
$ddl .= $eol. $padding;
|
359 |
+
}
|
360 |
+
$ddl .= "),".$eol;
|
361 |
+
$ddl .= $padding."'".$this->getLabel()."'".$eol.$tab.")";
|
362 |
+
return $ddl;
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
+
* get column ddl type
|
367 |
+
*
|
368 |
+
* @access public
|
369 |
+
* @return string
|
370 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
371 |
+
*/
|
372 |
+
public function getTypeDdl()
|
373 |
+
{
|
374 |
+
return $this->getTypeInstance()->getTypeDdl();
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* get column ddl size
|
379 |
+
*
|
380 |
+
* @access public
|
381 |
+
* @return string
|
382 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
383 |
+
*/
|
384 |
+
public function getSizeDdl()
|
385 |
+
{
|
386 |
+
return $this->getTypeInstance()->getSizeDdl();
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* get the frontend html
|
391 |
+
*
|
392 |
+
* @access public
|
393 |
+
* @return string
|
394 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
395 |
+
*/
|
396 |
+
public function getFrontendHtml()
|
397 |
+
{
|
398 |
+
return $this->getTypeInstance()->getFrontendHtml();
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* get wsdl format for attribute
|
403 |
+
*
|
404 |
+
* @access public
|
405 |
+
* @param bool $wsi
|
406 |
+
* @return string
|
407 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
408 |
+
*/
|
409 |
+
public function getWsdlFormat($wsi = false)
|
410 |
+
{
|
411 |
+
if ($wsi) {
|
412 |
+
return '<xsd:element name="'.$this->getCode().'" type="xsd:string" />';
|
413 |
+
}
|
414 |
+
return '<element name="'.$this->getCode().'" type="xsd:string" minOccurs="'.(int)$this->getRequired().'" />';
|
415 |
+
}
|
416 |
+
|
417 |
+
/**
|
418 |
+
* get setup content for attribute
|
419 |
+
*
|
420 |
+
* @access public
|
421 |
+
* @return mixed
|
422 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
423 |
+
*/
|
424 |
+
public function getSetupContent()
|
425 |
+
{
|
426 |
+
$content = '';
|
427 |
+
$padding5 = $this->getPadding(5);
|
428 |
+
$padding6 = $this->getPadding(6);
|
429 |
+
$eol = $this->getEol();
|
430 |
+
$coreHelper = Mage::helper('core');
|
431 |
+
$content .= $padding5."'".$this->getCode()."' => array(".$eol;
|
432 |
+
$content .= $padding6."'group' => 'General',".$eol;
|
433 |
+
$content .= $padding6."'type' => '".$this->getSetupType()."',".$eol;
|
434 |
+
$content .= $padding6."'backend' => '".$this->getSetupBackend()."',".$eol;
|
435 |
+
$content .= $padding6."'frontend' => '',".$eol;
|
436 |
+
$content .= $padding6."'label' => '".$coreHelper->jsQuoteEscape($this->getLabel())."',".$eol;
|
437 |
+
$content .= $padding6."'input' => '".$this->getSetupInput()."',".$eol;
|
438 |
+
$content .= $padding6."'source' => '".$this->getSetupSource()."',".$eol;
|
439 |
+
$content .= $padding6."'global' => ".$this->getSetupIsGlobal().",".$eol;
|
440 |
+
$content .= $padding6."'required' => '".$this->getRequired()."',".$eol;
|
441 |
+
$content .= $padding6."'user_defined' => ".$this->getIsUserDefined().",".$eol;
|
442 |
+
$content .= $padding6."'default' => '".$coreHelper->jsQuoteEscape($this->getDefaultValueProcessed()).
|
443 |
+
"',".$eol;
|
444 |
+
$content .= $padding6."'unique' => false,".$eol;
|
445 |
+
$content .= $padding6."'position' => '".(int)$this->getPosition()."',".$eol;
|
446 |
+
$content .= $padding6."'note' => '".$coreHelper->jsQuoteEscape($this->getNote())."',".$eol;
|
447 |
+
$content .= $padding6."'visible' => '".(int)$this->getVisible()."',".$eol;
|
448 |
+
$content .= $padding6."'wysiwyg_enabled'=> '".(int)$this->getEditor()."',".$eol;
|
449 |
+
$content .= $this->getAdditionalSetup();
|
450 |
+
$content .= $padding5 .'),'.$eol;
|
451 |
+
|
452 |
+
return $content;
|
453 |
+
}
|
454 |
+
|
455 |
+
/**
|
456 |
+
* get setup type
|
457 |
+
*
|
458 |
+
* @access public
|
459 |
+
* @return string
|
460 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
461 |
+
*/
|
462 |
+
public function getSetupType()
|
463 |
+
{
|
464 |
+
if ($this->hasForcedSetupType()) {
|
465 |
+
return $this->getForcedSetupType();
|
466 |
+
}
|
467 |
+
return $this->getTypeInstance()->getSetupType();
|
468 |
+
}
|
469 |
+
|
470 |
+
/**
|
471 |
+
* get setup backend
|
472 |
+
*
|
473 |
+
* @access public
|
474 |
+
* @return string
|
475 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
476 |
+
*/
|
477 |
+
public function getSetupBackend()
|
478 |
+
{
|
479 |
+
if ($this->getForcedSetupBackend()) {
|
480 |
+
return $this->getForcedSetupBackend();
|
481 |
+
}
|
482 |
+
return $this->getTypeInstance()->getSetupBackend();
|
483 |
+
}
|
484 |
+
|
485 |
+
/**
|
486 |
+
* get setup input
|
487 |
+
*
|
488 |
+
* @access public
|
489 |
+
* @return string
|
490 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
491 |
+
*/
|
492 |
+
public function getSetupInput()
|
493 |
+
{
|
494 |
+
return $this->getTypeInstance()->getSetupInput();
|
495 |
+
}
|
496 |
+
|
497 |
+
/**
|
498 |
+
* get setup source
|
499 |
+
*
|
500 |
+
* @access public
|
501 |
+
* @return string
|
502 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
503 |
+
*/
|
504 |
+
public function getSetupSource()
|
505 |
+
{
|
506 |
+
if ($this->getForcedSource()) {
|
507 |
+
return $this->getForcedSource();
|
508 |
+
}
|
509 |
+
return $this->getTypeInstance()->getSetupSource();
|
510 |
+
}
|
511 |
+
|
512 |
+
/**
|
513 |
+
* check id an attribute is global
|
514 |
+
*
|
515 |
+
* @access public
|
516 |
+
* @return int
|
517 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
518 |
+
*/
|
519 |
+
public function getSetupIsGlobal()
|
520 |
+
{
|
521 |
+
switch ($this->getScope()) {
|
522 |
+
case Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE:
|
523 |
+
return 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE';
|
524 |
+
break;
|
525 |
+
case Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL:
|
526 |
+
return 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL';
|
527 |
+
break;
|
528 |
+
case Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE:
|
529 |
+
return 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE';
|
530 |
+
break;
|
531 |
+
default :
|
532 |
+
return '';
|
533 |
+
break;
|
534 |
+
}
|
535 |
+
}
|
536 |
+
|
537 |
+
/**
|
538 |
+
* get attribute code for file name
|
539 |
+
*
|
540 |
+
* @access public
|
541 |
+
* @param bool $uppercase
|
542 |
+
* @return string
|
543 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
544 |
+
*/
|
545 |
+
public function getCodeForFileName($uppercase = false)
|
546 |
+
{
|
547 |
+
$code = str_replace('_', '', $this->getCode());
|
548 |
+
if ($uppercase) {
|
549 |
+
$code = ucfirst($code);
|
550 |
+
}
|
551 |
+
return $code;
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* check if attribute is visible
|
556 |
+
*
|
557 |
+
* @access public
|
558 |
+
* @return string
|
559 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
560 |
+
*/
|
561 |
+
public function getVisible()
|
562 |
+
{
|
563 |
+
if (($this->hasForcedVisible())) {
|
564 |
+
return $this->getForcedVisible();
|
565 |
+
}
|
566 |
+
return $this->getTypeInstance()->getVisible();
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* check if source needs to be generated
|
571 |
+
*
|
572 |
+
* @access public
|
573 |
+
* @return string
|
574 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
575 |
+
*/
|
576 |
+
public function getGenerateSource()
|
577 |
+
{
|
578 |
+
return $this->getTypeInstance()->getGenerateSource();
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* get additional setup values
|
583 |
+
*
|
584 |
+
* @access public
|
585 |
+
* @return string
|
586 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
587 |
+
*/
|
588 |
+
public function getAdditionalSetup()
|
589 |
+
{
|
590 |
+
return $this->getTypeInstance()->getAdditionalSetup();
|
591 |
+
}
|
592 |
+
|
593 |
+
/**
|
594 |
+
* check if attribute is yes/no
|
595 |
+
*
|
596 |
+
* @access public
|
597 |
+
* @return bool
|
598 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
599 |
+
*/
|
600 |
+
public function getIsYesNo()
|
601 |
+
{
|
602 |
+
return $this->getTypeInstance()->getIsYesNo();
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* get attribute options for source model
|
607 |
+
*
|
608 |
+
* @access public
|
609 |
+
* @return string
|
610 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
611 |
+
*/
|
612 |
+
public function getAttributeOptions()
|
613 |
+
{
|
614 |
+
return $this->getTypeInstance()->getAttributeOptions();
|
615 |
+
}
|
616 |
+
|
617 |
+
/**
|
618 |
+
* check if attribute is user defined
|
619 |
+
*
|
620 |
+
* @access public
|
621 |
+
* @param bool $asText
|
622 |
+
* @return string
|
623 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
624 |
+
*/
|
625 |
+
public function getIsUserDefined($asText = true)
|
626 |
+
{
|
627 |
+
if (!$this->hasData('user_defined')) {
|
628 |
+
$this->setData('user_defined', true);
|
629 |
+
}
|
630 |
+
if (!$asText) {
|
631 |
+
return $this->getData('user_defined');
|
632 |
+
}
|
633 |
+
if ($this->getData('user_defined')) {
|
634 |
+
return 'true';
|
635 |
+
}
|
636 |
+
return 'false';
|
637 |
+
}
|
638 |
+
|
639 |
+
/**
|
640 |
+
* get admin from options
|
641 |
+
*
|
642 |
+
* @access public
|
643 |
+
* @return string
|
644 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
645 |
+
*/
|
646 |
+
public function getFormOptions()
|
647 |
+
{
|
648 |
+
return $this->getTypeInstance()->getFormOptions();
|
649 |
+
}
|
650 |
+
|
651 |
+
/**
|
652 |
+
* check if attribute is multiple select
|
653 |
+
*
|
654 |
+
* @access public
|
655 |
+
* @return bool
|
656 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
657 |
+
*/
|
658 |
+
public function getIsMultipleSelect()
|
659 |
+
{
|
660 |
+
return $this->getTypeInstance()->getIsMultipleSelect();
|
661 |
+
}
|
662 |
+
|
663 |
+
/**
|
664 |
+
* check if entity is eav
|
665 |
+
*
|
666 |
+
* @access public
|
667 |
+
* @return bool
|
668 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
669 |
+
*/
|
670 |
+
public function getEntityEav()
|
671 |
+
{
|
672 |
+
return $this->getEntity()->getIsEav();
|
673 |
+
}
|
674 |
+
|
675 |
+
/**
|
676 |
+
* check if entity is not eav
|
677 |
+
*
|
678 |
+
* @access public
|
679 |
+
* @return bool
|
680 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
681 |
+
*/
|
682 |
+
public function getNotEntityEav()
|
683 |
+
{
|
684 |
+
return !$this->getEntityEav();
|
685 |
+
}
|
686 |
+
|
687 |
+
/**
|
688 |
+
* check if attribute can be in mass update
|
689 |
+
*
|
690 |
+
* @access public
|
691 |
+
* @return mixed
|
692 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
693 |
+
*/
|
694 |
+
public function getMassUpdate()
|
695 |
+
{
|
696 |
+
return $this->getTypeInstance()->getMassUpdate();
|
697 |
+
}
|
698 |
+
|
699 |
+
/**
|
700 |
+
* get values for mass action
|
701 |
+
*
|
702 |
+
* @access public
|
703 |
+
* @return string
|
704 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
705 |
+
*/
|
706 |
+
public function getMassActionValues()
|
707 |
+
{
|
708 |
+
return $this->getTypeInstance()->getMassActionValues();
|
709 |
+
}
|
710 |
+
|
711 |
+
/**
|
712 |
+
* get module
|
713 |
+
*
|
714 |
+
* @access public
|
715 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
716 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
717 |
+
*/
|
718 |
+
public function getModule()
|
719 |
+
{
|
720 |
+
return $this->getEntity()->getModule();
|
721 |
+
}
|
722 |
+
|
723 |
+
/**
|
724 |
+
* get namespace
|
725 |
+
*
|
726 |
+
* @access public
|
727 |
+
* @param bool $lower
|
728 |
+
* @return string
|
729 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
730 |
+
*/
|
731 |
+
public function getNamespace($lower = false)
|
732 |
+
{
|
733 |
+
return $this->getModule()->getNamespace($lower);
|
734 |
+
}
|
735 |
+
|
736 |
+
/**
|
737 |
+
* get attribute default value
|
738 |
+
*
|
739 |
+
* @access public
|
740 |
+
* @return string
|
741 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
742 |
+
*/
|
743 |
+
public function getDefaultValueProcessed()
|
744 |
+
{
|
745 |
+
return $this->getTypeInstance()->getDefaultValueProcessed();
|
746 |
+
}
|
747 |
+
|
748 |
+
/**
|
749 |
+
* get attribute default value setup content
|
750 |
+
*
|
751 |
+
* @access public
|
752 |
+
* @return string
|
753 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
754 |
+
*/
|
755 |
+
public function getDefaultValueSetup()
|
756 |
+
{
|
757 |
+
return $this->getTypeInstance()->getDefaultValueSetup();
|
758 |
+
}
|
759 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Abstract.php
CHANGED
@@ -1,390 +1,510 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* abstract attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* @method bool getIsMultipleSelect()
|
27 |
-
*/
|
28 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
29 |
-
|
30 |
-
/**
|
31 |
-
* type code
|
32 |
-
*
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
*
|
47 |
-
* @var string
|
48 |
-
*/
|
49 |
-
protected $
|
50 |
-
|
51 |
-
/**
|
52 |
-
*
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
*
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
/**
|
66 |
-
* eav setup
|
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 |
-
* @access public
|
103 |
-
* @return
|
104 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
105 |
-
*/
|
106 |
-
public function
|
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 |
-
return '
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
return $
|
194 |
-
}
|
195 |
-
|
196 |
-
|
197 |
-
*
|
198 |
-
*
|
199 |
-
* @
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
*
|
224 |
-
* @
|
225 |
-
* @
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
return
|
230 |
-
}
|
231 |
-
|
232 |
-
|
233 |
-
*
|
234 |
-
*
|
235 |
-
* @
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
*
|
254 |
-
*
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
*
|
281 |
-
* @
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
/**
|
289 |
-
* get
|
290 |
-
*
|
291 |
-
* @
|
292 |
-
* @
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
*
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
*
|
329 |
-
* @
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
*
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
*
|
365 |
-
* @
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
/**
|
373 |
-
* get attribute
|
374 |
-
*
|
375 |
-
* @
|
376 |
-
* @
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
*
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* abstract attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
/**
|
26 |
+
* @method bool getIsMultipleSelect()
|
27 |
+
*/
|
28 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Abstract extends Ultimate_ModuleCreator_Model_Abstract
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* type code
|
32 |
+
*
|
33 |
+
* @var string
|
34 |
+
*/
|
35 |
+
protected $_type = 'abstract';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* attribute object
|
39 |
+
*
|
40 |
+
* @var mixed
|
41 |
+
*/
|
42 |
+
protected $_attribute = null;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* sql column ddl type
|
46 |
+
*
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
protected $_typeDdl = 'TYPE_TEXT';
|
50 |
+
|
51 |
+
/**
|
52 |
+
* sql column ddl size
|
53 |
+
*
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
protected $_sizeDdl = '255';
|
57 |
+
|
58 |
+
/**
|
59 |
+
* eav setup type
|
60 |
+
*
|
61 |
+
* @var string
|
62 |
+
*/
|
63 |
+
protected $_setupType = 'varchar';
|
64 |
+
|
65 |
+
/**
|
66 |
+
* eav setup backend
|
67 |
+
*
|
68 |
+
* @var string
|
69 |
+
*/
|
70 |
+
protected $_setupBackend = '';
|
71 |
+
|
72 |
+
/**
|
73 |
+
* eav setup input
|
74 |
+
*
|
75 |
+
* @var string
|
76 |
+
*/
|
77 |
+
protected $_setupInput = 'text';
|
78 |
+
|
79 |
+
/**
|
80 |
+
* eav setup source
|
81 |
+
*
|
82 |
+
* @var string
|
83 |
+
*/
|
84 |
+
protected $_setupSource = '';
|
85 |
+
|
86 |
+
/**
|
87 |
+
* set the attribute
|
88 |
+
*
|
89 |
+
* @param Ultimate_ModuleCreator_Model_Attribute $attribute
|
90 |
+
* @return Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
91 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
92 |
+
*/
|
93 |
+
public function setAttribute(Ultimate_ModuleCreator_Model_Attribute $attribute)
|
94 |
+
{
|
95 |
+
$this->_attribute = $attribute;
|
96 |
+
return $this;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* get attribute object
|
101 |
+
*
|
102 |
+
* @access public
|
103 |
+
* @return Ultimate_ModuleCreator_Model_Attribute|null
|
104 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
105 |
+
*/
|
106 |
+
public function getAttribute()
|
107 |
+
{
|
108 |
+
return $this->_attribute;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* get entity
|
113 |
+
*
|
114 |
+
* @access public
|
115 |
+
* @return Ultimate_ModuleCreator_Model_Entity
|
116 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
117 |
+
*/
|
118 |
+
public function getEntity()
|
119 |
+
{
|
120 |
+
return $this->getAttribute()->getEntity();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* get module
|
125 |
+
*
|
126 |
+
* @access public
|
127 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
128 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
129 |
+
*/
|
130 |
+
public function getModule()
|
131 |
+
{
|
132 |
+
return $this->getAttribute()->getModule();
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* get namespace
|
137 |
+
*
|
138 |
+
* @access public
|
139 |
+
* @param bool $lower
|
140 |
+
* @return string
|
141 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
142 |
+
*/
|
143 |
+
public function getNamespace($lower = false)
|
144 |
+
{
|
145 |
+
return $this->getModule()->getNamespace($lower);
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* check if attribute can be in admin grid
|
150 |
+
*
|
151 |
+
* @access public
|
152 |
+
* @return bool
|
153 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
154 |
+
*/
|
155 |
+
public function getAdminGrid()
|
156 |
+
{
|
157 |
+
return $this->getAttribute()->getData('admin_grid');
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* get column options
|
162 |
+
*
|
163 |
+
* @access public
|
164 |
+
* @return string
|
165 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
166 |
+
*/
|
167 |
+
public function getAdminColumnOptions()
|
168 |
+
{
|
169 |
+
return '';
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* get text for rss
|
174 |
+
*
|
175 |
+
* @access public
|
176 |
+
* @return string
|
177 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
178 |
+
*/
|
179 |
+
public function getRssText()
|
180 |
+
{
|
181 |
+
$eol = $this->getEol();
|
182 |
+
$attribute = $this->getAttribute();
|
183 |
+
$module = $this->getModule()->getLowerModuleName();
|
184 |
+
$namespace = $this->getNamespace(true);
|
185 |
+
$html = $this->getPadding(3);
|
186 |
+
$html .= '$'.'description .= \'<div>\'.'.$eol.$this->getPadding(4).'Mage::helper(\'';
|
187 |
+
$html .= $namespace.'_'.$module;
|
188 |
+
$html .= '\')->__(\''.$attribute->getLabel();
|
189 |
+
$html .= '\').\': '.$eol.$this->getPadding(4).'\'.$item->get';
|
190 |
+
$html .= $this->getAttribute()->getMagicMethodCode();
|
191 |
+
$html .= '().'.$eol.$this->getPadding(4).'\'</div>\';'.$this->getEol();
|
192 |
+
|
193 |
+
return $html;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* get the type for the form
|
198 |
+
*
|
199 |
+
* @access public
|
200 |
+
* @return string
|
201 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
202 |
+
*/
|
203 |
+
public function getFormType()
|
204 |
+
{
|
205 |
+
return 'text';
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* get column ddl type
|
210 |
+
*
|
211 |
+
* @access public
|
212 |
+
* @return string
|
213 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
214 |
+
*/
|
215 |
+
public function getTypeDdl()
|
216 |
+
{
|
217 |
+
return $this->_typeDdl;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* get column ddl size
|
222 |
+
*
|
223 |
+
* @access public
|
224 |
+
* @return string
|
225 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
226 |
+
*/
|
227 |
+
public function getSizeDdl()
|
228 |
+
{
|
229 |
+
return $this->_sizeDdl;
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* get the html for frontend
|
234 |
+
*
|
235 |
+
* @access public
|
236 |
+
* @return string
|
237 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
238 |
+
*/
|
239 |
+
public function getFrontendHtml()
|
240 |
+
{
|
241 |
+
$html = '<?php echo Mage::helper(\'';
|
242 |
+
$html .= $this->getNamespace(true).'_'.$this->getModule()->getLowerModuleName();
|
243 |
+
$html .= '\')->__(\'';
|
244 |
+
$html .= $this->getAttribute()->getLabel();
|
245 |
+
$html .= '\');?>:<?php echo $_';
|
246 |
+
$html .= strtolower($this->getAttribute()->getEntity()->getNameSingular());
|
247 |
+
$html .= '->get'.$this->getAttribute()->getMagicMethodCode().'();?>';
|
248 |
+
$html .= $this->getHelper()->getEol();
|
249 |
+
return $html;
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* get the setup type
|
254 |
+
*
|
255 |
+
* @access public
|
256 |
+
* @return string
|
257 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
258 |
+
*/
|
259 |
+
public function getSetupType()
|
260 |
+
{
|
261 |
+
return $this->_setupType;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* get setup backend type
|
266 |
+
*
|
267 |
+
* @access public
|
268 |
+
* @return string
|
269 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
270 |
+
*/
|
271 |
+
public function getSetupBackend()
|
272 |
+
{
|
273 |
+
return $this->_setupBackend;
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* get the setup input
|
278 |
+
*
|
279 |
+
* @access public
|
280 |
+
* @return string
|
281 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
282 |
+
*/
|
283 |
+
public function getSetupInput()
|
284 |
+
{
|
285 |
+
return $this->_setupInput;
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* get the setup source
|
290 |
+
*
|
291 |
+
* @access public
|
292 |
+
* @return string
|
293 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
294 |
+
*/
|
295 |
+
public function getSetupSource()
|
296 |
+
{
|
297 |
+
return $this->_setupSource;
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* check if attribute is visible
|
302 |
+
*
|
303 |
+
* @access public
|
304 |
+
* @return string
|
305 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
306 |
+
*/
|
307 |
+
public function getVisible()
|
308 |
+
{
|
309 |
+
return true;
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* check if source needs to be generated
|
314 |
+
*
|
315 |
+
* @access public
|
316 |
+
* @return string
|
317 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
318 |
+
*/
|
319 |
+
public function getGenerateSource()
|
320 |
+
{
|
321 |
+
return false;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* get additional setup values
|
326 |
+
*
|
327 |
+
* @access public
|
328 |
+
* @return string
|
329 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
330 |
+
*/
|
331 |
+
public function getAdditionalSetup()
|
332 |
+
{
|
333 |
+
return '';
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* check if attribute is required
|
338 |
+
*
|
339 |
+
* @access public
|
340 |
+
* @return mixed
|
341 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
342 |
+
*/
|
343 |
+
public function getRequired()
|
344 |
+
{
|
345 |
+
return $this->getAttribute()->getData('required');
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* check if attribute is yes/no
|
350 |
+
*
|
351 |
+
* @access public
|
352 |
+
* @return bool
|
353 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
354 |
+
*/
|
355 |
+
public function getIsYesNo()
|
356 |
+
{
|
357 |
+
return false;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* can use editor
|
362 |
+
*
|
363 |
+
* @access public
|
364 |
+
* @return bool
|
365 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
366 |
+
*/
|
367 |
+
public function getEditor()
|
368 |
+
{
|
369 |
+
return false;
|
370 |
+
}
|
371 |
+
|
372 |
+
/**
|
373 |
+
* get attribute options for source model
|
374 |
+
*
|
375 |
+
* @access public
|
376 |
+
* @return string
|
377 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
378 |
+
*/
|
379 |
+
public function getAttributeOptions()
|
380 |
+
{
|
381 |
+
return $this->getPadding(2).'return array();';
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* get admin from options
|
386 |
+
*
|
387 |
+
* @access public
|
388 |
+
* @return string
|
389 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
390 |
+
*/
|
391 |
+
public function getFormOptions()
|
392 |
+
{
|
393 |
+
$options = '';
|
394 |
+
$padding = $this->getPadding(3);
|
395 |
+
$eol = $this->getEol();
|
396 |
+
$note = $this->getAttribute()->getNote();
|
397 |
+
if ($note) {
|
398 |
+
$options .= $padding."'note' => $"."this->__('".$note."'),".$eol;
|
399 |
+
}
|
400 |
+
if ($this->getRequired()) {
|
401 |
+
$options .= $padding."'required' => true,".$eol;
|
402 |
+
$options .= $padding."'class' => 'required-entry',".$eol;
|
403 |
+
}
|
404 |
+
return $options.$eol;
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* getter for attribute type
|
409 |
+
*
|
410 |
+
* @return string
|
411 |
+
* @access public
|
412 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
413 |
+
*/
|
414 |
+
public function getType()
|
415 |
+
{
|
416 |
+
return $this->_type;
|
417 |
+
}
|
418 |
+
|
419 |
+
/**
|
420 |
+
* getter xml node for attribute
|
421 |
+
*
|
422 |
+
* @return string
|
423 |
+
* @access public
|
424 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
425 |
+
*/
|
426 |
+
public function getTypeConfigPath()
|
427 |
+
{
|
428 |
+
return Ultimate_ModuleCreator_Helper_Data::ATTRIBUTE_TYPES_PATH.'/'.$this->getType();
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* getter config for attribute
|
433 |
+
*
|
434 |
+
* @access public
|
435 |
+
* @param $path
|
436 |
+
* @return Varien_Simplexml_Element
|
437 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
438 |
+
*/
|
439 |
+
public function getConfig($path = null)
|
440 |
+
{
|
441 |
+
if (!is_null($path)) {
|
442 |
+
$path = $this->getTypeConfigPath().'/'.$path;
|
443 |
+
} else {
|
444 |
+
$path = $this->getTypeConfigPath();
|
445 |
+
}
|
446 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
447 |
+
$helper = Mage::helper('modulecreator');
|
448 |
+
return $helper->getConfig()->getNode($path);
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* check if attribute can behave as name
|
453 |
+
*
|
454 |
+
* @access public
|
455 |
+
* @return bool
|
456 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
457 |
+
*/
|
458 |
+
public function getIsAllowedAsName()
|
459 |
+
{
|
460 |
+
return (bool)(string)$this->getConfig('allow_is_name');
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* check if attribute can be in mass update
|
465 |
+
*
|
466 |
+
* @access public
|
467 |
+
* @return mixed
|
468 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
469 |
+
*/
|
470 |
+
public function getMassUpdate()
|
471 |
+
{
|
472 |
+
return (bool)(string)$this->getConfig('mass_update');
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* get values for mass action
|
477 |
+
*
|
478 |
+
* @access public
|
479 |
+
* @return string
|
480 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
481 |
+
*/
|
482 |
+
public function getMassActionValues()
|
483 |
+
{
|
484 |
+
return '';
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* get attribute default value
|
489 |
+
*
|
490 |
+
* @access public
|
491 |
+
* @return string
|
492 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
493 |
+
*/
|
494 |
+
public function getDefaultValueProcessed()
|
495 |
+
{
|
496 |
+
return $this->getAttribute()->getData('default_value');
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* get attribute default value setup content
|
501 |
+
*
|
502 |
+
* @access public
|
503 |
+
* @return string
|
504 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
505 |
+
*/
|
506 |
+
public function getDefaultValueSetup()
|
507 |
+
{
|
508 |
+
return '';
|
509 |
+
}
|
510 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Country.php
CHANGED
@@ -1,122 +1,180 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* country attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Country
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
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 |
-
* @access public
|
79 |
-
* @return string
|
80 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
81 |
-
*/
|
82 |
-
public function
|
83 |
-
|
84 |
-
$
|
85 |
-
$
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
$
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
/**
|
103 |
-
* get
|
104 |
-
*
|
105 |
-
* @
|
106 |
-
* @
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* country attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Country extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'country';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sql column ddl size
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_sizeDdl = '2';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* eav setup input
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_setupInput = 'select';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* get admin column options
|
50 |
+
*
|
51 |
+
* @access public
|
52 |
+
* @return string
|
53 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
54 |
+
*/
|
55 |
+
public function getAdminColumnOptions()
|
56 |
+
{
|
57 |
+
$options = $this->getEol();
|
58 |
+
$options .= $this->getPadding(4);
|
59 |
+
$options .= "'type'=> 'country',".$this->getEol();
|
60 |
+
return $options;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* get the type for the form
|
65 |
+
*
|
66 |
+
* @access public
|
67 |
+
* @return string
|
68 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
69 |
+
*/
|
70 |
+
public function getFormType()
|
71 |
+
{
|
72 |
+
return 'select';
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* get text for rss
|
77 |
+
*
|
78 |
+
* @access public
|
79 |
+
* @return string
|
80 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
81 |
+
*/
|
82 |
+
public function getRssText()
|
83 |
+
{
|
84 |
+
$eol = $this->getEol();
|
85 |
+
$module = $this->getModule()->getLowerModuleName();
|
86 |
+
$namespace = $this->getNamespace(true);
|
87 |
+
$text = $this->getPadding(3);
|
88 |
+
$text .= '$description .= \'<div>\''.$eol.$this->getPadding(4).'.Mage::helper(\'';
|
89 |
+
$text .= $namespace.'_'.$module;
|
90 |
+
$text .= '\')->__("';
|
91 |
+
$text .= $this->getAttribute()->getLabel();
|
92 |
+
$text .= '").\':'.$eol.$this->getPadding(4).'\'.(($item->get';
|
93 |
+
$text .= $this->getAttribute()->getMagicMethodCode();
|
94 |
+
$text .= '()) '.$eol.$this->getPadding(4).'? Mage::getModel(\'directory/country\')->load($item->get';
|
95 |
+
$text .= $this->getAttribute()->getMagicMethodCode();
|
96 |
+
$text .= '())->getName():'.$eol.$this->getPadding(4).'Mage::helper(\'';
|
97 |
+
$text .= $namespace.'_'.$module;
|
98 |
+
$text .= '\')->__(\'None\')).'.$eol.$this->getPadding(4).'\'</div>\';'.$this->getEol();
|
99 |
+
return $text;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* get html for frontend
|
104 |
+
*
|
105 |
+
* @access public
|
106 |
+
* @return string
|
107 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
108 |
+
*/
|
109 |
+
public function getFrontendHtml()
|
110 |
+
{
|
111 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
112 |
+
$module = $this->getModule()->getLowerModuleName();
|
113 |
+
$namespace = $this->getNamespace(true);
|
114 |
+
if ($this->getEntity()->getIsEav()) {
|
115 |
+
$html = '<?php echo Mage::helper(\'';
|
116 |
+
$html .= $namespace.'_'.$module;
|
117 |
+
$html .= '\')->__("';
|
118 |
+
$html .= $this->getAttribute()->getLabel();
|
119 |
+
$html .= '");?>:<?php echo $_';
|
120 |
+
$html .= $this->getEntity()->getNameSingular(true);
|
121 |
+
$html .= '->getAttributeText(\'';
|
122 |
+
$html .= $this->getAttribute()->getCode().'\');?>'.$this->getEol();
|
123 |
+
return $html;
|
124 |
+
}
|
125 |
+
$html = '<?php echo Mage::helper(\'';
|
126 |
+
$html .= $namespace.'_'.$module;
|
127 |
+
$html .= '\')->__("';
|
128 |
+
$html .= $this->getAttribute()->getLabel();
|
129 |
+
$html .= '");?>:<?php echo ($_';
|
130 |
+
$html .= $entityName.'->get'.$this->getAttribute()->getMagicMethodCode();
|
131 |
+
$html .= '()) ? Mage::getModel(\'directory/country\')->load($_';
|
132 |
+
$html .= $entityName.'->get'.$this->getAttribute()->getMagicMethodCode();
|
133 |
+
$html .= '())->getName():Mage::helper(\'';
|
134 |
+
$html .= $namespace.'_'.$module;
|
135 |
+
$html .= '\')->__(\'None\') ?>'.$this->getEol();
|
136 |
+
return $html;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* get source for setup
|
141 |
+
*
|
142 |
+
* @access public
|
143 |
+
* @return string|void
|
144 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
145 |
+
*/
|
146 |
+
public function getSetupSource()
|
147 |
+
{
|
148 |
+
$module = $this->getModule()->getLowerModuleName();
|
149 |
+
$namespace = $this->getNamespace(true);
|
150 |
+
return $namespace.'_'.$module.'/attribute_source_country';
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* get admin from options
|
155 |
+
*
|
156 |
+
* @access public
|
157 |
+
* @return string
|
158 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
159 |
+
*/
|
160 |
+
public function getFormOptions()
|
161 |
+
{
|
162 |
+
$options = parent::getFormOptions();
|
163 |
+
$options .= $this->getPadding(3);
|
164 |
+
$options .="'values'=> Mage::getResourceModel('directory/country_collection')->toOptionArray(),";
|
165 |
+
$options .= $this->getEol();
|
166 |
+
return $options;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* get values for mass action
|
171 |
+
*
|
172 |
+
* @access public
|
173 |
+
* @return string
|
174 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
175 |
+
*/
|
176 |
+
public function getMassActionValues()
|
177 |
+
{
|
178 |
+
return 'Mage::getResourceModel(\'directory/country_collection\')->toOptionArray()'.$this->getEol();
|
179 |
+
}
|
180 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Decimal.php
CHANGED
@@ -1,47 +1,54 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* decimal attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Decimal
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
*
|
44 |
-
* @var string
|
45 |
-
*/
|
46 |
-
protected $
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* decimal attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Decimal extends Ultimate_ModuleCreator_Model_Attribute_Type_Int
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'decimal';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sql column ddl type
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_typeDdl = 'TYPE_DECIMAL';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* sql column ddl size
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_sizeDdl = "'12,4'";
|
47 |
+
|
48 |
+
/**
|
49 |
+
* eav setup type
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_setupType = 'decimal';
|
54 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown.php
CHANGED
@@ -1,312 +1,412 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* dropdown attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
*
|
44 |
-
* @var string
|
45 |
-
*/
|
46 |
-
protected $
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
/**
|
56 |
-
* eav setup
|
57 |
-
*
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
*
|
64 |
-
*
|
65 |
-
* @
|
66 |
-
*/
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
/**
|
77 |
-
* get
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
*
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
*
|
223 |
-
* @access public
|
224 |
-
* @return string
|
225 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
226 |
-
*/
|
227 |
-
public function
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
*
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
*
|
264 |
-
*
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
*
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* dropdown attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'dropdown';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* dropdown subtype
|
36 |
+
*
|
37 |
+
* @var Ultimate_ModuleCreator_Model_Abstract
|
38 |
+
*/
|
39 |
+
protected $_subTypeInstance;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* sql colum ddl type
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_typeDdl = 'TYPE_INTEGER';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* sql colum ddl size
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_sizeDdl = 'null';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* eav setup type
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $_setupType = 'int';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* eav setup input
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $_setupInput = 'select';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* eav setup source
|
71 |
+
*
|
72 |
+
* @var string
|
73 |
+
*/
|
74 |
+
protected $_setupSource = 'eav/entity_attribute_source_table';
|
75 |
+
|
76 |
+
/**
|
77 |
+
* get source for setup
|
78 |
+
*
|
79 |
+
* @access public
|
80 |
+
* @return string|void
|
81 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
82 |
+
*/
|
83 |
+
public function getSetupSource()
|
84 |
+
{
|
85 |
+
if (!$this->getGenerateSource()) {
|
86 |
+
return parent::getSetupSource();
|
87 |
+
}
|
88 |
+
$module = $this->getModule()->getLowerModuleName();
|
89 |
+
$namespace = $this->getNamespace(true);
|
90 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
91 |
+
return $namespace.'_'.$module.'/'.$entity.'_attribute_source_'.$this->getAttribute()->getCodeForFileName();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* get admin column options
|
96 |
+
*
|
97 |
+
* @return string
|
98 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
99 |
+
*/
|
100 |
+
public function getAdminColumnOptions()
|
101 |
+
{
|
102 |
+
$options = $this->getEol();
|
103 |
+
$module = $this->getModule()->getLowerModuleName();
|
104 |
+
$namespace = $this->getNamespace(true);
|
105 |
+
$entity = strtolower($this->getAttribute()->getEntity()->getNameSingular());
|
106 |
+
$attr = $this->getAttribute()->getCode();
|
107 |
+
$options .= $this->getPadding(4)."'type' => 'options',".$this->getEol();
|
108 |
+
if ($this->getAttribute()->getEntity()->getIsEav()) {
|
109 |
+
$options .= $this->getPadding(4).
|
110 |
+
"'options' => Mage::helper('".$namespace.'_'.$module.
|
111 |
+
"')->convertOptions(".$this->getEol().$this->getPadding(5)."Mage::getModel('eav/config')->getAttribute('".
|
112 |
+
$namespace.'_'.$module.'_'.$entity."', '".$attr.
|
113 |
+
"')->getSource()->getAllOptions(false)".$this->getEol().$this->getPadding(4).")".$this->getEol();
|
114 |
+
} else {
|
115 |
+
$options .= $this->getPadding(4).
|
116 |
+
"'options' => Mage::helper('".$namespace.'_'.$module.
|
117 |
+
"')->convertOptions(".$this->getEol().$this->getPadding(5)."Mage::getModel('".
|
118 |
+
$namespace.'_'.$module.'/'.$entity."_attribute_source_".
|
119 |
+
$this->getAttribute()->getCodeForFileName(false).
|
120 |
+
"')->getAllOptions(false)".$this->getEol().$this->getPadding(4).")".$this->getEol();
|
121 |
+
}
|
122 |
+
return $options;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* get the type for the form
|
127 |
+
*
|
128 |
+
* @access public
|
129 |
+
* @return string
|
130 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
131 |
+
*/
|
132 |
+
public function getFormType()
|
133 |
+
{
|
134 |
+
return 'select';
|
135 |
+
}
|
136 |
+
|
137 |
+
/**
|
138 |
+
* get text for rss
|
139 |
+
*
|
140 |
+
* @access public
|
141 |
+
* @return string
|
142 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
143 |
+
*/
|
144 |
+
public function getRssText()
|
145 |
+
{
|
146 |
+
$eol = $this->getEol();
|
147 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
148 |
+
$module = $this->getModule()->getLowerModuleName();
|
149 |
+
$namespace = $this->getNamespace(true);
|
150 |
+
if ($this->getAttribute()->getEntity()->getIsEav()) {
|
151 |
+
return $this->getPadding(3).
|
152 |
+
'$description .= \'<div>\'.'.$eol.$this->getPadding(4).'Mage::helper(\''.
|
153 |
+
$namespace.'_'.$module.'\')->__("'.$this->getAttribute()->getLabel().
|
154 |
+
'").\': \''.$eol.$this->getPadding(4).'.$item->getAttributeText(\''.
|
155 |
+
$this->getAttribute()->getCode().'\').'.$eol.$this->getPadding(4).'\'</div>\';'.$this->getEol();
|
156 |
+
} else {
|
157 |
+
$attributeFile = $this->getAttribute()->getCodeForFileName(false);
|
158 |
+
$code = $this->getAttribute()->getMagicMethodCode();
|
159 |
+
return $this->getPadding(3).
|
160 |
+
'$description .= \'<div>\'.'.$eol.$this->getPadding(4).'Mage::helper(\''.
|
161 |
+
$namespace.'_'.$module.'\')->__("'.
|
162 |
+
$this->getAttribute()->getLabel().'").\': \''.$eol.$this->getPadding(4).'.Mage::getSingleton(\''.
|
163 |
+
$namespace.'_'.$module.'/'.$entityName.'_attribute_source_'.$attributeFile.
|
164 |
+
'\')->getOptionText($item->get'.$code.'()).'.$eol.$this->getPadding(4).'\'</div>\';'.$this->getEol();
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* check if source needs to be generated
|
170 |
+
*
|
171 |
+
* @access public
|
172 |
+
* @return string
|
173 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
174 |
+
*/
|
175 |
+
public function getGenerateSource()
|
176 |
+
{
|
177 |
+
return $this->getSubTypeInstance()->getGenerateSource();
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* get subtype instance
|
182 |
+
*
|
183 |
+
* @access public
|
184 |
+
* @return Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Abstract
|
185 |
+
* @throws Ultimate_ModuleCreator_Exception
|
186 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
187 |
+
*/
|
188 |
+
public function getSubTypeInstance()
|
189 |
+
{
|
190 |
+
if (!$this->_subTypeInstance) {
|
191 |
+
$type = $this->getAttribute()->getOptionsSource();
|
192 |
+
try{
|
193 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
194 |
+
$helper = Mage::helper('modulecreator');
|
195 |
+
$types = $helper->getDropdownSubtypes(false);
|
196 |
+
$instanceModel = (string)$types->$type->type_model;
|
197 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Abstract $subtypeInstance */
|
198 |
+
$subtypeInstance = Mage::getModel($instanceModel);
|
199 |
+
$this->_subTypeInstance = $subtypeInstance;
|
200 |
+
$this->_subTypeInstance->setTypeAttribute($this);
|
201 |
+
} catch (Exception $e){
|
202 |
+
throw new Ultimate_ModuleCreator_Exception("Invalid dropdown subtype: ". $type);
|
203 |
+
}
|
204 |
+
}
|
205 |
+
return $this->_subTypeInstance;
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* get additional setup values
|
210 |
+
*
|
211 |
+
* @access public
|
212 |
+
* @return string
|
213 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
214 |
+
*/
|
215 |
+
public function getAdditionalSetup()
|
216 |
+
{
|
217 |
+
return $this->getSubTypeInstance()->getAdditionalSetup();
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* get html for frontend
|
222 |
+
*
|
223 |
+
* @access public
|
224 |
+
* @return string
|
225 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
226 |
+
*/
|
227 |
+
public function getFrontendHtml()
|
228 |
+
{
|
229 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
230 |
+
$module = $this->getModule()->getLowerModuleName();
|
231 |
+
$namespace = $this->getNamespace(true);
|
232 |
+
if ($this->getAttribute()->getEntity()->getIsEav()) {
|
233 |
+
return '<?php echo Mage::helper(\''.
|
234 |
+
$namespace.'_'.$module.'\')->__("'.
|
235 |
+
$this->getAttribute()->getLabel().'");?>:<?php echo $_'.
|
236 |
+
$entityName.'->getAttributeText(\''.
|
237 |
+
$this->getAttribute()->getCode().'\');?>'.$this->getEol();
|
238 |
+
} else {
|
239 |
+
$attributeFile = $this->getAttribute()->getCodeForFileName(false);
|
240 |
+
$code = $this->getAttribute()->getMagicMethodCode();
|
241 |
+
return '<?php echo Mage::helper(\''.
|
242 |
+
$namespace.'_'.$module.'\')->__("'.
|
243 |
+
$this->getAttribute()->getLabel().
|
244 |
+
'");?>:<?php echo Mage::getSingleton(\''.
|
245 |
+
$namespace.'_'.$module.'/'.$entityName.'_attribute_source_'.$attributeFile.
|
246 |
+
'\')->getOptionText($_'.$entityName.'->get'.$code.'())'.';?>'.$this->getEol();
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* get attribute options for source model
|
252 |
+
*
|
253 |
+
* @access public
|
254 |
+
* @return string
|
255 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
256 |
+
*/
|
257 |
+
public function getAttributeOptions()
|
258 |
+
{
|
259 |
+
return $this->getSubTypeInstance()->getAttributeOptions();
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* get the options for form input
|
264 |
+
*
|
265 |
+
* @access public
|
266 |
+
* @return string
|
267 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
268 |
+
*/
|
269 |
+
public function getFormOptions()
|
270 |
+
{
|
271 |
+
$options = parent::getFormOptions();
|
272 |
+
$padding = $this->getPadding(3);
|
273 |
+
$module = $this->getModule()->getLowerModuleName();
|
274 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
275 |
+
$namespace = $this->getNamespace(true);
|
276 |
+
$options .= $padding."'values'=> Mage::getModel('".
|
277 |
+
$namespace.'_'.$module.'/'.$entity."_attribute_source_".
|
278 |
+
$this->getAttribute()->getCodeForFileName(false).
|
279 |
+
"')->getAllOptions(".$this->getOptionsFlag()."),".$this->getEol();
|
280 |
+
return $options;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* check if options should be returned with empty
|
285 |
+
*
|
286 |
+
* @access public
|
287 |
+
* @return string
|
288 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
289 |
+
*/
|
290 |
+
public function getOptionsFlag()
|
291 |
+
{
|
292 |
+
return 'true';
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* get the setup type of the dropdown
|
297 |
+
*
|
298 |
+
* @access public
|
299 |
+
* @return string|void
|
300 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
301 |
+
*/
|
302 |
+
public function getSetupType()
|
303 |
+
{
|
304 |
+
$setupType = $this->getSubTypeInstance()->getSetupType();
|
305 |
+
if (empty($setupType)) {
|
306 |
+
return parent::getSetupType();
|
307 |
+
}
|
308 |
+
return $setupType;
|
309 |
+
}
|
310 |
+
|
311 |
+
/**
|
312 |
+
* get the setup type of the dropdown
|
313 |
+
*
|
314 |
+
* @access public
|
315 |
+
* @return string|void
|
316 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
317 |
+
*/
|
318 |
+
public function getTypeDdl()
|
319 |
+
{
|
320 |
+
$setupType = $this->getSubTypeInstance()->getTypeDdl();
|
321 |
+
if (empty($setupType)) {
|
322 |
+
return parent::getTypeDdl();
|
323 |
+
}
|
324 |
+
return $setupType;
|
325 |
+
}
|
326 |
+
|
327 |
+
/**
|
328 |
+
* get column ddl size
|
329 |
+
*
|
330 |
+
* @access public
|
331 |
+
* @return string
|
332 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
333 |
+
*/
|
334 |
+
public function getSizeDdl()
|
335 |
+
{
|
336 |
+
$size = $this->getSubTypeInstance()->getSizeDdl();
|
337 |
+
if (empty($size)) {
|
338 |
+
return parent::getSizeDdl();
|
339 |
+
}
|
340 |
+
return $size;
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* get values for mass action
|
345 |
+
*
|
346 |
+
* @access public
|
347 |
+
* @return string
|
348 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
349 |
+
*/
|
350 |
+
public function getMassActionValues()
|
351 |
+
{
|
352 |
+
$module = $this->getModule()->getLowerModuleName();
|
353 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
354 |
+
$namespace = $this->getNamespace(true);
|
355 |
+
if ($this->getEntity()->getIsEav()) {
|
356 |
+
return "Mage::getModel('eav/config')->getAttribute('".
|
357 |
+
$namespace.'_'.$module."_".$entity."', '".
|
358 |
+
$this->getAttribute()->getCode()."')".$this->getEol().$this->getPadding(7)."->getSource()->getAllOptions(".
|
359 |
+
$this->getOptionsFlag()."),".$this->getEol();
|
360 |
+
} else {
|
361 |
+
return "Mage::getModel('".
|
362 |
+
$namespace.'_'.$module.'/'.$entity."_attribute_source_".
|
363 |
+
$this->getAttribute()->getCodeForFileName(false).
|
364 |
+
"')".$this->getEol().$this->getPadding(7)."->getAllOptions(".$this->getOptionsFlag()."),".$this->getEol();
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* get attribute default value
|
370 |
+
*
|
371 |
+
* @access public
|
372 |
+
* @return string
|
373 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
374 |
+
*/
|
375 |
+
public function getDefaultValueProcessed()
|
376 |
+
{
|
377 |
+
return $this->getSubTypeInstance()->getDefaultValueProcessed();
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* get attribute default value setup content
|
382 |
+
*
|
383 |
+
* @access public
|
384 |
+
* @return string
|
385 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
386 |
+
*/
|
387 |
+
public function getDefaultValueSetup()
|
388 |
+
{
|
389 |
+
$content = '';
|
390 |
+
if ($this->getSubTypeInstance() instanceof Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Custom
|
391 |
+
&& $this->getAttribute()->getDefaultValue()
|
392 |
+
) {
|
393 |
+
$eol = $this->getEol();
|
394 |
+
$entity = $this->getEntity();
|
395 |
+
$attribute= $this->getAttribute();
|
396 |
+
$content .= '$attribute = Mage::getSingleton(\'eav/config\')->getAttribute(\''.
|
397 |
+
$this->getNamespace(true).'_'.$this->getModule()->getLowerModuleName().'_'.$entity->getNameSingular().
|
398 |
+
'\', \''.$attribute->getCode().'\');'.$eol;
|
399 |
+
$content .= '$options = $attribute->getSource()->getAllOptions(false);'.$eol;
|
400 |
+
$content .= 'foreach ($options as $option) {'.$eol;
|
401 |
+
$content .= $this->getPadding().'if ($option[\'label\'] == \''.
|
402 |
+
Mage::helper('core')->jsQuoteEscape($attribute->getDefaultValue()).'\') {'.$eol;
|
403 |
+
$content .= $this->getPadding(2).
|
404 |
+
'$this->updateAttribute(\''.
|
405 |
+
$this->getNamespace(true).'_'.$this->getModule()->getLowerModuleName().'_'.$entity->getNameSingular().
|
406 |
+
'\', \''.$attribute->getCode().'\', \'default_value\', $option[\'value\']);'.$eol;
|
407 |
+
$content .= $this->getPadding().'}'.$eol;
|
408 |
+
$content .= '}'.$eol;
|
409 |
+
}
|
410 |
+
return $content;
|
411 |
+
}
|
412 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Abstract.php
CHANGED
@@ -1,87 +1,101 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* abstract attribute dropdown type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* @method string getAttributeOptions
|
27 |
-
* @method string getSetupType()
|
28 |
-
* @method string getTypeDdl()
|
29 |
-
* @method string getSizeDdl()
|
30 |
-
*/
|
31 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Abstract
|
32 |
-
|
33 |
-
/**
|
34 |
-
* type attribute
|
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 |
-
* get
|
80 |
-
*
|
81 |
-
* @
|
82 |
-
* @
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* abstract attribute dropdown type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
/**
|
26 |
+
* @method string getAttributeOptions
|
27 |
+
* @method string getSetupType()
|
28 |
+
* @method string getTypeDdl()
|
29 |
+
* @method string getSizeDdl()
|
30 |
+
*/
|
31 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Abstract extends Ultimate_ModuleCreator_Model_Abstract
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* type attribute
|
35 |
+
*
|
36 |
+
* @var Ultimate_ModuleCreator_Model_Attribute_Type_Decimal
|
37 |
+
*/
|
38 |
+
protected $_typeAttribute;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* check if source needs to be generated
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @return string
|
45 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
46 |
+
*/
|
47 |
+
public function getGenerateSource()
|
48 |
+
{
|
49 |
+
return true;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* type attribute setter
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @param Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown $attributeType
|
57 |
+
* @return $this
|
58 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
59 |
+
*/
|
60 |
+
public function setTypeAttribute(Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown $attributeType)
|
61 |
+
{
|
62 |
+
$this->_typeAttribute = $attributeType;
|
63 |
+
return $this;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* type attribute getter
|
68 |
+
*
|
69 |
+
* @access public
|
70 |
+
* @return Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown
|
71 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
72 |
+
*/
|
73 |
+
public function getTypeAttribute()
|
74 |
+
{
|
75 |
+
return $this->_typeAttribute;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* get additional setup values
|
80 |
+
*
|
81 |
+
* @access public
|
82 |
+
* @return string
|
83 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
84 |
+
*/
|
85 |
+
public function getAdditionalSetup()
|
86 |
+
{
|
87 |
+
return '';
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* get attribute default value
|
92 |
+
*
|
93 |
+
* @access public
|
94 |
+
* @return string
|
95 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
96 |
+
*/
|
97 |
+
public function getDefaultValueProcessed()
|
98 |
+
{
|
99 |
+
return '';
|
100 |
+
}
|
101 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Category.php
CHANGED
@@ -1,32 +1,33 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* category attribute dropdown type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Category
|
26 |
-
|
27 |
-
/**
|
28 |
-
* entity code for source
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* category attribute dropdown type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Category extends Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Product
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* entity code for source
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_entityCode = 'catalog_category';
|
33 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Custom.php
CHANGED
@@ -1,124 +1,134 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* custom attribute dropdown type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Custom
|
26 |
-
|
27 |
-
/**
|
28 |
-
* check if source needs to be generated
|
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 |
-
$content .= $padding.$tab.$tab
|
57 |
-
$content .= $padding.$tab.$tab."
|
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 |
-
$content .= $padding.'
|
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 |
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* custom attribute dropdown type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Custom extends Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* check if source needs to be generated
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return string
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function getGenerateSource()
|
35 |
+
{
|
36 |
+
return $this->getTypeAttribute()->getAttribute()->getEntity()->getIsFlat();
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* get additional setup values
|
41 |
+
*
|
42 |
+
* @access public
|
43 |
+
* @return string
|
44 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
45 |
+
*/
|
46 |
+
public function getAdditionalSetup()
|
47 |
+
{
|
48 |
+
$content = '';
|
49 |
+
if ($this->getTypeAttribute()->getAttribute()->getEntity()->getIsEav()) {
|
50 |
+
$padding = $this->getPadding(6);
|
51 |
+
$tab = $this->getPadding();
|
52 |
+
$eol = $this->getEol();
|
53 |
+
if ($this->getTypeAttribute()->getAttribute()->getOptions()) {
|
54 |
+
$content .= $padding."'option' =>".$eol;
|
55 |
+
$content .= $padding.$tab."array (".$eol;
|
56 |
+
$content .= $padding.$tab.$tab."'values' =>".$eol;
|
57 |
+
$content .= $padding.$tab.$tab.$tab."array (".$eol;
|
58 |
+
foreach ($this->getTypeAttribute()->getAttribute()->getOptions(true) as $option) {
|
59 |
+
$content .= $padding.$tab.$tab.$tab.$tab."'".Mage::helper('core')->jsQuoteEscape($option)."',".$eol;
|
60 |
+
}
|
61 |
+
$content .= $padding.$tab.$tab.$tab."),".$eol;
|
62 |
+
$content .= $padding.$tab.$tab."),".$eol;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
return $content;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* get attribute options for source model
|
70 |
+
*
|
71 |
+
* @access public
|
72 |
+
* @return string
|
73 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
74 |
+
*/
|
75 |
+
public function getAttributeOptions()
|
76 |
+
{
|
77 |
+
$content = '';
|
78 |
+
$padding = $this->getPadding(2);
|
79 |
+
$tab = $this->getPadding();
|
80 |
+
$eol = $this->getEol();
|
81 |
+
$module = $this->getTypeAttribute()->getAttribute()->getEntity()->getModule()->getLowerModuleName();
|
82 |
+
$namespace = $this->getTypeAttribute()->getAttribute()->getEntity()->getModule()->getNamespace(true);
|
83 |
+
if ($this->getTypeAttribute()->getAttribute()->getOptions()) {
|
84 |
+
$content .= $padding.'$options = array('.$eol;
|
85 |
+
foreach ($this->getTypeAttribute()->getAttribute()->getOptions(true) as $index=>$option) {
|
86 |
+
$content .= $padding.$tab.'array('.$eol;
|
87 |
+
$content .= $padding.$tab.$tab."'label' => Mage::helper('";
|
88 |
+
$content .= $namespace.'_'.$module."')->__('".Mage::helper('core')->jsQuoteEscape($option)."'),".$eol;
|
89 |
+
$content .= $padding.$tab.$tab."'value' => ".($index+1).$eol;
|
90 |
+
$content .= $padding.$tab.'),'.$eol;
|
91 |
+
}
|
92 |
+
$content .= $padding.");".$eol;
|
93 |
+
$content .= $padding.'if ($withEmpty) {'.$eol;
|
94 |
+
$content .= $padding.$tab.'array_unshift($options, array(\'label\'=>\'\', \'value\'=>\'\'));'.$eol;
|
95 |
+
$content .= $padding.'}'.$eol;
|
96 |
+
$content .= $padding.'return $options;'.$eol;
|
97 |
+
} else {
|
98 |
+
$content = $padding.'return array();';
|
99 |
+
}
|
100 |
+
return $content;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* get attribute default value
|
105 |
+
*
|
106 |
+
* @access public
|
107 |
+
* @return string
|
108 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
109 |
+
*/
|
110 |
+
public function getDefaultValueProcessed()
|
111 |
+
{
|
112 |
+
if ($this->getTypeAttribute()->getAttribute()->getForcedDefaultValue()) {
|
113 |
+
return $this->getTypeAttribute()->getAttribute()->getForcedDefaultValue();
|
114 |
+
}
|
115 |
+
if ($this->getTypeAttribute()->getAttribute()->getEntity()->getIsFlat()) {
|
116 |
+
$options = $this->getTypeAttribute()->getAttribute()->getOptions(true);
|
117 |
+
$defaultValue = trim($this->getTypeAttribute()->getAttribute()->getDefaultValue());
|
118 |
+
$defaultValue = explode(Ultimate_ModuleCreator_Model_Attribute::OPTION_SEPARATOR, $defaultValue);
|
119 |
+
$multiselectValues = array();
|
120 |
+
foreach ($options as $index=>$option) {
|
121 |
+
if (in_array($option, $defaultValue)) {
|
122 |
+
if ($this->getTypeAttribute() instanceof Ultimate_ModuleCreator_Model_Attribute_Type_Multiselect) {
|
123 |
+
$multiselectValues[] = $index + 1;
|
124 |
+
} else {
|
125 |
+
return ($index + 1);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
return implode(',', $multiselectValues);
|
130 |
+
}
|
131 |
+
//EAV default values are handled in the install script. there is no way of doing it through the definition.
|
132 |
+
return '';
|
133 |
+
}
|
134 |
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Customer.php
CHANGED
@@ -1,32 +1,33 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* customer attribute dropdown type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Customer
|
26 |
-
|
27 |
-
/**
|
28 |
-
* entity code for source
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* customer attribute dropdown type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Customer extends Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Product
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* entity code for source
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_entityCode = 'customer';
|
33 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Dropdown/Product.php
CHANGED
@@ -1,157 +1,175 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* product attribute dropdown type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Product
|
26 |
-
|
27 |
-
/**
|
28 |
-
* entity code for source
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
*
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
*
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
$content
|
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 |
-
return
|
107 |
-
break;
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* product attribute dropdown type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Product extends Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* entity code for source
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_entityCode = 'catalog_product';
|
33 |
+
/**
|
34 |
+
* entity attribute
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $_entityAttribute = null;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* get attribute options for source model
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @return string
|
45 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
46 |
+
*/
|
47 |
+
public function getAttributeOptions()
|
48 |
+
{
|
49 |
+
$content = '';
|
50 |
+
$padding = $this->getPadding(2);
|
51 |
+
$eol = $this->getEol();
|
52 |
+
$attrCode = $this->getTypeAttribute()->getAttribute()->getOptionsSourceAttribute();
|
53 |
+
$content .= $padding.'$'."source = Mage::getModel('eav/config')->getAttribute('";
|
54 |
+
$content .= $this->getEntityCode()."', '".$attrCode."');".$eol;
|
55 |
+
$content .= $padding.'return $source->getSource()->getAllOptions($withEmpty, $defaultValues);';
|
56 |
+
return $content;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* get entity code
|
61 |
+
*
|
62 |
+
* @access public
|
63 |
+
* @return string
|
64 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
65 |
+
*/
|
66 |
+
public function getEntityCode()
|
67 |
+
{
|
68 |
+
return $this->_entityCode;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* get attribute setup type
|
73 |
+
*
|
74 |
+
* @access public
|
75 |
+
* @return string
|
76 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
77 |
+
*/
|
78 |
+
public function getSetupType()
|
79 |
+
{
|
80 |
+
$attrCode = $this->getTypeAttribute()->getAttribute()->getOptionsSourceAttribute();
|
81 |
+
/** @var Mage_Eav_Model_Config $config */
|
82 |
+
$config = Mage::getModel('eav/config');
|
83 |
+
$productAttribute = $config->getAttribute($this->getEntityCode(), $attrCode);
|
84 |
+
if ($productAttribute->getId()) {
|
85 |
+
$type = $productAttribute->getBackendType();
|
86 |
+
if ($type == 'static') {
|
87 |
+
return false;
|
88 |
+
}
|
89 |
+
return $type;
|
90 |
+
}
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* get attribute setup type
|
96 |
+
*
|
97 |
+
* @access public
|
98 |
+
* @return string
|
99 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
100 |
+
*/
|
101 |
+
public function getTypeDdl()
|
102 |
+
{
|
103 |
+
$entityAttribute = $this->_getEntityAttribute();
|
104 |
+
switch($entityAttribute->getBackendType()) {
|
105 |
+
case 'int':
|
106 |
+
return 'TYPE_INTEGER';
|
107 |
+
break;
|
108 |
+
case 'varchar':
|
109 |
+
return 'TYPE_TEXT';
|
110 |
+
break;
|
111 |
+
case 'text':
|
112 |
+
return 'TYPE_TEXT';
|
113 |
+
case 'datetime':
|
114 |
+
return 'TYPE_DATETIME';
|
115 |
+
break;
|
116 |
+
case 'decimal':
|
117 |
+
return 'TYPE_DECIMAL';
|
118 |
+
break;
|
119 |
+
default:
|
120 |
+
return false;
|
121 |
+
break;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* get attribute setup type
|
127 |
+
*
|
128 |
+
* @access public
|
129 |
+
* @return string
|
130 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
131 |
+
*/
|
132 |
+
public function getTypeSize()
|
133 |
+
{
|
134 |
+
$entityAttribute = $this->_getEntityAttribute();
|
135 |
+
switch($entityAttribute->getBackendType()) {
|
136 |
+
case 'int':
|
137 |
+
return 'null';
|
138 |
+
break;
|
139 |
+
case 'varchar':
|
140 |
+
return '255';
|
141 |
+
break;
|
142 |
+
case 'text':
|
143 |
+
return "'64k'";
|
144 |
+
break;
|
145 |
+
case 'datetime':
|
146 |
+
return "255";
|
147 |
+
break;
|
148 |
+
case 'decimal':
|
149 |
+
return "'12,4'";
|
150 |
+
break;
|
151 |
+
default:
|
152 |
+
return false;
|
153 |
+
break;
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* get the source model attribute
|
159 |
+
*
|
160 |
+
* @access public
|
161 |
+
* @return null|Mage_Eav_Model_Entity_Attribute_Abstract
|
162 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
163 |
+
*/
|
164 |
+
protected function _getEntityAttribute()
|
165 |
+
{
|
166 |
+
if (is_null($this->_entityAttribute)) {
|
167 |
+
$attrCode = $this->getTypeAttribute()->getAttribute()->getOptionsSourceAttribute();
|
168 |
+
/** @var Mage_Eav_Model_Config $config */
|
169 |
+
$config = Mage::getModel('eav/config');
|
170 |
+
$productAttribute = $config->getAttribute($this->getEntityCode(), $attrCode);
|
171 |
+
$this->_entityAttribute = $productAttribute;
|
172 |
+
}
|
173 |
+
return $this->_entityAttribute;
|
174 |
+
}
|
175 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/File.php
CHANGED
@@ -1,128 +1,161 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* file attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_File
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
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 |
-
return
|
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 |
-
$content =
|
96 |
-
|
97 |
-
|
98 |
-
$
|
99 |
-
|
100 |
-
$content .= $this->getPadding().'
|
101 |
-
$content .= $this->getPadding(
|
102 |
-
$content .= $this->getPadding(3).'
|
103 |
-
|
104 |
-
$content
|
105 |
-
|
106 |
-
|
107 |
-
/**
|
108 |
-
* get the
|
109 |
-
*
|
110 |
-
* @
|
111 |
-
* @
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
$
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* file attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_File extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'file';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* eav setup input
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_setupInput = 'file';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* don't show in admin grid
|
43 |
+
*
|
44 |
+
* @access public
|
45 |
+
* @return bool
|
46 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
47 |
+
*/
|
48 |
+
public function getAdminGrid()
|
49 |
+
{
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* check if attribute is required
|
55 |
+
*
|
56 |
+
* @access public
|
57 |
+
* @return mixed
|
58 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
59 |
+
*/
|
60 |
+
public function getRequired()
|
61 |
+
{
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* get the type for the form
|
67 |
+
*
|
68 |
+
* @access public
|
69 |
+
* @return string
|
70 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
71 |
+
*/
|
72 |
+
public function getFormType()
|
73 |
+
{
|
74 |
+
return 'file';
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* get text for rss
|
79 |
+
*
|
80 |
+
* @access public
|
81 |
+
* @return string
|
82 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
83 |
+
*/
|
84 |
+
public function getRssText()
|
85 |
+
{
|
86 |
+
$content = '';
|
87 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
88 |
+
$eol = $this->getEol();
|
89 |
+
$module = $this->getModule()->getLowerModuleName();
|
90 |
+
$namespace = $this->getNamespace(true);
|
91 |
+
$content .= $this->getPadding(3).'if ($item->get'.$this->getAttribute()->getMagicMethodCode().'()) {'.$eol;
|
92 |
+
$content .= $this->getPadding(4).'$description .= \'<div>\';'.$eol;
|
93 |
+
$content .= $this->getPadding(4).'$description .= Mage::helper(\''.
|
94 |
+
$namespace.'_'.$module.'\')->__(\''.$this->getAttribute()->getLabel().'\');'.$eol;
|
95 |
+
$content .= $this->getPadding(4).'$description .= \' <a href="\'.Mage::helper(\''.
|
96 |
+
$namespace.'_'.$module.'/'.$entityName.'\')->getFileBaseUrl().$item->get'.
|
97 |
+
$this->getAttribute()->getMagicMethodCode().'().\'">\';'.$eol;
|
98 |
+
$content .= $this->getPadding(4).'$description .= \' <span>\'. basename($item->get'.
|
99 |
+
$this->getAttribute()->getMagicMethodCode().'()).\'</span>\';'.$eol;
|
100 |
+
$content .= $this->getPadding(4).'$description .= \' </a>\';'.$eol;
|
101 |
+
$content .= $this->getPadding(4).'$description .= \'</div>\';'.$eol;
|
102 |
+
$content .= $this->getPadding(3).'}'.$eol;
|
103 |
+
|
104 |
+
return $content;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* get the html for frontend
|
109 |
+
*
|
110 |
+
* @access public
|
111 |
+
* @return string
|
112 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
113 |
+
*/
|
114 |
+
public function getFrontendHtml()
|
115 |
+
{
|
116 |
+
$content = '';
|
117 |
+
$eol = $this->getEol();
|
118 |
+
$entityName = $this->getAttribute()->getEntity()->getNameSingular(true);
|
119 |
+
$module = $this->getModule()->getLowerModuleName();
|
120 |
+
$namespace = $this->getNamespace(true);
|
121 |
+
$content .= $this->getPadding().'<?php if ($_'.$entityName.'->get'.
|
122 |
+
$this->getAttribute()->getMagicMethodCode().'()) :?>'.$eol;
|
123 |
+
$content .= $this->getPadding(2).'<a href="<?php echo Mage::helper(\''.
|
124 |
+
$namespace.'_'.$module.'/'.$entityName.'\')->getFileBaseUrl().$_'.
|
125 |
+
$entityName.'->get'.$this->getAttribute()->getMagicMethodCode().'();?>">'.$eol;
|
126 |
+
$content .= $this->getPadding(3).'<span><?php echo basename($_'.
|
127 |
+
$entityName.'->get'.$this->getAttribute()->getMagicMethodCode().'())?></span>'.$eol;
|
128 |
+
$content .= $this->getPadding(2).'</a>'.$eol;
|
129 |
+
$content .= $this->getPadding().'<?php endif;?>'.$eol;
|
130 |
+
return $content;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* get the setup backend type
|
135 |
+
*
|
136 |
+
* @access public
|
137 |
+
* @return string
|
138 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
139 |
+
*/
|
140 |
+
public function getSetupBackend()
|
141 |
+
{
|
142 |
+
$attribute = $this->getAttribute();
|
143 |
+
$entity = $attribute->getEntity();
|
144 |
+
$module = $this->getModule();
|
145 |
+
return $this->getNamespace(true).'_'.
|
146 |
+
$module->getLowerModuleName().'/'.
|
147 |
+
$entity->getNameSingular(true).'_attribute_backend_file';
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* get attribute default value
|
152 |
+
*
|
153 |
+
* @access public
|
154 |
+
* @return string
|
155 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
156 |
+
*/
|
157 |
+
public function getDefaultValueProcessed()
|
158 |
+
{
|
159 |
+
return '';
|
160 |
+
}
|
161 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Image.php
CHANGED
@@ -1,122 +1,155 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* image attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Image
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
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 |
-
* get
|
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 |
-
$content
|
93 |
-
|
94 |
-
$
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
$content .= '
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
*
|
105 |
-
*
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* image attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Image extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'image';
|
33 |
+
/**
|
34 |
+
* eav setup input
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
protected $_setupInput = 'image';
|
39 |
+
|
40 |
+
/**
|
41 |
+
* don't show in admin grid
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @return bool
|
45 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
46 |
+
*/
|
47 |
+
public function getAdminGrid()
|
48 |
+
{
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* check if attribute is required
|
54 |
+
*
|
55 |
+
* @access public
|
56 |
+
* @return mixed
|
57 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
58 |
+
*/
|
59 |
+
public function getRequired()
|
60 |
+
{
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* get the type for the form
|
66 |
+
*
|
67 |
+
* @access public
|
68 |
+
* @return string
|
69 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
70 |
+
*/
|
71 |
+
public function getFormType()
|
72 |
+
{
|
73 |
+
return 'image';
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* get text for rss
|
78 |
+
*
|
79 |
+
* @access public
|
80 |
+
* @return string
|
81 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
82 |
+
*/
|
83 |
+
public function getRssText()
|
84 |
+
{
|
85 |
+
$eol = $this->getEol();
|
86 |
+
$content = '';
|
87 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
88 |
+
$module = $this->getModule()->getLowerModuleName();
|
89 |
+
$namespace = $this->getNamespace(true);
|
90 |
+
$content .= $this->getPadding(3).'if ($item->get'.$this->getAttribute()->getMagicMethodCode().'()) {'.$eol;
|
91 |
+
$content .= $this->getPadding(4).'$description .= \'<div>\';'.$eol;
|
92 |
+
$content .= $this->getPadding(4).'$description .= Mage::helper(\''.$namespace.'_'.$module.
|
93 |
+
'\')->__(\''.$this->getAttribute()->getLabel().'\');'.$eol;
|
94 |
+
$content .= $this->getPadding(4).'$description .= \'<img src="\'.Mage::helper(\''.
|
95 |
+
$namespace.'_'.$module.'/'.$entityName.'_image\')->init($item, \''.
|
96 |
+
$this->getAttribute()->getCode().'\')->resize(75).\'" alt="\'.$this->escapeHtml($item->get'.
|
97 |
+
$this->getEntity()->getNameAttributeMagicCode().'()).\'" />\';'.$eol;
|
98 |
+
$content .= $this->getPadding(4).'$description .= \'</div>\';'.$eol;
|
99 |
+
$content .= $this->getPadding(3).'}'.$eol;
|
100 |
+
return $content;
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* get the html for frontend
|
105 |
+
*
|
106 |
+
* @access public
|
107 |
+
* @return string
|
108 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
109 |
+
*/
|
110 |
+
public function getFrontendHtml()
|
111 |
+
{
|
112 |
+
$eol = $this->getEol();
|
113 |
+
$content = '';
|
114 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
115 |
+
$module = $this->getModule()->getLowerModuleName();
|
116 |
+
$namespace = $this->getNamespace(true);
|
117 |
+
$content .= '<?php if ($_'.$entityName.'->get'.$this->getAttribute()->getMagicMethodCode().'()) :?>'.$eol;
|
118 |
+
$content .= $this->getHelper()->getPadding().
|
119 |
+
'<img src="<?php echo Mage::helper(\''.$namespace.'_'.$module.'/'.$entityName.'_image\')->init($_'.
|
120 |
+
$entityName.', \''.$this->getAttribute()->getCode().
|
121 |
+
'\')->resize(75);?>" alt="<?php echo $this->escapeHtml($_'.
|
122 |
+
$entityName.'->get'.$this->getAttribute()->getEntity()->getNameAttributeMagicCode().'());?>" />'.$eol;
|
123 |
+
$content .= '<?php endif;?>'.$eol;
|
124 |
+
return $content;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* get the setup backend type
|
129 |
+
*
|
130 |
+
* @access public
|
131 |
+
* @return string
|
132 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
133 |
+
*/
|
134 |
+
public function getSetupBackend()
|
135 |
+
{
|
136 |
+
$attribute = $this->getAttribute();
|
137 |
+
$entity = $attribute->getEntity();
|
138 |
+
$module = $entity->getModule();
|
139 |
+
return $this->getNamespace(true).'_'.
|
140 |
+
$module->getLowerModuleName().'/'.
|
141 |
+
$entity->getNameSingular(true).'_attribute_backend_image';
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* get attribute default value
|
146 |
+
*
|
147 |
+
* @access public
|
148 |
+
* @return string
|
149 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
150 |
+
*/
|
151 |
+
public function getDefaultValueProcessed()
|
152 |
+
{
|
153 |
+
return '';
|
154 |
+
}
|
155 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Int.php
CHANGED
@@ -1,58 +1,69 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* int attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Int
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* int attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Int extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'int';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sql column ddl type
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_typeDdl = 'TYPE_INTEGER';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* sql column ddl size
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_sizeDdl = 'null';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* eav setup type
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_setupType = 'int';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* get admin column options
|
57 |
+
*
|
58 |
+
* @access public
|
59 |
+
* @return string
|
60 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
61 |
+
*/
|
62 |
+
public function getAdminColumnOptions()
|
63 |
+
{
|
64 |
+
$options = $this->getEol();
|
65 |
+
$options .= $this->getPadding(4);
|
66 |
+
$options .= "'type'=> 'number',".$this->getEol();
|
67 |
+
return $options;
|
68 |
+
}
|
69 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Multiselect.php
CHANGED
@@ -1,144 +1,193 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* multiselect attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Multiselect
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
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 |
-
* @access public
|
85 |
-
* @return string
|
86 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
87 |
-
*/
|
88 |
-
public function
|
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 |
-
* @access public
|
121 |
-
* @return string
|
122 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
123 |
-
*/
|
124 |
-
public function
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* multiselect attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Multiselect extends Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'multiselect';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sql column ddl type
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_typeDdl = 'TYPE_TEXT';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* sql column ddl size
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_sizeDdl = "'64k'";
|
47 |
+
|
48 |
+
/**
|
49 |
+
* eav setup input
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_setupInput = 'multiselect';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* eav setup type
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $_setupType = 'text';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* backend setup type
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
protected $_setupBackend = 'eav/entity_attribute_backend_array';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* don't show in admin grid
|
71 |
+
*
|
72 |
+
* @access public
|
73 |
+
* @return bool
|
74 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
75 |
+
*/
|
76 |
+
public function getAdminGrid()
|
77 |
+
{
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* get the type for the form
|
83 |
+
*
|
84 |
+
* @access public
|
85 |
+
* @return string
|
86 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
87 |
+
*/
|
88 |
+
public function getFormType()
|
89 |
+
{
|
90 |
+
return 'multiselect';
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* check if attribute is multiple select
|
95 |
+
*
|
96 |
+
* @access public
|
97 |
+
* @return bool
|
98 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
99 |
+
*/
|
100 |
+
public function getIsMultipleSelect()
|
101 |
+
{
|
102 |
+
return true;
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* get the setup type of the dropdown
|
107 |
+
*
|
108 |
+
* @access public
|
109 |
+
* @return string|void
|
110 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
111 |
+
*/
|
112 |
+
public function getSetupType()
|
113 |
+
{
|
114 |
+
return $this->_setupType;
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* get attribute setup type
|
119 |
+
*
|
120 |
+
* @access public
|
121 |
+
* @return string
|
122 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
123 |
+
*/
|
124 |
+
public function getTypeDdl()
|
125 |
+
{
|
126 |
+
return $this->_typeDdl;
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* check if options should be returned with empty
|
131 |
+
*
|
132 |
+
* @access public
|
133 |
+
* @return string
|
134 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
135 |
+
*/
|
136 |
+
public function getOptionsFlag()
|
137 |
+
{
|
138 |
+
return 'false';
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* get values for mass action
|
143 |
+
*
|
144 |
+
* @access public
|
145 |
+
* @return string
|
146 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
147 |
+
*/
|
148 |
+
public function getMassActionValues()
|
149 |
+
{
|
150 |
+
return '';
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* get attribute default value setup content
|
155 |
+
*
|
156 |
+
* @access public
|
157 |
+
* @return string
|
158 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
159 |
+
*/
|
160 |
+
public function getDefaultValueSetup()
|
161 |
+
{
|
162 |
+
$content = '';
|
163 |
+
if ($this->getSubTypeInstance() instanceof Ultimate_ModuleCreator_Model_Attribute_Type_Dropdown_Custom
|
164 |
+
&& $this->getAttribute()->getDefaultValue()
|
165 |
+
) {
|
166 |
+
$eol = $this->getEol();
|
167 |
+
$entity = $this->getEntity();
|
168 |
+
$attribute= $this->getAttribute();
|
169 |
+
$content .= '$attribute = Mage::getSingleton(\'eav/config\')->getAttribute(\''.
|
170 |
+
$this->getNamespace(true).'_'.$this->getModule()->getLowerModuleName().'_'.
|
171 |
+
$entity->getNameSingular().'\', \''.$attribute->getCode().'\');'.$eol;
|
172 |
+
$content .= '$options = $attribute->getSource()->getAllOptions(false);'.$eol;
|
173 |
+
$content .= '$defaultOptions = array();'.$eol;
|
174 |
+
$content .= 'foreach ($options as $option) {'.$eol;
|
175 |
+
$content .= $this->getPadding().'if (in_array($option[\'label\'], array(\''.
|
176 |
+
implode(
|
177 |
+
"','",
|
178 |
+
explode(
|
179 |
+
Ultimate_ModuleCreator_Model_Attribute::OPTION_SEPARATOR,
|
180 |
+
Mage::helper('core')->jsQuoteEscape($attribute->getDefaultValue())
|
181 |
+
)
|
182 |
+
).'\'))) {'.$eol;
|
183 |
+
$content .= $this->getPadding(2).'$defaultOptions[] = $option[\'value\'];'.$eol;
|
184 |
+
$content .= $this->getPadding().'}'.$eol;
|
185 |
+
$content .= '}'.$eol;
|
186 |
+
$content .= '$this->updateAttribute(\''.
|
187 |
+
$this->getNamespace(true).'_'.$this->getModule()->getLowerModuleName().'_'.
|
188 |
+
$entity->getNameSingular().'\', \''.$attribute->getCode().
|
189 |
+
'\', \'default_value\', implode(\',\', $defaultOptions));'.$eol;
|
190 |
+
}
|
191 |
+
return $content;
|
192 |
+
}
|
193 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Signedint.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* int attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Signedint extends Ultimate_ModuleCreator_Model_Attribute_Type_Int
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'signedint';
|
33 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Text.php
CHANGED
@@ -1,44 +1,48 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* text attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Text
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
*
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* text attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Text extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'text';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* get admin column options
|
36 |
+
*
|
37 |
+
* @access public
|
38 |
+
* @return string
|
39 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
40 |
+
*/
|
41 |
+
public function getAdminColumnOptions()
|
42 |
+
{
|
43 |
+
$options = $this->getEol();
|
44 |
+
$options .= $this->getPadding(4);
|
45 |
+
$options .= "'type'=> 'text',".$this->getEol();
|
46 |
+
return $options;
|
47 |
+
}
|
48 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Textarea.php
CHANGED
@@ -1,97 +1,117 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* textarea attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Textarea
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
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 |
-
return
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* textarea attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Textarea extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'textarea';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sql column ddl type
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_typeDdl = 'TYPE_TEXT';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* sql column ddl size
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_sizeDdl = "'64k'";
|
47 |
+
|
48 |
+
/**
|
49 |
+
* eav setup type
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_setupType = 'text';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* eav setup input
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $_setupInput = 'textarea';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* don't show in admin grid
|
64 |
+
*
|
65 |
+
* @access public
|
66 |
+
* @return bool
|
67 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
68 |
+
*/
|
69 |
+
public function getAdminGrid()
|
70 |
+
{
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* get the type for the form
|
76 |
+
*
|
77 |
+
* @access public
|
78 |
+
* @return string
|
79 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
80 |
+
*/
|
81 |
+
public function getFormType()
|
82 |
+
{
|
83 |
+
if ($this->getAttribute()->getEditor()) {
|
84 |
+
return 'editor';
|
85 |
+
}
|
86 |
+
return 'textarea';
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* can use editor
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @return bool
|
94 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
95 |
+
*/
|
96 |
+
public function getEditor()
|
97 |
+
{
|
98 |
+
return $this->getAttribute()->getData('editor');
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* get the options for form input
|
103 |
+
*
|
104 |
+
* @access public
|
105 |
+
* @return string
|
106 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
107 |
+
*/
|
108 |
+
public function getFormOptions()
|
109 |
+
{
|
110 |
+
$options = '';
|
111 |
+
if ($this->getEditor() && !$this->getEntity()->getIsTree()) {
|
112 |
+
$options = $this->getPadding(3)."'config' => "."$"."wysiwygConfig,".$this->getEol();
|
113 |
+
}
|
114 |
+
$options .= parent::getFormOptions();
|
115 |
+
return $options;
|
116 |
+
}
|
117 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Timestamp.php
CHANGED
@@ -1,111 +1,144 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* timestamp attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Timestamp
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
29 |
-
*
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
/**
|
42 |
-
* eav setup
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* timestamp attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Timestamp extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'timestamp';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sql column ddl type
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_typeDdl = 'TYPE_DATETIME';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* eav setup type
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_setupType = 'datetime';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* eav setup input
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_setupInput = 'date';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* setup backend
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
protected $_setupBackend = 'eav/entity_attribute_backend_datetime';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* get admin column options
|
64 |
+
*
|
65 |
+
* @access public
|
66 |
+
* @return string
|
67 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
68 |
+
*/
|
69 |
+
public function getAdminColumnOptions()
|
70 |
+
{
|
71 |
+
$options = $this->getEol();
|
72 |
+
$options .= $this->getPadding(4);
|
73 |
+
$options .= "'type'=> 'date',".$this->getEol();
|
74 |
+
return $options;
|
75 |
+
}
|
76 |
+
|
77 |
+
/**
|
78 |
+
* get the type for the form
|
79 |
+
*
|
80 |
+
* @access public
|
81 |
+
* @return string
|
82 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
83 |
+
*/
|
84 |
+
public function getFormType()
|
85 |
+
{
|
86 |
+
return 'date';
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* get html for frontend
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @return string
|
94 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
95 |
+
*/
|
96 |
+
public function getFrontendHtml()
|
97 |
+
{
|
98 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
99 |
+
$module = $this->getModule()->getLowerModuleName();
|
100 |
+
$namespace = $this->getNamespace(true);
|
101 |
+
return '<?php echo Mage::helper(\''.
|
102 |
+
$namespace.'_'.$module.'\')->__("'.
|
103 |
+
$this->getAttribute()->getLabel().
|
104 |
+
'");?>: <?php echo Mage::helper(\'core\')->formatDate($_'.
|
105 |
+
$entityName.'->get'.$this->getAttribute()->getMagicMethodCode().'(), \'full\');?>'.$this->getEol();
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* get options for admin form
|
110 |
+
*
|
111 |
+
* @access public
|
112 |
+
* @return string
|
113 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
114 |
+
*/
|
115 |
+
public function getFormOptions()
|
116 |
+
{
|
117 |
+
$options = parent::getFormOptions();
|
118 |
+
$padding = $this->getPadding(3);
|
119 |
+
$eol = $this->getEol();
|
120 |
+
$options .= $padding.'\'image\' => $this->getSkinUrl(\'images/grid-cal.gif\'),'.$eol;;
|
121 |
+
$options .= $padding.
|
122 |
+
'\'format\' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),'.$eol;
|
123 |
+
return $options;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* get text for rss
|
128 |
+
*
|
129 |
+
* @access public
|
130 |
+
* @return string
|
131 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
132 |
+
*/
|
133 |
+
public function getRssText()
|
134 |
+
{
|
135 |
+
$attribute = $this->getAttribute();
|
136 |
+
$module = $this->getModule()->getLowerModuleName();
|
137 |
+
$namespace = $this->getNamespace(true);
|
138 |
+
return $this->getPadding(3).'$'.
|
139 |
+
'description .= \'<div>\'.Mage::helper(\''.
|
140 |
+
$namespace.'_'.$module.'\')->__(\''.
|
141 |
+
$attribute->getLabel().'\').\': \'.Mage::helper(\'core\')->formatDate($item->get'.
|
142 |
+
$this->getAttribute()->getMagicMethodCode().'(), \'full\').\'</div>\';'.$this->getEol();
|
143 |
+
}
|
144 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Attribute/Type/Yesno.php
CHANGED
@@ -1,156 +1,200 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* yes/no attribute type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Attribute_Type_Yesno
|
26 |
-
|
27 |
-
/**
|
28 |
-
* type code
|
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 |
-
protected $
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* yes/no attribute type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Attribute_Type_Yesno extends Ultimate_ModuleCreator_Model_Attribute_Type_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* type code
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
protected $_type = 'yesno';
|
33 |
+
|
34 |
+
/**
|
35 |
+
* sql column ddl type
|
36 |
+
*
|
37 |
+
* @var string
|
38 |
+
*/
|
39 |
+
protected $_typeDdl = 'TYPE_SMALLINT';
|
40 |
+
|
41 |
+
/**
|
42 |
+
* sql column ddl size
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
protected $_sizeDdl = 'null';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* eav setup type
|
50 |
+
*
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
protected $_setupType = 'int';
|
54 |
+
|
55 |
+
/**
|
56 |
+
* eav setup input
|
57 |
+
*/
|
58 |
+
protected $_setupInput = 'select';
|
59 |
+
|
60 |
+
/**
|
61 |
+
* eav setup source
|
62 |
+
*/
|
63 |
+
protected $_setupSource = 'eav/entity_attribute_source_boolean';
|
64 |
+
|
65 |
+
/**
|
66 |
+
* get admin column options
|
67 |
+
*
|
68 |
+
* @access public
|
69 |
+
* @return string
|
70 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
71 |
+
*/
|
72 |
+
public function getAdminColumnOptions()
|
73 |
+
{
|
74 |
+
$eol = $this->getEol();
|
75 |
+
$options = $eol;
|
76 |
+
$extension = $this->getModule()->getExtensionName(true);
|
77 |
+
$options .= $this->getPadding(4)."'type' => 'options',".$eol;
|
78 |
+
$options .= $this->getPadding(5)."'options' => array(".$eol;
|
79 |
+
$options .= $this->getPadding(5)."'1' => Mage::helper('".$extension."')->__('Yes'),".$eol;
|
80 |
+
$options .= $this->getPadding(5)."'0' => Mage::helper('".$extension."')->__('No'),".$eol;
|
81 |
+
$options .= $this->getPadding(4).")".$eol;
|
82 |
+
return $options;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* get the type for the form
|
87 |
+
*
|
88 |
+
* @access public
|
89 |
+
* @return string
|
90 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
91 |
+
*/
|
92 |
+
public function getFormType()
|
93 |
+
{
|
94 |
+
return 'select';
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* get text for rss
|
99 |
+
*
|
100 |
+
* @access public
|
101 |
+
* @return string
|
102 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
103 |
+
*/
|
104 |
+
public function getRssText()
|
105 |
+
{
|
106 |
+
$module = $this->getModule()->getLowerModuleName();
|
107 |
+
$namespace = $this->getNamespace(true);
|
108 |
+
return $this->getPadding(3).
|
109 |
+
'$description .= \'<div>\'.Mage::helper(\''.
|
110 |
+
$namespace.'_'.$module.'\')->__("'.
|
111 |
+
$this->getAttribute()->getLabel().
|
112 |
+
'").\':\'.(($item->get'.$this->getAttribute()->getMagicMethodCode().
|
113 |
+
'() == 1) ? Mage::helper(\''.$namespace.'_'.$module.
|
114 |
+
'\')->__(\'Yes\') : Mage::helper(\''.
|
115 |
+
$namespace.'_'.$module.'\')->__(\'No\')).\'</div>\';'.$this->getEol();
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* get html for frontend
|
120 |
+
*
|
121 |
+
* @access public
|
122 |
+
* @return string
|
123 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
124 |
+
*/
|
125 |
+
public function getFrontendHtml()
|
126 |
+
{
|
127 |
+
$entityName = $this->getEntity()->getNameSingular(true);
|
128 |
+
$module = $this->getModule()->getLowerModuleName();
|
129 |
+
$namespace = $this->getNamespace(true);
|
130 |
+
return '<?php echo Mage::helper(\''.
|
131 |
+
$namespace.'_'.$module.'\')->__("'.
|
132 |
+
$this->getAttribute()->getLabel().
|
133 |
+
'");?>:<?php echo ($_'.
|
134 |
+
$entityName.'->get'.$this->getAttribute()->getMagicMethodCode().
|
135 |
+
'() == 1) ? Mage::helper(\''.$namespace.'_'.$module.
|
136 |
+
'\')->__(\'Yes\') : Mage::helper(\''.
|
137 |
+
$namespace.'_'.$module.'\')->__(\'No\') ?>'.$this->getEol();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* check if attribute is yes/no
|
142 |
+
*
|
143 |
+
* @access public
|
144 |
+
* @return bool
|
145 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
146 |
+
*/
|
147 |
+
public function getIsYesNo()
|
148 |
+
{
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* get the options for form input
|
154 |
+
*
|
155 |
+
* @access public
|
156 |
+
* @return string
|
157 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
158 |
+
*/
|
159 |
+
public function getFormOptions()
|
160 |
+
{
|
161 |
+
$options = parent::getFormOptions();
|
162 |
+
$padding = $this->getPadding(3);
|
163 |
+
$tab = $this->getPadding();
|
164 |
+
$eol = $this->getEol();
|
165 |
+
$module = $this->getModule()->getLowerModuleName();
|
166 |
+
$namespace = $this->getNamespace(true);
|
167 |
+
$options .= $padding."'values'=> array(".$eol;
|
168 |
+
$options .= $padding.$tab.'array('.$eol;
|
169 |
+
$options .= $padding.$tab.$tab."'value' => 1,".$eol;
|
170 |
+
$options .= $padding.$tab.$tab."'label' => Mage::helper('".$namespace.'_'.$module."')->__('Yes'),".$eol;
|
171 |
+
$options .= $padding.$tab."),".$eol;
|
172 |
+
$options .= $padding.$tab.'array('.$eol;
|
173 |
+
$options .= $padding.$tab.$tab."'value' => 0,".$eol;
|
174 |
+
$options .= $padding.$tab.$tab."'label' => Mage::helper('".$namespace.'_'.$module."')->__('No'),".$eol;
|
175 |
+
$options .= $padding.$tab."),".$eol;
|
176 |
+
$options .= $padding."),".$eol;
|
177 |
+
return $options;
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* get values for mass action
|
182 |
+
*
|
183 |
+
* @access public
|
184 |
+
* @return string
|
185 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
186 |
+
*/
|
187 |
+
public function getMassActionValues()
|
188 |
+
{
|
189 |
+
$eol = $this->getEol();
|
190 |
+
$module = $this->getModule()->getLowerModuleName();
|
191 |
+
$namespace = $this->getNamespace(true);
|
192 |
+
$padding = $this->getPadding(7);
|
193 |
+
$tab = $this->getPadding();
|
194 |
+
$content = 'array('.$eol;
|
195 |
+
$content .= $padding.$tab."'1' => Mage::helper('".$namespace.'_'.$module."')->__('Yes'),".$eol;
|
196 |
+
$content .= $padding.$tab."'0' => Mage::helper('".$namespace.'_'.$module."')->__('No'),".$eol;
|
197 |
+
$content .= $padding.')'.$eol;
|
198 |
+
return $content;
|
199 |
+
}
|
200 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Config.php
CHANGED
@@ -1,71 +1,81 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
class Ultimate_ModuleCreator_Model_Config extends Varien_Simplexml_Config
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
class Ultimate_ModuleCreator_Model_Config extends Varien_Simplexml_Config
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* cache key
|
22 |
+
*/
|
23 |
+
const CACHE_ID = 'umc_config';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* get DOM of the config
|
27 |
+
*
|
28 |
+
* @access public
|
29 |
+
* @return null|Varien_Simplexml_Element
|
30 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
31 |
+
*/
|
32 |
+
public function getDom()
|
33 |
+
{
|
34 |
+
if (is_null($this->_xml)) {
|
35 |
+
$this->_xml = Mage::getConfig()->loadModulesConfiguration('umc.xml')
|
36 |
+
->applyExtends();
|
37 |
+
}
|
38 |
+
return $this->_xml;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* get default translation module
|
43 |
+
*
|
44 |
+
* @return string
|
45 |
+
* @access protected
|
46 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
47 |
+
*/
|
48 |
+
protected function _getDefaultTranslateModule()
|
49 |
+
{
|
50 |
+
return 'Ultimate_ModuleCreator';
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* translate node
|
55 |
+
*
|
56 |
+
* @access protected
|
57 |
+
* @param Varien_Simplexml_Element $node
|
58 |
+
* @return Ultimate_ModuleCreator_Model_Config
|
59 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
60 |
+
*/
|
61 |
+
protected function _translateNode(&$node)
|
62 |
+
{
|
63 |
+
if ($node->getAttribute('translate')) {
|
64 |
+
$fields = explode(' ', $node->getAttribute('translate'));
|
65 |
+
$module = ($node->getAttribute('module'))
|
66 |
+
? (string)$node->getAttribute('module')
|
67 |
+
: $this->_getDefaultTranslateModule();
|
68 |
+
foreach ($fields as $field) {
|
69 |
+
if ($node->$field) {
|
70 |
+
$node->$field = Mage::helper($module)->__((string)$node->$field);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
if ($node->hasChildren()) {
|
75 |
+
foreach ($node->children() as $child) {
|
76 |
+
$this->_translateNode($child);
|
77 |
+
}
|
78 |
+
}
|
79 |
+
return $this;
|
80 |
+
}
|
81 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Entity.php
CHANGED
@@ -1,2992 +1,3502 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* entity model
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* @method Ultimate_ModuleCreator_Model_Entity setIndex()
|
27 |
-
* @method Ultimate_ModuleCreator_Model_Entity setEditor()
|
28 |
-
* @method Ultimate_ModuleCreator_Model_Entity setHasImage()
|
29 |
-
* @method Ultimate_ModuleCreator_Model_Entity setHasFile()
|
30 |
-
* @method Ultimate_ModuleCreator_Model_Entity setHasCountry()
|
31 |
-
* @method Ultimate_ModuleCreator_Model_Entity setHasMultipleSelect()
|
32 |
-
* @method bool getCreateFrontend()
|
33 |
-
* @method bool getLinkProduct()
|
34 |
-
* @method bool getLinkCategory()
|
35 |
-
* @method bool getIsTree()
|
36 |
-
* @method string getType()
|
37 |
-
* @method string getLabelSingular()
|
38 |
-
* @method string getLabelPlural()
|
39 |
-
* @method string getProductAttributeCode()
|
40 |
-
* @method string getCategoryAttributeCode()
|
41 |
-
* @method int getPosition()
|
42 |
-
* @method string getUrlRewriteList()
|
43 |
-
* @method bool getAllowComment()
|
44 |
-
* @method bool getStore()
|
45 |
-
* @method bool getShowCategory()
|
46 |
-
* @method int getProductAttributeScope()
|
47 |
-
* @method int getCategoryAttributeScope()
|
48 |
-
* @method bool getProductAttribute();
|
49 |
-
* @method bool getCategoryAttribute()
|
50 |
-
* @method string getProductAttributeGroup()
|
51 |
-
* @method string getCategoryAttributeGroup()
|
52 |
-
* @method int getListMenu()
|
53 |
-
* @method bool getRest()
|
54 |
-
* @method Ultimate_ModuleCreator_Model_Entity setPosition()
|
55 |
-
* @method Ultimate_ModuleCreator_Model_Entity setRss()
|
56 |
-
* @method bool getEditor()
|
57 |
-
* @method bool getApi()
|
58 |
-
* @method bool getHasCountry()
|
59 |
-
* @method bool getSearch()
|
60 |
-
* @method int getIndex()
|
61 |
-
*/
|
62 |
-
class Ultimate_ModuleCreator_Model_Entity
|
63 |
-
|
64 |
-
/**
|
65 |
-
* reference to type instance
|
66 |
-
*
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
*
|
81 |
-
* @var
|
82 |
-
*/
|
83 |
-
protected $
|
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 |
-
if ($
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
}
|
195 |
-
$
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
if (
|
208 |
-
$this->
|
209 |
-
}
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
*
|
219 |
-
*
|
220 |
-
* @
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
$
|
236 |
-
|
237 |
-
$
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
*
|
269 |
-
* @
|
270 |
-
* @return string
|
271 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
272 |
-
*/
|
273 |
-
public function
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
/**
|
295 |
-
*
|
296 |
-
*
|
297 |
-
* @
|
298 |
-
* @
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
/**
|
313 |
-
* get the
|
314 |
-
*
|
315 |
-
* @
|
316 |
-
* @
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
*
|
328 |
-
* @
|
329 |
-
* @
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
*
|
350 |
-
*
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
*
|
401 |
-
*
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
*
|
426 |
-
* @
|
427 |
-
* @
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
*
|
438 |
-
* @
|
439 |
-
* @
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
if ($this->
|
444 |
-
return $this->getData('
|
445 |
-
}
|
446 |
-
return '';
|
447 |
-
}
|
448 |
-
|
449 |
-
|
450 |
-
*
|
451 |
-
*
|
452 |
-
* @
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
return
|
474 |
-
}
|
475 |
-
|
476 |
-
|
477 |
-
*
|
478 |
-
*
|
479 |
-
* @
|
480 |
-
* @return
|
481 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
482 |
-
*/
|
483 |
-
public function
|
484 |
-
|
485 |
-
return $this;
|
486 |
-
}
|
487 |
-
|
488 |
-
|
489 |
-
*
|
490 |
-
*
|
491 |
-
* @
|
492 |
-
* @
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
*
|
505 |
-
* @
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
/**
|
513 |
-
* check if
|
514 |
-
*
|
515 |
-
* @
|
516 |
-
* @
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
*
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
*
|
542 |
-
* @access public
|
543 |
-
* @return
|
544 |
-
* @
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
if (
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
return $this->
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
*
|
570 |
-
*
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
$this->
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
Mage::
|
688 |
-
$
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
*
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
$
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
);
|
744 |
-
|
745 |
-
$this->
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
$
|
773 |
-
|
774 |
-
|
775 |
-
$
|
776 |
-
|
777 |
-
|
778 |
-
$
|
779 |
-
|
780 |
-
|
781 |
-
$
|
782 |
-
|
783 |
-
|
784 |
-
$
|
785 |
-
|
786 |
-
|
787 |
-
$
|
788 |
-
|
789 |
-
|
790 |
-
$
|
791 |
-
|
792 |
-
|
793 |
-
$
|
794 |
-
$
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
$
|
810 |
-
$
|
811 |
-
$
|
812 |
-
$
|
813 |
-
$
|
814 |
-
$
|
815 |
-
$
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
$
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
$
|
880 |
-
$
|
881 |
-
$
|
882 |
-
|
883 |
-
$
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
*
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
$
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
$
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
$
|
1205 |
-
|
1206 |
-
$
|
1207 |
-
}
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
$
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
$
|
1237 |
-
|
1238 |
-
|
1239 |
-
$content .= $
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
*
|
1247 |
-
* @access public
|
1248 |
-
* @
|
1249 |
-
* @
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
$
|
1257 |
-
$
|
1258 |
-
|
1259 |
-
|
1260 |
-
$
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
$
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
$
|
1409 |
-
$
|
1410 |
-
$
|
1411 |
-
$content
|
1412 |
-
$
|
1413 |
-
|
1414 |
-
|
1415 |
-
$content
|
1416 |
-
$content
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
$content .= $
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
$content .= $
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
return $content;
|
1481 |
-
}
|
1482 |
-
|
1483 |
-
|
1484 |
-
*
|
1485 |
-
*
|
1486 |
-
* @
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
$eol = $this->getEol();
|
1493 |
-
$
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
$
|
1500 |
-
$content .= $
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
$content .= $
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
*
|
1513 |
-
* @access public
|
1514 |
-
* @
|
1515 |
-
* @
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
$
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
*
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
$
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
*
|
1568 |
-
*
|
1569 |
-
* @
|
1570 |
-
* @
|
1571 |
-
* @
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
$
|
1576 |
-
$
|
1577 |
-
$
|
1578 |
-
$
|
1579 |
-
$
|
1580 |
-
$
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
$
|
1603 |
-
|
1604 |
-
|
1605 |
-
$
|
1606 |
-
$
|
1607 |
-
|
1608 |
-
|
1609 |
-
$
|
1610 |
-
$
|
1611 |
-
|
1612 |
-
|
1613 |
-
$
|
1614 |
-
$
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
$
|
1619 |
-
$
|
1620 |
-
|
1621 |
-
$
|
1622 |
-
$
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
$content
|
1643 |
-
$content
|
1644 |
-
$content
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
$
|
1667 |
-
$
|
1668 |
-
$
|
1669 |
-
$content .= $padding.$
|
1670 |
-
|
1671 |
-
|
1672 |
-
$content .= $padding.$
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
$content
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
$
|
1756 |
-
$
|
1757 |
-
|
1758 |
-
|
1759 |
-
$content
|
1760 |
-
|
1761 |
-
|
1762 |
-
$content .= $
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
$
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
*
|
1776 |
-
* @
|
1777 |
-
* @return string
|
1778 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1779 |
-
*/
|
1780 |
-
public function
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
$
|
1795 |
-
$
|
1796 |
-
|
1797 |
-
$
|
1798 |
-
$
|
1799 |
-
$
|
1800 |
-
$
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
$
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
$
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
$
|
1897 |
-
$
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
/**
|
1902 |
-
* get
|
1903 |
-
*
|
1904 |
-
* @
|
1905 |
-
* @
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
$content
|
1918 |
-
$content
|
1919 |
-
}
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
$
|
1941 |
-
$
|
1942 |
-
$
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
$
|
1951 |
-
|
1952 |
-
|
1953 |
-
$
|
1954 |
-
$
|
1955 |
-
|
1956 |
-
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
*
|
1965 |
-
*
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
$
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
$tab
|
2004 |
-
|
2005 |
-
$
|
2006 |
-
$
|
2007 |
-
|
2008 |
-
$
|
2009 |
-
$content .= $padding.'<
|
2010 |
-
$content .= $padding.$tab.'<
|
2011 |
-
|
2012 |
-
$content .= $padding
|
2013 |
-
|
2014 |
-
$content .= $padding
|
2015 |
-
$content .= $padding.
|
2016 |
-
|
2017 |
-
$content
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
$content
|
2031 |
-
$
|
2032 |
-
$
|
2033 |
-
$
|
2034 |
-
$
|
2035 |
-
$
|
2036 |
-
$
|
2037 |
-
|
2038 |
-
$
|
2039 |
-
$
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
$
|
2056 |
-
|
2057 |
-
|
2058 |
-
$
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
$content .= $
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
$
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
$content
|
2110 |
-
|
2111 |
-
$
|
2112 |
-
$
|
2113 |
-
$
|
2114 |
-
|
2115 |
-
$
|
2116 |
-
|
2117 |
-
$content .= $padding.'<
|
2118 |
-
|
2119 |
-
$content .= $padding.'</
|
2120 |
-
|
2121 |
-
$content
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
*
|
2129 |
-
* @
|
2130 |
-
* @
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
$content
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
$content .= $
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
$
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
$
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
$
|
2204 |
-
$
|
2205 |
-
$
|
2206 |
-
$
|
2207 |
-
|
2208 |
-
$
|
2209 |
-
$
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
$
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
$
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
$
|
2249 |
-
|
2250 |
-
|
2251 |
-
$
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
*
|
2264 |
-
* @access public
|
2265 |
-
* @param
|
2266 |
-
* @return string
|
2267 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2268 |
-
*/
|
2269 |
-
public function
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
$
|
2275 |
-
$
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
*
|
2294 |
-
*
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
*
|
2330 |
-
*
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
|
2367 |
-
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
*
|
2397 |
-
|
2398 |
-
|
2399 |
-
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
$
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
$
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
-
|
2420 |
-
|
2421 |
-
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
2433 |
-
|
2434 |
-
|
2435 |
-
|
2436 |
-
|
2437 |
-
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
|
2446 |
-
|
2447 |
-
|
2448 |
-
|
2449 |
-
|
2450 |
-
|
2451 |
-
|
2452 |
-
|
2453 |
-
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
*
|
2489 |
-
*
|
2490 |
-
* @
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
|
2505 |
-
|
2506 |
-
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
|
2525 |
-
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
|
2530 |
-
|
2531 |
-
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
-
|
2544 |
-
|
2545 |
-
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
2575 |
-
|
2576 |
-
|
2577 |
-
|
2578 |
-
|
2579 |
-
|
2580 |
-
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
|
2593 |
-
$
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
$
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
*
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
$
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
-
*
|
2672 |
-
* @
|
2673 |
-
* @
|
2674 |
-
|
2675 |
-
|
2676 |
-
|
2677 |
-
$
|
2678 |
-
|
2679 |
-
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
|
2704 |
-
|
2705 |
-
*
|
2706 |
-
*
|
2707 |
-
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
2722 |
-
|
2723 |
-
|
2724 |
-
|
2725 |
-
|
2726 |
-
|
2727 |
-
|
2728 |
-
|
2729 |
-
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
*
|
2743 |
-
* @access public
|
2744 |
-
* @return
|
2745 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2746 |
-
*/
|
2747 |
-
public function
|
2748 |
-
|
2749 |
-
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
2753 |
-
*
|
2754 |
-
*
|
2755 |
-
* @
|
2756 |
-
|
2757 |
-
|
2758 |
-
|
2759 |
-
|
2760 |
-
|
2761 |
-
|
2762 |
-
|
2763 |
-
|
2764 |
-
|
2765 |
-
*
|
2766 |
-
|
2767 |
-
|
2768 |
-
|
2769 |
-
|
2770 |
-
|
2771 |
-
|
2772 |
-
|
2773 |
-
|
2774 |
-
|
2775 |
-
|
2776 |
-
|
2777 |
-
*
|
2778 |
-
*
|
2779 |
-
* @
|
2780 |
-
* @
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
|
2788 |
-
|
2789 |
-
|
2790 |
-
|
2791 |
-
|
2792 |
-
|
2793 |
-
|
2794 |
-
|
2795 |
-
|
2796 |
-
|
2797 |
-
|
2798 |
-
|
2799 |
-
|
2800 |
-
|
2801 |
-
|
2802 |
-
|
2803 |
-
|
2804 |
-
|
2805 |
-
|
2806 |
-
|
2807 |
-
|
2808 |
-
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
-
|
2816 |
-
*
|
2817 |
-
* @
|
2818 |
-
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
$
|
2831 |
-
|
2832 |
-
|
2833 |
-
|
2834 |
-
|
2835 |
-
|
2836 |
-
|
2837 |
-
*
|
2838 |
-
* @
|
2839 |
-
* @return
|
2840 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2841 |
-
*/
|
2842 |
-
public function
|
2843 |
-
|
2844 |
-
$
|
2845 |
-
|
2846 |
-
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
|
2858 |
-
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
|
2867 |
-
|
2868 |
-
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
|
2873 |
-
|
2874 |
-
|
2875 |
-
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
2880 |
-
|
2881 |
-
|
2882 |
-
|
2883 |
-
$
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
-
|
2889 |
-
|
2890 |
-
|
2891 |
-
|
2892 |
-
|
2893 |
-
|
2894 |
-
|
2895 |
-
|
2896 |
-
|
2897 |
-
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
*
|
2905 |
-
*
|
2906 |
-
* @
|
2907 |
-
* @
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
);
|
2913 |
-
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
2920 |
-
|
2921 |
-
|
2922 |
-
|
2923 |
-
|
2924 |
-
|
2925 |
-
|
2926 |
-
|
2927 |
-
|
2928 |
-
|
2929 |
-
*
|
2930 |
-
* @
|
2931 |
-
* @
|
2932 |
-
|
2933 |
-
|
2934 |
-
|
2935 |
-
|
2936 |
-
|
2937 |
-
|
2938 |
-
|
2939 |
-
|
2940 |
-
|
2941 |
-
|
2942 |
-
|
2943 |
-
|
2944 |
-
|
2945 |
-
|
2946 |
-
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
2955 |
-
*
|
2956 |
-
* @
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
|
2963 |
-
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
-
*
|
2975 |
-
* @access public
|
2976 |
-
* @return string
|
2977 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2978 |
-
*/
|
2979 |
-
public function
|
2980 |
-
|
2981 |
-
|
2982 |
-
|
2983 |
-
|
2984 |
-
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
-
|
2990 |
-
|
2991 |
-
|
2992 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* entity model
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
/**
|
26 |
+
* @method Ultimate_ModuleCreator_Model_Entity setIndex()
|
27 |
+
* @method Ultimate_ModuleCreator_Model_Entity setEditor()
|
28 |
+
* @method Ultimate_ModuleCreator_Model_Entity setHasImage()
|
29 |
+
* @method Ultimate_ModuleCreator_Model_Entity setHasFile()
|
30 |
+
* @method Ultimate_ModuleCreator_Model_Entity setHasCountry()
|
31 |
+
* @method Ultimate_ModuleCreator_Model_Entity setHasMultipleSelect()
|
32 |
+
* @method bool getCreateFrontend()
|
33 |
+
* @method bool getLinkProduct()
|
34 |
+
* @method bool getLinkCategory()
|
35 |
+
* @method bool getIsTree()
|
36 |
+
* @method string getType()
|
37 |
+
* @method string getLabelSingular()
|
38 |
+
* @method string getLabelPlural()
|
39 |
+
* @method string getProductAttributeCode()
|
40 |
+
* @method string getCategoryAttributeCode()
|
41 |
+
* @method int getPosition()
|
42 |
+
* @method string getUrlRewriteList()
|
43 |
+
* @method bool getAllowComment()
|
44 |
+
* @method bool getStore()
|
45 |
+
* @method bool getShowCategory()
|
46 |
+
* @method int getProductAttributeScope()
|
47 |
+
* @method int getCategoryAttributeScope()
|
48 |
+
* @method bool getProductAttribute();
|
49 |
+
* @method bool getCategoryAttribute()
|
50 |
+
* @method string getProductAttributeGroup()
|
51 |
+
* @method string getCategoryAttributeGroup()
|
52 |
+
* @method int getListMenu()
|
53 |
+
* @method bool getRest()
|
54 |
+
* @method Ultimate_ModuleCreator_Model_Entity setPosition()
|
55 |
+
* @method Ultimate_ModuleCreator_Model_Entity setRss()
|
56 |
+
* @method bool getEditor()
|
57 |
+
* @method bool getApi()
|
58 |
+
* @method bool getHasCountry()
|
59 |
+
* @method bool getSearch()
|
60 |
+
* @method int getIndex()
|
61 |
+
*/
|
62 |
+
class Ultimate_ModuleCreator_Model_Entity extends Ultimate_ModuleCreator_Model_Abstract
|
63 |
+
{
|
64 |
+
/**
|
65 |
+
* reference to type instance
|
66 |
+
*
|
67 |
+
* @var null|Ultimate_ModuleCreator_Model_Entity_Type_Abstract
|
68 |
+
*/
|
69 |
+
protected $_typeInstance = null;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* entity code
|
73 |
+
*
|
74 |
+
* @var string
|
75 |
+
*/
|
76 |
+
protected $_entityCode = 'umc_entity';
|
77 |
+
|
78 |
+
/**
|
79 |
+
* entity attributes
|
80 |
+
*
|
81 |
+
* @var array
|
82 |
+
*/
|
83 |
+
protected $_attributes = array();
|
84 |
+
|
85 |
+
/**
|
86 |
+
* entity module
|
87 |
+
*
|
88 |
+
* @var Ultimate_ModuleCreator_Model_Module
|
89 |
+
*/
|
90 |
+
protected $_module = null;
|
91 |
+
|
92 |
+
/**
|
93 |
+
* attribute that behaves as name
|
94 |
+
*
|
95 |
+
* @var Ultimate_ModuleCreator_Model_Attribute
|
96 |
+
*/
|
97 |
+
protected $_nameAttribute = null;
|
98 |
+
|
99 |
+
/**
|
100 |
+
* remember if attributes were prepared
|
101 |
+
*
|
102 |
+
* @var bool
|
103 |
+
*/
|
104 |
+
protected $_preparedAttributes = null;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* related entities
|
108 |
+
*
|
109 |
+
* @var array()
|
110 |
+
*/
|
111 |
+
protected $_relatedEntities = array();
|
112 |
+
|
113 |
+
/**
|
114 |
+
* placeholders for replacing in source files
|
115 |
+
*
|
116 |
+
* @var mixed
|
117 |
+
*/
|
118 |
+
protected $_placeholders = null;
|
119 |
+
|
120 |
+
/**
|
121 |
+
* placeholders for sibling entities
|
122 |
+
*
|
123 |
+
* @var mixed
|
124 |
+
*/
|
125 |
+
protected $_placeholdersAsSibling = null;
|
126 |
+
|
127 |
+
/**
|
128 |
+
* set the entity module
|
129 |
+
*
|
130 |
+
* @access public
|
131 |
+
* @param Ultimate_ModuleCreator_Model_Module $module
|
132 |
+
* @return Ultimate_ModuleCreator_Model_Entity
|
133 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
134 |
+
*/
|
135 |
+
public function setModule(Ultimate_ModuleCreator_Model_Module $module)
|
136 |
+
{
|
137 |
+
$this->_module = $module;
|
138 |
+
return $this;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* get the entity module
|
143 |
+
*
|
144 |
+
* @access public
|
145 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
146 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
147 |
+
*/
|
148 |
+
public function getModule()
|
149 |
+
{
|
150 |
+
return $this->_module;
|
151 |
+
}
|
152 |
+
|
153 |
+
/**
|
154 |
+
* add new attribute
|
155 |
+
*
|
156 |
+
* @access public
|
157 |
+
* @param Ultimate_ModuleCreator_Model_Attribute $attribute
|
158 |
+
* @return Ultimate_ModuleCreator_Model_Entity
|
159 |
+
* @throws Ultimate_ModuleCreator_Exception
|
160 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
161 |
+
*/
|
162 |
+
public function addAttribute(Ultimate_ModuleCreator_Model_Attribute $attribute)
|
163 |
+
{
|
164 |
+
Mage::dispatchEvent(
|
165 |
+
'umc_entity_add_attribute_before',
|
166 |
+
array('attribute'=>$attribute, 'entity'=>$this)
|
167 |
+
);
|
168 |
+
$attribute->setEntity($this);
|
169 |
+
if (isset($this->_attributes[$attribute->getCode()])) {
|
170 |
+
throw new Ultimate_ModuleCreator_Exception(
|
171 |
+
Mage::helper('modulecreator')->__(
|
172 |
+
'An attribute with the code "%s" already exists for entity "%s"',
|
173 |
+
$attribute->getCode(),
|
174 |
+
$this->getNameSingular()
|
175 |
+
)
|
176 |
+
);
|
177 |
+
}
|
178 |
+
$this->_preparedAttributes = false;
|
179 |
+
$this->_attributes[$attribute->getCode()] = $attribute;
|
180 |
+
if ($attribute->getIsName()) {
|
181 |
+
if (!$attribute->getIsAllowedAsName()) {
|
182 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
183 |
+
$helper = Mage::helper('modulecreator');
|
184 |
+
$attributeTypes = $helper->getNameAttributeTypes(true);
|
185 |
+
throw new Ultimate_ModuleCreator_Exception(
|
186 |
+
Mage::helper('modulecreator')->__(
|
187 |
+
'An attribute that acts as name must have one of the types "%s".',
|
188 |
+
implode(', ', $attributeTypes)
|
189 |
+
)
|
190 |
+
);
|
191 |
+
}
|
192 |
+
$attribute->setUserDefined(false);
|
193 |
+
$this->_nameAttribute = $attribute;
|
194 |
+
}
|
195 |
+
if ($attribute->getEditor()) {
|
196 |
+
$this->setEditor(true);
|
197 |
+
}
|
198 |
+
if ($attribute->getType() == 'image') {
|
199 |
+
$this->setHasImage(true);
|
200 |
+
}
|
201 |
+
if ($attribute->getType() == 'file') {
|
202 |
+
$this->setHasFile(true);
|
203 |
+
}
|
204 |
+
if ($attribute->getType() == 'country') {
|
205 |
+
$this->setHasCountry(true);
|
206 |
+
}
|
207 |
+
if ($attribute->getIsMultipleSelect()) {
|
208 |
+
$this->setHasMultipleSelect(true);
|
209 |
+
}
|
210 |
+
Mage::dispatchEvent(
|
211 |
+
'umc_entity_add_attribute_after',
|
212 |
+
array('attribute'=>$attribute, 'entity'=>$this)
|
213 |
+
);
|
214 |
+
return $this;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* prepare attributes
|
219 |
+
*
|
220 |
+
* @access protected
|
221 |
+
* @return Ultimate_ModuleCreator_Model_Entity
|
222 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
223 |
+
*/
|
224 |
+
protected function _prepareAttributes()
|
225 |
+
{
|
226 |
+
if ($this->_preparedAttributes) {
|
227 |
+
return $this;
|
228 |
+
}
|
229 |
+
$attributesByPosition = array();
|
230 |
+
foreach ($this->_attributes as $attribute) {
|
231 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attribute */
|
232 |
+
$attributesByPosition[$attribute->getPosition()][] = $attribute;
|
233 |
+
}
|
234 |
+
ksort($attributesByPosition);
|
235 |
+
$attributes = array();
|
236 |
+
foreach ($attributesByPosition as $attributeList) {
|
237 |
+
foreach ($attributeList as $attribute) {
|
238 |
+
$attributes[$attribute->getCode()] = $attribute;
|
239 |
+
}
|
240 |
+
}
|
241 |
+
$this->_attributes = $attributes;
|
242 |
+
Mage::dispatchEvent('umc_entity_prepare_attributes', array('entity'=>$this));
|
243 |
+
$this->_preparedAttributes = true;
|
244 |
+
return $this;
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* ge the entity attributes
|
249 |
+
*
|
250 |
+
* @access public
|
251 |
+
* @return Ultimate_ModuleCreator_Model_Attribute[]
|
252 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
253 |
+
*/
|
254 |
+
public function getAttributes()
|
255 |
+
{
|
256 |
+
if (!$this->_preparedAttributes) {
|
257 |
+
$this->_prepareAttributes();
|
258 |
+
}
|
259 |
+
return $this->_attributes;
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* entity to xml
|
264 |
+
*
|
265 |
+
* @access public
|
266 |
+
* @param array $arrAttributes
|
267 |
+
* @param string $rootName
|
268 |
+
* @param bool $addOpenTag
|
269 |
+
* @param bool $addCdata
|
270 |
+
* @return string
|
271 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
272 |
+
*/
|
273 |
+
public function toXml(array $arrAttributes = array(), $rootName = 'entity', $addOpenTag=false, $addCdata=false)
|
274 |
+
{
|
275 |
+
$xml = '';
|
276 |
+
if ($addOpenTag) {
|
277 |
+
$xml.= '<?xml version="1.0" encoding="UTF-8"?>'.$this->getEol();
|
278 |
+
}
|
279 |
+
if (!empty($rootName)) {
|
280 |
+
$xml.= '<'.$rootName.'>'.$this->getEol();
|
281 |
+
}
|
282 |
+
$xml .= parent::toXml($this->getXmlAttributes(), '', false, $addCdata);
|
283 |
+
$xml .= '<attributes>'.$this->getEol();
|
284 |
+
foreach ($this->getAttributes() as $attribute) {
|
285 |
+
$xml .= $attribute->toXml(array(), 'attribute', false, $addCdata);
|
286 |
+
}
|
287 |
+
$xml .= '</attributes>'.$this->getEol();
|
288 |
+
if (!empty($rootName)) {
|
289 |
+
$xml.= '</'.$rootName.'>'.$this->getEol();
|
290 |
+
}
|
291 |
+
return $xml;
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* get magic function code for the name attribute
|
296 |
+
*
|
297 |
+
* @access public
|
298 |
+
* @return string
|
299 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
300 |
+
*/
|
301 |
+
public function getNameAttributeMagicCode()
|
302 |
+
{
|
303 |
+
$nameAttribute = $this->getNameAttribute();
|
304 |
+
if ($nameAttribute) {
|
305 |
+
$entityNameMagicCode = $nameAttribute->getMagicMethodCode();
|
306 |
+
} else {
|
307 |
+
$entityNameMagicCode = 'Name';
|
308 |
+
}
|
309 |
+
return $entityNameMagicCode;
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* get the name attribute
|
314 |
+
*
|
315 |
+
* @access public
|
316 |
+
* @return mixed(null|Ultimate_ModuleCreator_Model_Attribute)
|
317 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
318 |
+
*/
|
319 |
+
public function getNameAttribute()
|
320 |
+
{
|
321 |
+
return $this->_nameAttribute;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* get the attribute code for the name attribute
|
326 |
+
*
|
327 |
+
* @access public
|
328 |
+
* @return string
|
329 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
330 |
+
*/
|
331 |
+
public function getNameAttributeCode()
|
332 |
+
{
|
333 |
+
return $this->_nameAttribute->getCode();
|
334 |
+
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* get the attribute label for the name attribute
|
338 |
+
*
|
339 |
+
* @access public
|
340 |
+
* @return string
|
341 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
342 |
+
*/
|
343 |
+
public function getNameAttributeLabel()
|
344 |
+
{
|
345 |
+
return $this->getNameAttribute()->getLabel();
|
346 |
+
}
|
347 |
+
|
348 |
+
/**
|
349 |
+
* check if the entity has file attributes
|
350 |
+
*
|
351 |
+
* @access public
|
352 |
+
* @return bool
|
353 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
354 |
+
*/
|
355 |
+
public function getHasFile()
|
356 |
+
{
|
357 |
+
return $this->getTypeInstance()->getHasFile();
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* check if the entity has image attributes
|
362 |
+
*
|
363 |
+
* @access public
|
364 |
+
* @return bool
|
365 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
366 |
+
*/
|
367 |
+
public function getHasImage()
|
368 |
+
{
|
369 |
+
return $this->getTypeInstance()->getHasImage();
|
370 |
+
}
|
371 |
+
/**
|
372 |
+
* check if the entity has upload attributes
|
373 |
+
* @access public
|
374 |
+
* @return bool
|
375 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
376 |
+
*/
|
377 |
+
public function getHasUpload()
|
378 |
+
{
|
379 |
+
return $this->getHasFile() || $this->getHasImage();
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* get the first image attribute code
|
384 |
+
*
|
385 |
+
* @access public
|
386 |
+
* @return string
|
387 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
388 |
+
*/
|
389 |
+
public function getFirstImageField()
|
390 |
+
{
|
391 |
+
foreach ($this->getAttributes() as $attribute) {
|
392 |
+
if ($attribute->getType() == 'image') {
|
393 |
+
return $attribute->getCode();
|
394 |
+
}
|
395 |
+
}
|
396 |
+
return '';
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* get the attribute name for plural
|
401 |
+
*
|
402 |
+
* @access public
|
403 |
+
* @param bool $lower
|
404 |
+
* @return string
|
405 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
406 |
+
*/
|
407 |
+
public function getNamePlural($lower = false)
|
408 |
+
{
|
409 |
+
$plural = $this->getData('name_plural');
|
410 |
+
if ($plural == $this->getNameSingular()) {
|
411 |
+
if ($plural == "") {
|
412 |
+
return "";
|
413 |
+
}
|
414 |
+
$plural = $this->getNameSingular().'s';
|
415 |
+
}
|
416 |
+
if ($lower) {
|
417 |
+
$plural = strtolower($plural);
|
418 |
+
}
|
419 |
+
return $plural;
|
420 |
+
}
|
421 |
+
|
422 |
+
/**
|
423 |
+
* check if frontend list files must be created
|
424 |
+
*
|
425 |
+
* @access public
|
426 |
+
* @return bool
|
427 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
428 |
+
*/
|
429 |
+
public function getCreateList()
|
430 |
+
{
|
431 |
+
return $this->getCreateFrontend() && $this->getData('create_list');
|
432 |
+
}
|
433 |
+
|
434 |
+
/**
|
435 |
+
* get list template
|
436 |
+
*
|
437 |
+
* @access public
|
438 |
+
* @return string
|
439 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
440 |
+
*/
|
441 |
+
public function getListTemplate()
|
442 |
+
{
|
443 |
+
if ($this->getCreateList()) {
|
444 |
+
return $this->getData('list_template');
|
445 |
+
}
|
446 |
+
return '';
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* check if frontend view files must be created
|
451 |
+
*
|
452 |
+
* @access public
|
453 |
+
* @return bool
|
454 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
455 |
+
*/
|
456 |
+
public function getCreateView()
|
457 |
+
{
|
458 |
+
return $this->getCreateFrontend() && $this->getData('create_view');
|
459 |
+
}
|
460 |
+
|
461 |
+
/**
|
462 |
+
* get list template
|
463 |
+
*
|
464 |
+
* @access public
|
465 |
+
* @return string
|
466 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
467 |
+
*/
|
468 |
+
public function getViewTemplate()
|
469 |
+
{
|
470 |
+
if ($this->getCreateView()) {
|
471 |
+
return $this->getData('view_template');
|
472 |
+
}
|
473 |
+
return '';
|
474 |
+
}
|
475 |
+
|
476 |
+
/**
|
477 |
+
* check if widget list files must be created
|
478 |
+
*
|
479 |
+
* @access public
|
480 |
+
* @return bool
|
481 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
482 |
+
*/
|
483 |
+
public function getWidget()
|
484 |
+
{
|
485 |
+
return $this->getCreateFrontend() && $this->getData('widget');
|
486 |
+
}
|
487 |
+
|
488 |
+
/**
|
489 |
+
* check if SEO attributes should be added
|
490 |
+
*
|
491 |
+
* @access public
|
492 |
+
* @return bool
|
493 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
494 |
+
*/
|
495 |
+
public function getAddSeo()
|
496 |
+
{
|
497 |
+
return $this->getCreateView() && $this->getData('add_seo');
|
498 |
+
}
|
499 |
+
|
500 |
+
/**
|
501 |
+
* check if SEO attributes should be added
|
502 |
+
*
|
503 |
+
* @access public
|
504 |
+
* @return bool
|
505 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
506 |
+
*/
|
507 |
+
public function getRss()
|
508 |
+
{
|
509 |
+
return $this->getCreateFrontend() && $this->getData('rss');
|
510 |
+
}
|
511 |
+
|
512 |
+
/**
|
513 |
+
* check if url rewrite should be added
|
514 |
+
*
|
515 |
+
* @access public
|
516 |
+
* @return bool
|
517 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
518 |
+
*/
|
519 |
+
public function getUrlRewrite()
|
520 |
+
{
|
521 |
+
return $this->getCreateView() && $this->getData('url_rewrite');
|
522 |
+
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* get url prefix
|
526 |
+
*
|
527 |
+
* @access public
|
528 |
+
* @return string
|
529 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
530 |
+
*/
|
531 |
+
public function getUrlPrefix()
|
532 |
+
{
|
533 |
+
if ($this->getUrlRewrite()) {
|
534 |
+
return $this->getData('url_prefix');
|
535 |
+
}
|
536 |
+
return '';
|
537 |
+
}
|
538 |
+
|
539 |
+
/**
|
540 |
+
* get url suffix
|
541 |
+
*
|
542 |
+
* @access public
|
543 |
+
* @return string
|
544 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
545 |
+
*/
|
546 |
+
public function getUrlSuffix()
|
547 |
+
{
|
548 |
+
if ($this->getUrlRewrite()) {
|
549 |
+
return $this->getData('url_suffix');
|
550 |
+
}
|
551 |
+
return '';
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* check if products are listed in the entity view page
|
556 |
+
*
|
557 |
+
* @access public
|
558 |
+
* @return bool
|
559 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
560 |
+
*/
|
561 |
+
public function getShowProducts()
|
562 |
+
{
|
563 |
+
return $this->getLinkProduct() &&
|
564 |
+
$this->getCreateFrontend() &&
|
565 |
+
$this->getData('show_products');
|
566 |
+
}
|
567 |
+
|
568 |
+
/**
|
569 |
+
* check if entity list is shown on product page
|
570 |
+
*
|
571 |
+
* @access public
|
572 |
+
* @return bool
|
573 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
574 |
+
*/
|
575 |
+
public function getShowOnProduct()
|
576 |
+
{
|
577 |
+
return $this->getLinkProduct() && $this->getData('show_on_product');
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* check if entity list is shown on category page
|
582 |
+
*
|
583 |
+
* @access public
|
584 |
+
* @return bool
|
585 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
586 |
+
*/
|
587 |
+
public function getShowOnCategory()
|
588 |
+
{
|
589 |
+
return $this->getLinkCategory() && $this->getData('show_on_category');
|
590 |
+
}
|
591 |
+
|
592 |
+
/**
|
593 |
+
* add related entities
|
594 |
+
*
|
595 |
+
* @access public
|
596 |
+
* @param string $type
|
597 |
+
* @param Ultimate_ModuleCreator_Model_Entity $entity
|
598 |
+
* @return Ultimate_ModuleCreator_Model_Entity
|
599 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
600 |
+
*/
|
601 |
+
public function addRelatedEntity($type, $entity)
|
602 |
+
{
|
603 |
+
$this->_relatedEntities[$type][] = $entity;
|
604 |
+
return $this;
|
605 |
+
}
|
606 |
+
|
607 |
+
/**
|
608 |
+
* get the related entities
|
609 |
+
*
|
610 |
+
* @access public
|
611 |
+
* @param mixed $type
|
612 |
+
* @return Ultimate_ModuleCreator_Model_Entity[]
|
613 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
614 |
+
*/
|
615 |
+
public function getRelatedEntities($type = null)
|
616 |
+
{
|
617 |
+
if (is_null($type)) {
|
618 |
+
return $this->_relatedEntities;
|
619 |
+
}
|
620 |
+
if (isset($this->_relatedEntities[$type])) {
|
621 |
+
return $this->_relatedEntities[$type];
|
622 |
+
}
|
623 |
+
return array();
|
624 |
+
}
|
625 |
+
|
626 |
+
/**
|
627 |
+
* check if entity does not behave as tree
|
628 |
+
*
|
629 |
+
* @access public
|
630 |
+
* @return bool
|
631 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
632 |
+
*/
|
633 |
+
public function getNotIsTree()
|
634 |
+
{
|
635 |
+
return !$this->getIsTree();
|
636 |
+
}
|
637 |
+
|
638 |
+
/**
|
639 |
+
* check if entity does not have url rewrites
|
640 |
+
*
|
641 |
+
* @access public
|
642 |
+
* @return bool
|
643 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
644 |
+
*/
|
645 |
+
public function getNotUrlRewrite()
|
646 |
+
{
|
647 |
+
return !$this->getUrlRewrite();
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
* check if entity is EAV
|
652 |
+
*
|
653 |
+
* @access public
|
654 |
+
* @return bool
|
655 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
656 |
+
*/
|
657 |
+
public function getIsEav()
|
658 |
+
{
|
659 |
+
return $this->getType() == Ultimate_ModuleCreator_Model_Entity_Type_Abstract::TYPE_EAV;
|
660 |
+
}
|
661 |
+
|
662 |
+
/**
|
663 |
+
* check if entity is Flat
|
664 |
+
*
|
665 |
+
* @access public
|
666 |
+
* @return bool
|
667 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
668 |
+
*/
|
669 |
+
public function getIsFlat()
|
670 |
+
{
|
671 |
+
return $this->getType() == Ultimate_ModuleCreator_Model_Entity_Type_Abstract::TYPE_FLAT;
|
672 |
+
}
|
673 |
+
|
674 |
+
/**
|
675 |
+
* get the entity type instance
|
676 |
+
*
|
677 |
+
* @access public
|
678 |
+
* @return Ultimate_ModuleCreator_Model_Entity_Type_Abstract
|
679 |
+
* @throws Ultimate_ModuleCreator_Exception
|
680 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
681 |
+
*/
|
682 |
+
public function getTypeInstance()
|
683 |
+
{
|
684 |
+
if (is_null($this->_typeInstance)) {
|
685 |
+
$type = $this->getType();
|
686 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
687 |
+
$helper = Mage::helper('modulecreator');
|
688 |
+
$types = $helper->getEntityTypes(false);
|
689 |
+
if (isset($types[$type])) {
|
690 |
+
/** @var Ultimate_ModuleCreator_Model_Entity_Type_Abstract $typeInstance */
|
691 |
+
$typeInstance = Mage::getModel((string)$types[$type]->type_model);
|
692 |
+
$this->_typeInstance = $typeInstance;
|
693 |
+
} else {
|
694 |
+
throw new Ultimate_ModuleCreator_Exception(
|
695 |
+
Mage::helper('modulecreator')->__('Entity "%s" type is not valid', $type)
|
696 |
+
);
|
697 |
+
}
|
698 |
+
$this->_typeInstance->setEntity($this);
|
699 |
+
}
|
700 |
+
return $this->_typeInstance;
|
701 |
+
}
|
702 |
+
|
703 |
+
/**
|
704 |
+
* check if entity has default config settings
|
705 |
+
*
|
706 |
+
* @access public
|
707 |
+
* @return bool
|
708 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
709 |
+
*/
|
710 |
+
public function getHasConfigDefaults()
|
711 |
+
{
|
712 |
+
return $this->getCreateFrontend();
|
713 |
+
}
|
714 |
+
|
715 |
+
/**
|
716 |
+
* check if entity is linked to core entities (product, category)
|
717 |
+
*
|
718 |
+
* @access public
|
719 |
+
* @return bool
|
720 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
721 |
+
*/
|
722 |
+
public function getLinkCore()
|
723 |
+
{
|
724 |
+
return $this->getLinkProduct() || $this->getLinkCategory();
|
725 |
+
}
|
726 |
+
|
727 |
+
/**
|
728 |
+
* get entity placeholders
|
729 |
+
*
|
730 |
+
* @access public
|
731 |
+
* @param null $param
|
732 |
+
* @return array|mixed|null|string
|
733 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
734 |
+
*/
|
735 |
+
public function getPlaceholders($param = null)
|
736 |
+
{
|
737 |
+
if (is_null($this->_placeholders)) {
|
738 |
+
$this->_placeholders = array();
|
739 |
+
$this->_placeholders['{{entity_default_config}}'] = $this->getDefaultConfig();
|
740 |
+
$this->_placeholders['{{entity}}'] = $this->getNameSingular(true);
|
741 |
+
$this->_placeholders['{{Entity}}'] = ucfirst($this->getNameSingular(true));
|
742 |
+
$this->_placeholders['{{ENTITY}}'] = strtoupper($this->getNameSingular());
|
743 |
+
$this->_placeholders['{{EntityLabel}}'] = ucfirst($this->getLabelSingular());
|
744 |
+
$this->_placeholders['{{entityLabel}}'] = strtolower($this->getLabelSingular());
|
745 |
+
$this->_placeholders['{{EntitiesLabel}}'] = ucfirst($this->getLabelPlural());
|
746 |
+
$this->_placeholders['{{entitiesLabel}}'] = strtolower($this->getLabelPlural());
|
747 |
+
$this->_placeholders['{{entityCollectionAttributes}}'] = $this->getCollectionAttributes();
|
748 |
+
$this->_placeholders['{{entityAdminJoin}}'] = $this->getAdminJoin();
|
749 |
+
$this->_placeholders['{{prepareColumnsHeader}}'] = $this->getPrepareColumnsHeader();
|
750 |
+
$this->_placeholders['{{nameAttributeGridEav}}'] = $this->getNameAttributeGridEav();
|
751 |
+
$this->_placeholders['{{nameAttributeCode}}'] = $this->getNameAttributeCode();
|
752 |
+
$this->_placeholders['{{nameAttributeLabel}}'] = $this->getNameAttributeLabel();
|
753 |
+
$this->_placeholders['{{entities}}'] = $this->getNamePlural(true);
|
754 |
+
$this->_placeholders['{{Entities}}'] = ucfirst($this->getNamePlural(true));
|
755 |
+
$this->_placeholders['{{EntityNameMagicCode}}'] = $this->getNameAttributeMagicCode();
|
756 |
+
$this->_placeholders['{{attributeDdlSql}}'] = $this->getAttributesDdlSql();
|
757 |
+
$this->_placeholders['{{referenceHead}}'] = $this->getReferenceHeadLayout();
|
758 |
+
$this->_placeholders['{{EntityViewRelationLayout}}'] = $this->getRelationLayoutXml();
|
759 |
+
$this->_placeholders['{{listLayout}}'] = $this->getListTemplate();
|
760 |
+
$this->_placeholders['{{viewLayout}}'] = $this->getViewTemplate();
|
761 |
+
$this->_placeholders['{{entityHtmlLink}}'] = $this->getHtmlLink();
|
762 |
+
$this->_placeholders['{{EntityViewAttributes}}'] = $this->getViewAttributesHtml();
|
763 |
+
$this->_placeholders['{{EntityViewWidgetAttributes}}'] = $this->getViewWidgetAttributesHtml();
|
764 |
+
$this->_placeholders['{{systemAttributes}}'] = $this->getSystemAttributes();
|
765 |
+
$this->_placeholders['{{entityApiAdditional}}'] = $this->getApiAdditional();
|
766 |
+
$this->_placeholders['{{entityApiFaults}}'] = $this->getApiFaults();
|
767 |
+
$this->_placeholders['{{entityAdditionalApiAcl}}'] = $this->getAdditionalApiAcl();
|
768 |
+
$this->_placeholders['{{entityWsdlAttributes}}'] = $this->getWsdlAttributes();
|
769 |
+
$this->_placeholders['{{entityWsdlAttributesForAdd}}'] = $this->getWsdlAttributes(false, true);
|
770 |
+
$this->_placeholders['{{entityWsdlRelationTypes}}'] = $this->getWsdlRelationTypes();
|
771 |
+
$this->_placeholders['{{entityWsdlPortTypeRelation}}'] = $this->getWsdlPortTypeRelation();
|
772 |
+
$this->_placeholders['{{entityWsdlRelationBinding}}'] = $this->getWsdlRelationBinding();
|
773 |
+
$this->_placeholders['{{entityWsiRelationParamTypes}}'] = $this->getWsiRelationParamTypes();
|
774 |
+
$this->_placeholders['{{entityWsiRelationMessages}}'] = $this->getWsiRelationMessages();
|
775 |
+
$this->_placeholders['{{entityWsiPortTypeRelation}}'] = $this->getWsiPortTypeRelation();
|
776 |
+
$this->_placeholders['{{entityWsiRelationBinding}}'] = $this->getWsiRelationBinding();
|
777 |
+
$this->_placeholders['{{entityWsiAttributes}}'] = $this->getWsiAttributes();
|
778 |
+
$this->_placeholders['{{entityWsiAttributesForAdd}}'] = $this->getWsiAttributes(true);
|
779 |
+
$this->_placeholders['{{entityWsiRelationTypes}}'] = $this->getWsiRelationTypes();
|
780 |
+
$this->_placeholders['{{entityWsdlMessages}}'] = $this->getWsdlMessages();
|
781 |
+
$this->_placeholders['{{fksDdl}}'] = $this->getParentEntitiesFksDdl();
|
782 |
+
$this->_placeholders['{{selectedMenuPath}}'] = $this->getSelectedMenuPath();
|
783 |
+
$this->_placeholders['{{entityAttributesSetup}}'] = $this->getAttributesSetup();
|
784 |
+
$this->_placeholders['{{ResourceModelParent}}'] = $this->getResourceModelParent();
|
785 |
+
$this->_placeholders['{{ResourceCollectionParent}}'] = $this->getResourceCollectionModelParent();
|
786 |
+
$this->_placeholders['{{RelationsResourceTables}}'] = $this->getResourceRelationsTables();
|
787 |
+
$this->_placeholders['{{RelationsResourceTablesDeclare}}'] = $this->getResourceRelationsTablesDeclare();
|
788 |
+
$this->_placeholders['{{adminIndexContent}}'] = $this->getAdminIndexLayoutContent();
|
789 |
+
$this->_placeholders['{{EntityParentModel}}'] = $this->getEntityParentModel();
|
790 |
+
$this->_placeholders['{{entityTableAlias}}'] = $this->getEntityTableAlias();
|
791 |
+
$this->_placeholders['{{additionalPrepareCollection}}'] = $this->getAdditionalPrepareCollection();
|
792 |
+
$this->_placeholders['{{entityEditLayoutLeft}}'] = $this->getEditLayoutLeft();
|
793 |
+
$this->_placeholders['{{entityLayoutAdditional}}'] = $this->getEditLayoutAdditional();
|
794 |
+
$this->_placeholders['{{productAttributeCode}}'] = $this->getProductAttributeCode();
|
795 |
+
$this->_placeholders['{{categoryAttributeCode}}'] = $this->getCategoryAttributeCode();
|
796 |
+
$this->_placeholders['{{entityProductAttributeScope}}'] = $this->getProductAttributeScopeLabel();
|
797 |
+
$this->_placeholders['{{entityCategoryAttributeScope}}']= $this->getCategoryAttributeScopeLabel();
|
798 |
+
$this->_placeholders['{{productAttributeGroup}}'] = $this->getProductAttributeGroupLabel();
|
799 |
+
$this->_placeholders['{{categoryAttributeGroup}}'] = $this->getCategoryAttributeGroupLabel();
|
800 |
+
$this->_placeholders['{{beforeSaveParam}}'] = $this->getBeforeSaveParam();
|
801 |
+
$this->_placeholders['{{EntityAttributeSetId}}'] = $this->getEntityAttributeSetId();
|
802 |
+
$this->_placeholders['{{filterMethod}}'] = $this->getFilterMethod();
|
803 |
+
$this->_placeholders['{{multipleSelectConvert}}'] = $this->getMultipleSelectConvert();
|
804 |
+
$this->_placeholders['{{toOptionAddition}}'] = $this->getToOptionAddition();
|
805 |
+
$this->_placeholders['{{multiselectMethods}}'] = $this->getMultiselectMethods();
|
806 |
+
$this->_placeholders['{{nameHtml}}'] = $this->getNameHtml();
|
807 |
+
$this->_placeholders['{{isTree}}'] = (int)$this->getIsTree();
|
808 |
+
$this->_placeholders['{{commentFilterIndexPrefix}}'] = $this->getCommentFilterIndexPrefix();
|
809 |
+
$this->_placeholders['{{entityApiAdditionalSettings}}'] = $this->getApiAdditionalSettings();
|
810 |
+
$this->_placeholders['{{subEntitiesAcl}}'] = $this->getSubEntitiesAcl();
|
811 |
+
$this->_placeholders['{{position}}'] = $this->getPosition();
|
812 |
+
$this->_placeholders['{{entityApiResourcesAlias}}'] = $this->getApiResourcesAlias();
|
813 |
+
$this->_placeholders['{{entityApiResourcesAliasV2}}'] = $this->getApiResourcesAliasV2();
|
814 |
+
$this->_placeholders['{{defaultApiAttributes}}'] = $this->getDefaultApiAttributes();
|
815 |
+
$this->_placeholders['{{filterEntityDates}}'] = $this->getFilterDates();
|
816 |
+
$this->_placeholders['{{filterEntityDates3}}'] = $this->getFilterDates(3);
|
817 |
+
$this->_placeholders['{{allAttributesToCollection}}'] = $this->getAllAttributesToCollection();
|
818 |
+
$this->_placeholders['{{loadStoreId}}'] = $this->getLoadStoreId();
|
819 |
+
$this->_placeholders['{{restCollectionCleanup}}'] = $this->getRestCollectionCleanup();
|
820 |
+
$this->_placeholders['{{restCollectionStoreId}}'] = $this->getRestCollectionStoreId();
|
821 |
+
$this->_placeholders['{{defaultAttributeValues}}'] = $this->getDefaultAttributeValues();
|
822 |
+
$this->_placeholders['{{toOptionArraySelect}}'] = $this->getToOptionArraySelect();
|
823 |
+
$this->_placeholders['{{parentStaticParams}}'] = $this->getParentStaticParams();
|
824 |
+
|
825 |
+
|
826 |
+
$eventObject = new Varien_Object(
|
827 |
+
array(
|
828 |
+
'placeholders' => $this->_placeholders
|
829 |
+
)
|
830 |
+
);
|
831 |
+
Mage::dispatchEvent('umc_entity_placeholdrers', array('event_object'=>$eventObject));
|
832 |
+
$this->_placeholders = $eventObject->getPlaceholders();
|
833 |
+
}
|
834 |
+
if (is_null($param)) {
|
835 |
+
return $this->_placeholders;
|
836 |
+
}
|
837 |
+
if (isset($this->_placeholders[$param])) {
|
838 |
+
return $this->_placeholders[$param];
|
839 |
+
}
|
840 |
+
return '';
|
841 |
+
}
|
842 |
+
|
843 |
+
/**
|
844 |
+
* get placeholders as sibling
|
845 |
+
*
|
846 |
+
* @access public
|
847 |
+
* @param null $param
|
848 |
+
* @return array|mixed|null|string
|
849 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
850 |
+
*/
|
851 |
+
public function getPlaceholdersAsSibling($param = null)
|
852 |
+
{
|
853 |
+
if (is_null($this->_placeholdersAsSibling)) {
|
854 |
+
$this->_placeholdersAsSibling = array();
|
855 |
+
$this->_placeholdersAsSibling['{{sibling_default_config}}'] = $this->getDefaultConfig();
|
856 |
+
$this->_placeholdersAsSibling['{{sibling}}'] = $this->getNameSingular(true);
|
857 |
+
$this->_placeholdersAsSibling['{{Sibling}}'] = ucfirst($this->getNameSingular(true));
|
858 |
+
$this->_placeholdersAsSibling['{{SIBLING}}'] = strtoupper($this->getNameSingular());
|
859 |
+
$this->_placeholdersAsSibling['{{SiblingLabel}}'] = ucfirst($this->getLabelSingular());
|
860 |
+
$this->_placeholdersAsSibling['{{siblingLabel}}'] = strtolower($this->getLabelSingular());
|
861 |
+
$this->_placeholdersAsSibling['{{SiblingsLabel}}'] = ucfirst($this->getLabelPlural());
|
862 |
+
$this->_placeholdersAsSibling['{{siblingsLabel}}'] = $this->getLabelPlural(true);
|
863 |
+
$this->_placeholdersAsSibling['{{siblingCollectionAttributes}}'] = $this->getCollectionAttributes();
|
864 |
+
$this->_placeholdersAsSibling['{{siblingAdminJoin}}'] = $this->getAdminJoin();
|
865 |
+
$this->_placeholdersAsSibling['{{siblingColumnsHeader}}'] = $this->getPrepareColumnsHeader();
|
866 |
+
$this->_placeholdersAsSibling['{{siblingNameAttributeGridEav}}'] = $this->getNameAttributeGridEav();
|
867 |
+
$this->_placeholdersAsSibling['{{siblingNameAttributeCode}}'] = $this->getNameAttributeCode();
|
868 |
+
$this->_placeholdersAsSibling['{{siblingNameAttributeLabel}}'] = $this->getNameAttributeLabel();
|
869 |
+
$this->_placeholdersAsSibling['{{siblings}}'] = strtolower($this->getNamePlural());
|
870 |
+
$this->_placeholdersAsSibling['{{Siblings}}'] = ucfirst($this->getNamePlural(true));
|
871 |
+
$this->_placeholdersAsSibling['{{SiblingNameMagicCode}}'] = $this->getNameAttributeMagicCode();
|
872 |
+
$this->_placeholdersAsSibling['{{SiblingViewRelationLayout}}'] = $this->getRelationLayoutXml();
|
873 |
+
$this->_placeholdersAsSibling['{{siblingListLayout}}'] = $this->getListTemplate();
|
874 |
+
$this->_placeholdersAsSibling['{{siblingViewLayout}}'] = $this->getViewTemplate();
|
875 |
+
$this->_placeholdersAsSibling['{{SiblingListItem}}'] = $this->getHtmlLink();
|
876 |
+
$this->_placeholdersAsSibling['{{siblingNameAttribute}}'] = $this->getNameAttributeCode();
|
877 |
+
$this->_placeholdersAsSibling['{{siblingAdditionalPrepareCollection}}']
|
878 |
+
= $this->getAdditionalPrepareCollection();
|
879 |
+
$this->_placeholdersAsSibling['{{siblingTableAlias}}'] = $this->getEntityTableAlias();
|
880 |
+
$this->_placeholdersAsSibling['{{siblingFilterMethod}}'] = $this->getFilterMethod();
|
881 |
+
$this->_placeholdersAsSibling['{{siblingAllAttributesToCollection}}']
|
882 |
+
= $this->getAllAttributesToCollection();
|
883 |
+
$this->_placeholdersAsSibling['{{siblingLoadStoreId}}'] = $this->getLoadStoreId();
|
884 |
+
$this->_placeholdersAsSibling['{{siblingToOptionArraySelect}}'] = $this->getToOptionArraySelect();
|
885 |
+
$this->_placeholdersAsSibling['{{siblingParentStaticParams}}'] = $this->getParentStaticParams();
|
886 |
+
|
887 |
+
$eventObject = new Varien_Object(
|
888 |
+
array(
|
889 |
+
'placeholders' => $this->_placeholdersAsSibling
|
890 |
+
)
|
891 |
+
);
|
892 |
+
Mage::dispatchEvent(
|
893 |
+
'umc_entity_placeholdrers_as_sibling',
|
894 |
+
array('event_object'=>$eventObject)
|
895 |
+
);
|
896 |
+
$this->_placeholdersAsSibling = $eventObject->getPlaceholders();
|
897 |
+
}
|
898 |
+
if (is_null($param)) {
|
899 |
+
return $this->_placeholdersAsSibling;
|
900 |
+
}
|
901 |
+
if (isset($this->_placeholdersAsSibling[$param])) {
|
902 |
+
return $this->_placeholdersAsSibling[$param];
|
903 |
+
}
|
904 |
+
return '';
|
905 |
+
}
|
906 |
+
|
907 |
+
/**
|
908 |
+
* get default config settings
|
909 |
+
*
|
910 |
+
* @access public
|
911 |
+
* @return string
|
912 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
913 |
+
*/
|
914 |
+
public function getDefaultConfig()
|
915 |
+
{
|
916 |
+
if (!$this->getHasConfigDefaults()) {
|
917 |
+
return '';
|
918 |
+
}
|
919 |
+
$padding3 = $this->getPadding(3);
|
920 |
+
$padding = $this->getPadding();
|
921 |
+
$eol = $this->getEol();
|
922 |
+
|
923 |
+
$text = '<'.$this->getNameSingular().'>'.$eol;
|
924 |
+
if ($this->getCreateFrontend()) {
|
925 |
+
$text.= $padding3.$padding.'<breadcrumbs>1</breadcrumbs>'.$eol;
|
926 |
+
}
|
927 |
+
if ($this->getUrlRewrite() && $this->getUrlPrefix()) {
|
928 |
+
$text.= $padding3.$padding.'<url_prefix>'.$this->getUrlPrefix().'</url_prefix>'.$eol;
|
929 |
+
}
|
930 |
+
if ($this->getUrlRewrite() && $this->getUrlSuffix()) {
|
931 |
+
$text.= $padding3.$padding.'<url_suffix>'.$this->getUrlSuffix().'</url_suffix>'.$eol;
|
932 |
+
}
|
933 |
+
if ($this->getUrlRewrite() && $this->getUrlRewriteList()) {
|
934 |
+
$text.= $padding3.$padding.'<url_rewrite_list>'.$this->getUrlRewriteList().'</url_rewrite_list>'.$eol;
|
935 |
+
}
|
936 |
+
if ($this->getAllowComment()) {
|
937 |
+
$text.= $padding3.$padding.'<allow_comment>1</allow_comment>'.$eol;
|
938 |
+
}
|
939 |
+
if ($this->getRss()) {
|
940 |
+
$text.= $padding3.$padding.'<rss>1</rss>'.$eol;
|
941 |
+
}
|
942 |
+
if ($this->getAddSeo()) {
|
943 |
+
$text.= $padding3.$padding.'<meta_title>'.$this->getLabelPlural().'</meta_title>'.$eol;
|
944 |
+
}
|
945 |
+
if ($this->getIsTree() && $this->getCreateFrontend()) {
|
946 |
+
$text.= $padding3.$padding.'<tree>1</tree>'.$eol;
|
947 |
+
$text.= $padding3.$padding.'<recursion>0</recursion>'.$eol;
|
948 |
+
}
|
949 |
+
$text .= $padding3.'</'.$this->getNameSingular().'>'.$eol;
|
950 |
+
return $text;
|
951 |
+
}
|
952 |
+
|
953 |
+
/**
|
954 |
+
* get xml for add product event
|
955 |
+
*
|
956 |
+
* @access public
|
957 |
+
* @return string
|
958 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
959 |
+
*/
|
960 |
+
public function getAddBlockToProductEvent()
|
961 |
+
{
|
962 |
+
$text = '';
|
963 |
+
if ($this->getLinkProduct()) {
|
964 |
+
$ns = $this->getNamespace(true);
|
965 |
+
$eol = $this->getEol();
|
966 |
+
$text = $this->getPadding(5).'<'.$ns.'_'.$this->getModule()->getLowerModuleName().'_'.
|
967 |
+
$this->getNameSingular(true).'>'.$eol;
|
968 |
+
$text .= $this->getPadding(6).'<type>singleton</type>'.$eol;
|
969 |
+
$text .= $this->getPadding(6).'<class>'.$ns.'_'.$this->getModule()->getLowerModuleName().
|
970 |
+
'/adminhtml_observer</class>'.$eol;
|
971 |
+
$text .= $this->getPadding(6).'<method>add'.ucfirst(strtolower($this->getNameSingular())).
|
972 |
+
'Block</method>'.$eol;
|
973 |
+
$text .= $this->getPadding(5).'</'.$ns.'_'.$this->getModule()->getLowerModuleName().'_'.
|
974 |
+
$this->getNameSingular(true).'>'.$eol;
|
975 |
+
}
|
976 |
+
return $text;
|
977 |
+
}
|
978 |
+
|
979 |
+
/**
|
980 |
+
* get xml for add product save after event
|
981 |
+
*
|
982 |
+
* @access public
|
983 |
+
* @return string
|
984 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
985 |
+
*/
|
986 |
+
public function getProductSaveAfterEvent()
|
987 |
+
{
|
988 |
+
$text = '';
|
989 |
+
if ($this->getLinkProduct()) {
|
990 |
+
$ns = strtolower($this->getModule()->getNamespace());
|
991 |
+
$eol = $this->getEol();
|
992 |
+
$text = $this->getPadding(5).'<'.$ns.'_'.$this->getModule()->getLowerModuleName().'_'.
|
993 |
+
$this->getNameSingular(true).'>'.$eol;
|
994 |
+
$text .= $this->getPadding(6).'<type>singleton</type>'.$eol;
|
995 |
+
$text .= $this->getPadding(6).'<class>'.$ns.'_'.$this->getModule()->getLowerModuleName().
|
996 |
+
'/adminhtml_observer</class>'.$eol;
|
997 |
+
$text .= $this->getPadding(6).'<method>save'.ucfirst(strtolower($this->getNameSingular())).
|
998 |
+
'Data</method>'.$eol;
|
999 |
+
$text .= $this->getPadding(5).'</'.$ns.'_'.$this->getModule()->getLowerModuleName().
|
1000 |
+
'_'.$this->getNameSingular(true).'>'.$eol;
|
1001 |
+
}
|
1002 |
+
return $text;
|
1003 |
+
}
|
1004 |
+
|
1005 |
+
/**
|
1006 |
+
* get xml for add can load ext js
|
1007 |
+
*
|
1008 |
+
* @access public
|
1009 |
+
* @return string
|
1010 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1011 |
+
*/
|
1012 |
+
public function getCanLoadExtJsEvent()
|
1013 |
+
{
|
1014 |
+
$text = '';
|
1015 |
+
if ($this->getLinkProduct() && $this->getIsTree()) {
|
1016 |
+
$eol = $this->getEol();
|
1017 |
+
$ns = strtolower($this->getModule()->getNamespace());
|
1018 |
+
$text = $this->getPadding(5).'<'.$ns.'_'.$this->getModule()->getLowerModuleName().'_'.
|
1019 |
+
$this->getNameSingular(true).'>'.$eol;
|
1020 |
+
$text .= $this->getPadding(6).'<type>singleton</type>'.$eol;
|
1021 |
+
$text .= $this->getPadding(6).'<class>'.$ns.'_'.$this->getModule()->getLowerModuleName().
|
1022 |
+
'/adminhtml_observer</class>'.$eol;
|
1023 |
+
$text .= $this->getPadding(6).'<method>setCanLoadExtJs</method>'.$eol;
|
1024 |
+
$text .= $this->getPadding(5).'</'.$ns.'_'.$this->getModule()->getLowerModuleName().
|
1025 |
+
'_'.$this->getNameSingular(true).'>'.$eol;
|
1026 |
+
}
|
1027 |
+
return $text;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
/**
|
1031 |
+
* get xml for admin menu
|
1032 |
+
*
|
1033 |
+
* @access public
|
1034 |
+
* @param $padding
|
1035 |
+
* @return string
|
1036 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1037 |
+
*/
|
1038 |
+
public function getMenu($padding)
|
1039 |
+
{
|
1040 |
+
$extension = $this->getModule()->getExtensionName(true);
|
1041 |
+
$module = $this->getModule()->getLowerModuleName();
|
1042 |
+
$title = ucwords($this->getLabelSingular());
|
1043 |
+
$entity = strtolower($this->getNameSingular());
|
1044 |
+
$action = $module.'_'.$entity;
|
1045 |
+
$eol = $this->getEol();
|
1046 |
+
|
1047 |
+
$text = $this->getPadding($padding).'<'.$entity.' translate="title" module="'.$extension.'">'.$eol;
|
1048 |
+
$text .= $this->getPadding($padding + 1).'<title>'.$title.'</title>'.$eol;
|
1049 |
+
$text .= $this->getPadding($padding + 1).'<action>adminhtml/'.$action.'</action>'.$eol;
|
1050 |
+
$text .= $this->getPadding($padding + 1).'<sort_order>'.$this->getPosition().'</sort_order>'.$eol;
|
1051 |
+
$text .= $this->getPadding($padding).'</'.$entity.'>'.$eol;
|
1052 |
+
if ($this->getAllowComment()) {
|
1053 |
+
$text .= $this->getPadding($padding).'<'.$entity.
|
1054 |
+
'_comments translate="title" module="'.$extension.'">'.$eol;
|
1055 |
+
$text .= $this->getPadding($padding + 1).'<title>Manage '.$title.' Comments</title>'.$eol;
|
1056 |
+
$text .= $this->getPadding($padding + 1).'<action>adminhtml/'.$action.'_comment</action>'.$eol;
|
1057 |
+
$text .= $this->getPadding($padding + 1).'<sort_order>'.($this->getPosition() + 4).'</sort_order>'.$eol;
|
1058 |
+
$text .= $this->getPadding($padding).'</'.$entity.'_comments>'.$eol;
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
$text .= $this->getTypeInstance()->getAdditionalMenu($padding);
|
1062 |
+
return $text;
|
1063 |
+
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
/**
|
1067 |
+
* get xml for acl
|
1068 |
+
*
|
1069 |
+
* @access public
|
1070 |
+
* @param $padding
|
1071 |
+
* @return string
|
1072 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1073 |
+
*/
|
1074 |
+
public function getMenuAcl($padding)
|
1075 |
+
{
|
1076 |
+
$extension = $this->getModule()->getExtensionName(true);
|
1077 |
+
$title = ucwords($this->getLabelSingular());
|
1078 |
+
$entity = $this->getNameSingular(true);
|
1079 |
+
$eol = $this->getEol();
|
1080 |
+
|
1081 |
+
$text = $this->getPadding($padding).'<'.$entity.' translate="title" module="'.$extension.'">'.$eol;
|
1082 |
+
$text .= $this->getPadding($padding + 1).'<title>'.$title.'</title>'.$eol;
|
1083 |
+
$text .= $this->getPadding($padding + 1).'<sort_order>'.$this->getPosition().'</sort_order>'.$eol;
|
1084 |
+
$text .= $this->getPadding($padding).'</'.$entity.'>'.$eol;
|
1085 |
+
|
1086 |
+
if ($this->getAllowComment()) {
|
1087 |
+
$text .= $this->getPadding($padding).'<'.$entity.
|
1088 |
+
'_comments translate="title" module="'.$extension.'">'.$eol;
|
1089 |
+
$text .= $this->getPadding($padding + 1).'<title>Manage '.$title.' Comments</title>'.$eol;
|
1090 |
+
$text .= $this->getPadding($padding + 1).'<sort_order>'.($this->getPosition() + 5).'</sort_order>'.$eol;
|
1091 |
+
$text .= $this->getPadding($padding).'</'.$entity.'_comments>'.$eol;
|
1092 |
+
}
|
1093 |
+
$text .= $this->getTypeInstance()->getAdditionalMenuAcl($padding);
|
1094 |
+
return $text;
|
1095 |
+
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
/**
|
1099 |
+
* get attributes that need to be added in the admin grid collection
|
1100 |
+
*
|
1101 |
+
* @access public
|
1102 |
+
* @return string
|
1103 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1104 |
+
*/
|
1105 |
+
public function getCollectionAttributes()
|
1106 |
+
{
|
1107 |
+
return $this->getTypeInstance()->getCollectionAttributes();
|
1108 |
+
}
|
1109 |
+
|
1110 |
+
/**
|
1111 |
+
* get join with admin - for the admin grid
|
1112 |
+
*
|
1113 |
+
* @access public
|
1114 |
+
* @return string
|
1115 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1116 |
+
*/
|
1117 |
+
public function getAdminJoin()
|
1118 |
+
{
|
1119 |
+
return $this->getTypeInstance()->getAdminJoin();
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
/**
|
1123 |
+
* code above the prepare columns
|
1124 |
+
*
|
1125 |
+
* @access public
|
1126 |
+
* @return string
|
1127 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1128 |
+
*/
|
1129 |
+
public function getPrepareColumnsHeader()
|
1130 |
+
{
|
1131 |
+
return $this->getTypeInstance()->getPrepareColumnsHeader();
|
1132 |
+
}
|
1133 |
+
|
1134 |
+
/**
|
1135 |
+
* name attribute in grid
|
1136 |
+
*
|
1137 |
+
* @access public
|
1138 |
+
* @return string
|
1139 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1140 |
+
*/
|
1141 |
+
public function getNameAttributeGridEav()
|
1142 |
+
{
|
1143 |
+
return $this->getTypeInstance()->getNameAttributeGridEav();
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
/**
|
1147 |
+
* check if the frontend list block can be created
|
1148 |
+
*
|
1149 |
+
* @access public
|
1150 |
+
* @return bool
|
1151 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1152 |
+
*/
|
1153 |
+
public function getCanCreateListBlock()
|
1154 |
+
{
|
1155 |
+
if ($this->getCreateList()) {
|
1156 |
+
return true;
|
1157 |
+
}
|
1158 |
+
if ($this->getShowOnProduct()) {
|
1159 |
+
return true;
|
1160 |
+
}
|
1161 |
+
if ($this->getShowOnCategory()) {
|
1162 |
+
return true;
|
1163 |
+
}
|
1164 |
+
//check for siblings with frontend view
|
1165 |
+
$related = $this->getRelatedEntities(
|
1166 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1167 |
+
);
|
1168 |
+
foreach ($related as $r) {
|
1169 |
+
if ($r->getCreateView()) {
|
1170 |
+
return true;
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
//check for parents with frontend view
|
1174 |
+
$related = $this->getRelatedEntities(
|
1175 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD
|
1176 |
+
);
|
1177 |
+
foreach ($related as $r) {
|
1178 |
+
if ($r->getCreateView()) {
|
1179 |
+
return true;
|
1180 |
+
}
|
1181 |
+
}
|
1182 |
+
return false;
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
/**
|
1186 |
+
* get ddl text for attributes
|
1187 |
+
*
|
1188 |
+
* @access public
|
1189 |
+
* @return bool
|
1190 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1191 |
+
*/
|
1192 |
+
public function getAttributesDdlSql()
|
1193 |
+
{
|
1194 |
+
$padding = $this->getPadding();
|
1195 |
+
$eol = $this->getEol();
|
1196 |
+
$content = '';
|
1197 |
+
$content .= $this->getParentEntitiesFkAttributes($padding, true);
|
1198 |
+
if ($this->getIsFlat()) {
|
1199 |
+
foreach ($this->getAttributes() as $attribute) {
|
1200 |
+
$content .= $padding.$attribute->getDdlSqlColumn().$eol;
|
1201 |
+
}
|
1202 |
+
}
|
1203 |
+
if ($this->getIsFlat()) {
|
1204 |
+
$simulated = $this->getSimulatedAttributes(null, false);
|
1205 |
+
} elseif ($this->getIsTree()) {
|
1206 |
+
$simulated = $this->getSimulatedAttributes('tree', false);
|
1207 |
+
} else {
|
1208 |
+
$simulated = array();
|
1209 |
+
}
|
1210 |
+
foreach ($simulated as $attr) {
|
1211 |
+
$content .= $padding.$attr->getDdlSqlColumn().$eol;
|
1212 |
+
}
|
1213 |
+
return substr($content, 0, strlen($content) - strlen($eol));
|
1214 |
+
}
|
1215 |
+
|
1216 |
+
/**
|
1217 |
+
* get foreign key columns
|
1218 |
+
*
|
1219 |
+
* @access public
|
1220 |
+
* @param $padding
|
1221 |
+
* @return string
|
1222 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1223 |
+
*/
|
1224 |
+
public function getParentEntitiesFkAttributes($padding)
|
1225 |
+
{
|
1226 |
+
if ($this->getIsEav()) {
|
1227 |
+
return '';
|
1228 |
+
}
|
1229 |
+
$parents = $this->getRelatedEntities(
|
1230 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD
|
1231 |
+
);
|
1232 |
+
$content = '';
|
1233 |
+
foreach ($parents as $parent) {
|
1234 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1235 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1236 |
+
$attr->setCode($parent->getPlaceholders('{{entity}}').'_id');
|
1237 |
+
$attr->setLabel($parent->getPlaceholders('{{EntityLabel}}'). ' ID');
|
1238 |
+
$attr->setType('int');
|
1239 |
+
$content .= $padding.$attr->getDdlSqlColumn()."\n";
|
1240 |
+
}
|
1241 |
+
return $content;
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
/**
|
1245 |
+
* get simulated attributes
|
1246 |
+
*
|
1247 |
+
* @access public
|
1248 |
+
* @param mixed $type
|
1249 |
+
* @param bool $ignoreSettings
|
1250 |
+
* @param array $except
|
1251 |
+
* @return Ultimate_ModuleCreator_Model_Attribute[]
|
1252 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1253 |
+
*/
|
1254 |
+
public function getSimulatedAttributes($type = null, $ignoreSettings = false, $except = array())
|
1255 |
+
{
|
1256 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute[] $attributes */
|
1257 |
+
$attributes = array();
|
1258 |
+
$namespace = $this->getNamespace(true);
|
1259 |
+
if (is_null($type)) {
|
1260 |
+
$types = array('status', 'url_rewrite', 'tree', 'rss', 'seo', 'comment');
|
1261 |
+
$attributes = array();
|
1262 |
+
foreach ($types as $type) {
|
1263 |
+
if (!in_array($type, $except)) {
|
1264 |
+
$attributes = array_merge($attributes, $this->getSimulatedAttributes($type, $ignoreSettings));
|
1265 |
+
}
|
1266 |
+
}
|
1267 |
+
return $attributes;
|
1268 |
+
}
|
1269 |
+
switch ($type) {
|
1270 |
+
case 'status':
|
1271 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1272 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1273 |
+
$attr->setCode('status');
|
1274 |
+
$attr->setLabel('Enabled');
|
1275 |
+
$attr->setType('yesno');
|
1276 |
+
$attr->setDefaultValue('1');
|
1277 |
+
$attributes[] = $attr;
|
1278 |
+
break;
|
1279 |
+
case 'url_rewrite':
|
1280 |
+
if ($this->getUrlRewrite() || $ignoreSettings) {
|
1281 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1282 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1283 |
+
$attr->setCode('url_key');
|
1284 |
+
$attr->setLabel('URL key');
|
1285 |
+
$attr->setType('text');
|
1286 |
+
$module = $this->getModule()->getLowerModuleName();
|
1287 |
+
$entity = $this->getNameSingular(true);
|
1288 |
+
$attr->setForcedSetupBackend($namespace.'_'.$module.'/'.$entity.'_attribute_backend_urlkey');
|
1289 |
+
$attributes[] = $attr;
|
1290 |
+
}
|
1291 |
+
break;
|
1292 |
+
case 'tree' :
|
1293 |
+
if ($this->getIsTree() || $ignoreSettings) {
|
1294 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1295 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1296 |
+
$attr->setCode('parent_id');
|
1297 |
+
$attr->setLabel('Parent id');
|
1298 |
+
$attr->setType('int');
|
1299 |
+
$attributes[] = $attr;
|
1300 |
+
|
1301 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1302 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1303 |
+
$attr->setCode('path');
|
1304 |
+
$attr->setLabel('Path');
|
1305 |
+
$attr->setType('text');
|
1306 |
+
$attr->setIgnoreApi(true);
|
1307 |
+
$attributes[] = $attr;
|
1308 |
+
|
1309 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1310 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1311 |
+
$attr->setCode('position');
|
1312 |
+
$attr->setLabel('Position');
|
1313 |
+
$attr->setType('int');
|
1314 |
+
$attr->setIgnoreApi(true);
|
1315 |
+
$attributes[] = $attr;
|
1316 |
+
|
1317 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1318 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1319 |
+
$attr->setCode('level');
|
1320 |
+
$attr->setLabel('Level');
|
1321 |
+
$attr->setType('int');
|
1322 |
+
$attr->setIgnoreApi(true);
|
1323 |
+
$attributes[] = $attr;
|
1324 |
+
|
1325 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1326 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1327 |
+
$attr->setCode('children_count');
|
1328 |
+
$attr->setLabel('Children count');
|
1329 |
+
$attr->setType('int');
|
1330 |
+
$attr->setIgnoreApi(true);
|
1331 |
+
$attributes[] = $attr;
|
1332 |
+
}
|
1333 |
+
break;
|
1334 |
+
case 'rss':
|
1335 |
+
if ($this->getRss() || $ignoreSettings) {
|
1336 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1337 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1338 |
+
$attr->setCode('in_rss');
|
1339 |
+
$attr->setLabel('In RSS');
|
1340 |
+
$attr->setType('yesno');
|
1341 |
+
$attr->setDefaultValue('1');
|
1342 |
+
$attributes[] = $attr;
|
1343 |
+
}
|
1344 |
+
break;
|
1345 |
+
case 'seo':
|
1346 |
+
if ($this->getAddSeo() || $ignoreSettings) {
|
1347 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1348 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1349 |
+
$attr->setCode('meta_title');
|
1350 |
+
$attr->setLabel('Meta title');
|
1351 |
+
$attr->setType('text');
|
1352 |
+
$attributes[] = $attr;
|
1353 |
+
|
1354 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1355 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1356 |
+
$attr->setCode('meta_keywords');
|
1357 |
+
$attr->setLabel('Meta keywords');
|
1358 |
+
$attr->setType('textarea');
|
1359 |
+
$attributes[] = $attr;
|
1360 |
+
|
1361 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1362 |
+
$attr->setCode('meta_description');
|
1363 |
+
$attr->setLabel('Meta description');
|
1364 |
+
$attr->setType('textarea');
|
1365 |
+
$attributes[] = $attr;
|
1366 |
+
}
|
1367 |
+
break;
|
1368 |
+
case 'comment':
|
1369 |
+
if ($this->getAllowComment() || $ignoreSettings) {
|
1370 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1371 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1372 |
+
$attr->setCode('allow_comment');
|
1373 |
+
$attr->setLabel('Allow Comment');
|
1374 |
+
$attr->setType('dropdown');
|
1375 |
+
$attr->setOptionsSource('custom');
|
1376 |
+
$attr->setOptions(false);
|
1377 |
+
$attr->setEntity($this);
|
1378 |
+
$attr->setDefaultValue('2');
|
1379 |
+
$attr->setForcedDefaultValue('2');
|
1380 |
+
$attr->setForcedSource(
|
1381 |
+
$namespace.'_'.$this->getModule()->getLowerModuleName().
|
1382 |
+
'/adminhtml_source_yesnodefault'
|
1383 |
+
);
|
1384 |
+
$attributes[] = $attr;
|
1385 |
+
}
|
1386 |
+
break;
|
1387 |
+
default:
|
1388 |
+
break;
|
1389 |
+
}
|
1390 |
+
foreach ($attributes as $attribute) {
|
1391 |
+
$attribute->setUserDefined(false);
|
1392 |
+
}
|
1393 |
+
return $attributes;
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
/**
|
1397 |
+
* get layout xml head reference
|
1398 |
+
*
|
1399 |
+
* @access public
|
1400 |
+
* @return string
|
1401 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1402 |
+
*/
|
1403 |
+
public function getReferenceHeadLayout()
|
1404 |
+
{
|
1405 |
+
$eol = $this->getEol();
|
1406 |
+
$content = $this->getPadding(2);
|
1407 |
+
if ($this->getIsTree()) {
|
1408 |
+
$namespace = $this->getNamespace(true);
|
1409 |
+
$module = $this->getModule()->getLowerModuleName();
|
1410 |
+
$entity = $this->getNameSingular(true);
|
1411 |
+
$content .= '<reference name="head">'.$eol;
|
1412 |
+
$content .= $this->getPadding(3).
|
1413 |
+
'<action method="addItem" ifconfig="'.$namespace.'_'.$module.'/'.$entity.
|
1414 |
+
'/tree"><type>skin_js</type><js>js/'.$namespace.'_'.$module.'/tree.js</js></action>'.$eol;
|
1415 |
+
$content .= $this->getPadding(2).'</reference>'.$eol;
|
1416 |
+
$content .= $this->getPadding(2);
|
1417 |
+
}
|
1418 |
+
return $content;
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
/**
|
1422 |
+
* get layout xml for relation to product
|
1423 |
+
*
|
1424 |
+
* @access public
|
1425 |
+
* @return string
|
1426 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1427 |
+
*/
|
1428 |
+
public function getRelationLayoutXml()
|
1429 |
+
{
|
1430 |
+
$eol = $this->getEol();
|
1431 |
+
$content = $this->getPadding(2);
|
1432 |
+
$module = $this->getModule()->getLowerModuleName();
|
1433 |
+
$entityName = $this->getNameSingular(true);
|
1434 |
+
$namespace = $this->getNamespace(true);
|
1435 |
+
if ($this->getIsTree()) {
|
1436 |
+
$content .= $this->getPadding().'<block type="'.$namespace.'_'.$module.'/'.
|
1437 |
+
$entityName.'_children" name="'.$entityName.'_children" template="'.
|
1438 |
+
$namespace.'_'.$module.'/'.$entityName.'/children.phtml" />'.$eol.$this->getPadding(2);
|
1439 |
+
}
|
1440 |
+
if ($this->getShowProducts()) {
|
1441 |
+
$content .= $this->getPadding().'<block type="'.
|
1442 |
+
$namespace.'_'.$module.'/'.$entityName.'_catalog_product_list" name="'.
|
1443 |
+
$entityName.'.info.products" as="'.$entityName.'_products" template="'.
|
1444 |
+
$namespace.'_'.$module.'/'.$entityName.'/catalog/product/list.phtml" />'.
|
1445 |
+
$eol.$this->getPadding(2);
|
1446 |
+
}
|
1447 |
+
if ($this->getShowCategory()) {
|
1448 |
+
$content .= $this->getPadding().'<block type="'.
|
1449 |
+
$namespace.'_'.$module.'/'.$entityName.'_catalog_category_list" name="'.
|
1450 |
+
$entityName.'.info.categories" as="'.$entityName.
|
1451 |
+
'_categories" template="'.$namespace.'_'.$module.'/'.$entityName.
|
1452 |
+
'/catalog/category/list.phtml" />'.$eol.$this->getPadding(2);
|
1453 |
+
}
|
1454 |
+
$children = $this->getRelatedEntities(
|
1455 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_PARENT
|
1456 |
+
);
|
1457 |
+
$siblings = $this->getRelatedEntities(
|
1458 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1459 |
+
);
|
1460 |
+
/** @var Ultimate_ModuleCreator_Model_Entity[] $relatedEntities */
|
1461 |
+
$relatedEntities = array_merge($children, $siblings);
|
1462 |
+
foreach ($relatedEntities as $entity) {
|
1463 |
+
$content .= $this->getPadding().'<block type="'.$namespace.'_'.$module.'/'.
|
1464 |
+
$entityName.'_'.strtolower($entity->getNameSingular()).'_list" name="'.$entityName.
|
1465 |
+
'.'.strtolower($entity->getNameSingular()).'_list" as="'.$entityName.'_'.
|
1466 |
+
strtolower($this->getNamePlural()).'" template="'.$namespace.'_'.$module.'/'.$entityName.'/'.
|
1467 |
+
strtolower($entity->getNameSingular()).'/list.phtml" />'.$eol.$this->getPadding(2);
|
1468 |
+
}
|
1469 |
+
if ($this->getAllowComment()) {
|
1470 |
+
$content .= $this->getPadding().'<block type="'.
|
1471 |
+
$namespace.'_'.$module.'/'.$entityName.'_comment_list" name="'.
|
1472 |
+
$entityName.'.comments_list" as="'.$entityName.'_comment_list" template="'.$namespace.'_'.$module.'/'.
|
1473 |
+
$entityName.'/comment/list.phtml">'.$eol.$this->getPadding(2);
|
1474 |
+
$content .= $this->getPadding(2).
|
1475 |
+
'<block type="'.$namespace.'_'.$module.'/'.$entityName.
|
1476 |
+
'_comment_form" name="comment_form" as="comment_form" template="'.
|
1477 |
+
$namespace.'_'.$module.'/'.$entityName.'/comment/form.phtml" />'.$eol.$this->getPadding(2);
|
1478 |
+
$content .= $this->getPadding().'</block>'.$eol.$this->getPadding(2);
|
1479 |
+
}
|
1480 |
+
return $content;
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
/**
|
1484 |
+
* get html link to entity
|
1485 |
+
*
|
1486 |
+
* @access public
|
1487 |
+
* @return string
|
1488 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1489 |
+
*/
|
1490 |
+
public function getHtmlLink()
|
1491 |
+
{
|
1492 |
+
$eol = $this->getEol();
|
1493 |
+
$entity = $this->getNameSingular(true);
|
1494 |
+
$entityUc = ucfirst($this->getNameSingular());
|
1495 |
+
$nameCode = $this->getNameAttributeMagicCode();
|
1496 |
+
$content = '';
|
1497 |
+
$padd = 3;
|
1498 |
+
if ($this->getCreateView()) {
|
1499 |
+
$padd = 4;
|
1500 |
+
$content .= $this->getPadding(3).'<a href="<?php echo $_'.$entity.'->get'.$entityUc.'Url()?>">'.$eol;
|
1501 |
+
}
|
1502 |
+
$content .= $this->getPadding($padd).'<?php echo $_'.$entity.'->get'.$nameCode.'();?>'.$eol;
|
1503 |
+
if ($this->getCreateView()) {
|
1504 |
+
$content .= $this->getPadding(3).'</a>';
|
1505 |
+
}
|
1506 |
+
$content .= '<br />';
|
1507 |
+
return $content;
|
1508 |
+
}
|
1509 |
+
|
1510 |
+
/**
|
1511 |
+
* get the html for attributes in view page
|
1512 |
+
*
|
1513 |
+
* @access public
|
1514 |
+
* @return string
|
1515 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1516 |
+
*/
|
1517 |
+
public function getViewAttributesHtml()
|
1518 |
+
{
|
1519 |
+
$eol = $this->getEol();
|
1520 |
+
$content = '';
|
1521 |
+
foreach ($this->getAttributes() as $attribute) {
|
1522 |
+
if ($attribute->getFrontend()) {
|
1523 |
+
$content .= $this->getPadding().
|
1524 |
+
'<div class="'.$this->getNameSingular().'-'.$attribute->getCode().'">'.$eol;
|
1525 |
+
$content .= $this->getPadding(2).$attribute->getFrontendHtml().$eol;
|
1526 |
+
$content .= $this->getPadding().'</div>'.$eol;
|
1527 |
+
}
|
1528 |
+
}
|
1529 |
+
return $content;
|
1530 |
+
}
|
1531 |
+
|
1532 |
+
/**
|
1533 |
+
* check if comments should be split by store
|
1534 |
+
*
|
1535 |
+
* @access public
|
1536 |
+
* @return bool
|
1537 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1538 |
+
*/
|
1539 |
+
public function getAllowCommentByStore()
|
1540 |
+
{
|
1541 |
+
return $this->getTypeInstance()->getAllowCommentByStore();
|
1542 |
+
}
|
1543 |
+
|
1544 |
+
/**
|
1545 |
+
* get view widget attributes
|
1546 |
+
*
|
1547 |
+
* @access public
|
1548 |
+
* @return string
|
1549 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1550 |
+
*/
|
1551 |
+
public function getViewWidgetAttributesHtml()
|
1552 |
+
{
|
1553 |
+
$content = '';
|
1554 |
+
$padding = $this->getPadding(3);
|
1555 |
+
$tab = $this->getPadding();
|
1556 |
+
$eol = $this->getEol();
|
1557 |
+
foreach ($this->getAttributes() as $attribute) {
|
1558 |
+
if ($attribute->getWidget()) {
|
1559 |
+
$content .= $padding.'<div class="'.$attribute->getCode().'-widget">'.
|
1560 |
+
$eol.$padding.$tab.$attribute->getFrontendHtml().$padding.'</div>'.$eol;
|
1561 |
+
}
|
1562 |
+
}
|
1563 |
+
return $content;
|
1564 |
+
}
|
1565 |
+
|
1566 |
+
/**
|
1567 |
+
* get the system attributes
|
1568 |
+
*
|
1569 |
+
* @access public
|
1570 |
+
* @return string
|
1571 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1572 |
+
*/
|
1573 |
+
public function getSystemAttributes()
|
1574 |
+
{
|
1575 |
+
$position = 10;
|
1576 |
+
$content = '';
|
1577 |
+
$tab = $this->getPadding();
|
1578 |
+
$eol = $this->getEol();
|
1579 |
+
$padding = str_repeat($tab, 6);
|
1580 |
+
if ($this->getCreateFrontend()) {
|
1581 |
+
$content .= $padding.'<breadcrumbs translate="label">'.$eol;
|
1582 |
+
$content .= $padding.$tab.'<label>Use Breadcrumbs</label>'.$eol;
|
1583 |
+
$content .= $padding.$tab.'<frontend_type>select</frontend_type>'.$eol;
|
1584 |
+
$content .= $padding.$tab.'<source_model>adminhtml/system_config_source_yesno</source_model>'.$eol;
|
1585 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1586 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1587 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1588 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1589 |
+
$content .= $padding.'</breadcrumbs>'.$eol;
|
1590 |
+
$position += 10;
|
1591 |
+
}
|
1592 |
+
if ($this->getUrlRewrite()) {
|
1593 |
+
$content .= $padding.'<url_rewrite_list translate="label comment">'.$eol;
|
1594 |
+
$content .= $padding.$tab.'<label>URL key for list page</label>'.$eol;
|
1595 |
+
$content .= $padding.$tab.'<frontend_type>text</frontend_type>'.$eol;
|
1596 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1597 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1598 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1599 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1600 |
+
$content .= $padding.$tab.'<comment>Leave empty to use default URL module/controller/action</comment>'.$eol;
|
1601 |
+
$content .= $padding.'</url_rewrite_list>'.$eol;
|
1602 |
+
$position += 10;
|
1603 |
+
|
1604 |
+
|
1605 |
+
$content .= $padding.'<url_prefix translate="label comment">'.$eol;
|
1606 |
+
$content .= $padding.$tab.'<label>URL prefix</label>'.$eol;
|
1607 |
+
$content .= $padding.$tab.'<frontend_type>text</frontend_type>'.$eol;
|
1608 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1609 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1610 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1611 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1612 |
+
$content .= $padding.$tab.'<comment>Leave empty for no prefix</comment>'.$eol;
|
1613 |
+
$content .= $padding.'</url_prefix>'.$eol;
|
1614 |
+
$position += 10;
|
1615 |
+
|
1616 |
+
$content .= $padding.'<url_suffix translate="label comment">'.$eol;
|
1617 |
+
$content .= $padding.$tab.'<label>Url suffix</label>'.$eol;
|
1618 |
+
$content .= $padding.$tab.'<frontend_type>text</frontend_type>'.$eol;
|
1619 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1620 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1621 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1622 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1623 |
+
$content .= $padding.$tab.'<comment>What goes after the dot. Leave empty for no suffix.</comment>'.$eol;
|
1624 |
+
$content .= $padding.'</url_suffix>'.$eol;
|
1625 |
+
$position += 10;
|
1626 |
+
}
|
1627 |
+
if ($this->getAllowComment()) {
|
1628 |
+
$content .= $padding.'<allow_comment translate="label">'.$eol;
|
1629 |
+
$content .= $padding.$tab.'<label>Allow comments</label>'.$eol;
|
1630 |
+
$content .= $padding.$tab.'<frontend_type>select</frontend_type>'.$eol;
|
1631 |
+
$content .= $padding.$tab.'<source_model>adminhtml/system_config_source_yesno</source_model>'.$eol;
|
1632 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1633 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1634 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1635 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1636 |
+
$content .= $padding.'</allow_comment>'.$eol;
|
1637 |
+
$position += 10;
|
1638 |
+
|
1639 |
+
$content .= $padding.'<allow_guest_comment translate="label">'.$eol;
|
1640 |
+
$content .= $padding.$tab.'<label>Allow guest comments</label>'.$eol;
|
1641 |
+
$content .= $padding.$tab.'<frontend_type>select</frontend_type>'.$eol;
|
1642 |
+
$content .= $padding.$tab.'<source_model>adminhtml/system_config_source_yesno</source_model>'.$eol;
|
1643 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1644 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1645 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1646 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1647 |
+
$content .= $padding.$tab.'<depends>'.$eol;
|
1648 |
+
$content .= $padding.$tab.$tab.'<allow_comment>1</allow_comment>'.$eol;
|
1649 |
+
$content .= $padding.$tab.'</depends>'.$eol;
|
1650 |
+
$content .= $padding.'</allow_guest_comment>'.$eol;
|
1651 |
+
$position += 10;
|
1652 |
+
}
|
1653 |
+
if ($this->getRss()) {
|
1654 |
+
$content .= $padding.'<rss translate="label">'.$eol;
|
1655 |
+
$content .= $padding.$tab.'<label>Enable rss</label>'.$eol;
|
1656 |
+
$content .= $padding.$tab.'<frontend_type>select</frontend_type>'.$eol;
|
1657 |
+
$content .= $padding.$tab.'<source_model>adminhtml/system_config_source_yesno</source_model>'.$eol;
|
1658 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1659 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1660 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1661 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1662 |
+
$content .= $padding.'</rss>'.$eol;
|
1663 |
+
$position += 10;
|
1664 |
+
}
|
1665 |
+
if ($this->getIsTree() && $this->getCreateList()) {
|
1666 |
+
$content .= $padding.'<tree translate="label">'.$eol;
|
1667 |
+
$content .= $padding.$tab.'<label>Display as tree</label>'.$eol;
|
1668 |
+
$content .= $padding.$tab.'<frontend_type>select</frontend_type>'.$eol;
|
1669 |
+
$content .= $padding.$tab.'<source_model>adminhtml/system_config_source_yesno</source_model>'.$eol;
|
1670 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1671 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1672 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1673 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1674 |
+
$content .= $padding.'</tree>'.$eol;
|
1675 |
+
$position += 10;
|
1676 |
+
}
|
1677 |
+
if ($this->getIsTree() && ($this->getCreateList() || $this->getWidget())) {
|
1678 |
+
$content .= $padding.'<recursion translate="label">'.$eol;
|
1679 |
+
$content .= $padding.$tab.'<label>Recursion level</label>'.$eol;
|
1680 |
+
$content .= $padding.$tab.'<frontend_type>text</frontend_type>'.$eol;
|
1681 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1682 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1683 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1684 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1685 |
+
$content .= $padding.'</recursion>'.$eol;
|
1686 |
+
$position += 10;
|
1687 |
+
}
|
1688 |
+
|
1689 |
+
if ($this->getAddSeo() && $this->getCreateList()) {
|
1690 |
+
$content .= $padding.'<meta_title translate="label">'.$eol;
|
1691 |
+
$content .= $padding.$tab.'<label>Meta title for '.
|
1692 |
+
strtolower($this->getLabelPlural()).' list page</label>'.$eol;
|
1693 |
+
$content .= $padding.$tab.'<frontend_type>text</frontend_type>'.$eol;
|
1694 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1695 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1696 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1697 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1698 |
+
$content .= $padding.'</meta_title>'.$eol;
|
1699 |
+
$position += 10;
|
1700 |
+
|
1701 |
+
$content .= $padding.'<meta_description translate="label">'.$eol;
|
1702 |
+
$content .= $padding.$tab.'<label>Meta description for '.
|
1703 |
+
strtolower($this->getLabelPlural()).' list page</label>'.$eol;
|
1704 |
+
$content .= $padding.$tab.'<frontend_type>textarea</frontend_type>'.$eol;
|
1705 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1706 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1707 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1708 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1709 |
+
$content .= $padding.'</meta_description>'.$eol;
|
1710 |
+
$position += 10;
|
1711 |
+
|
1712 |
+
$content .= $padding.'<meta_keywords translate="label">'.$eol;
|
1713 |
+
$content .= $padding.$tab.'<label>Meta keywords for '.
|
1714 |
+
strtolower($this->getLabelPlural()).' list page</label>'.$eol;
|
1715 |
+
$content .= $padding.$tab.'<frontend_type>textarea</frontend_type>'.$eol;
|
1716 |
+
$content .= $padding.$tab.'<sort_order>'.$position.'</sort_order>'.$eol;
|
1717 |
+
$content .= $padding.$tab.'<show_in_default>1</show_in_default>'.$eol;
|
1718 |
+
$content .= $padding.$tab.'<show_in_website>1</show_in_website>'.$eol;
|
1719 |
+
$content .= $padding.$tab.'<show_in_store>1</show_in_store>'.$eol;
|
1720 |
+
$content .= $padding.'</meta_keywords>'.$eol;
|
1721 |
+
}
|
1722 |
+
return substr($content, 0, strlen($content) - strlen($eol));
|
1723 |
+
}
|
1724 |
+
|
1725 |
+
/**
|
1726 |
+
* get additional api xml
|
1727 |
+
*
|
1728 |
+
* @access public
|
1729 |
+
* @return string
|
1730 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1731 |
+
*/
|
1732 |
+
public function getApiAdditional()
|
1733 |
+
{
|
1734 |
+
$content = $this->getApiTree();
|
1735 |
+
$content .= $this->getTypeInstance()->getApiAdditional();
|
1736 |
+
$content .= $this->getApiRelations();
|
1737 |
+
return $content;
|
1738 |
+
}
|
1739 |
+
|
1740 |
+
/**
|
1741 |
+
* get additional api xml for tree entities
|
1742 |
+
*
|
1743 |
+
* @access public
|
1744 |
+
* @return string
|
1745 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1746 |
+
*/
|
1747 |
+
public function getApiTree()
|
1748 |
+
{
|
1749 |
+
$content = '';
|
1750 |
+
$padding = $this->getPadding();
|
1751 |
+
$prefix = str_repeat($padding, 5);
|
1752 |
+
$eol = $this->getEol();
|
1753 |
+
$extension = $this->getModule()->getExtensionName(true);
|
1754 |
+
if ($this->getIsTree()) {
|
1755 |
+
$module = $this->getModule()->getLowerModuleName();
|
1756 |
+
$entity = $this->getNameSingular(true);
|
1757 |
+
$entityLabel = strtolower($this->getLabelSingular());
|
1758 |
+
$entitiesLabel = strtolower($this->getLabelPlural());
|
1759 |
+
$content = $prefix.'<level translate="title" module="'.$extension.'">'.$eol;
|
1760 |
+
$content .= $prefix.$padding.'<title>Retrieve one level of '.$entitiesLabel.'</title>'.$eol;
|
1761 |
+
$content .= $prefix.$padding.'<acl>'.$module.'/'.$entity.'/info</acl>'.$eol;
|
1762 |
+
$content .= $prefix.'</level>'.$eol;
|
1763 |
+
$content .= $prefix.'<move translate="title" module="'.$extension.'">'.$eol;
|
1764 |
+
$content .= $prefix.$padding.'<title>Move '.$entityLabel.' in tree</title>'.$eol;
|
1765 |
+
$content .= $prefix.$padding.'<acl>'.$module.'/'.$entity.'/move</acl>'.$eol;
|
1766 |
+
$content .= $prefix.'</move>'.$eol;
|
1767 |
+
}
|
1768 |
+
return $content;
|
1769 |
+
}
|
1770 |
+
|
1771 |
+
/**
|
1772 |
+
* get api relations for a section
|
1773 |
+
*
|
1774 |
+
* @access public
|
1775 |
+
* @param $relatedCode
|
1776 |
+
* @param $relatedLabel
|
1777 |
+
* @return string
|
1778 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1779 |
+
*/
|
1780 |
+
public function getApiRelationsSection($relatedCode, $relatedLabel)
|
1781 |
+
{
|
1782 |
+
$eol = $this->getEol();
|
1783 |
+
$padding = $this->getPadding();
|
1784 |
+
$prefix = $this->getPadding(5);
|
1785 |
+
$module = $this->getModule()->getLowerModuleName();
|
1786 |
+
$entity = $this->getNameSingular(true);
|
1787 |
+
$entityLabelUc = ucfirst($this->getLabelSingular());
|
1788 |
+
$entityLabel = strtolower($this->getLabelSingular());
|
1789 |
+
$extension = $this->getModule()->getExtensionName(true);
|
1790 |
+
|
1791 |
+
$string = '';
|
1792 |
+
$string .= $prefix. '<assign'.$relatedCode.' translate="title" module="'.$extension.'">'.$eol;
|
1793 |
+
$string .= $prefix.$padding. '<title>Assign '.$relatedLabel.' to '.$entityLabelUc.'</title>'.$eol;
|
1794 |
+
$string .= $prefix.$padding. '<acl>'.$module.'/'.$entity.'/update</acl>'.$eol;
|
1795 |
+
$string .= $prefix. '</assign'.$relatedCode.'>'.$eol;
|
1796 |
+
|
1797 |
+
$string .= $prefix. '<unassign'.$relatedCode.' translate="title" module="'.$extension.'">'.$eol;
|
1798 |
+
$string .= $prefix.$padding. '<title>Remove '.$relatedLabel.' from '.$entityLabel.'</title>'.$eol;
|
1799 |
+
$string .= $prefix.$padding. '<acl>'.$module.'/'.$entity.'/update</acl>'.$eol;
|
1800 |
+
$string .= $prefix. '</unassign'.$relatedCode.'>'.$eol;
|
1801 |
+
return $string;
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
/**
|
1805 |
+
* get API xml for entity relations
|
1806 |
+
*
|
1807 |
+
* @access public
|
1808 |
+
* @return string
|
1809 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1810 |
+
*/
|
1811 |
+
public function getApiRelations()
|
1812 |
+
{
|
1813 |
+
$string = '';
|
1814 |
+
if ($this->getLinkProduct()) {
|
1815 |
+
$string .= $this->getApiRelationsSection('Product', 'product');
|
1816 |
+
}
|
1817 |
+
if ($this->getLinkCategory()) {
|
1818 |
+
$string .= $this->getApiRelationsSection('Category', 'category');
|
1819 |
+
}
|
1820 |
+
$siblings = $this->getRelatedEntities(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING);
|
1821 |
+
foreach ($siblings as $sibling) {
|
1822 |
+
$siblingNameUc = ucfirst($sibling->getNameSingular());
|
1823 |
+
$siblingLabel = strtolower($sibling->getLabelSingular());
|
1824 |
+
$string .= $this->getApiRelationsSection($siblingNameUc, $siblingLabel);
|
1825 |
+
}
|
1826 |
+
$string .= $this->getPadding(4);
|
1827 |
+
return $string;
|
1828 |
+
}
|
1829 |
+
|
1830 |
+
/**
|
1831 |
+
* get API faults for a section
|
1832 |
+
*
|
1833 |
+
* @access public
|
1834 |
+
* @param $relatedCode
|
1835 |
+
* @param $relatedLabel
|
1836 |
+
* @param $code
|
1837 |
+
* @return string
|
1838 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1839 |
+
*/
|
1840 |
+
public function getApiFaultsSection($relatedCode, $relatedLabel, $code)
|
1841 |
+
{
|
1842 |
+
$padding = $this->getPadding();
|
1843 |
+
$prefix = str_repeat($padding, 5);
|
1844 |
+
$eol = $this->getEol();
|
1845 |
+
$string = '';
|
1846 |
+
$string .= $prefix.'<'.$relatedCode.'_not_exists>'.$eol;
|
1847 |
+
$string .= $prefix.$padding.'<code>'.$code.'</code>'.$eol;
|
1848 |
+
$string .= $prefix.$padding.'<message>'.$relatedLabel.' does not exist.</message>'.$eol;
|
1849 |
+
$string .= $prefix.'</'.$relatedCode.'_not_exists>'.$eol;
|
1850 |
+
|
1851 |
+
return $string;
|
1852 |
+
}
|
1853 |
+
|
1854 |
+
/**
|
1855 |
+
* get list of faults for API
|
1856 |
+
*
|
1857 |
+
* @access public
|
1858 |
+
* @return string
|
1859 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1860 |
+
*/
|
1861 |
+
public function getApiFaults()
|
1862 |
+
{
|
1863 |
+
$string = '';
|
1864 |
+
$padding = $this->getPadding();
|
1865 |
+
$prefix = str_repeat($padding, 5);
|
1866 |
+
$eol = $this->getEol();
|
1867 |
+
$code = 105;
|
1868 |
+
$entity = $this->getNameSingular(true);
|
1869 |
+
$entityLabelUc = ucfirst($this->getLabelSingular());
|
1870 |
+
if ($this->getIsTree()) {
|
1871 |
+
$string .= $prefix.'<not_moved>'.$eol;
|
1872 |
+
$string .= $prefix.$padding.'<code>'.$code.'</code>'.$eol;
|
1873 |
+
$string .= $prefix.$padding.'<message>'.
|
1874 |
+
$entityLabelUc.' not moved. Details in error message.</message>'.$eol;
|
1875 |
+
$string .= $prefix.'</not_moved>'.$eol;
|
1876 |
+
$code++;
|
1877 |
+
}
|
1878 |
+
if ($this->getLinkProduct()) {
|
1879 |
+
$string .= $this->getApiFaultsSection('product', 'Product', $code);
|
1880 |
+
$code++;
|
1881 |
+
}
|
1882 |
+
if ($this->getLinkCategory()) {
|
1883 |
+
$string .= $this->getApiFaultsSection('category', 'Category', $code);
|
1884 |
+
$code++;
|
1885 |
+
}
|
1886 |
+
$siblings = $this->getRelatedEntities(
|
1887 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1888 |
+
);
|
1889 |
+
foreach ($siblings as $sibling) {
|
1890 |
+
$siblingName = $sibling->getNameSingular(true);
|
1891 |
+
$siblingLabelUc = ucfirst($sibling->getLabelSingular());
|
1892 |
+
|
1893 |
+
$string .= $this->getApiFaultsSection($entity.'_'.$siblingName, $siblingLabelUc, $code);
|
1894 |
+
$code++;
|
1895 |
+
}
|
1896 |
+
$string .= $this->getTypeInstance()->getApiFaults();
|
1897 |
+
$string .= str_repeat($padding, 4);
|
1898 |
+
return $string;
|
1899 |
+
}
|
1900 |
+
|
1901 |
+
/**
|
1902 |
+
* get additional api acl
|
1903 |
+
*
|
1904 |
+
* @access public
|
1905 |
+
* @return string
|
1906 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1907 |
+
*/
|
1908 |
+
public function getAdditionalApiAcl()
|
1909 |
+
{
|
1910 |
+
$content = '';
|
1911 |
+
$padding = $this->getPadding();
|
1912 |
+
$prefix = str_repeat($padding, 6);
|
1913 |
+
$eol = $this->getEol();
|
1914 |
+
$extension = $this->getModule()->getExtensionName(true);
|
1915 |
+
if ($this->getIsTree()) {
|
1916 |
+
$content .= $prefix.'<move translate="title" module="'.$extension.'">'.$eol;
|
1917 |
+
$content .= $prefix.$padding.'<title>Move</title>'.$eol;
|
1918 |
+
$content .= $prefix.'</move>'.$eol;
|
1919 |
+
}
|
1920 |
+
$content .= str_repeat($padding, 5);
|
1921 |
+
return $content;
|
1922 |
+
}
|
1923 |
+
|
1924 |
+
/**
|
1925 |
+
* get attributes format for wsdl
|
1926 |
+
*
|
1927 |
+
* @access public
|
1928 |
+
* @param bool $wsi
|
1929 |
+
* @param bool $forAdd
|
1930 |
+
* @return string
|
1931 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1932 |
+
*/
|
1933 |
+
public function getWsdlAttributes($wsi = false, $forAdd = false)
|
1934 |
+
{
|
1935 |
+
$parents = $this->getRelatedEntities(
|
1936 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD
|
1937 |
+
);
|
1938 |
+
$tab = $this->getPadding();
|
1939 |
+
$padding = str_repeat($tab, 5);
|
1940 |
+
$eol = $this->getEol();
|
1941 |
+
$content = '';
|
1942 |
+
foreach ($parents as $parent) {
|
1943 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
1944 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
1945 |
+
$attr->setCode($parent->getNameSingular().'_id');
|
1946 |
+
$attr->setLabel($parent->getLabelSingular());
|
1947 |
+
$attr->setType('int');
|
1948 |
+
$content .= $padding.$attr->getWsdlFormat($wsi).$eol;
|
1949 |
+
}
|
1950 |
+
foreach ($this->getAttributes() as $attribute) {
|
1951 |
+
$content .= $padding.$attribute->getWsdlFormat($wsi).$eol;
|
1952 |
+
}
|
1953 |
+
$simulated = $this->getSimulatedAttributes(null, false);
|
1954 |
+
foreach ($simulated as $attr) {
|
1955 |
+
if (!$forAdd || !$attr->getIgnoreApi()) {
|
1956 |
+
$content .= $padding.$attr->getWsdlFormat($wsi).$eol;
|
1957 |
+
}
|
1958 |
+
}
|
1959 |
+
$content .= $this->getTypeInstance()->getWsdlAttributes($wsi);
|
1960 |
+
return $content;
|
1961 |
+
}
|
1962 |
+
|
1963 |
+
/**
|
1964 |
+
* get attributes format for wsi
|
1965 |
+
*
|
1966 |
+
* @access public
|
1967 |
+
* @param bool $forAdd
|
1968 |
+
* @return string
|
1969 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1970 |
+
*/
|
1971 |
+
public function getWsiAttributes($forAdd = false)
|
1972 |
+
{
|
1973 |
+
return $this->getWsdlAttributes(true, $forAdd);
|
1974 |
+
}
|
1975 |
+
|
1976 |
+
/**
|
1977 |
+
* get wsdl relation type for a section
|
1978 |
+
*
|
1979 |
+
* @param $relatedCode
|
1980 |
+
* @param $relatedId
|
1981 |
+
* @param bool $wsi
|
1982 |
+
* @return string
|
1983 |
+
*/
|
1984 |
+
public function getWsdlRelationTypesSection($relatedCode, $relatedId, $wsi = false)
|
1985 |
+
{
|
1986 |
+
$content = '';
|
1987 |
+
$tab = $this->getPadding();
|
1988 |
+
$padding = str_repeat($tab, 3);
|
1989 |
+
$mainTag = ($wsi) ? 'xsd:complexType':'complexType';
|
1990 |
+
$subtag = ($wsi) ? 'xsd:sequence' : 'all';
|
1991 |
+
$element = ($wsi) ? 'xsd:element' : 'element';
|
1992 |
+
$eol = $this->getEol();
|
1993 |
+
$module = $this->getModule()->getLowerModuleName();
|
1994 |
+
$entity = $this->getNameSingular(true);
|
1995 |
+
$entityUc = ucfirst($this->getNameSingular());
|
1996 |
+
|
1997 |
+
$content .= $padding.'<'.$mainTag .' name="'.$module.$entityUc.'Assign'.$relatedCode.'Entity">'.$eol;
|
1998 |
+
$content .= $padding.$tab.'<'.$subtag.'>'.$eol;
|
1999 |
+
$content .= $padding.$tab.'<'.$element.' name="'.$entity.'Id" type="xsd:string"'.
|
2000 |
+
((!$wsi)?' minOccurs="1"':'').' />'.$eol;
|
2001 |
+
$content .= $padding.$tab.'<'.$element.' name="'.$relatedId.'Id" type="xsd:string"'.
|
2002 |
+
((!$wsi)?' minOccurs="1"':'').' />'.$eol;
|
2003 |
+
$content .= $padding.$tab.'<'.$element.' name="position" type="xsd:string"'.
|
2004 |
+
((!$wsi)?' minOccurs="0"':'').' />'.$eol;
|
2005 |
+
$content .= $padding.$tab.'</'.$subtag.'>'.$eol;
|
2006 |
+
$content .= $padding.'</'.$mainTag.'>'.$eol;
|
2007 |
+
|
2008 |
+
$content .= $padding.'<'.$mainTag .' name="'.$module.$entityUc.'Unassign'.$relatedCode.'Entity">'.$eol;
|
2009 |
+
$content .= $padding.$tab.'<'.$subtag.'>'.$eol;
|
2010 |
+
$content .= $padding.$tab.'<'.$element.' name="'.
|
2011 |
+
$entity.'Id" type="xsd:string"'.((!$wsi)?' minOccurs="1"':'').' />'.$eol;
|
2012 |
+
$content .= $padding.$tab.'<'.$element.' name="'.
|
2013 |
+
$relatedId.'Id" type="xsd:string"'.((!$wsi)?' minOccurs="1"':'').' />'.$eol;
|
2014 |
+
$content .= $padding.$tab.'</'.$subtag.'>'.$eol;
|
2015 |
+
$content .= $padding.'</'.$mainTag.'>'.$eol;
|
2016 |
+
|
2017 |
+
return $content;
|
2018 |
+
}
|
2019 |
+
|
2020 |
+
/**
|
2021 |
+
* get entity WSDL relation types
|
2022 |
+
*
|
2023 |
+
* @access public
|
2024 |
+
* @param bool $wsi
|
2025 |
+
* @return string
|
2026 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2027 |
+
*/
|
2028 |
+
public function getWsdlRelationTypes($wsi = false)
|
2029 |
+
{
|
2030 |
+
$content = '';
|
2031 |
+
$tab = $this->getPadding();
|
2032 |
+
$padding = str_repeat($tab, 3);
|
2033 |
+
$mainTag = ($wsi) ? 'xsd:complexType':'complexType';
|
2034 |
+
$subtag = ($wsi) ? 'xsd:sequence' : 'all';
|
2035 |
+
$element = ($wsi) ? 'xsd:element' : 'element';
|
2036 |
+
$eol = $this->getEol();
|
2037 |
+
$module = $this->getModule()->getLowerModuleName();
|
2038 |
+
$entity = $this->getNameSingular(true);
|
2039 |
+
$entityUc = ucfirst($this->getNameSingular());
|
2040 |
+
if ($this->getIsTree()) {
|
2041 |
+
$content .= $padding.'<'.$mainTag .' name="'.$module.$entityUc.'MoveEntity">'.$eol;
|
2042 |
+
$content .= $padding.$tab.'<'.$subtag.'>'.$eol;
|
2043 |
+
$content .= $padding.$tab.'<'.$element.
|
2044 |
+
' name="'.$entity.'_id" type="xsd:string"'.((!$wsi)?' minOccurs="1"':'').' />'.$eol;
|
2045 |
+
$content .= $padding.$tab.'<'.$element.
|
2046 |
+
' name="parent_id" type="xsd:string"'.((!$wsi)?' minOccurs="1"':'').' />'.$eol;
|
2047 |
+
$content .= $padding.$tab.'<'.$element.
|
2048 |
+
' name="after_id" type="xsd:string"'.((!$wsi)?' minOccurs="0"':'').' />'.$eol;
|
2049 |
+
$content .= $padding.$tab.'</'.$subtag.'>'.$eol;
|
2050 |
+
$content .= $padding.'</'.$mainTag.'>'.$eol;
|
2051 |
+
}
|
2052 |
+
if ($this->getLinkProduct()) {
|
2053 |
+
$content .= $this->getWsdlRelationTypesSection('Product', 'product', $wsi);
|
2054 |
+
}
|
2055 |
+
if ($this->getLinkCategory()) {
|
2056 |
+
$content .= $this->getWsdlRelationTypesSection('Category', 'category', $wsi);
|
2057 |
+
}
|
2058 |
+
$siblings = $this->getRelatedEntities(
|
2059 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
2060 |
+
);
|
2061 |
+
foreach ($siblings as $sibling) {
|
2062 |
+
$siblingName = $sibling->getNameSingular(true);
|
2063 |
+
$siblingNameUc = ucfirst($sibling->getNameSingular());
|
2064 |
+
$content .= $this->getWsdlRelationTypesSection($siblingNameUc, $siblingName, $wsi);
|
2065 |
+
|
2066 |
+
}
|
2067 |
+
$content .= $tab.$tab;
|
2068 |
+
return $content;
|
2069 |
+
}
|
2070 |
+
|
2071 |
+
/**
|
2072 |
+
* get entity WSI relation types
|
2073 |
+
*
|
2074 |
+
* @access public
|
2075 |
+
* @return string
|
2076 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2077 |
+
*/
|
2078 |
+
public function getWsiRelationTypes()
|
2079 |
+
{
|
2080 |
+
return $this->getWsdlRelationTypes(true);
|
2081 |
+
}
|
2082 |
+
|
2083 |
+
/**
|
2084 |
+
* get wsdl port type relations for a section
|
2085 |
+
*
|
2086 |
+
* @access public
|
2087 |
+
* @param $relatedLabel
|
2088 |
+
* @param $relatedText
|
2089 |
+
* @param $wsi
|
2090 |
+
* @return string
|
2091 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2092 |
+
*/
|
2093 |
+
public function getWsdlPortTypeRelationSection($relatedLabel, $relatedText, $wsi)
|
2094 |
+
{
|
2095 |
+
$content = '';
|
2096 |
+
$tab = $this->getPadding();
|
2097 |
+
$padding = $tab.$tab;
|
2098 |
+
$eol = $this->getEol();
|
2099 |
+
$module = $this->getModule()->getLowerModuleName();
|
2100 |
+
$entityUc = ucfirst($this->getNameSingular());
|
2101 |
+
$label = strtolower($this->getLabelSingular());
|
2102 |
+
$tagPrefix = ($wsi) ? 'wsdl:':'';
|
2103 |
+
|
2104 |
+
$content .= $padding.'<'.$tagPrefix.'operation name="'.$module.$entityUc.'Assign'.$relatedLabel.'">'.$eol;
|
2105 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'documentation>Assign '.
|
2106 |
+
$relatedText.' to '.$label.'</'.$tagPrefix.'documentation>'.$eol;
|
2107 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'input message="typens:'.
|
2108 |
+
$module.$entityUc.'Assign'.$relatedLabel.'Request" />'.$eol;
|
2109 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'output message="typens:'.
|
2110 |
+
$module.$entityUc.'Assign'.$relatedLabel.'Response" />'.$eol;
|
2111 |
+
$content .= $padding.'</'.$tagPrefix.'operation>'.$eol;
|
2112 |
+
$content .= $padding.'<'.$tagPrefix.'operation name="'.$module.$entityUc.'Unassign'.$relatedLabel.'">'.$eol;
|
2113 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'documentation>Remove '.
|
2114 |
+
$relatedText.' from '.$label.'</'.$tagPrefix.'documentation>'.$eol;
|
2115 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'input message="typens:'.
|
2116 |
+
$module.$entityUc.'Unassign'.$relatedLabel.'Request" />'.$eol;
|
2117 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'output message="typens:'.
|
2118 |
+
$module.$entityUc.'Unassign'.$relatedLabel.'Response" />'.$eol;
|
2119 |
+
$content .= $padding.'</'.$tagPrefix.'operation>'.$eol;
|
2120 |
+
|
2121 |
+
return $content;
|
2122 |
+
}
|
2123 |
+
|
2124 |
+
/**
|
2125 |
+
* get entity WSDL port type for relations
|
2126 |
+
*
|
2127 |
+
* @access public
|
2128 |
+
* @param bool $wsi
|
2129 |
+
* @return string
|
2130 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2131 |
+
*/
|
2132 |
+
public function getWsdlPortTypeRelation($wsi = false)
|
2133 |
+
{
|
2134 |
+
$content = '';
|
2135 |
+
$tab = $this->getPadding();
|
2136 |
+
$padding = $tab.$tab;
|
2137 |
+
$eol = $this->getEol();
|
2138 |
+
$module = $this->getModule()->getLowerModuleName();
|
2139 |
+
$entity = $this->getNameSingular(true);
|
2140 |
+
$entityUc = ucfirst($entity);
|
2141 |
+
$label = strtolower($this->getLabelSingular());
|
2142 |
+
|
2143 |
+
$tagPrefix = ($wsi) ? 'wsdl:':'';
|
2144 |
+
|
2145 |
+
if ($this->getIsTree()) {
|
2146 |
+
$content .= $padding.'<'.$tagPrefix.'operation name="'.$module.$entityUc.'Move">'.$eol;
|
2147 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'documentation>Move '.$label.
|
2148 |
+
' in tree</'.$tagPrefix.'documentation>'.$eol;
|
2149 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'input message="typens:'.$module.$entityUc.'MoveRequest" />'.$eol;
|
2150 |
+
$content .= $padding.$tab.'<'.$tagPrefix.'output message="typens:'.
|
2151 |
+
$module.$entityUc.'MoveResponse" />'.$eol;
|
2152 |
+
$content .= $padding.'</'.$tagPrefix.'operation>'.$eol;
|
2153 |
+
|
2154 |
+
}
|
2155 |
+
|
2156 |
+
if ($this->getLinkProduct()) {
|
2157 |
+
$content .= $this->getWsdlPortTypeRelationSection('Product', 'product', $wsi);
|
2158 |
+
}
|
2159 |
+
|
2160 |
+
if ($this->getLinkCategory()) {
|
2161 |
+
$content .= $this->getWsdlPortTypeRelationSection('Category', 'category', $wsi);
|
2162 |
+
}
|
2163 |
+
$siblings = $this->getRelatedEntities(
|
2164 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
2165 |
+
);
|
2166 |
+
foreach ($siblings as $sibling) {
|
2167 |
+
$siblingNameUc = ucfirst($sibling->getNameSingular());
|
2168 |
+
$siblingLabel = strtolower($sibling->getLabelSingular());
|
2169 |
+
|
2170 |
+
$content .= $this->getWsdlPortTypeRelationSection($siblingNameUc, $siblingLabel, $wsi);
|
2171 |
+
|
2172 |
+
}
|
2173 |
+
$content .= $tab;
|
2174 |
+
return $content;
|
2175 |
+
}
|
2176 |
+
|
2177 |
+
/**
|
2178 |
+
* get entity WSI port type for relations
|
2179 |
+
*
|
2180 |
+
* @access public
|
2181 |
+
* @return string
|
2182 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2183 |
+
*/
|
2184 |
+
public function getWsiPortTypeRelation()
|
2185 |
+
{
|
2186 |
+
return $this->getWsdlPortTypeRelation(true);
|
2187 |
+
}
|
2188 |
+
|
2189 |
+
/**
|
2190 |
+
* get wsld relation binding for a section
|
2191 |
+
*
|
2192 |
+
* @access public
|
2193 |
+
* @param $sectionName
|
2194 |
+
* @return string
|
2195 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2196 |
+
*/
|
2197 |
+
public function getWsdlRelationBindingSection($sectionName)
|
2198 |
+
{
|
2199 |
+
$content = '';
|
2200 |
+
$tab = $this->getPadding();
|
2201 |
+
$doubleTab = $tab.$tab;
|
2202 |
+
$padding = $doubleTab;
|
2203 |
+
$eol = $this->getEol();
|
2204 |
+
$module = $this->getModule()->getLowerModuleName();
|
2205 |
+
$entity = $this->getNameSingular(true);
|
2206 |
+
$entityUc = ucfirst($entity);
|
2207 |
+
|
2208 |
+
$content .= $padding.'<operation name="'.$module.$entityUc.$sectionName.'">'.$eol;
|
2209 |
+
$content .= $padding.$tab.'<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />'.$eol;
|
2210 |
+
$content .= $padding.$tab.'<input>'.$eol;
|
2211 |
+
$content .= $padding.$doubleTab.
|
2212 |
+
'<soap:body namespace="urn:{{var wsdl.name}}"'.
|
2213 |
+
' use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />'.
|
2214 |
+
$eol;
|
2215 |
+
$content .= $padding.$tab.'</input>'.$eol;
|
2216 |
+
$content .= $padding.$tab.'<output>'.$eol;
|
2217 |
+
$content .= $padding.$doubleTab.
|
2218 |
+
'<soap:body namespace="urn:{{var wsdl.name}}"'.
|
2219 |
+
' use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />'.
|
2220 |
+
$eol;
|
2221 |
+
$content .= $padding.$tab.'</output>'.$eol;
|
2222 |
+
$content .= $padding.'</operation>'.$eol;
|
2223 |
+
return $content;
|
2224 |
+
}
|
2225 |
+
|
2226 |
+
/**
|
2227 |
+
* get WSDL relation binding
|
2228 |
+
*
|
2229 |
+
* @access public
|
2230 |
+
* @return string
|
2231 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2232 |
+
*/
|
2233 |
+
public function getWsdlRelationBinding()
|
2234 |
+
{
|
2235 |
+
$content = '';
|
2236 |
+
if ($this->getIsTree()) {
|
2237 |
+
$content .= $this->getWsdlRelationBindingSection('Move');
|
2238 |
+
}
|
2239 |
+
if ($this->getLinkProduct()) {
|
2240 |
+
$content .= $this->getWsdlRelationBindingSection('AssignProduct');
|
2241 |
+
$content .= $this->getWsdlRelationBindingSection('UnassignProduct');
|
2242 |
+
}
|
2243 |
+
if ($this->getLinkCategory()) {
|
2244 |
+
$content .= $this->getWsdlRelationBindingSection('AssignCategory');
|
2245 |
+
$content .= $this->getWsdlRelationBindingSection('UnassignCategory');
|
2246 |
+
}
|
2247 |
+
|
2248 |
+
$siblings = $this->getRelatedEntities(
|
2249 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
2250 |
+
);
|
2251 |
+
foreach ($siblings as $sibling) {
|
2252 |
+
$siblingName = $sibling->getNameSingular(true);
|
2253 |
+
$siblingNameUc = ucfirst($siblingName);
|
2254 |
+
$content .= $this->getWsdlRelationBindingSection('Assign'.$siblingNameUc);
|
2255 |
+
$content .= $this->getWsdlRelationBindingSection('Unassign'.$siblingNameUc);
|
2256 |
+
}
|
2257 |
+
$content .= $this->getPadding();
|
2258 |
+
return $content;
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
/**
|
2262 |
+
* get wsld relation binding for a section
|
2263 |
+
*
|
2264 |
+
* @access public
|
2265 |
+
* @param $sectionName
|
2266 |
+
* @return string
|
2267 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2268 |
+
*/
|
2269 |
+
public function getWsiRelationBindingSection($sectionName)
|
2270 |
+
{
|
2271 |
+
$content = '';
|
2272 |
+
$tab = $this->getPadding();
|
2273 |
+
$doubleTab = $tab.$tab;
|
2274 |
+
$padding = $doubleTab;
|
2275 |
+
$eol = $this->getEol();
|
2276 |
+
$module = $this->getModule()->getLowerModuleName();
|
2277 |
+
$entity = $this->getNameSingular(true);
|
2278 |
+
$entityUc = ucfirst($entity);
|
2279 |
+
|
2280 |
+
$content .= $padding.'<wsdl:operation name="'.$module.$entityUc.$sectionName.'">'.$eol;
|
2281 |
+
$content .= $padding.$tab.'<soap:operation soapAction="" />'.$eol;
|
2282 |
+
$content .= $padding.$tab.'<wsdl:input>'.$eol;
|
2283 |
+
$content .= $padding.$doubleTab.'<soap:body use="literal" />'.$eol;
|
2284 |
+
$content .= $padding.$tab.'</wsdl:input>'.$eol;
|
2285 |
+
$content .= $padding.$tab.'<wsdl:output>'.$eol;
|
2286 |
+
$content .= $padding.$doubleTab.'<soap:body use="literal" />'.$eol;
|
2287 |
+
$content .= $padding.$tab.'</wsdl:output>'.$eol;
|
2288 |
+
$content .= $padding.'</wsdl:operation>'.$eol;
|
2289 |
+
return $content;
|
2290 |
+
}
|
2291 |
+
|
2292 |
+
/**
|
2293 |
+
* get WSI relation binding
|
2294 |
+
*
|
2295 |
+
* @access public
|
2296 |
+
* @return string
|
2297 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2298 |
+
*/
|
2299 |
+
public function getWsiRelationBinding()
|
2300 |
+
{
|
2301 |
+
$content = '';
|
2302 |
+
if ($this->getIsTree()) {
|
2303 |
+
$content .= $this->getWsiRelationBindingSection('Move');
|
2304 |
+
}
|
2305 |
+
if ($this->getLinkProduct()) {
|
2306 |
+
$content .= $this->getWsiRelationBindingSection('AssignProduct');
|
2307 |
+
$content .= $this->getWsiRelationBindingSection('UnassignProduct');
|
2308 |
+
}
|
2309 |
+
if ($this->getLinkCategory()) {
|
2310 |
+
$content .= $this->getWsiRelationBindingSection('AssignCategory');
|
2311 |
+
$content .= $this->getWsiRelationBindingSection('UnassignCategory');
|
2312 |
+
}
|
2313 |
+
|
2314 |
+
$siblings = $this->getRelatedEntities(
|
2315 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
2316 |
+
);
|
2317 |
+
foreach ($siblings as $sibling) {
|
2318 |
+
$siblingName = $sibling->getNameSingular(true);
|
2319 |
+
$siblingNameUc = ucfirst($siblingName);
|
2320 |
+
|
2321 |
+
$content .= $this->getWsiRelationBindingSection('Assign'.$siblingNameUc);
|
2322 |
+
$content .= $this->getWsiRelationBindingSection('Unassign'.$siblingNameUc);
|
2323 |
+
}
|
2324 |
+
$content .= $this->getPadding();
|
2325 |
+
return $content;
|
2326 |
+
}
|
2327 |
+
|
2328 |
+
/**
|
2329 |
+
* get wsi relation param types for a section
|
2330 |
+
*
|
2331 |
+
* @access public
|
2332 |
+
* @param $sectionName
|
2333 |
+
* @param $sectionParam
|
2334 |
+
* @return string
|
2335 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2336 |
+
*/
|
2337 |
+
public function getWsiRelationParamTypesSection($sectionName, $sectionParam)
|
2338 |
+
{
|
2339 |
+
$content = '';
|
2340 |
+
$tab = $this->getPadding();
|
2341 |
+
$padding = $this->getPadding(3);
|
2342 |
+
$eol = $this->getEol();
|
2343 |
+
$module = $this->getModule()->getLowerModuleName();
|
2344 |
+
$entity = $this->getNameSingular(true);
|
2345 |
+
$entityUc = ucfirst($entity);
|
2346 |
+
$content .= $padding.'<xsd:element name="'.$module.$entityUc.'Assign'.$sectionName.'RequestParam">'.$eol;
|
2347 |
+
$content .= $padding.$tab.'<xsd:complexType>'.$eol;
|
2348 |
+
$content .= $padding.str_repeat($tab, 2).'<xsd:sequence>'.$eol;
|
2349 |
+
$content .= $padding.str_repeat($tab, 3).
|
2350 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />'.$eol;
|
2351 |
+
$content .= $padding.str_repeat($tab, 3).
|
2352 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="'.$entity.'Id" type="xsd:string" />'.$eol;
|
2353 |
+
$content .= $padding.str_repeat($tab, 3).
|
2354 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="'.$sectionParam.'Id" type="xsd:string" />'.$eol;
|
2355 |
+
$content .= $padding.str_repeat($tab, 3).
|
2356 |
+
'<xsd:element minOccurs="0" maxOccurs="1" name="position" type="xsd:string" />'.$eol;
|
2357 |
+
$content .= $padding.str_repeat($tab, 2).'</xsd:sequence>'.$eol;
|
2358 |
+
$content .= $padding.$tab.'</xsd:complexType>'.$eol;
|
2359 |
+
$content .= $padding.'</xsd:element>'.$eol;
|
2360 |
+
|
2361 |
+
$content .= $padding.'<xsd:element name="'.$module.$entityUc.'Assign'.$sectionName.'ResponseParam">'.$eol;
|
2362 |
+
$content .= $padding.$tab.'<xsd:complexType>'.$eol;
|
2363 |
+
$content .= $padding.str_repeat($tab, 2).'<xsd:sequence>'.$eol;
|
2364 |
+
$content .= $padding.str_repeat($tab, 3).
|
2365 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />'.$eol;
|
2366 |
+
$content .= $padding.str_repeat($tab, 2).'</xsd:sequence>'.$eol;
|
2367 |
+
$content .= $padding.$tab.'</xsd:complexType>'.$eol;
|
2368 |
+
$content .= $padding.'</xsd:element>'.$eol;
|
2369 |
+
|
2370 |
+
$content .= $padding.'<xsd:element name="'.$module.$entityUc.'Unassign'.$sectionName.'RequestParam">'.$eol;
|
2371 |
+
$content .= $padding.$tab.'<xsd:complexType>'.$eol;
|
2372 |
+
$content .= $padding.str_repeat($tab, 2).'<xsd:sequence>'.$eol;
|
2373 |
+
$content .= $padding.str_repeat($tab, 3).
|
2374 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />'.$eol;
|
2375 |
+
$content .= $padding.str_repeat($tab, 3).
|
2376 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="'.$entity.'Id" type="xsd:string" />'.$eol;
|
2377 |
+
$content .= $padding.str_repeat($tab, 3).
|
2378 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="'.$sectionParam.'Id" type="xsd:string" />'.$eol;
|
2379 |
+
$content .= $padding.str_repeat($tab, 2).'</xsd:sequence>'.$eol;
|
2380 |
+
$content .= $padding.$tab.'</xsd:complexType>'.$eol;
|
2381 |
+
$content .= $padding.'</xsd:element>'.$eol;
|
2382 |
+
|
2383 |
+
$content .= $padding.'<xsd:element name="'.$module.$entityUc.'Unassign'.$sectionName.'ResponseParam">'.$eol;
|
2384 |
+
$content .= $padding.$tab.'<xsd:complexType>'.$eol;
|
2385 |
+
$content .= $padding.str_repeat($tab, 2).'<xsd:sequence>'.$eol;
|
2386 |
+
$content .= $padding.str_repeat($tab, 3).
|
2387 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />'.$eol;
|
2388 |
+
$content .= $padding.str_repeat($tab, 2).'</xsd:sequence>'.$eol;
|
2389 |
+
$content .= $padding.$tab.'</xsd:complexType>'.$eol;
|
2390 |
+
$content .= $padding.'</xsd:element>'.$eol;
|
2391 |
+
|
2392 |
+
return $content;
|
2393 |
+
}
|
2394 |
+
|
2395 |
+
/**
|
2396 |
+
* get entity WSI relation param types
|
2397 |
+
*
|
2398 |
+
* @access public
|
2399 |
+
* @return string
|
2400 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2401 |
+
*/
|
2402 |
+
public function getWsiRelationParamTypes()
|
2403 |
+
{
|
2404 |
+
$content = '';
|
2405 |
+
$tab = $this->getPadding();
|
2406 |
+
$padding = str_repeat($tab, 3);
|
2407 |
+
$eol = $this->getEol();
|
2408 |
+
$module = $this->getModule()->getLowerModuleName();
|
2409 |
+
$entity = $this->getNameSingular(true);
|
2410 |
+
$entityUc = ucfirst($entity);
|
2411 |
+
|
2412 |
+
if ($this->getIsTree()) {
|
2413 |
+
$content .= $padding.'<xsd:element name="'.$module.$entityUc.'MoveRequestParam">'.$eol;
|
2414 |
+
$content .= $padding.$tab.'<xsd:complexType>'.$eol;
|
2415 |
+
$content .= $padding.str_repeat($tab, 2).'<xsd:sequence>'.$eol;
|
2416 |
+
$content .= $padding.str_repeat($tab, 3).
|
2417 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="session_id" type="xsd:string" />'.$eol;
|
2418 |
+
$content .= $padding.str_repeat($tab, 3).
|
2419 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="'.$entity.'Id" type="xsd:string" />'.$eol;
|
2420 |
+
$content .= $padding.str_repeat($tab, 3).
|
2421 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="parentId" type="xsd:string" />'.$eol;
|
2422 |
+
$content .= $padding.str_repeat($tab, 3).
|
2423 |
+
'<xsd:element minOccurs="0" maxOccurs="1" name="afterId" type="xsd:string" />'.$eol;
|
2424 |
+
$content .= $padding.str_repeat($tab, 2).'</xsd:sequence>'.$eol;
|
2425 |
+
$content .= $padding.$tab.'</xsd:complexType>'.$eol;
|
2426 |
+
$content .= $padding.'</xsd:element>'.$eol;
|
2427 |
+
|
2428 |
+
$content .= $padding.'<xsd:element name="'.$module.$entityUc.'AssignProductResponseParam">'.$eol;
|
2429 |
+
$content .= $padding.$tab.'<xsd:complexType>'.$eol;
|
2430 |
+
$content .= $padding.str_repeat($tab, 2).'<xsd:sequence>'.$eol;
|
2431 |
+
$content .= $padding.str_repeat($tab, 3).
|
2432 |
+
'<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:boolean" />'.$eol;
|
2433 |
+
$content .= $padding.str_repeat($tab, 2).'</xsd:sequence>'.$eol;
|
2434 |
+
$content .= $padding.$tab.'</xsd:complexType>'.$eol;
|
2435 |
+
$content .= $padding.'</xsd:element>'.$eol;
|
2436 |
+
}
|
2437 |
+
|
2438 |
+
if ($this->getLinkProduct()) {
|
2439 |
+
$content .= $this->getWsiRelationParamTypesSection('Product', 'product');
|
2440 |
+
}
|
2441 |
+
|
2442 |
+
if ($this->getLinkCategory()) {
|
2443 |
+
$content .= $this->getWsiRelationParamTypesSection('Category', 'category');
|
2444 |
+
}
|
2445 |
+
|
2446 |
+
$siblings = $this->getRelatedEntities(
|
2447 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
2448 |
+
);
|
2449 |
+
foreach ($siblings as $sibling) {
|
2450 |
+
$siblingName = $sibling->getNameSingular(true);
|
2451 |
+
$siblingNameUc = ucfirst($siblingName);
|
2452 |
+
$content .= $this->getWsiRelationParamTypesSection($siblingNameUc, $siblingName);
|
2453 |
+
}
|
2454 |
+
$content .= $tab.$tab;
|
2455 |
+
return $content;
|
2456 |
+
}
|
2457 |
+
|
2458 |
+
/**
|
2459 |
+
* get wsi relation messaged for a section
|
2460 |
+
*
|
2461 |
+
* @param $sectionName
|
2462 |
+
* @return string
|
2463 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2464 |
+
*/
|
2465 |
+
public function getWsiRelationMessagesSection($sectionName)
|
2466 |
+
{
|
2467 |
+
$content = '';
|
2468 |
+
$padding = $this->getPadding();
|
2469 |
+
$tab = $padding;
|
2470 |
+
$eol = $this->getEol();
|
2471 |
+
$module = $this->getModule()->getLowerModuleName();
|
2472 |
+
$entity = $this->getNameSingular(true);
|
2473 |
+
$entityUc = ucfirst($entity);
|
2474 |
+
|
2475 |
+
$content .= $padding.'<wsdl:message name="'.$module.$entityUc.$sectionName.'Request">'.$eol;
|
2476 |
+
$content .= $padding.$tab.'<wsdl:part name="parameters" element="typens:'.
|
2477 |
+
$module.$entityUc.$sectionName.'RequestParam" />'.$eol;
|
2478 |
+
$content .= $padding.'</wsdl:message>'.$eol;
|
2479 |
+
$content .= $padding.'<wsdl:message name="'.$module.$entityUc.$sectionName.'Response">'.$eol;
|
2480 |
+
$content .= $padding.$tab.'<wsdl:part name="parameters" element="typens:'.
|
2481 |
+
$module.$entityUc.$sectionName.'ResponseParam" />'.$eol;
|
2482 |
+
$content .= $padding.'</wsdl:message>'.$eol;
|
2483 |
+
|
2484 |
+
return $content;
|
2485 |
+
}
|
2486 |
+
|
2487 |
+
/**
|
2488 |
+
* get entity WSI relation messages
|
2489 |
+
*
|
2490 |
+
* @access public
|
2491 |
+
* @return string
|
2492 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2493 |
+
*/
|
2494 |
+
public function getWsiRelationMessages()
|
2495 |
+
{
|
2496 |
+
$content = '';
|
2497 |
+
if ($this->getIsTree()) {
|
2498 |
+
$content .= $this->getWsiRelationMessagesSection('Move');
|
2499 |
+
}
|
2500 |
+
|
2501 |
+
if ($this->getLinkProduct()) {
|
2502 |
+
$content .= $this->getWsiRelationMessagesSection('AssignProduct');
|
2503 |
+
$content .= $this->getWsiRelationMessagesSection('UnassignProduct');
|
2504 |
+
}
|
2505 |
+
|
2506 |
+
if ($this->getLinkCategory()) {
|
2507 |
+
$content .= $this->getWsiRelationMessagesSection('AssignCategory');
|
2508 |
+
$content .= $this->getWsiRelationMessagesSection('UnassignCategory');
|
2509 |
+
}
|
2510 |
+
$siblings = $this->getRelatedEntities(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING);
|
2511 |
+
foreach ($siblings as $sibling) {
|
2512 |
+
$siblingName = $sibling->getNameSingular(true);
|
2513 |
+
$siblingNameUc = ucfirst($siblingName);
|
2514 |
+
|
2515 |
+
$content .= $this->getWsiRelationMessagesSection('Assign'.$siblingNameUc);
|
2516 |
+
$content .= $this->getWsiRelationMessagesSection('Unassign'.$siblingNameUc);
|
2517 |
+
}
|
2518 |
+
return $content;
|
2519 |
+
}
|
2520 |
+
|
2521 |
+
/**
|
2522 |
+
* get wsdl messages for a section
|
2523 |
+
*
|
2524 |
+
* @param $sectionName
|
2525 |
+
* @param $sectionParam
|
2526 |
+
* @return string
|
2527 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2528 |
+
*/
|
2529 |
+
public function getWsdlMessagesSection($sectionName, $sectionParam)
|
2530 |
+
{
|
2531 |
+
$content = '';
|
2532 |
+
$tab = $this->getPadding();
|
2533 |
+
$padding = $tab.$tab;
|
2534 |
+
$eol = $this->getEol();
|
2535 |
+
$module = $this->getModule()->getLowerModuleName();
|
2536 |
+
$entity = $this->getNameSingular(true);
|
2537 |
+
$entityUc = ucfirst($entity);
|
2538 |
+
|
2539 |
+
$content .= $padding.'<message name="'.$module.$entityUc.'Assign'.$sectionName.'Request">'.$eol;
|
2540 |
+
$content .= $padding.$tab.'<part name="sessionId" type="xsd:string" />'.$eol;
|
2541 |
+
$content .= $padding.$tab.'<part name="'.$entity.'_id" type="xsd:string" />'.$eol;
|
2542 |
+
$content .= $padding.$tab.'<part name="'.$sectionParam.'_id" type="xsd:string" />'.$eol;
|
2543 |
+
$content .= $padding.$tab.'<part name="position" type="xsd:string" />'.$eol;
|
2544 |
+
$content .= $padding.'</message>'.$eol;
|
2545 |
+
$content .= $padding.'<message name="'.$module.$entityUc.'Assign'.$sectionName.'Response">'.$eol;
|
2546 |
+
$content .= $padding.$tab.'<part name="result" type="xsd:boolean" />'.$eol;
|
2547 |
+
$content .= $padding.'</message>'.$eol;
|
2548 |
+
$content .= $padding.'<message name="'.$module.$entityUc.'Unassign'.$sectionName.'Request">'.$eol;
|
2549 |
+
$content .= $padding.$tab.'<part name="session_id" type="xsd:string" />'.$eol;
|
2550 |
+
$content .= $padding.$tab.'<part name="'.$entity.'_id" type="xsd:string" />'.$eol;
|
2551 |
+
$content .= $padding.$tab.'<part name="'.$sectionParam.'_id" type="xsd:string" />'.$eol;
|
2552 |
+
$content .= $padding.'</message>'.$eol;
|
2553 |
+
$content .= $padding.'<message name="'.$module.$entityUc.'Unassign'.$sectionName.'Response">'.$eol;
|
2554 |
+
$content .= $padding.$tab.'<part name="result" type="xsd:boolean" />'.$eol;
|
2555 |
+
$content .= $padding.'</message>'.$eol;
|
2556 |
+
|
2557 |
+
return $content;
|
2558 |
+
}
|
2559 |
+
|
2560 |
+
/**
|
2561 |
+
* get entity WSDL messages for relations
|
2562 |
+
*
|
2563 |
+
* @access public
|
2564 |
+
* @return string
|
2565 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2566 |
+
*/
|
2567 |
+
public function getWsdlMessages()
|
2568 |
+
{
|
2569 |
+
$content = '';
|
2570 |
+
$tab = $this->getPadding();
|
2571 |
+
$padding = $tab.$tab;
|
2572 |
+
$eol = $this->getEol();
|
2573 |
+
$module = $this->getModule()->getLowerModuleName();
|
2574 |
+
$entity = $this->getNameSingular(true);
|
2575 |
+
$entityUc = ucfirst($entity);
|
2576 |
+
|
2577 |
+
if ($this->getIsTree()) {
|
2578 |
+
$content .= $padding.'<message name="'.$module.$entityUc.'MoveRequest">'.$eol;
|
2579 |
+
$content .= $padding.$tab.'<part name="session_id" type="xsd:string" />'.$eol;
|
2580 |
+
$content .= $padding.$tab.'<part name="'.$entity.'_id" type="xsd:string" />'.$eol;
|
2581 |
+
$content .= $padding.$tab.'<part name="parent_id" type="xsd:string" />'.$eol;
|
2582 |
+
$content .= $padding.$tab.'<part name="after_id" type="xsd:string" />'.$eol;
|
2583 |
+
$content .= $padding.'</message>'.$eol;
|
2584 |
+
|
2585 |
+
$content .= $padding.'<message name="'.$module.$entityUc.'MoveResponse">'.$eol;
|
2586 |
+
$content .= $padding.$tab.'<part name="id" type="xsd:boolean"/>'.$eol;
|
2587 |
+
$content .= $padding.'</message>'.$eol;
|
2588 |
+
}
|
2589 |
+
if ($this->getLinkProduct()) {
|
2590 |
+
$content .= $this->getWsdlMessagesSection('Product', 'product');
|
2591 |
+
}
|
2592 |
+
|
2593 |
+
if ($this->getLinkCategory()) {
|
2594 |
+
$content .= $this->getWsdlMessagesSection('Category', 'category');
|
2595 |
+
}
|
2596 |
+
|
2597 |
+
$siblings = $this->getRelatedEntities(
|
2598 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
2599 |
+
);
|
2600 |
+
foreach ($siblings as $sibling) {
|
2601 |
+
$siblingName = $sibling->getNameSingular(true);
|
2602 |
+
$siblingNameUc = ucfirst($siblingName);
|
2603 |
+
|
2604 |
+
$content .= $this->getWsdlMessagesSection($siblingNameUc, $siblingName);
|
2605 |
+
}
|
2606 |
+
$content .= $tab;
|
2607 |
+
return $content;
|
2608 |
+
}
|
2609 |
+
/**
|
2610 |
+
* get foreign keys for sql (Ddl)
|
2611 |
+
*
|
2612 |
+
* @access public
|
2613 |
+
* @return string
|
2614 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2615 |
+
*/
|
2616 |
+
public function getParentEntitiesFksDdl()
|
2617 |
+
{
|
2618 |
+
$padding = $this->getPadding();
|
2619 |
+
$eol = $this->getEol();
|
2620 |
+
$parents = $this->getRelatedEntities(
|
2621 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD
|
2622 |
+
);
|
2623 |
+
$content = '';
|
2624 |
+
|
2625 |
+
$module = $this->getModule()->getLowerModuleName();
|
2626 |
+
$namespace = $this->getNamespace(true);
|
2627 |
+
foreach ($parents as $parent) {
|
2628 |
+
$parentName = $parent->getNameSingular(true);
|
2629 |
+
$content .= $eol.$padding."->addIndex($"."this->getIdxName('".
|
2630 |
+
$namespace.'_'.$module.'/'.$parentName."', array('".$parentName."_id')), array('".
|
2631 |
+
$parentName."_id'))";
|
2632 |
+
}
|
2633 |
+
return $content;
|
2634 |
+
}
|
2635 |
+
|
2636 |
+
/**
|
2637 |
+
* get selected menu path
|
2638 |
+
*
|
2639 |
+
* @access public
|
2640 |
+
* @param string $suffix
|
2641 |
+
* @return string
|
2642 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2643 |
+
*/
|
2644 |
+
public function getSelectedMenuPath($suffix = '')
|
2645 |
+
{
|
2646 |
+
$path = $this->getModule()->getMenuParent();
|
2647 |
+
if (!empty($path)) {
|
2648 |
+
$path .= '/';
|
2649 |
+
}
|
2650 |
+
$path .= $this->getModule()->getExtensionName(true).'/';
|
2651 |
+
$path .= $this->getNameSingular(true);
|
2652 |
+
|
2653 |
+
return $path . $suffix;
|
2654 |
+
}
|
2655 |
+
|
2656 |
+
/**
|
2657 |
+
* get attributes content for setup
|
2658 |
+
*
|
2659 |
+
* @access public
|
2660 |
+
* @return string
|
2661 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2662 |
+
*/
|
2663 |
+
public function getAttributesSetup()
|
2664 |
+
{
|
2665 |
+
return $this->getTypeInstance()->getAttributesSetup();
|
2666 |
+
}
|
2667 |
+
|
2668 |
+
/**
|
2669 |
+
* get parent class for the entity resource model
|
2670 |
+
*
|
2671 |
+
* @access public
|
2672 |
+
* @return string
|
2673 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2674 |
+
*/
|
2675 |
+
public function getResourceModelParent()
|
2676 |
+
{
|
2677 |
+
return $this->getTypeInstance()->getResourceModelParent();
|
2678 |
+
}
|
2679 |
+
|
2680 |
+
/**
|
2681 |
+
* get parent class for the entity resource model
|
2682 |
+
*
|
2683 |
+
* @access public
|
2684 |
+
* @return string
|
2685 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2686 |
+
*/
|
2687 |
+
public function getResourceCollectionModelParent()
|
2688 |
+
{
|
2689 |
+
return $this->getTypeInstance()->getResourceCollectionModelParent();
|
2690 |
+
}
|
2691 |
+
|
2692 |
+
/**
|
2693 |
+
* get related entities relations table
|
2694 |
+
*
|
2695 |
+
* @access public
|
2696 |
+
* @return string
|
2697 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2698 |
+
*/
|
2699 |
+
public function getResourceRelationsTables()
|
2700 |
+
{
|
2701 |
+
return $this->getTypeInstance()->getResourceRelationsTables();
|
2702 |
+
}
|
2703 |
+
|
2704 |
+
/**
|
2705 |
+
* get related entities relations table declaration
|
2706 |
+
*
|
2707 |
+
* @access public
|
2708 |
+
* @return string
|
2709 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2710 |
+
*/
|
2711 |
+
public function getResourceRelationsTablesDeclare()
|
2712 |
+
{
|
2713 |
+
return $this->getTypeInstance()->getResourceRelationsTablesDeclare();
|
2714 |
+
}
|
2715 |
+
|
2716 |
+
/**
|
2717 |
+
* get admin layout content for index page
|
2718 |
+
*
|
2719 |
+
* @access public
|
2720 |
+
* @return string
|
2721 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2722 |
+
*/
|
2723 |
+
public function getAdminIndexLayoutContent()
|
2724 |
+
{
|
2725 |
+
return $this->getTypeInstance()->getAdminIndexLayoutContent();
|
2726 |
+
}
|
2727 |
+
|
2728 |
+
/**
|
2729 |
+
* get the parent model class
|
2730 |
+
*
|
2731 |
+
* @access public
|
2732 |
+
* @return mixed
|
2733 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2734 |
+
*/
|
2735 |
+
public function getEntityParentModel()
|
2736 |
+
{
|
2737 |
+
return $this->getTypeInstance()->getEntityParentModel();
|
2738 |
+
}
|
2739 |
+
|
2740 |
+
/**
|
2741 |
+
* get entity table alias
|
2742 |
+
*
|
2743 |
+
* @access public
|
2744 |
+
* @return mixed
|
2745 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2746 |
+
*/
|
2747 |
+
public function getEntityTableAlias()
|
2748 |
+
{
|
2749 |
+
return $this->getTypeInstance()->getEntityTableAlias();
|
2750 |
+
}
|
2751 |
+
|
2752 |
+
/**
|
2753 |
+
* get additional prepare collection
|
2754 |
+
*
|
2755 |
+
* @access public
|
2756 |
+
* @return mixed
|
2757 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2758 |
+
*/
|
2759 |
+
public function getAdditionalPrepareCollection()
|
2760 |
+
{
|
2761 |
+
return $this->getTypeInstance()->getAdditionalPrepareCollection();
|
2762 |
+
}
|
2763 |
+
|
2764 |
+
/**
|
2765 |
+
* additional layout block for left section
|
2766 |
+
*
|
2767 |
+
* @access public
|
2768 |
+
* @return mixed
|
2769 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2770 |
+
*/
|
2771 |
+
public function getEditLayoutLeft()
|
2772 |
+
{
|
2773 |
+
return $this->getTypeInstance()->getEditLayoutLeft();
|
2774 |
+
}
|
2775 |
+
|
2776 |
+
/**
|
2777 |
+
* additional layout block edit
|
2778 |
+
*
|
2779 |
+
* @access public
|
2780 |
+
* @return mixed
|
2781 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2782 |
+
*/
|
2783 |
+
public function getEditLayoutAdditional()
|
2784 |
+
{
|
2785 |
+
return $this->getTypeInstance()->getEditLayoutAdditional();
|
2786 |
+
}
|
2787 |
+
|
2788 |
+
/**
|
2789 |
+
* get the label for product attribute scope
|
2790 |
+
*
|
2791 |
+
* @access public
|
2792 |
+
* @return string
|
2793 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2794 |
+
*/
|
2795 |
+
public function getProductAttributeScopeLabel()
|
2796 |
+
{
|
2797 |
+
return $this->_getScopeLabel($this->getProductAttributeScope());
|
2798 |
+
}
|
2799 |
+
|
2800 |
+
/**
|
2801 |
+
* get the label for category attribute scope
|
2802 |
+
*
|
2803 |
+
* @access public
|
2804 |
+
* @return string
|
2805 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2806 |
+
*/
|
2807 |
+
public function getCategoryAttributeScopeLabel()
|
2808 |
+
{
|
2809 |
+
return $this->_getScopeLabel($this->getCategoryAttributeScope());
|
2810 |
+
}
|
2811 |
+
|
2812 |
+
/**
|
2813 |
+
* get scope label for install scripts
|
2814 |
+
*
|
2815 |
+
* @param $value
|
2816 |
+
* @return string
|
2817 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2818 |
+
*/
|
2819 |
+
protected function _getScopeLabel($value)
|
2820 |
+
{
|
2821 |
+
$values = array(
|
2822 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>
|
2823 |
+
'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE',
|
2824 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>
|
2825 |
+
'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE',
|
2826 |
+
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>
|
2827 |
+
'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL'
|
2828 |
+
);
|
2829 |
+
if (!isset($values[$value])) {
|
2830 |
+
$value = Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL;
|
2831 |
+
}
|
2832 |
+
return $values[$value];
|
2833 |
+
}
|
2834 |
+
|
2835 |
+
/**
|
2836 |
+
* check if the entity is used as an attribute
|
2837 |
+
*
|
2838 |
+
* @access public
|
2839 |
+
* @return bool
|
2840 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2841 |
+
*/
|
2842 |
+
public function getIsAttribute()
|
2843 |
+
{
|
2844 |
+
return $this->getProductAttribute() || $this->getCategoryAttribute();
|
2845 |
+
}
|
2846 |
+
|
2847 |
+
/**
|
2848 |
+
* check if source model can be created
|
2849 |
+
*
|
2850 |
+
* @access public
|
2851 |
+
* @return bool
|
2852 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2853 |
+
*/
|
2854 |
+
public function getCanCreateSourceModel()
|
2855 |
+
{
|
2856 |
+
return $this->getIsAttribute() || $this->getIsParent();
|
2857 |
+
}
|
2858 |
+
|
2859 |
+
/**
|
2860 |
+
* check if entity has children
|
2861 |
+
*
|
2862 |
+
* @access public
|
2863 |
+
* @return bool
|
2864 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2865 |
+
*/
|
2866 |
+
public function getIsParent()
|
2867 |
+
{
|
2868 |
+
$children = $this->getRelatedEntities(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_PARENT);
|
2869 |
+
return count($children) > 0;
|
2870 |
+
}
|
2871 |
+
|
2872 |
+
/**
|
2873 |
+
* get product attribute group
|
2874 |
+
*
|
2875 |
+
* @access public
|
2876 |
+
* @return string
|
2877 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2878 |
+
*/
|
2879 |
+
public function getProductAttributeGroupLabel()
|
2880 |
+
{
|
2881 |
+
if ($this->getProductAttributeGroup()) {
|
2882 |
+
return "'group' => '".$this->getProductAttributeGroup()."',".
|
2883 |
+
$this->getEol().$this->getPadding(2);
|
2884 |
+
}
|
2885 |
+
return '';
|
2886 |
+
}
|
2887 |
+
/**
|
2888 |
+
* get category attribute group
|
2889 |
+
*
|
2890 |
+
* @access public
|
2891 |
+
* @return string
|
2892 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2893 |
+
*/
|
2894 |
+
public function getCategoryAttributeGroupLabel()
|
2895 |
+
{
|
2896 |
+
if ($this->getCategoryAttributeGroup()) {
|
2897 |
+
return "'group' => '".$this->getCategoryAttributeGroup().
|
2898 |
+
"',".$this->getEol().$this->getPadding(2);
|
2899 |
+
}
|
2900 |
+
return '';
|
2901 |
+
}
|
2902 |
+
|
2903 |
+
/**
|
2904 |
+
* get param name for before save
|
2905 |
+
*
|
2906 |
+
* @access public
|
2907 |
+
* @return mixed
|
2908 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2909 |
+
*/
|
2910 |
+
public function getBeforeSaveParam()
|
2911 |
+
{
|
2912 |
+
return $this->getTypeInstance()->getBeforeSaveParam();
|
2913 |
+
}
|
2914 |
+
|
2915 |
+
/**
|
2916 |
+
* entity attribute set string
|
2917 |
+
*
|
2918 |
+
* @access public
|
2919 |
+
* @return string
|
2920 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2921 |
+
*/
|
2922 |
+
public function getEntityAttributeSetId()
|
2923 |
+
{
|
2924 |
+
return $this->getTypeInstance()->getEntityAttributeSetId();
|
2925 |
+
}
|
2926 |
+
|
2927 |
+
/**
|
2928 |
+
* filter method name
|
2929 |
+
*
|
2930 |
+
* @access public
|
2931 |
+
* @return string
|
2932 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2933 |
+
*/
|
2934 |
+
public function getFilterMethod()
|
2935 |
+
{
|
2936 |
+
return $this->getTypeInstance()->getFilterMethod();
|
2937 |
+
}
|
2938 |
+
|
2939 |
+
/**
|
2940 |
+
* convert multiple select fields to strings
|
2941 |
+
*
|
2942 |
+
* @access public
|
2943 |
+
* @return mixed
|
2944 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2945 |
+
*/
|
2946 |
+
public function getMultipleSelectConvert()
|
2947 |
+
{
|
2948 |
+
return $this->getTypeInstance()->getMultipleSelectConvert();
|
2949 |
+
}
|
2950 |
+
|
2951 |
+
/**
|
2952 |
+
* check if the entity helper can be created
|
2953 |
+
*
|
2954 |
+
* @access public
|
2955 |
+
* @return bool
|
2956 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2957 |
+
*/
|
2958 |
+
public function getCanCreateEntityHelper()
|
2959 |
+
{
|
2960 |
+
if ($this->getIsTree()) {
|
2961 |
+
return true;
|
2962 |
+
}
|
2963 |
+
if ($this->getHasFile()) {
|
2964 |
+
return true;
|
2965 |
+
}
|
2966 |
+
if ($this->getCreateFrontend()) {
|
2967 |
+
return true;
|
2968 |
+
}
|
2969 |
+
return $this->getTypeInstance()->getCanCreateEntityHelper();
|
2970 |
+
}
|
2971 |
+
|
2972 |
+
/**
|
2973 |
+
* get additional code for toOptionArray()
|
2974 |
+
*
|
2975 |
+
* @access public
|
2976 |
+
* @return string
|
2977 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2978 |
+
*/
|
2979 |
+
public function getToOptionAddition()
|
2980 |
+
{
|
2981 |
+
return $this->getTypeInstance()->getToOptionAddition();
|
2982 |
+
}
|
2983 |
+
|
2984 |
+
/**
|
2985 |
+
* check if entity should be included in the category menu
|
2986 |
+
*
|
2987 |
+
* @access public
|
2988 |
+
* @return bool
|
2989 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2990 |
+
*/
|
2991 |
+
public function getShowInCategoryMenu()
|
2992 |
+
{
|
2993 |
+
return $this->getListMenu() ==
|
2994 |
+
Ultimate_ModuleCreator_Model_Source_Entity_Menu::CATEGORY_MENU;
|
2995 |
+
}
|
2996 |
+
|
2997 |
+
/**
|
2998 |
+
* get multiselect methods
|
2999 |
+
*
|
3000 |
+
* @access public
|
3001 |
+
* @return string
|
3002 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3003 |
+
*/
|
3004 |
+
public function getMultiselectMethods()
|
3005 |
+
{
|
3006 |
+
$content = '';
|
3007 |
+
$padding = $this->getPadding();
|
3008 |
+
$tab = $this->getPadding();
|
3009 |
+
$eol = $this->getEol();
|
3010 |
+
foreach ($this->getAttributes() as $attribute) {
|
3011 |
+
$magicCode = $attribute->getMagicMethodCode();
|
3012 |
+
$code = $attribute->getCode();
|
3013 |
+
if ($attribute->getTypeInstance() instanceof Ultimate_ModuleCreator_Model_Attribute_Type_Multiselect) {
|
3014 |
+
$content .= $eol.$padding.'/**'.$eol;
|
3015 |
+
$content .= $padding.' * get '.$attribute->getLabel().$eol;
|
3016 |
+
$content .= $padding.' *'.$eol;
|
3017 |
+
$content .= $padding.' * @access public'.$eol;
|
3018 |
+
$content .= $padding.' * @return array'.$eol;
|
3019 |
+
$content .= $padding.' * '.$this->getModule()->getQwertyuiop().$eol;
|
3020 |
+
$content .= $padding.' */'.$eol;
|
3021 |
+
$content .= $padding.'public function get'.$magicCode.'()'.$eol;
|
3022 |
+
$content .= $padding.'{'.$eol;
|
3023 |
+
$content .= $padding.$tab.'if (!$this->getData(\''.$code.'\')) {'.$eol;
|
3024 |
+
$content .= $padding.$tab.$tab.'return explode(\',\', $this->getData(\''.$code.'\'));'.$eol;
|
3025 |
+
$content .= $padding.$tab.'}'.$eol;
|
3026 |
+
$content .= $padding.$tab.'return $this->getData(\''.$code.'\');'.$eol;
|
3027 |
+
$content .= $padding.'}';
|
3028 |
+
}
|
3029 |
+
}
|
3030 |
+
return $content;
|
3031 |
+
}
|
3032 |
+
|
3033 |
+
/**
|
3034 |
+
* get html for displaying the name
|
3035 |
+
*
|
3036 |
+
* @access public
|
3037 |
+
* @return string
|
3038 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3039 |
+
*/
|
3040 |
+
public function getNameHtml()
|
3041 |
+
{
|
3042 |
+
$content = '';
|
3043 |
+
$lower = $this->getNameSingular(true);
|
3044 |
+
$ucFirst = ucfirst($lower);
|
3045 |
+
$name = $this->getNameAttributeMagicCode();
|
3046 |
+
if ($this->getCreateView()) {
|
3047 |
+
$content .= '\'<a href="\'.$'.$lower.'->get'.$ucFirst.'Url().\'">\'.$'.$lower.'->get'.$name.'().\'</a>\'';
|
3048 |
+
} else {
|
3049 |
+
$content .= '\'<a href="#">\'.$'.$lower.'->get'.$name.'().\'</a>\'';
|
3050 |
+
}
|
3051 |
+
return $content;
|
3052 |
+
}
|
3053 |
+
|
3054 |
+
/**
|
3055 |
+
* check if the entity is not store related
|
3056 |
+
*
|
3057 |
+
* @access public
|
3058 |
+
* @return bool
|
3059 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3060 |
+
*/
|
3061 |
+
public function getNoStore()
|
3062 |
+
{
|
3063 |
+
return !$this->getStore();
|
3064 |
+
}
|
3065 |
+
|
3066 |
+
/**
|
3067 |
+
* get comment name field filter index
|
3068 |
+
*
|
3069 |
+
* @access public
|
3070 |
+
* @return string
|
3071 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3072 |
+
*/
|
3073 |
+
public function getCommentFilterIndexPrefix()
|
3074 |
+
{
|
3075 |
+
return $this->getTypeInstance()->getCommentFilterIndexPrefix();
|
3076 |
+
}
|
3077 |
+
|
3078 |
+
/**
|
3079 |
+
* additional API subentities.
|
3080 |
+
*
|
3081 |
+
* @access public
|
3082 |
+
* @return string
|
3083 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3084 |
+
*/
|
3085 |
+
public function getApiAdditionalSettings()
|
3086 |
+
{
|
3087 |
+
$content = '';
|
3088 |
+
|
3089 |
+
if ($this->getAllowComment()) {
|
3090 |
+
$padding = $this->getPadding(3);
|
3091 |
+
$tab = $this->getPadding();
|
3092 |
+
$module = $this->getModule()->getLowerModuleName();
|
3093 |
+
$entity = $this->getNameSingular(true);
|
3094 |
+
$eol = $this->getEol();
|
3095 |
+
$title = $this->getLabelSingular().' Comments';
|
3096 |
+
$ns = $this->getNamespace(true);
|
3097 |
+
|
3098 |
+
$content .= $eol;
|
3099 |
+
$content .= $padding.'<'.$module.'_'.$entity.'_comment translate="title" module="'.
|
3100 |
+
$ns.'_'.$module.'">'.$eol;
|
3101 |
+
$content .= $padding.$tab.'<title>'.$title.'</title>'.$eol;
|
3102 |
+
$content .= $padding.$tab.'<model>'.$ns.'_'.$module.'/'.$entity.'_comment_api</model>'.$eol;
|
3103 |
+
$content .= $padding.$tab.'<acl>'.$module.'/'.$entity.'/comment</acl>'.$eol;
|
3104 |
+
$content .= $padding.$tab.'<methods>'.$eol;
|
3105 |
+
$content .= $padding.$tab.$tab.'<list translate="title" module="'.$ns.'_'.$module.'">'.$eol;
|
3106 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Retrieve '.$title.'</title>'.$eol;
|
3107 |
+
$content .= $padding.$tab.$tab.$tab.'<method>items</method>'.$eol;
|
3108 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_comment/list</acl>'.$eol;
|
3109 |
+
$content .= $padding.$tab.$tab.'</list>'.$eol;
|
3110 |
+
$content .= $padding.$tab.$tab.'<updateStatus translate="title" module="'.$ns.'_'.$module.'">'.$eol;
|
3111 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Update '.$this->getLabelSingular().' Status</title>'.$eol;
|
3112 |
+
$content .= $padding.$tab.$tab.$tab.'<method>updateStatus</method>'.$eol;
|
3113 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_comment/updateStatus</acl>'.$eol;
|
3114 |
+
$content .= $padding.$tab.$tab.'</updateStatus>'.$eol;
|
3115 |
+
$content .= $padding.$tab.'</methods>'.$eol;
|
3116 |
+
$content .= $padding.$tab.'<faults module="'.$ns.'_'.$module.'">'.$eol;
|
3117 |
+
$content .= $padding.$tab.$tab.'<not_exists>'.$eol;
|
3118 |
+
$content .= $padding.$tab.$tab.$tab.'<code>101</code>'.$eol;
|
3119 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Requested comment not found.</message>'.$eol;
|
3120 |
+
$content .= $padding.$tab.$tab.'</not_exists>'.$eol;
|
3121 |
+
$content .= $padding.$tab.'</faults>'.$eol;
|
3122 |
+
$content .= $padding.'</'.$module.'_'.$entity.'_comment>'.$eol;
|
3123 |
+
}
|
3124 |
+
$content .= $this->getTypeInstance()->getApiAdditionalSettings();
|
3125 |
+
return $content;
|
3126 |
+
}
|
3127 |
+
|
3128 |
+
/**
|
3129 |
+
* get subentities acl
|
3130 |
+
*
|
3131 |
+
* @access public
|
3132 |
+
* @return string
|
3133 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3134 |
+
*/
|
3135 |
+
public function getSubEntitiesAcl()
|
3136 |
+
{
|
3137 |
+
$content = '';
|
3138 |
+
if ($this->getAllowComment()) {
|
3139 |
+
$padding = $this->getPadding(5);
|
3140 |
+
$tab = $this->getPadding();
|
3141 |
+
$module = $this->getModule()->getLowerModuleName();
|
3142 |
+
$entity = $this->getNameSingular(true);
|
3143 |
+
$eol = $this->getEol();
|
3144 |
+
$title = $this->getLabelSingular().' Comments';
|
3145 |
+
$content .= $eol;
|
3146 |
+
$ns = $this->getModule()->getNamespace(true);
|
3147 |
+
|
3148 |
+
$content .= $padding.'<'.$entity.'_comment translate="title" module="'.$ns.'_'.$module.'">'.$eol;
|
3149 |
+
$content .= $padding.$tab.'<title>'.$title.'</title>'.$eol;
|
3150 |
+
$content .= $padding.$tab.'<sort_order>'.($this->getPosition() + 3).'</sort_order>'.$eol;
|
3151 |
+
$content .= $padding.$tab.'<list translate="title" module="'.$ns.'_'.$module.'">'.$eol;
|
3152 |
+
$content .= $padding.$tab.$tab.'<title>List</title>'.$eol;
|
3153 |
+
$content .= $padding.$tab.'</list>'.$eol;
|
3154 |
+
$content .= $padding.$tab.'<updateStatus translate="title" module="'.$ns.'_'.$module.'">'.$eol;
|
3155 |
+
$content .= $padding.$tab.$tab.'<title>Update Status</title>'.$eol;
|
3156 |
+
$content .= $padding.$tab.'</updateStatus>'.$eol;
|
3157 |
+
$content .= $padding.'</'.$entity.'_comment>'.$eol;
|
3158 |
+
}
|
3159 |
+
$content .= $this->getTypeInstance()->getSubEntitiesAcl();
|
3160 |
+
return $content;
|
3161 |
+
}
|
3162 |
+
|
3163 |
+
/**
|
3164 |
+
* get api aliases
|
3165 |
+
*
|
3166 |
+
* @access public
|
3167 |
+
* @return string
|
3168 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3169 |
+
*/
|
3170 |
+
public function getApiResourcesAlias()
|
3171 |
+
{
|
3172 |
+
$content = '';
|
3173 |
+
if ($this->getAllowComment()) {
|
3174 |
+
$padding = $this->getPadding(3);
|
3175 |
+
$module = $this->getModule()->getLowerModuleName();
|
3176 |
+
$entity = $this->getNameSingular(true);
|
3177 |
+
$eol = $this->getEol();
|
3178 |
+
$content .= $eol;
|
3179 |
+
$content .= $padding.'<'.$entity.'_comment>'.$module.'_'.$entity.'_comment</'.$entity.'_comment>';
|
3180 |
+
}
|
3181 |
+
$content .= $this->getTypeInstance()->getApiResourcesAlias();
|
3182 |
+
return $content;
|
3183 |
+
}
|
3184 |
+
|
3185 |
+
/**
|
3186 |
+
* get api V2 aliases
|
3187 |
+
*
|
3188 |
+
* @access public
|
3189 |
+
* @return string
|
3190 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3191 |
+
*/
|
3192 |
+
public function getApiResourcesAliasV2()
|
3193 |
+
{
|
3194 |
+
$content = '';
|
3195 |
+
if ($this->getAllowComment()) {
|
3196 |
+
$padding = $this->getPadding(4);
|
3197 |
+
$module = $this->getModule()->getLowerModuleName();
|
3198 |
+
$entity = strtolower($this->getNameSingular());
|
3199 |
+
$eol = $this->getEol();
|
3200 |
+
$content .= $eol;
|
3201 |
+
$content .= $padding.'<'.$entity.'_comment>'.$module.ucfirst($entity).'Comment</'.$entity.'_comment>';
|
3202 |
+
}
|
3203 |
+
$content .= $this->getTypeInstance()->getApiResourcesAliasV2();
|
3204 |
+
return $content;
|
3205 |
+
}
|
3206 |
+
|
3207 |
+
/**
|
3208 |
+
* get default api attributes
|
3209 |
+
*
|
3210 |
+
* @access public
|
3211 |
+
* @return string
|
3212 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3213 |
+
*/
|
3214 |
+
public function getDefaultApiAttributes()
|
3215 |
+
{
|
3216 |
+
return $this->getTypeInstance()->getDefaultApiAttributes();
|
3217 |
+
}
|
3218 |
+
|
3219 |
+
/**
|
3220 |
+
* get the module namespace
|
3221 |
+
*
|
3222 |
+
* @access public
|
3223 |
+
* @param bool $lower
|
3224 |
+
* @return mixed|string
|
3225 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3226 |
+
*/
|
3227 |
+
public function getNamespace($lower = false)
|
3228 |
+
{
|
3229 |
+
return $this->getModule()->getNamespace($lower);
|
3230 |
+
}
|
3231 |
+
|
3232 |
+
/**
|
3233 |
+
* get entity name
|
3234 |
+
*
|
3235 |
+
* @access public
|
3236 |
+
* @param bool $lower
|
3237 |
+
* @return mixed|string
|
3238 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3239 |
+
*/
|
3240 |
+
public function getNameSingular($lower = false)
|
3241 |
+
{
|
3242 |
+
$name = $this->getData('name_singular');
|
3243 |
+
if ($lower) {
|
3244 |
+
$name = strtolower($name);
|
3245 |
+
}
|
3246 |
+
return $name;
|
3247 |
+
}
|
3248 |
+
|
3249 |
+
/**
|
3250 |
+
* get code that filters dates
|
3251 |
+
*
|
3252 |
+
* @access public
|
3253 |
+
* @param int $padding
|
3254 |
+
* @return string
|
3255 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3256 |
+
*/
|
3257 |
+
public function getFilterDates($padding = 4)
|
3258 |
+
{
|
3259 |
+
$dateAttributes = array();
|
3260 |
+
foreach ($this->getAttributes() as $attribute) {
|
3261 |
+
if ($attribute->getTypeInstance() instanceof
|
3262 |
+
Ultimate_ModuleCreator_Model_Attribute_Type_Timestamp) {
|
3263 |
+
$dateAttributes[] = $attribute->getCode();
|
3264 |
+
}
|
3265 |
+
}
|
3266 |
+
if (count($dateAttributes) == 0) {
|
3267 |
+
return '';
|
3268 |
+
}
|
3269 |
+
return $this->getEol().$this->getPadding($padding).
|
3270 |
+
'$data = $this->_filterDates($data, array(\''.implode("' ,'", $dateAttributes).'\'));';
|
3271 |
+
}
|
3272 |
+
|
3273 |
+
/**
|
3274 |
+
* get add all attributes to collection
|
3275 |
+
*
|
3276 |
+
* @access public
|
3277 |
+
* @return string
|
3278 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3279 |
+
*/
|
3280 |
+
public function getAllAttributesToCollection()
|
3281 |
+
{
|
3282 |
+
return $this->getTypeInstance()->getAllAttributesToCollection();
|
3283 |
+
}
|
3284 |
+
|
3285 |
+
/**
|
3286 |
+
* get load store id statement
|
3287 |
+
*
|
3288 |
+
* @access public
|
3289 |
+
* @return string
|
3290 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3291 |
+
*/
|
3292 |
+
public function getLoadStoreId()
|
3293 |
+
{
|
3294 |
+
return $this->getTypeInstance()->getLoadStoreId();
|
3295 |
+
}
|
3296 |
+
|
3297 |
+
/**
|
3298 |
+
* get rest resource group
|
3299 |
+
*
|
3300 |
+
* @param $padding
|
3301 |
+
* @return string
|
3302 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3303 |
+
*/
|
3304 |
+
public function getRestResourceGroup($padding)
|
3305 |
+
{
|
3306 |
+
$content = '';
|
3307 |
+
$eol = $this->getEol();
|
3308 |
+
if ($this->getRest()) {
|
3309 |
+
$ns = $this->getNamespace(true);
|
3310 |
+
$md = $this->getModule()->getLowerModuleName();
|
3311 |
+
$entity = $this->getNameSingular(true);
|
3312 |
+
$content .= $this->getPadding($padding).'<'.$ns.'_'.$md.'_'.$entity.
|
3313 |
+
' translate="title" module="'.$ns.'_'.$md.'">'.$eol;
|
3314 |
+
$content .= $this->getPadding($padding + 1).'<title>'.$this->getLabelSingular().'</title>'.$eol;
|
3315 |
+
$content .= $this->getPadding($padding + 1).'<sort_order>'.$this->getPosition().'</sort_order>'.$eol;
|
3316 |
+
$content .= $this->getPadding($padding).'</'.$ns.'_'.$md.'_'.$entity.'>'.$eol;
|
3317 |
+
}
|
3318 |
+
return $content;
|
3319 |
+
}
|
3320 |
+
|
3321 |
+
/**
|
3322 |
+
* get rest resource
|
3323 |
+
*
|
3324 |
+
* @param $padding
|
3325 |
+
* @return string
|
3326 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3327 |
+
*/
|
3328 |
+
public function getRestResource($padding)
|
3329 |
+
{
|
3330 |
+
$content = '';
|
3331 |
+
$eol = $this->getEol();
|
3332 |
+
if ($this->getRest()) {
|
3333 |
+
$ns = $this->getNamespace(true);
|
3334 |
+
$md = $this->getModule()->getLowerModuleName();
|
3335 |
+
$entity = $this->getNameSingular(true);
|
3336 |
+
$content .= $this->getPadding($padding).'<'.$ns.'_'.$md.'_'.$entity.
|
3337 |
+
' translate="title" module="'.$ns.'_'.$md.'">'.$eol;
|
3338 |
+
$content .= $this->getPadding($padding + 1).'<group>'.$ns.'_'.$md.'_'.$entity.'</group>'.$eol;
|
3339 |
+
$content .= $this->getPadding($padding + 1).'<model>'.$ns.'_'.$md.'/api2_'.$entity.'</model>'.$eol;
|
3340 |
+
$content .= $this->getPadding($padding + 1).'<working_model>'.$ns.'_'.$md.'/'.$entity.
|
3341 |
+
'</working_model>'.$eol;
|
3342 |
+
$content .= $this->getPadding($padding + 1).'<title>'.$this->getLabelSingular().'</title>'.$eol;
|
3343 |
+
$content .= $this->getPadding($padding + 1).'<sort_order>'.$this->getPosition().'</sort_order>'.$eol;
|
3344 |
+
$content .= $this->getPadding($padding + 1).'<privileges>'.$eol;
|
3345 |
+
$content .= $this->getPadding($padding + 2).'<admin>'.$eol;
|
3346 |
+
$content .= $this->getPadding($padding + 3).'<create>1</create>'.$eol;
|
3347 |
+
$content .= $this->getPadding($padding + 3).'<retrieve>1</retrieve>'.$eol;
|
3348 |
+
$content .= $this->getPadding($padding + 3).'<update>1</update>'.$eol;
|
3349 |
+
$content .= $this->getPadding($padding + 3).'<delete>1</delete>'.$eol;
|
3350 |
+
$content .= $this->getPadding($padding + 2).'</admin>'.$eol;
|
3351 |
+
$content .= $this->getPadding($padding + 2).'<customer>'.$eol;
|
3352 |
+
$content .= $this->getPadding($padding + 3).'<retrieve>1</retrieve>'.$eol;
|
3353 |
+
$content .= $this->getPadding($padding + 2).'</customer>'.$eol;
|
3354 |
+
$content .= $this->getPadding($padding + 2).'<guest>'.$eol;
|
3355 |
+
$content .= $this->getPadding($padding + 3).'<retrieve>1</retrieve>'.$eol;
|
3356 |
+
$content .= $this->getPadding($padding + 2).'</guest>'.$eol;
|
3357 |
+
$content .= $this->getPadding($padding + 1).'</privileges>'.$eol;
|
3358 |
+
$content .= $this->getPadding($padding + 1).'<attributes translate="'.
|
3359 |
+
$this->getRestAttributes(true, true).'" module="'.$ns.'_'.$md.'">'.$eol;
|
3360 |
+
foreach ($this->getRestAttributes(false, false) as $code=>$label) {
|
3361 |
+
$content .= $this->getPadding($padding + 2).'<'.$code.'>'.$label.'</'.$code.'>'.$eol;
|
3362 |
+
}
|
3363 |
+
$content .= $this->getPadding($padding + 1).'</attributes>'.$eol;
|
3364 |
+
$content .= $this->getPadding($padding + 1).'<routes>'.$eol;
|
3365 |
+
$content .= $this->getPadding($padding + 2).'<route_entity>'.$eol;
|
3366 |
+
$content .= $this->getPadding($padding + 3).'<route>/'.$md.'_'.$this->getNamePlural(true).
|
3367 |
+
'/:id</route>'.$eol;
|
3368 |
+
$content .= $this->getPadding($padding + 3).'<action_type>entity</action_type>'.$eol;
|
3369 |
+
$content .= $this->getPadding($padding + 2).'</route_entity>'.$eol;
|
3370 |
+
if ($this->getIsEav() || $this->getStore()) {
|
3371 |
+
$content .= $this->getPadding($padding + 2).'<route_entity_with_store>'.$eol;
|
3372 |
+
$content .= $this->getPadding($padding + 3).'<route>/'.$md.'_'.$this->getNamePlural(true).
|
3373 |
+
'/:id/store/:store</route>'.$eol;
|
3374 |
+
$content .= $this->getPadding($padding + 3).'<action_type>entity</action_type>'.$eol;
|
3375 |
+
$content .= $this->getPadding($padding + 2).'</route_entity_with_store>'.$eol;
|
3376 |
+
}
|
3377 |
+
$content .= $this->getPadding($padding + 2).'<route_collection>'.$eol;
|
3378 |
+
$content .= $this->getPadding($padding + 3).'<route>/'.$md.'_'.$this->getNamePlural(true).'</route>'.$eol;
|
3379 |
+
$content .= $this->getPadding($padding + 3).'<action_type>collection</action_type>'.$eol;
|
3380 |
+
$content .= $this->getPadding($padding + 2).'</route_collection>'.$eol;
|
3381 |
+
if ($this->getIsEav() || $this->getStore()) {
|
3382 |
+
$content .= $this->getPadding($padding + 2).'<route_collection_with_store>'.$eol;
|
3383 |
+
$content .= $this->getPadding($padding + 3).'<route>/'.$md.'_'.$this->getNamePlural(true).
|
3384 |
+
'/store/:store</route>'.$eol;
|
3385 |
+
$content .= $this->getPadding($padding + 3).'<action_type>collection</action_type>'.$eol;
|
3386 |
+
$content .= $this->getPadding($padding + 2).'</route_collection_with_store>'.$eol;
|
3387 |
+
}
|
3388 |
+
$content .= $this->getPadding($padding + 1).'</routes>'.$eol;
|
3389 |
+
$content .= $this->getPadding($padding + 1).'<versions>1</versions>'.$eol;
|
3390 |
+
$content .= $this->getPadding($padding).'</'.$ns.'_'.$md.'_'.$entity.'>'.$eol;
|
3391 |
+
}
|
3392 |
+
return $content;
|
3393 |
+
}
|
3394 |
+
|
3395 |
+
/**
|
3396 |
+
* get rest attributes
|
3397 |
+
*
|
3398 |
+
* @param bool $codeOnly
|
3399 |
+
* @param bool $asString
|
3400 |
+
* @return array|string
|
3401 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3402 |
+
*/
|
3403 |
+
public function getRestAttributes($codeOnly = false, $asString = false)
|
3404 |
+
{
|
3405 |
+
$attributes = array(
|
3406 |
+
'entity_id' => 'Id',
|
3407 |
+
);
|
3408 |
+
foreach ($this->getAttributes() as $attribute) {
|
3409 |
+
$attributes[$attribute->getCode()] = $attribute->getLabel();
|
3410 |
+
}
|
3411 |
+
foreach ($this->getSimulatedAttributes() as $attribute) {
|
3412 |
+
$attributes[$attribute->getCode()] = $attribute->getLabel();
|
3413 |
+
}
|
3414 |
+
if ($codeOnly) {
|
3415 |
+
if ($asString) {
|
3416 |
+
return implode(' ', array_keys($attributes));
|
3417 |
+
}
|
3418 |
+
return array_keys($attributes);
|
3419 |
+
}
|
3420 |
+
return $attributes;
|
3421 |
+
}
|
3422 |
+
|
3423 |
+
/**
|
3424 |
+
* @access public
|
3425 |
+
*
|
3426 |
+
* @return string
|
3427 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3428 |
+
*/
|
3429 |
+
public function getRestCollectionCleanup()
|
3430 |
+
{
|
3431 |
+
return $this->getTypeInstance()->getRestCollectionCleanup();
|
3432 |
+
}
|
3433 |
+
|
3434 |
+
/**
|
3435 |
+
* @access public
|
3436 |
+
*
|
3437 |
+
* @return string
|
3438 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3439 |
+
*/
|
3440 |
+
public function getRestCollectionStoreId()
|
3441 |
+
{
|
3442 |
+
return $this->getTypeInstance()->getRestCollectionStoreId();
|
3443 |
+
}
|
3444 |
+
|
3445 |
+
/**
|
3446 |
+
* get default attribute values
|
3447 |
+
*
|
3448 |
+
* @access public
|
3449 |
+
* @return string
|
3450 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3451 |
+
*/
|
3452 |
+
public function getDefaultAttributeValues()
|
3453 |
+
{
|
3454 |
+
return $this->getTypeInstance()->getDefaultAttributeValues();
|
3455 |
+
}
|
3456 |
+
|
3457 |
+
/**
|
3458 |
+
* check if entity has parent entities
|
3459 |
+
*
|
3460 |
+
* @access public
|
3461 |
+
* @return bool
|
3462 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3463 |
+
*/
|
3464 |
+
public function getHasParentRelation()
|
3465 |
+
{
|
3466 |
+
return count($this->getRelatedEntities(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD)) > 0;
|
3467 |
+
}
|
3468 |
+
|
3469 |
+
/**
|
3470 |
+
* get additional to option array select
|
3471 |
+
*
|
3472 |
+
* @access public
|
3473 |
+
* @return string
|
3474 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3475 |
+
*/
|
3476 |
+
public function getToOptionArraySelect()
|
3477 |
+
{
|
3478 |
+
return $this->getTypeInstance()->getToOptionArraySelect();
|
3479 |
+
}
|
3480 |
+
|
3481 |
+
/**
|
3482 |
+
* get parent grid column static params
|
3483 |
+
*
|
3484 |
+
* @access public
|
3485 |
+
* @return string
|
3486 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
3487 |
+
*/
|
3488 |
+
public function getParentStaticParams()
|
3489 |
+
{
|
3490 |
+
if ($this->getNotIsTree()) {
|
3491 |
+
return '';
|
3492 |
+
}
|
3493 |
+
$eol = $this->getEol();
|
3494 |
+
$padding = $this->getPadding(4);
|
3495 |
+
$tab = $this->getPadding();
|
3496 |
+
$content = $eol;
|
3497 |
+
$content .= $padding."'static' => array(".$eol;
|
3498 |
+
$content .= $padding.$tab."'clear' => 1".$eol;
|
3499 |
+
$content .= $padding."),";
|
3500 |
+
return $content;
|
3501 |
+
}
|
3502 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Entity/Type/Abstract.php
CHANGED
@@ -1,495 +1,644 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* abstract entity type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
abstract class Ultimate_ModuleCreator_Model_Entity_Type_Abstract
|
26 |
-
|
27 |
-
/**
|
28 |
-
* constant for eav type
|
29 |
-
*/
|
30 |
-
const TYPE_EAV = 'eav';
|
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 |
-
* get the
|
72 |
-
*
|
73 |
-
* @
|
74 |
-
* @return
|
75 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
76 |
-
*/
|
77 |
-
public function
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
return
|
189 |
-
}
|
190 |
-
|
191 |
-
|
192 |
-
*
|
193 |
-
*
|
194 |
-
* @
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
*
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
*
|
220 |
-
* @access public
|
221 |
-
* @return string
|
222 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
223 |
-
*/
|
224 |
-
public function
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
*
|
231 |
-
*
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
*
|
243 |
-
*
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
*
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
*
|
268 |
-
* @access public
|
269 |
-
* @return
|
270 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
271 |
-
*/
|
272 |
-
public function
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
*
|
279 |
-
*
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
*
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
*
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
*
|
345 |
-
* @
|
346 |
-
* @
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
return '';
|
351 |
-
}
|
352 |
-
|
353 |
-
|
354 |
-
*
|
355 |
-
*
|
356 |
-
* @
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
*
|
381 |
-
* @
|
382 |
-
* @
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
return '';
|
387 |
-
}
|
388 |
-
|
389 |
-
|
390 |
-
*
|
391 |
-
*
|
392 |
-
* @
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
*
|
429 |
-
*
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
*
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
*
|
454 |
-
* @
|
455 |
-
* @
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
return
|
485 |
-
}
|
486 |
-
|
487 |
-
|
488 |
-
*
|
489 |
-
*
|
490 |
-
* @
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* abstract entity type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
abstract class Ultimate_ModuleCreator_Model_Entity_Type_Abstract extends Ultimate_ModuleCreator_Model_Abstract
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* constant for eav type
|
29 |
+
*/
|
30 |
+
const TYPE_EAV = 'eav';
|
31 |
+
|
32 |
+
/**
|
33 |
+
* constant for flat type
|
34 |
+
*/
|
35 |
+
const TYPE_FLAT = 'flat';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* current entity
|
39 |
+
*
|
40 |
+
* @var Ultimate_ModuleCreator_Model_Entity
|
41 |
+
*/
|
42 |
+
protected $_entity;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* set the entity
|
46 |
+
*
|
47 |
+
* @access public
|
48 |
+
* @param Ultimate_ModuleCreator_Model_Entity $entity
|
49 |
+
* @return Ultimate_ModuleCreator_Model_Entity_Type_Abstract
|
50 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
51 |
+
*/
|
52 |
+
public function setEntity(Ultimate_ModuleCreator_Model_Entity $entity)
|
53 |
+
{
|
54 |
+
$this->_entity = $entity;
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* get the entity object
|
60 |
+
*
|
61 |
+
* @access public
|
62 |
+
* @return Ultimate_ModuleCreator_Model_Entity|null
|
63 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
64 |
+
*/
|
65 |
+
public function getEntity()
|
66 |
+
{
|
67 |
+
return $this->_entity;
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* get the module object
|
72 |
+
*
|
73 |
+
* @access public
|
74 |
+
* @return Ultimate_ModuleCreator_Model_Module|null
|
75 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
76 |
+
*/
|
77 |
+
public function getModule()
|
78 |
+
{
|
79 |
+
return $this->getEntity()->getModule();
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* get the namespace
|
84 |
+
*
|
85 |
+
* @access public
|
86 |
+
* @param bool $lower
|
87 |
+
* @return string
|
88 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
89 |
+
*/
|
90 |
+
public function getNamespace($lower = false)
|
91 |
+
{
|
92 |
+
return $this->getModule()->getNamespace($lower);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* get lower module name
|
97 |
+
*
|
98 |
+
* @access public
|
99 |
+
* @return string
|
100 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
101 |
+
*/
|
102 |
+
public function getLowerModuleName()
|
103 |
+
{
|
104 |
+
return $this->getModule()->getLowerModuleName();
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* get collection attributes
|
109 |
+
*
|
110 |
+
* @access public
|
111 |
+
* @return string
|
112 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
113 |
+
*/
|
114 |
+
public function getCollectionAttributes()
|
115 |
+
{
|
116 |
+
return '';
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* get admin join
|
121 |
+
*
|
122 |
+
* @access public
|
123 |
+
* @return string
|
124 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
125 |
+
*/
|
126 |
+
public function getAdminJoin()
|
127 |
+
{
|
128 |
+
return '';
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* prepare columns text
|
133 |
+
*
|
134 |
+
* @access public
|
135 |
+
* @return string
|
136 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
137 |
+
*/
|
138 |
+
public function getPrepareColumnsHeader()
|
139 |
+
{
|
140 |
+
return '';
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* get name attribute grid eav
|
145 |
+
*
|
146 |
+
* @access public
|
147 |
+
* @return string
|
148 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
149 |
+
*/
|
150 |
+
public function getNameAttributeGridEav()
|
151 |
+
{
|
152 |
+
return '';
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* check if entity has images
|
157 |
+
*
|
158 |
+
* @access public
|
159 |
+
* @return bool
|
160 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
161 |
+
*/
|
162 |
+
public function getHasImage()
|
163 |
+
{
|
164 |
+
return $this->getEntity()->getData('has_image');
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* check if entity has files
|
169 |
+
*
|
170 |
+
* @access public
|
171 |
+
* @return bool
|
172 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
173 |
+
*/
|
174 |
+
public function getHasFile()
|
175 |
+
{
|
176 |
+
return $this->getEntity()->getData('has_file');
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* check if submenu should exist
|
181 |
+
*
|
182 |
+
* @access public
|
183 |
+
* @return bool
|
184 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
185 |
+
*/
|
186 |
+
public function getHasSubmenu()
|
187 |
+
{
|
188 |
+
return false;
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* get Additional submenu
|
193 |
+
*
|
194 |
+
* @access public
|
195 |
+
* @param $padding
|
196 |
+
* @return string
|
197 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
198 |
+
*/
|
199 |
+
public function getAdditionalMenu($padding)
|
200 |
+
{
|
201 |
+
return '';
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* get Additional menu acl
|
206 |
+
*
|
207 |
+
* @access public
|
208 |
+
* @param $padding
|
209 |
+
* @return string
|
210 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
211 |
+
*/
|
212 |
+
public function getAdditionalMenuAcl($padding)
|
213 |
+
{
|
214 |
+
return '';
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* check if comments are allowed by store
|
219 |
+
*
|
220 |
+
* @access public
|
221 |
+
* @return string
|
222 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
223 |
+
*/
|
224 |
+
public function getAllowCommentByStore()
|
225 |
+
{
|
226 |
+
return $this->getEntity()->getAllowComment() && $this->getEntity()->getStore();
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* get attributes content for setup
|
231 |
+
*
|
232 |
+
* @access public
|
233 |
+
* @return string
|
234 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
235 |
+
*/
|
236 |
+
public function getAttributesSetup()
|
237 |
+
{
|
238 |
+
return '';
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* get parent class for the entity resource model
|
243 |
+
*
|
244 |
+
* @access public
|
245 |
+
* @return string
|
246 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
247 |
+
*/
|
248 |
+
public function getResourceModelParent()
|
249 |
+
{
|
250 |
+
return 'Mage_Core_Model_Resource_Db_Abstract';
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* get parent class for the entity resource collection model
|
255 |
+
*
|
256 |
+
* @access public
|
257 |
+
* @return string
|
258 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
259 |
+
*/
|
260 |
+
public function getResourceCollectionModelParent()
|
261 |
+
{
|
262 |
+
return 'Mage_Core_Model_Resource_Db_Collection_Abstract';
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* get related entities relations table
|
267 |
+
*
|
268 |
+
* @access public
|
269 |
+
* @return string
|
270 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
271 |
+
*/
|
272 |
+
public function getResourceRelationsTables()
|
273 |
+
{
|
274 |
+
return '';
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* get related entities relations table declaration
|
279 |
+
*
|
280 |
+
* @access public
|
281 |
+
* @return string
|
282 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
283 |
+
*/
|
284 |
+
public function getResourceRelationsTablesDeclare()
|
285 |
+
{
|
286 |
+
return '';
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* get admin layout content for index page
|
291 |
+
*
|
292 |
+
* @access public
|
293 |
+
* @return string
|
294 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
295 |
+
*/
|
296 |
+
public function getAdminIndexLayoutContent()
|
297 |
+
{
|
298 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
299 |
+
$module = $this->getLowerModuleName();
|
300 |
+
$namespace = $this->getNamespace(true);
|
301 |
+
return $this->getPadding(3).'<block type="'.
|
302 |
+
$namespace.'_'.$module.'/adminhtml_'.$entity.'" name="'.$entity.'" />'.$this->getEol();
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* get the parent model class
|
307 |
+
*
|
308 |
+
* @access public
|
309 |
+
* @return mixed
|
310 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
311 |
+
*/
|
312 |
+
public function getEntityParentModel()
|
313 |
+
{
|
314 |
+
return 'Mage_Core_Model_Abstract';
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* get entity table alias
|
319 |
+
*
|
320 |
+
* @access public
|
321 |
+
* @return mixed
|
322 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
323 |
+
*/
|
324 |
+
public function getEntityTableAlias()
|
325 |
+
{
|
326 |
+
return 'main_table';
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* get additional prepare collection
|
331 |
+
*
|
332 |
+
* @access public
|
333 |
+
* @return mixed
|
334 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
335 |
+
*/
|
336 |
+
public function getAdditionalPrepareCollection()
|
337 |
+
{
|
338 |
+
return '';
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* additional layout block for left section
|
343 |
+
*
|
344 |
+
* @access public
|
345 |
+
* @return mixed
|
346 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
347 |
+
*/
|
348 |
+
public function getEditLayoutLeft()
|
349 |
+
{
|
350 |
+
return '';
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* additional layout block edit
|
355 |
+
*
|
356 |
+
* @access public
|
357 |
+
* @return mixed
|
358 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
359 |
+
*/
|
360 |
+
public function getEditLayoutAdditional()
|
361 |
+
{
|
362 |
+
return '';
|
363 |
+
}
|
364 |
+
|
365 |
+
/**
|
366 |
+
* get param name for before save
|
367 |
+
*
|
368 |
+
* @access public
|
369 |
+
* @return mixed
|
370 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
371 |
+
*/
|
372 |
+
public function getBeforeSaveParam()
|
373 |
+
{
|
374 |
+
return 'Mage_Core_Model_Abstract';
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* entity attribute set string
|
379 |
+
*
|
380 |
+
* @access public
|
381 |
+
* @return string
|
382 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
383 |
+
*/
|
384 |
+
public function getEntityAttributeSetId()
|
385 |
+
{
|
386 |
+
return '';
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* filter method name
|
391 |
+
*
|
392 |
+
* @access public
|
393 |
+
* @return string
|
394 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
395 |
+
*/
|
396 |
+
public function getFilterMethod()
|
397 |
+
{
|
398 |
+
return 'addFieldToFilter';
|
399 |
+
}
|
400 |
+
|
401 |
+
/**
|
402 |
+
* convert multiple select fields to strings
|
403 |
+
*
|
404 |
+
* @access public
|
405 |
+
* @return mixed
|
406 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
407 |
+
*/
|
408 |
+
public function getMultipleSelectConvert()
|
409 |
+
{
|
410 |
+
$padding = $this->getPadding(2);
|
411 |
+
$tab = $this->getPadding();
|
412 |
+
$eol = $this->getEol();
|
413 |
+
$content = '';
|
414 |
+
foreach ($this->getEntity()->getAttributes() as $attribute) {
|
415 |
+
if ($attribute->getIsMultipleSelect()) {
|
416 |
+
$ucCode = $attribute->getMagicMethodCode();
|
417 |
+
$lcCode = $attribute->getCodeForFileName(false);
|
418 |
+
$content .= '$'.$attribute->getCodeForFileName(false).' = $object->get'.$ucCode.'();'.$eol;
|
419 |
+
$content .= $padding.'if (is_array($'.$lcCode.')) {'.$eol;
|
420 |
+
$content .= $padding.$tab.'$object->set'.$ucCode."(implode(',', $".$lcCode.'));'.$eol;
|
421 |
+
$content .= $padding.'}'.$eol.$padding;
|
422 |
+
}
|
423 |
+
}
|
424 |
+
return $content;
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* check if the entity helper can be created
|
429 |
+
*
|
430 |
+
* @access public
|
431 |
+
* @return bool
|
432 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
433 |
+
*/
|
434 |
+
public function getCanCreateEntityHelper()
|
435 |
+
{
|
436 |
+
return false;
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* get additional code for toOptionArray()
|
441 |
+
*
|
442 |
+
* @access public
|
443 |
+
* @return string
|
444 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
445 |
+
*/
|
446 |
+
public function getToOptionAddition()
|
447 |
+
{
|
448 |
+
return '';
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* get comment name field filter index
|
453 |
+
*
|
454 |
+
* @access public
|
455 |
+
* @return string
|
456 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
457 |
+
*/
|
458 |
+
public function getCommentFilterIndexPrefix()
|
459 |
+
{
|
460 |
+
return $this->getEntityTableAlias().'.';
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* get additional api xml
|
465 |
+
*
|
466 |
+
* @access public
|
467 |
+
* @return string
|
468 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
469 |
+
*/
|
470 |
+
public function getApiAdditional()
|
471 |
+
{
|
472 |
+
return '';
|
473 |
+
}
|
474 |
+
|
475 |
+
/**
|
476 |
+
* get additional api faults
|
477 |
+
*
|
478 |
+
* @access public
|
479 |
+
* @return string
|
480 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
481 |
+
*/
|
482 |
+
public function getApiFaults()
|
483 |
+
{
|
484 |
+
return '';
|
485 |
+
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* additional API sub-entities.
|
489 |
+
*
|
490 |
+
* @access public
|
491 |
+
* @return string
|
492 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
493 |
+
*/
|
494 |
+
public function getApiAdditionalSettings()
|
495 |
+
{
|
496 |
+
return '';
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* get sub-entities acl
|
501 |
+
*
|
502 |
+
* @access public
|
503 |
+
* @return string
|
504 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
505 |
+
*/
|
506 |
+
public function getSubEntitiesAcl()
|
507 |
+
{
|
508 |
+
return '';
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* get api aliases
|
513 |
+
*
|
514 |
+
* @access public
|
515 |
+
* @return string
|
516 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
517 |
+
*/
|
518 |
+
public function getApiResourcesAlias()
|
519 |
+
{
|
520 |
+
return '';
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* get api V2 aliases
|
525 |
+
*
|
526 |
+
* @access public
|
527 |
+
* @return string
|
528 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
529 |
+
*/
|
530 |
+
public function getApiResourcesAliasV2()
|
531 |
+
{
|
532 |
+
return '';
|
533 |
+
}
|
534 |
+
|
535 |
+
/**
|
536 |
+
* get attributes format for wsdl
|
537 |
+
*
|
538 |
+
* @access public
|
539 |
+
* @param bool $wsi
|
540 |
+
* @return string
|
541 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
542 |
+
*/
|
543 |
+
public function getWsdlAttributes($wsi = false)
|
544 |
+
{
|
545 |
+
return '';
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* get default api attributes
|
550 |
+
*
|
551 |
+
* @access public
|
552 |
+
* @return string
|
553 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
554 |
+
*/
|
555 |
+
public function getDefaultApiAttributes()
|
556 |
+
{
|
557 |
+
return '';
|
558 |
+
}
|
559 |
+
|
560 |
+
/**
|
561 |
+
* get add all attributes to collection
|
562 |
+
*
|
563 |
+
* @access public
|
564 |
+
* @return string
|
565 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
566 |
+
*/
|
567 |
+
public function getAllAttributesToCollection()
|
568 |
+
{
|
569 |
+
return '';
|
570 |
+
}
|
571 |
+
|
572 |
+
/**
|
573 |
+
* get load store id statement
|
574 |
+
*
|
575 |
+
* @access public
|
576 |
+
* @return string
|
577 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
578 |
+
*/
|
579 |
+
public function getLoadStoreId()
|
580 |
+
{
|
581 |
+
return '';
|
582 |
+
}
|
583 |
+
|
584 |
+
/**
|
585 |
+
* get rest collection cleanup
|
586 |
+
*
|
587 |
+
* @access public
|
588 |
+
* @return string
|
589 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
590 |
+
*/
|
591 |
+
public function getRestCollectionCleanup()
|
592 |
+
{
|
593 |
+
return $this->getEol().$this->getPadding(2).'$'.
|
594 |
+
$this->getEntity()->getNamePlural(true).
|
595 |
+
'Array = $'.$this->getEntity()->getNamePlural(true).'Array[\'items\'];'.$this->getEol();
|
596 |
+
}
|
597 |
+
|
598 |
+
/**
|
599 |
+
* get rest collection store id
|
600 |
+
*
|
601 |
+
* @access public
|
602 |
+
* @return string
|
603 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
604 |
+
*/
|
605 |
+
public function getRestCollectionStoreId()
|
606 |
+
{
|
607 |
+
return '';
|
608 |
+
}
|
609 |
+
|
610 |
+
/**
|
611 |
+
* get default attribute values
|
612 |
+
*
|
613 |
+
* @access public
|
614 |
+
* @return string
|
615 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
616 |
+
*/
|
617 |
+
public function getDefaultAttributeValues()
|
618 |
+
{
|
619 |
+
$content = '';
|
620 |
+
foreach ($this->getEntity()->getAttributes() as $attribute) {
|
621 |
+
$defaultValue = $attribute->getDefaultValueProcessed();
|
622 |
+
if (!empty($defaultValue)) {
|
623 |
+
$content .= $this->getPadding(2).
|
624 |
+
'$values[\''.$attribute->getCode().'\'] = \''.$defaultValue.'\';'.$this->getEol();
|
625 |
+
}
|
626 |
+
}
|
627 |
+
if ($content) {
|
628 |
+
$content .= $this->getEol();
|
629 |
+
}
|
630 |
+
return $content;
|
631 |
+
}
|
632 |
+
|
633 |
+
/**
|
634 |
+
* get additional to option array select
|
635 |
+
*
|
636 |
+
* @access public
|
637 |
+
* @return string
|
638 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
639 |
+
*/
|
640 |
+
public function getToOptionArraySelect()
|
641 |
+
{
|
642 |
+
return '';
|
643 |
+
}
|
644 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Entity/Type/Eav.php
CHANGED
@@ -1,783 +1,971 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
class Ultimate_ModuleCreator_Model_Entity_Type_Eav extends Ultimate_ModuleCreator_Model_Entity_Type_Abstract
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
*
|
215 |
-
*
|
216 |
-
* @
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
$
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
$
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
$
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
*
|
333 |
-
* @
|
334 |
-
* @
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
return '
|
339 |
-
}
|
340 |
-
|
341 |
-
|
342 |
-
*
|
343 |
-
*
|
344 |
-
* @
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
$content
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
*
|
407 |
-
* @access public
|
408 |
-
* @return string
|
409 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
410 |
-
*/
|
411 |
-
public function
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
*
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
*
|
444 |
-
* @
|
445 |
-
* @
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
return '';
|
450 |
-
}
|
451 |
-
|
452 |
-
|
453 |
-
*
|
454 |
-
*
|
455 |
-
* @
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
$content
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
$
|
521 |
-
$
|
522 |
-
$
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
$
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
$content
|
604 |
-
$
|
605 |
-
$
|
606 |
-
|
607 |
-
$
|
608 |
-
$
|
609 |
-
$
|
610 |
-
$content
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
$
|
623 |
-
$
|
624 |
-
$
|
625 |
-
$content
|
626 |
-
$content .= $padding
|
627 |
-
$content .= $padding.$tab.'<
|
628 |
-
$content .= $padding.$tab
|
629 |
-
$content .= $padding
|
630 |
-
$content
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
$content
|
643 |
-
$
|
644 |
-
$
|
645 |
-
$
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
$content = '';
|
656 |
-
$padding
|
657 |
-
$
|
658 |
-
$
|
659 |
-
$
|
660 |
-
$content .= $eol;
|
661 |
-
$content .= $padding
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
$content
|
672 |
-
$padding
|
673 |
-
$
|
674 |
-
$
|
675 |
-
$
|
676 |
-
$content .= $eol;
|
677 |
-
$content .= $padding.'<
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
$
|
689 |
-
$
|
690 |
-
$
|
691 |
-
$content
|
692 |
-
$
|
693 |
-
$
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
$
|
710 |
-
$
|
711 |
-
$
|
712 |
-
$
|
713 |
-
$content
|
714 |
-
$
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
$
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
$content .= $padding.$tab.
|
728 |
-
$content .= $padding.$tab.
|
729 |
-
$content .= $padding.'
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
* @access public
|
752 |
-
* @return string
|
753 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
754 |
-
*/
|
755 |
-
public function
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
class Ultimate_ModuleCreator_Model_Entity_Type_Eav extends Ultimate_ModuleCreator_Model_Entity_Type_Abstract
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* parent entities FK
|
22 |
+
*
|
23 |
+
* @var null
|
24 |
+
*/
|
25 |
+
protected $_parentAttributes = null;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* get collection attributes
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return string
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function getCollectionAttributes()
|
35 |
+
{
|
36 |
+
$result = '';
|
37 |
+
$eol = $this->getEol();
|
38 |
+
$padding = $this->getPadding(3);
|
39 |
+
foreach ($this->_getParentAttributes() as $attribute) {
|
40 |
+
$result .= $eol;
|
41 |
+
$result .= $padding;
|
42 |
+
$result .= '->addAttributeToSelect(\''.$attribute->getCode().'\')';
|
43 |
+
}
|
44 |
+
foreach ($this->getEntity()->getAttributes() as $attribute) {
|
45 |
+
if ($attribute->getAdminGrid() && $attribute->getCode() != $this->getEntity()->getNameAttributeCode()) {
|
46 |
+
$result .= $eol;
|
47 |
+
$result .= $padding;
|
48 |
+
$result .= '->addAttributeToSelect(\''.$attribute->getCode().'\')';
|
49 |
+
}
|
50 |
+
}
|
51 |
+
foreach ($this->getEntity()->getSimulatedAttributes('status') as $attribute) {
|
52 |
+
$result .= $eol;
|
53 |
+
$result .= $padding;
|
54 |
+
$result .= '->addAttributeToSelect(\''.$attribute->getCode().'\')';
|
55 |
+
}
|
56 |
+
if ($this->getEntity()->getUrlRewrite()) {
|
57 |
+
foreach ($this->getEntity()->getSimulatedAttributes('url_rewrite') as $attribute) {
|
58 |
+
$result .= $eol;
|
59 |
+
$result .= $padding;
|
60 |
+
$result .= '->addAttributeToSelect(\''.$attribute->getCode().'\')';
|
61 |
+
}
|
62 |
+
}
|
63 |
+
return $result;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* get admin join
|
68 |
+
*
|
69 |
+
* @access public
|
70 |
+
* @return string
|
71 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
72 |
+
*/
|
73 |
+
public function getAdminJoin()
|
74 |
+
{
|
75 |
+
$eol = $this->getEol();
|
76 |
+
$result = $eol;
|
77 |
+
$result .= $this->getPadding(2).'$adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;'.$eol;
|
78 |
+
$result .= $this->getPadding(2).'$store = $this->_getStore();'.$eol;
|
79 |
+
$result .= $this->getPadding(2).'$collection->joinAttribute('.$eol.$this->getPadding(3).'\''.
|
80 |
+
$this->getEntity()->getNameAttributeCode().'\', '.$eol.$this->getPadding(3).'\''.
|
81 |
+
strtolower($this->getEntity()->getModule()->getNamespace()).'_'.
|
82 |
+
$this->getEntity()->getModule()->getLowerModuleName().'_'.
|
83 |
+
$this->getEntity()->getNameSingular().'/'.
|
84 |
+
$this->getEntity()->getNameAttributeCode().'\', '.
|
85 |
+
$eol.$this->getPadding(3).'\'entity_id\', '
|
86 |
+
.$eol.$this->getPadding(3).'null, '.
|
87 |
+
$eol.$this->getPadding(3).'\'inner\', '.
|
88 |
+
$eol.$this->getPadding(3).'$adminStore'
|
89 |
+
.$eol.$this->getPadding(2).');'.$eol;
|
90 |
+
$result .= $this->getPadding(2).'if ($store->getId()) {'.$eol;
|
91 |
+
$result .= $this->getPadding(3). '$collection->joinAttribute(\''.
|
92 |
+
$eol.$this->getPadding(4).$this->getModule()->getNamespace(true).'_'.
|
93 |
+
$this->getModule()->getLowerModuleName().'_'.
|
94 |
+
$this->getEntity()->getNameSingular().'_'.
|
95 |
+
$this->getEntity()->getNameAttributeCode().'\', '.
|
96 |
+
$eol.$this->getPadding(4).'\''.$this->getModule()->getNamespace(true).
|
97 |
+
'_'.$this->getModule()->getLowerModuleName().
|
98 |
+
'_'.$this->getEntity()->getNameSingular().
|
99 |
+
'/'.$this->getEntity()->getNameAttributeCode().'\', '.
|
100 |
+
$eol.$this->getPadding(4).'\'entity_id\', '.
|
101 |
+
$eol.$this->getPadding(4).'null, '.
|
102 |
+
$eol.$this->getPadding(4).'\'inner\', '.
|
103 |
+
$eol.$this->getPadding(4).'$store->getId()'.
|
104 |
+
$eol.$this->getPadding(3).');'.$eol;
|
105 |
+
$result .= $this->getPadding(2).'}'.$eol;
|
106 |
+
return $result;
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* prepare columns header
|
111 |
+
*
|
112 |
+
* @access public
|
113 |
+
* @return string
|
114 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
115 |
+
*/
|
116 |
+
public function getPrepareColumnsHeader()
|
117 |
+
{
|
118 |
+
return '$store = $this->_getStore();'.$this->getEol().$this->getPadding(2);
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* get name attribute for grid
|
123 |
+
*
|
124 |
+
* @access public
|
125 |
+
* @return string
|
126 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
127 |
+
*/
|
128 |
+
public function getNameAttributeGridEav()
|
129 |
+
{
|
130 |
+
$eol = $this->getEol();
|
131 |
+
$result = $eol;
|
132 |
+
$result .= $this->getPadding(2).'if ($this->_getStore()->getId()) {'.$eol;
|
133 |
+
$result .= $this->getPadding(3). '$this->addColumn('.
|
134 |
+
$eol.$this->getPadding(4).'\''.$this->getNamespace(true).'_'.
|
135 |
+
$this->getLowerModuleName().'_'.$this->getEntity()->getNameSingular().'_'.
|
136 |
+
$this->getEntity()->getNameAttributeCode().'\', '.
|
137 |
+
$eol.$this->getPadding(4).'array('.$eol;
|
138 |
+
$result .= $this->getPadding(5). '\'header\' => Mage::helper(\''.
|
139 |
+
$this->getNamespace(true).'_'.$this->getLowerModuleName().'\')->__(\''.
|
140 |
+
$this->getEntity()->getNameAttributeLabel().' in %s\', $this->_getStore()->getName()),'.$eol;
|
141 |
+
$result .= $this->getPadding(5).'\'align\' => \'left\','.$eol;
|
142 |
+
$result .= $this->getPadding(5).'\'index\' => \''.
|
143 |
+
$this->getNamespace(true).'_'.$this->getLowerModuleName().'_'.
|
144 |
+
$this->getEntity()->getNameSingular().'_'.$this->getEntity()->getNameAttributeCode().'\','.$eol;
|
145 |
+
$result .= $this->getPadding(4).')'.
|
146 |
+
$eol.$this->getPadding(3).');'.$eol;
|
147 |
+
$result .= $this->getPadding(2).'}'.$eol;
|
148 |
+
return $result;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* eav always has image
|
153 |
+
*
|
154 |
+
* @access public
|
155 |
+
* @return bool
|
156 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
157 |
+
*/
|
158 |
+
public function getHasImage()
|
159 |
+
{
|
160 |
+
return true;
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* eav always has files
|
165 |
+
*
|
166 |
+
* @access public
|
167 |
+
* @return bool
|
168 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
169 |
+
*/
|
170 |
+
public function getHasFile()
|
171 |
+
{
|
172 |
+
return true;
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* eav always has submenu
|
177 |
+
*
|
178 |
+
* @access public
|
179 |
+
* @return bool
|
180 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
181 |
+
*/
|
182 |
+
public function getHasSubmenu()
|
183 |
+
{
|
184 |
+
return true;
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* get additional menu
|
189 |
+
*
|
190 |
+
* @access public
|
191 |
+
* @param $padding
|
192 |
+
* @return bool
|
193 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
194 |
+
*/
|
195 |
+
public function getAdditionalMenu($padding)
|
196 |
+
{
|
197 |
+
$extension = $this->getModule()->getExtensionName(true);
|
198 |
+
$module = $this->getLowerModuleName();
|
199 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
200 |
+
$entityTitle = $this->getEntity()->getLabelSingular();
|
201 |
+
$action = $module.'_'.$entity;
|
202 |
+
$eol = $this->getEol();
|
203 |
+
|
204 |
+
$text = $this->getPadding($padding).'<'.$entity.'_attributes translate="title" module="'.$extension.'">'.$eol;
|
205 |
+
$text .= $this->getPadding($padding + 1).'<title>Manage '.$entityTitle.' Attributes</title>'.$eol;
|
206 |
+
$text .= $this->getPadding($padding + 1).'<action>adminhtml/'.$action.'_attribute</action>'.$eol;
|
207 |
+
$text .= $this->getPadding($padding + 1).
|
208 |
+
'<sort_order>'.($this->getEntity()->getPosition() + 7).'</sort_order>'.$eol;
|
209 |
+
$text .= $this->getPadding($padding).'</'.$entity.'_attributes>'.$eol;
|
210 |
+
return $text;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* get additional menu acl
|
215 |
+
*
|
216 |
+
* @access public
|
217 |
+
* @param $padding
|
218 |
+
* @return string
|
219 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
220 |
+
*/
|
221 |
+
public function getAdditionalMenuAcl($padding)
|
222 |
+
{
|
223 |
+
$extension = $this->getModule()->getExtensionName(true);
|
224 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
225 |
+
$entityTitle = $this->getEntity()->getLabelSingular();
|
226 |
+
$eol = $this->getEol();
|
227 |
+
|
228 |
+
$text = $this->getPadding($padding).'<'.$entity.'_attributes translate="title" module="'.$extension.'">'.$eol;
|
229 |
+
$text .= $this->getPadding($padding + 1).'<title>Manage '.$entityTitle.' attributes</title>'.$eol;
|
230 |
+
$text .= $this->getPadding($padding + 1).'<sort_order>'.
|
231 |
+
($this->getEntity()->getPosition() + 7).'</sort_order>'.$eol;
|
232 |
+
$text .= $this->getPadding($padding).'</'.$entity.'_attributes>'.$eol;
|
233 |
+
return $text;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* allow comments by store
|
238 |
+
*
|
239 |
+
* @access public
|
240 |
+
* @return string
|
241 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
242 |
+
*/
|
243 |
+
public function getAllowCommentByStore()
|
244 |
+
{
|
245 |
+
return $this->getEntity()->getAllowComment();
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* get parent attributes
|
250 |
+
*
|
251 |
+
* @access protected
|
252 |
+
* @return Ultimate_ModuleCreator_Model_Attribute[]
|
253 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
254 |
+
*/
|
255 |
+
protected function _getParentAttributes()
|
256 |
+
{
|
257 |
+
if (is_null($this->_parentAttributes)) {
|
258 |
+
$parents = $this->getEntity()->getRelatedEntities(
|
259 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD
|
260 |
+
);
|
261 |
+
$this->_parentAttributes = array();
|
262 |
+
foreach ($parents as $parent) {
|
263 |
+
$module = $parent->getModule()->getLowerModuleName();
|
264 |
+
$namespace = $parent->getModule()->getNamespace(true);
|
265 |
+
$name = $parent->getNameSingular();
|
266 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attr */
|
267 |
+
$attr = Mage::getModel('modulecreator/attribute');
|
268 |
+
$attr->setCode($name.'_id');
|
269 |
+
$attr->setLabel($parent->getLabelSingular());
|
270 |
+
$attr->setType('dropdown');
|
271 |
+
$attr->setOptionsSource('custom');
|
272 |
+
$attr->setForcedSource($namespace.'_'.$module.'/'.$name.'_source');
|
273 |
+
$attr->setScope(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL);
|
274 |
+
$attr->setEntity($this->getEntity());
|
275 |
+
$attr->setUseFilterIndex(true);
|
276 |
+
$this->_parentAttributes[] = $attr;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
return $this->_parentAttributes;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* get attributes content for setup
|
284 |
+
*
|
285 |
+
* @access public
|
286 |
+
* @return string
|
287 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
288 |
+
*/
|
289 |
+
public function getAttributesSetup()
|
290 |
+
{
|
291 |
+
$content = '';
|
292 |
+
$position = 0;
|
293 |
+
//all parent attributes
|
294 |
+
/** @var Ultimate_ModuleCreator_Model_Attribute $attribute */
|
295 |
+
foreach ($this->_getParentAttributes() as $attribute) {
|
296 |
+
$content .= $attribute->getSetupContent();
|
297 |
+
}
|
298 |
+
foreach ($this->getEntity()->getAttributes() as $attribute) {
|
299 |
+
$content .= $attribute->getSetupContent();
|
300 |
+
$position = $attribute->getPosition();
|
301 |
+
}
|
302 |
+
$position += 10;
|
303 |
+
foreach ($this->getEntity()->getSimulatedAttributes(null, false, array('tree')) as $attribute) {
|
304 |
+
$attribute->setPosition($position);
|
305 |
+
$content .= $attribute->getSetupContent();
|
306 |
+
$position += 10;
|
307 |
+
}
|
308 |
+
foreach ($this->getEntity()->getSimulatedAttributes('tree', false) as $attribute) {
|
309 |
+
$attribute->setForcedSetupType('static');
|
310 |
+
$attribute->setForcedVisible(0);
|
311 |
+
$content .= $attribute->getSetupContent();
|
312 |
+
$position += 10;
|
313 |
+
}
|
314 |
+
return $content;
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* get parent class for the entity resource model
|
319 |
+
*
|
320 |
+
* @access public
|
321 |
+
* @return string
|
322 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
323 |
+
*/
|
324 |
+
public function getResourceModelParent()
|
325 |
+
{
|
326 |
+
return 'Mage_Catalog_Model_Resource_Abstract';
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
* get parent class for the entity resource collection model
|
331 |
+
*
|
332 |
+
* @access public
|
333 |
+
* @return string
|
334 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
335 |
+
*/
|
336 |
+
public function getResourceCollectionModelParent()
|
337 |
+
{
|
338 |
+
return 'Mage_Catalog_Model_Resource_Collection_Abstract';
|
339 |
+
}
|
340 |
+
|
341 |
+
/**
|
342 |
+
* get related entities relations table
|
343 |
+
*
|
344 |
+
* @access public
|
345 |
+
* @return string
|
346 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
347 |
+
*/
|
348 |
+
public function getResourceRelationsTables()
|
349 |
+
{
|
350 |
+
$padding = $this->getPadding(2);
|
351 |
+
$content = '';
|
352 |
+
$eol = $this->getEol();
|
353 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
354 |
+
$module = $this->getLowerModuleName();
|
355 |
+
$namespace = $this->getNamespace(true);
|
356 |
+
if ($this->getEntity()->getLinkProduct()) {
|
357 |
+
$content .= $padding.'$'.'this->_'.
|
358 |
+
$entity.'ProductTable = $'."this->getTable('".
|
359 |
+
$namespace.'_'.$module."/".$entity."_product');".$eol;
|
360 |
+
}
|
361 |
+
if ($this->getEntity()->getLinkCategory()) {
|
362 |
+
$content .= $padding.'$'.'this->_'.
|
363 |
+
$entity.'CategoryTable = $'."this->getTable('".
|
364 |
+
$namespace.'_'.$module."/".$entity."_category');".$eol;
|
365 |
+
}
|
366 |
+
$related = $this->getEntity()->getRelatedEntities(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING);
|
367 |
+
foreach ($related as $_entity) {
|
368 |
+
$_entityUc = ucfirst($_entity->getNameSingular());
|
369 |
+
$_entityLower = $_entity->getNameSingular(true);
|
370 |
+
$content .= $padding.'$'.'this->_'.
|
371 |
+
$entity.$_entityUc.'Table = $'."this->getTable('".
|
372 |
+
$namespace.'_'.$module."/".$entity."_".$_entityLower."');".$eol;
|
373 |
+
}
|
374 |
+
return $content;
|
375 |
+
}
|
376 |
+
|
377 |
+
/**
|
378 |
+
* get related entities relations table declaration
|
379 |
+
*
|
380 |
+
* @access public
|
381 |
+
* @return string
|
382 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
383 |
+
*/
|
384 |
+
public function getResourceRelationsTablesDeclare()
|
385 |
+
{
|
386 |
+
$padding = $this->getPadding();
|
387 |
+
$content = '';
|
388 |
+
$eol = $this->getEol();
|
389 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
390 |
+
if ($this->getEntity()->getLinkProduct()) {
|
391 |
+
$content .= $padding.'protected $'.'_'.$entity.'ProductTable = null;'.$eol;
|
392 |
+
}
|
393 |
+
if ($this->getEntity()->getLinkCategory()) {
|
394 |
+
$content .= $padding.'protected $'.'_'.$entity.'CategoryTable = null;'.$eol;
|
395 |
+
}
|
396 |
+
$related = $this->getEntity()->getRelatedEntities(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING);
|
397 |
+
foreach ($related as $_entity) {
|
398 |
+
$_entityUc = ucfirst($_entity->getNameSingular());
|
399 |
+
$content .= $padding.'protected $'.'_'.$entity.$_entityUc.'Table = null;'.$eol;
|
400 |
+
}
|
401 |
+
return $content;
|
402 |
+
}
|
403 |
+
|
404 |
+
/**
|
405 |
+
* get admin layout content for index page
|
406 |
+
*
|
407 |
+
* @access public
|
408 |
+
* @return string
|
409 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
410 |
+
*/
|
411 |
+
public function getAdminIndexLayoutContent()
|
412 |
+
{
|
413 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
414 |
+
$module = $this->getLowerModuleName();
|
415 |
+
$namespace = $this->getNamespace(true);
|
416 |
+
$eol = $this->getEol();
|
417 |
+
$content = $this->getPadding(3).
|
418 |
+
'<block type="'.$namespace.'_'.$module.
|
419 |
+
'/adminhtml_'.$entity.'" name="'.$entity.'">'.$eol;
|
420 |
+
$content .= $this->getPadding(4).
|
421 |
+
'<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">'.$eol;
|
422 |
+
$content .= $this->getPadding(5).'<action method="setUseConfirm"><params>0</params></action>'.$eol;
|
423 |
+
$content .= $this->getPadding(4).'</block>'.$eol;
|
424 |
+
$content .= $this->getPadding(3).'</block>'.$eol;
|
425 |
+
return $content;
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* get the parent model class
|
430 |
+
*
|
431 |
+
* @access public
|
432 |
+
* @return mixed
|
433 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
434 |
+
*/
|
435 |
+
public function getEntityParentModel()
|
436 |
+
{
|
437 |
+
return 'Mage_Catalog_Model_Abstract';
|
438 |
+
}
|
439 |
+
|
440 |
+
/**
|
441 |
+
* get entity table alias
|
442 |
+
*
|
443 |
+
* @access public
|
444 |
+
* @return mixed
|
445 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
446 |
+
*/
|
447 |
+
public function getEntityTableAlias()
|
448 |
+
{
|
449 |
+
return 'e';
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* get additional prepare collection
|
454 |
+
*
|
455 |
+
* @access public
|
456 |
+
* @return mixed
|
457 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
458 |
+
*/
|
459 |
+
public function getAdditionalPrepareCollection()
|
460 |
+
{
|
461 |
+
return "->addAttributeToSelect('".$this->getEntity()->getNameAttributeCode()."')";
|
462 |
+
}
|
463 |
+
|
464 |
+
/**
|
465 |
+
* additional layout block for left section
|
466 |
+
*
|
467 |
+
* @access public
|
468 |
+
* @return mixed
|
469 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
470 |
+
*/
|
471 |
+
public function getEditLayoutLeft()
|
472 |
+
{
|
473 |
+
return '<block type="adminhtml/store_switcher" name="store_switcher" before="-"></block>'.
|
474 |
+
$this->getEol().$this->getPadding(3);
|
475 |
+
}
|
476 |
+
|
477 |
+
/**
|
478 |
+
* additional layout block edit
|
479 |
+
*
|
480 |
+
* @access public
|
481 |
+
* @return mixed
|
482 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
483 |
+
*/
|
484 |
+
public function getEditLayoutAdditional()
|
485 |
+
{
|
486 |
+
$content = '';
|
487 |
+
$eol = $this->getEol();
|
488 |
+
$content .= $eol.$this->getPadding(2).'<reference name="head">'.$eol;
|
489 |
+
$content .= $this->getPadding(3).'<action method="setCanLoadTinyMce"><load>1</load></action>'.$eol;
|
490 |
+
$content .= $this->getPadding(2).'</reference>'.$eol;
|
491 |
+
$content .= $this->getPadding(2).'<reference name="js">'.$eol;
|
492 |
+
$content .= $this->getPadding(3).
|
493 |
+
'<block type="core/template" name="catalog.wysiwyg.js" template="catalog/wysiwyg/js.phtml"/>'.
|
494 |
+
$eol;
|
495 |
+
$content .= $this->getPadding(2).'</reference>';
|
496 |
+
return $content;
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* get param name for before save
|
501 |
+
*
|
502 |
+
* @access public
|
503 |
+
* @return mixed
|
504 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
505 |
+
*/
|
506 |
+
public function getBeforeSaveParam()
|
507 |
+
{
|
508 |
+
return 'Varien_Object';
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* entity attribute set string
|
513 |
+
*
|
514 |
+
* @access public
|
515 |
+
* @return string
|
516 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
517 |
+
*/
|
518 |
+
public function getEntityAttributeSetId()
|
519 |
+
{
|
520 |
+
$namespace = $this->getNamespace(true);
|
521 |
+
$module = $this->getLowerModuleName();
|
522 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
523 |
+
return $this->getEol().$this->getPadding().
|
524 |
+
"->setAttributeSetId(Mage::getModel('".$namespace.'_'.$module.'/'.$entity.
|
525 |
+
"')->getDefaultAttributeSetId())";
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* filter method name
|
530 |
+
*
|
531 |
+
* @access public
|
532 |
+
* @return string
|
533 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
534 |
+
*/
|
535 |
+
public function getFilterMethod()
|
536 |
+
{
|
537 |
+
return 'addAttributeToFilter';
|
538 |
+
}
|
539 |
+
|
540 |
+
/**
|
541 |
+
* convert multiple select fields to strings
|
542 |
+
*
|
543 |
+
* @access public
|
544 |
+
* @return mixed
|
545 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
546 |
+
*/
|
547 |
+
public function getMultipleSelectConvert()
|
548 |
+
{
|
549 |
+
return $this->getEol();
|
550 |
+
}
|
551 |
+
|
552 |
+
/**
|
553 |
+
* check if the entity helper can be created
|
554 |
+
*
|
555 |
+
* @access public
|
556 |
+
* @return bool
|
557 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
558 |
+
*/
|
559 |
+
public function getCanCreateEntityHelper()
|
560 |
+
{
|
561 |
+
return true;
|
562 |
+
}
|
563 |
+
|
564 |
+
/**
|
565 |
+
* get additional code for toOptionArray()
|
566 |
+
*
|
567 |
+
* @access public
|
568 |
+
* @return string
|
569 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
570 |
+
*/
|
571 |
+
public function getToOptionAddition()
|
572 |
+
{
|
573 |
+
$attribute = $this->getEntity()->getNameAttributeCode();
|
574 |
+
return '$this->addAttributeToSelect(\''.$attribute.'\');'.$this->getEol().$this->getPadding(2);
|
575 |
+
}
|
576 |
+
|
577 |
+
/**
|
578 |
+
* get comment name field filter index
|
579 |
+
*
|
580 |
+
* @access public
|
581 |
+
* @return string
|
582 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
583 |
+
*/
|
584 |
+
public function getCommentFilterIndexPrefix()
|
585 |
+
{
|
586 |
+
return '';
|
587 |
+
}
|
588 |
+
|
589 |
+
/**
|
590 |
+
* get additional api xml
|
591 |
+
*
|
592 |
+
* @access public
|
593 |
+
* @return string
|
594 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
595 |
+
*/
|
596 |
+
public function getApiAdditional()
|
597 |
+
{
|
598 |
+
$eol = $this->getEol();
|
599 |
+
$padding = $this->getPadding(5);
|
600 |
+
$tab = $this->getPadding();
|
601 |
+
$content = '';
|
602 |
+
$content .= $padding.'<currentStore>'.$eol;
|
603 |
+
$content .= $padding.$tab.'<title>Set/Get current store view</title>'.$eol;
|
604 |
+
$content .= $padding.'</currentStore>'.$eol;
|
605 |
+
$content .= $padding.'<listOfAdditionalAttributes translate="title" module="'.
|
606 |
+
$this->getNamespace(true).'_'.$this->getLowerModuleName().'">'.$eol;
|
607 |
+
$content .= $padding.$tab.'<title>Get list of non-default attributes</title>'.$eol;
|
608 |
+
$content .= $padding.$tab.'<method>getAdditionalAttributes</method>'.$eol;
|
609 |
+
$content .= $padding.'</listOfAdditionalAttributes>'.$eol;
|
610 |
+
return $content;
|
611 |
+
}
|
612 |
+
|
613 |
+
/**
|
614 |
+
* get additional api faults
|
615 |
+
*
|
616 |
+
* @access public
|
617 |
+
* @return string
|
618 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
619 |
+
*/
|
620 |
+
public function getApiFaults()
|
621 |
+
{
|
622 |
+
$eol = $this->getEol();
|
623 |
+
$padding = $this->getPadding(5);
|
624 |
+
$tab = $this->getPadding();
|
625 |
+
$content = '';
|
626 |
+
$content .= $padding.'<store_not_exists>'.$eol;
|
627 |
+
$content .= $padding.$tab.'<code>100</code>'.$eol;
|
628 |
+
$content .= $padding.$tab.'<message>Requested store view not found.</message>'.$eol;
|
629 |
+
$content .= $padding.'</store_not_exists>'.$eol;
|
630 |
+
return $content;
|
631 |
+
}
|
632 |
+
|
633 |
+
/**
|
634 |
+
* additional API subentities.
|
635 |
+
*
|
636 |
+
* @access public
|
637 |
+
* @return string
|
638 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
639 |
+
*/
|
640 |
+
public function getApiAdditionalSettings()
|
641 |
+
{
|
642 |
+
$content = '';
|
643 |
+
$padding = $this->getPadding(3);
|
644 |
+
$tab = $this->getPadding();
|
645 |
+
$module = $this->getLowerModuleName();
|
646 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
647 |
+
$eol = $this->getEol();
|
648 |
+
$content .= $eol;
|
649 |
+
$extension = $this->getModule()->getExtensionName(true);
|
650 |
+
$content .= $padding.'<'.$module.'_'.$entity.'_attribute translate="title" module="'.$extension.'">'.$eol;
|
651 |
+
$content .= $padding.$tab.'<title>Product attributes API</title>'.$eol;
|
652 |
+
$content .= $padding.$tab.'<model>'.$extension.'/'.$entity.'_attribute_api</model>'.$eol;
|
653 |
+
$content .= $padding.$tab.'<acl>'.$module.'/'.$entity.'</acl>'.$eol;
|
654 |
+
$content .= $padding.$tab.'<methods>'.$eol;
|
655 |
+
$content .= $padding.$tab.$tab.'<currentStore translate="title" module="'.$extension.'">'.$eol;
|
656 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Set/Get current store view</title>'.$eol;
|
657 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/write</acl>'.$eol;
|
658 |
+
$content .= $padding.$tab.$tab.'</currentStore>'.$eol;
|
659 |
+
$content .= $padding.$tab.$tab.'<list translate="title" module="'.$extension.'">'.$eol;
|
660 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Retrieve attribute list</title>'.$eol;
|
661 |
+
$content .= $padding.$tab.$tab.$tab.'<method>items</method>'.$eol;
|
662 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/read</acl>'.$eol;
|
663 |
+
$content .= $padding.$tab.$tab.'</list>'.$eol;
|
664 |
+
$content .= $padding.$tab.$tab.'<options translate="title" module="'.$extension.'">'.$eol;
|
665 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Retrieve attribute options</title>'.$eol;
|
666 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/read</acl>'.$eol;
|
667 |
+
$content .= $padding.$tab.$tab.'</options>'.$eol;
|
668 |
+
$content .= $padding.$tab.$tab.'<types translate="title" module="'.$extension.'">'.$eol;
|
669 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Get list of possible attribute types</title>'.$eol;
|
670 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/types</acl>'.$eol;
|
671 |
+
$content .= $padding.$tab.$tab.'</types>'.$eol;
|
672 |
+
$content .= $padding.$tab.$tab.'<create translate="title" module="'.$extension.'">'.$eol;
|
673 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Create new attribute</title>'.$eol;
|
674 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/create</acl>'.$eol;
|
675 |
+
$content .= $padding.$tab.$tab.'</create>'.$eol;
|
676 |
+
$content .= $padding.$tab.$tab.'<update translate="title" module="'.$extension.'">'.$eol;
|
677 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Update attribute</title>'.$eol;
|
678 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/update</acl>'.$eol;
|
679 |
+
$content .= $padding.$tab.$tab.'</update>'.$eol;
|
680 |
+
$content .= $padding.$tab.$tab.'<remove translate="title" module="'.$extension.'">'.$eol;
|
681 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Delete attribute</title>'.$eol;
|
682 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/remove</acl>'.$eol;
|
683 |
+
$content .= $padding.$tab.$tab.'</remove>'.$eol;
|
684 |
+
$content .= $padding.$tab.$tab.'<info translate="title" module="'.$extension.'">'.$eol;
|
685 |
+
$content .= $padding.$tab.$tab.$tab.
|
686 |
+
'<title>Get full information about attribute with list of options</title>'.
|
687 |
+
$eol;
|
688 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/info</acl>'.$eol;
|
689 |
+
$content .= $padding.$tab.$tab.'</info>'.$eol;
|
690 |
+
$content .= $padding.$tab.$tab.'<addOption translate="title" module="'.$extension.'">'.$eol;
|
691 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Add option</title>'.$eol;
|
692 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/option/add</acl>'.$eol;
|
693 |
+
$content .= $padding.$tab.$tab.'</addOption>'.$eol;
|
694 |
+
$content .= $padding.$tab.$tab.'<removeOption translate="title" module="'.$extension.'">'.$eol;
|
695 |
+
$content .= $padding.$tab.$tab.$tab.'<title>Remove option</title>'.$eol;
|
696 |
+
$content .= $padding.$tab.$tab.$tab.'<acl>'.$module.'/'.$entity.'_attribute/option/remove</acl>'.$eol;
|
697 |
+
$content .= $padding.$tab.$tab.'</removeOption>'.$eol;
|
698 |
+
$content .= $padding.$tab.'</methods>'.$eol;
|
699 |
+
$content .= $padding.$tab.'<faults module="'.$extension.'">'.$eol;
|
700 |
+
$content .= $padding.$tab.$tab.'<store_not_exists>'.$eol;
|
701 |
+
$content .= $padding.$tab.$tab.$tab.'<code>100</code>'.$eol;
|
702 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Requested store view not found.</message>'.$eol;
|
703 |
+
$content .= $padding.$tab.$tab.'</store_not_exists>'.$eol;
|
704 |
+
$content .= $padding.$tab.$tab.'<not_exists>'.$eol;
|
705 |
+
$content .= $padding.$tab.$tab.$tab.'<code>101</code>'.$eol;
|
706 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Requested attribute not found.</message>'.$eol;
|
707 |
+
$content .= $padding.$tab.$tab.'</not_exists>'.$eol;
|
708 |
+
$content .= $padding.$tab.$tab.'<invalid_parameters>'.$eol;
|
709 |
+
$content .= $padding.$tab.$tab.$tab.'<code>102</code>'.$eol;
|
710 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Invalid request parameters.</message>'.$eol;
|
711 |
+
$content .= $padding.$tab.$tab.'</invalid_parameters>'.$eol;
|
712 |
+
$content .= $padding.$tab.$tab.'<invalid_code>'.$eol;
|
713 |
+
$content .= $padding.$tab.$tab.$tab.'<code>103</code>'.$eol;
|
714 |
+
$content .= $padding.$tab.$tab.$tab.
|
715 |
+
'<message>Attribute code is invalid. Please use only letters (a-z), '.
|
716 |
+
'numbers (0-9) or underscore(_) in this field, first character should be a letter.</message>'.
|
717 |
+
$eol;
|
718 |
+
$content .= $padding.$tab.$tab.'</invalid_code>'.$eol;
|
719 |
+
$content .= $padding.$tab.$tab.'<invalid_frontend_input>'.$eol;
|
720 |
+
$content .= $padding.$tab.$tab.$tab.'<code>104</code>'.$eol;
|
721 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Incorrect attribute type.</message>'.$eol;
|
722 |
+
$content .= $padding.$tab.$tab.'</invalid_frontend_input>'.$eol;
|
723 |
+
$content .= $padding.$tab.$tab.'<unable_to_save>'.$eol;
|
724 |
+
$content .= $padding.$tab.$tab.$tab.'<code>105</code>'.$eol;
|
725 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Unable to save attribute.</message>'.$eol;
|
726 |
+
$content .= $padding.$tab.$tab.'</unable_to_save>'.$eol;
|
727 |
+
$content .= $padding.$tab.$tab.'<can_not_delete>'.$eol;
|
728 |
+
$content .= $padding.$tab.$tab.$tab.'<code>106</code>'.$eol;
|
729 |
+
$content .= $padding.$tab.$tab.$tab.'<message>This attribute cannot be deleted.</message>'.$eol;
|
730 |
+
$content .= $padding.$tab.$tab.'</can_not_delete>'.$eol;
|
731 |
+
$content .= $padding.$tab.$tab.'<can_not_edit>'.$eol;
|
732 |
+
$content .= $padding.$tab.$tab.$tab.'<code>107</code>'.$eol;
|
733 |
+
$content .= $padding.$tab.$tab.$tab.'<message>This attribute cannot be edited.</message>'.$eol;
|
734 |
+
$content .= $padding.$tab.$tab.'</can_not_edit>'.$eol;
|
735 |
+
$content .= $padding.$tab.$tab.'<unable_to_add_option>'.$eol;
|
736 |
+
$content .= $padding.$tab.$tab.$tab.'<code>108</code>'.$eol;
|
737 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Unable to add option.</message>'.$eol;
|
738 |
+
$content .= $padding.$tab.$tab.'</unable_to_add_option>'.$eol;
|
739 |
+
$content .= $padding.$tab.$tab.'<unable_to_remove_option>'.$eol;
|
740 |
+
$content .= $padding.$tab.$tab.$tab.'<code>109</code>'.$eol;
|
741 |
+
$content .= $padding.$tab.$tab.$tab.'<message>Unable to remove option.</message>'.$eol;
|
742 |
+
$content .= $padding.$tab.$tab.'</unable_to_remove_option>'.$eol;
|
743 |
+
$content .= $padding.$tab.'</faults>'.$eol;
|
744 |
+
$content .= $padding.'</'.$module.'_'.$entity.'_attribute>'.$eol;
|
745 |
+
return $content;
|
746 |
+
}
|
747 |
+
|
748 |
+
/**
|
749 |
+
* get subentities acl
|
750 |
+
*
|
751 |
+
* @access public
|
752 |
+
* @return string
|
753 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
754 |
+
*/
|
755 |
+
public function getSubEntitiesAcl()
|
756 |
+
{
|
757 |
+
$content = '';
|
758 |
+
$padding = $this->getPadding(5);
|
759 |
+
$tab = $this->getPadding();
|
760 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
761 |
+
$eol = $this->getEol();
|
762 |
+
$title = $this->getEntity()->getLabelSingular().' Attributes';
|
763 |
+
$extension = $this->getModule()->getExtensionName(true);
|
764 |
+
$content .= $eol;
|
765 |
+
|
766 |
+
$content .= $padding.'<'.$entity.'_attribute translate="title" module="'.$extension.'">'.$eol;
|
767 |
+
$content .= $padding.$tab.'<title>'.$title.'</title>'.$eol;
|
768 |
+
$content .= $padding.$tab.'<sort_order>'.($this->getEntity()->getPosition() + 6).'</sort_order>'.$eol;
|
769 |
+
$content .= $padding.$tab.'<currentStore translate="title" module="'.$extension.'">'.$eol;
|
770 |
+
$content .= $padding.$tab.$tab.'<title>Set/Get current store view</title>'.$eol;
|
771 |
+
$content .= $padding.$tab.'</currentStore>'.$eol;
|
772 |
+
$content .= $padding.$tab.'<list translate="title" module="'.$extension.'">'.$eol;
|
773 |
+
$content .= $padding.$tab.$tab.'<title>Retrieve attribute list</title>'.$eol;
|
774 |
+
$content .= $padding.$tab.'</list>'.$eol;
|
775 |
+
$content .= $padding.$tab.'<options translate="title" module="'.$extension.'">'.$eol;
|
776 |
+
$content .= $padding.$tab.$tab.'<title>Retrieve attribute options</title>'.$eol;
|
777 |
+
$content .= $padding.$tab.'</options>'.$eol;
|
778 |
+
$content .= $padding.$tab.'<types translate="title" module="'.$extension.'">'.$eol;
|
779 |
+
$content .= $padding.$tab.$tab.'<title>Get list of possible attribute types</title>'.$eol;
|
780 |
+
$content .= $padding.$tab.'</types>'.$eol;
|
781 |
+
$content .= $padding.$tab.'<create translate="title" module="'.$extension.'">'.$eol;
|
782 |
+
$content .= $padding.$tab.$tab.'<title>Create new attribute</title>'.$eol;
|
783 |
+
$content .= $padding.$tab.'</create>'.$eol;
|
784 |
+
$content .= $padding.$tab.'<update translate="title" module="'.$extension.'">'.$eol;
|
785 |
+
$content .= $padding.$tab.$tab.'<title>Update attribute</title>'.$eol;
|
786 |
+
$content .= $padding.$tab.'</update>'.$eol;
|
787 |
+
$content .= $padding.$tab.'<remove translate="title" module="'.$extension.'">'.$eol;
|
788 |
+
$content .= $padding.$tab.$tab.'<title>Remove attribute</title>'.$eol;
|
789 |
+
$content .= $padding.$tab.'</remove>'.$eol;
|
790 |
+
$content .= $padding.$tab.'<info translate="title" module="'.$extension.'">'.$eol;
|
791 |
+
$content .= $padding.$tab.$tab.'<title>Get full information about attribute with list of options</title>'.$eol;
|
792 |
+
$content .= $padding.$tab.'</info>'.$eol;
|
793 |
+
$content .= $padding.$tab.'<addOption translate="title" module="'.$extension.'">'.$eol;
|
794 |
+
$content .= $padding.$tab.$tab.'<title>Add option</title>'.$eol;
|
795 |
+
$content .= $padding.$tab.'</addOption>'.$eol;
|
796 |
+
$content .= $padding.$tab.'<removeOption translate="title" module="'.$extension.'">'.$eol;
|
797 |
+
$content .= $padding.$tab.$tab.'<title>Remove option</title>'.$eol;
|
798 |
+
$content .= $padding.$tab.'</removeOption>'.$eol;
|
799 |
+
$content .= $padding.'</'.$entity.'_attribute>'.$eol;
|
800 |
+
return $content;
|
801 |
+
}
|
802 |
+
|
803 |
+
/**
|
804 |
+
* get api aliases
|
805 |
+
*
|
806 |
+
* @access public
|
807 |
+
* @return string
|
808 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
809 |
+
*/
|
810 |
+
public function getApiResourcesAlias()
|
811 |
+
{
|
812 |
+
$content = '';
|
813 |
+
$padding = $this->getPadding(3);
|
814 |
+
$module = $this->getLowerModuleName();
|
815 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
816 |
+
$eol = $this->getEol();
|
817 |
+
$content .= $eol;
|
818 |
+
$content .= $padding.'<'.$entity.'_attribute>'.$module.'_'.$entity.'_attribute</'.$entity.'_attribute>';
|
819 |
+
return $content;
|
820 |
+
}
|
821 |
+
|
822 |
+
/**
|
823 |
+
* get api V2 aliases
|
824 |
+
*
|
825 |
+
* @access public
|
826 |
+
* @return string
|
827 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
828 |
+
*/
|
829 |
+
public function getApiResourcesAliasV2()
|
830 |
+
{
|
831 |
+
$content = '';
|
832 |
+
$padding = $this->getPadding(4);
|
833 |
+
$module = $this->getLowerModuleName();
|
834 |
+
$entity = $this->getEntity()->getNameSingular(true);
|
835 |
+
$eol = $this->getEol();
|
836 |
+
$content .= $eol;
|
837 |
+
$content .= $padding.'<'.$entity.'_attribute>'.$module.ucfirst($entity).'Attribute</'.$entity.'_attribute>';
|
838 |
+
return $content;
|
839 |
+
}
|
840 |
+
|
841 |
+
/**
|
842 |
+
* get attributes format for wsdl
|
843 |
+
*
|
844 |
+
* @access public
|
845 |
+
* @param bool $wsi
|
846 |
+
* @return string
|
847 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
848 |
+
*/
|
849 |
+
public function getWsdlAttributes($wsi = false)
|
850 |
+
{
|
851 |
+
$tab = $this->getPadding();
|
852 |
+
$padding = str_repeat($tab, 5);
|
853 |
+
$eol = $this->getEol();
|
854 |
+
$content = '';
|
855 |
+
$module = $this->getLowerModuleName();
|
856 |
+
$entity = ucfirst($this->getEntity()->getNameSingular(true));
|
857 |
+
if (!$wsi) {
|
858 |
+
$content .= $padding.
|
859 |
+
'<element name="additional_attributes" type="typens:'.$module.$entity.
|
860 |
+
'AdditionalAttributesEntity" minOccurs="0"/>'.$eol;
|
861 |
+
} else {
|
862 |
+
$content .= $padding.
|
863 |
+
'<xsd:element name="additional_attributes" type="typens:associativeArray" minOccurs="0" />'.
|
864 |
+
$eol;
|
865 |
+
}
|
866 |
+
return $content;
|
867 |
+
}
|
868 |
+
|
869 |
+
/**
|
870 |
+
* get default api attributes
|
871 |
+
*
|
872 |
+
* @access public
|
873 |
+
* @return string
|
874 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
875 |
+
*/
|
876 |
+
public function getDefaultApiAttributes()
|
877 |
+
{
|
878 |
+
$padding = $this->getPadding();
|
879 |
+
$tab = $padding;
|
880 |
+
$eol = $this->getEol();
|
881 |
+
$entity = $this->getEntity();
|
882 |
+
$content = $padding.'protected $_defaultAttributeList = array('.$eol;
|
883 |
+
$parents = $entity->getRelatedEntities(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD);
|
884 |
+
foreach ($parents as $parent) {
|
885 |
+
$content .= $padding.$tab."'".$parent->getNameSingular(true).'_id'."', ".$eol;
|
886 |
+
}
|
887 |
+
foreach ($entity->getAttributes() as $attribute) {
|
888 |
+
$content .= $padding.$tab."'".$attribute->getCode()."'".', '.$eol;
|
889 |
+
}
|
890 |
+
$simulated = $entity->getSimulatedAttributes(null, false);
|
891 |
+
foreach ($simulated as $attr) {
|
892 |
+
$content .= $padding.$tab."'".$attr->getCode()."'".', '.$eol;
|
893 |
+
}
|
894 |
+
$content .= $padding.$tab."'created_at', ".$eol;
|
895 |
+
$content .= $padding.$tab."'updated_at', ".$eol;
|
896 |
+
$content .= $padding.');'.$eol;
|
897 |
+
return $content;
|
898 |
+
}
|
899 |
+
|
900 |
+
/**
|
901 |
+
* get add all attributes to collection
|
902 |
+
*
|
903 |
+
* @access public
|
904 |
+
* @return string
|
905 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
906 |
+
*/
|
907 |
+
public function getAllAttributesToCollection()
|
908 |
+
{
|
909 |
+
return '->addAttributeToSelect(\'*\')';
|
910 |
+
}
|
911 |
+
|
912 |
+
/**
|
913 |
+
* get load store id statement
|
914 |
+
*
|
915 |
+
* @access public
|
916 |
+
* @return string
|
917 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
918 |
+
*/
|
919 |
+
public function getLoadStoreId()
|
920 |
+
{
|
921 |
+
return '->setStoreId(Mage::app()->getStore()->getId())';
|
922 |
+
}
|
923 |
+
|
924 |
+
/**
|
925 |
+
* get rest collection cleanup
|
926 |
+
*
|
927 |
+
* @access public
|
928 |
+
* @return string
|
929 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
930 |
+
*/
|
931 |
+
public function getRestCollectionCleanup()
|
932 |
+
{
|
933 |
+
return '';
|
934 |
+
}
|
935 |
+
|
936 |
+
/**
|
937 |
+
* get rest collection store id
|
938 |
+
*
|
939 |
+
* @access public
|
940 |
+
* @return string
|
941 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
942 |
+
*/
|
943 |
+
public function getRestCollectionStoreId()
|
944 |
+
{
|
945 |
+
return $this->getEol().$this->getPadding(2).'$collection->setStoreId($this->_getStore()->getId());';
|
946 |
+
}
|
947 |
+
|
948 |
+
/**
|
949 |
+
* get default attribute values
|
950 |
+
*
|
951 |
+
* @access public
|
952 |
+
* @return string
|
953 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
954 |
+
*/
|
955 |
+
public function getDefaultAttributeValues()
|
956 |
+
{
|
957 |
+
return '';
|
958 |
+
}
|
959 |
+
|
960 |
+
/**
|
961 |
+
* get additional to option array select
|
962 |
+
*
|
963 |
+
* @access public
|
964 |
+
* @return string
|
965 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
966 |
+
*/
|
967 |
+
public function getToOptionArraySelect()
|
968 |
+
{
|
969 |
+
return '->addAttributeToSelect(\''.$this->getEntity()->getNameAttributeCode().'\')';
|
970 |
+
}
|
971 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Entity/Type/Flat.php
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* flat entity type
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Entity_Type_Flat
|
26 |
-
|
27 |
-
|
28 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* flat entity type
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Entity_Type_Flat extends Ultimate_ModuleCreator_Model_Entity_Type_Abstract
|
26 |
+
{
|
27 |
+
|
28 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Module.php
CHANGED
@@ -1,1915 +1,2326 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* @method string getFilenameId()
|
20 |
-
* @method string getMenuParent()
|
21 |
-
* @method Ultimate_ModuleCreator_Model_Module setRss()
|
22 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasFile()
|
23 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasImage()
|
24 |
-
* @method Ultimate_ModuleCreator_Model_Module setAddSeo()
|
25 |
-
* @method Ultimate_ModuleCreator_Model_Module setWidget()
|
26 |
-
* @method Ultimate_ModuleCreator_Model_Module setCreateFrontend()
|
27 |
-
* @method Ultimate_ModuleCreator_Model_Module setCanCreateRouter()
|
28 |
-
* @method Ultimate_ModuleCreator_Model_Module setCreateList()
|
29 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasTree()
|
30 |
-
* @method Ultimate_ModuleCreator_Model_Module setEditor()
|
31 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasConfigDefaults()
|
32 |
-
* @method Ultimate_ModuleCreator_Model_Module setLinkProduct()
|
33 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasObserver()
|
34 |
-
* @method Ultimate_ModuleCreator_Model_Module setLinkCategory()
|
35 |
-
* @method Ultimate_ModuleCreator_Model_Module setLinkCore()
|
36 |
-
* @method Ultimate_ModuleCreator_Model_Module setUrlRewrite()
|
37 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasEav()
|
38 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasFlat()
|
39 |
-
* @method Ultimate_ModuleCreator_Model_Module setApi()
|
40 |
-
* @method Ultimate_ModuleCreator_Model_Module setAllowComment()
|
41 |
-
* @method Ultimate_ModuleCreator_Model_Module setAllowCommentByStore()
|
42 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasCountry()
|
43 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasSeo()
|
44 |
-
* @method Ultimate_ModuleCreator_Model_Module setShowOnProduct()
|
45 |
-
* @method Ultimate_ModuleCreator_Model_Module setShowOnCategory()
|
46 |
-
* @method Ultimate_ModuleCreator_Model_Module setShowInCategoryMenu()
|
47 |
-
* @method Ultimate_ModuleCreator_Model_Module setSearch()
|
48 |
-
* @method Ultimate_ModuleCreator_Model_Module setHasCatalogAttribute()
|
49 |
-
* @method Ultimate_ModuleCreator_Model_Module setRest()
|
50 |
-
* @method string getModuleName()
|
51 |
-
* @method int getInstall()
|
52 |
-
* @method Ultimate_ModuleCreator_Model_Module setInstall()
|
53 |
-
* @method bool getHasEav()
|
54 |
-
* @method int getSortOrder()
|
55 |
-
* @method string getMenuText()
|
56 |
-
* @method string getCodepool()
|
57 |
-
* @method string getVersion()
|
58 |
-
* @method bool getCreateFrontend()
|
59 |
-
* @method bool getLinkProduct()
|
60 |
-
* @method bool getLinkCategory()
|
61 |
-
* @method bool getHasCatalogAttribute()
|
62 |
-
* @method bool getLinkCore()
|
63 |
-
* @method bool getShowInCategoryMenu()
|
64 |
-
*/
|
65 |
-
class Ultimate_ModuleCreator_Model_Module extends Ultimate_ModuleCreator_Model_Abstract
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
*
|
70 |
-
* @var string
|
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 |
-
* @var
|
106 |
-
*/
|
107 |
-
protected $
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
$this->
|
204 |
-
}
|
205 |
-
if ($entity->
|
206 |
-
$this->
|
207 |
-
}
|
208 |
-
if ($entity->
|
209 |
-
$this->
|
210 |
-
}
|
211 |
-
if ($entity->
|
212 |
-
$this->
|
213 |
-
}
|
214 |
-
if ($entity->
|
215 |
-
$this->
|
216 |
-
}
|
217 |
-
if ($entity->
|
218 |
-
$this->
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
if (
|
235 |
-
|
236 |
-
}
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
if ($
|
253 |
-
$
|
254 |
-
}
|
255 |
-
if (
|
256 |
-
$
|
257 |
-
}
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
$
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
*
|
286 |
-
* @
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
*
|
298 |
-
*
|
299 |
-
* @
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
$
|
319 |
-
foreach ($this->
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
*
|
338 |
-
* @
|
339 |
-
* @
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
$
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
*
|
351 |
-
* @
|
352 |
-
* @
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
$
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
*
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
*
|
576 |
-
* @
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
*
|
598 |
-
* @
|
599 |
-
* @
|
600 |
-
* @
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
*
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
*
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
$this->
|
803 |
-
}
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
*
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
$this->
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
}
|
1256 |
-
}
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
*
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
$
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
*
|
1390 |
-
*
|
1391 |
-
* @
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
*
|
1542 |
-
* @
|
1543 |
-
* @param
|
1544 |
-
* @
|
1545 |
-
* @
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
* this
|
1577 |
-
*
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
*
|
1589 |
-
*
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
$
|
1599 |
-
$
|
1600 |
-
|
1601 |
-
|
1602 |
-
}
|
1603 |
-
$
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
$
|
1623 |
-
$
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
$
|
1630 |
-
|
1631 |
-
}
|
1632 |
-
return $
|
1633 |
-
}
|
1634 |
-
|
1635 |
-
|
1636 |
-
*
|
1637 |
-
*
|
1638 |
-
* @
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
$
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
*
|
1762 |
-
* @
|
1763 |
-
* @
|
1764 |
-
* @
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
$
|
1770 |
-
$
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
*
|
1785 |
-
*
|
1786 |
-
* @
|
1787 |
-
* @
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
*
|
1799 |
-
* @
|
1800 |
-
* @
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
*
|
1838 |
-
* @
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
$
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* @method string getFilenameId()
|
20 |
+
* @method string getMenuParent()
|
21 |
+
* @method Ultimate_ModuleCreator_Model_Module setRss()
|
22 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasFile()
|
23 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasImage()
|
24 |
+
* @method Ultimate_ModuleCreator_Model_Module setAddSeo()
|
25 |
+
* @method Ultimate_ModuleCreator_Model_Module setWidget()
|
26 |
+
* @method Ultimate_ModuleCreator_Model_Module setCreateFrontend()
|
27 |
+
* @method Ultimate_ModuleCreator_Model_Module setCanCreateRouter()
|
28 |
+
* @method Ultimate_ModuleCreator_Model_Module setCreateList()
|
29 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasTree()
|
30 |
+
* @method Ultimate_ModuleCreator_Model_Module setEditor()
|
31 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasConfigDefaults()
|
32 |
+
* @method Ultimate_ModuleCreator_Model_Module setLinkProduct()
|
33 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasObserver()
|
34 |
+
* @method Ultimate_ModuleCreator_Model_Module setLinkCategory()
|
35 |
+
* @method Ultimate_ModuleCreator_Model_Module setLinkCore()
|
36 |
+
* @method Ultimate_ModuleCreator_Model_Module setUrlRewrite()
|
37 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasEav()
|
38 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasFlat()
|
39 |
+
* @method Ultimate_ModuleCreator_Model_Module setApi()
|
40 |
+
* @method Ultimate_ModuleCreator_Model_Module setAllowComment()
|
41 |
+
* @method Ultimate_ModuleCreator_Model_Module setAllowCommentByStore()
|
42 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasCountry()
|
43 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasSeo()
|
44 |
+
* @method Ultimate_ModuleCreator_Model_Module setShowOnProduct()
|
45 |
+
* @method Ultimate_ModuleCreator_Model_Module setShowOnCategory()
|
46 |
+
* @method Ultimate_ModuleCreator_Model_Module setShowInCategoryMenu()
|
47 |
+
* @method Ultimate_ModuleCreator_Model_Module setSearch()
|
48 |
+
* @method Ultimate_ModuleCreator_Model_Module setHasCatalogAttribute()
|
49 |
+
* @method Ultimate_ModuleCreator_Model_Module setRest()
|
50 |
+
* @method string getModuleName()
|
51 |
+
* @method int getInstall()
|
52 |
+
* @method Ultimate_ModuleCreator_Model_Module setInstall()
|
53 |
+
* @method bool getHasEav()
|
54 |
+
* @method int getSortOrder()
|
55 |
+
* @method string getMenuText()
|
56 |
+
* @method string getCodepool()
|
57 |
+
* @method string getVersion()
|
58 |
+
* @method bool getCreateFrontend()
|
59 |
+
* @method bool getLinkProduct()
|
60 |
+
* @method bool getLinkCategory()
|
61 |
+
* @method bool getHasCatalogAttribute()
|
62 |
+
* @method bool getLinkCore()
|
63 |
+
* @method bool getShowInCategoryMenu()
|
64 |
+
*/
|
65 |
+
class Ultimate_ModuleCreator_Model_Module extends Ultimate_ModuleCreator_Model_Abstract
|
66 |
+
{
|
67 |
+
/**
|
68 |
+
* enterprise version where Varien_Io_File was changed
|
69 |
+
*
|
70 |
+
* @var string
|
71 |
+
*/
|
72 |
+
const EFFIN_VERSION_ENTERPRISE = '1.13.1';
|
73 |
+
|
74 |
+
/**
|
75 |
+
* community version where Varien_Io_File was changed
|
76 |
+
*
|
77 |
+
* @var string
|
78 |
+
*/
|
79 |
+
const EFFIN_VERSION_COMMUNITY = '1.8.1';
|
80 |
+
|
81 |
+
/**
|
82 |
+
* entity code
|
83 |
+
*
|
84 |
+
* @var string
|
85 |
+
*/
|
86 |
+
protected $_entityCode = 'umc_module';
|
87 |
+
|
88 |
+
/**
|
89 |
+
* module entities
|
90 |
+
*
|
91 |
+
* @var array()
|
92 |
+
*/
|
93 |
+
protected $_entities = array();
|
94 |
+
|
95 |
+
/**
|
96 |
+
* module config
|
97 |
+
*
|
98 |
+
* @var mixed (null|Varien_Simplexml_Element)
|
99 |
+
*/
|
100 |
+
protected $_config = null;
|
101 |
+
|
102 |
+
/**
|
103 |
+
* entity relations
|
104 |
+
*
|
105 |
+
* @var array
|
106 |
+
*/
|
107 |
+
protected $_relations = array();
|
108 |
+
|
109 |
+
/**
|
110 |
+
* io member
|
111 |
+
*
|
112 |
+
* @var null|Varien_Io_File
|
113 |
+
*/
|
114 |
+
protected $_io = null;
|
115 |
+
|
116 |
+
/**
|
117 |
+
* error log
|
118 |
+
*
|
119 |
+
* @var array
|
120 |
+
*/
|
121 |
+
protected $_errors = array();
|
122 |
+
|
123 |
+
/**
|
124 |
+
* source folder
|
125 |
+
*
|
126 |
+
* @var null
|
127 |
+
*/
|
128 |
+
protected $_sourceFolder = null;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* placeholders
|
132 |
+
*
|
133 |
+
* @var null
|
134 |
+
*/
|
135 |
+
protected $_placeholders = null;
|
136 |
+
|
137 |
+
/**
|
138 |
+
* base placeholders
|
139 |
+
*
|
140 |
+
* @var array
|
141 |
+
*/
|
142 |
+
protected $_basePlaceholders = array();
|
143 |
+
|
144 |
+
/**
|
145 |
+
* generated files
|
146 |
+
*
|
147 |
+
* @var array
|
148 |
+
*/
|
149 |
+
protected $_files = array();
|
150 |
+
|
151 |
+
/**
|
152 |
+
* keep modman paths
|
153 |
+
*
|
154 |
+
* @var array
|
155 |
+
*/
|
156 |
+
protected $_modman = array();
|
157 |
+
|
158 |
+
/**
|
159 |
+
* add entity to module
|
160 |
+
*
|
161 |
+
* @access public
|
162 |
+
* @param Ultimate_ModuleCreator_Model_Entity $entity
|
163 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
164 |
+
* @throws Ultimate_ModuleCreator_Exception
|
165 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
166 |
+
*/
|
167 |
+
public function addEntity(Ultimate_ModuleCreator_Model_Entity $entity)
|
168 |
+
{
|
169 |
+
Mage::dispatchEvent(
|
170 |
+
'umc_module_add_entity_before',
|
171 |
+
array('entity'=>$entity, 'module'=>$this)
|
172 |
+
);
|
173 |
+
if (isset($this->_entities[$entity->getNameSingular()])) {
|
174 |
+
throw new Ultimate_ModuleCreator_Exception(
|
175 |
+
Mage::helper('modulecreator')->__(
|
176 |
+
'An entity with the code "%s" already exists',
|
177 |
+
$entity->getNameSingular()
|
178 |
+
)
|
179 |
+
);
|
180 |
+
}
|
181 |
+
$entity->setModule($this);
|
182 |
+
$entity->setIndex(count($this->_entities));
|
183 |
+
$position = 10 * (count($this->_entities));
|
184 |
+
$entity->setPosition($position);
|
185 |
+
$this->_entities[$entity->getNameSingular()] = $entity;
|
186 |
+
if ($entity->getRss()) {
|
187 |
+
$this->setRss(true);
|
188 |
+
}
|
189 |
+
if ($entity->getHasFile()) {
|
190 |
+
$this->setHasFile(true);
|
191 |
+
}
|
192 |
+
if ($entity->getHasImage()) {
|
193 |
+
$this->setHasImage(true);
|
194 |
+
}
|
195 |
+
if ($entity->getAddSeo()) {
|
196 |
+
$this->setAddSeo(true);
|
197 |
+
}
|
198 |
+
if ($entity->getWidget()) {
|
199 |
+
$this->setWidget(true);
|
200 |
+
}
|
201 |
+
if ($entity->getCreateFrontend()) {
|
202 |
+
$this->setCreateFrontend(true);
|
203 |
+
$this->setCanCreateRouter(true);
|
204 |
+
}
|
205 |
+
if ($entity->getCreateList()) {
|
206 |
+
$this->setCreateList(true);
|
207 |
+
}
|
208 |
+
if ($entity->getIsTree()) {
|
209 |
+
$this->setHasTree(true);
|
210 |
+
}
|
211 |
+
if ($entity->getEditor()) {
|
212 |
+
$this->setEditor(true);
|
213 |
+
}
|
214 |
+
if ($entity->getHasConfigDefaults()) {
|
215 |
+
$this->setHasConfigDefaults(true);
|
216 |
+
}
|
217 |
+
if ($entity->getLinkProduct()) {
|
218 |
+
$this->setLinkProduct(true);
|
219 |
+
$this->setHasObserver(true);
|
220 |
+
}
|
221 |
+
if ($entity->getLinkCategory()) {
|
222 |
+
$this->setLinkCategory(true);
|
223 |
+
$this->setHasObserver(true);
|
224 |
+
}
|
225 |
+
if ($entity->getLinkCore()) {
|
226 |
+
$this->setLinkCore(true);
|
227 |
+
}
|
228 |
+
if ($entity->getUrlRewrite()) {
|
229 |
+
$this->setUrlRewrite(true);
|
230 |
+
}
|
231 |
+
if ($entity->getIsEav()) {
|
232 |
+
$this->setHasEav(true);
|
233 |
+
}
|
234 |
+
if ($entity->getIsFlat()) {
|
235 |
+
$this->setHasFlat(true);
|
236 |
+
}
|
237 |
+
if ($entity->getApi()) {
|
238 |
+
$this->setApi(true);
|
239 |
+
}
|
240 |
+
if ($entity->getAllowComment()) {
|
241 |
+
$this->setAllowComment(true);
|
242 |
+
}
|
243 |
+
if ($entity->getAllowCommentByStore()) {
|
244 |
+
$this->setAllowCommentByStore(true);
|
245 |
+
}
|
246 |
+
if ($entity->getHasCountry()) {
|
247 |
+
$this->setHasCountry(true);
|
248 |
+
}
|
249 |
+
if ($entity->getAddSeo()) {
|
250 |
+
$this->setHasSeo(true);
|
251 |
+
}
|
252 |
+
if ($entity->getCanCreateListBlock()) {
|
253 |
+
$this->setCreateFrontend(true);
|
254 |
+
}
|
255 |
+
if ($entity->getShowOnProduct()) {
|
256 |
+
$this->setShowOnProduct(true);
|
257 |
+
}
|
258 |
+
if ($entity->getShowOnCategory()) {
|
259 |
+
$this->setShowOnCategory(true);
|
260 |
+
}
|
261 |
+
if ($entity->getShowInCategoryMenu()) {
|
262 |
+
$this->setShowInCategoryMenu(true);
|
263 |
+
}
|
264 |
+
if ($entity->getSearch()) {
|
265 |
+
$this->setSearch(true);
|
266 |
+
}
|
267 |
+
if ($entity->getProductAttribute() ||$entity->getCategoryAttribute()) {
|
268 |
+
$this->setHasCatalogAttribute(true);
|
269 |
+
}
|
270 |
+
if ($entity->getRest()) {
|
271 |
+
$this->setRest(true);
|
272 |
+
}
|
273 |
+
Mage::dispatchEvent(
|
274 |
+
'umc_module_add_entity_after',
|
275 |
+
array('entity'=>$entity, 'module'=>$this)
|
276 |
+
);
|
277 |
+
return $this;
|
278 |
+
}
|
279 |
+
|
280 |
+
/**
|
281 |
+
* get a module entity
|
282 |
+
*
|
283 |
+
* @access public
|
284 |
+
* @param string $code
|
285 |
+
* @return mixed(Ultimate_ModuleCreator_Model_Entity|null)
|
286 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
287 |
+
*/
|
288 |
+
public function getEntity($code)
|
289 |
+
{
|
290 |
+
if (isset($this->_entities[$code])) {
|
291 |
+
return $this->_entities[$code];
|
292 |
+
}
|
293 |
+
return null;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* module to xml
|
298 |
+
*
|
299 |
+
* @access public
|
300 |
+
* @param array $arrAttributes
|
301 |
+
* @param string $rootName
|
302 |
+
* @param bool $addOpenTag
|
303 |
+
* @param bool $addCdata
|
304 |
+
* @return string
|
305 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
306 |
+
*/
|
307 |
+
public function toXml(array $arrAttributes = array(), $rootName = 'module', $addOpenTag=false, $addCdata=false)
|
308 |
+
{
|
309 |
+
$xml = '';
|
310 |
+
$eol = $this->getEol();
|
311 |
+
if ($addOpenTag) {
|
312 |
+
$xml.= '<?xml version="1.0" encoding="UTF-8"?>'.$eol;
|
313 |
+
}
|
314 |
+
if (!empty($rootName)) {
|
315 |
+
$xml.= '<'.$rootName.'>'.$eol;
|
316 |
+
}
|
317 |
+
$xml .= parent::toXml($this->getXmlAttributes(), '', false, $addCdata);
|
318 |
+
$xml .= '<entities>'.$eol;
|
319 |
+
foreach ($this->getEntities() as $entity) {
|
320 |
+
$xml .= $entity->toXml(array(), 'entity', false, $addCdata);
|
321 |
+
}
|
322 |
+
$xml .= '</entities>'.$eol;
|
323 |
+
$xml .= '<relations>'.$eol;
|
324 |
+
foreach ($this->getRelations() as $relation) {
|
325 |
+
$xml .= $relation->toXml(array(), '', false, $addCdata);
|
326 |
+
}
|
327 |
+
$xml .= '</relations>'.$eol;
|
328 |
+
if (!empty($rootName)) {
|
329 |
+
$xml.= '</'.$rootName.'>'.$eol;
|
330 |
+
}
|
331 |
+
return $xml;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**
|
335 |
+
* get the module entities
|
336 |
+
*
|
337 |
+
* @access public
|
338 |
+
* @return Ultimate_ModuleCreator_Model_Entity[]
|
339 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
340 |
+
*/
|
341 |
+
public function getEntities()
|
342 |
+
{
|
343 |
+
$this->_prepareEntities();
|
344 |
+
return $this->_entities;
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* prepare the entities before saving
|
349 |
+
*
|
350 |
+
* @access protected
|
351 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
352 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
353 |
+
*/
|
354 |
+
protected function _prepareEntities()
|
355 |
+
{
|
356 |
+
Mage::dispatchEvent('umc_module_prepare_entities', array('module'=>$this));
|
357 |
+
return $this;
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* add relation to module
|
362 |
+
*
|
363 |
+
* @access public
|
364 |
+
* @param Ultimate_ModuleCreator_Model_Relation $relation
|
365 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
366 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
367 |
+
*/
|
368 |
+
public function addRelation(Ultimate_ModuleCreator_Model_Relation $relation)
|
369 |
+
{
|
370 |
+
Mage::dispatchEvent(
|
371 |
+
'umc_module_add_relation_before',
|
372 |
+
array('relation'=>$relation, 'module'=>$this)
|
373 |
+
);
|
374 |
+
$this->_relations[] = $relation;
|
375 |
+
Mage::dispatchEvent(
|
376 |
+
'umc_module_add_relation_after',
|
377 |
+
array('relation'=>$relation, 'module'=>$this)
|
378 |
+
);
|
379 |
+
return $this;
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* get module relations
|
384 |
+
*
|
385 |
+
* @access public
|
386 |
+
* @param mixed $type
|
387 |
+
* @return Ultimate_ModuleCreator_Model_Relation[]
|
388 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
389 |
+
*/
|
390 |
+
public function getRelations($type = null)
|
391 |
+
{
|
392 |
+
if (is_null($type)) {
|
393 |
+
return $this->_relations;
|
394 |
+
}
|
395 |
+
$relations = array();
|
396 |
+
foreach ($this->_relations as $relation) {
|
397 |
+
/** @var Ultimate_ModuleCreator_Model_Relation $relation */
|
398 |
+
if ($relation->getType() == $type) {
|
399 |
+
$relations[] = $relation;
|
400 |
+
}
|
401 |
+
}
|
402 |
+
return $relations;
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* get the extensions xml path
|
407 |
+
*
|
408 |
+
* @access public
|
409 |
+
* @return string
|
410 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
411 |
+
*/
|
412 |
+
public function getXmlPath()
|
413 |
+
{
|
414 |
+
return $this->getHelper()->getLocalPackagesPath().
|
415 |
+
$this->getNamespace()."_".$this->getModuleName().'.xml';
|
416 |
+
}
|
417 |
+
|
418 |
+
/**
|
419 |
+
* save the module as xml
|
420 |
+
*
|
421 |
+
* @access public
|
422 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
423 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
424 |
+
*/
|
425 |
+
public function save()
|
426 |
+
{
|
427 |
+
$destination = $this->getXmlPath();
|
428 |
+
$xml = $this->toXml(array(), 'module', true, true);
|
429 |
+
$this->_writeFile($destination, $xml);
|
430 |
+
return $this;
|
431 |
+
}
|
432 |
+
|
433 |
+
/**
|
434 |
+
* validate the module
|
435 |
+
*
|
436 |
+
* @access public
|
437 |
+
* @return array
|
438 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
439 |
+
*/
|
440 |
+
public function validate()
|
441 |
+
{
|
442 |
+
$config = $this->getHelper()->getConfig();
|
443 |
+
$settings = $config->getNode('forms/settings/fieldsets');
|
444 |
+
foreach ($settings->fieldset as $set) {
|
445 |
+
foreach ($set->fields->children() as $key => $values) {
|
446 |
+
$v = $this->getData($key);
|
447 |
+
if ((string)$values->required == 1 && (!$this->hasData($key) || $v === "")) {
|
448 |
+
$this->_addError(
|
449 |
+
Mage::helper("modulecreator")->__('This is a required field.'),
|
450 |
+
'settings_'.$key
|
451 |
+
);
|
452 |
+
}
|
453 |
+
}
|
454 |
+
}
|
455 |
+
//validate namespace
|
456 |
+
if (strtolower($this->getNamespace()) == 'mage') {
|
457 |
+
$this->_addError(
|
458 |
+
Mage::helper('modulecreator')->__("You shouldn't use the namespace Mage. Be Creative"),
|
459 |
+
'settings_namespace'
|
460 |
+
);
|
461 |
+
}
|
462 |
+
//validate module name
|
463 |
+
$routers = Mage::getConfig()->getNode('frontend/routers');
|
464 |
+
$moduleName = $this->getModuleName();
|
465 |
+
$lower = strtolower($moduleName);
|
466 |
+
$extension = $this->getExtensionName();
|
467 |
+
if ($routers->$lower) {
|
468 |
+
if ((string)$routers->$lower->args->module != $extension) {
|
469 |
+
$this->_addError(
|
470 |
+
Mage::helper('modulecreator')->__(
|
471 |
+
'You cannot use the module name %s',
|
472 |
+
$this->getModuleName()
|
473 |
+
),
|
474 |
+
'settings_module_name'
|
475 |
+
);
|
476 |
+
}
|
477 |
+
}
|
478 |
+
//validate front key
|
479 |
+
foreach ((array)$routers as $router) {
|
480 |
+
if ((string)$router->args->frontName == $this->getFrontKey() &&
|
481 |
+
$router->args->module != $extension) {
|
482 |
+
$this->_addError(
|
483 |
+
Mage::helper('modulecreator')->__(
|
484 |
+
'You cannot use the front key %s. It is used by the module %s',
|
485 |
+
$this->getFrontKey(),
|
486 |
+
(string)$router->args->module
|
487 |
+
),
|
488 |
+
'settings_front_key'
|
489 |
+
);
|
490 |
+
break;
|
491 |
+
}
|
492 |
+
}
|
493 |
+
//validate entity count
|
494 |
+
if (count($this->getEntities()) == 0) {
|
495 |
+
$this->_addError(Mage::helper('modulecreator')->__('Add at least an entity'));
|
496 |
+
} else {
|
497 |
+
//validate entities
|
498 |
+
foreach ($this->getEntities() as $entity) {
|
499 |
+
$entityCode = $entity->getNameSingular(true);
|
500 |
+
if (in_array($entityCode, $this->getRestrictedEntityNames())) {
|
501 |
+
$this->_addError(
|
502 |
+
Mage::helper('modulecreator')->__(
|
503 |
+
'The entity code "%s" is restricted',
|
504 |
+
$entityCode
|
505 |
+
),
|
506 |
+
'entity_'.$entity->getIndex().'_name_singular'
|
507 |
+
);
|
508 |
+
}
|
509 |
+
if (count($entity->getAttributes()) == 0) {
|
510 |
+
$this->_addError(
|
511 |
+
Mage::helper('modulecreator')->__(
|
512 |
+
'The entity "%s" must have at least one attribute.',
|
513 |
+
$entity->getLabelSingular()
|
514 |
+
)
|
515 |
+
);
|
516 |
+
} else {
|
517 |
+
//validate name attribute
|
518 |
+
if (is_null($entity->getNameAttribute())) {
|
519 |
+
$this->_addError(
|
520 |
+
Mage::helper('modulecreator')->__(
|
521 |
+
'The entity "%s" must have an attribute that behaves as a name.',
|
522 |
+
$entity->getLabelSingular()
|
523 |
+
)
|
524 |
+
);
|
525 |
+
}
|
526 |
+
$restrictedAttributes = $this->getRestrictedAttributeCodes();
|
527 |
+
//validate attributes
|
528 |
+
foreach ($entity->getAttributes() as $attribute) {
|
529 |
+
$code = $attribute->getCode();
|
530 |
+
if (isset($restrictedAttributes[$code])) {
|
531 |
+
//presume "not guilty"
|
532 |
+
$valid = true;
|
533 |
+
if (!isset($restrictedAttributes[$code]->depend_entity)) {//if general restriction.
|
534 |
+
$valid = false;
|
535 |
+
} else {//if depends on entity setting.
|
536 |
+
foreach ((array)$restrictedAttributes[$code]->depend_entity as $prop=>$value) {
|
537 |
+
if ($entity->getDataUsingMethod($prop) == $value) {
|
538 |
+
//"found guilty"
|
539 |
+
$valid = false;
|
540 |
+
break;
|
541 |
+
}
|
542 |
+
}
|
543 |
+
}
|
544 |
+
if (!$valid) {
|
545 |
+
$this->_addError(
|
546 |
+
$restrictedAttributes[$code]->message,
|
547 |
+
'attribute_'.$entity->getIndex().'_'.$attribute->getIndex().'_code'
|
548 |
+
);
|
549 |
+
}
|
550 |
+
}
|
551 |
+
//validate attributes against getters ("getData", "getCollection", ,....)
|
552 |
+
$methodCodes = $this->getMethodAttributeCodes();
|
553 |
+
if (in_array($code, $methodCodes)) {
|
554 |
+
$method = $method = str_replace(' ', '', ucwords(str_replace('_', ' ', $code)));
|
555 |
+
$this->_addError(
|
556 |
+
Mage::helper('modulecreator')->__('Attribute code %s is restricted because a method similar to "set%s()" or "get%s()" exists in parent model class', $code, $method, $method),
|
557 |
+
'attribute_'.$entity->getIndex().'_'.$attribute->getIndex().'_code'
|
558 |
+
);
|
559 |
+
}
|
560 |
+
}
|
561 |
+
}
|
562 |
+
}
|
563 |
+
}
|
564 |
+
|
565 |
+
return $this->_errors;
|
566 |
+
}
|
567 |
+
|
568 |
+
/**
|
569 |
+
* add an error to the error list
|
570 |
+
*
|
571 |
+
* @access protected
|
572 |
+
* @param $message
|
573 |
+
* @param null $attribute
|
574 |
+
* @param string $separator
|
575 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
576 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
577 |
+
*/
|
578 |
+
protected function _addError($message, $attribute = null, $separator = '<br />')
|
579 |
+
{
|
580 |
+
if (empty($attribute)) {
|
581 |
+
$this->_errors[''][] = $message;
|
582 |
+
} else {
|
583 |
+
if (!isset($this->_errors[$attribute])) {
|
584 |
+
$this->_errors[$attribute] = '';
|
585 |
+
} else {
|
586 |
+
$this->_errors[$attribute] .= $separator;
|
587 |
+
}
|
588 |
+
$this->_errors[$attribute] .= $message;
|
589 |
+
}
|
590 |
+
return $this;
|
591 |
+
}
|
592 |
+
|
593 |
+
/**
|
594 |
+
* write a file
|
595 |
+
*
|
596 |
+
* @access protected
|
597 |
+
* @param string $destinationFile
|
598 |
+
* @param string $contents
|
599 |
+
* @throws Exception
|
600 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
601 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
602 |
+
*/
|
603 |
+
protected function _writeFile($destinationFile, $contents)
|
604 |
+
{
|
605 |
+
try {
|
606 |
+
$io = $this->getIo();
|
607 |
+
$io->mkdir(dirname($destinationFile));
|
608 |
+
/**
|
609 |
+
* Varien_Io_File has changed in CE 1.8.1 / EE 1.13.1 A LOT
|
610 |
+
*/
|
611 |
+
if (version_compare(Mage::getVersion(), $this->getEffinVersion(), '<')) {
|
612 |
+
$io->write($destinationFile, $contents, 0777);
|
613 |
+
} else {
|
614 |
+
$io->filePutContent($destinationFile, $contents);
|
615 |
+
}
|
616 |
+
} catch (Exception $e) {
|
617 |
+
if ($e->getCode() != 0) {
|
618 |
+
throw $e;
|
619 |
+
}
|
620 |
+
}
|
621 |
+
return $this;
|
622 |
+
}
|
623 |
+
|
624 |
+
/**
|
625 |
+
* get the version for which the io writer has changed
|
626 |
+
*
|
627 |
+
* @access public
|
628 |
+
* @return string
|
629 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
630 |
+
*/
|
631 |
+
public function getEffinVersion()
|
632 |
+
{
|
633 |
+
if (Mage::getEdition() == Mage::EDITION_ENTERPRISE) {
|
634 |
+
return self::EFFIN_VERSION_ENTERPRISE;
|
635 |
+
}
|
636 |
+
return self::EFFIN_VERSION_COMMUNITY;
|
637 |
+
}
|
638 |
+
|
639 |
+
/**
|
640 |
+
* get the IO - class instance
|
641 |
+
*
|
642 |
+
* @access public
|
643 |
+
* @return Varien_Io_File
|
644 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
645 |
+
*/
|
646 |
+
public function getIo()
|
647 |
+
{
|
648 |
+
if (!$this->_io) {
|
649 |
+
$this->_io = new Varien_Io_File();
|
650 |
+
$this->_io->setAllowCreateFolders(true);
|
651 |
+
}
|
652 |
+
return $this->_io;
|
653 |
+
}
|
654 |
+
|
655 |
+
/**
|
656 |
+
* get module relations as json
|
657 |
+
*
|
658 |
+
* @access public
|
659 |
+
* @return string
|
660 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
661 |
+
*/
|
662 |
+
public function getRelationsAsJson()
|
663 |
+
{
|
664 |
+
$json = array();
|
665 |
+
$relations = $this->getRelations();
|
666 |
+
foreach ($relations as $relation) {
|
667 |
+
$entities = $relation->getEntities();
|
668 |
+
$json[$entities[0]->getIndex().'_'.$entities[1]->getIndex()] = $relation->getType();
|
669 |
+
}
|
670 |
+
return json_encode($json);
|
671 |
+
}
|
672 |
+
|
673 |
+
/**
|
674 |
+
* get the extension name
|
675 |
+
*
|
676 |
+
* @param bool $lower
|
677 |
+
* @return string
|
678 |
+
* @access public
|
679 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
680 |
+
*/
|
681 |
+
public function getExtensionName($lower = false)
|
682 |
+
{
|
683 |
+
$name = $this->getNamespace().'_'.$this->getModuleName();
|
684 |
+
if ($lower) {
|
685 |
+
$name = strtolower($name);
|
686 |
+
}
|
687 |
+
return $name;
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* get the restricted entity name
|
692 |
+
*
|
693 |
+
* @access public
|
694 |
+
* @return array
|
695 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
696 |
+
*/
|
697 |
+
public function getRestrictedEntityNames()
|
698 |
+
{
|
699 |
+
return $this->getDataSetDefault(
|
700 |
+
'restricted_entity_names',
|
701 |
+
array_keys(
|
702 |
+
(array)$this->getHelper()->getConfig()->getNode('restricted/entity')
|
703 |
+
)
|
704 |
+
);
|
705 |
+
}
|
706 |
+
|
707 |
+
/**
|
708 |
+
* get the restricted attribute codes
|
709 |
+
*
|
710 |
+
* @access public
|
711 |
+
* @return array
|
712 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
713 |
+
*/
|
714 |
+
public function getRestrictedAttributeCodes()
|
715 |
+
{
|
716 |
+
return $this->getDataSetDefault(
|
717 |
+
'restricted_attribute_codes',
|
718 |
+
(array)$this->getHelper()->getConfig()->getNode('restricted/attribute')
|
719 |
+
);
|
720 |
+
}
|
721 |
+
|
722 |
+
/**
|
723 |
+
* get the restricted attribute codes because of the method names
|
724 |
+
*
|
725 |
+
* @access public
|
726 |
+
* @return array
|
727 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
728 |
+
*/
|
729 |
+
public function getMethodAttributeCodes()
|
730 |
+
{
|
731 |
+
if (!$this->hasData('method_attribute_codes')) {
|
732 |
+
$attributes = array();
|
733 |
+
$methods = get_class_methods('Mage_Catalog_Model_Abstract');
|
734 |
+
$start = array('get', 'set', 'has', 'uns');
|
735 |
+
foreach ($methods as $method) {
|
736 |
+
if (in_array(substr($method, 0, 3), $start)) {
|
737 |
+
$attribute = strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", substr($method, 3)));
|
738 |
+
$attributes[$attribute] = 1;
|
739 |
+
}
|
740 |
+
}
|
741 |
+
$this->setData('method_attribute_codes', array_keys($attributes));
|
742 |
+
}
|
743 |
+
return $this->getData('method_attribute_codes');
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* build the module
|
748 |
+
*
|
749 |
+
* @access public
|
750 |
+
* @return array
|
751 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
752 |
+
*/
|
753 |
+
public function buildModule()
|
754 |
+
{
|
755 |
+
$config = $this->getConfig();
|
756 |
+
$files = $config->getNode('files');
|
757 |
+
$messages = array();
|
758 |
+
foreach ((array)$files as $file) {
|
759 |
+
if ($file->scope == 'disabled') {
|
760 |
+
continue;
|
761 |
+
}
|
762 |
+
$this->_createFile($file);
|
763 |
+
}
|
764 |
+
if ($this->getInstall()) {
|
765 |
+
$existingFiles = $this->_checkExistingFiles();
|
766 |
+
if (count($existingFiles) > 0) {
|
767 |
+
$this->setInstall(false);
|
768 |
+
$messages[] = Mage::helper('modulecreator')->__(
|
769 |
+
'The following files already exist. They were NOT overwritten. The extension was not installed. You can download it from the list of extensions and install it manually: %s',
|
770 |
+
implode('<br />', $existingFiles)
|
771 |
+
);
|
772 |
+
}
|
773 |
+
}
|
774 |
+
$this->_writeFiles();
|
775 |
+
if (!$this->getInstall()) {
|
776 |
+
$contents = array();
|
777 |
+
foreach ($this->_files as $filename=>$file) {
|
778 |
+
$contents[] = $this->getRelativeBasePath().$filename;
|
779 |
+
}
|
780 |
+
/** @var Ultimate_ModuleCreator_Model_Writer $_writer */
|
781 |
+
$_writer = Mage::getModel('modulecreator/writer', $contents);
|
782 |
+
$_writer->setPathPrefix('var'.DS.'modulecreator'.DS.$this->getExtensionName().DS);
|
783 |
+
$_writer->setNamePackage(Mage::getBaseDir('var').DS.'modulecreator'.DS.$this->getExtensionName());
|
784 |
+
$_writer->composePackage()->archivePackage();
|
785 |
+
$this->_io->rmdir($this->getBasePath(), true);
|
786 |
+
}
|
787 |
+
return $messages;
|
788 |
+
}
|
789 |
+
|
790 |
+
/**
|
791 |
+
* write files to disk
|
792 |
+
*
|
793 |
+
* @access protected
|
794 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
795 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
796 |
+
*/
|
797 |
+
protected function _writeFiles()
|
798 |
+
{
|
799 |
+
$basePath = $this->getBasePath();
|
800 |
+
foreach ($this->_files as $name=>$file) {
|
801 |
+
$destinationFile = $basePath.$name;
|
802 |
+
$this->_writeFile($destinationFile, $file);
|
803 |
+
}
|
804 |
+
$this->_writeLog();
|
805 |
+
$this->_writeUninstall();
|
806 |
+
$this->_writeModman();
|
807 |
+
return $this;
|
808 |
+
}
|
809 |
+
|
810 |
+
/**
|
811 |
+
* write log with generated files
|
812 |
+
*
|
813 |
+
* can be used for uninstall
|
814 |
+
* @access protected
|
815 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
816 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
817 |
+
*/
|
818 |
+
protected function _writeLog()
|
819 |
+
{
|
820 |
+
$filesToWrite = array_keys($this->_files);
|
821 |
+
asort($filesToWrite);
|
822 |
+
$filesToWrite = array_values($filesToWrite);
|
823 |
+
$text = implode($this->getEol(), $filesToWrite);
|
824 |
+
$this->_writeFile($this->getLogPath(), $text);
|
825 |
+
return $this;
|
826 |
+
}
|
827 |
+
|
828 |
+
/**
|
829 |
+
* write sql uninstall script
|
830 |
+
*
|
831 |
+
* @access protected
|
832 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
833 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
834 |
+
*/
|
835 |
+
protected function _writeUninstall()
|
836 |
+
{
|
837 |
+
$lines = array();
|
838 |
+
$module = $this->getPlaceholder('{{module}}');
|
839 |
+
$namespace = $this->getNamespace(true);
|
840 |
+
$lines[] = '-- add table prefix if you have one';
|
841 |
+
foreach ($this->getRelations(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING) as $relation) {
|
842 |
+
$entities = $relation->getEntities();
|
843 |
+
$tableName = $namespace.'_'.$module.'_'.
|
844 |
+
$entities[0]->getPlaceholders('{{entity}}').'_'.
|
845 |
+
$entities[1]->getPlaceholders('{{entity}}');
|
846 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
847 |
+
}
|
848 |
+
foreach ($this->getEntities() as $entity) {
|
849 |
+
if ($entity->getIsEav()) {
|
850 |
+
$entityTypeCode = $namespace.'_'.$this->getLowerModuleName().'_'.$entity->getPlaceholders('{{entity}}');
|
851 |
+
$lines[] = "DELETE"." FROM eav_attribute WHERE entity_type_id IN ".
|
852 |
+
"(SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = '{$entityTypeCode}');";
|
853 |
+
$lines[] = "DELETE"." FROM eav_entity_type WHERE entity_type_code = '{$entityTypeCode}';";
|
854 |
+
}
|
855 |
+
if ($entity->getProductAttribute()) {
|
856 |
+
$lines[] = "DELETE"." FROM eav_attribute WHERE attribute_code = '".
|
857 |
+
$entity->getProductAttributeCode().
|
858 |
+
"' AND entity_type_id IN
|
859 |
+
(SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product');";
|
860 |
+
}
|
861 |
+
if ($entity->getCategoryAttribute()) {
|
862 |
+
$lines[] = "DELETE"." FROM eav_attribute WHERE attribute_code = '".$entity->getCategoryAttributeCode().
|
863 |
+
"' AND entity_type_id IN (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category');";
|
864 |
+
}
|
865 |
+
if ($entity->getAllowCommentByStore()) {
|
866 |
+
$tableName = $namespace.'_'.$module.'_'.$entity->getPlaceholders('{{entity}}').'_comment_store';
|
867 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
868 |
+
}
|
869 |
+
if ($entity->getAllowComment()) {
|
870 |
+
$tableName = $namespace.'_'.$module.'_'.$entity->getPlaceholders('{{entity}}').'_comment';
|
871 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
872 |
+
}
|
873 |
+
if ($entity->getLinkProduct()) {
|
874 |
+
$tableName = $namespace.'_'.$module.'_'.$entity->getPlaceholders('{{entity}}').'_product';
|
875 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
876 |
+
}
|
877 |
+
if ($entity->getLinkCategory()) {
|
878 |
+
$tableName = $namespace.'_'.$module.'_'.$entity->getPlaceholders('{{entity}}').'_category';
|
879 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
880 |
+
}
|
881 |
+
if ($entity->getStore()) {
|
882 |
+
$tableName = $namespace.'_'.$module.'_'.$entity->getPlaceholders('{{entity}}').'_store';
|
883 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
884 |
+
}
|
885 |
+
if ($entity->getIsEav()) {
|
886 |
+
foreach (array('int', 'decimal','datetime', 'varchar', 'text') as $type) {
|
887 |
+
$tableName = $namespace.'_'.$module.'_'.$entity->getPlaceholders('{{entity}}').'_'.$type;
|
888 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
889 |
+
}
|
890 |
+
}
|
891 |
+
$tableName = $namespace.'_'.$module.'_'.$entity->getPlaceholders('{{entity}}');
|
892 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
893 |
+
}
|
894 |
+
if ($this->getHasEav()) {
|
895 |
+
$tableName = $namespace.'_'.$module.'_eav_attribute';
|
896 |
+
$lines[] = 'DROP'.' TABLE IF EXISTS '.$tableName.';';
|
897 |
+
}
|
898 |
+
$lines[] = "DELETE"." FROM core_resource WHERE code = '".$namespace.'_'.$module."_setup';";
|
899 |
+
$lines[] = "DELETE"." FROM core_config_data WHERE path like '".$namespace.'_'.$module."/%';";
|
900 |
+
$text = implode($this->getEol(), $lines);
|
901 |
+
$this->_writeFile($this->getUninstallPath(), $text);
|
902 |
+
return $this;
|
903 |
+
}
|
904 |
+
|
905 |
+
/**
|
906 |
+
* write the modman file
|
907 |
+
*
|
908 |
+
* @access protected
|
909 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
910 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
911 |
+
*/
|
912 |
+
protected function _writeModman()
|
913 |
+
{
|
914 |
+
$paths = array(
|
915 |
+
'app/etc/modules/'.$this->getNamespace().'_'.$this->getModuleName().'.xml',
|
916 |
+
'app/code/'.$this->getCodepool().'/'.$this->getNamespace().'_'.$this->getModuleName(),
|
917 |
+
'app/locale/en_US/'.$this->getNamespace().'_'.$this->getModuleName().'.csv',
|
918 |
+
'app/design/adminhtml/default/default/layout/'.$this->getNamespace(true).'_'.$this->getLowerModuleName().'.xml',
|
919 |
+
'app/design/adminhtml/default/default/template/'.$this->getNamespace(true).'_'.$this->getLowerModuleName()
|
920 |
+
);
|
921 |
+
if ($this->getCreateFrontend()) {
|
922 |
+
$paths[] = 'app/design/frontend/base/default/layout/'.$this->getNamespace(true).'_'.$this->getLowerModuleName().'.xml';
|
923 |
+
$paths[] = 'app/design/adminhtml/default/default/template/'.$this->getNamespace(true).'_'.$this->getLowerModuleName();
|
924 |
+
}
|
925 |
+
foreach ($this->getEntities() as $entity) {
|
926 |
+
if ($entity->getHasImage()) {
|
927 |
+
$paths[] = 'skin/frontend/base/default/images/placeholder/'.$entity->getNameSingular(true).'.jpg';
|
928 |
+
}
|
929 |
+
if ($entity->getIsTree()) {
|
930 |
+
$paths[] = 'skin/frontend/base/default/css/'.$this->getNamespace(true).'_'.$this->getLowerModuleName();
|
931 |
+
$paths[] = 'skin/frontend/base/default/images/'.$this->getNamespace(true).'_'.$this->getLowerModuleName();
|
932 |
+
$paths[] = 'skin/frontend/base/default/js/'.$this->getNamespace(true).'_'.$this->getLowerModuleName();
|
933 |
+
}
|
934 |
+
}
|
935 |
+
sort($paths);
|
936 |
+
$paths = array_unique($paths);
|
937 |
+
$text = '';
|
938 |
+
$eol = $this->getEol();
|
939 |
+
foreach ($paths as $path) {
|
940 |
+
$text .= $path . ' '.$path.$eol;
|
941 |
+
}
|
942 |
+
$this->_writeFile($this->getModmanPath(), $text);
|
943 |
+
return $this;
|
944 |
+
}
|
945 |
+
|
946 |
+
/**
|
947 |
+
* get path for modman file
|
948 |
+
*
|
949 |
+
* @access public
|
950 |
+
* @return string
|
951 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
952 |
+
*/
|
953 |
+
public function getModmanPath()
|
954 |
+
{
|
955 |
+
return $this->getHelper()->getLocalPackagesPath().$this->getExtensionName().'/modman';
|
956 |
+
}
|
957 |
+
|
958 |
+
/**
|
959 |
+
* check if some files already exist so it won't be overwritten
|
960 |
+
*
|
961 |
+
* @access protected
|
962 |
+
* @return array()
|
963 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
964 |
+
*/
|
965 |
+
protected function _checkExistingFiles()
|
966 |
+
{
|
967 |
+
$existingFiles = array();
|
968 |
+
$io = $this->getIo();
|
969 |
+
$basePath = $this->getBasePath();
|
970 |
+
foreach ($this->_files as $name=>$content) {
|
971 |
+
if ($io->fileExists($basePath.$name)) {
|
972 |
+
$existingFiles[] = $basePath.$name;
|
973 |
+
}
|
974 |
+
}
|
975 |
+
return $existingFiles;
|
976 |
+
}
|
977 |
+
|
978 |
+
/**
|
979 |
+
* get path for log file
|
980 |
+
*
|
981 |
+
* @access public
|
982 |
+
* @return string
|
983 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
984 |
+
*/
|
985 |
+
public function getLogPath()
|
986 |
+
{
|
987 |
+
return $this->getHelper()->getLocalPackagesPath().$this->getExtensionName().'/files.log';
|
988 |
+
}
|
989 |
+
|
990 |
+
/**
|
991 |
+
* get path for uninstall sql file
|
992 |
+
*
|
993 |
+
* @access public
|
994 |
+
* @return string
|
995 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
996 |
+
*/
|
997 |
+
public function getUninstallPath()
|
998 |
+
{
|
999 |
+
return $this->getHelper()->getLocalPackagesPath().$this->getExtensionName().'/uninstall.sql';
|
1000 |
+
}
|
1001 |
+
|
1002 |
+
/**
|
1003 |
+
* get module base path
|
1004 |
+
*
|
1005 |
+
* @access public
|
1006 |
+
* @return string
|
1007 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1008 |
+
*/
|
1009 |
+
public function getBasePath()
|
1010 |
+
{
|
1011 |
+
if (!$this->getInstall()) {
|
1012 |
+
return Mage::getBaseDir('var').DS.'modulecreator'.DS.$this->getExtensionName().DS;
|
1013 |
+
}
|
1014 |
+
return Mage::getBaseDir().DS;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
/**
|
1018 |
+
* get relative path ro the module
|
1019 |
+
*
|
1020 |
+
* @access public
|
1021 |
+
* @return string
|
1022 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1023 |
+
*/
|
1024 |
+
public function getRelativeBasePath()
|
1025 |
+
{
|
1026 |
+
$basePath = $this->getBasePath();
|
1027 |
+
$remove = Mage::getBaseDir().DS;
|
1028 |
+
$relativePath = substr($basePath, strlen($remove));
|
1029 |
+
return $relativePath;
|
1030 |
+
}
|
1031 |
+
|
1032 |
+
/**
|
1033 |
+
* get the module config
|
1034 |
+
*
|
1035 |
+
* @access public
|
1036 |
+
* @return Varien_Simplexml_Config
|
1037 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1038 |
+
*/
|
1039 |
+
public function getConfig()
|
1040 |
+
{
|
1041 |
+
if (is_null($this->_config)) {
|
1042 |
+
$this->_config = Mage::getConfig()->loadModulesConfiguration('umc_source.xml')->applyExtends();
|
1043 |
+
}
|
1044 |
+
return $this->_config;
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
/**
|
1048 |
+
* get contents of a file
|
1049 |
+
*
|
1050 |
+
* @access public
|
1051 |
+
* @param string $file
|
1052 |
+
* @return string
|
1053 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1054 |
+
*/
|
1055 |
+
public function getFileContents($file)
|
1056 |
+
{
|
1057 |
+
return file_get_contents($file);
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
/**
|
1061 |
+
* create a file
|
1062 |
+
*
|
1063 |
+
* @access protected
|
1064 |
+
* @param Varien_Simplexml_Element
|
1065 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
1066 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1067 |
+
*/
|
1068 |
+
protected function _createFile($config)
|
1069 |
+
{
|
1070 |
+
switch ($config->scope) {
|
1071 |
+
case 'entity' :
|
1072 |
+
$this->_buildEntityFile($config);
|
1073 |
+
break;
|
1074 |
+
case 'siblings':
|
1075 |
+
$this->_buildSiblingFile($config);
|
1076 |
+
break;
|
1077 |
+
case 'children' :
|
1078 |
+
$this->_buildChildrenFile($config);
|
1079 |
+
break;
|
1080 |
+
case 'attribute' :
|
1081 |
+
$this->_buildAttributeFile($config);
|
1082 |
+
break;
|
1083 |
+
case 'global':
|
1084 |
+
default:
|
1085 |
+
$this->_buildGlobalFile($config);
|
1086 |
+
break;
|
1087 |
+
}
|
1088 |
+
return $this;
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
/**
|
1092 |
+
* validate xml condition
|
1093 |
+
*
|
1094 |
+
* @access protected
|
1095 |
+
* @param Ultimate_ModuleCreator_Model_Abstract $entity
|
1096 |
+
* @param Mage_Core_Model_Config_Element $conditions
|
1097 |
+
* @param mixed $params
|
1098 |
+
* @return bool
|
1099 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1100 |
+
*/
|
1101 |
+
protected function _validateDepend(
|
1102 |
+
Ultimate_ModuleCreator_Model_Abstract $entity,
|
1103 |
+
Mage_Core_Model_Config_Element $conditions,
|
1104 |
+
$params = null
|
1105 |
+
) {
|
1106 |
+
if (!$conditions) {
|
1107 |
+
return true;
|
1108 |
+
}
|
1109 |
+
if (!is_array($conditions)) {
|
1110 |
+
$conditions = $conditions->asArray();
|
1111 |
+
}
|
1112 |
+
foreach ($conditions as $condition=>$value) {
|
1113 |
+
if (!$entity->getDataUsingMethod($condition, $params)) {
|
1114 |
+
return false;
|
1115 |
+
}
|
1116 |
+
}
|
1117 |
+
return true;
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
/**
|
1121 |
+
* create a file with global scope
|
1122 |
+
*
|
1123 |
+
* @access protected
|
1124 |
+
* @param Varien_Simplexml_Element
|
1125 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
1126 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1127 |
+
*/
|
1128 |
+
public function _buildGlobalFile($config)
|
1129 |
+
{
|
1130 |
+
$filetype = $config->filetype;
|
1131 |
+
$sourceFolder = $this->getSourceFolder().$this->_filterString((string)$config->source, $filetype);
|
1132 |
+
$destination = $this->_filterString((string)$config->destination, $filetype);
|
1133 |
+
$content = '';
|
1134 |
+
$depend = $config->depend;
|
1135 |
+
if (!$this->_validateDepend($this, $depend)) {
|
1136 |
+
return '';
|
1137 |
+
}
|
1138 |
+
if ($config->method) {
|
1139 |
+
$method = (string)$config->method;
|
1140 |
+
$content = $this->$method();
|
1141 |
+
} else {
|
1142 |
+
$code = $this->_sortCodeFiles((array)$config->code);
|
1143 |
+
foreach ($code as $file) {
|
1144 |
+
$sourceContent = $this->getFileContents($sourceFolder.(string)$file->name);
|
1145 |
+
$scope = (string)$file->scope;
|
1146 |
+
$depend = $file->depend;
|
1147 |
+
if ($scope == 'entity') {
|
1148 |
+
foreach ($this->getEntities() as $entity) {
|
1149 |
+
if ($this->_validateDepend($entity, $depend)) {
|
1150 |
+
$replace = $entity->getPlaceholders();
|
1151 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
} elseif ($scope == 'attribute') {
|
1155 |
+
$depend = $file->depend;
|
1156 |
+
/** @var Mage_Core_Model_Config_Element $dependType */
|
1157 |
+
$dependType = $file->depend_type;
|
1158 |
+
foreach ($this->getEntities() as $entity) {
|
1159 |
+
foreach ($entity->getAttributes() as $attribute) {
|
1160 |
+
$valid = $this->_validateDepend($attribute, $depend);
|
1161 |
+
$typeValid = true;
|
1162 |
+
if ($dependType) {
|
1163 |
+
$typeValid = false;
|
1164 |
+
foreach ($dependType->asArray() as $condition=>$value) {
|
1165 |
+
if ($attribute->getType() == $condition) {
|
1166 |
+
$typeValid = true;
|
1167 |
+
break;
|
1168 |
+
}
|
1169 |
+
}
|
1170 |
+
}
|
1171 |
+
if ($valid && $typeValid) {
|
1172 |
+
$replace = $entity->getPlaceholders();
|
1173 |
+
$attributeReplace = $attribute->getPlaceholders();
|
1174 |
+
$replace = array_merge($replace, $attributeReplace);
|
1175 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1176 |
+
}
|
1177 |
+
}
|
1178 |
+
}
|
1179 |
+
} elseif ($scope == 'siblings') {
|
1180 |
+
$relatedEntities = $this->getRelations(
|
1181 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1182 |
+
);
|
1183 |
+
foreach ($relatedEntities as $relation) {
|
1184 |
+
$entities = $relation->getEntities();
|
1185 |
+
$replaceEntity = $entities[0]->getPlaceholders();
|
1186 |
+
$replaceSibling = $entities[1]->getPlaceholdersAsSibling();
|
1187 |
+
$replace = array_merge($replaceEntity, $replaceSibling);
|
1188 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1189 |
+
}
|
1190 |
+
} elseif ($scope == 'siblings_both_tree') {
|
1191 |
+
$relatedEntities = $this->getRelations(
|
1192 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1193 |
+
);
|
1194 |
+
foreach ($relatedEntities as $relation) {
|
1195 |
+
$entities = $relation->getEntities();
|
1196 |
+
if ($entities[0]->getIsTree() || $entities[1]->getIsTree()) {
|
1197 |
+
if ($entities[0]->getIsTree()) {
|
1198 |
+
$tree = $entities[0];
|
1199 |
+
$sibling = $entities[1];
|
1200 |
+
} else {
|
1201 |
+
$tree = $entities[1];
|
1202 |
+
$sibling = $entities[0];
|
1203 |
+
}
|
1204 |
+
$replaceEntity = $tree->getPlaceholders();
|
1205 |
+
$replaceSibling = $sibling->getPlaceholdersAsSibling();
|
1206 |
+
$replace = array_merge($replaceEntity, $replaceSibling);
|
1207 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1208 |
+
}
|
1209 |
+
}
|
1210 |
+
} elseif ($scope == 'siblings_both_not_tree') {
|
1211 |
+
$relatedEntities = $this->getRelations(
|
1212 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1213 |
+
);
|
1214 |
+
foreach ($relatedEntities as $relation) {
|
1215 |
+
$entities = $relation->getEntities();
|
1216 |
+
if ($entities[0]->getIsTree() || $entities[1]->getIsTree()) {
|
1217 |
+
continue;
|
1218 |
+
}
|
1219 |
+
$replaceEntity = $entities[0]->getPlaceholders();
|
1220 |
+
$replaceSibling = $entities[1]->getPlaceholdersAsSibling();
|
1221 |
+
$replace = array_merge($replaceEntity, $replaceSibling);
|
1222 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1223 |
+
|
1224 |
+
$replaceEntity = $entities[1]->getPlaceholders();
|
1225 |
+
$replaceSibling = $entities[0]->getPlaceholdersAsSibling();
|
1226 |
+
$replace = array_merge($replaceEntity, $replaceSibling);
|
1227 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1228 |
+
}
|
1229 |
+
} elseif ($scope == 'children') {
|
1230 |
+
$relatedEntities = $this->getRelations(
|
1231 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD
|
1232 |
+
);
|
1233 |
+
foreach ($relatedEntities as $relation) {
|
1234 |
+
$entities = $relation->getEntities();
|
1235 |
+
$replaceEntity = $entities[0]->getPlaceholders();
|
1236 |
+
$replaceSibling = $entities[1]->getPlaceholdersAsSibling();
|
1237 |
+
$replace = array_merge($replaceEntity, $replaceSibling);
|
1238 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1239 |
+
}
|
1240 |
+
$relatedEntities = $this->getRelations(
|
1241 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_PARENT
|
1242 |
+
);
|
1243 |
+
foreach ($relatedEntities as $relation) {
|
1244 |
+
$entities = $relation->getEntities();
|
1245 |
+
$replaceEntity = $entities[1]->getPlaceholders();
|
1246 |
+
$replaceSibling = $entities[0]->getPlaceholdersAsSibling();
|
1247 |
+
$replace = array_merge($replaceEntity, $replaceSibling);
|
1248 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1249 |
+
}
|
1250 |
+
} else {
|
1251 |
+
if ($this->_validateDepend($this, $depend)) {
|
1252 |
+
$content .= $this->_filterString($sourceContent, $filetype);
|
1253 |
+
}
|
1254 |
+
}
|
1255 |
+
}
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
if ($config->after_build) {
|
1259 |
+
$function = (string)$config->after_build;
|
1260 |
+
$content = $this->$function($content);
|
1261 |
+
}
|
1262 |
+
|
1263 |
+
$content = $this->_filterString($content, $config->type);
|
1264 |
+
$this->_addFile($destination, $content);
|
1265 |
+
return $this;
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
/**
|
1269 |
+
* create a file with entity scope
|
1270 |
+
*
|
1271 |
+
* @access protected
|
1272 |
+
* @param Varien_Simplexml_Element
|
1273 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
1274 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1275 |
+
*/
|
1276 |
+
public function _buildEntityFile($config)
|
1277 |
+
{
|
1278 |
+
foreach ($this->getEntities() as $entity) {
|
1279 |
+
$filetype = $config->filetype;
|
1280 |
+
$sourceFolder = $this->getSourceFolder().$this->_filterString((string)$config->source, $filetype);
|
1281 |
+
$destinationFile = $this->_filterString(
|
1282 |
+
(string)$config->destination,
|
1283 |
+
$filetype,
|
1284 |
+
$entity->getPlaceholders(),
|
1285 |
+
true
|
1286 |
+
);
|
1287 |
+
$content = '';
|
1288 |
+
$depend = $config->depend;
|
1289 |
+
if (!$this->_validateDepend($entity, $depend)) {
|
1290 |
+
continue;
|
1291 |
+
}
|
1292 |
+
$code = $this->_sortCodeFiles((array)$config->code);
|
1293 |
+
foreach ($code as $file) {
|
1294 |
+
$sourceContent = $this->getFileContents($sourceFolder.(string)$file->name);
|
1295 |
+
$scope = (string)$file->scope;
|
1296 |
+
$depend = $file->depend;
|
1297 |
+
/** @var Mage_Core_Model_Config_Element $dependType */
|
1298 |
+
$dependType = $file->depend_type;
|
1299 |
+
if ($scope == 'attribute') {
|
1300 |
+
foreach ($entity->getAttributes() as $attribute) {
|
1301 |
+
$valid = $this->_validateDepend($attribute, $depend);
|
1302 |
+
$typeValid = true;
|
1303 |
+
if ($dependType) {
|
1304 |
+
$typeValid = false;
|
1305 |
+
foreach ($dependType->asArray() as $condition=>$value) {
|
1306 |
+
if ($attribute->getType() == $condition) {
|
1307 |
+
$typeValid = true;
|
1308 |
+
break;
|
1309 |
+
}
|
1310 |
+
}
|
1311 |
+
}
|
1312 |
+
if ($valid && $typeValid) {
|
1313 |
+
$replace = $entity->getPlaceholders();
|
1314 |
+
$attributeReplace = $attribute->getPlaceholders();
|
1315 |
+
$replace = array_merge($replace, $attributeReplace);
|
1316 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1317 |
+
}
|
1318 |
+
}
|
1319 |
+
} elseif ($scope == 'siblings') {
|
1320 |
+
$relatedEntities = $entity->getRelatedEntities(
|
1321 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1322 |
+
);
|
1323 |
+
foreach ($relatedEntities as $related) {
|
1324 |
+
if ($this->_validateDepend($entity, $depend)) {
|
1325 |
+
$placeholders = $entity->getPlaceholders();
|
1326 |
+
$replaceSibling = $related->getPlaceholdersAsSibling();
|
1327 |
+
$replace = array_merge($placeholders, $replaceSibling);
|
1328 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1329 |
+
}
|
1330 |
+
}
|
1331 |
+
} elseif ($scope == 'siblings_not_tree') {
|
1332 |
+
$relatedEntities = $entity->getRelatedEntities(
|
1333 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1334 |
+
);
|
1335 |
+
foreach ($relatedEntities as $related) {
|
1336 |
+
if ($related->getNotIsTree()) {
|
1337 |
+
$placeholders = $entity->getPlaceholders();
|
1338 |
+
$replaceSibling = $related->getPlaceholdersAsSibling();
|
1339 |
+
$replace = array_merge($placeholders, $replaceSibling);
|
1340 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1341 |
+
}
|
1342 |
+
}
|
1343 |
+
} elseif ($scope == 'siblings_tree') {
|
1344 |
+
$relatedEntities = $entity->getRelatedEntities(
|
1345 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING
|
1346 |
+
);
|
1347 |
+
foreach ($relatedEntities as $related) {
|
1348 |
+
if ($related->getIsTree()) {
|
1349 |
+
$placeholders = $entity->getPlaceholders();
|
1350 |
+
$replaceSibling = $related->getPlaceholdersAsSibling();
|
1351 |
+
$replace = array_merge($placeholders, $replaceSibling);
|
1352 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1353 |
+
}
|
1354 |
+
}
|
1355 |
+
} elseif ($scope == 'parents') {
|
1356 |
+
$relatedEntities = $entity->getRelatedEntities(
|
1357 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD
|
1358 |
+
);
|
1359 |
+
foreach ($relatedEntities as $related) {
|
1360 |
+
$placeholders = $entity->getPlaceholders();
|
1361 |
+
$replaceSibling = $related->getPlaceholdersAsSibling();
|
1362 |
+
$replace = array_merge($placeholders, $replaceSibling);
|
1363 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1364 |
+
}
|
1365 |
+
} elseif ($scope == 'children') {
|
1366 |
+
$relatedEntities = $entity->getRelatedEntities(
|
1367 |
+
Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_PARENT
|
1368 |
+
);
|
1369 |
+
foreach ($relatedEntities as $related) {
|
1370 |
+
$placeholders = $entity->getPlaceholders();
|
1371 |
+
$replaceSibling = $related->getPlaceholdersAsSibling();
|
1372 |
+
$replace = array_merge($placeholders, $replaceSibling);
|
1373 |
+
$content .= $this->_filterString($sourceContent, $filetype, $replace, true);
|
1374 |
+
}
|
1375 |
+
} elseif ($depend) {
|
1376 |
+
if ($this->_validateDepend($entity, $depend)) {
|
1377 |
+
$content .= $this->_filterString($sourceContent, $filetype, $entity->getPlaceholders(), true);
|
1378 |
+
}
|
1379 |
+
} else {
|
1380 |
+
$content .= $this->_filterString($sourceContent, $filetype, $entity->getPlaceholders(), true);
|
1381 |
+
}
|
1382 |
+
$this->_addFile($destinationFile, $content);
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
return $this;
|
1386 |
+
}
|
1387 |
+
|
1388 |
+
/**
|
1389 |
+
* generate files for sibling relations
|
1390 |
+
*
|
1391 |
+
* @access protected
|
1392 |
+
* @param $config
|
1393 |
+
* @return $this
|
1394 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1395 |
+
*/
|
1396 |
+
protected function _buildSiblingFile($config)
|
1397 |
+
{
|
1398 |
+
foreach ($this->getRelations(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING) as $relation) {
|
1399 |
+
$entities = $relation->getEntities();
|
1400 |
+
foreach ($entities as $index=>$entity) {
|
1401 |
+
$depend = $config->depend;
|
1402 |
+
if (!$this->_validateDepend($relation, $depend, $index)) {
|
1403 |
+
continue;
|
1404 |
+
}
|
1405 |
+
$placeholders = array_merge(
|
1406 |
+
$entities[$index]->getPlaceholders(),
|
1407 |
+
$entities[1 - $index]->getPlaceholdersAsSibling()
|
1408 |
+
);
|
1409 |
+
$filetype = $config->filetype;
|
1410 |
+
$sourceFolder = $this->getSourceFolder().
|
1411 |
+
$this->_filterString((string)$config->source, $filetype);
|
1412 |
+
$destinationFile = $this->_filterString(
|
1413 |
+
(string)$config->destination,
|
1414 |
+
$filetype,
|
1415 |
+
$placeholders,
|
1416 |
+
true
|
1417 |
+
);
|
1418 |
+
$content = '';
|
1419 |
+
$code = $this->_sortCodeFiles((array)$config->code);
|
1420 |
+
foreach ($code as $file) {
|
1421 |
+
$depend = $file->depend;
|
1422 |
+
if (!$this->_validateDepend($relation, $depend, $index)) {
|
1423 |
+
continue;
|
1424 |
+
}
|
1425 |
+
$sourceContent = $this->getFileContents($sourceFolder.(string)$file->name);
|
1426 |
+
$content .= $this->_filterString($sourceContent, $filetype, $placeholders, true);
|
1427 |
+
}
|
1428 |
+
$this->_addFile($destinationFile, $content);
|
1429 |
+
}
|
1430 |
+
}
|
1431 |
+
return $this;
|
1432 |
+
}
|
1433 |
+
|
1434 |
+
/**
|
1435 |
+
* create files for children relations
|
1436 |
+
*
|
1437 |
+
* @access protected
|
1438 |
+
* @param Varien_Simplexml_Element
|
1439 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
1440 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1441 |
+
*/
|
1442 |
+
protected function _buildChildrenFile($config)
|
1443 |
+
{
|
1444 |
+
foreach ($this->getRelations() as $relation) {
|
1445 |
+
$type = $relation->getType();
|
1446 |
+
$entities = $relation->getEntities();
|
1447 |
+
$parent = false;
|
1448 |
+
$child = false;
|
1449 |
+
if ($type == Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_PARENT) {
|
1450 |
+
$parent = $entities[0];
|
1451 |
+
$child = $entities[1];
|
1452 |
+
} elseif ($type == Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD) {
|
1453 |
+
$parent = $entities[1];
|
1454 |
+
$child = $entities[0];
|
1455 |
+
}
|
1456 |
+
if ($parent && $child) {
|
1457 |
+
$depend = $config->depend;
|
1458 |
+
if ($this->_validateDepend($relation, $depend)) {
|
1459 |
+
$placeholders = array_merge($parent->getPlaceholders(), $child->getPlaceholdersAsSibling());
|
1460 |
+
$filetype = $config->filetype;
|
1461 |
+
$sourceFolder = $this->getSourceFolder().
|
1462 |
+
$this->_filterString((string)$config->source, $filetype);
|
1463 |
+
$destinationFile = $this->_filterString(
|
1464 |
+
(string)$config->destination,
|
1465 |
+
$filetype,
|
1466 |
+
$placeholders,
|
1467 |
+
true
|
1468 |
+
);
|
1469 |
+
$content = '';
|
1470 |
+
$code = $this->_sortCodeFiles((array)$config->code);
|
1471 |
+
foreach ($code as $file) {
|
1472 |
+
$depend = $file->depend;
|
1473 |
+
if (!$this->_validateDepend($relation, $depend)) {
|
1474 |
+
continue;
|
1475 |
+
}
|
1476 |
+
$sourceContent = $this->getFileContents($sourceFolder.(string)$file->name);
|
1477 |
+
$content .= $this->_filterString($sourceContent, $filetype, $placeholders, true);
|
1478 |
+
}
|
1479 |
+
$this->_addFile($destinationFile, $content);
|
1480 |
+
}
|
1481 |
+
}
|
1482 |
+
}
|
1483 |
+
return $this;
|
1484 |
+
}
|
1485 |
+
|
1486 |
+
/**
|
1487 |
+
* build source file for an attribute
|
1488 |
+
*
|
1489 |
+
* @access public
|
1490 |
+
* @param $config
|
1491 |
+
* @return Ultimate_ModuleCreator_Model_Module
|
1492 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1493 |
+
*/
|
1494 |
+
protected function _buildAttributeFile($config)
|
1495 |
+
{
|
1496 |
+
foreach ($this->getEntities() as $entity) {
|
1497 |
+
foreach ($entity->getAttributes() as $attribute) {
|
1498 |
+
$filetype = $config->filetype;
|
1499 |
+
$sourceFolder = $this->getSourceFolder().$this->_filterString((string)$config->source, $filetype);
|
1500 |
+
$placeholders = array_merge($entity->getPlaceholders(), $attribute->getPlaceholders());
|
1501 |
+
$destinationFile = $this->_filterString((string)$config->destination, $filetype, $placeholders, true);
|
1502 |
+
$content = '';
|
1503 |
+
$depend = $config->depend;
|
1504 |
+
if (!$this->_validateDepend($attribute, $depend)) {
|
1505 |
+
continue;
|
1506 |
+
}
|
1507 |
+
$code = $this->_sortCodeFiles((array)$config->code);
|
1508 |
+
foreach ($code as $file) {
|
1509 |
+
$depend = $file->depend;
|
1510 |
+
if (!$this->_validateDepend($attribute, $depend)) {
|
1511 |
+
continue;
|
1512 |
+
}
|
1513 |
+
$sourceContent = $this->getFileContents($sourceFolder.(string)$file->name);
|
1514 |
+
$content .= $this->_filterString($sourceContent, $filetype, $placeholders, true);
|
1515 |
+
}
|
1516 |
+
$this->_addFile($destinationFile, $content);
|
1517 |
+
}
|
1518 |
+
}
|
1519 |
+
return $this;
|
1520 |
+
}
|
1521 |
+
|
1522 |
+
/**
|
1523 |
+
* get sample files source folder
|
1524 |
+
*
|
1525 |
+
* @access public
|
1526 |
+
* @return string
|
1527 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1528 |
+
*/
|
1529 |
+
public function getSourceFolder()
|
1530 |
+
{
|
1531 |
+
if (!isset($this->_sourceFolder)) {
|
1532 |
+
$this->_sourceFolder = Mage::getConfig()->getModuleDir('etc', 'Ultimate_ModuleCreator').DS.'source'.DS;
|
1533 |
+
}
|
1534 |
+
return $this->_sourceFolder;
|
1535 |
+
}
|
1536 |
+
|
1537 |
+
/**
|
1538 |
+
* filter placeholders
|
1539 |
+
*
|
1540 |
+
* @access protected
|
1541 |
+
* @param string $string
|
1542 |
+
* @param string $fileType
|
1543 |
+
* @param mixed (null|array()) $replaceArray
|
1544 |
+
* @param bool $mergeReplace
|
1545 |
+
* @param bool $forLicence
|
1546 |
+
* @return string
|
1547 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1548 |
+
*/
|
1549 |
+
protected function _filterString(
|
1550 |
+
$string,
|
1551 |
+
$fileType,
|
1552 |
+
$replaceArray = null,
|
1553 |
+
$mergeReplace = false,
|
1554 |
+
$forLicence = false
|
1555 |
+
) {
|
1556 |
+
$replace = $this->getPlaceholder();
|
1557 |
+
if (!$forLicence) {
|
1558 |
+
$replace['{{License}}'] = $this->getLicenseText($fileType);
|
1559 |
+
}
|
1560 |
+
if (!is_null($replaceArray)) {
|
1561 |
+
if ($mergeReplace) {
|
1562 |
+
$replace = array_merge($replace, $replaceArray);
|
1563 |
+
} else {
|
1564 |
+
$replace = $replaceArray;
|
1565 |
+
}
|
1566 |
+
}
|
1567 |
+
return str_replace(array_keys($replace), array_values($replace), $string);
|
1568 |
+
}
|
1569 |
+
|
1570 |
+
/**
|
1571 |
+
* add file to create list
|
1572 |
+
*
|
1573 |
+
* @access protected
|
1574 |
+
* @param $destinationFile
|
1575 |
+
* @param $content
|
1576 |
+
* @return $this
|
1577 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1578 |
+
*/
|
1579 |
+
protected function _addFile($destinationFile, $content)
|
1580 |
+
{
|
1581 |
+
if (trim($content)) {
|
1582 |
+
$this->_files[$destinationFile] = $content;
|
1583 |
+
}
|
1584 |
+
return $this;
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
/**
|
1588 |
+
* get text for licence
|
1589 |
+
*
|
1590 |
+
* @access public
|
1591 |
+
* @param string $fileType
|
1592 |
+
* @return string
|
1593 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1594 |
+
*/
|
1595 |
+
public function getLicenseText($fileType)
|
1596 |
+
{
|
1597 |
+
if (!$this->getData('processed_license_'.$fileType)) {
|
1598 |
+
$eol = $this->getEol();
|
1599 |
+
$license = trim($this->getData('license'));
|
1600 |
+
if (!$license) {
|
1601 |
+
return '';
|
1602 |
+
}
|
1603 |
+
while (strpos($license, '*/') !== false) {
|
1604 |
+
$license = str_replace('*/', '', $license);
|
1605 |
+
}
|
1606 |
+
while (strpos($license, '/*') !== false) {
|
1607 |
+
$license = str_replace('/*', '', $license);
|
1608 |
+
}
|
1609 |
+
while (strpos($license, '<!--') !== false) {
|
1610 |
+
$license = str_replace('<!--', '', $license);
|
1611 |
+
}
|
1612 |
+
while (strpos($license, '-->') !== false) {
|
1613 |
+
$license = str_replace('-->', '', $license);
|
1614 |
+
}
|
1615 |
+
$lines = explode("\n", $license);
|
1616 |
+
$top = '';
|
1617 |
+
$footer = '';
|
1618 |
+
if ($fileType == 'xml') {
|
1619 |
+
$top = '<!--'.$eol;
|
1620 |
+
$footer = $eol.'-->';
|
1621 |
+
}
|
1622 |
+
$processed = $top.'/**'.$eol;
|
1623 |
+
foreach ($lines as $line) {
|
1624 |
+
$processed .= ' * '.$line.$eol;
|
1625 |
+
}
|
1626 |
+
$processed .= ' */'.$footer;
|
1627 |
+
$this->setData(
|
1628 |
+
'processed_license_'.$fileType,
|
1629 |
+
$this->_filterString($processed, $fileType, array(), true, true)
|
1630 |
+
);
|
1631 |
+
}
|
1632 |
+
return $this->getData('processed_license_'.$fileType);
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
/**
|
1636 |
+
* get all placeholders
|
1637 |
+
*
|
1638 |
+
* @access public
|
1639 |
+
* @param null $param
|
1640 |
+
* @return array|null|string
|
1641 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1642 |
+
*/
|
1643 |
+
public function getPlaceholder($param = null)
|
1644 |
+
{
|
1645 |
+
if (is_null($this->_placeholders)) {
|
1646 |
+
$this->_placeholders = array(
|
1647 |
+
'{{DS}}' => DS,
|
1648 |
+
'{{namespace}}' => $this->getNamespace(true),
|
1649 |
+
'{{sort_order}}' => (int)$this->getSortOrder(),
|
1650 |
+
'{{module}}' => strtolower($this->getModuleName()),
|
1651 |
+
'{{Namespace}}' => $this->getNamespace(),
|
1652 |
+
'{{Module}}' => $this->getModuleName(),
|
1653 |
+
'{{NAMESPACE}}' => strtoupper($this->getNamespace()),
|
1654 |
+
'{{MODULE}}' => strtoupper($this->getModuleName()),
|
1655 |
+
'{{qwertyuiop}}' => $this->getQwertyuiop(),
|
1656 |
+
'{{qwertyuiopp}}' => $this->getQwertyuiopp(),
|
1657 |
+
'{{Y}}' => date('Y'),
|
1658 |
+
'{{entity_default_config}}' => $this->getEntityDefaultConfig(),
|
1659 |
+
'{{module_menu}}' => $this->getMenuText(),
|
1660 |
+
'{{codepool}}' => $this->getCodepool(),
|
1661 |
+
'{{version}}' => $this->getVersion(),
|
1662 |
+
'{{menuItemsXml}}' => $this->getMenuItemsXml(),
|
1663 |
+
'{{menuAcl}}' => $this->getMenuAcl(),
|
1664 |
+
'{{ModuleFolder}}' => ucfirst(strtolower($this->getModuleName())),
|
1665 |
+
'{{ResourceSetup}}' => $this->getResourceSetupModel(),
|
1666 |
+
'{{depends}}' => $this->getDepends(),
|
1667 |
+
'{{productViewLayout}}' => $this->getProductViewLayout(),
|
1668 |
+
'{{categoryViewLayout}}' => $this->getCategoryViewLayout(),
|
1669 |
+
'{{defaultLayoutHandle}}' => $this->getFrontendDefaultLayoutHandle(),
|
1670 |
+
'{{categoryMenuEvent}}' => $this->getCategoryMenuEvent(),
|
1671 |
+
'{{customerCommentLinks}}' => $this->getCustomerCommentLinks(),
|
1672 |
+
'{{frontKey}}' => $this->getFrontKey(),
|
1673 |
+
'{{SystemTabName}}' => $this->getSystemTabName(),
|
1674 |
+
'{{systemTabPosition}}' => $this->getSystemTabPosition(),
|
1675 |
+
'{{RestResourceGroupsChildren}}' => $this->getRestResourceGroupsChildren(),
|
1676 |
+
'{{RestResources}}' => $this->getRestResources(),
|
1677 |
+
'{{eavOptionsDefaults}}' => $this->getEavOptionsDefaults()
|
1678 |
+
);
|
1679 |
+
}
|
1680 |
+
if (is_null($param)) {
|
1681 |
+
return $this->_placeholders;
|
1682 |
+
}
|
1683 |
+
if (isset($this->_placeholders[$param])) {
|
1684 |
+
return $this->_placeholders[$param];
|
1685 |
+
}
|
1686 |
+
return '';
|
1687 |
+
}
|
1688 |
+
|
1689 |
+
/**
|
1690 |
+
* get config.xml default section
|
1691 |
+
*
|
1692 |
+
* @access public
|
1693 |
+
* @return string
|
1694 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1695 |
+
*/
|
1696 |
+
public function getEntityDefaultConfig()
|
1697 |
+
{
|
1698 |
+
$eol = $this->getEol();
|
1699 |
+
$text = '';
|
1700 |
+
if ($this->getCreateFrontend()) {
|
1701 |
+
$text = $eol.$this->getPadding().'<default>'.$eol;
|
1702 |
+
$text.= $this->getPadding(2).'<'.strtolower($this->getModuleName()).'>'.$eol;
|
1703 |
+
foreach ($this->getEntities() as $entity) {
|
1704 |
+
$text .= $this->getPadding(3).$entity->getDefaultConfig();
|
1705 |
+
}
|
1706 |
+
$text.= $this->getPadding(2).'</'.strtolower($this->getModuleName()).'>'.$eol;
|
1707 |
+
$text.= $this->getPadding().'</default>';
|
1708 |
+
}
|
1709 |
+
return $text;
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
/**
|
1713 |
+
* check if module related to catalog
|
1714 |
+
*
|
1715 |
+
* @access public
|
1716 |
+
* @return bool
|
1717 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1718 |
+
*/
|
1719 |
+
public function getHasCatalogRelation()
|
1720 |
+
{
|
1721 |
+
return $this->getLinkProduct() || $this->getLinkCategory();
|
1722 |
+
}
|
1723 |
+
|
1724 |
+
/**
|
1725 |
+
* get menu for entities
|
1726 |
+
*
|
1727 |
+
* @access public
|
1728 |
+
* @param $padding
|
1729 |
+
* @return string
|
1730 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1731 |
+
*/
|
1732 |
+
public function getEntityMenu($padding)
|
1733 |
+
{
|
1734 |
+
$text = '';
|
1735 |
+
foreach ($this->getEntities() as $entity) {
|
1736 |
+
$text .= $entity->getMenu($padding);
|
1737 |
+
}
|
1738 |
+
return $text;
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
/**
|
1742 |
+
* get menu ACL for entities
|
1743 |
+
*
|
1744 |
+
* @access public
|
1745 |
+
* @param $padding
|
1746 |
+
* @return string
|
1747 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1748 |
+
*/
|
1749 |
+
public function getEntityMenuAcl($padding)
|
1750 |
+
{
|
1751 |
+
$text = '';
|
1752 |
+
foreach ($this->getEntities() as $entity) {
|
1753 |
+
$text .= $entity->getMenuAcl($padding);
|
1754 |
+
}
|
1755 |
+
return $text;
|
1756 |
+
}
|
1757 |
+
|
1758 |
+
/**
|
1759 |
+
* sort source code files
|
1760 |
+
*
|
1761 |
+
* @access protected
|
1762 |
+
* @param $files
|
1763 |
+
* @param string $sortField
|
1764 |
+
* @return array
|
1765 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1766 |
+
*/
|
1767 |
+
protected function _sortCodeFiles($files, $sortField = 'sort_order')
|
1768 |
+
{
|
1769 |
+
$sorted = array();
|
1770 |
+
foreach ($files as $values) {
|
1771 |
+
$sorted[(int)$values->$sortField][] = $values;
|
1772 |
+
}
|
1773 |
+
ksort($sorted);
|
1774 |
+
$return = array();
|
1775 |
+
foreach ($sorted as $values) {
|
1776 |
+
foreach ($values as $file) {
|
1777 |
+
$return[] = $file;
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
return $return;
|
1781 |
+
}
|
1782 |
+
|
1783 |
+
/**
|
1784 |
+
* get module name in lower case
|
1785 |
+
*
|
1786 |
+
* @access public
|
1787 |
+
* @return string
|
1788 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1789 |
+
*/
|
1790 |
+
public function getLowerModuleName()
|
1791 |
+
{
|
1792 |
+
return strtolower($this->getModuleName());
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
/**
|
1796 |
+
* get menu items xml
|
1797 |
+
*
|
1798 |
+
* @access public
|
1799 |
+
* @return string
|
1800 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1801 |
+
*/
|
1802 |
+
public function getMenuItemsXml()
|
1803 |
+
{
|
1804 |
+
$xml = '';
|
1805 |
+
$parts = array();
|
1806 |
+
$padding = 2;
|
1807 |
+
$namespace = $this->getNamespace(true);
|
1808 |
+
$eol = $this->getEol();
|
1809 |
+
if ($this->getMenuParent()) {
|
1810 |
+
$parts = explode('/', $this->getMenuParent());
|
1811 |
+
}
|
1812 |
+
foreach ($parts as $part) {
|
1813 |
+
$xml .= $this->getPadding($padding++).'<'.$part.'>'.$eol;
|
1814 |
+
$xml .= $this->getPadding($padding++).'<children>'.$eol;
|
1815 |
+
}
|
1816 |
+
$xml .= $this->getPadding($padding++).'<'.$namespace.'_'.$this->getLowerModuleName().
|
1817 |
+
' translate="title" module="'.$namespace.'_'.$this->getLowerModuleName().'">'.$eol;
|
1818 |
+
$xml .= $this->getPadding($padding).'<title>'.$this->getMenuText().'</title>'.$eol;
|
1819 |
+
$xml .= $this->getPadding($padding).'<sort_order>'.$this->getSortOrder().'</sort_order>'.$eol;
|
1820 |
+
$xml .= $this->getPadding($padding++).'<children>'.$eol;
|
1821 |
+
$xml .= $this->getEntityMenu($padding);
|
1822 |
+
$xml .= $this->getPadding(--$padding).'</children>'.$eol;
|
1823 |
+
$xml .= $this->getPadding(--$padding).'</'.$namespace.'_'.$this->getLowerModuleName().'>';
|
1824 |
+
|
1825 |
+
$parts = array_reverse($parts);
|
1826 |
+
foreach ($parts as $part) {
|
1827 |
+
$xml .= $this->getPadding(--$padding).'</children>'.$eol;
|
1828 |
+
$xml .= $this->getPadding(--$padding).'</'.$part.'>'.$eol;
|
1829 |
+
}
|
1830 |
+
return $xml;
|
1831 |
+
}
|
1832 |
+
|
1833 |
+
/**
|
1834 |
+
* get menu ACL
|
1835 |
+
*
|
1836 |
+
* @access public
|
1837 |
+
* @return string
|
1838 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1839 |
+
*/
|
1840 |
+
public function getMenuAcl()
|
1841 |
+
{
|
1842 |
+
$xml = '';
|
1843 |
+
$parts = array();
|
1844 |
+
$padding = 5;
|
1845 |
+
$eol = $this->getEol();
|
1846 |
+
$namespace = $this->getNamespace(true);
|
1847 |
+
if ($this->getMenuParent()) {
|
1848 |
+
$parts = explode('/', $this->getMenuParent());
|
1849 |
+
}
|
1850 |
+
foreach ($parts as $part) {
|
1851 |
+
$xml .= $this->getPadding($padding++).'<'.$part.'>'.$eol;
|
1852 |
+
$xml .= $this->getPadding($padding++).'<children>'.$eol;
|
1853 |
+
}
|
1854 |
+
$xml .= $this->getPadding($padding++).'<'.$namespace.'_'.
|
1855 |
+
$this->getLowerModuleName().' translate="title" module="'.
|
1856 |
+
$namespace.'_'.$this->getLowerModuleName().'">'.$eol;
|
1857 |
+
$xml .= $this->getPadding($padding).'<title>'.$this->getMenuText().'</title>'.$eol;
|
1858 |
+
$xml .= $this->getPadding($padding++).'<children>'.$eol;
|
1859 |
+
$xml .= $this->getEntityMenuAcl($padding);
|
1860 |
+
$xml .= $this->getPadding(--$padding).'</children>'.$eol;
|
1861 |
+
$xml .= $this->getPadding(--$padding).'</'.$namespace.'_'.$this->getLowerModuleName().'>';
|
1862 |
+
|
1863 |
+
$parts = array_reverse($parts);
|
1864 |
+
foreach ($parts as $part) {
|
1865 |
+
$xml .= $this->getPadding(--$padding).'</children>'.$eol;
|
1866 |
+
$xml .= $this->getPadding(--$padding).'</'.$part.'>'.$eol;
|
1867 |
+
}
|
1868 |
+
return $xml;
|
1869 |
+
}
|
1870 |
+
|
1871 |
+
/**
|
1872 |
+
* get resource setup base class
|
1873 |
+
*
|
1874 |
+
* @access public
|
1875 |
+
* @return string
|
1876 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1877 |
+
*/
|
1878 |
+
public function getResourceSetupModel()
|
1879 |
+
{
|
1880 |
+
if ($this->getHasCatalogRelation() || $this->getHasEav() || $this->getHasCatalogAttribute()) {
|
1881 |
+
return 'Mage_Catalog_Model_Resource_Setup';
|
1882 |
+
}
|
1883 |
+
return 'Mage_Core_Model_Resource_Setup';
|
1884 |
+
}
|
1885 |
+
|
1886 |
+
/**
|
1887 |
+
* sort the translation file
|
1888 |
+
*
|
1889 |
+
* @access protected
|
1890 |
+
* @param string $content
|
1891 |
+
* @return string
|
1892 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1893 |
+
*/
|
1894 |
+
protected function _sortTranslationFile($content)
|
1895 |
+
{
|
1896 |
+
$lines = explode($this->getEol(), $content);
|
1897 |
+
$distinct = array();
|
1898 |
+
foreach ($lines as $line) {
|
1899 |
+
if (trim($line)) {
|
1900 |
+
$distinct[$line] = 1;
|
1901 |
+
}
|
1902 |
+
}
|
1903 |
+
//remove blank line
|
1904 |
+
if (isset($distinct['"",""'])) {
|
1905 |
+
unset($distinct['"",""']);
|
1906 |
+
}
|
1907 |
+
ksort($distinct);
|
1908 |
+
$content = implode($this->getEol(), array_keys($distinct));
|
1909 |
+
return $content;
|
1910 |
+
}
|
1911 |
+
|
1912 |
+
/**
|
1913 |
+
* this does nothing
|
1914 |
+
* don't look through the code - go away
|
1915 |
+
* I said it does nothing
|
1916 |
+
*
|
1917 |
+
* @access public
|
1918 |
+
* @return string
|
1919 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1920 |
+
*/
|
1921 |
+
public function getQwertyuiop()
|
1922 |
+
{
|
1923 |
+
return $this->getHelper()->getQwertyuiop();
|
1924 |
+
}
|
1925 |
+
|
1926 |
+
/**
|
1927 |
+
* this also does nothing
|
1928 |
+
* don't look here either
|
1929 |
+
*
|
1930 |
+
* @access public
|
1931 |
+
* @return string
|
1932 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1933 |
+
*/
|
1934 |
+
public function getQwertyuiopp()
|
1935 |
+
{
|
1936 |
+
return $this->getHelper()->getQwertyuiopp();
|
1937 |
+
}
|
1938 |
+
|
1939 |
+
/**
|
1940 |
+
* check module dependency
|
1941 |
+
*
|
1942 |
+
* @access public
|
1943 |
+
* @return array
|
1944 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1945 |
+
*/
|
1946 |
+
public function getDepends()
|
1947 |
+
{
|
1948 |
+
if (!$this->hasData('_depends')) {
|
1949 |
+
$dependency = array('<Mage_Core />'=>1);
|
1950 |
+
if ($this->getLinkCore() || $this->getHasEav()) {
|
1951 |
+
$dependency['<Mage_Catalog />'] = 1;
|
1952 |
+
}
|
1953 |
+
$eol = $this->getEol();
|
1954 |
+
$padding = $this->getPadding(4);
|
1955 |
+
$depends = '';
|
1956 |
+
foreach ($dependency as $key=>$value) {
|
1957 |
+
$depends = $padding.$key.$eol;
|
1958 |
+
}
|
1959 |
+
$this->setData('_depends', $depends);
|
1960 |
+
}
|
1961 |
+
return $this->getData('_depends');
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
/**
|
1965 |
+
* get layout for product view page
|
1966 |
+
*
|
1967 |
+
* @access public
|
1968 |
+
* @return string
|
1969 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
1970 |
+
*/
|
1971 |
+
public function getProductViewLayout()
|
1972 |
+
{
|
1973 |
+
$content = '';
|
1974 |
+
$padding = $this->getPadding(3);
|
1975 |
+
$eol = $this->getEol();
|
1976 |
+
$tab = $this->getPadding();
|
1977 |
+
$ns = $this->getNamespace(true);
|
1978 |
+
$module = $this->getLowerModuleName();
|
1979 |
+
foreach ($this->getEntities() as $entity) {
|
1980 |
+
$name = strtolower($entity->getNameSingular());
|
1981 |
+
$names = strtolower($entity->getNamePlural());
|
1982 |
+
$label = $entity->getLabelPlural();
|
1983 |
+
if ($entity->getShowOnProduct()) {
|
1984 |
+
$content .= $padding.
|
1985 |
+
'<block type="'.$ns.'_'.$module.'/catalog_product_list_'.
|
1986 |
+
$name.'" name="product.info.'.$names.'" as="product_'.$names.
|
1987 |
+
'" template="'.$ns.'_'.$module.'/catalog/product/list/'.$name.'.phtml">'.$eol;
|
1988 |
+
$content .= $padding.$tab.
|
1989 |
+
'<action method="addToParentGroup"><group>detailed_info</group></action>'.$eol;
|
1990 |
+
$content .= $padding.$tab.
|
1991 |
+
'<action method="setTitle" translate="value" module="'.
|
1992 |
+
$ns.'_'.$module.'"><value>'.$label.'</value></action>'.$eol;
|
1993 |
+
$content .= $padding.'</block>'.$eol;
|
1994 |
+
}
|
1995 |
+
}
|
1996 |
+
return $content;
|
1997 |
+
}
|
1998 |
+
/**
|
1999 |
+
* get layout for category view page
|
2000 |
+
*
|
2001 |
+
* @access public
|
2002 |
+
* @return string
|
2003 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2004 |
+
*/
|
2005 |
+
public function getCategoryViewLayout()
|
2006 |
+
{
|
2007 |
+
$content = '';
|
2008 |
+
$padding = $this->getPadding(3);
|
2009 |
+
$eol = $this->getEol();
|
2010 |
+
$ns = $this->getNamespace(true);
|
2011 |
+
$module = $this->getLowerModuleName();
|
2012 |
+
foreach ($this->getEntities() as $entity) {
|
2013 |
+
$name = $entity->getNameSingular(true);
|
2014 |
+
$names = $entity->getNamePlural(true);
|
2015 |
+
if ($entity->getShowOnCategory()) {
|
2016 |
+
$content .= $padding.'<block type="'.
|
2017 |
+
$ns.'_'.$module.'/catalog_category_list_'.
|
2018 |
+
$name.'" name="category.info.'.$names.
|
2019 |
+
'" as="category_'.$names.'" template="'.$ns.'_'.$module.
|
2020 |
+
'/catalog/category/list/'.$name.'.phtml" after="-" />'.$eol;
|
2021 |
+
}
|
2022 |
+
}
|
2023 |
+
return $content;
|
2024 |
+
}
|
2025 |
+
|
2026 |
+
/**
|
2027 |
+
* get default layout handle
|
2028 |
+
*
|
2029 |
+
* @access public
|
2030 |
+
* @return string
|
2031 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2032 |
+
*/
|
2033 |
+
public function getFrontendDefaultLayoutHandle()
|
2034 |
+
{
|
2035 |
+
$padding = $this->getPadding(1);
|
2036 |
+
$tab = $this->getPadding();
|
2037 |
+
$eol = $this->getEol();
|
2038 |
+
/** @var Ultimate_ModuleCreator_Model_Entity[] $top */
|
2039 |
+
$top = array();
|
2040 |
+
/** @var Ultimate_ModuleCreator_Model_Entity[] $footer */
|
2041 |
+
$footer = array();
|
2042 |
+
$content = $eol.$padding;
|
2043 |
+
$namespace = $this->getNamespace(true);
|
2044 |
+
$tree = false;
|
2045 |
+
if ($this->getCreateFrontend()) {
|
2046 |
+
foreach ($this->getEntities() as $entity) {
|
2047 |
+
if ($entity->getCreateList()) {
|
2048 |
+
if ($entity->getListMenu() == Ultimate_ModuleCreator_Model_Source_Entity_Menu::TOP_LINKS) {
|
2049 |
+
$top[] = $entity;
|
2050 |
+
} elseif (
|
2051 |
+
$entity->getListMenu() == Ultimate_ModuleCreator_Model_Source_Entity_Menu::FOOTER_LINKS
|
2052 |
+
) {
|
2053 |
+
$footer[] = $entity;
|
2054 |
+
}
|
2055 |
+
if ($entity->getIsTree()) {
|
2056 |
+
$tree = true;
|
2057 |
+
}
|
2058 |
+
}
|
2059 |
+
}
|
2060 |
+
}
|
2061 |
+
if (count($top) > 0 || count($footer) > 0 || $tree) {
|
2062 |
+
$content .= '<default>'.$eol;
|
2063 |
+
if ($tree) {
|
2064 |
+
$content .= $padding.'<reference name="head">'.$eol;
|
2065 |
+
$content .= $padding.$tab.'<action method="addCss"><js>css/'.
|
2066 |
+
$this->getNamespace(true).'_'.$this->getLowerModuleName().
|
2067 |
+
'/tree.css</js></action>'.$eol;
|
2068 |
+
$content .= $padding.'</reference>'.$eol;
|
2069 |
+
}
|
2070 |
+
if (count($top) > 0) {
|
2071 |
+
$content .= $padding.$tab.'<reference name="top.links">'.$eol;
|
2072 |
+
$position = 120;
|
2073 |
+
foreach ($top as $entity) {
|
2074 |
+
$content .= $padding.$tab.$tab.'<action method="addLink" translate="label title" module="'.
|
2075 |
+
$namespace.'_'.$this->getLowerModuleName().'">'.$eol;
|
2076 |
+
$content .= $padding.$tab.$tab.$tab.'<label>'.$entity->getLabelPlural().'</label>'.$eol;
|
2077 |
+
$content .= $padding.$tab.$tab.$tab.'<url helper="'.$namespace.'_'.
|
2078 |
+
$this->getLowerModuleName().'/'.strtolower($entity->getNameSingular()).'/get'.
|
2079 |
+
ucfirst(strtolower($entity->getNamePlural())).'Url" />'.$eol;
|
2080 |
+
$content .= $padding.$tab.$tab.$tab.'<title>'.$entity->getLabelPlural().'</title>'.$eol;
|
2081 |
+
$content .= $padding.$tab.$tab.$tab.'<prepare />'.$eol;
|
2082 |
+
$content .= $padding.$tab.$tab.$tab.'<urlParams/>'.$eol;
|
2083 |
+
$content .= $padding.$tab.$tab.$tab.'<position>'.$position.'</position>'.$eol;
|
2084 |
+
$content .= $padding.$tab.$tab.'</action>'.$eol;
|
2085 |
+
$position += 10;
|
2086 |
+
}
|
2087 |
+
$content .= $padding.$tab.'</reference>'.$eol;
|
2088 |
+
}
|
2089 |
+
if (count($footer) > 0) {
|
2090 |
+
$content .= $padding.$tab.'<reference name="footer_links">'.$eol;
|
2091 |
+
$position = 120;
|
2092 |
+
foreach ($footer as $entity) {
|
2093 |
+
$content .= $padding.$tab.$tab.'<action method="addLink" translate="label title" module="'.
|
2094 |
+
$namespace.'_'.$this->getLowerModuleName().'">'.$eol;
|
2095 |
+
$content .= $padding.$tab.$tab.$tab.'<label>'.$entity->getLabelPlural().'</label>'.$eol;
|
2096 |
+
$content .= $padding.$tab.$tab.$tab.
|
2097 |
+
'<url helper="'.$namespace.'_'.$this->getLowerModuleName().'/'.
|
2098 |
+
strtolower($entity->getNameSingular()).'/get'.
|
2099 |
+
ucfirst(strtolower($entity->getNamePlural())).'Url" />'.$eol;
|
2100 |
+
$content .= $padding.$tab.$tab.$tab.'<title>'.$entity->getLabelPlural().'</title>'.$eol;
|
2101 |
+
$content .= $padding.$tab.$tab.$tab.'<prepare />'.$eol;
|
2102 |
+
$content .= $padding.$tab.$tab.$tab.'<urlParams/>'.$eol;
|
2103 |
+
$content .= $padding.$tab.$tab.$tab.'<position>'.$position.'</position>'.$eol;
|
2104 |
+
$content .= $padding.$tab.$tab.'</action>'.$eol;
|
2105 |
+
$position += 10;
|
2106 |
+
}
|
2107 |
+
$content .= $padding.$tab.'</reference>'.$eol;
|
2108 |
+
}
|
2109 |
+
$content .= $padding.'</default>';
|
2110 |
+
}
|
2111 |
+
return $content;
|
2112 |
+
}
|
2113 |
+
|
2114 |
+
/**
|
2115 |
+
* get xml for category menu event
|
2116 |
+
*
|
2117 |
+
* @access public
|
2118 |
+
* @return string
|
2119 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2120 |
+
*/
|
2121 |
+
public function getCategoryMenuEvent()
|
2122 |
+
{
|
2123 |
+
if ($this->getShowInCategoryMenu()) {
|
2124 |
+
$namespace = $this->getNamespace(true);
|
2125 |
+
|
2126 |
+
$eol = $this->getEol();
|
2127 |
+
$padding = $this->getPadding(2);
|
2128 |
+
$tab = $this->getPadding();
|
2129 |
+
$content = $eol;
|
2130 |
+
$content .= $padding.'<events>'.$eol;
|
2131 |
+
$content .= $padding.$tab.'<page_block_html_topmenu_gethtml_before>'.$eol;
|
2132 |
+
$content .= $padding.$tab.$tab.'<observers>'.$eol;
|
2133 |
+
$content .= $padding.$tab.$tab.$tab.'<'.$namespace.'_'.$this->getLowerModuleName().'>'.$eol;
|
2134 |
+
$content .= $padding.$tab.$tab.$tab.$tab.
|
2135 |
+
'<class>'.$namespace.'_'.$this->getLowerModuleName().'/observer</class>'.$eol;
|
2136 |
+
$content .= $padding.$tab.$tab.$tab.$tab.'<method>addItemsToTopmenuItems</method>'.$eol;
|
2137 |
+
$content .= $padding.$tab.$tab.$tab.'</'.$namespace.'_'.$this->getLowerModuleName().'>'.$eol;
|
2138 |
+
$content .= $padding.$tab.$tab.'</observers>'.$eol;
|
2139 |
+
$content .= $padding.$tab.'</page_block_html_topmenu_gethtml_before>'.$eol;
|
2140 |
+
$content .= $padding.'</events>'.$eol;
|
2141 |
+
return $content;
|
2142 |
+
}
|
2143 |
+
return '';
|
2144 |
+
}
|
2145 |
+
|
2146 |
+
/**
|
2147 |
+
* get customer comment links
|
2148 |
+
*
|
2149 |
+
* @access public
|
2150 |
+
* @return string
|
2151 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2152 |
+
*/
|
2153 |
+
public function getCustomerCommentLinks()
|
2154 |
+
{
|
2155 |
+
$namespace = $this->getNamespace(true);
|
2156 |
+
$eol = $this->getEol();
|
2157 |
+
$padding = $this->getPadding(3);
|
2158 |
+
$content = $eol;
|
2159 |
+
$module = $this->getLowerModuleName();
|
2160 |
+
foreach ($this->getEntities() as $entity) {
|
2161 |
+
if ($entity->getAllowComment()) {
|
2162 |
+
$entityName = $entity->getNameSingular(true);
|
2163 |
+
$label = $entity->getLabelPlural();
|
2164 |
+
$content .= $padding . '<action method="addLink" translate="label" module="'.
|
2165 |
+
$namespace.'_'.$module.'"><name>'.$entityName.'_comments</name><path>'.
|
2166 |
+
$namespace.'_'.$module.'/'.$entityName.'_customer_comment</path><label>'.
|
2167 |
+
$label.' Comments</label></action>'.$eol;
|
2168 |
+
}
|
2169 |
+
}
|
2170 |
+
return $content;
|
2171 |
+
}
|
2172 |
+
|
2173 |
+
/**
|
2174 |
+
* get the module namespace
|
2175 |
+
*
|
2176 |
+
* @access public
|
2177 |
+
* @param bool $lower
|
2178 |
+
* @return mixed|string
|
2179 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2180 |
+
*/
|
2181 |
+
public function getNamespace($lower = false)
|
2182 |
+
{
|
2183 |
+
$namespace = $this->getData('namespace');
|
2184 |
+
if ($lower) {
|
2185 |
+
$namespace = strtolower($namespace);
|
2186 |
+
}
|
2187 |
+
return $namespace;
|
2188 |
+
}
|
2189 |
+
|
2190 |
+
/**
|
2191 |
+
* get front key
|
2192 |
+
*
|
2193 |
+
* @access public
|
2194 |
+
* @return mixed
|
2195 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2196 |
+
*/
|
2197 |
+
public function getFrontKey()
|
2198 |
+
{
|
2199 |
+
if (!$this->getCreateFrontend()) {
|
2200 |
+
return $this->getData('front_key');
|
2201 |
+
}
|
2202 |
+
if (!$this->getData('front_key')) {
|
2203 |
+
$frontKey = $this->getNamespace(true).'_'.$this->getLowerModuleName();
|
2204 |
+
$this->setData('front_key', $frontKey);
|
2205 |
+
}
|
2206 |
+
return $this->getData('front_key');
|
2207 |
+
}
|
2208 |
+
|
2209 |
+
/**
|
2210 |
+
* system configuration tab name
|
2211 |
+
*
|
2212 |
+
* @access public
|
2213 |
+
* @return string
|
2214 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2215 |
+
*/
|
2216 |
+
public function getSystemTabName()
|
2217 |
+
{
|
2218 |
+
if (!$this->getData('system_tab')) {
|
2219 |
+
$this->setData('system_tab', $this->getNamespace());
|
2220 |
+
}
|
2221 |
+
return $this->getData('system_tab');
|
2222 |
+
}
|
2223 |
+
|
2224 |
+
/**
|
2225 |
+
* system configuration tab position
|
2226 |
+
*
|
2227 |
+
* @access public
|
2228 |
+
* @return string
|
2229 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2230 |
+
*/
|
2231 |
+
public function getSystemTabPosition()
|
2232 |
+
{
|
2233 |
+
return (int)$this->getData('system_tab_position');
|
2234 |
+
}
|
2235 |
+
|
2236 |
+
/**
|
2237 |
+
* get xml for api2.xml resource groups children
|
2238 |
+
* @access public
|
2239 |
+
* @return string
|
2240 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2241 |
+
*/
|
2242 |
+
public function getRestResourceGroupsChildren()
|
2243 |
+
{
|
2244 |
+
$content = '';
|
2245 |
+
foreach ($this->getEntities() as $entity) {
|
2246 |
+
$content .= $entity->getRestResourceGroup(5);
|
2247 |
+
}
|
2248 |
+
return $content;
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
/**
|
2252 |
+
* get xml for api2.xml resources
|
2253 |
+
*
|
2254 |
+
* @access public
|
2255 |
+
* @return string
|
2256 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2257 |
+
*/
|
2258 |
+
public function getRestResources()
|
2259 |
+
{
|
2260 |
+
$content = '';
|
2261 |
+
foreach ($this->getEntities() as $entity) {
|
2262 |
+
$content .= $entity->getRestResource(3);
|
2263 |
+
}
|
2264 |
+
return $content;
|
2265 |
+
}
|
2266 |
+
|
2267 |
+
/**
|
2268 |
+
* get eav default values
|
2269 |
+
*
|
2270 |
+
* @access public
|
2271 |
+
* @return string
|
2272 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2273 |
+
*/
|
2274 |
+
public function getEavOptionsDefaults()
|
2275 |
+
{
|
2276 |
+
$content = '';
|
2277 |
+
foreach ($this->getEntities() as $entity) {
|
2278 |
+
if ($entity->getIsEav()) {
|
2279 |
+
foreach ($entity->getAttributes() as $attribute) {
|
2280 |
+
$content .= $attribute->getDefaultValueSetup();
|
2281 |
+
}
|
2282 |
+
}
|
2283 |
+
}
|
2284 |
+
return $content;
|
2285 |
+
}
|
2286 |
+
|
2287 |
+
/**
|
2288 |
+
* check if there are sibling relations
|
2289 |
+
*
|
2290 |
+
* @access public
|
2291 |
+
* @return bool
|
2292 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2293 |
+
*/
|
2294 |
+
public function getHasRelationColumnRenderer()
|
2295 |
+
{
|
2296 |
+
if (count($this->getRelations(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_SIBLING)) > 0) {
|
2297 |
+
return true;
|
2298 |
+
}
|
2299 |
+
foreach ($this->getEntities() as $_entity) {
|
2300 |
+
if ($_entity->getLinkCore()) {
|
2301 |
+
return true;
|
2302 |
+
}
|
2303 |
+
}
|
2304 |
+
return false;
|
2305 |
+
}
|
2306 |
+
|
2307 |
+
/**
|
2308 |
+
* check if there are parent-child relations
|
2309 |
+
*
|
2310 |
+
* @access public
|
2311 |
+
* @return bool
|
2312 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
2313 |
+
*/
|
2314 |
+
public function getHasParentRelation()
|
2315 |
+
{
|
2316 |
+
$parentRelations = $this->getRelations(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_PARENT);
|
2317 |
+
if (count($parentRelations)) {
|
2318 |
+
return true;
|
2319 |
+
}
|
2320 |
+
$childRelations = $this->getRelations(Ultimate_ModuleCreator_Model_Relation::RELATION_TYPE_CHILD);
|
2321 |
+
if (count($childRelations)) {
|
2322 |
+
return true;
|
2323 |
+
}
|
2324 |
+
return false;
|
2325 |
+
}
|
2326 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Module/Collection.php
CHANGED
@@ -1,96 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* module collection
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Module_Collection
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Files and folders regexsp
|
29 |
-
* @var string
|
30 |
-
*/
|
31 |
-
protected $_allowedDirsMask
|
32 |
-
protected $_allowedFilesMask= '/^[a-z0-9\.\-\_]+\.(xml
|
33 |
-
protected $_disallowedFilesMask = '/^package\.xml$/i';
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Base dir where packages are located
|
37 |
-
*
|
38 |
-
* @var string
|
39 |
-
*/
|
40 |
-
protected $_baseDir = '';
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Set base dir
|
44 |
-
*
|
45 |
-
* @
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
$
|
51 |
-
$io
|
52 |
-
$
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
*
|
59 |
-
*
|
60 |
-
* @
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
$
|
68 |
-
$row['
|
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 |
-
$this->
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* module collection
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Module_Collection extends Varien_Data_Collection_Filesystem
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Files and folders regexsp
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $_allowedDirsMask = '/^[a-z0-9\.\-]+$/i';
|
32 |
+
protected $_allowedFilesMask = '/^[a-z0-9\.\-\_]+\.(xml)$/i';
|
33 |
+
protected $_disallowedFilesMask = '/^package\.xml$/i';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Base dir where packages are located
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
protected $_baseDir = '';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Set base dir
|
44 |
+
*
|
45 |
+
* @access public
|
46 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
47 |
+
*/
|
48 |
+
public function __construct()
|
49 |
+
{
|
50 |
+
$this->_baseDir = Mage::getBaseDir('var') . DS . 'modulecreator'.DS.'package';
|
51 |
+
$io = new Varien_Io_File();
|
52 |
+
$io->setAllowCreateFolders(true);
|
53 |
+
$io->createDestinationDir($this->_baseDir);
|
54 |
+
$this->addTargetDir($this->_baseDir);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Row generator
|
59 |
+
*
|
60 |
+
* @access public
|
61 |
+
* @param string $filename
|
62 |
+
* @return array
|
63 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
64 |
+
*/
|
65 |
+
protected function _generateRow($filename)
|
66 |
+
{
|
67 |
+
$row = parent::_generateRow($filename);
|
68 |
+
$row['package'] = preg_replace('/\.(xml)$/', '', str_replace($this->_baseDir . DS, '', $filename));
|
69 |
+
$row['filename_id'] = $row['package'];
|
70 |
+
$row['safe_id'] = strtr(base64_encode($row['package']), '+/=', '-_,');
|
71 |
+
$folder = explode(DS, $row['package']);
|
72 |
+
$row['folder'] = DS;
|
73 |
+
array_pop($folder);
|
74 |
+
if (!empty($folder)) {
|
75 |
+
$row['folder'] = implode(DS, $folder) . DS;
|
76 |
+
}
|
77 |
+
return $row;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get all folders as options array
|
82 |
+
*
|
83 |
+
* @access public
|
84 |
+
* @return array
|
85 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
86 |
+
*/
|
87 |
+
public function collectFolders()
|
88 |
+
{
|
89 |
+
$collectFiles = $this->_collectFiles;
|
90 |
+
$collectDirs = $this->_collectDirs;
|
91 |
+
$this->setCollectFiles(false)->setCollectDirs(true);
|
92 |
+
|
93 |
+
$this->_collectRecursive($this->_baseDir);
|
94 |
+
$result = array(DS => DS);
|
95 |
+
foreach ($this->_collectedDirs as $dir) {
|
96 |
+
$dir = str_replace($this->_baseDir . DS, '', $dir) . DS;
|
97 |
+
$result[$dir] = $dir;
|
98 |
+
}
|
99 |
+
$this->setCollectFiles($collectFiles)->setCollectDirs($collectDirs);
|
100 |
+
return $result;
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Relation.php
CHANGED
@@ -1,211 +1,253 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
class Ultimate_ModuleCreator_Model_Relation extends Ultimate_ModuleCreator_Model_Abstract
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
const
|
24 |
-
const
|
25 |
-
const
|
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 |
-
if ($
|
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 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
*
|
192 |
-
* @
|
193 |
-
* @
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
/**
|
201 |
-
* check if
|
202 |
-
*
|
203 |
-
* @
|
204 |
-
* @
|
205 |
-
* @
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
class Ultimate_ModuleCreator_Model_Relation extends Ultimate_ModuleCreator_Model_Abstract
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* relation type constants
|
22 |
+
*/
|
23 |
+
const RELATION_TYPE_NONE = 'none';
|
24 |
+
const RELATION_TYPE_CHILD = 'child';
|
25 |
+
const RELATION_TYPE_PARENT = 'parent';
|
26 |
+
const RELATION_TYPE_SIBLING = 'sibling';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var Ultimate_ModuleCreator_Model_Entity
|
30 |
+
*/
|
31 |
+
protected $_entity1;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var Ultimate_ModuleCreator_Model_Entity
|
35 |
+
*/
|
36 |
+
protected $_entity2;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* relation type
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
protected $_type;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* set entities in relation
|
47 |
+
*
|
48 |
+
* @access public
|
49 |
+
* @param Ultimate_ModuleCreator_Model_Entity $entity1
|
50 |
+
* @param Ultimate_ModuleCreator_Model_Entity $entity2
|
51 |
+
* @param int $type
|
52 |
+
* @return Ultimate_ModuleCreator_Model_Relation
|
53 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
54 |
+
*/
|
55 |
+
public function setEntities(
|
56 |
+
Ultimate_ModuleCreator_Model_Entity $entity1,
|
57 |
+
Ultimate_ModuleCreator_Model_Entity $entity2,
|
58 |
+
$type
|
59 |
+
) {
|
60 |
+
$this->_entity1 = $entity1;
|
61 |
+
$this->_entity2 = $entity2;
|
62 |
+
$this->_type = $type;
|
63 |
+
switch($type) {
|
64 |
+
case self::RELATION_TYPE_NONE:
|
65 |
+
break;
|
66 |
+
case self::RELATION_TYPE_CHILD:
|
67 |
+
$this->_entity1->addRelatedEntity($type, $this->_entity2);
|
68 |
+
$this->_entity2->addRelatedEntity(self::RELATION_TYPE_PARENT, $this->_entity1);
|
69 |
+
break;
|
70 |
+
case self::RELATION_TYPE_PARENT:
|
71 |
+
$this->_entity1->addRelatedEntity($type, $this->_entity2);
|
72 |
+
$this->_entity2->addRelatedEntity(self::RELATION_TYPE_CHILD, $this->_entity1);
|
73 |
+
break;
|
74 |
+
case self::RELATION_TYPE_SIBLING:
|
75 |
+
$this->_entity1->addRelatedEntity($type, $this->_entity2);
|
76 |
+
$this->_entity2->addRelatedEntity(self::RELATION_TYPE_SIBLING, $this->_entity1);
|
77 |
+
break;
|
78 |
+
default:
|
79 |
+
break;
|
80 |
+
}
|
81 |
+
return $this;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* get the relation type
|
86 |
+
*
|
87 |
+
* @access public
|
88 |
+
* @return int
|
89 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
90 |
+
*/
|
91 |
+
public function getType()
|
92 |
+
{
|
93 |
+
return $this->_type;
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* get relation entities
|
98 |
+
*
|
99 |
+
* @access public
|
100 |
+
* @return Ultimate_ModuleCreator_Model_Entity[]
|
101 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
102 |
+
*/
|
103 |
+
public function getEntities()
|
104 |
+
{
|
105 |
+
return array($this->_entity1, $this->_entity2);
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* relation to xml
|
110 |
+
*
|
111 |
+
* @access protected
|
112 |
+
* @param array $arrAttributes
|
113 |
+
* @param string $rootName
|
114 |
+
* @param bool $addOpenTag
|
115 |
+
* @param bool $addCdata
|
116 |
+
* @return string
|
117 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
118 |
+
*/
|
119 |
+
public function toXml(array $arrAttributes = array(), $rootName = 'relation', $addOpenTag=false, $addCdata=false)
|
120 |
+
{
|
121 |
+
$xml = '';
|
122 |
+
$eol = $this->getEol();
|
123 |
+
if ($rootName) {
|
124 |
+
$xml .= '<'.$rootName.'>'.$eol;
|
125 |
+
}
|
126 |
+
$entities = $this->getEntities();
|
127 |
+
$xml .= '<'.$entities[0]->getNameSingular().'_'.$entities[1]->getNameSingular().'>';
|
128 |
+
$xml .= $this->getType();
|
129 |
+
$xml .= '</'.$entities[0]->getNameSingular().'_'.$entities[1]->getNameSingular().'>'.$eol;
|
130 |
+
if ($rootName) {
|
131 |
+
$xml .= '</'.$rootName.'>'.$eol;
|
132 |
+
}
|
133 |
+
return $xml;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* check if siblings can be listed in the entity view page
|
138 |
+
*
|
139 |
+
* @access public
|
140 |
+
* @param int $index
|
141 |
+
* @return bool
|
142 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
143 |
+
*/
|
144 |
+
public function getShowFrontendRelationSiblings($index)
|
145 |
+
{
|
146 |
+
if ($this->getType() != self::RELATION_TYPE_SIBLING) {
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
$index = !!$index;
|
150 |
+
$entities = $this->getEntities();
|
151 |
+
$e = $entities[$index];
|
152 |
+
return $e->getCreateView();
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* check if children can be listed in the parent view page
|
157 |
+
*
|
158 |
+
* @access public
|
159 |
+
* @return bool
|
160 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
161 |
+
*/
|
162 |
+
public function getShowFrontendRelationChildren()
|
163 |
+
{
|
164 |
+
if ($this->getType() == self::RELATION_TYPE_CHILD) {
|
165 |
+
$index = 1;
|
166 |
+
} elseif ($this->getType() == self::RELATION_TYPE_PARENT) {
|
167 |
+
$index = 0;
|
168 |
+
} else {
|
169 |
+
return false;
|
170 |
+
}
|
171 |
+
$entities = $this->getEntities();
|
172 |
+
$e = $entities[$index];
|
173 |
+
return $e->getCreateView();
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* check if a relations has tree entities
|
178 |
+
*
|
179 |
+
* @access public
|
180 |
+
* @return bool
|
181 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
182 |
+
*/
|
183 |
+
public function getHasTree()
|
184 |
+
{
|
185 |
+
return $this->_entity1->getIsTree() || $this->_entity2->getIsTree();
|
186 |
+
}
|
187 |
+
|
188 |
+
/**
|
189 |
+
* check if a relations does not have tree entities
|
190 |
+
*
|
191 |
+
* @access public
|
192 |
+
* @return bool
|
193 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
194 |
+
*/
|
195 |
+
public function getNotHasTree()
|
196 |
+
{
|
197 |
+
return !$this->getHasTree();
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* check if one of the entities behaves as tree
|
202 |
+
*
|
203 |
+
* @access public
|
204 |
+
* @param int $index
|
205 |
+
* @return bool
|
206 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
207 |
+
*/
|
208 |
+
public function getEntityIsTree($index)
|
209 |
+
{
|
210 |
+
$entities = $this->getEntities();
|
211 |
+
return $entities[$index]->getIsTree();
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* check if one of the entities behaves as tree
|
216 |
+
*
|
217 |
+
* @access public
|
218 |
+
* @param int $index
|
219 |
+
* @return bool
|
220 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
221 |
+
*/
|
222 |
+
public function getSiblingIsTree($index)
|
223 |
+
{
|
224 |
+
return $this->getEntityIsTree(1 - $index);
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* check if one of the entities does not behave as tree
|
229 |
+
*
|
230 |
+
* @access public
|
231 |
+
* @param int $index
|
232 |
+
* @return bool
|
233 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
234 |
+
*/
|
235 |
+
public function getSiblingIsNotTree($index)
|
236 |
+
{
|
237 |
+
return !$this->getSiblingIsTree($index);
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* check if entity has API
|
242 |
+
*
|
243 |
+
* @access public
|
244 |
+
* @param int $index
|
245 |
+
* @return bool
|
246 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
247 |
+
*/
|
248 |
+
public function getEntityHasApi($index)
|
249 |
+
{
|
250 |
+
$entities = $this->getEntities();
|
251 |
+
return $entities[$index]->getApi();
|
252 |
+
}
|
253 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Attribute/Scope.php
CHANGED
@@ -1,60 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* allowed attribute scopes
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Source_Attribute_Scope
|
26 |
-
|
27 |
-
|
28 |
-
*
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
*
|
35 |
-
*
|
36 |
-
* @
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
);
|
45 |
-
$this->_options[] = array(
|
46 |
-
'label' => Mage::helper('modulecreator')->__('
|
47 |
-
'value' => Mage_Catalog_Model_Resource_Eav_Attribute::
|
48 |
-
);
|
49 |
-
$this->_options[] = array(
|
50 |
-
'label' => Mage::helper('modulecreator')->__('
|
51 |
-
'value' => Mage_Catalog_Model_Resource_Eav_Attribute::
|
52 |
-
);
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* allowed attribute scopes
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Source_Attribute_Scope
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* options
|
29 |
+
*
|
30 |
+
* @var null
|
31 |
+
*/
|
32 |
+
protected $_options = null;
|
33 |
+
/**
|
34 |
+
* get options array
|
35 |
+
*
|
36 |
+
* @access public
|
37 |
+
* @param bool $withEmpty
|
38 |
+
* @return array|null
|
39 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
40 |
+
*/
|
41 |
+
public function toArray($withEmpty = false)
|
42 |
+
{
|
43 |
+
if (is_null($this->_options)) {
|
44 |
+
$this->_options = array();
|
45 |
+
$this->_options[] = array(
|
46 |
+
'label' => Mage::helper('modulecreator')->__('Store View'),
|
47 |
+
'value' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE
|
48 |
+
);
|
49 |
+
$this->_options[] = array(
|
50 |
+
'label' => Mage::helper('modulecreator')->__('Website'),
|
51 |
+
'value' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE
|
52 |
+
);
|
53 |
+
$this->_options[] = array(
|
54 |
+
'label' => Mage::helper('modulecreator')->__('Global'),
|
55 |
+
'value' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
|
56 |
+
);
|
57 |
+
}
|
58 |
+
$options = $this->_options;
|
59 |
+
if ($withEmpty) {
|
60 |
+
$options = array_merge(array(''=>''), $options);
|
61 |
+
}
|
62 |
+
return $options;
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Attribute/Type.php
CHANGED
@@ -1,64 +1,67 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* allowed attribute types
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Source_Attribute_Type
|
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 |
-
}
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* allowed attribute types
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Source_Attribute_Type
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* options
|
29 |
+
*
|
30 |
+
* @var mixed
|
31 |
+
*/
|
32 |
+
protected $_options = null;
|
33 |
+
/**
|
34 |
+
* get options array
|
35 |
+
*
|
36 |
+
* @access public
|
37 |
+
* @param bool $withEmpty
|
38 |
+
* @return array|null
|
39 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
40 |
+
*/
|
41 |
+
public function toArray($withEmpty = false)
|
42 |
+
{
|
43 |
+
if (is_null($this->_options)) {
|
44 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
45 |
+
$helper = Mage::helper('modulecreator');
|
46 |
+
$types = $helper->getAttributeTypes();
|
47 |
+
$groups = $helper->getAttributeTypeGroups();
|
48 |
+
foreach ($groups as $key=>$group) {
|
49 |
+
$this->_options[$key] = array('label'=>(string)$group->label, 'value'=>array());
|
50 |
+
}
|
51 |
+
foreach ($types as $type=>$values) {
|
52 |
+
$group = (string)$values->group;
|
53 |
+
if (!empty($group) && isset($this->_options[$group])) {
|
54 |
+
$this->_options[$group]['value'][] = array('label'=>(string)$values->label, 'value'=>$type);
|
55 |
+
} else {
|
56 |
+
$this->_options[] = array('label'=>(string)$values->label, 'value'=>$type);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
$this->_options = array_values($this->_options);
|
60 |
+
}
|
61 |
+
$options = $this->_options;
|
62 |
+
if ($withEmpty) {
|
63 |
+
array_unshift($options, array('label'=>'', 'value'=>''));
|
64 |
+
}
|
65 |
+
return $options;
|
66 |
+
}
|
67 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Attribute/Value/Source.php
CHANGED
@@ -1,55 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* allowed attribute sources
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Source_Attribute_Value_Source
|
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 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* allowed attribute sources
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Source_Attribute_Value_Source
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* options
|
29 |
+
*
|
30 |
+
* @var mixed
|
31 |
+
*/
|
32 |
+
protected $_options = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* get options array
|
36 |
+
*
|
37 |
+
* @access public
|
38 |
+
* @param bool $withEmpty
|
39 |
+
* @return array|null
|
40 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
41 |
+
*/
|
42 |
+
public function toArray($withEmpty = false)
|
43 |
+
{
|
44 |
+
if (is_null($this->_options)) {
|
45 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
46 |
+
$helper = Mage::helper('modulecreator');
|
47 |
+
$options = $helper->getDropdownSubtypes(true);
|
48 |
+
$this->_options = array();
|
49 |
+
foreach ($options as $key=>$option) {
|
50 |
+
$this->_options[$key] = $option->label;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
$options = $this->_options;
|
54 |
+
if ($withEmpty) {
|
55 |
+
$options = array_merge(array(''=>''), $options);
|
56 |
+
}
|
57 |
+
return $options;
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Codepool.php
CHANGED
@@ -1,64 +1,76 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* code pool source model
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
class Ultimate_ModuleCreator_Model_Source_Codepool
|
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 |
-
return $
|
63 |
-
}
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* code pool source model
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
class Ultimate_ModuleCreator_Model_Source_Codepool
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* get the list of available code pools
|
28 |
+
*
|
29 |
+
* @access public
|
30 |
+
* @param bool $withEmpty
|
31 |
+
* @return array
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function toOptionArray($withEmpty = false)
|
35 |
+
{
|
36 |
+
$options = array();
|
37 |
+
if ($withEmpty) {
|
38 |
+
$options[] = array(
|
39 |
+
'value'=>'',
|
40 |
+
'label'=>Mage::helper('modulecreator')->__('Select a codepool')
|
41 |
+
);
|
42 |
+
}
|
43 |
+
$options[] = array('value' => 'local', 'label'=>'local');
|
44 |
+
$options[] = array('value' => 'community', 'label'=>'community');
|
45 |
+
return $options;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* get options as an array
|
50 |
+
*
|
51 |
+
* @access public
|
52 |
+
* @param bool $withEmpty
|
53 |
+
* @return array
|
54 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
55 |
+
*/
|
56 |
+
public function getAllOptions($withEmpty = true)
|
57 |
+
{
|
58 |
+
$options = array();
|
59 |
+
foreach ($this->toOptionArray($withEmpty) as $option) {
|
60 |
+
$options[$option['value']] = $option['label'];
|
61 |
+
}
|
62 |
+
return $options;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* get options as an array - wrapper
|
67 |
+
*
|
68 |
+
* @param bool $withEmpty
|
69 |
+
* @return array
|
70 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
71 |
+
*/
|
72 |
+
public function toArray($withEmpty = true)
|
73 |
+
{
|
74 |
+
return $this->getAllOptions($withEmpty);
|
75 |
+
}
|
76 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Entity/Layout.php
CHANGED
@@ -1,53 +1,57 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* allowed entity layouts
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Source_Entity_Layout
|
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 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* allowed entity layouts
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Source_Entity_Layout
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* options
|
29 |
+
*
|
30 |
+
* @var mixed
|
31 |
+
*/
|
32 |
+
protected $_options = null;
|
33 |
+
/**
|
34 |
+
* get options array
|
35 |
+
*
|
36 |
+
* @access public
|
37 |
+
* @param bool $withEmpty
|
38 |
+
* @return array|null
|
39 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
40 |
+
*/
|
41 |
+
public function toArray($withEmpty = false)
|
42 |
+
{
|
43 |
+
if (is_null($this->_options)) {
|
44 |
+
/** @var Mage_Page_Model_Source_Layout $layoutModel */
|
45 |
+
$layoutModel = Mage::getSingleton('page/source_layout');
|
46 |
+
$_options = $layoutModel->toOptionArray();
|
47 |
+
foreach ($_options as $option) {
|
48 |
+
$this->_options[$option['value']] = $option['label'];
|
49 |
+
}
|
50 |
+
}
|
51 |
+
$options = $this->_options;
|
52 |
+
if ($withEmpty) {
|
53 |
+
$options = array_merge(array(''=>''), $options);
|
54 |
+
}
|
55 |
+
return $options;
|
56 |
+
}
|
57 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Entity/Menu.php
CHANGED
@@ -1,55 +1,62 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* available menus
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Source_Entity_Menu
|
26 |
-
|
27 |
-
const
|
28 |
-
const
|
29 |
-
const
|
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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* available menus
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Source_Entity_Menu
|
26 |
+
{
|
27 |
+
const NO_MENU = 0;
|
28 |
+
const TOP_LINKS = 1;
|
29 |
+
const CATEGORY_MENU = 2;
|
30 |
+
const FOOTER_LINKS = 3;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* options
|
34 |
+
*
|
35 |
+
* @var mixed
|
36 |
+
*/
|
37 |
+
protected $_options = null;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* get options array
|
41 |
+
*
|
42 |
+
* @access public
|
43 |
+
* @param bool $withEmpty
|
44 |
+
* @return array|null
|
45 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
46 |
+
*/
|
47 |
+
public function toArray($withEmpty = false)
|
48 |
+
{
|
49 |
+
if (is_null($this->_options)) {
|
50 |
+
$this->_options[self::NO_MENU] = Mage::helper('modulecreator')->__('Do not include in any menu');
|
51 |
+
$this->_options[self::TOP_LINKS] = Mage::helper('modulecreator')
|
52 |
+
->__('Include in top links. (near My account, Checkout, ...)');
|
53 |
+
$this->_options[self::CATEGORY_MENU] = Mage::helper('modulecreator')->__('Include in category menu');
|
54 |
+
$this->_options[self::FOOTER_LINKS] = Mage::helper('modulecreator')->__('Include in footer links');
|
55 |
+
}
|
56 |
+
$options = $this->_options;
|
57 |
+
if ($withEmpty) {
|
58 |
+
$options = array_merge(array(''=>''), $options);
|
59 |
+
}
|
60 |
+
return $options;
|
61 |
+
}
|
62 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Entity/Type.php
CHANGED
@@ -1,53 +1,58 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* allowed entity types
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Source_Entity_Type
|
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 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* allowed entity types
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Source_Entity_Type
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* options
|
29 |
+
*
|
30 |
+
* @var mixed
|
31 |
+
*/
|
32 |
+
protected $_options = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* get options array
|
36 |
+
*
|
37 |
+
* @access public
|
38 |
+
* @param bool $withEmpty
|
39 |
+
* @return array|null
|
40 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
41 |
+
*/
|
42 |
+
public function toArray($withEmpty = false)
|
43 |
+
{
|
44 |
+
if (is_null($this->_options)) {
|
45 |
+
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
46 |
+
$helper = Mage::helper('modulecreator');
|
47 |
+
$types = $helper->getEntityTypes();
|
48 |
+
foreach ($types as $type=>$values) {
|
49 |
+
$this->_options[$type] = Mage::helper('modulecreator')->__((string)$values->label);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
$options = $this->_options;
|
53 |
+
if ($withEmpty) {
|
54 |
+
$options = array_merge(array(''=>''), $options);
|
55 |
+
}
|
56 |
+
return $options;
|
57 |
+
}
|
58 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Source/Install.php
CHANGED
@@ -1,74 +1,83 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* install source mode
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Model_Source_Install
|
26 |
-
|
27 |
-
|
28 |
-
*
|
29 |
-
*
|
30 |
-
* @
|
31 |
-
* @
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
$options[] = array(
|
45 |
-
'value' => '
|
46 |
-
'label'=>Mage::helper('modulecreator')->__('
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* install source mode
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Model_Source_Install
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* get the list of available install actions
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @param bool $withEmpty
|
32 |
+
* @return array
|
33 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
34 |
+
*/
|
35 |
+
public function toOptionArray($withEmpty = false)
|
36 |
+
{
|
37 |
+
$options = array();
|
38 |
+
if ($withEmpty) {
|
39 |
+
$options[] = array(
|
40 |
+
'value'=>'',
|
41 |
+
'label'=>Mage::helper('modulecreator')->__('Select action')
|
42 |
+
);
|
43 |
+
}
|
44 |
+
$options[] = array(
|
45 |
+
'value' => '1',
|
46 |
+
'label'=>Mage::helper('modulecreator')->__('Install new extension on the current instance.')
|
47 |
+
);
|
48 |
+
$options[] = array(
|
49 |
+
'value' => '0',
|
50 |
+
'label'=>Mage::helper('modulecreator')->__('Create archive. I will install it later')
|
51 |
+
);
|
52 |
+
return $options;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* get options as an array
|
57 |
+
*
|
58 |
+
* @access public
|
59 |
+
* @param bool $withEmpty
|
60 |
+
* @return array
|
61 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
62 |
+
*/
|
63 |
+
public function getAllOptions($withEmpty = true)
|
64 |
+
{
|
65 |
+
$options = array();
|
66 |
+
foreach ($this->toOptionArray($withEmpty) as $option) {
|
67 |
+
$options[$option['value']] = $option['label'];
|
68 |
+
}
|
69 |
+
return $options;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* get options as an array - wrapper
|
74 |
+
*
|
75 |
+
* @param bool $withEmpty
|
76 |
+
* @return array
|
77 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
78 |
+
*/
|
79 |
+
public function toArray($withEmpty = true)
|
80 |
+
{
|
81 |
+
return $this->getAllOptions($withEmpty);
|
82 |
+
}
|
83 |
+
}
|
app/code/community/Ultimate/ModuleCreator/Model/Writer.php
CHANGED
@@ -1,83 +1,91 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2012
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
*/
|
17 |
-
/**
|
18 |
-
* Zip writer
|
19 |
-
*
|
20 |
-
* @category Ultimate
|
21 |
-
* @package Ultimate_ModuleCreator
|
22 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
-
*/
|
24 |
-
class Ultimate_ModuleCreator_Model_Writer
|
25 |
-
|
26 |
-
/**
|
27 |
-
* prefix for path
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2012
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* Zip writer
|
19 |
+
*
|
20 |
+
* @category Ultimate
|
21 |
+
* @package Ultimate_ModuleCreator
|
22 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
23 |
+
*/
|
24 |
+
class Ultimate_ModuleCreator_Model_Writer extends Mage_Connect_Package_Writer
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* prefix for path
|
28 |
+
*
|
29 |
+
* @var string
|
30 |
+
*/
|
31 |
+
protected $_pathPrefix = '';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* set path prefix
|
35 |
+
*
|
36 |
+
* @param $pathPrefix
|
37 |
+
* @return $this
|
38 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
39 |
+
*/
|
40 |
+
public function setPathPrefix($pathPrefix)
|
41 |
+
{
|
42 |
+
$this->_pathPrefix = $pathPrefix;
|
43 |
+
return $this;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* build the package
|
48 |
+
*
|
49 |
+
* @access public
|
50 |
+
* @return Ultimate_ModuleCreator_Model_Writer
|
51 |
+
* @see Mage_Connect_Package_Writer::composePackage()
|
52 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
53 |
+
*/
|
54 |
+
public function composePackage()
|
55 |
+
{
|
56 |
+
@mkdir(self::PATH_TO_TEMPORARY_DIRECTORY, 0777, true);
|
57 |
+
$root = self::PATH_TO_TEMPORARY_DIRECTORY . basename($this->_namePackage);
|
58 |
+
@mkdir($root, 0777, true);
|
59 |
+
foreach ($this->_files as $file) {
|
60 |
+
if (is_dir($file) || is_file($file)) {
|
61 |
+
$fileName = basename($file);
|
62 |
+
$filePath = dirname($file);
|
63 |
+
if (substr($filePath, 0, strlen($this->_pathPrefix)) == $this->_pathPrefix) {
|
64 |
+
$filePath = substr($filePath, strlen($this->_pathPrefix));
|
65 |
+
}
|
66 |
+
@mkdir($root . DS . $filePath, 0777, true);
|
67 |
+
if (is_file($file)) {
|
68 |
+
copy($file, $root . DS . $filePath . DS . $fileName);
|
69 |
+
} else {
|
70 |
+
@mkdir($root . DS . $filePath . $fileName, 0777);
|
71 |
+
}
|
72 |
+
}
|
73 |
+
}
|
74 |
+
$this->_temporaryPackageDir = $root;
|
75 |
+
return $this;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* set the package name
|
80 |
+
*
|
81 |
+
* @access public
|
82 |
+
* @param string $name
|
83 |
+
* @return Ultimate_ModuleCreator_Model_Writer
|
84 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
85 |
+
*/
|
86 |
+
public function setNamePackage($name)
|
87 |
+
{
|
88 |
+
$this->_namePackage = $name;
|
89 |
+
return $this;
|
90 |
+
}
|
91 |
+
}
|
app/code/community/Ultimate/ModuleCreator/controllers/Adminhtml/ModulecreatorController.php
CHANGED
@@ -1,262 +1,297 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Ultimate_ModuleCreator extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the MIT License
|
8 |
-
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/mit-license.php
|
11 |
-
*
|
12 |
-
* @category Ultimate
|
13 |
-
* @package Ultimate_ModuleCreator
|
14 |
-
* @copyright Copyright (c) 2014
|
15 |
-
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
-
*/
|
18 |
-
/**
|
19 |
-
* main admin controller
|
20 |
-
*
|
21 |
-
* @category Ultimate
|
22 |
-
* @package Ultimate_ModuleCreator
|
23 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
-
*/
|
25 |
-
class Ultimate_ModuleCreator_Adminhtml_ModulecreatorController
|
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 |
-
* @access public
|
67 |
-
* @return void
|
68 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
69 |
-
*/
|
70 |
-
public function
|
71 |
-
|
72 |
-
$this->
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
$this->loadLayout();
|
82 |
-
$this->renderLayout();
|
83 |
-
}
|
84 |
-
/**
|
85 |
-
* init module
|
86 |
-
* @access protected
|
87 |
-
* @return mixed
|
88 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
89 |
-
*/
|
90 |
-
protected function _initModule() {
|
91 |
-
$packageName = base64_decode(strtr($this->getRequest()->getParam('id'), '-_,', '+/='));
|
92 |
-
if ($packageName) {
|
93 |
-
try {
|
94 |
-
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
95 |
-
$helper = Mage::helper('modulecreator');
|
96 |
-
$path = $helper->getLocalPackagesPath();
|
97 |
-
$packageName = basename($packageName);
|
98 |
-
$xmlFile = $path . $packageName . '.xml';
|
99 |
-
if (file_exists($xmlFile) && is_readable($xmlFile)) {
|
100 |
-
$xml = simplexml_load_file($xmlFile, 'Varien_Simplexml_Element');
|
101 |
-
$module = $helper->loadModule($xml);
|
102 |
-
Mage::register('current_module', $module);
|
103 |
-
return $module;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
catch (Exception $e) {
|
107 |
-
Mage::logException($e);
|
108 |
-
$this->_getSession()->addError($e->getMessage());
|
109 |
-
$this->_redirect('*/*/index');
|
110 |
-
}
|
111 |
-
}
|
112 |
-
return false;
|
113 |
-
}
|
114 |
-
/**
|
115 |
-
* init a module from an array
|
116 |
-
* @access public
|
117 |
-
* @param array $data
|
118 |
-
* @return Ultimate_ModuleCreator_Model_Module
|
119 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
120 |
-
*/
|
121 |
-
protected function _initModuleFromData($data) {
|
122 |
-
$entitiesByIndex = array();
|
123 |
-
/** @var Ultimate_ModuleCreator_Model_Module $module */
|
124 |
-
$module = Mage::getModel('modulecreator/module');
|
125 |
-
if (isset($data['settings'])) {
|
126 |
-
$module->addData($data['settings']);
|
127 |
-
}
|
128 |
-
if (isset($data['entity'])) {
|
129 |
-
$entities = $data['entity'];
|
130 |
-
if (is_array($entities)) {
|
131 |
-
foreach ($entities as $key=>$entityData) {
|
132 |
-
/** @var Ultimate_ModuleCreator_Model_Entity $entity */
|
133 |
-
$entity = Mage::getModel('modulecreator/entity');
|
134 |
-
$entity->addData($entityData);
|
135 |
-
$entity->setIndex($key);
|
136 |
-
if (isset($entityData['attributes']) && is_array($entityData['attributes'])) {
|
137 |
-
if (isset($entityData['attributes']['is_name'])) {
|
138 |
-
$isName = $entityData['attributes']['is_name'];
|
139 |
-
unset($entityData['attributes']['is_name']);
|
140 |
-
if (isset($entityData['attributes'][$isName])) {
|
141 |
-
$entityData['attributes'][$isName]['is_name'] = 1;
|
142 |
-
}
|
143 |
-
}
|
144 |
-
foreach ($entityData['attributes'] as $aKey=>$attributeData) {
|
145 |
-
/** @var Ultimate_ModuleCreator_Model_Attribute $attribute */
|
146 |
-
$attribute = Mage::getModel('modulecreator/attribute');
|
147 |
-
$attribute->addData($attributeData);
|
148 |
-
$attribute->setIndex($aKey);
|
149 |
-
$entity->addAttribute($attribute);
|
150 |
-
}
|
151 |
-
}
|
152 |
-
$module->addEntity($entity);
|
153 |
-
$entitiesByIndex[$key] = $entity;
|
154 |
-
}
|
155 |
-
}
|
156 |
-
if (isset($data['relation'])) {
|
157 |
-
foreach($data['relation'] as $index=>$values){
|
158 |
-
foreach ($values as $jndex=>$type){
|
159 |
-
if (isset($entitiesByIndex[$index]) && isset($entitiesByIndex[$jndex])) {
|
160 |
-
/** @var Ultimate_ModuleCreator_Model_Relation $relation */
|
161 |
-
$relation = Mage::getModel('modulecreator/relation');
|
162 |
-
$relation->setEntities($entitiesByIndex[$index], $entitiesByIndex[$jndex], $type);
|
163 |
-
$module->addRelation($relation);
|
164 |
-
}
|
165 |
-
}
|
166 |
-
}
|
167 |
-
}
|
168 |
-
}
|
169 |
-
return $module;
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* validate module before saving
|
174 |
-
* @access public
|
175 |
-
* @return void
|
176 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
177 |
-
*/
|
178 |
-
public function validateAction(){
|
179 |
-
try{
|
180 |
-
$response = new Varien_Object();
|
181 |
-
$module = $this->_initModuleFromData($this->getRequest()->getPost());
|
182 |
-
$errors = $module->validate();
|
183 |
-
if (count($errors) == 0){
|
184 |
-
$messages = $module->buildModule();
|
185 |
-
$module->save();
|
186 |
-
$response->setError(false);
|
187 |
-
}
|
188 |
-
else{
|
189 |
-
if (isset($errors[''])){
|
190 |
-
$response->setMessage(implode('<br />', $errors['']));
|
191 |
-
unset($errors['']);
|
192 |
-
}
|
193 |
-
$response->setError(true);
|
194 |
-
$response->setAttributes($errors);
|
195 |
-
}
|
196 |
-
}
|
197 |
-
catch (Exception $e){
|
198 |
-
$response->setError(true);
|
199 |
-
$response->setMessage($e->getMessage());
|
200 |
-
}
|
201 |
-
$this->getResponse()->setBody($response->toJson());
|
202 |
-
}
|
203 |
-
/**
|
204 |
-
* save module - actually only redirects the page
|
205 |
-
* the save was done in validateAction(). there is no need to process the request twice.
|
206 |
-
* @access public
|
207 |
-
* @return void
|
208 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
209 |
-
*/
|
210 |
-
public function saveAction() {
|
211 |
-
$this->_getSession()->addSuccess(Mage::helper('modulecreator')->__('Your extension has been created!'));
|
212 |
-
$module = $this->_initModuleFromData($this->getRequest()->getPost());
|
213 |
-
$redirectBack = $this->getRequest()->getParam('back', false);
|
214 |
-
if ($redirectBack) {
|
215 |
-
$this->_redirect('*/*/edit', array(
|
216 |
-
'id' => strtr(base64_encode($module->getExtensionName()), '+/=', '-_,'),
|
217 |
-
'_current' => true
|
218 |
-
));
|
219 |
-
}
|
220 |
-
else {
|
221 |
-
$this->_redirect('*/*/');
|
222 |
-
}
|
223 |
-
}
|
224 |
-
/**
|
225 |
-
* download module action
|
226 |
-
* @access public
|
227 |
-
* @return void
|
228 |
-
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
229 |
-
*/
|
230 |
-
public function downloadAction(){
|
231 |
-
$what = $this->getRequest()->getParam('type');
|
232 |
-
$packageName = base64_decode(strtr($this->getRequest()->getParam('id'), '-_,', '+/='));
|
233 |
-
/** @var Ultimate_ModuleCreator_Helper_Data $helper */
|
234 |
-
$helper = Mage::helper('modulecreator');
|
235 |
-
$path = $helper->getLocalModulesDir();
|
236 |
-
$namePrefix = '';
|
237 |
-
switch ($what) {
|
238 |
-
case 'config' :
|
239 |
-
$file = $path.'package'.DS.$packageName . '.xml';
|
240 |
-
break;
|
241 |
-
case 'list':
|
242 |
-
$file = $path.'package'.DS.$packageName . DS. 'files.log';
|
243 |
-
$namePrefix = $packageName.'_';
|
244 |
-
break;
|
245 |
-
case 'uninstall' :
|
246 |
-
$file = $path.'package'.DS.$packageName . DS. 'uninstall.sql';
|
247 |
-
$namePrefix = $packageName.'_';
|
248 |
-
break;
|
249 |
-
default:
|
250 |
-
$file = $path . $packageName . '.tgz';
|
251 |
-
break;
|
252 |
-
}
|
253 |
-
if (file_exists($file) && is_readable($file)) {
|
254 |
-
$content = file_get_contents($file);
|
255 |
-
$this->_prepareDownloadResponse($namePrefix.basename($file), $content);
|
256 |
-
}
|
257 |
-
else{
|
258 |
-
$this->_getSession()->addError(Mage::helper('modulecreator')->__('Your extension archive was not created or is not readable'));
|
259 |
-
$this->_redirect('*/*');
|
260 |
-
}
|
261 |
-
}
|
262 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Ultimate_ModuleCreator extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE_UMC.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Ultimate
|
13 |
+
* @package Ultimate_ModuleCreator
|
14 |
+
* @copyright Copyright (c) 2014
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
17 |
+
*/
|
18 |
+
/**
|
19 |
+
* main admin controller
|
20 |
+
*
|
21 |
+
* @category Ultimate
|
22 |
+
* @package Ultimate_ModuleCreator
|
23 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
24 |
+
*/
|
25 |
+
class Ultimate_ModuleCreator_Adminhtml_ModulecreatorController extends Mage_Adminhtml_Controller_Action
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* default action
|
29 |
+
*
|
30 |
+
* @access public
|
31 |
+
* @return void
|
32 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
33 |
+
*/
|
34 |
+
public function indexAction()
|
35 |
+
{
|
36 |
+
$this->_title(Mage::helper('modulecreator')->__('Ultimate module creator'));
|
37 |
+
$this->_getSession()->addNotice(
|
38 |
+
Mage::helper('modulecreator')->__(
|
39 |
+
'To delete a module from this list go to "<strong>%s</strong>" and remove the files "<strong>%s</strong>" and "<strong>%s</strong>" and folder "<strong>%s</strong>" if they exist. Replace <strong>Namespace_Module</strong> with the appropriate value for each module. There is no delete link in here for security reasons.',
|
40 |
+
Mage::getBaseDir('var').DS.'modulecreator',
|
41 |
+
'Namespace_Module.tgz',
|
42 |
+
'package/Namespace_Module.xml',
|
43 |
+
'package/Namespace_Module/'
|
44 |
+
)
|
45 |
+
);
|
46 |
+
$this->loadLayout();
|
47 |
+
$this->renderLayout();
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* grid action
|
52 |
+
*
|
53 |
+
* @access public
|
54 |
+
* @return void
|
55 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
56 |
+
*/
|
57 |
+
public function gridAction()
|
58 |
+
{
|
59 |
+
$this->loadLayout();
|
60 |
+
$this->renderLayout();
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* new action
|
65 |
+
*
|
66 |
+
* @access public
|
67 |
+
* @return void
|
68 |
+
* @author Marius Strajeru <ultimate.module.creator@gmail.com>
|
69 |
+
*/
|
70 |
+
public function newAction()
|
71 |
+
{
|
72 |
+
$this->_forward('edit');
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* edit action
|
77 |
+
*
|
78 |
+
* @access public
|
79 |
+
* @return void
|
80 |
+
* @author Marius Strajeru <ultimate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|