Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
SearchAttributesDataCollection.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 
42  {
43  protected $sourceData;
44 
45  protected $model;
46 
47  public function __construct($model)
48  {
49  assert('$model instanceof RedBeanModel || $model instanceof SearchForm');
50  $this->model = $model;
51  }
52 
53  public function getModel()
54  {
55  return $this->model;
56  }
57 
58  public function setSourceData($sourceData)
59  {
60  assert('is_array($sourceData)');
61  $this->sourceData = $sourceData;
62  }
63 
64  public function getSourceData()
65  {
66  if (isset($this->sourceData))
67  {
68  return $this->sourceData;
69  }
70  return $_GET;
71  }
72 
73  public function getDynamicSearchAttributes()
74  {
75  $dynamicSearchAttributes = SearchUtil::
76  getDynamicSearchAttributesFromArray(get_class($this->model), $this->getSourceData());
77  if ($dynamicSearchAttributes == null)
78  {
79  return array();
80  }
81  return $dynamicSearchAttributes;
82  }
83 
84  public function getSanitizedDynamicSearchAttributes()
85  {
86  $dynamicSearchAttributes = SearchUtil::
87  getDynamicSearchAttributesFromArray(get_class($this->model), $this->getSourceData());
88  if ($dynamicSearchAttributes == null)
89  {
90  return array();
91  }
92  return SearchUtil::
93  sanitizeDynamicSearchAttributesByDesignerTypeForSavingModel($this->model, $dynamicSearchAttributes);
94  }
95 
96  public function getDynamicStructure()
97  {
98  return SearchUtil::getDynamicSearchStructureFromArray(get_class($this->model), $this->getSourceData());
99  }
100 
101  public function getAnyMixedAttributesScopeFromModel()
102  {
103  return $this->model->getAnyMixedAttributesScope();
104  }
105 
106  public function getSelectedListAttributesFromModel()
107  {
108  if ($this->model->getListAttributesSelector() != null)
109  {
110  return $this->model->getListAttributesSelector()->getSelected();
111  }
112  }
113 
114  public function getFilterByStarred()
115  {
116  return SearchUtil::getFilterByStarredFromArray(get_class($this->model), $this->getSourceData());
117  }
118 
119  public function getFilteredBy()
120  {
121  return SearchUtil::getFilteredByFromArray(get_class($this->model), $this->getSourceData());
122  }
123 
124  public function hasKanbanBoard()
125  {
126  if ($this->model->getKanbanBoard() == null)
127  {
128  return false;
129  }
130  return true;
131  }
132 
133  public function getKanbanBoard()
134  {
135  return $this->model->getKanbanBoard();
136  }
137 
138  public function shouldClearStickyForKanbanBoard()
139  {
140  if ($this->model->getKanbanBoard() == null)
141  {
142  throw new NotSupportedException();
143  }
144  elseif ($this->model->getKanbanBoard()->getClearSticky())
145  {
146  return true;
147  }
148  return false;
149  }
150 
151  public function getKanbanBoardGroupByAttributeVisibleValuesFromModel()
152  {
153  if ($this->model->getKanbanBoard() != null)
154  {
155  return $this->model->getKanbanBoard()->getGroupByAttributeVisibleValues();
156  }
157  }
158 
159  public function getKanbanBoardSelectedThemeFromModel()
160  {
161  if ($this->model->getKanbanBoard() != null)
162  {
163  return $this->model->getKanbanBoard()->getSelectedTheme();
164  }
165  }
166 
167  public function resolveSearchAttributesFromSourceData()
168  {
169  return SearchUtil::resolveSearchAttributesFromArray(get_class($this->model),
170  get_class($this->model),
171  $this->getSourceData());
172  }
173 
174  public function resolveAnyMixedAttributesScopeForSearchModelFromSourceData()
175  {
177  get_class($this->model),
178  $this->getSourceData());
179  }
180 
181  public function resolveSelectedListAttributesForSearchModelFromSourceData()
182  {
184  get_class($this->model),
185  $this->getSourceData());
186  }
187 
188  public function resolveKanbanBoardOptionsForSearchModelFromSourceData()
189  {
191  get_class($this->model),
192  $this->getSourceData());
193  }
194 
195  public function resolveSortAttributeFromSourceData($name)
196  {
197  assert('is_string($name)');
198  $sortAttribute = SearchUtil::resolveSortAttributeFromArray($name, $this->getSourceData());
199  if ($sortAttribute == null)
200  {
201  if (!empty($this->model->sortAttribute))
202  {
203  $sortAttribute = $this->model->sortAttribute;
204  }
205  else
206  {
207  $sortAttribute = null;
208  }
209  }
210 
211  return $sortAttribute;
212  }
213 
214  public function resolveSortDescendingFromSourceData($name)
215  {
216  assert('is_string($name)');
217  $sortDescending = SearchUtil::resolveSortDescendingFromArray($name, $this->getSourceData());
218  if (!isset($sortDescending))
219  {
220  if (!empty($this->model->sortDescending))
221  {
222  $sortDescending = true;
223  }
224  else
225  {
226  $sortDescending = false;
227  }
228  }
229  return $sortDescending;
230  }
231 
232  public function resolveFilterByStarredFromSourceData()
233  {
235  get_class($this->model),
236  $this->getSourceData());
237  }
238 
239  public function resolveFilteredByFromSourceData()
240  {
241  SearchUtil::resolveFilteredByFromArray($this->model,
242  get_class($this->model),
243  $this->getSourceData());
244  }
245  }
246 ?>
static resolveSelectedListAttributesForSearchModelFromArray($searchModel, $getArrayName, $sourceData)
Definition: SearchUtil.php:111
static sanitizeDynamicSearchAttributesByDesignerTypeForSavingModel(DynamicSearchForm $searchModel, $dynamicSearchAttributes)
Definition: SearchUtil.php:430
static getDynamicSearchStructureFromArray($getArrayName, $sourceData)
Definition: SearchUtil.php:503
static resolveKanbanBoardOptionsForSearchModelFromArray($searchModel, $getArrayName, $sourceData)
Definition: KanbanBoard.php:76
static getFilterByStarredFromArray($getArrayName, $sourceData)
Definition: SearchUtil.php:518
static getDynamicSearchAttributesFromArray($getArrayName, $sourceData)
Definition: SearchUtil.php:404
static resolveAnyMixedAttributesScopeForSearchModelFromArray($searchModel, $getArrayName, $sourceData)
Definition: SearchUtil.php:80
static resolveFilterByStarredFromArray($searchModel, $getArrayName, $sourceData)
Definition: SearchUtil.php:209
static resolveSearchAttributesFromArray($getArrayName, $formModelClassName, $sourceData)
Definition: SearchUtil.php:52
static resolveSortAttributeFromArray($getArrayPrefixName, $sourceData)
Definition: SearchUtil.php:173
static resolveSortDescendingFromArray($getArrayPrefixName, $sourceData)
Definition: SearchUtil.php:190
Generated on Sun Jul 5 2020 07:10:29
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.