Passed
Push — master ( cb2842...994f5c )
by Patrick
02:04
created
library/Trapdirector/Tables/TrapDirectorTableFilter.php 3 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -6,72 +6,72 @@
 block discarded – undo
6 6
 trait TrapDirectorTableFilter
7 7
 {
8 8
     
9
-    /********* Filter ********/
10
-    /** @var string $filterString : string filter for db columns */
11
-    protected $filterString = '';
9
+	/********* Filter ********/
10
+	/** @var string $filterString : string filter for db columns */
11
+	protected $filterString = '';
12 12
     
13
-    /** @var array $filterColumn : columns to apply filter to */
14
-    protected $filterColumn = array();
13
+	/** @var array $filterColumn : columns to apply filter to */
14
+	protected $filterColumn = array();
15 15
     
16
-    protected $filterQuery='';
16
+	protected $filterQuery='';
17 17
     
18 18
     
19
-    /**************** Filtering ******************/
19
+	/**************** Filtering ******************/
20 20
     
21
-    public function applyFilter()
22
-    {
23
-        if ($this->filterString == '' || count($this->filterColumn) == 0)
24
-        {
25
-            return $this;
26
-        }
27
-        $filter='';
28
-        foreach ($this->filterColumn as $column)
29
-        {
30
-            if ($filter != "") $filter.=' OR ';
31
-            //$filter .= "'" . $column . "' LIKE '%" . $this->filterString. "%'";
32
-            $filter .= $column  . " LIKE '%" . $this->filterString. "%'";
33
-        }
34
-        //echo $filter;
21
+	public function applyFilter()
22
+	{
23
+		if ($this->filterString == '' || count($this->filterColumn) == 0)
24
+		{
25
+			return $this;
26
+		}
27
+		$filter='';
28
+		foreach ($this->filterColumn as $column)
29
+		{
30
+			if ($filter != "") $filter.=' OR ';
31
+			//$filter .= "'" . $column . "' LIKE '%" . $this->filterString. "%'";
32
+			$filter .= $column  . " LIKE '%" . $this->filterString. "%'";
33
+		}
34
+		//echo $filter;
35 35
         
36
-        $this->query=$this->query->where($filter);
36
+		$this->query=$this->query->where($filter);
37 37
 
38
-        return $this;
39
-    }
38
+		return $this;
39
+	}
40 40
 
41
-    public function setFilter(string $filter, array $filterCol)
42
-    {
43
-        $this->filterString = $filter;
44
-        $this->filterColumn = $filterCol;
45
-        return $this;
46
-    }
41
+	public function setFilter(string $filter, array $filterCol)
42
+	{
43
+		$this->filterString = $filter;
44
+		$this->filterColumn = $filterCol;
45
+		return $this;
46
+	}
47 47
    
48
-    public function renderFilter()
49
-    {
48
+	public function renderFilter()
49
+	{
50 50
         
51
-        $html=' <form id="genfilter" name="mainFilterGen"
51
+		$html=' <form id="genfilter" name="mainFilterGen"
52 52
 			enctype="application/x-www-form-urlencoded"
53 53
 			action="'.$this->getCurrentURLAndQS('filter').'"
54 54
 			method="get">';
55
-        $html.='<input type="text" name="f" title="Search is simple! Try to combine multiple words"
55
+		$html.='<input type="text" name="f" title="Search is simple! Try to combine multiple words"
56 56
 	placeholder="Search..."  value="'.$this->filterQuery.'">';
57 57
 
58
-        $html.='</form>';
59
-        return $html;
60
-    }
58
+		$html.='</form>';
59
+		return $html;
60
+	}
61 61
  
62
-    public function getFilterQuery(array $getVars)
63
-    {
64
-        if (isset($getVars['f']))
65
-        {
66
-            $this->filterQuery = $getVars['f'];
67
-            $this->setFilter(html_entity_decode($getVars['f']), $this->columnNames);
68
-        }
69
-    }
62
+	public function getFilterQuery(array $getVars)
63
+	{
64
+		if (isset($getVars['f']))
65
+		{
66
+			$this->filterQuery = $getVars['f'];
67
+			$this->setFilter(html_entity_decode($getVars['f']), $this->columnNames);
68
+		}
69
+	}
70 70
     
71
-    protected function curFilterQuery()
72
-    {
73
-        if ($this->filterQuery == '') return '';
74
-        return 'f='.$this->filterQuery;
75
-    }
71
+	protected function curFilterQuery()
72
+	{
73
+		if ($this->filterQuery == '') return '';
74
+		return 'f='.$this->filterQuery;
75
+	}
76 76
     
77 77
 }
78 78
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
     
9 9
     /********* Filter ********/
10 10
     /** @var string $filterString : string filter for db columns */
11
-    protected $filterString = '';
11
+    protected $filterString='';
12 12
     
13 13
     /** @var array $filterColumn : columns to apply filter to */
14
-    protected $filterColumn = array();
14
+    protected $filterColumn=array();
15 15
     
16 16
     protected $filterQuery='';
17 17
     
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         {
30 30
             if ($filter != "") $filter.=' OR ';
31 31
             //$filter .= "'" . $column . "' LIKE '%" . $this->filterString. "%'";
32
-            $filter .= $column  . " LIKE '%" . $this->filterString. "%'";
32
+            $filter.=$column." LIKE '%".$this->filterString."%'";
33 33
         }
34 34
         //echo $filter;
35 35
         
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function setFilter(string $filter, array $filterCol)
42 42
     {
43
-        $this->filterString = $filter;
44
-        $this->filterColumn = $filterCol;
43
+        $this->filterString=$filter;
44
+        $this->filterColumn=$filterCol;
45 45
         return $this;
46 46
     }
47 47
    
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         if (isset($getVars['f']))
65 65
         {
66
-            $this->filterQuery = $getVars['f'];
66
+            $this->filterQuery=$getVars['f'];
67 67
             $this->setFilter(html_entity_decode($getVars['f']), $this->columnNames);
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
         $filter='';
28 28
         foreach ($this->filterColumn as $column)
29 29
         {
30
-            if ($filter != "") $filter.=' OR ';
30
+            if ($filter != "") {
31
+            	$filter.=' OR ';
32
+            }
31 33
             //$filter .= "'" . $column . "' LIKE '%" . $this->filterString. "%'";
32 34
             $filter .= $column  . " LIKE '%" . $this->filterString. "%'";
33 35
         }
@@ -70,7 +72,9 @@  discard block
 block discarded – undo
70 72
     
71 73
     protected function curFilterQuery()
72 74
     {
73
-        if ($this->filterQuery == '') return '';
75
+        if ($this->filterQuery == '') {
76
+        	return '';
77
+        }
74 78
         return 'f='.$this->filterQuery;
75 79
     }
76 80
     
Please login to merge, or discard this patch.
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
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -6,68 +6,68 @@  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 14
  
15
-    /*****************  Paging and counting *********/
15
+	/*****************  Paging and counting *********/
16 16
     
17
-    public function countQuery()
18
-    {
19
-        $this->query = $this->dbConn->select();
20
-        $this->query = $this->query
21
-            ->from(
22
-                $this->table,
23
-                array('COUNT(*)')
24
-                );
25
-        $this->applyFilter();                   
26
-    }
17
+	public function countQuery()
18
+	{
19
+		$this->query = $this->dbConn->select();
20
+		$this->query = $this->query
21
+			->from(
22
+				$this->table,
23
+				array('COUNT(*)')
24
+				);
25
+		$this->applyFilter();                   
26
+	}
27 27
     
28
-    public function count()
29
-    {
30
-        $this->countQuery();
31
-        return $this->dbConn->fetchOne($this->query);
32
-    }
28
+	public function count()
29
+	{
30
+		$this->countQuery();
31
+		return $this->dbConn->fetchOne($this->query);
32
+	}
33 33
     
34
-    public function setMaxPerPage(int $max)
35
-    {
36
-        $this->maxPerPage = $max;
37
-    }
34
+	public function setMaxPerPage(int $max)
35
+	{
36
+		$this->maxPerPage = $max;
37
+	}
38 38
     
39
-    protected function getPagingQuery(array $getVars)
40
-    {
41
-        if (isset($getVars['page']))
42
-        {
43
-            $this->currentPage = $getVars['page'];
44
-        }
45
-    }
39
+	protected function getPagingQuery(array $getVars)
40
+	{
41
+		if (isset($getVars['page']))
42
+		{
43
+			$this->currentPage = $getVars['page'];
44
+		}
45
+	}
46 46
 
47
-    protected function curPagingQuery()
48
-    {
49
-        if ($this->currentPage == '') return '';
50
-        return 'page='.$this->currentPage;
51
-    }
47
+	protected function curPagingQuery()
48
+	{
49
+		if ($this->currentPage == '') return '';
50
+		return 'page='.$this->currentPage;
51
+	}
52 52
     
53
-    public function renderPagingHeader()
54
-    {
55
-        $count = $this->count();
56
-        if ($count <= $this->maxPerPage )
57
-        {
58
-            return  'count : ' . $this->count() . '<br>';
59
-        }
53
+	public function renderPagingHeader()
54
+	{
55
+		$count = $this->count();
56
+		if ($count <= $this->maxPerPage )
57
+		{
58
+			return  'count : ' . $this->count() . '<br>';
59
+		}
60 60
         
61
-        if ($this->currentPage == 0) $this->currentPage = 1;
61
+		if ($this->currentPage == 0) $this->currentPage = 1;
62 62
         
63
-        $numPages = intdiv($count , $this->maxPerPage);
64
-        if ($count % $this->maxPerPage != 0 ) $numPages++;
63
+		$numPages = intdiv($count , $this->maxPerPage);
64
+		if ($count % $this->maxPerPage != 0 ) $numPages++;
65 65
         
66
-        $html = '<div class="pagination-control" role="navigation">';
67
-        $html .= '<ul class="nav tab-nav">';
68
-        if ($this->currentPage <=1)
69
-        {
70
-            $html .= '
66
+		$html = '<div class="pagination-control" role="navigation">';
67
+		$html .= '<ul class="nav tab-nav">';
68
+		if ($this->currentPage <=1)
69
+		{
70
+			$html .= '
71 71
                 <li class="nav-item disabled" aria-hidden="true">
72 72
                     <span class="previous-page">
73 73
                             <span class="sr-only">Previous page</span>
@@ -75,35 +75,35 @@  discard block
 block discarded – undo
75 75
                      </span>
76 76
                 </li>
77 77
                ';
78
-        }
79
-        else 
80
-        {
81
-            $html .= '
78
+		}
79
+		else 
80
+		{
81
+			$html .= '
82 82
                 <li class="nav-item">
83 83
                     <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage - 1 ).'" class="previous-page" >
84 84
                             <i aria-hidden="true" class="icon-angle-double-left"></i>            
85 85
                      </a>
86 86
                 </li>
87 87
             ';
88
-        }
88
+		}
89 89
         
90
-        for ($i=1; $i <= $numPages ; $i++)
91
-        {
92
-            $active = ($this->currentPage == $i) ? 'active' : '';
93
-            $first = ($i-1)*$this->maxPerPage+1;
94
-            $last = $i * $this->maxPerPage;
95
-            if ($last > $count) $last = $count;
96
-            $display = 'Show rows '. $first . ' to '. $last .' of '. $count;
97
-            $html .= '<li class="' . $active . ' nav-item">
90
+		for ($i=1; $i <= $numPages ; $i++)
91
+		{
92
+			$active = ($this->currentPage == $i) ? 'active' : '';
93
+			$first = ($i-1)*$this->maxPerPage+1;
94
+			$last = $i * $this->maxPerPage;
95
+			if ($last > $count) $last = $count;
96
+			$display = 'Show rows '. $first . ' to '. $last .' of '. $count;
97
+			$html .= '<li class="' . $active . ' nav-item">
98 98
                     <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. $i .'" title="' . $display . '" aria-label="' . $display . '">
99 99
                     '.$i.'                
100 100
                     </a>
101 101
                 </li>';
102
-        }
102
+		}
103 103
         
104
-        if ($this->currentPage == $numPages)
105
-        {
106
-            $html .= '
104
+		if ($this->currentPage == $numPages)
105
+		{
106
+			$html .= '
107 107
                 <li class="nav-item disabled" aria-hidden="true">
108 108
                     <span class="previous-page">
109 109
                             <span class="sr-only">Previous page</span>
@@ -111,28 +111,28 @@  discard block
 block discarded – undo
111 111
                      </span>
112 112
                 </li>
113 113
                ';
114
-        }
115
-        else
116
-        {
117
-            $html .= '
114
+		}
115
+		else
116
+		{
117
+			$html .= '
118 118
                 <li class="nav-item">
119 119
                     <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage + 1 ).'" class="next-page">
120 120
                             <i aria-hidden="true" class="icon-angle-double-right"></i>
121 121
                      </a>
122 122
                 </li>
123 123
             ';
124
-        }
124
+		}
125 125
         
126
-        $html .= '</ul> </div>';
126
+		$html .= '</ul> </div>';
127 127
         
128
-        return $html;
129
-    }
128
+		return $html;
129
+	}
130 130
     
131
-    public function applyPaging()
132
-    {
133
-        $this->query->limitPage($this->currentPage,$this->maxPerPage);
134
-        return $this;
135
-    }
131
+	public function applyPaging()
132
+	{
133
+		$this->query->limitPage($this->currentPage,$this->maxPerPage);
134
+		return $this;
135
+	}
136 136
     
137 137
     
138 138
 }
139 139
\ 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,17 +7,17 @@  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
  
15 15
     /*****************  Paging and counting *********/
16 16
     
17 17
     public function countQuery()
18 18
     {
19
-        $this->query = $this->dbConn->select();
20
-        $this->query = $this->query
19
+        $this->query=$this->dbConn->select();
20
+        $this->query=$this->query
21 21
             ->from(
22 22
                 $this->table,
23 23
                 array('COUNT(*)')
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
     
34 34
     public function setMaxPerPage(int $max)
35 35
     {
36
-        $this->maxPerPage = $max;
36
+        $this->maxPerPage=$max;
37 37
     }
38 38
     
39 39
     protected function getPagingQuery(array $getVars)
40 40
     {
41 41
         if (isset($getVars['page']))
42 42
         {
43
-            $this->currentPage = $getVars['page'];
43
+            $this->currentPage=$getVars['page'];
44 44
         }
45 45
     }
46 46
 
@@ -52,22 +52,22 @@  discard block
 block discarded – undo
52 52
     
53 53
     public function renderPagingHeader()
54 54
     {
55
-        $count = $this->count();
56
-        if ($count <= $this->maxPerPage )
55
+        $count=$this->count();
56
+        if ($count <= $this->maxPerPage)
57 57
         {
58
-            return  'count : ' . $this->count() . '<br>';
58
+            return  'count : '.$this->count().'<br>';
59 59
         }
60 60
         
61
-        if ($this->currentPage == 0) $this->currentPage = 1;
61
+        if ($this->currentPage == 0) $this->currentPage=1;
62 62
         
63
-        $numPages = intdiv($count , $this->maxPerPage);
64
-        if ($count % $this->maxPerPage != 0 ) $numPages++;
63
+        $numPages=intdiv($count, $this->maxPerPage);
64
+        if ($count % $this->maxPerPage != 0) $numPages++;
65 65
         
66
-        $html = '<div class="pagination-control" role="navigation">';
67
-        $html .= '<ul class="nav tab-nav">';
68
-        if ($this->currentPage <=1)
66
+        $html='<div class="pagination-control" role="navigation">';
67
+        $html.='<ul class="nav tab-nav">';
68
+        if ($this->currentPage <= 1)
69 69
         {
70
-            $html .= '
70
+            $html.='
71 71
                 <li class="nav-item disabled" aria-hidden="true">
72 72
                     <span class="previous-page">
73 73
                             <span class="sr-only">Previous page</span>
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
         }
79 79
         else 
80 80
         {
81
-            $html .= '
81
+            $html.='
82 82
                 <li class="nav-item">
83
-                    <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage - 1 ).'" class="previous-page" >
83
+                    <a href="'. $this->getCurrentURLAndQS('paging').'&page='.($this->currentPage - 1).'" class="previous-page" >
84 84
                             <i aria-hidden="true" class="icon-angle-double-left"></i>            
85 85
                      </a>
86 86
                 </li>
87 87
             ';
88 88
         }
89 89
         
90
-        for ($i=1; $i <= $numPages ; $i++)
90
+        for ($i=1; $i <= $numPages; $i++)
91 91
         {
92
-            $active = ($this->currentPage == $i) ? 'active' : '';
93
-            $first = ($i-1)*$this->maxPerPage+1;
94
-            $last = $i * $this->maxPerPage;
95
-            if ($last > $count) $last = $count;
96
-            $display = 'Show rows '. $first . ' to '. $last .' of '. $count;
97
-            $html .= '<li class="' . $active . ' nav-item">
98
-                    <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. $i .'" title="' . $display . '" aria-label="' . $display . '">
92
+            $active=($this->currentPage == $i) ? 'active' : '';
93
+            $first=($i - 1) * $this->maxPerPage + 1;
94
+            $last=$i * $this->maxPerPage;
95
+            if ($last > $count) $last=$count;
96
+            $display='Show rows '.$first.' to '.$last.' of '.$count;
97
+            $html.='<li class="'.$active.' nav-item">
98
+                    <a href="'. $this->getCurrentURLAndQS('paging').'&page='.$i.'" title="'.$display.'" aria-label="'.$display.'">
99 99
                     '.$i.'                
100 100
                     </a>
101 101
                 </li>';
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         
104 104
         if ($this->currentPage == $numPages)
105 105
         {
106
-            $html .= '
106
+            $html.='
107 107
                 <li class="nav-item disabled" aria-hidden="true">
108 108
                     <span class="previous-page">
109 109
                             <span class="sr-only">Previous page</span>
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
         }
115 115
         else
116 116
         {
117
-            $html .= '
117
+            $html.='
118 118
                 <li class="nav-item">
119
-                    <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage + 1 ).'" class="next-page">
119
+                    <a href="'. $this->getCurrentURLAndQS('paging').'&page='.($this->currentPage + 1).'" class="next-page">
120 120
                             <i aria-hidden="true" class="icon-angle-double-right"></i>
121 121
                      </a>
122 122
                 </li>
123 123
             ';
124 124
         }
125 125
         
126
-        $html .= '</ul> </div>';
126
+        $html.='</ul> </div>';
127 127
         
128 128
         return $html;
129 129
     }
130 130
     
131 131
     public function applyPaging()
132 132
     {
133
-        $this->query->limitPage($this->currentPage,$this->maxPerPage);
133
+        $this->query->limitPage($this->currentPage, $this->maxPerPage);
134 134
         return $this;
135 135
     }
136 136
     
Please login to merge, or discard this patch.
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.
library/Trapdirector/Tables/TrapDirectorTableOrder.php 3 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -5,61 +5,61 @@
 block discarded – undo
5 5
 
6 6
 trait TrapDirectorTableOrder
7 7
 { 
8
-    /** @var array $order : (db column, 'ASC' | 'DESC') */
9
-    protected $order = array();
10
-    protected $orderQuery = '';   
8
+	/** @var array $order : (db column, 'ASC' | 'DESC') */
9
+	protected $order = array();
10
+	protected $orderQuery = '';   
11 11
     
12 12
    /***************** Ordering ********************/
13 13
     
14
-    public function applyOrder()
15
-    {
16
-        if (count($this->order) == 0)
17
-        {
18
-            return $this;
19
-        }
20
-        $orderSQL='';
21
-        foreach ($this->order as $column => $direction)
22
-        {
23
-            if ($orderSQL != "") $orderSQL.=',';
14
+	public function applyOrder()
15
+	{
16
+		if (count($this->order) == 0)
17
+		{
18
+			return $this;
19
+		}
20
+		$orderSQL='';
21
+		foreach ($this->order as $column => $direction)
22
+		{
23
+			if ($orderSQL != "") $orderSQL.=',';
24 24
             
25
-            $orderSQL .= $column . ' ' . $direction;
26
-        }
27
-        $this->query = $this->query->order($orderSQL);
25
+			$orderSQL .= $column . ' ' . $direction;
26
+		}
27
+		$this->query = $this->query->order($orderSQL);
28 28
         
29
-        return $this;
30
-    }
29
+		return $this;
30
+	}
31 31
     
32
-    public function setOrder(array $order)
33
-    {
34
-        $this->order = $order;
35
-        return $this;
36
-    }
32
+	public function setOrder(array $order)
33
+	{
34
+		$this->order = $order;
35
+		return $this;
36
+	}
37 37
 
38
-    public function isOrderSet()
39
-    {
40
-        if (count($this->order) == 0) return FALSE;
41
-        return TRUE;
42
-    }
38
+	public function isOrderSet()
39
+	{
40
+		if (count($this->order) == 0) return FALSE;
41
+		return TRUE;
42
+	}
43 43
     
44
-    public function getOrderQuery(array $getVars)
45
-    {
46
-        if (isset($getVars['o']))
47
-        {
48
-            $this->orderQuery = $getVars['o'];
49
-            $match = array();
50
-            if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery , $match))
51
-            {
52
-                $orderArray=array($match[1] => $match[2]);
53
-                echo "$match[1] => $match[2]";
54
-                $this->setOrder($orderArray);
55
-            }
56
-        }
57
-    }
44
+	public function getOrderQuery(array $getVars)
45
+	{
46
+		if (isset($getVars['o']))
47
+		{
48
+			$this->orderQuery = $getVars['o'];
49
+			$match = array();
50
+			if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery , $match))
51
+			{
52
+				$orderArray=array($match[1] => $match[2]);
53
+				echo "$match[1] => $match[2]";
54
+				$this->setOrder($orderArray);
55
+			}
56
+		}
57
+	}
58 58
     
59
-    protected function curOrderQuery()
60
-    {
61
-        if ($this->orderQuery == '') return '';
62
-        return 'o='.$this->orderQuery;
63
-    }
59
+	protected function curOrderQuery()
60
+	{
61
+		if ($this->orderQuery == '') return '';
62
+		return 'o='.$this->orderQuery;
63
+	}
64 64
         
65 65
 }
66 66
\ 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,8 +6,8 @@  discard block
 block discarded – undo
6 6
 trait TrapDirectorTableOrder
7 7
 { 
8 8
     /** @var array $order : (db column, 'ASC' | 'DESC') */
9
-    protected $order = array();
10
-    protected $orderQuery = '';   
9
+    protected $order=array();
10
+    protected $orderQuery='';   
11 11
     
12 12
    /***************** Ordering ********************/
13 13
     
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
         {
23 23
             if ($orderSQL != "") $orderSQL.=',';
24 24
             
25
-            $orderSQL .= $column . ' ' . $direction;
25
+            $orderSQL.=$column.' '.$direction;
26 26
         }
27
-        $this->query = $this->query->order($orderSQL);
27
+        $this->query=$this->query->order($orderSQL);
28 28
         
29 29
         return $this;
30 30
     }
31 31
     
32 32
     public function setOrder(array $order)
33 33
     {
34
-        $this->order = $order;
34
+        $this->order=$order;
35 35
         return $this;
36 36
     }
37 37
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     {
46 46
         if (isset($getVars['o']))
47 47
         {
48
-            $this->orderQuery = $getVars['o'];
49
-            $match = array();
50
-            if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery , $match))
48
+            $this->orderQuery=$getVars['o'];
49
+            $match=array();
50
+            if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery, $match))
51 51
             {
52 52
                 $orderArray=array($match[1] => $match[2]);
53 53
                 echo "$match[1] => $match[2]";
Please login to merge, or discard this patch.
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.
library/Trapdirector/Tables/TrapDirectorTableGrouping.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 block discarded – undo
7 7
 {
8 8
     
9 9
   
10
-    /*************** Grouping ************/
11
-    protected $grouppingActive=false;
10
+	/*************** Grouping ************/
11
+	protected $grouppingActive=false;
12 12
     
13
-    protected $groupingColumn='';
13
+	protected $groupingColumn='';
14 14
     
15
-    protected $groupingVal='';
15
+	protected $groupingVal='';
16 16
     
17
-    protected $groupingColSpan=1;
17
+	protected $groupingColSpan=1;
18 18
       
19
-    /*****************  Grouping ****************/
20
-    
21
-    public function setGrouping($columnDBName)
22
-    {
23
-        $this->groupingColumn = $columnDBName;
24
-        $this->grouppingActive = TRUE;
25
-    }
26
-    
27
-    public function initGrouping()
28
-    {
29
-        $this->groupingVal = '';
30
-        $this->groupingColSpan = count($this->titles);
31
-    }
32
-    
33
-    public function groupingPrintData( $value)
34
-    {
35
-        $html = "$value";
36
-        return $html;
37
-    }
38
-    
39
-    public function groupingNextLine( $values)
40
-    {
41
-        if ($this->grouppingActive === FALSE) return '';
19
+	/*****************  Grouping ****************/
20
+    
21
+	public function setGrouping($columnDBName)
22
+	{
23
+		$this->groupingColumn = $columnDBName;
24
+		$this->grouppingActive = TRUE;
25
+	}
26
+    
27
+	public function initGrouping()
28
+	{
29
+		$this->groupingVal = '';
30
+		$this->groupingColSpan = count($this->titles);
31
+	}
32
+    
33
+	public function groupingPrintData( $value)
34
+	{
35
+		$html = "$value";
36
+		return $html;
37
+	}
38
+    
39
+	public function groupingNextLine( $values)
40
+	{
41
+		if ($this->grouppingActive === FALSE) return '';
42 42
         
43
-        $dbcol = $this->groupingColumn;
44
-        if ($this->groupingVal == '' || $this->groupingVal != $values->$dbcol )
45
-        {
46
-            $this->groupingVal = $values->$dbcol;
47
-            $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
48
-            return $html;
49
-        }
50
-        return '';
43
+		$dbcol = $this->groupingColumn;
44
+		if ($this->groupingVal == '' || $this->groupingVal != $values->$dbcol )
45
+		{
46
+			$this->groupingVal = $values->$dbcol;
47
+			$html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
48
+			return $html;
49
+		}
50
+		return '';
51 51
         
52
-    }
52
+	}
53 53
     
54 54
   
55 55
 }
56 56
\ 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
@@ -20,31 +20,31 @@
 block discarded – undo
20 20
     
21 21
     public function setGrouping($columnDBName)
22 22
     {
23
-        $this->groupingColumn = $columnDBName;
24
-        $this->grouppingActive = TRUE;
23
+        $this->groupingColumn=$columnDBName;
24
+        $this->grouppingActive=TRUE;
25 25
     }
26 26
     
27 27
     public function initGrouping()
28 28
     {
29
-        $this->groupingVal = '';
30
-        $this->groupingColSpan = count($this->titles);
29
+        $this->groupingVal='';
30
+        $this->groupingColSpan=count($this->titles);
31 31
     }
32 32
     
33
-    public function groupingPrintData( $value)
33
+    public function groupingPrintData($value)
34 34
     {
35
-        $html = "$value";
35
+        $html="$value";
36 36
         return $html;
37 37
     }
38 38
     
39
-    public function groupingNextLine( $values)
39
+    public function groupingNextLine($values)
40 40
     {
41 41
         if ($this->grouppingActive === FALSE) return '';
42 42
         
43
-        $dbcol = $this->groupingColumn;
44
-        if ($this->groupingVal == '' || $this->groupingVal != $values->$dbcol )
43
+        $dbcol=$this->groupingColumn;
44
+        if ($this->groupingVal == '' || $this->groupingVal != $values->$dbcol)
45 45
         {
46
-            $this->groupingVal = $values->$dbcol;
47
-            $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>';
46
+            $this->groupingVal=$values->$dbcol;
47
+            $html='<tr><th colspan="'.$this->groupingColSpan.'">'.$this->groupingPrintData($this->groupingVal).'</th></tr>';
48 48
             return $html;
49 49
         }
50 50
         return '';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@
 block discarded – undo
38 38
     
39 39
     public function groupingNextLine( $values)
40 40
     {
41
-        if ($this->grouppingActive === FALSE) return '';
41
+        if ($this->grouppingActive === FALSE) {
42
+        	return '';
43
+        }
42 44
         
43 45
         $dbcol = $this->groupingColumn;
44 46
         if ($this->groupingVal == '' || $this->groupingVal != $values->$dbcol )
Please login to merge, or discard this patch.