Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
LatestActivitiesListView.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  {
42  protected $controllerId;
43 
44  protected $moduleId;
45 
46  protected $dataProvider;
47 
52  protected $configurationForm;
53 
58  protected $portletDetailsUrl;
59 
65  public $redirectUrl;
66 
71  protected $uniquePageId;
72 
77  protected $showRollUpToggle = true;
78 
83  protected $showOwnedByFilter = true;
84 
85  protected $params;
86 
91  protected $containerModuleClassName;
92 
104  public function __construct(RedBeanModelsDataProvider $dataProvider,
105  LatestActivitiesConfigurationForm $configurationForm,
106  $controllerId,
107  $moduleId,
108  $portletDetailsUrl,
109  $redirectUrl,
110  $uniquePageId,
111  $params,
112  $containerModuleClassName)
113  {
114  assert('is_string($controllerId)');
115  assert('is_string($moduleId)');
116  assert('is_string($portletDetailsUrl)');
117  assert('is_string($redirectUrl)');
118  assert('is_string($uniquePageId)');
119  assert('is_array($params)');
120  assert('is_string($containerModuleClassName)');
121  $this->dataProvider = $dataProvider;
122  $this->configurationForm = $configurationForm;
123  $this->controllerId = $controllerId;
124  $this->moduleId = $moduleId;
125  $this->portletDetailsUrl = $portletDetailsUrl;
126  $this->redirectUrl = $redirectUrl;
127  $this->uniquePageId = $uniquePageId;
128  $this->gridIdSuffix = $uniquePageId;
129  $this->gridId = 'list-view';
130  $this->params = $params;
131  $this->containerModuleClassName = $containerModuleClassName;
132  }
133 
134  protected function renderContent()
135  {
136  $content = $this->renderConfigurationForm();
137  $cClipWidget = new CClipWidget();
138  $cClipWidget->beginClip("ListView");
139  $cClipWidget->widget($this->getGridViewWidgetPath(), $this->getCGridViewParams());
140  $cClipWidget->endClip();
141  $content .= $cClipWidget->getController()->clips['ListView'] . "\n";
142  return $content;
143  }
144 
145  protected static function getGridTemplate()
146  {
147  $preloader = '<div class="list-preloader"><span class="z-spinner"></span></div>';
148  return "\n{items}\n{pager}" . $preloader;
149  }
150 
151  public static function getDefaultMetadata()
152  {
153  $metadata = array(
154  'global' => array(
155  'panels' => array(
156  array(
157  'rows' => array(
158  array('cells' =>
159  array(
160  array(
161  'elements' => array(
162  array('attributeName' => 'null', 'type' => 'ActivitySummary'),
163  ),
164  ),
165  )
166  ),
167  ),
168  ),
169  ),
170  ),
171 
172  );
173  return $metadata;
174  }
175 
176  protected function getCGridViewParams()
177  {
178  return array_merge(parent::getCGridViewParams(), array('hideHeader' => true));
179  }
180 
181  protected function getCGridViewLastColumn()
182  {
183  return array();
184  }
185 
186  protected static function getPagerCssClass()
187  {
188  return 'pager horizontal';
189  }
190 
191  protected function getCGridViewPagerParams()
192  {
193  return array(
194  'firstPageLabel' => '<span>first</span>',
195  'prevPageLabel' => '<span>previous</span>',
196  'nextPageLabel' => '<span>next</span>',
197  'lastPageLabel' => '<span>last</span>',
198  'class' => 'SimpleListLinkPager',
199  'paginationParams' => array_merge(GetUtil::getData(), array('portletId' => $this->params['portletId'])),
200  'route' => 'defaultPortlet/details',
201  );
202  }
203 
209  protected function getCGridViewAfterAjaxUpdate()
210  {
211  // Begin Not Coding Standard
212  return 'js:function(id, data) {
213  processAjaxSuccessError(id, data);
214  }';
215  // End Not Coding Standard
216  }
217 
218  protected function renderConfigurationForm()
219  {
220  $formName = 'latest-activity-configuration-form';
221  $clipWidget = new ClipWidget();
222  list($form, $formStart) = $clipWidget->renderBeginWidget(
223  'ZurmoActiveForm',
224  array(
225  'id' => $formName,
226  )
227  );
228  $content = $formStart;
229  $content .= $this->renderConfigurationFormLayout($form);
230  $formEnd = $clipWidget->renderEndWidget();
231  $content .= $formEnd;
232  $this->registerConfigurationFormLayoutScripts($form);
233  TasksUtil::registerTaskModalDetailsScript($this->getGridViewId());
234  return $content;
235  }
236 
237  protected function renderConfigurationFormLayout($form)
238  {
239  assert('$form instanceof ZurmoActiveForm');
240  $content = null;
241  $innerContent = null;
242  if ($this->showOwnedByFilter)
243  {
244  $element = new LatestActivitiesOwnedByFilterRadioElement($this->configurationForm,
245  'ownedByFilter',
246  $form);
247  $element->editableTemplate = '<div id="LatestActivitiesConfigurationForm_ownedByFilter_area">{content}</div>';
248  $ownedByFilterContent = $element->render();
249  $innerContent .= $ownedByFilterContent;
250  }
251  if ($this->showRollUpToggle)
252  {
253  $element = new LatestActivitiesRollUpFilterRadioElement($this->configurationForm,
254  'rollup', $form);
255  $element->editableTemplate = '{content}';
256  $rollupElementContent = $element->render();
257  $innerContent .= '<div id="LatestActivitiesConfigurationForm_rollup_area">' . $rollupElementContent . '</div>';
258  }
259  if ($innerContent != null)
260  {
261  $content .= '<div class="horizontal-line latest-activity-toolbar">';
262  $content .= $innerContent;
263  $content .= ZurmoHtml::link(Zurmo::t('Core', 'Filters'), '#', array('id' => 'filter-latest-activities-link'));
264  $content .= '</div>' . "\n";
265  }
266  if ($innerContent != null &&
267  $this->configurationForm->filteredByModelName == LatestActivitiesConfigurationForm::FILTERED_BY_ALL)
268  {
269  $startingStyle = "display:none";
270  }
271  else
272  {
273  $startingStyle = null;
274  }
275  $content .= '<div id="filter-portlet-model-bar-' . $this->uniquePageId . '" class="filter-portlet-model-bar" style="' . $startingStyle . '">';
276  $element = new LatestActivitiesMashableFilterRadioElement($this->configurationForm,
277  'filteredByModelName',
278  $form);
279  $element->editableTemplate = '<div id="LatestActivitiesConfigurationForm_filteredByModelName_area">{content}</div>';
280  $content .= $element->render();
281  $content .= '</div>' . "\n";
282  return $content;
283  }
284 
285  protected function registerConfigurationFormLayoutScripts($form)
286  {
287  assert('$form instanceof ZurmoActiveForm');
288  $urlScript = 'js:$.param.querystring("' . $this->portletDetailsUrl . '", "' .
289  $this->dataProvider->getPagination()->pageVar . '=1")'; // Not Coding Standard
290  $ajaxSubmitScript = ZurmoHtml::ajax(array(
291  'type' => 'GET',
292  'data' => 'js:$("#' . $form->getId() . '").serialize()',
293  'url' => $urlScript,
294  'update' => '#' . $this->uniquePageId,
295  'beforeSend' => 'js:function(){$(this).makeSmallLoadingSpinner(true, "#' . $this->getGridViewId() . '"); $("#' . $form->getId() . '").parent().children(".cgrid-view").addClass("loading");}',
296  'complete' => 'js:function()
297  {
298  $("#' . $form->getId() . '").parent().children(".cgrid-view").removeClass("loading");
299  $("#filter-portlet-model-bar-' . $this->uniquePageId . '").show();
300  }'
301  ));
302  Yii::app()->clientScript->registerScript($this->uniquePageId, "
303  $('#LatestActivitiesConfigurationForm_rollup_area').buttonset();
304  $('#LatestActivitiesConfigurationForm_ownedByFilter_area').buttonset();
305  $('#LatestActivitiesConfigurationForm_filteredByModelName_area').buttonset();
306  $('#LatestActivitiesConfigurationForm_rollup_area').change(function()
307  {
308  " . $ajaxSubmitScript . "
309  }
310  );
311  $('#LatestActivitiesConfigurationForm_ownedByFilter_area').change(function()
312  {
313  " . $ajaxSubmitScript . "
314  }
315  );
316  $('#LatestActivitiesConfigurationForm_filteredByModelName_area').change(function()
317  {
318  " . $ajaxSubmitScript . "
319  }
320  );
321  $('#filter-latest-activities-link').click( function()
322  {
323  $('#filter-portlet-model-bar-" . $this->uniquePageId . "').toggle();
324  return false;
325  }
326  );
327  ");
328  }
329 
330  public function isUniqueToAPage()
331  {
332  return false;
333  }
334 
335  public function getOwnedByFilter()
336  {
337  return $this->configurationForm->ownedByFilter;
338  }
339 
340  public function getContainerModuleClassName()
341  {
342  return $this->containerModuleClassName;
343  }
344  }
345 ?>
static registerTaskModalDetailsScript($sourceId)
Definition: TasksUtil.php:515
__construct(RedBeanModelsDataProvider $dataProvider, LatestActivitiesConfigurationForm $configurationForm, $controllerId, $moduleId, $portletDetailsUrl, $redirectUrl, $uniquePageId, $params, $containerModuleClassName)
Generated on Tue Jul 7 2020 07:10:30
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.