Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
SummationReportWizardView.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  {
45  public function getTitle()
46  {
47  return parent::getTitle() . ' - ' . Zurmo::t('ReportsModule', 'Summation');
48  }
49 
54  protected function renderContainingViews(WizardActiveForm $form)
55  {
56  $moduleForReportWizardView = new ModuleForReportWizardView ($this->model, $form);
57  $filtersForReportWizardView = new FiltersForReportWizardView($this->model, $form, true);
58  $groupBysForReportWizardView = new GroupBysForReportWizardView($this->model, $form, true);
59  $displayAttributesForReportWizardView = new DisplayAttributesForReportWizardView($this->model, $form, true);
60  $drillDownDisplayAttributesForReportWizardView = new DrillDownDisplayAttributesForReportWizardView($this->model, $form, true);
61  $orderBysForReportWizardView = new OrderBysForReportWizardView($this->model, $form, true);
62  $chartForReportWizardView = new ChartForReportWizardView($this->model, $form, true);
63  $generalDataForReportWizardView = new GeneralDataForReportWizardView($this->model, $form, true);
64 
65  $gridView = new GridView(8, 1);
66  $gridView->setView($moduleForReportWizardView, 0, 0);
67  $gridView->setView($filtersForReportWizardView, 1, 0);
68  $gridView->setView($groupBysForReportWizardView, 2, 0);
69  $gridView->setView($displayAttributesForReportWizardView, 3, 0);
70  $gridView->setView($drillDownDisplayAttributesForReportWizardView, 4, 0);
71  $gridView->setView($orderBysForReportWizardView, 5, 0);
72  $gridView->setView($chartForReportWizardView, 6, 0);
73  $gridView->setView($generalDataForReportWizardView, 7, 0);
74  return $gridView->render();
75  }
76 
81  protected function renderConfigSaveAjax($formName)
82  {
83  assert('is_string($formName)');
84  return "linkId = $('#" . $formName . "').find('.attachLoadingTarget').attr('id');
85  if (linkId == '" . ModuleForReportWizardView::getNextPageLinkId() . "')
86  {
87  $('#" . static::getValidationScenarioInputId() . "').val('" .
88  ReportWizardForm::FILTERS_VALIDATION_SCENARIO . "');
89  $('#ModuleForReportWizardView').hide();
90  " . static::renderTreeViewAjaxScriptContent($formName, 'FiltersForReportWizardView', $this->model->type) . "
91  $('#FiltersForReportWizardView').show();
92  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('25%');
93  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').next().addClass('current-step');
94  }
95  if (linkId == '" . FiltersForReportWizardView::getNextPageLinkId() . "')
96  {
97  $('#" . static::getValidationScenarioInputId() . "').val('" .
98  ReportWizardForm::GROUP_BYS_VALIDATION_SCENARIO . "');
99  $('#FiltersForReportWizardView').hide();
100  " . static::renderTreeViewAjaxScriptContent($formName, 'GroupBysForReportWizardView', $this->model->type) . "
101  $('#GroupBysForReportWizardView').show();
102  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('37.5%');
103  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').next().addClass('current-step');
104  }
105  if (linkId == '" . GroupBysForReportWizardView::getNextPageLinkId() . "')
106  {
107  $('#" . static::getValidationScenarioInputId() . "').val('" .
108  ReportWizardForm::DISPLAY_ATTRIBUTES_VALIDATION_SCENARIO . "');
109  $('#GroupBysForReportWizardView').hide();
110  " . static::renderTreeViewAjaxScriptContent($formName, 'DisplayAttributesForReportWizardView', $this->model->type) . "
111  $('#DisplayAttributesForReportWizardView').show();
112  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('50%');
113  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').next().addClass('current-step');
114  }
116  {
117  $('#" . static::getValidationScenarioInputId() . "').val('" .
118  ReportWizardForm::DRILL_DOWN_DISPLAY_ATTRIBUTES_VALIDATION_SCENARIO . "');
119  $('#DisplayAttributesForReportWizardView').hide();
120  " . static::renderTreeViewAjaxScriptContent($formName, 'DrillDownDisplayAttributesForReportWizardView', $this->model->type) . "
121  $('#DrillDownDisplayAttributesForReportWizardView').show();
122  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('62.5%');
123  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').next().addClass('current-step');
124  }
126  {
127  $('#" . static::getValidationScenarioInputId() . "').val('" .
128  ReportWizardForm::ORDER_BYS_VALIDATION_SCENARIO . "');
129  $('#DrillDownDisplayAttributesForReportWizardView').hide();
130  " . static::renderTreeViewAjaxScriptContent($formName, 'OrderBysForReportWizardView', $this->model->type) . "
131  $('#OrderBysForReportWizardView').show();
132  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('75%');
133  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').next().addClass('current-step');
134  }
135  if (linkId == '" . OrderBysForReportWizardView::getNextPageLinkId() . "')
136  {
137  $('#" . static::getValidationScenarioInputId() . "').val('" .
138  ReportWizardForm::CHART_VALIDATION_SCENARIO . "');
139  $('#OrderBysForReportWizardView').hide();
140  " . static::renderLoadChartSeriesAndRangesScriptContent($formName) . "
141  $('#ChartForReportWizardView').show();
142  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('87.5%');
143  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').next().addClass('current-step');
144  }
145  if (linkId == '" . ChartForReportWizardView::getNextPageLinkId() . "')
146  {
147  $('#" . static::getValidationScenarioInputId() . "').val('" .
148  ReportWizardForm::GENERAL_DATA_VALIDATION_SCENARIO . "');
149  $('#ChartForReportWizardView').hide();
150  $('#GeneralDataForReportWizardView').show();
151  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('100%');
152  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').next().addClass('current-step');
153  }
154  if (linkId == '" . GeneralDataForReportWizardView::getNextPageLinkId() . "')
155  {
156  " . $this->getSaveAjaxString($formName) . "
157  }
158  else
159  {
160  $('#" . $formName . "').find('.attachLoadingTarget').removeClass('loading');
161  $('#" . $formName . "').find('.attachLoadingTarget').removeClass('loading-ajax-submit');
162  $('#" . $formName . "').find('.attachLoadingTarget').removeClass('attachLoadingTarget');
163  }
164  ";
165  }
166 
167  protected function registerClickFlowScript()
168  {
169  Yii::app()->clientScript->registerScript('clickflow', "
170  $('#" . ModuleForReportWizardView::getPreviousPageLinkId() . "').unbind('click');
171  $('#" . ModuleForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
172  {
173  url = document.referrer;
174  window.location.href = url;
175  return false;
176  }
177  );
178  $('#" . FiltersForReportWizardView::getPreviousPageLinkId() . "').unbind('click');
179  $('#" . FiltersForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
180  {
181  $('#" . static::getValidationScenarioInputId() . "').val('" .
182  ReportWizardForm::MODULE_VALIDATION_SCENARIO . "');
183  $('#" . WizardActiveForm::makeErrorsSummaryId(static::getFormId()) . "').hide();
184  $('#ModuleForReportWizardView').show();
185  $('#FiltersForReportWizardView').hide();
186  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('12.5%');
187  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');
188  return false;
189  }
190  );
191  $('#" . GroupBysForReportWizardView::getPreviousPageLinkId() . "').unbind('click');
192  $('#" . GroupBysForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
193  {
194  $('#" . static::getValidationScenarioInputId() . "').val('" .
195  ReportWizardForm::FILTERS_VALIDATION_SCENARIO . "');
196  $('#FiltersForReportWizardView').show();
197  $('#GroupBysForReportWizardView').hide();
198  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('25%');
199  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');
200  return false;
201  }
202  );
203  $('#" . DisplayAttributesForReportWizardView::getPreviousPageLinkId() . "').unbind('click');
204  $('#" . DisplayAttributesForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
205  {
206  $('#" . static::getValidationScenarioInputId() . "').val('" .
207  ReportWizardForm::GROUP_BYS_VALIDATION_SCENARIO . "');
208  $('#GroupBysForReportWizardView').show();
209  $('#DisplayAttributesForReportWizardView').hide();
210  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('37.5%');
211  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');
212  return false;
213  }
214  );
216  $('#" . DrillDownDisplayAttributesForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
217  {
218  $('#" . static::getValidationScenarioInputId() . "').val('" .
219  ReportWizardForm::DISPLAY_ATTRIBUTES_VALIDATION_SCENARIO . "');
220  $('#DisplayAttributesForReportWizardView').show();
221  $('#DrillDownDisplayAttributesForReportWizardView').hide();
222  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('50%');
223  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');
224  return false;
225  }
226  );
227  $('#" . OrderBysForReportWizardView::getPreviousPageLinkId() . "').unbind('click');
228  $('#" . OrderBysForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
229  {
230  $('#" . static::getValidationScenarioInputId() . "').val('" .
231  ReportWizardForm::DRILL_DOWN_DISPLAY_ATTRIBUTES_VALIDATION_SCENARIO . "');
232  $('#DrillDownDisplayAttributesForReportWizardView').show();
233  $('#OrderBysForReportWizardView').hide();
234  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('62.5%');
235  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');
236  return false;
237  }
238  );
239  $('#" . ChartForReportWizardView::getPreviousPageLinkId() . "').unbind('click');
240  $('#" . ChartForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
241  {
242  $('#" . static::getValidationScenarioInputId() . "').val('" .
243  ReportWizardForm::ORDER_BYS_VALIDATION_SCENARIO . "');
244  $('#OrderBysForReportWizardView').show();
245  $('#ChartForReportWizardView').hide();
246  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('75%');
247  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');
248  return false;
249  }
250  );
251  $('#" . GeneralDataForReportWizardView::getPreviousPageLinkId() . "').unbind('click');
252  $('#" . GeneralDataForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()
253  {
254  $('#" . static::getValidationScenarioInputId() . "').val('" .
255  ReportWizardForm::CHART_VALIDATION_SCENARIO . "');
256  $('#ChartForReportWizardView').show();
257  $('#GeneralDataForReportWizardView').hide();
258  $('.StepsAndProgressBarForWizardView').find('.progress-bar').width('87.5%');
259  $('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');
260  return false;
261  }
262  );
263  ");
264  }
265 
270  protected function renderLoadChartSeriesAndRangesScriptContent($formName)
271  {
272  assert('is_string($formName)');
273  $url = Yii::app()->createUrl(static::getModuleId() . '/' . static::getControllerId() . '/getAvailableSeriesAndRangesForChart',
274  array_merge($_GET, array('type' => $this->model->type)));
275  // Begin Not Coding Standard
276  $script = "
277  $.ajax({
278  url : '" . $url . "',
279  type : 'POST',
280  data : $('#" . $formName . "').serialize(),
281  dataType: 'json',
282  success : function(data)
283  {
284  rebuildSelectInputFromDataAndLabels
285  ('SummationReportWizardForm_ChartForReportForm_firstSeries', data.firstSeriesDataAndLabels);
286  rebuildSelectInputFromDataAndLabels
287  ('SummationReportWizardForm_ChartForReportForm_firstRange', data.firstRangeDataAndLabels);
288  rebuildSelectInputFromDataAndLabels
289  ('SummationReportWizardForm_ChartForReportForm_secondSeries', data.secondSeriesDataAndLabels);
290  rebuildSelectInputFromDataAndLabels
291  ('SummationReportWizardForm_ChartForReportForm_secondRange', data.secondRangeDataAndLabels);
292  },
293  error : function()
294  {
295  //todo: error call
296  }
297  });
298  ";
299  // End Not Coding Standard
300  return $script;
301  }
302 
303  protected function registerScripts()
304  {
305  parent::registerScripts();
306  Yii::app()->clientScript->registerScriptFile(
307  Yii::app()->getAssetManager()->publish(
308  Yii::getPathOfAlias('application.core.elements.assets')) . '/SelectInputUtils.js', CClientScript::POS_END);
309  $this->registerLinkedRemovalScript();
310  }
311 
312  protected function registerLinkedRemovalScript()
313  {
314  Yii::app()->clientScript->registerScript('linkedRemovalScript', "
315  //When a group by is removed, remove the corresponding display column and/or order by column if
316  //necessary
317  $('#GroupBysForReportWizardView').find('.remove-dynamic-row-link').live('click', function()
318  {
319  var inputIdBeingRemoved = $(this).prev().find('input').first().val();
320  $('#DisplayAttributesForReportWizardView').find('.dynamic-row').each(function()
321  {
322  if (inputIdBeingRemoved == $(this).find('input').first().val())
323  {
324  $(this).parent().remove();
325  }
326  }
327  );
328  $('#OrderBysForReportWizardView').find('.dynamic-row').each(function()
329  {
330  if (inputIdBeingRemoved == $(this).find('input').first().val())
331  {
332  $(this).parent().remove();
333  }
334  }
335  );
336  }
337  );
338  ");
339  }
340 
341  protected function registerModuleClassNameChangeScriptExtraPart()
342  {
343  return " $('#OrderBysForReportWizardView').find('.dynamic-rows').find('ul:first').find('li').remove();
344  $('#OrderBysTreeArea').html('');
346  $('#GroupBysForReportWizardView').find('.dynamic-rows').find('ul:first').find('li').remove();
347  $('#GroupBysTreeArea').html('');
349  $('#DrillDownDisplayAttributesForReportWizardView').find('.dynamic-rows').find('ul:first').find('li').remove();
350  $('#DrillDownDisplayAttributesTreeArea').html('');
352  $('input:radio[name=\"SummationReportWizardForm[ChartForReportForm][type]\"]').filter('[value=\"\"]').attr('checked', true)
353  onChangeChartType($('.chart-selector:checked'));
354  ";
355  }
356  }
357 ?>
renderContainingViews(WizardActiveForm $form)
getSaveAjaxString($formName, $redirectAfterSave=true, array $additionalAjaxOptions=array())
Definition: WizardView.php:281
Generated on Sat Nov 28 2020 07:10:46
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.