Completed
Push — master ( 37052f...d19713 )
by Michael
02:03
created
class/common/breadcrumb.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -32,48 +32,48 @@
 block discarded – undo
32 32
  */
33 33
 class PedigreeBreadcrumb
34 34
 {
35
-    public $dirname;
36
-    private $bread = [];
35
+	public $dirname;
36
+	private $bread = [];
37 37
 
38
-    /**
39
-     *
40
-     */
41
-    public function __construct()
42
-    {
43
-        $this->dirname = basename(dirname(__DIR__));
44
-    }
38
+	/**
39
+	 *
40
+	 */
41
+	public function __construct()
42
+	{
43
+		$this->dirname = basename(dirname(__DIR__));
44
+	}
45 45
 
46
-    /**
47
-     * Add link to breadcrumb
48
-     *
49
-     * @param string $title
50
-     * @param string $link
51
-     */
52
-    public function addLink($title = '', $link = '')
53
-    {
54
-        $this->bread[] = [
55
-            'link'  => $link,
56
-            'title' => $title
57
-        ];
58
-    }
46
+	/**
47
+	 * Add link to breadcrumb
48
+	 *
49
+	 * @param string $title
50
+	 * @param string $link
51
+	 */
52
+	public function addLink($title = '', $link = '')
53
+	{
54
+		$this->bread[] = [
55
+			'link'  => $link,
56
+			'title' => $title
57
+		];
58
+	}
59 59
 
60
-    /**
61
-     * Render Pedigree BreadCrumb
62
-     *
63
-     */
64
-    public function render()
65
-    {
66
-        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
67
-            require_once $GLOBALS['xoops']->path('class/theme.php');
68
-            $GLOBALS['xoTheme'] = new xos_opal_Theme();
69
-        }
60
+	/**
61
+	 * Render Pedigree BreadCrumb
62
+	 *
63
+	 */
64
+	public function render()
65
+	{
66
+		if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
67
+			require_once $GLOBALS['xoops']->path('class/theme.php');
68
+			$GLOBALS['xoTheme'] = new xos_opal_Theme();
69
+		}
70 70
 
71
-        require_once $GLOBALS['xoops']->path('class/template.php');
72
-        $breadcrumbTpl = new XoopsTpl();
73
-        $breadcrumbTpl->assign('breadcrumb', $this->bread);
74
-        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
75
-        unset($breadcrumbTpl);
71
+		require_once $GLOBALS['xoops']->path('class/template.php');
72
+		$breadcrumbTpl = new XoopsTpl();
73
+		$breadcrumbTpl->assign('breadcrumb', $this->bread);
74
+		$html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
75
+		unset($breadcrumbTpl);
76 76
 
77
-        return $html;
78
-    }
77
+		return $html;
78
+	}
79 79
 }
Please login to merge, or discard this patch.
class/common/traitfilesmgmt.php 1 patch
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -16,226 +16,226 @@
 block discarded – undo
16 16
  */
17 17
 trait FilesManagement
18 18
 {
19
-    /**
20
-     * Function responsible for checking if a directory exists, we can also write in and create an index.html file
21
-     *
22
-     * @param string $folder The full path of the directory to check
23
-     *
24
-     * @return void
25
-     */
26
-    public static function createFolder($folder)
27
-    {
28
-        try {
29
-            if (!file_exists($folder)) {
30
-                if (!mkdir($folder) && !is_dir($folder)) {
31
-                    throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
32
-                }
33
-
34
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
35
-            }
36
-        } catch (Exception $e) {
37
-            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
38
-        }
39
-    }
40
-
41
-    /**
42
-     * @param $file
43
-     * @param $folder
44
-     * @return bool
45
-     */
46
-    public static function copyFile($file, $folder)
47
-    {
48
-        return copy($file, $folder);
49
-    }
50
-
51
-    /**
52
-     * @param $src
53
-     * @param $dst
54
-     */
55
-    public static function recurseCopy($src, $dst)
56
-    {
57
-        $dir = opendir($src);
58
-        @mkdir($dst);
59
-        while (false !== ($file = readdir($dir))) {
60
-            if (('.' !== $file) && ('..' !== $file)) {
61
-                if (is_dir($src . '/' . $file)) {
62
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
63
-                } else {
64
-                    copy($src . '/' . $file, $dst . '/' . $file);
65
-                }
66
-            }
67
-        }
68
-        closedir($dir);
69
-    }
70
-
71
-    /**
72
-     *
73
-     * Remove files and (sub)directories
74
-     *
75
-     * @param string $src source directory to delete
76
-     *
77
-     * @uses \Xmf\Module\Helper::getHelper()
78
-     * @uses \Xmf\Module\Helper::isUserAdmin()
79
-     *
80
-     * @return bool true on success
81
-     */
82
-    public static function deleteDirectory($src)
83
-    {
84
-        // Only continue if user is a 'global' Admin
85
-        if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
86
-            return false;
87
-        }
88
-
89
-        $success = true;
90
-        // remove old files
91
-        $dirInfo = new SplFileInfo($src);
92
-        // validate is a directory
93
-        if ($dirInfo->isDir()) {
94
-            $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']);
95
-            foreach ($fileList as $k => $v) {
96
-                $fileInfo = new SplFileInfo("{$src}/{$v}");
97
-                if ($fileInfo->isDir()) {
98
-                    // recursively handle subdirectories
99
-                    if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
100
-                        break;
101
-                    }
102
-                } else {
103
-                    // delete the file
104
-                    if (!($success = unlink($fileInfo->getRealPath()))) {
105
-                        break;
106
-                    }
107
-                }
108
-            }
109
-            // now delete this (sub)directory if all the files are gone
110
-            if ($success) {
111
-                $success = rmdir($dirInfo->getRealPath());
112
-            }
113
-        } else {
114
-            // input is not a valid directory
115
-            $success = false;
116
-        }
117
-        return $success;
118
-    }
119
-
120
-    /**
121
-     *
122
-     * Recursively remove directory
123
-     *
124
-     * @todo currently won't remove directories with hidden files, should it?
125
-     *
126
-     * @param string $src directory to remove (delete)
127
-     *
128
-     * @return bool true on success
129
-     */
130
-    public static function rrmdir($src)
131
-    {
132
-        // Only continue if user is a 'global' Admin
133
-        if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
134
-            return false;
135
-        }
136
-
137
-        // If source is not a directory stop processing
138
-        if (!is_dir($src)) {
139
-            return false;
140
-        }
141
-
142
-        $success = true;
143
-
144
-        // Open the source directory to read in files
145
-        $iterator = new DirectoryIterator($src);
146
-        foreach ($iterator as $fObj) {
147
-            if ($fObj->isFile()) {
148
-                $filename = $fObj->getPathname();
149
-                $fObj     = null; // clear this iterator object to close the file
150
-                if (!unlink($filename)) {
151
-                    return false; // couldn't delete the file
152
-                }
153
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
154
-                // Try recursively on directory
155
-                self::rrmdir($fObj->getPathname());
156
-            }
157
-        }
158
-        $iterator = null;   // clear iterator Obj to close file/directory
159
-        return rmdir($src); // remove the directory & return results
160
-    }
161
-
162
-    /**
163
-     * Recursively move files from one directory to another
164
-     *
165
-     * @param string $src  - Source of files being moved
166
-     * @param string $dest - Destination of files being moved
167
-     *
168
-     * @return bool true on success
169
-     */
170
-    public static function rmove($src, $dest)
171
-    {
172
-        // Only continue if user is a 'global' Admin
173
-        if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
174
-            return false;
175
-        }
176
-
177
-        // If source is not a directory stop processing
178
-        if (!is_dir($src)) {
179
-            return false;
180
-        }
181
-
182
-        // If the destination directory does not exist and could not be created stop processing
183
-        if (!is_dir($dest) && !mkdir($dest, 0755)) {
184
-            return false;
185
-        }
186
-
187
-        // Open the source directory to read in files
188
-        $iterator = new DirectoryIterator($src);
189
-        foreach ($iterator as $fObj) {
190
-            if ($fObj->isFile()) {
191
-                rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
192
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
193
-                // Try recursively on directory
194
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
195
-                //                rmdir($fObj->getPath()); // now delete the directory
196
-            }
197
-        }
198
-        $iterator = null;   // clear iterator Obj to close file/directory
199
-        return rmdir($src); // remove the directory & return results
200
-    }
201
-
202
-    /**
203
-     * Recursively copy directories and files from one directory to another
204
-     *
205
-     * @param string $src  - Source of files being moved
206
-     * @param string $dest - Destination of files being moved
207
-     *
208
-     * @uses \Xmf\Module\Helper::getHelper()
209
-     * @uses \Xmf\Module\Helper::isUserAdmin()
210
-     *
211
-     * @return bool true on success
212
-     */
213
-    public static function rcopy($src, $dest)
214
-    {
215
-        // Only continue if user is a 'global' Admin
216
-        if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
217
-            return false;
218
-        }
219
-
220
-        // If source is not a directory stop processing
221
-        if (!is_dir($src)) {
222
-            return false;
223
-        }
224
-
225
-        // If the destination directory does not exist and could not be created stop processing
226
-        if (!is_dir($dest) && !mkdir($dest, 0755)) {
227
-            return false;
228
-        }
229
-
230
-        // Open the source directory to read in files
231
-        $iterator = new DirectoryIterator($src);
232
-        foreach ($iterator as $fObj) {
233
-            if ($fObj->isFile()) {
234
-                copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
235
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
236
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
237
-            }
238
-        }
239
-        return true;
240
-    }
19
+	/**
20
+	 * Function responsible for checking if a directory exists, we can also write in and create an index.html file
21
+	 *
22
+	 * @param string $folder The full path of the directory to check
23
+	 *
24
+	 * @return void
25
+	 */
26
+	public static function createFolder($folder)
27
+	{
28
+		try {
29
+			if (!file_exists($folder)) {
30
+				if (!mkdir($folder) && !is_dir($folder)) {
31
+					throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
32
+				}
33
+
34
+				file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
35
+			}
36
+		} catch (Exception $e) {
37
+			echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
38
+		}
39
+	}
40
+
41
+	/**
42
+	 * @param $file
43
+	 * @param $folder
44
+	 * @return bool
45
+	 */
46
+	public static function copyFile($file, $folder)
47
+	{
48
+		return copy($file, $folder);
49
+	}
50
+
51
+	/**
52
+	 * @param $src
53
+	 * @param $dst
54
+	 */
55
+	public static function recurseCopy($src, $dst)
56
+	{
57
+		$dir = opendir($src);
58
+		@mkdir($dst);
59
+		while (false !== ($file = readdir($dir))) {
60
+			if (('.' !== $file) && ('..' !== $file)) {
61
+				if (is_dir($src . '/' . $file)) {
62
+					self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
63
+				} else {
64
+					copy($src . '/' . $file, $dst . '/' . $file);
65
+				}
66
+			}
67
+		}
68
+		closedir($dir);
69
+	}
70
+
71
+	/**
72
+	 *
73
+	 * Remove files and (sub)directories
74
+	 *
75
+	 * @param string $src source directory to delete
76
+	 *
77
+	 * @uses \Xmf\Module\Helper::getHelper()
78
+	 * @uses \Xmf\Module\Helper::isUserAdmin()
79
+	 *
80
+	 * @return bool true on success
81
+	 */
82
+	public static function deleteDirectory($src)
83
+	{
84
+		// Only continue if user is a 'global' Admin
85
+		if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
86
+			return false;
87
+		}
88
+
89
+		$success = true;
90
+		// remove old files
91
+		$dirInfo = new SplFileInfo($src);
92
+		// validate is a directory
93
+		if ($dirInfo->isDir()) {
94
+			$fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']);
95
+			foreach ($fileList as $k => $v) {
96
+				$fileInfo = new SplFileInfo("{$src}/{$v}");
97
+				if ($fileInfo->isDir()) {
98
+					// recursively handle subdirectories
99
+					if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
100
+						break;
101
+					}
102
+				} else {
103
+					// delete the file
104
+					if (!($success = unlink($fileInfo->getRealPath()))) {
105
+						break;
106
+					}
107
+				}
108
+			}
109
+			// now delete this (sub)directory if all the files are gone
110
+			if ($success) {
111
+				$success = rmdir($dirInfo->getRealPath());
112
+			}
113
+		} else {
114
+			// input is not a valid directory
115
+			$success = false;
116
+		}
117
+		return $success;
118
+	}
119
+
120
+	/**
121
+	 *
122
+	 * Recursively remove directory
123
+	 *
124
+	 * @todo currently won't remove directories with hidden files, should it?
125
+	 *
126
+	 * @param string $src directory to remove (delete)
127
+	 *
128
+	 * @return bool true on success
129
+	 */
130
+	public static function rrmdir($src)
131
+	{
132
+		// Only continue if user is a 'global' Admin
133
+		if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
134
+			return false;
135
+		}
136
+
137
+		// If source is not a directory stop processing
138
+		if (!is_dir($src)) {
139
+			return false;
140
+		}
141
+
142
+		$success = true;
143
+
144
+		// Open the source directory to read in files
145
+		$iterator = new DirectoryIterator($src);
146
+		foreach ($iterator as $fObj) {
147
+			if ($fObj->isFile()) {
148
+				$filename = $fObj->getPathname();
149
+				$fObj     = null; // clear this iterator object to close the file
150
+				if (!unlink($filename)) {
151
+					return false; // couldn't delete the file
152
+				}
153
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
154
+				// Try recursively on directory
155
+				self::rrmdir($fObj->getPathname());
156
+			}
157
+		}
158
+		$iterator = null;   // clear iterator Obj to close file/directory
159
+		return rmdir($src); // remove the directory & return results
160
+	}
161
+
162
+	/**
163
+	 * Recursively move files from one directory to another
164
+	 *
165
+	 * @param string $src  - Source of files being moved
166
+	 * @param string $dest - Destination of files being moved
167
+	 *
168
+	 * @return bool true on success
169
+	 */
170
+	public static function rmove($src, $dest)
171
+	{
172
+		// Only continue if user is a 'global' Admin
173
+		if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
174
+			return false;
175
+		}
176
+
177
+		// If source is not a directory stop processing
178
+		if (!is_dir($src)) {
179
+			return false;
180
+		}
181
+
182
+		// If the destination directory does not exist and could not be created stop processing
183
+		if (!is_dir($dest) && !mkdir($dest, 0755)) {
184
+			return false;
185
+		}
186
+
187
+		// Open the source directory to read in files
188
+		$iterator = new DirectoryIterator($src);
189
+		foreach ($iterator as $fObj) {
190
+			if ($fObj->isFile()) {
191
+				rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
192
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
193
+				// Try recursively on directory
194
+				self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
195
+				//                rmdir($fObj->getPath()); // now delete the directory
196
+			}
197
+		}
198
+		$iterator = null;   // clear iterator Obj to close file/directory
199
+		return rmdir($src); // remove the directory & return results
200
+	}
201
+
202
+	/**
203
+	 * Recursively copy directories and files from one directory to another
204
+	 *
205
+	 * @param string $src  - Source of files being moved
206
+	 * @param string $dest - Destination of files being moved
207
+	 *
208
+	 * @uses \Xmf\Module\Helper::getHelper()
209
+	 * @uses \Xmf\Module\Helper::isUserAdmin()
210
+	 *
211
+	 * @return bool true on success
212
+	 */
213
+	public static function rcopy($src, $dest)
214
+	{
215
+		// Only continue if user is a 'global' Admin
216
+		if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
217
+			return false;
218
+		}
219
+
220
+		// If source is not a directory stop processing
221
+		if (!is_dir($src)) {
222
+			return false;
223
+		}
224
+
225
+		// If the destination directory does not exist and could not be created stop processing
226
+		if (!is_dir($dest) && !mkdir($dest, 0755)) {
227
+			return false;
228
+		}
229
+
230
+		// Open the source directory to read in files
231
+		$iterator = new DirectoryIterator($src);
232
+		foreach ($iterator as $fObj) {
233
+			if ($fObj->isFile()) {
234
+				copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
235
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
236
+				self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
237
+			}
238
+		}
239
+		return true;
240
+	}
241 241
 }
Please login to merge, or discard this patch.
class/instruction.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -8,138 +8,138 @@
 block discarded – undo
8 8
 
9 9
 class InstructionInstruction extends XoopsObject
10 10
 {
11
-    // constructor
12
-    public function __construct()
13
-    {
14
-        //		$this->XoopsObject();
15
-        $this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11);
16
-        $this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5);
17
-        $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
18
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
19
-        $this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1);
20
-        $this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11);
21
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
22
-        $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
23
-        $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
24
-        $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
25
-        $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
26
-
27
-        // Нет в таблице
28
-        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
29
-        $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false);
30
-    }
31
-
32
-    public function InstructionInstruction()
33
-    {
34
-        $this->__construct();
35
-    }
36
-
37
-    public function get_new_enreg()
38
-    {
39
-        $new_enreg = $GLOBALS['xoopsDB']->getInsertId();
40
-        return $new_enreg;
41
-    }
42
-
43
-    // Получаем форму
44
-    public function getForm($action = false)
45
-    {
46
-        global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
47
-        // Если нет $action
48
-        if (false === $action) {
49
-            $action = xoops_getenv('REQUEST_URI');
50
-        }
51
-        // Подключаем формы
52
-        include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
53
-
54
-        // Название формы
55
-        $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR);
56
-
57
-        // Форма
58
-        $form = new XoopsThemeForm($title, 'forminstr', $action, 'post', true);
59
-        //$form->setExtra('enctype="multipart/form-data"');
60
-        // Название инструкции
61
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
62
-        // Категория
63
-        $instructioncatHandler = xoops_getModuleHandler('category', 'instruction');
64
-        $criteria              = new CriteriaCompo();
65
-        $criteria->setSort('weight ASC, title');
66
-        $criteria->setOrder('ASC');
67
-        $instructioncat_arr = $instructioncatHandler->getall($criteria);
68
-        unset($criteria);
69
-        // Подключаем трей
70
-        include_once $GLOBALS['xoops']->path('/class/tree.php');
71
-        $mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
72
-        $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
73
-        // Описание
74
-        $form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true);
75
-        // Статус
76
-        $form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
77
-
78
-        // Теги
79
-        if (is_dir('../../tag') || is_dir('../tag')) {
80
-            $dir_tag_ok = true;
81
-        } else {
82
-            $dir_tag_ok = false;
83
-        }
84
-        // Если влючена поддержка тегов и есть модуль tag
85
-        if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) {
86
-            $itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid');
87
-            // Подключаем форму тегов
88
-            include_once $GLOBALS['xoops']->path('/modules/tag/include/formtag.php');
89
-            // Добавляем элемент в форму
90
-            $form->addElement(new XoopsFormTag('tag', 60, 255, $itemIdForTag, 0));
91
-        }
92
-
93
-        // Мета-теги ключевых слов
94
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
95
-        // Мета-теги описания
96
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
97
-
98
-        // Если мы редактируем категорию
99
-        if (!$this->isNew()) {
100
-            $form->addElement(new XoopsFormHidden('instrid', $this->getVar('instrid')));
101
-        }
102
-        //
103
-        $form->addElement(new XoopsFormHidden('op', 'saveinstr'));
104
-        // Кнопка
105
-        $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
106
-        return $form;
107
-    }
11
+	// constructor
12
+	public function __construct()
13
+	{
14
+		//		$this->XoopsObject();
15
+		$this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11);
16
+		$this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5);
17
+		$this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
18
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
19
+		$this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1);
20
+		$this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11);
21
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
22
+		$this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
23
+		$this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
24
+		$this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
25
+		$this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
26
+
27
+		// Нет в таблице
28
+		$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
29
+		$this->initVar('dobr', XOBJ_DTYPE_INT, 0, false);
30
+	}
31
+
32
+	public function InstructionInstruction()
33
+	{
34
+		$this->__construct();
35
+	}
36
+
37
+	public function get_new_enreg()
38
+	{
39
+		$new_enreg = $GLOBALS['xoopsDB']->getInsertId();
40
+		return $new_enreg;
41
+	}
42
+
43
+	// Получаем форму
44
+	public function getForm($action = false)
45
+	{
46
+		global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
47
+		// Если нет $action
48
+		if (false === $action) {
49
+			$action = xoops_getenv('REQUEST_URI');
50
+		}
51
+		// Подключаем формы
52
+		include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
53
+
54
+		// Название формы
55
+		$title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR);
56
+
57
+		// Форма
58
+		$form = new XoopsThemeForm($title, 'forminstr', $action, 'post', true);
59
+		//$form->setExtra('enctype="multipart/form-data"');
60
+		// Название инструкции
61
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
62
+		// Категория
63
+		$instructioncatHandler = xoops_getModuleHandler('category', 'instruction');
64
+		$criteria              = new CriteriaCompo();
65
+		$criteria->setSort('weight ASC, title');
66
+		$criteria->setOrder('ASC');
67
+		$instructioncat_arr = $instructioncatHandler->getall($criteria);
68
+		unset($criteria);
69
+		// Подключаем трей
70
+		include_once $GLOBALS['xoops']->path('/class/tree.php');
71
+		$mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
72
+		$form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
73
+		// Описание
74
+		$form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true);
75
+		// Статус
76
+		$form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
77
+
78
+		// Теги
79
+		if (is_dir('../../tag') || is_dir('../tag')) {
80
+			$dir_tag_ok = true;
81
+		} else {
82
+			$dir_tag_ok = false;
83
+		}
84
+		// Если влючена поддержка тегов и есть модуль tag
85
+		if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) {
86
+			$itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid');
87
+			// Подключаем форму тегов
88
+			include_once $GLOBALS['xoops']->path('/modules/tag/include/formtag.php');
89
+			// Добавляем элемент в форму
90
+			$form->addElement(new XoopsFormTag('tag', 60, 255, $itemIdForTag, 0));
91
+		}
92
+
93
+		// Мета-теги ключевых слов
94
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
95
+		// Мета-теги описания
96
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
97
+
98
+		// Если мы редактируем категорию
99
+		if (!$this->isNew()) {
100
+			$form->addElement(new XoopsFormHidden('instrid', $this->getVar('instrid')));
101
+		}
102
+		//
103
+		$form->addElement(new XoopsFormHidden('op', 'saveinstr'));
104
+		// Кнопка
105
+		$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
106
+		return $form;
107
+	}
108 108
 }
109 109
 
110 110
 class InstructionInstructionHandler extends XoopsPersistableObjectHandler
111 111
 {
112
-    public function __construct($db)
113
-    {
114
-        parent::__construct($db, 'instruction_instr', 'InstructionInstruction', 'instrid', 'title');
115
-    }
116
-
117
-    // Обновление даты обновления инструкций
118
-    public function updateDateupdated($instrid = 0, $time = null)
119
-    {
120
-        // Если не передали время
121
-        $time = null === $time ? time() : (int)$time;
122
-        //
123
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid);
124
-        //
125
-        return $this->db->query($sql);
126
-    }
127
-
128
-    // Обновление числа страниц
129
-    public function updatePages($instrid = 0)
130
-    {
131
-        $inspageHandler = xoops_getModuleHandler('page', 'instruction');
132
-        // Находим число активных страниц
133
-        $criteria = new CriteriaCompo();
134
-        $criteria->add(new Criteria('instrid', $instrid, '='));
135
-        $criteria->add(new Criteria('status ', '0', '>'));
136
-        // Число страниц
137
-        $pages = $inspageHandler->getCount($criteria);
138
-        unset($criteria);
139
-
140
-        // Сохраняем это число
141
-        $sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid);
142
-        //
143
-        return $this->db->query($sql);
144
-    }
112
+	public function __construct($db)
113
+	{
114
+		parent::__construct($db, 'instruction_instr', 'InstructionInstruction', 'instrid', 'title');
115
+	}
116
+
117
+	// Обновление даты обновления инструкций
118
+	public function updateDateupdated($instrid = 0, $time = null)
119
+	{
120
+		// Если не передали время
121
+		$time = null === $time ? time() : (int)$time;
122
+		//
123
+		$sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid);
124
+		//
125
+		return $this->db->query($sql);
126
+	}
127
+
128
+	// Обновление числа страниц
129
+	public function updatePages($instrid = 0)
130
+	{
131
+		$inspageHandler = xoops_getModuleHandler('page', 'instruction');
132
+		// Находим число активных страниц
133
+		$criteria = new CriteriaCompo();
134
+		$criteria->add(new Criteria('instrid', $instrid, '='));
135
+		$criteria->add(new Criteria('status ', '0', '>'));
136
+		// Число страниц
137
+		$pages = $inspageHandler->getCount($criteria);
138
+		unset($criteria);
139
+
140
+		// Сохраняем это число
141
+		$sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid);
142
+		//
143
+		return $this->db->query($sql);
144
+	}
145 145
 }
Please login to merge, or discard this patch.
class/helper.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -23,37 +23,37 @@
 block discarded – undo
23 23
  */
24 24
 class Instruction extends \Xmf\Module\Helper
25 25
 {
26
-    public $debugArray = [];
26
+	public $debugArray = [];
27 27
 
28
-    /**
29
-     * @internal param $debug
30
-     */
31
-    protected function __construct()
32
-    {
33
-        //        $this->debug   = $debug;
34
-        $this->dirname = basename(dirname(__DIR__));
35
-    }
28
+	/**
29
+	 * @internal param $debug
30
+	 */
31
+	protected function __construct()
32
+	{
33
+		//        $this->debug   = $debug;
34
+		$this->dirname = basename(dirname(__DIR__));
35
+	}
36 36
 
37
-    /**
38
-     * @param bool $debug
39
-     *
40
-     * @return Newbb
41
-     */
42
-    public static function getInstance($debug = false)
43
-    {
44
-        static $instance;
45
-        if (null === $instance) {
46
-            $instance = new static($debug);
47
-        }
37
+	/**
38
+	 * @param bool $debug
39
+	 *
40
+	 * @return Newbb
41
+	 */
42
+	public static function getInstance($debug = false)
43
+	{
44
+		static $instance;
45
+		if (null === $instance) {
46
+			$instance = new static($debug);
47
+		}
48 48
 
49
-        return $instance;
50
-    }
49
+		return $instance;
50
+	}
51 51
 
52
-    /**
53
-     * @return string
54
-     */
55
-    public function getDirname()
56
-    {
57
-        return $this->dirname;
58
-    }
52
+	/**
53
+	 * @return string
54
+	 */
55
+	public function getDirname()
56
+	{
57
+		return $this->dirname;
58
+	}
59 59
 }
Please login to merge, or discard this patch.
class/page.php 1 patch
Indentation   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -8,208 +8,208 @@
 block discarded – undo
8 8
 
9 9
 class InstructionPage extends XoopsObject
10 10
 {
11
-    // constructor
12
-    public function __construct()
13
-    {
14
-        //	$this->XoopsObject();
15
-        $this->initVar('pageid', XOBJ_DTYPE_INT, null, false, 11);
16
-        $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 11);
17
-        $this->initVar('instrid', XOBJ_DTYPE_INT, 0, false, 11);
18
-        $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
19
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false, 255);
20
-        $this->initVar('status', XOBJ_DTYPE_INT, 1, false, 1);
21
-        $this->initVar('type', XOBJ_DTYPE_INT, 1, false, 1);
22
-        $this->initVar('hometext', XOBJ_DTYPE_TXTAREA, null, false);
23
-        $this->initVar('footnote', XOBJ_DTYPE_TXTAREA, '', false);
24
-        $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11);
25
-        $this->initVar('keywords', XOBJ_DTYPE_TXTBOX, '', false, 255);
26
-        $this->initVar('description', XOBJ_DTYPE_TXTBOX, '', false, 255);
27
-        $this->initVar('comments', XOBJ_DTYPE_INT, 0, false, 11);
28
-        $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
29
-        $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
30
-        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false, 1);
31
-        $this->initVar('dosmiley', XOBJ_DTYPE_INT, 0, false, 1);
32
-        $this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false, 1);
33
-        $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false, 1);
34
-    }
35
-
36
-    public function InstructionPage()
37
-    {
38
-        $this->__construct();
39
-    }
40
-
41
-    public function get_new_enreg()
42
-    {
43
-        $new_enreg = $GLOBALS['xoopsDB']->getInsertId();
44
-        return $new_enreg;
45
-    }
46
-
47
-    // Получаем форму
48
-    public function getForm($action = false, $instrid = 0)
49
-    {
50
-        // Если нет $action
51
-        if (false === $action) {
52
-            $action = xoops_getenv('REQUEST_URI');
53
-        }
54
-
55
-        // Подключаем формы
56
-        include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
57
-        // Подключаем типы страниц
58
-        $pagetypes = include $GLOBALS['xoops']->path('/modules/instruction/include/pagetypes.inc.php');
59
-
60
-        // Название формы
61
-        $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDPAGE) : sprintf(_AM_INSTRUCTION_FORMEDITPAGE);
62
-
63
-        // Форма
64
-        $form = new XoopsThemeForm($title, 'instr_form_page', $action, 'post', true);
65
-        // Название
66
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
67
-
68
-        // Родительская страница
69
-        $inspageHandler = xoops_getModuleHandler('page', 'instruction');
70
-        $criteria       = new CriteriaCompo();
71
-        // ID инструкции в которой данная страница
72
-        $instrid_page = $this->isNew() ? $instrid : $this->getVar('instrid');
73
-        // Находим все страницы данной инструкции
74
-        $criteria->add(new Criteria('instrid', $instrid_page, '='));
75
-        // Если мы редактируем, то убрать текущую страницу из списка выбора родительской
76
-        if (!$this->isNew()) {
77
-            $criteria->add(new Criteria('pageid', $this->getVar('pageid'), '<>'));
78
-        }
79
-        $criteria->setSort('weight');
80
-        $criteria->setOrder('ASC');
81
-        $inspage_arr = $inspageHandler->getall($criteria);
82
-        unset($criteria);
83
-        // Подключаем трей
84
-        include_once $GLOBALS['xoops']->path('/class/tree.php');
85
-        $mytree = new XoopsObjectTree($inspage_arr, 'pageid', 'pid');
86
-        $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PPAGEC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
87
-
88
-        // Вес
89
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true);
90
-        // Основной текст
91
-        $form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_HOMETEXTC, 'hometext', $this->getVar('hometext', 'e')), true);
92
-        // Сноска
93
-        $form_footnote = new XoopsFormTextArea(_AM_INSTRUCTION_FOOTNOTEC, 'footnote', $this->getVar('footnote', 'e'));
94
-        $form_footnote->setDescription(_AM_INSTRUCTION_FOOTNOTE_DSC);
95
-        $form->addElement($form_footnote, false);
96
-        unset($form_footnote);
97
-        // Статус
98
-        $form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
99
-        // Тип страницы
100
-        $form_type = new XoopsFormSelect(_AM_INSTR_PAGETYPEC, 'type', $this->getVar('type'));
101
-        $form_type->setDescription(_AM_INSTR_PAGETYPEC_DESC);
102
-        $form_type->addOptionArray($pagetypes);
103
-        $form->addElement($form_type, false);
104
-        // Мета-теги ключевых слов
105
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'keywords', 50, 255, $this->getVar('keywords')), false);
106
-        // Мета-теги описания
107
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'description', 50, 255, $this->getVar('description')), false);
108
-
109
-        // Настройки
110
-        $option_tray = new XoopsFormElementTray(_OPTIONS, '<br>');
111
-        // HTML
112
-        $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml'));
113
-        $html_checkbox->addOption(1, _AM_INSTR_DOHTML);
114
-        $option_tray->addElement($html_checkbox);
115
-        // Смайлы
116
-        $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley'));
117
-        $smiley_checkbox->addOption(1, _AM_INSTR_DOSMILEY);
118
-        $option_tray->addElement($smiley_checkbox);
119
-        // ББ коды
120
-        $xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode'));
121
-        $xcode_checkbox->addOption(1, _AM_INSTR_DOXCODE);
122
-        $option_tray->addElement($xcode_checkbox);
123
-        //
124
-        $br_checkbox = new XoopsFormCheckBox('', 'dobr', $this->getVar('dobr'));
125
-        $br_checkbox->addOption(1, _AM_INSTR_DOAUTOWRAP);
126
-        $option_tray->addElement($br_checkbox);
127
-        //
128
-        $form->addElement($option_tray);
129
-
130
-        // Если мы редактируем страницу
131
-        if (!$this->isNew()) {
132
-            $form->addElement(new XoopsFormHidden('pageid', $this->getVar('pageid')));
133
-        } else {
134
-            $form->addElement(new XoopsFormHidden('pageid', 0));
135
-        }
136
-        // ID инструкции
137
-        if ($instrid) {
138
-            $form->addElement(new XoopsFormHidden('instrid', $instrid));
139
-        } else {
140
-            $form->addElement(new XoopsFormHidden('instrid', 0));
141
-        }
142
-        //
143
-        $form->addElement(new XoopsFormHidden('op', 'savepage'));
144
-        // Кнопка
145
-        $button_tray = new XoopsFormElementTray('', '');
146
-        $button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
147
-        $save_btn = new XoopsFormButton('', 'cancel', _AM_INSTR_SAVEFORM);
148
-        $save_btn->setExtra('onclick="instrSavePage();"');
149
-        $button_tray->addElement($save_btn);
150
-        $form->addElement($button_tray);
151
-
152
-        return $form;
153
-    }
154
-
155
-    //
156
-    public function getInstrid()
157
-    {
158
-        // Возвращаем ID инструкции
159
-        return $this->getVar('instrid');
160
-    }
11
+	// constructor
12
+	public function __construct()
13
+	{
14
+		//	$this->XoopsObject();
15
+		$this->initVar('pageid', XOBJ_DTYPE_INT, null, false, 11);
16
+		$this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 11);
17
+		$this->initVar('instrid', XOBJ_DTYPE_INT, 0, false, 11);
18
+		$this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
19
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false, 255);
20
+		$this->initVar('status', XOBJ_DTYPE_INT, 1, false, 1);
21
+		$this->initVar('type', XOBJ_DTYPE_INT, 1, false, 1);
22
+		$this->initVar('hometext', XOBJ_DTYPE_TXTAREA, null, false);
23
+		$this->initVar('footnote', XOBJ_DTYPE_TXTAREA, '', false);
24
+		$this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11);
25
+		$this->initVar('keywords', XOBJ_DTYPE_TXTBOX, '', false, 255);
26
+		$this->initVar('description', XOBJ_DTYPE_TXTBOX, '', false, 255);
27
+		$this->initVar('comments', XOBJ_DTYPE_INT, 0, false, 11);
28
+		$this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
29
+		$this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
30
+		$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false, 1);
31
+		$this->initVar('dosmiley', XOBJ_DTYPE_INT, 0, false, 1);
32
+		$this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false, 1);
33
+		$this->initVar('dobr', XOBJ_DTYPE_INT, 0, false, 1);
34
+	}
35
+
36
+	public function InstructionPage()
37
+	{
38
+		$this->__construct();
39
+	}
40
+
41
+	public function get_new_enreg()
42
+	{
43
+		$new_enreg = $GLOBALS['xoopsDB']->getInsertId();
44
+		return $new_enreg;
45
+	}
46
+
47
+	// Получаем форму
48
+	public function getForm($action = false, $instrid = 0)
49
+	{
50
+		// Если нет $action
51
+		if (false === $action) {
52
+			$action = xoops_getenv('REQUEST_URI');
53
+		}
54
+
55
+		// Подключаем формы
56
+		include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
57
+		// Подключаем типы страниц
58
+		$pagetypes = include $GLOBALS['xoops']->path('/modules/instruction/include/pagetypes.inc.php');
59
+
60
+		// Название формы
61
+		$title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDPAGE) : sprintf(_AM_INSTRUCTION_FORMEDITPAGE);
62
+
63
+		// Форма
64
+		$form = new XoopsThemeForm($title, 'instr_form_page', $action, 'post', true);
65
+		// Название
66
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
67
+
68
+		// Родительская страница
69
+		$inspageHandler = xoops_getModuleHandler('page', 'instruction');
70
+		$criteria       = new CriteriaCompo();
71
+		// ID инструкции в которой данная страница
72
+		$instrid_page = $this->isNew() ? $instrid : $this->getVar('instrid');
73
+		// Находим все страницы данной инструкции
74
+		$criteria->add(new Criteria('instrid', $instrid_page, '='));
75
+		// Если мы редактируем, то убрать текущую страницу из списка выбора родительской
76
+		if (!$this->isNew()) {
77
+			$criteria->add(new Criteria('pageid', $this->getVar('pageid'), '<>'));
78
+		}
79
+		$criteria->setSort('weight');
80
+		$criteria->setOrder('ASC');
81
+		$inspage_arr = $inspageHandler->getall($criteria);
82
+		unset($criteria);
83
+		// Подключаем трей
84
+		include_once $GLOBALS['xoops']->path('/class/tree.php');
85
+		$mytree = new XoopsObjectTree($inspage_arr, 'pageid', 'pid');
86
+		$form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PPAGEC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
87
+
88
+		// Вес
89
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true);
90
+		// Основной текст
91
+		$form->addElement(InstructionUtility::getWysiwygForm(_AM_INSTRUCTION_HOMETEXTC, 'hometext', $this->getVar('hometext', 'e')), true);
92
+		// Сноска
93
+		$form_footnote = new XoopsFormTextArea(_AM_INSTRUCTION_FOOTNOTEC, 'footnote', $this->getVar('footnote', 'e'));
94
+		$form_footnote->setDescription(_AM_INSTRUCTION_FOOTNOTE_DSC);
95
+		$form->addElement($form_footnote, false);
96
+		unset($form_footnote);
97
+		// Статус
98
+		$form->addElement(new XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
99
+		// Тип страницы
100
+		$form_type = new XoopsFormSelect(_AM_INSTR_PAGETYPEC, 'type', $this->getVar('type'));
101
+		$form_type->setDescription(_AM_INSTR_PAGETYPEC_DESC);
102
+		$form_type->addOptionArray($pagetypes);
103
+		$form->addElement($form_type, false);
104
+		// Мета-теги ключевых слов
105
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'keywords', 50, 255, $this->getVar('keywords')), false);
106
+		// Мета-теги описания
107
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'description', 50, 255, $this->getVar('description')), false);
108
+
109
+		// Настройки
110
+		$option_tray = new XoopsFormElementTray(_OPTIONS, '<br>');
111
+		// HTML
112
+		$html_checkbox = new XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml'));
113
+		$html_checkbox->addOption(1, _AM_INSTR_DOHTML);
114
+		$option_tray->addElement($html_checkbox);
115
+		// Смайлы
116
+		$smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley'));
117
+		$smiley_checkbox->addOption(1, _AM_INSTR_DOSMILEY);
118
+		$option_tray->addElement($smiley_checkbox);
119
+		// ББ коды
120
+		$xcode_checkbox = new XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode'));
121
+		$xcode_checkbox->addOption(1, _AM_INSTR_DOXCODE);
122
+		$option_tray->addElement($xcode_checkbox);
123
+		//
124
+		$br_checkbox = new XoopsFormCheckBox('', 'dobr', $this->getVar('dobr'));
125
+		$br_checkbox->addOption(1, _AM_INSTR_DOAUTOWRAP);
126
+		$option_tray->addElement($br_checkbox);
127
+		//
128
+		$form->addElement($option_tray);
129
+
130
+		// Если мы редактируем страницу
131
+		if (!$this->isNew()) {
132
+			$form->addElement(new XoopsFormHidden('pageid', $this->getVar('pageid')));
133
+		} else {
134
+			$form->addElement(new XoopsFormHidden('pageid', 0));
135
+		}
136
+		// ID инструкции
137
+		if ($instrid) {
138
+			$form->addElement(new XoopsFormHidden('instrid', $instrid));
139
+		} else {
140
+			$form->addElement(new XoopsFormHidden('instrid', 0));
141
+		}
142
+		//
143
+		$form->addElement(new XoopsFormHidden('op', 'savepage'));
144
+		// Кнопка
145
+		$button_tray = new XoopsFormElementTray('', '');
146
+		$button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
147
+		$save_btn = new XoopsFormButton('', 'cancel', _AM_INSTR_SAVEFORM);
148
+		$save_btn->setExtra('onclick="instrSavePage();"');
149
+		$button_tray->addElement($save_btn);
150
+		$form->addElement($button_tray);
151
+
152
+		return $form;
153
+	}
154
+
155
+	//
156
+	public function getInstrid()
157
+	{
158
+		// Возвращаем ID инструкции
159
+		return $this->getVar('instrid');
160
+	}
161 161
 }
162 162
 
163 163
 class InstructionPageHandler extends XoopsPersistableObjectHandler
164 164
 {
165
-    public function __construct($db)
166
-    {
167
-        parent::__construct($db, 'instruction_page', 'InstructionPage', 'pageid', 'title');
168
-    }
169
-
170
-    /**
171
-     * Generate function for update user post
172
-     *
173
-     * @ Update user post count after send approve content
174
-     * @ Update user post count after change status content
175
-     * @ Update user post count after delete content
176
-     */
177
-    public function updateposts($uid, $status, $action)
178
-    {
179
-        //
180
-        switch ($action) {
181
-            // Добавление страницы
182
-            case 'add':
183
-                if ($uid && $status) {
184
-                    $user          = new xoopsUser($uid);
185
-                    $memberHandler = xoops_getHandler('member');
186
-                    // Добавялем +1 к комментам
187
-                    $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
188
-                }
189
-                break;
190
-            // Удаление страницы
191
-            case 'delete':
192
-                if ($uid && $status) {
193
-                    $user          = new xoopsUser($uid);
194
-                    $memberHandler = xoops_getHandler('member');
195
-                    // Декримент комментов
196
-                    //$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 );
197
-                    // Сохраняем
198
-                    $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
199
-                }
200
-                break;
201
-
202
-            case 'status':
203
-                if ($uid) {
204
-                    $user          = new xoopsUser($uid);
205
-                    $memberHandler = xoops_getHandler('member');
206
-                    if ($status) {
207
-                        $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
208
-                    } else {
209
-                        $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
210
-                    }
211
-                }
212
-                break;
213
-        }
214
-    }
165
+	public function __construct($db)
166
+	{
167
+		parent::__construct($db, 'instruction_page', 'InstructionPage', 'pageid', 'title');
168
+	}
169
+
170
+	/**
171
+	 * Generate function for update user post
172
+	 *
173
+	 * @ Update user post count after send approve content
174
+	 * @ Update user post count after change status content
175
+	 * @ Update user post count after delete content
176
+	 */
177
+	public function updateposts($uid, $status, $action)
178
+	{
179
+		//
180
+		switch ($action) {
181
+			// Добавление страницы
182
+			case 'add':
183
+				if ($uid && $status) {
184
+					$user          = new xoopsUser($uid);
185
+					$memberHandler = xoops_getHandler('member');
186
+					// Добавялем +1 к комментам
187
+					$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
188
+				}
189
+				break;
190
+			// Удаление страницы
191
+			case 'delete':
192
+				if ($uid && $status) {
193
+					$user          = new xoopsUser($uid);
194
+					$memberHandler = xoops_getHandler('member');
195
+					// Декримент комментов
196
+					//$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 );
197
+					// Сохраняем
198
+					$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
199
+				}
200
+				break;
201
+
202
+			case 'status':
203
+				if ($uid) {
204
+					$user          = new xoopsUser($uid);
205
+					$memberHandler = xoops_getHandler('member');
206
+					if ($status) {
207
+						$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
208
+					} else {
209
+						$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
210
+					}
211
+				}
212
+				break;
213
+		}
214
+	}
215 215
 }
Please login to merge, or discard this patch.
class/category.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -11,56 +11,56 @@  discard block
 block discarded – undo
11 11
 
12 12
 class InstructionCategory extends XoopsObject
13 13
 {
14
-    // constructor
15
-    public function __construct()
16
-    {
17
-        //		$this->XoopsObject();
18
-        $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5);
19
-        $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 5);
20
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
21
-        $this->initVar('imgurl', XOBJ_DTYPE_TXTBOX, '', false);
22
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
23
-        $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11);
24
-        $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
25
-        $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
26
-        $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
27
-        $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
28
-    }
29
-
30
-    public function InstructionCategory()
31
-    {
32
-        $this->__construct();
33
-    }
34
-
35
-    public function get_new_enreg()
36
-    {
37
-        $new_enreg = $GLOBALS['xoopsDB']->getInsertId();
38
-        return $new_enreg;
39
-    }
40
-
41
-    // Получаем форму
42
-    public function getForm($action = false)
43
-    {
44
-        //global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
45
-        // Если нет $action
46
-        if (false === $action) {
47
-            $action = xoops_getenv('REQUEST_URI');
48
-        }
49
-        // Подключаем формы
50
-        include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
51
-
52
-        // Название формы
53
-        $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDCAT) : sprintf(_AM_INSTRUCTION_FORMEDITCAT);
54
-
55
-        // Форма
56
-        $form = new XoopsThemeForm($title, 'formcat', $action, 'post', true);
57
-        //$form->setExtra('enctype="multipart/form-data"');
58
-        // Название категории
59
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
60
-        // Редактор
61
-        $form->addElement(new XoopsFormTextArea(_AM_INSTRUCTION_DSCC, 'description', $this->getVar('description', 'e')), true);
62
-        //image
63
-        /*
14
+	// constructor
15
+	public function __construct()
16
+	{
17
+		//		$this->XoopsObject();
18
+		$this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5);
19
+		$this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 5);
20
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
21
+		$this->initVar('imgurl', XOBJ_DTYPE_TXTBOX, '', false);
22
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
23
+		$this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11);
24
+		$this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
25
+		$this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
26
+		$this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
27
+		$this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
28
+	}
29
+
30
+	public function InstructionCategory()
31
+	{
32
+		$this->__construct();
33
+	}
34
+
35
+	public function get_new_enreg()
36
+	{
37
+		$new_enreg = $GLOBALS['xoopsDB']->getInsertId();
38
+		return $new_enreg;
39
+	}
40
+
41
+	// Получаем форму
42
+	public function getForm($action = false)
43
+	{
44
+		//global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
45
+		// Если нет $action
46
+		if (false === $action) {
47
+			$action = xoops_getenv('REQUEST_URI');
48
+		}
49
+		// Подключаем формы
50
+		include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
51
+
52
+		// Название формы
53
+		$title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDCAT) : sprintf(_AM_INSTRUCTION_FORMEDITCAT);
54
+
55
+		// Форма
56
+		$form = new XoopsThemeForm($title, 'formcat', $action, 'post', true);
57
+		//$form->setExtra('enctype="multipart/form-data"');
58
+		// Название категории
59
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
60
+		// Редактор
61
+		$form->addElement(new XoopsFormTextArea(_AM_INSTRUCTION_DSCC, 'description', $this->getVar('description', 'e')), true);
62
+		//image
63
+		/*
64 64
         $downloadscat_img = $this->getVar('imgurl') ? $this->getVar('imgurl') : 'blank.gif';
65 65
         $uploadirectory='/uploads/tdmdownloads/images/cats';
66 66
         $imgtray = new XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMIMG,'<br>');
@@ -79,127 +79,127 @@  discard block
 block discarded – undo
79 79
         $imgtray->addElement($fileseltray);
80 80
         $form->addElement($imgtray);
81 81
         */
82
-        // Родительская категория
83
-        $instructioncatHandler = xoops_getModuleHandler('category', 'instruction');
84
-        $criteria              = new CriteriaCompo();
85
-        // Если мы редактируем, то убрать текущую категорию из списка выбора родительской
86
-        if (!$this->isNew()) {
87
-            $criteria->add(new Criteria('cid', $this->getVar('cid'), '<>'));
88
-        }
89
-        $criteria->setSort('weight ASC, title');
90
-        $criteria->setOrder('ASC');
91
-        $instructioncat_arr = $instructioncatHandler->getall($criteria);
92
-        unset($criteria);
93
-        // Подключаем трей
94
-        include_once $GLOBALS['xoops']->path('/class/tree.php');
95
-        $mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
96
-
97
-        //        $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
98
-        $moduleDirName = basename(__DIR__);
99
-        if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
100
-        } else {
101
-            $moduleHelper = Xmf\Module\Helper::getHelper('system');
102
-        }
103
-        $module = $moduleHelper->getModule();
104
-
105
-        if (InstructionUtility::checkVerXoops($module, '2.5.9')) {
106
-            $mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PCATC);
107
-            $form->addElement($mytree_select);
108
-        } else {
109
-            $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
110
-        }
111
-
112
-        // Вес
113
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true);
114
-        // Мета-теги ключевых слов
115
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
116
-        // Мета-теги описания
117
-        $form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
118
-
119
-        // ==========================================================
120
-        // ==========================================================
121
-
122
-        // Права
123
-        $memberHandler = xoops_getHandler('member');
124
-        $group_list    = $memberHandler->getGroupList();
125
-        $gpermHandler  = xoops_getHandler('groupperm');
126
-        $full_list     = array_keys($group_list);
127
-
128
-        // Права на просмотр
129
-        $groups_ids = [];
130
-        // Если мы редактируем
131
-        if (!$this->isNew()) {
132
-            $groups_ids        = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
133
-            $groups_ids        = array_values($groups_ids);
134
-            $groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids);
135
-        } else {
136
-            $groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $full_list);
137
-        }
138
-        $groups_instr_view->addOptionArray($group_list);
139
-        $form->addElement($groups_instr_view);
140
-
141
-        // Права на отправку
142
-        $groups_ids = [];
143
-        if (!$this->isNew()) {
144
-            $groups_ids          = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
145
-            $groups_ids          = array_values($groups_ids);
146
-            $groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids);
147
-        } else {
148
-            $groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $full_list);
149
-        }
150
-        $groups_instr_submit->addOptionArray($group_list);
151
-        $form->addElement($groups_instr_submit);
152
-
153
-        // Права на редактирование
154
-        $groups_ids = [];
155
-        if (!$this->isNew()) {
156
-            $groups_ids        = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
157
-            $groups_ids        = array_values($groups_ids);
158
-            $groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids);
159
-        } else {
160
-            $groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $full_list);
161
-        }
162
-        $groups_instr_edit->addOptionArray($group_list);
163
-        $form->addElement($groups_instr_edit);
164
-
165
-        // ==========================================================
166
-        // ==========================================================
167
-
168
-        // Если мы редактируем категорию
169
-        if (!$this->isNew()) {
170
-            $form->addElement(new XoopsFormHidden('cid', $this->getVar('cid')));
171
-            //$form->addElement( new XoopsFormHidden( 'catmodify', true));
172
-        }
173
-        //
174
-        $form->addElement(new XoopsFormHidden('op', 'savecat'));
175
-        // Кнопка
176
-        $button_tray = new XoopsFormElementTray('', '');
177
-        $submit_btn  = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
178
-        $button_tray->addElement($submit_btn);
179
-        $cancel_btn = new XoopsFormButton('', 'cancel', _CANCEL, 'cancel');
180
-        $cancel_btn->setExtra('onclick="javascript:history.go(-1);"');
181
-        $button_tray->addElement($cancel_btn);
182
-        $form->addElement($button_tray);
183
-
184
-        return $form;
185
-    }
82
+		// Родительская категория
83
+		$instructioncatHandler = xoops_getModuleHandler('category', 'instruction');
84
+		$criteria              = new CriteriaCompo();
85
+		// Если мы редактируем, то убрать текущую категорию из списка выбора родительской
86
+		if (!$this->isNew()) {
87
+			$criteria->add(new Criteria('cid', $this->getVar('cid'), '<>'));
88
+		}
89
+		$criteria->setSort('weight ASC, title');
90
+		$criteria->setOrder('ASC');
91
+		$instructioncat_arr = $instructioncatHandler->getall($criteria);
92
+		unset($criteria);
93
+		// Подключаем трей
94
+		include_once $GLOBALS['xoops']->path('/class/tree.php');
95
+		$mytree = new XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
96
+
97
+		//        $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
98
+		$moduleDirName = basename(__DIR__);
99
+		if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) {
100
+		} else {
101
+			$moduleHelper = Xmf\Module\Helper::getHelper('system');
102
+		}
103
+		$module = $moduleHelper->getModule();
104
+
105
+		if (InstructionUtility::checkVerXoops($module, '2.5.9')) {
106
+			$mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PCATC);
107
+			$form->addElement($mytree_select);
108
+		} else {
109
+			$form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
110
+		}
111
+
112
+		// Вес
113
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true);
114
+		// Мета-теги ключевых слов
115
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
116
+		// Мета-теги описания
117
+		$form->addElement(new XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
118
+
119
+		// ==========================================================
120
+		// ==========================================================
121
+
122
+		// Права
123
+		$memberHandler = xoops_getHandler('member');
124
+		$group_list    = $memberHandler->getGroupList();
125
+		$gpermHandler  = xoops_getHandler('groupperm');
126
+		$full_list     = array_keys($group_list);
127
+
128
+		// Права на просмотр
129
+		$groups_ids = [];
130
+		// Если мы редактируем
131
+		if (!$this->isNew()) {
132
+			$groups_ids        = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
133
+			$groups_ids        = array_values($groups_ids);
134
+			$groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids);
135
+		} else {
136
+			$groups_instr_view = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $full_list);
137
+		}
138
+		$groups_instr_view->addOptionArray($group_list);
139
+		$form->addElement($groups_instr_view);
140
+
141
+		// Права на отправку
142
+		$groups_ids = [];
143
+		if (!$this->isNew()) {
144
+			$groups_ids          = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
145
+			$groups_ids          = array_values($groups_ids);
146
+			$groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids);
147
+		} else {
148
+			$groups_instr_submit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $full_list);
149
+		}
150
+		$groups_instr_submit->addOptionArray($group_list);
151
+		$form->addElement($groups_instr_submit);
152
+
153
+		// Права на редактирование
154
+		$groups_ids = [];
155
+		if (!$this->isNew()) {
156
+			$groups_ids        = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
157
+			$groups_ids        = array_values($groups_ids);
158
+			$groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids);
159
+		} else {
160
+			$groups_instr_edit = new XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $full_list);
161
+		}
162
+		$groups_instr_edit->addOptionArray($group_list);
163
+		$form->addElement($groups_instr_edit);
164
+
165
+		// ==========================================================
166
+		// ==========================================================
167
+
168
+		// Если мы редактируем категорию
169
+		if (!$this->isNew()) {
170
+			$form->addElement(new XoopsFormHidden('cid', $this->getVar('cid')));
171
+			//$form->addElement( new XoopsFormHidden( 'catmodify', true));
172
+		}
173
+		//
174
+		$form->addElement(new XoopsFormHidden('op', 'savecat'));
175
+		// Кнопка
176
+		$button_tray = new XoopsFormElementTray('', '');
177
+		$submit_btn  = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
178
+		$button_tray->addElement($submit_btn);
179
+		$cancel_btn = new XoopsFormButton('', 'cancel', _CANCEL, 'cancel');
180
+		$cancel_btn->setExtra('onclick="javascript:history.go(-1);"');
181
+		$button_tray->addElement($cancel_btn);
182
+		$form->addElement($button_tray);
183
+
184
+		return $form;
185
+	}
186 186
 }
187 187
 
188 188
 class InstructionCategoryHandler extends XoopsPersistableObjectHandler
189 189
 {
190
-    public function __construct($db)
191
-    {
192
-        parent::__construct($db, 'instruction_cat', 'InstructionCategory', 'cid', 'title');
193
-    }
194
-
195
-    // Обновление даты обновления категории
196
-    public function updateDateupdated($cid = 0, $time = null)
197
-    {
198
-        // Если не передали время
199
-        $time = null === $time ? time() : (int)$time;
200
-        //
201
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid);
202
-        //
203
-        return $this->db->query($sql);
204
-    }
190
+	public function __construct($db)
191
+	{
192
+		parent::__construct($db, 'instruction_cat', 'InstructionCategory', 'cid', 'title');
193
+	}
194
+
195
+	// Обновление даты обновления категории
196
+	public function updateDateupdated($cid = 0, $time = null)
197
+	{
198
+		// Если не передали время
199
+		$time = null === $time ? time() : (int)$time;
200
+		//
201
+		$sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid);
202
+		//
203
+		return $this->db->query($sql);
204
+	}
205 205
 }
Please login to merge, or discard this patch.
class/utility.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -13,63 +13,63 @@
 block discarded – undo
13 13
  */
14 14
 class InstructionUtility
15 15
 {
16
-    use VersionChecks; //checkVerXoops, checkVerPhp Traits
16
+	use VersionChecks; //checkVerXoops, checkVerPhp Traits
17 17
 
18
-    use ServerStats; // getServerStats Trait
18
+	use ServerStats; // getServerStats Trait
19 19
 
20
-    use FilesManagement; // Files Management Trait
20
+	use FilesManagement; // Files Management Trait
21 21
 
22
-    // Права
23
-    public static function getItemIds($permtype = 'instruction_view')
24
-    {
25
-        //global $xoopsUser;
26
-        static $permissions = [];
27
-        // Если есть в статике
28
-        if (is_array($permissions) && array_key_exists($permtype, $permissions)) {
29
-            return $permissions[$permtype];
30
-        }
31
-        // Находим из базы
32
-        $moduleHandler          = xoops_getHandler('module');
33
-        $instrModule            = $moduleHandler->getByDirname('instruction');
34
-        $groups                 = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
35
-        $gpermHandler           = xoops_getHandler('groupperm');
36
-        $categories             = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid'));
37
-        $permissions[$permtype] = $categories;
38
-        return $categories;
39
-    }
22
+	// Права
23
+	public static function getItemIds($permtype = 'instruction_view')
24
+	{
25
+		//global $xoopsUser;
26
+		static $permissions = [];
27
+		// Если есть в статике
28
+		if (is_array($permissions) && array_key_exists($permtype, $permissions)) {
29
+			return $permissions[$permtype];
30
+		}
31
+		// Находим из базы
32
+		$moduleHandler          = xoops_getHandler('module');
33
+		$instrModule            = $moduleHandler->getByDirname('instruction');
34
+		$groups                 = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
35
+		$gpermHandler           = xoops_getHandler('groupperm');
36
+		$categories             = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid'));
37
+		$permissions[$permtype] = $categories;
38
+		return $categories;
39
+	}
40 40
 
41
-    // Редактор
42
-    public static function getWysiwygForm($caption, $name, $value = '')
43
-    {
44
-        $editor                   = false;
45
-        $editor_configs           = [];
46
-        $editor_configs['name']   = $name;
47
-        $editor_configs['value']  = $value;
48
-        $editor_configs['rows']   = 35;
49
-        $editor_configs['cols']   = 60;
50
-        $editor_configs['width']  = '100%';
51
-        $editor_configs['height'] = '350px';
52
-        $editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction'));
41
+	// Редактор
42
+	public static function getWysiwygForm($caption, $name, $value = '')
43
+	{
44
+		$editor                   = false;
45
+		$editor_configs           = [];
46
+		$editor_configs['name']   = $name;
47
+		$editor_configs['value']  = $value;
48
+		$editor_configs['rows']   = 35;
49
+		$editor_configs['cols']   = 60;
50
+		$editor_configs['width']  = '100%';
51
+		$editor_configs['height'] = '350px';
52
+		$editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction'));
53 53
 
54
-        $editor = new XoopsFormEditor($caption, $name, $editor_configs);
55
-        return $editor;
56
-    }
54
+		$editor = new XoopsFormEditor($caption, $name, $editor_configs);
55
+		return $editor;
56
+	}
57 57
 
58
-    // Получение значения переменной, переданной через GET или POST запрос
59
-    public static function cleanVars(&$global, $key, $default = '', $type = 'int')
60
-    {
61
-        switch ($type) {
62
-            case 'string':
63
-                $ret = isset($global[$key]) ? $global[$key] : $default;
64
-                break;
65
-            case 'int':
66
-            default:
67
-                $ret = isset($global[$key]) ? (int)$global[$key] : (int)$default;
68
-                break;
69
-        }
70
-        if (false === $ret) {
71
-            return $default;
72
-        }
73
-        return $ret;
74
-    }
58
+	// Получение значения переменной, переданной через GET или POST запрос
59
+	public static function cleanVars(&$global, $key, $default = '', $type = 'int')
60
+	{
61
+		switch ($type) {
62
+			case 'string':
63
+				$ret = isset($global[$key]) ? $global[$key] : $default;
64
+				break;
65
+			case 'int':
66
+			default:
67
+				$ret = isset($global[$key]) ? (int)$global[$key] : (int)$default;
68
+				break;
69
+		}
70
+		if (false === $ret) {
71
+			return $default;
72
+		}
73
+		return $ret;
74
+	}
75 75
 }
Please login to merge, or discard this patch.
class/tree.php 1 patch
Indentation   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -12,82 +12,82 @@  discard block
 block discarded – undo
12 12
 // Наследник класса XoopsObjectTree
13 13
 class InstructionTree extends XoopsObjectTree
14 14
 {
15
-    public function __constrcut()
16
-    {
17
-    }
18
-
19
-    public function _makePagesAdminOptions($key, &$ret, $prefix_orig, $objInsinstr, $class = 'odd', $prefix_curr = '')
20
-    {
21
-        if ($key > 0) {
22
-
23
-            //
24
-            $class = ('even' == $class) ? 'odd' : 'even';
25
-            // ID инструкции ( Можно сделать статической )
26
-            $instrid = $objInsinstr->getVar('instrid');
27
-
28
-            // ID страницы
29
-            $pageid = $this->tree[$key]['obj']->getVar('pageid');
30
-            // Название страницы
31
-            $pagetitle = $this->tree[$key]['obj']->getVar('title');
32
-            // Вес
33
-            $pageweight = $this->tree[$key]['obj']->getVar('weight');
34
-            // Статус
35
-            $pagestatus = $this->tree[$key]['obj']->getVar('status');
36
-            // Тип страницы
37
-            $pagetype = $this->tree[$key]['obj']->getVar('type');
38
-
39
-            // Дочернии страницы
40
-            $page_childs = $this->getAllChild($pageid);
41
-            // Число дочерних страниц
42
-            $num_childs = count($page_childs);
43
-
44
-            // Действие - удаление
45
-            $act_del = ($num_childs > 0) ? '<img src="../assets/icons/no_delete_mini.png" alt="' . _AM_INSTR_NODELPAGE . '" title="' . _AM_INSTR_NODELPAGE . '" />' : '<a href="instr.php?op=delpage&pageid='
46
-                                                                                                                                                                      . $pageid
47
-                                                                                                                                                                      . '"><img src="../assets/icons/delete_mini.png" alt="'
48
-                                                                                                                                                                      . _AM_INSTRUCTION_DEL
49
-                                                                                                                                                                      . '" title="'
50
-                                                                                                                                                                      . _AM_INSTRUCTION_DEL
51
-                                                                                                                                                                      . '"></a>';
52
-            //
53
-            $page_link = '<a name="pageid_' . $pageid . '" ' . ($pagetype ? 'href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext"' : '') . '>' . $pagetitle . '</a>';
54
-
55
-            $ret .= '<tr class="' . $class . '">
15
+	public function __constrcut()
16
+	{
17
+	}
18
+
19
+	public function _makePagesAdminOptions($key, &$ret, $prefix_orig, $objInsinstr, $class = 'odd', $prefix_curr = '')
20
+	{
21
+		if ($key > 0) {
22
+
23
+			//
24
+			$class = ('even' == $class) ? 'odd' : 'even';
25
+			// ID инструкции ( Можно сделать статической )
26
+			$instrid = $objInsinstr->getVar('instrid');
27
+
28
+			// ID страницы
29
+			$pageid = $this->tree[$key]['obj']->getVar('pageid');
30
+			// Название страницы
31
+			$pagetitle = $this->tree[$key]['obj']->getVar('title');
32
+			// Вес
33
+			$pageweight = $this->tree[$key]['obj']->getVar('weight');
34
+			// Статус
35
+			$pagestatus = $this->tree[$key]['obj']->getVar('status');
36
+			// Тип страницы
37
+			$pagetype = $this->tree[$key]['obj']->getVar('type');
38
+
39
+			// Дочернии страницы
40
+			$page_childs = $this->getAllChild($pageid);
41
+			// Число дочерних страниц
42
+			$num_childs = count($page_childs);
43
+
44
+			// Действие - удаление
45
+			$act_del = ($num_childs > 0) ? '<img src="../assets/icons/no_delete_mini.png" alt="' . _AM_INSTR_NODELPAGE . '" title="' . _AM_INSTR_NODELPAGE . '" />' : '<a href="instr.php?op=delpage&pageid='
46
+																																									  . $pageid
47
+																																									  . '"><img src="../assets/icons/delete_mini.png" alt="'
48
+																																									  . _AM_INSTRUCTION_DEL
49
+																																									  . '" title="'
50
+																																									  . _AM_INSTRUCTION_DEL
51
+																																									  . '"></a>';
52
+			//
53
+			$page_link = '<a name="pageid_' . $pageid . '" ' . ($pagetype ? 'href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext"' : '') . '>' . $pagetitle . '</a>';
54
+
55
+			$ret .= '<tr class="' . $class . '">
56 56
       <td>' . $prefix_curr . ' ' . $page_link . '</td>
57 57
       <td align="center" width="50">
58 58
         <input type="text" name="weights[]" size="2" value="' . $pageweight . '" />
59 59
         <input type="hidden" name="pageids[]" value="' . $pageid . '" />
60 60
       </td>
61 61
       <td align="center" width="180">';
62
-            // Просмотре без кэша
63
-            $ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&amp;nocache=1"><img src="../assets/icons/no_cache.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> ';
64
-            // Добавить подстраницу
65
-            $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="../assets/icons/add_mini.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> ';
66
-
67
-            if ($pagestatus) {
68
-                $ret .= ' <img src="../assets/icons/lock_mini.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> ';
69
-            } else {
70
-                $ret .= ' <img src="../assets/icons/unlock_mini.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> ';
71
-            }
72
-
73
-            $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="../assets/icons/edit_mini.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . '
62
+			// Просмотре без кэша
63
+			$ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&amp;nocache=1"><img src="../assets/icons/no_cache.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> ';
64
+			// Добавить подстраницу
65
+			$ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="../assets/icons/add_mini.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> ';
66
+
67
+			if ($pagestatus) {
68
+				$ret .= ' <img src="../assets/icons/lock_mini.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> ';
69
+			} else {
70
+				$ret .= ' <img src="../assets/icons/unlock_mini.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> ';
71
+			}
72
+
73
+			$ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="../assets/icons/edit_mini.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . '
74 74
       </td>
75 75
     </tr>';
76 76
 
77
-            // Устанавливаем префикс
78
-            $prefix_curr .= $prefix_orig;
79
-        }
77
+			// Устанавливаем префикс
78
+			$prefix_curr .= $prefix_orig;
79
+		}
80 80
 
81
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
82
-            foreach ($this->tree[$key]['child'] as $childkey) {
83
-                $this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr);
84
-            }
85
-        }
86
-    }
81
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
82
+			foreach ($this->tree[$key]['child'] as $childkey) {
83
+				$this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr);
84
+			}
85
+		}
86
+	}
87 87
 
88
-    public function makePagesAdmin(&$objInsinstr, $prefix = '-', $key = 0)
89
-    {
90
-        $ret = '<form name="inspages" action="instr.php" method="post">
88
+	public function makePagesAdmin(&$objInsinstr, $prefix = '-', $key = 0)
89
+	{
90
+		$ret = '<form name="inspages" action="instr.php" method="post">
91 91
   <table width="100%" cellspacing="1" class="outer">
92 92
     <tr>
93 93
       <th align="center" colspan="3">' . sprintf(_AM_INSTRUCTION_LISTPAGESININSTR, $objInsinstr->getVar('title')) . '</th>
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
       <td class="head" align="center" width="180">' . _AM_INSTRUCTION_ACTION . '</td>
99 99
     </tr>';
100 100
 
101
-        // Выводим все страницы
102
-        $this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr);
101
+		// Выводим все страницы
102
+		$this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr);
103 103
 
104
-        $ret .= '<tr class="foot">
104
+		$ret .= '<tr class="foot">
105 105
       <td><a href="instr.php?op=editpage&instrid=' . $objInsinstr->getVar('instrid') . '"><img src="../assets/icons/add_mini.png" alt="' . _AM_INSTRUCTION_ADDPAGE . '" title="' . _AM_INSTRUCTION_ADDPAGE . '"></a></td>
106 106
       <td colspan="2">
107 107
         <input type="hidden" name="instrid" value="' . $objInsinstr->getVar('instrid') . '" />
@@ -112,52 +112,52 @@  discard block
 block discarded – undo
112 112
   </table>
113 113
 </form>';
114 114
 
115
-        return $ret;
116
-    }
117
-
118
-    // ==================================
119
-    // === Дерево категорий в админке ===
120
-    // ==================================
121
-
122
-    public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '')
123
-    {
124
-        if ($key > 0) {
125
-
126
-            //
127
-            $class = ('even' == $class) ? 'odd' : 'even';
128
-
129
-            // ID категории
130
-            $catid = $this->tree[$key]['obj']->getVar('cid');
131
-            // Название категории
132
-            $cattitle = $this->tree[$key]['obj']->getVar('title');
133
-            // Вес
134
-            $catweight = $this->tree[$key]['obj']->getVar('weight');
135
-            // Статус
136
-            $pagestatus = $this->tree[$key]['obj']->getVar('status');
137
-
138
-            // Дочернии категории
139
-            $cat_childs = $this->getAllChild($catid);
140
-            // Число дочерних категорий
141
-            $num_childs = count($cat_childs);
142
-            // Число инструкций
143
-            $num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0;
144
-
145
-            // Действие - удаление
146
-            $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="../assets/icons/no_delete_mini.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid='
147
-                                                                                                                                                                                           . $catid
148
-                                                                                                                                                                                           . '"><img src="../assets/icons/delete_mini.png" alt="'
149
-                                                                                                                                                                                           . _AM_INSTRUCTION_DEL
150
-                                                                                                                                                                                           . '" title="'
151
-                                                                                                                                                                                           . _AM_INSTRUCTION_DEL
152
-                                                                                                                                                                                           . '" /></a>';
153
-            // Действие - просмотр
154
-            $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="../assets/icons/view_mini.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/icons/no_view_mini.png" alt="'
155
-                                                                                                                                                                                                             . _AM_INSTR_NOVIEWINSTR
156
-                                                                                                                                                                                                             . '" title="'
157
-                                                                                                                                                                                                             . _AM_INSTR_NOVIEWINSTR
158
-                                                                                                                                                                                                             . '" />';
159
-
160
-            $ret .= '<tr class="' . $class . '">
115
+		return $ret;
116
+	}
117
+
118
+	// ==================================
119
+	// === Дерево категорий в админке ===
120
+	// ==================================
121
+
122
+	public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '')
123
+	{
124
+		if ($key > 0) {
125
+
126
+			//
127
+			$class = ('even' == $class) ? 'odd' : 'even';
128
+
129
+			// ID категории
130
+			$catid = $this->tree[$key]['obj']->getVar('cid');
131
+			// Название категории
132
+			$cattitle = $this->tree[$key]['obj']->getVar('title');
133
+			// Вес
134
+			$catweight = $this->tree[$key]['obj']->getVar('weight');
135
+			// Статус
136
+			$pagestatus = $this->tree[$key]['obj']->getVar('status');
137
+
138
+			// Дочернии категории
139
+			$cat_childs = $this->getAllChild($catid);
140
+			// Число дочерних категорий
141
+			$num_childs = count($cat_childs);
142
+			// Число инструкций
143
+			$num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0;
144
+
145
+			// Действие - удаление
146
+			$act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="../assets/icons/no_delete_mini.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid='
147
+																																														   . $catid
148
+																																														   . '"><img src="../assets/icons/delete_mini.png" alt="'
149
+																																														   . _AM_INSTRUCTION_DEL
150
+																																														   . '" title="'
151
+																																														   . _AM_INSTRUCTION_DEL
152
+																																														   . '" /></a>';
153
+			// Действие - просмотр
154
+			$act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="../assets/icons/view_mini.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/icons/no_view_mini.png" alt="'
155
+																																																			 . _AM_INSTR_NOVIEWINSTR
156
+																																																			 . '" title="'
157
+																																																			 . _AM_INSTR_NOVIEWINSTR
158
+																																																			 . '" />';
159
+
160
+			$ret .= '<tr class="' . $class . '">
161 161
       <td>' . $prefix_curr . ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/index.php?cid=' . $catid . '">' . $cattitle . '</a></td>
162 162
       <td align="center" width="50">' . $catweight . '</td>
163 163
       <td align="center" width="100">' . $num_instrs . '</td>
@@ -168,20 +168,20 @@  discard block
 block discarded – undo
168 168
       </td>
169 169
     </tr>';
170 170
 
171
-            // Устанавливаем префикс
172
-            $prefix_curr .= $prefix_orig;
173
-        }
171
+			// Устанавливаем префикс
172
+			$prefix_curr .= $prefix_orig;
173
+		}
174 174
 
175
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
176
-            foreach ($this->tree[$key]['child'] as $childkey) {
177
-                $this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr);
178
-            }
179
-        }
180
-    }
175
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
176
+			foreach ($this->tree[$key]['child'] as $childkey) {
177
+				$this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr);
178
+			}
179
+		}
180
+	}
181 181
 
182
-    public function makeCatsAdmin($prefix = '-', $cidinstrids = [], $key = 0)
183
-    {
184
-        $ret = '<table width="100%" cellspacing="1" class="outer">
182
+	public function makeCatsAdmin($prefix = '-', $cidinstrids = [], $key = 0)
183
+	{
184
+		$ret = '<table width="100%" cellspacing="1" class="outer">
185 185
     <tr>
186 186
       <th align="center" colspan="4">' . _AM_INSTR_LISTALLCATS . '</th>
187 187
     </tr>
@@ -192,193 +192,193 @@  discard block
 block discarded – undo
192 192
       <td class="head" align="center" width="150">' . _AM_INSTRUCTION_ACTION . '</td>
193 193
     </tr>';
194 194
 
195
-        // Выводим все страницы
196
-        $this->_makeCatsAdminOptions($key, $ret, $prefix, $cidinstrids);
197
-
198
-        $ret .= '</table>';
199
-
200
-        return $ret;
201
-    }
202
-
203
-    // ======================================
204
-    // Список страниц на стороне пользователя
205
-    // ======================================
206
-
207
-    public function _makePagesUserTree($key, &$ret, $currpageid = 0, &$lastpageids = [], $level = 0)
208
-    {
209
-
210
-        // Сохраняем значение предыдущей страницы
211
-        //static $stat_prevpages;
212
-
213
-        if ($key > 0) {
214
-
215
-            // ID страницы
216
-            $pageid = $this->tree[$key]['obj']->getVar('pageid');
217
-            // Название страницы
218
-            $pagetitle = $this->tree[$key]['obj']->getVar('title');
219
-            // Тип страницы
220
-            $pagetype = $this->tree[$key]['obj']->getVar('type');
221
-
222
-            // Дочернии категории
223
-            $page_childs = $this->getAllChild($pageid);
224
-            // Число дочерних страниц
225
-            $num_childs = count($page_childs);
226
-
227
-            // Генерируем класс
228
-            // InstrTreeNode InstrTreeIsRoot InstrTreeExpandClosed InstrTreeIsLast
229
-            $class = [];
230
-            // Данный класс должен быть у любого узла
231
-            $class[] = 'InstrTreeNode';
232
-            // Если узел нулевого уровня, добавляем InstrTreeIsRoot
233
-            if (0 === $level) {
234
-                $class[] = 'InstrTreeIsRoot';
235
-            }
236
-            // Тип узла InstrTreeExpandClosed|InstrTreeExpandLeaf
237
-            // Если у узла нет потомков - InstrTreeExpandLeaf
238
-            if (0 == $num_childs) {
239
-                $class[] = 'InstrTreeExpandLeaf';
240
-                // Если у искомого элемента есть потомки - открываем список
241
-            } elseif ($currpageid == $pageid) {
242
-                $class[] = 'InstrTreeExpandOpen';
243
-                // Если искомый элемент есть в потомках текущего, то ставим класс InstrTreeExpandOpen
244
-            } elseif (in_array($currpageid, array_keys($page_childs))) {
245
-                $class[] = 'InstrTreeExpandOpen';
246
-                //
247
-            } else {
248
-                $class[] = 'InstrTreeExpandClosed';
249
-            }
250
-
251
-            // Данный класс нужно добавлять последнему узлу в каждом уровне
252
-
253
-            if (isset($lastpageids[$level]) && ($pageid == $lastpageids[$level])) {
254
-                $class[] = 'InstrTreeIsLast';
255
-            }
256
-
257
-            //$class[] = 'InstrTreeIsLast';
258
-
259
-            // Test
260
-            //$ret .= '<div id="' . $pageid . '">';
261
-
262
-            // Создаём запись
263
-            $ret .= '<li class="' . implode(' ', $class) . '">';
264
-            //
265
-            $ret .= '<div class="InstrTreeExpand"></div>';
266
-            //
267
-            $ret .= '<div class="InstrTreeContent">';
268
-
269
-            // Если это лист дерева
270
-            if (0 == $pagetype) {
271
-                $ret .= '<span class="InstrTreeEmptyPage">' . $pagetitle . '</span>';
272
-                //
273
-            } elseif ($currpageid == $pageid) {
274
-                $ret .= $pagetitle;
275
-                //
276
-            } else {
277
-                $ret .= '<a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext">' . $pagetitle . '</a>';
278
-            }
279
-
280
-            $ret .= '</div>';
281
-
282
-            // Если есть потомки
283
-            if ($num_childs > 0) {
284
-                $ret .= '<ul class="InstrTreeContainer">';
285
-            }
286
-
287
-            // Инкримент уровня
288
-            $level++;
289
-        }
290
-
291
-        // Рекурсия
292
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
293
-            foreach ($this->tree[$key]['child'] as $childkey) {
294
-                $this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level);
295
-            }
296
-        }
297
-
298
-        // Test
299
-        if ($key > 0) {
300
-            // Если есть потомки
301
-            if ($num_childs > 0) {
302
-                $ret .= '</ul>';
303
-            }
304
-            // Конец текущей записи
305
-            $ret .= '</li>';
306
-        }
307
-    }
308
-
309
-    // Находим предыдущую и следующую страницы.
310
-    // Находим последнии страницы на каждом уровне.
311
-    public function _makePagesUserCalc($key, $currpageid = 0, &$prevpages = [], &$nextpages = [], &$lastpageids = [], $level = 0)
312
-    {
313
-
314
-        // Сохраняем значение предыдущей страницы
315
-        static $stat_prevpages;
316
-
317
-        if ($key > 0) {
318
-            // ID страницы
319
-            $pageid = $this->tree[$key]['obj']->getVar('pageid');
320
-            // Название страницы
321
-            $pagetitle = $this->tree[$key]['obj']->getVar('title');
322
-            // Тип страницы
323
-            $pagetype = $this->tree[$key]['obj']->getVar('type');
324
-
325
-            // Если мы передали ID текущей страницы, то находить предыдудую и следующую страницы
326
-            // Не находить предыдущие и следующие для "Пустой страницы"
327
-            if ($currpageid && $pagetype) {
328
-                // Если элемент равен текущей странице
329
-                if (isset($stat_prevpages) && ($currpageid == $pageid)) {
330
-                    // Забиваем массив предыдущей страницы
331
-                    $prevpages['pageid'] = $stat_prevpages['pageid'];
332
-                    $prevpages['title']  = $stat_prevpages['title'];
333
-
334
-                    // Если предыдущий равен текущей странице
335
-                } elseif (isset($stat_prevpages) && ($currpageid == $stat_prevpages['pageid'])) {
336
-                    // Забиваем массив следующей страницы
337
-                    $nextpages['pageid'] = $pageid;
338
-                    $nextpages['title']  = $pagetitle;
339
-                }
340
-                // Заносим текущие данные в массив предыдущей страницы
341
-                $stat_prevpages['pageid'] = $pageid;
342
-                $stat_prevpages['title']  = $pagetitle;
343
-            }
344
-
345
-            // Заносим текущую страницу в массив "последних страний"
346
-            $lastpageids[$level] = $pageid;
347
-
348
-            // Инкримент уровня
349
-            $level++;
350
-        }
351
-
352
-        // Рекурсия
353
-        if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
354
-            foreach ($this->tree[$key]['child'] as $childkey) {
355
-                $this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level);
356
-            }
357
-        }
358
-    }
359
-
360
-    //
361
-
362
-    public function makePagesUser($currpageid = 0, &$prevpages = [], &$nextpages = [], $key = 0)
363
-    {
364
-
365
-        // Массив последней страницы на каждом уровне
366
-        // level => pageid
367
-        $lastpageids = [];
368
-
369
-        // Расчёт
370
-        $this->_makePagesUserCalc($key, $currpageid, $prevpages, $nextpages, $lastpageids);
371
-
372
-        $ret = '<div onclick="instr_tree_toggle(arguments[0])">
195
+		// Выводим все страницы
196
+		$this->_makeCatsAdminOptions($key, $ret, $prefix, $cidinstrids);
197
+
198
+		$ret .= '</table>';
199
+
200
+		return $ret;
201
+	}
202
+
203
+	// ======================================
204
+	// Список страниц на стороне пользователя
205
+	// ======================================
206
+
207
+	public function _makePagesUserTree($key, &$ret, $currpageid = 0, &$lastpageids = [], $level = 0)
208
+	{
209
+
210
+		// Сохраняем значение предыдущей страницы
211
+		//static $stat_prevpages;
212
+
213
+		if ($key > 0) {
214
+
215
+			// ID страницы
216
+			$pageid = $this->tree[$key]['obj']->getVar('pageid');
217
+			// Название страницы
218
+			$pagetitle = $this->tree[$key]['obj']->getVar('title');
219
+			// Тип страницы
220
+			$pagetype = $this->tree[$key]['obj']->getVar('type');
221
+
222
+			// Дочернии категории
223
+			$page_childs = $this->getAllChild($pageid);
224
+			// Число дочерних страниц
225
+			$num_childs = count($page_childs);
226
+
227
+			// Генерируем класс
228
+			// InstrTreeNode InstrTreeIsRoot InstrTreeExpandClosed InstrTreeIsLast
229
+			$class = [];
230
+			// Данный класс должен быть у любого узла
231
+			$class[] = 'InstrTreeNode';
232
+			// Если узел нулевого уровня, добавляем InstrTreeIsRoot
233
+			if (0 === $level) {
234
+				$class[] = 'InstrTreeIsRoot';
235
+			}
236
+			// Тип узла InstrTreeExpandClosed|InstrTreeExpandLeaf
237
+			// Если у узла нет потомков - InstrTreeExpandLeaf
238
+			if (0 == $num_childs) {
239
+				$class[] = 'InstrTreeExpandLeaf';
240
+				// Если у искомого элемента есть потомки - открываем список
241
+			} elseif ($currpageid == $pageid) {
242
+				$class[] = 'InstrTreeExpandOpen';
243
+				// Если искомый элемент есть в потомках текущего, то ставим класс InstrTreeExpandOpen
244
+			} elseif (in_array($currpageid, array_keys($page_childs))) {
245
+				$class[] = 'InstrTreeExpandOpen';
246
+				//
247
+			} else {
248
+				$class[] = 'InstrTreeExpandClosed';
249
+			}
250
+
251
+			// Данный класс нужно добавлять последнему узлу в каждом уровне
252
+
253
+			if (isset($lastpageids[$level]) && ($pageid == $lastpageids[$level])) {
254
+				$class[] = 'InstrTreeIsLast';
255
+			}
256
+
257
+			//$class[] = 'InstrTreeIsLast';
258
+
259
+			// Test
260
+			//$ret .= '<div id="' . $pageid . '">';
261
+
262
+			// Создаём запись
263
+			$ret .= '<li class="' . implode(' ', $class) . '">';
264
+			//
265
+			$ret .= '<div class="InstrTreeExpand"></div>';
266
+			//
267
+			$ret .= '<div class="InstrTreeContent">';
268
+
269
+			// Если это лист дерева
270
+			if (0 == $pagetype) {
271
+				$ret .= '<span class="InstrTreeEmptyPage">' . $pagetitle . '</span>';
272
+				//
273
+			} elseif ($currpageid == $pageid) {
274
+				$ret .= $pagetitle;
275
+				//
276
+			} else {
277
+				$ret .= '<a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext">' . $pagetitle . '</a>';
278
+			}
279
+
280
+			$ret .= '</div>';
281
+
282
+			// Если есть потомки
283
+			if ($num_childs > 0) {
284
+				$ret .= '<ul class="InstrTreeContainer">';
285
+			}
286
+
287
+			// Инкримент уровня
288
+			$level++;
289
+		}
290
+
291
+		// Рекурсия
292
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
293
+			foreach ($this->tree[$key]['child'] as $childkey) {
294
+				$this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level);
295
+			}
296
+		}
297
+
298
+		// Test
299
+		if ($key > 0) {
300
+			// Если есть потомки
301
+			if ($num_childs > 0) {
302
+				$ret .= '</ul>';
303
+			}
304
+			// Конец текущей записи
305
+			$ret .= '</li>';
306
+		}
307
+	}
308
+
309
+	// Находим предыдущую и следующую страницы.
310
+	// Находим последнии страницы на каждом уровне.
311
+	public function _makePagesUserCalc($key, $currpageid = 0, &$prevpages = [], &$nextpages = [], &$lastpageids = [], $level = 0)
312
+	{
313
+
314
+		// Сохраняем значение предыдущей страницы
315
+		static $stat_prevpages;
316
+
317
+		if ($key > 0) {
318
+			// ID страницы
319
+			$pageid = $this->tree[$key]['obj']->getVar('pageid');
320
+			// Название страницы
321
+			$pagetitle = $this->tree[$key]['obj']->getVar('title');
322
+			// Тип страницы
323
+			$pagetype = $this->tree[$key]['obj']->getVar('type');
324
+
325
+			// Если мы передали ID текущей страницы, то находить предыдудую и следующую страницы
326
+			// Не находить предыдущие и следующие для "Пустой страницы"
327
+			if ($currpageid && $pagetype) {
328
+				// Если элемент равен текущей странице
329
+				if (isset($stat_prevpages) && ($currpageid == $pageid)) {
330
+					// Забиваем массив предыдущей страницы
331
+					$prevpages['pageid'] = $stat_prevpages['pageid'];
332
+					$prevpages['title']  = $stat_prevpages['title'];
333
+
334
+					// Если предыдущий равен текущей странице
335
+				} elseif (isset($stat_prevpages) && ($currpageid == $stat_prevpages['pageid'])) {
336
+					// Забиваем массив следующей страницы
337
+					$nextpages['pageid'] = $pageid;
338
+					$nextpages['title']  = $pagetitle;
339
+				}
340
+				// Заносим текущие данные в массив предыдущей страницы
341
+				$stat_prevpages['pageid'] = $pageid;
342
+				$stat_prevpages['title']  = $pagetitle;
343
+			}
344
+
345
+			// Заносим текущую страницу в массив "последних страний"
346
+			$lastpageids[$level] = $pageid;
347
+
348
+			// Инкримент уровня
349
+			$level++;
350
+		}
351
+
352
+		// Рекурсия
353
+		if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
354
+			foreach ($this->tree[$key]['child'] as $childkey) {
355
+				$this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level);
356
+			}
357
+		}
358
+	}
359
+
360
+	//
361
+
362
+	public function makePagesUser($currpageid = 0, &$prevpages = [], &$nextpages = [], $key = 0)
363
+	{
364
+
365
+		// Массив последней страницы на каждом уровне
366
+		// level => pageid
367
+		$lastpageids = [];
368
+
369
+		// Расчёт
370
+		$this->_makePagesUserCalc($key, $currpageid, $prevpages, $nextpages, $lastpageids);
371
+
372
+		$ret = '<div onclick="instr_tree_toggle(arguments[0])">
373 373
 <div>' . _MD_INSTRUCTION_LISTPAGES . '</div>
374 374
 <div><ul class="InstrTreeContainer">';
375 375
 
376
-        // Генерируем дерево
377
-        $this->_makePagesUserTree($key, $ret, $currpageid, $lastpageids);
376
+		// Генерируем дерево
377
+		$this->_makePagesUserTree($key, $ret, $currpageid, $lastpageids);
378 378
 
379
-        $ret .= '</ul>
379
+		$ret .= '</ul>
380 380
 </div>';
381 381
 
382
-        return $ret;
383
-    }
382
+		return $ret;
383
+	}
384 384
 }
Please login to merge, or discard this patch.
xoops_version.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -10,62 +10,62 @@  discard block
 block discarded – undo
10 10
 $xoops_url     = parse_url(XOOPS_URL);
11 11
 
12 12
 $modversion = [
13
-    'version'             => 1.06,
14
-    'module_status'       => 'Beta 3',
15
-    'release_date'        => '2017/05/11',
16
-    'name'                => _MI_INSTRUCTION_NAME,
17
-    'description'         => _MI_INSTRUCTION_DESC,
18
-    'credits'             => 'radio-hobby.org, www.shmel.org',
19
-    'author'              => 'andrey3761, aerograf',
20
-    'nickname'            => '',
21
-    'help'                => 'page=help',
22
-    'license'             => 'GNU GPL 2.0',
23
-    'license_url'         => 'www.gnu.org/licenses/gpl-2.0.html/',
24
-    'official'            => 0,
25
-    'image'               => 'assets/images/slogo.png',
26
-    'dirname'             => $moduleDirName,
27
-    'modicons16'          => 'assets/images/icons/16',
28
-    'modicons32'          => 'assets/images/icons/32',
29
-    // О модуле
30
-    'module_website_url'  => 'radio-hobby.org',
31
-    'module_website_name' => 'radio-hobby.org',
13
+	'version'             => 1.06,
14
+	'module_status'       => 'Beta 3',
15
+	'release_date'        => '2017/05/11',
16
+	'name'                => _MI_INSTRUCTION_NAME,
17
+	'description'         => _MI_INSTRUCTION_DESC,
18
+	'credits'             => 'radio-hobby.org, www.shmel.org',
19
+	'author'              => 'andrey3761, aerograf',
20
+	'nickname'            => '',
21
+	'help'                => 'page=help',
22
+	'license'             => 'GNU GPL 2.0',
23
+	'license_url'         => 'www.gnu.org/licenses/gpl-2.0.html/',
24
+	'official'            => 0,
25
+	'image'               => 'assets/images/slogo.png',
26
+	'dirname'             => $moduleDirName,
27
+	'modicons16'          => 'assets/images/icons/16',
28
+	'modicons32'          => 'assets/images/icons/32',
29
+	// О модуле
30
+	'module_website_url'  => 'radio-hobby.org',
31
+	'module_website_name' => 'radio-hobby.org',
32 32
 
33
-    'author_website_url'  => 'radio-hobby.org',
34
-    'author_website_name' => 'andrey3761',
35
-    'module_website_url'  => 'www.xoops.org',
36
-    'module_website_name' => 'Support site',
37
-    'min_php'             => '5.5',
38
-    'min_xoops'           => '2.5.8',
39
-    'min_admin'           => '1.1',
40
-    'min_db'              => ['mysql' => '5.5'],
41
-    // Файл базы данных
42
-    'sqlfile'             => ['mysql' => 'sql/mysql.sql'],
43
-    // Таблицы
44
-    'tables'              => [
45
-        $moduleDirName . '_cat',
46
-        $moduleDirName . '_instr',
47
-        $moduleDirName . '_page'
48
-    ],
49
-    // Имеет админку
50
-    'hasAdmin'            => 1,
51
-    'adminindex'          => 'admin/index.php',
52
-    'adminmenu'           => 'admin/menu.php',
53
-    'system_menu'         => 1,
54
-    // Меню
55
-    'hasMain'             => 1,
56
-    // Search
57
-    'hasSearch'           => 1,
58
-    'search'              => [
59
-        'file' => 'include/search.inc.php',
60
-        'func' => $moduleDirName . '_search',
61
-    ],
33
+	'author_website_url'  => 'radio-hobby.org',
34
+	'author_website_name' => 'andrey3761',
35
+	'module_website_url'  => 'www.xoops.org',
36
+	'module_website_name' => 'Support site',
37
+	'min_php'             => '5.5',
38
+	'min_xoops'           => '2.5.8',
39
+	'min_admin'           => '1.1',
40
+	'min_db'              => ['mysql' => '5.5'],
41
+	// Файл базы данных
42
+	'sqlfile'             => ['mysql' => 'sql/mysql.sql'],
43
+	// Таблицы
44
+	'tables'              => [
45
+		$moduleDirName . '_cat',
46
+		$moduleDirName . '_instr',
47
+		$moduleDirName . '_page'
48
+	],
49
+	// Имеет админку
50
+	'hasAdmin'            => 1,
51
+	'adminindex'          => 'admin/index.php',
52
+	'adminmenu'           => 'admin/menu.php',
53
+	'system_menu'         => 1,
54
+	// Меню
55
+	'hasMain'             => 1,
56
+	// Search
57
+	'hasSearch'           => 1,
58
+	'search'              => [
59
+		'file' => 'include/search.inc.php',
60
+		'func' => $moduleDirName . '_search',
61
+	],
62 62
 ];
63 63
 //  Help files
64 64
 $modversion['helpsection'] = [
65
-    ['name' => _MI_INSTRUCTION_HELP_OVERVIEW, 'link' => 'page=help'],
66
-    ['name' => _MI_INSTRUCTION_DISCLAIMER, 'link' => 'page=disclaimer'],
67
-    ['name' => _MI_INSTRUCTION_LICENSE, 'link' => 'page=license'],
68
-    ['name' => _MI_INSTRUCTION_SUPPORT, 'link' => 'page=support'],
65
+	['name' => _MI_INSTRUCTION_HELP_OVERVIEW, 'link' => 'page=help'],
66
+	['name' => _MI_INSTRUCTION_DISCLAIMER, 'link' => 'page=disclaimer'],
67
+	['name' => _MI_INSTRUCTION_LICENSE, 'link' => 'page=license'],
68
+	['name' => _MI_INSTRUCTION_SUPPORT, 'link' => 'page=support'],
69 69
 ];
70 70
 
71 71
 // Comments
@@ -78,144 +78,144 @@  discard block
 block discarded – undo
78 78
 
79 79
 // Templates
80 80
 $modversion['templates'] = [
81
-    [
82
-        'file'        => 'admin/' . $moduleDirName . '_admin_index.tpl',
83
-        'description' => ''
84
-    ],
85
-    [
86
-        'file'        => 'admin/' . $moduleDirName . '_admin_cat.tpl',
87
-        'description' => ''
88
-    ],
89
-    [
90
-        'file'        => 'admin/' . $moduleDirName . '_admin_editcat.tpl',
91
-        'description' => ''
92
-    ],
93
-    [
94
-        'file'        => 'admin/' . $moduleDirName . '_admin_savecat.tpl',
95
-        'description' => ''
96
-    ],
97
-    [
98
-        'file'        => 'admin/' . $moduleDirName . '_admin_viewcat.tpl',
99
-        'description' => ''
100
-    ],
101
-    [
102
-        'file'        => 'admin/' . $moduleDirName . '_admin_instr.tpl',
103
-        'description' => ''
104
-    ],
105
-    [
106
-        'file'        => 'admin/' . $moduleDirName . '_admin_editinstr.tpl',
107
-        'description' => ''
108
-    ],
109
-    [
110
-        'file'        => 'admin/' . $moduleDirName . '_admin_saveinstr.tpl',
111
-        'description' => ''
112
-    ],
113
-    [
114
-        'file'        => 'admin/' . $moduleDirName . '_admin_viewinstr.tpl',
115
-        'description' => ''
116
-    ],
117
-    [
118
-        'file'        => 'admin/' . $moduleDirName . '_admin_editpage.tpl',
119
-        'description' => ''
120
-    ],
121
-    [
122
-        'file'        => 'admin/' . $moduleDirName . '_admin_savepage.tpl',
123
-        'description' => ''
124
-    ],
125
-    [
126
-        'file'        => 'admin/' . $moduleDirName . '_admin_perm.tpl',
127
-        'description' => ''
128
-    ],
129
-    [
130
-        'file'        => 'admin/' . $moduleDirName . '_admin_about.tpl',
131
-        'description' => ''
132
-    ],
133
-    [
134
-        'file'        => $moduleDirName . '_page.tpl',
135
-        'description' => ''
136
-    ],
137
-    [
138
-        'file'        => $moduleDirName . '_instr.tpl',
139
-        'description' => ''
140
-    ],
141
-    [
142
-        'file'        => $moduleDirName . '_index.tpl',
143
-        'description' => ''
144
-    ],
145
-    [
146
-        'file'        => $moduleDirName . '_editpage.tpl',
147
-        'description' => ''
148
-    ],
149
-    [
150
-        'file'        => $moduleDirName . '_savepage.tpl',
151
-        'description' => ''
152
-    ],
81
+	[
82
+		'file'        => 'admin/' . $moduleDirName . '_admin_index.tpl',
83
+		'description' => ''
84
+	],
85
+	[
86
+		'file'        => 'admin/' . $moduleDirName . '_admin_cat.tpl',
87
+		'description' => ''
88
+	],
89
+	[
90
+		'file'        => 'admin/' . $moduleDirName . '_admin_editcat.tpl',
91
+		'description' => ''
92
+	],
93
+	[
94
+		'file'        => 'admin/' . $moduleDirName . '_admin_savecat.tpl',
95
+		'description' => ''
96
+	],
97
+	[
98
+		'file'        => 'admin/' . $moduleDirName . '_admin_viewcat.tpl',
99
+		'description' => ''
100
+	],
101
+	[
102
+		'file'        => 'admin/' . $moduleDirName . '_admin_instr.tpl',
103
+		'description' => ''
104
+	],
105
+	[
106
+		'file'        => 'admin/' . $moduleDirName . '_admin_editinstr.tpl',
107
+		'description' => ''
108
+	],
109
+	[
110
+		'file'        => 'admin/' . $moduleDirName . '_admin_saveinstr.tpl',
111
+		'description' => ''
112
+	],
113
+	[
114
+		'file'        => 'admin/' . $moduleDirName . '_admin_viewinstr.tpl',
115
+		'description' => ''
116
+	],
117
+	[
118
+		'file'        => 'admin/' . $moduleDirName . '_admin_editpage.tpl',
119
+		'description' => ''
120
+	],
121
+	[
122
+		'file'        => 'admin/' . $moduleDirName . '_admin_savepage.tpl',
123
+		'description' => ''
124
+	],
125
+	[
126
+		'file'        => 'admin/' . $moduleDirName . '_admin_perm.tpl',
127
+		'description' => ''
128
+	],
129
+	[
130
+		'file'        => 'admin/' . $moduleDirName . '_admin_about.tpl',
131
+		'description' => ''
132
+	],
133
+	[
134
+		'file'        => $moduleDirName . '_page.tpl',
135
+		'description' => ''
136
+	],
137
+	[
138
+		'file'        => $moduleDirName . '_instr.tpl',
139
+		'description' => ''
140
+	],
141
+	[
142
+		'file'        => $moduleDirName . '_index.tpl',
143
+		'description' => ''
144
+	],
145
+	[
146
+		'file'        => $moduleDirName . '_editpage.tpl',
147
+		'description' => ''
148
+	],
149
+	[
150
+		'file'        => $moduleDirName . '_savepage.tpl',
151
+		'description' => ''
152
+	],
153 153
 ];
154 154
 // Конфигурация
155 155
 $modversion['config'][] = [
156
-    'name'        => 'form_options',
157
-    'title'       => '_MI_INSTRUCTION_FORM_OPTIONS',
158
-    'description' => '_MI_INSTRUCTION_FORM_OPTIONS_DESC',
159
-    'formtype'    => 'select',
160
-    'valuetype'   => 'text',
161
-    'default'     => 'dhtml',
162
-    'options'     => array_flip($editorHandler->getList())
156
+	'name'        => 'form_options',
157
+	'title'       => '_MI_INSTRUCTION_FORM_OPTIONS',
158
+	'description' => '_MI_INSTRUCTION_FORM_OPTIONS_DESC',
159
+	'formtype'    => 'select',
160
+	'valuetype'   => 'text',
161
+	'default'     => 'dhtml',
162
+	'options'     => array_flip($editorHandler->getList())
163 163
 ];
164 164
 $modversion['config'][] = [
165
-    'name'        => 'perpageadmin',
166
-    'title'       => '_MI_INSTRUCTION_PERPAGEADMIN',
167
-    'description' => '_MI_INSTRUCTION_PERPAGEADMINDSC',
168
-    'formtype'    => 'textbox',
169
-    'valuetype'   => 'int',
170
-    'default'     => 20
165
+	'name'        => 'perpageadmin',
166
+	'title'       => '_MI_INSTRUCTION_PERPAGEADMIN',
167
+	'description' => '_MI_INSTRUCTION_PERPAGEADMINDSC',
168
+	'formtype'    => 'textbox',
169
+	'valuetype'   => 'int',
170
+	'default'     => 20
171 171
 ];
172 172
 $modversion['config'][] = [
173
-    'name'        => 'perpagemain',
174
-    'title'       => '_MI_INSTRUCTION_PERPAGEMAIN',
175
-    'description' => '_MI_INSTRUCTION_PERPAGEMAINDSC',
176
-    'formtype'    => 'textbox',
177
-    'valuetype'   => 'int',
178
-    'default'     => 20
173
+	'name'        => 'perpagemain',
174
+	'title'       => '_MI_INSTRUCTION_PERPAGEMAIN',
175
+	'description' => '_MI_INSTRUCTION_PERPAGEMAINDSC',
176
+	'formtype'    => 'textbox',
177
+	'valuetype'   => 'int',
178
+	'default'     => 20
179 179
 ];
180 180
 // Теги
181 181
 $modversion['config'][] = [
182
-    'name'        => 'usetag',
183
-    'title'       => '_MI_INSTRUCTION_USETAG',
184
-    'description' => '_MI_INSTRUCTION_USETAGDSC',
185
-    'formtype'    => 'yesno',
186
-    'valuetype'   => 'int',
187
-    'default'     => 0
182
+	'name'        => 'usetag',
183
+	'title'       => '_MI_INSTRUCTION_USETAG',
184
+	'description' => '_MI_INSTRUCTION_USETAGDSC',
185
+	'formtype'    => 'yesno',
186
+	'valuetype'   => 'int',
187
+	'default'     => 0
188 188
 ];
189 189
 // Оценки
190 190
 $modversion['config'][] = [
191
-    'name'        => 'userat',
192
-    'title'       => '_MI_INSTRUCTION_USERAT',
193
-    'description' => '_MI_INSTRUCTION_USERATDSC',
194
-    'formtype'    => 'yesno',
195
-    'valuetype'   => 'int',
196
-    'default'     => 0
191
+	'name'        => 'userat',
192
+	'title'       => '_MI_INSTRUCTION_USERAT',
193
+	'description' => '_MI_INSTRUCTION_USERATDSC',
194
+	'formtype'    => 'yesno',
195
+	'valuetype'   => 'int',
196
+	'default'     => 0
197 197
 ];
198 198
 
199 199
 // Блоки
200 200
 // Блок последних страниц
201 201
 $modversion['blocks'][] = [
202
-    'file'        => 'instr_lastpage.php',
203
-    'name'        => _MI_INSTR_BLOCK_LASTPAGE,
204
-    'description' => _MI_INSTR_BLOCK_LASTPAGE_DESC,
205
-    'show_func'   => 'b_instr_lastpage_show',
206
-    'edit_func'   => 'b_instr_lastpage_edit',
207
-    'options'     => '10|20',
208
-    'template'    => $moduleDirName . '_block_lastpage.tpl'
202
+	'file'        => 'instr_lastpage.php',
203
+	'name'        => _MI_INSTR_BLOCK_LASTPAGE,
204
+	'description' => _MI_INSTR_BLOCK_LASTPAGE_DESC,
205
+	'show_func'   => 'b_instr_lastpage_show',
206
+	'edit_func'   => 'b_instr_lastpage_edit',
207
+	'options'     => '10|20',
208
+	'template'    => $moduleDirName . '_block_lastpage.tpl'
209 209
 ];
210 210
 // Блок последних инструкций
211 211
 $modversion['blocks'][] = [
212
-    'file'        => 'instr_lastinstr.php',
213
-    'name'        => _MI_INSTR_BLOCK_LASTINSTR,
214
-    'description' => _MI_INSTR_BLOCK_LASTINSTR_DESC,
215
-    'show_func'   => 'b_instr_lastinstr_show',
216
-    'edit_func'   => 'b_instr_lastinstr_edit',
217
-    'options'     => '10|20',
218
-    'template'    => $moduleDirName . '_block_lastinstr.tpl'
212
+	'file'        => 'instr_lastinstr.php',
213
+	'name'        => _MI_INSTR_BLOCK_LASTINSTR,
214
+	'description' => _MI_INSTR_BLOCK_LASTINSTR_DESC,
215
+	'show_func'   => 'b_instr_lastinstr_show',
216
+	'edit_func'   => 'b_instr_lastinstr_edit',
217
+	'options'     => '10|20',
218
+	'template'    => $moduleDirName . '_block_lastinstr.tpl'
219 219
 ];
220 220
 
221 221
 // Notification
Please login to merge, or discard this patch.