Passed
Push — master ( 994f5c...2ea6c2 )
by Patrick
02:04
created
library/Trapdirector/Tables/TrapDirectorTable.php 3 patches
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -6,195 +6,195 @@
 block discarded – undo
6 6
 abstract class TrapDirectorTable
7 7
 {
8 8
     
9
-    use TrapDirectorTableFilter;
10
-    use TrapDirectorTablePaging;
11
-    use TrapDirectorTableOrder;
12
-    use TrapDirectorTableGrouping;
9
+	use TrapDirectorTableFilter;
10
+	use TrapDirectorTablePaging;
11
+	use TrapDirectorTableOrder;
12
+	use TrapDirectorTableGrouping;
13 13
     
14
-    /** @var array $titles table titles (name, display value) */
15
-    protected $titles = null;
14
+	/** @var array $titles table titles (name, display value) */
15
+	protected $titles = null;
16 16
 
17
-    /** @var array $content table content  (name, sb column name). name index must be the same as $titles*/
18
-    protected $content = null;
17
+	/** @var array $content table content  (name, sb column name). name index must be the same as $titles*/
18
+	protected $content = null;
19 19
     
20
-    /** @var array $columnNames names of columns for filtering */
21
-    protected $columnNames = array();
20
+	/** @var array $columnNames names of columns for filtering */
21
+	protected $columnNames = array();
22 22
     
23
-    /** @var mixed $dbConn connection to database  */
24
-    protected $dbConn = null;
23
+	/** @var mixed $dbConn connection to database  */
24
+	protected $dbConn = null;
25 25
     
26
-    /** Current view **/
27
-    protected $view;
26
+	/** Current view **/
27
+	protected $view;
28 28
     
29
-    protected $urlPath;
29
+	protected $urlPath;
30 30
     
31
-    // Database stuff
31
+	// Database stuff
32 32
    /** @var array $table (db ref, name) */
33
-    protected $table = array();
34
-    
35
-    /** @var mixed  $query Query in database; */
36
-    protected $query = null;
37
-    
38
-    function __construct(array $table,array $titles, array $columns, array $columnNames, $dbConn , $view, $urlPath)
39
-    {
40
-        $this->table = $table;
41
-        $this->titles = $titles;
42
-        $this->content = $columns;
43
-        $this->columnNames = $columnNames;
44
-        $this->dbConn = $dbConn;
33
+	protected $table = array();
34
+    
35
+	/** @var mixed  $query Query in database; */
36
+	protected $query = null;
37
+    
38
+	function __construct(array $table,array $titles, array $columns, array $columnNames, $dbConn , $view, $urlPath)
39
+	{
40
+		$this->table = $table;
41
+		$this->titles = $titles;
42
+		$this->content = $columns;
43
+		$this->columnNames = $columnNames;
44
+		$this->dbConn = $dbConn;
45 45
         
46
-        $this->view = $view;
47
-        $this->urlPath = $urlPath;
46
+		$this->view = $view;
47
+		$this->urlPath = $urlPath;
48 48
         
49
-        return $this;
50
-    }
49
+		return $this;
50
+	}
51 51
 
52 52
     
53
-    /************** GET variables and URLs *************/
54
-    public function getParams(array $getVars)
55
-    {
56
-        $this->getFilterQuery($getVars);
57
-        $this->getPagingQuery($getVars);
58
-        $this->getOrderQuery($getVars);
59
-    }
60
-    
61
-    public function getCurrentURL()
62
-    {
63
-        return '?';
64
-    }
65
-    
66
-    protected function getCurrentURLAndQS(string $caller)
67
-    {
68
-        $actionURL = $this->getCurrentURL() . '?' ;
69
-        $QSList=array();
70
-        if ($caller != 'filter' && $this->curFilterQuery() != '')
71
-            array_push($QSList , $this->curFilterQuery());
53
+	/************** GET variables and URLs *************/
54
+	public function getParams(array $getVars)
55
+	{
56
+		$this->getFilterQuery($getVars);
57
+		$this->getPagingQuery($getVars);
58
+		$this->getOrderQuery($getVars);
59
+	}
60
+    
61
+	public function getCurrentURL()
62
+	{
63
+		return '?';
64
+	}
65
+    
66
+	protected function getCurrentURLAndQS(string $caller)
67
+	{
68
+		$actionURL = $this->getCurrentURL() . '?' ;
69
+		$QSList=array();
70
+		if ($caller != 'filter' && $this->curFilterQuery() != '')
71
+			array_push($QSList , $this->curFilterQuery());
72 72
         
73
-        if ($caller != 'paging' && $caller != 'filter' && $this->curPagingQuery() != '')
74
-            array_push($QSList , $this->curPagingQuery());
73
+		if ($caller != 'paging' && $caller != 'filter' && $this->curPagingQuery() != '')
74
+			array_push($QSList , $this->curPagingQuery());
75 75
  
76
-        if ($caller != 'order' && $this->curOrderQuery() != '')
77
-            array_push($QSList , $this->curOrderQuery());
76
+		if ($caller != 'order' && $this->curOrderQuery() != '')
77
+			array_push($QSList , $this->curOrderQuery());
78 78
         
79
-        if (count($QSList) != 0)
80
-            $actionURL .=  implode('&', $QSList) . '&';
79
+		if (count($QSList) != 0)
80
+			$actionURL .=  implode('&', $QSList) . '&';
81 81
         
82
-        return $actionURL;
83
-    }
84
-    
85
-    /************* DB queries ******************/
86
-    /**
87
-     * Get base query in $this->query
88
-     * @return  TrapDirectorTable
89
-     */
90
-    public function getBaseQuery()
91
-    {
92
-        $this->query = $this->dbConn->select();
93
-        $this->query = $this->query->from(
94
-            $this->table,
95
-            $this->content
96
-            );
82
+		return $actionURL;
83
+	}
84
+    
85
+	/************* DB queries ******************/
86
+	/**
87
+	 * Get base query in $this->query
88
+	 * @return  TrapDirectorTable
89
+	 */
90
+	public function getBaseQuery()
91
+	{
92
+		$this->query = $this->dbConn->select();
93
+		$this->query = $this->query->from(
94
+			$this->table,
95
+			$this->content
96
+			);
97 97
         
98
-        return $this;
99
-    }
100
-    
101
-    public function fullQuery()
102
-    {
103
-        $this->getBaseQuery()
104
-        ->applyFilter()
105
-        ->applyPaging()
106
-        ->applyOrder();
98
+		return $this;
99
+	}
100
+    
101
+	public function fullQuery()
102
+	{
103
+		$this->getBaseQuery()
104
+		->applyFilter()
105
+		->applyPaging()
106
+		->applyOrder();
107 107
         
108
-        return $this->dbConn->fetchAll($this->query);
109
-        //return $this->query->fetchAll();
110
-    }
108
+		return $this->dbConn->fetchAll($this->query);
109
+		//return $this->query->fetchAll();
110
+	}
111 111
      
112
-    /*************** Rendering *************************/
113
-    
114
-    public function titleOrder($name)
115
-    {
116
-        return $this->content[$name];
117
-    }
118
-    
119
-    public function renderTitles()
120
-    {
121
-        $html = "<thead>\n<tr>\n";
122
-        foreach ($this->titles as $name => $values)
123
-        {
124
-            $titleOrder = $this->titleOrder($name);  // TODO : put this as function of order trait
125
-            if ($titleOrder != NULL)
126
-            {
127
-                if (isset($this->order[$titleOrder]))
128
-                {
129
-                    if ($this->order[$titleOrder] == 'ASC')
130
-                    {
131
-                        $titleOrder.='DESC';
132
-                    }
133
-                    else
134
-                    {
135
-                        $titleOrder.='ASC';
136
-                    }
137
-                }
138
-                else 
139
-                {
140
-                    $titleOrder.='ASC';
141
-                }
142
-                $actionURL = $this->getCurrentURLAndQS('order').'o='.$titleOrder;
143
-                $html .= '<th><a href="'.$actionURL.'">' . $values . '</a></th>';
144
-            }
145
-            else 
146
-            {
147
-                $html .= '<th>' . $values . '</th>';
148
-            }          
149
-        }
150
-        $html .= "</tr>\n</thead>\n";
151
-        return $html;
152
-    }
153
-    
154
-    public function renderLine( $value)
155
-    {
156
-        $html = '';
157
-        $titleNames = array_keys($this->titles);
158
-        foreach ($titleNames as $name )
159
-        {
160
-            $html .= '<td>';
161
-            $html .= $value->$name;
162
-            $html .= "</td>\n";
163
-        }
164
-        return $html;
165
-    }
166
-    
167
-    public function renderTable(array $values)
168
-    {
169
-       $html = '<tbody id="obj_table_body">';
170
-       foreach($values as $value)
171
-       {
172
-           $html .= $this->groupingNextLine($value);
112
+	/*************** Rendering *************************/
113
+    
114
+	public function titleOrder($name)
115
+	{
116
+		return $this->content[$name];
117
+	}
118
+    
119
+	public function renderTitles()
120
+	{
121
+		$html = "<thead>\n<tr>\n";
122
+		foreach ($this->titles as $name => $values)
123
+		{
124
+			$titleOrder = $this->titleOrder($name);  // TODO : put this as function of order trait
125
+			if ($titleOrder != NULL)
126
+			{
127
+				if (isset($this->order[$titleOrder]))
128
+				{
129
+					if ($this->order[$titleOrder] == 'ASC')
130
+					{
131
+						$titleOrder.='DESC';
132
+					}
133
+					else
134
+					{
135
+						$titleOrder.='ASC';
136
+					}
137
+				}
138
+				else 
139
+				{
140
+					$titleOrder.='ASC';
141
+				}
142
+				$actionURL = $this->getCurrentURLAndQS('order').'o='.$titleOrder;
143
+				$html .= '<th><a href="'.$actionURL.'">' . $values . '</a></th>';
144
+			}
145
+			else 
146
+			{
147
+				$html .= '<th>' . $values . '</th>';
148
+			}          
149
+		}
150
+		$html .= "</tr>\n</thead>\n";
151
+		return $html;
152
+	}
153
+    
154
+	public function renderLine( $value)
155
+	{
156
+		$html = '';
157
+		$titleNames = array_keys($this->titles);
158
+		foreach ($titleNames as $name )
159
+		{
160
+			$html .= '<td>';
161
+			$html .= $value->$name;
162
+			$html .= "</td>\n";
163
+		}
164
+		return $html;
165
+	}
166
+    
167
+	public function renderTable(array $values)
168
+	{
169
+	   $html = '<tbody id="obj_table_body">';
170
+	   foreach($values as $value)
171
+	   {
172
+		   $html .= $this->groupingNextLine($value);
173 173
            
174
-           $html .= "<tr>\n";
175
-           $html .= $this->renderLine($value);
176
-           $html .= "</tr>\n";
177
-       }
178
-       $html .= '</tbody>';
179
-       return $html;
180
-    }
181
-    
182
-    public function render()
183
-    {
184
-        $html = '';
174
+		   $html .= "<tr>\n";
175
+		   $html .= $this->renderLine($value);
176
+		   $html .= "</tr>\n";
177
+	   }
178
+	   $html .= '</tbody>';
179
+	   return $html;
180
+	}
181
+    
182
+	public function render()
183
+	{
184
+		$html = '';
185 185
         
186 186
         
187
-        $values = $this->fullQuery();
188
-        $this->initGrouping();
187
+		$values = $this->fullQuery();
188
+		$this->initGrouping();
189 189
         
190
-        $html.="<table class='simple common-table table-row-selectable'>\n";
190
+		$html.="<table class='simple common-table table-row-selectable'>\n";
191 191
         
192
-        $html .= $this->renderTitles();
193
-        $html .= $this->renderTable($values);
194
-        $html .= '</table>'; 
192
+		$html .= $this->renderTitles();
193
+		$html .= $this->renderTable($values);
194
+		$html .= '</table>'; 
195 195
         
196 196
 
197
-        return $html;
198
-    }
197
+		return $html;
198
+	}
199 199
     
200 200
 }
201 201
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
     use TrapDirectorTableGrouping;
13 13
     
14 14
     /** @var array $titles table titles (name, display value) */
15
-    protected $titles = null;
15
+    protected $titles=null;
16 16
 
17 17
     /** @var array $content table content  (name, sb column name). name index must be the same as $titles*/
18
-    protected $content = null;
18
+    protected $content=null;
19 19
     
20 20
     /** @var array $columnNames names of columns for filtering */
21
-    protected $columnNames = array();
21
+    protected $columnNames=array();
22 22
     
23 23
     /** @var mixed $dbConn connection to database  */
24
-    protected $dbConn = null;
24
+    protected $dbConn=null;
25 25
     
26 26
     /** Current view **/
27 27
     protected $view;
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
     
31 31
     // Database stuff
32 32
    /** @var array $table (db ref, name) */
33
-    protected $table = array();
33
+    protected $table=array();
34 34
     
35 35
     /** @var mixed  $query Query in database; */
36
-    protected $query = null;
36
+    protected $query=null;
37 37
     
38
-    function __construct(array $table,array $titles, array $columns, array $columnNames, $dbConn , $view, $urlPath)
38
+    function __construct(array $table, array $titles, array $columns, array $columnNames, $dbConn, $view, $urlPath)
39 39
     {
40
-        $this->table = $table;
41
-        $this->titles = $titles;
42
-        $this->content = $columns;
43
-        $this->columnNames = $columnNames;
44
-        $this->dbConn = $dbConn;
40
+        $this->table=$table;
41
+        $this->titles=$titles;
42
+        $this->content=$columns;
43
+        $this->columnNames=$columnNames;
44
+        $this->dbConn=$dbConn;
45 45
         
46
-        $this->view = $view;
47
-        $this->urlPath = $urlPath;
46
+        $this->view=$view;
47
+        $this->urlPath=$urlPath;
48 48
         
49 49
         return $this;
50 50
     }
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
     
66 66
     protected function getCurrentURLAndQS(string $caller)
67 67
     {
68
-        $actionURL = $this->getCurrentURL() . '?' ;
68
+        $actionURL=$this->getCurrentURL().'?';
69 69
         $QSList=array();
70 70
         if ($caller != 'filter' && $this->curFilterQuery() != '')
71
-            array_push($QSList , $this->curFilterQuery());
71
+            array_push($QSList, $this->curFilterQuery());
72 72
         
73 73
         if ($caller != 'paging' && $caller != 'filter' && $this->curPagingQuery() != '')
74
-            array_push($QSList , $this->curPagingQuery());
74
+            array_push($QSList, $this->curPagingQuery());
75 75
  
76 76
         if ($caller != 'order' && $this->curOrderQuery() != '')
77
-            array_push($QSList , $this->curOrderQuery());
77
+            array_push($QSList, $this->curOrderQuery());
78 78
         
79 79
         if (count($QSList) != 0)
80
-            $actionURL .=  implode('&', $QSList) . '&';
80
+            $actionURL.=implode('&', $QSList).'&';
81 81
         
82 82
         return $actionURL;
83 83
     }
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function getBaseQuery()
91 91
     {
92
-        $this->query = $this->dbConn->select();
93
-        $this->query = $this->query->from(
92
+        $this->query=$this->dbConn->select();
93
+        $this->query=$this->query->from(
94 94
             $this->table,
95 95
             $this->content
96 96
             );
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
     
119 119
     public function renderTitles()
120 120
     {
121
-        $html = "<thead>\n<tr>\n";
121
+        $html="<thead>\n<tr>\n";
122 122
         foreach ($this->titles as $name => $values)
123 123
         {
124
-            $titleOrder = $this->titleOrder($name);  // TODO : put this as function of order trait
124
+            $titleOrder=$this->titleOrder($name); // TODO : put this as function of order trait
125 125
             if ($titleOrder != NULL)
126 126
             {
127 127
                 if (isset($this->order[$titleOrder]))
@@ -139,59 +139,59 @@  discard block
 block discarded – undo
139 139
                 {
140 140
                     $titleOrder.='ASC';
141 141
                 }
142
-                $actionURL = $this->getCurrentURLAndQS('order').'o='.$titleOrder;
143
-                $html .= '<th><a href="'.$actionURL.'">' . $values . '</a></th>';
142
+                $actionURL=$this->getCurrentURLAndQS('order').'o='.$titleOrder;
143
+                $html.='<th><a href="'.$actionURL.'">'.$values.'</a></th>';
144 144
             }
145 145
             else 
146 146
             {
147
-                $html .= '<th>' . $values . '</th>';
147
+                $html.='<th>'.$values.'</th>';
148 148
             }          
149 149
         }
150
-        $html .= "</tr>\n</thead>\n";
150
+        $html.="</tr>\n</thead>\n";
151 151
         return $html;
152 152
     }
153 153
     
154
-    public function renderLine( $value)
154
+    public function renderLine($value)
155 155
     {
156
-        $html = '';
157
-        $titleNames = array_keys($this->titles);
158
-        foreach ($titleNames as $name )
156
+        $html='';
157
+        $titleNames=array_keys($this->titles);
158
+        foreach ($titleNames as $name)
159 159
         {
160
-            $html .= '<td>';
161
-            $html .= $value->$name;
162
-            $html .= "</td>\n";
160
+            $html.='<td>';
161
+            $html.=$value->$name;
162
+            $html.="</td>\n";
163 163
         }
164 164
         return $html;
165 165
     }
166 166
     
167 167
     public function renderTable(array $values)
168 168
     {
169
-       $html = '<tbody id="obj_table_body">';
170
-       foreach($values as $value)
169
+       $html='<tbody id="obj_table_body">';
170
+       foreach ($values as $value)
171 171
        {
172
-           $html .= $this->groupingNextLine($value);
172
+           $html.=$this->groupingNextLine($value);
173 173
            
174
-           $html .= "<tr>\n";
175
-           $html .= $this->renderLine($value);
176
-           $html .= "</tr>\n";
174
+           $html.="<tr>\n";
175
+           $html.=$this->renderLine($value);
176
+           $html.="</tr>\n";
177 177
        }
178
-       $html .= '</tbody>';
178
+       $html.='</tbody>';
179 179
        return $html;
180 180
     }
181 181
     
182 182
     public function render()
183 183
     {
184
-        $html = '';
184
+        $html='';
185 185
         
186 186
         
187
-        $values = $this->fullQuery();
187
+        $values=$this->fullQuery();
188 188
         $this->initGrouping();
189 189
         
190 190
         $html.="<table class='simple common-table table-row-selectable'>\n";
191 191
         
192
-        $html .= $this->renderTitles();
193
-        $html .= $this->renderTable($values);
194
-        $html .= '</table>'; 
192
+        $html.=$this->renderTitles();
193
+        $html.=$this->renderTable($values);
194
+        $html.='</table>'; 
195 195
         
196 196
 
197 197
         return $html;
Please login to merge, or discard this patch.
Braces   +15 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,17 +67,21 @@  discard block
 block discarded – undo
67 67
     {
68 68
         $actionURL = $this->getCurrentURL() . '?' ;
69 69
         $QSList=array();
70
-        if ($caller != 'filter' && $this->curFilterQuery() != '')
71
-            array_push($QSList , $this->curFilterQuery());
70
+        if ($caller != 'filter' && $this->curFilterQuery() != '') {
71
+                    array_push($QSList , $this->curFilterQuery());
72
+        }
72 73
         
73
-        if ($caller != 'paging' && $caller != 'filter' && $this->curPagingQuery() != '')
74
-            array_push($QSList , $this->curPagingQuery());
74
+        if ($caller != 'paging' && $caller != 'filter' && $this->curPagingQuery() != '') {
75
+                    array_push($QSList , $this->curPagingQuery());
76
+        }
75 77
  
76
-        if ($caller != 'order' && $this->curOrderQuery() != '')
77
-            array_push($QSList , $this->curOrderQuery());
78
+        if ($caller != 'order' && $this->curOrderQuery() != '') {
79
+                    array_push($QSList , $this->curOrderQuery());
80
+        }
78 81
         
79
-        if (count($QSList) != 0)
80
-            $actionURL .=  implode('&', $QSList) . '&';
82
+        if (count($QSList) != 0) {
83
+                    $actionURL .=  implode('&', $QSList) . '&';
84
+        }
81 85
         
82 86
         return $actionURL;
83 87
     }
@@ -129,20 +133,17 @@  discard block
 block discarded – undo
129 133
                     if ($this->order[$titleOrder] == 'ASC')
130 134
                     {
131 135
                         $titleOrder.='DESC';
132
-                    }
133
-                    else
136
+                    } else
134 137
                     {
135 138
                         $titleOrder.='ASC';
136 139
                     }
137
-                }
138
-                else 
140
+                } else 
139 141
                 {
140 142
                     $titleOrder.='ASC';
141 143
                 }
142 144
                 $actionURL = $this->getCurrentURLAndQS('order').'o='.$titleOrder;
143 145
                 $html .= '<th><a href="'.$actionURL.'">' . $values . '</a></th>';
144
-            }
145
-            else 
146
+            } else 
146 147
             {
147 148
                 $html .= '<th>' . $values . '</th>';
148 149
             }          
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapDirectorTablePaging.php 3 patches
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
     protected function curPagingQuery()
48 48
     {
49
-        if ($this->currentPage == '') return '';
49
+        if ($this->currentPage == '') {
50
+        	return '';
51
+        }
50 52
         return 'page='.$this->currentPage;
51 53
     }
52 54
     
@@ -58,10 +60,14 @@  discard block
 block discarded – undo
58 60
             return  'count : ' . $this->count() . '<br>';
59 61
         }
60 62
         
61
-        if ($this->currentPage == 0) $this->currentPage = 1;
63
+        if ($this->currentPage == 0) {
64
+        	$this->currentPage = 1;
65
+        }
62 66
         
63 67
         $numPages = intdiv($count , $this->maxPerPage);
64
-        if ($count % $this->maxPerPage != 0 ) $numPages++;
68
+        if ($count % $this->maxPerPage != 0 ) {
69
+        	$numPages++;
70
+        }
65 71
         
66 72
         $html = '<div class="pagination-control" role="navigation">';
67 73
         $html .= '<ul class="nav tab-nav">';
@@ -75,8 +81,7 @@  discard block
 block discarded – undo
75 81
                      </span>
76 82
                 </li>
77 83
                ';
78
-        }
79
-        else 
84
+        } else 
80 85
         {
81 86
             $html .= '
82 87
                 <li class="nav-item">
@@ -92,7 +97,9 @@  discard block
 block discarded – undo
92 97
             $active = ($this->currentPage == $i) ? 'active' : '';
93 98
             $first = ($i-1)*$this->maxPerPage+1;
94 99
             $last = $i * $this->maxPerPage;
95
-            if ($last > $count) $last = $count;
100
+            if ($last > $count) {
101
+            	$last = $count;
102
+            }
96 103
             $display = 'Show rows '. $first . ' to '. $last .' of '. $count;
97 104
             $html .= '<li class="' . $active . ' nav-item">
98 105
                     <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. $i .'" title="' . $display . '" aria-label="' . $display . '">
@@ -111,8 +118,7 @@  discard block
 block discarded – undo
111 118
                      </span>
112 119
                 </li>
113 120
                ';
114
-        }
115
-        else
121
+        } else
116 122
         {
117 123
             $html .= '
118 124
                 <li class="nav-item">
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -6,72 +6,72 @@  discard block
 block discarded – undo
6 6
 trait TrapDirectorTablePaging
7 7
 {
8 8
    
9
-    /*************** Paging *************/
10
-    protected $maxPerPage = 25;
9
+	/*************** Paging *************/
10
+	protected $maxPerPage = 25;
11 11
     
12
-    protected $currentPage = 0;
12
+	protected $currentPage = 0;
13 13
         
14
-    /**** var & func of TrapDirectorTable used ***/
15
-    protected $query;
16
-    abstract protected function getCurrentURLAndQS(string $caller);
17
-    abstract public function applyFilter();
14
+	/**** var & func of TrapDirectorTable used ***/
15
+	protected $query;
16
+	abstract protected function getCurrentURLAndQS(string $caller);
17
+	abstract public function applyFilter();
18 18
     
19
-    /*****************  Paging and counting *********/
19
+	/*****************  Paging and counting *********/
20 20
     
21
-    public function countQuery()
22
-    {
23
-        $this->query = $this->dbConn->select();
24
-        $this->query = $this->query
25
-            ->from(
26
-                $this->table,
27
-                array('COUNT(*)')
28
-                );
29
-        $this->applyFilter();                   
30
-    }
21
+	public function countQuery()
22
+	{
23
+		$this->query = $this->dbConn->select();
24
+		$this->query = $this->query
25
+			->from(
26
+				$this->table,
27
+				array('COUNT(*)')
28
+				);
29
+		$this->applyFilter();                   
30
+	}
31 31
     
32
-    public function count()
33
-    {
34
-        $this->countQuery();
35
-        return $this->dbConn->fetchOne($this->query);
36
-    }
32
+	public function count()
33
+	{
34
+		$this->countQuery();
35
+		return $this->dbConn->fetchOne($this->query);
36
+	}
37 37
     
38
-    public function setMaxPerPage(int $max)
39
-    {
40
-        $this->maxPerPage = $max;
41
-    }
38
+	public function setMaxPerPage(int $max)
39
+	{
40
+		$this->maxPerPage = $max;
41
+	}
42 42
     
43
-    protected function getPagingQuery(array $getVars)
44
-    {
45
-        if (isset($getVars['page']))
46
-        {
47
-            $this->currentPage = $getVars['page'];
48
-        }
49
-    }
43
+	protected function getPagingQuery(array $getVars)
44
+	{
45
+		if (isset($getVars['page']))
46
+		{
47
+			$this->currentPage = $getVars['page'];
48
+		}
49
+	}
50 50
 
51
-    protected function curPagingQuery()
52
-    {
53
-        if ($this->currentPage == '') return '';
54
-        return 'page='.$this->currentPage;
55
-    }
51
+	protected function curPagingQuery()
52
+	{
53
+		if ($this->currentPage == '') return '';
54
+		return 'page='.$this->currentPage;
55
+	}
56 56
     
57
-    public function renderPagingHeader()
58
-    {
59
-        $count = $this->count();
60
-        if ($count <= $this->maxPerPage )
61
-        {
62
-            return  'count : ' . $this->count() . '<br>';
63
-        }
57
+	public function renderPagingHeader()
58
+	{
59
+		$count = $this->count();
60
+		if ($count <= $this->maxPerPage )
61
+		{
62
+			return  'count : ' . $this->count() . '<br>';
63
+		}
64 64
         
65
-        if ($this->currentPage == 0) $this->currentPage = 1;
65
+		if ($this->currentPage == 0) $this->currentPage = 1;
66 66
         
67
-        $numPages = intdiv($count , $this->maxPerPage);
68
-        if ($count % $this->maxPerPage != 0 ) $numPages++;
67
+		$numPages = intdiv($count , $this->maxPerPage);
68
+		if ($count % $this->maxPerPage != 0 ) $numPages++;
69 69
         
70
-        $html = '<div class="pagination-control" role="navigation">';
71
-        $html .= '<ul class="nav tab-nav">';
72
-        if ($this->currentPage <=1)
73
-        {
74
-            $html .= '
70
+		$html = '<div class="pagination-control" role="navigation">';
71
+		$html .= '<ul class="nav tab-nav">';
72
+		if ($this->currentPage <=1)
73
+		{
74
+			$html .= '
75 75
                 <li class="nav-item disabled" aria-hidden="true">
76 76
                     <span class="previous-page">
77 77
                             <span class="sr-only">Previous page</span>
@@ -79,35 +79,35 @@  discard block
 block discarded – undo
79 79
                      </span>
80 80
                 </li>
81 81
                ';
82
-        }
83
-        else 
84
-        {
85
-            $html .= '
82
+		}
83
+		else 
84
+		{
85
+			$html .= '
86 86
                 <li class="nav-item">
87 87
                     <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage - 1 ).'" class="previous-page" >
88 88
                             <i aria-hidden="true" class="icon-angle-double-left"></i>            
89 89
                      </a>
90 90
                 </li>
91 91
             ';
92
-        }
92
+		}
93 93
         
94
-        for ($i=1; $i <= $numPages ; $i++)
95
-        {
96
-            $active = ($this->currentPage == $i) ? 'active' : '';
97
-            $first = ($i-1)*$this->maxPerPage+1;
98
-            $last = $i * $this->maxPerPage;
99
-            if ($last > $count) $last = $count;
100
-            $display = 'Show rows '. $first . ' to '. $last .' of '. $count;
101
-            $html .= '<li class="' . $active . ' nav-item">
94
+		for ($i=1; $i <= $numPages ; $i++)
95
+		{
96
+			$active = ($this->currentPage == $i) ? 'active' : '';
97
+			$first = ($i-1)*$this->maxPerPage+1;
98
+			$last = $i * $this->maxPerPage;
99
+			if ($last > $count) $last = $count;
100
+			$display = 'Show rows '. $first . ' to '. $last .' of '. $count;
101
+			$html .= '<li class="' . $active . ' nav-item">
102 102
                     <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. $i .'" title="' . $display . '" aria-label="' . $display . '">
103 103
                     '.$i.'                
104 104
                     </a>
105 105
                 </li>';
106
-        }
106
+		}
107 107
         
108
-        if ($this->currentPage == $numPages)
109
-        {
110
-            $html .= '
108
+		if ($this->currentPage == $numPages)
109
+		{
110
+			$html .= '
111 111
                 <li class="nav-item disabled" aria-hidden="true">
112 112
                     <span class="previous-page">
113 113
                             <span class="sr-only">Previous page</span>
@@ -115,28 +115,28 @@  discard block
 block discarded – undo
115 115
                      </span>
116 116
                 </li>
117 117
                ';
118
-        }
119
-        else
120
-        {
121
-            $html .= '
118
+		}
119
+		else
120
+		{
121
+			$html .= '
122 122
                 <li class="nav-item">
123 123
                     <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage + 1 ).'" class="next-page">
124 124
                             <i aria-hidden="true" class="icon-angle-double-right"></i>
125 125
                      </a>
126 126
                 </li>
127 127
             ';
128
-        }
128
+		}
129 129
         
130
-        $html .= '</ul> </div>';
130
+		$html .= '</ul> </div>';
131 131
         
132
-        return $html;
133
-    }
132
+		return $html;
133
+	}
134 134
     
135
-    public function applyPaging()
136
-    {
137
-        $this->query->limitPage($this->currentPage,$this->maxPerPage);
138
-        return $this;
139
-    }
135
+	public function applyPaging()
136
+	{
137
+		$this->query->limitPage($this->currentPage,$this->maxPerPage);
138
+		return $this;
139
+	}
140 140
     
141 141
     
142 142
 }
143 143
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
 {
8 8
    
9 9
     /*************** Paging *************/
10
-    protected $maxPerPage = 25;
10
+    protected $maxPerPage=25;
11 11
     
12
-    protected $currentPage = 0;
12
+    protected $currentPage=0;
13 13
         
14 14
     /**** var & func of TrapDirectorTable used ***/
15 15
     protected $query;
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
     
21 21
     public function countQuery()
22 22
     {
23
-        $this->query = $this->dbConn->select();
24
-        $this->query = $this->query
23
+        $this->query=$this->dbConn->select();
24
+        $this->query=$this->query
25 25
             ->from(
26 26
                 $this->table,
27 27
                 array('COUNT(*)')
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
     
38 38
     public function setMaxPerPage(int $max)
39 39
     {
40
-        $this->maxPerPage = $max;
40
+        $this->maxPerPage=$max;
41 41
     }
42 42
     
43 43
     protected function getPagingQuery(array $getVars)
44 44
     {
45 45
         if (isset($getVars['page']))
46 46
         {
47
-            $this->currentPage = $getVars['page'];
47
+            $this->currentPage=$getVars['page'];
48 48
         }
49 49
     }
50 50
 
@@ -56,22 +56,22 @@  discard block
 block discarded – undo
56 56
     
57 57
     public function renderPagingHeader()
58 58
     {
59
-        $count = $this->count();
60
-        if ($count <= $this->maxPerPage )
59
+        $count=$this->count();
60
+        if ($count <= $this->maxPerPage)
61 61
         {
62
-            return  'count : ' . $this->count() . '<br>';
62
+            return  'count : '.$this->count().'<br>';
63 63
         }
64 64
         
65
-        if ($this->currentPage == 0) $this->currentPage = 1;
65
+        if ($this->currentPage == 0) $this->currentPage=1;
66 66
         
67
-        $numPages = intdiv($count , $this->maxPerPage);
68
-        if ($count % $this->maxPerPage != 0 ) $numPages++;
67
+        $numPages=intdiv($count, $this->maxPerPage);
68
+        if ($count % $this->maxPerPage != 0) $numPages++;
69 69
         
70
-        $html = '<div class="pagination-control" role="navigation">';
71
-        $html .= '<ul class="nav tab-nav">';
72
-        if ($this->currentPage <=1)
70
+        $html='<div class="pagination-control" role="navigation">';
71
+        $html.='<ul class="nav tab-nav">';
72
+        if ($this->currentPage <= 1)
73 73
         {
74
-            $html .= '
74
+            $html.='
75 75
                 <li class="nav-item disabled" aria-hidden="true">
76 76
                     <span class="previous-page">
77 77
                             <span class="sr-only">Previous page</span>
@@ -82,24 +82,24 @@  discard block
 block discarded – undo
82 82
         }
83 83
         else 
84 84
         {
85
-            $html .= '
85
+            $html.='
86 86
                 <li class="nav-item">
87
-                    <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage - 1 ).'" class="previous-page" >
87
+                    <a href="'. $this->getCurrentURLAndQS('paging').'&page='.($this->currentPage - 1).'" class="previous-page" >
88 88
                             <i aria-hidden="true" class="icon-angle-double-left"></i>            
89 89
                      </a>
90 90
                 </li>
91 91
             ';
92 92
         }
93 93
         
94
-        for ($i=1; $i <= $numPages ; $i++)
94
+        for ($i=1; $i <= $numPages; $i++)
95 95
         {
96
-            $active = ($this->currentPage == $i) ? 'active' : '';
97
-            $first = ($i-1)*$this->maxPerPage+1;
98
-            $last = $i * $this->maxPerPage;
99
-            if ($last > $count) $last = $count;
100
-            $display = 'Show rows '. $first . ' to '. $last .' of '. $count;
101
-            $html .= '<li class="' . $active . ' nav-item">
102
-                    <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. $i .'" title="' . $display . '" aria-label="' . $display . '">
96
+            $active=($this->currentPage == $i) ? 'active' : '';
97
+            $first=($i - 1) * $this->maxPerPage + 1;
98
+            $last=$i * $this->maxPerPage;
99
+            if ($last > $count) $last=$count;
100
+            $display='Show rows '.$first.' to '.$last.' of '.$count;
101
+            $html.='<li class="'.$active.' nav-item">
102
+                    <a href="'. $this->getCurrentURLAndQS('paging').'&page='.$i.'" title="'.$display.'" aria-label="'.$display.'">
103 103
                     '.$i.'                
104 104
                     </a>
105 105
                 </li>';
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         
108 108
         if ($this->currentPage == $numPages)
109 109
         {
110
-            $html .= '
110
+            $html.='
111 111
                 <li class="nav-item disabled" aria-hidden="true">
112 112
                     <span class="previous-page">
113 113
                             <span class="sr-only">Previous page</span>
@@ -118,23 +118,23 @@  discard block
 block discarded – undo
118 118
         }
119 119
         else
120 120
         {
121
-            $html .= '
121
+            $html.='
122 122
                 <li class="nav-item">
123
-                    <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage + 1 ).'" class="next-page">
123
+                    <a href="'. $this->getCurrentURLAndQS('paging').'&page='.($this->currentPage + 1).'" class="next-page">
124 124
                             <i aria-hidden="true" class="icon-angle-double-right"></i>
125 125
                      </a>
126 126
                 </li>
127 127
             ';
128 128
         }
129 129
         
130
-        $html .= '</ul> </div>';
130
+        $html.='</ul> </div>';
131 131
         
132 132
         return $html;
133 133
     }
134 134
     
135 135
     public function applyPaging()
136 136
     {
137
-        $this->query->limitPage($this->currentPage,$this->maxPerPage);
137
+        $this->query->limitPage($this->currentPage, $this->maxPerPage);
138 138
         return $this;
139 139
     }
140 140
     
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapDirectorTableOrder.php 3 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
         $orderSQL='';
21 21
         foreach ($this->order as $column => $direction)
22 22
         {
23
-            if ($orderSQL != "") $orderSQL.=',';
23
+            if ($orderSQL != "") {
24
+            	$orderSQL.=',';
25
+            }
24 26
             
25 27
             $orderSQL .= $column . ' ' . $direction;
26 28
         }
@@ -37,7 +39,9 @@  discard block
 block discarded – undo
37 39
 
38 40
     public function isOrderSet()
39 41
     {
40
-        if (count($this->order) == 0) return FALSE;
42
+        if (count($this->order) == 0) {
43
+        	return FALSE;
44
+        }
41 45
         return TRUE;
42 46
     }
43 47
     
@@ -58,7 +62,9 @@  discard block
 block discarded – undo
58 62
     
59 63
     protected function curOrderQuery()
60 64
     {
61
-        if ($this->orderQuery == '') return '';
65
+        if ($this->orderQuery == '') {
66
+        	return '';
67
+        }
62 68
         return 'o='.$this->orderQuery;
63 69
     }
64 70
         
Please login to merge, or discard this patch.
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -5,65 +5,65 @@
 block discarded – undo
5 5
 
6 6
 trait TrapDirectorTableOrder
7 7
 { 
8
-    /** @var array $order : (db column, 'ASC' | 'DESC') */
9
-    protected $order = array();
10
-    /** @var string $orderQuery passed by GET */
11
-    protected $orderQuery = '';   
8
+	/** @var array $order : (db column, 'ASC' | 'DESC') */
9
+	protected $order = array();
10
+	/** @var string $orderQuery passed by GET */
11
+	protected $orderQuery = '';   
12 12
     
13
-    /** used var & functions of trapDirectorTable **/
14
-    protected $query;
13
+	/** used var & functions of trapDirectorTable **/
14
+	protected $query;
15 15
     
16 16
    /***************** Ordering ********************/
17 17
     
18
-    public function applyOrder()
19
-    {
20
-        if (count($this->order) == 0)
21
-        {
22
-            return $this;
23
-        }
24
-        $orderSQL='';
25
-        foreach ($this->order as $column => $direction)
26
-        {
27
-            if ($orderSQL != "") $orderSQL.=',';
18
+	public function applyOrder()
19
+	{
20
+		if (count($this->order) == 0)
21
+		{
22
+			return $this;
23
+		}
24
+		$orderSQL='';
25
+		foreach ($this->order as $column => $direction)
26
+		{
27
+			if ($orderSQL != "") $orderSQL.=',';
28 28
             
29
-            $orderSQL .= $column . ' ' . $direction;
30
-        }
31
-        $this->query = $this->query->order($orderSQL);
29
+			$orderSQL .= $column . ' ' . $direction;
30
+		}
31
+		$this->query = $this->query->order($orderSQL);
32 32
         
33
-        return $this;
34
-    }
33
+		return $this;
34
+	}
35 35
     
36
-    public function setOrder(array $order)
37
-    {
38
-        $this->order = $order;
39
-        return $this;
40
-    }
36
+	public function setOrder(array $order)
37
+	{
38
+		$this->order = $order;
39
+		return $this;
40
+	}
41 41
 
42
-    public function isOrderSet()
43
-    {
44
-        if (count($this->order) == 0) return FALSE;
45
-        return TRUE;
46
-    }
42
+	public function isOrderSet()
43
+	{
44
+		if (count($this->order) == 0) return FALSE;
45
+		return TRUE;
46
+	}
47 47
     
48
-    public function getOrderQuery(array $getVars)
49
-    {
50
-        if (isset($getVars['o']))
51
-        {
52
-            $this->orderQuery = $getVars['o'];
53
-            $match = array();
54
-            if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery , $match))
55
-            {
56
-                $orderArray=array($match[1] => $match[2]);
57
-                echo "$match[1] => $match[2]";
58
-                $this->setOrder($orderArray);
59
-            }
60
-        }
61
-    }
48
+	public function getOrderQuery(array $getVars)
49
+	{
50
+		if (isset($getVars['o']))
51
+		{
52
+			$this->orderQuery = $getVars['o'];
53
+			$match = array();
54
+			if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery , $match))
55
+			{
56
+				$orderArray=array($match[1] => $match[2]);
57
+				echo "$match[1] => $match[2]";
58
+				$this->setOrder($orderArray);
59
+			}
60
+		}
61
+	}
62 62
     
63
-    protected function curOrderQuery()
64
-    {
65
-        if ($this->orderQuery == '') return '';
66
-        return 'o='.$this->orderQuery;
67
-    }
63
+	protected function curOrderQuery()
64
+	{
65
+		if ($this->orderQuery == '') return '';
66
+		return 'o='.$this->orderQuery;
67
+	}
68 68
         
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
 trait TrapDirectorTableOrder
7 7
 { 
8 8
     /** @var array $order : (db column, 'ASC' | 'DESC') */
9
-    protected $order = array();
9
+    protected $order=array();
10 10
     /** @var string $orderQuery passed by GET */
11
-    protected $orderQuery = '';   
11
+    protected $orderQuery='';   
12 12
     
13 13
     /** used var & functions of trapDirectorTable **/
14 14
     protected $query;
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
         {
27 27
             if ($orderSQL != "") $orderSQL.=',';
28 28
             
29
-            $orderSQL .= $column . ' ' . $direction;
29
+            $orderSQL.=$column.' '.$direction;
30 30
         }
31
-        $this->query = $this->query->order($orderSQL);
31
+        $this->query=$this->query->order($orderSQL);
32 32
         
33 33
         return $this;
34 34
     }
35 35
     
36 36
     public function setOrder(array $order)
37 37
     {
38
-        $this->order = $order;
38
+        $this->order=$order;
39 39
         return $this;
40 40
     }
41 41
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
     {
50 50
         if (isset($getVars['o']))
51 51
         {
52
-            $this->orderQuery = $getVars['o'];
53
-            $match = array();
54
-            if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery , $match))
52
+            $this->orderQuery=$getVars['o'];
53
+            $match=array();
54
+            if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery, $match))
55 55
             {
56 56
                 $orderArray=array($match[1] => $match[2]);
57 57
                 echo "$match[1] => $match[2]";
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapDirectorTableGrouping.php 3 patches
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -7,85 +7,85 @@
 block discarded – undo
7 7
 {
8 8
     
9 9
   
10
-    /*************** Grouping ************/
10
+	/*************** Grouping ************/
11 11
     
12
-    /** @var boolean $grouppingActive set to true if grouping is active by query or function call */
13
-    protected $grouppingActive=false;
12
+	/** @var boolean $grouppingActive set to true if grouping is active by query or function call */
13
+	protected $grouppingActive=false;
14 14
     
15
-    /** @var string $groupingColumn Name of column (can be hidden) for grouping */
16
-    protected $groupingColumn='';
15
+	/** @var string $groupingColumn Name of column (can be hidden) for grouping */
16
+	protected $groupingColumn='';
17 17
     
18
-    /**@var string $groupingVal Current value of grouping column in row (used while rendering) */
19
-    protected $groupingVal='';
18
+	/**@var string $groupingVal Current value of grouping column in row (used while rendering) */
19
+	protected $groupingVal='';
20 20
     
21
-    /** @var integer $groupingColSpan colspan of grouping line : set to table titles in init */
22
-    protected $groupingColSpan=1;
21
+	/** @var integer $groupingColSpan colspan of grouping line : set to table titles in init */
22
+	protected $groupingColSpan=1;
23 23
       
24
-    /*****************  Grouping ****************/
24
+	/*****************  Grouping ****************/
25 25
     
26
-    /**
27
-     * Set grouping. column must be DB name
28
-     * @param string $columnDBName
29
-     */
30
-    public function setGrouping(string $columnDBName)
31
-    {
32
-        $this->groupingColumn = $columnDBName;
33
-        $this->grouppingActive = TRUE;
34
-    }
26
+	/**
27
+	 * Set grouping. column must be DB name
28
+	 * @param string $columnDBName
29
+	 */
30
+	public function setGrouping(string $columnDBName)
31
+	{
32
+		$this->groupingColumn = $columnDBName;
33
+		$this->grouppingActive = TRUE;
34
+	}
35 35
     
36
-    /**
37
-     * Init of grouping before rendering
38
-     */
39
-    public function initGrouping()
40
-    {
41
-        $this->groupingVal = '';
42
-        $this->groupingColSpan = count($this->titles);
43
-    }
36
+	/**
37
+	 * Init of grouping before rendering
38
+	 */
39
+	public function initGrouping()
40
+	{
41
+		$this->groupingVal = '';
42
+		$this->groupingColSpan = count($this->titles);
43
+	}
44 44
     
45
-    /**
46
-     * Function to print grouping value (for ovveride in specific tables)
47
-     * @param string $value
48
-     * @return string
49
-     */
50
-    public function groupingPrintData( string $value )
51
-    {
52
-        $html = "$value";
53
-        return $html;
54
-    }
45
+	/**
46
+	 * Function to print grouping value (for ovveride in specific tables)
47
+	 * @param string $value
48
+	 * @return string
49
+	 */
50
+	public function groupingPrintData( string $value )
51
+	{
52
+		$html = "$value";
53
+		return $html;
54
+	}
55 55
     
56
-    /**
57
-     * When to display new grouping line  (for ovveride in specific tables)
58
-     * @param string $val1 Current value in grouping
59
-     * @param string $val2 Value of current line
60
-     * @return boolean TRUE if a new grouping line is needed.
61
-     */
62
-    public function groupingEvalNext(string $val1, string $val2)
63
-    {
64
-        if ($val1 != $val2)
65
-            return TRUE;
66
-        else
67
-            return FALSE;
68
-    }
56
+	/**
57
+	 * When to display new grouping line  (for ovveride in specific tables)
58
+	 * @param string $val1 Current value in grouping
59
+	 * @param string $val2 Value of current line
60
+	 * @return boolean TRUE if a new grouping line is needed.
61
+	 */
62
+	public function groupingEvalNext(string $val1, string $val2)
63
+	{
64
+		if ($val1 != $val2)
65
+			return TRUE;
66
+		else
67
+			return FALSE;
68
+	}
69 69
     
70
-    /**
71
-     * Called before each line to check if grouping line is needed.
72
-     * @param mixed $values
73
-     * @return string with line or empty.
74
-     */
75
-    public function groupingNextLine( $values)
76
-    {
77
-        if ($this->grouppingActive === FALSE) return '';
70
+	/**
71
+	 * Called before each line to check if grouping line is needed.
72
+	 * @param mixed $values
73
+	 * @return string with line or empty.
74
+	 */
75
+	public function groupingNextLine( $values)
76
+	{
77
+		if ($this->grouppingActive === FALSE) return '';
78 78
         
79
-        $dbcol = $this->groupingColumn;
80
-        if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$values->$dbcol) === TRUE )
81
-        {
82
-            $this->groupingVal = $values->$dbcol;
83
-            $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
84
-            return $html;
85
-        }
86
-        return '';
79
+		$dbcol = $this->groupingColumn;
80
+		if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$values->$dbcol) === TRUE )
81
+		{
82
+			$this->groupingVal = $values->$dbcol;
83
+			$html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
84
+			return $html;
85
+		}
86
+		return '';
87 87
         
88
-    }
88
+	}
89 89
     
90 90
   
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function setGrouping(string $columnDBName)
31 31
     {
32
-        $this->groupingColumn = $columnDBName;
33
-        $this->grouppingActive = TRUE;
32
+        $this->groupingColumn=$columnDBName;
33
+        $this->grouppingActive=TRUE;
34 34
     }
35 35
     
36 36
     /**
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function initGrouping()
40 40
     {
41
-        $this->groupingVal = '';
42
-        $this->groupingColSpan = count($this->titles);
41
+        $this->groupingVal='';
42
+        $this->groupingColSpan=count($this->titles);
43 43
     }
44 44
     
45 45
     /**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
      * @param string $value
48 48
      * @return string
49 49
      */
50
-    public function groupingPrintData( string $value )
50
+    public function groupingPrintData(string $value)
51 51
     {
52
-        $html = "$value";
52
+        $html="$value";
53 53
         return $html;
54 54
     }
55 55
     
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
      * @param mixed $values
73 73
      * @return string with line or empty.
74 74
      */
75
-    public function groupingNextLine( $values)
75
+    public function groupingNextLine($values)
76 76
     {
77 77
         if ($this->grouppingActive === FALSE) return '';
78 78
         
79
-        $dbcol = $this->groupingColumn;
80
-        if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$values->$dbcol) === TRUE )
79
+        $dbcol=$this->groupingColumn;
80
+        if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal, $values->$dbcol) === TRUE)
81 81
         {
82
-            $this->groupingVal = $values->$dbcol;
83
-            $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
82
+            $this->groupingVal=$values->$dbcol;
83
+            $html='<tr><th colspan="'.$this->groupingColSpan.'">'.$this->groupingPrintData($this->groupingVal).'</th></tr>';
84 84
             return $html;
85 85
         }
86 86
         return '';
Please login to merge, or discard this patch.
Braces   +8 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,10 +61,11 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function groupingEvalNext(string $val1, string $val2)
63 63
     {
64
-        if ($val1 != $val2)
65
-            return TRUE;
66
-        else
67
-            return FALSE;
64
+        if ($val1 != $val2) {
65
+                    return TRUE;
66
+        } else {
67
+                    return FALSE;
68
+        }
68 69
     }
69 70
     
70 71
     /**
@@ -74,7 +75,9 @@  discard block
 block discarded – undo
74 75
      */
75 76
     public function groupingNextLine( $values)
76 77
     {
77
-        if ($this->grouppingActive === FALSE) return '';
78
+        if ($this->grouppingActive === FALSE) {
79
+        	return '';
80
+        }
78 81
         
79 82
         $dbcol = $this->groupingColumn;
80 83
         if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$values->$dbcol) === TRUE )
Please login to merge, or discard this patch.