/** * @param null $obj */ public function __construct($object = null) { $this->object = $object; $this->config = $object->config; $xoops = Xoops::getInstance(); parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal'); $activate = new Xoops\Form\Radio(_AM_XCAPTCHA_ACTIVATE, 'disabled', $this->config['disabled']); $activate->addOption(1, _AM_XCAPTCHA_ENABLE); $activate->addOption(0, _AM_XCAPTCHA_DISABLE); $this->addElement($activate, false); $plugin_List = new Xoops\Form\Select(_AM_XCAPTCHA_PLUGINS, 'mode', $this->config['mode']); $plugin_List->addOptionArray($this->object->plugin_List); $this->addElement($plugin_List, false); $this->addElement(new Xoops\Form\Text(_AM_XCAPTCHA_NAME, 'name', 50, 50, $this->config['name']), true); $skipmember = new Xoops\Form\Radio(_AM_XCAPTCHA_SKIPMEMBER, 'skipmember', $this->config['skipmember']); $skipmember->addOption(1, _AM_XCAPTCHA_ENABLE); $skipmember->addOption(0, _AM_XCAPTCHA_DISABLE); $this->addElement($skipmember, false); $this->addElement(new Xoops\Form\Text(_AM_XCAPTCHA_MAXATTEMPTS, 'maxattempts', 2, 2, $this->config['maxattempts']), true); $this->addElement(new Xoops\Form\Hidden('type', 'config')); $buttonTray = new Xoops\Form\ElementTray('', ''); $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save')); $buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); $buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset')); $buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button'); $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'"); $buttonTray->addElement($buttonCancelSend); $this->addElement($buttonTray); }
/** * @return void */ public function getDump() { $xoops = Xoops::getInstance(); $maintenance = new Maintenance(); parent::__construct('', "form_dump", "dump.php", 'post', true); $dump_tray = new Xoops\Form\ElementTray(_AM_MAINTENANCE_DUMP_TABLES_OR_MODULES, ''); $select_tables1 = new Xoops\Form\Select('', "dump_tables", '', 7, true); $select_tables1->addOptionArray($maintenance->displayTables(true)); $dump_tray->addElement($select_tables1, false); $ele = new Xoops\Form\Select(' ' . _AM_MAINTENANCE_OR . ' ', 'dump_modules', '', 7, true); $module_list = XoopsLists::getModulesList(); $module_handler = $xoops->getHandlerModule(); foreach ($module_list as $file) { if (XoopsLoad::fileExists(\XoopsBaseConfig::get('root-path') . '/modules/' . $file . '/xoops_version.php')) { clearstatcache(); $file = trim($file); $module = $module_handler->create(); $module->loadInfo($file); if ($module->getInfo('tables') && $xoops->isActiveModule($file)) { $ele->addOption($module->getInfo('dirname'), $module->getInfo('name')); } unset($module); } } $dump_tray->addElement($ele); $this->addElement($dump_tray); $this->addElement(new Xoops\Form\RadioYesNo(_AM_MAINTENANCE_DUMP_DROP, 'drop', 1)); $this->addElement(new Xoops\Form\Hidden("op", "dump_save")); $this->addElement(new Xoops\Form\Button("", "dump_save", XoopsLocale::A_SUBMIT, "submit")); }
/** * @param array $param array of parameters with these keys: * 'obj' => ImagesCategory|XoopsObject $obj * 'target' => textarea id */ public function __construct($param) { $xoops = Xoops::getInstance(); $groups = $xoops->getUserGroups(); extract($param); $helper = Xoops\Module\Helper::getHelper('images'); $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_read'); parent::__construct('', '', $xoops->getEnv('PHP_SELF'), 'post', false, 'inline'); $select = new Xoops\Form\Select('', 'imgcat_id', $imgcat_id); $select->addOption(0, _AM_IMAGES_CAT_SELECT); $select->addOptionArray($categories); if (isset($target)) { $select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?target=" . $target . "&imgcat_id=\" + this.value'"); } else { $select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?imgcat_id=\" + this.value'"); } $this->addElement($select); if (isset($target)) { $this->addElement(new Xoops\Form\Hidden('target', $target)); } $write = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write'); if ($imgcat_id > 0 && array_key_exists($imgcat_id, $write)) { $this->addElement(new Xoops\Form\Hidden('op', 'upload')); $button = new Xoops\Form\Button('', 'submit', _IMAGES_ADD, 'submit'); $button->setClass('btn btn-success floatright'); $this->addElement($button); } }
/** * @param null $obj */ public function __construct($obj = null) { $xoops = Xoops::getInstance(); parent::__construct('', 'xlanguage_form', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal'); // language name $xlanguage_select = new Xoops\Form\Select(_AM_XLANGUAGE_NAME, 'xlanguage_name', $obj->getVar('xlanguage_name')); $xlanguage_select->addOptionArray(XoopsLists::getLocaleList()); $this->addElement($xlanguage_select, true); // language description $this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_DESCRIPTION, 'xlanguage_description', 5, 30, $obj->getVar('xlanguage_description')), true); // language charset $autoload = XoopsLoad::loadConfig('xlanguage'); $charset_select = new Xoops\Form\Select(_AM_XLANGUAGE_CHARSET, 'xlanguage_charset', $obj->getVar('xlanguage_charset')); $charset_select->addOptionArray($autoload['charset']); $this->addElement($charset_select); // language code $this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_CODE, 'xlanguage_code', 5, 10, $obj->getVar('xlanguage_code')), true); // language weight $this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_WEIGHT, 'xlanguage_weight', 1, 4, $obj->getVar('xlanguage_weight'))); // language image $image_option_tray = new Xoops\Form\ElementTray(_AM_XLANGUAGE_IMAGE, ''); $image_array = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('root-path') . '/media/xoops/images/flags/' . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . '/'); $image_select = new Xoops\Form\Select('', 'xlanguage_image', $obj->getVar('xlanguage_image')); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image\", \"xlanguage_image\", \"/media/xoops/images/flags/" . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . "/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'"); $image_tray = new Xoops\Form\ElementTray('', ' '); $image_tray->addElement($image_select); $image_tray->addElement(new Xoops\Form\Label('', "<div style='padding: 8px;'><img style='width:24px; height:24px; ' src='" . \XoopsBaseConfig::get('url') . "/media/xoops/images/flags/" . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . "/" . $obj->getVar("xlanguage_image") . "' name='image' id='image' alt='' /></div>")); $image_option_tray->addElement($image_tray); $this->addElement($image_option_tray); $this->addElement(new Xoops\Form\Hidden('xlanguage_id', $obj->getVar('xlanguage_id'))); /** * Buttons */ $button_tray = new Xoops\Form\ElementTray('', ''); $button_tray->addElement(new Xoops\Form\Hidden('op', 'save')); $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'); $button->setClass('btn btn-success'); $button_tray->addElement($button); $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'); $button_2->setClass('btn btn-warning'); $button_tray->addElement($button_2); switch (basename($xoops->getEnv('PHP_SELF'), '.php')) { case 'xoops_xlanguage': $button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button'); $button_3->setExtra('onclick="tinyMCEPopup.close();"'); $button_3->setClass('btn btn-danger'); $button_tray->addElement($button_3); break; case 'index': default: $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button'); $button_3->setExtra("onclick='javascript:history.go(-1);'"); $button_3->setClass('btn btn-danger'); $button_tray->addElement($button_3); break; } $this->addElement($button_tray); }
/** * @param BannersBanner|XoopsObject $obj */ public function __construct(BannersBanner &$obj) { $xoops = Xoops::getInstance(); $helper = Banners::getInstance(); if ($obj->isNew()) { $blank_img = 'blank.gif'; $html_banner = 0; } else { if (substr_count($obj->getVar('banner_imageurl'), $xoops_upload_url . '/banners/') == 0) { $blank_img = 'blank.gif'; } else { $namefile = substr_replace($obj->getVar('banner_imageurl'), '', 0, strlen($xoops_upload_url . '/banners/')); $pathfile = $xoops_root_path . '/uploads/banners/' . $namefile; if (is_file($pathfile)) { $blank_img = str_replace($xoops_upload_url . '/banners/', '', $obj->getVar('banner_imageurl', 'e')); } else { $blank_img = 'blank.gif'; } } $html_banner = $obj->getVar('banner_htmlbanner'); } $title = $obj->isNew() ? sprintf(_AM_BANNERS_BANNERS_ADD) : sprintf(_AM_BANNERS_BANNERS_EDIT); parent::__construct($title, 'form', 'banners.php', 'post', true); $this->setExtra('enctype="multipart/form-data"'); $client_Handler = $helper->getHandlerBannerclient(); $client_select = new Xoops\Form\Select(_AM_BANNERS_CLIENTS_NAME, 'cid', $obj->getVar('banner_cid')); $client_select->addOptionArray($client_Handler->getList()); $this->addElement($client_select, true); $imptotal = new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMPRESSIONSP, 'imptotal', 1, 255, $obj->getVar('banner_imptotal')); //$imptotal->setPattern('^[0-9]*[0-9]+$|^[0-9]+[0-9]*$', _AM_BANNERS_BANNERS_IMPRESSIONSP_PATTERN); $this->addElement($imptotal, true); $imgtray_img = new Xoops\Form\ElementTray(_AM_BANNERS_BANNERS_IMAGE, '<br /><br />'); $imgtray_img->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMGURL, 'imageurl', 8, 255, $obj->getVar('banner_imageurl'))); $imgpath_img = sprintf(_AM_BANNERS_BANNERS_IMAGE_PATH, $xoops_upload_path . '/banners/'); $imageselect_img = new Xoops\Form\Select($imgpath_img, 'banners_imageurl', $blank_img); $image_array_img = XoopsLists::getImgListAsArray($xoops_upload_path . '/banners'); $imageselect_img->addOption("{$blank_img}", $blank_img); foreach ($image_array_img as $image_img) { $imageselect_img->addOption("{$image_img}", $image_img); } $imageselect_img->setExtra('onchange="showImgSelected(\'xo-banners-img\', \'banners_imageurl\', \'banners\', \'\', \'' . $xoops_upload_url . '\' )"'); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/banners/" . $blank_img . "' name='image_img' id='xo-banners-img' alt='' />")); $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new Xoops\Form\File(_AM_BANNERS_BANNERS_UPLOADS, 'banners_imageurl'), false); $fileseltray_img->addElement(new Xoops\Form\Label(''), false); $imgtray_img->addElement($fileseltray_img); $this->addElement($imgtray_img); $this->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_CLICKURL, 'clickurl', 5, 255, $obj->getVar('banner_clickurl')), false); $this->addElement(new Xoops\Form\RadioYesNo(_AM_BANNERS_BANNERS_USEHTML, 'htmlbanner', $html_banner)); $this->addElement(new Xoops\Form\TextArea(_AM_BANNERS_BANNERS_CODEHTML, 'htmlcode', $obj->getVar('banner_htmlcode'), 5, 5), false); if (!$obj->isNew()) { $this->addElement(new Xoops\Form\Hidden('bid', $obj->getVar('banner_bid'))); } $this->addElement(new Xoops\Form\Hidden('op', 'save')); $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); }
/** * @param ImagesImage|XoopsObject $obj */ public function __construct(ImagesImage $obj) { $xoops = Xoops::getInstance(); $helper = Xoops\Module\Helper::getHelper('images'); $groups = $xoops->getUserGroups(); if ($obj->isNew()) { $title = _AM_IMAGES_IMG_ADD; } else { $title = _AM_IMAGES_IMG_EDIT; } parent::__construct('', 'image', $xoops->getEnv('PHP_SELF'), 'post', true); $this->setExtra('enctype="multipart/form-data"'); $tabtray = new Xoops\Form\TabTray('', 'uniqueid', $xoops->getModuleConfig('jquery_theme', 'system')); $tab1 = new Xoops\Form\Tab($title, 'tabid-1'); $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_NAME, 'image_nicename', 50, 255, $obj->getVar('image_nicename')), true); if ($obj->isNew()) { $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write'); $select = new Xoops\Form\Select(_AM_IMAGES_CAT_SELECT, 'imgcat_id', $obj->getVar('imgcat_id')); $select->addOption('', _AM_IMAGES_CAT_SELECT); $select->addOptionArray($categories); $tab1->addElement($select, true); } else { $tab1->addElement(new Xoops\Form\Label(_AM_IMAGES_CAT_SELECT, '<span class="red bold">' . $helper->getHandlerCategories()->get($obj->getVar('imgcat_id'))->getVar('imgcat_name') . '</span>')); $this->addElement(new Xoops\Form\Hidden('imgcat_id', $obj->getVar('imgcat_id'))); } // warning $category = $helper->getHandlerCategories()->get($obj->getVar('imgcat_id')); $upload_msg[] = _AM_IMAGES_CAT_SIZE . ' : ' . $category->getVar('imgcat_maxsize'); $upload_msg[] = _AM_IMAGES_CAT_WIDTH . ' : ' . $category->getVar('imgcat_maxwidth'); $upload_msg[] = _AM_IMAGES_CAT_HEIGHT . ' : ' . $category->getVar('imgcat_maxheight'); $image_tray = new Xoops\Form\File(_AM_IMAGES_IMG_FILE, 'image_file'); $image_tray->setDescription(self::message($upload_msg, '')); $tab1->addElement($image_tray); $tab1->addElement(new Xoops\Form\Text(_AM_IMAGES_WEIGHT, 'image_weight', 1, 4, $obj->getVar('image_weight'))); $tab1->addElement(new Xoops\Form\RadioYesNo(_AM_IMAGES_DISPLAY, 'image_display', $obj->getVar('image_display'))); $tabtray->addElement($tab1); $this->addElement($tabtray); $this->addElement(new Xoops\Form\Hidden('image_name', $obj->getVar('image_name'))); $this->addElement(new Xoops\Form\Hidden('image_id', $obj->getVar('image_id'))); /** * Buttons */ $button_tray = new Xoops\Form\ElementTray('', ''); $button_tray->addElement(new Xoops\Form\Hidden('op', 'save')); $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'); $button->setClass('btn btn-success'); $button_tray->addElement($button); $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'); $button_2->setClass('btn btn-warning'); $button_tray->addElement($button_2); $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button'); $button_3->setExtra("onclick='javascript:history.go(-1);'"); $button_3->setClass('btn btn-danger'); $button_tray->addElement($button_3); $this->addElement($button_tray); }
/** * @param SmiliesSmiley|XoopsObject $obj */ public function __construct(SmiliesSmiley $obj) { $xoops = Xoops::getInstance(); if ($obj->isNew()) { $blank_img = 'blank.gif'; } else { $blank_img = str_replace('smilies/', '', $obj->getVar('smiley_url', 'e')); } $title = $obj->isNew() ? sprintf(_AM_SMILIES_ADD) : sprintf(_AM_SMILIES_EDIT); parent::__construct($title, 'form', $xoops->getEnv('PHP_SELF'), 'post', true); $this->setExtra('enctype="multipart/form-data"'); $this->addElement(new Xoops\Form\Text(_AM_SMILIES_CODE, 'smiley_code', 2, 25, $obj->getVar('smiley_code')), true); $this->addElement(new Xoops\Form\Text(_AM_SMILIES_DESCRIPTION, 'smiley_emotion', 4, 50, $obj->getVar('smiley_emotion')), true); $imgtray_img = new Xoops\Form\ElementTray(_AM_SMILIES_FILE, '<br />'); $imgpath_img = sprintf(_AM_SMILIES_IMAGE_PATH, \XoopsBaseConfig::get('uploads-url') . '/smilies/'); $imageselect_img = new Xoops\Form\Select($imgpath_img, 'smiley_url', $blank_img); $image_array_img = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('uploads-url') . '/smilies'); $imageselect_img->addOptionArray($image_array_img); $imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smiley_url\', \'smilies\', \'\', \'' . \XoopsBaseConfig::get('uploads-url') . '\' )"'); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . \XoopsBaseConfig::get('uploads-url') . "/smilies/" . $blank_img . "' name='image_img' id='xo-smilies-img' alt=''>")); $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new Xoops\Form\File(_AM_SMILIES_UPLOADS, 'smiley_url'), false); $fileseltray_img->addElement(new Xoops\Form\Label(''), false); $imgtray_img->addElement($fileseltray_img); $this->addElement($imgtray_img); $this->addElement(new Xoops\Form\RadioYesNo(_AM_SMILIES_OFF, 'smiley_display', $obj->getVar('smiley_display'))); $this->addElement(new Xoops\Form\Hidden('smiley_id', $obj->getVar('smiley_id'))); /** * Buttons */ $button_tray = new Xoops\Form\ElementTray('', ''); $button_tray->addElement(new Xoops\Form\Hidden('op', 'save')); $button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'); $button->setClass('btn btn-success'); $button_tray->addElement($button); $button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'); $button_2->setClass('btn btn-warning'); $button_tray->addElement($button_2); switch (basename($xoops->getEnv('PHP_SELF'), '.php')) { case 'xoops_smilies': $button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button'); $button_3->setExtra('onclick="tinyMCEPopup.close();"'); $button_3->setClass('btn btn-danger'); $button_tray->addElement($button_3); break; case 'smilies': default: $button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button'); $button_3->setExtra("onclick='javascript:history.go(-1);'"); $button_3->setClass('btn btn-danger'); $button_tray->addElement($button_3); break; } $this->addElement($button_tray); }
function b_system_topposters_edit($options) { $block_form = new Xoops\Form\BlockForm(); $block_form->addElement(new Xoops\Form\Text(SystemLocale::NUMBER_OF_USERS_TO_DISPLAY, 'options[0]', 1, 3, $options[0]), true); $block_form->addElement(new Xoops\Form\RadioYesNo(SystemLocale::DISPLAY_USERS_AVATARS, 'options[1]', $options[1])); $ranks = XoopsLists::getUserRankList(); $ranks_select = new Xoops\Form\Select(SystemLocale::C_DO_NOT_DISPLAY_USERS_WHOSE_RANK_IS, 'options[2]', explode(',', $options[2]), 5, true); $ranks_select->addOptionArray($ranks); $block_form->addElement($ranks_select); return $block_form->render(); }
/** * @param Array * * 'obj' => ImagesImage|XoopsObject $obj * 'target' => textarea id */ public function __construct($param) { $xoops = Xoops::getInstance(); $helper = Xoops\Module\Helper::getHelper('images'); //todo, remove extract extract($param); $groups = $xoops->getUserGroups(); if ($obj->isNew()) { $title = _AM_IMAGES_IMG_ADD; } else { $title = _AM_IMAGES_IMG_EDIT; } parent::__construct($title, 'image', $xoops->getEnv('PHP_SELF'), 'post', true); $this->setExtra('enctype="multipart/form-data"'); $this->addElement(new Xoops\Form\Text(_AM_IMAGES_NAME, 'image_nicename', 50, 255, $obj->getVar('image_nicename')), true); $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write'); $select = new Xoops\Form\Select(_AM_IMAGES_CAT_SELECT, 'imgcat_id', $obj->getVar('imgcat_id')); $select->addOption('', _AM_IMAGES_CAT_SELECT); $select->addOptionArray($categories); $this->addElement($select, true); $this->addElement(new Xoops\Form\File(_AM_IMAGES_IMG_FILE, 'image_file')); $this->addElement(new Xoops\Form\Hidden('image_weight', $obj->getVar('image_weight'))); $this->addElement(new Xoops\Form\Hidden('image_display', $obj->getVar('image_display'))); $this->addElement(new Xoops\Form\Hidden('image_name', $obj->getVar('image_name'))); $this->addElement(new Xoops\Form\Hidden('image_id', $obj->getVar('image_id'))); $this->addElement(new Xoops\Form\Hidden('target', $target)); /** * Buttons */ $buttonTray = new Xoops\Form\ElementTray('', ''); $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save')); $buttonSubmit = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'); $buttonSubmit->setClass('btn btn-success'); $buttonTray->addElement($buttonSubmit); $buttonReset = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'); $buttonReset->setClass('btn btn-warning'); $buttonTray->addElement($buttonReset); switch (basename($xoops->getEnv('PHP_SELF'), '.php')) { case 'xoops_images': $buttonClose = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button'); $buttonClose->setExtra('onclick="tinyMCEPopup.close();"'); $buttonClose->setClass('btn btn-danger'); $buttonTray->addElement($buttonClose); break; case 'images': default: $buttonCancel = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button'); $buttonCancel->setExtra("onclick='javascript:history.go(-1);'"); $buttonCancel->setClass('btn btn-danger'); $buttonTray->addElement($buttonCancel); break; } $this->addElement($buttonTray); }
function publisher_items_menu_edit($options) { $form = new Xoops\Form\BlockForm(); $catEle = new Xoops\Form\Label(_MB_PUBLISHER_SELECTCAT, PublisherUtils::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new Xoops\Form\Select(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray(array('datesub' => _MB_PUBLISHER_DATE, 'counter' => _MB_PUBLISHER_HITS, 'weight' => _MB_PUBLISHER_WEIGHT)); $dispEle = new Xoops\Form\Text(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]); $form->addElement($catEle); $form->addElement($orderEle); $form->addElement($dispEle); return $form->render(); }
/** * @param category id $imgcat_id */ public function __construct($imgcat_id) { $xoops = Xoops::getInstance(); $groups = $xoops->getUserGroups(); $helper = Xoops\Module\Helper::getHelper('images'); $categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_read'); parent::__construct('', 'category_select', $xoops->getEnv('PHP_SELF'), 'post'); $select = new Xoops\Form\Select('', 'imgcat_id', $imgcat_id); $select->addOption(0, _AM_IMAGES_CAT_SELECT); $select->addOptionArray($categories); $select->setExtra("onchange='javascript:window.location.href=\"images.php?imgcat_id=\" + this.value'"); $this->addElement($select); }
function b_system_topposters_edit($options) { $block_form = new Xoops\Form\BlockForm(); $block_form->addElement(new Xoops\Form\Text(SystemLocale::NUMBER_OF_USERS_TO_DISPLAY, 'options[0]', 1, 3, $options[0]), true); $block_form->addElement(new Xoops\Form\RadioYesNo(SystemLocale::DISPLAY_USERS_AVATARS, 'options[1]', $options[1])); $xoops = \Xoops::getInstance(); $ranks = $xoops->service('userrank')->getAssignableUserRankList()->getValue(); if ($ranks === null) { $ranks = []; } $ranks_select = new Xoops\Form\Select(SystemLocale::C_DO_NOT_DISPLAY_USERS_WHOSE_RANK_IS, 'options[2]', explode(',', $options[2]), 5, true); $ranks_select->addOptionArray($ranks); $block_form->addElement($ranks_select); return $block_form->render(); }
public function getSearchFrom($andor, $queries, $mids, $mid) { $xoops = Xoops::getInstance(); $search = Search::getInstance(); // create form parent::__construct(_MD_SEARCH, 'search', 'index.php', 'get'); // create form elements $this->addElement(new Xoops\Form\Text(_MD_SEARCH_KEYWORDS, 'query', 30, 255, htmlspecialchars(stripslashes($this->queryArrayToString($queries)), ENT_QUOTES)), true); $type_select = new Xoops\Form\Select(_MD_SEARCH_TYPE, 'andor', $andor); $type_select->addOptionArray(array('AND' => _MD_SEARCH_ALL, 'OR' => _MD_SEARCH_ANY)); $this->addElement($type_select); if (!empty($mids)) { $mods_checkbox = new Xoops\Form\Checkbox(_MD_SEARCH_SEARCHIN, 'mids[]', $mids); } else { $mods_checkbox = new Xoops\Form\Checkbox(_MD_SEARCH_SEARCHIN, 'mids[]', $mid); } if (empty($modules)) { $gperm_handler = $xoops->getHandlerGroupperm(); $available_modules = $gperm_handler->getItemIds('module_read', $xoops->getUserGroups()); $available_plugins = \Xoops\Module\Plugin::getPlugins('search'); //todo, would be nice to have the module ids availabe also $criteria = new CriteriaCompo(); $criteria->add(new Criteria('dirname', "('" . implode("','", array_keys($available_plugins)) . "')", 'IN')); if (isset($available_modules) && !empty($available_modules)) { $criteria->add(new Criteria('mid', '(' . implode(',', $available_modules) . ')', 'IN')); } $module_handler = $xoops->getHandlerModule(); $mods_checkbox->addOptionArray($module_handler->getNameList($criteria)); } else { /* @var $module XoopsModule */ $module_array = array(); foreach ($modules as $mid => $module) { $module_array[$mid] = $module->getVar('name'); } $mods_checkbox->addOptionArray($module_array); } $this->addElement($mods_checkbox); if ($search->getConfig('keyword_min') > 0) { $this->addElement(new Xoops\Form\Label(_MD_SEARCH_SEARCHRULE, sprintf(_MD_SEARCH_KEYIGNORE, $search->getConfig('keyword_min')))); } $this->addElement(new Xoops\Form\Hidden('action', 'results')); $this->addElement(new Xoops\Form\Token('id')); $this->addElement(new Xoops\Form\Button('', 'submit', _MD_SEARCH, 'submit')); return $this; }
/** * __construct * * @param string $caption * @param string $name * @param integer $size * @param integer $value */ public function __construct($caption, $name, $size = 15, $value = 0) { parent::__construct($caption, ' '); $value = (int) $value; $value = $value > 0 ? $value : time(); $datetime = getdate($value); $this->addElement(new Xoops\Form\DateSelect('', $name . '[date]', $size, $value)); $timearray = array(); for ($i = 0; $i < 24; ++$i) { for ($j = 0; $j < 60; $j = $j + 10) { $key = $i * 3600 + $j * 60; $timearray[$key] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j; } } ksort($timearray); $timeselect = new Xoops\Form\Select('', $name . '[time]', $datetime['hours'] * 3600 + 600 * floor($datetime['minutes'] / 10)); $timeselect->addOptionArray($timearray); $this->addElement($timeselect); }
public function __construct(AvatarsAvatar $obj) { $xoops = Xoops::getInstance(); $helper = Avatars::getInstance(); // Get avatar handler $avatar_handler = $helper->getHandlerAvatar(); $action = $_SERVER['REQUEST_URI']; parent::__construct(AvatarsLocale::USERFORM, 'avatar_user_form', $action, "post", true); $this->setExtra('enctype="multipart/form-data"'); // select and uploads $avatar_select = new Xoops\Form\Select('', 'user_avatar', $xoops->user->getVar('user_avatar')); $avatar_list = $avatar_handler->getListByType('S', true); $avatar_selected = $xoops->user->getVar("user_avatar", "E"); $avatar_selected = in_array($avatar_selected, array_keys($avatar_list)) ? $avatar_selected : "blank.gif"; $avatar_select->addOptionArray($avatar_list); $xoops_url = \XoopsBaseConfig::get('url'); $xoops_upload_url = \XoopsBaseConfig::get('uploads-url'); $avatar_select->setExtra("onchange='showImgSelected(\"avatar\", \"user_avatar\", \"uploads\", \"\", \"" . $xoops_url . "\")'"); $avatar_tray = new Xoops\Form\ElementTray(XoopsLocale::FILE, ' '); $avatar_tray->addElement($avatar_select); $avatar_tray->addElement(new Xoops\Form\Label('', "<a href=\"javascript:openWithSelfMain('" . $xoops_url . "/modules/avatars/popup.php','avatars',600,400);\">" . XoopsLocale::LIST_ . "</a><br />")); $avatar_tray->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/" . $avatar_selected . "' name='avatar' id='avatar' alt='' />")); if ($helper->getConfig('avatars_allowupload') == 1 && $xoops->user->getVar('posts') >= $helper->getConfig('avatars_postsrequired')) { $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new Xoops\Form\File(XoopsLocale::A_UPLOAD, 'user_avatar'), false); $avatar_tray->addElement($fileseltray_img); } $this->addElement($avatar_tray); // Hidden $this->addElement(new Xoops\Form\Hidden('avatar_type', 'c')); $this->addElement(new Xoops\Form\Hidden('uid', $xoops->user->getVar('uid'))); $this->addElement(new Xoops\Form\Hidden('op', 'save')); $this->addElement(new Xoops\Form\Hidden('avatar_id', $obj->getVar('avatar_id', 'e'))); // Button $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); }
/** * @param null $obj */ public function __construct($object = null) { $this->object = $object; $this->config = $object->config; $xoops = Xoops::getInstance(); parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal'); $this->addElement(new Xoops\Form\TextArea(_XCAPTCHA_PRIVATE_KEY, 'private_key', $this->config['private_key'], 5, 50), true); $this->addElement(new Xoops\Form\Textarea(_XCAPTCHA_PUBLIC_KEY, 'public_key', $this->config['public_key'], 5, 50), true); $theme_form = new Xoops\Form\Select(_XCAPTCHA_THEME, 'theme', $this->config['theme'], $size = 4); $theme_form->addOptionArray($this->object->getThemes()); $this->addElement($theme_form, false); $lang_form = new Xoops\Form\Select(_XCAPTCHA_LANG, 'lang', $this->config['lang'], $size = 4); $lang_form->addOptionArray($this->object->getLanguages()); $this->addElement($lang_form, false); $this->addElement(new Xoops\Form\Hidden('type', 'recaptcha')); $buttonTray = new Xoops\Form\ElementTray('', ''); $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save')); $buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); $buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset')); $buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button'); $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'"); $buttonTray->addElement($buttonCancelSend); $this->addElement($buttonTray); }
$occupation_text = new Xoops\Form\Text(XoopsLocale::OCCUPATION_CONTAINS, "user_occ", 30, 100); $interest_text = new Xoops\Form\Text(XoopsLocale::INTEREST_CONTAINS, "user_intrest", 30, 100); $lastlog_more = new Xoops\Form\Text(SystemLocale::LAST_LOGIN_GREATER_THAN_X, "user_lastlog_more", 10, 5); $lastlog_less = new Xoops\Form\Text(SystemLocale::LAST_LOGIN_LESS_THAN_X, "user_lastlog_less", 10, 5); $reg_more = new Xoops\Form\Text(SystemLocale::REGISTRATION_DATE_GREATER_THAN_X, "user_reg_more", 10, 5); $reg_less = new Xoops\Form\Text(SystemLocale::REGISTRATION_DATE_LESS_THAN_X, "user_reg_less", 10, 5); $posts_more = new Xoops\Form\Text(SystemLocale::POSTS_NUMBER_GREATER_THAN_X, "user_posts_more", 10, 5); $posts_less = new Xoops\Form\Text(SystemLocale::POSTS_NUMBER_LESS_THAN_X, "user_posts_less", 10, 5); $mailok_radio = new Xoops\Form\Radio(XoopsLocale::TYPE_OF_USERS_TO_SHOW, "user_mailok", "both"); $mailok_radio->addOptionArray(array("mailok" => XoopsLocale::ONLY_USERS_THAT_ACCEPT_EMAIL, "mailng" => XoopsLocale::ONLY_USERS_THAT_DO_NOT_ACCEPT_EMAIL, "both" => XoopsLocale::ALL_USERS)); $type_radio = new Xoops\Form\Radio(XoopsLocale::TYPE_OF_USERS_TO_SHOW, "user_type", "both"); $type_radio->addOptionArray(array("actv" => SystemLocale::ONLY_ACTIVE_USERS, "inactv" => SystemLocale::ONLY_INACTIVE_USERS, "both" => XoopsLocale::ALL_USERS)); $sort_select = new Xoops\Form\Select(XoopsLocale::SORT_BY, "user_sort", 'uname'); $sort_select->addOptionArray(array("uname" => XoopsLocale::USER_NAME, "email" => XoopsLocale::EMAIL, "last_login" => XoopsLocale::LAST_LOGIN, "user_regdate" => XoopsLocale::REGISTRATION_DATE, "posts" => XoopsLocale::COMMENTS_POSTS)); $order_select = new Xoops\Form\Select(XoopsLocale::ORDER, "user_order", 'ASC'); $order_select->addOptionArray(array("ASC" => XoopsLocale::ASCENDING, "DESC" => XoopsLocale::DESCENDING)); $limit_text = new Xoops\Form\Text(XoopsLocale::NUMBER_OF_RESULTS_PER_PAGE, "user_limit", 6, 2, 20); $submit_button = new Xoops\Form\Button("", "user_submit", XoopsLocale::A_SUBMIT, "submit"); $form = new Xoops\Form\ThemeForm(XoopsLocale::FIND_USERS, "user_findform", "admin.php?fct=users", 'post', true); $form->addElement($uname_tray); $form->addElement($name_tray); $form->addElement($email_tray); $form->addElement($group_select); $form->addElement($icq_tray); $form->addElement($aim_tray); $form->addElement($yim_tray); $form->addElement($msnm_tray); $form->addElement($url_text); $form->addElement($location_text); $form->addElement($occupation_text); $form->addElement($interest_text);
function publisher_items_new_edit($options) { $form = new Xoops\Form\BlockForm(); $catEle = new Xoops\Form\Label(_MB_PUBLISHER_SELECTCAT, PublisherUtils::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new Xoops\Form\Select(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray(array('datesub' => _MB_PUBLISHER_DATE, 'counter' => _MB_PUBLISHER_HITS, 'weight' => _MB_PUBLISHER_WEIGHT)); $showEle = new Xoops\Form\RadioYesNo(_MB_PUBLISHER_ORDER_SHOW, 'options[2]', $options[2]); $dispEle = new Xoops\Form\Text(_MB_PUBLISHER_DISP, 'options[3]', 2, 255, $options[3]); $charsEle = new Xoops\Form\Text(_MB_PUBLISHER_CHARS, 'options[4]', 2, 255, $options[4]); $imageEle = new Xoops\Form\Select(_MB_PUBLISHER_IMAGE_TO_DISPLAY, 'options[5]', $options[5]); $imageEle->addOptionArray(array('none' => XoopsLocale::NONE, 'article' => _MB_PUBLISHER_IMAGE_ARTICLE, 'category' => _MB_PUBLISHER_IMAGE_CATEGORY, 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR)); $form->addElement($catEle); $form->addElement($orderEle); $form->addElement($showEle); $form->addElement($dispEle); $form->addElement($charsEle); $form->addElement($imageEle); return $form->render(); }
/** * getForm - get block edit form * * @param string $mode mode for form, edit or clone * * @return void */ public function getForm($mode = 'edit') { $xoops = Xoops::getInstance(); $xoops->loadLanguage('blocks', 'system'); if ($this->obj->isNew()) { $title = SystemLocale::ADD_BLOCK; $modules = array(-1); $groups = array(FixedGroups::USERS, FixedGroups::ANONYMOUS, FixedGroups::ADMIN); $this->obj->setVar('block_type', 'C'); $this->obj->setVar('visible', 1); $op = 'save'; } else { $title = ''; $modules = array(); // Search modules $blockmodulelink_handler = $xoops->getHandlerBlockmodulelink(); $criteria = new CriteriaCompo(new Criteria('block_id', $this->obj->getVar('bid'))); $blockmodulelink = $blockmodulelink_handler->getObjects($criteria); /* @var $link XoopsBlockmodulelink */ foreach ($blockmodulelink as $link) { $modules[] = $link->getVar('module_id'); } // Search perms $groupperm_handler = $xoops->getHandlerGroupperm(); $groups = $groupperm_handler->getGroupIds('block_read', $this->obj->getVar('bid')); switch ($mode) { case 'edit': $title = SystemLocale::EDIT_BLOCK; break; case 'clone': $title = SystemLocale::CLONE_BLOCK; $this->obj->setVar('bid', 0); if ($this->obj->isCustom()) { $this->obj->setVar('block_type', 'C'); } else { $this->obj->setVar('block_type', 'D'); } break; } $op = 'save'; } parent::__construct($title, 'blockform', 'admin.php', 'post', true); if (!$this->obj->isNew()) { $this->addElement(new Xoops\Form\Label(XoopsLocale::NAME, $this->obj->getVar('name'))); } // Side position $side_select = new Xoops\Form\Select(XoopsLocale::SIDE, 'side', $this->obj->getVar('side')); $side_select->addOptionArray(array(0 => XoopsLocale::LEFT, 1 => XoopsLocale::RIGHT, 3 => SystemLocale::TOP_LEFT, 4 => SystemLocale::TOP_RIGHT, 5 => SystemLocale::TOP_CENTER, 7 => SystemLocale::BOTTOM_LEFT, 8 => SystemLocale::BOTTOM_RIGHT, 9 => SystemLocale::BOTTOM_CENTER)); $this->addElement($side_select); // Order $weight = new Xoops\Form\Text(XoopsLocale::WEIGHT, 'weight', 1, 5, $this->obj->getVar('weight'), ''); $weight->setPattern('^\\d+$', XoopsLocale::E_YOU_NEED_A_POSITIVE_INTEGER); $this->addElement($weight, true); // Display $this->addElement(new Xoops\Form\RadioYesNo(XoopsLocale::VISIBLE, 'visible', $this->obj->getVar('visible'))); // Visible In $mod_select = new Xoops\Form\Select(XoopsLocale::VISIBLE_IN, 'modules', $modules, 5, true); $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); $criteria->add(new Criteria('isactive', 1)); $module_list = $xoops->getHandlerModule()->getNameList($criteria); $module_list[-1] = XoopsLocale::TOP_PAGE; $module_list[0] = XoopsLocale::ALL_PAGES; ksort($module_list); $mod_select->addOptionArray($module_list); $this->addElement($mod_select); // Title $this->addElement(new Xoops\Form\Text(XoopsLocale::TITLE, 'title', 5, 255, $this->obj->getVar('title')), false); if ($this->obj->isNew() || $this->obj->isCustom()) { $editor_configs = array(); $editor_configs["name"] = "content_block"; $editor_configs["value"] = $this->obj->getVar('content', 'e'); $editor_configs["rows"] = 15; $editor_configs["cols"] = 6; $editor_configs["editor"] = $xoops->getModuleConfig('blocks_editor', 'system'); $this->addElement(new Xoops\Form\Editor(XoopsLocale::CONTENT, "content_block", $editor_configs), true); if (in_array($editor_configs["editor"], array('dhtmltextarea', 'textarea'))) { $ctype_select = new Xoops\Form\Select(SystemLocale::CONTENT_TYPE, 'c_type', $this->obj->getVar('c_type')); $ctype_select->addOptionArray(array('H' => XoopsLocale::HTML, 'P' => SystemLocale::PHP_SCRIPT, 'S' => SystemLocale::AUTO_FORMAT_SMILIES_ENABLED, 'T' => SystemLocale::AUTO_FORMAT_SMILIES_DISABLED)); $this->addElement($ctype_select); } else { $this->addElement(new Xoops\Form\Hidden('c_type', 'H')); } } else { if ($this->obj->getVar('template') != '') { $tplfile_handler = $xoops->getHandlerTplfile(); $btemplate = $tplfile_handler->find($xoops->getConfig('template_set'), 'block', $this->obj->getVar('bid')); if (count($btemplate) > 0) { $this->addElement(new Xoops\Form\Label(XoopsLocale::CONTENT, '<a href="' . \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate[0]->getVar('tpl_id') . '">' . SystemLocale::EDIT_TEMPLATE . '</a>')); } else { $btemplate2 = $tplfile_handler->find('default', 'block', $this->obj->getVar('bid')); if (count($btemplate2) > 0) { $this->addElement(new Xoops\Form\Label(XoopsLocale::CONTENT, '<a href="' . \XoopsBaseConfig::get('url') . '/modules/system/admin.php?fct=tplsets&op=edittpl&id=' . $btemplate2[0]->getVar('tpl_id') . '" rel="external">' . SystemLocale::EDIT_TEMPLATE . '</a>')); } } } if ($this->obj->getOptions() != false) { $this->addElement(new Xoops\Form\Label(XoopsLocale::OPTIONS, $this->obj->getOptions())); } else { $this->addElement(new Xoops\Form\Hidden('options', $this->obj->getVar('options'))); } $this->addElement(new Xoops\Form\Hidden('c_type', 'H')); } $cache_select = new Xoops\Form\Select(SystemLocale::CACHE_LIFETIME, 'bcachetime', $this->obj->getVar('bcachetime')); $cache_select->addOptionArray(array('0' => XoopsLocale::NO_CACHE, '30' => sprintf(XoopsLocale::F_SECONDS, 30), '60' => XoopsLocale::ONE_MINUTE, '300' => sprintf(XoopsLocale::F_MINUTES, 5), '1800' => sprintf(XoopsLocale::F_MINUTES, 30), '3600' => XoopsLocale::ONE_HOUR, '18000' => sprintf(XoopsLocale::F_HOURS, 5), '86400' => XoopsLocale::ONE_DAY, '259200' => sprintf(XoopsLocale::F_DAYS, 3), '604800' => XoopsLocale::ONE_WEEK, '2592000' => XoopsLocale::ONE_MONTH)); $this->addElement($cache_select); // Groups $this->addElement(new Xoops\Form\SelectGroup(XoopsLocale::GROUPS, 'groups', true, $groups, 5, true)); $this->addElement(new Xoops\Form\Hidden('block_type', $this->obj->getVar('block_type'))); $this->addElement(new Xoops\Form\Hidden('mid', $this->obj->getVar('mid'))); $this->addElement(new Xoops\Form\Hidden('func_num', $this->obj->getVar('func_num'))); $this->addElement(new Xoops\Form\Hidden('func_file', $this->obj->getVar('func_file'))); $this->addElement(new Xoops\Form\Hidden('show_func', $this->obj->getVar('show_func'))); $this->addElement(new Xoops\Form\Hidden('edit_func', $this->obj->getVar('edit_func'))); $this->addElement(new Xoops\Form\Hidden('template', $this->obj->getVar('template'))); $this->addElement(new Xoops\Form\Hidden('dirname', $this->obj->getVar('dirname'))); $this->addElement(new Xoops\Form\Hidden('name', $this->obj->getVar('name'))); $this->addElement(new Xoops\Form\Hidden('bid', $this->obj->getVar('bid'))); $this->addElement(new Xoops\Form\Hidden('op', $op)); $this->addElement(new Xoops\Form\Hidden('fct', 'blocksadmin')); $button_tray = new Xoops\Form\ElementTray('', ' '); if ($this->obj->isNew() || $this->obj->isCustom()) { $preview = new Xoops\Form\Button('', 'previewblock', XoopsLocale::A_PREVIEW, 'preview'); $preview->setExtra("onclick=\"blocks_preview();\""); $button_tray->addElement($preview); } $button_tray->addElement(new Xoops\Form\Button('', 'submitblock', XoopsLocale::A_SUBMIT, 'submit')); $this->addElement($button_tray); }
/** * __construct * * @param XoopsUser|XoopsObject &$obj user object */ public function __construct(XoopsUser $obj) { $xoops = Xoops::getInstance(); if ($obj->isNew()) { //Add user $uid_value = ""; $uname_value = ""; $name_value = ""; $email_value = ""; $email_cbox_value = 0; $url_value = ""; $timezone_value = $xoops->getConfig('default_TZ'); $icq_value = ""; $aim_value = ""; $yim_value = ""; $msnm_value = ""; $location_value = ""; $occ_value = ""; $interest_value = ""; $sig_value = ""; $sig_cbox_value = 0; $bio_value = ""; $rank_value = 0; $mailok_value = 0; $form_title = SystemLocale::ADD_USER; $form_isedit = false; $groups = array(FixedGroups::USERS); } else { //Edit user $uid_value = $obj->getVar("uid", "E"); $uname_value = $obj->getVar("uname", "E"); $name_value = $obj->getVar("name", "E"); $email_value = $obj->getVar("email", "E"); $email_cbox_value = $obj->getVar("user_viewemail") ? 1 : 0; $url_value = $obj->getVar("url", "E"); $timezone_value = $obj->getVar("timezone_offset"); $icq_value = $obj->getVar("user_icq", "E"); $aim_value = $obj->getVar("user_aim", "E"); $yim_value = $obj->getVar("user_yim", "E"); $msnm_value = $obj->getVar("user_msnm", "E"); $location_value = $obj->getVar("user_from", "E"); $occ_value = $obj->getVar("user_occ", "E"); $interest_value = $obj->getVar("user_intrest", "E"); $sig_value = $obj->getVar("user_sig", "E"); $sig_cbox_value = $obj->getVar("attachsig") == 1 ? 1 : 0; $bio_value = $obj->getVar("bio", "E"); $rank_value = $obj->getVar('rank'); $mailok_value = $obj->getVar('user_mailok', 'E'); $form_title = sprintf(SystemLocale::F_UPDATE_USER, $obj->getVar("uname")); $form_isedit = true; $groups = array_values($obj->getGroups()); } //Affichage du formulaire parent::__construct($form_title, "form_user", "admin.php", "post", true); $this->addElement(new Xoops\Form\Text(XoopsLocale::USER_NAME, "username", 4, 25, $uname_value), true); $this->addElement(new Xoops\Form\Text(XoopsLocale::NAME, "name", 5, 60, $name_value)); $email_tray = new Xoops\Form\ElementTray(XoopsLocale::EMAIL, "<br />"); $email_text = new Xoops\Form\Text("", "email", 5, 60, $email_value); $email_tray->addElement($email_text, true); $email_cbox = new Xoops\Form\Checkbox("", "user_viewemail", $email_cbox_value); $email_cbox->addOption(1, XoopsLocale::ALLOW_OTHER_USERS_TO_VIEW_EMAIL); $email_tray->addElement($email_cbox); $this->addElement($email_tray, true); $this->addElement(new Xoops\Form\Text(XoopsLocale::WEB_URL, "url", 5, 100, $url_value)); $this->addElement(new Xoops\Form\SelectTimeZone(XoopsLocale::TIME_ZONE, "timezone_offset", $timezone_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::ICQ, "user_icq", 3, 15, $icq_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::AIM, "user_aim", 3, 18, $aim_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::YIM, "user_yim", 3, 25, $yim_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::MSNM, "user_msnm", 3, 100, $msnm_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::LOCATION, "user_from", 5, 100, $location_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::OCCUPATION, "user_occ", 5, 100, $occ_value)); $this->addElement(new Xoops\Form\Text(XoopsLocale::INTEREST, "user_intrest", 5, 150, $interest_value)); $sig_tray = new Xoops\Form\ElementTray(XoopsLocale::SIGNATURE, "<br />"); $sig_tarea = new Xoops\Form\TextArea("", "user_sig", $sig_value, 5, 5); $sig_tray->addElement($sig_tarea); $sig_cbox = new Xoops\Form\Checkbox("", "attachsig", $sig_cbox_value); $sig_cbox->addOption(1, XoopsLocale::ALWAYS_ATTACH_MY_SIGNATURE); $sig_tray->addElement($sig_cbox); $this->addElement($sig_tray); $this->addElement(new Xoops\Form\TextArea(XoopsLocale::EXTRA_INFO, "bio", $bio_value, 5, 5)); $ranklist = $xoops->service('userrank')->getAssignableUserRankList()->getValue(); if ($ranklist !== null) { $rank_select = new Xoops\Form\Select(XoopsLocale::RANK, "rank", $rank_value); $rank_select->addOption(0, "--------------"); if (count($ranklist) > 0) { $rank_select->addOptionArray($ranklist); } $this->addElement($rank_select); } else { $this->addElement(new Xoops\Form\Hidden("rank", $rank_value)); } // adding a new user requires password fields if (!$form_isedit) { $this->addElement(new Xoops\Form\Password(XoopsLocale::PASSWORD, "password", 3, 32), true); $this->addElement(new Xoops\Form\Password(XoopsLocale::RETYPE_PASSWORD, "pass2", 3, 32), true); } else { $this->addElement(new Xoops\Form\Password(XoopsLocale::PASSWORD, "password", 3, 32)); $this->addElement(new Xoops\Form\Password(XoopsLocale::RETYPE_PASSWORD, "pass2", 3, 32)); } $this->addElement(new Xoops\Form\RadioYesNo(XoopsLocale::ONLY_USERS_THAT_ACCEPT_EMAIL, 'user_mailok', $mailok_value)); //Groups administration addition XOOPS 2.0.9: Mith $gperm_handler = $xoops->getHandlerGroupPermission(); $group_select = array(); //If user has admin rights on groups if ($gperm_handler->checkRight("system_admin", XOOPS_SYSTEM_GROUP, $xoops->user->getGroups(), 1)) { //add group selection $group_select[] = new Xoops\Form\SelectGroup(XoopsLocale::GROUPS, 'groups', false, $groups, 5, true); } else { //add each user groups foreach ($groups as $key => $group) { $group_select[] = new Xoops\Form\Hidden('groups[' . $key . ']', $group); } } foreach ($group_select as $group) { $this->addElement($group); unset($group); } $this->addElement(new Xoops\Form\Hidden("fct", "users")); $this->addElement(new Xoops\Form\Hidden("op", "users_save")); $this->addElement(new Xoops\Form\Button("", "submit", XoopsLocale::A_SUBMIT, "submit")); if (!empty($uid_value)) { $this->addElement(new Xoops\Form\Hidden("uid", $uid_value)); } }
/** * @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); } }
/** * @param array $obj * @param XoopsModule $mod */ public function getForm(&$obj, XoopsModule $mod) { $xoops = Xoops::getInstance(); $helper = Userconfigs::getInstance(); $config_handler = $helper->getHandlerConfig(); /* @var $plugin UserconfigsPluginInterface */ if ($plugin = \Xoops\Module\Plugin::getPlugin($mod->getVar('dirname'), 'userconfigs')) { parent::__construct('', 'pref_form', 'index.php', 'post', true); if ($mod->getVar('dirname') != 'system') { $xoops->loadLanguage('modinfo', $mod->getVar('dirname')); $xoops->loadLocale($mod->getVar('dirname')); } $configs = $plugin->configs(); $configNames = array(); foreach (array_keys($configs) as $i) { $configNames[$configs[$i]['name']] =& $configs[$i]; } $configCats = $plugin->categories(); if (!$configCats) { $configCats = array('default' => array('name' => _MD_USERCONFIGS_CONFIGS, 'description' => '')); } if (!in_array('default', array_keys($configCats))) { $configCats['default'] = array('name' => _MD_USERCONFIGS_CONFIGS, 'description' => ''); } foreach (array_keys($configNames) as $name) { if (!isset($configNames[$name]['category'])) { $configNames[$name]['category'] = 'default'; } } $tabtray = new Xoops\Form\TabTray('', 'pref_tabtay', $xoops->getModuleConfig('jquery_theme', 'system')); $tabs = array(); foreach ($configCats as $name => $info) { $tabs[$name] = new Xoops\Form\Tab($info['name'], 'pref_tab_' . $name); if (isset($info['description']) && $info['description'] != '') { $tabs[$name]->addElement(new Xoops\Form\Label('', $info['description'])); } } $count = count($obj); for ($i = 0; $i < $count; ++$i) { $title = Xoops_Locale::translate($obj[$i]->getVar('conf_title'), $mod->getVar('dirname')); $desc = $obj[$i]->getVar('conf_desc') != '' ? Xoops_Locale::translate($obj[$i]->getVar('conf_desc'), $mod->getVar('dirname')) : ''; switch ($obj[$i]->getVar('conf_formtype')) { case 'textarea': $myts = MyTextSanitizer::getInstance(); if ($obj[$i]->getVar('conf_valuetype') == 'array') { // this is exceptional.. only when value type is arrayneed a smarter way for this $ele = $obj[$i]->getVar('conf_value') != '' ? new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars(implode('|', $obj[$i]->getConfValueForOutput())), 5, 5) : new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), '', 5, 5); } else { $ele = new Xoops\Form\TextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput()), 5, 5); } break; case 'select': $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id'))); $opcount = count($options); for ($j = 0; $j < $opcount; ++$j) { $optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), $mod->getVar('dirname')); $optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), $mod->getVar('dirname')); $ele->addOption($optval, $optkey); } break; case 'select_multi': $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true); $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id'))); $opcount = count($options); for ($j = 0; $j < $opcount; ++$j) { $optval = Xoops_Locale::translate($options[$j]->getVar('confop_value'), $mod->getVar('dirname')); $optkey = Xoops_Locale::translate($options[$j]->getVar('confop_name'), $mod->getVar('dirname')); $ele->addOption($optval, $optkey); } break; case 'yesno': $ele = new Xoops\Form\RadioYesNo($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); break; case 'theme': case 'theme_multi': $ele = $obj[$i]->getVar('conf_formtype') != 'theme_multi' ? new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()) : new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true); $dirlist = XoopsLists::getThemesList(); if (!empty($dirlist)) { asort($dirlist); $ele->addOptionArray($dirlist); } break; case 'tplset': $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); $tplset_handler = $xoops->getHandlerTplSet(); $tplsetlist = $tplset_handler->getNameList(); asort($tplsetlist); foreach ($tplsetlist as $key => $name) { $ele->addOption($key, $name); } break; case 'cpanel': $ele = new Xoops\Form\Hidden($obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); /* $ele = new Xoops\Form\Select($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); XoopsLoad::load("cpanel", "system"); $list = XoopsSystemCpanel::getGuis(); $ele->addOptionArray($list); */ break; case 'timezone': $ele = new Xoops\Form\SelectTimeZone($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); break; case 'language': $ele = new Xoops\Form\SelectLanguage($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); break; case 'locale': $ele = new Xoops\Form\SelectLocale($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); break; case 'startpage': $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); $module_handler = $xoops->getHandlerModule(); $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); $criteria->add(new Criteria('isactive', 1)); $moduleslist = $module_handler->getNameList($criteria, true); $moduleslist['--'] = XoopsLocale::NONE; $ele->addOptionArray($moduleslist); break; case 'group': $ele = new Xoops\Form\SelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false); break; case 'group_multi': $ele = new Xoops\Form\SelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true); break; // RMV-NOTIFY: added 'user' and 'user_multi' // RMV-NOTIFY: added 'user' and 'user_multi' case 'user': $ele = new Xoops\Form\SelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false); break; case 'user_multi': $ele = new Xoops\Form\SelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true); break; case 'module_cache': $module_handler = $xoops->getHandlerModule(); $modules = $module_handler->getObjectsArray(new Criteria('hasmain', 1), true); $currrent_val = $obj[$i]->getConfValueForOutput(); $cache_options = array('0' => XoopsLocale::NO_CACHE, '30' => sprintf(XoopsLocale::F_SECONDS, 30), '60' => XoopsLocale::ONE_MINUTE, '300' => sprintf(XoopsLocale::F_MINUTES, 5), '1800' => sprintf(XoopsLocale::F_MINUTES, 30), '3600' => XoopsLocale::ONE_HOUR, '18000' => sprintf(XoopsLocale::F_HOURS, 5), '86400' => XoopsLocale::ONE_DAY, '259200' => sprintf(XoopsLocale::F_DAYS, 3), '604800' => XoopsLocale::ONE_WEEK, '2592000' => XoopsLocale::ONE_MONTH); if (count($modules) > 0) { $ele = new Xoops\Form\ElementTray($title, '<br />'); foreach (array_keys($modules) as $mid) { $c_val = isset($currrent_val[$mid]) ? (int) $currrent_val[$mid] : null; $selform = new Xoops\Form\Select($modules[$mid]->getVar('name'), $obj[$i]->getVar('conf_name') . "[{$mid}]", $c_val); $selform->addOptionArray($cache_options); $ele->addElement($selform); unset($selform); } } else { $ele = new Xoops\Form\Label($title, SystemLocale::NO_MODULE_TO_CACHE); } break; case 'site_cache': $ele = new Xoops\Form\Select($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); $ele->addOptionArray(array('0' => XoopsLocale::NO_CACHE, '30' => sprintf(XoopsLocale::F_SECONDS, 30), '60' => XoopsLocale::ONE_MINUTE, '300' => sprintf(XoopsLocale::F_MINUTES, 5), '1800' => sprintf(XoopsLocale::F_MINUTES, 30), '3600' => XoopsLocale::ONE_HOUR, '18000' => sprintf(XoopsLocale::F_HOURS, 5), '86400' => XoopsLocale::ONE_DAY, '259200' => sprintf(XoopsLocale::F_DAYS, 3), '604800' => XoopsLocale::ONE_WEEK, '2592000' => XoopsLocale::ONE_MONTH)); break; case 'password': $myts = MyTextSanitizer::getInstance(); $ele = new Xoops\Form\Password($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput())); break; case 'color': $myts = MyTextSanitizer::getInstance(); $ele = new Xoops\Form\ColorPicker($title, $obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput())); break; case 'hidden': $myts = MyTextSanitizer::getInstance(); $ele = new Xoops\Form\Hidden($obj[$i]->getVar('conf_name'), $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput())); break; case 'textbox': default: $myts = MyTextSanitizer::getInstance(); $ele = new Xoops\Form\Text($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlSpecialChars($obj[$i]->getConfValueForOutput())); break; } $hidden = new Xoops\Form\Hidden('conf_ids[]', $obj[$i]->getVar('conf_id')); if (isset($ele)) { $ele->setDescription($desc); if ($obj[$i]->getVar('conf_formtype') != 'hidden') { $name = 'default'; if (isset($configNames[$obj[$i]->getVar('conf_name')]['category'])) { $name = $configNames[$obj[$i]->getVar('conf_name')]['category']; } $tabs[$name]->addElement($ele); } else { $this->addElement($ele); } $this->addElement($hidden); unset($ele); unset($hidden); } } foreach (array_keys($tabs) as $name) { if ($tabs[$name]->getElements()) { $tabtray->addElement($tabs[$name]); } } $this->addElement($tabtray); $this->addElement(new Xoops\Form\Hidden('op', 'save')); $this->addElement(new Xoops\Form\Hidden('mid', $mod->getVar('mid'))); $this->addElement(new Xoops\Form\Button('', 'button', XoopsLocale::A_SUBMIT, 'submit')); } }
/** * @param XoopsConfigItem $config * * @return Xoops\Form\ThemeForm[] */ function createThemeform(XoopsConfigItem $config) { $title = $config->getVar('conf_desc') == '' ? Xoops_Locale::translate($config->getVar('conf_title'), 'system') : Xoops_Locale::translate($config->getVar('conf_title'), 'system') . '<br /><br /><span>' . Xoops_Locale::translate($config->getVar('conf_desc'), 'system') . '</span>'; $form_theme_set = new Xoops\Form\Select('', $config->getVar('conf_name'), $config->getConfValueForOutput(), 1, false); $dirlist = XoopsLists::getThemesList(); if (!empty($dirlist)) { asort($dirlist); $form_theme_set->addOptionArray($dirlist); } $label_content = ""; // read ini file for each theme foreach ($dirlist as $theme) { // set default value $theme_ini = array('Name' => $theme, 'Description' => '', 'Version' => '', 'Format' => '', 'Author' => '', 'Demo' => '', 'Url' => '', 'Download' => '', 'W3C' => '', 'Licence' => '', 'thumbnail' => 'screenshot.gif', 'screenshot' => 'screenshot.png'); if ($theme == $config->getConfValueForOutput()) { $label_content .= "<div id='{$theme}' rel='theme' style='display:block;'>"; } else { $label_content .= "<div id='{$theme}' rel='theme' style='display:none;'>"; } if (file_exists(XOOPS_ROOT_PATH . "/themes/{$theme}/theme.ini")) { $theme_ini = parse_ini_file(XOOPS_ROOT_PATH . "/themes/{$theme}/theme.ini"); if ($theme_ini['screenshot'] == '') { $theme_ini['screenshot'] = 'screenshot.png'; $theme_ini['thumbnail'] = 'thumbnail.png'; } } if ($theme_ini['screenshot'] != '' && file_exists(XOOPS_ROOT_PATH . "/themes/{$theme}/" . $theme_ini['screenshot'])) { $label_content .= "<img src='" . XOOPS_URL . "/themes/" . $theme . "/" . $theme_ini['screenshot'] . "' alt='Screenshot' />"; } elseif ($theme_ini['thumbnail'] != '' && file_exists(XOOPS_ROOT_PATH . "/themes/{$theme}/" . $theme_ini['thumbnail'])) { $label_content .= "<img src='" . XOOPS_URL . "/themes/" . $theme . "/" . $theme_ini['thumbnail'] . "' alt='{$theme}' />"; } else { $label_content .= THEME_NO_SCREENSHOT; } $label_content .= "</div>"; } // read ini file for each theme $form_theme_set->setExtra("onchange='showThemeSelected(this)'"); $form = new Xoops\Form\ThemeForm($title, 'themes', 'index.php', 'post'); $form->addElement($form_theme_set); $form->addElement(new Xoops\Form\Label('', "<div id='screenshot'>" . $label_content . "</div>")); $form->addElement(new Xoops\Form\Hidden('conf_ids[]', $config->getVar('conf_id'))); return array($form); }
/** * @param PublisherItem $obj */ public function __construct(PublisherItem $obj) { $xoops = Xoops::getInstance(); $publisher = Publisher::getInstance(); $allowed_editors = PublisherUtils::getEditors($publisher->getPermissionHandler()->getGrantedItems('editors')); $group = $xoops->getUserGroups(); parent::__construct('title', 'form', $xoops->getEnv('PHP_SELF')); $this->setExtra('enctype="multipart/form-data"'); $tabtray = new Xoops\Form\TabTray('', 'uniqueid', $xoops->getModuleConfig('jquery_theme', 'system')); $mainTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_MAIN, 'maintab'); // Category $category_select = new Xoops\Form\Select(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e')); $category_select->setDescription(_CO_PUBLISHER_CATEGORY_DSC); $category_select->addOptionArray($publisher->getCategoryHandler()->getCategoriesForSubmit()); $mainTab->addElement($category_select); // ITEM TITLE $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true); // SUBTITLE if ($this->_isGranted(_PUBLISHER_SUBTITLE)) { $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e'))); } // SHORT URL if ($this->_isGranted(_PUBLISHER_ITEM_SHORT_URL)) { $text_short_url = new Xoops\Form\Text(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->getVar('short_url', 'e')); $text_short_url->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC); $mainTab->addElement($text_short_url); } // TAGS if ($xoops->isActiveModule('tag') && $this->_isGranted(_PUBLISHER_ITEM_TAG)) { include_once \XoopsBaseConfig::get('root-path') . '/modules/tag/include/formtag.php'; $text_tags = new Xoops\Form\Tag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0); $mainTab->addElement($text_tags); } // SELECT EDITOR $nohtml = false; if (count($allowed_editors) == 1) { $editor = $allowed_editors[0]; } else { 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); $mainTab->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'); // SUMMARY if ($this->_isGranted(_PUBLISHER_SUMMARY)) { // Description //$summary_text = new Xoops\Form\TextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60); $editor_configs["name"] = "summary"; $editor_configs["value"] = $obj->getVar('summary', 'e'); $summary_text = new Xoops\Form\Editor(_CO_PUBLISHER_SUMMARY, $editor, $editor_configs, $nohtml, $onfailure = null); $summary_text->setDescription(_CO_PUBLISHER_SUMMARY_DSC); $mainTab->addElement($summary_text); } // BODY $editor_configs["name"] = "body"; $editor_configs["value"] = $obj->getVar('body', 'e'); $body_text = new Xoops\Form\Editor(_CO_PUBLISHER_BODY, $editor, $editor_configs, $nohtml, $onfailure = null); $body_text->setDescription(_CO_PUBLISHER_BODY_DSC); $mainTab->addElement($body_text); // VARIOUS OPTIONS if ($this->_isGranted(_PUBLISHER_DOHTML) || $this->_isGranted(_PUBLISHER_DOSMILEY) || $this->_isGranted(_PUBLISHER_DOXCODE) || $this->_isGranted(_PUBLISHER_DOIMAGE) || $this->_isGranted(_PUBLISHER_DOLINEBREAK)) { if ($this->_isGranted(_PUBLISHER_DOHTML)) { $html_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->getVar('dohtml')); $mainTab->addElement($html_radio); } if ($this->_isGranted(_PUBLISHER_DOSMILEY)) { $smiley_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->getVar('dosmiley')); $mainTab->addElement($smiley_radio); } if ($this->_isGranted(_PUBLISHER_DOXCODE)) { $xcode_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->getVar('doxcode')); $mainTab->addElement($xcode_radio); } if ($this->_isGranted(_PUBLISHER_DOIMAGE)) { $image_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->getVar('doimage')); $mainTab->addElement($image_radio); } if ($this->_isGranted(_PUBLISHER_DOLINEBREAK)) { $linebreak_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->getVar('dobr')); $mainTab->addElement($linebreak_radio); } } // Available pages to wrap if ($this->_isGranted(_PUBLISHER_AVAILABLE_PAGE_WRAP)) { $wrap_pages = XoopsLists::getHtmlListAsArray(PublisherUtils::getUploadDir(true, 'content')); $available_wrap_pages_text = array(); foreach ($wrap_pages as $page) { $available_wrap_pages_text[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>"; } $available_wrap_pages = new Xoops\Form\Label(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text)); $available_wrap_pages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC); $mainTab->addElement($available_wrap_pages); } // Uid /* We need to retrieve the users manually because for some reason, on the frxoops.org server, the method users::getobjects encounters a memory error */ // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL if ($this->_isGranted(_PUBLISHER_UID)) { $uid_select = new Xoops\Form\SelectUser(_CO_PUBLISHER_UID, 'uid', true, array($obj->getVar('uid', 'e')), 1, false); $uid_select->setDescription(_CO_PUBLISHER_UID_DSC); //$sql = "SELECT uid, uname FROM " . $obj->db->prefix('users') . " ORDER BY uname ASC"; //$result = $obj->db->query($sql); //$users_array = array(); //$users_array[0] = $xoops->getConfig('anonymous'); //while ($myrow = $obj->db->fetchArray($result)) { // $users_array[$myrow['uid']] = $myrow['uname']; //} //$uid_select->addOptionArray($users_array); $mainTab->addElement($uid_select); } /* else { $hidden = new Xoops\Form\Hidden('uid', $obj->getVar('uid')); $this->addElement($hidden); unset($hidden); }*/ // Author Alias if ($this->_isGranted(_PUBLISHER_AUTHOR_ALIAS)) { $element = new Xoops\Form\Text(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e')); $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC); $mainTab->addElement($element); unset($element); } // STATUS if ($this->_isGranted(_PUBLISHER_STATUS)) { $options = array(_PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, _PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, _PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, _PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED); $status_select = new Xoops\Form\Select(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status')); $status_select->addOptionArray($options); $status_select->setDescription(_CO_PUBLISHER_STATUS_DSC); $mainTab->addElement($status_select); unset($status_select); } // Datesub if ($this->_isGranted(_PUBLISHER_DATESUB)) { $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub'); $datesub_datetime = new PublisherFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub); $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC); $mainTab->addElement($datesub_datetime); } // NOTIFY ON PUBLISH if ($this->_isGranted(_PUBLISHER_NOTIFY)) { $notify_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_NOTIFY, 'notify', $obj->getVar('notifypub')); $mainTab->addElement($notify_radio); } $tabtray->addElement($mainTab); if ($xoops->isActiveModule('images') && $this->_hasTab(_CO_PUBLISHER_TAB_IMAGES)) { $imagesTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_IMAGES, 'imagestab'); // IMAGE if ($this->_isGranted(_PUBLISHER_IMAGE_ITEM)) { $imgcat_handler = Images::getInstance()->getHandlerCategories(); $image_handler = Images::getInstance()->getHandlerImages(); $objimages = $obj->getImages(); $mainarray = is_object($objimages['main']) ? array($objimages['main']) : array(); $mergedimages = array_merge($mainarray, $objimages['others']); $objimage_array = array(); /* @var $imageObj ImagesImage */ foreach ($mergedimages as $imageObj) { $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); } $catlist = $imgcat_handler->getListByPermission($group, 'imgcat_read', 1); $catids = array_keys($catlist); $imageObjs = array(); if (!empty($catids)) { $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . implode(',', $catids) . ')', 'IN')); $criteria->add(new Criteria('image_display', 1)); $criteria->setSort('image_nicename'); $criteria->setOrder('ASC'); $imageObjs = $image_handler->getObjects($criteria, true); unset($criteria); } $image_array = array(); foreach ($imageObjs as $imageObj) { $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename'); } $image_array = array_diff($image_array, $objimage_array); $image_select = new Xoops\Form\Select('', 'image_notused', '', 5); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'"); //$image_select->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'"); unset($image_array); $image_select2 = new Xoops\Form\Select('', 'image_item', '', 5, true); $image_select2->addOptionArray($objimage_array); $image_select2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'"); $buttonadd = new Xoops\Form\Button('', 'buttonadd', _CO_PUBLISHER_ADD); $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'"); $buttonremove = new Xoops\Form\Button('', 'buttonremove', _CO_PUBLISHER_REMOVE); $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'"); $opentable = new Xoops\Form\Label('', "<table><tr><td>"); $addcol = new Xoops\Form\Label('', "</td><td>"); $addbreak = new Xoops\Form\Label('', "<br />"); $closetable = new Xoops\Form\Label('', "</td></tr></table>"); $xoops->theme()->addScript(PUBLISHER_URL . '/js/ajaxupload.3.9.js'); //todo, find replacement for error class $js_data = new Xoops\Form\Label('', ' <script type= "text/javascript">/*<![CDATA[*/ $(document).ready(function(){ var button = $("#publisher_upload_button"), interval; new AjaxUpload(button,{ action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons responseType: "text/html", name: "publisher_upload_file", onSubmit : function(file, ext){ // change button text, when user selects file $("#publisher_upload_message").html(" "); button.html("<img src=\'' . PUBLISHER_URL . '/images/loadingbar.gif\'/>"); this.setData({ "image_nicename": $("#image_nicename").val(), "imgcat_id" : $("#imgcat_id").val() }); // If you want to allow uploading only 1 file at time, // you can disable upload button this.disable(); interval = window.setInterval(function(){ }, 200); }, onComplete: function(file, response){ button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '"); window.clearInterval(interval); // enable upload button this.enable(); // add file to the list var result = eval(response); if (result[0] == "success") { $("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>"); publisher_updateSelectOption(\'image_item\', \'image_featured\'); showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . \XoopsBaseConfig::get('url') . '\') } else { $("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>"); } } }); }); /*]]>*/</script> '); $messages = new Xoops\Form\Label('', "<div id='publisher_upload_message'></div>"); $button = new Xoops\Form\Label('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . "</div>"); $nicename = new Xoops\Form\Text('', 'image_nicename', 30, 30, _CO_PUBLISHER_IMAGE_NICENAME); $catlist = $imgcat_handler->getListByPermission($group, 'imgcat_read', 1); $imagecat = new Xoops\Form\Select('', 'imgcat_id', '', 1); $imagecat->addOptionArray($catlist); $image_upload_tray = new Xoops\Form\ElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, ''); $image_upload_tray->addElement($js_data); $image_upload_tray->addElement($messages); $image_upload_tray->addElement($opentable); $image_upload_tray->addElement($imagecat); $image_upload_tray->addElement($addbreak); $image_upload_tray->addElement($nicename); $image_upload_tray->addElement($addbreak); $image_upload_tray->addElement($button); $image_upload_tray->addElement($closetable); $imagesTab->addElement($image_upload_tray); $image_tray = new Xoops\Form\ElementTray(_CO_PUBLISHER_IMAGE_ITEMS, ''); $image_tray->addElement($opentable); $image_tray->addElement($image_select); $image_tray->addElement($addbreak); $image_tray->addElement($buttonadd); $image_tray->addElement($addcol); $image_tray->addElement($image_select2); $image_tray->addElement($addbreak); $image_tray->addElement($buttonremove); $image_tray->addElement($closetable); $image_tray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC); $imagesTab->addElement($image_tray); $imagename = is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : ''; $imageforpath = $imagename != '' ? $imagename : 'blank.gif'; $image_select3 = new Xoops\Form\Select(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1); $image_select3->addOptionArray($objimage_array); $image_select3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'"); $image_select3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC); $imagesTab->addElement($image_select3); $image_preview = new Xoops\Form\Label(_CO_PUBLISHER_IMAGE_PREVIEW, "<img width='500' src='" . \XoopsBaseConfig::get('url') . "/uploads/" . $imageforpath . "' name='image_display' id='image_display' alt='' />"); $imagesTab->addElement($image_preview); } $tabtray->addElement($imagesTab); } if ($this->_hasTab(_CO_PUBLISHER_TAB_FILES)) { $filesTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_FILES, 'filestab'); // File upload UPLOAD if ($this->_isGranted(_PUBLISHER_ITEM_UPLOAD_FILE)) { // NAME $name_text = new Xoops\Form\Text(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, ''); $name_text->setDescription(_CO_PUBLISHER_FILE_NAME_DSC); $filesTab->addElement($name_text); unset($name_text); // DESCRIPTION $description_text = new Xoops\Form\TextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', ''); $description_text->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC); $filesTab->addElement($description_text); unset($description_text); $status_select = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1); //1 - active $status_select->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC); $filesTab->addElement($status_select); unset($status_select); $file_box = new Xoops\Form\File(_CO_PUBLISHER_ITEM_UPLOAD_FILE, "item_upload_file"); $file_box->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC); $file_box->setExtra("size ='50'"); $filesTab->addElement($file_box); unset($file_box); if (!$obj->isNew()) { $filesObj = $publisher->getFileHandler()->getAllFiles($obj->getVar('itemid')); if (count($filesObj) > 0) { $table = ''; $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; $table .= "<tr>"; $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>"; $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . "</strong></td>"; $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . "</strong></td>"; $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . "</strong></td>"; $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . "</strong></td>"; $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; $table .= "</tr>"; /* @var $fileObj PublisherFile */ foreach ($filesObj as $fileObj) { $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>"; $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>"; if ($fileObj->getVar('status') == 0) { $not_visible = "<img src='" . PUBLISHER_URL . "/images/no.gif'/>"; } else { $not_visible = ''; } $table .= "<tr>"; $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . "</td>"; $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . "</td>"; $table .= "<td class='even' align='left'>" . $fileObj->getVar('description') . "</td>"; $table .= "<td class='even' align='center'>" . $fileObj->getVar('counter') . ""; $table .= "<td class='even' align='center'>" . $fileObj->datesub() . "</td>"; $table .= "<td class='even' align='center'> {$modify} {$delete} </td>"; $table .= "</tr>"; } $table .= "</table>"; $files_box = new Xoops\Form\Label(_CO_PUBLISHER_FILES_LINKED, $table); $filesTab->addElement($files_box); unset($files_box, $filesObj, $fileObj); } } } $tabtray->addElement($filesTab); } if ($this->_hasTab(_CO_PUBLISHER_TAB_OTHERS)) { $othersTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_OTHERS, 'otherstab'); // Meta Keywords if ($this->_isGranted(_PUBLISHER_ITEM_META_KEYWORDS)) { $text_meta_keywords = new Xoops\Form\TextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->getVar('meta_keywords', 'e'), 7, 60); $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC); $othersTab->addElement($text_meta_keywords); } // Meta Description if ($this->_isGranted(_PUBLISHER_ITEM_META_DESCRIPTION)) { $text_meta_description = new Xoops\Form\TextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->getVar('meta_description', 'e'), 7, 60); $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC); $othersTab->addElement($text_meta_description); } // COMMENTS if ($this->_isGranted(_PUBLISHER_ALLOWCOMMENTS)) { $addcomments_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->getVar('cancomment')); $othersTab->addElement($addcomments_radio); } // WEIGHT if ($this->_isGranted(_PUBLISHER_WEIGHT)) { $othersTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->getVar('weight'))); } $tabtray->addElement($othersTab); } $this->addElement($tabtray); //COMMON TO ALL TABS $button_tray = new Xoops\Form\ElementTray('', ''); if (!$obj->isNew()) { $button_tray->addElement(new Xoops\Form\Button('', 'additem', XoopsLocale::A_SUBMIT, 'submit')); //orclone } else { $button_tray->addElement(new Xoops\Form\Button('', 'additem', _CO_PUBLISHER_CREATE, 'submit')); $button_tray->addElement(new Xoops\Form\Button('', '', _CO_PUBLISHER_CLEAR, 'reset')); } $button_tray->addElement(new Xoops\Form\Button('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit')); $butt_cancel = new Xoops\Form\Button('', '', _CO_PUBLISHER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $this->addElement($button_tray); $hidden = new Xoops\Form\Hidden('itemid', $obj->getVar('itemid')); $this->addElement($hidden); unset($hidden); }
$form_purge->addElement(new Xoops\Form\DateSelect(_AM_COMMENTS_FORM_PURGE_DATE_BEFORE, 'comments_before', '15')); //user $form_purge->addElement(new Xoops\Form\SelectUser(_AM_COMMENTS_FORM_PURGE_USER, "comments_userid", false, @$_REQUEST['comments_userid'], 5, true)); //groups $groupe_select = new Xoops\Form\SelectGroup(_AM_COMMENTS_FORM_PURGE_GROUPS, "comments_groupe", false, '', 5, true); $groupe_select->setExtra("style=\"width:170px;\" "); $form_purge->addElement($groupe_select); //Status $status = new Xoops\Form\Select(_AM_COMMENTS_FORM_PURGE_STATUS, "comments_status", ''); $options = $status_array; $status->addOptionArray($options); $form_purge->addElement($status, true); //Modules $modules = new Xoops\Form\Select(_AM_COMMENTS_FORM_PURGE_MODULES, "comments_modules", ''); $options = $module_array; $modules->addOptionArray($options); $form_purge->addElement($modules, true); $form_purge->addElement(new Xoops\Form\Hidden("op", "comments_purge")); $form_purge->addElement(new Xoops\Form\Button("", "submit", XoopsLocale::A_SUBMIT, "submit")); $xoops->tpl()->assign('form', $form_purge->render()); break; case 'comments_purge': $criteria = new CriteriaCompo(); $verif = false; if (isset($_POST['comments_after']) && isset($_POST['comments_before'])) { if ($_POST['comments_after'] != $_POST['comments_before']) { $after = $system->cleanVars($_POST, 'comments_after', time(), 'date'); $before = $system->cleanVars($_POST, 'comments_before', time(), 'date'); if ($after) { $criteria->add(new Criteria('created', $after, ">")); }
$ele = new Xoops\Form\Select(SystemLocale::CHOOSE_TEMPLATE, 'tplset', $xoops->getConfig('tplset')); $tplset_handler = $xoops->getHandlerTplSet(); $tplsetlist = $tplset_handler->getNameList(); asort($tplsetlist); foreach ($tplsetlist as $key => $name) { $ele->addOption($key, $name); } $form->addElement($ele); $form->addElement(new Xoops\Form\SelectTheme(XoopsLocale::SELECT_THEME, 'select_theme', 1, 5), true); $form->addElement(new Xoops\Form\RadioYesNo(SystemLocale::FORCED_FILE_GENERATION, 'force_generated', 0), true); $modules = new Xoops\Form\Select(XoopsLocale::SELECT_MODULE, 'select_modules'); $module_handler = $xoops->getHandlerModule(); $criteria = new CriteriaCompo(new Criteria('isactive', 1)); $moduleslist = $module_handler->getNameList($criteria, true); $modules->addOption(0, XoopsLocale::ALL_MODULES); $modules->addOptionArray($moduleslist); $form->addElement($modules, true); $form->addElement(new Xoops\Form\Hidden("active_templates", "0")); $form->addElement(new Xoops\Form\Hidden("active_modules", "0")); $form->addElement(new Xoops\Form\Hidden("op", "tpls_overload")); $form->addElement(new Xoops\Form\Button("", "submit", XoopsLocale::A_SUBMIT, "submit")); $form->display(); break; //overload template //overload template case 'tpls_overload': if (!$xoops->security()->check()) { $xoops->redirect('admin.php?fct=tplsets', 3, implode('<br />', $xoops->security()->getErrors())); } // Assign Breadcrumb menu $system_breadcrumb->addHelp(system_adminVersion('tplsets', 'help') . '#override');
// XF-Section /*$xfs_version = 0; $moduleObj = $module_handler->getByDirname('xfsection'); If ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if ($from_module_version > 1.00) { $importfile_select_array["xfsection"] = "XF-Section " . $from_module_version; $xfs_version = $from_module_version; } } */ if (isset($importfile_select_array) && count($importfile_select_array) > 0) { $sform = new Xoops\Form\ThemeForm(_AM_PUBLISHER_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // Partners to import $importfile_select = new Xoops\Form\Select('', 'importfile', $importfile); $importfile_select->addOptionArray($importfile_select_array); $importfile_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_IMPORT_SELECT_FILE, ' '); $importfile_tray->addElement($importfile_select); $importfile_tray->setDescription(_AM_PUBLISHER_IMPORT_SELECT_FILE_DSC); $sform->addElement($importfile_tray); // Buttons $button_tray = new Xoops\Form\ElementTray('', ''); $hidden = new Xoops\Form\Hidden('op', 'importExecute'); $button_tray->addElement($hidden); $butt_import = new Xoops\Form\Button('', '', _AM_PUBLISHER_IMPORT, 'submit'); $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"'); $button_tray->addElement($butt_import); $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray);
/** * @param ProfileField|XoopsObject $obj */ public function __construct(ProfileField $obj) { $xoops = Xoops::getInstance(); $title = $obj->isNew() ? sprintf(_PROFILE_AM_ADD, _PROFILE_AM_FIELD) : sprintf(_PROFILE_AM_EDIT, _PROFILE_AM_FIELD); parent::__construct($title, 'form', '', 'post', true); $this->addElement(new Xoops\Form\Text(_PROFILE_AM_TITLE, 'field_title', 5, 255, $obj->getVar('field_title', 'e')), true); $this->addElement(new Xoops\Form\TextArea(_PROFILE_AM_DESCRIPTION, 'field_description', $obj->getVar('field_description', 'e'), 5, 5)); if (!$obj->isNew()) { $fieldcat_id = $obj->getVar('cat_id'); } else { $fieldcat_id = 0; } $category_handler = $xoops->getModuleHandler('category'); $cat_select = new Xoops\Form\Select(_PROFILE_AM_CATEGORY, 'field_category', $fieldcat_id); $cat_select->addOption(0, _PROFILE_AM_DEFAULT); $cat_select->addOptionArray($category_handler->getList()); $this->addElement($cat_select); $weight = new Xoops\Form\Text(_PROFILE_AM_WEIGHT, 'field_weight', 1, 10, $obj->getVar('field_weight', 'e'), ''); $weight->setPattern('^\\d+$', _PROFILE_AM_ERROR_WEIGHT); $this->addElement($weight, true); if ($obj->getVar('field_config') || $obj->isNew()) { if (!$obj->isNew()) { $this->addElement(new Xoops\Form\Label(_PROFILE_AM_NAME, $obj->getVar('field_name'))); $this->addElement(new Xoops\Form\Hidden('id', $obj->getVar('field_id'))); } else { $this->addElement(new Xoops\Form\Text(_PROFILE_AM_NAME, 'field_name', 5, 255, $obj->getVar('field_name', 'e')), true); } //autotext and theme left out of this one as fields of that type should never be changed (valid assumption, I think) $fieldtypes = array('checkbox' => _PROFILE_AM_CHECKBOX, 'date' => _PROFILE_AM_DATE, 'datetime' => _PROFILE_AM_DATETIME, 'longdate' => _PROFILE_AM_LONGDATE, 'group' => _PROFILE_AM_GROUP, 'group_multi' => _PROFILE_AM_GROUPMULTI, 'language' => _PROFILE_AM_LANGUAGE, 'radio' => _PROFILE_AM_RADIO, 'select' => _PROFILE_AM_SELECT, 'select_multi' => _PROFILE_AM_SELECTMULTI, 'textarea' => _PROFILE_AM_TEXTAREA, 'dhtml' => _PROFILE_AM_DHTMLTEXTAREA, 'textbox' => _PROFILE_AM_TEXTBOX, 'timezone' => _PROFILE_AM_TIMEZONE, 'yesno' => _PROFILE_AM_YESNO); $element_select = new Xoops\Form\Select(_PROFILE_AM_TYPE, 'field_type', $obj->getVar('field_type', 'e')); $element_select->addOptionArray($fieldtypes); $this->addElement($element_select); switch ($obj->getVar('field_type')) { case "textbox": $valuetypes = array(XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY, XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL, XOBJ_DTYPE_INT => _PROFILE_AM_INT, XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT, XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL, XOBJ_DTYPE_TXTAREA => _PROFILE_AM_TXTAREA, XOBJ_DTYPE_TXTBOX => _PROFILE_AM_TXTBOX, XOBJ_DTYPE_URL => _PROFILE_AM_URL, XOBJ_DTYPE_OTHER => _PROFILE_AM_OTHER); $type_select = new Xoops\Form\Select(_PROFILE_AM_VALUETYPE, 'field_valuetype', $obj->getVar('field_valuetype', 'e'), 5, 5); $type_select->addOptionArray($valuetypes); $this->addElement($type_select); break; case "select": case "radio": $valuetypes = array(XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY, XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL, XOBJ_DTYPE_INT => _PROFILE_AM_INT, XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT, XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL, XOBJ_DTYPE_TXTAREA => _PROFILE_AM_TXTAREA, XOBJ_DTYPE_TXTBOX => _PROFILE_AM_TXTBOX, XOBJ_DTYPE_URL => _PROFILE_AM_URL, XOBJ_DTYPE_OTHER => _PROFILE_AM_OTHER); $type_select = new Xoops\Form\Select(_PROFILE_AM_VALUETYPE, 'field_valuetype', $obj->getVar('field_valuetype', 'e')); $type_select->addOptionArray($valuetypes); $this->addElement($type_select); break; } //$this->addElement(new Xoops\Form\RadioYesNo(_PROFILE_AM_NOTNULL, 'field_notnull', $obj->getVar('field_notnull', 'e') )); if ($obj->getVar('field_type') == "select" || $obj->getVar('field_type') == "select_multi" || $obj->getVar('field_type') == "radio" || $obj->getVar('field_type') == "checkbox") { $options = $obj->getVar('field_options'); if (count($options) > 0) { $remove_options = new Xoops\Form\Checkbox(_PROFILE_AM_REMOVEOPTIONS, 'removeOptions'); //$remove_options->columns = 3; asort($options); foreach (array_keys($options) as $key) { $options[$key] .= "[{$key}]"; } $remove_options->addOptionArray($options); $this->addElement($remove_options); } $option_text = "<table cellspacing='1'><tr><td class='width20'>" . _PROFILE_AM_KEY . "</td><td>" . _PROFILE_AM_VALUE . "</td></tr>"; for ($i = 0; $i < 3; ++$i) { $option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15' /></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35' /></td></tr>"; $option_text .= "<tr height='3px'><td colspan='2'> </td></tr>"; } $option_text .= "</table>"; $this->addElement(new Xoops\Form\Label(_PROFILE_AM_ADDOPTION, $option_text)); } } if ($obj->getVar('field_edit')) { switch ($obj->getVar('field_type')) { case "textbox": case "textarea": case "dhtml": $this->addElement(new Xoops\Form\Text(_PROFILE_AM_MAXLENGTH, 'field_maxlength', 5, 5, $obj->getVar('field_maxlength', 'e'))); $this->addElement(new Xoops\Form\TextArea(_PROFILE_AM_DEFAULT, 'field_default', $obj->getVar('field_default', 'e'))); break; case "checkbox": case "select_multi": $def_value = $obj->getVar('field_default', 'e') != null ? unserialize($obj->getVar('field_default', 'n')) : null; $element = new Xoops\Form\Select(_PROFILE_AM_DEFAULT, 'field_default', $def_value, 8, true); $options = $obj->getVar('field_options'); asort($options); // If options do not include an empty element, then add a blank option to prevent any default selection if (!in_array('', array_keys($options))) { $element->addOption('', XoopsLocale::NONE); } $element->addOptionArray($options); $this->addElement($element); break; case "select": case "radio": $def_value = $obj->getVar('field_default', 'e') != null ? $obj->getVar('field_default') : null; $element = new Xoops\Form\Select(_PROFILE_AM_DEFAULT, 'field_default', $def_value); $options = $obj->getVar('field_options'); asort($options); // If options do not include an empty element, then add a blank option to prevent any default selection if (!in_array('', array_keys($options))) { $element->addOption('', XoopsLocale::NONE); } $element->addOptionArray($options); $this->addElement($element); break; case "date": $this->addElement(new Xoops\Form\DateSelect(_PROFILE_AM_DEFAULT, 'field_default', 2, $obj->getVar('field_default', 'e'))); break; case "longdate": $this->addElement(new Xoops\Form\DateSelect(_PROFILE_AM_DEFAULT, 'field_default', 2, strtotime($obj->getVar('field_default', 'e')))); break; case "datetime": $this->addElement(new Xoops\Form\DateTime(_PROFILE_AM_DEFAULT, 'field_default', 2, $obj->getVar('field_default', 'e'))); break; case "yesno": $this->addElement(new Xoops\Form\RadioYesNo(_PROFILE_AM_DEFAULT, 'field_default', $obj->getVar('field_default', 'e'))); break; case "timezone": $this->addElement(new Xoops\Form\SelectTimeZone(_PROFILE_AM_DEFAULT, 'field_default', $obj->getVar('field_default', 'e'))); break; case "language": $this->addElement(new Xoops\Form\SelectLanguage(_PROFILE_AM_DEFAULT, 'field_default', $obj->getVar('field_default', 'e'))); break; case "group": $this->addElement(new Xoops\Form\SelectGroup(_PROFILE_AM_DEFAULT, 'field_default', true, $obj->getVar('field_default', 'e'))); break; case "group_multi": $this->addElement(new Xoops\Form\SelectGroup(_PROFILE_AM_DEFAULT, 'field_default', true, unserialize($obj->getVar('field_default', 'n')), 5, true)); break; case "theme": $this->addElement(new Xoops\Form\SelectTheme(_PROFILE_AM_DEFAULT, 'field_default', $obj->getVar('field_default', 'e'))); break; case "autotext": $this->addElement(new Xoops\Form\TextArea(_PROFILE_AM_DEFAULT, 'field_default', $obj->getVar('field_default', 'e'))); break; } } $groupperm_handler = $xoops->getHandlerGroupperm(); $searchable_types = array('textbox', 'select', 'radio', 'yesno', 'date', 'datetime', 'timezone', 'language'); if (in_array($obj->getVar('field_type'), $searchable_types)) { $search_groups = $groupperm_handler->getGroupIds('profile_search', $obj->getVar('field_id'), $xoops->module->getVar('mid')); $this->addElement(new Xoops\Form\SelectGroup(_PROFILE_AM_PROF_SEARCH, 'profile_search', true, $search_groups, 5, true)); } if ($obj->getVar('field_edit') || $obj->isNew()) { if (!$obj->isNew()) { //Load groups $editable_groups = $groupperm_handler->getGroupIds('profile_edit', $obj->getVar('field_id'), $xoops->module->getVar('mid')); } else { $editable_groups = array(); } $this->addElement(new Xoops\Form\SelectGroup(_PROFILE_AM_PROF_EDITABLE, 'profile_edit', false, $editable_groups, 5, true)); $this->addElement(new Xoops\Form\RadioYesNo(_PROFILE_AM_REQUIRED, 'field_required', $obj->getVar('field_required', 'e'))); $regstep_select = new Xoops\Form\Select(_PROFILE_AM_PROF_REGISTER, 'step_id', $obj->getVar('step_id', 'e')); $regstep_select->addOption(0, XoopsLocale::NO); $regstep_handler = $xoops->getModuleHandler('regstep'); $regstep_select->addOptionArray($regstep_handler->getList()); $this->addElement($regstep_select); } $this->addElement(new Xoops\Form\Hidden('op', 'save')); $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); }
function menus_block_edit($options) { //Unique ID if (!$options[4] || isset($_GET['op']) && $_GET['op'] == 'clone') { $options[4] = uniqid(); } $helper = Xoops::getModuleHelper('menus'); $helper->loadLanguage('admin'); $criteria = new CriteriaCompo(); $criteria->setSort('title'); $criteria->setOrder('ASC'); $menus = $helper->getHandlerMenus()->getList($criteria); unset($criteria); if (count($menus) == 0) { $form = "<a href='" . $helper->url('admin/admin_menus.php') . "'>" . _AM_MENUS_MSG_NOMENUS . "</a>"; return $form; } //Menu $form = new Xoops\Form\BlockForm(); $element = new Xoops\Form\Select(_MB_MENUS_SELECT_MENU, 'options[0]', $options[0], 1); $element->addOptionArray($menus); $element->setDescription(_MB_MENUS_SELECT_MENU_DSC); $form->addElement($element); //Skin $temp_skins = XoopsLists::getDirListAsArray(\XoopsBaseConfig::get('root-path') . "/modules/menus/skins/", ""); $skins_options = array(); foreach ($temp_skins as $skin) { if (XoopsLoad::fileExists($helper->path('skins/' . $skin . '/skin_version.php'))) { $skins_options[$skin] = $skin; } } $element = new Xoops\Form\Select(_MB_MENUS_SELECT_SKIN, 'options[1]', $options[1], 1); $element->addOptionArray($skins_options); $element->setDescription(_MB_MENUS_SELECT_SKIN_DSC); $form->addElement($element); //Use skin from,theme $element = new Xoops\Form\RadioYesNo(_MB_MENUS_USE_THEME_SKIN, 'options[2]', $options[2]); $element->setDescription(_MB_MENUS_USE_THEME_SKIN_DSC); $form->addElement($element); //Display method $display_options = array('block' => _MB_MENUS_DISPLAY_METHOD_BLOCK, 'template' => _MB_MENUS_DISPLAY_METHOD_TEMPLATE); $element = new Xoops\Form\Select(_MB_MENUS_DISPLAY_METHOD, 'options[3]', $options[3], 1); $element->addOptionArray($display_options); $element->setDescription(sprintf(_MB_MENUS_DISPLAY_METHOD_DSC, $options[4])); $form->addElement($element); //Unique ID $element = new Xoops\Form\Text(_MB_MENUS_UNIQUEID, 'options[4]', 2, 20, $options[4]); $element->setDescription(_MB_MENUS_UNIQUEID_DSC); $form->addElement($element); return $form->render(); }
$op_select->addOption('access', _PROFILE_AM_PROF_ACCESS); $opform->addElement($op_select); $opform->display(); $criteria = new CriteriaCompo(); $criteria->setGroupby("field_id, user_group, profile_group"); $criteria->setSort('field_id'); $criteria->setOrder('DESC'); $visibilities = $visibility_handler->getAll($criteria, false, false, true); $member_handler = $xoops->getHandlerMember(); $groups = $member_handler->getGroupList(); $groups[0] = _PROFILE_AM_FIELDVISIBLETOALL; asort($groups); $xoops->tpl()->assign('fields', $fields); $xoops->tpl()->assign('visibilities', $visibilities); $xoops->tpl()->assign('groups', $groups); $add_form = new Xoops\Form\SimpleForm('', 'addform', 'visibility.php'); $sel_field = new Xoops\Form\Select(_PROFILE_AM_FIELDVISIBLE, 'field_id'); $sel_field->setExtra("style='width: 200px;'"); $sel_field->addOptionArray($fields); $add_form->addElement($sel_field); $sel_ug = new Xoops\Form\Select(_PROFILE_AM_FIELDVISIBLEFOR, 'ug'); $sel_ug->addOptionArray($groups); $add_form->addElement($sel_ug); unset($groups[FixedGroups::ANONYMOUS]); $sel_pg = new Xoops\Form\Select(_PROFILE_AM_FIELDVISIBLEON, 'pg'); $sel_pg->addOptionArray($groups); $add_form->addElement($sel_pg); $add_form->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_ADD, 'submit')); $add_form->assign($xoops->tpl()); $xoops->tpl()->display("admin:profile/visibility.tpl"); $xoops->footer();