/** * Get a {@link XoopsForm} object for creating/editing Spotlight articles * * @return object */ function getForm($action = false) { if ($action === false) { $action = $_SERVER['REQUEST_URI']; } $title = _AMS_AM_SPOTLIGHT; include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; include_once XOOPS_ROOT_PATH . "/modules/AMS/class/formimageselect.php"; $form = new XoopsThemeForm($title, 'spotlightform', $action); if (!$this->isNew()) { $form->addElement(new XoopsFormHidden('id', $this->getVar('spotlightid'))); } $mode_select = new XoopsFormRadio('', 'mode', $this->getVar('mode')); $mode_select->addOption(1, _AMS_AM_SPOT_LATESTARTICLE); $mode_select->addOption(2, _AMS_AM_SPOT_LATESTINTOPIC); $mode_select->addOption(3, _AMS_AM_SPOT_SPECIFICARTICLE); $mode_select->addOption(4, _AMS_AM_SPOT_CUSTOM); include_once XOOPS_ROOT_PATH . "/class/tree.php"; include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newstopic.php"; include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php"; $xt = new AmsTopic($GLOBALS['xoopsDB']->prefix("ams_topics")); $allTopics = $xt->getAllTopics(); $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topic_select = new XoopsFormLabel(_AMS_AM_TOPIC, $topic_obj_tree->makeSelBox('topicid', 'topic_title', '--', $this->getVar('topicid'), false)); $topic_select->setDescription(_AMS_AM_SPOT_TOPIC_DESC); $article_select = new XoopsFormSelect(_AMS_AM_ARTICLE, 'storyid', $this->getVar('storyid')); $article_select->addOptionArray(AmsStory::getAllPublished($GLOBALS['xoopsModuleConfig']['spotlight_art_num'], 0, false, 0, 1, false)); $article_select->setDescription(_AMS_AM_SPOT_ARTICLE_DESC); $mode_tray = new XoopsFormElementTray(_AMS_AM_SPOT_MODE_SELECT); $mode_tray->addElement($mode_select); $showimage_select = new XoopsFormRadio(_AMS_AM_SPOT_SHOWIMAGE, 'showimage', $this->getVar('showimage')); $showimage_select->addOption(0, _AMS_AM_SPOT_SPECIFYIMAGE); $showimage_select->addOption(1, _AMS_AM_SPOT_TOPICIMAGE); $showimage_select->addOption(2, _AMS_AM_SPOT_AUTHORIMAGE); $showimage_select->addOption(3, _AMS_AM_SPOT_NOIMAGE); $showimage_select->setDescription(_AMS_AM_SPOT_SHOWIMAGE_DESC); $image_select = new XoopsFormImageSelect(_AMS_AM_SPOT_IMAGE, 'image', $this->getVar('image', 'e'), 70, 255); $autoteaser_select = new XoopsFormRadioYN(_AMS_AM_SPOT_AUTOTEASER, 'autoteaser', $this->getVar('autoteaser')); $teaser_text = new XoopsFormDhtmlTextArea(_AMS_AM_SPOT_TEASER, 'teaser', $this->getVar('teaser', 'e')); $maxlength_text = new XoopsFormText(_AMS_AM_SPOT_MAXLENGTH, 'maxlength', 10, 10, $this->getVar('maxlength')); $display_select = new XoopsFormRadioYN(_AMS_AM_SPOT_DISPLAY, 'display', $this->getVar('display')); $weight_text = new XoopsFormText(_AMS_AM_SPOT_WEIGHT, 'weight', 10, 10, $this->getVar('weight')); $form->addElement($mode_tray); $form->addElement($topic_select); $form->addElement($article_select); $form->addElement($showimage_select); $form->addElement($image_select); $form->addElement($autoteaser_select); $form->addElement($maxlength_text); $form->addElement($teaser_text); $form->addElement($display_select); $form->addElement($weight_text); $form->addElement(new XoopsFormHidden('op', 'save')); $form->addElement(new XoopsFormButton('', 'spotlightsubmit', _AMS_AM_SUBMIT, 'submit')); return $form; }
/** * @param MenusMenu $obj */ public function __construct(MenusMenu $obj) { global $menu_id; $xoops = Xoops::getInstance(); $helper = Menus::getInstance(); $this_handler = $helper->getHandlerMenu(); $decorators = MenusDecorator::getAvailableDecorators(); $title = $obj->isNew() ? sprintf(_AM_MENUS_ADD_MENUS) : sprintf(_AM_MENUS_EDIT_MENUS); parent::__construct($title, 'form', 'admin_menu.php', 'post', true); $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_TITLE, 'title', 50, 255, $obj->getVar('title'), ''), true); $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_ALTTITLE, 'alt_title', 50, 255, $obj->getVar('alt_title'), '')); $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_LINK, 'link', 50, 255, $obj->getVar('link'), '')); $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_IMAGE, 'image', 50, 255, $obj->getVar('image'), '')); $criteria = new CriteriaCompo(new Criteria('mid', $menu_id)); $criteria->add(new Criteria('id', $obj->getVar('id'), '<>')); $criteria->setSort('weight'); $criteria->setOrder('ASC'); $results = $this_handler->getAll($criteria, array('title', 'id', 'pid')); $parent_tree = new XoopsObjectTree($results, 'id', 'pid'); $parent_select = $parent_tree->makeSelBox('pid', 'title', '-- ', $obj->getVar('pid'), true); $this->addElement(new Xoops\Form\Label(_AM_MENUS_MENU_PARENT, $parent_select)); $formvis = new Xoops\Form\Select(_AM_MENUS_MENU_VISIBLE, "visible", $obj->getVar('visible')); $formvis->addOption("0", XoopsLocale::NO); $formvis->addOption("1", XoopsLocale::YES); $this->addElement($formvis); $formtarget = new Xoops\Form\Select(_AM_MENUS_MENU_TARGET, "target", $obj->getVar('target')); $formtarget->addOption("_self", _AM_MENUS_MENU_TARG_SELF); $formtarget->addOption("_blank", _AM_MENUS_MENU_TARG_BLANK); $formtarget->addOption("_parent", _AM_MENUS_MENU_TARG_PARENT); $formtarget->addOption("_top", _AM_MENUS_MENU_TARG_TOP); $this->addElement($formtarget); $formgroups = new Xoops\Form\SelectGroup(_AM_MENUS_MENU_GROUPS, "groups", true, $obj->getVar('groups'), 5, true); $formgroups->setDescription(_AM_MENUS_MENU_GROUPS_HELP); $this->addElement($formgroups); $formhooks = new Xoops\Form\Select(_AM_MENUS_MENU_ACCESS_FILTER, "hooks", $obj->getVar('hooks'), 5, true); $accessFilter = array(); foreach ($decorators as $decorator) { $decorator->accessFilter($accessFilter); } foreach ($accessFilter as $result) { $formhooks->addOption($result['method'], $result['name']); } $this->addElement($formhooks); $formcss = new Xoops\Form\Text(_AM_MENUS_MENU_CSS, 'css', 50, 255, $obj->getVar('css')); $this->addElement($formcss); $this->addElement(new Xoops\Form\Hidden('id', $obj->getVar('id'))); $this->addElement(new Xoops\Form\Hidden('mid', $obj->getVar('mid'))); $this->addElement(new Xoops\Form\Hidden('op', 'save')); $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); }
/** * @param bool $action * @return XoopsThemeForm */ public function getForm($action = false) { global $xoopsDB, $xoopsModuleConfig; if ($action === false) { $action = $_SERVER['REQUEST_URI']; } $title = $this->isNew() ? sprintf(_AM_PRESENTER_CAT_ADD) : sprintf(_AM_PRESENTER_CAT_EDIT); include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $form = new XoopsThemeForm($title, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); // Cat_pid include_once XOOPS_ROOT_PATH . '/class/tree.php'; $categoriesHandler =& xoops_getModuleHandler('categories', 'presenter'); $criteria = new CriteriaCompo(); $categories = $categoriesHandler->getObjects($criteria); if ($categories) { $categories_tree = new XoopsObjectTree($categories, 'cat_id', 'cat_pid'); $cat_pid = $categories_tree->makeSelBox('cat_pid', 'cat_title', '--', $this->getVar('cat_pid', 'e'), false); $form->addElement(new XoopsFormLabel(_AM_PRESENTER_CAT_PID, $cat_pid)); } // Cat_title $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_TITLE, 'cat_title', 50, 255, $this->getVar('cat_title')), true); // Cat_desc $form->addElement(new XoopsFormTextArea(_AM_PRESENTER_CAT_DESC, 'cat_desc', $this->getVar('cat_desc'), 4, 47), true); // Cat_image $cat_image = $this->getVar('cat_image') ? $this->getVar('cat_image') : 'blank.gif'; $uploadir = '/uploads/presenter/images/categories'; $imgtray = new XoopsFormElementTray(_AM_PRESENTER_CAT_IMAGE, '<br />'); $imgpath = sprintf(_AM_PRESENTER_FORMIMAGE_PATH, $uploadir); $imageselect = new XoopsFormSelect($imgpath, 'cat_image', $cat_image); $image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadir); foreach ($image_array as $image) { $imageselect->addOption("{$image}", $image); } $imageselect->setExtra("onchange='showImgSelected(\"image_cat_image\", \"cat_image\", \"" . $uploadir . "\", \"\", \"" . XOOPS_URL . "\")'"); $imgtray->addElement($imageselect); $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadir . "/" . $cat_image . "' name='image_cat_image' id='image_cat_image' alt='' />")); $fileseltray = new XoopsFormElementTray('', '<br />'); $fileseltray->addElement(new XoopsFormFile(_AM_PRESENTER_FORMUPLOAD, 'cat_image', $xoopsModuleConfig['maxsize'])); $fileseltray->addElement(new XoopsFormLabel('')); $imgtray->addElement($fileseltray); $form->addElement($imgtray); // Cat_weight $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_WEIGHT, 'cat_weight', 50, 255, $this->getVar('cat_weight')), false); // Cat_color // $form->addElement(new XoopsFormColorPicker(_AM_PRESENTER_CAT_COLOR, 'cat_color', $this->getVar('cat_color')), false); $form->addElement(new XoopsFormHidden('op', 'save')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); return $form; }
/** * Render comments in nested view * * Danger: Recursive! * * @param integer $comment_id Always "0" when called by client. * @param boolean $admin_view */ function renderNestView($comment_id = 0, $admin_view = false) { include_once $GLOBALS['xoops']->path('class/tree.php'); $xot = new XoopsObjectTree($this->_comments, 'com_id', 'com_pid', 'com_rootid'); $tree =& $xot->getTree(); if (false != $this->_useIcons) { $title = $this->_getTitleIcon($tree[$comment_id]['obj']->getVar('com_icon')) . ' ' . $tree[$comment_id]['obj']->getVar('com_title'); } else { $title = $tree[$comment_id]['obj']->getVar('com_title'); } if (false != $admin_view) { $text = $tree[$comment_id]['obj']->getVar('com_text') . '<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' . _CM_STATUS . ': ' . $this->_statusText[$tree[$comment_id]['obj']->getVar('com_status')] . '<br />IP: <span style="font-weight: bold;">' . $tree[$comment_id]['obj']->getVar('com_ip') . '</span></div>'; } else { // skip this comment if it is not active and continue on processing its child comments instead if (XOOPS_COMMENT_ACTIVE != $tree[$comment_id]['obj']->getVar('com_status')) { // if there are any child comments, display them as root comments if (isset($tree[$comment_id]['child']) && !empty($tree[$comment_id]['child'])) { foreach ($tree[$comment_id]['child'] as $child_id) { $this->renderNestView($child_id, $admin_view); } } return; } else { $text = $tree[$comment_id]['obj']->getVar('com_text'); } } $replies = array(); $this->_renderNestReplies($tree, $comment_id, $replies, 25, $admin_view); $this->_tpl->append('comments', array('pid' => $tree[$comment_id]['obj']->getVar('com_pid'), 'id' => $tree[$comment_id]['obj']->getVar('com_id'), 'itemid' => $tree[$comment_id]['obj']->getVar('com_itemid'), 'rootid' => $tree[$comment_id]['obj']->getVar('com_rootid'), 'title' => $title, 'text' => $text, 'date_posted' => formatTimestamp($tree[$comment_id]['obj']->getVar('com_created'), 'm'), 'date_modified' => formatTimestamp($tree[$comment_id]['obj']->getVar('com_modified'), 'm'), 'poster' => $this->_getPosterArray($tree[$comment_id]['obj']->getVar('com_uid')), 'replies' => $replies)); }
/** * Add pages to $this->pages from a category tree * * @param XoopsObjectTree $tree * @param int $parentid key to start from * @param int $level * @param int $offset integer added to location * * @return void */ function traversePageTree($tree, $parentid = 0, $level = 0) { $pages =& $tree->getFirstChild($parentid); $level++; foreach (array_keys($pages) as $i) { $this->pages[] = array('location' => $pages[$i]->getVar('categoryid'), 'name' => $pages[$i]->getVar('name', 'n'), 'level' => $level); $this->traversePageTree($tree, $pages[$i]->getVar('categoryid'), $level); } }
/** * @param PublisherCategory $obj */ public function __construct(PublisherCategory $obj) { $xoops = Xoops::getInstance(); $publisher = Publisher::getInstance(); $member_handler = $xoops->getHandlerMember(); $userGroups = $member_handler->getGroupList(); parent::__construct(_AM_PUBLISHER_CATEGORY, "form", $xoops->getEnv('PHP_SELF')); $this->setExtra('enctype="multipart/form-data"'); // Category $criteria = new Criteria(null); $criteria->setSort('weight'); $criteria->setOrder('ASC'); $categories = $publisher->getCategoryHandler()->getObjects($criteria); $mytree = new XoopsObjectTree($categories, "categoryid", "parentid"); $cat_select = $mytree->makeSelBox('parentid', 'name', '--', $obj->getVar('parentid'), true); $this->addElement(new Xoops\Form\Label(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $cat_select)); // Name $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $obj->getVar('name', 'e')), true); // Description $this->addElement(new Xoops\Form\TextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $obj->getVar('description', 'e'), 7, 60)); // EDITOR $groups = $xoops->getUserGroups(); $gperm_handler = $publisher->getGrouppermHandler(); $module_id = $publisher->getModule()->mid(); $allowed_editors = PublisherUtils::getEditors($gperm_handler->getItemIds('editors', $groups, $module_id)); $nohtml = false; if (count($allowed_editors) > 0) { $editor = @$_POST['editor']; if (!empty($editor)) { PublisherUtils::setCookieVar('publisher_editor', $editor); } else { $editor = PublisherUtils::getCookieVar('publisher_editor'); if (empty($editor) && $xoops->isUser()) { $editor = $xoops->user->getVar('publisher_editor'); // Need set through user profile } } $editor = empty($editor) || !in_array($editor, $allowed_editors) ? $publisher->getConfig('submit_editor') : $editor; $form_editor = new Xoops\Form\SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors); $this->addElement($form_editor); } else { $editor = $publisher->getConfig('submit_editor'); } $editor_configs = array(); $editor_configs['rows'] = $publisher->getConfig('submit_editor_rows') == '' ? 35 : $publisher->getConfig('submit_editor_rows'); $editor_configs['cols'] = $publisher->getConfig('submit_editor_cols') == '' ? 60 : $publisher->getConfig('submit_editor_cols'); $editor_configs['width'] = $publisher->getConfig('submit_editor_width') == '' ? "100%" : $publisher->getConfig('submit_editor_width'); $editor_configs['height'] = $publisher->getConfig('submit_editor_height') == '' ? "400px" : $publisher->getConfig('submit_editor_height'); $editor_configs['name'] = 'header'; $editor_configs['value'] = $obj->getVar('header', 'e'); $text_header = new Xoops\Form\Editor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editor_configs, $nohtml, $onfailure = null); $text_header->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC); $this->addElement($text_header); // IMAGE $image_array = XoopsLists::getImgListAsArray(PublisherUtils::getImageDir('category')); $image_select = new Xoops\Form\Select('', 'image', $obj->image()); //$image_select -> addOption ('-1', '---------------'); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'"); $image_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_IMAGE, ' '); $image_tray->addElement($image_select); $image_tray->addElement(new Xoops\Form\Label('', "<br /><br /><img src='" . PublisherUtils::getImageDir('category', false) . $obj->image() . "' name='image3' id='image3' alt='' />")); $image_tray->setDescription(_AM_PUBLISHER_IMAGE_DSC); $this->addElement($image_tray); // IMAGE UPLOAD //$max_size = 5000000; $file_box = new Xoops\Form\File(_AM_PUBLISHER_IMAGE_UPLOAD, "image_file"); $file_box->setExtra("size ='45'"); $file_box->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC); $this->addElement($file_box); // Short url $text_short_url = new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $obj->getVar('short_url', 'e')); $text_short_url->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC); $this->addElement($text_short_url); // Meta Keywords $text_meta_keywords = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $obj->getVar('meta_keywords', 'e'), 7, 60); $text_meta_keywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC); $this->addElement($text_meta_keywords); // Meta Description $text_meta_description = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $obj->getVar('meta_description', 'e'), 7, 60); $text_meta_description->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC); $this->addElement($text_meta_description); // Weight $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $obj->getVar('weight'))); // Added by skalpa: custom template support //todo, check this $this->addElement(new Xoops\Form\Text("Custom template", 'template', 50, 255, $obj->getVar('template', 'e')), false); // READ PERMISSIONS $groups_read_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_READ, 'groups_read[]', $obj->getGroups_read()); foreach ($userGroups as $group_id => $group_name) { $groups_read_checkbox->addOption($group_id, $group_name); } $this->addElement($groups_read_checkbox); // SUBMIT PERMISSIONS $groups_submit_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $obj->getGroups_submit()); $groups_submit_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC); foreach ($userGroups as $group_id => $group_name) { $groups_submit_checkbox->addOption($group_id, $group_name); } $this->addElement($groups_submit_checkbox); // MODERATION PERMISSIONS $groups_moderation_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, 'groups_moderation[]', $obj->getGroups_moderation()); $groups_moderation_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC); foreach ($userGroups as $group_id => $group_name) { $groups_moderation_checkbox->addOption($group_id, $group_name); } $this->addElement($groups_moderation_checkbox); $moderator = new Xoops\Form\SelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $obj->getVar('moderator', 'e'), 1, false); $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC); $this->addElement($moderator); $cat_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />'); for ($i = 0; $i < $this->_subCatsCount; ++$i) { if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) { $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : ''; } else { $subname = ''; } $cat_tray->addElement(new Xoops\Form\Text('', 'scname[' . $i . ']', 50, 255, $subname)); } $t = new Xoops\Form\Text('', 'nb_subcats', 3, 2); $l = new Xoops\Form\Label('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render())); $b = new Xoops\Form\Button('', 'submit_subcats', _AM_PUBLISHER_ADD_OPT_SUBMIT, 'submit'); if (!$obj->getVar('categoryid')) { $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"'); } else { $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"'); } $r = new Xoops\Form\ElementTray(''); $r->addElement($l); $r->addElement($b); $cat_tray->addElement($r); $this->addElement($cat_tray); $this->addElement(new Xoops\Form\Hidden('categoryid', $obj->getVar('categoryid'))); $this->addElement(new Xoops\Form\Hidden('nb_sub_yet', $this->_subCatsCount)); // Action buttons tray $button_tray = new Xoops\Form\ElementTray('', ''); // No ID for category -- then it's new category, button says 'Create' if (!$obj->getVar('categoryid')) { $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_CREATE, 'submit')); $butt_clear = new Xoops\Form\Button('', '', _AM_PUBLISHER_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $this->addElement($button_tray); } else { $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_MODIFY, 'submit')); $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $this->addElement($button_tray); } }
// Item exits ? $item = null; $item = $h_oledrion_cat->get($id); if (!is_object($item)) { oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5); } $edit = true; $label_submit = _AM_OLEDRION_MODIFY; } else { $title = _AM_OLEDRION_ADD_CATEG; $item = $h_oledrion_cat->create(true); $label_submit = _AM_OLEDRION_ADD; $edit = false; } $tbl_categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters()); $mytree = new XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid'); $select_categ = $mytree->makeSelBox('cat_pid', 'cat_title', '-', $item->getVar('cat_pid'), true); $sform = new XoopsThemeForm($title, 'frmcategory', $baseurl); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormHidden('op', 'categories')); $sform->addElement(new XoopsFormHidden('action', 'saveedit')); $sform->addElement(new XoopsFormHidden('cat_cid', $item->getVar('cat_cid'))); $sform->addElement(new XoopsFormText(_AM_OLEDRION_CATEG_TITLE, 'cat_title', 50, 255, $item->getVar('cat_title', 'e')), true); $sform->addElement(new XoopsFormLabel(_AM_OLEDRION_PARENT_CATEG, $select_categ), false); if ($action == 'edit' && $item->pictureExists()) { $pictureTray = new XoopsFormElementTray(_AM_OLEDRION_CURRENT_PICTURE, '<br />'); $pictureTray->addElement(new XoopsFormLabel('', "<img src='" . $item->getPictureUrl() . "' alt='' border='0' />")); $deleteCheckbox = new XoopsFormCheckBox('', 'delpicture'); $deleteCheckbox->addOption(1, _DELETE); $pictureTray->addElement($deleteCheckbox); $sform->addElement($pictureTray);
// GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; include_once XOOPS_ROOT_PATH . "/class/tree.php"; $fform = new XoopsThemeForm(_AMS_AM_FILTER, "filterform", 'index.php'); $fform->setExtra('enctype="multipart/form-data"'); $first_row = new XoopsFormElementTray(_OPTIONS); $first_row->addElement(new XoopsFormText(_AMS_AM_TITLE, 'title', 50, 80, $title)); global $xoopsDB; $xt = new AmsTopic($xoopsDB->prefix("ams_topics")); $alltopics = $xt->getAllTopics(); $topic_obj_tree = new XoopsObjectTree($alltopics, 'topic_id', 'topic_pid'); $first_row->addElement(new XoopsFormLabel(_AMS_AM_TOPIC, $topic_obj_tree->makeSelBox('topicid', 'topic_title', '--', $topicid, true))); $author_select = new XoopsFormSelect(_AMS_AM_POSTER, 'author', $author, 5, true); $authors = $xt->getAllAuthors(); //$authors = array_flip($authors); foreach ($authors as $key => $user_arr) { $author_select->addOption($user_arr['uid'], $user_arr['uname']); } $first_row->addElement($author_select); $second_row = new XoopsFormElementTray(_AMS_AM_SORTING); $status_select = new XoopsFormSelect(_AMS_AM_STATUS, 'status', $status); $status_select->addOption('none', '---'); $status_select->addOption('published', _AMS_AM_PUBLISHED); $status_select->addOption('expired', _AMS_AM_EXPIRED); $second_row->addElement($status_select); $order = isset($order) ? $order : "DESC";
// 2) If there's no topics to display as sub menus we can go on if (!isset($_SESSION['items_count']) || $_SESSION['items_count'] == -1) { $sql = "SELECT COUNT(*) as cpt FROM " . $xoopsDB->prefix("topics") . " WHERE menu=1"; $result = $xoopsDB->query($sql); list($count) = $xoopsDB->fetchRow($result); $_SESSION['items_count'] = $count; } else { $count = $_SESSION['items_count']; } if ($count > 0) { include_once XOOPS_ROOT_PATH . '/class/tree.php'; include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newstopic.php'; include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; $xt = new NewsTopic(); $allTopics = $xt->getAllTopics(news_getmoduleoption('restrictindex')); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); if ($module) { foreach ($topics_arr as $onetopic) { if ($gperm_handler->checkRight('news_view', $onetopic->topic_id(), $groups, $xoopsModule->getVar('mid')) && $onetopic->menu()) { $modversion['sub'][$i]['name'] = $onetopic->topic_title(); $modversion['sub'][$i]['url'] = "index.php?storytopic=" . $onetopic->topic_id(); } $i++; } } unset($xt); } } $modversion['sub'][$i]['name'] = _MI_NEWS_SMNAME2; $modversion['sub'][$i]['url'] = "archive.php";
/** * AboutTree constructor. * @param array $objectArr * @param null $rootId */ public function __construct(&$objectArr, $rootId = null) { parent::__construct($objectArr, 'page_id', 'page_pid', $rootId); }
$item = $h_oledrion_location->create(true); $label_submit = _AM_OLEDRION_ADD; $edit = false; } // Get delivery methods $deliveres = $h_oledrion_delivery->getLocationDelivery(new oledrion_parameters(array('limit' => $limit, 'location' => $id))); if (empty($deliveres)) { oledrion_utils::redirect(_AM_OLEDRION_LOCATION_DELIVERYADD, $baseurl, 5); } $sform = new XoopsThemeForm($title, 'frmaddlocation', $baseurl); $sform->addElement(new XoopsFormHidden('op', 'location')); $sform->addElement(new XoopsFormHidden('action', 'save')); $sform->addElement(new XoopsFormHidden('location_id', $item->getVar('location_id'))); $sform->addElement(new XoopsFormText(_AM_OLEDRION_LOCATION_TITLE, 'location_title', 50, 150, $item->getVar('location_title', 'e')), true); $location_pid = $h_oledrion_location->getAllPid(new oledrion_parameters()); $mytree = new XoopsObjectTree($location_pid, 'location_id', 'location_pid'); $select_pid = $mytree->makeSelBox('location_pid', 'location_title', '-', $item->getVar('location_pid'), true); $sform->addElement(new XoopsFormLabel(_AM_OLEDRION_LOCATION_PID, $select_pid), false); $product_type = new XoopsFormSelect(_AM_OLEDRION_LOCATION_TYPE, 'location_type', $item->getVar('location_type')); $product_type->addOption('location', _AM_OLEDRION_LOCATION_LOCATION); $product_type->addOption('parent', _AM_OLEDRION_LOCATION_PARENT); $sform->addElement($product_type, true); $sform->addElement(new XoopsFormRadioYN(_OLEDRION_ONLINE_HLP, 'location_online', $item->getVar('location_online')), true); $delivery_options = new XoopsFormElementTray(_AM_OLEDRION_LOCATION_DELIVERY, '<br />'); foreach ($deliveres as $delivery) { if (isset($delivery['ld_id']) && is_array($delivery['ld_id'])) { $delivery_checkbox = new XoopsFormCheckBox('', $delivery['delivery_id'] . '_ld_select', $delivery['ld_id']['delivery_select']); $delivery_checkbox->addOption(1, $delivery['delivery_title']); $delivery_options->addElement($delivery_checkbox); $delivery_options->addElement(new XoopsFormText(_AM_OLEDRION_LOCATION_PRICE, $delivery['delivery_id'] . '_ld_price', 16, 16, $delivery['ld_id']['ld_price'])); $delivery_options->addElement(new XoopsFormText(_AM_OLEDRION_LOCATION_DELIVERY_TIME, $delivery['delivery_id'] . '_ld_delivery_time', 8, 8, $delivery['ld_id']['ld_delivery_time']));
/** * Render comments in nested view * Danger: Recursive! * * @param integer $comment_id Always "0" when called by client. * @param boolean $admin_view * * @return void */ public function renderNestView($comment_id = 0, $admin_view = false) { $xot = new XoopsObjectTree($this->comments, 'id', 'pid', 'rootid'); $tree = $xot->getTree(); $image = false != $this->useIcons ? $this->getTitleIcon($tree[$comment_id]['obj']->getVar('icon')) : ''; $title = $tree[$comment_id]['obj']->getVar('title'); if (false != $admin_view) { $text = $tree[$comment_id]['obj']->getVar('text') . '<div style="text-align:right; margin-top: 2px; margin-bottom: 0px; margin-right: 2px;">' . _MD_COMMENTS_STATUS . ': ' . $this->statusText[$tree[$comment_id]['obj']->getVar('status')] . '<br />IP: <span style="font-weight: bold;">' . $tree[$comment_id]['obj']->getVar('ip') . '</span></div>'; } else { // skip this comment if it is not active and continue on processing its child comments instead if (Comments::STATUS_ACTIVE != $tree[$comment_id]['obj']->getVar('status')) { // if there are any child comments, display them as root comments if (isset($tree[$comment_id]['child']) && !empty($tree[$comment_id]['child'])) { foreach ($tree[$comment_id]['child'] as $child_id) { $this->renderNestView($child_id, $admin_view); } } return; } else { $text = $tree[$comment_id]['obj']->getVar('text'); } } $replies = array(); $this->renderNestReplies($tree, $comment_id, $replies, 25, $admin_view); $this->tpl->append('comments', array('pid' => $tree[$comment_id]['obj']->getVar('pid'), 'id' => $tree[$comment_id]['obj']->getVar('id'), 'itemid' => $tree[$comment_id]['obj']->getVar('itemid'), 'rootid' => $tree[$comment_id]['obj']->getVar('rootid'), 'image' => $image, 'title' => $title, 'text' => $text, 'date_posted' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('created'), 'm'), 'date_modified' => XoopsLocale::formatTimestamp($tree[$comment_id]['obj']->getVar('modified'), 'm'), 'poster' => $this->getPosterArray($tree[$comment_id]['obj']->getVar('uid')), 'replies' => $replies)); }
// // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include 'header.php'; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object $mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); $catObjs = $mylinksCatHandler->getAll(); $myCatTree = new XoopsObjectTree($catObjs, 'cid', 'pid'); $xoopsOption['template_main'] = 'mylinks_topten.html'; include XOOPS_ROOT_PATH . "/header.php"; //wanikoo $xoTheme->addStylesheet('browse.php?' . mylinksGetStylePath('mylinks.css', 'include')); $xoTheme->addScript('browse.php?' . mylinksGetStylePath('mylinks.js', 'include')); // //generates top 10 charts by rating and hits for each main category if (!empty($_GET['rate'])) { $sort = _MD_MYLINKS_RATING; $sortDB = "rating"; } else { $sort = _MD_MYLINKS_HITS; $sortDB = "hits"; } $xoopsTpl->assign('lang_sortby', $sort);
$name = $product_user->getVar('uname'); } $tbl_tmp['product_submiter_name'] = $name; $linkeduser = '******' . XOOPS_URL . '/userinfo.php?uid=' . $product_user->getVar('uid') . '">' . $name . '</a>'; $tbl_tmp['product_submiter_link'] = $name; $tbl_tmp['product_vat_rate'] = $product_vat->toArray(); $tbl_tmp['product_rating_formated'] = number_format($product->getVar('product_rating'), 2); if ($product->getVar('product_votes') == 1) { $tbl_tmp['product_votes_count'] = _MYSHOP_ONEVOTE; } else { $tbl_tmp['product_votes_count'] = sprintf(_MYSHOP_NUMVOTES, $product->getVar('product_votes')); } $xoopsTpl->assign('product', $tbl_tmp); // Breadcrumb $tbl_tmp = array(); $mytree = new XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid'); $tbl_ancestors = $mytree->getAllParent($product->getVar('product_cid')); $tbl_ancestors = array_reverse($tbl_ancestors); $tbl_tmp[] = "<a href='" . MYSHOP_URL . "index.php' title='" . myshop_utils::makeHrefTitle(myshop_utils::getModuleName()) . "'>" . myshop_utils::getModuleName() . "</a>"; foreach ($tbl_ancestors as $item) { $tbl_tmp[] = "<a href='" . $item->getLink() . "' title='" . myshop_utils::makeHrefTitle($item->getVar('cat_title')) . "'>" . $item->getVar('cat_title') . "</a>"; } // Add current category $tbl_tmp[] = "<a href='" . $product_category->getLink() . "' title='" . myshop_utils::makeHrefTitle($product_category->getVar('cat_title')) . "'>" . $product_category->getVar('cat_title') . "</a>"; $tbl_tmp[] = $product->getVar('product_title'); $breadcrumb = implode(' » ', $tbl_tmp); $xoopsTpl->assign('breadcrumb', $breadcrumb); // count views if ($product->getVar('product_submitter') != $currentUser) { $h_myshop_products->addCounter($product_id); }
// This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // include 'header.php'; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object include_once XOOPS_ROOT_PATH . '/class/tree.php'; $mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); $catObjs = $mylinksCatHandler->getAll(); $myCatTree = new XoopsObjectTree($catObjs, 'cid', 'pid'); xoops_load('mylinksUtility', $xoopsModule->getVar('dirname')); $cid = mylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min' => 0)); $catid = $cid; $xoopsOption['template_main'] = 'mylinks_viewcat.html'; include XOOPS_ROOT_PATH . '/header.php'; //wanikoo $xoTheme->addStylesheet('browse.php?' . mylinksGetStylePath('mylinks.css', 'include')); $xoTheme->addScript('browse.php?' . mylinksGetStylePath('mylinks.js', 'include')); // $xoopsTpl->assign('show_nav', false); //set to not show nav bar $show = mylinksUtility::mylinks_cleanVars($_GET, 'show', $xoopsModuleConfig['perpage'], 'int'); $min = mylinksUtility::mylinks_cleanVars($_GET, 'min', 0, 'int'); $max = !isset($max) ? $min + $show : $max; $orderby = mylinksUtility::mylinks_cleanVars($_GET, 'orderby', 'title ASC', 'string');
/** * Creates all the meta datas : * - For Mozilla/Netscape and Opera the site navigation's bar * - The Dublin's Core Metadata * - The link for Firefox 2 micro summaries * - The meta keywords * - The meta description * * @package News * @author Instant Zero (http://xoops.instant-zero.com) * @copyright (c) Instant Zero */ function nw_CreateMetaDatas($story = null) { global $xoopsConfig, $xoTheme, $xoopsTpl; $content = ''; $myts =& MyTextSanitizer::getInstance(); include_once NW_MODULE_PATH . '/class/class.newstopic.php'; /** * Firefox and Opera Navigation's Bar */ if(nw_getmoduleoption('sitenavbar', NW_MODULE_DIR_NAME)) { $content .= sprintf("<link rel=\"Home\" title=\"%s\" href=\"%s/\" />\n",$xoopsConfig['sitename'],XOOPS_URL); $content .= sprintf("<link rel=\"Contents\" href=\"%s\" />\n",NW_MODULE_URL . '/index.php'); $content .= sprintf("<link rel=\"Search\" href=\"%s\" />\n",XOOPS_URL.'/search.php'); $content .= sprintf("<link rel=\"Glossary\" href=\"%s\" />\n",NW_MODULE_URL . '/archive.php'); $content .= sprintf("<link rel=\"%s\" href=\"%s\" />\n",$myts->htmlSpecialChars(_MA_NW_SUBMITNEWS), NW_MODULE_URL . '/submit.php'); $content .= sprintf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s\" href=\"%s/\" />\n",$xoopsConfig['sitename'], XOOPS_URL.'/backend.php'); // Create chapters include_once XOOPS_ROOT_PATH.'/class/tree.php'; include_once NW_MODULE_PATH . '/class/class.newstopic.php'; $xt = new nw_NewsTopic(); $allTopics = $xt->getAllTopics(nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME)); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); foreach ($topics_arr as $onetopic) { $content .= sprintf("<link rel=\"Chapter\" title=\"%s\" href=\"%s\" />\n",$onetopic->topic_title(),NW_MODULE_URL . '/index.php?storytopic='.$onetopic->topic_id()); } } /** * Meta Keywords and Description * If you have set this module's option to 'yes' and if the information was entered, then they are rendered in the page else they are computed */ $meta_keywords = ''; if(isset($story) && is_object($story)) { if(xoops_trim($story->keywords()) != '') { $meta_keywords = $story->keywords(); } else { $meta_keywords = nw_createmeta_keywords($story->hometext().' '.$story->bodytext()); } if(xoops_trim($story->description())!='') { $meta_description = strip_tags($story->description); } else { $meta_description = strip_tags($story->title); } if(isset($xoTheme) && is_object($xoTheme)) { $xoTheme->addMeta( 'meta', 'keywords', $meta_keywords); $xoTheme->addMeta( 'meta', 'description', $meta_description); } elseif(isset($xoopsTpl) && is_object($xoopsTpl)) { // Compatibility for old Xoops versions $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords); $xoopsTpl->assign('xoops_meta_description', $meta_description); } } /** * Dublin Core's meta datas */ if(nw_getmoduleoption('dublincore', NW_MODULE_DIR_NAME) && isset($story) && is_object($story)) { $config_handler =& xoops_gethandler('config'); $xoopsConfigMetaFooter =& $config_handler->getConfigsByCat(XOOPS_CONF_METAFOOTER); $content .= '<meta name="DC.Title" content="'.nw_DublinQuotes($story->title())."\" />\n"; $content .= '<meta name="DC.Creator" content="'.nw_DublinQuotes($story->uname())."\" />\n"; $content .= '<meta name="DC.Subject" content="'.nw_DublinQuotes($meta_keywords)."\" />\n"; $content .= '<meta name="DC.Description" content="'.nw_DublinQuotes($story->title())."\" />\n"; $content .= '<meta name="DC.Publisher" content="'.nw_DublinQuotes($xoopsConfig['sitename'])."\" />\n"; $content .= '<meta name="DC.Date.created" scheme="W3CDTF" content="'.date('Y-m-d',$story->created)."\" />\n"; $content .= '<meta name="DC.Date.issued" scheme="W3CDTF" content="'.date('Y-m-d',$story->published)."\" />\n"; $content .= '<meta name="DC.Identifier" content="'.NW_MODULE_URL . '/article.php?storyid='.$story->storyid()."\" />\n"; $content .= '<meta name="DC.Source" content="'.XOOPS_URL."\" />\n"; $content .= '<meta name="DC.Language" content="'._LANGCODE."\" />\n"; $content .= '<meta name="DC.Relation.isReferencedBy" content="'.NW_MODULE_URL . '/index.php?storytopic='.$story->topicid()."\" />\n"; if(isset($xoopsConfigMetaFooter['meta_copyright'])) { $content .= '<meta name="DC.Rights" content="'.nw_DublinQuotes($xoopsConfigMetaFooter['meta_copyright'])."\" />\n"; } } /** * Firefox 2 micro summaries */ if(nw_getmoduleoption('firefox_microsummaries', NW_MODULE_DIR_NAME)) { $content .= sprintf("<link rel=\"microsummary\" href=\"%s\" />\n",NW_MODULE_URL . '/micro_summary.php'); } if(isset($xoopsTpl) && is_object($xoopsTpl)) { $xoopsTpl->assign('xoops_module_header', $content); } }
$cnt_tla_contents = $fmContentHdlr->getCount($criteria); if ($cnt_tla_contents) { $cat_cbox_options[0] = _AM_PUBLISHER_IMPORT_FMCONTENT_NAME . " ({$cnt_tla_contents})"; } natcasesort($cat_cbox_options); //put them in "alphabetical" order echo "<span style='color: #567; margin: 3px 0 12px 0; font-size: small; display: block;'>" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $fmContentCount, count($cat_cbox_options)) . '</span>'; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}"); $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('<br />', $cat_cbox_options)); $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC); $form->addElement($cat_label); // Publisher parent category xoops_load('tree'); $categoryHdlr =& $publisher->getHandler('category'); $catObjs = $categoryHdlr->getAll(); $myObjTree = new XoopsObjectTree($catObjs, 'categoryid', 'parentid'); $catSelBox = $myObjTree->makeSelBox('parent_category', 'name', '-', 0, true); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, $catSelBox); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); $form->addElement($parent_cat_sel); /* $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix("publisher_categories"), "categoryid", "parentid"); ob_start(); $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category"); $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents()); $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC); $form->addElement($parent_cat_sel); ob_end_clean(); */ $form->addElement(new XoopsFormHidden('op', 'go'));
/** * News export * * You can use this function in the module's admin when you click on the tab named "News Export" * First select a range of date, possibly a range of topics and if you want, check the option "Include Topics Definitions" * to also export the topics. * News, and topics, will be exported to the XML format. */ function NewsExport() { global $xoopsDB; include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; xoops_cp_header(); adminmenu(4); echo "<br />"; $sform = new XoopsThemeForm(_AM_NEWS_EXPORT_NEWS, "exportform", XOOPS_URL . '/modules/news/admin/index.php', 'post'); $dates_tray = new XoopsFormElementTray(_AM_NEWS_EXPORT_BETWEEN); $date1 = new XoopsFormTextDateSelect('', 'date1', 15, time()); $date2 = new XoopsFormTextDateSelect(_AM_NEWS_EXPORT_AND, 'date2', 15, time()); $dates_tray->addElement($date1); $dates_tray->addElement($date2); $sform->addElement($dates_tray); $topiclist = new XoopsFormSelect(_AM_NEWS_PRUNE_TOPICS, 'export_topics', '', 5, true); $topics_arr = array(); $xt = new NewsTopic(); $allTopics = $xt->getAllTopics(false); // The webmaster can see everything $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_tree->getAllChild(0); if (count($topics_arr)) { foreach ($topics_arr as $onetopic) { $topiclist->addOption($onetopic->topic_id(), $onetopic->topic_title()); } } $topiclist->setDescription(_AM_NEWS_EXPORT_PRUNE_DSC); $sform->addElement($topiclist, false); $sform->addElement(new XoopsFormRadioYN(_AM_NEWS_EXPORT_INCTOPICS, 'includetopics', 0), false); $sform->addElement(new XoopsFormHidden('op', 'launchexport'), false); $button_tray = new XoopsFormElementTray('', ''); $submit_btn = new XoopsFormButton('', 'post', _SUBMIT, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); }
include XOOPS_ROOT_PATH . '/header.php'; xoops_error($errs); include XOOPS_ROOT_PATH . '/footer.php'; exit; } redirect_header($redirect_page . '=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode, 1, _CM_COMDELETED); break; case 'delete_all': $comment_handler = xoops_gethandler('comment'); $comment =& $comment_handler->get($com_id); $com_rootid = $comment->getVar('com_rootid'); // get all comments posted later within the same thread $thread_comments =& $comment_handler->getThread($com_rootid, $com_id); // construct a comment tree include_once XOOPS_ROOT_PATH . '/class/tree.php'; $xot = new XoopsObjectTree($thread_comments, 'com_id', 'com_pid', 'com_rootid'); $child_comments =& $xot->getAllChild($com_id); // add itself here $child_comments[$com_id] =& $comment; $msgs = array(); $deleted_num = array(); $member_handler =& xoops_gethandler('member'); foreach (array_keys($child_comments) as $i) { if (!$comment_handler->delete($child_comments[$i])) { $msgs[] = _CM_COMDELETENG . ' (ID: ' . $child_comments[$i]->getVar('com_id') . ')'; } else { $msgs[] = _CM_COMDELETED . ' (ID: ' . $child_comments[$i]->getVar('com_id') . ')'; // store poster ID and deleted post number into array for later use $poster_id = $child_comments[$i]->getVar('com_uid'); if ($poster_id > 0) { $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : $deleted_num[$poster_id] + 1;
function deleteComment($com_id) { $delete_op = isset($_POST['delete_op']) ? xoops_trim($_POST['delete_op']) : 'delete_one'; switch ($delete_op) { case 'delete_one': $comment_handler = xoops_gethandler('comment'); $comment =& $comment_handler->get($com_id); if (!$comment_handler->delete($comment)) { return xoops_error(_CM_COMDELETENG . ' (ID: ' . $comment->getVar('com_id') . ')'); exit; } $com_itemid = $comment->getVar('com_itemid'); // update user posts if its not an anonymous post if ($comment->getVar('com_uid') != 0) { $member_handler =& xoops_gethandler('member'); $com_poster =& $member_handler->getUser($comment->getVar('com_uid')); if (is_object($com_poster)) { $member_handler->updateUserByField($com_poster, 'posts', $com_poster->getVar('posts') - 1); } } // get all comments posted later within the same thread $thread_comments =& $comment_handler->getThread($comment->getVar('com_rootid'), $com_id); include_once XOOPS_ROOT_PATH . '/class/tree.php'; $xot = new XoopsObjectTree($thread_comments, 'com_id', 'com_pid', 'com_rootid'); $child_comments =& $xot->getFirstChild($com_id); // now set new parent ID for direct child comments $new_pid = $comment->getVar('com_pid'); // $errs = array(); $msgs = ''; foreach (array_keys($child_comments) as $i) { $child_comments[$i]->setVar('com_pid', $new_pid); // if the deleted comment is a root comment, need to change root id to own id if (false != $comment->isRoot()) { $new_rootid = $child_comments[$i]->getVar('com_id'); $child_comments[$i]->setVar('com_rootid', $child_comments[$i]->getVar('com_id')); if (!$comment_handler->insert($child_comments[$i])) { // $errs[] = 'Could not change comment parent ID from <b>'.$com_id.'</b> to <b>'.$new_pid.'</b>. (ID: '.$new_rootid.')'; $msgs .= 'Could not change comment parent ID from <b>' . $com_id . '</b> to <b>' . $new_pid . '</b>. (ID: ' . $new_rootid . ')<br />'; } else { // need to change root id for all its child comments as well $c_child_comments =& $xot->getAllChild($new_rootid); $cc_count = count($c_child_comments); foreach (array_keys($c_child_comments) as $j) { $c_child_comments[$j]->setVar('com_rootid', $new_rootid); if (!$comment_handler->insert($c_child_comments[$j])) { // $errs[] = 'Could not change comment root ID from <b>'.$com_id.'</b> to <b>'.$new_rootid.'</b>.'; $msgs .= 'Could not change comment root ID from <b>' . $com_id . '</b> to <b>' . $new_rootid . '</b>.<br />'; } } } } else { if (!$comment_handler->insert($child_comments[$i])) { // $errs[] = 'Could not change comment parent ID from <b>'.$com_id.'</b> to <b>'.$new_pid.'</b>.'; $msgs .= 'Could not change comment parent ID from <b>' . $com_id . '</b> to <b>' . $new_pid . '</b>.<br />'; } } } // if(count($errs) > 0) if ($msgs != '') { // return xoops_error($errs); return $msgs; exit; } // redirect_header($redirect_page.'='.$com_itemid.'&com_order='.$com_order.'&com_mode='.$com_mode, 1, _CM_COMDELETED); return _CM_COMDELETED; break; case 'delete_all': $comment_handler = xoops_gethandler('comment'); $comment =& $comment_handler->get($com_id); $com_rootid = $comment->getVar('com_rootid'); // get all comments posted later within the same thread $thread_comments =& $comment_handler->getThread($com_rootid, $com_id); // construct a comment tree include_once XOOPS_ROOT_PATH . '/class/tree.php'; $xot = new XoopsObjectTree($thread_comments, 'com_id', 'com_pid', 'com_rootid'); $child_comments =& $xot->getAllChild($com_id); // add itself here $child_comments[$com_id] =& $comment; // $msgs = array(); $msgs = ''; $deleted_num = array(); $member_handler =& xoops_gethandler('member'); foreach (array_keys($child_comments) as $i) { if (!$comment_handler->delete($child_comments[$i])) { // $msgs[] = _CM_COMDELETENG.' (ID: '.$child_comments[$i]->getVar('com_id').')'; $msgs .= _CM_COMDELETENG . ' (ID: ' . $child_comments[$i]->getVar('com_id') . ')<br />'; } else { // $msgs[] = _CM_COMDELETED.' (ID: '.$child_comments[$i]->getVar('com_id').')'; $msgs .= _CM_COMDELETED . ' (ID: ' . $child_comments[$i]->getVar('com_id') . ')<br />'; // store poster ID and deleted post number into array for later use $poster_id = $child_comments[$i]->getVar('com_uid'); if ($poster_id > 0) { $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : $deleted_num[$poster_id] + 1; } } } foreach ($deleted_num as $user_id => $post_num) { // update user posts $com_poster = $member_handler->getUser($user_id); if (is_object($com_poster)) { $member_handler->updateUserByField($com_poster, 'posts', $com_poster->getVar('posts') - $post_num); } } $com_itemid = $comment->getVar('com_itemid'); // execute updateStat callback function if set if (isset($comment_config['callback']['update']) && trim($comment_config['callback']['update']) != '') { $skip = false; if (!function_exists($comment_config['callback']['update'])) { if (isset($comment_config['callbackFile'])) { $callbackfile = trim($comment_config['callbackFile']); if ($callbackfile != '' && file_exists(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile)) { include_once XOOPS_ROOT_PATH . '/modules/' . $moddir . '/' . $callbackfile; } if (!function_exists($comment_config['callback']['update'])) { $skip = true; } } else { $skip = true; } } if (!$skip) { $criteria = new CriteriaCompo(new Criteria('com_modid', $this->mid)); $criteria->add(new Criteria('com_itemid', $com_itemid)); $criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); $comment_count = $comment_handler->getCount($criteria); $comment_config['callback']['update']($com_itemid, $comment_count); } } // return xoops_result($msgs); return $msgs; break; } }
/** * Return number of products from one or several categories * * @param integer $cat_cid * @param boolean $withNested * @return integer */ function getCategoryProductsCount($cat_cid, $withNested = true) { global $h_myshop_products; $childsIDs = array(); $childsIDs[] = $cat_cid; if ($withNested) { // Search sub-categories $items = $childs = array(); include_once XOOPS_ROOT_PATH . '/class/tree.php'; $items = $this->getAllCategories(); $mytree = new XoopsObjectTree($items, 'cat_cid', 'cat_pid'); $childs = $mytree->getAllChild($cat_cid); if (count($childs) > 0) { foreach ($childs as $onechild) { $childsIDs[] = $onechild->getVar('cat_cid'); } } } return $h_myshop_products->getCategoryProductsCount($childsIDs); }
/** * @param AlumniCategory|XoopsObject $obj */ public function __construct(AlumniCategory &$obj) { $xoops = Xoops::getInstance(); $moduleDirName = basename(dirname(__DIR__)); $admin_lang = '_AM_' . strtoupper($moduleDirName); $title = $obj->isNew() ? sprintf(AlumniLocale::ADD_CAT) : sprintf(AlumniLocale::EDIT_CAT); parent::__construct($title, 'form', false, 'post', true); include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $this->setExtra('enctype="multipart/form-data"'); include_once XOOPS_ROOT_PATH . '/class/tree.php'; $categoryHandler = $xoops->getModuleHandler('category', 'alumni'); $arr = $categoryHandler->getall(); $mytree = new XoopsObjectTree($arr, 'cid', 'pid'); $this->addElement(new Xoops\Form\Label(AlumniLocale::CATEGORY_PID, $mytree->makeSelBox('pid', 'title', '-', $obj->getVar('pid'), true))); $this->addElement(new Xoops\Form\Text(AlumniLocale::CATEGORY_TITLE, 'title', 50, 255, $obj->getVar('title')), true); if ($obj->isNew()) { $default_img = 'default.gif'; } else { $default_img = str_replace('alumni/', '', $obj->getVar('img', 'e')); } $img = $obj->getVar("img") ? $obj->getVar("img") : 'default.gif'; $imgtray_img = new Xoops\Form\ElementTray(AlumniLocale::IMGCAT, '<br />'); $img_path = \XoopsBaseConfig::get('root-path') . '/modules/alumni/images/cat'; $imgpath_img = sprintf(AlumniLocale::FORMIMAGE_PATH, $img_path); $imageselect_img = new Xoops\Form\Select(sprintf(XoopsLocale::F_FILE_EXISTS_IN, $img_path . '/'), 'img', $img); $image_array_img = XoopsLists::getImgListAsArray($img_path); $imageselect_img->addOption("{$default_img}", $default_img); foreach ($image_array_img as $image_img) { $imageselect_img->addOption("{$image_img}", $image_img); } $alumni_upload_url = \XoopsBaseConfig::get('url') . '/modules/alumni/images/cat'; $imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"img\", \"\", \"\", \"" . $alumni_upload_url . "\")'"); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $alumni_upload_url . "/" . $img . "' name='image_img' id='image_img' alt='' />")); $fileseltray_category_img = new Xoops\Form\ElementTray('<br />', '<br />'); $fileseltray_category_img->addElement(new Xoops\Form\File(AlumniLocale::FORMUPLOAD, "img"), false); $fileseltray_category_img->addElement(new Xoops\Form\Label(''), false); $imgtray_img->addElement($fileseltray_category_img); $this->addElement($imgtray_img); $this->addElement(new Xoops\Form\Text(AlumniLocale::ORDER, 'ordre', 4, 4, $obj->getVar('ordre')), false); $this->addElement(new Xoops\Form\Label(AlumniLocale::IFSCHOOL, '')); $photo_old = $obj->getVar('scphoto') ? $obj->getVar('scphoto') : ''; $uploadirectory_photo = XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/photos/school_photos"; $imgtray_photo = new Xoops\Form\ElementTray(AlumniLocale::SCPHOTO, '<br />'); $imgpath_photo = sprintf(AlumniLocale::FORMIMAGE_PATH, $uploadirectory_photo); $fileseltray_photo = new Xoops\Form\ElementTray('', '<br />'); $fileseltray_photo->addElement(new XoopsFormFile(AlumniLocale::FORMUPLOAD, 'scphoto', $xoops->getModuleConfig('alumni_photomax')), false); if ($photo_old) { $fileseltray_photo->addElement(new Xoops\Form\Label(AlumniLocale::SELECTED_PHOTO, '<a href="../photos/school_photos/' . $photo_old . '">' . $photo_old . '</a>', false)); $imgtray_checkbox = new Xoops\Form\Checkbox('', 'del_photo', 0); $imgtray_checkbox->addOption(1, AlumniLocale::DELPICT); $fileseltray_photo->addElement($imgtray_checkbox); } $imgtray_photo->addElement($fileseltray_photo); $this->addElement($imgtray_photo); $this->addElement(new Xoops\Form\Hidden('photo_old', $photo_old)); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCADDRESS, 'scaddress', 50, 255, $obj->getVar('scaddress')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCADDRESS2, 'scaddress2', 50, 255, $obj->getVar('scaddress2')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCCITY, 'sccity', 50, 255, $obj->getVar('sccity')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCSTATE, 'scstate', 50, 255, $obj->getVar('scstate')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCZIP, 'sczip', 50, 255, $obj->getVar('sczip')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCPHONE, 'scphone', 50, 255, $obj->getVar('scphone')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCFAX, 'scfax', 50, 255, $obj->getVar('scfax')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCMOTTO, 'scmotto', 50, 255, $obj->getVar('scmotto')), false); $this->addElement(new Xoops\Form\Text(AlumniLocale::SCURL, 'scurl', 50, 255, $obj->getVar('scurl')), false); $this->addElement(new Xoops\Form\Hidden('op', 'save_category')); $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); }
function modCat() { global $xoopsDB, $myts, $eh, $xoopsModule; $cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min' => 0)); //xoops_cp_header(); echo "<h4>" . _MD_MYLINKS_WEBLINKSCONF . "</h4>\n" . "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" . " <tr><th>" . _MD_MYLINKS_MODCAT . "<br /></th></tr>\n" . " <tr class='odd'>\n" . " <td>\n"; $mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname')); $catObj = $mylinksCatHandler->get($cid); if (isset($catObj) && is_object($catObj)) { $criteria = new CriteriaCompo(); $criteria->add(new Criteria('cid', $cid, "!=")); $catListObjs = $mylinksCatHandler->getAll($criteria); $catListTree = new XoopsObjectTree($catListObjs, 'cid', 'pid'); $title = $myts->htmlSpecialChars($catObj->getVar('title')); $imgurl = $myts->htmlSpecialChars($catObj->getVar('imgurl')); $pid = $catObj->getVar('pid'); echo " <form action='main.php' method='post'>" . _MD_MYLINKS_TITLEC . "\n" . " <input type='text' name='title' value='{$title}' size='51' maxlength='50' />\n" . "\t\t <br /><br />\n"; if (0 == $catObj->getVar('pid')) { echo " " . _MD_MYLINKS_IMGURLMAIN . "<br />\n" . " <input type='text' name='imgurl' value='{$imgurl}' size='100' maxlength='150' />\n" . " <br /><br />\n"; } echo " " . _MD_MYLINKS_PARENT . " \n" . " " . $catListTree->makeSelBox("pid", "title", '- ', $pid, true) . "\n" . " <br />\n" . " <input type='hidden' name='cid' value='{$cid}' />\n" . " <input type='hidden' name='op' value='modCatS' /><br />\n" . " <input type='submit' value='" . _MD_MYLINKS_SAVE . "' />\n" . " <input type='button' value='" . _DELETE . "' onclick=\"location='main.php?pid={$pid}&cid={$cid}&op=delCat'\" /> \n" . " <input type='button' value='" . _CANCEL . "' onclick=\"javascript:history.go(-1)\" />\n" . " </form>\n"; } else { echo " <tr><td>" . _MD_MYLINKS_CIDERROR . "</td></tr>\n" . " <tr><td><input type='button' value='" . _BACK . "' onclick=\"javascript:history.go(-1)\" /></td></tr>\n"; } echo " </td>\n" . " </tr>\n" . "</table>\n"; include 'footer.php'; }
/** * Retourne le nombre de produits d'une ou de plusieurs catégories * * @param integer $cat_cid L'identifiant de la catégorie dont on veut récupérer le nombre de produits * @param boolean $withNested Faut il inclure les sous-catégories ? * @return integer Le nombre de produits */ public function getCategoryProductsCount($cat_cid, $withNested = true) { global $h_oledrion_products; $childsIDs = array(); $childsIDs[] = $cat_cid; if ($withNested) { // Recherche des sous catégories de cette catégorie $items = $childs = array(); include_once XOOPS_ROOT_PATH . '/class/tree.php'; $items = $this->getAllCategories(new oledrion_parameters()); $mytree = new XoopsObjectTree($items, 'cat_cid', 'cat_pid'); $childs = $mytree->getAllChild($cat_cid); if (count($childs) > 0) { foreach ($childs as $onechild) { $childsIDs[] = $onechild->getVar('cat_cid'); } } } return $h_oledrion_products->getCategoryProductsCount($childsIDs); }
function topicsmanager() { global $xoopsModule, $xoopsModuleConfig, $xoopsDB; include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; //$uploadfolder=sprintf(_AMS_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule -> dirname().'/images/topics'); $uploadirectory = "/modules/" . $xoopsModule->dirname() . '/images/topics'; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; include_once XOOPS_ROOT_PATH . "/class/tree.php"; $xt = new AmsTopic($xoopsDB->prefix("ams_topics")); $allTopics = $xt->getAllTopics(); $totaltopics = count($allTopics); if ($totaltopics > 0) { $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_obj_tree->getAllChild(0); } echo "<form action='index.php' method='POST'>"; echo "<div class=\"odd\">"; echo "<div style='text-align: center;'><b>" . _AMS_AM_TOPICSMNGR . ' (' . ($start + 1) . '-' . ($start + $xoopsModuleConfig['storycountadmin'] > $totaltopics ? $totaltopics : $start + $xoopsModuleConfig['storycountadmin']) . ' ' . _AMS_AM_OF . ' ' . $totaltopics . ')' . "</b><br /><br />"; echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AMS_AM_TOPIC . "</td><td align='left'>" . _AMS_AM_TOPICNAME . "</td><td align='center'>" . _AMS_AM_PARENTTOPIC . "</td><td> " . _AMS_AM_WEIGHT . " </td><td align='center'>" . _AMS_AM_ACTION . "</td></tr>"; //If topic not empty if ($totaltopics > 0) { $i = 0; foreach ($topics_arr as $thisTopic) { $i++; if ($i > $start && $i - $start <= $xoopsModuleConfig['storycountadmin']) { $linkedit = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=topicsmanager&topic_id=' . $thisTopic->topic_id(); $linkdelete = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=delTopic&topic_id=' . $thisTopic->topic_id(); $action = sprintf("<a href='%s'>%s</a> - <a href='%s'>%s</a>", $linkedit, _AMS_AM_EDIT, $linkdelete, _AMS_AM_DELETE); $parent = ' '; $pid = $thisTopic->topic_pid(); if ($pid > 0) { $parent = $topics_arr[$pid]->topic_title(); $thisTopic->prefix = str_replace(".", "-", $thisTopic->prefix) . ' '; } else { $thisTopic->prefix = str_replace(".", "", $thisTopic->prefix); } echo "<tr><td>" . $thisTopic->topic_id() . "</td><td align='left'>" . $thisTopic->prefix() . $thisTopic->topic_title() . "</td><td align='left'>" . $parent . "</td><td align='center'><input type='text' name='weight[" . $thisTopic->topic_id() . "]' value='" . $thisTopic->weight . "' size='10' maxlength='10' /> </td><td>" . $action . "</td></tr>"; } } echo "<tr><td colspan='3'></td><td><input type='hidden' name='op' value='reorder' />\r\n <input type='submit' name='submit' value='" . _AMS_AM_SUBMIT . "' /></td><td></td></tr>"; } echo "</table></div></div></form>"; if ($totaltopics > $xoopsModuleConfig['storycountadmin']) { $pagenav = new XoopsPageNav($totaltopics, $xoopsModuleConfig['storycountadmin'], $start, 'start', 'op=topicsmanager'); echo "<div align='right'>"; echo $pagenav->renderNav() . '</div><br />'; } $topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : 0; if ($topic_id > 0) { $xtmod = $topics_arr[$topic_id]; $topic_title = $xtmod->topic_title('E'); $op = 'modTopicS'; if (trim($xtmod->topic_imgurl()) != '') { $topicimage = $xtmod->topic_imgurl(); } else { $topicimage = "blank.png"; } $btnlabel = _AMS_AM_MODIFY; $parent = $xtmod->topic_pid(); $formlabel = _AMS_AM_MODIFYTOPIC; $banner = $xtmod->banner; $banner_inherit = $xtmod->banner_inherit; $forum = $xtmod->forum_id; unset($xtmod); } else { $topic_title = ''; $op = 'addTopic'; $topicimage = 'xoops.gif'; $btnlabel = _AMS_AM_ADD; $parent = 0; $formlabel = _AMS_AM_ADD_TOPIC; $banner = ''; $banner_inherit = 0; $forum = 0; } $sform = new XoopsThemeForm($formlabel, "topicform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php', 'post'); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormText(_AMS_AM_TOPICNAME . ' ' . _AMS_AM_MAX40CHAR, 'topic_title', 40, 50, $topic_title), true); $sform->addElement(new XoopsFormHidden('op', $op), false); $sform->addElement(new XoopsFormHidden('topic_id', $topic_id), false); if ($totaltopics > 0) { $sform->addElement(new XoopsFormLabel(_AMS_AM_PARENTTOPIC, $topic_obj_tree->makeSelBox('topic_pid', 'topic_title', '--', $parent, true))); } else { $sform->addElement(new XoopsFormHidden('topic_pid', 0)); } // ********** Picture $imgtray = new XoopsFormElementTray(_AMS_AM_TOPICIMG, '<br />'); $imgpath = sprintf(_AMS_AM_IMGNAEXLOC, "modules/" . $xoopsModule->dirname() . "/images/topics/"); $imageselect = new XoopsFormSelect($imgpath, 'topic_imgurl', $topicimage); $topics_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/AMS/images/topics/"); foreach ($topics_array as $image) { $imageselect->addOption("{$image}", $image); } $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"topic_imgurl\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'"); $imgtray->addElement($imageselect, false); $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $topicimage . "' name='image3' id='image3' alt='' />")); $uploadfolder = sprintf(_AMS_AM_UPLOAD_WARNING, XOOPS_URL . "/modules/" . $xoopsModule->dirname() . '/images/topics'); $fileseltray = new XoopsFormElementTray('', '<br />'); $fileseltray->addElement(new XoopsFormFile(_AMS_AM_TOPIC_PICTURE, 'attachedfile', $xoopsModuleConfig['maxuploadsize']), false); $fileseltray->addElement(new XoopsFormLabel($uploadfolder), false); $imgtray->addElement($fileseltray); $sform->addElement($imgtray); //Forum linking $module_handler =& xoops_gethandler('module'); $forum_module =& $module_handler->getByDirname('newbb'); if (is_object($forum_module) && $forum_module->getVar('version') >= 200) { $forum_handler =& xoops_getmodulehandler('forum', 'newbb', true); if (is_object($forum_handler)) { $forums = $forum_handler->getForums(); if (count($forums) > 0) { $forum_tree = new XoopsObjectTree($forums, 'forum_id', 'parent_forum'); $sform->addElement(new XoopsFormLabel(_AMS_AM_LINKEDFORUM, $forum_tree->makeSelBox('forum_id', 'forum_name', '--', $forum, true))); } } } //Banner $sform->addElement(new XoopsFormDhtmlTextArea(_AMS_AM_TOPICBANNER, 'banner', $banner)); $inherit_checkbox = new XoopsFormCheckBox(_AMS_AM_BANNERINHERIT, 'banner_inherit', $banner_inherit); $inherit_checkbox->addOption(1, _YES); $sform->addElement($inherit_checkbox); //Added in AMS 2.50 Final. Use News 1.62 permission style //Enhance in AMS 3.0 Beta 1. Add default permission for approval=admin, submit=admin,User. // Permissions $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $gperm_handler =& xoops_gethandler('groupperm'); $group_type_ref =& $member_handler->getGroups(null, true); $admin_list = array(); $user_list = array(); $full_list = array(); $admincount = 1; $usercount = 1; $fullcount = 1; foreach (array_keys($group_type_ref) as $i) { if ($group_type_ref[$i]->getVar('group_type') == 'Admin') { $admin_list[$i] = $group_list[$i]; $admincount++; $user_list[$i] = $group_list[$i]; $usercount++; } if ($group_type_ref[$i]->getVar('group_type') == 'User') { $user_list[$i] = $group_list[$i]; $usercount++; } $full_list[$i] = $group_list[$i]; $fullcount++; } $admin_list = array_keys($admin_list); $user_list = array_keys($user_list); $full_list = array_keys($full_list); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_approve', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $groups_ids); } else { // Creation mode $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $admin_list); } $groups_AMS_can_approve_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_approve_checkbox); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_submit', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $groups_ids); } else { // Creation mode $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $user_list); } $groups_AMS_can_submit_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_submit_checkbox); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_view', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $groups_ids); } else { // Creation mode $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $full_list); } $groups_AMS_can_view_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_view_checkbox); // Submit buttons $button_tray = new XoopsFormElementTray('', ''); $submit_btn = new XoopsFormButton('', 'post', $btnlabel, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); }
$xoopsTpl->assign('rates', true); $xoopsTpl->assign('lang_ratingc', _NW_RATINGC); $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS); } else { $xoopsTpl->assign('rates', false); } if ($xoopsOption['storytopic']) { $xt->getTopic($xoopsOption['storytopic']); $xoopsTpl->assign('topic_description', $xt->topic_description('S')); $xoopsTpl->assign('topic_color', '#' . $xt->topic_color('S')); $topictitle = $xt->topic_title(); } if ($xoopsModuleConfig['displaynav'] == 1) { $xoopsTpl->assign('displaynav', true); $allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex']); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topic_select = $topic_tree->makeSelBox('storytopic', 'topic_title', '-- ', $xoopsOption['storytopic'], true); $xoopsTpl->assign('topic_select', $topic_select); $storynum_options = ''; for ($i = 5; $i <= 30; $i = $i + 5) { $sel = ''; if ($i == $xoopsOption['storynum']) { $sel = ' selected="selected"'; } $storynum_options .= '<option value="' . $i . '"' . $sel . '>' . $i . '</option>'; } $xoopsTpl->assign('storynum_options', $storynum_options); } else { $xoopsTpl->assign('displaynav', false); } if ($xoopsOption['storytopic'] == 0) {
function _processSave(&$controller, &$xoopsUser) { $statusArr = $this->mActionForm->get('status'); $comment_handler = xoops_gethandler('comment'); foreach (array_keys($statusArr) as $cid) { $comment =& $comment_handler->get($cid); if (is_object($comment)) { $olddata['com_status'] = $comment->get('com_status'); $newdata['com_status'] = $this->mActionForm->get('status', $cid); if (count(array_diff_assoc($olddata, $newdata)) > 0) { $comment->set('com_status', $this->mActionForm->get('status', $cid)); if (!$comment_handler->insert($comment)) { return LEGACY_FRAME_VIEW_ERROR; } $add_userpost = false; $call_approvefunc = false; $call_updatefunc = false; $notify_event = false; if (!empty($newdata['com_status']) && $newdata['com_status'] != XOOPS_COMMENT_PENDING) { if (XOOPS_COMMENT_PENDING == $olddata['com_status']) { $add_userpost = true; if (XOOPS_COMMENT_ACTIVE == $newdata['com_status']) { $call_updatefunc = true; $call_approvefunc = true; $notify_event = 'comment'; } } elseif (XOOPS_COMMENT_HIDDEN == $olddata['com_status'] && XOOPS_COMMENT_ACTIVE == $newdata['com_status']) { $call_updatefunc = true; } elseif (XOOPS_COMMENT_ACTIVE == $olddata['com_status'] && XOOPS_COMMENT_HIDDEN == $newdata['com_status']) { $call_updatefunc = true; } } $comment_config = Legacy_CommentEditAction::loadCallbackFile($comment); if ($comment_config && $call_approvefunc != false) { $function = $comment_config['callback']['approve']; if (function_exists($function)) { call_user_func($function, $comment); } } if ($comment_config && $call_updatefunc != false) { $function = $comment_config['callback']['update']; if (function_exists($function)) { $criteria = new CriteriaCompo(new Criteria('com_modid', $comment->getVar('com_modid'))); $criteria->add(new Criteria('com_itemid', $comment->getVar('com_itemid'))); $criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); $comment_count = $comment_handler->getCount($criteria); call_user_func_array($function, array($comment->getVar('com_itemid'), $comment_count, $comment->getVar('com_id'))); } } $uid = $comment->getVar('com_uid'); if ($uid > 0 && false != $add_userpost) { $member_handler =& xoops_gethandler('member'); $poster =& $member_handler->getUser($uid); if (is_object($poster)) { $member_handler->updateUserByField($poster, 'posts', $poster->getVar('posts') + 1); } } //notification // RMV-NOTIFY // trigger notification event if necessary if ($notify_event) { $not_modid = $comment->getVar('com_modid'); include_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; $not_catinfo =& notificationCommentCategoryInfo($not_modid); $not_category = $not_catinfo['name']; $not_itemid = $comment->getVar('com_itemid'); $not_event = $notify_event; $comment_tags = array(); $module_handler =& xoops_gethandler('module'); $not_module =& $module_handler->get($not_modid); $com_config =& $not_module->getInfo('comments'); $comment_url = $com_config['pageName'] . '?'; //Umm....not use com_exparams(--;;Fix Me!) //$extra_params = $comment->getVar('com_exparams'); //$comment_url .= $extra_params; $comment_url .= $com_config['itemName']; $comment_tags['X_COMMENT_URL'] = XOOPS_URL . '/modules/' . $not_module->getVar('dirname') . '/' . $comment_url . '=' . $comment->getVar('com_itemid') . '&com_id=' . $comment->getVar('com_id') . '&com_rootid=' . $comment->getVar('com_rootid') . '#comment' . $comment->getVar('com_id'); $notification_handler =& xoops_gethandler('notification'); $notification_handler->triggerEvent($not_category, $not_itemid, $not_event, $comment_tags, false, $not_modid); } //notify if } //count if } //object if } //foreach foreach (array_keys($statusArr) as $cid) { if ($this->mActionForm->get('delete', $cid) == 1) { $comment =& $comment_handler->get($cid); if (is_object($comment)) { if (!$comment_handler->delete($comment)) { return LEGACY_FRAME_VIEW_ERROR; } if ($comment->get('com_status') != 1 && $comment->get('com_uid') > 0) { $memberhandler =& xoops_gethandler('member'); $user =& $memberhandler->getUser($comment->get('com_uid')); if (is_object($user)) { $count = $user->get('posts'); if ($count > 0) { $memberhandler->updateUserByField($user, 'posts', $count - 1); } } } // get all comments posted later within the same thread $thread_comments =& $comment_handler->getThread($comment->getVar('com_rootid'), $cid); include_once XOOPS_ROOT_PATH . '/class/tree.php'; $xot = new XoopsObjectTree($thread_comments, 'com_id', 'com_pid', 'com_rootid'); $child_comments =& $xot->getFirstChild($cid); // now set new parent ID for direct child comments $new_pid = $comment->getVar('com_pid'); $errs = array(); foreach (array_keys($child_comments) as $i) { $child_comments[$i]->setVar('com_pid', $new_pid); // if the deleted comment is a root comment, need to change root id to own id if (false != $comment->isRoot()) { $new_rootid = $child_comments[$i]->getVar('com_id'); $child_comments[$i]->setVar('com_rootid', $child_comments[$i]->getVar('com_id')); if (!$comment_handler->insert($child_comments[$i])) { $errs[] = 'Could not change comment parent ID from <b>' . $cid . '</b> to <b>' . $new_pid . '</b>. (ID: ' . $new_rootid . ')'; } else { // need to change root id for all its child comments as well $c_child_comments =& $xot->getAllChild($new_rootid); $cc_count = count($c_child_comments); foreach (array_keys($c_child_comments) as $j) { $c_child_comments[$j]->setVar('com_rootid', $new_rootid); if (!$comment_handler->insert($c_child_comments[$j])) { $errs[] = 'Could not change comment root ID from <b>' . $cid . '</b> to <b>' . $new_rootid . '</b>.'; } } } } else { if (!$comment_handler->insert($child_comments[$i])) { $errs[] = 'Could not change comment parent ID from <b>' . $cid . '</b> to <b>' . $new_pid . '</b>.'; } } } if (count($errs) > 0) { return LEGACY_FRAME_VIEW_ERROR; } // // callback // $comment_config = Legacy_CommentEditAction::loadCallbackFile($comment); if ($comment_config) { $function = $comment_config['callback']['update']; if (function_exists($function)) { $criteria = new CriteriaCompo(new Criteria('com_modid', $comment->getVar('com_modid'))); $criteria->add(new Criteria('com_itemid', $comment->getVar('com_itemid'))); $criteria->add(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); $comment_count = $comment_handler->getCount($criteria); call_user_func_array($function, array($comment->getVar('com_itemid'), $comment_count, $comment->getVar('com_id'))); } } } //if object } //if } //foreach return LEGACY_FRAME_VIEW_SUCCESS; }
public function displayDelete() { $xoops = Xoops::getInstance(); $op = Request::getCmd('op', 'delete', 'POST'); $mode = Request::getString('com_mode', 'flat'); $order = Request::getString('com_order', COMMENTS_OLD1ST); $id = Request::getInt('com_id'); /* @var $comment CommentsComment */ /* @var $comment_handler CommentsCommentHandler */ $comment_handler = $this->getHandlerComment(); $comment = $comment_handler->get($id); if (!is_object($comment)) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } $module = $xoops->getModuleById($comment->getVar('modid')); if (!is_object($module)) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } if (!$xoops->isAdminSide && COMMENTS_APPROVENONE == $xoops->getModuleConfig('com_rule', $module->getVar('dirname')) || !$xoops->isUser() && !$xoops->getModuleConfig('com_anonpost', $module->getVar('dirname')) || !$xoops->isModule()) { $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION); } $modid = $module->getVar('mid'); /* @var $plugin CommentsPluginInterface */ if ($plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'comments')) { if ($xoops->isAdminSide) { $redirect_page = $this->url('admin/main.php?com_modid=' . $modid . '&com_itemid'); } else { $redirect_page = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $plugin->pageName() . '?'); $comment_confirm_extra = array(); if (is_array($extraParams = $plugin->extraParams())) { foreach ($extraParams as $extra_param) { if (isset($_GET[$extra_param])) { $redirect_page .= $extra_param . '=' . $_GET[$extra_param] . '&'; // for the confirmation page $comment_confirm_extra[$extra_param] = $_GET[$extra_param]; } } } $redirect_page .= $plugin->itemName(); } $accesserror = false; if (!$xoops->isUser()) { $accesserror = true; } else { if (!$xoops->user->isAdmin($modid)) { $accesserror = true; } } if (false != $accesserror) { $ref = $xoops->getEnv('HTTP_REFERER'); if ($ref != '') { $xoops->redirect($ref, 2, XoopsLocale::E_NO_ACCESS_PERMISSION); } else { $xoops->redirect($redirect_page . '?' . $plugin->itemName() . '=' . (int) $id, 2, XoopsLocale::E_NO_ACCESS_PERMISSION); } } switch ($op) { case 'delete_one': if (!$comment_handler->delete($comment)) { $xoops->header(); echo $xoops->alert('error', _MD_COMMENTS_COMDELETENG . ' (ID: ' . $comment->getVar('id') . ')'); $xoops->footer(); } $itemid = $comment->getVar('itemid'); $criteria = new CriteriaCompo(new Criteria('modid', $modid)); $criteria->add(new Criteria('itemid', $itemid)); $criteria->add(new Criteria('status', COMMENTS_ACTIVE)); $comment_count = $comment_handler->getCount($criteria); $plugin->update($itemid, $comment_count); // update user posts if its not an anonymous post if ($comment->getVar('uid') != 0) { $member_handler = $xoops->getHandlerMember(); $poster = $member_handler->getUser($comment->getVar('uid')); if (is_object($poster)) { $member_handler->updateUserByField($poster, 'posts', $poster->getVar('posts') - 1); } } // get all comments posted later within the same thread $thread_comments = $comment_handler->getThread($comment->getVar('rootid'), $id); $xot = new XoopsObjectTree($thread_comments, 'id', 'pid', 'rootid'); $child_comments = $xot->getFirstChild($id); // now set new parent ID for direct child comments $new_pid = $comment->getVar('pid'); $errs = array(); foreach (array_keys($child_comments) as $i) { $child_comments[$i]->setVar('pid', $new_pid); // if the deleted comment is a root comment, need to change root id to own id if (false != $comment->isRoot()) { $new_rootid = $child_comments[$i]->getVar('id'); $child_comments[$i]->setVar('rootid', $child_comments[$i]->getVar('id')); if (!$comment_handler->insert($child_comments[$i])) { $errs[] = 'Could not change comment parent ID from <strong>' . $id . '</strong> to <strong>' . $new_pid . '</strong>. (ID: ' . $new_rootid . ')'; } else { // need to change root id for all its child comments as well $c_child_comments = $xot->getAllChild($new_rootid); $cc_count = count($c_child_comments); foreach (array_keys($c_child_comments) as $j) { $c_child_comments[$j]->setVar('rootid', $new_rootid); if (!$comment_handler->insert($c_child_comments[$j])) { $errs[] = 'Could not change comment root ID from <strong>' . $id . '</strong> to <strong>' . $new_rootid . '</strong>.'; } } } } else { if (!$comment_handler->insert($child_comments[$i])) { $errs[] = 'Could not change comment parent ID from <strong>' . $id . '</strong> to <strong>' . $new_pid . '</strong>.'; } } } if (count($errs) > 0) { $xoops->header(); echo $xoops->alert('error', $errs); $xoops->footer(); exit; } $xoops->redirect($redirect_page . '=' . $itemid . '&com_order=' . $order . '&com_mode=' . $mode, 1, _MD_COMMENTS_COMDELETED); break; case 'delete_all': $rootid = $comment->getVar('rootid'); // get all comments posted later within the same thread $thread_comments = $comment_handler->getThread($rootid, $id); // construct a comment tree $xot = new XoopsObjectTree($thread_comments, 'id', 'pid', 'rootid'); $child_comments = $xot->getAllChild($id); // add itself here $child_comments[$id] = $comment; $msgs = array(); $deleted_num = array(); $member_handler = $xoops->getHandlerMember(); foreach (array_keys($child_comments) as $i) { if (!$comment_handler->delete($child_comments[$i])) { $msgs[] = _MD_COMMENTS_COMDELETENG . ' (ID: ' . $child_comments[$i]->getVar('id') . ')'; } else { $msgs[] = _MD_COMMENTS_COMDELETED . ' (ID: ' . $child_comments[$i]->getVar('id') . ')'; // store poster ID and deleted post number into array for later use $poster_id = $child_comments[$i]->getVar('uid'); if ($poster_id > 0) { $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : $deleted_num[$poster_id] + 1; } } } foreach ($deleted_num as $user_id => $post_num) { // update user posts $poster = $member_handler->getUser($user_id); if (is_object($poster)) { $member_handler->updateUserByField($poster, 'posts', $poster->getVar('posts') - $post_num); } } $itemid = $comment->getVar('itemid'); $criteria = new CriteriaCompo(new Criteria('modid', $modid)); $criteria->add(new Criteria('itemid', $itemid)); $criteria->add(new Criteria('status', COMMENTS_ACTIVE)); $comment_count = $comment_handler->getCount($criteria); $plugin->update($itemid, $comment_count); $xoops->header(); echo $xoops->alert('info', $msgs); echo '<br /><a href="' . $redirect_page . '=' . $itemid . '&com_order=' . $order . '&com_mode=' . $mode . '">' . XoopsLocale::GO_BACK . '</a>'; $xoops->footer(); break; case 'delete': default: $xoops->header(); $comment_confirm = array('com_id' => $id, 'com_mode' => $mode, 'com_order' => $order, 'op' => array(_MD_COMMENTS_DELETEONE => 'delete_one', _MD_COMMENTS_DELETEALL => 'delete_all')); if (!empty($comment_confirm_extra) && is_array($comment_confirm_extra)) { $comment_confirm = $comment_confirm + $comment_confirm_extra; } echo $xoops->confirm($comment_confirm, 'comment_delete.php', _MD_COMMENTS_DELETESELECT); $xoops->footer(); break; } } }
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; include_once XOOPS_ROOT_PATH . '/modules/news/config.php'; $sform = new XoopsThemeForm(_NW_SUBMITNEWS, "storyform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php'); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormText(_NW_TITLE, 'title', 50, 255, $title), true); // Topic's selection box if (!isset($xt)) { $xt = new NewsTopic(); } if ($xt->getAllTopicsCount() == 0) { redirect_header("index.php", 4, _NW_POST_SORRY); exit; } include_once XOOPS_ROOT_PATH . "/class/tree.php"; $allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex'], 'news_submit'); $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topic_select = $topic_tree->makeSelBox('topic_id', 'topic_title', '-- ', $topicid, false); $sform->addElement(new XoopsFormLabel(_NW_TOPIC, $topic_select)); //If admin - show admin form //TODO: Change to "If submit privilege" if ($approveprivilege) { //Show topic image? $sform->addElement(new XoopsFormRadioYN(_AM_TOPICDISPLAY, 'topicdisplay', $topicdisplay)); //Select image position $posselect = new XoopsFormSelect(_AM_TOPICALIGN, 'topicalign', $topicalign); $posselect->addOption('R', _AM_RIGHT); $posselect->addOption('L', _AM_LEFT); $sform->addElement($posselect); //Publish in home? //TODO: Check that pubinhome is 0 = no and 1 = yes (currently vice versa) $sform->addElement(new XoopsFormRadioYN(_AM_PUBINHOME, 'ihome', $ihome, _NO, _YES));
$edit = false; } $categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters()); if (count($categories) == 0) { oledrion_utils::redirect(_AM_OLEDRION_ERROR_8, $baseurl, 5); } // TVA $vats = $vatsForDisplay = array(); $vats = $h_oledrion_vat->getAllVats(new oledrion_parameters()); if (count($vats) == 0 && oledrion_utils::getModuleOption('use_price')) { oledrion_utils::redirect(_AM_OLEDRION_ERROR_9, $baseurl, 5); } foreach ($vats as $onevat) { $vatsForDisplay[$onevat->getVar('vat_id')] = $onevat->getVar('vat_rate'); } $mytree = new XoopsObjectTree($categories, 'cat_cid', 'cat_pid'); $select_categ = $mytree->makeSelBox('product_cid', 'cat_title', '-', $item->getVar('product_cid')); $sform = new XoopsThemeForm($title, 'frmproduct', $baseurl); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormHidden('op', 'products')); $sform->addElement(new XoopsFormHidden('action', 'saveedit')); $sform->addElement(new XoopsFormHidden('product_id', $item->getVar('product_id'))); $sform->addElement(new XoopsFormHidden('product_submitter', $xoopsUser->getVar('uid'))); $sform->addElement(new XoopsFormText(_OLEDRION_TITLE, 'product_title', 50, 255, $item->getVar('product_title', 'e')), true); // Vendeurs ************************************************************* $vendors = $vendorsForDisplay = array(); $vendors = $h_oledrion_vendors->getAllVendors(new oledrion_parameters()); foreach ($vendors as $oneVendor) { $vendorsForDisplay[$oneVendor->getVar('vendor_id')] = $oneVendor->getVar('vendor_name'); } $vendorsSelect = new XoopsFormSelect(_OLEDRION_VENDOR, 'product_vendor_id', $item->getVar('product_vendor_id'));