Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
ExtendedGridView.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 
37  Yii::import('zii.widgets.grid.CGridView');
38 
43  class ExtendedGridView extends CGridView
44  {
45  const CLONE_SUMMARY_CLASS = 'list-view-items-summary-clone';
46 
47  public $template = "{selectRowsSelectors}{summary}\n{items}\n{pager}";
48 
52  public $nullDisplay = '&#160;';
53 
57  public $blankDisplay = '&#160;';
58 
59  public $cssFile = false;
60 
61  public $summaryCloneId;
62 
63  public $renderSpanOnEmptyText = true;
64 
72  public $tableColumnGroup = array();
73 
74  public function init()
75  {
76  $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(
77  Yii::getPathOfAlias('application.core.widgets.assets'))
78  . '/extendedGridView';
79  parent::init();
80  }
81 
85  public function renderTopPager()
86  {
87  if (!$this->enablePagination)
88  {
89  return;
90  }
91  $pager = array();
92  $class = 'TopLinkPager';
93  if (is_array($this->pager))
94  {
95  $pager = $this->pager;
96  if (isset($pager['class']))
97  {
98  throw new NotSupportedException();
99  }
100  }
101  else
102  {
103  throw new NotSupportedException();
104  }
105  $pager['pages'] = $this->dataProvider->getPagination();
106  if ($pager['pages']->getPageCount() > 1)
107  {
108  echo '<div class="' . $this->pagerCssClass . '">';
109  $this->widget($class, $pager);
110  echo '</div>';
111  }
112  }
113 
117  public function renderBottomPager()
118  {
119  if (!$this->enablePagination)
120  {
121  return;
122  }
123  $pager = array();
124  $class = 'BottomLinkPager';
125  if (is_array($this->pager))
126  {
127  $pager = $this->pager;
128  if (isset($pager['class']))
129  {
130  throw new NotSupportedException();
131  }
132  }
133  else
134  {
135  throw new NotSupportedException();
136  }
137  $pager['pages'] = $this->dataProvider->getPagination();
138  if ($pager['pages']->getPageCount() > 1)
139  {
140  echo '<div class="' . $this->pagerCssClass . '">';
141  $this->widget($class, $pager);
142  echo '</div>';
143  }
144  }
145 
151  public function renderPager()
152  {
153  if (!$this->enablePagination)
154  {
155  return;
156  }
157  $pager = array();
158  $class = 'CLinkPager';
159  if (is_string($this->pager))
160  {
161  $class = $this->pager;
162  }
163  elseif (is_array($this->pager))
164  {
165  $pager = $this->pager;
166  if (isset($pager['class']))
167  {
168  $class = $pager['class'];
169  unset($pager['class']);
170  }
171  }
172  $pager['pages'] = $this->dataProvider->getPagination();
173  echo '<div class="' . $this->pagerCssClass . '">';
174  $this->widget($class, $pager);
175  echo '</div>';
176  }
177 
185  public function renderSummary()
186  {
187  parent::renderSummary();
188  Yii::app()->clientScript->registerScript($this->id . '_listViewSummaryChangeScript', '
189  processListViewSummaryClone("' . $this->id . '", "' . $this->summaryCssClass . '", "' . $this->summaryCloneId . '");
190  ');
191  }
192 
196  public function renderEmptyText()
197  {
198  if ($this->emptyText === null)
199  {
200  $emptyText = Zurmo::t('Core', 'No results found');
201  }
202  else
203  {
204  $emptyText = $this->emptyText;
205  }
206 
207  if ($this->renderSpanOnEmptyText)
208  {
209  $icon = ZurmoHtml::tag('span', array('class' => 'icon-empty'), '');
210  echo CHtml::tag('span', array('class' => 'empty'), $icon . $emptyText);
211  }
212  else
213  {
214  echo $emptyText;
215  }
216  }
217 
222  public function renderKeys()
223  {
224  echo CHtml::openTag('div', array(
225  'class' => 'keys',
226  'style' => 'display:none',
227  'title' => Yii::app()->getRequest()->resolveAndGetUrl(),
228  ));
229  foreach ($this->dataProvider->getKeys() as $key)
230  {
231  echo "<span>" . CHtml::encode($key) . "</span>";
232  }
233  echo "</div>\n";
234  }
235 
239  public function renderTableHeader()
240  {
241  if (!$this->hideHeader)
242  {
243  echo "<thead>\n";
244  $this->renderTableColumnGroup();
245  if ($this->filterPosition === self::FILTER_POS_HEADER)
246  {
247  $this->renderFilter();
248  }
249  echo "<tr>\n";
250  foreach ($this->columns as $column)
251  {
252  $column->renderHeaderCell();
253  }
254  echo "</tr>\n";
255  if ($this->filterPosition === self::FILTER_POS_BODY)
256  {
257  $this->renderFilter();
258  }
259  echo "</thead>\n";
260  }
261  elseif ($this->filter !== null && ($this->filterPosition === self::FILTER_POS_HEADER ||
262  $this->filterPosition === self::FILTER_POS_BODY))
263  {
264  echo "<thead>\n";
265  $this->renderFilter();
266  echo "</thead>\n";
267  }
268  }
269 
270  protected function renderTableColumnGroup()
271  {
272  if (!empty($this->tableColumnGroup))
273  {
274  echo '<colgroup>';
275  foreach ($this->tableColumnGroup as $width)
276  {
277  echo '<col style="width:' . $width . '" />';
278  }
279  echo '</colgroup>';
280  }
281  }
282  }
283 ?>
Generated on Wed Sep 30 2020 07:10:29
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.