Completed
Push — master ( 8138ff...ee3296 )
by Michael
01:55
created
class/Tree.php 2 patches
Indentation   +364 added lines, -364 removed lines patch added patch discarded remove patch
@@ -18,96 +18,96 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Tree extends \XoopsObjectTree
20 20
 {
21
-    //    public function __construct()
22
-    //    {
23
-    //    }
24
-
25
-    /**
26
-     * @param        $key
27
-     * @param        $ret
28
-     * @param        $prefix_orig
29
-     * @param        $objInsinstr
30
-     * @param string $class
31
-     * @param string $prefix_curr
32
-     */
33
-    public function _makePagesAdminOptions($key, &$ret, $prefix_orig, $objInsinstr, $class = 'odd', $prefix_curr = '')
34
-    {
35
-        if ($key > 0) {
36
-
37
-            //
38
-            $class = ('even' === $class) ? 'odd' : 'even';
39
-            // ID инструкции ( Можно сделать статической )
40
-            $instrid = $objInsinstr->getVar('instrid');
41
-
42
-            // ID страницы
43
-            $pageid = $this->tree[$key]['obj']->getVar('pageid');
44
-            // Название страницы
45
-            $pagetitle = $this->tree[$key]['obj']->getVar('title');
46
-            // Вес
47
-            $pageweight = $this->tree[$key]['obj']->getVar('weight');
48
-            // Статус
49
-            $pagestatus = $this->tree[$key]['obj']->getVar('status');
50
-            // Тип страницы
51
-            $pagetype = $this->tree[$key]['obj']->getVar('type');
52
-
53
-            // Дочернии страницы
54
-            $page_childs = $this->getAllChild($pageid);
55
-            // Число дочерних страниц
56
-            $num_childs = count($page_childs);
57
-
58
-            // Действие - удаление
59
-            $act_del = ($num_childs > 0) ? '<img src="../assets/images/icons/16/application_key.png" alt="' . _AM_INSTR_NODELPAGE . '" title="' . _AM_INSTR_NODELPAGE . '" />' : '<a href="instr.php?op=delpage&pageid='
60
-                                                                                                                                                                      . $pageid
61
-                                                                                                                                                                      . '"><img src="../assets/icons/delete_mini.png" alt="'
62
-                                                                                                                                                                      . _AM_INSTRUCTION_DEL
63
-                                                                                                                                                                      . '" title="'
64
-                                                                                                                                                                      . _AM_INSTRUCTION_DEL
65
-                                                                                                                                                                      . '"></a>';
66
-            //
67
-            $page_link = '<a name="pageid_' . $pageid . '" ' . ($pagetype ? 'href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext"' : '') . '>' . $pagetitle . '</a>';
68
-
69
-            $ret .= '<tr class="' . $class . '">
21
+	//    public function __construct()
22
+	//    {
23
+	//    }
24
+
25
+	/**
26
+	 * @param        $key
27
+	 * @param        $ret
28
+	 * @param        $prefix_orig
29
+	 * @param        $objInsinstr
30
+	 * @param string $class
31
+	 * @param string $prefix_curr
32
+	 */
33
+	public function _makePagesAdminOptions($key, &$ret, $prefix_orig, $objInsinstr, $class = 'odd', $prefix_curr = '')
34
+	{
35
+		if ($key > 0) {
36
+
37
+			//
38
+			$class = ('even' === $class) ? 'odd' : 'even';
39
+			// ID инструкции ( Можно сделать статической )
40
+			$instrid = $objInsinstr->getVar('instrid');
41
+
42
+			// ID страницы
43
+			$pageid = $this->tree[$key]['obj']->getVar('pageid');
44
+			// Название страницы
45
+			$pagetitle = $this->tree[$key]['obj']->getVar('title');
46
+			// Вес
47
+			$pageweight = $this->tree[$key]['obj']->getVar('weight');
48
+			// Статус
49
+			$pagestatus = $this->tree[$key]['obj']->getVar('status');
50
+			// Тип страницы
51
+			$pagetype = $this->tree[$key]['obj']->getVar('type');
52
+
53
+			// Дочернии страницы
54
+			$page_childs = $this->getAllChild($pageid);
55
+			// Число дочерних страниц
56
+			$num_childs = count($page_childs);
57
+
58
+			// Действие - удаление
59
+			$act_del = ($num_childs > 0) ? '<img src="../assets/images/icons/16/application_key.png" alt="' . _AM_INSTR_NODELPAGE . '" title="' . _AM_INSTR_NODELPAGE . '" />' : '<a href="instr.php?op=delpage&pageid='
60
+																																									  . $pageid
61
+																																									  . '"><img src="../assets/icons/delete_mini.png" alt="'
62
+																																									  . _AM_INSTRUCTION_DEL
63
+																																									  . '" title="'
64
+																																									  . _AM_INSTRUCTION_DEL
65
+																																									  . '"></a>';
66
+			//
67
+			$page_link = '<a name="pageid_' . $pageid . '" ' . ($pagetype ? 'href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext"' : '') . '>' . $pagetitle . '</a>';
68
+
69
+			$ret .= '<tr class="' . $class . '">
70 70
       <td>' . $prefix_curr . ' ' . $page_link . '</td>
71 71
       <td align="center" width="50">
72 72
         <input type="text" name="weights[]" size="2" value="' . $pageweight . '" />
73 73
         <input type="hidden" name="pageids[]" value="' . $pageid . '" />
74 74
       </td>
75 75
       <td align="center" width="180">';
76
-            // Просмотре без кэша
77
-            $ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&amp;nocache=1"><img src="../assets/images/icons/16/database_black.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> ';
78
-            // Добавить подстраницу
79
-            $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> ';
80
-
81
-            if ($pagestatus) {
82
-                $ret .= ' <img src="../assets/images/icons/16/lock.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> ';
83
-            } else {
84
-                $ret .= ' <img src="../assets/images/icons/16/lock_open.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> ';
85
-            }
86
-
87
-            $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . '
76
+			// Просмотре без кэша
77
+			$ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&amp;nocache=1"><img src="../assets/images/icons/16/database_black.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> ';
78
+			// Добавить подстраницу
79
+			$ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> ';
80
+
81
+			if ($pagestatus) {
82
+				$ret .= ' <img src="../assets/images/icons/16/lock.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> ';
83
+			} else {
84
+				$ret .= ' <img src="../assets/images/icons/16/lock_open.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> ';
85
+			}
86
+
87
+			$ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . '
88 88
       </td>
89 89
     </tr>';
90 90
 
91
-            // Устанавливаем префикс
92
-            $prefix_curr .= $prefix_orig;
93
-        }
94
-
95
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
96
-            foreach ($this->tree[$key]['child'] as $childkey) {
97
-                $this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr);
98
-            }
99
-        }
100
-    }
101
-
102
-    /**
103
-     * @param        $objInsinstr
104
-     * @param string $prefix
105
-     * @param int    $key
106
-     * @return string
107
-     */
108
-    public function makePagesAdmin(&$objInsinstr, $prefix = '-', $key = 0)
109
-    {
110
-        $ret = '<form name="inspages" action="instr.php" method="post">
91
+			// Устанавливаем префикс
92
+			$prefix_curr .= $prefix_orig;
93
+		}
94
+
95
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
96
+			foreach ($this->tree[$key]['child'] as $childkey) {
97
+				$this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr);
98
+			}
99
+		}
100
+	}
101
+
102
+	/**
103
+	 * @param        $objInsinstr
104
+	 * @param string $prefix
105
+	 * @param int    $key
106
+	 * @return string
107
+	 */
108
+	public function makePagesAdmin(&$objInsinstr, $prefix = '-', $key = 0)
109
+	{
110
+		$ret = '<form name="inspages" action="instr.php" method="post">
111 111
   <table width="100%" cellspacing="1" class="outer">
112 112
     <tr>
113 113
       <th align="center" colspan="3">' . sprintf(_AM_INSTRUCTION_LISTPAGESININSTR, $objInsinstr->getVar('title')) . '</th>
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
       <td class="head" align="center" width="180">' . _AM_INSTRUCTION_ACTION . '</td>
119 119
     </tr>';
120 120
 
121
-        // Выводим все страницы
122
-        $this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr);
121
+		// Выводим все страницы
122
+		$this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr);
123 123
 
124
-        $ret .= '<tr class="foot">
124
+		$ret .= '<tr class="foot">
125 125
       <td><a href="instr.php?op=editpage&instrid=' . $objInsinstr->getVar('instrid') . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDPAGE . '" title="' . _AM_INSTRUCTION_ADDPAGE . '"></a></td>
126 126
       <td colspan="2">
127 127
         <input type="hidden" name="instrid" value="' . $objInsinstr->getVar('instrid') . '" />
@@ -132,61 +132,61 @@  discard block
 block discarded – undo
132 132
   </table>
133 133
 </form>';
134 134
 
135
-        return $ret;
136
-    }
137
-
138
-    // ==================================
139
-    // === Дерево категорий в админке ===
140
-    // ==================================
141
-
142
-    /**
143
-     * @param        $key
144
-     * @param        $ret
145
-     * @param        $prefix_orig
146
-     * @param array  $cidinstrids
147
-     * @param string $class
148
-     * @param string $prefix_curr
149
-     */
150
-    public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '')
151
-    {
152
-        $pathIcon16    = \Xmf\Module\Admin::iconUrl('', 16);
153
-        if ($key > 0) {
154
-
155
-            //
156
-            $class = ('even' === $class) ? 'odd' : 'even';
157
-
158
-            // ID категории
159
-            $catid = $this->tree[$key]['obj']->getVar('cid');
160
-            // Название категории
161
-            $cattitle = $this->tree[$key]['obj']->getVar('title');
162
-            // Вес
163
-            $catweight = $this->tree[$key]['obj']->getVar('weight');
164
-            // Статус
165
-            $pagestatus = $this->tree[$key]['obj']->getVar('status');
166
-
167
-            // Дочернии категории
168
-            $cat_childs = $this->getAllChild($catid);
169
-            // Число дочерних категорий
170
-            $num_childs = count($cat_childs);
171
-            // Число инструкций
172
-            $num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0;
173
-
174
-            // Действие - удаление
175
-            $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="'. $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid='
176
-                                                                                                                                                                                           . $catid
177
-                                                                                                                                                                                           . '"><img src="'. $pathIcon16 . '/delete.png" alt="'
178
-                                                                                                                                                                                           . _AM_INSTRUCTION_DEL
179
-                                                                                                                                                                                           . '" title="'
180
-                                                                                                                                                                                           . _AM_INSTRUCTION_DEL
181
-                                                                                                                                                                                           . '" /></a>';
182
-            // Действие - просмотр
183
-            $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="'. $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="'
184
-                                                                                                                                                                                                             . _AM_INSTR_NOVIEWINSTR
185
-                                                                                                                                                                                                             . '" title="'
186
-                                                                                                                                                                                                             . _AM_INSTR_NOVIEWINSTR
187
-                                                                                                                                                                                                             . '" />';
188
-
189
-            $ret .= '<tr class="' . $class . '">
135
+		return $ret;
136
+	}
137
+
138
+	// ==================================
139
+	// === Дерево категорий в админке ===
140
+	// ==================================
141
+
142
+	/**
143
+	 * @param        $key
144
+	 * @param        $ret
145
+	 * @param        $prefix_orig
146
+	 * @param array  $cidinstrids
147
+	 * @param string $class
148
+	 * @param string $prefix_curr
149
+	 */
150
+	public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '')
151
+	{
152
+		$pathIcon16    = \Xmf\Module\Admin::iconUrl('', 16);
153
+		if ($key > 0) {
154
+
155
+			//
156
+			$class = ('even' === $class) ? 'odd' : 'even';
157
+
158
+			// ID категории
159
+			$catid = $this->tree[$key]['obj']->getVar('cid');
160
+			// Название категории
161
+			$cattitle = $this->tree[$key]['obj']->getVar('title');
162
+			// Вес
163
+			$catweight = $this->tree[$key]['obj']->getVar('weight');
164
+			// Статус
165
+			$pagestatus = $this->tree[$key]['obj']->getVar('status');
166
+
167
+			// Дочернии категории
168
+			$cat_childs = $this->getAllChild($catid);
169
+			// Число дочерних категорий
170
+			$num_childs = count($cat_childs);
171
+			// Число инструкций
172
+			$num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0;
173
+
174
+			// Действие - удаление
175
+			$act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="'. $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid='
176
+																																														   . $catid
177
+																																														   . '"><img src="'. $pathIcon16 . '/delete.png" alt="'
178
+																																														   . _AM_INSTRUCTION_DEL
179
+																																														   . '" title="'
180
+																																														   . _AM_INSTRUCTION_DEL
181
+																																														   . '" /></a>';
182
+			// Действие - просмотр
183
+			$act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="'. $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="'
184
+																																																			 . _AM_INSTR_NOVIEWINSTR
185
+																																																			 . '" title="'
186
+																																																			 . _AM_INSTR_NOVIEWINSTR
187
+																																																			 . '" />';
188
+
189
+			$ret .= '<tr class="' . $class . '">
190 190
       <td>' . $prefix_curr . ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/index.php?cid=' . $catid . '">' . $cattitle . '</a></td>
191 191
       <td align="center" width="50">' . $catweight . '</td>
192 192
       <td align="center" width="100">' . $num_instrs . '</td>
@@ -197,26 +197,26 @@  discard block
 block discarded – undo
197 197
       </td>
198 198
     </tr>';
199 199
 
200
-            // Устанавливаем префикс
201
-            $prefix_curr .= $prefix_orig;
202
-        }
203
-
204
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
205
-            foreach ($this->tree[$key]['child'] as $childkey) {
206
-                $this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr);
207
-            }
208
-        }
209
-    }
210
-
211
-    /**
212
-     * @param string $prefix
213
-     * @param array  $cidinstrids
214
-     * @param int    $key
215
-     * @return string
216
-     */
217
-    public function makeCatsAdmin($prefix = '-', $cidinstrids = [], $key = 0)
218
-    {
219
-        $ret = '<table width="100%" cellspacing="1" class="outer">
200
+			// Устанавливаем префикс
201
+			$prefix_curr .= $prefix_orig;
202
+		}
203
+
204
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
205
+			foreach ($this->tree[$key]['child'] as $childkey) {
206
+				$this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr);
207
+			}
208
+		}
209
+	}
210
+
211
+	/**
212
+	 * @param string $prefix
213
+	 * @param array  $cidinstrids
214
+	 * @param int    $key
215
+	 * @return string
216
+	 */
217
+	public function makeCatsAdmin($prefix = '-', $cidinstrids = [], $key = 0)
218
+	{
219
+		$ret = '<table width="100%" cellspacing="1" class="outer">
220 220
     <tr>
221 221
       <th align="center" colspan="4">' . _AM_INSTR_LISTALLCATS . '</th>
222 222
     </tr>
@@ -227,216 +227,216 @@  discard block
 block discarded – undo
227 227
       <td class="head" align="center" width="150">' . _AM_INSTRUCTION_ACTION . '</td>
228 228
     </tr>';
229 229
 
230
-        // Выводим все страницы
231
-        $this->_makeCatsAdminOptions($key, $ret, $prefix, $cidinstrids);
232
-
233
-        $ret .= '</table>';
234
-
235
-        return $ret;
236
-    }
237
-
238
-    // ======================================
239
-    // Список страниц на стороне пользователя
240
-    // ======================================
241
-
242
-    /**
243
-     * @param       $key
244
-     * @param       $ret
245
-     * @param int   $currpageid
246
-     * @param array $lastpageids
247
-     * @param int   $level
248
-     */
249
-    public function _makePagesUserTree($key, &$ret, $currpageid = 0, &$lastpageids = [], $level = 0)
250
-    {
251
-
252
-        // Сохраняем значение предыдущей страницы
253
-        //static $stat_prevpages;
254
-
255
-        if ($key > 0) {
256
-
257
-            // ID страницы
258
-            $pageid = $this->tree[$key]['obj']->getVar('pageid');
259
-            // Название страницы
260
-            $pagetitle = $this->tree[$key]['obj']->getVar('title');
261
-            // Тип страницы
262
-            $pagetype = $this->tree[$key]['obj']->getVar('type');
263
-
264
-            // Дочернии категории
265
-            $page_childs = $this->getAllChild($pageid);
266
-            // Число дочерних страниц
267
-            $num_childs = count($page_childs);
268
-
269
-            // Генерируем класс
270
-            // InstrTreeNode InstrTreeIsRoot InstrTreeExpandClosed InstrTreeIsLast
271
-            $class = [];
272
-            // Данный класс должен быть у любого узла
273
-            $class[] = 'InstrTreeNode';
274
-            // Если узел нулевого уровня, добавляем InstrTreeIsRoot
275
-            if (0 === $level) {
276
-                $class[] = 'InstrTreeIsRoot';
277
-            }
278
-            // Тип узла InstrTreeExpandClosed|InstrTreeExpandLeaf
279
-            // Если у узла нет потомков - InstrTreeExpandLeaf
280
-            if (0 == $num_childs) {
281
-                $class[] = 'InstrTreeExpandLeaf';
282
-                // Если у искомого элемента есть потомки - открываем список
283
-            } elseif ($currpageid == $pageid) {
284
-                $class[] = 'InstrTreeExpandOpen';
285
-                // Если искомый элемент есть в потомках текущего, то ставим класс InstrTreeExpandOpen
286
-            } elseif (array_key_exists($currpageid, $page_childs)) {
287
-                $class[] = 'InstrTreeExpandOpen';
288
-                //
289
-            } else {
290
-                $class[] = 'InstrTreeExpandClosed';
291
-            }
292
-
293
-            // Данный класс нужно добавлять последнему узлу в каждом уровне
294
-
295
-            if (isset($lastpageids[$level]) && ($pageid == $lastpageids[$level])) {
296
-                $class[] = 'InstrTreeIsLast';
297
-            }
298
-
299
-            //$class[] = 'InstrTreeIsLast';
300
-
301
-            // Test
302
-            //$ret .= '<div id="' . $pageid . '">';
303
-
304
-            // Создаём запись
305
-            $ret .= '<li class="' . implode(' ', $class) . '">';
306
-            //
307
-            $ret .= '<div class="InstrTreeExpand"></div>';
308
-            //
309
-            $ret .= '<div class="InstrTreeContent">';
310
-
311
-            // Если это лист дерева
312
-            if (0 == $pagetype) {
313
-                $ret .= '<span class="InstrTreeEmptyPage">' . $pagetitle . '</span>';
314
-                //
315
-            } elseif ($currpageid == $pageid) {
316
-                $ret .= $pagetitle;
317
-                //
318
-            } else {
319
-                $ret .= '<a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext">' . $pagetitle . '</a>';
320
-            }
321
-
322
-            $ret .= '</div>';
323
-
324
-            // Если есть потомки
325
-            if ($num_childs > 0) {
326
-                $ret .= '<ul class="InstrTreeContainer">';
327
-            }
328
-
329
-            // Инкримент уровня
330
-            $level++;
331
-        }
332
-
333
-        // Рекурсия
334
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
335
-            foreach ($this->tree[$key]['child'] as $childkey) {
336
-                $this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level);
337
-            }
338
-        }
339
-
340
-        // Test
341
-        if ($key > 0) {
342
-            // Если есть потомки
343
-            if ($num_childs > 0) {
344
-                $ret .= '</ul>';
345
-            }
346
-            // Конец текущей записи
347
-            $ret .= '</li>';
348
-        }
349
-    }
350
-
351
-    // Находим предыдущую и следующую страницы.
352
-    // Находим последнии страницы на каждом уровне.
353
-    /**
354
-     * @param       $key
355
-     * @param int   $currpageid
356
-     * @param array $prevpages
357
-     * @param array $nextpages
358
-     * @param array $lastpageids
359
-     * @param int   $level
360
-     */
361
-    public function _makePagesUserCalc($key, $currpageid = 0, &$prevpages = [], &$nextpages = [], &$lastpageids = [], $level = 0)
362
-    {
363
-
364
-        // Сохраняем значение предыдущей страницы
365
-        static $stat_prevpages;
366
-
367
-        if ($key > 0) {
368
-            // ID страницы
369
-            $pageid = $this->tree[$key]['obj']->getVar('pageid');
370
-            // Название страницы
371
-            $pagetitle = $this->tree[$key]['obj']->getVar('title');
372
-            // Тип страницы
373
-            $pagetype = $this->tree[$key]['obj']->getVar('type');
374
-
375
-            // Если мы передали ID текущей страницы, то находить предыдудую и следующую страницы
376
-            // Не находить предыдущие и следующие для "Пустой страницы"
377
-            if ($currpageid && $pagetype) {
378
-                // Если элемент равен текущей странице
379
-                if (null !== $stat_prevpages && ($currpageid == $pageid)) {
380
-                    // Забиваем массив предыдущей страницы
381
-                    $prevpages['pageid'] = $stat_prevpages['pageid'];
382
-                    $prevpages['title']  = $stat_prevpages['title'];
383
-
384
-                    // Если предыдущий равен текущей странице
385
-                } elseif (null !== $stat_prevpages && ($currpageid == $stat_prevpages['pageid'])) {
386
-                    // Забиваем массив следующей страницы
387
-                    $nextpages['pageid'] = $pageid;
388
-                    $nextpages['title']  = $pagetitle;
389
-                }
390
-                // Заносим текущие данные в массив предыдущей страницы
391
-                $stat_prevpages['pageid'] = $pageid;
392
-                $stat_prevpages['title']  = $pagetitle;
393
-            }
394
-
395
-            // Заносим текущую страницу в массив "последних страний"
396
-            $lastpageids[$level] = $pageid;
397
-
398
-            // Инкримент уровня
399
-            $level++;
400
-        }
401
-
402
-        // Рекурсия
403
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
404
-            foreach ($this->tree[$key]['child'] as $childkey) {
405
-                $this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level);
406
-            }
407
-        }
408
-    }
409
-
410
-    //
411
-
412
-    /**
413
-     * @param int   $currpageid
414
-     * @param array $prevpages
415
-     * @param array $nextpages
416
-     * @param int   $key
417
-     * @return string
418
-     */
419
-    public function makePagesUser($currpageid = 0, &$prevpages = [], &$nextpages = [], $key = 0)
420
-    {
421
-
422
-        // Массив последней страницы на каждом уровне
423
-        // level => pageid
424
-        $lastpageids = [];
425
-
426
-        // Расчёт
427
-        $this->_makePagesUserCalc($key, $currpageid, $prevpages, $nextpages, $lastpageids);
428
-
429
-        $ret = '<div onclick="instr_tree_toggle(arguments[0])">
230
+		// Выводим все страницы
231
+		$this->_makeCatsAdminOptions($key, $ret, $prefix, $cidinstrids);
232
+
233
+		$ret .= '</table>';
234
+
235
+		return $ret;
236
+	}
237
+
238
+	// ======================================
239
+	// Список страниц на стороне пользователя
240
+	// ======================================
241
+
242
+	/**
243
+	 * @param       $key
244
+	 * @param       $ret
245
+	 * @param int   $currpageid
246
+	 * @param array $lastpageids
247
+	 * @param int   $level
248
+	 */
249
+	public function _makePagesUserTree($key, &$ret, $currpageid = 0, &$lastpageids = [], $level = 0)
250
+	{
251
+
252
+		// Сохраняем значение предыдущей страницы
253
+		//static $stat_prevpages;
254
+
255
+		if ($key > 0) {
256
+
257
+			// ID страницы
258
+			$pageid = $this->tree[$key]['obj']->getVar('pageid');
259
+			// Название страницы
260
+			$pagetitle = $this->tree[$key]['obj']->getVar('title');
261
+			// Тип страницы
262
+			$pagetype = $this->tree[$key]['obj']->getVar('type');
263
+
264
+			// Дочернии категории
265
+			$page_childs = $this->getAllChild($pageid);
266
+			// Число дочерних страниц
267
+			$num_childs = count($page_childs);
268
+
269
+			// Генерируем класс
270
+			// InstrTreeNode InstrTreeIsRoot InstrTreeExpandClosed InstrTreeIsLast
271
+			$class = [];
272
+			// Данный класс должен быть у любого узла
273
+			$class[] = 'InstrTreeNode';
274
+			// Если узел нулевого уровня, добавляем InstrTreeIsRoot
275
+			if (0 === $level) {
276
+				$class[] = 'InstrTreeIsRoot';
277
+			}
278
+			// Тип узла InstrTreeExpandClosed|InstrTreeExpandLeaf
279
+			// Если у узла нет потомков - InstrTreeExpandLeaf
280
+			if (0 == $num_childs) {
281
+				$class[] = 'InstrTreeExpandLeaf';
282
+				// Если у искомого элемента есть потомки - открываем список
283
+			} elseif ($currpageid == $pageid) {
284
+				$class[] = 'InstrTreeExpandOpen';
285
+				// Если искомый элемент есть в потомках текущего, то ставим класс InstrTreeExpandOpen
286
+			} elseif (array_key_exists($currpageid, $page_childs)) {
287
+				$class[] = 'InstrTreeExpandOpen';
288
+				//
289
+			} else {
290
+				$class[] = 'InstrTreeExpandClosed';
291
+			}
292
+
293
+			// Данный класс нужно добавлять последнему узлу в каждом уровне
294
+
295
+			if (isset($lastpageids[$level]) && ($pageid == $lastpageids[$level])) {
296
+				$class[] = 'InstrTreeIsLast';
297
+			}
298
+
299
+			//$class[] = 'InstrTreeIsLast';
300
+
301
+			// Test
302
+			//$ret .= '<div id="' . $pageid . '">';
303
+
304
+			// Создаём запись
305
+			$ret .= '<li class="' . implode(' ', $class) . '">';
306
+			//
307
+			$ret .= '<div class="InstrTreeExpand"></div>';
308
+			//
309
+			$ret .= '<div class="InstrTreeContent">';
310
+
311
+			// Если это лист дерева
312
+			if (0 == $pagetype) {
313
+				$ret .= '<span class="InstrTreeEmptyPage">' . $pagetitle . '</span>';
314
+				//
315
+			} elseif ($currpageid == $pageid) {
316
+				$ret .= $pagetitle;
317
+				//
318
+			} else {
319
+				$ret .= '<a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext">' . $pagetitle . '</a>';
320
+			}
321
+
322
+			$ret .= '</div>';
323
+
324
+			// Если есть потомки
325
+			if ($num_childs > 0) {
326
+				$ret .= '<ul class="InstrTreeContainer">';
327
+			}
328
+
329
+			// Инкримент уровня
330
+			$level++;
331
+		}
332
+
333
+		// Рекурсия
334
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
335
+			foreach ($this->tree[$key]['child'] as $childkey) {
336
+				$this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level);
337
+			}
338
+		}
339
+
340
+		// Test
341
+		if ($key > 0) {
342
+			// Если есть потомки
343
+			if ($num_childs > 0) {
344
+				$ret .= '</ul>';
345
+			}
346
+			// Конец текущей записи
347
+			$ret .= '</li>';
348
+		}
349
+	}
350
+
351
+	// Находим предыдущую и следующую страницы.
352
+	// Находим последнии страницы на каждом уровне.
353
+	/**
354
+	 * @param       $key
355
+	 * @param int   $currpageid
356
+	 * @param array $prevpages
357
+	 * @param array $nextpages
358
+	 * @param array $lastpageids
359
+	 * @param int   $level
360
+	 */
361
+	public function _makePagesUserCalc($key, $currpageid = 0, &$prevpages = [], &$nextpages = [], &$lastpageids = [], $level = 0)
362
+	{
363
+
364
+		// Сохраняем значение предыдущей страницы
365
+		static $stat_prevpages;
366
+
367
+		if ($key > 0) {
368
+			// ID страницы
369
+			$pageid = $this->tree[$key]['obj']->getVar('pageid');
370
+			// Название страницы
371
+			$pagetitle = $this->tree[$key]['obj']->getVar('title');
372
+			// Тип страницы
373
+			$pagetype = $this->tree[$key]['obj']->getVar('type');
374
+
375
+			// Если мы передали ID текущей страницы, то находить предыдудую и следующую страницы
376
+			// Не находить предыдущие и следующие для "Пустой страницы"
377
+			if ($currpageid && $pagetype) {
378
+				// Если элемент равен текущей странице
379
+				if (null !== $stat_prevpages && ($currpageid == $pageid)) {
380
+					// Забиваем массив предыдущей страницы
381
+					$prevpages['pageid'] = $stat_prevpages['pageid'];
382
+					$prevpages['title']  = $stat_prevpages['title'];
383
+
384
+					// Если предыдущий равен текущей странице
385
+				} elseif (null !== $stat_prevpages && ($currpageid == $stat_prevpages['pageid'])) {
386
+					// Забиваем массив следующей страницы
387
+					$nextpages['pageid'] = $pageid;
388
+					$nextpages['title']  = $pagetitle;
389
+				}
390
+				// Заносим текущие данные в массив предыдущей страницы
391
+				$stat_prevpages['pageid'] = $pageid;
392
+				$stat_prevpages['title']  = $pagetitle;
393
+			}
394
+
395
+			// Заносим текущую страницу в массив "последних страний"
396
+			$lastpageids[$level] = $pageid;
397
+
398
+			// Инкримент уровня
399
+			$level++;
400
+		}
401
+
402
+		// Рекурсия
403
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
404
+			foreach ($this->tree[$key]['child'] as $childkey) {
405
+				$this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level);
406
+			}
407
+		}
408
+	}
409
+
410
+	//
411
+
412
+	/**
413
+	 * @param int   $currpageid
414
+	 * @param array $prevpages
415
+	 * @param array $nextpages
416
+	 * @param int   $key
417
+	 * @return string
418
+	 */
419
+	public function makePagesUser($currpageid = 0, &$prevpages = [], &$nextpages = [], $key = 0)
420
+	{
421
+
422
+		// Массив последней страницы на каждом уровне
423
+		// level => pageid
424
+		$lastpageids = [];
425
+
426
+		// Расчёт
427
+		$this->_makePagesUserCalc($key, $currpageid, $prevpages, $nextpages, $lastpageids);
428
+
429
+		$ret = '<div onclick="instr_tree_toggle(arguments[0])">
430 430
 <div>' . _MD_INSTRUCTION_LISTPAGES . '</div>
431 431
 <div><ul class="InstrTreeContainer">';
432 432
 
433
-        // Генерируем дерево
434
-        $this->_makePagesUserTree($key, $ret, $currpageid, $lastpageids);
433
+		// Генерируем дерево
434
+		$this->_makePagesUserTree($key, $ret, $currpageid, $lastpageids);
435 435
 
436
-        $ret .= '</ul>
436
+		$ret .= '</ul>
437 437
 </div>
438 438
 </div>';
439 439
 
440
-        return $ret;
441
-    }
440
+		return $ret;
441
+	}
442 442
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             // Просмотре без кэша
77 77
             $ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&amp;nocache=1"><img src="../assets/images/icons/16/database_black.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> ';
78 78
             // Добавить подстраницу
79
-            $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> ';
79
+            $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="' . $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> ';
80 80
 
81 81
             if ($pagestatus) {
82 82
                 $ret .= ' <img src="../assets/images/icons/16/lock.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> ';
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 $ret .= ' <img src="../assets/images/icons/16/lock_open.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> ';
85 85
             }
86 86
 
87
-            $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . '
87
+            $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="' . $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . '
88 88
       </td>
89 89
     </tr>';
90 90
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $prefix_curr .= $prefix_orig;
93 93
         }
94 94
 
95
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
95
+        if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) {
96 96
             foreach ($this->tree[$key]['child'] as $childkey) {
97 97
                 $this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr);
98 98
             }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr);
123 123
 
124 124
         $ret .= '<tr class="foot">
125
-      <td><a href="instr.php?op=editpage&instrid=' . $objInsinstr->getVar('instrid') . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDPAGE . '" title="' . _AM_INSTRUCTION_ADDPAGE . '"></a></td>
125
+      <td><a href="instr.php?op=editpage&instrid=' . $objInsinstr->getVar('instrid') . '"><img src="' . $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDPAGE . '" title="' . _AM_INSTRUCTION_ADDPAGE . '"></a></td>
126 126
       <td colspan="2">
127 127
         <input type="hidden" name="instrid" value="' . $objInsinstr->getVar('instrid') . '" />
128 128
         <input type="hidden" name="op" value="updpage" />
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      */
150 150
     public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '')
151 151
     {
152
-        $pathIcon16    = \Xmf\Module\Admin::iconUrl('', 16);
152
+        $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
153 153
         if ($key > 0) {
154 154
 
155 155
             //
@@ -172,15 +172,15 @@  discard block
 block discarded – undo
172 172
             $num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0;
173 173
 
174 174
             // Действие - удаление
175
-            $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="'. $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid='
175
+            $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="' . $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid='
176 176
                                                                                                                                                                                            . $catid
177
-                                                                                                                                                                                           . '"><img src="'. $pathIcon16 . '/delete.png" alt="'
177
+                                                                                                                                                                                           . '"><img src="' . $pathIcon16 . '/delete.png" alt="'
178 178
                                                                                                                                                                                            . _AM_INSTRUCTION_DEL
179 179
                                                                                                                                                                                            . '" title="'
180 180
                                                                                                                                                                                            . _AM_INSTRUCTION_DEL
181 181
                                                                                                                                                                                            . '" /></a>';
182 182
             // Действие - просмотр
183
-            $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="'. $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="'
183
+            $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="' . $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="'
184 184
                                                                                                                                                                                                              . _AM_INSTR_NOVIEWINSTR
185 185
                                                                                                                                                                                                              . '" title="'
186 186
                                                                                                                                                                                                              . _AM_INSTR_NOVIEWINSTR
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
       <td align="center" width="100">' . $num_instrs . '</td>
193 193
       <td align="center" width="150">
194 194
         ' . $act_view . '
195
-        <a href="cat.php?op=editcat&cid=' . $catid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a>
195
+        <a href="cat.php?op=editcat&cid=' . $catid . '"><img src="' . $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a>
196 196
         ' . $act_del . '
197 197
       </td>
198 198
     </tr>';
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $prefix_curr .= $prefix_orig;
202 202
         }
203 203
 
204
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
204
+        if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) {
205 205
             foreach ($this->tree[$key]['child'] as $childkey) {
206 206
                 $this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr);
207 207
             }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         }
332 332
 
333 333
         // Рекурсия
334
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
334
+        if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) {
335 335
             foreach ($this->tree[$key]['child'] as $childkey) {
336 336
                 $this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level);
337 337
             }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
         }
401 401
 
402 402
         // Рекурсия
403
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
403
+        if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) {
404 404
             foreach ($this->tree[$key]['child'] as $childkey) {
405 405
                 $this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level);
406 406
             }
Please login to merge, or discard this patch.
page.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 $criteria->add(new \Criteria('pageid ', $pageid));
30 30
 $criteria->add(new \Criteria('status ', '0', '>'));
31 31
 if (0 == $pageHandler->getCount($criteria)) {
32
-    redirect_header('index.php', 3, _MD_INSTRUCTION_PAGENOTEXIST);
33
-    exit();
32
+	redirect_header('index.php', 3, _MD_INSTRUCTION_PAGENOTEXIST);
33
+	exit();
34 34
 }
35 35
 //
36 36
 unset($criteria);
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 // Если админ и ссылка на отключение кэша
44 44
 if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isAdmin() && $nocache) {
45
-    // Отключаем кэш
46
-    $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
45
+	// Отключаем кэш
46
+	$GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
47 47
 }
48 48
 
49 49
 // Задание тайтла
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 // Права на просмотр инструкции
61 61
 $categories = Xoopsmodules\instruction\Utility::getItemIds();
62 62
 if (!in_array($objInsinstr->getVar('cid'), $categories)) {
63
-    redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
64
-    exit();
63
+	redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
64
+	exit();
65 65
 }
66 66
 
67 67
 // Массив данных о странице
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 $footnote = $objInspage->getVar('footnote');
79 79
 // Если есть сноски
80 80
 if ($footnote) {
81
-    $pages['footnotes'] = explode('|', $objInspage->getVar('footnote'));
81
+	$pages['footnotes'] = explode('|', $objInspage->getVar('footnote'));
82 82
 } else {
83
-    $pages['footnotes'] = false;
83
+	$pages['footnotes'] = false;
84 84
 }
85 85
 // Мета-теги ключевых слов
86 86
 $pages['keywords'] = $objInspage->getVar('keywords');
@@ -89,39 +89,39 @@  discard block
 block discarded – undo
89 89
 //
90 90
 // Если админ, рисуем админлинк
91 91
 if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) {
92
-    $pages['adminlink'] = '&nbsp;<a href="'
93
-                          . XOOPS_URL
94
-                          . '/modules/'
95
-                          . $moduleDirName
96
-                          . '/admin/instr.php?op=editpage&pageid='
97
-                          . $pages['pageid']
98
-                          . '"><img style="width:16px;" src="'. $pathModIcon16 . '/assets/images/icons/16/edit.png" alt='
99
-                          . _EDIT
100
-                          . ' title='
101
-                          . _EDIT
102
-                          . '></a>&nbsp;<a href="'
103
-                          . XOOPS_URL
104
-                          . '/modules/'
105
-                          . $moduleDirName
106
-                          . '/admin/instr.php?op=delpage&pageid='
107
-                          . $pages['pageid']
108
-                          . '"><img style="width:16px;" src="./assets/icons/delete_mini.png" alt='
109
-                          . _DELETE
110
-                          . ' title='
111
-                          . _DELETE
112
-                          . '></a>&nbsp;';
92
+	$pages['adminlink'] = '&nbsp;<a href="'
93
+						  . XOOPS_URL
94
+						  . '/modules/'
95
+						  . $moduleDirName
96
+						  . '/admin/instr.php?op=editpage&pageid='
97
+						  . $pages['pageid']
98
+						  . '"><img style="width:16px;" src="'. $pathModIcon16 . '/assets/images/icons/16/edit.png" alt='
99
+						  . _EDIT
100
+						  . ' title='
101
+						  . _EDIT
102
+						  . '></a>&nbsp;<a href="'
103
+						  . XOOPS_URL
104
+						  . '/modules/'
105
+						  . $moduleDirName
106
+						  . '/admin/instr.php?op=delpage&pageid='
107
+						  . $pages['pageid']
108
+						  . '"><img style="width:16px;" src="./assets/icons/delete_mini.png" alt='
109
+						  . _DELETE
110
+						  . ' title='
111
+						  . _DELETE
112
+						  . '></a>&nbsp;';
113 113
 } else {
114
-    $pages['adminlink'] = '&nbsp;';
115
-    // Если можно редактировать
116
-    if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) {
117
-        $pages['adminlink'] .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/submit.php?op=editpage&pageid=' . $pages['pageid'] . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt=' . _EDIT . ' title=' . _EDIT . '></a>';
118
-    }
119
-
120
-    $pages['adminlink'] .= '&nbsp;';
121
-    // Если нет админлика
122
-    if ('[&nbsp;&nbsp;]' === $pages['adminlink']) {
123
-        $pages['adminlink'] = '';
124
-    }
114
+	$pages['adminlink'] = '&nbsp;';
115
+	// Если можно редактировать
116
+	if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) {
117
+		$pages['adminlink'] .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/submit.php?op=editpage&pageid=' . $pages['pageid'] . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt=' . _EDIT . ' title=' . _EDIT . '></a>';
118
+	}
119
+
120
+	$pages['adminlink'] .= '&nbsp;';
121
+	// Если нет админлика
122
+	if ('[&nbsp;&nbsp;]' === $pages['adminlink']) {
123
+		$pages['adminlink'] = '';
124
+	}
125 125
 }
126 126
 // Выводим в шаблон
127 127
 $GLOBALS['xoopsTpl']->assign('insPage', $pages);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 $nav_parent_id = array_reverse($nav_parent_id);
141 141
 $navigation    = '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/">' . $GLOBALS['xoopsModule']->name() . '</a>&nbsp;:&nbsp;';
142 142
 foreach (array_keys($nav_parent_id) as $i) {
143
-    $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a>&nbsp;:&nbsp;';
143
+	$navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a>&nbsp;:&nbsp;';
144 144
 }
145 145
 $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $objInscat->getVar('cid') . '">' . $objInscat->getVar('title') . '</a>&nbsp;:&nbsp;';
146 146
 $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/instr.php?id=' . $pages['instrid'] . '">' . $objInsinstr->getVar('title') . '</a>';
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 
173 173
 // Рейтинг
174 174
 if (xoops_getModuleOption('userat', 'instruction')) {
175
-    $xoopsTpl->assign('insUserat', true);
175
+	$xoopsTpl->assign('insUserat', true);
176 176
 } else {
177
-    $xoopsTpl->assign('insUserat', false);
177
+	$xoopsTpl->assign('insUserat', false);
178 178
 }
179 179
 
180 180
 // Мета теги
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 // Права на просмотр инструкции
61 61
 $categories = Xoopsmodules\instruction\Utility::getItemIds();
62
-if (!in_array($objInsinstr->getVar('cid'), $categories)) {
62
+if ( ! in_array($objInsinstr->getVar('cid'), $categories)) {
63 63
     redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
64 64
     exit();
65 65
 }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                           . $moduleDirName
96 96
                           . '/admin/instr.php?op=editpage&pageid='
97 97
                           . $pages['pageid']
98
-                          . '"><img style="width:16px;" src="'. $pathModIcon16 . '/assets/images/icons/16/edit.png" alt='
98
+                          . '"><img style="width:16px;" src="' . $pathModIcon16 . '/assets/images/icons/16/edit.png" alt='
99 99
                           . _EDIT
100 100
                           . ' title='
101 101
                           . _EDIT
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     $pages['adminlink'] = '&nbsp;';
115 115
     // Если можно редактировать
116 116
     if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) {
117
-        $pages['adminlink'] .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/submit.php?op=editpage&pageid=' . $pages['pageid'] . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt=' . _EDIT . ' title=' . _EDIT . '></a>';
117
+        $pages['adminlink'] .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/submit.php?op=editpage&pageid=' . $pages['pageid'] . '"><img style="width:16px;" src="' . $pathIcon16 . '/edit.png" alt=' . _EDIT . ' title=' . _EDIT . '></a>';
118 118
     }
119 119
 
120 120
     $pages['adminlink'] .= '&nbsp;';
Please login to merge, or discard this patch.
admin/admin_header.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
 
13 13
 //if (($GLOBALS['xoopsUser'] instanceof \XoopsUser)) {
14 14
 if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) {
15
-    if (!$helper->isUserAdmin()) {
16
-        $helper->redirect(XOOPS_URL . '/', 3, _NOPERM);
17
-    }
15
+	if (!$helper->isUserAdmin()) {
16
+		$helper->redirect(XOOPS_URL . '/', 3, _NOPERM);
17
+	}
18 18
 } else {
19
-    $helper->redirect(XOOPS_URL . '/user.php', 1, _NOPERM);
19
+	$helper->redirect(XOOPS_URL . '/user.php', 1, _NOPERM);
20 20
 }
21 21
 
22 22
 /** @var Xmf\Module\Admin $adminObject */
23 23
 $adminObject = \Xmf\Module\Admin::getInstance();
24 24
 
25 25
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
26
-    require_once $GLOBALS['xoops']->path('class/template.php');
27
-    $xoopsTpl = new \XoopsTpl();
26
+	require_once $GLOBALS['xoops']->path('class/template.php');
27
+	$xoopsTpl = new \XoopsTpl();
28 28
 }
29 29
 
30 30
 $pathIcon16    = \Xmf\Module\Admin::iconUrl('', 16);
Please login to merge, or discard this patch.
instr.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 $criteria->add(new \Criteria('instrid', $instrid));
20 20
 $criteria->add(new \Criteria('status ', '0', '>'));
21 21
 if (0 == $instructionHandler->getCount($criteria)) {
22
-    redirect_header('index.php', 3, _MD_INSTRUCTION_INSTRNOTEXIST);
23
-    exit();
22
+	redirect_header('index.php', 3, _MD_INSTRUCTION_INSTRNOTEXIST);
23
+	exit();
24 24
 }
25 25
 //
26 26
 unset($criteria);
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 // Права на просмотр инструкции
43 43
 $categories = Xoopsmodules\instruction\Utility::getItemIds();
44 44
 if (!in_array($objInsinstr->getVar('cid'), $categories)) {
45
-    redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
46
-    exit();
45
+	redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
46
+	exit();
47 47
 }
48 48
 
49 49
 // Массив данных об инструкции
@@ -56,29 +56,29 @@  discard block
 block discarded – undo
56 56
 $instrs['description'] = $objInsinstr->getVar('description');
57 57
 // Если админ, рисуем админлинк
58 58
 if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) {
59
-    $instrs['adminlink'] = '&nbsp;<a href="'
60
-                           . XOOPS_URL
61
-                           . '/modules/'
62
-                           . $moduleDirName
63
-                           . '/admin/instr.php?op=editinstr&instrid='
64
-                           . $instrid
65
-                           . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt='
66
-                           . _EDIT
67
-                           . ' title='
68
-                           . _EDIT
69
-                           . '></a>&nbsp;<a href="'
70
-                           . XOOPS_URL
71
-                           . '/modules/'
72
-                           . $moduleDirName
73
-                           . '/admin/instr.php?op=delinstr&instrid='
74
-                           . $instrid
75
-                           . '"><img style="width:16px;" src="'. $pathIcon16 . '/delete.png" alt='
76
-                           . _DELETE
77
-                           . ' title='
78
-                           . _DELETE
79
-                           . '></a>&nbsp;';
59
+	$instrs['adminlink'] = '&nbsp;<a href="'
60
+						   . XOOPS_URL
61
+						   . '/modules/'
62
+						   . $moduleDirName
63
+						   . '/admin/instr.php?op=editinstr&instrid='
64
+						   . $instrid
65
+						   . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt='
66
+						   . _EDIT
67
+						   . ' title='
68
+						   . _EDIT
69
+						   . '></a>&nbsp;<a href="'
70
+						   . XOOPS_URL
71
+						   . '/modules/'
72
+						   . $moduleDirName
73
+						   . '/admin/instr.php?op=delinstr&instrid='
74
+						   . $instrid
75
+						   . '"><img style="width:16px;" src="'. $pathIcon16 . '/delete.png" alt='
76
+						   . _DELETE
77
+						   . ' title='
78
+						   . _DELETE
79
+						   . '></a>&nbsp;';
80 80
 } else {
81
-    $instrs['adminlink'] = '';
81
+	$instrs['adminlink'] = '';
82 82
 }
83 83
 
84 84
 // Выводим в шаблон
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 $nav_parent_id = array_reverse($nav_parent_id);
103 103
 $navigation    = '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/">' . $GLOBALS['xoopsModule']->name() . '</a>&nbsp;:&nbsp;';
104 104
 foreach (array_keys($nav_parent_id) as $i) {
105
-    $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a>&nbsp;:&nbsp;';
105
+	$navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a>&nbsp;:&nbsp;';
106 106
 }
107 107
 $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $objInscat->getVar('cid') . '">' . $objInscat->getVar('title') . '</a>&nbsp;:&nbsp;';
108 108
 $navigation .= $objInsinstr->getVar('title');
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
 
130 130
 // Теги
131 131
 if (xoops_getModuleOption('usetag', 'instruction')) {
132
-    include_once $GLOBALS['xoops']->path('modules/tag/include/tagbar.php');
133
-    $xoopsTpl->assign('tags', true);
134
-    $xoopsTpl->assign('tagbar', tagBar($instrid, 0));
132
+	include_once $GLOBALS['xoops']->path('modules/tag/include/tagbar.php');
133
+	$xoopsTpl->assign('tags', true);
134
+	$xoopsTpl->assign('tagbar', tagBar($instrid, 0));
135 135
 } else {
136
-    $xoopsTpl->assign('tags', false);
136
+	$xoopsTpl->assign('tags', false);
137 137
 }
138 138
 
139 139
 // Рейтинг
140 140
 if (xoops_getModuleOption('userat', 'instruction')) {
141
-    $xoopsTpl->assign('insUserat', true);
141
+	$xoopsTpl->assign('insUserat', true);
142 142
 } else {
143
-    $xoopsTpl->assign('insUserat', false);
143
+	$xoopsTpl->assign('insUserat', false);
144 144
 }
145 145
 
146 146
 // Подвал
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 // Права на просмотр инструкции
43 43
 $categories = Xoopsmodules\instruction\Utility::getItemIds();
44
-if (!in_array($objInsinstr->getVar('cid'), $categories)) {
44
+if ( ! in_array($objInsinstr->getVar('cid'), $categories)) {
45 45
     redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
46 46
     exit();
47 47
 }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                            . $moduleDirName
63 63
                            . '/admin/instr.php?op=editinstr&instrid='
64 64
                            . $instrid
65
-                           . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt='
65
+                           . '"><img style="width:16px;" src="' . $pathIcon16 . '/edit.png" alt='
66 66
                            . _EDIT
67 67
                            . ' title='
68 68
                            . _EDIT
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                            . $moduleDirName
73 73
                            . '/admin/instr.php?op=delinstr&instrid='
74 74
                            . $instrid
75
-                           . '"><img style="width:16px;" src="'. $pathIcon16 . '/delete.png" alt='
75
+                           . '"><img style="width:16px;" src="' . $pathIcon16 . '/delete.png" alt='
76 76
                            . _DELETE
77 77
                            . ' title='
78 78
                            . _DELETE
Please login to merge, or discard this patch.