Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
DesignerRules.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
36 
41  abstract class DesignerRules
42  {
43  public function allowEditInLayoutTool()
44  {
45  return true;
46  }
47 
48  public function canAddPanels()
49  {
50  return true;
51  }
52 
53  public function canAddRows()
54  {
55  return true;
56  }
57 
58  public function canMergeAndSplitCells()
59  {
60  return true;
61  }
62 
63  public function canModifyCellSettings()
64  {
65  return true;
66  }
67 
68  public function canModifyPanelSettings()
69  {
70  return true;
71  }
72 
73  public function canMovePanels()
74  {
75  return true;
76  }
77 
78  public function canMoveRows()
79  {
80  return true;
81  }
82 
83  public function canRemovePanels()
84  {
85  return true;
86  }
87 
88  public function canRemoveRows()
89  {
90  return true;
91  }
92 
93  public function canConfigureLayoutPanelsType()
94  {
95  return false;
96  }
97 
101  public function formatSavableMetadataFromLayout($metadata, $viewClassName)
102  {
103  assert('is_string($viewClassName)');
104  $rules = $this->getSavableMetadataRules();
105  foreach ($metadata['global']['panels'] as $panelKey => $panel)
106  {
107  foreach ($panel['rows'] as $rowKey => $row)
108  {
109  foreach ($row['cells'] as $cellKey => $cell)
110  {
111  if (is_array($cell['elements']))
112  {
113  foreach ($cell['elements'] as $elementKey => $elementInformation)
114  {
115  foreach ($rules as $rule)
116  {
117  if (static::doesRuleApplyToElement($rule, $elementInformation, $viewClassName))
118  {
119  $ruleClassName = $rule . 'ViewMetadataRules';
120  $ruleClassName::resolveElementMetadata(
121  $elementInformation,
122  $metadata['global']['panels'][$panelKey]['rows'][$rowKey]['cells'][$cellKey]['elements'][$elementKey]
123  );
124  if (method_exists($ruleClassName, 'resolveCellMetadata'))
125  {
126  $ruleClassName::resolveCellMetadata(
127  $elementInformation,
128  $metadata['global']['panels'][$panelKey]['rows'][$rowKey]['cells'][$cellKey]
129  );
130  }
131  }
132  }
133  }
134  }
135  }
136  }
137  }
138  return $metadata;
139  }
140 
145  public function formatSavableElement($element, $viewClassName)
146  {
147  assert('is_array($element)');
148  $rules = $this->getSavableMetadataRules();
149  $finalElement = $element;
150  foreach ($rules as $rule)
151  {
152  if (static::doesRuleApplyToElement($rule, $element, $viewClassName))
153  {
154  $ruleClassName = $rule . 'ViewMetadataRules';
155  $ruleClassName::resolveElementMetadata(
156  $element,
157  $finalElement
158  );
159  }
160  }
161  return $finalElement;
162  }
163 
171  protected static function doesRuleApplyToElement($rule, $elementInformation, $viewClassName)
172  {
173  return true;
174  }
175 
176  public function getCellSettingsAttributes()
177  {
178  return array();
179  }
180 
186  public function getDerivedAttributeTypes()
187  {
188  return array();
189  }
190 
191  public function getDisplayName()
192  {
193  }
194 
198  public function resolveDisplayNameByView($viewClassName)
199  {
200  return $this->getDisplayName();
201  }
202 
203  public function getMetadataViewClassNames($viewClassName, $moduleClassName)
204  {
205  return array($viewClassName);
206  }
207 
208  public function getPanelSettingsAttributes()
209  {
210  return array();
211  }
212 
213  public function getSavableMetadataRules()
214  {
215  }
216 
217  public function mergeRowAndAttributePlacement()
218  {
219  return false;
220  }
221 
222  public function requireAllRequiredFieldsInLayout()
223  {
224  return false;
225  }
226 
231  public function isRequiredAttributeExemptFromBeingPlacedInLayout($attributeName)
232  {
233  return false;
234  }
235 
240  public function areAllPseudoRequiredDerivedAttributeTypesPlacedInLayout($placedDerivedAttributeTypes)
241  {
242  return true;
243  }
244 
245  public function requireOnlyUniqueFieldsInLayout()
246  {
247  return false;
248  }
249 
255  {
256  return array();
257  }
258 
264  {
265  return array();
266  }
267 
273  public function formatEditableMetadataForLayoutParsing($metadata)
274  {
275  assert('isset($metadata["global"]["panels"])');
276  foreach ($metadata['global']['panels'] as $panelKey => $panel)
277  {
278  foreach ($panel['rows'] as $rowKey => $row)
279  {
280  foreach ($row['cells'] as $cellKey => $cell)
281  {
282  if (is_array($cell['elements']))
283  {
284  foreach ($cell['elements'] as $elementKey => $elementInformation)
285  {
286  if (count($row['cells']) == 1 && count($row['cells']) < $this->maxCellsPerRow())
287  {
288  $metadata['global']['panels'][$panelKey]['rows'][$rowKey]['cells'][$cellKey]['elements'][$elementKey]['wide'] = true;
289  }
290  }
291  }
292  }
293  }
294  }
295  return $metadata;
296  }
297 
298  public function maxCellsPerRow()
299  {
300  return 1;
301  }
302 
306  public function shouldPlaceNullElement()
307  {
308  return true;
309  }
310 
315  public static function getSavedLayoutSuccessMessage()
316  {
317  return Zurmo::t('DesignerModule', 'Layout saved successfully.');
318  }
319  }
320 ?>
resolveDisplayNameByView($viewClassName)
formatEditableMetadataForLayoutParsing($metadata)
getNonPlaceableLayoutAttributeTypes()
isRequiredAttributeExemptFromBeingPlacedInLayout($attributeName)
formatSavableElement($element, $viewClassName)
formatSavableMetadataFromLayout($metadata, $viewClassName)
areAllPseudoRequiredDerivedAttributeTypesPlacedInLayout($placedDerivedAttributeTypes)
static getSavedLayoutSuccessMessage()
getNonPlaceableLayoutAttributeNames()
static doesRuleApplyToElement($rule, $elementInformation, $viewClassName)
Generated on Sun Oct 25 2020 07:10:29
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.