| 1 |  |  | <?php namespace Xoopsmodules\instruction; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | //if (!defined("XOOPS_ROOT_PATH")) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | //	die("XOOPS root path not defined"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | //} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | //include_once $GLOBALS['xoops']->path('include/common.php'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | //include_once __DIR__ . '/Utility.php'; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | //include_once __DIR__ . '/CategoryHandler.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | //include_once __DIR__ . '/Helper.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * Class Category | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * @package Xoopsmodules\instruction | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 16 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  | class Category extends \XoopsObject | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |     // constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     public function __construct() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         //		$this->XoopsObject(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 5); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         $this->initVar('imgurl', XOBJ_DTYPE_TXTBOX, '', false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 33 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |      * @return mixed | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |     public function getNewInstertId() | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |         $newEnreg = $GLOBALS['xoopsDB']->getInsertId(); | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |         return $newEnreg; | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |     // Получаем форму | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |      * @param bool|null|string $action | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |      * @return \XoopsThemeForm | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     public function getForm($action = false) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         //global $xoopsDB, $xoopsModule, $xoopsModuleConfig; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         require_once __DIR__ . '/../include/common.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         // Если нет $action | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         if (false === $action) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |             $action = xoops_getenv('REQUEST_URI'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         // Подключаем формы | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         // Название формы | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDCAT) : sprintf(_AM_INSTRUCTION_FORMEDITCAT); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         // Форма | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $form = new \XoopsThemeForm($title, 'formcat', $action, 'post', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         //$form->setExtra('enctype="multipart/form-data"'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         // Название категории | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         // Редактор | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         $form->addElement(new \XoopsFormTextArea(_AM_INSTRUCTION_DSCC, 'description', $this->getVar('description', 'e')), true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         //image | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         /* | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         $downloadscat_img = $this->getVar('imgurl') ? $this->getVar('imgurl') : 'blank.gif'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         $uploadirectory='/uploads/tdmdownloads/images/cats'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         $imgtray = new \XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMIMG,'<br>'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         $imgpath=sprintf(_AM_TDMDOWNLOADS_FORMPATH, $uploadirectory ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         $imageselect= new \XoopsFormSelect($imgpath, 'downloadscat_img',$downloadscat_img); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         $topics_array = XoopsLists :: getImgListAsArray( XOOPS_ROOT_PATH . $uploadirectory ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         foreach( $topics_array as $image ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             $imageselect->addOption("$image", $image); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         $imageselect->setExtra( "onchange='showImgSelected(\"image3\", \"downloadscat_img\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'" ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         $imgtray->addElement($imageselect,false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         $imgtray -> addElement( new \XoopsFormLabel( '', "<br><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $downloadscat_img . "' name='image3' id='image3' alt='' />" ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         $fileseltray= new \XoopsFormElementTray('','<br>'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         $fileseltray->addElement(new \XoopsFormFile(_AM_TDMDOWNLOADS_FORMUPLOAD , 'attachedfile', $xoopsModuleConfig['maxuploadsize']), false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         $fileseltray->addElement(new \XoopsFormLabel('' ), false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         $imgtray->addElement($fileseltray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         $form->addElement($imgtray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         // Родительская категория | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         //        $categoryHandler = xoops_getModuleHandler('category', 'instruction'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         $criteria = new \CriteriaCompo(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         // Если мы редактируем, то убрать текущую категорию из списка выбора родительской | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         if (!$this->isNew()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             $criteria->add(new \Criteria('cid', $this->getVar('cid'), '<>')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         $criteria->setSort('weight ASC, title'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         $criteria->setOrder('ASC'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         $db              = \XoopsDatabaseFactory::getDatabase(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |         $categoryHandler = new CategoryHandler($db); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         $instructioncat_arr = $categoryHandler->getall($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         unset($criteria); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |         // Подключаем трей | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |         include_once $GLOBALS['xoops']->path('class/tree.php'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         $mytree = new \XoopsObjectTree($instructioncat_arr, 'cid', 'pid'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         // $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         $helper = Helper::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |         $module = $helper->getModule(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 115 |  | View Code Duplication |         if (Utility::checkVerXoops($module, '2.5.9')) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |             $mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PCATC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |             $form->addElement($mytree_select); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |             $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |         // Вес | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |         $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |         // Мета-теги ключевых слов | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         // Мета-теги описания | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         // ========================================================== | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         // ========================================================== | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |         // Права | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |         $memberHandler = xoops_getHandler('member'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |         $group_list    = $memberHandler->getGroupList(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |         $gpermHandler  = xoops_getHandler('groupperm'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |         $full_list     = array_keys($group_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         // Права на просмотр | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         $groups_ids = []; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         // Если мы редактируем | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 141 |  | View Code Duplication |         if (!$this->isNew()) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             $groups_ids        = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |             $groups_ids        = array_values($groups_ids); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             $groups_instr_view = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             $groups_instr_view = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $full_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |         $groups_instr_view->addOptionArray($group_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |         $form->addElement($groups_instr_view); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |         // Права на отправку | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |         $groups_ids = []; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 153 |  | View Code Duplication |         if (!$this->isNew()) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |             $groups_ids          = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |             $groups_ids          = array_values($groups_ids); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |             $groups_instr_submit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |             $groups_instr_submit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $full_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |         $groups_instr_submit->addOptionArray($group_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |         $form->addElement($groups_instr_submit); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |         // Права на редактирование | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |         $groups_ids = []; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 165 |  | View Code Duplication |         if (!$this->isNew()) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |             $groups_ids        = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |             $groups_ids        = array_values($groups_ids); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |             $groups_instr_edit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             $groups_instr_edit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $full_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |         $groups_instr_edit->addOptionArray($group_list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         $form->addElement($groups_instr_edit); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         // ========================================================== | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |         // ========================================================== | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |         // Если мы редактируем категорию | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         if (!$this->isNew()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |             $form->addElement(new \XoopsFormHidden('cid', $this->getVar('cid'))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |             //$form->addElement( new \XoopsFormHidden( 'catmodify', true)); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         // | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |         $form->addElement(new \XoopsFormHidden('op', 'savecat')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         // Кнопка | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |         $button_tray = new \XoopsFormElementTray('', ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         $submit_btn  = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         $button_tray->addElement($submit_btn); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         $cancel_btn = new \XoopsFormButton('', 'cancel', _CANCEL, 'cancel'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |         $cancel_btn->setExtra('onclick="javascript:history.go(-1);"'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         $button_tray->addElement($cancel_btn); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |         $form->addElement($button_tray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         return $form; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 195 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 196 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 198 |  |  |  | 
            
                        
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.