@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $moduleDirName = basename(dirname(__DIR__)); |
| 23 | 23 | $capsDirName = strtoupper($moduleDirName); |
| 24 | 24 | |
| 25 | -if (!defined($capsDirName . '_DIRNAME')) { |
|
| 25 | +if ( ! defined($capsDirName . '_DIRNAME')) { |
|
| 26 | 26 | //if (!defined(constant($capsDirName . '_DIRNAME'))) { |
| 27 | 27 | define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); |
| 28 | 28 | define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | //Configurator |
| 38 | -return (object)[ |
|
| 38 | +return (object) [ |
|
| 39 | 39 | 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
| 40 | 40 | 'paths' => [ |
| 41 | 41 | 'dirname' => $moduleDirName, |
@@ -23,57 +23,57 @@ |
||
| 23 | 23 | $capsDirName = strtoupper($moduleDirName); |
| 24 | 24 | |
| 25 | 25 | if (!defined($capsDirName . '_DIRNAME')) { |
| 26 | - //if (!defined(constant($capsDirName . '_DIRNAME'))) { |
|
| 27 | - define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); |
|
| 28 | - define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
| 29 | - define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
| 30 | - define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); |
|
| 31 | - define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
| 32 | - define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); |
|
| 33 | - define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
| 34 | - define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
| 26 | + //if (!defined(constant($capsDirName . '_DIRNAME'))) { |
|
| 27 | + define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); |
|
| 28 | + define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
| 29 | + define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
| 30 | + define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); |
|
| 31 | + define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); |
|
| 32 | + define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); |
|
| 33 | + define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
| 34 | + define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | //Configurator |
| 38 | 38 | return (object)[ |
| 39 | - 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
|
| 40 | - 'paths' => [ |
|
| 41 | - 'dirname' => $moduleDirName, |
|
| 42 | - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
| 43 | - // 'path' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
| 44 | - // 'url' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
| 45 | - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 46 | - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
| 47 | - ], |
|
| 48 | - 'uploadFolders' => [ |
|
| 49 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
| 50 | - //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
| 51 | - //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
| 52 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
| 53 | - ], |
|
| 54 | - 'blankFiles' => [ |
|
| 55 | - constant($capsDirName . '_UPLOAD_PATH'), |
|
| 56 | - //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
| 57 | - //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
| 58 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
| 59 | - ], |
|
| 39 | + 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
|
| 40 | + 'paths' => [ |
|
| 41 | + 'dirname' => $moduleDirName, |
|
| 42 | + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
| 43 | + // 'path' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
| 44 | + // 'url' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
| 45 | + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 46 | + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
| 47 | + ], |
|
| 48 | + 'uploadFolders' => [ |
|
| 49 | + constant($capsDirName . '_UPLOAD_PATH'), |
|
| 50 | + //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
| 51 | + //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
| 52 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
| 53 | + ], |
|
| 54 | + 'blankFiles' => [ |
|
| 55 | + constant($capsDirName . '_UPLOAD_PATH'), |
|
| 56 | + //constant($capsDirName . '_UPLOAD_PATH') . '/category', |
|
| 57 | + //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', |
|
| 58 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
| 59 | + ], |
|
| 60 | 60 | |
| 61 | - 'templateFolders' => [ |
|
| 62 | - '/templates/', |
|
| 63 | - '/templates/blocks/', |
|
| 64 | - '/templates/admin/' |
|
| 61 | + 'templateFolders' => [ |
|
| 62 | + '/templates/', |
|
| 63 | + '/templates/blocks/', |
|
| 64 | + '/templates/admin/' |
|
| 65 | 65 | |
| 66 | - ], |
|
| 67 | - 'oldFiles' => [// '/sql/mysql.sql', |
|
| 68 | - ], |
|
| 69 | - 'oldFolders' => [ |
|
| 70 | - '/images', |
|
| 71 | - '/css', |
|
| 72 | - '/js', |
|
| 73 | - '/tree', |
|
| 74 | - '/images/icons/16', |
|
| 75 | - '/images/icons/32', |
|
| 76 | - ], |
|
| 77 | - 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
| 66 | + ], |
|
| 67 | + 'oldFiles' => [// '/sql/mysql.sql', |
|
| 68 | + ], |
|
| 69 | + 'oldFolders' => [ |
|
| 70 | + '/images', |
|
| 71 | + '/css', |
|
| 72 | + '/js', |
|
| 73 | + '/tree', |
|
| 74 | + '/images/icons/16', |
|
| 75 | + '/images/icons/32', |
|
| 76 | + ], |
|
| 77 | + 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
| 78 | 78 | <img src='" . $capsDirName . '_AUTHOR_LOGOIMG' . '\' alt=\'XOOPS Project\' /></a>', |
| 79 | 79 | ]; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // Типы страницы |
| 3 | 3 | return [ |
| 4 | - 0 => _AM_INSTR_PT_0, |
|
| 5 | - 1 => _AM_INSTR_PT_1 |
|
| 4 | + 0 => _AM_INSTR_PT_0, |
|
| 5 | + 1 => _AM_INSTR_PT_1 |
|
| 6 | 6 | ]; |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | . " FROM {$itemHandler->table} " |
| 53 | 53 | . " WHERE {$itemHandler->table}.status > 0" |
| 54 | 54 | . ' ) ' |
| 55 | - . ' )'; else: |
|
| 55 | + . ' )'; else {
|
|
| 56 | + : |
|
| 56 | 57 | $sql = " DELETE {$linkHandler->table} FROM {$linkHandler->table}" |
| 57 | 58 | . " LEFT JOIN {$itemHandler->table} AS aa ON {$linkHandler->table}.tag_itemid = aa.{$itemHandler->keyName} " |
| 58 | 59 | . ' WHERE ' |
@@ -60,7 +61,8 @@ discard block |
||
| 60 | 61 | . ' AND ' |
| 61 | 62 | . " ( aa.{$itemHandler->keyName} IS NULL" |
| 62 | 63 | . ' OR aa.status < 1' |
| 63 | - . ' )'; |
|
| 64 | + . ' )'; |
|
| 65 | + } |
|
| 64 | 66 | endif; |
| 65 | 67 | if (!$result = $linkHandler->db->queryF($sql)) { |
| 66 | 68 | //xoops_error($linkHandler->db->error()); |
@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | function instruction_tag_iteminfo(&$items) |
| 9 | 9 | { |
| 10 | - if (empty($items) || !is_array($items)) { |
|
| 10 | + if (empty($items) || ! is_array($items)) { |
|
| 11 | 11 | return false; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $items_id = []; |
| 15 | 15 | foreach (array_keys($items) as $cat_id) { |
| 16 | 16 | foreach (array_keys($items[$cat_id]) as $item_id) { |
| 17 | - $items_id[] = (int)$item_id; |
|
| 17 | + $items_id[] = (int) $item_id; |
|
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | . ' OR aa.status < 1' |
| 71 | 71 | . ' )'; |
| 72 | 72 | endif; |
| 73 | - if (!$result = $linkHandler->db->queryF($sql)) { |
|
| 73 | + if ( ! $result = $linkHandler->db->queryF($sql)) { |
|
| 74 | 74 | //xoops_error($linkHandler->db->error()); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -7,37 +7,37 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | function instruction_tag_iteminfo(&$items) |
| 9 | 9 | { |
| 10 | - if (empty($items) || !is_array($items)) { |
|
| 11 | - return false; |
|
| 12 | - } |
|
| 10 | + if (empty($items) || !is_array($items)) { |
|
| 11 | + return false; |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - $items_id = []; |
|
| 15 | - foreach (array_keys($items) as $cat_id) { |
|
| 16 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
| 17 | - $items_id[] = (int)$item_id; |
|
| 18 | - } |
|
| 19 | - } |
|
| 14 | + $items_id = []; |
|
| 15 | + foreach (array_keys($items) as $cat_id) { |
|
| 16 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
| 17 | + $items_id[] = (int)$item_id; |
|
| 18 | + } |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
| 22 | - $items_obj = $itemHandler->getObjects(new \Criteria('instrid', '(' . implode(', ', $items_id) . ')', 'IN'), true); |
|
| 21 | + $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
| 22 | + $items_obj = $itemHandler->getObjects(new \Criteria('instrid', '(' . implode(', ', $items_id) . ')', 'IN'), true); |
|
| 23 | 23 | |
| 24 | - foreach (array_keys($items) as $cat_id) { |
|
| 25 | - foreach (array_keys($items[$cat_id]) as $item_id) { |
|
| 26 | - if (isset($items_obj[$item_id])) { |
|
| 27 | - $item_obj = $items_obj[$item_id]; |
|
| 28 | - $items[$cat_id][$item_id] = [ |
|
| 29 | - 'title' => $item_obj->getVar('title'), |
|
| 30 | - 'uid' => $item_obj->getVar('uid'), |
|
| 31 | - 'link' => "instr.php?id={$item_id}", |
|
| 32 | - 'time' => $item_obj->getVar('datecreated'), |
|
| 33 | - 'tags' => '', |
|
| 34 | - 'content' => '', |
|
| 35 | - ]; |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - unset($items_obj); |
|
| 40 | - return ''; |
|
| 24 | + foreach (array_keys($items) as $cat_id) { |
|
| 25 | + foreach (array_keys($items[$cat_id]) as $item_id) { |
|
| 26 | + if (isset($items_obj[$item_id])) { |
|
| 27 | + $item_obj = $items_obj[$item_id]; |
|
| 28 | + $items[$cat_id][$item_id] = [ |
|
| 29 | + 'title' => $item_obj->getVar('title'), |
|
| 30 | + 'uid' => $item_obj->getVar('uid'), |
|
| 31 | + 'link' => "instr.php?id={$item_id}", |
|
| 32 | + 'time' => $item_obj->getVar('datecreated'), |
|
| 33 | + 'tags' => '', |
|
| 34 | + 'content' => '', |
|
| 35 | + ]; |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + unset($items_obj); |
|
| 40 | + return ''; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // Синхронизация тегов |
@@ -46,31 +46,31 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function instruction_tag_synchronization($mid) |
| 48 | 48 | { |
| 49 | - $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
| 50 | - $linkHandler = xoops_getModuleHandler('link', 'tag'); |
|
| 49 | + $itemHandler = xoops_getModuleHandler('instruction', 'instruction'); |
|
| 50 | + $linkHandler = xoops_getModuleHandler('link', 'tag'); |
|
| 51 | 51 | |
| 52 | - /* clear tag-item links */ |
|
| 53 | - if (version_compare($GLOBALS['xoopsDB']->getServerVersion(), '4.1.0', 'ge')): |
|
| 54 | - $sql = " DELETE FROM {$linkHandler->table}" |
|
| 55 | - . ' WHERE ' |
|
| 56 | - . " tag_modid = {$mid}" |
|
| 57 | - . ' AND ' |
|
| 58 | - . ' ( tag_itemid NOT IN ' |
|
| 59 | - . " ( SELECT DISTINCT {$itemHandler->keyName} " |
|
| 60 | - . " FROM {$itemHandler->table} " |
|
| 61 | - . " WHERE {$itemHandler->table}.status > 0" |
|
| 62 | - . ' ) ' |
|
| 63 | - . ' )'; else: |
|
| 64 | - $sql = " DELETE {$linkHandler->table} FROM {$linkHandler->table}" |
|
| 65 | - . " LEFT JOIN {$itemHandler->table} AS aa ON {$linkHandler->table}.tag_itemid = aa.{$itemHandler->keyName} " |
|
| 66 | - . ' WHERE ' |
|
| 67 | - . " tag_modid = {$mid}" |
|
| 68 | - . ' AND ' |
|
| 69 | - . " ( aa.{$itemHandler->keyName} IS NULL" |
|
| 70 | - . ' OR aa.status < 1' |
|
| 71 | - . ' )'; |
|
| 72 | - endif; |
|
| 73 | - if (!$result = $linkHandler->db->queryF($sql)) { |
|
| 74 | - //xoops_error($linkHandler->db->error()); |
|
| 75 | - } |
|
| 52 | + /* clear tag-item links */ |
|
| 53 | + if (version_compare($GLOBALS['xoopsDB']->getServerVersion(), '4.1.0', 'ge')): |
|
| 54 | + $sql = " DELETE FROM {$linkHandler->table}" |
|
| 55 | + . ' WHERE ' |
|
| 56 | + . " tag_modid = {$mid}" |
|
| 57 | + . ' AND ' |
|
| 58 | + . ' ( tag_itemid NOT IN ' |
|
| 59 | + . " ( SELECT DISTINCT {$itemHandler->keyName} " |
|
| 60 | + . " FROM {$itemHandler->table} " |
|
| 61 | + . " WHERE {$itemHandler->table}.status > 0" |
|
| 62 | + . ' ) ' |
|
| 63 | + . ' )'; else: |
|
| 64 | + $sql = " DELETE {$linkHandler->table} FROM {$linkHandler->table}" |
|
| 65 | + . " LEFT JOIN {$itemHandler->table} AS aa ON {$linkHandler->table}.tag_itemid = aa.{$itemHandler->keyName} " |
|
| 66 | + . ' WHERE ' |
|
| 67 | + . " tag_modid = {$mid}" |
|
| 68 | + . ' AND ' |
|
| 69 | + . " ( aa.{$itemHandler->keyName} IS NULL" |
|
| 70 | + . ' OR aa.status < 1' |
|
| 71 | + . ' )'; |
|
| 72 | + endif; |
|
| 73 | + if (!$result = $linkHandler->db->queryF($sql)) { |
|
| 74 | + //xoops_error($linkHandler->db->error()); |
|
| 75 | + } |
|
| 76 | 76 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0'; |
| 11 | 11 | if (0 != $userid) { |
| 12 | - $sql .= ' AND p.uid = ' . (int)$userid . ' '; |
|
| 12 | + $sql .= ' AND p.uid = ' . (int) $userid . ' '; |
|
| 13 | 13 | //return NULL; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -13,46 +13,46 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | function instruction_search($queryarray, $andor, $limit, $offset, $userid) |
| 15 | 15 | { |
| 16 | - // Подключаем функции |
|
| 17 | - $moduleDirName = basename(dirname(__DIR__)); |
|
| 18 | - include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php'); |
|
| 16 | + // Подключаем функции |
|
| 17 | + $moduleDirName = basename(dirname(__DIR__)); |
|
| 18 | + include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php'); |
|
| 19 | 19 | |
| 20 | - $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0'; |
|
| 21 | - if (0 != $userid) { |
|
| 22 | - $sql .= ' AND p.uid = ' . (int)$userid . ' '; |
|
| 23 | - //return NULL; |
|
| 24 | - } |
|
| 20 | + $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0'; |
|
| 21 | + if (0 != $userid) { |
|
| 22 | + $sql .= ' AND p.uid = ' . (int)$userid . ' '; |
|
| 23 | + //return NULL; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - // Права на просмотр |
|
| 27 | - $categories = Xoopsmodules\instruction\Utility::getItemIds(); |
|
| 28 | - if (is_array($categories) && count($categories) > 0) { |
|
| 29 | - $sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) '; |
|
| 30 | - // Если пользователь не имеет прав просмотра ни одной категории |
|
| 31 | - } else { |
|
| 32 | - return null; |
|
| 33 | - } |
|
| 26 | + // Права на просмотр |
|
| 27 | + $categories = Xoopsmodules\instruction\Utility::getItemIds(); |
|
| 28 | + if (is_array($categories) && count($categories) > 0) { |
|
| 29 | + $sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) '; |
|
| 30 | + // Если пользователь не имеет прав просмотра ни одной категории |
|
| 31 | + } else { |
|
| 32 | + return null; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - // Добавляем в условие ключевые слова поиска |
|
| 36 | - if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 37 | - $sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )"; |
|
| 38 | - for ($i = 1; $i < $count; $i++) { |
|
| 39 | - $sql .= " $andor "; |
|
| 40 | - $sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )"; |
|
| 41 | - } |
|
| 42 | - $sql .= ' ) '; |
|
| 43 | - } |
|
| 44 | - //$sql .= "ORDER BY date DESC"; |
|
| 45 | - $result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset); |
|
| 46 | - $ret = []; |
|
| 47 | - $i = 0; |
|
| 48 | - // Перебираем все результаты |
|
| 49 | - while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) { |
|
| 50 | - $ret[$i]['image'] = 'assets/images/size2.gif'; |
|
| 51 | - $ret[$i]['link'] = 'page.php?id=' . $pageid; |
|
| 52 | - $ret[$i]['title'] = $ititle . ': ' . $ptitle; |
|
| 53 | - $ret[$i]['time'] = $pdatecreated; |
|
| 54 | - $ret[$i]['uid'] = $puid; |
|
| 55 | - $i++; |
|
| 56 | - } |
|
| 57 | - return $ret; |
|
| 35 | + // Добавляем в условие ключевые слова поиска |
|
| 36 | + if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 37 | + $sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )"; |
|
| 38 | + for ($i = 1; $i < $count; $i++) { |
|
| 39 | + $sql .= " $andor "; |
|
| 40 | + $sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )"; |
|
| 41 | + } |
|
| 42 | + $sql .= ' ) '; |
|
| 43 | + } |
|
| 44 | + //$sql .= "ORDER BY date DESC"; |
|
| 45 | + $result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset); |
|
| 46 | + $ret = []; |
|
| 47 | + $i = 0; |
|
| 48 | + // Перебираем все результаты |
|
| 49 | + while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) { |
|
| 50 | + $ret[$i]['image'] = 'assets/images/size2.gif'; |
|
| 51 | + $ret[$i]['link'] = 'page.php?id=' . $pageid; |
|
| 52 | + $ret[$i]['title'] = $ititle . ': ' . $ptitle; |
|
| 53 | + $ret[$i]['time'] = $pdatecreated; |
|
| 54 | + $ret[$i]['uid'] = $puid; |
|
| 55 | + $i++; |
|
| 56 | + } |
|
| 57 | + return $ret; |
|
| 58 | 58 | } |
@@ -7,12 +7,12 @@ |
||
| 7 | 7 | |
| 8 | 8 | $com_itemid = Request::getInt('com_itemid', 0, 'GET'); |
| 9 | 9 | if ($com_itemid > 0) { |
| 10 | - $itemObj = $publisher->getHandler('item')->get($com_itemid); |
|
| 11 | - $com_replytext = _POSTEDBY . ' <strong>' . $itemObj->getLinkedPosterName() . '</strong> ' . _DATE . ' <strong>' . $itemObj->dateSub() . '</strong><br><br>' . $itemObj->summary(); |
|
| 12 | - $bodytext = $itemObj->body(); |
|
| 13 | - if ('' != $bodytext) { |
|
| 14 | - $com_replytext .= '<br><br>' . $bodytext . ''; |
|
| 15 | - } |
|
| 16 | - $com_replytitle = $itemObj->getTitle(); |
|
| 17 | - include_once $GLOBALS['xoops']->path('include/comment_new.php'); |
|
| 10 | + $itemObj = $publisher->getHandler('item')->get($com_itemid); |
|
| 11 | + $com_replytext = _POSTEDBY . ' <strong>' . $itemObj->getLinkedPosterName() . '</strong> ' . _DATE . ' <strong>' . $itemObj->dateSub() . '</strong><br><br>' . $itemObj->summary(); |
|
| 12 | + $bodytext = $itemObj->body(); |
|
| 13 | + if ('' != $bodytext) { |
|
| 14 | + $com_replytext .= '<br><br>' . $bodytext . ''; |
|
| 15 | + } |
|
| 16 | + $com_replytitle = $itemObj->getTitle(); |
|
| 17 | + include_once $GLOBALS['xoops']->path('include/comment_new.php'); |
|
| 18 | 18 | } |
@@ -36,24 +36,24 @@ discard block |
||
| 36 | 36 | $moduleId = $GLOBALS['xoopsModule']->getVar('mid'); |
| 37 | 37 | |
| 38 | 38 | switch ($permission) { |
| 39 | - // Права на просмотр |
|
| 40 | - case 1: |
|
| 41 | - $formTitle = _AM_INSTRUCTION_PERM_VIEW; |
|
| 42 | - $permissionName = 'instruction_view'; |
|
| 43 | - $permissionDescription = _AM_INSTRUCTION_PERM_VIEW_DSC; |
|
| 44 | - break; |
|
| 45 | - // Права на добавление |
|
| 46 | - case 2: |
|
| 47 | - $formTitle = _AM_INSTRUCTION_PERM_SUBMIT; |
|
| 48 | - $permissionName = 'instruction_submit'; |
|
| 49 | - $permissionDescription = _AM_INSTRUCTION_PERM_SUBMIT_DSC; |
|
| 50 | - break; |
|
| 51 | - // Права на редактирование |
|
| 52 | - case 3: |
|
| 53 | - $formTitle = _AM_INSTRUCTION_PERM_EDIT; |
|
| 54 | - $permissionName = 'instruction_edit'; |
|
| 55 | - $permissionDescription = _AM_INSTRUCTION_PERM_EDIT_DSC; |
|
| 56 | - break; |
|
| 39 | + // Права на просмотр |
|
| 40 | + case 1: |
|
| 41 | + $formTitle = _AM_INSTRUCTION_PERM_VIEW; |
|
| 42 | + $permissionName = 'instruction_view'; |
|
| 43 | + $permissionDescription = _AM_INSTRUCTION_PERM_VIEW_DSC; |
|
| 44 | + break; |
|
| 45 | + // Права на добавление |
|
| 46 | + case 2: |
|
| 47 | + $formTitle = _AM_INSTRUCTION_PERM_SUBMIT; |
|
| 48 | + $permissionName = 'instruction_submit'; |
|
| 49 | + $permissionDescription = _AM_INSTRUCTION_PERM_SUBMIT_DSC; |
|
| 50 | + break; |
|
| 51 | + // Права на редактирование |
|
| 52 | + case 3: |
|
| 53 | + $formTitle = _AM_INSTRUCTION_PERM_EDIT; |
|
| 54 | + $permissionName = 'instruction_edit'; |
|
| 55 | + $permissionDescription = _AM_INSTRUCTION_PERM_EDIT_DSC; |
|
| 56 | + break; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Права |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | $sql = 'SELECT cid, pid, title FROM ' . $xoopsDB->prefix('instruction_cat') . ' ORDER BY title'; |
| 63 | 63 | $result = $xoopsDB->query($sql); |
| 64 | 64 | if ($result) { |
| 65 | - while ($row = $xoopsDB->fetchArray($result)) { |
|
| 66 | - $permissionsForm->addItem($row['cid'], $row['title'], $row['pid']); |
|
| 67 | - } |
|
| 65 | + while ($row = $xoopsDB->fetchArray($result)) { |
|
| 66 | + $permissionsForm->addItem($row['cid'], $row['title'], $row['pid']); |
|
| 67 | + } |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | echo $permissionsForm->render(); |
@@ -1,7 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use Xoopsmodules\instruction; |
|
| 4 | - |
|
| 5 | 3 | // Автор: andrey3761 |
| 6 | 4 | $moduleDirName = basename(dirname(__DIR__)); |
| 7 | 5 | require_once __DIR__ . '/../../../include/cp_header.php'; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | //if (($GLOBALS['xoopsUser'] instanceof \XoopsUser)) { |
| 14 | 14 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
| 15 | - if (!$helper->isUserAdmin()) { |
|
| 15 | + if ( ! $helper->isUserAdmin()) { |
|
| 16 | 16 | $helper->redirect(XOOPS_URL . '/', 3, _NOPERM); |
| 17 | 17 | } |
| 18 | 18 | } else { |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** @var Xmf\Module\Admin $adminObject */ |
| 23 | 23 | $adminObject = \Xmf\Module\Admin::getInstance(); |
| 24 | 24 | |
| 25 | -if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
|
| 25 | +if ( ! isset($GLOBALS['xoopsTpl']) || ! ($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
|
| 26 | 26 | require_once $GLOBALS['xoops']->path('class/template.php'); |
| 27 | 27 | $xoopsTpl = new \XoopsTpl(); |
| 28 | 28 | } |
@@ -12,19 +12,19 @@ |
||
| 12 | 12 | |
| 13 | 13 | //if (($GLOBALS['xoopsUser'] instanceof \XoopsUser)) { |
| 14 | 14 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
| 15 | - if (!$helper->isUserAdmin()) { |
|
| 16 | - $helper->redirect(XOOPS_URL . '/', 3, _NOPERM); |
|
| 17 | - } |
|
| 15 | + if (!$helper->isUserAdmin()) { |
|
| 16 | + $helper->redirect(XOOPS_URL . '/', 3, _NOPERM); |
|
| 17 | + } |
|
| 18 | 18 | } else { |
| 19 | - $helper->redirect(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
| 19 | + $helper->redirect(XOOPS_URL . '/user.php', 1, _NOPERM); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** @var Xmf\Module\Admin $adminObject */ |
| 23 | 23 | $adminObject = \Xmf\Module\Admin::getInstance(); |
| 24 | 24 | |
| 25 | 25 | if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { |
| 26 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 27 | - $xoopsTpl = new \XoopsTpl(); |
|
| 26 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
| 27 | + $xoopsTpl = new \XoopsTpl(); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | // } |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * @param $key |
|
| 27 | - * @param $ret |
|
| 28 | - * @param $prefix_orig |
|
| 26 | + * @param integer $key |
|
| 27 | + * @param string $ret |
|
| 28 | + * @param string $prefix_orig |
|
| 29 | 29 | * @param $objInsinstr |
| 30 | 30 | * @param string $class |
| 31 | 31 | * @param string $prefix_curr |
@@ -140,9 +140,9 @@ discard block |
||
| 140 | 140 | // ================================== |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * @param $key |
|
| 144 | - * @param $ret |
|
| 145 | - * @param $prefix_orig |
|
| 143 | + * @param integer $key |
|
| 144 | + * @param string $ret |
|
| 145 | + * @param string $prefix_orig |
|
| 146 | 146 | * @param array $cidinstrids |
| 147 | 147 | * @param string $class |
| 148 | 148 | * @param string $prefix_curr |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | // ====================================== |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | - * @param $key |
|
| 243 | - * @param $ret |
|
| 242 | + * @param integer $key |
|
| 243 | + * @param string $ret |
|
| 244 | 244 | * @param int $currpageid |
| 245 | 245 | * @param array $lastpageids |
| 246 | 246 | * @param int $level |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | // Находим предыдущую и следующую страницы. |
| 351 | 351 | // Находим последнии страницы на каждом уровне. |
| 352 | 352 | /** |
| 353 | - * @param $key |
|
| 353 | + * @param integer $key |
|
| 354 | 354 | * @param int $currpageid |
| 355 | 355 | * @param array $prevpages |
| 356 | 356 | * @param array $nextpages |
@@ -18,97 +18,97 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | class Tree extends \XoopsObjectTree |
| 20 | 20 | { |
| 21 | - // public function __construct() |
|
| 22 | - // { |
|
| 23 | - // } |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @param $key |
|
| 27 | - * @param $ret |
|
| 28 | - * @param $prefix_orig |
|
| 29 | - * @param $objInsinstr |
|
| 30 | - * @param string $class |
|
| 31 | - * @param string $prefix_curr |
|
| 32 | - */ |
|
| 33 | - public function _makePagesAdminOptions($key, &$ret, $prefix_orig, $objInsinstr, $class = 'odd', $prefix_curr = '') |
|
| 34 | - { |
|
| 35 | - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 36 | - if ($key > 0) { |
|
| 37 | - |
|
| 38 | - // |
|
| 39 | - $class = ('even' === $class) ? 'odd' : 'even'; |
|
| 40 | - // ID инструкции ( Можно сделать статической ) |
|
| 41 | - $instrid = $objInsinstr->getVar('instrid'); |
|
| 42 | - |
|
| 43 | - // ID страницы |
|
| 44 | - $pageid = $this->tree[$key]['obj']->getVar('pageid'); |
|
| 45 | - // Название страницы |
|
| 46 | - $pagetitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 47 | - // Вес |
|
| 48 | - $pageweight = $this->tree[$key]['obj']->getVar('weight'); |
|
| 49 | - // Статус |
|
| 50 | - $pagestatus = $this->tree[$key]['obj']->getVar('status'); |
|
| 51 | - // Тип страницы |
|
| 52 | - $pagetype = $this->tree[$key]['obj']->getVar('type'); |
|
| 53 | - |
|
| 54 | - // Дочернии страницы |
|
| 55 | - $page_childs = $this->getAllChild($pageid); |
|
| 56 | - // Число дочерних страниц |
|
| 57 | - $num_childs = count($page_childs); |
|
| 58 | - |
|
| 59 | - // Действие - удаление |
|
| 60 | - $act_del = ($num_childs > 0) ? '<img src="../assets/images/icons/16/application_key.png" alt="' . _AM_INSTR_NODELPAGE . '" title="' . _AM_INSTR_NODELPAGE . '" />' : '<a href="instr.php?op=delpage&pageid=' |
|
| 61 | - . $pageid |
|
| 62 | - . '"><img src="'. $pathIcon16 . '/delete.png" alt="' |
|
| 63 | - . _AM_INSTRUCTION_DEL |
|
| 64 | - . '" title="' |
|
| 65 | - . _AM_INSTRUCTION_DEL |
|
| 66 | - . '"></a>'; |
|
| 67 | - // |
|
| 68 | - $page_link = '<a name="pageid_' . $pageid . '" ' . ($pagetype ? 'href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext"' : '') . '>' . $pagetitle . '</a>'; |
|
| 69 | - |
|
| 70 | - $ret .= '<tr class="' . $class . '"> |
|
| 21 | + // public function __construct() |
|
| 22 | + // { |
|
| 23 | + // } |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @param $key |
|
| 27 | + * @param $ret |
|
| 28 | + * @param $prefix_orig |
|
| 29 | + * @param $objInsinstr |
|
| 30 | + * @param string $class |
|
| 31 | + * @param string $prefix_curr |
|
| 32 | + */ |
|
| 33 | + public function _makePagesAdminOptions($key, &$ret, $prefix_orig, $objInsinstr, $class = 'odd', $prefix_curr = '') |
|
| 34 | + { |
|
| 35 | + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 36 | + if ($key > 0) { |
|
| 37 | + |
|
| 38 | + // |
|
| 39 | + $class = ('even' === $class) ? 'odd' : 'even'; |
|
| 40 | + // ID инструкции ( Можно сделать статической ) |
|
| 41 | + $instrid = $objInsinstr->getVar('instrid'); |
|
| 42 | + |
|
| 43 | + // ID страницы |
|
| 44 | + $pageid = $this->tree[$key]['obj']->getVar('pageid'); |
|
| 45 | + // Название страницы |
|
| 46 | + $pagetitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 47 | + // Вес |
|
| 48 | + $pageweight = $this->tree[$key]['obj']->getVar('weight'); |
|
| 49 | + // Статус |
|
| 50 | + $pagestatus = $this->tree[$key]['obj']->getVar('status'); |
|
| 51 | + // Тип страницы |
|
| 52 | + $pagetype = $this->tree[$key]['obj']->getVar('type'); |
|
| 53 | + |
|
| 54 | + // Дочернии страницы |
|
| 55 | + $page_childs = $this->getAllChild($pageid); |
|
| 56 | + // Число дочерних страниц |
|
| 57 | + $num_childs = count($page_childs); |
|
| 58 | + |
|
| 59 | + // Действие - удаление |
|
| 60 | + $act_del = ($num_childs > 0) ? '<img src="../assets/images/icons/16/application_key.png" alt="' . _AM_INSTR_NODELPAGE . '" title="' . _AM_INSTR_NODELPAGE . '" />' : '<a href="instr.php?op=delpage&pageid=' |
|
| 61 | + . $pageid |
|
| 62 | + . '"><img src="'. $pathIcon16 . '/delete.png" alt="' |
|
| 63 | + . _AM_INSTRUCTION_DEL |
|
| 64 | + . '" title="' |
|
| 65 | + . _AM_INSTRUCTION_DEL |
|
| 66 | + . '"></a>'; |
|
| 67 | + // |
|
| 68 | + $page_link = '<a name="pageid_' . $pageid . '" ' . ($pagetype ? 'href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext"' : '') . '>' . $pagetitle . '</a>'; |
|
| 69 | + |
|
| 70 | + $ret .= '<tr class="' . $class . '"> |
|
| 71 | 71 | <td>' . $prefix_curr . ' ' . $page_link . '</td> |
| 72 | 72 | <td align="center" width="50"> |
| 73 | 73 | <input type="text" name="weights[]" size="2" value="' . $pageweight . '" /> |
| 74 | 74 | <input type="hidden" name="pageids[]" value="' . $pageid . '" /> |
| 75 | 75 | </td> |
| 76 | 76 | <td align="center" width="180">'; |
| 77 | - // Просмотре без кэша |
|
| 78 | - $ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&nocache=1"><img src="../assets/images/icons/16/database_black.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> '; |
|
| 79 | - // Добавить подстраницу |
|
| 80 | - $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> '; |
|
| 81 | - |
|
| 82 | - if ($pagestatus) { |
|
| 83 | - $ret .= ' <img src="../assets/images/icons/16/lock.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> '; |
|
| 84 | - } else { |
|
| 85 | - $ret .= ' <img src="../assets/images/icons/16/lock_open.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> '; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . ' |
|
| 77 | + // Просмотре без кэша |
|
| 78 | + $ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&nocache=1"><img src="../assets/images/icons/16/database_black.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> '; |
|
| 79 | + // Добавить подстраницу |
|
| 80 | + $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> '; |
|
| 81 | + |
|
| 82 | + if ($pagestatus) { |
|
| 83 | + $ret .= ' <img src="../assets/images/icons/16/lock.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> '; |
|
| 84 | + } else { |
|
| 85 | + $ret .= ' <img src="../assets/images/icons/16/lock_open.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> '; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . ' |
|
| 89 | 89 | </td> |
| 90 | 90 | </tr>'; |
| 91 | 91 | |
| 92 | - // Устанавливаем префикс |
|
| 93 | - $prefix_curr .= $prefix_orig; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 97 | - foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 98 | - $this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr); |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @param $objInsinstr |
|
| 105 | - * @param string $prefix |
|
| 106 | - * @param int $key |
|
| 107 | - * @return string |
|
| 108 | - */ |
|
| 109 | - public function makePagesAdmin(&$objInsinstr, $prefix = '-', $key = 0) |
|
| 110 | - { |
|
| 111 | - $ret = '<form name="inspages" action="instr.php" method="post"> |
|
| 92 | + // Устанавливаем префикс |
|
| 93 | + $prefix_curr .= $prefix_orig; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 97 | + foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 98 | + $this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr); |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @param $objInsinstr |
|
| 105 | + * @param string $prefix |
|
| 106 | + * @param int $key |
|
| 107 | + * @return string |
|
| 108 | + */ |
|
| 109 | + public function makePagesAdmin(&$objInsinstr, $prefix = '-', $key = 0) |
|
| 110 | + { |
|
| 111 | + $ret = '<form name="inspages" action="instr.php" method="post"> |
|
| 112 | 112 | <table width="100%" cellspacing="1" class="outer"> |
| 113 | 113 | <tr> |
| 114 | 114 | <th align="center" colspan="3">' . sprintf(_AM_INSTRUCTION_LISTPAGESININSTR, $objInsinstr->getVar('title')) . '</th> |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | <td class="head" align="center" width="180">' . _AM_INSTRUCTION_ACTION . '</td> |
| 120 | 120 | </tr>'; |
| 121 | 121 | |
| 122 | - // Выводим все страницы |
|
| 123 | - $this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr); |
|
| 122 | + // Выводим все страницы |
|
| 123 | + $this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr); |
|
| 124 | 124 | |
| 125 | - $ret .= '<tr class="foot"> |
|
| 125 | + $ret .= '<tr class="foot"> |
|
| 126 | 126 | <td><a href="instr.php?op=editpage&instrid=' . $objInsinstr->getVar('instrid') . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDPAGE . '" title="' . _AM_INSTRUCTION_ADDPAGE . '"></a></td> |
| 127 | 127 | <td colspan="2"> |
| 128 | 128 | <input type="hidden" name="instrid" value="' . $objInsinstr->getVar('instrid') . '" /> |
@@ -133,61 +133,61 @@ discard block |
||
| 133 | 133 | </table> |
| 134 | 134 | </form>'; |
| 135 | 135 | |
| 136 | - return $ret; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - // ================================== |
|
| 140 | - // === Дерево категорий в админке === |
|
| 141 | - // ================================== |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * @param $key |
|
| 145 | - * @param $ret |
|
| 146 | - * @param $prefix_orig |
|
| 147 | - * @param array $cidinstrids |
|
| 148 | - * @param string $class |
|
| 149 | - * @param string $prefix_curr |
|
| 150 | - */ |
|
| 151 | - public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '') |
|
| 152 | - { |
|
| 153 | - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 154 | - if ($key > 0) { |
|
| 155 | - |
|
| 156 | - // |
|
| 157 | - $class = ('even' === $class) ? 'odd' : 'even'; |
|
| 158 | - |
|
| 159 | - // ID категории |
|
| 160 | - $catid = $this->tree[$key]['obj']->getVar('cid'); |
|
| 161 | - // Название категории |
|
| 162 | - $cattitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 163 | - // Вес |
|
| 164 | - $catweight = $this->tree[$key]['obj']->getVar('weight'); |
|
| 165 | - // Статус |
|
| 166 | - $pagestatus = $this->tree[$key]['obj']->getVar('status'); |
|
| 167 | - |
|
| 168 | - // Дочернии категории |
|
| 169 | - $cat_childs = $this->getAllChild($catid); |
|
| 170 | - // Число дочерних категорий |
|
| 171 | - $num_childs = count($cat_childs); |
|
| 172 | - // Число инструкций |
|
| 173 | - $num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0; |
|
| 174 | - |
|
| 175 | - // Действие - удаление |
|
| 176 | - $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="'. $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid=' |
|
| 177 | - . $catid |
|
| 178 | - . '"><img src="'. $pathIcon16 . '/delete.png" alt="' |
|
| 179 | - . _AM_INSTRUCTION_DEL |
|
| 180 | - . '" title="' |
|
| 181 | - . _AM_INSTRUCTION_DEL |
|
| 182 | - . '" /></a>'; |
|
| 183 | - // Действие - просмотр |
|
| 184 | - $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="'. $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="' |
|
| 185 | - . _AM_INSTR_NOVIEWINSTR |
|
| 186 | - . '" title="' |
|
| 187 | - . _AM_INSTR_NOVIEWINSTR |
|
| 188 | - . '" />'; |
|
| 189 | - |
|
| 190 | - $ret .= '<tr class="' . $class . '"> |
|
| 136 | + return $ret; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + // ================================== |
|
| 140 | + // === Дерево категорий в админке === |
|
| 141 | + // ================================== |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * @param $key |
|
| 145 | + * @param $ret |
|
| 146 | + * @param $prefix_orig |
|
| 147 | + * @param array $cidinstrids |
|
| 148 | + * @param string $class |
|
| 149 | + * @param string $prefix_curr |
|
| 150 | + */ |
|
| 151 | + public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '') |
|
| 152 | + { |
|
| 153 | + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 154 | + if ($key > 0) { |
|
| 155 | + |
|
| 156 | + // |
|
| 157 | + $class = ('even' === $class) ? 'odd' : 'even'; |
|
| 158 | + |
|
| 159 | + // ID категории |
|
| 160 | + $catid = $this->tree[$key]['obj']->getVar('cid'); |
|
| 161 | + // Название категории |
|
| 162 | + $cattitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 163 | + // Вес |
|
| 164 | + $catweight = $this->tree[$key]['obj']->getVar('weight'); |
|
| 165 | + // Статус |
|
| 166 | + $pagestatus = $this->tree[$key]['obj']->getVar('status'); |
|
| 167 | + |
|
| 168 | + // Дочернии категории |
|
| 169 | + $cat_childs = $this->getAllChild($catid); |
|
| 170 | + // Число дочерних категорий |
|
| 171 | + $num_childs = count($cat_childs); |
|
| 172 | + // Число инструкций |
|
| 173 | + $num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0; |
|
| 174 | + |
|
| 175 | + // Действие - удаление |
|
| 176 | + $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="'. $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid=' |
|
| 177 | + . $catid |
|
| 178 | + . '"><img src="'. $pathIcon16 . '/delete.png" alt="' |
|
| 179 | + . _AM_INSTRUCTION_DEL |
|
| 180 | + . '" title="' |
|
| 181 | + . _AM_INSTRUCTION_DEL |
|
| 182 | + . '" /></a>'; |
|
| 183 | + // Действие - просмотр |
|
| 184 | + $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="'. $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="' |
|
| 185 | + . _AM_INSTR_NOVIEWINSTR |
|
| 186 | + . '" title="' |
|
| 187 | + . _AM_INSTR_NOVIEWINSTR |
|
| 188 | + . '" />'; |
|
| 189 | + |
|
| 190 | + $ret .= '<tr class="' . $class . '"> |
|
| 191 | 191 | <td>' . $prefix_curr . ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/index.php?cid=' . $catid . '">' . $cattitle . '</a></td> |
| 192 | 192 | <td align="center" width="50">' . $catweight . '</td> |
| 193 | 193 | <td align="center" width="100">' . $num_instrs . '</td> |
@@ -198,26 +198,26 @@ discard block |
||
| 198 | 198 | </td> |
| 199 | 199 | </tr>'; |
| 200 | 200 | |
| 201 | - // Устанавливаем префикс |
|
| 202 | - $prefix_curr .= $prefix_orig; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 206 | - foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 207 | - $this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr); |
|
| 208 | - } |
|
| 209 | - } |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * @param string $prefix |
|
| 214 | - * @param array $cidinstrids |
|
| 215 | - * @param int $key |
|
| 216 | - * @return string |
|
| 217 | - */ |
|
| 218 | - public function makeCatsAdmin($prefix = '-', $cidinstrids = [], $key = 0) |
|
| 219 | - { |
|
| 220 | - $ret = '<table width="100%" cellspacing="1" class="outer"> |
|
| 201 | + // Устанавливаем префикс |
|
| 202 | + $prefix_curr .= $prefix_orig; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 206 | + foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 207 | + $this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr); |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * @param string $prefix |
|
| 214 | + * @param array $cidinstrids |
|
| 215 | + * @param int $key |
|
| 216 | + * @return string |
|
| 217 | + */ |
|
| 218 | + public function makeCatsAdmin($prefix = '-', $cidinstrids = [], $key = 0) |
|
| 219 | + { |
|
| 220 | + $ret = '<table width="100%" cellspacing="1" class="outer"> |
|
| 221 | 221 | <tr> |
| 222 | 222 | <th align="center" colspan="4">' . _AM_INSTR_LISTALLCATS . '</th> |
| 223 | 223 | </tr> |
@@ -228,216 +228,216 @@ discard block |
||
| 228 | 228 | <td class="head" align="center" width="150">' . _AM_INSTRUCTION_ACTION . '</td> |
| 229 | 229 | </tr>'; |
| 230 | 230 | |
| 231 | - // Выводим все страницы |
|
| 232 | - $this->_makeCatsAdminOptions($key, $ret, $prefix, $cidinstrids); |
|
| 233 | - |
|
| 234 | - $ret .= '</table>'; |
|
| 235 | - |
|
| 236 | - return $ret; |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - // ====================================== |
|
| 240 | - // Список страниц на стороне пользователя |
|
| 241 | - // ====================================== |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * @param $key |
|
| 245 | - * @param $ret |
|
| 246 | - * @param int $currpageid |
|
| 247 | - * @param array $lastpageids |
|
| 248 | - * @param int $level |
|
| 249 | - */ |
|
| 250 | - public function _makePagesUserTree($key, &$ret, $currpageid = 0, &$lastpageids = [], $level = 0) |
|
| 251 | - { |
|
| 252 | - |
|
| 253 | - // Сохраняем значение предыдущей страницы |
|
| 254 | - //static $stat_prevpages; |
|
| 255 | - |
|
| 256 | - if ($key > 0) { |
|
| 257 | - |
|
| 258 | - // ID страницы |
|
| 259 | - $pageid = $this->tree[$key]['obj']->getVar('pageid'); |
|
| 260 | - // Название страницы |
|
| 261 | - $pagetitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 262 | - // Тип страницы |
|
| 263 | - $pagetype = $this->tree[$key]['obj']->getVar('type'); |
|
| 264 | - |
|
| 265 | - // Дочернии категории |
|
| 266 | - $page_childs = $this->getAllChild($pageid); |
|
| 267 | - // Число дочерних страниц |
|
| 268 | - $num_childs = count($page_childs); |
|
| 269 | - |
|
| 270 | - // Генерируем класс |
|
| 271 | - // InstrTreeNode InstrTreeIsRoot InstrTreeExpandClosed InstrTreeIsLast |
|
| 272 | - $class = []; |
|
| 273 | - // Данный класс должен быть у любого узла |
|
| 274 | - $class[] = 'InstrTreeNode'; |
|
| 275 | - // Если узел нулевого уровня, добавляем InstrTreeIsRoot |
|
| 276 | - if (0 === $level) { |
|
| 277 | - $class[] = 'InstrTreeIsRoot'; |
|
| 278 | - } |
|
| 279 | - // Тип узла InstrTreeExpandClosed|InstrTreeExpandLeaf |
|
| 280 | - // Если у узла нет потомков - InstrTreeExpandLeaf |
|
| 281 | - if (0 == $num_childs) { |
|
| 282 | - $class[] = 'InstrTreeExpandLeaf'; |
|
| 283 | - // Если у искомого элемента есть потомки - открываем список |
|
| 284 | - } elseif ($currpageid == $pageid) { |
|
| 285 | - $class[] = 'InstrTreeExpandOpen'; |
|
| 286 | - // Если искомый элемент есть в потомках текущего, то ставим класс InstrTreeExpandOpen |
|
| 287 | - } elseif (array_key_exists($currpageid, $page_childs)) { |
|
| 288 | - $class[] = 'InstrTreeExpandOpen'; |
|
| 289 | - // |
|
| 290 | - } else { |
|
| 291 | - $class[] = 'InstrTreeExpandClosed'; |
|
| 292 | - } |
|
| 293 | - |
|
| 294 | - // Данный класс нужно добавлять последнему узлу в каждом уровне |
|
| 295 | - |
|
| 296 | - if (isset($lastpageids[$level]) && ($pageid == $lastpageids[$level])) { |
|
| 297 | - $class[] = 'InstrTreeIsLast'; |
|
| 298 | - } |
|
| 299 | - |
|
| 300 | - //$class[] = 'InstrTreeIsLast'; |
|
| 301 | - |
|
| 302 | - // Test |
|
| 303 | - //$ret .= '<div id="' . $pageid . '">'; |
|
| 304 | - |
|
| 305 | - // Создаём запись |
|
| 306 | - $ret .= '<li class="' . implode(' ', $class) . '">'; |
|
| 307 | - // |
|
| 308 | - $ret .= '<div class="InstrTreeExpand"></div>'; |
|
| 309 | - // |
|
| 310 | - $ret .= '<div class="InstrTreeContent">'; |
|
| 311 | - |
|
| 312 | - // Если это лист дерева |
|
| 313 | - if (0 == $pagetype) { |
|
| 314 | - $ret .= '<span class="InstrTreeEmptyPage">' . $pagetitle . '</span>'; |
|
| 315 | - // |
|
| 316 | - } elseif ($currpageid == $pageid) { |
|
| 317 | - $ret .= $pagetitle; |
|
| 318 | - // |
|
| 319 | - } else { |
|
| 320 | - $ret .= '<a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext">' . $pagetitle . '</a>'; |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - $ret .= '</div>'; |
|
| 324 | - |
|
| 325 | - // Если есть потомки |
|
| 326 | - if ($num_childs > 0) { |
|
| 327 | - $ret .= '<ul class="InstrTreeContainer">'; |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - // Инкримент уровня |
|
| 331 | - $level++; |
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - // Рекурсия |
|
| 335 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 336 | - foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 337 | - $this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level); |
|
| 338 | - } |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - // Test |
|
| 342 | - if ($key > 0) { |
|
| 343 | - // Если есть потомки |
|
| 344 | - if ($num_childs > 0) { |
|
| 345 | - $ret .= '</ul>'; |
|
| 346 | - } |
|
| 347 | - // Конец текущей записи |
|
| 348 | - $ret .= '</li>'; |
|
| 349 | - } |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - // Находим предыдущую и следующую страницы. |
|
| 353 | - // Находим последнии страницы на каждом уровне. |
|
| 354 | - /** |
|
| 355 | - * @param $key |
|
| 356 | - * @param int $currpageid |
|
| 357 | - * @param array $prevpages |
|
| 358 | - * @param array $nextpages |
|
| 359 | - * @param array $lastpageids |
|
| 360 | - * @param int $level |
|
| 361 | - */ |
|
| 362 | - public function _makePagesUserCalc($key, $currpageid = 0, &$prevpages = [], &$nextpages = [], &$lastpageids = [], $level = 0) |
|
| 363 | - { |
|
| 364 | - |
|
| 365 | - // Сохраняем значение предыдущей страницы |
|
| 366 | - static $stat_prevpages; |
|
| 367 | - |
|
| 368 | - if ($key > 0) { |
|
| 369 | - // ID страницы |
|
| 370 | - $pageid = $this->tree[$key]['obj']->getVar('pageid'); |
|
| 371 | - // Название страницы |
|
| 372 | - $pagetitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 373 | - // Тип страницы |
|
| 374 | - $pagetype = $this->tree[$key]['obj']->getVar('type'); |
|
| 375 | - |
|
| 376 | - // Если мы передали ID текущей страницы, то находить предыдудую и следующую страницы |
|
| 377 | - // Не находить предыдущие и следующие для "Пустой страницы" |
|
| 378 | - if ($currpageid && $pagetype) { |
|
| 379 | - // Если элемент равен текущей странице |
|
| 380 | - if (null !== $stat_prevpages && ($currpageid == $pageid)) { |
|
| 381 | - // Забиваем массив предыдущей страницы |
|
| 382 | - $prevpages['pageid'] = $stat_prevpages['pageid']; |
|
| 383 | - $prevpages['title'] = $stat_prevpages['title']; |
|
| 384 | - |
|
| 385 | - // Если предыдущий равен текущей странице |
|
| 386 | - } elseif (null !== $stat_prevpages && ($currpageid == $stat_prevpages['pageid'])) { |
|
| 387 | - // Забиваем массив следующей страницы |
|
| 388 | - $nextpages['pageid'] = $pageid; |
|
| 389 | - $nextpages['title'] = $pagetitle; |
|
| 390 | - } |
|
| 391 | - // Заносим текущие данные в массив предыдущей страницы |
|
| 392 | - $stat_prevpages['pageid'] = $pageid; |
|
| 393 | - $stat_prevpages['title'] = $pagetitle; |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - // Заносим текущую страницу в массив "последних страний" |
|
| 397 | - $lastpageids[$level] = $pageid; |
|
| 398 | - |
|
| 399 | - // Инкримент уровня |
|
| 400 | - $level++; |
|
| 401 | - } |
|
| 402 | - |
|
| 403 | - // Рекурсия |
|
| 404 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 405 | - foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 406 | - $this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level); |
|
| 407 | - } |
|
| 408 | - } |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - // |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * @param int $currpageid |
|
| 415 | - * @param array $prevpages |
|
| 416 | - * @param array $nextpages |
|
| 417 | - * @param int $key |
|
| 418 | - * @return string |
|
| 419 | - */ |
|
| 420 | - public function makePagesUser($currpageid = 0, &$prevpages = [], &$nextpages = [], $key = 0) |
|
| 421 | - { |
|
| 422 | - |
|
| 423 | - // Массив последней страницы на каждом уровне |
|
| 424 | - // level => pageid |
|
| 425 | - $lastpageids = []; |
|
| 426 | - |
|
| 427 | - // Расчёт |
|
| 428 | - $this->_makePagesUserCalc($key, $currpageid, $prevpages, $nextpages, $lastpageids); |
|
| 429 | - |
|
| 430 | - $ret = '<div onclick="instr_tree_toggle(arguments[0])"> |
|
| 231 | + // Выводим все страницы |
|
| 232 | + $this->_makeCatsAdminOptions($key, $ret, $prefix, $cidinstrids); |
|
| 233 | + |
|
| 234 | + $ret .= '</table>'; |
|
| 235 | + |
|
| 236 | + return $ret; |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + // ====================================== |
|
| 240 | + // Список страниц на стороне пользователя |
|
| 241 | + // ====================================== |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * @param $key |
|
| 245 | + * @param $ret |
|
| 246 | + * @param int $currpageid |
|
| 247 | + * @param array $lastpageids |
|
| 248 | + * @param int $level |
|
| 249 | + */ |
|
| 250 | + public function _makePagesUserTree($key, &$ret, $currpageid = 0, &$lastpageids = [], $level = 0) |
|
| 251 | + { |
|
| 252 | + |
|
| 253 | + // Сохраняем значение предыдущей страницы |
|
| 254 | + //static $stat_prevpages; |
|
| 255 | + |
|
| 256 | + if ($key > 0) { |
|
| 257 | + |
|
| 258 | + // ID страницы |
|
| 259 | + $pageid = $this->tree[$key]['obj']->getVar('pageid'); |
|
| 260 | + // Название страницы |
|
| 261 | + $pagetitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 262 | + // Тип страницы |
|
| 263 | + $pagetype = $this->tree[$key]['obj']->getVar('type'); |
|
| 264 | + |
|
| 265 | + // Дочернии категории |
|
| 266 | + $page_childs = $this->getAllChild($pageid); |
|
| 267 | + // Число дочерних страниц |
|
| 268 | + $num_childs = count($page_childs); |
|
| 269 | + |
|
| 270 | + // Генерируем класс |
|
| 271 | + // InstrTreeNode InstrTreeIsRoot InstrTreeExpandClosed InstrTreeIsLast |
|
| 272 | + $class = []; |
|
| 273 | + // Данный класс должен быть у любого узла |
|
| 274 | + $class[] = 'InstrTreeNode'; |
|
| 275 | + // Если узел нулевого уровня, добавляем InstrTreeIsRoot |
|
| 276 | + if (0 === $level) { |
|
| 277 | + $class[] = 'InstrTreeIsRoot'; |
|
| 278 | + } |
|
| 279 | + // Тип узла InstrTreeExpandClosed|InstrTreeExpandLeaf |
|
| 280 | + // Если у узла нет потомков - InstrTreeExpandLeaf |
|
| 281 | + if (0 == $num_childs) { |
|
| 282 | + $class[] = 'InstrTreeExpandLeaf'; |
|
| 283 | + // Если у искомого элемента есть потомки - открываем список |
|
| 284 | + } elseif ($currpageid == $pageid) { |
|
| 285 | + $class[] = 'InstrTreeExpandOpen'; |
|
| 286 | + // Если искомый элемент есть в потомках текущего, то ставим класс InstrTreeExpandOpen |
|
| 287 | + } elseif (array_key_exists($currpageid, $page_childs)) { |
|
| 288 | + $class[] = 'InstrTreeExpandOpen'; |
|
| 289 | + // |
|
| 290 | + } else { |
|
| 291 | + $class[] = 'InstrTreeExpandClosed'; |
|
| 292 | + } |
|
| 293 | + |
|
| 294 | + // Данный класс нужно добавлять последнему узлу в каждом уровне |
|
| 295 | + |
|
| 296 | + if (isset($lastpageids[$level]) && ($pageid == $lastpageids[$level])) { |
|
| 297 | + $class[] = 'InstrTreeIsLast'; |
|
| 298 | + } |
|
| 299 | + |
|
| 300 | + //$class[] = 'InstrTreeIsLast'; |
|
| 301 | + |
|
| 302 | + // Test |
|
| 303 | + //$ret .= '<div id="' . $pageid . '">'; |
|
| 304 | + |
|
| 305 | + // Создаём запись |
|
| 306 | + $ret .= '<li class="' . implode(' ', $class) . '">'; |
|
| 307 | + // |
|
| 308 | + $ret .= '<div class="InstrTreeExpand"></div>'; |
|
| 309 | + // |
|
| 310 | + $ret .= '<div class="InstrTreeContent">'; |
|
| 311 | + |
|
| 312 | + // Если это лист дерева |
|
| 313 | + if (0 == $pagetype) { |
|
| 314 | + $ret .= '<span class="InstrTreeEmptyPage">' . $pagetitle . '</span>'; |
|
| 315 | + // |
|
| 316 | + } elseif ($currpageid == $pageid) { |
|
| 317 | + $ret .= $pagetitle; |
|
| 318 | + // |
|
| 319 | + } else { |
|
| 320 | + $ret .= '<a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '#pagetext">' . $pagetitle . '</a>'; |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + $ret .= '</div>'; |
|
| 324 | + |
|
| 325 | + // Если есть потомки |
|
| 326 | + if ($num_childs > 0) { |
|
| 327 | + $ret .= '<ul class="InstrTreeContainer">'; |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + // Инкримент уровня |
|
| 331 | + $level++; |
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + // Рекурсия |
|
| 335 | + if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 336 | + foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 337 | + $this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level); |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + // Test |
|
| 342 | + if ($key > 0) { |
|
| 343 | + // Если есть потомки |
|
| 344 | + if ($num_childs > 0) { |
|
| 345 | + $ret .= '</ul>'; |
|
| 346 | + } |
|
| 347 | + // Конец текущей записи |
|
| 348 | + $ret .= '</li>'; |
|
| 349 | + } |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + // Находим предыдущую и следующую страницы. |
|
| 353 | + // Находим последнии страницы на каждом уровне. |
|
| 354 | + /** |
|
| 355 | + * @param $key |
|
| 356 | + * @param int $currpageid |
|
| 357 | + * @param array $prevpages |
|
| 358 | + * @param array $nextpages |
|
| 359 | + * @param array $lastpageids |
|
| 360 | + * @param int $level |
|
| 361 | + */ |
|
| 362 | + public function _makePagesUserCalc($key, $currpageid = 0, &$prevpages = [], &$nextpages = [], &$lastpageids = [], $level = 0) |
|
| 363 | + { |
|
| 364 | + |
|
| 365 | + // Сохраняем значение предыдущей страницы |
|
| 366 | + static $stat_prevpages; |
|
| 367 | + |
|
| 368 | + if ($key > 0) { |
|
| 369 | + // ID страницы |
|
| 370 | + $pageid = $this->tree[$key]['obj']->getVar('pageid'); |
|
| 371 | + // Название страницы |
|
| 372 | + $pagetitle = $this->tree[$key]['obj']->getVar('title'); |
|
| 373 | + // Тип страницы |
|
| 374 | + $pagetype = $this->tree[$key]['obj']->getVar('type'); |
|
| 375 | + |
|
| 376 | + // Если мы передали ID текущей страницы, то находить предыдудую и следующую страницы |
|
| 377 | + // Не находить предыдущие и следующие для "Пустой страницы" |
|
| 378 | + if ($currpageid && $pagetype) { |
|
| 379 | + // Если элемент равен текущей странице |
|
| 380 | + if (null !== $stat_prevpages && ($currpageid == $pageid)) { |
|
| 381 | + // Забиваем массив предыдущей страницы |
|
| 382 | + $prevpages['pageid'] = $stat_prevpages['pageid']; |
|
| 383 | + $prevpages['title'] = $stat_prevpages['title']; |
|
| 384 | + |
|
| 385 | + // Если предыдущий равен текущей странице |
|
| 386 | + } elseif (null !== $stat_prevpages && ($currpageid == $stat_prevpages['pageid'])) { |
|
| 387 | + // Забиваем массив следующей страницы |
|
| 388 | + $nextpages['pageid'] = $pageid; |
|
| 389 | + $nextpages['title'] = $pagetitle; |
|
| 390 | + } |
|
| 391 | + // Заносим текущие данные в массив предыдущей страницы |
|
| 392 | + $stat_prevpages['pageid'] = $pageid; |
|
| 393 | + $stat_prevpages['title'] = $pagetitle; |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + // Заносим текущую страницу в массив "последних страний" |
|
| 397 | + $lastpageids[$level] = $pageid; |
|
| 398 | + |
|
| 399 | + // Инкримент уровня |
|
| 400 | + $level++; |
|
| 401 | + } |
|
| 402 | + |
|
| 403 | + // Рекурсия |
|
| 404 | + if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 405 | + foreach ($this->tree[$key]['child'] as $childkey) { |
|
| 406 | + $this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level); |
|
| 407 | + } |
|
| 408 | + } |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + // |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * @param int $currpageid |
|
| 415 | + * @param array $prevpages |
|
| 416 | + * @param array $nextpages |
|
| 417 | + * @param int $key |
|
| 418 | + * @return string |
|
| 419 | + */ |
|
| 420 | + public function makePagesUser($currpageid = 0, &$prevpages = [], &$nextpages = [], $key = 0) |
|
| 421 | + { |
|
| 422 | + |
|
| 423 | + // Массив последней страницы на каждом уровне |
|
| 424 | + // level => pageid |
|
| 425 | + $lastpageids = []; |
|
| 426 | + |
|
| 427 | + // Расчёт |
|
| 428 | + $this->_makePagesUserCalc($key, $currpageid, $prevpages, $nextpages, $lastpageids); |
|
| 429 | + |
|
| 430 | + $ret = '<div onclick="instr_tree_toggle(arguments[0])"> |
|
| 431 | 431 | <div>' . _MD_INSTRUCTION_LISTPAGES . '</div> |
| 432 | 432 | <div><ul class="InstrTreeContainer">'; |
| 433 | 433 | |
| 434 | - // Генерируем дерево |
|
| 435 | - $this->_makePagesUserTree($key, $ret, $currpageid, $lastpageids); |
|
| 434 | + // Генерируем дерево |
|
| 435 | + $this->_makePagesUserTree($key, $ret, $currpageid, $lastpageids); |
|
| 436 | 436 | |
| 437 | - $ret .= '</ul> |
|
| 437 | + $ret .= '</ul> |
|
| 438 | 438 | </div> |
| 439 | 439 | </div>'; |
| 440 | 440 | |
| 441 | - return $ret; |
|
| 442 | - } |
|
| 441 | + return $ret; |
|
| 442 | + } |
|
| 443 | 443 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function _makePagesAdminOptions($key, &$ret, $prefix_orig, $objInsinstr, $class = 'odd', $prefix_curr = '') |
| 34 | 34 | { |
| 35 | - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 35 | + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 36 | 36 | if ($key > 0) { |
| 37 | 37 | |
| 38 | 38 | // |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // Действие - удаление |
| 60 | 60 | $act_del = ($num_childs > 0) ? '<img src="../assets/images/icons/16/application_key.png" alt="' . _AM_INSTR_NODELPAGE . '" title="' . _AM_INSTR_NODELPAGE . '" />' : '<a href="instr.php?op=delpage&pageid=' |
| 61 | 61 | . $pageid |
| 62 | - . '"><img src="'. $pathIcon16 . '/delete.png" alt="' |
|
| 62 | + . '"><img src="' . $pathIcon16 . '/delete.png" alt="' |
|
| 63 | 63 | . _AM_INSTRUCTION_DEL |
| 64 | 64 | . '" title="' |
| 65 | 65 | . _AM_INSTRUCTION_DEL |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | // Просмотре без кэша |
| 78 | 78 | $ret .= ' <a href="' . XOOPS_URL . '/modules/' . INST_DIRNAME . '/page.php?id=' . $pageid . '&nocache=1"><img src="../assets/images/icons/16/database_black.png" alt="' . _AM_INSTR_DISPLAY_NOCACHE . '" title="' . _AM_INSTR_DISPLAY_NOCACHE . '" /></a> '; |
| 79 | 79 | // Добавить подстраницу |
| 80 | - $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> '; |
|
| 80 | + $ret .= ' <a href="instr.php?op=editpage&instrid=' . $instrid . '&pid=' . $pageid . '"><img src="' . $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDSUBPAGE . '" title="' . _AM_INSTRUCTION_ADDSUBPAGE . '" /></a> '; |
|
| 81 | 81 | |
| 82 | 82 | if ($pagestatus) { |
| 83 | 83 | $ret .= ' <img src="../assets/images/icons/16/lock.png" alt="' . _AM_INSTRUCTION_LOCK . '" title="' . _AM_INSTRUCTION_LOCK . '"> '; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $ret .= ' <img src="../assets/images/icons/16/lock_open.png" alt="' . _AM_INSTRUCTION_UNLOCK . '" title="' . _AM_INSTRUCTION_UNLOCK . '"> '; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . ' |
|
| 88 | + $ret .= ' <a href="instr.php?op=editpage&pageid=' . $pageid . '"><img src="' . $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> ' . $act_del . ' |
|
| 89 | 89 | </td> |
| 90 | 90 | </tr>'; |
| 91 | 91 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $prefix_curr .= $prefix_orig; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 96 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 97 | 97 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 98 | 98 | $this->_makePagesAdminOptions($childkey, $ret, $prefix_orig, $objInsinstr, $class, $prefix_curr); |
| 99 | 99 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $this->_makePagesAdminOptions($key, $ret, $prefix, $objInsinstr); |
| 124 | 124 | |
| 125 | 125 | $ret .= '<tr class="foot"> |
| 126 | - <td><a href="instr.php?op=editpage&instrid=' . $objInsinstr->getVar('instrid') . '"><img src="'. $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDPAGE . '" title="' . _AM_INSTRUCTION_ADDPAGE . '"></a></td> |
|
| 126 | + <td><a href="instr.php?op=editpage&instrid=' . $objInsinstr->getVar('instrid') . '"><img src="' . $pathIcon16 . '/add.png" alt="' . _AM_INSTRUCTION_ADDPAGE . '" title="' . _AM_INSTRUCTION_ADDPAGE . '"></a></td> |
|
| 127 | 127 | <td colspan="2"> |
| 128 | 128 | <input type="hidden" name="instrid" value="' . $objInsinstr->getVar('instrid') . '" /> |
| 129 | 129 | <input type="hidden" name="op" value="updpage" /> |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function _makeCatsAdminOptions($key, &$ret, $prefix_orig, $cidinstrids = [], &$class = 'odd', $prefix_curr = '') |
| 152 | 152 | { |
| 153 | - $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 153 | + $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
|
| 154 | 154 | if ($key > 0) { |
| 155 | 155 | |
| 156 | 156 | // |
@@ -173,15 +173,15 @@ discard block |
||
| 173 | 173 | $num_instrs = isset($cidinstrids[$catid]) ? $cidinstrids[$catid] : 0; |
| 174 | 174 | |
| 175 | 175 | // Действие - удаление |
| 176 | - $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="'. $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid=' |
|
| 176 | + $act_del = (($num_instrs > 0) || ($num_childs > 0)) ? '<img src="' . $pathIcon16 . '/delete.png" alt="' . _AM_INSTR_NODELCAT . '" title="' . _AM_INSTR_NODELCAT . '" />' : '<a href="cat.php?op=delcat&cid=' |
|
| 177 | 177 | . $catid |
| 178 | - . '"><img src="'. $pathIcon16 . '/delete.png" alt="' |
|
| 178 | + . '"><img src="' . $pathIcon16 . '/delete.png" alt="' |
|
| 179 | 179 | . _AM_INSTRUCTION_DEL |
| 180 | 180 | . '" title="' |
| 181 | 181 | . _AM_INSTRUCTION_DEL |
| 182 | 182 | . '" /></a>'; |
| 183 | 183 | // Действие - просмотр |
| 184 | - $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="'. $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="' |
|
| 184 | + $act_view = ($num_instrs > 0) ? '<a href="instr.php?cid=' . $catid . '"><img src="' . $pathIcon16 . '/view.png" alt="' . _AM_INSTR_VIEWINSTR . '" title="' . _AM_INSTR_VIEWINSTR . '" /></a>' : '<img src="../assets/images/icons/16/document_protect.png" alt="' |
|
| 185 | 185 | . _AM_INSTR_NOVIEWINSTR |
| 186 | 186 | . '" title="' |
| 187 | 187 | . _AM_INSTR_NOVIEWINSTR |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | <td align="center" width="100">' . $num_instrs . '</td> |
| 194 | 194 | <td align="center" width="150"> |
| 195 | 195 | ' . $act_view . ' |
| 196 | - <a href="cat.php?op=editcat&cid=' . $catid . '"><img src="'. $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> |
|
| 196 | + <a href="cat.php?op=editcat&cid=' . $catid . '"><img src="' . $pathIcon16 . '/edit.png" alt="' . _AM_INSTRUCTION_EDIT . '" title="' . _AM_INSTRUCTION_EDIT . '"></a> |
|
| 197 | 197 | ' . $act_del . ' |
| 198 | 198 | </td> |
| 199 | 199 | </tr>'; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $prefix_curr .= $prefix_orig; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 205 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 206 | 206 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 207 | 207 | $this->_makeCatsAdminOptions($childkey, $ret, $prefix_orig, $cidinstrids, $class, $prefix_curr); |
| 208 | 208 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // Рекурсия |
| 335 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 335 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 336 | 336 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 337 | 337 | $this->_makePagesUserTree($childkey, $ret, $currpageid, $lastpageids, $level); |
| 338 | 338 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | // Рекурсия |
| 404 | - if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
|
| 404 | + if (isset($this->tree[$key]['child']) && ! empty($this->tree[$key]['child'])) { |
|
| 405 | 405 | foreach ($this->tree[$key]['child'] as $childkey) { |
| 406 | 406 | $this->_makePagesUserCalc($childkey, $currpageid, $prevpages, $nextpages, $lastpageids, $level); |
| 407 | 407 | } |
@@ -46,8 +46,8 @@ |
||
| 46 | 46 | // Редактор |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @param $caption |
|
| 50 | - * @param $name |
|
| 49 | + * @param string $caption |
|
| 50 | + * @param string $name |
|
| 51 | 51 | * @param string $value |
| 52 | 52 | * @return bool|\XoopsFormEditor |
| 53 | 53 | */ |
@@ -1,6 +1,5 @@ |
||
| 1 | 1 | <?php namespace Xoopsmodules\instruction; |
| 2 | 2 | |
| 3 | -use Xmf\Request; |
|
| 4 | 3 | use Xoopsmodules\instruction\common; |
| 5 | 4 | |
| 6 | 5 | require_once __DIR__ . '/common/VersionChecks.php'; |
@@ -14,56 +14,56 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Utility |
| 16 | 16 | { |
| 17 | - use common\VersionChecks; //checkVerXoops, checkVerPhp Traits |
|
| 17 | + use common\VersionChecks; //checkVerXoops, checkVerPhp Traits |
|
| 18 | 18 | |
| 19 | - use common\ServerStats; // getServerStats Trait |
|
| 19 | + use common\ServerStats; // getServerStats Trait |
|
| 20 | 20 | |
| 21 | - use common\FilesManagement; // Files Management Trait |
|
| 21 | + use common\FilesManagement; // Files Management Trait |
|
| 22 | 22 | |
| 23 | - // Права |
|
| 24 | - /** |
|
| 25 | - * @param string $permtype |
|
| 26 | - * @return mixed |
|
| 27 | - */ |
|
| 28 | - public static function getItemIds($permtype = 'instruction_view') |
|
| 29 | - { |
|
| 30 | - //global $xoopsUser; |
|
| 31 | - static $permissions = []; |
|
| 32 | - // Если есть в статике |
|
| 33 | - if (is_array($permissions) && array_key_exists($permtype, $permissions)) { |
|
| 34 | - return $permissions[$permtype]; |
|
| 35 | - } |
|
| 36 | - // Находим из базы |
|
| 37 | - $moduleHandler = xoops_getHandler('module'); |
|
| 38 | - $instrModule = $moduleHandler->getByDirname('instruction'); |
|
| 39 | - $groups = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 40 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
| 41 | - $categories = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid')); |
|
| 42 | - $permissions[$permtype] = $categories; |
|
| 43 | - return $categories; |
|
| 44 | - } |
|
| 23 | + // Права |
|
| 24 | + /** |
|
| 25 | + * @param string $permtype |
|
| 26 | + * @return mixed |
|
| 27 | + */ |
|
| 28 | + public static function getItemIds($permtype = 'instruction_view') |
|
| 29 | + { |
|
| 30 | + //global $xoopsUser; |
|
| 31 | + static $permissions = []; |
|
| 32 | + // Если есть в статике |
|
| 33 | + if (is_array($permissions) && array_key_exists($permtype, $permissions)) { |
|
| 34 | + return $permissions[$permtype]; |
|
| 35 | + } |
|
| 36 | + // Находим из базы |
|
| 37 | + $moduleHandler = xoops_getHandler('module'); |
|
| 38 | + $instrModule = $moduleHandler->getByDirname('instruction'); |
|
| 39 | + $groups = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; |
|
| 40 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
| 41 | + $categories = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid')); |
|
| 42 | + $permissions[$permtype] = $categories; |
|
| 43 | + return $categories; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - // Редактор |
|
| 46 | + // Редактор |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @param $caption |
|
| 50 | - * @param $name |
|
| 51 | - * @param string $value |
|
| 52 | - * @return bool|\XoopsFormEditor |
|
| 53 | - */ |
|
| 54 | - public static function getWysiwygForm($caption, $name, $value = '') |
|
| 55 | - { |
|
| 56 | - $editor = false; |
|
| 57 | - $editor_configs = []; |
|
| 58 | - $editor_configs['name'] = $name; |
|
| 59 | - $editor_configs['value'] = $value; |
|
| 60 | - $editor_configs['rows'] = 35; |
|
| 61 | - $editor_configs['cols'] = 60; |
|
| 62 | - $editor_configs['width'] = '100%'; |
|
| 63 | - $editor_configs['height'] = '350px'; |
|
| 64 | - $editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction')); |
|
| 48 | + /** |
|
| 49 | + * @param $caption |
|
| 50 | + * @param $name |
|
| 51 | + * @param string $value |
|
| 52 | + * @return bool|\XoopsFormEditor |
|
| 53 | + */ |
|
| 54 | + public static function getWysiwygForm($caption, $name, $value = '') |
|
| 55 | + { |
|
| 56 | + $editor = false; |
|
| 57 | + $editor_configs = []; |
|
| 58 | + $editor_configs['name'] = $name; |
|
| 59 | + $editor_configs['value'] = $value; |
|
| 60 | + $editor_configs['rows'] = 35; |
|
| 61 | + $editor_configs['cols'] = 60; |
|
| 62 | + $editor_configs['width'] = '100%'; |
|
| 63 | + $editor_configs['height'] = '350px'; |
|
| 64 | + $editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction')); |
|
| 65 | 65 | |
| 66 | - $editor = new \XoopsFormEditor($caption, $name, $editor_configs); |
|
| 67 | - return $editor; |
|
| 68 | - } |
|
| 66 | + $editor = new \XoopsFormEditor($caption, $name, $editor_configs); |
|
| 67 | + return $editor; |
|
| 68 | + } |
|
| 69 | 69 | } |