Passed
Push — master ( cb2842...994f5c )
by Patrick
02:04
created
library/Trapdirector/Tables/TrapDirectorTableFilter.php 1 patch
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.
library/Trapdirector/Tables/TrapDirectorTable.php 1 patch
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.
library/Trapdirector/Tables/TrapDirectorTablePaging.php 1 patch
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.
library/Trapdirector/Tables/TrapDirectorTableOrder.php 1 patch
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.
library/Trapdirector/Tables/TrapDirectorTableGrouping.php 1 patch
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.