/**
  * Constructor
  *
  * @param string $caption
  * @param string $name
  * @param mixed $value Pre-selected value (or array of them).
  *                                                 For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
  * @param bool $include_anon Include user "anonymous"?
  * @param int $size Number or rows. "1" makes a drop-down-list.
  * @param bool $multiple Allow multiple selections?
  */
 function XoopsFormSelectUser($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
 {
     $limit = 200;
     $select_element = new XoopsFormSelect('', $name, $value, $size, $multiple);
     if ($include_anon) {
         $select_element->addOption(0, $GLOBALS['xoopsConfig']['anonymous']);
     }
     $member_handler =& xoops_gethandler('member');
     $user_count = $member_handler->getUserCount();
     $value = is_array($value) ? $value : (empty($value) ? array() : array($value));
     if ($user_count > $limit && count($value) > 0) {
         $criteria = new CriteriaCompo(new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'));
     } else {
         $criteria = new CriteriaCompo();
         $criteria->setLimit($limit);
     }
     $criteria->setSort('uname');
     $criteria->setOrder('ASC');
     $users = $member_handler->getUserList($criteria);
     $select_element->addOptionArray($users);
     if ($user_count <= $limit) {
         $this->XoopsFormElementTray($caption, "", $name);
         $this->addElement($select_element);
         return;
     }
     xoops_loadLanguage('findusers');
     $js_addusers = "<script type='text/javascript'>\r\n            function addusers(opts){\r\n                var num = opts.substring(0, opts.indexOf(':'));\r\n                opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                var sel = xoopsGetElementById('" . $name . "');\r\n                var arr = new Array(num);\r\n                for (var n=0; n < num; n++) {\r\n                    var nm = opts.substring(0, opts.indexOf(':'));\r\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                    var val = opts.substring(0, opts.indexOf(':'));\r\n                    opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n                    var txt = opts.substring(0, nm - val.length);\r\n                    opts = opts.substring(nm - val.length, opts.length);\r\n                    var added = false;\r\n                    for (var k = 0; k < sel.options.length; k++) {\r\n                        if(sel.options[k].value == val){\r\n                            added = true;\r\n                            break;\r\n                        }\r\n                    }\r\n                    if (added == false) {\r\n                        sel.options[k] = new Option(txt, val);\r\n                        sel.options[k].selected = true;\r\n                    }\r\n                }\r\n                return true;\r\n            }\r\n            </script>";
     $token = $GLOBALS['xoopsSecurity']->createToken();
     $action_tray = new XoopsFormElementTray("", " | ");
     $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;">' . _MA_USER_REMOVE . "</a>"));
     $action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&amp;multiple=' . $multiple . '&amp;token=' . $token . '\', \'userselect\', 800, 600, null); return false;" >' . _MA_USER_MORE . "</a>" . $js_addusers));
     $this->XoopsFormElementTray($caption, '<br /><br />', $name);
     $this->addElement($select_element);
     $this->addElement($action_tray);
 }
Esempio n. 2
0
 /**
  * Get {@link XoopsForm} for setting prune criteria
  *
  * @return object
  **/
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['SCRIPT_NAME'];
     }
     $title = $this->isNew() ? sprintf(_MD_ILOG_INSERT, _MD_ILOG_INSERT) : sprintf(_MD_ILOG_EDIT, _MD_ILOG_EDIT);
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->addElement(new XoopsFormText(_MD_ILOG_TITLE, 'title', 60, 255, $this->getVar('title')));
     //tag
     $itemid = $this->isNew() ? 0 : $this->getVar("id");
     include_once XOOPS_ROOT_PATH . "/modules/tag/include/formtag.php";
     $form->addElement(new XoopsFormTag("keywords", 60, 255, $itemid, $catid = 0));
     $configs = array('editor' => 'fckeditor', 'toolbarset' => 'ilog', 'width' => '100%', 'height' => '500px', 'value' => $this->getVar('text_body', 'e'));
     $form->addElement(new XoopsFormEditor(_MD_ILOG_TEXT, 'text_body', $configs), true);
     $configs = array('editor' => 'fckeditor', 'toolbarset' => 'Basic', 'width' => '100%', 'height' => '200px', 'value' => $this->getVar('summary', 'e'));
     $form->addElement(new XoopsFormEditor(_MD_ILOG_SUMMARY, 'summary', $configs), true);
     $form_select = new XoopsFormSelect(_MD_ILOG_STATUS, 'status', $this->getVar('status'));
     $form_select->addOption('1', _MD_ILOG_ACCESSALL);
     $form_select->addOption('2', _MD_ILOG_ACCESSME);
     $form->addElement($form_select);
     if (!$this->isNew()) {
         //Load groups
         $form->addElement(new XoopsFormHidden('id', $this->getVar('id')));
     }
     if ($this->isNew()) {
         global $xoopsUser;
         $form->addElement(new XoopsFormHidden('uid', $xoopsUser->uid()));
         $form->addElement(new XoopsFormHidden('uname', $xoopsUser->getVar('uname')));
     }
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
 function &execute(&$controller, &$request, &$user)
 {
     $editform =& $request->getAttribute('editform');
     $form = new XoopsThemeForm(_MD_A_PLZXOO_LANG_EDIT_CATEGORY, 'Category', '', 'POST');
     $form->addElement(new XoopsFormHidden('cid', $editform->cid_));
     $form->addElement(new XoopsFormText(_MD_A_PLZXOO_LANG_NAME, 'name', 64, 255, $editform->name_));
     //-------------------------
     // ¿Æ¥«¥Æ¥´¥ê
     //-------------------------
     $select = new XoopsFormSelect(_MD_A_PLZXOO_LANG_PARENT_CATEGORY, 'pid', $editform->pid_);
     $select->addOption(0, _MD_A_PLZXOO_LANG_TOP);
     $categories =& $request->getAttribute('categories');
     foreach ($categories as $category) {
         $select->addOption($category->getVar('cid'), $category->getVar('name'));
     }
     $form->addElement($select);
     unset($select);
     $form->addElement(new XoopsFormDhtmlTextArea(_MD_A_PLZXOO_LANG_DESCRIPTION, 'description', $editform->description_, 6, 50));
     $form->addElement(new XoopsFormText(_MD_A_PLZXOO_LANG_WEIGHT, 'weight', 10, 10, intval($editform->weight_)));
     $tray = new XoopsFormElementTray(_MD_A_PLZXOO_LANG_CONTROL);
     $tray->addElement(new XoopsFormButton('', 'submit', _MD_A_PLZXOO_LANG_SUBMIT, 'submit'));
     $tray->addElement(new XoopsFormButton('', 'reset', _MD_A_PLZXOO_LANG_RESET, 'reset'));
     $form->addElement($tray);
     $renderer = new mojaLE_Renderer($controller, $request, $user);
     $renderer->setTemplate('category_edit.tpl');
     $renderer->setAttribute('xoopsform', $form);
     return $renderer;
 }
Esempio n. 4
0
 /**
  * Constructor
  * 
  * @param	string	$caption	
  * @param	string	$name
  * @param	mixed	$value	    	Pre-selected value (or array of them).
  *									For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
  * @param	bool	$include_anon	Include user "anonymous"?
  * @param	int		$size	        Number or rows. "1" makes a drop-down-list.
  * @param	bool    $multiple       Allow multiple selections?
  */
 function XoopsFormSelectUser($caption, $name, $value = array(), $include_anon = false, $size = 1, $multiple = false)
 {
     $this->XoopsFormElementTray($caption, "<br /><br />", $name);
     $select_form = new XoopsFormSelect("", $name, $value, $size, $multiple);
     if ($include_anon) {
         $select_form->addOption(0, $GLOBALS["xoopsConfig"]['anonymous']);
     }
     $member_handler =& xoops_gethandler('member');
     $criteria = new CriteriaCompo();
     if (!is_array($value)) {
         $value = array($value);
     }
     if (is_array($value) && count($value) > 0) {
         $id_in = "(" . implode(",", $value) . ")";
         $criteria->add(new Criteria("uid", $id_in, "IN"));
         $criteria->setSort('name');
         $criteria->setOrder('ASC');
         $users = $member_handler->getUserList($criteria);
         $select_form->addOptionArray($member_handler->getUserList($criteria));
     }
     $action_tray = new XoopsFormElementTray("", " | ");
     $action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='return openWithSelfMain(\"" . XOOPS_URL . "/modules/system/include/userselect.php?action=1&amp;target=" . $name . "&amp;multiple=" . $multiple . "\", \"userselect\", 800, 500, null);' >" . _LIST . "</a>"));
     $action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='return openWithSelfMain(\"" . XOOPS_URL . "/modules/system/include/userselect.php?action=0&amp;target=" . $name . "&amp;multiple=" . $multiple . "\", \"userselect\", 800, 500, null);' >" . _SEARCH . "</a>"));
     $action_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='var sel = xoopsGetElementById(\"" . $name . "\");for (var i = sel.options.length-1; i >= 0; i--) {if (sel.options[i].selected) {sel.options[i] = null;}}'>" . _REMOVE . "</a>" . "<script type=\"text/javascript\">\n\t\t    function addusers(opts){\n\t\t\t    var num = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t    opts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n        \t\tvar sel = xoopsGetElementById(\"" . $name . "\");\n\t\t\t    var arr = new Array(num);\n\t\t\t    for(var n=0; n<num; n++){\n\t\t\t    \tvar nm = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t    \topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n\t\t\t    \tvar val = opts.substring(0, opts.indexOf(\":\"));\n\t\t\t    \topts = opts.substring(opts.indexOf(\":\")+1, opts.length);\n\t\t\t    \tvar txt = opts.substring(0, nm - val.length);\n\t\t\t    \topts = opts.substring(nm - val.length, opts.length);\n\t\t\t\t\tvar added = false;\n\t\t\t\t\tfor (var k = 0; k < sel.options.length; k++) {\n\t\t\t\t\t\tif(sel.options[k].value == val){\n\t\t\t\t\t\t\tadded = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(added==false){\n\t\t\t\t\t\tappendSelectOption(\"" . $name . "\",txt, val);\n\t        \t\t}\n\t\t\t    }\n\t\t\t\treturn true;\n\t\t    }\n\t\t\t</script>"));
     $this->addElement($select_form);
     $this->addElement($action_tray);
 }
Esempio n. 5
0
function salat_block_show($options)
{
    $block = array();
    $infos = salat_getInfos();
    $sform = new XoopsThemeForm(_MA_SALAT_GETPRAYERS, "form", XOOPS_URL . '/modules/salat/index.php');
    foreach ($infos as $info) {
        $options[$info['city']] = $info['city'] . ' - ' . $info['country'];
        if (isset($info['default'])) {
            $default = $info['city'];
        }
    }
    $city = isset($default) ? $default : '';
    $date = time();
    $timezone = 0;
    // City
    $element = new XoopsFormSelect(_MA_SALAT_SELECT_CITY, 'city', $city);
    $element->addOptionArray($options);
    $element->setExtra('width="100" style="width:100px;"');
    $sform->addElement($element);
    unset($element);
    $element = new XoopsFormTextDateSelect(_MA_SALAT_SELECT_DATE, 'date', 12, $date);
    //$element->setExtra('width="100" style="width:100px;"');
    $sform->addElement($element);
    unset($element);
    // Timezone
    $element = new XoopsFormSelectTimezone(_MA_SALAT_SELECT_TIMEZONE, 'timezone', $timezone);
    $element->setExtra('width="100" style="width:100px;"');
    $sform->addElement($element);
    unset($element);
    $sform->addElement(new XoopsFormButton('', 'get_prayers', _SUBMIT, 'submit'));
    $block['content'] = $sform->render();
    return $block;
}
Esempio n. 6
0
 /**
  * @param bool $action
  *
  * @return XoopsThemeForm
  */
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? sprintf(_AM_SYSTEM_BANNERS_ADDNWBNR) : sprintf(_AM_SYSTEM_BANNERS_EDITBNR);
     xoops_load('XoopsFormLoader');
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $banner_client_Handler =& xoops_getModuleHandler('bannerclient', 'system');
     $client_select = new XoopsFormSelect(_AM_SYSTEM_BANNERS_CLINAMET, 'cid', $this->getVar('cid'));
     $client_select->addOptionArray($banner_client_Handler->getList());
     $form->addElement($client_select, true);
     $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMPPURCHT, 'imptotal', 20, 255, $this->getVar('imptotal')), true);
     $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMGURLT, 'imageurl', 80, 255, $this->getVar('imageurl')), false);
     $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_CLICKURLT, 'clickurl', 80, 255, $this->getVar('clickurl')), false);
     $htmlbanner = $this->isNew() ? 0 : $this->getVar('htmlbanner');
     $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_BANNERS_USEHTML, 'htmlbanner', $htmlbanner, _YES, _NO));
     $form->addElement(new xoopsFormTextArea(_AM_SYSTEM_BANNERS_CODEHTML, 'htmlcode', $this->getVar('htmlcode'), 5, 50), false);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormHidden('bid', $this->getVar('bid')));
     }
     $form->addElement(new XoopsFormHidden('op', 'banner_save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     //$form->display();
     return $form;
 }
Esempio n. 7
0
 /**
  * Retourne le formulaire utilisé pour paramétrer la passerelle de paiement
  *
  * @return object de type XoopsThemeForm
  */
 function getParametersForm($postUrl)
 {
     require $this->getGatewayLanguageFile();
     $sform = new XoopsThemeForm(_OLEDRION_PAYPAL_PARAMETERS . ' - ' . $this->gatewayInformation['name'], 'frmPaypal', $postUrl);
     // You must specify the gateway folder's name
     $sform->addElement(new XoopsFormHidden('gateway', $this->gatewayInformation['foldername']));
     // Adresse email Paypal du compte marchand
     $paypal_email = new XoopsFormText(_OLEDRION_PAYPAL_EMAIL, 'paypal_email', 50, 255, $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($this->gatewayInformation['foldername'], 'paypal_email'));
     $paypal_email->setDescription(_OLEDRION_PAYPAL_EMAILDSC);
     $sform->addElement($paypal_email, true);
     // Libellé de la monnaie pour Paypal
     $paypal_money = new XoopsFormSelect(_OLEDRION_PAYPAL_MONEY_P, 'paypal_money', $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($this->gatewayInformation['foldername'], 'paypal_money'));
     $paypal_money->addOptionArray(array('AUD' => 'Australian Dollar', 'CAD' => 'Canadian Dollar', 'CHF' => 'Swiss Franc', 'CZK' => 'Czech Koruna', 'DKK' => 'Danish Krone', 'EUR' => 'Euro', 'GBP' => 'Pound Sterling', 'HKD' => 'Hong Kong Dollar', 'HUF' => 'Hungarian Forint', 'JPY' => 'Japanese Yen', 'NOK' => 'Norwegian Krone', 'NZD' => 'New Zealand Dollar', 'PLN' => 'Polish Zloty', 'SEK' => 'Swedish Krona', 'SGD' => 'Singapore Dollar', 'USD' => 'U.S. Dollar'));
     $sform->addElement($paypal_money, true);
     // Paypal en mode test ?
     $paypal_test = new XoopsFormRadioYN(_OLEDRION_PAYPAL_TEST, 'paypal_test', $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($this->gatewayInformation['foldername'], 'paypal_test'));
     $sform->addElement($paypal_test, true);
     // Forcé à vrai ...
     $sform->addElement(new XoopsFormHidden('use_ipn', 1));
     $button_tray = new XoopsFormElementTray('', '');
     $submit_btn = new XoopsFormButton('', 'post', _AM_OLEDRION_GATEWAYS_UPDATE, 'submit');
     $button_tray->addElement($submit_btn);
     $sform->addElement($button_tray);
     return $sform;
 }
Esempio n. 8
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;
 }
Esempio n. 9
0
function links_block_edit($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/links/include/xoopsformloader.php";
    $form = new XoopsBlockForm("", "", "");
    $categories = new XoopsFormSelect(_MB_LINKS_SHOWCAT, 'options[0]', $options[0]);
    $categories->addOption(0, _MB_LINKS_ALL);
    $cat_handler = xoops_getmodulehandler('category', 'links');
    $criteria = new CriteriaCompo();
    $criteria->setSort('cat_order');
    $criteria->setOrder('ASC');
    $category = $cat_handler->getList($criteria);
    foreach ($cat_handler->getList($criteria) as $k => $v) {
        $categories->addOption($k, $v);
    }
    $form->addElement($categories, true);
    $sort = new XoopsFormSelect(_MB_LINKS_SORTWAY, 'options[1]', $options[1]);
    $sort->addOption('published', _MB_LINKS_PUBLISHTIME);
    $sort->addOption('datetime', _MB_LINKS_UPDATETIME);
    $sort->addOption('link_order', _MB_LINKS_DEFAULT);
    $form->addElement($sort, true);
    $form->addElement(new XoopsFormText(_MB_LINKS_SHOWHOWLIK, "options[2]", 5, 2, $options[2]), true);
    $form->addElement(new XoopsFormText(_MB_LINKS_LIKTITLEMAX, "options[3]", 5, 2, $options[3]), true);
    $form->addElement(new XoopsFormRadioYN(_MB_LINKS_SHOWCATTITLE, 'options[4]', $options[4]), true);
    $display = new XoopsFormSelect(_MB_LINKS_BYSHOW, 'options[5]', $options[5]);
    $display->addOption('1', _MB_LINKS_LOGOHOR);
    $display->addOption('2', _MB_LINKS_LOGOVER);
    $display->addOption('3', _MB_LINKS_TITLEHOR);
    $display->addOption('4', _MB_LINKS_TITLEVER);
    $form->addElement($display, true);
    return $form->render();
}
Esempio n. 10
0
 function createElements($target)
 {
     $this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'tabtitle', 35, 255, $target->getVar('tabtitle', 'e')));
     $this->addElement(new XoopsFormDateTime(_AM_MYTABS_PUBLISHDATE, 'tabfromdate', 15, $target->getVar('tabfromdate', 'e')));
     $this->addElement(new XoopsFormDateTime(_AM_MYTABS_ENDDATE, 'tabtodate', 15, $target->getVar('tabtodate', 'e')));
     $always_select = new XoopsFormSelect(_AM_MYTABS_ALWAYSSHOW . ":", "tabalwayson", $target->getVar('tabshowalways', 'e'));
     $always_select->addOption("yes", _AM_MYTABS_ALWAYS);
     $always_select->addOption("time", _AM_MYTABS_TIMEBASED);
     $always_select->addOption("no", _AM_MYTABS_OFF);
     $this->addElement($always_select);
     $this->addElement(new XoopsFormText(_AM_MYTABS_PRIORITY . ":", "tabpriority", 4, 5, $target->getVar('tabpriority', 'e')));
     $note = new XoopsFormText(_AM_MYTABS_NOTE . ":", "tabnote", 50, 255, $target->getVar('tabnote', 'e'));
     $this->addElement($note);
     $this->addElement(new XoopsFormSelectGroup(_AM_MYTABS_GROUPS, 'tabgroups', true, $target->getVar('tabgroups'), 8, true));
     $link = new XoopsFormText(_AM_MYTABS_LINK . ":", "tablink", 50, 255, $target->getVar('tablink', 'e'));
     $this->addElement($link);
     $rev = new XoopsFormText(_AM_MYTABS_REV . ":", "tabrev", 50, 255, $target->getVar('tabrev', 'e'));
     $this->addElement($rev);
     if (!$target->isNew()) {
         $this->addElement(new XoopsFormHidden("tabid", $target->getVar('tabid')));
     }
     $this->addElement(new XoopsFormHidden("tabpageid", $target->getVar('tabpageid')));
     $this->addElement(new XoopsFormHidden("op", "save"));
     $tray = new XoopsFormElementTray("");
     $tray->addElement(new XoopsFormButton("", "submit", _AM_MYTABS_OK, "submit"));
     $cancel = new XoopsFormButton("", "cancel", _AM_MYTABS_CANCEL, "button");
     $cancel->setExtra("onclick=\"self.location='index.php?pageid=" . $target->getVar('tabpageid') . "';\"");
     $tray->addElement($cancel);
     $this->addElement($tray);
 }
Esempio n. 11
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;
 }
Esempio n. 12
0
 function listAction()
 {
     global $xoopsConfig;
     echo '<h3>' . _AD_OPENID_LANG_BUTTONS . '</h3>';
     echo '<p>' . _AD_OPENID_LANG_BUTTONS_DESC . '</p>';
     echo '<p>[<a href="' . $this->_url . '&op=new">' . _AD_OPENID_LANG_NEW . '</a>]</p>';
     if ($records =& $this->_handler->getObjects()) {
         echo '<table border=1><tr>';
         echo '<th></th>';
         echo '<th>Title</th>';
         echo '<th>OpenID Identifier</th>';
         echo '<th>Type</th>';
         echo '<th colspan="2"></th></tr>';
         foreach ($records as $r) {
             $type = $r->get('type');
             $image = $r->get4show('image');
             $description = $r->get4Show('description');
             echo '<tr><td>';
             echo '<img src="';
             echo strpos($image, 'http') !== 0 ? XOOPS_URL . '/modules/openid/images/' : '';
             echo $image . '" alt="' . $description . '">';
             echo '</td><td>';
             echo $description;
             echo '</td><td>';
             echo $r->get4Show('identifier');
             echo '</td><td>';
             echo $type ? 'signon' : 'server';
             echo '</td><td>';
             echo '<a href="' . $this->_url . '&op=edit&id=' . $r->get4Show('id') . '">' . _EDIT . '</a>';
             echo '</td><td>';
             echo '<a href="' . $this->_url . '&op=delete&id=' . $r->get4Show('id') . '">' . _DELETE . '</a>';
             echo '</td></tr>';
         }
         echo '</table>';
     } else {
         echo '<p>' . $this->_handler->getError() . '</p>';
     }
     echo '<br />';
     $filterItems = array();
     @(include XOOPS_ROOT_PATH . '/modules/openid/language/' . $xoopsConfig['language'] . '/filterItems.php');
     $options = array();
     foreach ($filterItems as $item) {
         if (isset($item['op_identifier']) || isset($item['user_identifier'])) {
             $options[] = $item['description'];
         }
     }
     require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $form = new XoopsSimpleForm('', 'openid_generator', $this->_url, 'post', true);
     $form->addElement(new XoopsFormHidden('controller', $this->_control));
     $form->addElement(new XoopsFormHidden('op', 'generate'));
     $element = new XoopsFormSelect(_ADD, 'offset');
     $element->addOptionArray($options);
     $form->addElement($element);
     $form->addElement(new XoopsFormButton('', 'submit', 'OK', 'submit'));
     echo $form->render();
 }
Esempio n. 13
0
 /**
  * Get a {@link XoopsForm} object for creating/editing Spotlight articles
  *
  * @return object
  */
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = _AMS_AM_SPOTLIGHT;
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/formimageselect.php";
     $form = new XoopsThemeForm($title, 'spotlightform', $action);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormHidden('id', $this->getVar('spotlightid')));
     }
     $mode_select = new XoopsFormRadio('', 'mode', $this->getVar('mode'));
     $mode_select->addOption(1, _AMS_AM_SPOT_LATESTARTICLE);
     $mode_select->addOption(2, _AMS_AM_SPOT_LATESTINTOPIC);
     $mode_select->addOption(3, _AMS_AM_SPOT_SPECIFICARTICLE);
     $mode_select->addOption(4, _AMS_AM_SPOT_CUSTOM);
     include_once XOOPS_ROOT_PATH . "/class/tree.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newstopic.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
     $xt = new AmsTopic($GLOBALS['xoopsDB']->prefix("ams_topics"));
     $allTopics = $xt->getAllTopics();
     $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
     $topic_select = new XoopsFormLabel(_AMS_AM_TOPIC, $topic_obj_tree->makeSelBox('topicid', 'topic_title', '--', $this->getVar('topicid'), false));
     $topic_select->setDescription(_AMS_AM_SPOT_TOPIC_DESC);
     $article_select = new XoopsFormSelect(_AMS_AM_ARTICLE, 'storyid', $this->getVar('storyid'));
     $article_select->addOptionArray(AmsStory::getAllPublished($GLOBALS['xoopsModuleConfig']['spotlight_art_num'], 0, false, 0, 1, false));
     $article_select->setDescription(_AMS_AM_SPOT_ARTICLE_DESC);
     $mode_tray = new XoopsFormElementTray(_AMS_AM_SPOT_MODE_SELECT);
     $mode_tray->addElement($mode_select);
     $showimage_select = new XoopsFormRadio(_AMS_AM_SPOT_SHOWIMAGE, 'showimage', $this->getVar('showimage'));
     $showimage_select->addOption(0, _AMS_AM_SPOT_SPECIFYIMAGE);
     $showimage_select->addOption(1, _AMS_AM_SPOT_TOPICIMAGE);
     $showimage_select->addOption(2, _AMS_AM_SPOT_AUTHORIMAGE);
     $showimage_select->addOption(3, _AMS_AM_SPOT_NOIMAGE);
     $showimage_select->setDescription(_AMS_AM_SPOT_SHOWIMAGE_DESC);
     $image_select = new XoopsFormImageSelect(_AMS_AM_SPOT_IMAGE, 'image', $this->getVar('image', 'e'), 70, 255);
     $autoteaser_select = new XoopsFormRadioYN(_AMS_AM_SPOT_AUTOTEASER, 'autoteaser', $this->getVar('autoteaser'));
     $teaser_text = new XoopsFormDhtmlTextArea(_AMS_AM_SPOT_TEASER, 'teaser', $this->getVar('teaser', 'e'));
     $maxlength_text = new XoopsFormText(_AMS_AM_SPOT_MAXLENGTH, 'maxlength', 10, 10, $this->getVar('maxlength'));
     $display_select = new XoopsFormRadioYN(_AMS_AM_SPOT_DISPLAY, 'display', $this->getVar('display'));
     $weight_text = new XoopsFormText(_AMS_AM_SPOT_WEIGHT, 'weight', 10, 10, $this->getVar('weight'));
     $form->addElement($mode_tray);
     $form->addElement($topic_select);
     $form->addElement($article_select);
     $form->addElement($showimage_select);
     $form->addElement($image_select);
     $form->addElement($autoteaser_select);
     $form->addElement($maxlength_text);
     $form->addElement($teaser_text);
     $form->addElement($display_select);
     $form->addElement($weight_text);
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'spotlightsubmit', _AMS_AM_SUBMIT, 'submit'));
     return $form;
 }
Esempio n. 14
0
function display_action_form($action = "")
{
    $action_options = array("no" => _SELECT, "template" => art_constant("AM_PERMISSION_TEMPLATE"), "apply" => art_constant("AM_PERMISSION_TEMPLATE_APPLY"), "default" => art_constant("AM_PERMISSION_SETBYGROUP"));
    $actionform = new XoopsSimpleForm(art_constant("AM_PERMISSION_ACTION"), 'actionform', 'admin.permission.php', "GET");
    $action_select = new XoopsFormSelect("", 'action', $action);
    $action_select->setExtra('onchange="document.forms.actionform.submit()"');
    $action_select->addOptionArray($action_options);
    $actionform->addElement($action_select);
    $actionform->display();
}
Esempio n. 15
0
 /**
  * created elements
  * @license http://www.blags.org/
  * @created:2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author Martin <*****@*****.**> 
  * */
 function createElements()
 {
     global $xoopsDB;
     $TypeElement = new XoopsFormSelect('服务类别', 'service_type_id', $this->Obj->service_type_id(), 1);
     $TypeElement->addOptionArray($this->TypeList);
     $this->addElement($TypeElement, true);
     $this->addElement(new XoopsFormText('服务单位<br>example:(小时,张,位)', 'service_unit', 45, 45, $this->Obj->service_unit()), true);
     $this->addElement(new XoopsFormText('服务名称', 'service_name', 50, 255, $this->Obj->service_name()), true);
     $this->addElement(new XoopsFormTextArea('服务描述', 'service_instruction', $this->Obj->service_instruction()), true);
     $this->addElement(new XoopsFormHidden('id', $this->Obj->service_id()));
 }
Esempio n. 16
0
 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;
 }
Esempio n. 17
0
 /**
  * created elements
  * @license   http://www.blags.org/
  * @created   :2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author    Martin <*****@*****.**>
  * */
 public function createElements()
 {
     global $xoopsDB;
     $TypeElement = new XoopsFormSelect(_AM_MARTIN_SERVICE_TYPE, 'service_type_id', $this->Obj->service_type_id(), 1);
     $TypeElement->addOptionArray($this->TypeList);
     $this->addElement($TypeElement, true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_SERVICE_UNITS . '<br>' . _AM_MARTIN_SERVICE_UNITS_DESC, 'service_unit', 45, 45, $this->Obj->service_unit()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_SERVICE_NAME, 'service_name', 50, 255, $this->Obj->service_name()), true);
     $this->addElement(new XoopsFormTextArea(_AM_MARTIN_SERVICE_DESCRIPTION, 'service_instruction', $this->Obj->service_instruction()), true);
     $this->addElement(new XoopsFormHidden('id', $this->Obj->service_id()));
 }
 /**
  * created elements
  * @license http://www.blags.org/
  * @created:2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author Martin <*****@*****.**> 
  * */
 function createElements()
 {
     global $xoopsDB;
     $Relation =& $this->Obj;
     $HotelElement = new XoopsFormSelect('酒店名称', 'hotel_id', $Relation['hotel_id'], 1);
     $HotelElement->addOptionArray($this->hotelList);
     $this->addElement($HotelElement, true);
     $ServiceElement = new XoopsFormSelect('服务名称', 'service_id', $Relation['service_id'], 1);
     $ServiceElement->addOptionArray($this->serviceList);
     $this->addElement($ServiceElement, true);
     $this->addElement(new XoopsFormText('服务价格', 'service_extra_price', 11, 11, $Relation['service_extra_price']), true);
 }
Esempio n. 19
0
 function createElements($target)
 {
     if ($target->isNew()) {
         $this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'title', 35, 255, $target->block->getVar('title', 'e')));
     } else {
         $this->addElement(new XoopsFormText(_AM_MYTABS_TITLE, 'title', 35, 255, $target->getVar('title', 'e')));
     }
     $options = $target->block->getOptions();
     if ($options) {
         $this->addElement(new XoopsFormLabel(_AM_MYTABS_OPTIONS, $options));
     }
     // DATE
     $this->addElement(new XoopsFormDateTime(_AM_MYTABS_PUBLISHDATE, 'fromdate', 15, $target->getVar('fromdate', 'e')));
     $this->addElement(new XoopsFormDateTime(_AM_MYTABS_ENDDATE, 'todate', 15, $target->getVar('todate', 'e')));
     $always_select = new XoopsFormSelect(_AM_MYTABS_ALWAYSSHOW . ":", "alwayson", $target->getVar('showalways', 'e'));
     $always_select->addOption("yes", _AM_MYTABS_ALWAYS);
     $always_select->addOption("time", _AM_MYTABS_TIMEBASED);
     $always_select->addOption("no", _AM_MYTABS_OFF);
     $this->addElement($always_select);
     $placement = new XoopsFormSelect(_AM_MYTABS_PLACEMENT . ":", "tabid", $target->getVar('tabid', 'e'));
     $tab_handler = xoops_getmodulehandler('tab');
     $tabs = $tab_handler->getObjects(new Criteria('tabpageid', $target->getVar('pageid')));
     foreach ($tabs as $tab) {
         $placement->addOption($tab->getVar('tabid'), $tab->getVar('tabtitle'));
     }
     $this->addElement($placement);
     $block_placement = new XoopsFormSelect(_AM_MYTABS_BLOCK_PLACEMENT . ":", "placement", $target->getVar('placement', 'e'));
     $block_placement->addOption("left", _AM_MYTABS_LEFT);
     $block_placement->addOption("center", _AM_MYTABS_CENTER);
     $block_placement->addOption("right", _AM_MYTABS_RIGHT);
     $this->addElement($block_placement);
     $this->addElement(new XoopsFormText(_AM_MYTABS_PRIORITY . ":", "priority", 4, 5, $target->getVar('priority', 'e')));
     $cachetime = new XoopsFormSelect(_AM_MYTABS_CACHETIME, 'pbcachetime', $target->getVar('pbcachetime', 'e'));
     $cache_options = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK);
     $cachetime->addOptionArray($cache_options);
     $this->addElement($cachetime);
     $this->addElement(new XoopsFormRadioYN(_AM_MYTABS_CACHEBYURL, 'cachebyurl', $target->getVar('cachebyurl', 'e')));
     $note = new XoopsFormText(_AM_MYTABS_NOTE . ":", "note", 50, 255, $target->getVar('note', 'e'));
     $this->addElement($note);
     $this->addElement(new XoopsFormSelectGroup(_AM_MYTABS_GROUPS, 'groups', true, $target->getVar('groups'), 8, true));
     if (!$target->isNew()) {
         $this->addElement(new XoopsFormHidden("pageblockid", $target->getVar('pageblockid')));
     }
     $this->addElement(new XoopsFormHidden("blockid", $target->getVar('blockid')));
     $this->addElement(new XoopsFormHidden("pageid", $target->getVar('pageid')));
     $this->addElement(new XoopsFormHidden("op", "save"));
     $tray = new XoopsFormElementTray("");
     $tray->addElement(new XoopsFormButton("", "submit", _AM_MYTABS_OK, "submit"));
     $cancel = new XoopsFormButton("", "cancel", _AM_MYTABS_CANCEL, "button");
     $cancel->setExtra("onclick=\"self.location='index.php?pageid=" . $target->getVar('pageid') . "';\"");
     $tray->addElement($cancel);
     $this->addElement($tray);
 }
Esempio n. 20
0
function b_smartmail_custom_edit($options)
{
    $ts =& MyTextSanitizer::getInstance();
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    $form = new XoopsFormElementTray('', '<br />', 'options');
    $form->addElement(new XoopsFormDhtmlTextArea(_NL_MB_CONTENT, 'options[0]', htmlspecialchars($ts->stripSlashesGPC($options[0]), ENT_QUOTES), 15, 60));
    $type_select = new XoopsFormSelect(_NL_MB_CONTENTTYPE, 'options[1]', $options[1]);
    $type_select->addOption('H', _NL_MB_HTMLBLOCK);
    $type_select->addOption('S', _NL_MB_NOHTMLBLOCK);
    $form->addElement($type_select);
    return $form->render();
}
 /**
  * created elements
  * @license   http://www.blags.org/
  * @created   :2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author    Martin <*****@*****.**>
  * */
 public function createElements()
 {
     global $xoopsDB;
     $Relation =& $this->Obj;
     $HotelElement = new XoopsFormSelect(_AM_MARTIN_HOTEL_NAME, 'hotel_id', $Relation['hotel_id'], 1);
     $HotelElement->addOptionArray($this->hotelList);
     $this->addElement($HotelElement, true);
     $ServiceElement = new XoopsFormSelect(_AM_MARTIN_SERVICE_NAME, 'service_id', $Relation['service_id'], 1);
     $ServiceElement->addOptionArray($this->serviceList);
     $this->addElement($ServiceElement, true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_SERVICE_PRICES, 'service_extra_price', 11, 11, $Relation['service_extra_price']), true);
 }
Esempio n. 22
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;
 }
Esempio n. 23
0
 function createElements($target)
 {
     //        $plugin->doConfig($form);
     $this->addElement(new XoopsFormText(_SMARTBLOCKS_TITLE, 'title', 35, 255, $target->getVar('title', 'e')));
     $options = $target->block->getOptions();
     if ($options) {
         $this->addElement(new XoopsFormLabel(_SMARTBLOCKS_OPTIONS, $options));
     }
     // DATE
     $this->addElement(new XoopsFormDateTime(_SMARTBLOCKS_PUBLISHDATE, 'fromdate', 15, $target->getVar('fromdate', 'e')));
     $this->addElement(new XoopsFormDateTime(_SMARTBLOCKS_ENDDATE, 'todate', 15, $target->getVar('todate', 'e')));
     $always_select = new XoopsFormSelect(_SMARTBLOCKS_ALWAYSSHOW . ":", "alwayson", $target->getVar('showalways', 'e'));
     $always_select->addOption("yes", _SMARTBLOCKS_ALWAYS);
     $always_select->addOption("time", _SMARTBLOCKS_TIMEBASED);
     $always_select->addOption("no", _SMARTBLOCKS_OFF);
     $this->addElement($always_select);
     $placement = new XoopsFormSelect(_SMARTBLOCKS_PLACEMENT . ":", "placement", $target->getVar('placement', 'e'));
     $placement->addOption(1, _SMARTBLOCKS_LEFT);
     $placement->addOption(2, _SMARTBLOCKS_RIGHT);
     $placement->addOption(3, _SMARTBLOCKS_CENTER);
     $placement->addOption(4, _SMARTBLOCKS_CENTER_LEFT);
     $placement->addOption(5, _SMARTBLOCKS_CENTER_RIGHT);
     $placement->addOption(6, _SMARTBLOCKS_BCENTER);
     $placement->addOption(7, _SMARTBLOCKS_BCENTER_LEFT);
     $placement->addOption(8, _SMARTBLOCKS_BCENTER_RIGHT);
     $this->addElement($placement);
     $this->addElement(new XoopsFormText(_SMARTBLOCKS_PRIORITY . ":", "priority", 4, 5, $target->getVar('priority', 'e')));
     $falldown =& new XoopsFormCheckBox(_SMARTBLOCKS_FALLDOWN . ":", "falldown", $target->getVar('falldown', 'e'));
     $falldown->addOption(1, _YES);
     $this->addElement($falldown);
     $cachetime = new XoopsFormSelect(_SMARTBLOCKS_CACHETIME, 'pbcachetime', $target->getVar('pbcachetime', 'e'));
     $cache_options = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK);
     $cachetime->addOptionArray($cache_options);
     $this->addElement($cachetime);
     $this->addElement(new XoopsFormRadioYN(_SMARTBLOCKS_CACHEBYURL, 'cachebyurl', $target->getVar('cachebyurl', 'e')));
     $note =& new XoopsFormText(_SMARTBLOCKS_NOTE . ":", "note", 50, 255, $target->getVar('note', 'e'));
     $this->addElement($note);
     $this->addElement(new XoopsFormSelectGroup(_SMARTBLOCKS_GROUPS, 'groups', true, $target->getVar('groups'), 8, true));
     if ($target->isNew()) {
         $this->addElement(new XoopsFormHidden("blockid", $target->block->getVar('bid')));
         $this->addElement(new XoopsFormHidden("moduleid", $target->getVar('moduleid')));
         $this->addElement(new XoopsFormHidden("location", $target->getVar('location')));
     }
     $this->addElement(new XoopsFormHidden("pageblockid", $target->getVar('pageblockid')));
     $this->addElement(new XoopsFormHidden("op", "save"));
     $tray =& new XoopsFormElementTray("");
     $tray->addElement(new XoopsFormButton("", "submit", _SMARTBLOCKS_OK, "submit"));
     $cancel =& new XoopsFormButton("", "cancel", _SMARTBLOCKS_CANCEL, "button");
     $cancel->setExtra("onclick=\"self.location='page.php?location=" . $target->getVar('location') . "&moduleid=" . $target->getVar('moduleid') . "';\"");
     $tray->addElement($cancel);
     $this->addElement($tray);
 }
Esempio n. 24
0
    /**
     * Constructor
     * 
     * @param	object	$form	the form calling the editor selection	
     * @param	string	$name	editor name
     * @param	string	$value	Pre-selected text value
     * @param	bool	$noHtml  dohtml disabled
     */
    function XoopsFormSelectEditor(&$form, $name = "editor", $value = null, $noHtml = false)
    {
        $this->XoopsFormElementTray(_SELECTEDITOR);
        $editor_handler =& xoops_gethandler("editor");
        $option_select = new XoopsFormSelect("", $name, $value);
        $extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){
			window.document.forms.' . $form->getName() . '.skipValidationJS.value=1;
			window.document.forms.' . $form->getName() . '.submit();
			}"';
        $option_select->setExtra($extra);
        $option_select->addOptionArray($editor_handler->getList($noHtml));
        $this->addElement($option_select);
    }
Esempio n. 25
0
function press_block_news_edit($options)
{
    global $GLOBALS;
    include_once XOOPS_ROOT_PATH . "/modules/press/include/xoopsformloader.php";
    $category_handler =& xoops_getmodulehandler("category", "press");
    $form = new XoopsBlockForm("", "", "");
    $form_select = new XoopsFormSelect("catgory", "options[0]", $options[0]);
    $form_select->addOption(0, _ALL);
    $form_select->addOptionArray($category_handler->getList());
    $form->addElement($form_select);
    $form->addElement(new XoopsFormText("show", "options[1]", 5, 2, $options[1]));
    $form->render();
    return $form->render();
}
Esempio n. 26
0
/**
 * @param $options
 *
 * @return string
 */
function publisher_items_menu_edit($options)
{
    include_once PUBLISHER_ROOT_PATH . '/class/blockform.php';
    xoops_load('XoopsFormLoader');
    $form = new PublisherBlockForm();
    $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisherCreateCategorySelect($options[0], 0, true, 'options[0]'));
    $orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
    $orderEle->addOptionArray(array('datesub' => _MB_PUBLISHER_DATE, 'counter' => _MB_PUBLISHER_HITS, 'weight' => _MB_PUBLISHER_WEIGHT));
    $dispEle = new XoopsFormText(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
    $form->addElement($catEle);
    $form->addElement($orderEle);
    $form->addElement($dispEle);
    return $form->render();
}
Esempio n. 27
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;
 }
 function XoopsFormSelectTime($caption, $name, $value = 0, $format = "%y-%m-%d %h:%i")
 {
     $value = intval($value);
     if (empty($value)) {
         $time = time();
         $this->year = formatTimestamp($time, 'Y');
         $this->month = formatTimestamp($time, 'n');
         $this->day = formatTimestamp($time, 'd');
         $this->hour = formatTimestamp($time, 'H');
         $this->min = formatTimestamp($time, 'i');
         $this->sec = date('s', $time);
     } else {
         $this->year = formatTimestamp($value, 'Y');
         $this->month = formatTimestamp($value, 'n');
         $this->day = formatTimestamp($value, 'd');
         $this->hour = formatTimestamp($value, 'H');
         $this->min = formatTimestamp($value, 'i');
         $this->sec = date('s', $value);
     }
     $this->XoopsFormElementTray($caption, '');
     $thsy = date('Y');
     $year_select = new XoopsFormSelect('', $name . '[year]', $this->year);
     //		$year_select  ->addOptionArray(array($thsy-8=>$thsy-8, $thsy-7, $thsy-6, $thsy-5, $thsy-4, $thsy-3, $thsy-2, $thsy-1, $thsy, $thsy+1));
     for ($y = 1970; $y < 2038; $y++) {
         $year_select->addOption($y, $y);
     }
     // GIJ
     $month_select = new XoopsFormSelect('', $name . '[month]', $this->month);
     $month_select->addOptionArray(array(1 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
     $day_select = new XoopsFormSelect('', $name . '[day]', $this->day);
     $day_select->addOptionArray(array(1 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31));
     $hour_select = new XoopsFormSelect('', $name . '[hour]', $this->hour);
     $hour_select->addOptionArray(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23));
     $sixty_option = array();
     for ($i = 0; $i < 60; $i++) {
         $sixty_option[] = $i;
     }
     $min_select = new XoopsFormSelect('', $name . '[min]', $this->min);
     $min_select->addOptionArray($sixty_option);
     $sec_select = new XoopsFormSelect('', $name . '[sec]', $this->sec);
     $sec_select->addOptionArray($sixty_option);
     $format = preg_replace('/%y/i', $year_select->render(), $format);
     $format = preg_replace('/%m/i', $month_select->render(), $format);
     $format = preg_replace('/%d/i', $day_select->render(), $format);
     $format = preg_replace('/%h/i', $hour_select->render(), $format);
     $format = preg_replace('/%i/i', $min_select->render(), $format);
     $format = preg_replace('/%s/i', $sec_select->render(), $format);
     $base_label = new XoopsFormLabel('', $format);
     $this->addElement($base_label);
 }
Esempio n. 29
0
    function render()
    {
        xoops_load('XoopsEditorHandler');
        $editor_handler = XoopsEditorHandler::getInstance();
        $editor_handler->allowed_editors = $this->allowed_editors;
        $option_select = new XoopsFormSelect("", $this->name, $this->value);
        $extra = 'onchange="if(this.options[this.selectedIndex].value.length > 0 ){
			window.document.forms.' . $this->form->getName() . '.submit();
			}"';
        $option_select->setExtra($extra);
        $option_select->addOptionArray($editor_handler->getList($this->nohtml));
        $this->addElement($option_select);
        return parent::render();
    }
/**
 * editCategory()
 *
 * @param integer $catid
 * @return
 */
function editCategory($category_obj = null)
{
    global $xoopsModule;
    $category_handler =& xoops_getmodulehandler('category', 'newbb');
    if (empty($category_obj)) {
        $category_obj =& $category_handler->create();
    }
    $groups_cat_access = null;
    include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php";
    if (!$category_obj->isNew()) {
        $sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . " " . $category_obj->getVar('cat_title'), "op", xoops_getenv('PHP_SELF'));
    } else {
        $sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, "op", xoops_getenv('PHP_SELF'));
        $category_obj->setVar('cat_title', '');
        $category_obj->setVar('cat_image', '');
        $category_obj->setVar('cat_description', '');
        $category_obj->setVar('cat_order', 0);
        $category_obj->setVar('cat_url', 'http://www.myxoops.org myXOOPS Support');
    }
    $sform->addElement(new XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $category_obj->getVar('cat_title', 'E')), true);
    $sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $category_obj->getVar('cat_description', 'E'), 10, 60), false);
    $imgdir = "/modules/" . $xoopsModule->getVar("dirname") . "/images/category";
    $cat_image = $category_obj->getVar("cat_image");
    $cat_image = empty($cat_image) ? 'blank.gif' : $cat_image;
    $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . "/");
    array_unshift($graph_array, _NONE);
    $cat_image_select = new XoopsFormSelect('', 'cat_image', $category_obj->getVar('cat_image'));
    $cat_image_select->addOptionArray($graph_array);
    $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\"");
    $cat_image_tray = new XoopsFormElementTray(_AM_NEWBB_IMAGE, '&nbsp;');
    $cat_image_tray->addElement($cat_image_select);
    $cat_image_tray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . $imgdir . "/" . $cat_image . " 'name='img' id='img' alt='' />"));
    $sform->addElement($cat_image_tray);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $category_obj->getVar('cat_url', 'E')), false);
    $sform->addElement(new XoopsFormHidden('cat_id', $category_obj->getVar("cat_id")));
    $button_tray = new XoopsFormElementTray('', '');
    $button_tray->addElement(new XoopsFormHidden('op', 'save'));
    $butt_save = new XoopsFormButton('', '', _SUBMIT, 'submit');
    $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"');
    $button_tray->addElement($butt_save);
    if ($category_obj->getVar("cat_id")) {
        $butt_delete = new XoopsFormButton('', '', _CANCEL, 'submit');
        $butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"');
        $button_tray->addElement($butt_delete);
    }
    $sform->addElement($button_tray);
    $sform->display();
}