/** * @desc Muestra el formulario para agregar un nuevo sitio */ function edit_bookmark() { global $xoopsModule, $xoopsConfig, $xoopsSecurity, $rmTpl; $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirectMsg('bookmarks.php', __('Site ID not provided!', 'mywords'), 1); die; } $book = new MWBookmark($id); if ($book->isNew()) { redirectMsg('bookmarks.php', __('Social site not exists!', 'mywords'), 1); die; } $temp = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/mywords/images/icons'); foreach ($temp as $icon) { $icons[] = array('url' => XOOPS_URL . "/modules/mywords/images/icons/{$icon}", 'name' => $icon); } MWFunctions::include_required_files(); RMBreadCrumb::get()->add_crumb(__('Social Sites', 'mywords'), 'bookmarks.php'); RMBreadCrumb::get()->add_crumb(__('Edit Site', 'mywords')); xoops_cp_header(); $show_edit = true; include $rmTpl->get_template('admin/mywords_bookmarks.php', 'module', 'mywords'); $rmTpl->assign('xoops_pagetitle', __('Edit Social Site', 'mywords')); $rmTpl->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); $rmTpl->add_script('../include/js/scripts.php?file=bookmarks.js'); xoops_cp_footer(); }
/** * @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 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); }
/** * @param bool $action * @return XoopsThemeForm */ public function getForm($action = false) { global $xoopsDB, $xoopsModuleConfig; if ($action === false) { $action = $_SERVER['REQUEST_URI']; } $title = $this->isNew() ? sprintf(_AM_PRESENTER_CAT_ADD) : sprintf(_AM_PRESENTER_CAT_EDIT); include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $form = new XoopsThemeForm($title, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); // Cat_pid include_once XOOPS_ROOT_PATH . '/class/tree.php'; $categoriesHandler =& xoops_getModuleHandler('categories', 'presenter'); $criteria = new CriteriaCompo(); $categories = $categoriesHandler->getObjects($criteria); if ($categories) { $categories_tree = new XoopsObjectTree($categories, 'cat_id', 'cat_pid'); $cat_pid = $categories_tree->makeSelBox('cat_pid', 'cat_title', '--', $this->getVar('cat_pid', 'e'), false); $form->addElement(new XoopsFormLabel(_AM_PRESENTER_CAT_PID, $cat_pid)); } // Cat_title $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_TITLE, 'cat_title', 50, 255, $this->getVar('cat_title')), true); // Cat_desc $form->addElement(new XoopsFormTextArea(_AM_PRESENTER_CAT_DESC, 'cat_desc', $this->getVar('cat_desc'), 4, 47), true); // Cat_image $cat_image = $this->getVar('cat_image') ? $this->getVar('cat_image') : 'blank.gif'; $uploadir = '/uploads/presenter/images/categories'; $imgtray = new XoopsFormElementTray(_AM_PRESENTER_CAT_IMAGE, '<br />'); $imgpath = sprintf(_AM_PRESENTER_FORMIMAGE_PATH, $uploadir); $imageselect = new XoopsFormSelect($imgpath, 'cat_image', $cat_image); $image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadir); foreach ($image_array as $image) { $imageselect->addOption("{$image}", $image); } $imageselect->setExtra("onchange='showImgSelected(\"image_cat_image\", \"cat_image\", \"" . $uploadir . "\", \"\", \"" . XOOPS_URL . "\")'"); $imgtray->addElement($imageselect); $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadir . "/" . $cat_image . "' name='image_cat_image' id='image_cat_image' alt='' />")); $fileseltray = new XoopsFormElementTray('', '<br />'); $fileseltray->addElement(new XoopsFormFile(_AM_PRESENTER_FORMUPLOAD, 'cat_image', $xoopsModuleConfig['maxsize'])); $fileseltray->addElement(new XoopsFormLabel('')); $imgtray->addElement($fileseltray); $form->addElement($imgtray); // Cat_weight $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_WEIGHT, 'cat_weight', 50, 255, $this->getVar('cat_weight')), false); // Cat_color // $form->addElement(new XoopsFormColorPicker(_AM_PRESENTER_CAT_COLOR, 'cat_color', $this->getVar('cat_color')), false); $form->addElement(new XoopsFormHidden('op', 'save')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); return $form; }
/** * editCategory() * * @param integer $catid * @return */ function editCategory($category_obj = null) { global $xoopsModule; $category_handler =& xoops_getmodulehandler('category', 'newbb'); if (empty($category_obj)) { $category_obj =& $category_handler->create(); } $groups_cat_access = null; include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php"; if (!$category_obj->isNew()) { $sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . " " . $category_obj->getVar('cat_title'), "op", xoops_getenv('PHP_SELF')); } else { $sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, "op", xoops_getenv('PHP_SELF')); $category_obj->setVar('cat_title', ''); $category_obj->setVar('cat_image', ''); $category_obj->setVar('cat_description', ''); $category_obj->setVar('cat_order', 0); $category_obj->setVar('cat_url', 'http://www.myxoops.org myXOOPS Support'); } $sform->addElement(new XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false); $sform->addElement(new XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $category_obj->getVar('cat_title', 'E')), true); $sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $category_obj->getVar('cat_description', 'E'), 10, 60), false); $imgdir = "/modules/" . $xoopsModule->getVar("dirname") . "/images/category"; $cat_image = $category_obj->getVar("cat_image"); $cat_image = empty($cat_image) ? 'blank.gif' : $cat_image; $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . "/"); array_unshift($graph_array, _NONE); $cat_image_select = new XoopsFormSelect('', 'cat_image', $category_obj->getVar('cat_image')); $cat_image_select->addOptionArray($graph_array); $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\""); $cat_image_tray = new XoopsFormElementTray(_AM_NEWBB_IMAGE, ' '); $cat_image_tray->addElement($cat_image_select); $cat_image_tray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . $imgdir . "/" . $cat_image . " 'name='img' id='img' alt='' />")); $sform->addElement($cat_image_tray); $sform->addElement(new XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $category_obj->getVar('cat_url', 'E')), false); $sform->addElement(new XoopsFormHidden('cat_id', $category_obj->getVar("cat_id"))); $button_tray = new XoopsFormElementTray('', ''); $button_tray->addElement(new XoopsFormHidden('op', 'save')); $butt_save = new XoopsFormButton('', '', _SUBMIT, 'submit'); $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"'); $button_tray->addElement($butt_save); if ($category_obj->getVar("cat_id")) { $butt_delete = new XoopsFormButton('', '', _CANCEL, 'submit'); $butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"'); $button_tray->addElement($butt_delete); } $sform->addElement($button_tray); $sform->display(); }
/** * @return XoopsThemeForm */ function getForm() { if ($this->isNew()) { $blank_img = 'blank.gif'; } else { $blank_img = str_replace('avatars/', '', $this->getVar('avatar_file', 'e')); } // Get User Config $config_handler =& xoops_gethandler('config'); $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER); // New and edit form $form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', "post", true); $form->setExtra('enctype="multipart/form-data"'); // Name $form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true); // Name description $maxpixel = '<div>' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>'; $maxsize = '<div>' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>'; // Upload part $imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br />'); $imgtray_img->setDescription($maxpixel . $maxsize); $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img); $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars'); $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-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'"); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />")); $fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false); $imgtray_img->addElement($fileseltray_img); $form->addElement($imgtray_img); // Weight $form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e'))); // Display $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO)); // Hidden if ($this->isNew()) { $form->addElement(new XoopsFormHidden('avatar_type', 's')); } $form->addElement(new XoopsFormHidden('op', 'save')); $form->addElement(new XoopsFormHidden('fct', 'avatars')); $form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e'))); // Button $form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit')); return $form; }
/** * @param UserrankRank|XoopsObject $obj */ public function __construct(XoopsObject $obj) { if ($obj->isNew()) { $blank_img = 'blank.gif'; } else { $blank_img = str_replace('ranks/', '', $obj->getVar('rank_image', 'e')); } $title = $obj->isNew() ? sprintf(_AM_USERRANK_ADD) : sprintf(_AM_USERRANK_EDIT); parent::__construct($title, 'form', 'userrank.php', 'post', true); $this->setExtra('enctype="multipart/form-data"'); $this->addElement(new Xoops\Form\Text(_AM_USERRANK_TITLE, 'rank_title', 4, 50, $obj->getVar('rank_title')), true); $min = new Xoops\Form\Text(_AM_USERRANK_MINPOST, 'rank_min', 1, 10, $obj->getVar('rank_min')); $min->setPattern('^\\d+$', _AM_USERRANK_ERROR_POST); $this->addElement($min); $max = new Xoops\Form\Text(_AM_USERRANK_MAXPOST, 'rank_max', 1, 10, $obj->getVar('rank_max')); $max->setPattern('^\\d+$', _AM_USERRANK_ERROR_POST); $this->addElement($max); $imgtray_img = new Xoops\Form\ElementTray(_AM_USERRANK_IMAGE, '<br />'); $imgpath_img = sprintf(_AM_USERRANK_IMAGE_PATH, \XoopsBaseConfig::get('uploads-path') . '/ranks/'); $imageselect_img = new Xoops\Form\Select($imgpath_img, 'rank_image', $blank_img); $image_array_img = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('uploads-path') . '/ranks'); $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-ranks-img\", \"rank_image\", \"ranks\", \"\", \"" . \XoopsBaseConfig::get('uploads-url') . "\")'"); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . \XoopsBaseConfig::get('uploads-url') . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />")); $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new Xoops\Form\File(_AM_USERRANK_UPLOAD, 'rank_image'), false); $fileseltray_img->addElement(new Xoops\Form\Label(''), false); $imgtray_img->addElement($fileseltray_img); $this->addElement($imgtray_img); if (!$obj->isNew()) { $rank_special = $obj->getVar('rank_special'); } else { $rank_special = 0; } $special_tray = new Xoops\Form\ElementTray(_AM_USERRANK_SPECIAL, '<br />'); $special_tray->setDescription(_AM_USERRANK_SPECIAL_CAN); $special_tray->addElement(new Xoops\Form\RadioYesNo('', 'rank_special', $rank_special)); $this->addElement($special_tray); if (!$obj->isNew()) { $this->addElement(new Xoops\Form\Hidden('rank_id', $obj->getVar('rank_id'))); } $this->addElement(new Xoops\Form\Hidden('op', 'userrank_save')); $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); }
function getForm($action = false) { if ($this->isNew()) { $blank_img = 'blank.gif'; } else { $blank_img = str_replace('ranks/', '', $this->getVar('rank_image', 'e')); } if ($action === false) { $action = $_SERVER['REQUEST_URI']; } $title = $this->isNew() ? sprintf(_AM_SYSTEM_USERRANK_ADD) : sprintf(_AM_SYSTEM_USERRANK_EDIT); $form = new XoopsThemeForm($title, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_TITLE, 'rank_title', 50, 50, $this->getVar('rank_title'), true)); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MINPOST, 'rank_min', 10, 10, $this->getVar('rank_min'))); $form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MAXPOST, 'rank_max', 10, 10, $this->getVar('rank_max'))); $imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_IMAGE, '<br />'); $imgpath_img = sprintf(_AM_SYSTEM_USERRANK_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/ranks/'); $imageselect_img = new XoopsFormSelect($imgpath_img, 'rank_image', $blank_img); $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/ranks'); $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-ranks-img\", \"rank_image\", \"ranks\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'"); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />")); $fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_USERRANK_UPLOAD, 'rank_image', 500000), false); $fileseltray_img->addElement(new XoopsFormLabel(''), false); $imgtray_img->addElement($fileseltray_img); $form->addElement($imgtray_img); if (!$this->isNew()) { $rank_special = $this->getVar('rank_special'); } else { $rank_special = 0; } $special_tray = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_SPECIAL, '<br />'); $special_tray->setDescription(_AM_SYSTEM_USERRANK_SPECIAL_CAN); $special_tray->addElement(new XoopsFormRadioYN('', 'rank_special', $rank_special)); $form->addElement($special_tray); if (!$this->isNew()) { $form->addElement(new XoopsFormHidden('rank_id', $this->getVar('rank_id'))); } $form->addElement(new XoopsFormHidden('op', 'userrank_save')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); return $form; }
public function __construct(AvatarsAvatar $obj) { if ($obj->isNew()) { $blank_img = 'blank.gif'; } else { $blank_img = str_replace('avatars/', '', $obj->getVar('avatar_file', 'e')); } //$xoops = Xoops::getInstance(); // New and edit form $title = $obj->isNew() ? XoopsLocale::A_ADD : XoopsLocale::A_EDIT; $action = $_SERVER['REQUEST_URI']; parent::__construct($title, 'avatar_form', $action, "post", true); $this->setExtra('enctype="multipart/form-data"'); // Name $this->addElement(new Xoops\Form\Text(XoopsLocale::NAME, 'avatar_name', 5, 255, $obj->getVar('avatar_name', 'e')), true); // Upload part $imgtray_img = new Xoops\Form\ElementTray(XoopsLocale::FILE, '<br />'); $avatars_path = \XoopsBaseConfig::get('uploads-path') . '/avatars'; $imageselect_img = new Xoops\Form\Select(sprintf(XoopsLocale::F_FILE_EXISTS_IN, $avatars_path . '/'), 'avatar_file', $blank_img); $image_array_img = XoopsLists::getImgListAsArray($avatars_path); $imageselect_img->addOption("{$blank_img}", $blank_img); foreach ($image_array_img as $image_img) { $imageselect_img->addOption("{$image_img}", $image_img); } $xoops_upload_url = \XoopsBaseConfig::get('uploads-url'); $imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . $xoops_upload_url . "\")'"); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />")); $fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new Xoops\Form\File(XoopsLocale::A_UPLOAD, 'avatar_file'), false); // , $xoops->getModuleConfig('avatars_imagefilesize') $imgtray_img->addElement($fileseltray_img); $this->addElement($imgtray_img); // Weight $weight = new Xoops\Form\Text(XoopsLocale::DISPLAY_ORDER, 'avatar_weight', 1, 4, $obj->getVar('avatar_weight', 'e'), ''); $weight->setPattern('^\\d+$', XoopsLocale::E_YOU_NEED_A_POSITIVE_INTEGER); $this->addElement($weight, true); // Display $this->addElement(new Xoops\Form\RadioYesNo(XoopsLocale::DISPLAY_THIS_ITEM, 'avatar_display', $obj->getVar('avatar_display', 'e'), XoopsLocale::YES, XoopsLocale::NO)); // Hidden if ($obj->isNew()) { $this->addElement(new Xoops\Form\Hidden('avatar_type', 's')); } $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')); }
function b_xmobile_qr_edit($options) { $qrimage = empty($options[0]) ? 0 : intval($options[0]); $qr_mod_dir = empty($options[1]) ? "" : htmlspecialchars($options[1]); require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; $qrimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/xmobile/images/qr/'); $i = 0; $qr = "<select name='options[0]'>"; $qr .= "<option value='" . $i . "' " . ($qrimage == $i ? "selected='selected'" : "") . ">---</option>"; foreach ($qrimg_array as $v) { $qr .= "<option value='" . ++$i . "' " . ($qrimage == $i ? "selected='selected'" : "") . ">" . htmlspecialchars($v) . "</option>"; } $qr .= "</select>"; $form = _BLOCK_XMOBILE_QR_CODE . " " . $qr . " " . _BLOCK_XMOBILE_QR_CODE_DESC . "<br />\n" . _BLOCK_XMOBILE_QR_MOD_DIR . "<input type='text' name='options[1]' value='" . $qr_mod_dir . "'>"; return $form; }
/** * @param bool $action * * @return XoopsThemeForm */ function getForm($action = false) { if ($this->isNew()) { $blank_img = 'blank.gif'; } else { $blank_img = str_replace('smilies/', '', $this->getVar('smile_url', 'e')); } if ($action === false) { $action = $_SERVER['REQUEST_URI']; } $title = $this->isNew() ? sprintf(_AM_SYSTEM_SMILIES_ADD) : sprintf(_AM_SYSTEM_SMILIES_EDIT); $form = new XoopsThemeForm($title, 'form', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_CODE, 'code', 26, 25, $this->getVar('code')), true); $form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_DESCRIPTION, 'emotion', 50, 50, $this->getVar('emotion')), true); $imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_SMILIES_FILE, '<br />'); $imgpath_img = sprintf(_AM_SYSTEM_SMILIES_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/smilies/'); $imageselect_img = new XoopsFormSelect($imgpath_img, 'smile_url', $blank_img); $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/smilies'); $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-smilies-img\', \'smile_url\', \'smilies\', \'\', \'' . XOOPS_UPLOAD_URL . '\' )"'); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/smilies/" . $blank_img . "' name='image_img' id='xo-smilies-img' alt='' />")); $fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />'); $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_SMILIES_UPLOADS, 'smile_url', 500000), false); $fileseltray_img->addElement(new XoopsFormLabel(''), false); $imgtray_img->addElement($fileseltray_img); $form->addElement($imgtray_img); if (!$this->isNew()) { $form->addElement(new XoopsFormHidden('smilies_id', $this->getVar('id'))); $display = $this->getVar('display'); } else { $display = 0; } $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_SMILIES_OFF, 'display', $display)); $form->addElement(new XoopsFormHidden('op', 'save_smilie')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); return $form; }
/** * @return XoopsThemeForm */ public function getForm() { if ($this->isNew()) { $blank_img = 'blank.gif'; } else { $blank_img = $this->getVar('avatar_file', 'e'); } // Get User Config $config_handler = xoops_getHandler('config'); $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER); $form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true); $maxpixel = '<div class="small basic italic">' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>'; $maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>'; $uploadirectory_img = ''; $imgtray_img = new XoopsFormElementTray(_IMAGEFILE . '<br><br>' . $maxpixel . $maxsize, '<br>'); $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH), 'avatar_file', $blank_img); $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH); $imageselect_img->addOption("{$blank_img}", $blank_img); foreach ($image_array_img as $image_img) { // if (preg_match('#avt#', $image_img)) { if (false !== strpos(image_img, 'avt')) { $imageselect_img->addOption("{$image_img}", $image_img); } } $imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"avatar_file\", \"" . $uploadirectory_img . "\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'"); $imgtray_img->addElement($imageselect_img, false); $imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/' . $blank_img . "' name='image_img' id='image_img' alt='' />")); $fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>'); $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false); $imgtray_img->addElement($fileseltray_img); $form->addElement($imgtray_img); $form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e'))); $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO)); $form->addElement(new XoopsFormHidden('op', 'save')); $form->addElement(new XoopsFormHidden('fct', 'avatars')); $form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e'))); $form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit')); return $form; }
/** * gets list of subject icon image file names in a certain directory * if directory is not specified, default directory will be searched * * @static * * @param string $sub_dir * * @return array */ public static function getSubjectsList($sub_dir = '') { $xoops_root_path = \XoopsBaseConfig::get('root-path'); if ($sub_dir != '') { $subjects = XoopsLists::getImgListAsArray($xoops_root_path . '/images/subject/' . $sub_dir, $sub_dir . '/'); } else { $subjects = XoopsLists::getImgListAsArray($xoops_root_path . '/images/subject/'); } return $subjects; }
function editpartner($showmenu = false, $id = 0) { global $xoopsDB, $smartpartner_partner_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; if (!isset($smartpartner_partner_handler)) { $smartpartner_partner_handler =& smartpartner_gethandler('partner'); } include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a partner if ($id != 0) { // Creating the partner object $partnerObj = new SmartpartnerPartner($id); if ($partnerObj->notLoaded()) { redirect_header("partner.php", 1, _AM_SPARTNER_NOPARTNERSELECTED); exit; } switch ($partnerObj->status()) { case _SPARTNER_STATUS_SUBMITTED: $breadcrumb_action1 = _AM_SPARTNER_SUBMITTED_PARTNERS; $breadcrumb_action2 = _AM_SPARTNER_APPROVING; $page_title = _AM_SPARTNER_SUBMITTED_TITLE; $page_info = _AM_SPARTNER_SUBMITTED_INFO; $button_caption = _AM_SPARTNER_APPROVE; $new_status = _SPARTNER_STATUS_ACTIVE; break; case _SPARTNER_STATUS_ACTIVE: $breadcrumb_action1 = _AM_SPARTNER_ACTIVE_PARTNERS; $breadcrumb_action2 = _AM_SPARTNER_EDITING; $page_title = _AM_SPARTNER_ACTIVE_EDITING; $page_info = _AM_SPARTNER_ACTIVE_EDITING_INFO; $button_caption = _AM_SPARTNER_MODIFY; $new_status = _SPARTNER_STATUS_ACTIVE; break; case _SPARTNER_STATUS_INACTIVE: $breadcrumb_action1 = _AM_SPARTNER_INACTIVE_PARTNERS; $breadcrumb_action2 = _AM_SPARTNER_EDITING; $page_title = _AM_SPARTNER_INACTIVE_EDITING; $page_info = _AM_SPARTNER_INACTIVE_EDITING_INFO; $button_caption = _AM_SPARTNER_MODIFY; $new_status = _SPARTNER_STATUS_INACTIVE; break; case _SPARTNER_STATUS_REJECTED: $breadcrumb_action1 = _AM_SPARTNER_REJECTED_PARTNERS; $breadcrumb_action2 = _AM_SPARTNER_EDITING; $page_title = _AM_SPARTNER_REJECTED_EDITING; $page_info = _AM_SPARTNER_REJECTED_EDITING_INFO; $button_caption = _AM_SPARTNER_MODIFY; $new_status = _SPARTNER_STATUS_REJECTED; break; case "default": default: break; } if ($showmenu) { smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; smartpartner_collapsableBar('editpartner', 'editpartmericon', $page_title, $page_info); } else { // there's no parameter, so we're adding a partner $partnerObj =& $smartpartner_partner_handler->create(); $breadcrumb_action1 = _AM_SPARTNER_PARTNERS; $breadcrumb_action2 = _AM_SPARTNER_CREATE; $button_caption = _AM_SPARTNER_CREATE; $new_status = _SPARTNER_STATUS_ACTIVE; if ($showmenu) { smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } smartpartner_collapsableBar('addpartner', 'addpartmericon', _AM_SPARTNER_PARTNER_CREATING, _AM_SPARTNER_PARTNER_CREATING_DSC); } // PARTNER FORM $sform = new XoopsThemeForm(_AM_SPARTNER_PARTNERS, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // TITLE $title_text = new XoopsFormText(_AM_SPARTNER_TITLE, 'title', 50, 255, $partnerObj->title('e')); $sform->addElement($title_text, true); // Parent Category $mytree = new SmartTree($xoopsDB->prefix("smartpartner_categories"), "categoryid", "parentid"); ob_start(); $mytree->makeMySelBox("name", "weight", explode('|', $partnerObj->categoryid()), 0, 'categoryid', '', true); //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="") $parent_cat_select = new XoopsFormLabel(_AM_SPARTNER_CATEGORY_BELONG, ob_get_contents()); $parent_cat_select->setDescription(_AM_SPARTNER_BELONG_CATEGORY_DSC); $sform->addElement($parent_cat_select); ob_end_clean(); // LOGO $logo_array =& XoopsLists::getImgListAsArray(smartpartner_getImageDir()); $logo_select = new XoopsFormSelect('', 'image', $partnerObj->image()); $logo_select->addOption('-1', '---------------'); $logo_select->addOptionArray($logo_array); $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTPARTNER_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'"); $logo_tray = new XoopsFormElementTray(_AM_SPARTNER_LOGO, ' '); $logo_tray->addElement($logo_select); $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartpartner_getImageDir('', false) . $partnerObj->image() . "' name='image3' id='image3' alt='' />")); $logo_tray->setDescription(_AM_SPARTNER_LOGO_DSC); $sform->addElement($logo_tray); // LOGO UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SPARTNER_LOGO_UPLOAD, "logo_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(sprintf(_AM_SPARTNER_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height'])); $sform->addElement($file_box); // IMAGE_URL $image_url_text = new XoopsFormText(_CO_SPARTNER_IMAGE_URL, 'image_url', 50, 255, $partnerObj->image_url()); $image_url_text->setDescription(_CO_SPARTNER_IMAGE_URL_DSC); $sform->addElement($image_url_text, false); // URL $url_text = new XoopsFormText(_AM_SPARTNER_URL, 'url', 50, 255, $partnerObj->url()); $url_text->setDescription(_AM_SPARTNER_URL_DSC); $sform->addElement($url_text, false); // SUMMARY $summary_text = new XoopsFormTextArea(_AM_SPARTNER_SUMMARY, 'summary', $partnerObj->summary(0, 'e'), 7, 60); $summary_text->setDescription(_AM_SPARTNER_SUMMARY_DSC); $sform->addElement($summary_text, true); // SHOW summary on partner page $showsum_radio = new XoopsFormRadioYN(_AM_SPARTNER_SHOW_SUMMARY, 'showsummary', $partnerObj->getVar('showsummary')); $showsum_radio->setDescription(_AM_SPARTNER_SHOW_SUMMARY_DSC); $sform->addElement($showsum_radio); // DESCRIPTION $description_text = new XoopsFormDhtmlTextArea(_AM_SPARTNER_DESCRIPTION, 'description', $partnerObj->description(0, 'e'), 15, 60); $description_text->setDescription(_AM_SPARTNER_DESCRIPTION_DSC); $sform->addElement($description_text, false); // CONTACT_NAME $contact_name_text = new XoopsFormText(_CO_SPARTNER_CONTACT_NAME, 'contact_name', 50, 255, $partnerObj->contact_name('e')); $contact_name_text->setDescription(_CO_SPARTNER_CONTACT_NAME_DSC); $sform->addElement($contact_name_text, false); // CONTACT_EMAIL $contact_email_text = new XoopsFormText(_CO_SPARTNER_CONTACT_EMAIL, 'contact_email', 50, 255, $partnerObj->contact_email('e')); $contact_email_text->setDescription(_CO_SPARTNER_CONTACT_EMAIL_DSC); $sform->addElement($contact_email_text, false); // EMAIL_PRIV $email_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_EMAILPRIV, 'email_priv', $partnerObj->email_priv('e')); $email_priv_radio->setDescription(_CO_SPARTNER_CONTACT_EMAILPRIV_DSC); $sform->addElement($email_priv_radio); // CONTACT_PHONE $contact_phone_text = new XoopsFormText(_CO_SPARTNER_CONTACT_PHONE, 'contact_phone', 50, 255, $partnerObj->contact_phone('e')); $contact_phone_text->setDescription(_CO_SPARTNER_CONTACT_PHONE_DSC); $sform->addElement($contact_phone_text, false); // PHONE_PRIV $phone_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_PHONEPRIV, 'phone_priv', $partnerObj->phone_priv('e')); $phone_priv_radio->setDescription(_CO_SPARTNER_CONTACT_PHONEPRIV_DSC); $sform->addElement($phone_priv_radio); // ADRESS //$adress_text = new XoopsFormText(_CO_SPARTNER_ADRESS, 'adress', 50, 255, $partnerObj->adress('e')); $adress_text = new XoopsFormTextArea(_CO_SPARTNER_ADRESS, 'adress', $partnerObj->adress('e')); $adress_text->setDescription(_CO_SPARTNER_ADRESS_DSC); $sform->addElement($adress_text, false); // ADRESS_PRIV $adress_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_ADRESSPRIV, 'adress_priv', $partnerObj->adress_priv('e')); $adress_priv_radio->setDescription(_CO_SPARTNER_CONTACT_ADRESSPRIV_DSC); $sform->addElement($adress_priv_radio); // STATUS $options = $partnerObj->getAvailableStatus(); $status_select = new XoopsFormSelect(_AM_SPARTNER_STATUS, 'status', $new_status); $status_select->addOptionArray($options); $status_select->setDescription(_AM_SPARTNER_STATUS_DSC); $sform->addElement($status_select); // WEIGHT $weight_text = new XoopsFormText(_AM_SPARTNER_WEIGHT, 'weight', 4, 4, $partnerObj->weight()); $weight_text->setDescription(_AM_SPARTNER_WEIGHT_DSC); $sform->addElement($weight_text); //perms global $smartpermissions_handler; include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php'; $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler); if ($partnerObj->id() != 0) { $grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $partnerObj->id()); } else { $grantedGroups = $xoopsModuleConfig['default_full_view']; } $full_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_FULL_PERM_READ, 'full_view', true, $grantedGroups, 5, true); $full_view_select->setDescription(_CO_SPARTNER_FULL_PERM_READ_DSC); $sform->addElement($full_view_select); if ($partnerObj->id() != 0) { $partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $partnerObj->id()); } else { $partGrantedGroups = $xoopsModuleConfig['default_part_view']; } $part_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_PART_PERM_READ, 'partial_view', true, $partGrantedGroups, 5, true); $part_view_select->setDescription(_CO_SPARTNER_PART_PERM_READ_DSC); $sform->addElement($part_view_select); // Partner id $sform->addElement(new XoopsFormHidden('id', $partnerObj->id())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'addpartner'); $button_tray->addElement($hidden); $sform->addElement(new XoopsFormHidden('original_status', $partnerObj->status())); if (!$id) { // there's no id? Then it's a new partner // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SPARTNER_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } else { // else, we're editing an existing partner // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SPARTNER_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addpartner\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SPARTNER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } $sform->addElement($button_tray); $sform->display(); unset($hidden); if (!$id) { smartpartner_close_collapsable('addpartner', 'addpartnericon'); } else { smartpartner_close_collapsable('editpartner', 'editpartnericon'); } if ($id != 0) { showfiles($partnerObj); } }
$template_select->addOptionArray($templates); //$template_option_tray->addElement($template_select); //$form_art->addElement($template_option_tray); $form_art->addElement($template_select); } // Image if (!empty($xoopsModuleConfig["path_image"])) { $cat_image = $category_obj->getVar("cat_image"); $image_option_tray = new XoopsFormElementTray(art_constant("MD_IMAGE_UPLOAD"), "<br />"); $image_option_tray->addElement(new XoopsFormFile("", "userfile", "")); $form_art->addElement($image_option_tray); unset($image_tray); unset($image_option_tray); $image_option_tray = new XoopsFormElementTray(art_constant("MD_IMAGE_SELECT"), "<br />"); $path_image = $xoopsModuleConfig["path_image"]; $image_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $path_image . "/"); array_unshift($image_array, _NONE); $image_select = new XoopsFormSelect("", "cat_image", $cat_image); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $path_image . "/', '', '" . XOOPS_URL . "')\""); $image_tray = new XoopsFormElementTray("", " "); $image_tray->addElement($image_select); if (!empty($cat_image) && file_exists(XOOPS_ROOT_PATH . "/" . $path_image . "/" . $cat_image)) { $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/" . $path_image . "/" . $cat_image . "\" name=\"img\" id=\"img\" alt=\"\" /></div>")); } else { $image_tray->addElement(new XoopsFormLabel("", "<div style=\"padding: 8px;\"><img src=\"" . XOOPS_URL . "/images/blank.gif\" name=\"img\" id=\"img\" alt=\"\" /></div>")); } $image_option_tray->addElement($image_tray); $form_art->addElement($image_option_tray); } // The moderator
function modLink() { global $xoopsDB, $myts, $eh, $mytree, $xoopsConfig; $linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/mylinks/images/shots/"); $lid = $_GET['lid']; xoops_cp_header(); echo "<h4>" . _MD_WEBLINKSCONF . "</h4>"; echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr class=\"odd\"><td>"; $result = $xoopsDB->query("select cid, title, url, logourl from " . $xoopsDB->prefix("mylinks_links") . " where lid={$lid}") or $eh->show("0013"); echo "<h4>" . _MD_MODLINK . "</h4><br />"; list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result); $title = $myts->makeTboxData4Edit($title); $url = $myts->makeTboxData4Edit($url); // $url = urldecode($url); $logourl = $myts->makeTboxData4Edit($logourl); // $logourl = urldecode($logourl); $result2 = $xoopsDB->query("select description from " . $xoopsDB->prefix("mylinks_text") . " where lid={$lid}"); list($description) = $xoopsDB->fetchRow($result2); $GLOBALS['description'] = $myts->makeTareaData4Edit($description); echo "<table>"; echo "<form method='post' action='index.php'>"; echo "<tr><td>" . _MD_LINKID . "</td><td><b>{$lid}</b></td></tr>"; echo "<tr><td>" . _MD_SITETITLE . "</td><td><input type='text' name='title' value=\"{$title}\" size='50' maxlength='100' /></td></tr>\n"; echo "<tr><td>" . _MD_SITEURL . "</td><td><input type='text' name='url' value=\"{$url}\" size='50' maxlength='250' /></td></tr>\n"; echo "<tr><td valign=\"top\">" . _MD_DESCRIPTIONC . "</td><td>"; xoopsCodeTarea("description", 60, 8); xoopsSmilies("description"); //echo "<textarea name=description cols=60 rows=5>$description</textarea>"; echo "</td></tr>"; echo "<tr><td>" . _MD_CATEGORYC . "</td><td>"; $mytree->makeMySelBox("title", "title", $cid); echo "</td></tr>\n"; echo "<tr><td>" . _MD_SHOTIMAGE . "</td><td>"; //echo "<input type=text name=logourl value=\"$logourl\" size=\"50\" maxlength=\"60\"></input> echo "<select size='1' name='logourl'>"; echo "<option value=' '>------</option>"; foreach ($linkimg_array as $image) { if ($image == $logourl) { $opt_selected = "selected='selected'"; } else { $opt_selected = ""; } echo "<option value='" . $image . "' {$opt_selected}>" . $image . "</option>"; } echo "</select>"; echo "</td></tr>\n"; $shotdir = "<b>" . XOOPS_URL . "/modules/mylinks/images/shots/</b>"; echo "<tr><td></td><td>"; printf(_MD_SHOTMUST, $shotdir); echo "</td></tr>\n"; echo "</table>"; echo "<br /><br /><input type='hidden' name='lid' value='{$lid}' />\n"; echo "<input type='hidden' name='op' value='modLinkS' /><input type='submit' value='" . _MD_MODIFY . "' />"; echo "</form>\n"; echo "<table><tr><td>\n"; echo myTextForm("index.php?op=delLink&lid=" . $lid, _MD_DELETE); echo "</td><td>\n"; echo myTextForm("index.php?op=linksConfigMenu", _MD_CANCEL); echo "</td></tr></table>\n"; echo "<hr />"; $result5 = $xoopsDB->query("SELECT count(*) FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid = {$lid}"); list($totalvotes) = $xoopsDB->fetchRow($result5); echo "<table width='100%'>\n"; echo "<tr><td colspan='7'><b>"; printf(_MD_TOTALVOTES, $totalvotes); echo "</b><br /><br /></td></tr>\n"; // Show Registered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid = {$lid} AND ratinguser >0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo "<tr><td colspan='7'><br /><br /><b>"; printf(_MD_USERTOTALVOTES, $votes); echo "</b><br /><br /></td></tr>\n"; echo "<tr><td><b>" . _MD_USER . " </b></td><td><b>" . _MD_IP . " </b></td><td><b>" . _MD_RATING . " </b></td><td><b>" . _MD_USERAVG . " </b></td><td><b>" . _MD_TOTALRATE . " </b></td><td><b>" . _MD_DATE . " </b></td><td align=\"center\"><b>" . _MD_DELETE . "</b></td></tr>\n"; if ($votes == 0) { echo "<tr><td align=\"center\" colspan=\"7\">" . _MD_NOREGVOTES . "<br /></td></tr>\n"; } $x = 0; $colorswitch = "dddddd"; while (list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { // $ratingtimestamp = formatTimestamp($ratingtimestamp); //Individual user information $result2 = $xoopsDB->query("SELECT rating FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE ratinguser = '******'"); $uservotes = $xoopsDB->getRowsNum($result2); $useravgrating = 0; while (list($rating2) = $xoopsDB->fetchRow($result2)) { $useravgrating = $useravgrating + $rating2; } $useravgrating = $useravgrating / $uservotes; $useravgrating = number_format($useravgrating, 1); $ratingusername = XoopsUser::getUnameFromId($ratinguser); echo "<tr><td bgcolor=\"" . $colorswitch . "\">" . $ratingusername . "</td><td bgcolor=\"{$colorswitch}\">" . $ratinghostname . "</td><td bgcolor=\"{$colorswitch}\">{$rating}</td><td bgcolor=\"{$colorswitch}\">" . $useravgrating . "</td><td bgcolor=\"{$colorswitch}\">" . $uservotes . "</td><td bgcolor=\"{$colorswitch}\">" . $ratingtimestamp . "</td><td bgcolor=\"{$colorswitch}\" align=\"center\"><b>" . myTextForm("index.php?op=delVote&lid={$lid}&rid={$ratingid}", "X") . "</b></td></tr>\n"; $x++; if ($colorswitch == "dddddd") { $colorswitch = "ffffff"; } else { $colorswitch = "dddddd"; } } // Show Unregistered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid = {$lid} AND ratinguser = 0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo "<tr><td colspan='7'><b><br /><br />"; printf(_MD_ANONTOTALVOTES, $votes); echo "</b><br /><br /></td></tr>\n"; echo "<tr><td colspan='2'><b>" . _MD_IP . " </b></td><td colspan='3'><b>" . _MD_RATING . " </b></td><td><b>" . _MD_DATE . " </b></b></td><td align=\"center\"><b>" . _MD_DELETE . "</b></td><br /></tr>"; if ($votes == 0) { echo "<tr><td colspan=\"7\" align=\"center\">" . _MD_NOUNREGVOTES . "<br /></td></tr>"; } $x = 0; $colorswitch = "dddddd"; while (list($ratingid, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { $formatted_date = formatTimestamp($ratingtimestamp); echo "<td colspan=\"2\" bgcolor=\"{$colorswitch}\">{$ratinghostname}</td><td colspan=\"3\" bgcolor=\"{$colorswitch}\">{$rating}</td><td bgcolor=\"{$colorswitch}\">{$formatted_date}</td><td bgcolor=\"{$colorswitch}\" aling=\"center\"><b>" . myTextForm("index.php?op=delVote&lid={$lid}&rid={$ratingid}", "X") . "</b></td></tr>"; $x++; if ($colorswitch == "dddddd") { $colorswitch = "ffffff"; } else { $colorswitch = "dddddd"; } } echo "<tr><td colspan=\"6\"> <br /></td></tr>\n"; echo "</table>\n"; echo "</td></tr></table>"; xoops_cp_footer(); }
function edititem($showmenu = false, $itemid = 0) { global $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a item if ($itemid != 0) { // Creating the ITEM object $itemObj = new ssItem($itemid); if ($itemObj->notLoaded()) { redirect_header("item.php", 1, _AM_SS_NOITEMSELECTED); exit; } switch ($itemObj->status()) { case _SS_STATUS_SUBMITTED: $breadcrumb_action1 = _AM_SS_SUBMITTED; $breadcrumb_action2 = _AM_SS_APPROVING; $page_title = _AM_SS_SUBMITTED_TITLE; $page_info = _AM_SS_SUBMITTED_INFO; $button_caption = _AM_SS_APPROVE; $new_status = _SS_STATUS_PUBLISHED; break; case _SS_STATUS_PUBLISHED: $breadcrumb_action1 = _AM_SS_PUBLISHED; $breadcrumb_action2 = _AM_SS_EDITING; $page_title = _AM_SS_PUBLISHEDEDITING; $page_info = _AM_SS_PUBLISHEDEDITING_INFO; $button_caption = _AM_SS_MODIFY; $new_status = _SS_STATUS_PUBLISHED; break; case _SS_STATUS_OFFLINE: $breadcrumb_action1 = _AM_SS_OFFLINE; $breadcrumb_action2 = _AM_SS_EDITING; $page_title = _AM_SS_OFFLINEEDITING; $page_info = _AM_SS_OFFLINEEDITING_INFO; $button_caption = _AM_SS_MODIFY; $new_status = _SS_STATUS_OFFLINE; break; case "default": default: break; } $categoryObj =& $itemObj->category(); if ($showmenu) { ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; ss_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info); } else { // there's no parameter, so we're adding an item $itemObj =& $smartsection_item_handler->create(); $categoryObj =& $smartsection_category_handler->create(); $breadcrumb_action1 = _AM_SS_ITEMS; $breadcrumb_action2 = _AM_SS_CREATINGNEW; $button_caption = _AM_SS_CREATE; $new_status = _SS_STATUS_PUBLISHED; if ($showmenu) { ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0; $categoryObj->setVar('categoryid', $sel_categoryid); ss_collapsableBar('createitemtable', 'createitemicon', _AM_SS_ITEM_CREATING, _AM_SS_ITEM_CREATING_DSC); } // ITEM FORM $sform = new XoopsThemeForm(_AM_SS_ITEMS, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // CATEGORY $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid"); ob_start(); $sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid())); $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid()); $category_label = new XoopsFormLabel(_AM_SS_CATEGORY, ob_get_contents()); $category_label->setDescription(_AM_SS_CATEGORY_DSC); $sform->addElement($category_label); ob_end_clean(); // TITLE $title_text = new XoopsFormText(_AM_SS_TITLE, 'title', 50, 255, $itemObj->title(0, 'e')); $sform->addElement($title_text, true); // SUMMARY $summary_text = ss_getEditor(_AM_SS_SUMMARY, 'summary', $itemObj->summary(0, 'e')); $summary_text->setDescription(_AM_SS_SUMMARY_DSC); $sform->addElement($summary_text, false); // DISPLAY_SUMMARY $display_summary_radio = new XoopsFormRadioYN(_AM_SS_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . ''); $sform->addElement($display_summary_radio); // BODY $body_text = ss_getEditor(_AM_SS_BODY, 'body', $itemObj->body(0, 'e')); //$body_text = new XoopsFormDhtmlTextArea(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'), 20, 60); $body_text->setDescription(_AM_SS_BODY_DSC); $sform->addElement($body_text, true); // IMAGE $image_array =& XoopsLists::getImgListAsArray(ss_getImageDir('item')); $image_select = new XoopsFormSelect('', 'image', $itemObj->image()); //$image_select -> addOption ('-1', '---------------'); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray(_AM_SS_IMAGE_ITEM, ' '); $image_tray->addElement($image_select); $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . ss_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />")); $image_tray->setDescription(_AM_SS_IMAGE_ITEM_DSC); $sform->addElement($image_tray); // IMAGE UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SS_IMAGE_UPLOAD, "image_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(_AM_SS_IMAGE_UPLOAD_ITEM_DSC); $sform->addElement($file_box); // Uid /* We need to retreive the users manually because for some reason, on the frxoops.org server, the method users::getobjects encounters a memory error */ $uid = $itemObj->uid() == 0 ? $xoopsUser->uid() : $itemObj->uid(); $uid_select = new XoopsFormSelect(_AM_SS_UID, 'uid', $uid, 1, false); $uid_select->setDescription(_AM_SS_UID_DSC); $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC"; $result = $xoopsDB->query($sql); $users_array = array(); while ($myrow = $xoopsDB->fetchArray($result)) { $users_array[$myrow['uid']] = $myrow['uname']; } $uid_select->addOptionArray($users_array); $sform->addElement($uid_select); // Datesub $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub'); $datesub_datetime = new XoopsFormDateTime(_AM_SS_DATESUB, 'datesub', $size = 15, $datesub); $datesub_datetime->setDescription(_AM_SS_DATESUB_DSC); $sform->addElement($datesub_datetime); // STATUS $options = array(_SS_STATUS_PUBLISHED => _AM_SS_PUBLISHED, _SS_STATUS_OFFLINE => _AM_SS_OFFLINE); $status_select = new XoopsFormSelect(_AM_SS_STATUS, 'status', $new_status); $status_select->addOptionArray($options); $status_select->setDescription(_AM_SS_STATUS_DSC); $sform->addElement($status_select); // WEIGHT $sform->addElement(new XoopsFormText(_AM_SS_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true); // COMMENTS $addcomments_radio = new XoopsFormRadioYN(_AM_SS_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . ''); $sform->addElement($addcomments_radio); // PER ITEM PERMISSIONS $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $groups_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read()); $groups_checkbox->setDescription(_AM_SS_PERMISSIONS_ITEM_DSC); foreach ($group_list as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_checkbox->addOption($group_id, $group_name); } } $sform->addElement($groups_checkbox); // VARIOUS OPTIONS $options_tray = new XoopsFormElementTray(_AM_SS_OPTIONS, '<br />'); $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml()); $html_checkbox->addOption(1, _AM_SS_DOHTML); $options_tray->addElement($html_checkbox); $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley()); $smiley_checkbox->addOption(1, _AM_SS_DOSMILEY); $options_tray->addElement($smiley_checkbox); $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode()); $xcodes_checkbox->addOption(1, _AM_SS_DOXCODE); $options_tray->addElement($xcodes_checkbox); $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage()); $images_checkbox->addOption(1, _AM_SS_DOIMAGE); $options_tray->addElement($images_checkbox); $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr()); $linebreak_checkbox->addOption(1, _AM_SS_DOLINEBREAK); $options_tray->addElement($linebreak_checkbox); $sform->addElement($options_tray); // item ID $sform->addElement(new XoopsFormHidden('itemid', $itemObj->itemid())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'additem'); $button_tray->addElement($hidden); if (!$itemid) { // there's no itemid? Then it's a new item // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SS_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SS_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); $sform->display(); ss_close_collapsable('createitemtable', 'createitemicon'); } else { // else, we're editing an existing item // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); $sform->display(); ss_close_collapsable('edititemtable', 'edititemicon'); } unset($hidden); if ($itemid != 0) { showfiles($itemObj); } }
function editform() { global $xoopsModule, $HTTP_SERVER_VARS, $HTTP_POST_VARS, $groupid, $myts, $xoopsConfig, $xoopsUser, $xoopsDB, $textareaname, $wfsConfig; include XOOPS_ROOT_PATH . "/include/xoopscodes.php"; $textareaname = ''; //$maintext = ''; echo "<table width='100%' border='0' cellspacing='0' cellpadding='1'>"; echo "<table><tr><td><form action='index.php' method='post' name='coolsus'>"; echo "<div><b>" . _AM_GROUPPROMPT . "</b><br />"; if (isset($this->groupid)) { listGroups($this->groupid); } else { listGroups(); } echo "<br />"; echo "</div><br />"; echo "<div><b>" . _WFS_CATEGORY . "</b><br>"; $xt = new WfsCategory(); if (isset($this->categoryid)) { $xt->makeSelBox(0, $this->categoryid, "categoryid"); } else { $xt->makeSelBox(0, 0, "categoryid"); } echo "</div><br />"; echo "<div><b>" . _AM_ARTICLEWEIGHT . "</b><br />"; echo "<input type='text' name='weight' id='weight' value='"; if (isset($this->weight)) { echo $this->weight("F"); } else { $this->weight = 0; echo $this->weight("F"); } echo "' size='5' /></div><br>"; echo "<div>" . _WFS_CAUTH . "<br></div>"; echo "<div><select name='changeuser'>"; echo "<option value='-1'>------</option>"; $result = $xoopsDB->query("SELECT uid, uname FROM " . $xoopsDB->prefix("users") . " ORDER BY uname"); while (list($uid, $uname) = $xoopsDB->fetchRow($result)) { if ($uid == $this->uid) { $opt_selected = "selected='selected'"; } else { $opt_selected = ""; } echo "<option value='" . $uid . "' {$opt_selected}>" . $uname . "</option>"; } echo "</select></div><br />"; echo "<div><b>" . _WFS_TITLE . "</b><br />"; echo "<input type='text' name='title' id='title' value='"; if (isset($this->title)) { if ($this->titleFlag) { echo $this->title("F"); } else { echo $this->title("E"); } } echo "' size='50' /></div><br />"; //HTML Page Seclection// echo "<div><b>" . _WFS_HTMLPAGE . "</b></div>"; //echo " <b>HTML Path: </b>".$htmlpath."<br /><br /></div>"; $html_array = XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath']); echo "<div><select size='1' name='htmlpage'>"; echo "<option value=' '>------</option>"; foreach ($html_array as $htmlpage) { if ($htmlpage == $this->htmlpage()) { $opt_selected = "selected='selected'"; } else { $opt_selected = ""; } echo "<option value='" . $htmlpage . "' {$opt_selected}>" . $htmlpage . "</option>"; } echo "</select>"; $htmlpath = XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath']; echo " <b>HTML Path: </b>" . $htmlpath . "<br /><br /></div>"; //echo "</div><br />"; echo "<div><b>" . _WFS_MAINTEXT . "</b></div>"; if (isset($this->maintext)) { if ($this->maintextFlag) { $GLOBALS['maintext'] = $this->maintext("F"); } else { $GLOBALS['maintext'] = $this->maintext("E"); } } if (!strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) { $wfsConfig['wysiwygeditor'] = '0'; } if ($wfsConfig['wysiwygeditor'] == '1') { html_editor('maintext'); $smiliepath = $wfsConfig['smiliepath']; $smilie_array = XoopsLists::getimgListAsArray(XOOPS_ROOT_PATH . "/" . $smiliepath); echo "<br /><div style='text-align: left;'><b>" . _AM_SMILIE . "</b><br />"; echo "<table><tr><td align='top' valign='left'>"; echo "<div><script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton() {\n\t\t\t \tdocument.all." . $textareaname . "_mysmile.src = '" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/' + document.all." . $textareaname . "_smiley.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>"; echo "<select name='" . $textareaname . "_smiley' onchange='showbutton();'>"; foreach ($smilie_array as $file) { echo "<option value='" . $file . "' {$opt_selected}>" . $file . "</option>"; } echo "</select></td><td align='top' valign='left'>"; echo "<img name='" . $textareaname . "_mysmile' src='" . $xoopsConfig['xoops_url'] . "/{$smiliepath}/{$file}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mysmile.src);\" />"; echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton();\n\t\t</script>"; //Start of article images $graphpath = $wfsConfig['graphicspath']; $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/" . $graphpath); echo "<br><div style='text-align: left;'><b>" . _AM_GRAPHIC . "</b><br />"; echo "<table><tr><td align='top' valign='left'>"; echo "<script type='text/javascript'>\n\t\t<!--\n\t\t\tfunction showbutton2() {\n\t\t\t\tdocument.all." . $textareaname . "_mygraph.src = '" . $xoopsConfig['xoops_url'] . "/{$graphpath}/' + document.all." . $textareaname . "_graph.value;\n\t\t\t}\n\t\t// -->\n\t\t</script>"; echo "<select name='" . $textareaname . "_graph' onchange='showbutton2();'>"; foreach ($graph_array as $file2) { echo "<option value='" . $file2 . "' {$opt_selected}>" . $file2 . "</option>"; } echo "</select></td><td align='top' valign='left'>"; echo "<img name='" . $textareaname . "_mygraph' src='" . $xoopsConfig['xoops_url'] . "/{$graphpath}/{$file2}' style='cursor:hand;' border='0' onclick=\"doFormat('InsertImage', document.all." . $textareaname . "_mygraph.src);\" />"; echo "</td></tr></table>\n\t\t<script type='text/javascript'>\n\t\t\tshowbutton2();\n\t\t</script>"; } else { xoopsCodeTarea("maintext", 60, 15); xoopsSmilies("maintext"); } echo "<div><b>" . _WFS_SUMMARY . "</b></div>"; echo "<div><textarea id='summary' name='summary' wrap='virtual' cols='60' rows='5'>"; if (isset($this->summary)) { if ($this->summaryFlag) { echo $this->summary("F"); } else { echo $this->summary("E"); } } echo "</textarea></div>"; echo "<div class = 'bg3'><h4>" . _WFS_ARTICLELINK . "</h4></div>"; echo "<div><b>" . _WFS_LINKURL . "</b><br />"; echo "<input type='text' name='url' id='url' value='"; if (isset($this->url)) { echo $this->url("F"); } echo "' size='70' /></div><br />"; echo "<div><b>" . _WFS_LINKURLNAME . "</b><br />"; echo "<input type='text' name='urlname' id='urlname' value='"; if (isset($this->urlname)) { echo $this->urlname("F"); } echo "' size='50' /></div><br>"; echo "<div class = 'bg3'><h4>" . _WFS_ATTACHEDFILES . "</h4></div>"; echo "<div>" . _WFS_ATTACHEDFILESTXT . "</div><br />"; if (empty($this->articleid)) { echo _WFS_AFTERREGED . "<br />"; } elseif ($num = $this->getFilesCount()) { echo "<table border='1' style='border-collapse: collapse' bordercolor='#ffffff' width='100%' >"; echo "<tr class='bg3'><td align='center'>" . _AM_FILEID . "</td><td align='center'>" . _AM_FILEICON . "</td><td align='center'>" . _AM_FILESTORE . "</td><td align='center'>" . _AM_REALFILENAME . "</td><td align='center'>" . _AM_USERFILENAME . "</td><td align='center' class='nw'>" . _AM_FILEMIMETYPE . "</td><td align='center' class='nw'>" . _AM_FILESIZE . "</td><td align='center'>" . _AM_ACTION . "</td></tr>"; foreach ($this->files as $attached) { if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $attached->getFileRealName())) { $filename = $attached->getFileRealName(); } else { $filename = "File Error!"; } $fileid = $attached->getFileid(); $mimetype = new mimetype(); $icon = get_icon(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename); $iconshow = "<img src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/" . $icon . " align='middle'>"; if (is_file(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename)) { $size = Prettysize(filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename)); } else { $size = '0'; } $filerealname = $attached->downloadname; $mimeshow = $mimetype->getType(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename); $counter = $attached->getCounter(); $linkedname = $attached->getFileShowName(); //$linkedname = $attached->getLinkedName(XOOPS_URL."/modules/".$xoopsModule->dirname()."/download.php?fileid="); $editlink = "<a href='index.php?op=fileedit&fileid=" . $fileid . "'>" . _AM_EDIT . "</a>"; $dellink = "<a href='index.php?op=delfile&fileid=" . $fileid . "'>" . _AM_DELETE . "</a>"; echo "<tr><td align='center'><b>" . $fileid . "</b>"; echo "</td><td align='center'>" . $iconshow . ""; echo "</td><td align='center'>" . $filename . ""; echo "</td><td align='center'>" . $filerealname . ""; echo "</td><td align='center'>" . $linkedname . ""; echo "</td><td align='center'>" . $mimeshow . ""; echo "</td><td align='center'>" . $size . ""; //echo "</td><td align='center' class='nw'>".$counter.""; echo "</td><td align='center'>" . $editlink . " " . $dellink . ""; echo "</td></tr>"; } echo "</table>"; } else { echo "<div align='left'>" . _WFS_NOFILE . "</div>"; } echo "</div><br />"; echo "<div class = 'bg3'><h4>" . _WFS_MISCSETTINGS . "</h4></div>"; echo "<input type='checkbox' name='autodate' value='1'"; if (isset($autodate) && $autodate == 1) { echo " checked='checked'"; } echo "> "; $time = time(); if (!empty($this->articleid)) { $isedit = 1; } if (isset($isedit) && $isedit == 1 && $this->published > $time) { echo "<b>" . _AM_CHANGEDATETIME . "</b><br /><br />"; printf(_AM_NOWSETTIME, formatTimestamp($this->published)); $published = xoops_getUserTimestamp($this->published); echo "<br /><br />"; printf(_AM_CURRENTTIME, formatTimestamp($time)); echo "<br />"; echo "<input type='hidden' name='isedit' value='1' />"; } else { echo "<b>" . _AM_SETDATETIME . "</b><br /><br />"; printf(_AM_CURRENTTIME, formatTimestamp($time)); echo "<br />"; } echo "<br /> " . _AM_MONTHC . " <select name='automonth'>"; if (isset($automonth)) { $automonth = intval($automonth); } elseif (isset($this->published)) { $automonth = date('m', $this->published); } else { $automonth = date('m'); } for ($xmonth = 1; $xmonth < 13; $xmonth++) { if ($xmonth == $automonth) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>"; } echo "</select> "; echo _AM_DAYC . " <select name='autoday'>"; if (isset($autoday)) { $autoday = intval($autoday); } elseif (isset($published)) { $autoday = date('d', $this->published); } else { $autoday = date('d'); } for ($xday = 1; $xday < 32; $xday++) { if ($xday == $autoday) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xday}' {$sel}>{$xday}</option>"; } echo "</select> "; echo _AM_YEARC . " <select name='autoyear'>"; if (isset($autoyear)) { $autoyear = intval($autoyear); } elseif (isset($this->published)) { $autoyear = date('Y', $this->published); } else { $autoyear = date('Y'); } $cyear = date('Y'); for ($xyear = $autoyear - 8; $xyear < $cyear + 2; $xyear++) { if ($xyear == $autoyear) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xyear}' {$sel}>{$xyear}</option>"; } echo "</select>"; echo " " . _AM_TIMEC . " <select name='autohour'>"; if (isset($autohour)) { $autohour = intval($autohour); } elseif (isset($this->publishedshed)) { $autohour = date('H', $this->published); } else { $autohour = date('H'); } for ($xhour = 0; $xhour < 24; $xhour++) { if ($xhour == $autohour) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xhour}' {$sel}>{$xhour}</option>"; } echo "</select>"; echo " : <select name='automin'>"; if (isset($automin)) { $automin = intval($automin); } elseif (isset($published)) { $automin = date('i', $published); } else { $automin = date('i'); } for ($xmin = 0; $xmin < 61; $xmin++) { if ($xmin == $automin) { $sel = 'selected="selected"'; } else { $sel = ''; } $xxmin = $xmin; if ($xxmin < 10) { $xxmin = "{$xmin}"; } echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>"; } echo "</select></br />"; echo "<br /><input type='checkbox' name='autoexpdate' value='1'"; if (isset($autoexpdate) && $autoexpdate == 1) { echo " checked='checked'"; } echo "> "; $time = time(); if (isset($isedit) && $isedit == 1 && $this->expired > 0) { echo "<b>" . _AM_CHANGEEXPDATETIME . "</b><br /><br />"; printf(_AM_NOWSETEXPTIME, formatTimestamp($this->expired)); echo "<br /><br />"; $expired = xoops_getUserTimestamp($this->expired); printf(_AM_CURRENTTIME, formatTimestamp($time)); echo "<br />"; echo "<input type='hidden' name='isedit' value='1' />"; } else { echo "<b>" . _AM_SETEXPDATETIME . "</b><br /><br />"; printf(_AM_CURRENTTIME, formatTimestamp($time)); echo "<br />"; } echo "<br /> " . _AM_MONTHC . " <select name='autoexpmonth'>"; if (isset($autoexpmonth)) { $autoexpmonth = intval($autoexpmonth); } elseif (isset($expired)) { $autoexpmonth = date('m', $expired); } else { $autoexpmonth = date('m'); $autoexpmonth = $autoexpmonth + 1; } for ($xmonth = 1; $xmonth < 13; $xmonth++) { if ($xmonth == $autoexpmonth) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xmonth}' {$sel}>{$xmonth}</option>"; } echo "</select> "; echo _AM_DAYC . " <select name='autoexpday'>"; if (isset($autoexpday)) { $autoexpday = intval($autoexpday); } elseif (isset($expired)) { $autoexpday = date('d', $expired); } else { $autoexpday = date('d'); } for ($xday = 1; $xday < 32; $xday++) { if ($xday == $autoexpday) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xday}' {$sel}>{$xday}</option>"; } echo "</select> "; echo _AM_YEARC . " <select name='autoexpyear'>"; if (isset($autoexpyear)) { $autoyear = intval($autoexpyear); } elseif (isset($expired)) { $autoexpyear = date('Y', $expired); } else { $autoexpyear = date('Y'); } $cyear = date('Y'); for ($xyear = $autoexpyear - 8; $xyear < $cyear + 2; $xyear++) { if ($xyear == $autoexpyear) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xyear}' {$sel}>{$xyear}</option>"; } echo "</select>"; echo " " . _AM_TIMEC . " <select name='autoexphour'>"; if (isset($autoexphour)) { $autoexphour = intval($autoexphour); } elseif (isset($expired)) { $autoexphour = date('H', $expired); } else { $autoexphour = date('H'); } for ($xhour = 0; $xhour < 24; $xhour++) { if ($xhour == $autoexphour) { $sel = 'selected="selected"'; } else { $sel = ''; } echo "<option value='{$xhour}' {$sel}>{$xhour}</option>"; } echo "</select>"; echo " : <select name='autoexpmin'>"; if (isset($autoexpmin)) { $autoexpmin = intval($autoexpmin); } elseif (isset($expired)) { $autoexpmin = date('i', $expired); } else { $autoexpmin = date('i'); } for ($xmin = 0; $xmin < 61; $xmin++) { if ($xmin == $autoexpmin) { $sel = 'selected="selected"'; } else { $sel = ''; } $xxmin = $xmin; if ($xxmin < 10) { $xxmin = "0{$xmin}"; } echo "<option value='{$xmin}' {$sel}>{$xxmin}</option>"; } echo "</select><br /><br />"; if (isset($this->published) && $this->published == 0 && isset($this->type) && $this->type == "user") { echo "<div><input type='checkbox' name='approved' value='1' checked='checked'> <b>" . _AM_APPROVE . "</b></div><br />"; } echo "<br /><div><input type='checkbox' name='nosmiley' value='1'"; if (isset($this->nosmiley) && $this->nosmiley == 1) { echo " checked='checked'"; } echo " /> <b>" . _WFS_DISAMILEY . "</b></div>"; echo "<div><input type='checkbox' name='nohtml' value='1'"; if (isset($this->nohtml) && $this->nohtml == 1) { echo " checked='checked'"; } echo " /> <b>" . _WFS_DISHTML . "</b><br />"; echo "</div><br />"; if (isset($isedit) && $isedit == 1) { echo "<input type='checkbox' name='movetotop' value='1'"; if (isset($movetotop) && $movetotop == 1) { echo " checked='checked'"; } echo " /> <b>" . _AM_MOVETOTOP . "</b><br />"; } echo "<br /><div><input type='checkbox' name='justhtml' value='2'"; if (isset($this->htmlpage) && $this->ishtml == '2') { echo " checked='checked'"; } echo " />" . _AM_JUSTHTML . "<br /></div>"; echo "<div><input type='checkbox' name='noshowart' value='1'"; if (isset($this->noshowart) && $this->noshowart == 1) { echo " checked='checked'"; } echo " /> " . _AM_NOSHOART . "<br />"; echo "</div><br />"; echo "<input type='checkbox' name='offline' value='1'"; if (isset($this->offline) && $this->offline == 1) { echo " checked='checked'"; } echo " /> " . _AM_OFFLINE . "<br />"; echo "<br />"; if (!empty($this->articleid)) { echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />\n"; } if (!empty($HTTP_POST_VARS['referer'])) { echo "<input type='hidden' name='referer' value='" . $HTTP_POST_VARS['referer'] . "' />\n"; } elseif (!empty($HTTP_SERVER_VARS['HTTP_REFERER'])) { echo "<input type='hidden' name='referer' value='" . $HTTP_SERVER_VARS['HTTP_REFERER'] . "' />\n"; } echo "<input type='submit' name='op' class='formButton' value='Preview' /> <input type='submit' name='op' class='formButton' value='Save' /> <input type='submit' name='op' class='formButton' value='Clean' />"; echo "</form>"; echo "</td></tr></table>"; if (!empty($this->articleid)) { echo "<hr />"; $upload = new UploadFile(); echo $upload->formStart("index.php?op=fileup"); echo "<h4>" . _WFS_FILEUPLOAD . "</h4>\n"; echo "" . _WFS_ATTACHFILEACCESS . "<br />"; echo "<br /><b>" . _WFS_ATTACHFILE . "</b><br />"; echo $upload->formMax(); echo $upload->formField(); echo "<br /><br /><b>" . _WFS_FILESHOWNAME . "</b><br />"; echo "<input type='text' name='fileshowname' id='fileshowname' value='"; if (isset($this->fileshowname)) { echo $this->fileshowname; } echo "' size='70' maxlength='80' /><br />"; echo "<br /><b>" . _WFS_FILEDESCRIPT . "</b><br />"; echo "<textarea name='textfiledescript' cols='50' rows='5'></textarea><br />"; echo "<br /><b>" . _WFS_FILETEXT . "</b><br />"; echo "<textarea name='textfilesearch' cols='50' rows='3'></textarea><br />"; echo "<input type='hidden' name='groupid' value='" . $this->groupip . "' />"; echo "<input type='hidden' name='articleid' value='" . $this->articleid . "' />"; echo "<input type='hidden' name='groupid' value= '" . $this->groupid . "' />"; echo $upload->formSubmit(_WFS_UPLOAD); echo $upload->formEnd(); } }
function getForm($action = false) { global $xoopsDB, $xoopsModule, $xoopsModuleConfig; if ($action === false) { $action = $_SERVER['REQUEST_URI']; } $title = $this->isNew() ? sprintf(_AM_TDMCREATE_MODULES_ADD) : sprintf(_AM_TDMCREATE_MODULES_EDIT); include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; $form = new XoopsThemeForm($title, 'form_modules', $action, 'post', true); $form->setExtra('enctype="multipart/form-data"'); $form->insertBreak('<div align="center"><b>' . _AM_TDMCREATE_MODULES_IMPORTANT . '</b></div>', 'head'); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_NAME, 'modules_name', 50, 255, $this->getVar('modules_name')), true); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_VERSION, 'modules_version', 50, 255, $this->getVar('modules_version')), true); $form->addElement(new XoopsFormTextArea(_AM_TDMCREATE_MODULES_DESCRIPTION, 'modules_description', $this->getVar('modules_description'), 3, 47), true); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR, 'modules_author', 50, 255, $this->getVar('modules_author')), true); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_LICENSE, 'modules_license', 50, 255, $this->getVar('modules_license')), true); $modules_display_menu = $this->isNew() ? '1' : $this->getVar('modules_display_menu'); $form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_DISPLAY_MENU, 'modules_display_menu', $modules_display_menu, _YES, _NO)); $modules_display_admin = $this->isNew() ? '1' : $this->getVar('modules_display_admin'); $form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_DISPLAY_ADMIN, 'modules_display_admin', $modules_display_admin, _YES, _NO)); $modules_active_search = $this->isNew() ? '1' : $this->getVar('modules_active_search'); $form->addElement(new XoopsFormRadioYN(_AM_TDMCREATE_MODULES_ACTIVE_SEARCH, 'modules_active_search', $modules_active_search, _YES, _NO)); $modules_image = $this->getVar('modules_image') ? $this->getVar('modules_image') : 'blank.gif'; $uploadirectory = "/modules/" . $xoopsModule->dirname() . "/images/uploads/modules"; $imgtray = new XoopsFormElementTray(_AM_TDMCREATE_MODULES_IMAGE, '<br />'); $imgpath = sprintf(_AM_TDMCREATE_FORMIMAGE_PATH, "./modules/" . $xoopsModule->dirname() . "/images/uploads/modules"); $imageselect = new XoopsFormSelect($imgpath, 'modules_image', $modules_image); $modules_image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadirectory); foreach ($modules_image_array as $image) { $imageselect->addOption("{$image}", $image); } $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"modules_image\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'"); $imgtray->addElement($imageselect, false); $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $modules_image . "' name='image3' id='image3' alt='' />")); $fileseltray = new XoopsFormElementTray('', '<br />'); $fileseltray->addElement(new XoopsFormFile(_AM_TDMCREATE_FORMUPLOAD, 'attachedfile', 104857600), false); $fileseltray->addElement(new XoopsFormLabel(''), false); $imgtray->addElement($fileseltray); $form->addElement($imgtray); $form->insertBreak('<div align="center"><b>' . _AM_TDMCREATE_MODULES_NOTIMPORTANT . '</b></div>', 'head'); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR_WEBSITE_URL, 'modules_author_website_url', 50, 255, $this->getVar('modules_author_website_url')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_AUTHOR_WEBSITE_NAME, 'modules_author_website_name', 50, 255, $this->getVar('modules_author_website_name')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_CREDITS, 'modules_credits', 50, 255, $this->getVar('modules_credits')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE_INFO, 'modules_release_info', 50, 255, $this->getVar('modules_release_info')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE_FILE, 'modules_release_file', 50, 255, $this->getVar('modules_release_file')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MANUAL, 'modules_manual', 50, 255, $this->getVar('modules_manual')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MANUAL_FILE, 'modules_manual_file', 50, 255, $this->getVar('modules_manual_file')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_DEMO_SITE_URL, 'modules_demo_site_url', 50, 255, $this->getVar('modules_demo_site_url')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_DEMO_SITE_NAME, 'modules_demo_site_name', 50, 255, $this->getVar('modules_demo_site_name')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MODULE_WEBSITE_URL, 'modules_module_website_url', 50, 255, $this->getVar('modules_module_website_url')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_MODULE_WEBSITE_NAME, 'modules_module_website_name', 50, 255, $this->getVar('modules_module_website_name')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_RELEASE, 'modules_release', 50, 255, $this->getVar('modules_release')), false); $form->addElement(new XoopsFormText(_AM_TDMCREATE_MODULES_STATUS, 'modules_module_status', 50, 255, $this->getVar('modules_module_status')), false); $form->addElement(new XoopsFormHidden('op', 'modules_save')); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); $form->display(); return $form; }
$sform->addElement(new XoopsFormText(_AM_XLANG_DESC, 'lang_desc', 50, 255, $lang_desc)); $sform->addElement(new XoopsFormText(_AM_XLANG_CHARSET, 'lang_charset', 50, 255, $lang_charset), true); $sform->addElement(new XoopsFormText(_AM_XLANG_CODE, 'lang_code', 50, 255, $lang_code), true); if (!$isBase) { $baseList =& $xlanguage_handler->getAll(); $base_list = array(); foreach ($baseList as $base => $baselang) { $base_list[$base] = $base; } $base_select = new XoopsFormSelect(_AM_XLANG_BASE, 'lang_base', $lang_base); $base_select->addOptionArray($base_list); $sform->addElement($base_select, true); } $sform->addElement(new XoopsFormText(_AM_XLANG_WEIGHT, 'weight', 10, 10, $weight)); $image_option_tray = new XoopsFormElementTray(_AM_XLANG_IMAGE, ''); $image_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . "/images/"); $lang_image = empty($lang_image) ? 'noflag.gif' : $lang_image; $image_select = new XoopsFormSelect('', 'lang_image', $lang_image); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image\", \"lang_image\", \"/modules/" . $xoopsModule->dirname() . "/images/\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray('', ' '); $image_tray->addElement($image_select); if (!empty($lang_image)) { $image_tray->addElement(new XoopsFormLabel('', "<div style='padding: 8px;'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/" . $lang_image . "' name='image' id='image' alt='' /></div>")); } else { $image_tray->addElement(new XoopsFormLabel('', "<div style='padding: 8px;'><img src='" . XOOPS_URL . "/images/blank.gif' name='image' id='image' alt='' /></div>")); } $image_option_tray->addElement($image_tray); $sform->addElement($image_option_tray); if (isset($lang_id)) { $sform->addElement(new XoopsFormHidden('lang_id', $lang_id));
function topicsmanager() { global $xoopsModule, $xoopsModuleConfig, $xoopsDB; include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php"; //$uploadfolder=sprintf(_AMS_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule -> dirname().'/images/topics'); $uploadirectory = "/modules/" . $xoopsModule->dirname() . '/images/topics'; $start = isset($_GET['start']) ? intval($_GET['start']) : 0; include_once XOOPS_ROOT_PATH . "/class/tree.php"; $xt = new AmsTopic($xoopsDB->prefix("ams_topics")); $allTopics = $xt->getAllTopics(); $totaltopics = count($allTopics); if ($totaltopics > 0) { $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid'); $topics_arr = $topic_obj_tree->getAllChild(0); } echo "<form action='index.php' method='POST'>"; echo "<div class=\"odd\">"; echo "<div style='text-align: center;'><b>" . _AMS_AM_TOPICSMNGR . ' (' . ($start + 1) . '-' . ($start + $xoopsModuleConfig['storycountadmin'] > $totaltopics ? $totaltopics : $start + $xoopsModuleConfig['storycountadmin']) . ' ' . _AMS_AM_OF . ' ' . $totaltopics . ')' . "</b><br /><br />"; echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AMS_AM_TOPIC . "</td><td align='left'>" . _AMS_AM_TOPICNAME . "</td><td align='center'>" . _AMS_AM_PARENTTOPIC . "</td><td> " . _AMS_AM_WEIGHT . " </td><td align='center'>" . _AMS_AM_ACTION . "</td></tr>"; //If topic not empty if ($totaltopics > 0) { $i = 0; foreach ($topics_arr as $thisTopic) { $i++; if ($i > $start && $i - $start <= $xoopsModuleConfig['storycountadmin']) { $linkedit = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=topicsmanager&topic_id=' . $thisTopic->topic_id(); $linkdelete = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=delTopic&topic_id=' . $thisTopic->topic_id(); $action = sprintf("<a href='%s'>%s</a> - <a href='%s'>%s</a>", $linkedit, _AMS_AM_EDIT, $linkdelete, _AMS_AM_DELETE); $parent = ' '; $pid = $thisTopic->topic_pid(); if ($pid > 0) { $parent = $topics_arr[$pid]->topic_title(); $thisTopic->prefix = str_replace(".", "-", $thisTopic->prefix) . ' '; } else { $thisTopic->prefix = str_replace(".", "", $thisTopic->prefix); } echo "<tr><td>" . $thisTopic->topic_id() . "</td><td align='left'>" . $thisTopic->prefix() . $thisTopic->topic_title() . "</td><td align='left'>" . $parent . "</td><td align='center'><input type='text' name='weight[" . $thisTopic->topic_id() . "]' value='" . $thisTopic->weight . "' size='10' maxlength='10' /> </td><td>" . $action . "</td></tr>"; } } echo "<tr><td colspan='3'></td><td><input type='hidden' name='op' value='reorder' />\r\n <input type='submit' name='submit' value='" . _AMS_AM_SUBMIT . "' /></td><td></td></tr>"; } echo "</table></div></div></form>"; if ($totaltopics > $xoopsModuleConfig['storycountadmin']) { $pagenav = new XoopsPageNav($totaltopics, $xoopsModuleConfig['storycountadmin'], $start, 'start', 'op=topicsmanager'); echo "<div align='right'>"; echo $pagenav->renderNav() . '</div><br />'; } $topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : 0; if ($topic_id > 0) { $xtmod = $topics_arr[$topic_id]; $topic_title = $xtmod->topic_title('E'); $op = 'modTopicS'; if (trim($xtmod->topic_imgurl()) != '') { $topicimage = $xtmod->topic_imgurl(); } else { $topicimage = "blank.png"; } $btnlabel = _AMS_AM_MODIFY; $parent = $xtmod->topic_pid(); $formlabel = _AMS_AM_MODIFYTOPIC; $banner = $xtmod->banner; $banner_inherit = $xtmod->banner_inherit; $forum = $xtmod->forum_id; unset($xtmod); } else { $topic_title = ''; $op = 'addTopic'; $topicimage = 'xoops.gif'; $btnlabel = _AMS_AM_ADD; $parent = 0; $formlabel = _AMS_AM_ADD_TOPIC; $banner = ''; $banner_inherit = 0; $forum = 0; } $sform = new XoopsThemeForm($formlabel, "topicform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php', 'post'); $sform->setExtra('enctype="multipart/form-data"'); $sform->addElement(new XoopsFormText(_AMS_AM_TOPICNAME . ' ' . _AMS_AM_MAX40CHAR, 'topic_title', 40, 50, $topic_title), true); $sform->addElement(new XoopsFormHidden('op', $op), false); $sform->addElement(new XoopsFormHidden('topic_id', $topic_id), false); if ($totaltopics > 0) { $sform->addElement(new XoopsFormLabel(_AMS_AM_PARENTTOPIC, $topic_obj_tree->makeSelBox('topic_pid', 'topic_title', '--', $parent, true))); } else { $sform->addElement(new XoopsFormHidden('topic_pid', 0)); } // ********** Picture $imgtray = new XoopsFormElementTray(_AMS_AM_TOPICIMG, '<br />'); $imgpath = sprintf(_AMS_AM_IMGNAEXLOC, "modules/" . $xoopsModule->dirname() . "/images/topics/"); $imageselect = new XoopsFormSelect($imgpath, 'topic_imgurl', $topicimage); $topics_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/AMS/images/topics/"); foreach ($topics_array as $image) { $imageselect->addOption("{$image}", $image); } $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"topic_imgurl\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'"); $imgtray->addElement($imageselect, false); $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $topicimage . "' name='image3' id='image3' alt='' />")); $uploadfolder = sprintf(_AMS_AM_UPLOAD_WARNING, XOOPS_URL . "/modules/" . $xoopsModule->dirname() . '/images/topics'); $fileseltray = new XoopsFormElementTray('', '<br />'); $fileseltray->addElement(new XoopsFormFile(_AMS_AM_TOPIC_PICTURE, 'attachedfile', $xoopsModuleConfig['maxuploadsize']), false); $fileseltray->addElement(new XoopsFormLabel($uploadfolder), false); $imgtray->addElement($fileseltray); $sform->addElement($imgtray); //Forum linking $module_handler =& xoops_gethandler('module'); $forum_module =& $module_handler->getByDirname('newbb'); if (is_object($forum_module) && $forum_module->getVar('version') >= 200) { $forum_handler =& xoops_getmodulehandler('forum', 'newbb', true); if (is_object($forum_handler)) { $forums = $forum_handler->getForums(); if (count($forums) > 0) { $forum_tree = new XoopsObjectTree($forums, 'forum_id', 'parent_forum'); $sform->addElement(new XoopsFormLabel(_AMS_AM_LINKEDFORUM, $forum_tree->makeSelBox('forum_id', 'forum_name', '--', $forum, true))); } } } //Banner $sform->addElement(new XoopsFormDhtmlTextArea(_AMS_AM_TOPICBANNER, 'banner', $banner)); $inherit_checkbox = new XoopsFormCheckBox(_AMS_AM_BANNERINHERIT, 'banner_inherit', $banner_inherit); $inherit_checkbox->addOption(1, _YES); $sform->addElement($inherit_checkbox); //Added in AMS 2.50 Final. Use News 1.62 permission style //Enhance in AMS 3.0 Beta 1. Add default permission for approval=admin, submit=admin,User. // Permissions $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $gperm_handler =& xoops_gethandler('groupperm'); $group_type_ref =& $member_handler->getGroups(null, true); $admin_list = array(); $user_list = array(); $full_list = array(); $admincount = 1; $usercount = 1; $fullcount = 1; foreach (array_keys($group_type_ref) as $i) { if ($group_type_ref[$i]->getVar('group_type') == 'Admin') { $admin_list[$i] = $group_list[$i]; $admincount++; $user_list[$i] = $group_list[$i]; $usercount++; } if ($group_type_ref[$i]->getVar('group_type') == 'User') { $user_list[$i] = $group_list[$i]; $usercount++; } $full_list[$i] = $group_list[$i]; $fullcount++; } $admin_list = array_keys($admin_list); $user_list = array_keys($user_list); $full_list = array_keys($full_list); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_approve', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $groups_ids); } else { // Creation mode $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $admin_list); } $groups_AMS_can_approve_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_approve_checkbox); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_submit', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $groups_ids); } else { // Creation mode $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $user_list); } $groups_AMS_can_submit_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_submit_checkbox); $groups_ids = array(); if ($topic_id > 0) { // Edit mode $groups_ids = $gperm_handler->getGroupIds('ams_view', $topic_id, $xoopsModule->getVar('mid')); $groups_ids = array_values($groups_ids); $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $groups_ids); } else { // Creation mode $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $full_list); } $groups_AMS_can_view_checkbox->addOptionArray($group_list); $sform->addElement($groups_AMS_can_view_checkbox); // Submit buttons $button_tray = new XoopsFormElementTray('', ''); $submit_btn = new XoopsFormButton('', 'post', $btnlabel, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform->display(); }
function editclient($showmenu = false, $id = 0) { global $client_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // If there is a parameter, and the id exists, retrieve data: we're editing a client if ($id != 0) { // Creating the client object $clientObj = new SmartclientClient($id); if ($clientObj->notLoaded()) { redirect_header("client.php", 1, _AM_SCLIENT_NOCLIENTSELECTED); exit; } switch ($clientObj->status()) { case _SCLIENT_STATUS_SUBMITTED: $breadcrumb_action1 = _AM_SCLIENT_SUBMITTED_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_APPROVING; $page_title = _AM_SCLIENT_SUBMITTED_TITLE; $page_info = _AM_SCLIENT_SUBMITTED_INFO; $button_caption = _AM_SCLIENT_APPROVE; $new_status = _SCLIENT_STATUS_ACTIVE; break; case _SCLIENT_STATUS_ACTIVE: $breadcrumb_action1 = _AM_SCLIENT_ACTIVE_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_ACTIVE_EDITING; $page_info = _AM_SCLIENT_ACTIVE_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_ACTIVE; break; case _SCLIENT_STATUS_INACTIVE: $breadcrumb_action1 = _AM_SCLIENT_INACTIVE_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_INACTIVE_EDITING; $page_info = _AM_SCLIENT_INACTIVE_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_INACTIVE; break; case _SCLIENT_STATUS_REJECTED: $breadcrumb_action1 = _AM_SCLIENT_REJECTED_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_EDITING; $page_title = _AM_SCLIENT_REJECTED_EDITING; $page_info = _AM_SCLIENT_REJECTED_EDITING_INFO; $button_caption = _AM_SCLIENT_MODIFY; $new_status = _SCLIENT_STATUS_REJECTED; break; case "default": default: break; } if ($showmenu) { smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; smartclient_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . $page_title . "</h3>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $page_info . "</span>"; echo "<div id='bottomtable'>"; } else { // there's no parameter, so we're adding a client $clientObj =& $client_handler->create(); $breadcrumb_action1 = _AM_SCLIENT_CLIENTS; $breadcrumb_action2 = _AM_SCLIENT_CREATE; $button_caption = _AM_SCLIENT_CREATE; $new_status = _SCLIENT_STATUS_ACTIVE; if ($showmenu) { smartclient_adminMenu(1, $breadcrumb_action1 . " > " . $breadcrumb_action2); } smartclient_collapsableBar('bottomtable', 'bottomtableicon'); echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a> " . _AM_SCLIENT_CLIENT_CREATING . "</h3>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SCLIENT_CLIENT_CREATING_DSC . "</span>"; echo "<div id='bottomtable'>"; } // CLIENT FORM $sform = new XoopsThemeForm(_AM_SCLIENT_CLIENTS, "op", xoops_getenv('PHP_SELF')); $sform->setExtra('enctype="multipart/form-data"'); // TITLE $title_text = new XoopsFormText(_CO_SCLIENT_TITLE_REQ, 'title', 50, 255, $clientObj->title('e')); $sform->addElement($title_text, true); // LOGO $logo_array =& XoopsLists::getImgListAsArray(smartclient_getImageDir()); $logo_select = new XoopsFormSelect('', 'image', $clientObj->image()); $logo_select->addOption('-1', '---------------'); $logo_select->addOptionArray($logo_array); $logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTCLIENT_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'"); $logo_tray = new XoopsFormElementTray(_AM_SCLIENT_LOGO, ' '); $logo_tray->addElement($logo_select); $logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartclient_getImageDir('', false) . $clientObj->image() . "' name='image3' id='image3' alt='' />")); $logo_tray->setDescription(_AM_SCLIENT_LOGO_DSC); $sform->addElement($logo_tray); // LOGO UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SCLIENT_LOGO_UPLOAD, "logo_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(sprintf(_AM_SCLIENT_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height'])); $sform->addElement($file_box); // IMAGE_URL $image_url_text = new XoopsFormText(_CO_SCLIENT_IMAGE_URL, 'image_url', 50, 255, $clientObj->image_url()); $image_url_text->setDescription(_CO_SCLIENT_IMAGE_URL_DSC); $sform->addElement($image_url_text, false); // URL $url_text = new XoopsFormText(_AM_SCLIENT_URL, 'url', 50, 255, $clientObj->url()); $url_text->setDescription(_AM_SCLIENT_URL_DSC); $sform->addElement($url_text, false); // SUMMARY $summary_text = new XoopsFormTextArea(_AM_SCLIENT_SUMMARY_REQ, 'summary', $clientObj->summary(0, 'e'), 7, 60); $summary_text->setDescription(_AM_SCLIENT_SUMMARY_DSC); $sform->addElement($summary_text, true); // DESCRIPTION $description_text = new XoopsFormDhtmlTextArea(_AM_SCLIENT_DESCRIPTION, 'description', $clientObj->description(0, 'e'), 15, 60); $description_text->setDescription(_AM_SCLIENT_DESCRIPTION_DSC); $sform->addElement($description_text, false); // CONTACT_NAME $contact_name_text = new XoopsFormText(_CO_SCLIENT_CONTACT_NAME, 'contact_name', 50, 255, $clientObj->contact_name('e')); $contact_name_text->setDescription(_CO_SCLIENT_CONTACT_NAME_DSC); $sform->addElement($contact_name_text, false); // CONTACT_EMAIL $contact_email_text = new XoopsFormText(_CO_SCLIENT_CONTACT_EMAIL, 'contact_email', 50, 255, $clientObj->contact_email('e')); $contact_email_text->setDescription(_CO_SCLIENT_CONTACT_EMAIL_DSC); $sform->addElement($contact_email_text, false); // CONTACT_PHONE $contact_phone_text = new XoopsFormText(_CO_SCLIENT_CONTACT_PHONE, 'contact_phone', 50, 255, $clientObj->contact_phone('e')); $contact_phone_text->setDescription(_CO_SCLIENT_CONTACT_PHONE_DSC); $sform->addElement($contact_phone_text, false); // ADRESS //$adress_text = new XoopsFormText(_CO_SCLIENT_ADRESS, 'adress', 50, 255, $clientObj->adress('e')); $adress_text = new XoopsFormTextArea(_CO_SCLIENT_ADRESS, 'adress', $clientObj->adress('e')); $adress_text->setDescription(_CO_SCLIENT_ADRESS_DSC); $sform->addElement($adress_text, false); // STATUS $options = $clientObj->getAvailableStatus(); $status_select = new XoopsFormSelect(_AM_SCLIENT_STATUS, 'status', $new_status); $status_select->addOptionArray($options); $status_select->setDescription(_AM_SCLIENT_STATUS_DSC); $sform->addElement($status_select); // WEIGHT $weight_text = new XoopsFormText(_AM_SCLIENT_WEIGHT, 'weight', 4, 4, $clientObj->weight()); $weight_text->setDescription(_AM_SCLIENT_WEIGHT_DSC); $sform->addElement($weight_text); // Client id $sform->addElement(new XoopsFormHidden('id', $clientObj->id())); $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'addclient'); $button_tray->addElement($hidden); $sform->addElement(new XoopsFormHidden('original_status', $clientObj->status())); if (!$id) { // there's no id? Then it's a new client // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_CREATE, 'submit' ) ); $butt_create = new XoopsFormButton('', '', _AM_SCLIENT_CREATE, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"'); $button_tray->addElement($butt_create); $butt_clear = new XoopsFormButton('', '', _AM_SCLIENT_CLEAR, 'reset'); $button_tray->addElement($butt_clear); $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } else { // else, we're editing an existing client // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SCLIENT_MODIFY, 'submit' ) ); $butt_create = new XoopsFormButton('', '', $button_caption, 'submit'); $butt_create->setExtra('onclick="this.form.elements.op.value=\'addclient\'"'); $button_tray->addElement($butt_create); $butt_cancel = new XoopsFormButton('', '', _AM_SCLIENT_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); } $sform->addElement($button_tray); $sform->display(); unset($hidden); echo "</div>"; }
function ModifyCar() { global $xoopsDB; $idc = $_POST['idc']; $ids = $_POST['ids']; if ($idc <= 0) { header('location: services.php'); die; } include 'functions.php'; include XOOPS_ROOT_PATH . "/include/xoopscodes.php"; include_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $result = $xoopsDB->query("SELECT * FROM {$tcar} WHERE id_car='{$idc}'"); $num = $xoopsDB->getRowsNum($result); if ($num <= 0) { redirect_header('services.php', 1, _AM_CARNOEXIST); die; } $row = $xoopsDB->fetchArray($result); xoops_cp_header(); ShowNav(); echo "<table width='80%' align='center' class='outer' cellspacing='1'>\n\n\t\t <tr><th align='left' colspan='2'>" . _AM_MODCAR . "</th></tr>\n\n\t\t <form name='frmNew' action='services.php' method='post'>\n\n\t\t <tr><td align='left' class='even'>" . _AM_FORMNAME . "</td>\n\n\t\t <td class='odd' align='left'><input value='{$row['nombre']}' type='text' size='30' name='nombre'>\n</td></tr>\n\t\t <tr><td align='left' class='even'>" . _AM_SHORTDESC . "</td>\n\n\t\t <td class='odd' align='left'><input value='{$row['shortdesc']}' type='text' size='50' name='shortdesc' maxlenght='255'>\n</td></tr>\n\t\t <tr><td class='even' align='left'>" . _AM_LONGDESC . "</td>\n\n\t\t <td class='odd' align='left'>"; $GLOBALS['longdesc'] = $row['longdesc']; xoopsCodeTarea("longdesc", 20, 15); xoopsSmilies("longdesc"); echo "</td></tr>\n\n\t\t <tr><td class='even' align='left'>" . _AM_FORMIMG . "</td>\n\n\t\t <td class='odd' align='left'><select name='img'><option value=''>--</option>\n"; $imgArray = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/rmservices/images/caracts/"); foreach ($imgArray as $image) { if ($row['img'] == $image) { echo "<option value='" . $image . "' selected>" . $image . "</option>"; } else { echo "<option value='" . $image . "'>" . $image . "</option>"; } } echo " </select></td></tr>\n\n\t\t <tr><td class='even'> </td>\n\n\t\t <td class='odd' align='left'><input type='submit' name='sbt' value='" . _AM_SEND . "'></td></tr>\n\n\t\t <input type='hidden' name='op' value='savemodcar'>\n\n\t\t <input type='hidden' name='ids' value='{$ids}'>\n\n\t\t <input type='hidden' name='idc' value='{$idc}'>\n\n\t\t </form></table>"; xoops_cp_footer(); }
//$topicselbox = ob_get_contents(); //ob_end_clean(); //ob_start(); //$BTopic->makeTopicSelBox(); //$topicselbox2 = ob_get_contents(); //ob_end_clean(); $topicselbox = $BTopic->makeTopicSelBox(true, 0, 'topic_pid'); $topicselbox2 = $BTopic->makeTopicSelBox(); $asssigns = array('gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'bulletin_admin'), 'images' => $images, 'topics_exists' => $topics_exists, 'topicselbox' => $topicselbox, 'topicselbox2' => $topicselbox2); $tpl->assign($asssigns); //$tpl->display( 'db:'.$mydirname.'_admin_category.html' ) ; break; case 'modTopic': $template = 'bulletin_modtopic.html'; $BTopic = new BulletinTopic($mydirname, $_GET['topic_id']); $topics_array = XoopsLists::getImgListAsArray($xoopsModuleConfig['topicon_path']); xoops_cp_header(); include dirname(__FILE__) . '/mymenu.php'; $images = array(); foreach ($topics_array as $v) { $images[] = array('image' => htmlspecialchars($v), 'option' => $BTopic->topic_imgurl() ? 'selected="selected"' : ''); } //ob_start(); //$BTopic->makeTopicSelBox( 1, $BTopic->topic_pid(), 'topic_pid' ); //$topicselbox = ob_get_contents(); //ob_end_clean(); $topicselbox = $BTopic->makeTopicSelBox(true, $BTopic->topic_pid(), 'topic_pid'); $asssigns = array('gticket_hidden' => $xoopsGTicket->getTicketHtml(__LINE__, 1800, 'bulletin_admin'), 'images' => $images, 'topic_id' => $BTopic->topic_id(), 'topic_pid' => $BTopic->topic_pid(), 'topic_title' => $BTopic->topic_title('E'), 'topic_imgurl' => $BTopic->topic_imgurl(), 'topic_imgdir' => str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $xoopsModuleConfig['topicon_path']), 'topicselbox' => $topicselbox); break; case 'addTopic': //ver3.0
/** * gets list of subject icon image file names in a certain directory * if directory is not specified, default directory will be searched * @param string $sub_dir * @return array */ public static function getSubjectsList($sub_dir = '') { $subjects = array(); if ($sub_dir != '') { $subjects = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/images/subject/' . $sub_dir, $sub_dir . '/'); } else { $subjects = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/images/subject/'); } return $subjects; }
function createElements() { global $xoopsDB; $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid"); // Parent Category ob_start(); $mytree->makeMySelBox("name", "weight", $this->targetObject->parentid(), 1, 'parentid'); //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="") $this->addElement(new XoopsFormLabel(_AM_SSECTION_PARENT_CATEGORY_EXP, ob_get_contents())); ob_end_clean(); // Name $this->addElement(new XoopsFormText(_AM_SSECTION_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true); // Description $this->addElement(new XoopsFormTextArea(_AM_SSECTION_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60)); if (SMARTSECTION_LEVEL > 0) { // Header $text_header = smartsection_getEditor(_AM_SSECTION_CATEGORY_HEADER, 'header', $this->targetObject->header('e')); $text_header->setDescription(_AM_SSECTION_CATEGORY_HEADER_DSC); $this->addElement($text_header); } // IMAGE $image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('category')); $image_select = new XoopsFormSelect('', 'image', $this->targetObject->image()); //$image_select -> addOption ('-1', '---------------'); $image_select->addOptionArray($image_array); $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'"); $image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE, ' '); $image_tray->addElement($image_select); $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('category', false) . $this->targetObject->image() . "' name='image3' id='image3' alt='' />")); $image_tray->setDescription(_AM_SSECTION_IMAGE_DSC); $this->addElement($image_tray); // IMAGE UPLOAD $max_size = 5000000; $file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size); $file_box->setExtra("size ='45'"); $file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_DSC); $this->addElement($file_box); if (SMARTSECTION_LEVEL > 0) { // Short url $text_short_url = new XoopsFormText(_AM_SSECTION_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e')); $text_short_url->setDescription(_AM_SSECTION_CATEGORY_SHORT_URL_DSC); $this->addElement($text_short_url); // Meta Keywords $text_meta_keywords = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60); $text_meta_keywords->setDescription(_AM_SSECTION_CATEGORY_META_KEYWORDS_DSC); $this->addElement($text_meta_keywords); // Meta Description $text_meta_description = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60); $text_meta_description->setDescription(_AM_SSECTION_CATEGORY_META_DESCRIPTION_DSC); $this->addElement($text_meta_description); } // Weight $this->addElement(new XoopsFormText(_AM_SSECTION_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight())); if (SMARTSECTION_LEVEL > 0) { // Added by skalpa: custom template support $this->addElement(new XoopsFormText("Custom template", 'template', 50, 255, $this->targetObject->template('e')), false); } // READ PERMISSIONS $groups_read_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_READ, 'groups_read[]', $this->targetObject->getGroups_read()); foreach ($this->userGroups as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_read_checkbox->addOption($group_id, $group_name); } } $this->addElement($groups_read_checkbox); // Apply permissions on all items $apply = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0; $addapplyall_radio = new XoopsFormRadioYN(_AM_SSECTION_PERMISSIONS_APPLY_ON_ITEMS, 'applyall', $apply, ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . ''); $this->addElement($addapplyall_radio); // SUBMIT PERMISSIONS $groups_submit_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $this->targetObject->getGroups_submit()); $groups_submit_checkbox->setDescription(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT_DSC); foreach ($this->userGroups as $group_id => $group_name) { if ($group_id != XOOPS_GROUP_ADMIN) { $groups_submit_checkbox->addOption($group_id, $group_name); } } $this->addElement($groups_submit_checkbox); if (SMARTSECTION_LEVEL > 0) { // Added by fx2024 // sub Categories $cat_tray = new XoopsFormElementTray(_AM_SSECTION_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 XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname), true); } $t = new XoopsFormText('', 'nb_subcats', 3, 2); $l = new XoopsFormLabel('', sprintf(_AM_SSECTION_ADD_OPT, $t->render())); $b = new XoopsFormButton('', 'submit', _AM_SSECTION_ADD_OPT_SUBMIT, 'submit'); if (!$this->targetObject->categoryid()) { $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"'); } else { $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"'); } $r = new XoopsFormElementTray(''); $r->addElement($l); $r->addElement($b); $cat_tray->addElement($r); $this->addElement($cat_tray); //End of fx2024 code } /* $module_id = $xoopsModule->getVar('mid'); $gperm_handler = &xoops_gethandler('groupperm'); $mod_perms = $gperm_handler->getGroupIds('category_moderation', $categoryid, $module_id); $moderators_select = new XoopsFormSelect('', 'moderators', $moderators, 5, true); $moderators_tray->addElement($moderators_select); $butt_mngmods = new XoopsFormButton('', '', 'Manage mods', 'button'); $butt_mngmods->setExtra('onclick="javascript:small_window(\'pop.php\', 370, 350);"'); $moderators_tray->addElement($butt_mngmods); $butt_delmod = new XoopsFormButton('', '', 'Delete mod', 'button'); $butt_delmod->setExtra('onclick="javascript:deleteSelectedItemsFromList(this.form.elements[\'moderators[]\']);"'); $moderators_tray->addElement($butt_delmod); $this->addElement($moderators_tray); */ $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid())); //$parentid = $this->targetObject->parentid('s'); //$this -> addElement( new XoopsFormHidden( 'parentid', $parentid ) ); $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount)); }
function modLink() { global $xoopsDB, $myts, $eh, $myCatTree, $xoopsModule; $linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar('dirname') . "/images/shots/"); $lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min' => 0)); //xoops_cp_header(); $result = $xoopsDB->query("SELECT cid, title, url, logourl FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE lid={$lid}") or $eh->show('0013'); list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result); if (!$title) { // all links have title so if there's no title this wasn't a vaild $lid redirect_header('index.php', 3, _MD_MYLINKS_NORECORDFOUND); exit; } $title = $myts->htmlSpecialChars($title); $url = $myts->htmlSpecialChars($url); //$url = urldecode($url); $logourl = $myts->htmlSpecialChars($logourl); //$logourl = urldecode($logourl); $result2 = $xoopsDB->query("SELECT description FROM " . $xoopsDB->prefix("mylinks_text") . " WHERE lid={$lid}"); list($description) = $xoopsDB->fetchRow($result2); $GLOBALS['description'] = $myts->htmlSpecialChars($description); echo "<h4>" . _MD_MYLINKS_WEBLINKSCONF . "</h4>" . "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>" . " <tr><th colspan='2'>" . _MD_MYLINKS_MODLINK . "</th></tr>\n" . " <tr class='odd'>\n" . " <td>\n" . " <form method='post' action='main.php' style='display: inline;'>\n" . " <table>\n" . " <tr><td>" . _MD_MYLINKS_LINKID . "</td><td style='font-weight: bold;'>{$lid}</td></tr>\n" . " <tr><td>" . _MD_MYLINKS_SITETITLE . "</td><td><input type='text' name='title' value='{$title}' size='50' maxlength='100' /></td></tr>\n" . "\t\t\t<tr><td>" . _MD_MYLINKS_SITEURL . "</td><td><input type='text' name='url' value='{$url}' size='50' maxlength='250' /></td></tr>\n" . " <tr><td style='vertical-align: top;'>" . _MD_MYLINKS_DESCRIPTIONC . "</td><td>"; xoopsCodeTarea("description", 60, 8); xoopsSmilies("description"); echo "</td></tr>\n" . "\t\t\t<tr><td>" . _MD_MYLINKS_CATEGORYC . "</td><td>" . "" . $myCatTree->makeSelBox("cid", "title", '- ', $cid) . "" . " </td></tr>\n" . "\t\t\t<tr><td>" . _MD_MYLINKS_SHOTIMAGE . "</td><td>" . "<select size='1' name='logourl'>" . "<option value=' '>------</option>"; foreach ($linkimg_array as $image) { $opt_selected = $image == $logourl ? " selected='selected'" : ''; echo "<option value='{$image}'{$opt_selected}>{$image}</option>"; } echo "</select>" . "</td></tr>\n"; $shotdir = "<strong>" . XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/images/shots/</strong>"; echo " <tr><td> </td><td>" . sprintf(_MD_MYLINKS_SHOTMUST, $shotdir) . "</td></tr>\n" . " </table>" . " <br /><br /><input type='hidden' name='lid' value='{$lid}' />\n" . " <input type='hidden' name='op' value='modLinkS' />\n" . " <input type='submit' value='" . _MD_MYLINKS_MODIFY . "' />" . " </form>\n" . "\t\t<form action='main.php?op=delLink&lid={$lid}' method='post' style='margin-left: 1em; display: inline;'><input type='submit' value='" . _DELETE . "' /></form>\n" . "\t\t<form action='main.php?op=linksConfigMenu' method='post' style='margin-left: 1em; display: inline;'><input type='submit' value='" . _CANCEL . "' /></form>\n" . " <hr />"; $result5 = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid='{$lid}'"); list($totalvotes) = $xoopsDB->fetchRow($result5); echo " <table style='width: 100%;'>\n" . " <tr><td colspan='7' style='font-weight: bold;'>" . sprintf(_MD_MYLINKS_TOTALVOTES, $totalvotes) . "<br /><br /></td></tr>\n"; // Show Registered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid='{$lid}' AND ratinguser >0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo " <tr><td colspan='7' style='font-weight: bold;'><br /><br />" . sprintf(_MD_MYLINKS_USERTOTALVOTES, $votes) . "<br /><br /></td></tr>\n"; echo " <tr>\n" . " <th>" . _MD_MYLINKS_USER . " </th>\n" . " <th>" . _MD_MYLINKS_IP . " </th>\n" . " <th>" . _MD_MYLINKS_RATING . " </th>\n" . "\t\t\t<th>" . _MD_MYLINKS_USERAVG . " </th>\n" . " <th>" . _MD_MYLINKS_TOTALRATE . " </th>\n" . " <th>" . _MD_MYLINKS_DATE . " </th>\n" . " <th>" . _DELETE . "</td>\n" . " </tr>\n"; if (0 == $votes) { echo " <tr><td style='text-align: center;' colspan='7'>" . _MD_MYLINKS_NOREGVOTES . "<br /></td></tr>\n"; } $x = 0; $colorswitch = "#DDDDDD"; while (list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { // $ratingtimestamp = formatTimestamp($ratingtimestamp); //Individual user information //v3.11 changed to let SQL do calculations instead of PHP $result2 = $xoopsDB->query("SELECT COUNT(), FORMAT(AVG(rating),2) FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE ratinguser = '******'"); list($uservotes, $useravgrating) = $xoopsDB->fetchRow($result2); // $useravgrating = ($rating2) ? sprintf("%01.2f", ($useravgrating / $uservotes)) : 0; /* $result2=$xoopsDB->query("SELECT rating FROM ".$xoopsDB->prefix("mylinks_votedata")." WHERE ratinguser = '******'"); $uservotes = $xoopsDB->getRowsNum($result2); $useravgrating = 0; while ( list($rating2) = $xoopsDB->fetchRow($result2) ) { $useravgrating = $useravgrating + $rating2; } $useravgrating = sprintf("%01.2f", ($useravgrating / $uservotes)); */ $ratingusername = XoopsUser::getUnameFromId($ratinguser); echo " <tr>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$ratingusername}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$ratinghostname}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$rating}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$useravgrating}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$uservotes}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$ratingtimestamp}</td>\n" . " \t\t<td style='background-color: {$colorswitch}; text-align: center; font-weight: bold;'>\n" . " \t <form action='main.php?op=delVote&lid={$lid}&rid={$ratingid}' method='post'><input type='submit' value='X' /></form>\n" . " \t\t</td>\n" . " \t </tr>\n"; $x++; $colorswitch = $colorswitch == "#DDDDDD" ? "#FFFFFF" : "#DDDDDD"; } // Show Unregistered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid ='{$lid}' AND ratinguser='******' ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo " <tr><td colspan='7' style='font-weight: bold;'><br /><br />" . sprintf(_MD_MYLINKS_ANONTOTALVOTES, $votes) . "<br /><br /></td></tr>\n" . " <tr>\n" . " <th colspan='2'>" . _MD_MYLINKS_IP . " </th>\n" . "\t\t <th colspan='3' style='font-weight: bold;'>" . _MD_MYLINKS_RATING . " </th>\n" . "\t\t\t<th style='font-weight: bold;'>" . _MD_MYLINKS_DATE . " </th>\n" . " <th style='text-align: center; font-weight: bold;'>" . _DELETE . "<br /></th>\n" . " </tr>\n"; if (0 == $votes) { echo " <tr><td colspan='7' style='text-align: center;'>" . _MD_MYLINKS_NOUNREGVOTES . "<br /></td></tr>\n"; } $x = 0; $colorswitch = "#DDDDDD"; while (list($ratingid, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { $formatted_date = formatTimestamp($ratingtimestamp); echo " <tr>\n" . " <td colspan='2' style='background-color: {$colorswitch}'>{$ratinghostname}</td>\n" . " <td colspan='3' style='background-color: {$colorswitch}'>{$rating}</td>\n" . " <td style='background-color: {$colorswitch}'>{$formatted_date}</td>\n" . " <td style='background-color: {$colorswitch} text-align: center; font-weight: bold;'>\n" . " <form action='main.php?op=delVote&lid={$lid}&rid={$ratingid}' method='post'><input type='submit' value='X' /></form>\n" . " </td>" . " </tr>"; $x++; $colorswitch = $colorswitch == "#DDDDDD" ? "#FFFFFF" : "#DDDDDD"; } echo " <tr><td colspan='7'> <br /></td></tr>\n" . " </table>\n" . " </td>\n" . " </tr>\n" . "</table>\n"; include 'footer.php'; }
function &getSubjectsList($sub_dir = "") { $subjects = array(); if ($sub_dir != "") { $subjects =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/images/subject/" . $sub_dir, $sub_dir . "/"); } else { $subjects =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/images/subject/"); } return $subjects; }
/** * @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); } }