示例#1
0
 function greenepForm($action = false)
 {
     global $xoopsModuleConfig;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $title = $this->isNew() ? _AM_CATALOG_ADD_GREENEP : _AM_CATALOG_EDIT_GREENEP;
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     $form->addElement(new XoopsFormText(_AM_CATALOG_GREENEP_RANK, 'greenep_rank', 60, 255, $this->getVar('greenep_rank')), true);
     $logo_image = new XoopsFormElementTray(_AM_CATALOG_GREENLOGO);
     if ($this->getVar('greenep_id')) {
         $logo_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . "/uploads/" . $this->getVar('greenep_logo') . '" width="100"><br><br>'));
         $display = _AM_CATALOG_REUPLOAD;
     } else {
         $display = '';
     }
     $logo_image->addElement(new XoopsFormFile('', 'greenep_logo', 1024 * 1024 * 2));
     $logo_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($logo_image);
     $form->addElement(new XoopsFormText(_AM_CATALOG_SORT, 'greenep_weight', 40, 60, $this->getVar('greenep_weight')));
     $form->addElement(new XoopsFormHidden('greenep_id', $this->getVar('greenep_id')));
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#2
0
 function brandForm($action = false)
 {
     global $xoopsModuleConfig;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $country_handler = xoops_getmodulehandler('country', 'catalog');
     $title = $this->isNew() ? _AM_CATALOG_ADDBRAND : _AM_CATALOG_UPDATEBRAND;
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     $form->addElement(new XoopsFormText(_AM_CATALOG_BRANDNAME, 'brand_name', 60, 255, $this->getVar('brand_name')), true);
     $countys =& $country_handler->getList();
     $county_select = new XoopsFormSelect(_AM_CATALOG_CHOICECOUNTRY, "country_id", $this->getVar("country_id"));
     $county_select->addOption('', _AM_CATALOG_CHOICE);
     $county_select->addOptionArray($countys);
     $form->addElement($county_select);
     $configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '150px', 'value' => $this->getVar('brand_description'));
     $form->addElement(new XoopsFormEditor(_AM_CATALOG_BRANDDESC, 'brand_description', $configs, $nohtml = false, $OnFailure = ""));
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('brand_published', time()));
     }
     $form->addElement(new XoopsFormHidden('brand_id', $this->getVar('brand_id')));
     $form->addElement(new XoopsFormHidden('ac', 'save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#3
0
 /**
  * Get form
  *
  * @param bool|mixed $action
  * @return XoopsThemeForm
  */
 public function getFormInfofields($action = false)
 {
     global $xoopsUser;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     // Title
     $title = $this->isNew() ? sprintf(_AM_WGTEAMS_INFOFIELD_ADD) : sprintf(_AM_WGTEAMS_INFOFIELD_EDIT);
     // Get Theme Form
     xoops_load('XoopsFormLoader');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     // Infofields handler
     //$infofieldsHandler = $this->wgteams->getHandler('infofields');
     // Form Text AddField_name
     $form->addElement(new XoopsFormText(_AM_WGTEAMS_INFOFIELD_NAME, 'infofield_name', 50, 255, $this->getVar('infofield_name')), true);
     // Form Select User
     $submitter = $this->isNew() ? $xoopsUser->getVar('uid') : $this->getVar('infofield_submitter');
     $form->addElement(new XoopsFormSelectUser(_AM_WGTEAMS_SUBMITTER, 'infofield_submitter', false, $submitter, 1, false));
     // Form Text Date Select
     $form->addElement(new XoopsFormTextDateSelect(_AM_WGTEAMS_DATE_CREATE, 'infofield_date_created', '', $this->getVar('infofield_date_created')));
     // Send
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
     return $form;
 }
示例#4
0
 function getForm($action = false)
 {
     global $xoopsModuleConfig;
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $linkusers_handler =& xoops_getmodulehandler('linkusers', 'support');
     $member_handler =& xoops_gethandler('member');
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? _MA_SUPPORT_ADDCAT : _MA_SUPPORT_UPDATECAT;
     $format = empty($format) ? "e" : $format;
     $status = $this->isNew() ? 1 : $this->getVar('cat_status');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     //名稱
     $form->addElement(new XoopsFormText(_MA_SUPPORT_CATNAME, 'cat_name', 60, 255, $this->getVar('cat_name', $format)), true);
     //題頭圖片
     $cat_image = new XoopsFormElementTray(_MA_SUPPORT_CATLOGO, '', 'image');
     if ($this->getVar('cat_image')) {
         $cat_image->addElement(new XoopsFormLabel('', '<img width="100" src="' . XOOPS_URL . '/uploads/support/' . $this->getVar('cat_image') . '"><br><br>'));
         $delete_check = new XoopsFormCheckBox('', 'delete_image');
         $delete_check->addOption(1, _DELETE);
         $cat_image->addElement($delete_check);
         $display = _MA_SUPPORT_REUPLOADLOGOTIP;
     } else {
         $display = '';
     }
     $cat_image->addElement(new XoopsFormFile('', 'cat_image', 1024 * 1024 * 2));
     $cat_image->addElement(new XoopsFormLabel('', _MA_SUPPORT_UPLOADSTYLE));
     $cat_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($cat_image);
     //服務介紹
     $configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('cat_desc'));
     $form->addElement(new XoopsFormEditor(_MA_SUPPORT_CATDESC, 'cat_desc', $configs));
     //狀態
     $form->addElement(new XoopsFormRadioYN(_MA_SUPPORT_VISIBLE, 'cat_status', $status));
     //管理員
     $uids = $member_handler->getUsersByGroup($xoopsModuleConfig['support']);
     $criteria = new CriteriaCompo(new Criteria("uid", "(" . implode(", ", $uids) . ")", "in"));
     $members = $member_handler->getUserList($criteria);
     $support_ids = array();
     if (!$this->isNew()) {
         $criteria = new CriteriaCompo();
         $criteria->add(new Criteria('cat_id', $this->getVar('cat_id')));
         $linkusers = $linkusers_handler->getAll($criteria, array('uid'), false);
         if (!empty($linkusers)) {
             foreach ($linkusers as $k => $v) {
                 $support_ids[] = $v['uid'];
             }
         }
     }
     $support = new XoopsFormSelect(_MA_SUPPORT_MANGER, 'support_ids', $support_ids, 5, true);
     $support->addOptionArray($members);
     $form->addElement($support, true);
     $form->addElement(new XoopsFormHidden('cat_id', $this->getVar('cat_id')));
     $form->addElement(new XoopsFormHidden('ac', 'insert'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#5
0
 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;
 }
示例#6
0
文件: links.php 项目: yunsite/xoopsdc
 function linksForm($action = false)
 {
     global $xoopsModuleConfig;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $title = $this->isNew() ? _AM_LINKS_ADDLIK : _AM_LINKS_UPDATELIK;
     $link_status = $this->isNew() ? 1 : $this->getVar('link_status');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     $cat_id = isset($_REQUEST['cid']) ? $_REQUEST['cid'] : '';
     if (empty($cat_id)) {
         $cat_id = $this->getVar("cat_id");
     }
     $categories = new XoopsFormSelect(_AM_LINKS_CATNAME, 'cat_id', $cat_id);
     $cat_handler = xoops_getmodulehandler('category', 'links');
     $criteria = new CriteriaCompo();
     $criteria->setSort('cat_order');
     $criteria->setOrder('ASC');
     $categories->addOptionArray($cat_handler->getList($criteria));
     $form->addElement($categories, true);
     $form->addElement(new XoopsFormText(_AM_LINKS_TITLE, 'link_title', 40, 50, $this->getVar('link_title')), true);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormText(_AM_LINKS_LIKADD, 'link_url', 80, 5000, $this->getVar('link_url'), true));
         $form->addElement(new XoopsFormHidden('datetime', time()));
     } else {
         $form->addElement(new XoopsFormText(_AM_LINKS_LIKADD, 'link_url', 80, 5000, 'http://'), true);
         $form->addElement(new XoopsFormHidden('published', time()));
         $form->addElement(new XoopsFormHidden('datetime', time()));
     }
     $logo_image = new XoopsFormElementTray(_AM_LINKS_LIKLOGO);
     if (!empty($xoopsModuleConfig['logo'])) {
         if ($this->getVar('link_title')) {
             $logo_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . $xoopsModuleConfig['logo_dir'] . $this->getVar('link_image') . '"><br><br>'));
             $display = _AM_LINKS_LOGOWARN;
         } else {
             $display = '';
         }
         $logo_image->addElement(new XoopsFormFile('', 'link_image', 1024 * 1024 * 2));
     } else {
         $logo_image->addElement(new XoopsFormText('', 'link_dir', 70, 255, $this->getVar('link_dir')));
         $display = _AM_LINKS_LOGOTIPS . XOOPS_URL . '/uploads/logo/logo.jpg';
     }
     $logo_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($logo_image);
     $form->addElement(new XoopsFormText(_AM_LINKS_SORT, 'link_order', 4, 2, $this->getVar('link_order')));
     $form->addElement(new XoopsFormText(_AM_LINKS_CONTACT, 'link_contact', 60, 255, $this->getVar('link_contact')));
     $form->addElement(new XoopsFormRadioYN(_AM_LINKS_SHOW, 'link_status', $link_status));
     $form->addElement(new XoopsFormHidden('link_id', $this->getVar('link_id')));
     $form->addElement(new XoopsFormHidden('ac', 'insert'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#7
0
 function getForm($action = false)
 {
     global $xoopsModuleConfig;
     include_once XOOPS_ROOT_PATH . "/modules/portfolio/include/functions.render.php";
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? '添加服务' : '更新服务';
     $format = empty($format) ? "e" : $format;
     $status = $this->isNew() ? 1 : $this->getVar('service_status');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     //名称
     $form->addElement(new XoopsFormText('案例名称', 'service_name', 60, 255, $this->getVar('service_name', $format)), true);
     $form->addElement(new XoopsFormText('页面标题', 'service_menu_name', 60, 255, $this->getVar('service_menu_name', $format)));
     //题头图片
     $service_image = new XoopsFormElementTray('题头图片', '', 'image');
     if ($this->getVar('service_image')) {
         $service_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . '/uploads/portfolio/' . $this->getVar('service_image') . '"><br><br>'));
         $delete_check = new XoopsFormCheckBox('', 'delete_image');
         $delete_check->addOption(1, _DELETE);
         $service_image->addElement($delete_check);
         $display = '从新上传将会覆盖现有文件';
     } else {
         $display = '';
     }
     $service_image->addElement(new XoopsFormFile('', 'service_image', 1024 * 1024 * 2));
     $service_image->addElement(new XoopsFormLabel('', '允许上传的类型为jpeg,pjpeg,gif,png文件'));
     $service_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($service_image);
     //服务介绍
     $configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('service_desc'));
     $form->addElement(new XoopsFormEditor('服务介绍', 'service_desc', $configs), false);
     //模板选择
     $templates = portfolio_getTemplateList("service");
     if (count($templates) > 0) {
         $template_select = new XoopsFormSelect('服务模板', "service_tpl", $this->getVar("service_tpl"));
         $template_select->addOptionArray($templates);
         $form->addElement($template_select);
     }
     //状态
     $form->addElement(new XoopsFormRadioYN('是否显示', 'service_status', $status));
     //创建时间
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('service_pushtime', time()));
     }
     $form->addElement(new XoopsFormHidden('service_id', $this->getVar('service_id')));
     $form->addElement(new XoopsFormHidden('ac', 'insert'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#8
0
 function replyForm($action = false, $title = _MA_SUPPORT_QUESTIONREPLY, $type = 'reply')
 {
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $member_handler =& xoops_gethandler('member');
     $category_handler =& xoops_getmodulehandler('category', 'support');
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $format = empty($format) ? "e" : $format;
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     // subject
     $form->addElement(new XoopsFormLabel(_MA_SUPPORT_QUESTIONNAME, $this->getVar('subject', $format)));
     // forword
     if ($type == 'forword') {
         $criteria = new CriteriaCompo();
         $criteria->setSort('cat_weight');
         $criteria->setOrder('ASC');
         $categories = $category_handler->getList($criteria);
         if (empty($categories)) {
             $categories = array(_MA_SUPPORT_DEFAULTCAT);
         }
         $cat_select = new XoopsFormSelect(_MA_SUPPORT_FORWARDCAT, "cat_id", '');
         $cat_select->addOption(0, _MA_SUPPORT_CHOICE);
         $cat_select->addOptionArray($categories);
         $form->addElement($cat_select);
         $support = new XoopsFormElementTray(_MA_SUPPORT_FORWORDMANGER, '', 'support');
         $support_select = new XoopsFormSelect('', "forword", '');
         $support_select->addOption('', _MA_SUPPORT_CHOICE);
         $support->addElement($support_select);
         $support_multiLabel = new XoopsFormLabel('', _MA_SUPPORT_NOCHOICEMANGER);
         $support->addElement($support_multiLabel);
         $form->addElement($support);
     }
     // infomation
     $configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => '');
     $form->addElement(new XoopsFormEditor(_MA_SUPPORT_QUESTIONDESC, 'infomation', $configs));
     // annex
     $annex = new XoopsFormElementTray(_MA_SUPPORT_ANNEX, '', 'annex');
     $annex_file = new XoopsFormFile('', 'annex', '');
     $annex_multiLabel = new XoopsFormLabel('', '<div><a id="addMore" href="javascript:void(0);">' . _MA_SUPPORT_ADDANNEX . '</a></div>');
     $annex->addElement($annex_file);
     $annex->addElement($annex_multiLabel);
     $form->addElement($annex);
     // gratetime
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('create_time', time()));
     }
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#9
0
 /**
  * @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;
 }
示例#10
0
 /**
  * @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 . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
     $maxsize = '<div>' . _US_MAXIMGSZ . '&nbsp;:&nbsp;' . $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;
 }
示例#11
0
 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;
 }
示例#12
0
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $title = $this->isNew() ? _AM_SPOTLIGHT_ADD_PAGE : _AM_SPOTLIGHT_EDIT_PAGE;
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     $form->addElement(new XoopsFormText(_AM_SPOTLIGHT_SLIDE_NAME, 'sp_name', 60, 255, $this->getVar('sp_name', 'e')), true);
     $form->addElement(new XoopsFormTextArea(_AM_SPOTLIGHT_EXPLAIN, 'sp_desc', $this->getVar('sp_desc', 'e'), 5, 80));
     //component
     $component_name = $this->getVar('component_name', 'e');
     if (empty($component_name)) {
         $component_name = 'default';
     }
     include_once XOOPS_ROOT_PATH . "/modules/spotlight/components/{$component_name}/config.php";
     //include component logo
     $components_list = XoopsLists::getDirListAsArray(dirname(dirname(__FILE__)) . '/components');
     foreach ($components_list as $key => $val) {
         include_once XOOPS_ROOT_PATH . "/modules/spotlight/components/{$val}/config.php";
         $_name = isset($config['name']) ? $config['name'] : $val;
         $component_names[$val] = $_name;
         unset($_name);
         unset($config['name']);
     }
     $component = new XoopsFormElementTray(_AM_SPOTLIGHT_COMPONENTS);
     $component_select = new XoopsFormSelect('', 'component_name', $component_name);
     $component_select->addOptionArray($component_names);
     $component->addElement($component_select);
     $component->addElement(new XoopsFormLabel('', '<div id="component_logo">'));
     if (isset($config['logo']) && file_exists(dirname(dirname(__FILE__)) . "/components/{$component_name}/{$config['logo']}")) {
         $img_patch = XOOPS_URL . "/modules/spotlight/components/{$component_name}/{$config['logo']}";
         $component->addElement(new XoopsFormLabel('', "<img src='{$img_patch}'>"));
     } else {
         $component->addElement(new XoopsFormLabel('', _AM_SPOTLIGHT_NO));
     }
     $component->addElement(new XoopsFormLabel('', '</div>'));
     $form->addElement($component);
     $form->addElement(new XoopsFormHidden('sp_id', $this->getVar('sp_id')));
     $form->addElement(new XoopsFormHidden('ac', 'insert'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#13
0
 function getForm($action = false)
 {
     global $xoopsModuleConfig;
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? '添加分类' : '更新分类';
     $format = empty($format) ? "e" : $format;
     $status = $this->isNew() ? 1 : $this->getVar('cat_status');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     //名称
     $form->addElement(new XoopsFormText('分类名称', 'cat_name', 60, 255, $this->getVar('cat_name', $format)), true);
     //题头图片
     $cat_image = new XoopsFormElementTray('题头图片', '', 'image');
     if ($this->getVar('cat_image')) {
         $cat_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . '/uploads/resources/' . $this->getVar('cat_image') . '"><br><br>'));
         $delete_check = new XoopsFormCheckBox('', 'delete_image');
         $delete_check->addOption(1, _DELETE);
         $cat_image->addElement($delete_check);
         $display = '从新上传将会覆盖现有文件';
     } else {
         $display = '';
     }
     $cat_image->addElement(new XoopsFormFile('', 'cat_image', 1024 * 1024 * 2));
     $cat_image->addElement(new XoopsFormLabel('', '允许上传的类型为jpeg,pjpeg,gif,png文件'));
     $cat_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($cat_image);
     //服务介绍
     $configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('cat_desc'));
     $form->addElement(new XoopsFormEditor('分类描述', 'cat_desc', $configs));
     //状态
     $form->addElement(new XoopsFormRadioYN('是否显示', 'cat_status', $status));
     // gratetime
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('grate_time', time()));
     }
     $form->addElement(new XoopsFormHidden('cat_id', $this->getVar('cat_id')));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#14
0
 /**
  * @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;
 }
示例#15
0
 /**
  * @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 . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
     $maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . '&nbsp;:&nbsp;' . $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;
 }
示例#16
0
 function getForm($action = false)
 {
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $category_handler =& xoops_getmodulehandler('category', 'resources');
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $format = empty($format) ? "e" : $format;
     $status = $this->isNew() ? 1 : $this->getVar('res_status');
     $form = new XoopsThemeForm('资源管理', 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     // category
     $criteria = new CriteriaCompo();
     $criteria->setSort('cat_weight');
     $criteria->setOrder('ASC');
     $categories = $category_handler->getList($criteria);
     $cat_select = new XoopsFormSelect('资源类别', 'cat_id', $this->getVar('cat_id'));
     $cat_select->addOptionArray($categories);
     $form->addElement($cat_select);
     // subject
     $form->addElement(new XoopsFormText('资源名称', 'res_subject', 60, 255, $this->getVar('res_subject', $format)), true);
     // content
     $configs = array('editor' => 'fckeditor', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('res_content', $format));
     $form->addElement(new XoopsFormEditor('资源描述', 'res_content', $configs));
     // resources
     $annex = new XoopsFormElementTray('资源附件', '', 'annex');
     $annex_file = new XoopsFormFile('', 'annex', '');
     $annex_multiLabel = new XoopsFormLabel('', '<div><a id="addMore" href="javascript:void(0);">再添加一个附件</a></div>');
     $annex->addElement($annex_file);
     $annex->addElement($annex_multiLabel);
     $form->addElement($annex);
     //状态
     $form->addElement(new XoopsFormRadioYN('是否显示', 'res_status', $status));
     // gratetime
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('grate_time', time()));
     }
     $form->addElement(new XoopsFormHidden('res_id', $this->getVar('res_id')));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
示例#17
0
文件: page.php 项目: yunsite/xoopsdc
 function getForm($action = false)
 {
     global $xoopsModuleConfig;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $sp_id = isset($_REQUEST['sp_id']) ? $_REQUEST['sp_id'] : '';
     $sp_handler =& xoops_getmodulehandler('spotlight', 'spotlight');
     $format = empty($format) ? "e" : $format;
     $title = $this->isNew() ? _AM_SPOTLIGHT_ADD_PAGE : _AM_SPOTLIGHT_EDIT_PAGE;
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     $sp_select = new XoopsFormSelect(_AM_SPOTLIGHT_ADD_PAGE_THEIR_SLIDE, 'sp_id', $sp_id);
     $sp_select->addOptionArray($sp_handler->getList());
     $form->addElement($sp_select);
     $form->addElement(new XoopsFormText(_AM_SPOTLIGHT_MANAGEMENT_TITLE, 'page_title', 80, 255, $this->getVar('page_title', $format)), true);
     $form->addElement(new XoopsFormTextArea(_AM_SPOTLIGHT_ADD_PAGE_SUMMARY, 'page_desc', $this->getVar('page_desc'), 5, 80));
     $form->addElement(new XoopsFormText(_AM_SPOTLIGHT_ADD_PAGE_LINK, 'page_link', 60, 255, $this->getVar('page_link')), true);
     $form->addElement(new XoopsFormRadioYN(_AM_SPOTLIGHT_ADD_PAGE_INDICATE, 'page_status', $this->getVar('page_status'), $yes = _AM_SPOTLIGHT_ADD_PAGE_SHOW, $no = _AM_SPOTLIGHT_ADD_PAGE_NOT_SHOW));
     $page_image = new XoopsFormElementTray(_AM_SPOTLIGHT_ADD_PAGE_IMEGES);
     if ($this->getVar('page_image')) {
         $page_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . $xoopsModuleConfig['spotlight_images'] . 'image_' . $this->getVar('page_image') . '"><br><br>'));
         $display = _AM_SPOTLIGHT_THE_NEW_IMSGE_EILL_REPLACE_THE_EXIETING;
     } else {
         $display = '';
     }
     $page_image->addElement(new XoopsFormFile('', 'page_image', 1024 * 1024 * 2));
     $page_image->addElement(new XoopsFormLabel('', _AM_SPOTLIGHT_ADD_PAGE_ALLOW_UPLOAD_TYPE));
     $page_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($page_image);
     $form->addElement(new XoopsFormHidden('published', time()));
     $form->addElement(new XoopsFormHidden('datetime', time()));
     $form->addElement(new XoopsFormHidden('id', $this->getVar('id')));
     $form->addElement(new XoopsFormHidden('page_id', $this->getVar('page_id')));
     $form->addElement(new XoopsFormHidden('ac', 'insert'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
function singleupload()
{
    require_once XOOPS_ROOT_PATH . '/class/template.php';
    if (!isset($xoopsTpl)) {
        $xoopsTpl = new XoopsTpl();
    }
    global $xoopsDB, $xoopsModuleConfig, $xoopsUser, $xoopsModule;
    $xoopsTpl->assign('uploadmax', $xoopsModuleConfig['debasermaxsize']);
    debaseradminMenu(4, _AM_DEBASER_SINGLEUP);
    echo "<br />";
    $fileform = new XoopsThemeForm(_MD_DEBASER_ADDMPEG, 'extfile', xoops_getenv('PHP_SELF'));
    if ($xoopsModuleConfig['debaserupsel'] == 1 || $xoopsModuleConfig['debaserupsel'] == 3) {
        $fileform->setExtra('enctype="multipart/form-data"');
    }
    $xfid = isset($_POST['xfid']) ? $_POST['xfid'] : 0;
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $gperm_handler =& xoops_gethandler('groupperm');
    $groups = $gperm_handler->getGroupIds('DebaserFilePerm', $xfid, $xoopsModule->getVar('mid'));
    $groups = $groups;
    if ($xoopsModuleConfig['usefileperm'] == 1) {
        $fileform->addElement(new XoopsFormSelectGroup(_AM_DEBASER_FCATEGORY_GROUPPROMPT, "groups", true, $groups, 5, true));
    }
    if ($xoopsModuleConfig['debaserupsel'] == 1 || $xoopsModuleConfig['debaserupsel'] == 3) {
        $fileform->addElement(new XoopsFormFile(_AM_DEBASER_FILE, 'mp3file', 0));
    }
    if ($xoopsModuleConfig['debaserupsel'] == 2 || $xoopsModuleConfig['debaserupsel'] == 3) {
        $formlink = new XoopsFormText(_MD_DEBASER_EXTLINK, 'link', 50, 255);
        $fileform->addElement($formlink);
    }
    $formtitle = new XoopsFormText(_MD_DEBASER_TITLE, 'title', 50, 100);
    $fileform->addElement($formtitle);
    //$formalbum = new XoopsFormText(_MD_DEBASER_ALBUM, 'album', 50, 50);
    //$fileform->addElement($formalbum);
    //$formyear = new XoopsFormText(_MD_DEBASER_YEAR, 'year', 4, 4);
    //$fileform->addElement($formyear);
    include_once XOOPS_ROOT_PATH . '/fck/fckeditor.php';
    $oFCKeditor = new FCKeditor('comment');
    $oFCKeditor->Value = '';
    $oFCKeditor->Height = '200';
    $fileform->addElement(new XoopsFormLabel(_MD_DEBASER_COMMENT, $oFCKeditor->CreateHTML()));
    //$formcomment = new XoopsFormDhtmlTextArea(_MD_DEBASER_COMMENT, 'comment', '', 10, 50);
    //$fileform->addElement($formcomment);
    if ($xoopsModuleConfig['autogenresingle'] != 1) {
        $mytreechose = new debaserTree($xoopsDB->prefix("debaser_genre"), 'genreid', 'subgenreid');
        ob_start();
        $mytreechose->debaserSelBox("genretitle", "genretitle", 0, 1, "genrefrom");
        $formgenre = new XoopsFormLabel(_MD_DEBASER_GENRE, ob_get_contents());
        ob_end_clean();
        $fileform->addElement($formgenre, true);
    }
    //$formtrack = new XoopsFormText(_MD_DEBASER_TRACK, 'track', 3, 3);
    //$fileform->addElement($formtrack);
    //$formartist = new XoopsFormText(_MD_DEBASER_TAMANHO, 'artist', 15, 50);
    //$fileform->addElement($formartist, true);
    $formalbum = new XoopsFormText(_MD_DEBASER_TAMANHO, 'album', 15, 50);
    $fileform->addElement($formalbum, true);
    $formlength = new XoopsFormText(_MD_DEBASER_LENGTH, 'length', 5, 5);
    $fileform->addElement($formlength, true);
    //$formbitrate = new XoopsFormText(_MD_DEBASER_BITRATE, 'bitrate', 3, 3);
    //$fileform->addElement($formbitrate);
    //$formfrequence = new XoopsFormText(_MD_DEBASER_FREQUENCY, 'frequence', 5, 5);
    //$fileform->addElement($formfrequence);
    $formweight = new XoopsFormText(_AM_DEBASER_WEIGHT, 'weight', 4, 4, 0);
    $fileform->addElement($formweight);
    $op_hidden = new XoopsFormHidden('op', 'extfile');
    $fileform->addElement($op_hidden);
    $submit_button = new XoopsFormButton("", "filesubmit", _SUBMIT, "button");
    $submit_button->setExtra("onclick=\"if(document.extfile.genrefrom.options[document.extfile.genrefrom.selectedIndex].value=='0') alert('Selecione categoria'); else submit();\"");
    $fileform->addElement($submit_button);
    $xoopsTpl->assign('extfileform', $fileform->render());
    $xoopsTpl->display('db:debaser_amupload.html');
}
示例#19
0
 *
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         article
 * @since           1.0
 * @author          Taiwen Jiang <*****@*****.**>
 * @version         $Id: form.category.php 2178 2008-09-26 08:34:09Z phppp $
 */
if (!defined("XOOPS_ROOT_PATH")) {
    exit;
}
require_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/class/xoopsformloader.php";
// Form
$form_art = new XoopsThemeForm(art_constant("MD_CATEGORY") . " " . $category_obj->getVar("cat_title"), "formcategory", XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/action.category.php");
$form_art->setExtra("enctype=\"multipart/form-data\"");
// Title
$input = new XoopsFormText(art_constant("MD_TITLE"), "cat_title", 50, 255, $category_obj->getVar("cat_title"));
if (!art_isAdministrator()) {
    $input->setExtra("type=\"disabled\"");
}
$form_art->addElement($input, true);
// Description
$form_art->addElement(new XoopsFormTextArea(art_constant("MD_DESCRIPTION"), "cat_description", $category_obj->getVar("cat_description", "E")));
// Parent category
if (art_isAdministrator()) {
    $categories =& $category_handler->getTree(0, "moderate", "----");
    $cat_options = array();
    $cat_options[0] = _NONE;
    foreach ($categories as $id => $cat) {
        $cat_options[$id] = $cat["prefix"] . $cat["cat_title"];
示例#20
0
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>&nbsp;" . $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>&nbsp;" . _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, '&nbsp;');
    $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>";
}
示例#21
0
function editfaq($showmenu = false, $faqid = -1)
{
    global $faq_handler, $category_handler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a faq
    if ($faqid != -1) {
        // Creating the FAQ object
        $faqObj = new sfFaq($faqid);
        if ($faqObj->notLoaded()) {
            redirect_header("faq.php", 1, _AM_SF_NOARTTOEDIT);
            exit;
        }
        switch ($faqObj->status()) {
            case _SF_STATUS_ASKED:
                $breadcrumb_action = _AM_SF_APPROVING;
                $collapsableBar_title = _AM_SF_QUESTION_APPROVING;
                $collapsableBar_info = _AM_SF_QUESTION_APPROVING_INFO;
                $button_caption = _AM_SF_QUEUE;
                break;
            case "default":
            default:
                $breadcrumb_action = _AM_SF_EDITING;
                $collapsableBar_title = _AM_SF_EDITQUES;
                $collapsableBar_info = _AM_SF_EDITING_INFO;
                $button_caption = _AM_SF_MODIFY;
                break;
        }
        // Creating the category of this FAQ
        $categoryObj =& $category_handler->get($faqObj->categoryid());
        if ($showmenu) {
            sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action);
        }
        echo "<br />\n";
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . $collapsableBar_title . "</h3>";
        echo "<div id='bottomtable'>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $collapsableBar_info . "</span>";
    } else {
        // there's no parameter, so we're adding a faq
        $faqObj =& $faq_handler->create();
        $faqObj->setVar('uid', $xoopsUser->getVar('uid'));
        $categoryObj =& $category_handler->create();
        $breadcrumb_action = _AM_SF_CREATINGNEW;
        $button_caption = _AM_SF_CREATE;
        if ($showmenu) {
            sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action);
        }
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SF_CREATEQUESTION . "</h3>";
        echo "<div id='bottomtable'>";
    }
    $sform = new XoopsThemeForm(_AM_SF_OPEN_QUESTION, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // faq requester
    $sform->addElement(new XoopsFormLabel(_AM_SF_REQUESTED_BY, sf_getLinkedUnameFromId($faqObj->uid(), $xoopsModuleConfig['userealname'])));
    // CATEGORY
    /*
     * Get information for pulldown menu using XoopsTree.
     * First var is the database table
     * Second var is the unique field ID for the categories
     * Last one is not set as we do not have sub menus in Smartfaq
     */
    $mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
    ob_start();
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $sform->addElement(new XoopsFormLabel(_AM_SF_CATEGORY_QUESTION, ob_get_contents()));
    ob_end_clean();
    // faq QUESTION
    $sform->addElement(new XoopsFormTextArea(_AM_SF_QUESTION, 'question', $faqObj->question(), 7, 60));
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SF_PERMISSIONS_QUESTION, 'groups[]', $faqObj->getGroups_read());
    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);
    // faq ID
    $sform->addElement(new XoopsFormHidden('faqid', $faqObj->faqid()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addfaq');
    $button_tray->addElement($hidden);
    $sform->addElement(new XoopsFormHidden('status', $faqObj->status()));
    // Setting the FAQ Status
    /*	$status_select = new XoopsFormSelect('', 'status', $status);
    	$status_select->addOptionArray(sf_getStatusArray());
    	$status_tray = new XoopsFormElementTray(_AM_SF_STATUS_EXP , '&nbsp;');
    	$status_tray->addElement($status_select);
    	$sform->addElement($status_tray);
    	*/
    if ($faqid == -1) {
        // there's no faqid? Then it's a new faq
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // else, we're editing an existing faq
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
        $button_tray->addElement($butt_create);
        $butt_edit = new XoopsFormButton('', '', _AM_SF_OPEN_QUESTION_EDIT, 'button');
        $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&amp;faqid=" . $faqid . "'\"");
        $button_tray->addElement($butt_edit);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    echo "</div>";
    unset($hidden);
}
示例#22
0
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&amp;topic_id=' . $thisTopic->topic_id();
                $linkdelete = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=delTopic&amp;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 = '&nbsp;';
                $pid = $thisTopic->topic_pid();
                if ($pid > 0) {
                    $parent = $topics_arr[$pid]->topic_title();
                    $thisTopic->prefix = str_replace(".", "-", $thisTopic->prefix) . '&nbsp;&nbsp;';
                } 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();
}
示例#23
0
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, '&nbsp;');
    $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);
    }
}
示例#24
0
 function itemForm($action = false)
 {
     global $xoopsModuleConfig, $item_id;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     include_once XOOPS_ROOT_PATH . "/modules/catalog/include/functions.render.php";
     $category_handler = xoops_getmodulehandler('category', 'catalog');
     $brand_handler = xoops_getmodulehandler('brand', 'catalog');
     $pictures_handler = xoops_getmodulehandler('picture', 'catalog');
     $country_handler = xoops_getmodulehandler('country', 'catalog');
     $link_handler =& xoops_getmodulehandler('symbol', 'symbol');
     $reseller_handler =& xoops_getmodulehandler('reseller', 'reseller');
     $cat_handler =& xoops_getmodulehandler('category', 'catalog');
     $greenep_handler = xoops_getmodulehandler('greenep', 'catalog');
     $att_handler =& xoops_getmodulehandler('attachment', 'catalog');
     $title = $this->isNew() ? _AM_CATALOG_ADDITEM : _AM_CATALOG_UPDATEITEM;
     $format = empty($format) ? "e" : $format;
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra("enctype=\"multipart/form-data\"");
     if ($xoopsModuleConfig['display'] == 1) {
         $countries =& $country_handler->getList();
         $country_select = new XoopsFormSelect(_AM_CATALOG_BELONGCOUNTRY, "country_id", $this->getVar("country_id"));
         $country_select->addOption('', _NONE);
         $country_select->addOptionArray($countries);
         $form->addElement($country_select, true);
         $brand_select = new XoopsFormSelect(_AM_CATALOG_ITEMBRAND, "brand_id", $this->getVar("brand_id"));
         $brand_select->addOption('', _NONE);
         if ($this->getVar("country_id")) {
             $criteria = new CriteriaCompo();
             $criteria->add(new Criteria('country_id', $this->getVar("country_id")));
             $brands =& $brand_handler->getList($criteria);
             unset($criteria);
             $brand_select->addOptionArray($brands);
         }
         $form->addElement($brand_select, true);
     }
     //关联分类
     $categories =& $category_handler->getTrees(0, "--");
     $cat_options = array();
     if ($categories) {
         foreach ($categories as $id => $cat) {
             $cat_options[$id] = $cat["prefix"] . $cat["cat_name"];
         }
     }
     $cat_id = empty($_REQUEST['cat_id']) ? "" : $_REQUEST['cat_id'];
     $cat_select = new XoopsFormSelect(_AM_CATALOG_ITEMCAT, "cat_id", $this->getVar("cat_id") != 0 ? $this->getVar("cat_id") : $cat_id);
     $cat_select->addOption('', _AM_CATALOG_CHOICE);
     $cat_select->addOptionArray($cat_options);
     $form->addElement($cat_select, true);
     /*
     $form->addElement(new XoopsFormText(_AM_CATALOG_ITEMNAME, 'item_name', 60, 255, $this->getVar('item_name')), true);
     $form->addElement(new XoopsFormDateTime("產品建立日期", 'create_time', 15, $this->getVar('create_time', $format)));
     $form->addElement(new XoopsFormText(_AM_CATALOG_MADEIN, 'shop_price', 40, 60, $this->getVar('shop_price')));  
     $form->addElement(new XoopsFormText(_AM_CATALOG_ITEMPACK, 'item_repairtime', 40, 60, $this->getVar('item_repairtime')));
     $form->addElement(new XoopsFormText(_AM_CATALOG_MAINFUNCTION, 'item_size', 100, 255, $this->getVar('item_size')));
     $form->addElement(new XoopsFormText(_AM_CATALOG_SHOPPRICE, 'item_weight', 40, 60, $this->getVar('item_weight')));
     */
     $form->addElement(new XoopsFormText('商品名稱', 'item_name', 60, 255, $this->getVar('item_name')), true);
     $form->addElement(new XoopsFormDateTime("建立日期", 'create_time', 15, $this->getVar('create_time', $format)));
     $form->addElement(new XoopsFormText('型號', 'item_repairtime', 40, 60, $this->getVar('item_repairtime')));
     $form->addElement(new XoopsFormText('產品顏色', 'item_weight', 40, 60, $this->getVar('item_weight')));
     $form->addElement(new XoopsFormText('外觀', 'shop_price', 40, 60, $this->getVar('shop_price')));
     $form->addElement(new XoopsFormText('尺寸', 'item_weights', 40, 255, $this->getVar('item_weights')));
     $form->addElement(new XoopsFormText('材質', 'item_size', 40, 60, $this->getVar('item_size')));
     $form->addElement(new XoopsFormText('重量', 'item_weight2', 40, 255, $this->getVar('item_weight2')));
     $form->addElement(new XoopsFormText('包裝', 'item_weightss', 40, 255, $this->getVar('item_weightss')));
     $form->addElement(new XoopsFormText('附註', 'item_weightsss', 40, 255, $this->getVar('item_weightsss')));
     /*
     $criteria2 = new CriteriaCompo();
     	    $criteria2->setSort('greenep_weight');
     	    $criteria2->setOrder('ASC');
     $greeneps =& $greenep_handler->getList($criteria2);
     $greenep_select = new XoopsFormRadio('供應綠環保程度', "greenep_id", $this->getVar("greenep_id"));
     $greenep_select->addOptionArray($greeneps);
     $form->addElement($greenep_select);
     */
     $format = empty($format) ? "e" : $format;
     $form->addElement(new XoopsFormEditor(_AM_CATALOG_FUNCTIONDESC, "item_summary", array('editor' => 'ckeditor', 'width' => '100%', 'height' => '150px', 'name' => 'item_summary', 'value' => $this->getVar('item_summary', $format)), false));
     $form->addElement(new XoopsFormEditor(_AM_CATALOG_DETAILSPEC_DESC, "item_description", array('editor' => 'ckeditor', 'width' => '100%', 'height' => '200px', 'name' => 'item_description', 'value' => $this->getVar('item_description', $format)), false));
     $form->addElement(new XoopsFormEditor(_AM_CATALOG_AFTERSERVICE_DESC, "item_service", array('editor' => 'ckeditor', 'width' => '100%', 'height' => '200px', 'name' => 'item_service', 'value' => $this->getVar('item_service', $format)), false));
     $links =& $link_handler->getList();
     $link_select = new XoopsFormSelect(' ', "link_id", $this->getVar("link_id"));
     $link_select->addOption('', _NONE);
     $link_select->addOptionArray($links);
     /*
     $link_tray = new XoopsFormElementTray("環保標章選擇", "&nbsp;<br />");
     $link_tray->addElement($link_select);
     if ($this->getVar("link_id")) {
         $link_obj =& $link_handler->get($this->getVar("link_id"));
         $link_img = XOOPS_URL . "/uploads/symbol/" . $link_obj->getVar("link_image");
         $link_tray->addElement(new XoopsFormLabel('','<span id="symbol_img"><img src="'.$link_img.'" /></span>'));
     } 
     else {
         $link_tray->addElement(new XoopsFormLabel('','<span id="symbol_img"></span>'));
     }
     $form->addElement($link_tray);
     */
     /*
     $links =& $link_handler->getList();
     $link_select = new XoopsFormCheckBox('環保標章選擇', "link_id", explode(",",$this->getVar("link_id")));
     $link_select->addOptionArray($links);
     $form->addElement($link_select);
     
     $resellers =& $reseller_handler->getList();
     $reseller_select = new XoopsFormCheckBox('優質店家選擇', "reseller_ids", explode(",",$this->getVar("reseller_ids")));
     $reseller_select->addOptionArray($resellers);
     $form->addElement($reseller_select);
     */
     $item_image = new XoopsFormElementTray(_AM_CATALOG_ITEMIMAGE);
     if ($this->getVar('item_picture')) {
         $item_image->addElement(new XoopsFormLabel('', '<img src="' . XOOPS_URL . '/uploads/gallery/thumb_' . $this->getVar('item_picture') . '"><br><br>'));
         /*  $display = _AM_CATALOG_REUPLOAD; */
     } else {
         $display = '';
     }
     $item_image->addElement(new XoopsFormFile('', 'item_image', 10240 * 10240 * 2));
     $item_image->addElement(new XoopsFormLabel('', _AM_CATALOG_UPLOADTYPE));
     $item_image->addElement(new XoopsFormLabel('', $display));
     $form->addElement($item_image);
     $gallery = new XoopsFormElementTray(_AM_CATALOG_PICUPLOAD);
     $gallery_file = new XoopsFormFile('', 'pic', 10240 * 10240 * 2);
     $gallery_multiLabel = new XoopsFormLabel('', '<div><a id="addMore" href="javascript:void(0);">' . _AM_CATALOG_ADDMORE . '</a></div>');
     $gallery->addElement($gallery_file);
     $gallery->addElement(new XoopsFormLabel('', _AM_CATALOG_UPLOADTYPE));
     $gallery->addElement($gallery_multiLabel);
     if (!$this->isNew()) {
         $criteria = new CriteriaCompo();
         $criteria->add(new Criteria('item_id', $item_id));
         $fields = array('pic_id', 'item_id', 'pic_description', 'pic_path', 'pic_thumb_path');
         $pictures = $pictures_handler->getAll($criteria, $fields, false, false);
         if (!empty($pictures)) {
             $form_checkbox = new XoopsFormCheckBox('<br>' . _AM_CATALOG_UPLOAD . '<input id="check" name="check" type="checkbox" onclick="xoopsCheckAll(\'form\',\'check\');" />' . _ALL . '<br>', 'del_pictures_id', '', '');
             foreach ($pictures as $k => $v) {
                 $form_checkbox->addOption($v['pic_id'], '<img width=50 src="' . XOOPS_URL . '/uploads/gallery/' . $v['pic_path'] . '"> ');
             }
             $gallery->addElement($form_checkbox);
             $gallery->addElement(new XoopsFormLabel('', _AM_CATALOG_AFTERCHOICED_DEL));
         }
     }
     $form->addElement($gallery);
     // file
     $annex = new XoopsFormElementTray(_AM_CATALOG_ANNEXUPLOAD, '', 'annex');
     $annex_file = new XoopsFormFile('', 'annex', '');
     $annex_multiLabel = new XoopsFormLabel('', '<div><a id="addMoreAnnex" href="javascript:void(0);">' . _AM_CATALOG_ADDMORE . '</a></div>');
     $annex->addElement($annex_file);
     $annex->addElement($annex_multiLabel);
     $criteria = new Criteria('item_id', $this->getVar('item_id') ? $this->getVar('item_id') : 0);
     $files = $att_handler->getAll($criteria, null, false);
     if (!empty($files)) {
         foreach ($files as $id => $file) {
             $list[$id] = "<a href='" . XOOPS_URL . "/modules/catalog/downloads.php?id=" . $file['att_id'] . "'>" . $file["att_filename"] . "</a>";
         }
         $ann_select = new XoopsFormCheckBox(_AM_CATALOG_UPLOAD, "att_ids", '');
         $ann_select->addOptionArray($list);
         $annex->addElement($ann_select);
         $annex->addElement(new XoopsFormLabel('', _AM_CATALOG_AFTERCHOICED_DEL));
     }
     $form->addElement($annex);
     /*
     $cstatus_select = new XoopsFormSelect('選擇比較商品形態', "compare_status", $this->getVar("compare_status"));
     $cstatus_select->addOption(1, '售價');
     $cstatus_select->addOption(2, '尺寸');
     $cstatus_select->addOption(3, '重量');
     $cstatus_select->addOption(4, '保修年份');
     $cstatus_select->addOption(5, '綠環保程度');
     $cstatus_select->addOption(6, '評價');
     $form->addElement($cstatus_select);
     */
     $form->addElement(new XoopsFormRadioYN(_AM_CATALOG_DOBEST, 'item_best', $this->getVar('item_best')));
     //        $form->addElement(new XoopsFormRadioYN(_AM_CATALOG_DONEW, 'item_newarrival',$this->getVar('item_newarrival')));
     //        $form->addElement(new XoopsFormRadioYN(_AM_CATALOG_DOHOT, 'item_hot',$this->getVar('item_hot')));
     //        $form->addElement(new XoopsFormText(_AM_CATALOG_SORT, 'weight', 40, 60, $this->getVar('weight')));
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('item_buildtime', time()));
     }
     $form->addElement(new XoopsFormHidden('modify_time', time()));
     $form->addElement(new XoopsFormHidden('item_id', $this->getVar('item_id')));
     $form->addElement(new XoopsFormHidden('ac', 'insert'));
     $btn_save = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
     //        $btn_preview = new XoopsFormButton("", "btn_preview", _PREVIEW, "button");
     //        $btn_preview->setExtra('onclick="window.document.' . $form->getName() . '.preview.value=1; window.document.' . $form->getName() . '.submit()"');
     //        $form->addElement(new XoopsFormHidden('preview', 0));
     $button_tray = new XoopsFormElementTray("");
     //        $button_tray->addElement($btn_preview);
     $button_tray->addElement($btn_save);
     $form->addElement($button_tray);
     return $form;
 }
示例#25
0
include_once XOOPS_ROOT_PATH . "/modules/" . $modversion['dirname'] . "/upload_FA.php";
if (empty($_POST['submit'])) {
    $j = 0;
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    include_once XOOPS_ROOT_PATH . '/header.php';
    $criteria = new Criteria('ele_display', 1);
    $criteria->setSort('ele_order');
    $criteria->setOrder('ASC');
    $elements =& $formulaire_mgr->getObjects2($criteria, $id);
    if ($qcm == '1') {
        $urlsuite = XOOPS_URL . '/modules/' . $modversion["dirname"] . '/formulaire.php?id=' . $id . '&qcm=1';
    } else {
        $urlsuite = XOOPS_URL . '/modules/' . $modversion["dirname"] . '/formulaire.php?id=' . $id . '&qcm=0';
    }
    $form = new XoopsThemeForm($form2, $modversion["dirname"], $urlsuite);
    $form->setExtra("enctype='multipart/form-data'");
    // impératif !
    include_once XOOPS_ROOT_PATH . "/class/uploader.php";
    if (!empty($_POST['event_id']) && !empty($_POST['event_title'])) {
        // aus pical kommend
        $picalid = new XoopsFormHidden('pical_eventid', intval($_POST['event_id']));
        $form->addElement($picalid);
        $picalid2 = new XoopsFormHidden('pical_eventtext', trim($_POST['event_title']));
        $form->addElement($picalid2);
        $picaltext = new XoopsFormLabel("", trim($_POST['event_title']));
        $form->addElement($picaltext);
    }
    $count = 0;
    $tabval = array();
    foreach ($elements as $i) {
        $ele_value = $i->getVar('ele_value');
示例#26
0
function editfile($showmenu = false, $fileid = 0, $itemid = 0)
{
    global $smartsection_file_handler, $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // if there is a parameter, and the id exists, retrieve data: we're editing a file
    if ($fileid != 0) {
        // Creating the File object
        $fileObj = new smartsectionfile($fileid);
        if ($fileObj->notLoaded()) {
            redirect_header("javascript:history.go(-1)", 1, _AM_SSECTION_NOFILESELECTED);
            exit;
        }
        if ($showmenu) {
            smartsection_adminMenu(2, _AM_SSECTION_FILE . " > " . _AM_SSECTION_EDITING);
        }
        echo "<br />\n";
        echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_SSECTION_FILE_EDITING . "</span>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SSECTION_FILE_EDITING_DSC . "</span>";
        smartsection_collapsableBar('editfile', 'editfileicon', _AM_SSECTION_FILE_INFORMATIONS);
    } else {
        // there's no parameter, so we're adding an item
        $fileObj =& $smartsection_file_handler->create();
        $fileObj->setVar('itemid', $itemid);
        if ($showmenu) {
            smartsection_adminMenu(2, _AM_SSECTION_FILE . " > " . _AM_SSECTION_FILE_ADD);
        }
        echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_SSECTION_FILE_ADDING . "</span>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SSECTION_FILE_ADDING_DSC . "</span>";
        smartsection_collapsableBar('addfile', 'addfileicon', _AM_SSECTION_FILE_INFORMATIONS);
    }
    // FILES UPLOAD FORM
    $files_form = new XoopsThemeForm(_AM_SSECTION_UPLOAD_FILE, "files_form", xoops_getenv('PHP_SELF'));
    $files_form->setExtra("enctype='multipart/form-data'");
    // NAME
    $name_text = new XoopsFormText(_AM_SSECTION_FILE_NAME, 'name', 50, 255, $fileObj->name());
    $name_text->setDescription(_AM_SSECTION_FILE_NAME_DSC);
    $files_form->addElement($name_text, true);
    // DESCRIPTION
    $description_text = new XoopsFormTextArea(_AM_SSECTION_FILE_DESCRIPTION, 'description', $fileObj->description());
    $description_text->setDescription(_AM_SSECTION_FILE_DESCRIPTION_DSC);
    $files_form->addElement($description_text, 7, 60);
    // FILE TO UPLOAD
    if ($fileid == 0) {
        $file_box = new XoopsFormFile(_AM_SSECTION_FILE_TO_UPLOAD, "userfile", 0);
        $file_box->setExtra("size ='50'");
        $files_form->addElement($file_box);
    }
    $status_select = new XoopsFormRadioYN(_AM_SSECTION_FILE_STATUS, 'file_status', $fileObj->status());
    $status_select->setDescription(_AM_SSECTION_FILE_STATUS_DSC);
    $files_form->addElement($status_select);
    $files_button_tray = new XoopsFormElementTray('', '');
    $files_hidden = new XoopsFormHidden('op', 'uploadfile');
    $files_button_tray->addElement($files_hidden);
    if ($fileid == 0) {
        $files_butt_create = new XoopsFormButton('', '', _AM_SSECTION_UPLOAD, 'submit');
        $files_butt_create->setExtra('onclick="this.form.elements.op.value=\'uploadfile\'"');
        $files_button_tray->addElement($files_butt_create);
        $files_butt_another = new XoopsFormButton('', '', _AM_SSECTION_FILE_UPLOAD_ANOTHER, 'submit');
        $files_butt_another->setExtra('onclick="this.form.elements.op.value=\'uploadanother\'"');
        $files_button_tray->addElement($files_butt_another);
    } else {
        $files_butt_create = new XoopsFormButton('', '', _AM_SSECTION_MODIFY, 'submit');
        $files_butt_create->setExtra('onclick="this.form.elements.op.value=\'modify\'"');
        $files_button_tray->addElement($files_butt_create);
    }
    $files_butt_clear = new XoopsFormButton('', '', _AM_SSECTION_CLEAR, 'reset');
    $files_button_tray->addElement($files_butt_clear);
    $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
    $butt_cancel->setExtra('onclick="history.go(-1)"');
    $files_button_tray->addElement($butt_cancel);
    $files_form->addElement($files_button_tray);
    // fileid
    $files_form->addElement(new XoopsFormHidden('fileid', $fileid));
    // itemid
    $files_form->addElement(new XoopsFormHidden('itemid', $itemid));
    $files_form->display();
    if ($fileid != 0) {
        smartsection_close_collapsable('editfile', 'editfileicon');
    } else {
        smartsection_close_collapsable('addfile', 'addfileicon');
    }
}
示例#27
0
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";

global $xoopsUser;

// create form
$search_form = new XoopsThemeForm(_MD_SEARCH, "search", "index.php", 'get');
$search_form->setExtra('accept-charset="utf-8"');

// create form elements
$search_form->addElement(new XoopsFormText(_MD_KEYWORDS, "query", 30, 255, htmlspecialchars($query, ENT_QUOTES)), true);
$type_select = new XoopsFormSelect(_MD_TYPE, "andor", $andor);
$type_select->addOptionArray(array("AND"=>_MD_ALL, "OR"=>_MD_ANY, "exact"=>_MD_EXACT));
$search_form->addElement($type_select);
if (!empty($mids)) {
	$mods_checkbox = new XoopsFormCheckBox(_MD_SEARCHIN, "mids[]", $mids);
} else {
	$mods_checkbox = new XoopsFormCheckBox(_MD_SEARCHIN, "mids[]", $mid);
}
if (empty($modules)) {
	$criteria = new CriteriaCompo();
	$criteria->add(new Criteria('hassearch', 1));
	$criteria->add(new Criteria('isactive', 1));
示例#28
0
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
if (!defined('XOOPS_ROOT_PATH')) {
    die("XOOPS root path not defined");
}
if (file_exists(XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/calendar.php')) {
    include_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/calendar.php';
} else {
    include_once XOOPS_ROOT_PATH . '/language/english/calendar.php';
}
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
include_once XOOPS_ROOT_PATH . '/modules/news/config.php';
$sform = new XoopsThemeForm(_NW_SUBMITNEWS, "storyform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php');
$sform->setExtra('enctype="multipart/form-data"');
$sform->addElement(new XoopsFormText(_NW_TITLE, 'title', 50, 255, $title), true);
// Topic's selection box
if (!isset($xt)) {
    $xt = new NewsTopic();
}
if ($xt->getAllTopicsCount() == 0) {
    redirect_header("index.php", 4, _NW_POST_SORRY);
    exit;
}
include_once XOOPS_ROOT_PATH . "/class/tree.php";
$allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex'], 'news_submit');
$topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
$topic_select = $topic_tree->makeSelBox('topic_id', 'topic_title', '-- ', $topicid, false);
$sform->addElement(new XoopsFormLabel(_NW_TOPIC, $topic_select));
//If admin - show admin form
示例#29
0
function formVote($session)
{
    $cform = new XoopsThemeForm(_VSP_FRM_VOTE_FORM, 'vote');
    $cform->setExtra('enctype="multipart/form-data"');
    $votesel = new XoopsFormSelect(_VSP_FRM_VOTE_STARS, 'stars', 0, 10);
    $votesel->addOption('10', '10 Stars');
    $votesel->addOption('9', '9 Stars');
    $votesel->addOption('8', '8 Stars');
    $votesel->addOption('7', '7 Stars');
    $votesel->addOption('6', '6 Stars');
    $votesel->addOption('5', '5 Stars');
    $votesel->addOption('4', '4 Stars');
    $votesel->addOption('3', '3 Stars');
    $votesel->addOption('2', '2 Stars');
    $votesel->addOption('1', '1 Stars');
    $cform->addElement($votesel);
    $cform->addElement(new XoopsFormHidden('op', 'vote'));
    $cform->addElement(new XoopsFormHidden('id', $session['id']));
    $cform->addElement(new XoopsFormHidden('ip', $session['ip']));
    $cform->addElement(new XoopsFormHidden('addy', $session['addy']));
    $cform->addElement(new XoopsFormButton('', 'contents_submit', _SUBMIT, "submit"));
    return $cform->render();
}
示例#30
0
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, '&nbsp;');
    $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);
    }
}