Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
MassProgressView.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 
40  abstract class MassProgressView extends ProgressView
41  {
46  protected $skipCount;
47 
48  protected $params;
49 
50  abstract protected function getMessagePrefix();
51 
52  abstract protected function getCompleteMessageSuffix();
53 
54  abstract protected function getInsufficientPermissionSkipSavingUtil();
55 
60  public function __construct(
61  $controllerId,
62  $moduleId,
63  $model,
65  $start,
66  $pageSize,
67  $page,
68  $refreshActionId,
69  $title,
70  $skipCount,
71  $params = null)
72  {
73  assert('$skipCount == null || is_int($skipCount)');
74  $this->skipCount = $skipCount;
75  $this->params = $params;
76  parent::__construct(
77  $controllerId,
78  $moduleId,
79  $model,
81  $start,
82  $pageSize,
83  $page,
84  $refreshActionId,
85  $title);
86  }
87 
88  protected function getMessage()
89  {
90  return $this->getMessagePrefix() . "&#160;" . $this->start . "&#160;-&#160;" . $this->getEndSize() .
91  "&#160;" . Zurmo::t('Core', 'of') . "&#160;" . $this->totalRecordCount . "&#160;" .
92  Zurmo::t('Core', 'total') . "&#160;" .
93  LabelUtil::getUncapitalizedRecordLabelByCount($this->totalRecordCount);
94  }
95 
96  protected function getCompleteMessage()
97  {
98  $successfulCount = $this->callInsufficientPermissionSkipSavingUtilFunction('resolveSuccessfulCountAgainstSkipCount',
99  array($this->totalRecordCount, $this->skipCount));
100  $content = $successfulCount . '&#160;' . LabelUtil::getUncapitalizedRecordLabelByCount($successfulCount)
101  . '&#160;' . $this->getCompleteMessageSuffix() . '.';
102  if ($this->skipCount > 0)
103  {
104  $content .= ZurmoHtml::tag('br') .
105  $this->callInsufficientPermissionSkipSavingUtilFunction(
106  'getSkipCountMessageContentByModelClassName',
107  array($this->skipCount, get_class($this->model)));
108  }
109  return $content;
110  }
111 
112  protected function onProgressComplete()
113  {
114  $this->callInsufficientPermissionSkipSavingUtilFunction('clear', array(get_class($this->model)));
115  }
116 
117  protected function renderFormLinks()
118  {
119  return ZurmoHtml::tag('div',
120  array('id' => $this->progressBarId . '-links', 'style' => 'display:none;'),
121  $this->renderReturnLink()
122  );
123  }
124 
125  protected function renderReturnLink()
126  {
127  return ZurmoHtml::link(ZurmoHtml::wrapLabel($this->renderReturnMessage()), $this->renderReturnUrl(),
128  array('class' => 'white-button'));
129  }
130 
131  protected function renderReturnUrl()
132  {
133  $returnUrl = ArrayUtil::getArrayValue($this->params, 'returnUrl');
134  if (!$returnUrl)
135  {
136  $returnUrl = Yii::app()->createUrl($this->moduleId);
137  }
138  return $returnUrl;
139  }
140 
141  protected function renderReturnMessage()
142  {
143  $returnMessage = ArrayUtil::getArrayValue($this->params, 'returnMessage');
144  if (!$returnMessage)
145  {
146  $returnMessage = Zurmo::t('Core', 'Return to List');
147  }
148  return $returnMessage;
149  }
150 
151  protected function getDefaultInsufficientPermissionSkipSavingUtil()
152  {
153  $util = ArrayUtil::getArrayValue($this->params, 'insufficientPermissionSkipSavingUtil');
154  if (!$util)
155  {
156  $util = $this->getInsufficientPermissionSkipSavingUtil();
157  }
158  return $util;
159  }
160 
161  protected function callInsufficientPermissionSkipSavingUtilFunction($function, $parameters = array())
162  {
163  $util = $this->getDefaultInsufficientPermissionSkipSavingUtil();
164  return call_user_func_array(array($util, $function), $parameters);
165  }
166  }
167 ?>
static wrapLabel($label, $class= 'z-label')
Definition: ZurmoHtml.php:656
static getArrayValue($array, $element, $defaultValue=null)
Definition: ArrayUtil.php:45
__construct($controllerId, $moduleId, $model, $totalRecordCount, $start, $pageSize, $page, $refreshActionId, $title, $skipCount, $params=null)
static getUncapitalizedRecordLabelByCount($count)
Definition: LabelUtil.php:46
Generated on Sat Jul 11 2020 07:10:26
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.