Passed
Pull Request — master (#78)
by
unknown
04:15
created
application/controllers/ReceivedController.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
 		$this->checkReadPermission();
24 24
 		$this->prepareTabs()->activate('traps');
25 25
 
26
-		$dbConn = $this->getUIDatabase()->getDb();
26
+		$dbConn=$this->getUIDatabase()->getDb();
27 27
 		if ($dbConn === null) throw new \ErrorException('uncatched db error');
28 28
 		$this->getTrapListTable()->setConnection($dbConn);
29 29
 		
30 30
 		// Apply pagination limits
31
-		$this->view->table=$this->applyPaginationLimits($this->getTrapListTable(),$this->getModuleConfig()->itemListDisplay());		
31
+		$this->view->table=$this->applyPaginationLimits($this->getTrapListTable(), $this->getModuleConfig()->itemListDisplay());		
32 32
 		
33 33
 		// Set Filter
34 34
 		//$postData=$this->getRequest()->getPost();
35 35
 		$filter=array();
36
-		$filter['q']=$this->params->get('q');//(isset($postData['q']))?$postData['q']:'';
36
+		$filter['q']=$this->params->get('q'); //(isset($postData['q']))?$postData['q']:'';
37 37
 		$filter['done']=$this->params->get('done');
38 38
 		$this->view->filter=$filter;
39
-		$this->view->table->updateFilter(Url::fromRequest(),$filter);
39
+		$this->view->table->updateFilter(Url::fromRequest(), $filter);
40 40
 		
41 41
 		//$this->view->filterEditor = $this->getTrapListTable()->getFilterEditor($this->getRequest());
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		
51 51
 		$this->checkReadPermission();
52 52
 		// set up tab
53
-		$this->getTabs()->add('get',array(
53
+		$this->getTabs()->add('get', array(
54 54
 			'active'	=> true,
55 55
 			'label'		=> $this->translate('Detailed status'),
56 56
 			'url'		=> Url::fromRequest()
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 		$this->view->trapid=$trapid;
61 61
 		$queryArray=$this->getModuleConfig()->trapDetailQuery();
62 62
 		
63
-		$dbConn = $this->getUIDatabase()->getDbConn();
63
+		$dbConn=$this->getUIDatabase()->getDbConn();
64 64
 		if ($dbConn === null) throw new \ErrorException('uncatched db error');
65 65
 		
66 66
 		// URL to add a handler
67 67
 		$this->view->addHandlerUrl=Url::fromPath(
68
-			$this->getModuleConfig()->urlPath() . '/handler/add',
68
+			$this->getModuleConfig()->urlPath().'/handler/add',
69 69
 			array('fromid' => $trapid));
70 70
 		// ***************  Get main data
71 71
 		// extract columns and titles;
@@ -77,15 +77,15 @@  discard block
 block discarded – undo
77 77
 		// Do DB query for trap. 
78 78
 		try
79 79
 		{
80
-		    $query = $dbConn->select()
81
-				->from($this->moduleConfig->getTrapTableName(),$elmts)
82
-				->where('id=?',$trapid);
80
+		    $query=$dbConn->select()
81
+				->from($this->moduleConfig->getTrapTableName(), $elmts)
82
+				->where('id=?', $trapid);
83 83
 				$trapDetail=$dbConn->fetchRow($query);
84
-			if ( $trapDetail == null) throw new Exception('No traps was found with id = '.$trapid);
84
+			if ($trapDetail == null) throw new Exception('No traps was found with id = '.$trapid);
85 85
 		}
86 86
 		catch (Exception $e)
87 87
 		{
88
-			$this->displayExitError('Trap detail',$e->getMessage());
88
+			$this->displayExitError('Trap detail', $e->getMessage());
89 89
 			return;
90 90
 		}
91 91
 
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 			} else {
97 97
 				$cval=$trapDetail->$key;
98 98
 			}
99
-			array_push($queryArray[$key],$cval);
99
+			array_push($queryArray[$key], $cval);
100 100
 		}
101
-		$this->view->rowset = $queryArray;
101
+		$this->view->rowset=$queryArray;
102 102
 
103 103
 		// **************   Check for additionnal data
104 104
 		
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 		}
111 111
 		try
112 112
 		{		
113
-		    $query = $dbConn->select()
114
-				->from($this->moduleConfig->getTrapDataTableName(),$data_elmts)
115
-				->where('trap_id=?',$trapid);
113
+		    $query=$dbConn->select()
114
+				->from($this->moduleConfig->getTrapDataTableName(), $data_elmts)
115
+				->where('trap_id=?', $trapid);
116 116
 			$trapDetail=$dbConn->fetchAll($query);
117 117
 		}
118 118
 		catch (Exception $e)
119 119
 		{
120
-			$this->displayExitError('Trap detail',$e->getMessage());
120
+			$this->displayExitError('Trap detail', $e->getMessage());
121 121
 		}
122 122
 		// TODO : code this in a better & simpler way
123
-		if ($trapDetail == null ) 
123
+		if ($trapDetail == null) 
124 124
 		{
125 125
 			$this->view->data=false;
126 126
 		}
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 			foreach ($trapDetail as $key => $val) 
133 133
 			{	
134 134
 				$trapval[$key]=array();
135
-				foreach (array_keys($queryArrayData) as $vkey ) 
135
+				foreach (array_keys($queryArrayData) as $vkey) 
136 136
 				{
137
-					array_push($trapval[$key],$val->$vkey);
137
+					array_push($trapval[$key], $val->$vkey);
138 138
 				}
139 139
 			}
140 140
 			$this->view->data_val=$trapval;
@@ -150,21 +150,21 @@  discard block
 block discarded – undo
150 150
 	    $this->checkReadPermission();
151 151
 	    $this->prepareTabs()->activate('hosts');
152 152
 	    
153
-	    $dbConn = $this->getUIDatabase()->getDb();
153
+	    $dbConn=$this->getUIDatabase()->getDb();
154 154
 	    if ($dbConn === null) throw new \ErrorException('uncatched db error');
155 155
 	    
156 156
 	    $this->getTrapHostListTable()->setConnection($dbConn);
157 157
 	    
158 158
 	    // Apply pagination limits
159
-	    $this->view->table=$this->applyPaginationLimits($this->getTrapHostListTable(),$this->getModuleConfig()->itemListDisplay());
159
+	    $this->view->table=$this->applyPaginationLimits($this->getTrapHostListTable(), $this->getModuleConfig()->itemListDisplay());
160 160
 	    
161 161
 	    // Set Filter
162 162
 	    //$postData=$this->getRequest()->getPost();
163 163
 	    $filter=array();
164
-	    $filter['q']=$this->params->get('q');//(isset($postData['q']))?$postData['q']:'';
164
+	    $filter['q']=$this->params->get('q'); //(isset($postData['q']))?$postData['q']:'';
165 165
 	    $filter['done']=$this->params->get('done');
166 166
 	    $this->view->filter=$filter;
167
-	    $this->view->table->updateFilter(Url::fromRequest(),$filter);
167
+	    $this->view->table->updateFilter(Url::fromRequest(), $filter);
168 168
 	}
169 169
 	
170 170
 	public function deleteAction()
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 	{
184 184
 		return $this->getTabs()->add('traps', array(
185 185
 			'label'	=> $this->translate('Traps'),
186
-			'url'   => $this->getModuleConfig()->urlPath() . '/received')
186
+			'url'   => $this->getModuleConfig()->urlPath().'/received')
187 187
 		    )
188 188
 		    ->add('hosts', array(
189 189
 		        'label' => $this->translate('Hosts'),
190
-		        'url'   => $this->getModuleConfig()->urlPath() . '/received/hosts')
190
+		        'url'   => $this->getModuleConfig()->urlPath().'/received/hosts')
191 191
 		    )
192 192
 		    ->add('delete', array(
193 193
 			'label' => $this->translate('Delete'),
194
-			'url'   => $this->getModuleConfig()->urlPath() . '/received/delete')
194
+			'url'   => $this->getModuleConfig()->urlPath().'/received/delete')
195 195
 		  );
196 196
 	} 
197 197
 
@@ -218,14 +218,14 @@  discard block
 block discarded – undo
218 218
 			$this->_helper->json(array('status'=>'Missing variables'));
219 219
 			return;
220 220
 		}
221
-		if ($action =="count")
221
+		if ($action == "count")
222 222
 		{
223
-			$this->_helper->json(array('status'=>'OK','count'=>$this->getUIDatabase()->countTrap($ip,$oid)));
223
+			$this->_helper->json(array('status'=>'OK', 'count'=>$this->getUIDatabase()->countTrap($ip, $oid)));
224 224
 			return;
225 225
 		}
226
-		if ($action =="delete")
226
+		if ($action == "delete")
227 227
 		{
228
-		    $this->_helper->json(array('status'=>'OK','count'=>$this->getUIDatabase()->deleteTrap($ip,$oid)));
228
+		    $this->_helper->json(array('status'=>'OK', 'count'=>$this->getUIDatabase()->deleteTrap($ip, $oid)));
229 229
 			return;
230 230
 		}		
231 231
 		$this->_helper->json(array('status'=>'unknown action'));
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTableHostList.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 	// Filters 
24 24
 	
25 25
     protected $filter;
26
-    protected $enforcedFilters = array();
27
-    protected $searchColumns = array();
26
+    protected $enforcedFilters=array();
27
+    protected $searchColumns=array();
28 28
 	
29 29
 	protected function getTitles() {
30 30
 		// TODO : check moduleconfig is set
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	// ******************  Render table in html 
35 35
 	
36 36
 	// Host grouping
37
-	protected function renderHostIfNew($IP,$hostname)
37
+	protected function renderHostIfNew($IP, $hostname)
38 38
 	{
39
-	    $view = $this->getView();
39
+	    $view=$this->getView();
40 40
 	    
41 41
 	    if ($this->lastHost === $IP) {
42 42
 	        return;
@@ -44,31 +44,31 @@  discard block
 block discarded – undo
44 44
 	    
45 45
 	    if ($this->lastHost === null) 
46 46
 	    {
47
-	        $htm = "<thead>\n  <tr>\n";
47
+	        $htm="<thead>\n  <tr>\n";
48 48
 	    } else {
49
-	        $htm = "</tbody>\n<thead>\n  <tr>\n";
49
+	        $htm="</tbody>\n<thead>\n  <tr>\n";
50 50
 	    }
51 51
 	    
52 52
 	    if ($this->columnCount === null) 
53 53
 	    {
54
-	        $this->columnCount = count($this->getTitles());
54
+	        $this->columnCount=count($this->getTitles());
55 55
 	    }
56 56
 	    
57
-	    $htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($IP);
57
+	    $htm.='<th colspan="'.$this->columnCount.'">'.$view->escape($IP);
58 58
 	    if ($hostname != null)
59 59
 	    {
60
-	        $htm .= ' ('.$hostname.')';
60
+	        $htm.=' ('.$hostname.')';
61 61
 	    }
62
-	    $htm .= '</th>' . "\n";
62
+	    $htm.='</th>'."\n";
63 63
 	    if ($this->lastHost === null) {
64
-	        $htm .= "  </tr>\n";
64
+	        $htm.="  </tr>\n";
65 65
 	    } else {
66
-	        $htm .= "  </tr>\n</thead>\n";
66
+	        $htm.="  </tr>\n</thead>\n";
67 67
 	    }
68 68
 	    
69
-	    $this->lastHost = $IP;
69
+	    $this->lastHost=$IP;
70 70
 	    
71
-	    return $htm . "<tbody>\n";
71
+	    return $htm."<tbody>\n";
72 72
 	}		
73 73
 	
74 74
     public function __toString()
@@ -79,62 +79,62 @@  discard block
 block discarded – undo
79 79
 	public function render()
80 80
 	{
81 81
 		$data=$this->getTable();
82
-		$view = $this->getView();
83
-		$this->columnCount = count($this->getTitles());
82
+		$view=$this->getView();
83
+		$this->columnCount=count($this->getTitles());
84 84
 		$this->lastHost=null;
85 85
 		// Table start
86
-		$htm  = '<table class="simple common-table table-row-selectable">';
86
+		$htm='<table class="simple common-table table-row-selectable">';
87 87
 		
88 88
 		// Titles
89
-		$htm .= "<thead>\n  <tr>\n";
90
-		$titles = $this->getTitles();
89
+		$htm.="<thead>\n  <tr>\n";
90
+		$titles=$this->getTitles();
91 91
 		foreach ($titles as $title) 
92 92
 		{
93
-			$htm .= '    <th>' . $view->escape($view->translate($title)) . "</th>\n";
93
+			$htm.='    <th>'.$view->escape($view->translate($title))."</th>\n";
94 94
 		}
95
-		$htm .= "  </tr>\n</thead>\n";
95
+		$htm.="  </tr>\n</thead>\n";
96 96
 		
97 97
 		// Rows
98
-		$htm .= "<tbody>\n";
98
+		$htm.="<tbody>\n";
99 99
 		
100 100
 		foreach ($data as $row) 
101 101
 		{
102 102
 
103
-			$firstCol = true;
103
+			$firstCol=true;
104 104
 			// Put host header
105
-			$source_name=(property_exists($row,'source_name'))?$row->source_name:null;
106
-			$htm .= $this->renderHostIfNew($row->source_ip,$source_name);
105
+			$source_name=(property_exists($row, 'source_name')) ? $row->source_name : null;
106
+			$htm.=$this->renderHostIfNew($row->source_ip, $source_name);
107 107
 			
108 108
 			
109 109
 			// Render row
110
-			$htm .= '<tr '.' >';
111
-			foreach ( $titles as $rowkey => $title) 
110
+			$htm.='<tr '.' >';
111
+			foreach ($titles as $rowkey => $title) 
112 112
 			{
113 113
 				// Check missing value
114 114
 				if (property_exists($row, $rowkey)) 
115 115
 				{
116
-					$val = ($rowkey=='last_sent') ? DateFormatter::formatDateTime($row->$rowkey) : $row->$rowkey;
116
+					$val=($rowkey == 'last_sent') ? DateFormatter::formatDateTime($row->$rowkey) : $row->$rowkey;
117 117
 				} else {
118
-					$val = '-';
118
+					$val='-';
119 119
 				}
120 120
 				if ($firstCol === true) { // Put link in first column for trap detail.
121
-					$htm .= '<td>' 
121
+					$htm.='<td>' 
122 122
 							. $view->qlink(
123 123
 									$view->escape($val),  
124 124
 									Url::fromPath(
125
-										$this->moduleConfig->urlPath() . '/received', 
125
+										$this->moduleConfig->urlPath().'/received', 
126 126
 										array('q' => $row->trap_oid)
127 127
 									)
128 128
 							)
129 129
 							. '</td>';
130 130
 				} else {
131
-					$htm .= '<td>' . $view->escape($val) . '</td>';
131
+					$htm.='<td>'.$view->escape($val).'</td>';
132 132
 				}
133 133
 				$firstCol=false;
134 134
 			}
135
-			$htm .= "<tr>\n";
135
+			$htm.="<tr>\n";
136 136
 		}
137
-		$htm .= "</tbody></table>\n";
137
+		$htm.="</tbody></table>\n";
138 138
 		//$htm .= "Filter : " . $this->filter."<br>\n";
139 139
 		return $htm;
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     {  
145 145
         $db=$this->db();
146 146
 		
147
-		$query = $this->getBaseQuery();
147
+		$query=$this->getBaseQuery();
148 148
 		$this->applyFiltersToQuery($query);
149 149
 		$values=$db->fetchAll($query);
150 150
 		
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	
156 156
     public function getPaginator()
157 157
     {
158
-        $paginator = new Paginator();
158
+        $paginator=new Paginator();
159 159
         $paginator->setQuery($this);
160 160
 
161 161
         return $paginator;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	{
168 168
 		$db=$this->db();
169 169
 		
170
-		$query = $this->getBaseQuery();
170
+		$query=$this->getBaseQuery();
171 171
 		$this->applyFiltersToQuery($query);
172 172
        if ($this->hasLimit() || $this->hasOffset()) {
173 173
             $query->limit($this->getLimit(), $this->getOffset());
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
     public function getBaseQuery()
180 180
     {
181 181
 		$db=$this->db();
182
-		$query = $db->select()->from(
182
+		$query=$db->select()->from(
183 183
             $this->moduleConfig->getTrapTableName(),
184 184
 		    $this->moduleConfig->getTrapHostListDisplayColumns()
185
-		    )->group(array('t.source_ip','t.source_name','t.trap_oid'))
185
+		    )->group(array('t.source_ip', 't.source_name', 't.trap_oid'))
186 186
 		    ->order('t.source_ip');
187 187
 
188 188
         return $query;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	protected $filter_Handler;
194 194
 	protected $filter_query='';
195 195
 	protected $filter_done='';
196
-	protected $filter_query_list=array('q','done');
196
+	protected $filter_query_list=array('q', 'done');
197 197
 	public function renderFilterHTML()
198 198
 	{
199 199
 		$htm=' <form id="filter" name="mainFilter" 
@@ -203,17 +203,17 @@  discard block
 block discarded – undo
203 203
 		$htm.='<input type="text" name="q" title="Search is simple! Try to combine multiple words" 
204 204
 		placeholder="Search..." class="search" value="'.$this->filter_query.'">';
205 205
 		$htm.='<input type="checkbox" id="checkbox_done" name="done" value="1" class="autosubmit" ';
206
-		if	($this->filter_done == 1) { $htm.=' checked ';}
206
+		if ($this->filter_done == 1) { $htm.=' checked '; }
207 207
 		$htm.='> <label for="checkbox_done">Hide processed traps</label>';
208 208
 		$htm.='</form>';
209 209
 		return $htm;
210 210
 	}
211 211
 	
212
-	public function updateFilter($handler,$filter)
212
+	public function updateFilter($handler, $filter)
213 213
 	{
214 214
 		$this->filter_Handler=$handler->remove($this->filter_query_list)->__toString();
215
-		$this->filter_query=(isset($filter['q']))?$this->filter_query=$filter['q']:'';
216
-		$this->filter_done=(isset($filter['done']))?$this->filter_done=$filter['done']:0;
215
+		$this->filter_query=(isset($filter['q'])) ? $this->filter_query=$filter['q'] : '';
216
+		$this->filter_done=(isset($filter['done'])) ? $this->filter_done=$filter['done'] : 0;
217 217
 	}
218 218
 	
219 219
     protected function getSearchColumns()
@@ -228,20 +228,20 @@  discard block
 block discarded – undo
228 228
 
229 229
     public function setFilter($filter)
230 230
     {
231
-        $this->filter = $filter;
231
+        $this->filter=$filter;
232 232
         return $this;
233 233
     }
234 234
 	
235 235
 	public function getFilterEditor(Request $request)
236 236
     {
237
-        $filterEditor = Widget::create('filterEditor')
237
+        $filterEditor=Widget::create('filterEditor')
238 238
             ->setColumns(array_keys($this->getColumns()))
239 239
             ->setSearchColumns(array_keys($this->getSearchColumns()))
240 240
             ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
241 241
             ->ignoreParams('page')
242 242
             ->handleRequest($request);
243 243
 
244
-        $filter = $filterEditor->getFilter();
244
+        $filter=$filterEditor->getFilter();
245 245
         $this->setFilter($filter);
246 246
 
247 247
         return $filterEditor;
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 		{
256 256
 			$sql.='(';
257 257
 			$first=1;
258
-			foreach($this->moduleConfig->getTrapListSearchColumns() as $column)
258
+			foreach ($this->moduleConfig->getTrapListSearchColumns() as $column)
259 259
 			{
260
-				if ($first==0) $sql.=' OR ';
260
+				if ($first == 0) $sql.=' OR ';
261 261
 				$first=0;
262 262
 				$sql.=" ".$column." LIKE  '%".$this->filter_query."%' ";
263 263
 			}
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTable.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
 	// view limits
30 30
 	protected $limit;
31
-    protected $offset;
31
+	protected $offset;
32 32
 
33 33
 	// Used for rendering days in list
34 34
 	protected $columnCount;
@@ -36,55 +36,55 @@  discard block
 block discarded – undo
36 36
 	
37 37
 	// Filters 
38 38
 	
39
-    protected $filter;
40
-    protected $enforcedFilters = array();
41
-    protected $searchColumns = array();
39
+	protected $filter;
40
+	protected $enforcedFilters = array();
41
+	protected $searchColumns = array();
42 42
 	
43 43
 	
44 44
 	// Must return titles in array ( id => display_name )
45 45
 	abstract protected function getTitles();
46 46
 	// ****************** Day header
47
-    protected function renderDayIfNew($timestamp)
48
-    {
49
-        $view = $this->getView();
47
+	protected function renderDayIfNew($timestamp)
48
+	{
49
+		$view = $this->getView();
50 50
 
51 51
 		// Check for date local format
52
-        if (in_array(setlocale(LC_ALL, 0), array('en_US.UTF-8', 'C'))) {
53
-            $day = date('l, jS F Y', (int) $timestamp);
54
-        } else {
55
-            $day = DateFormatter::formatDate((int) $timestamp);
56
-        }
57
-
58
-        if ($this->lastDay === $day) {
59
-            return;
60
-        }
61
-
62
-        if ($this->lastDay === null) {
63
-            $htm = "<thead>\n  <tr>\n";
64
-        } else {
65
-            $htm = "</tbody>\n<thead>\n  <tr>\n";
66
-        }
67
-
68
-        if ($this->columnCount === null) {
69
-            $this->columnCount = count($this->getTitles());
70
-        }
71
-
72
-        $htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($day) . '</th>' . "\n";
73
-        if ($this->lastDay === null) {
74
-            $htm .= "  </tr>\n";
75
-        } else {
76
-            $htm .= "  </tr>\n</thead>\n";
77
-        }
78
-
79
-        $this->lastDay = $day;
80
-
81
-        return $htm . "<tbody>\n";
82
-    }		
52
+		if (in_array(setlocale(LC_ALL, 0), array('en_US.UTF-8', 'C'))) {
53
+			$day = date('l, jS F Y', (int) $timestamp);
54
+		} else {
55
+			$day = DateFormatter::formatDate((int) $timestamp);
56
+		}
57
+
58
+		if ($this->lastDay === $day) {
59
+			return;
60
+		}
61
+
62
+		if ($this->lastDay === null) {
63
+			$htm = "<thead>\n  <tr>\n";
64
+		} else {
65
+			$htm = "</tbody>\n<thead>\n  <tr>\n";
66
+		}
67
+
68
+		if ($this->columnCount === null) {
69
+			$this->columnCount = count($this->getTitles());
70
+		}
71
+
72
+		$htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($day) . '</th>' . "\n";
73
+		if ($this->lastDay === null) {
74
+			$htm .= "  </tr>\n";
75
+		} else {
76
+			$htm .= "  </tr>\n</thead>\n";
77
+		}
78
+
79
+		$this->lastDay = $day;
80
+
81
+		return $htm . "<tbody>\n";
82
+	}		
83 83
 	// ******************  Render table in html  
84
-    public function __toString()
85
-    {
86
-        return $this->render();
87
-    }
84
+	public function __toString()
85
+	{
86
+		return $this->render();
87
+	}
88 88
 	
89 89
 	abstract public function render();
90 90
 	
@@ -94,76 +94,76 @@  discard block
 block discarded – undo
94 94
 		$this->moduleConfig = $conf;
95 95
 	}
96 96
 	// ******************  View get/set
97
-    protected function getView()
98
-    {
99
-        if ($this->view === null) {
100
-            $this->view = Icinga::app()->getViewRenderer()->view;
101
-        }
102
-        return $this->view;
103
-    }
97
+	protected function getView()
98
+	{
99
+		if ($this->view === null) {
100
+			$this->view = Icinga::app()->getViewRenderer()->view;
101
+		}
102
+		return $this->view;
103
+	}
104 104
 
105
-    public function setView($view)
106
-    {
107
-        $this->view = $view;
108
-    }	
105
+	public function setView($view)
106
+	{
107
+		$this->view = $view;
108
+	}	
109 109
 	
110 110
 	// Limits
111 111
 	
112
-    public function limit($count = null, $offset = null)
113
-    {
114
-        $this->limit = $count;
115
-        $this->offset = $offset;
116
-
117
-        return $this;
118
-    }
119
-
120
-    public function hasLimit()
121
-    {
122
-        return $this->limit !== null;
123
-    }
124
-
125
-    public function getLimit()
126
-    {
127
-        return $this->limit;
128
-    }
129
-
130
-    public function hasOffset()
131
-    {
132
-        return $this->offset !== null;
133
-    }
134
-
135
-    public function getOffset()
136
-    {
137
-        return $this->offset;
138
-    }
112
+	public function limit($count = null, $offset = null)
113
+	{
114
+		$this->limit = $count;
115
+		$this->offset = $offset;
116
+
117
+		return $this;
118
+	}
119
+
120
+	public function hasLimit()
121
+	{
122
+		return $this->limit !== null;
123
+	}
124
+
125
+	public function getLimit()
126
+	{
127
+		return $this->limit;
128
+	}
129
+
130
+	public function hasOffset()
131
+	{
132
+		return $this->offset !== null;
133
+	}
134
+
135
+	public function getOffset()
136
+	{
137
+		return $this->offset;
138
+	}
139 139
 	#[\ReturnTypeWillChange]
140 140
 	abstract function count();
141 141
 	
142
-    public function getPaginator()
143
-    {
144
-        $paginator = new Paginator();
145
-        $paginator->setQuery($this);
142
+	public function getPaginator()
143
+	{
144
+		$paginator = new Paginator();
145
+		$paginator->setQuery($this);
146 146
 
147
-        return $paginator;
148
-    }
147
+		return $paginator;
148
+	}
149 149
 	
150 150
 	// ****************** DB connection and query
151 151
 	
152
-    public function setConnection(Selectable $connection)
153
-    {
154
-        $this->connection = $connection;
155
-        return $this;
156
-    }
152
+	public function setConnection(Selectable $connection)
153
+	{
154
+		$this->connection = $connection;
155
+		return $this;
156
+	}
157 157
 
158
-    protected function connection()
159
-    {
160
-        return $this->connection;
161
-    }
158
+	protected function connection()
159
+	{
160
+		return $this->connection;
161
+	}
162 162
 
163
-    protected function db()
164
-    {
165
-        return $this->connection()->getDbAdapter();
166
-    }
163
+	protected function db()
164
+	{
165
+		return $this->connection()->getDbAdapter();
166
+	}
167 167
 	
168 168
 	protected function getTable()
169 169
 	{
@@ -171,52 +171,52 @@  discard block
 block discarded – undo
171 171
 		
172 172
 		$query = $this->getBaseQuery();
173 173
 		
174
-       if ($this->hasLimit() || $this->hasOffset()) {
175
-            $query->limit($this->getLimit(), $this->getOffset());
176
-        }		
174
+	   if ($this->hasLimit() || $this->hasOffset()) {
175
+			$query->limit($this->getLimit(), $this->getOffset());
176
+		}		
177 177
 		
178 178
 		return $db->fetchAll($query);
179 179
 	}
180 180
 	 
181
-    abstract public function getBaseQuery(); 
181
+	abstract public function getBaseQuery(); 
182 182
 	
183 183
 	// ****************** Filters
184 184
 
185
-    protected function getSearchColumns()
186
-    {
187
-        return $this->getColumns();
188
-    }
185
+	protected function getSearchColumns()
186
+	{
187
+		return $this->getColumns();
188
+	}
189 189
 	
190 190
 	abstract public function getColumns();
191 191
 
192
-    public function setFilter($filter)
193
-    {
194
-        $this->filter = $filter;
195
-        return $this;
196
-    }
192
+	public function setFilter($filter)
193
+	{
194
+		$this->filter = $filter;
195
+		return $this;
196
+	}
197 197
 	
198 198
 	public function getFilterEditor(Request $request)
199
-    {
200
-        $filterEditor = Widget::create('filterEditor')
201
-            ->setColumns(array_keys($this->getColumns()))
202
-            ->setSearchColumns(array_keys($this->getSearchColumns()))
203
-            ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
204
-            ->ignoreParams('page')
205
-            ->handleRequest($request);
199
+	{
200
+		$filterEditor = Widget::create('filterEditor')
201
+			->setColumns(array_keys($this->getColumns()))
202
+			->setSearchColumns(array_keys($this->getSearchColumns()))
203
+			->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
204
+			->ignoreParams('page')
205
+			->handleRequest($request);
206 206
 
207
-        $filter = $filterEditor->getFilter();
208
-        $this->setFilter($filter);
207
+		$filter = $filterEditor->getFilter();
208
+		$this->setFilter($filter);
209 209
 
210
-        return $filterEditor;
211
-    }
210
+		return $filterEditor;
211
+	}
212 212
 	
213 213
 	protected function renderFilter($filter)
214 214
 	{ // TODO : create a better filter wher user can choose host/oid to filter
215 215
 	}
216 216
 	
217
-    protected function applyFiltersToQuery($query)
218
-    {
219
-        /*
217
+	protected function applyFiltersToQuery($query)
218
+	{
219
+		/*
220 220
 		$filter = null;
221 221
         $enforced = $this->enforcedFilters;
222 222
         if ($this->filter && ! $this->filter->isEmpty()) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             $query->where($this->renderFilter($filter));
233 233
         }
234 234
 		*/
235
-        return $query;
236
-    }	
235
+		return $query;
236
+	}	
237 237
 
238 238
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	// Filters 
38 38
 	
39 39
     protected $filter;
40
-    protected $enforcedFilters = array();
41
-    protected $searchColumns = array();
40
+    protected $enforcedFilters=array();
41
+    protected $searchColumns=array();
42 42
 	
43 43
 	
44 44
 	// Must return titles in array ( id => display_name )
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 	// ****************** Day header
47 47
     protected function renderDayIfNew($timestamp)
48 48
     {
49
-        $view = $this->getView();
49
+        $view=$this->getView();
50 50
 
51 51
 		// Check for date local format
52 52
         if (in_array(setlocale(LC_ALL, 0), array('en_US.UTF-8', 'C'))) {
53
-            $day = date('l, jS F Y', (int) $timestamp);
53
+            $day=date('l, jS F Y', (int) $timestamp);
54 54
         } else {
55
-            $day = DateFormatter::formatDate((int) $timestamp);
55
+            $day=DateFormatter::formatDate((int) $timestamp);
56 56
         }
57 57
 
58 58
         if ($this->lastDay === $day) {
@@ -60,25 +60,25 @@  discard block
 block discarded – undo
60 60
         }
61 61
 
62 62
         if ($this->lastDay === null) {
63
-            $htm = "<thead>\n  <tr>\n";
63
+            $htm="<thead>\n  <tr>\n";
64 64
         } else {
65
-            $htm = "</tbody>\n<thead>\n  <tr>\n";
65
+            $htm="</tbody>\n<thead>\n  <tr>\n";
66 66
         }
67 67
 
68 68
         if ($this->columnCount === null) {
69
-            $this->columnCount = count($this->getTitles());
69
+            $this->columnCount=count($this->getTitles());
70 70
         }
71 71
 
72
-        $htm .= '<th colspan="' . $this->columnCount . '">' . $view->escape($day) . '</th>' . "\n";
72
+        $htm.='<th colspan="'.$this->columnCount.'">'.$view->escape($day).'</th>'."\n";
73 73
         if ($this->lastDay === null) {
74
-            $htm .= "  </tr>\n";
74
+            $htm.="  </tr>\n";
75 75
         } else {
76
-            $htm .= "  </tr>\n</thead>\n";
76
+            $htm.="  </tr>\n</thead>\n";
77 77
         }
78 78
 
79
-        $this->lastDay = $day;
79
+        $this->lastDay=$day;
80 80
 
81
-        return $htm . "<tbody>\n";
81
+        return $htm."<tbody>\n";
82 82
     }		
83 83
 	// ******************  Render table in html  
84 84
     public function __toString()
@@ -91,28 +91,28 @@  discard block
 block discarded – undo
91 91
 	// ******************  Static config set
92 92
 	public function setConfig($conf)
93 93
 	{
94
-		$this->moduleConfig = $conf;
94
+		$this->moduleConfig=$conf;
95 95
 	}
96 96
 	// ******************  View get/set
97 97
     protected function getView()
98 98
     {
99 99
         if ($this->view === null) {
100
-            $this->view = Icinga::app()->getViewRenderer()->view;
100
+            $this->view=Icinga::app()->getViewRenderer()->view;
101 101
         }
102 102
         return $this->view;
103 103
     }
104 104
 
105 105
     public function setView($view)
106 106
     {
107
-        $this->view = $view;
107
+        $this->view=$view;
108 108
     }	
109 109
 	
110 110
 	// Limits
111 111
 	
112
-    public function limit($count = null, $offset = null)
112
+    public function limit($count=null, $offset=null)
113 113
     {
114
-        $this->limit = $count;
115
-        $this->offset = $offset;
114
+        $this->limit=$count;
115
+        $this->offset=$offset;
116 116
 
117 117
         return $this;
118 118
     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	
142 142
     public function getPaginator()
143 143
     {
144
-        $paginator = new Paginator();
144
+        $paginator=new Paginator();
145 145
         $paginator->setQuery($this);
146 146
 
147 147
         return $paginator;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	
152 152
     public function setConnection(Selectable $connection)
153 153
     {
154
-        $this->connection = $connection;
154
+        $this->connection=$connection;
155 155
         return $this;
156 156
     }
157 157
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	{
170 170
 		$db=$this->db();
171 171
 		
172
-		$query = $this->getBaseQuery();
172
+		$query=$this->getBaseQuery();
173 173
 		
174 174
        if ($this->hasLimit() || $this->hasOffset()) {
175 175
             $query->limit($this->getLimit(), $this->getOffset());
@@ -191,20 +191,20 @@  discard block
 block discarded – undo
191 191
 
192 192
     public function setFilter($filter)
193 193
     {
194
-        $this->filter = $filter;
194
+        $this->filter=$filter;
195 195
         return $this;
196 196
     }
197 197
 	
198 198
 	public function getFilterEditor(Request $request)
199 199
     {
200
-        $filterEditor = Widget::create('filterEditor')
200
+        $filterEditor=Widget::create('filterEditor')
201 201
             ->setColumns(array_keys($this->getColumns()))
202 202
             ->setSearchColumns(array_keys($this->getSearchColumns()))
203 203
             ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
204 204
             ->ignoreParams('page')
205 205
             ->handleRequest($request);
206 206
 
207
-        $filter = $filterEditor->getFilter();
207
+        $filter=$filterEditor->getFilter();
208 208
         $this->setFilter($filter);
209 209
 
210 210
         return $filterEditor;
Please login to merge, or discard this patch.
library/Trapdirector/Tables/TrapTableList.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 	
20 20
 	// Filters 
21 21
 	
22
-    protected $filter;
23
-    protected $enforcedFilters = array();
24
-    protected $searchColumns = array();
22
+	protected $filter;
23
+	protected $enforcedFilters = array();
24
+	protected $searchColumns = array();
25 25
 	
26 26
 	protected function getTitles() {
27 27
 		// TODO : check moduleconfig is set
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 		
31 31
 	// ******************  Render table in html  
32
-    public function __toString()
33
-    {
34
-        return $this->render();
35
-    }
32
+	public function __toString()
33
+	{
34
+		return $this->render();
35
+	}
36 36
 	
37 37
 	public function render()
38 38
 	{
@@ -96,26 +96,26 @@  discard block
 block discarded – undo
96 96
 
97 97
 	}
98 98
 
99
-    public function count()
100
-    {
101
-        $db=$this->db();
99
+	public function count()
100
+	{
101
+		$db=$this->db();
102 102
 		
103 103
 		$query = $db->select()->from(
104
-            $this->moduleConfig->getTrapTableName(),
105
-            array('COUNT(*)')
106
-        );
104
+			$this->moduleConfig->getTrapTableName(),
105
+			array('COUNT(*)')
106
+		);
107 107
 		$this->applyFiltersToQuery($query);
108 108
 		
109
-        return $db->fetchOne($query);
110
-    }
109
+		return $db->fetchOne($query);
110
+	}
111 111
 	
112
-    public function getPaginator()
113
-    {
114
-        $paginator = new Paginator();
115
-        $paginator->setQuery($this);
112
+	public function getPaginator()
113
+	{
114
+		$paginator = new Paginator();
115
+		$paginator->setQuery($this);
116 116
 
117
-        return $paginator;
118
-    }
117
+		return $paginator;
118
+	}
119 119
 	
120 120
 	// ****************** DB connection and query
121 121
 	
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 		
126 126
 		$query = $this->getBaseQuery();
127 127
 		$this->applyFiltersToQuery($query);
128
-       if ($this->hasLimit() || $this->hasOffset()) {
129
-            $query->limit($this->getLimit(), $this->getOffset());
130
-        }		
128
+	   if ($this->hasLimit() || $this->hasOffset()) {
129
+			$query->limit($this->getLimit(), $this->getOffset());
130
+		}		
131 131
 		
132 132
 		return $db->fetchAll($query);
133 133
 	}
134 134
 	 
135
-    public function getBaseQuery()
136
-    {
135
+	public function getBaseQuery()
136
+	{
137 137
 		$db=$this->db();
138 138
 		
139 139
 		$query = $db->select()->from(
140
-            $this->moduleConfig->getTrapTableName(),
141
-            $this->moduleConfig->getTrapListDisplayColumns()
142
-        )->order('timestamp DESC');
140
+			$this->moduleConfig->getTrapTableName(),
141
+			$this->moduleConfig->getTrapListDisplayColumns()
142
+		)->order('timestamp DESC');
143 143
 
144
-        return $query;
145
-    }	 
144
+		return $query;
145
+	}	 
146 146
 	
147 147
 	// ****************** Filters
148 148
 
@@ -172,39 +172,39 @@  discard block
 block discarded – undo
172 172
 		$this->filter_done=(isset($filter['done']))?$this->filter_done=$filter['done']:0;
173 173
 	}
174 174
 	
175
-    protected function getSearchColumns()
176
-    {
177
-        return $this->getColumns();
178
-    }
175
+	protected function getSearchColumns()
176
+	{
177
+		return $this->getColumns();
178
+	}
179 179
 	
180 180
 	public function getColumns()
181 181
 	{
182 182
 		return $this->moduleConfig->getTrapListDisplayColumns();
183 183
 	}
184 184
 
185
-    public function setFilter($filter)
186
-    {
187
-        $this->filter = $filter;
188
-        return $this;
189
-    }
185
+	public function setFilter($filter)
186
+	{
187
+		$this->filter = $filter;
188
+		return $this;
189
+	}
190 190
 	
191 191
 	public function getFilterEditor(Request $request)
192
-    {
193
-        $filterEditor = Widget::create('filterEditor')
194
-            ->setColumns(array_keys($this->getColumns()))
195
-            ->setSearchColumns(array_keys($this->getSearchColumns()))
196
-            ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
197
-            ->ignoreParams('page')
198
-            ->handleRequest($request);
192
+	{
193
+		$filterEditor = Widget::create('filterEditor')
194
+			->setColumns(array_keys($this->getColumns()))
195
+			->setSearchColumns(array_keys($this->getSearchColumns()))
196
+			->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
197
+			->ignoreParams('page')
198
+			->handleRequest($request);
199 199
 
200
-        $filter = $filterEditor->getFilter();
201
-        $this->setFilter($filter);
200
+		$filter = $filterEditor->getFilter();
201
+		$this->setFilter($filter);
202 202
 
203
-        return $filterEditor;
204
-    }
203
+		return $filterEditor;
204
+	}
205 205
 	
206
-    protected function applyFiltersToQuery($query)
207
-    {
206
+	protected function applyFiltersToQuery($query)
207
+	{
208 208
 		
209 209
 		$sql='';
210 210
 		if ($this->filter_query != '')
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			$sql.="(status != 'done')";
226 226
 		}
227 227
 		if ($sql != '') $query->where($sql);	
228
-        return $query;
229
-    }	
228
+		return $query;
229
+	}	
230 230
 
231 231
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 	// Filters 
21 21
 	
22 22
     protected $filter;
23
-    protected $enforcedFilters = array();
24
-    protected $searchColumns = array();
23
+    protected $enforcedFilters=array();
24
+    protected $searchColumns=array();
25 25
 	
26 26
 	protected function getTitles() {
27 27
 		// TODO : check moduleconfig is set
@@ -37,60 +37,60 @@  discard block
 block discarded – undo
37 37
 	public function render()
38 38
 	{
39 39
 		$data=$this->getTable();
40
-		$view = $this->getView();
41
-		$this->columnCount = count($this->getTitles());
40
+		$view=$this->getView();
41
+		$this->columnCount=count($this->getTitles());
42 42
 		$this->lastDay=null;
43 43
 		// Table start
44
-		$htm  = '<table class="simple common-table table-row-selectable">';
44
+		$htm='<table class="simple common-table table-row-selectable">';
45 45
 		
46 46
 		// Titles
47
-		$htm .= "<thead>\n  <tr>\n";
48
-		$titles = $this->getTitles();
47
+		$htm.="<thead>\n  <tr>\n";
48
+		$titles=$this->getTitles();
49 49
 		foreach ($titles as $title) 
50 50
 		{
51
-			$htm .= '    <th>' . $view->escape($view->translate($title)) . "</th>\n";
51
+			$htm.='    <th>'.$view->escape($view->translate($title))."</th>\n";
52 52
 		}
53
-		$htm .= "  </tr>\n</thead>\n";
53
+		$htm.="  </tr>\n</thead>\n";
54 54
 		
55 55
 		// Rows
56
-		$htm .= "<tbody>\n";
56
+		$htm.="<tbody>\n";
57 57
 		
58 58
 		foreach ($data as $row) 
59 59
 		{
60
-			$firstCol = true;
60
+			$firstCol=true;
61 61
 			// Put date header
62
-			$htm .= $this->renderDayIfNew($row->timestamp);
62
+			$htm.=$this->renderDayIfNew($row->timestamp);
63 63
 			
64 64
 			
65 65
 			// Render row
66
-			$htm .= '<tr>';
67
-			foreach ( $titles as $rowkey => $title) 
66
+			$htm.='<tr>';
67
+			foreach ($titles as $rowkey => $title) 
68 68
 			{
69 69
 				// Check missing value
70 70
 				if (property_exists($row, $rowkey)) 
71 71
 				{
72
-					$val = ($rowkey=='timestamp') ?  DateFormatter::formatTime($row->$rowkey) : $row->$rowkey;
72
+					$val=($rowkey == 'timestamp') ?  DateFormatter::formatTime($row->$rowkey) : $row->$rowkey;
73 73
 				} else {
74
-					$val = '-';
74
+					$val='-';
75 75
 				}
76 76
 				if ($firstCol == true) { // Put link in first column for trap detail.
77
-					$htm .= '<td>' 
77
+					$htm.='<td>' 
78 78
 							. $view->qlink(
79 79
 									$view->escape($val),  
80 80
 									Url::fromPath(
81
-										$this->moduleConfig->urlPath() . '/received/trapdetail', 
81
+										$this->moduleConfig->urlPath().'/received/trapdetail', 
82 82
 										array('id' => $row->id)
83 83
 									)
84 84
 							)
85 85
 							. '</td>';
86 86
 				} else {
87
-					$htm .= '<td>' . $view->escape($val) . '</td>';
87
+					$htm.='<td>'.$view->escape($val).'</td>';
88 88
 				}
89 89
 				$firstCol=false;
90 90
 			}
91
-			$htm .= "<tr>\n";
91
+			$htm.="<tr>\n";
92 92
 		}
93
-		$htm .= "</tbody></table>\n";
93
+		$htm.="</tbody></table>\n";
94 94
 		//$htm .= "Filter : " . $this->filter."<br>\n";
95 95
 		return $htm;
96 96
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $db=$this->db();
102 102
 		
103
-		$query = $db->select()->from(
103
+		$query=$db->select()->from(
104 104
             $this->moduleConfig->getTrapTableName(),
105 105
             array('COUNT(*)')
106 106
         );
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	
112 112
     public function getPaginator()
113 113
     {
114
-        $paginator = new Paginator();
114
+        $paginator=new Paginator();
115 115
         $paginator->setQuery($this);
116 116
 
117 117
         return $paginator;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		$db=$this->db();
125 125
 		
126
-		$query = $this->getBaseQuery();
126
+		$query=$this->getBaseQuery();
127 127
 		$this->applyFiltersToQuery($query);
128 128
        if ($this->hasLimit() || $this->hasOffset()) {
129 129
             $query->limit($this->getLimit(), $this->getOffset());
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
 		$db=$this->db();
138 138
 		
139
-		$query = $db->select()->from(
139
+		$query=$db->select()->from(
140 140
             $this->moduleConfig->getTrapTableName(),
141 141
             $this->moduleConfig->getTrapListDisplayColumns()
142 142
         )->order('timestamp DESC');
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	protected $filter_Handler;
150 150
 	protected $filter_query='';
151 151
 	protected $filter_done='';
152
-	protected $filter_query_list=array('q','done');
152
+	protected $filter_query_list=array('q', 'done');
153 153
 	public function renderFilterHTML()
154 154
 	{
155 155
 		$htm=' <form id="filter" name="mainFilter" 
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
 		$htm.='<input type="text" name="q" title="Search is simple! Try to combine multiple words" 
160 160
 		placeholder="Search..." class="search" value="'.$this->filter_query.'">';
161 161
 		$htm.='<input type="checkbox" id="checkbox_done" name="done" value="1" class="autosubmit" ';
162
-		if	($this->filter_done == 1) { $htm.=' checked ';}
162
+		if ($this->filter_done == 1) { $htm.=' checked '; }
163 163
 		$htm.='> <label for="checkbox_done">Hide processed traps</label>';
164 164
 		$htm.='</form>';
165 165
 		return $htm;
166 166
 	}
167 167
 	
168
-	public function updateFilter($handler,$filter)
168
+	public function updateFilter($handler, $filter)
169 169
 	{
170 170
 		$this->filter_Handler=$handler->remove($this->filter_query_list)->__toString();
171
-		$this->filter_query=(isset($filter['q']))?$this->filter_query=$filter['q']:'';
172
-		$this->filter_done=(isset($filter['done']))?$this->filter_done=$filter['done']:0;
171
+		$this->filter_query=(isset($filter['q'])) ? $this->filter_query=$filter['q'] : '';
172
+		$this->filter_done=(isset($filter['done'])) ? $this->filter_done=$filter['done'] : 0;
173 173
 	}
174 174
 	
175 175
     protected function getSearchColumns()
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
 
185 185
     public function setFilter($filter)
186 186
     {
187
-        $this->filter = $filter;
187
+        $this->filter=$filter;
188 188
         return $this;
189 189
     }
190 190
 	
191 191
 	public function getFilterEditor(Request $request)
192 192
     {
193
-        $filterEditor = Widget::create('filterEditor')
193
+        $filterEditor=Widget::create('filterEditor')
194 194
             ->setColumns(array_keys($this->getColumns()))
195 195
             ->setSearchColumns(array_keys($this->getSearchColumns()))
196 196
             ->preserveParams('limit', 'sort', 'dir', 'view', 'backend')
197 197
             ->ignoreParams('page')
198 198
             ->handleRequest($request);
199 199
 
200
-        $filter = $filterEditor->getFilter();
200
+        $filter=$filterEditor->getFilter();
201 201
         $this->setFilter($filter);
202 202
 
203 203
         return $filterEditor;
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 		{
212 212
 			$sql.='(';
213 213
 			$first=1;
214
-			foreach($this->moduleConfig->getTrapListSearchColumns() as $column)
214
+			foreach ($this->moduleConfig->getTrapListSearchColumns() as $column)
215 215
 			{
216
-				if ($first==0) $sql.=' OR ';
216
+				if ($first == 0) $sql.=' OR ';
217 217
 				$first=0;
218 218
 				$sql.=" CAST(".$column." AS  char(100))  LIKE  '%".$this->filter_query."%' ";
219 219
 			}
Please login to merge, or discard this patch.