All Data Structures Functions Variables Pages
ReportResultsExtendedGridView.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  public $expandableRows = false;
44 
50  public $leadingHeaders;
51 
52  public function renderTableHeader()
53  {
54  if (!$this->hideHeader)
55  {
56  echo "<thead>\n";
57  if ($this->leadingHeaders != null)
58  {
59  $this->renderLeadingHeaders();
60  }
61  echo "<tr>\n";
62  foreach ($this->columns as $column)
63  {
64  $column->renderHeaderCell();
65  }
66  echo "</tr>\n";
67  echo "</thead>\n";
68  }
69  }
70 
71  public function renderTableBody()
72  {
73  $data = $this->dataProvider->getData();
74  $n = count($data);
75  echo "<tbody>\n";
76 
77  if ($n > 0)
78  {
79  for ($row = 0; $row < $n; ++$row)
80  {
81  $this->renderTableRow($row);
82  if ($this->expandableRows)
83  {
84  $this->renderExpandableRow($this->dataProvider->data[$row]->getId());
85  }
86  }
87  }
88  else
89  {
90  echo '<tr><td colspan="' . count($this->columns) . '" class="empty">';
91  $this->renderEmptyText();
92  echo "</td></tr>\n";
93  }
94  echo "</tbody>\n";
95  }
96 
100  protected function renderExpandableRow($id)
101  {
102  echo '<tr style="display:none;"><td class="hasDrillDownContent" colspan="' . (count($this->columns)) . '">';
103  echo '<div class="drillDownContent" id="drillDownContentFor-' . $id . '"></div>';
104  echo "</td></tr>\n";
105  }
106 
107  protected function renderLeadingHeaders()
108  {
109  $previousGroupByValuesCount = 1;
110  for ($i = 0; $i < count($this->leadingHeaders['rows']); $i++)
111  {
112  echo ZurmoHtml::openTag('tr');
113  for ($j = 0; $j < $this->leadingHeaders['axisCrossingColumnCount']; $j++)
114  {
115  echo ZurmoHtml::tag('th', array(), null);
116  }
117  for ($k = 0; $k < $previousGroupByValuesCount; $k++)
118  {
119  foreach ($this->leadingHeaders['rows'][$i]['groupByValues'] as $value)
120  {
121  echo ZurmoHtml::tag('th',
122  array('colspan' => $this->leadingHeaders['rows'][$i]['colSpan']), $value);
123  }
124  }
125  $previousGroupByValuesCount = count($this->leadingHeaders['rows'][$i]['groupByValues']);
126  if ($i == 0 && isset($this->leadingHeaders['renderTotalColumn']) && $this->leadingHeaders['renderTotalColumn'])
127  {
128  $lastRow = end($this->leadingHeaders['rows']);
129  $colSpanForTotal = $lastRow['colSpan'];
130  echo ZurmoHtml::tag('th',
131  array('class' => 'total-column',
132  'colspan' => $colSpanForTotal,
133  'rowspan' => count($this->leadingHeaders['rows'])),
134  Zurmo::t('Core', 'Total'));
135  }
136  echo '</tr>';
137  }
138  }
139  }
140 ?>
Generated on Fri Feb 21 2020 07:10:36