@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | { |
8 | 8 | |
9 | 9 | /*************** Paging *************/ |
10 | - protected $maxPerPage = 25; |
|
10 | + protected $maxPerPage=25; |
|
11 | 11 | |
12 | - protected $currentPage = 0; |
|
12 | + protected $currentPage=0; |
|
13 | 13 | |
14 | 14 | /**** var & func of TrapDirectorTable used ***/ |
15 | 15 | protected $query; |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | public function countQuery() |
22 | 22 | { |
23 | - $this->query = $this->dbConn->select(); |
|
24 | - $this->query = $this->query |
|
23 | + $this->query=$this->dbConn->select(); |
|
24 | + $this->query=$this->query |
|
25 | 25 | ->from( |
26 | 26 | $this->table, |
27 | 27 | array('COUNT(*)') |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | |
38 | 38 | public function setMaxPerPage(int $max) |
39 | 39 | { |
40 | - $this->maxPerPage = $max; |
|
40 | + $this->maxPerPage=$max; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | protected function getPagingQuery(array $getVars) |
44 | 44 | { |
45 | 45 | if (isset($getVars['page'])) |
46 | 46 | { |
47 | - $this->currentPage = $getVars['page']; |
|
47 | + $this->currentPage=$getVars['page']; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -56,22 +56,22 @@ discard block |
||
56 | 56 | |
57 | 57 | public function renderPagingHeader() |
58 | 58 | { |
59 | - $count = $this->count(); |
|
60 | - if ($count <= $this->maxPerPage ) |
|
59 | + $count=$this->count(); |
|
60 | + if ($count <= $this->maxPerPage) |
|
61 | 61 | { |
62 | - return 'count : ' . $this->count() . '<br>'; |
|
62 | + return 'count : '.$this->count().'<br>'; |
|
63 | 63 | } |
64 | 64 | |
65 | - if ($this->currentPage == 0) $this->currentPage = 1; |
|
65 | + if ($this->currentPage == 0) $this->currentPage=1; |
|
66 | 66 | |
67 | - $numPages = intdiv($count , $this->maxPerPage); |
|
68 | - if ($count % $this->maxPerPage != 0 ) $numPages++; |
|
67 | + $numPages=intdiv($count, $this->maxPerPage); |
|
68 | + if ($count % $this->maxPerPage != 0) $numPages++; |
|
69 | 69 | |
70 | - $html = '<div class="pagination-control" role="navigation">'; |
|
71 | - $html .= '<ul class="nav tab-nav">'; |
|
72 | - if ($this->currentPage <=1) |
|
70 | + $html='<div class="pagination-control" role="navigation">'; |
|
71 | + $html.='<ul class="nav tab-nav">'; |
|
72 | + if ($this->currentPage <= 1) |
|
73 | 73 | { |
74 | - $html .= ' |
|
74 | + $html.=' |
|
75 | 75 | <li class="nav-item disabled" aria-hidden="true"> |
76 | 76 | <span class="previous-page"> |
77 | 77 | <span class="sr-only">Previous page</span> |
@@ -82,24 +82,24 @@ discard block |
||
82 | 82 | } |
83 | 83 | else |
84 | 84 | { |
85 | - $html .= ' |
|
85 | + $html.=' |
|
86 | 86 | <li class="nav-item"> |
87 | - <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage - 1 ).'" class="previous-page" > |
|
87 | + <a href="'. $this->getCurrentURLAndQS('paging').'&page='.($this->currentPage - 1).'" class="previous-page" > |
|
88 | 88 | <i aria-hidden="true" class="icon-angle-double-left"></i> |
89 | 89 | </a> |
90 | 90 | </li> |
91 | 91 | '; |
92 | 92 | } |
93 | 93 | |
94 | - for ($i=1; $i <= $numPages ; $i++) |
|
94 | + for ($i=1; $i <= $numPages; $i++) |
|
95 | 95 | { |
96 | - $active = ($this->currentPage == $i) ? 'active' : ''; |
|
97 | - $first = ($i-1)*$this->maxPerPage+1; |
|
98 | - $last = $i * $this->maxPerPage; |
|
99 | - if ($last > $count) $last = $count; |
|
100 | - $display = 'Show rows '. $first . ' to '. $last .' of '. $count; |
|
101 | - $html .= '<li class="' . $active . ' nav-item"> |
|
102 | - <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. $i .'" title="' . $display . '" aria-label="' . $display . '"> |
|
96 | + $active=($this->currentPage == $i) ? 'active' : ''; |
|
97 | + $first=($i - 1) * $this->maxPerPage + 1; |
|
98 | + $last=$i * $this->maxPerPage; |
|
99 | + if ($last > $count) $last=$count; |
|
100 | + $display='Show rows '.$first.' to '.$last.' of '.$count; |
|
101 | + $html.='<li class="'.$active.' nav-item"> |
|
102 | + <a href="'. $this->getCurrentURLAndQS('paging').'&page='.$i.'" title="'.$display.'" aria-label="'.$display.'"> |
|
103 | 103 | '.$i.' |
104 | 104 | </a> |
105 | 105 | </li>'; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | if ($this->currentPage == $numPages) |
109 | 109 | { |
110 | - $html .= ' |
|
110 | + $html.=' |
|
111 | 111 | <li class="nav-item disabled" aria-hidden="true"> |
112 | 112 | <span class="previous-page"> |
113 | 113 | <span class="sr-only">Previous page</span> |
@@ -118,23 +118,23 @@ discard block |
||
118 | 118 | } |
119 | 119 | else |
120 | 120 | { |
121 | - $html .= ' |
|
121 | + $html.=' |
|
122 | 122 | <li class="nav-item"> |
123 | - <a href="'. $this->getCurrentURLAndQS('paging') .'&page='. ($this->currentPage + 1 ).'" class="next-page"> |
|
123 | + <a href="'. $this->getCurrentURLAndQS('paging').'&page='.($this->currentPage + 1).'" class="next-page"> |
|
124 | 124 | <i aria-hidden="true" class="icon-angle-double-right"></i> |
125 | 125 | </a> |
126 | 126 | </li> |
127 | 127 | '; |
128 | 128 | } |
129 | 129 | |
130 | - $html .= '</ul> </div>'; |
|
130 | + $html.='</ul> </div>'; |
|
131 | 131 | |
132 | 132 | return $html; |
133 | 133 | } |
134 | 134 | |
135 | 135 | public function applyPaging() |
136 | 136 | { |
137 | - $this->query->limitPage($this->currentPage,$this->maxPerPage); |
|
137 | + $this->query->limitPage($this->currentPage, $this->maxPerPage); |
|
138 | 138 | return $this; |
139 | 139 | } |
140 | 140 |
@@ -20,22 +20,22 @@ discard block |
||
20 | 20 | protected $MIB; |
21 | 21 | |
22 | 22 | // categories |
23 | - protected $categories = NULL; |
|
23 | + protected $categories=NULL; |
|
24 | 24 | |
25 | 25 | public function setCategoriesArray(array $categories) |
26 | 26 | { |
27 | - $this->categories = $categories; |
|
27 | + $this->categories=$categories; |
|
28 | 28 | } |
29 | 29 | |
30 | - public function groupingPrintData( string $value) |
|
30 | + public function groupingPrintData(string $value) |
|
31 | 31 | { |
32 | 32 | if ($this->groupingColumn == 'rule_type') |
33 | 33 | { |
34 | - if ($this->categories == NULL || (! isset($this->categories[$value]))) |
|
34 | + if ($this->categories == NULL || (!isset($this->categories[$value]))) |
|
35 | 35 | return 'Unknown category ('.$value.')'; |
36 | - return 'Category : '. $this->categories[$value]; |
|
36 | + return 'Category : '.$this->categories[$value]; |
|
37 | 37 | } |
38 | - $html = "$value"; |
|
38 | + $html="$value"; |
|
39 | 39 | return $html; |
40 | 40 | } |
41 | 41 | |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | |
59 | 59 | public function getCurrentURL() |
60 | 60 | { |
61 | - return Url::fromPath($this->urlPath . '/handler'); |
|
61 | + return Url::fromPath($this->urlPath.'/handler'); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function renderLine($row) |
65 | 65 | { |
66 | - $html = ''; |
|
67 | - $firstCol = true; |
|
66 | + $html=''; |
|
67 | + $firstCol=true; |
|
68 | 68 | |
69 | - $titleNames = array_keys($this->titles); |
|
70 | - foreach ($titleNames as $rowkey ) |
|
69 | + $titleNames=array_keys($this->titles); |
|
70 | + foreach ($titleNames as $rowkey) |
|
71 | 71 | { |
72 | 72 | // Check missing value |
73 | 73 | if (property_exists($row, $rowkey)) |
@@ -82,57 +82,57 @@ discard block |
||
82 | 82 | |
83 | 83 | if ($this->doTranslate === true) |
84 | 84 | { |
85 | - $oidName = $this->MIB->translateOID($row->$rowkey); |
|
85 | + $oidName=$this->MIB->translateOID($row->$rowkey); |
|
86 | 86 | if (isset($oidName['name'])) |
87 | 87 | { |
88 | 88 | $val=$oidName['name']; |
89 | 89 | } |
90 | 90 | else |
91 | 91 | { |
92 | - $val = $row->$rowkey; |
|
92 | + $val=$row->$rowkey; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | else |
96 | 96 | { |
97 | - $val = $row->$rowkey; |
|
97 | + $val=$row->$rowkey; |
|
98 | 98 | } |
99 | 99 | break; |
100 | 100 | case 'host_name': // switch to hostgroup if name is null |
101 | 101 | if ($row->$rowkey == null) |
102 | 102 | { |
103 | - $val = $row->host_group_name; |
|
103 | + $val=$row->host_group_name; |
|
104 | 104 | } |
105 | 105 | else |
106 | 106 | { |
107 | - $val = $row->$rowkey; |
|
107 | + $val=$row->$rowkey; |
|
108 | 108 | } |
109 | 109 | break; |
110 | 110 | default: |
111 | - $val = $row->$rowkey; |
|
111 | + $val=$row->$rowkey; |
|
112 | 112 | } |
113 | - if ($rowkey == 'trap_oid' && $this->doTranslate===true) |
|
113 | + if ($rowkey == 'trap_oid' && $this->doTranslate === true) |
|
114 | 114 | { |
115 | 115 | |
116 | 116 | } |
117 | 117 | } else { |
118 | - $val = '-'; |
|
118 | + $val='-'; |
|
119 | 119 | } |
120 | 120 | if ($firstCol === true) { // Put link in first column for trap detail. |
121 | - $html .= '<td class="traphover">' |
|
121 | + $html.='<td class="traphover">' |
|
122 | 122 | . $this->view->qlink( |
123 | 123 | $this->view->escape($val), |
124 | 124 | Url::fromPath( |
125 | - $this->urlPath . '/handler/add', |
|
125 | + $this->urlPath.'/handler/add', |
|
126 | 126 | array('ruleid' => $row->id) |
127 | 127 | ) |
128 | 128 | ); |
129 | 129 | if ($row->comment != '') |
130 | 130 | { |
131 | - $html.= '<span class="tohover">'. $row->comment .'</span></td>'; |
|
131 | + $html.='<span class="tohover">'.$row->comment.'</span></td>'; |
|
132 | 132 | } |
133 | - $html.= '</td>'; |
|
133 | + $html.='</td>'; |
|
134 | 134 | } else { |
135 | - $html .= '<td>' . $this->view->escape($val) . '</td>'; |
|
135 | + $html.='<td>'.$this->view->escape($val).'</td>'; |
|
136 | 136 | } |
137 | 137 | $firstCol=false; |
138 | 138 |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function setGrouping(string $columnDBName) |
31 | 31 | { |
32 | - $this->groupingColumn = $columnDBName; |
|
33 | - $this->grouppingActive = TRUE; |
|
32 | + $this->groupingColumn=$columnDBName; |
|
33 | + $this->grouppingActive=TRUE; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function initGrouping() |
40 | 40 | { |
41 | - $this->groupingVal = ''; |
|
42 | - $this->groupingColSpan = count($this->titles); |
|
41 | + $this->groupingVal=''; |
|
42 | + $this->groupingColSpan=count($this->titles); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * @param string $value |
48 | 48 | * @return string |
49 | 49 | */ |
50 | - public function groupingPrintData( string $value ) |
|
50 | + public function groupingPrintData(string $value) |
|
51 | 51 | { |
52 | - $html = "$value"; |
|
52 | + $html="$value"; |
|
53 | 53 | return $html; |
54 | 54 | } |
55 | 55 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | * @param mixed $values |
73 | 73 | * @return string with line or empty. |
74 | 74 | */ |
75 | - public function groupingNextLine( $values) |
|
75 | + public function groupingNextLine($values) |
|
76 | 76 | { |
77 | 77 | if ($this->grouppingActive === FALSE) return ''; |
78 | 78 | |
79 | - $dbcol = $this->groupingColumn; |
|
80 | - if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal ,$values->$dbcol) === TRUE ) |
|
79 | + $dbcol=$this->groupingColumn; |
|
80 | + if ($this->groupingVal == '' || $this->groupingEvalNext($this->groupingVal, $values->$dbcol) === TRUE) |
|
81 | 81 | { |
82 | - $this->groupingVal = $values->$dbcol; |
|
83 | - $html = '<tr><th colspan="'. $this->groupingColSpan .'">'. $this->groupingPrintData($this->groupingVal) .'</th></tr>'; |
|
82 | + $this->groupingVal=$values->$dbcol; |
|
83 | + $html='<tr><th colspan="'.$this->groupingColSpan.'">'.$this->groupingPrintData($this->groupingVal).'</th></tr>'; |
|
84 | 84 | return $html; |
85 | 85 | } |
86 | 86 | return ''; |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | trait TrapDirectorTableOrder |
7 | 7 | { |
8 | 8 | /** @var array $order : (db column, 'ASC' | 'DESC') */ |
9 | - protected $order = array(); |
|
9 | + protected $order=array(); |
|
10 | 10 | /** @var string $orderQuery passed by GET */ |
11 | - protected $orderQuery = ''; |
|
11 | + protected $orderQuery=''; |
|
12 | 12 | |
13 | 13 | /** used var & functions of trapDirectorTable **/ |
14 | 14 | protected $query; |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | { |
27 | 27 | if ($orderSQL != "") $orderSQL.=','; |
28 | 28 | |
29 | - $orderSQL .= $column . ' ' . $direction; |
|
29 | + $orderSQL.=$column.' '.$direction; |
|
30 | 30 | } |
31 | - $this->query = $this->query->order($orderSQL); |
|
31 | + $this->query=$this->query->order($orderSQL); |
|
32 | 32 | |
33 | 33 | return $this; |
34 | 34 | } |
35 | 35 | |
36 | 36 | public function setOrder(array $order) |
37 | 37 | { |
38 | - $this->order = $order; |
|
38 | + $this->order=$order; |
|
39 | 39 | return $this; |
40 | 40 | } |
41 | 41 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | { |
50 | 50 | if (isset($getVars['o'])) |
51 | 51 | { |
52 | - $this->orderQuery = $getVars['o']; |
|
53 | - $match = array(); |
|
54 | - if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery , $match)) |
|
52 | + $this->orderQuery=$getVars['o']; |
|
53 | + $match=array(); |
|
54 | + if (preg_match('/(.*)(ASC|DESC)$/', $this->orderQuery, $match)) |
|
55 | 55 | { |
56 | 56 | $orderArray=array($match[1] => $match[2]); |
57 | 57 | echo "$match[1] => $match[2]"; |