| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace XoopsModules\Publisher\Form; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  You may not change or alter any portion of this comment or credits | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  of supporting developers from this source code or any supporting source code | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  which is considered copyrighted (c) material of the original comment or credit authors. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Images; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use Xoops; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Xoops\Core\Kernel\Criteria; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Xoops\Core\Kernel\CriteriaCompo; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use Xoops\Form\Button; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use Xoops\Form\ContainerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use Xoops\Form\DateTimeSelect; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use Xoops\Form\Editor; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | use Xoops\Form\ElementTray; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | use Xoops\Form\File; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | use Xoops\Form\Hidden; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use Xoops\Form\Label; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use Xoops\Form\RadioYesNo; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use Xoops\Form\Select; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use Xoops\Form\SelectEditor; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use Xoops\Form\SelectUser; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | use Xoops\Form\SimpleForm; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | use Xoops\Form\Tab; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | use Xoops\Form\TabTray; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | use Xoops\Form\Text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | use Xoops\Form\TextArea; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | use Xoops\Html\Img; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | use XoopsBaseConfig; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | use XoopsLists; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | use XoopsLocale; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | use XoopsModules\Publisher; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | use XoopsModules\Publisher\Helper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | require_once \dirname(\dirname(__DIR__)) . '/include/common.php'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | $helper = Helper::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  *  Publisher form class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  * @category  PublisherItemForm | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  * @package   Publisher | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  * @author    trabis <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  * @copyright 2011-2015 The XUUPS Project (http://sourceforge.net/projects/xuups/) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  * @license   GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  * @link      http://xoops.org | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | class ItemForm extends SimpleForm | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     private $checkperm = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     private $tabs = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         _CO_PUBLISHER_TAB_MAIN => 'mainTab', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         _CO_PUBLISHER_TAB_IMAGES => 'imagesTab', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         _CO_PUBLISHER_TAB_FILES => 'filesTab', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         _CO_PUBLISHER_TAB_OTHERS => 'othersTab', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     private $mainTab = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         \_PUBLISHER_SUBTITLE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         \_PUBLISHER_ITEM_SHORT_URL, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         \_PUBLISHER_ITEM_TAG, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         \_PUBLISHER_SUMMARY, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         \_PUBLISHER_DOHTML, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         \_PUBLISHER_DOSMILEY, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         \_PUBLISHER_DOXCODE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         \_PUBLISHER_DOIMAGE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         \_PUBLISHER_DOLINEBREAK, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         \_PUBLISHER_DATESUB, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         \_PUBLISHER_STATUS, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         \_PUBLISHER_AUTHOR_ALIAS, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         \_PUBLISHER_NOTIFY, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         \_PUBLISHER_AVAILABLE_PAGE_WRAP, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         \_PUBLISHER_UID, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |     private $imagesTab = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         \_PUBLISHER_IMAGE_ITEM, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     private $filesTab = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         \_PUBLISHER_ITEM_UPLOAD_FILE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     private $othersTab = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         \_PUBLISHER_ITEM_META_KEYWORDS, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         \_PUBLISHER_ITEM_META_DESCRIPTION, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         \_PUBLISHER_WEIGHT, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         \_PUBLISHER_ALLOWCOMMENTS, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      * __construct | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      * @param Publisher\Item $obj source object for form variables | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     public function __construct(Publisher\Item $obj) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         $xoops = Xoops::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         parent::__construct('title', 'form', $xoops->getEnv('PHP_SELF')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |         $this->setExtra('enctype="multipart/form-data"'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |         $tabTray = new TabTray('', 'uniqueid'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         $mainTab = new Tab(_CO_PUBLISHER_TAB_MAIN, 'maintab'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |         $this->buildMainTab($obj, $mainTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         $tabTray->addElement($mainTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         if ($xoops->isActiveModule('images') && $this->hasTab(_CO_PUBLISHER_TAB_IMAGES)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |             $imagesTab = new Tab(_CO_PUBLISHER_TAB_IMAGES, 'imagestab'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |             $this->buildImagesTab($obj, $imagesTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |             $tabTray->addElement($imagesTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         if ($this->hasTab(_CO_PUBLISHER_TAB_FILES)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |             $filesTab = new Tab(_CO_PUBLISHER_TAB_FILES, 'filestab'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |             $this->buildFilesTab($obj, $filesTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             $tabTray->addElement($filesTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |         if ($this->hasTab(_CO_PUBLISHER_TAB_OTHERS)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             $othersTab = new Tab(_CO_PUBLISHER_TAB_OTHERS, 'otherstab'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |             $this->buildOthersTab($obj, $othersTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             $tabTray->addElement($othersTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |         $this->addElement($tabTray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         //COMMON TO ALL TABS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         $buttonTray = new ElementTray('', ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |         if (!$obj->isNew()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |             $buttonTray->addElement(new Button('', 'additem', XoopsLocale::A_SUBMIT, 'submit')); //orclone | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |             $buttonTray->addElement(new Button('', 'additem', _CO_PUBLISHER_CREATE, 'submit')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             $buttonTray->addElement(new Button('', '', _CO_PUBLISHER_CLEAR, 'reset')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |         $buttonTray->addElement(new Button('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |         $buttonCancel = new Button('', '', _CO_PUBLISHER_CANCEL, 'button'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |         $buttonCancel->set('onclick', 'history.go(-1);'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |         $buttonTray->addElement($buttonCancel); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         $this->addElement($buttonTray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         $hidden = new Hidden('itemid', $obj->getVar('itemid')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |         $this->addElement($hidden); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |         unset($hidden); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |      * Build the main tab | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |      * @param Publisher\Item     $obj     data source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |      * @param ContainerInterface $mainTab add elements to this tab/form | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     private function buildMainTab(Publisher\Item $obj, ContainerInterface $mainTab): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |         $xoops = Xoops::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         $helper = Helper::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         // Category | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |         $category_select = new Select(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         $category_select->setDescription(_CO_PUBLISHER_CATEGORY_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |         $category_select->addOptionArray($helper->getCategoryHandler()->getCategoriesForSubmit()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         $mainTab->addElement($category_select); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         // ITEM TITLE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |         $mainTab->addElement(new Text(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |         // SUBTITLE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         if ($this->isGranted(\_PUBLISHER_SUBTITLE)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |             $mainTab->addElement(new Text(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e'))); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         // SHORT URL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |         if ($this->isGranted(\_PUBLISHER_ITEM_SHORT_URL)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |             $text_short_url = new Text(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->getVar('short_url', 'e')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |             $text_short_url->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |             $mainTab->addElement($text_short_url); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |         // TAGS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |         if ($xoops->isActiveModule('tag') && $this->isGranted(\_PUBLISHER_ITEM_TAG)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |             require_once $xoops->path('modules/tag/include/formtag.php'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |             $text_tags = new \Tag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |             $mainTab->addElement($text_tags); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         $this->buildEditors($obj, $mainTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |         $this->buildTSOptions($obj, $mainTab); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |         // Available pages to wrap | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |         if ($this->isGranted(\_PUBLISHER_AVAILABLE_PAGE_WRAP)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |             $wrap_pages = XoopsLists::getHtmlListAsArray(Publisher\Utils::getUploadDir(true, 'content')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |             $available_wrap_pages_text = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |             foreach ($wrap_pages as $page) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |                 $available_wrap_pages_text[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap=$page] \");'" . " onmouseover='style.cursor=\"pointer\"'>$page</span>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |             $available_wrap_pages = new Label(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, \implode(', ', $available_wrap_pages_text)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |             $available_wrap_pages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |             $mainTab->addElement($available_wrap_pages); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |         // Uid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |         /*  We need to retrieve the users manually because for some reason, on the frxoops.org server, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |          the method users::getobjects encounters a memory error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |          */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |         if ($this->isGranted(\_PUBLISHER_UID)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |             $uid_select = new SelectUser(_CO_PUBLISHER_UID, 'uid', true, [$obj->getVar('uid', 'e')], 1, false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |             $uid_select->setDescription(_CO_PUBLISHER_UID_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |             $mainTab->addElement($uid_select); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |         // Author Alias | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |         if ($this->isGranted(\_PUBLISHER_AUTHOR_ALIAS)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |             $element = new Text(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |             $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |             $mainTab->addElement($element); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |             unset($element); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |         // STATUS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |         if ($this->isGranted(\_PUBLISHER_STATUS)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |             $options = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |                 \_PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |                 \_PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |                 \_PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |                 \_PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |             ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |             $status_select = new Select(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |             $status_select->addOptionArray($options); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |             $status_select->setDescription(_CO_PUBLISHER_STATUS_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |             $mainTab->addElement($status_select); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |             unset($status_select); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |         // Datesub | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |         if ($this->isGranted(\_PUBLISHER_DATESUB)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |             $datesub = (0 == $obj->getVar('datesub')) ? \time() : $obj->getVar('datesub'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |             $datesub_datetime = new DateTimeSelect(_CO_PUBLISHER_DATESUB, 'datesub', $datesub); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |             $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |             $mainTab->addElement($datesub_datetime); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |         // NOTIFY ON PUBLISH | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |         if ($this->isGranted(\_PUBLISHER_NOTIFY)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |             $notify_radio = new RadioYesNo(_CO_PUBLISHER_NOTIFY, 'notify', $obj->getVar('notifypub')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |             $mainTab->addElement($notify_radio); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |      * Build the summary and body editors | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |      * @param Publisher\Item     $obj     data source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |      * @param ContainerInterface $mainTab add elements to this tab/form | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |     private function buildEditors(Publisher\Item $obj, ContainerInterface $mainTab): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |         $xoops = Xoops::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |         $helper = Helper::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |         // SELECT EDITOR | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |         $allowed_editors = Publisher\Utils::getEditors($helper->getPermissionHandler()->getGrantedItems('editors')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         $nohtml = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |         if (1 == \count($allowed_editors)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |             $editor = $allowed_editors[0]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |             if (\count($allowed_editors) > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |                 $editor = @$_POST['editor']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |                 if (!empty($editor)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |                     Publisher\Utils::setCookieVar('publisher_editor', $editor); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |                 } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |                     $editor = Publisher\Utils::getCookieVar('publisher_editor'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |                     if (empty($editor) && $xoops->isUser()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |                         $editor = $xoops->user->getVar('publisher_editor'); // Need set through user profile | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |                 $editor = (empty($editor) || !\in_array($editor, $allowed_editors)) ? $helper->getConfig('submit_editor') : $editor; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |                 $form_editor = new SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |                 $mainTab->addElement($form_editor); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |                 $editor = $helper->getConfig('submit_editor'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |         $editor_configs = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |         $editor_configs['rows'] = !$helper->getConfig('submit_editor_rows') ? 35 : $helper->getConfig('submit_editor_rows'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |         $editor_configs['cols'] = !$helper->getConfig('submit_editor_cols') ? 60 : $helper->getConfig('submit_editor_cols'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |         $editor_configs['width'] = !$helper->getConfig('submit_editor_width') ? '100%' : $helper->getConfig('submit_editor_width'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |         $editor_configs['height'] = !$helper->getConfig('submit_editor_height') ? '400px' : $helper->getConfig('submit_editor_height'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |         // SUMMARY | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |         if ($this->isGranted(\_PUBLISHER_SUMMARY)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |             // Description | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |             $editor_configs['name'] = 'summary'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |             $editor_configs['value'] = $obj->getVar('summary', 'e'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |             $summary_text = new Editor(_CO_PUBLISHER_SUMMARY, $editor, $editor_configs, $nohtml, $onfailure = null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |             $summary_text->setDescription(_CO_PUBLISHER_SUMMARY_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |             $mainTab->addElement($summary_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |         // BODY | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |         $editor_configs['name'] = 'body'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |         $editor_configs['value'] = $obj->getVar('body', 'e'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |         $body_text = new Editor(_CO_PUBLISHER_BODY, $editor, $editor_configs, $nohtml, $onfailure = null); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |         $body_text->setDescription(_CO_PUBLISHER_BODY_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         $mainTab->addElement($body_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |      * Build the option selectors for Text\Sanitizer display processing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |      * @param Publisher\Item     $obj     data source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |      * @param ContainerInterface $mainTab add elements to this tab/form | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |     private function buildTSOptions(Publisher\Item $obj, ContainerInterface $mainTab): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |         // VARIOUS OPTIONS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |         if ($this->isGranted(\_PUBLISHER_DOHTML)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |             $html_radio = new RadioYesNo(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->getVar('dohtml')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |             $mainTab->addElement($html_radio); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |         if ($this->isGranted(\_PUBLISHER_DOSMILEY)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |             $smiley_radio = new RadioYesNo(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->getVar('dosmiley')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |             $mainTab->addElement($smiley_radio); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |         if ($this->isGranted(\_PUBLISHER_DOXCODE)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |             $xcode_radio = new RadioYesNo(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->getVar('doxcode')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |             $mainTab->addElement($xcode_radio); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |         if ($this->isGranted(\_PUBLISHER_DOIMAGE)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |             $image_radio = new RadioYesNo(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->getVar('doimage')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |             $mainTab->addElement($image_radio); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         if ($this->isGranted(\_PUBLISHER_DOLINEBREAK)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |             $linebreak_radio = new RadioYesNo(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->getVar('dobr')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |             $mainTab->addElement($linebreak_radio); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |      * Build the files tab | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |      * @param Publisher\Item     $obj      data source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |      * @param ContainerInterface $filesTab add elements to this tab/form | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |     private function buildFilesTab(Publisher\Item $obj, ContainerInterface $filesTab): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |         $helper = Helper::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         // File upload UPLOAD | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |         if ($this->isGranted(\_PUBLISHER_ITEM_UPLOAD_FILE)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |             // NAME | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |             $name_text = new Text(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |             $name_text->setDescription(_CO_PUBLISHER_FILE_NAME_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |             $filesTab->addElement($name_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |             unset($name_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |             // DESCRIPTION | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |             $description_text = new TextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |             $description_text->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |             $filesTab->addElement($description_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |             unset($description_text); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |             //1 - active | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |             $status_select = new RadioYesNo(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |             $status_select->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |             $filesTab->addElement($status_select); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |             unset($status_select); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |             $file_box = new File(_CO_PUBLISHER_ITEM_UPLOAD_FILE, 'item_upload_file'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |             $file_box->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |             $file_box->set('size', 50); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |             $filesTab->addElement($file_box); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |             unset($file_box); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |             if (!$obj->isNew()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |                 $filesObj = $helper->getFileHandler()->getAllFiles($obj->getVar('itemid')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |                 if (\count($filesObj) > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |                     $table = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |                     $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |                     $table .= '<tr>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |                     $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |                     $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . '</strong></td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |                     $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . '</strong></td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |                     $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . '</strong></td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |                     $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . '</strong></td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |                     $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |                     $table .= '</tr>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |                     /* @var Publisher\File $fileObj */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |                     foreach ($filesObj as $fileObj) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |                         $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->getVar('fileid') . "'><img src='" . \PUBLISHER_URL . "/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "'></a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |                         $delete = "<a href='file.php?op=del&fileid=" . $fileObj->getVar('fileid') . "'><img src='" . \PUBLISHER_URL . "/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'></a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |                         if (0 == $fileObj->getVar('status')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |                             $notVisible = "<img src='" . \PUBLISHER_URL . "/images/no.gif'>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |                         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |                             $notVisible = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |                         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |                         $table .= '<tr>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |                         $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . '</td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |                         $table .= "<td class='odd' align='left'>" . $notVisible . $fileObj->getFileLink() . '</td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |                         $table .= "<td class='even' align='left'>" . $fileObj->getVar('description') . '</td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |                         $table .= "<td class='even' align='center'>" . $fileObj->getVar('counter') . ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |                         $table .= "<td class='even' align='center'>" . $fileObj->datesub() . '</td>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |                         $table .= "<td class='even' align='center'> {$modify} {$delete} </td>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |                         $table .= '</tr>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |                     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |                     $table .= '</table>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |                     $files_box = new Label(_CO_PUBLISHER_FILES_LINKED, $table); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |                     $filesTab->addElement($files_box); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |                     unset($files_box, $filesObj, $fileObj); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |      * Build the images tab | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |      * @param Publisher\Item     $obj       data source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |      * @param ContainerInterface $imagesTab add elements to this tab/form | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 440 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 441 |  |  |     private function buildImagesTab(Publisher\Item $obj, ContainerInterface $imagesTab): void | 
            
                                                                        
                            
            
                                    
            
            
                | 442 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 443 |  |  |         $xoops = Xoops::getInstance(); | 
            
                                                                        
                            
            
                                    
            
            
                | 444 |  |  |         $group = $xoops->getUserGroups(); | 
            
                                                                        
                            
            
                                    
            
            
                | 445 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 446 |  |  |         // IMAGE | 
            
                                                                        
                            
            
                                    
            
            
                | 447 |  |  |         if ($this->isGranted(\_PUBLISHER_IMAGE_ITEM)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 448 |  |  |             $imgcatHandler = Images::getInstance()->getHandlerCategories(); | 
            
                                                                        
                            
            
                                    
            
            
                | 449 |  |  |             $imageHandler = Images::getInstance()->getHandlerImages(); | 
            
                                                                        
                            
            
                                    
            
            
                | 450 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 451 |  |  |             $objimages = $obj->getImages(); | 
            
                                                                        
                            
            
                                    
            
            
                | 452 |  |  |             $mainarray = \is_object($objimages['main']) ? [$objimages['main']] : []; | 
            
                                                                        
                            
            
                                    
            
            
                | 453 |  |  |             $mergedimages = \array_merge($mainarray, $objimages['others']); | 
            
                                                                        
                            
            
                                    
            
            
                | 454 |  |  |             $objimage_array = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 455 |  |  |             /* @var \ImagesImage $imageObj */ | 
            
                                                                        
                            
            
                                    
            
            
                | 456 |  |  |             foreach ($mergedimages as $imageObj) { | 
            
                                                                        
                            
            
                                    
            
            
                | 457 |  |  |                 $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); | 
            
                                                                        
                            
            
                                    
            
            
                | 458 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 459 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 460 |  |  |             $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1); | 
            
                                                                        
                            
            
                                    
            
            
                | 461 |  |  |             $catids = \array_keys($catlist); | 
            
                                                                        
                            
            
                                    
            
            
                | 462 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 463 |  |  |             $imageObjs = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 464 |  |  |             if (!empty($catids)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 465 |  |  |                 $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . \implode(',', $catids) . ')', 'IN')); | 
            
                                                                        
                            
            
                                    
            
            
                | 466 |  |  |                 $criteria->add(new Criteria('image_display', 1)); | 
            
                                                                        
                            
            
                                    
            
            
                | 467 |  |  |                 $criteria->setSort('image_nicename'); | 
            
                                                                        
                            
            
                                    
            
            
                | 468 |  |  |                 $criteria->setOrder('ASC'); | 
            
                                                                        
                            
            
                                    
            
            
                | 469 |  |  |                 $imageObjs = $imageHandler->getObjects($criteria, true); | 
            
                                                                        
                            
            
                                    
            
            
                | 470 |  |  |                 unset($criteria); | 
            
                                                                        
                            
            
                                    
            
            
                | 471 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 472 |  |  |             $image_array = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 473 |  |  |             foreach ($imageObjs as $imageObj) { | 
            
                                                                        
                            
            
                                    
            
            
                | 474 |  |  |                 $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); | 
            
                                                                        
                            
            
                                    
            
            
                | 475 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 476 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 477 |  |  |             $image_array = \array_diff($image_array, $objimage_array); | 
            
                                                                        
                            
            
                                    
            
            
                | 478 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 479 |  |  |             $image_select = new Select('', 'image_notused', '', 5); | 
            
                                                                        
                            
            
                                    
            
            
                | 480 |  |  |             $image_select->addOptionArray($image_array); | 
            
                                                                        
                            
            
                                    
            
            
                | 481 |  |  |             $image_select->set('onchange', 'showImgSelected("image_display", "image_notused", "uploads/", "", "' . XoopsBaseConfig::get('url') . '")'); | 
            
                                                                        
                            
            
                                    
            
            
                | 482 |  |  |             unset($image_array); | 
            
                                                                        
                            
            
                                    
            
            
                | 483 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 484 |  |  |             $image_select2 = new Select('', 'image_item', '', 5, true); | 
            
                                                                        
                            
            
                                    
            
            
                | 485 |  |  |             $image_select2->addOptionArray($objimage_array); | 
            
                                                                        
                            
            
                                    
            
            
                | 486 |  |  |             $image_select2->set('onchange', 'publisher_updateSelectOption("image_item", "image_featured"), ' . 'showImgSelected("image_display", "image_item", "uploads/", "", "' . XoopsBaseConfig::get('url') . '");'); | 
            
                                                                        
                            
            
                                    
            
            
                | 487 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 488 |  |  |             $buttonadd = new Button('', 'buttonadd', _CO_PUBLISHER_ADD); | 
            
                                                                        
                            
            
                                    
            
            
                | 489 |  |  |             $buttonadd->set('onclick', 'publisher_appendSelectOption("image_notused", "image_item"), ' . 'publisher_updateSelectOption("image_item", "image_featured");'); | 
            
                                                                        
                            
            
                                    
            
            
                | 490 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 491 |  |  |             $buttonremove = new Button('', 'buttonremove', _CO_PUBLISHER_REMOVE); | 
            
                                                                        
                            
            
                                    
            
            
                | 492 |  |  |             $buttonremove->set('onclick', 'publisher_appendSelectOption("image_item", "image_notused"), ' . 'publisher_updateSelectOption("image_item", "image_featured");'); | 
            
                                                                        
                            
            
                                    
            
            
                | 493 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 494 |  |  |             $opentable = new Label('', '<table><tr><td>'); | 
            
                                                                        
                            
            
                                    
            
            
                | 495 |  |  |             $addcol = new Label('', '</td><td>'); | 
            
                                                                        
                            
            
                                    
            
            
                | 496 |  |  |             $addbreak = new Label('', '<br>'); | 
            
                                                                        
                            
            
                                    
            
            
                | 497 |  |  |             $closetable = new Label('', '</td></tr></table>'); | 
            
                                                                        
                            
            
                                    
            
            
                | 498 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 499 |  |  |             $xoops->theme()->addScript(\PUBLISHER_URL . '/js/ajaxupload.3.9.js'); | 
            
                                                                        
                            
            
                                    
            
            
                | 500 |  |  |             //todo, find replacement for error class | 
            
                                                                        
                            
            
                                    
            
            
                | 501 |  |  |             $js_data = new Label('', ' | 
            
                                                                        
                            
            
                                    
            
            
                | 502 |  |  | <script type= "text/javascript">/*<![CDATA[*/ | 
            
                                                                        
                            
            
                                    
            
            
                | 503 |  |  | $(document).ready(function(){ | 
            
                                                                        
                            
            
                                    
            
            
                | 504 |  |  |     var button = $("#publisher_upload_button"), interval; | 
            
                                                                        
                            
            
                                    
            
            
                | 505 |  |  |     new AjaxUpload(button,{ | 
            
                                                                        
                            
            
                                    
            
            
                | 506 |  |  |         action: "' . \PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons | 
            
                                                                        
                            
            
                                    
            
            
                | 507 |  |  |         responseType: "text/html", | 
            
                                                                        
                            
            
                                    
            
            
                | 508 |  |  |         name: "publisher_upload_file", | 
            
                                                                        
                            
            
                                    
            
            
                | 509 |  |  |         onSubmit : function(file, ext){ | 
            
                                                                        
                            
            
                                    
            
            
                | 510 |  |  |             // change button text, when user selects file | 
            
                                                                        
                            
            
                                    
            
            
                | 511 |  |  |             $("#publisher_upload_message").html(" "); | 
            
                                                                        
                            
            
                                    
            
            
                | 512 |  |  |             button.html("<img src=\'' . \PUBLISHER_URL . '/images/loadingbar.gif\'>"); this.setData({ | 
            
                                                                        
                            
            
                                    
            
            
                | 513 |  |  |                 "image_nicename": $("#image_nicename").val(), | 
            
                                                                        
                            
            
                                    
            
            
                | 514 |  |  |                 "imgcat_id" : $("#imgcat_id").val() | 
            
                                                                        
                            
            
                                    
            
            
                | 515 |  |  |             }); | 
            
                                                                        
                            
            
                                    
            
            
                | 516 |  |  |             // If you want to allow uploading only 1 file at time, | 
            
                                                                        
                            
            
                                    
            
            
                | 517 |  |  |             // you can disable upload button | 
            
                                                                        
                            
            
                                    
            
            
                | 518 |  |  |             this.disable(); | 
            
                                                                        
                            
            
                                    
            
            
                | 519 |  |  |             interval = window.setInterval(function(){ | 
            
                                                                        
                            
            
                                    
            
            
                | 520 |  |  |             }, 200); | 
            
                                                                        
                            
            
                                    
            
            
                | 521 |  |  |         }, | 
            
                                                                        
                            
            
                                    
            
            
                | 522 |  |  |         onComplete: function(file, response){ | 
            
                                                                        
                            
            
                                    
            
            
                | 523 |  |  |             button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '"); | 
            
                                                                        
                            
            
                                    
            
            
                | 524 |  |  |             window.clearInterval(interval); | 
            
                                                                        
                            
            
                                    
            
            
                | 525 |  |  |             // enable upload button | 
            
                                                                        
                            
            
                                    
            
            
                | 526 |  |  |             this.enable(); | 
            
                                                                        
                            
            
                                    
            
            
                | 527 |  |  |             // add file to the list | 
            
                                                                        
                            
            
                                    
            
            
                | 528 |  |  |             var result = eval(response); | 
            
                                                                        
                            
            
                                    
            
            
                | 529 |  |  |             if (result[0] == "success") { | 
            
                                                                        
                            
            
                                    
            
            
                | 530 |  |  |                  $("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>"); | 
            
                                                                        
                            
            
                                    
            
            
                | 531 |  |  |                  publisher_updateSelectOption(\'image_item\', \'image_featured\'); | 
            
                                                                        
                            
            
                                    
            
            
                | 532 |  |  |                  showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XoopsBaseConfig::get('url') . '\') | 
            
                                                                        
                            
            
                                    
            
            
                | 533 |  |  |             } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 534 |  |  |                  $("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>"); | 
            
                                                                        
                            
            
                                    
            
            
                | 535 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 536 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 537 |  |  |     }); | 
            
                                                                        
                            
            
                                    
            
            
                | 538 |  |  | }); | 
            
                                                                        
                            
            
                                    
            
            
                | 539 |  |  | /*]]>*/</script> | 
            
                                                                        
                            
            
                                    
            
            
                | 540 |  |  | '); | 
            
                                                                        
                            
            
                                    
            
            
                | 541 |  |  |             $messages = new Label('', "<div id='publisher_upload_message'></div>"); | 
            
                                                                        
                            
            
                                    
            
            
                | 542 |  |  |             $button = new Label('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '</div>'); | 
            
                                                                        
                            
            
                                    
            
            
                | 543 |  |  |             $nicename = new Text('', 'image_nicename', 30, 30, \_CO_PUBLISHER_IMAGE_NICENAME); | 
            
                                                                        
                            
            
                                    
            
            
                | 544 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 545 |  |  |             $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1); | 
            
                                                                        
                            
            
                                    
            
            
                | 546 |  |  |             $imagecat = new Select('', 'imgcat_id', '', 1); | 
            
                                                                        
                            
            
                                    
            
            
                | 547 |  |  |             $imagecat->addOptionArray($catlist); | 
            
                                                                        
                            
            
                                    
            
            
                | 548 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 549 |  |  |             $image_upload_tray = new ElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, ''); | 
            
                                                                        
                            
            
                                    
            
            
                | 550 |  |  |             $image_upload_tray->addElement($js_data); | 
            
                                                                        
                            
            
                                    
            
            
                | 551 |  |  |             $image_upload_tray->addElement($messages); | 
            
                                                                        
                            
            
                                    
            
            
                | 552 |  |  |             $image_upload_tray->addElement($opentable); | 
            
                                                                        
                            
            
                                    
            
            
                | 553 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 554 |  |  |             $image_upload_tray->addElement($imagecat); | 
            
                                                                        
                            
            
                                    
            
            
                | 555 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 556 |  |  |             $image_upload_tray->addElement($addbreak); | 
            
                                                                        
                            
            
                                    
            
            
                | 557 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 558 |  |  |             $image_upload_tray->addElement($nicename); | 
            
                                                                        
                            
            
                                    
            
            
                | 559 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 560 |  |  |             $image_upload_tray->addElement($addbreak); | 
            
                                                                        
                            
            
                                    
            
            
                | 561 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 562 |  |  |             $image_upload_tray->addElement($button); | 
            
                                                                        
                            
            
                                    
            
            
                | 563 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 564 |  |  |             $image_upload_tray->addElement($closetable); | 
            
                                                                        
                            
            
                                    
            
            
                | 565 |  |  |             $imagesTab->addElement($image_upload_tray); | 
            
                                                                        
                            
            
                                    
            
            
                | 566 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 567 |  |  |             $image_tray = new ElementTray(_CO_PUBLISHER_IMAGE_ITEMS, ''); | 
            
                                                                        
                            
            
                                    
            
            
                | 568 |  |  |             $image_tray->addElement($opentable); | 
            
                                                                        
                            
            
                                    
            
            
                | 569 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 570 |  |  |             $image_tray->addElement($image_select); | 
            
                                                                        
                            
            
                                    
            
            
                | 571 |  |  |             $image_tray->addElement($addbreak); | 
            
                                                                        
                            
            
                                    
            
            
                | 572 |  |  |             $image_tray->addElement($buttonadd); | 
            
                                                                        
                            
            
                                    
            
            
                | 573 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 574 |  |  |             $image_tray->addElement($addcol); | 
            
                                                                        
                            
            
                                    
            
            
                | 575 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 576 |  |  |             $image_tray->addElement($image_select2); | 
            
                                                                        
                            
            
                                    
            
            
                | 577 |  |  |             $image_tray->addElement($addbreak); | 
            
                                                                        
                            
            
                                    
            
            
                | 578 |  |  |             $image_tray->addElement($buttonremove); | 
            
                                                                        
                            
            
                                    
            
            
                | 579 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 580 |  |  |             $image_tray->addElement($closetable); | 
            
                                                                        
                            
            
                                    
            
            
                | 581 |  |  |             $image_tray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC); | 
            
                                                                        
                            
            
                                    
            
            
                | 582 |  |  |             $imagesTab->addElement($image_tray); | 
            
                                                                        
                            
            
                                    
            
            
                | 583 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 584 |  |  |             $imagename = \is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : ''; | 
            
                                                                        
                            
            
                                    
            
            
                | 585 |  |  |             $imageforpath = ('' != $imagename) ? $imagename : 'blank.gif'; | 
            
                                                                        
                            
            
                                    
            
            
                | 586 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 587 |  |  |             $image_select3 = new Select(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1); | 
            
                                                                        
                            
            
                                    
            
            
                | 588 |  |  |             $image_select3->addOptionArray($objimage_array); | 
            
                                                                        
                            
            
                                    
            
            
                | 589 |  |  |             $image_select3->set('onchange', 'showImgSelected("image_display", "image_featured", "uploads/", "", "' . XoopsBaseConfig::get('url') . '");'); | 
            
                                                                        
                            
            
                                    
            
            
                | 590 |  |  |             $image_select3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC); | 
            
                                                                        
                            
            
                                    
            
            
                | 591 |  |  |             $imagesTab->addElement($image_select3); | 
            
                                                                        
                            
            
                                    
            
            
                | 592 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 593 |  |  |             $imgTag = new Img([ | 
            
                                                                        
                            
            
                                    
            
            
                | 594 |  |  |                                          'src' => $xoops->url('uploads/' . $imageforpath), | 
            
                                                                        
                            
            
                                    
            
            
                | 595 |  |  |                                          'width' => 500, | 
            
                                                                        
                            
            
                                    
            
            
                | 596 |  |  |                                          'name' => 'image_display', | 
            
                                                                        
                            
            
                                    
            
            
                | 597 |  |  |                                          'id' => 'image_display', | 
            
                                                                        
                            
            
                                    
            
            
                | 598 |  |  |                                          'alt' => '', | 
            
                                                                        
                            
            
                                    
            
            
                | 599 |  |  |                                      ]); | 
            
                                                                        
                            
            
                                    
            
            
                | 600 |  |  |             $image_preview = new Label(_CO_PUBLISHER_IMAGE_PREVIEW, $imgTag->render()); | 
            
                                                                        
                            
            
                                    
            
            
                | 601 |  |  |             $imagesTab->addElement($image_preview); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |      * Build the others tab | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |      * @param Publisher\Item     $obj       data source | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |      * @param ContainerInterface $othersTab add elements to this tab/form | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |     private function buildOthersTab(Publisher\Item $obj, ContainerInterface $othersTab): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |         // Meta Keywords | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |         if ($this->isGranted(\_PUBLISHER_ITEM_META_KEYWORDS)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |             $text_meta_keywords = new TextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->getVar('meta_keywords', 'e'), 7, 60); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |             $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |             $othersTab->addElement($text_meta_keywords); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |         // Meta Description | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |         if ($this->isGranted(\_PUBLISHER_ITEM_META_DESCRIPTION)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |             $text_meta_description = new TextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->getVar('meta_description', 'e'), 7, 60); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |             $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |             $othersTab->addElement($text_meta_description); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |         // COMMENTS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |         if ($this->isGranted(\_PUBLISHER_ALLOWCOMMENTS)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |             $addcomments_radio = new RadioYesNo(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->getVar('cancomment')); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |             $othersTab->addElement($addcomments_radio); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |         // WEIGHT | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |         if ($this->isGranted(\_PUBLISHER_WEIGHT)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |             $othersTab->addElement(new Text(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->getVar('weight'))); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |      * setCheckPermissions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |      * @param bool $checkperm true to check permissions, false to ignore permissions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |     public function setCheckPermissions($checkperm): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 646 |  |  |         $this->checkperm = (bool)$checkperm; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 647 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 648 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 649 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 650 |  |  |      * isGranted | 
            
                                                                                                            
                            
            
                                    
            
            
                | 651 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 652 |  |  |      * @param int $item permission item to check | 
            
                                                                                                            
                            
            
                                    
            
            
                | 653 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 654 |  |  |      * @return bool true if permission is granted, false if not | 
            
                                                                                                            
                            
            
                                    
            
            
                | 655 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 656 |  |  |     private function isGranted($item): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 657 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 658 |  |  |         $helper = Helper::getInstance(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 659 |  |  |         $ret = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 660 |  |  |         if (!$this->checkperm || $helper->getPermissionHandler()->isGranted('form_view', $item)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 661 |  |  |             $ret = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 662 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 663 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 664 |  |  |         return $ret; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 665 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 666 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 667 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 668 |  |  |      * hasTab | 
            
                                                                                                            
                            
            
                                    
            
            
                | 669 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 670 |  |  |      * @param string $tab tab name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 671 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 672 |  |  |      * @return bool true if form has tab named $tab | 
            
                                                                                                            
                            
            
                                    
            
            
                | 673 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 674 |  |  |     private function hasTab($tab): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 675 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 676 |  |  |         if (!isset($tab, $this->tabs[$tab])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 677 |  |  |             return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 678 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 679 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 680 |  |  |         $tabRef = $this->tabs[$tab]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 681 |  |  |         $items = $this->$tabRef; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 682 |  |  |         foreach ($items as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 683 |  |  |             if ($this->isGranted($item)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 684 |  |  |                 return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 685 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 686 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 687 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 688 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 689 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 690 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 691 |  |  |  |