Esempio n. 1
0
 function createElements()
 {
     global $xoopsDB, $xoopsUser;
     // NAME
     $name_text = new XoopsFormText(_CO_PUBLISHER_FILENAME, 'name', 50, 255, $this->targetObject->name());
     $name_text->setDescription(_CO_PUBLISHER_FILE_NAME_DSC);
     $this->addElement($name_text, true);
     // DESCRIPTION
     $description_text = new XoopsFormTextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'description', $this->targetObject->description());
     $description_text->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC);
     $this->addElement($description_text);
     // FILE TO UPLOAD
     //if (!$this->targetObject->fileid()) {
     $file_box = new XoopsFormFile(_CO_PUBLISHER_FILE_TO_UPLOAD, "item_upload_file", 0);
     $file_box->setExtra("size ='50'");
     $this->addElement($file_box);
     //}
     $status_select = new XoopsFormRadioYN(_CO_PUBLISHER_FILE_STATUS, 'file_status', _PUBLISHER_STATUS_FILE_ACTIVE);
     $status_select->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC);
     $this->addElement($status_select);
     // fileid
     $this->addElement(new XoopsFormHidden('fileid', $this->targetObject->fileid()));
     // itemid
     $this->addElement(new XoopsFormHidden('itemid', $this->targetObject->itemid()));
 }
Esempio n. 2
0
 /**
  * XoopsfaqCategory::displayForm()
  *
  * @return
  */
 function displayForm()
 {
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $caption = $this->isNew() ? _AM_XOOPSFAQ_CREATENEW : sprintf(_AM_XOOPSFAQ_MODIFYITEM, $this->getVar('category_title'));
     $form = new XoopsThemeForm($caption, 'content', xoops_getenv('PHP_SELF'));
     $form->addElement(new XoopsFormHiddenToken());
     $form->addElement(new xoopsFormHidden('op', 'save'));
     $form->addElement(new xoopsFormHidden('category_id', $this->getVar('category_id', 'e')));
     // title
     $category_title = new XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_TITLE, 'category_title', 50, 150, $this->getVar('category_title', 'e'));
     $category_title->setDescription(_AM_XOOPSFAQ_E_CATEGORY_TITLE_DSC);
     $form->addElement($category_title, true);
     // order
     $category_order = new XoopsFormText(_AM_XOOPSFAQ_E_CATEGORY_WEIGHT, 'category_order', 5, 5, $this->getVar('category_order', 'e'));
     $category_order->setDescription(_AM_XOOPSFAQ_E_CATEGORY_WEIGHT_DSC);
     $form->addElement($category_order, false);
     $btnTray = new XoopsFormElementTray('', '');
     $btnSubmit = new XoopsFormButton('', 'submit', _SUBMIT, 'submit');
     $btnTray->addElement($btnSubmit);
     $btnCancel = new XoopsFormButton('', '', _CANCEL, 'button');
     $btnCancel->setExtra('onclick="history.go(-1)"');
     $btnTray->addElement($btnCancel);
     $form->addElement($btnTray);
     $form->display();
 }
Esempio n. 3
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;
 }
 /**
  * created elements
  * @license   http://www.blags.org/
  * @created   :2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author    Martin <*****@*****.**>
  * */
 public function createElements()
 {
     $Form = new XoopsFormElementTray($this->Formjs() . _AM_MARTIN_SERVICE_TYPE);
     $service_type_name = new XoopsFormText('', 'service_type_name', 50, 255, $this->Obj->service_type_name());
     $service_type_name->setExtra('class="required"');
     $Form->addElement($service_type_name, true);
     $this->addElement($Form, false);
     $this->addElement(new XoopsFormHidden('typeid', $this->Obj->service_type_id()));
 }
Esempio n. 5
0
 function getParametersForm($postUrl)
 {
     $sform = new XoopsThemeForm(_OLEDRION_PARSIAN_PARAMETERS . ' - ' . $this->gatewayInformation['name'], 'frmParsian', $postUrl);
     $sform->addElement(new XoopsFormHidden('gateway', $this->gatewayInformation['foldername']));
     $pin = new XoopsFormText(_OLEDRION_PARSIAN_MID, 'parsian_mid', 50, 255, $this->handlers->h_oledrion_gateways_options->getGatewayOptionValue($this->gatewayInformation['foldername'], 'parsian_mid'));
     $pin->setDescription(_OLEDRION_PARSIAN_MIDDSC);
     $sform->addElement($pin, true);
     $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. 6
0
 /**
  * XoopsFormColorPicker::render()
  *
  * @return string
  */
 public function render()
 {
     if (isset($GLOBALS['xoTheme'])) {
         $GLOBALS['xoTheme']->addScript('include/color-picker.js');
     } else {
         echo '<script type="text/javascript" src="' . XOOPS_URL . '/include/color-picker.js"></script>';
     }
     $this->setExtra(' style="background-color:' . $this->getValue() . ';"');
     return parent::render() . "<input type='reset' value=' ... ' onclick=\"return TCP.popup('" . XOOPS_URL . "/include/',document.getElementById('" . $this->getName() . "'));\">";
 }
Esempio n. 7
0
function createDataTypeUI($ele_type, $element, $id_form, $ele_encrypt)
{
    // data type controls ... added May 31 2009, jwe
    // only do it for existing elements where the datatype choice is relevant
    // do not do it for encrypted elements
    $renderedUI = "";
    // check if there's a special class file for this element type, and if so, instantiate an element object of that kind, so we can check if it needs a datatype UI or not
    $customTypeNeedsUI = false;
    if (file_exists(XOOPS_ROOT_PATH . "/modules/formulize/class/" . $ele_type . "Element.php")) {
        $customTypeHandler = xoops_getmodulehandler($ele_type . "Element", 'formulize');
        $customTypeObject = $customTypeHandler->create();
        $customTypeNeedsUI = $customTypeObject->needsDataType;
    }
    if (($ele_type == "text" or $ele_type == "textarea" or $ele_type == "select" or $ele_type == "radio" or $ele_type == "checkbox" or $ele_type == "derived" or $customTypeNeedsUI) and !$ele_encrypt) {
        if ($element) {
            $defaultTypeInformation = $element->getDataTypeInformation();
            $defaultType = $defaultTypeInformation['dataType'];
            $defaultTypeSize = $defaultTypeInformation['dataTypeSize'];
            //print "defaultType: $defaultType<br>";
            //print "defaultTypeSize: $defaultTypeSize<br>";
            $renderedUI .= "<input type='hidden' name='element_default_datatype' value='{$defaultType}'>\n";
            $renderedUI .= "<input type='hidden' name='element_default_datatypesize' value='{$defaultTypeSize}'>\n";
        } else {
            $defaultType = 'text';
            $defaultTypeSize = '';
        }
        // setup the UI for the options...
        $dataTypeTray = new XoopsFormElementTray(_AM_FORM_DATATYPE_CONTROLS, '<br>');
        $dataTypeTray->setDescription(_AM_FORM_DATATYPE_CONTROLS_DESC);
        $textType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $textDataTypeLabel = (!$element and $ele_type == 'text') ? _AM_FORM_DATATYPE_TEXT_NEWTEXT : _AM_FORM_DATATYPE_TEXT;
        $textType->addOption('text', $textDataTypeLabel);
        $intType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $intType->addOption('int', _AM_FORM_DATATYPE_INT);
        $decimalType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $decimalTypeSizeDefault = ($defaultTypeSize and $defaultType == "decimal") ? $defaultTypeSize : 2;
        $decimalTypeSize = new XoopsFormText('', 'element_datatype_decimalsize', 2, 2, $decimalTypeSizeDefault);
        $decimalTypeSize->setExtra(" style=\"width: 2em;\" ");
        // style to force width necessary to compensate for silly forced 60% textbox widths in ICMS admin side
        $decimalType->addOption('decimal', _AM_FORM_DATATYPE_DECIMAL1 . $decimalTypeSize->render() . _AM_FORM_DATATYPE_DECIMAL2);
        $varcharType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $varcharTypeSizeDefault = ($defaultTypeSize and $defaultType == 'varchar') ? $defaultTypeSize : 255;
        $varcharTypeSize = new XoopsFormText('', 'element_datatype_varcharsize', 3, 3, $varcharTypeSizeDefault);
        $varcharTypeSize->setExtra(" style=\"width: 3em;\" ");
        $varcharType->addOption('varchar', _AM_FORM_DATATYPE_VARCHAR1 . $varcharTypeSize->render() . _AM_FORM_DATATYPE_VARCHAR2);
        $charType = new XoopsFormRadio('', 'element_datatype', $defaultType);
        $charTypeSizeDefault = ($defaultTypeSize and $defaultType == 'char') ? $defaultTypeSize : 255;
        $charTypeSize = new XoopsFormText('', 'element_datatype_charsize', 3, 3, $charTypeSizeDefault);
        $charTypeSize->setExtra(" style=\"width: 3em;\" ");
        $charType->addOption('char', _AM_FORM_DATATYPE_CHAR1 . $charTypeSize->render() . _AM_FORM_DATATYPE_CHAR2);
        if ($defaultType != "text" and $defaultType != "int" and $defaultType != "decimal" and $defaultType != "varchar" and $defaultType != "char") {
            $otherType = new XoopsFormRadio('', 'element_datatype', $defaultType);
            $otherType->addOption($defaultType, _AM_FORM_DATATYPE_OTHER . $defaultType);
            $dataTypeTray->addElement($otherType);
        }
        $dataTypeTray->addElement($textType);
        $dataTypeTray->addElement($intType);
        $dataTypeTray->addElement($decimalType);
        $dataTypeTray->addElement($varcharType);
        $dataTypeTray->addElement($charType);
        $renderedUI .= $dataTypeTray->render();
    }
    return $renderedUI;
}
Esempio n. 8
0
// 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"];
    }
    $cat_select = new XoopsFormSelect(art_constant("MD_PARENT_CATEGORY"), "cat_pid", $category_obj->getVar("cat_pid"));
    $cat_select->addOptionArray($cat_options);
    $form_art->addElement($cat_select);
} else {
    $form_art->addElement(new XoopsFormHidden("cat_pid", $category_obj->getVar("cat_pid")));
}
// Order
$order_input = new XoopsFormText(art_constant("MD_ORDER"), "cat_order", 20, 20, $category_obj->getVar("cat_order"));
if (!art_isAdministrator()) {
    $order_input->setExtra("type=\"disabled\"");
}
$form_art->addElement($order_input);
// Template set
$templates =& art_getTemplateList("category");
if (count($templates) > 0) {
    //$template_option_tray = new XoopsFormElementTray(art_constant("MD_TEMPLATE_SELECT"), "<br />");
    $template_select = new XoopsFormSelect(art_constant("MD_TEMPLATE_SELECT"), "cat_template", $category_obj->getVar("cat_template"));
    $template_select->addOptionArray($templates);
    //$template_option_tray->addElement($template_select);
    //$form_art->addElement($template_option_tray);
    $form_art->addElement($template_select);
}
// Image
$form->addElement($form_sort);
$form_sort_order = new XoopsFormSelect("", "sort_order", $sort_order);
$form_sort_order->addOption("name", 'Name');
$form_sort_order->addOption("id", 'Id');
$form_sort_order->addOption("url", 'URL');
$form_sort_order->addOption("rating", 'Rating');
$form_sort_order->addOption("updated", 'Updated');
$form_sort_order->addOption("rand", 'Random');
$form_sort_order->addOption("length", 'Name Length');
$form_sort->addElement($form_sort_order);
$form_sort_desc = new XoopsFormCheckBox("", "sort_desc", $sort_desc);
$form_sort_desc->addOption("Y", _LANG_WLC_SUBEDIT_DESCEND);
$form_sort->addElement($form_sort_desc);
$form->addElement(new XoopsFormText(_LANG_WLC_SUBEDIT_BEFORE, "text_before_link", 45, 150, $text_before_link));
$form->addElement(new XoopsFormText(_LANG_WLC_SUBEDIT_BETWEEN, "text_after_link", 45, 150, $text_after_link));
$form->addElement(new XoopsFormText(_LANG_WLC_SUBEDIT_AFTER, "text_after_all", 45, 150, $text_after_all));
$form_list_limit = new XoopsFormText(_LANG_WLC_SUBEDIT_LIMIT, "list_limit", 5, 5, $list_limit);
$form_list_limit->setDescription("(" . _LANG_WLC_EPAGE_EMPTY . ")");
$form->addElement($form_list_limit);
if ($form_id == 'addcat') {
    $form->addElement(new XoopsFormButton("", "submit", _LANG_WLC_ADDBUTTON_TEXT, "submit"));
    $form->addElement(new XoopsFormHidden("action", 'addcat'));
} elseif ($form_id == 'editcat') {
    $form_button = new XoopsFormElementTray("");
    $form->addElement($form_button);
    $form_button->addElement(new XoopsFormButton("", "submit", _LANG_WLC_SAVEBUTTON_TEXT, "submit"));
    $form_button->addElement(new XoopsFormButton("", "submit", _LANG_WLC_CANCELBUTTON_TEXT, "submit"));
    $form->addElement(new XoopsFormHidden("action", 'editedcat'));
    $form->addElement(new XoopsFormHidden("cat_id", $cat_id));
}
$form->addElement($xoopsWPTicket->getTicketXoopsForm(__LINE__, 3600));
Esempio n. 10
0
 $sortorder = empty($_REQUEST['sortorder']) ? empty($osortorder) ? 'desc' : $osortorder : $_REQUEST['sortorder'];
 $sortname = empty($_REQUEST['sortname']) ? empty($osortname) ? 'msg_time' : $osortname : $_REQUEST['sortname'];
 if (@$_REQUEST['after'] && $_REQUEST['after'] != "YYYY/MM/DD") {
     $catcriteria->add(new Criteria('msg_time', strtotime($_REQUEST['after']), ">"));
     $after = strtotime($_REQUEST['after']);
 } else {
     $after = 0;
 }
 $send = !empty($_GET['send']) ? 1 : 0;
 $start2 = !empty($_GET['start2']) ? intval($_GET['start2']) : 0;
 $xoopsTpl->assign('mp_formulaire', "<form name='read' method='post' action='contbox.php'>");
 $xoopsTpl->assign('mp_input_reply', "<input type='submit' onclick='document.prvmsg.action=\"contbox.php?send=1\"' id='post_messages' name='post_messages' value='" . _MP_SUBMIT . "'>");
 $xoopsTpl->assign('mp_input_del', "<input type='reset' id='reply' value='" . _MP_CLEAR . "'>");
 $form = new XoopsThemeForm(_MP_ADDCONTACT, "read", "contbox.php?send=1");
 //auto proposition de pseudo
 $tosee = new XoopsFormText('', 'inputString', 25, 50, '');
 $tosee->setExtra("onkeyup='lookup(this.value);'");
 $tosee_tray = new XoopsFormElementTray(_MP_SEARCH, '&nbsp;');
 $tosee_tray->addElement($tosee);
 //$tosee_tray->addElement(new XoopsFormLabel('', "<a href='###' onclick='lookupC();' >"._MP_CONTACT."</a>"));
 $tosee_tray->addElement(new XoopsFormLabel('', "<div class='suggestionsBox' id='suggestions' style='display: none;'>\r\n\t\t\t\t<div class='suggestionList' id='autoSuggestionsList'>\r\n\t\t\t\t\t&nbsp;\r\n\t\t\t\t</div><div align='center'><a href='#' onclick='closefill();'>Close</a></div> \r\n\t\t</div> "));
 $form->addElement($tosee_tray);
 //boite d'envoie
 $to_username = new XoopsFormSelect('', 'to_userid', @$_REQUEST['to_userid'], 5, true);
 $to_username->setExtra("style=\"width:170px;\" ");
 $to_username2 = new XoopsFormElementTray(_MP_CTT, '&nbsp;');
 $to_username2->setDescription(sprintf(_MP_UNOTE, $xoopsModuleConfig['senduser']));
 $to_username2->addElement($to_username);
 $to_username2->addElement(new XoopsFormLabel('', "<small><br /><a href='###' onclick='delfill();' >" . _MP_MDEL . "</a> | <a href='###' onclick='delallfill();' >" . _MP_MDELALL . "</a></small>"));
 $form->addElement($to_username2);
 $button_tray = new XoopsFormElementTray('', '');
Esempio n. 11
0
 $output = "<div align='right'>\n                        <a href='spotlight.php?op=add'><img src='../images/new.png' />" . _AMS_AM_SPOT_ADD . "</a>";
 if (is_object($spotlightBlock)) {
     $output .= "<br />\n                        <a href='" . XOOPS_URL . "/modules/system/admin.php?fct=blocksadmin&op=edit&bid=" . $spotlightBlock->getVar('bid') . "'><img src='../images/edit.png' />" . _AMS_AM_SPOT_EDITBLOCK . "</a>";
 }
 $output .= "</div>";
 $output .= "<div><form name='spotform' id='spotform' action='spotlight.php' method='POST'>";
 $output .= "<table>";
 $output .= "<tr><th>" . _AMS_AM_SPOT_NAME . "</th><th></th><th>" . _AMS_AM_SPOT_IMAGE . "</th><th>" . _AMS_AM_SPOT_WEIGHT . "</th><th>" . _AMS_AM_SPOT_DISPLAY . "</th><th>" . _AMS_AM_ACTION . "</th>";
 include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
 $minis = 0;
 if (count($spotlights) > 0) {
     foreach (array_keys($spotlights) as $i) {
         if ($spotlights[$i]['autoteaser'] == 1) {
             $spotlights[$i]['text'] = "[auto]" . $spotlights[$i]['text'];
         }
         $weight_select = new XoopsFormText('', 'weight[' . $spotlights[$i]['spotid'] . ']', 10, 10, $spotlights[$i]['weight']);
         $display_select = new XoopsFormRadioYN('', 'display[' . $spotlights[$i]['spotid'] . ']', $spotlights[$i]['display']);
         if (isset($class) && $class == 'odd') {
             $class = 'even';
         } else {
             $class = 'odd';
         }
         $output .= "<tr class='" . $class . "'>";
         $minis++;
         $output .= "<td>" . $spotlights[$i]['title'] . "</td>";
         $output .= "<td>" . $spotlights[$i]['text'] . "</td>";
         $output .= "<td>" . $spotlights[$i]['image'] . "</td>";
         $output .= "<td>" . $weight_select->render() . "</td>";
         $output .= "<td>" . $display_select->render() . "</td>";
         $output .= "<td><a href='spotlight.php?op=edit&amp;id=" . $spotlights[$i]['spotid'] . "'>" . _AMS_AM_EDIT . "</a>";
         $output .= "&nbsp;<a href='spotlight.php?op=delete&amp;id=" . $spotlights[$i]['spotid'] . "'>" . _AMS_AM_DELETE . "</a></td>";
 /**
  * @param string $caption
  * @param string $name
  * @param int $size
  * @param int $value
  */
 public function __construct($caption, $name, $size = 15, $value = 0)
 {
     $value = !is_numeric($value) ? time() : (int) $value;
     $value = $value == 0 ? time() : $value;
     parent::__construct($caption, $name, $size, 25, $value);
 }
Esempio n. 13
0
include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/functions.php";
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
global $smartsection_file_handler;
$fileid = isset($_GET['fileid']) ? intval($_GET['fileid']) : 0;
if ($fileid != 0) {
    $fileObj = new ssFile($fileid);
} else {
    $fileObj =& $smartsection_file_handler->create();
}
// FILES UPLOAD FORM
$files_form = new XoopsThemeForm(_MD_SS_UPLOAD_FILE, "files_form", xoops_getenv('PHP_SELF'));
$files_form->setExtra("enctype='multipart/form-data'");
// NAME
$name_text = new XoopsFormText(_MD_SS_FILENAME, 'name', 50, 255, $fileObj->name());
$name_text->setDescription(_MD_SS_FILE_NAME_DSC);
$files_form->addElement($name_text, true);
// DESCRIPTION
$description_text = new XoopsFormTextArea(_MD_SS_FILE_DESCRIPTION, 'description', $fileObj->description());
$description_text->setDescription(_MD_SS_FILE_DESCRIPTION_DSC);
$files_form->addElement($description_text, 7, 60);
// FILE TO UPLOAD
if ($fileid == 0) {
    $file_box = new XoopsFormFile(_MD_SS_FILE_TO_UPLOAD, "my_file", $max_imgsize);
    $file_box->setExtra("size ='50'");
    $files_form->addElement($file_box);
}
$files_button_tray = new XoopsFormElementTray('', '');
$files_hidden = new XoopsFormHidden('op', 'uploadfile');
$files_button_tray->addElement($files_hidden);
Esempio n. 14
0
    /**
     * created elements
     * @license http://www.blags.org/
     * @created:2010年05月21日 20时40分
     * @copyright 1997-2010 The Martin Group
     * @author Martin <*****@*****.**> 
     * */
    function createElements()
    {
        $Price =& $this->Obj;
        $today = intval(date('d'));
        $MouthDays = intval($this->MouthDays(date('m')));
        $js = '<script type=\'text/javascript\'>
			jQuery.noConflict(); 
			jQuery(document).ready(function($){
				$("#sub").click(function(){
					var result = true;
					$("form input[type=text]").each(function(Element){
						if($.trim($(this).val()) == "" && $.trim($(this).attr("class")) != "")
						{
							$(this).focus();
							result = false;
							return false;
						}
					});
					if(result)
					{
						$("#op").submit();	
					}else{
						alert("只能数字,不能为空");
					}
				});
				$(".sel").click(function(){
					var Check = $(this).prev("input[type=checkbox]").attr("checked") ? false : true;
					$(this).prev("input[type=checkbox]").attr("checked",Check);
				});
				/*$(".even").parent("tr").click(function(){
					var Check = $(this).find("input[type=checkbox]").attr("checked") ? false : true;
					$(this).find("input[type=checkbox]").attr("checked",Check);
					$(this).attr("style","background-color: rgb(0, 255, 0);");
				});*/
				$("#room_price_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_price").val(value);
				});
				$("#room_advisory_range_max_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_advisory_range_max").val(value);
				});
				$("#room_advisory_range_min_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_advisory_range_small").val(value);
				});
				$("#room_sented_coupon_all").click(function(){
					var value = $(this).next("input").val();
					if(!parseFloat(value)){alert("this must be Number.");$(this).focus();return false;}
					$(".room_sented_coupon").val(value);
				});
			});
			</script>';
        $button_str = '
						<table><tr><td width="150px;align=center;"><input type="button" id="room_price_all" value="ALL">&nbsp;<input type="text" size=5></td>
						<td width="100px;align=center;"><input type="button" id="room_advisory_range_min_all" value="ALL">&nbsp;<input type="text" size=5></td>
						<td width="150px;align=center;"><input type="button" id="room_advisory_range_max_all" value="ALL">&nbsp;<input type="text" size=5></td>
						<td width="150px;align=center;"><input type="button" id="room_sented_coupon_all" value="ALL">&nbsp;<input type="text" size=5></td></tr></table>
					';
        //var_dump($Price);
        if (!empty($Price) && is_array($Price) && isset($Price['room_price'])) {
            $PriceArea = new XoopsFormElementTray($js . '房间价格');
            $RoomElement = new XoopsFormSelect('客房', 'room_id', $Price['room_id'], 1);
            $RoomElement->addOptionArray($this->RoomList);
            $PriceArea->addElement($RoomElement, true);
            $PriceArea->addElement(new XoopsFormText('价格:', 'room_price', 11, 11, $Price['room_price']), true);
            $PriceArea->addElement(new XoopsFormText('价格范围:', 'room_advisory_range_small', 11, 11, $Price['room_advisory_range_small']), true);
            $PriceArea->addElement(new XoopsFormText('-', 'room_advisory_range_max', 11, 11, $Price['room_advisory_range_max']), true);
            //赠送现金卷
            $PriceArea->addElement(new XoopsFormText('赠送现金卷:', 'room_sented_coupon', 11, 11, $Price['room_sented_coupon']), true);
            $Special = new XoopsFormCheckBox('', "room_is_totay_special", $Price['room_is_totay_special']);
            $Special->addOption(1, '<label for="room_is_totay_special">' . _YES . '当日特价</label>');
            //$PriceArea->addElement(new XoopsFormText('时间:', 'room_date', 11, 11, date("Y-m-d",$Price['room_date'])), true);
            $PriceArea->addElement(new XoopsFormHidden('room_date[]', $Price['room_date']));
            $PriceArea->addElement($Special, false);
            $this->addElement($PriceArea, false);
        } else {
            $RoomElement = new XoopsFormSelect($js . '客房<br><font color=red><b>时间请不要修改</b></font>', 'room_id', '', 1);
            $RoomElement->addOptionArray($this->RoomList);
            $this->addElement($RoomElement);
            $Select = new XoopsFormElementTray('批量处理');
            $Select->addElement(new XoopsFormLabel("", $button_str));
            $this->addElement($Select);
            //var_dump($Price[1277395200]);
            //$countDate = count($Price) > 0 ? count($Price) + $today : $MouthDays + $today;
            $countDate = $MouthDays + $today;
            for ($today; $today <= $countDate; $today++) {
                $date = $today > $MouthDays ? date("Y") . '-' . (date("m") + 1) . '-' . ($today - $MouthDays) : date("Y") . '-' . date("m") . '-' . $today;
                $dateTime = strtotime($date);
                //var_dump($Price[$dateTime]);
                ${"PriceArea" . $today} = new XoopsFormElementTray('房间' . $date . '的价格');
                $room_price = new XoopsFormText('价格:', 'room_price[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_price'] : '0.00');
                $room_price->setExtra("class='room_price'");
                ${"PriceArea" . $today}->addElement($room_price, true);
                $room_advisory_range_small = new XoopsFormText('价格范围:', 'room_advisory_range_small[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_advisory_range_small'] : '0.00');
                $room_advisory_range_small->setExtra("class='room_advisory_range_small'");
                ${"PriceArea" . $today}->addElement($room_advisory_range_small, true);
                $room_advisory_range_max = new XoopsFormText('-', 'room_advisory_range_max[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_advisory_range_max'] : '0.00');
                $room_advisory_range_max->setExtra("class='room_advisory_range_max'");
                ${"PriceArea" . $today}->addElement($room_advisory_range_max, true);
                //赠送现金卷
                $room_sented_coupon = new XoopsFormText('赠送现金卷:', 'room_sented_coupon[]', 11, 11, isset($Price[$dateTime]) ? $Price[$dateTime]['room_sented_coupon'] : '0.00');
                $room_sented_coupon->setExtra("class='room_sented_coupon'");
                ${"PriceArea" . $today}->addElement($room_sented_coupon, true);
                $Special = new XoopsFormCheckBox('', "room_is_totay_special[{$dateTime}]", isset($Price[$dateTime]) ? $Price[$dateTime]['room_is_totay_special'] : 0);
                $Special->addOption(1, '<label class="sel">' . _YES . '当日特价</label>');
                //echo isset($Price[$dateTime]) ? $Price[$dateTime]['room_is_totay_special'] : 0;echo '<br>';
                //hide time
                //${"PriceArea".$today}->addElement(new XoopsFormText('时间:', 'room_date[]', 11, 11, $date), true);
                ${"PriceArea" . $today}->addElement(new XoopsFormHidden('room_date[]', $date));
                ${"PriceArea" . $today}->addElement($Special, false);
                $this->addElement(${"PriceArea" . $today}, false);
                unset(${"PriceArea" . $today}, $dateTime, $date, $room_price, $room_advisory_range_max, $room_advisory_range_small, $room_sented_coupon, $Special);
            }
        }
        /*$this->addElement( new XoopsFormText('客房名称', 'room_name', 45, 45, $this->Obj->room_name()), true);
        		$this->addElement( new XoopsFormText('客房面积', 'room_area', 11, 11, $this->Obj->room_area()), true);
        		$this->addElement( new XoopsFormText('客房楼层', 'room_floor', 45, 45, $this->Obj->room_floor()), true);
        		
        		$this->addElement( new XoopsFormText('加价', 'room_add_money', 11, 11, $this->Obj->room_add_money()), false);
        		$this->addElement( new XoopsFormTextArea('床描述', 'room_bed_info', $this->Obj->room_bed_info()) , false);
        		$this->addElement( new XoopsFormRadioYN('客房状态', 'room_status', $this->Obj->room_status(), "已发布",  "编辑中") , true);
        		$this->addElement( new XoopsFormText('赠送现金卷', 'room_sented_coupon', 11, 11, intval($this->Obj->room_sented_coupon())), false);*/
    }
Esempio n. 15
0
function defacer_form($itemid = 0)
{
    $defacer =& DefacerDefacer::getInstance();
    $obj = $defacer->getHandler('page')->get($itemid);
    if ($obj->isNew()) {
        $ftitle = _EDIT;
    } else {
        $ftitle = _ADD;
    }
    $form = new XoopsThemeForm($ftitle, 'page_form', basename(__FILE__), 'post', true);
    $mid = new XoopsFormSelect(_AM_DEFACER_PAGE_MODULE, 'page_moduleid', $obj->getVar('page_moduleid', 'e'));
    $mid->customValidationCode[] = 'var value = document.getElementById(\'page_moduleid\').value; if (value == 0){alert("' . _AM_DEFACER_SELECTMODULE_ERR . '"); return false;}';
    $module_handler =& xoops_gethandler('module');
    $criteria = new CriteriaCompo(new Criteria('hasmain', 1));
    $criteria->add(new Criteria('isactive', 1));
    //$criteria->setSort('name');
    //$criteria->setOrder('ASC'); xoopsModule does not accpet this :(
    $moduleslist = $module_handler->getList($criteria);
    $module = $module_handler->get(1);
    $list = array($module->getVar('mid') => $module->getVar('name'));
    $moduleslist = $list + $moduleslist;
    $mid->addOptionArray($moduleslist);
    $form->addElement($mid, true);
    $form->addElement(new XoopsFormText(_AM_DEFACER_PAGE_TITLE, 'page_title', 50, 255, $obj->getVar('page_title', 'e')), true);
    $furl = new XoopsFormText(_AM_DEFACER_PAGE_URL, 'page_url', 50, 255, $obj->getVar('page_url', 'e'));
    $furl->setDescription(_AM_DEFACER_PAGE_URL_DESC);
    $form->addElement($furl, true);
    $form->addElement(new XoopsFormRadioYN(_AM_DEFACER_PAGE_DISPLAY, 'page_status', $obj->getVar('page_status', 'e'), _YES, _NO));
    $tray = new XoopsFormElementTray('', '');
    $tray->addElement(new XoopsFormButton('', 'defacer_button', _SUBMIT, 'submit'));
    $btn = new XoopsFormButton('', 'reset', _CANCEL, 'button');
    if (!$obj->isNew()) {
        $btn->setExtra('onclick="document.location.href=\'' . basename(__FILE__) . '\'"');
    } else {
        $btn->setExtra('onclick="document.getElementById(\'form\').style.display = \'none\'; return false;"');
    }
    $tray->addElement($btn);
    $form->addElement($tray);
    if (!$obj->isNew()) {
        $form->addElement(new XoopsFormHidden('op', 'editok'));
        $form->addElement(new XoopsFormHidden('itemid', $itemid));
    } else {
        $form->addElement(new XoopsFormHidden('op', 'add'));
    }
    return $form->render();
}
Esempio n. 16
0
function addOptionsTray()
{
    $t = new XoopsFormText('', 'addopt', 3, 2);
    $l = new XoopsFormLabel('', sprintf(_AM_ELE_ADD_OPT, $t->render()));
    $b = new XoopsFormButton('', 'submit', _AM_ELE_ADD_OPT_SUBMIT, 'submit');
    $r = new XoopsFormElementTray('');
    $r->addElement($l);
    $r->addElement($b);
    return $r;
}
Esempio n. 17
0
    publisher_cloneFileFolder(PUBLISHER_ROOT_PATH);
    $logocreated = publisher_createLogo(strtolower($clone));
    $msg = "";
    if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($clone))) {
        $msg .= sprintf(_AM_PUBLISHER_CLONE_CONGRAT, "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(strtolower($clone)) . "</a>") . "<br />\n";
        if (!$logocreated) {
            $msg .= _AM_PUBLISHER_CLONE_IMAGEFAIL;
        }
    } else {
        $msg .= _AM_PUBLISHER_CLONE_FAIL;
    }
    echo $msg;
} else {
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
    $clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, '');
    $clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC);
    $form->addElement($clone, true);
    $form->addElement(new XoopsFormHidden('op', 'submit'));
    $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
    $form->display();
}
// End of collapsable bar
publisher_closeCollapsableBar('clone', 'cloneicon');
xoops_cp_footer();
// work around for PHP < 5.0.x
if (!function_exists('file_put_contents')) {
    function file_put_contents($filename, $data, $file_append = false)
    {
        if ($fp = fopen($filename, !$file_append ? 'w+' : 'a+')) {
            fputs($fp, $data);
Esempio n. 18
0
 $description_text->setDescription(_CO_SPARTNER_DESCRIPTION_DSC);
 $form->addElement($description_text, false);
 // CONTACT_NAME
 $contact_name_text = new XoopsFormText(_CO_SPARTNER_CONTACT_NAME, 'contact_name', 50, 255, '');
 $contact_name_text->setDescription(_CO_SPARTNER_CONTACT_NAME_DSC);
 $form->addElement($contact_name_text, false);
 // CONTACT_EMAIL
 $contact_email_text = new XoopsFormText(_CO_SPARTNER_CONTACT_EMAIL, 'contact_email', 50, 255, '');
 $contact_email_text->setDescription(_CO_SPARTNER_CONTACT_EMAIL_DSC);
 $form->addElement($contact_email_text, false);
 // EMAIL_PRIV
 $email_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_EMAILPRIV, 'email_priv', 0);
 $email_priv_radio->setDescription(_CO_SPARTNER_CONTACT_EMAILPRIV_DSC);
 $form->addElement($email_priv_radio);
 // CONTACT_PHONE
 $contact_phone_text = new XoopsFormText(_CO_SPARTNER_CONTACT_PHONE, 'contact_phone', 50, 255, '');
 $contact_phone_text->setDescription(_CO_SPARTNER_CONTACT_PHONE_DSC);
 $form->addElement($contact_phone_text, false);
 // PHONE_PRIV
 $phone_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_PHONEPRIV, 'phone_priv', 0);
 $phone_priv_radio->setDescription(_CO_SPARTNER_CONTACT_PHONEPRIV_DSC);
 $form->addElement($phone_priv_radio);
 // ADRESS
 $adress_text = new XoopsFormTextArea(_CO_SPARTNER_ADRESS, 'adress', '', 4, 60);
 $adress_text->setDescription(_CO_SPARTNER_ADRESS_DSC);
 $form->addElement($adress_text, false);
 // ADRESS_PRIV
 $adress_priv_radio = new XoopsFormRadioYN(_CO_SPARTNER_CONTACT_ADRESSPRIV, 'adress_priv', 0);
 $adress_priv_radio->setDescription(_CO_SPARTNER_CONTACT_ADRESSPRIV_DSC);
 $form->addElement($adress_priv_radio);
 // NOTIFY ON PUBLISH
Esempio n. 19
0
function editDepartment()
{
    $_xhelpSession = Session::singleton();
    global $imagearray, $xoopsModule, $oAdminButton, $limit, $start, $xoopsModuleConfig;
    $module_id = $xoopsModule->getVar('mid');
    $displayName =& $xoopsModuleConfig['xhelp_displayName'];
    // Determines if username or real name is displayed
    $_xhelpSession->set("xhelp_return_page", substr(strstr($_SERVER['REQUEST_URI'], 'admin/'), 6));
    if (isset($_REQUEST["deptid"])) {
        $deptID = $_REQUEST['deptid'];
    } else {
        redirect_header(XHELP_ADMIN_URL . "/department.php?op=manageDepartments", 3, _AM_XHELP_MSG_NO_DEPTID);
    }
    $hDepartments =& xhelpGetHandler('department');
    $hGroups =& xoops_gethandler('group');
    $hGroupPerm =& xoops_gethandler('groupperm');
    if (isset($_POST['updateDept'])) {
        $groups = isset($_POST['groups']) ? $_POST['groups'] : array();
        $hasErrors = false;
        //Department Name supplied?
        if (trim($_POST['newDept']) == '') {
            $hasErrors = true;
            $errors['newDept'][] = _AM_XHELP_MESSAGE_NO_DEPT;
        } else {
            //Department Name unique?
            $crit = new CriteriaCompo(new Criteria('department', $_POST['newDept']));
            $crit->add(new Criteria('id', $deptID, '!='));
            if ($existingDepts = $hDepartments->getCount($crit)) {
                $hasErrors = true;
                $errors['newDept'][] = _XHELP_MESSAGE_DEPT_EXISTS;
            }
        }
        if ($hasErrors) {
            $session =& Session::singleton();
            //Store existing dept info in session, reload addition page
            $aDept = array();
            $aDept['newDept'] = $_POST['newDept'];
            $aDept['groups'] = $groups;
            $session->set("xhelp_editDepartment_{$deptID}", $aDept);
            $session->set("xhelp_editDepartmentErrors_{$deptID}", $errors);
            header('Location: ' . xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'editDepartment', 'deptid' => $deptID), false));
            exit;
        }
        $dept =& $hDepartments->get($deptID);
        $oldDept = $dept;
        $groups = $_POST['groups'];
        // Need to remove old group permissions first
        $crit = new CriteriaCompo(new Criteria('gperm_modid', $module_id));
        $crit->add(new Criteria('gperm_itemid', $deptID));
        $crit->add(new Criteria('gperm_name', _XHELP_GROUP_PERM_DEPT));
        $hGroupPerm->deleteAll($crit);
        foreach ($groups as $group) {
            // Add new group permissions
            $hGroupPerm->addRight(_XHELP_GROUP_PERM_DEPT, $deptID, $group, $module_id);
        }
        $dept->setVar('department', $_POST['newDept']);
        if ($hDepartments->insert($dept)) {
            $message = _XHELP_MESSAGE_UPDATE_DEPT;
            // Update default dept
            if (isset($_POST['defaultDept']) && $_POST['defaultDept'] == 1) {
                xhelpSetMeta("default_department", $dept->getVar('id'));
            } else {
                $depts =& $hDepartments->getObjects();
                $aDepts = array();
                foreach ($depts as $dpt) {
                    $aDepts[] = $dpt->getVar('id');
                }
                xhelpSetMeta("default_department", $aDepts[0]);
            }
            // Edit configoption for department
            $hConfigOption =& xoops_gethandler('configoption');
            $crit = new CriteriaCompo(new Criteria('confop_name', $oldDept->getVar('department')));
            $crit->add(new Criteria('confop_value', $oldDept->getVar('id')));
            $confOption =& $hConfigOption->getObjects($crit);
            if (count($confOption) > 0) {
                $confOption[0]->setVar('confop_name', $dept->getVar('department'));
                if (!$hConfigOption->insert($confOption[0])) {
                    redirect_header(XHELP_ADMIN_URL . "/department.php?op=manageDepartments", 3, _AM_XHELP_MSG_UPDATE_CONFIG_ERR);
                }
            }
            _clearEditSessionVars($deptID);
            header("Location: " . XHELP_ADMIN_URL . "/department.php?op=manageDepartments");
        } else {
            $message = _XHELP_MESSAGE_UPDATE_DEPT_ERROR . $dept->getHtmlErrors();
            redirect_header(XHELP_ADMIN_URL . "/department.php?op=manageDepartments", 3, $message);
        }
    } else {
        xoops_cp_header();
        echo $oAdminButton->renderButtons('manDept');
        $dept =& $hDepartments->get($deptID);
        $session =& Session::singleton();
        $sess_dept = $session->get("xhelp_editDepartment_{$deptID}");
        $sess_errors = $session->get("xhelp_editDepartmentErrors_{$deptID}");
        //Display any form errors
        if (!$sess_errors === false) {
            xhelpRenderErrors($sess_errors, xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'clearEditSession', 'deptid' => $deptID)));
        }
        // Get list of groups with permission
        $crit = new CriteriaCompo(new Criteria('gperm_modid', $module_id));
        $crit->add(new Criteria('gperm_itemid', $deptID));
        $crit->add(new Criteria('gperm_name', _XHELP_GROUP_PERM_DEPT));
        $group_perms =& $hGroupPerm->getObjects($crit);
        $aPerms = array();
        // Put group_perms in usable format
        foreach ($group_perms as $perm) {
            $aPerms[$perm->getVar('gperm_groupid')] = $perm->getVar('gperm_groupid');
        }
        if (!$sess_dept === false) {
            $fld_newDept = $sess_dept['newDept'];
            $fld_groups = $sess_dept['groups'];
        } else {
            $fld_newDept = $dept->getVar('department');
            $fld_groups = $aPerms;
        }
        // Get list of all groups
        $crit = new Criteria('', '');
        $crit->setSort('name');
        $crit->setOrder('ASC');
        $groups =& $hGroups->getObjects($crit, true);
        $aGroups = array();
        foreach ($groups as $group_id => $group) {
            $aGroups[$group_id] = $group->getVar('name');
        }
        asort($aGroups);
        // Set groups in alphabetical order
        echo '<script type="text/javascript" src="' . XOOPS_URL . '/modules/xhelp/include/functions.js"></script>';
        $form = new xhelpForm(_AM_XHELP_EDIT_DEPARTMENT, 'edit_dept', xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'editDepartment', 'deptid' => $deptID)));
        $dept_name = new XoopsFormText(_AM_XHELP_TEXT_EDIT_DEPT, 'newDept', 20, 35, $fld_newDept);
        $group_select = new XoopsFormSelect(_AM_XHELP_TEXT_EDIT_DEPT_PERMS, 'groups', $fld_groups, 6, true);
        $group_select->addOptionArray($aGroups);
        $defaultDeptID = xhelpGetMeta("default_department");
        $defaultDept = new xhelpFormCheckbox(_AM_XHELP_TEXT_DEFAULT_DEPT, 'defaultDept', $defaultDeptID == $deptID ? 1 : 0, 'defaultDept');
        $defaultDept->addOption(1, "");
        $btn_tray = new XoopsFormElementTray('');
        $btn_tray->addElement(new XoopsFormButton('', 'updateDept', _AM_XHELP_BUTTON_SUBMIT, 'submit'));
        $form->addElement($dept_name);
        $form->addElement($group_select);
        $form->addElement($defaultDept);
        $form->addElement($btn_tray);
        $form->setLabelWidth('20%');
        echo $form->render();
        // Get dept staff members
        $hMembership =& xhelpGetHandler('membership');
        $hMember =& xoops_gethandler('member');
        $hStaffRole =& xhelpGetHandler('staffRole');
        $hRole =& xhelpGetHandler('role');
        $staff = $hMembership->membershipByDept($deptID, $limit, $start);
        $crit = new Criteria('j.department', $deptID);
        $staffCount =& $hMembership->getCount($crit);
        $roles =& $hRole->getObjects(null, true);
        echo "<form action='" . XHELP_ADMIN_URL . "/department.php?op=deleteStaffDept&amp;deptid=" . $deptID . "' method='post'>";
        echo "<table width='100%' cellspacing='1' class='outer'>\r\n              <tr><th colspan='" . (3 + count($roles)) . "'><label>" . _AM_XHELP_MANAGE_STAFF . "</label></th></tr>";
        if ($staffCount > 0) {
            $aStaff = array();
            foreach ($staff as $stf) {
                $aStaff[$stf->getVar('uid')] = $stf->getVar('uid');
                // Get array of staff uid
            }
            // Get user list
            $crit = new Criteria('uid', "(" . implode($aStaff, ',') . ")", "IN");
            //$members =& $hMember->getUserList($crit);
            $members =& xhelpGetUsers($crit, $displayName);
            // Get staff roles
            $crit = new CriteriaCompo(new Criteria('uid', "(" . implode($aStaff, ',') . ")", "IN"));
            $crit->add(new Criteria('deptid', $deptID));
            $staffRoles =& $hStaffRole->getObjects($crit);
            unset($aStaff);
            $staffInfo = array();
            foreach ($staff as $stf) {
                $staff_uid = $stf->getVar('uid');
                $staffInfo[$staff_uid]['uname'] = $members[$staff_uid];
                $aRoles = array();
                foreach ($staffRoles as $role) {
                    $role_id = $role->getVar('roleid');
                    if ($role->getVar('uid') == $staff_uid) {
                        $aRoles[$role_id] = $roles[$role_id]->getVar('name');
                    }
                    $staffInfo[$staff_uid]['roles'] = implode($aRoles, ', ');
                }
            }
            $nav = new XoopsPageNav($staffCount, $limit, $start, 'start', "op=editDepartment&amp;deptid={$deptID}&amp;limit={$limit}");
            echo "<tr class='head'><td rowspan='2'>" . _AM_XHELP_TEXT_ID . "</td><td rowspan='2'>" . _AM_XHELP_TEXT_USER . "</td><td colspan='" . count($roles) . "'>" . _AM_XHELP_TEXT_ROLES . "</td><td rowspan='2'>" . _AM_XHELP_TEXT_ACTIONS . "</td></tr>";
            echo "<tr class='head'>";
            foreach ($roles as $thisrole) {
                echo "<td>" . $thisrole->getVar('name') . "</td>";
            }
            echo "</tr>";
            foreach ($staffInfo as $uid => $staff) {
                echo "<tr class='even'>\r\n                          <td><input type='checkbox' name='staff[]' value='" . $uid . "' />" . $uid . "</td>\r\n                          <td>" . $staff['uname'] . "</td>";
                foreach ($roles as $thisrole) {
                    echo "<td><img src='" . XHELP_BASE_URL . "/images/";
                    echo in_array($thisrole->getVar('name'), explode(', ', $staff['roles'])) ? "on.png" : "off.png";
                    echo "' /></td>";
                }
                echo "    <td>\r\n                          <a href='" . XHELP_ADMIN_URL . "/staff.php?op=editStaff&amp;uid=" . $uid . "'><img src='" . XOOPS_URL . "/modules/xhelp/images/button_edit.png' title='" . _AM_XHELP_TEXT_EDIT . "' name='editStaff' /></a>&nbsp;\r\n                          <a href='" . XHELP_ADMIN_URL . "/department.php?op=deleteStaffDept&amp;uid=" . $uid . "&amp;deptid=" . $deptID . "'><img src='" . XOOPS_URL . "/modules/xhelp/images/button_delete.png' title='" . _AM_XHELP_TEXT_DELETE_STAFF_DEPT . "' name='deleteStaffDept' /></a>\r\n                      </td>\r\n                  </tr>";
            }
            echo "<tr>\r\n                      <td class='foot' colspan='" . (3 + count($roles)) . "'>\r\n                          <input type='checkbox' name='checkallRoles' value='0' onclick='selectAll(this.form,\"staff[]\",this.checked);' />\r\n                          <input type='submit' name='deleteStaff' id='deleteStaff' value='" . _AM_XHELP_BUTTON_DELETE . "' />\r\n                      </td>\r\n                  </tr>";
            echo "</table></form>";
            echo "<div id='staff_nav'>" . $nav->renderNav() . "</div>";
        } else {
            echo "</table></form>";
        }
        //now do the list of servers
        $hDeptServers =& xhelpGetHandler('departmentMailBox');
        $deptServers =& $hDeptServers->getByDepartment($deptID);
        //iterate
        if (count($deptServers) > 0) {
            echo "<br /><table width='100%' cellspacing='1' class='outer'>\r\n               <tr>\r\n                 <th colspan='5'><label>" . _AM_XHELP_DEPARTMENT_SERVERS . "</label></th>\r\n               </tr>\r\n               <tr>\r\n                 <td class='head' width='20%'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_EMAIL . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_TYPE . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_SERVERNAME . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_PORT . "</label></td>\r\n                 <td class='head'><label>" . _AM_XHELP_DEPARTMENT_SERVERS_ACTION . "</label></td>\r\n               </tr>";
            $i = 0;
            foreach ($deptServers as $server) {
                if ($server->getVar('active')) {
                    $activ_link = '".XHELP_ADMIN_URL."/department.php?op=activateMailbox&amp;setstate=0&amp;id=' . $server->getVar('id');
                    $activ_img = $imagearray['online'];
                    $activ_title = _AM_XHELP_MESSAGE_DEACTIVATE;
                } else {
                    $activ_link = '".XHELP_ADMIN_URL."/department.php?op=activateMailbox&amp;setstate=1&amp;id=' . $server->getVar('id');
                    $activ_img = $imagearray['offline'];
                    $activ_title = _AM_XHELP_MESSAGE_ACTIVATE;
                }
                echo '<tr class="even">
                   <td>' . $server->getVar('emailaddress') . '</td>
                   <td>' . xhelpGetMBoxType($server->getVar('mboxtype')) . '</td>
                   <td>' . $server->getVar('server') . '</td>
                   <td>' . $server->getVar('serverport') . '</td>
                   <td> <a href="' . $activ_link . '" title="' . $activ_title . '">' . $activ_img . '</a>
                        <a href="' . XHELP_ADMIN_URL . '/department.php?op=EditDepartmentServer&amp;id=' . $server->GetVar('id') . '">' . $imagearray['editimg'] . '</a>
                        <a href="' . XHELP_ADMIN_URL . '/department.php?op=DeleteDepartmentServer&amp;id=' . $server->GetVar('id') . '">' . $imagearray['deleteimg'] . '</a>

                   </td>
                 </tr>';
            }
            echo '</table>';
        }
        //finally add Mailbox form
        echo "<br /><br />";
        $formElements = array('type_select', 'server_text', 'port_text', 'username_text', 'pass_text', 'priority_radio', 'email_text', 'btn_tray');
        $form = new xhelpForm(_AM_XHELP_DEPARTMENT_ADD_SERVER, 'add_server', xhelpMakeURI(XHELP_ADMIN_URL . '/department.php', array('op' => 'AddDepartmentServer', 'id' => $deptID)));
        $type_select = new XoopsFormSelect(_AM_XHELP_DEPARTMENT_SERVERS_TYPE, 'mboxtype');
        $type_select->setExtra("id='mboxtype'");
        $type_select->addOption(_XHELP_MAILBOXTYPE_POP3, _AM_XHELP_MBOX_POP3);
        $server_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVERS_SERVERNAME, 'server', 40, 50);
        $server_text->setExtra("id='txtServer'");
        $port_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVERS_PORT, 'port', 5, 5, "110");
        $port_text->setExtra("id='txtPort'");
        $username_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_USERNAME, 'username', 25, 50);
        $username_text->setExtra("id='txtUsername'");
        $pass_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_PASSWORD, 'password', 25, 50);
        $pass_text->setExtra("id='txtPassword'");
        $priority_radio = new xhelpFormRadio(_AM_XHELP_DEPARTMENT_SERVERS_PRIORITY, 'priority', XHELP_DEFAULT_PRIORITY);
        $priority_array = array('1' => "<label for='priority1'><img src='" . XHELP_IMAGE_URL . "/priority1.png' title='" . xhelpGetPriority(1) . "' alt='priority1' /></label>", '2' => "<label for='priority2'><img src='" . XHELP_IMAGE_URL . "/priority2.png' title='" . xhelpGetPriority(2) . "' alt='priority2' /></label>", '3' => "<label for='priority3'><img src='" . XHELP_IMAGE_URL . "/priority3.png' title='" . xhelpGetPriority(3) . "' alt='priority3' /></label>", '4' => "<label for='priority4'><img src='" . XHELP_IMAGE_URL . "/priority4.png' title='" . xhelpGetPriority(4) . "' alt='priority4' /></label>", '5' => "<label for='priority5'><img src='" . XHELP_IMAGE_URL . "/priority5.png' title='" . xhelpGetPriority(5) . "' alt='priority5' /></label>");
        $priority_radio->addOptionArray($priority_array);
        $email_text = new XoopsFormText(_AM_XHELP_DEPARTMENT_SERVER_EMAILADDRESS, 'emailaddress', 50, 255);
        $email_text->setExtra("id='txtEmailaddress'");
        $btn_tray = new XoopsFormElementTray('');
        $test_button = new XoopsFormButton('', 'email_test', _AM_XHELP_BUTTON_TEST, 'button');
        $test_button->setExtra("id='test'");
        $submit_button = new XoopsFormButton('', 'updateDept2', _AM_XHELP_BUTTON_SUBMIT, 'submit');
        $cancel2_button = new XoopsFormButton('', 'cancel2', _AM_XHELP_BUTTON_CANCEL, 'button');
        $cancel2_button->setExtra("onclick='history.go(-1)'");
        $btn_tray->addElement($test_button);
        $btn_tray->addElement($submit_button);
        $btn_tray->addElement($cancel2_button);
        $form->setLabelWidth('20%');
        foreach ($formElements as $element) {
            $form->addElement(${$element});
        }
        echo $form->render();
        echo "<script type=\"text/javascript\" language=\"javascript\">\r\n          <!--\r\n          function xhelpEmailTest()\r\n          {\r\n            pop = openWithSelfMain(\"\", \"email_test\", 250, 150);\r\n            frm = xoopsGetElementById(\"add_server\");\r\n            newaction = \"department.php?op=testMailbox\";\r\n            oldaction = frm.action;\r\n            frm.action = newaction;\r\n            frm.target = \"email_test\";\r\n            frm.submit();\r\n            frm.action = oldaction;\r\n            frm.target = \"main\";\r\n\r\n          }\r\n\r\n          xhelpDOMAddEvent(xoopsGetElementById(\"email_test\"), \"click\", xhelpEmailTest, false);\r\n\r\n          //-->\r\n          </script>";
        xhelpAdminFooter();
        xoops_cp_footer();
    }
}
Esempio n. 20
0
##  source code which is considered copyrighted (c) material of the          ##
##  original comment or credit authors.                                      ##
##                                                                           ##
##  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 ##
###############################################################################
##  URL: http://www.frxoops.org/                                             ##
##  Project: Formulaire                                                      ##
###############################################################################
if (!preg_match("/elements.php/", $_SERVER['PHP_SELF'])) {
    exit("Access Denied");
}
$size = !empty($value[0]) ? intval($value[0]) : $xoopsModuleConfig['t_width'];
$max = !empty($value[1]) ? intval($value[1]) : $xoopsModuleConfig['t_max'];
$size = new XoopsFormText(_AM_ELE_SIZE, 'ele_value[0]', 3, 3, $size);
$max = new XoopsFormText(_AM_ELE_MAX_LENGTH, 'ele_value[1]', 3, 3, $max);
//the &#146 is a simple quote, it replace the quote witch cause crash in rendering the form
//not really good :-(
$value[2] = eregi_replace("'", "&#146;", $value[2]);
//
$default = new XoopsFormText(_AM_ELE_DEFAULT, 'ele_value[2]', 50, 255, $value[2]);
$default->setDescription(_AM_ELE_TEXT_DESC);
$form->addElement($size, 1);
$form->addElement($max, 1);
$form->addElement($default);
Esempio n. 21
0
         case 'color':
             $myts =& MyTextSanitizer::getInstance();
             $ele = new XoopsFormColorPicker($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
             break;
         case 'hidden':
             $myts =& MyTextSanitizer::getInstance();
             $ele = new XoopsFormHidden($config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
             break;
         case 'line_break':
             $myts =& MyTextSanitizer::getInstance();
             $form->insertBreak('<center>' . $title . '</center>', $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
             break;
         case 'textbox':
         default:
             $myts =& MyTextSanitizer::getInstance();
             $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput()));
             break;
     }
     if (isset($ele)) {
         $ele->setDescription($description);
         $form->addElement($ele);
     }
     $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id'));
     $form->addElement($hidden);
     unset($ele);
     unset($hidden);
 }
 $form->addElement(new XoopsFormHidden('op', 'save'));
 $form->addElement(new XoopsFormButton('', 'button', _GO, 'submit'));
 if ($module->getVar('name') == 'System') {
     // Define Breadcrumb
Esempio n. 22
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');
    }
}
Esempio n. 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);
    }
}
Esempio n. 24
0
 }
 $productsSelect = $h_oledrion_products->productSelector(new oledrion_parameters(array('caption' => _OLEDRION_RELATED_PRODUCTS, 'name' => 'relatedproducts', 'value' => $productRelated_d, 'size' => 5, 'multiple' => true, 'values' => $productRelated_d, 'showAll' => true, 'sort' => 'product_title', 'order' => 'ASC', 'formName' => 'frmproduct')));
 $sform->addElement($productsSelect);
 // ********************************************************************
 if (oledrion_utils::getModuleOption('use_price')) {
     // TVA ****************************************************************
     $vatSelect = new XoopsFormSelect(_OLEDRION_VAT, 'product_vat_id', $item->getVar('product_vat_id'));
     $vatSelect->addOptionArray($vatsForDisplay);
     $sform->addElement($vatSelect, true);
     $sform->addElement(new XoopsFormText(_OLEDRION_PRICE, 'product_price', 20, 20, $item->getVar('product_price', 'e')), true);
     $sform->addElement(new XoopsFormText(_AM_OLEDRION_DISCOUNT_HLP, 'product_discount_price', 20, 20, $item->getVar('product_discount_price', 'e')), false);
     $sform->addElement(new XoopsFormText(_OLEDRION_SHIPPING_PRICE, 'product_shipping_price', 20, 20, $item->getVar('product_shipping_price', 'e')), false);
     $sform->addElement(new XoopsFormText(_OLEDRION_ECOTAXE, 'product_ecotaxe', 10, 10, $item->getVar('product_ecotaxe', 'e')), false);
 }
 $sform->addElement(new XoopsFormText(_OLEDRION_STOCK_QUANTITY, 'product_stock', 10, 10, $item->getVar('product_stock', 'e')), false);
 $alertStock = new XoopsFormText(_OLEDRION_STOCK_ALERT, 'product_alert_stock', 10, 10, $item->getVar('product_alert_stock', 'e'));
 $alertStock->setDescription(_AM_OLEDRION_STOCK_HLP);
 $sform->addElement($alertStock, false);
 $editor2 = oledrion_utils::getWysiwygForm(_OLEDRION_SUMMARY, 'product_summary', $item->getVar('product_summary', 'e'), 15, 60, 'summary_hidden');
 if ($editor2) {
     $sform->addElement($editor2, false);
 }
 $editor = oledrion_utils::getWysiwygForm(_OLEDRION_DESCRIPTION, 'product_description', $item->getVar('product_description', 'e'), 15, 60, 'description_hidden');
 if ($editor) {
     $sform->addElement($editor, false);
 }
 // Tags
 if (oledrion_utils::getModuleOption('use_tags')) {
     require_once XOOPS_ROOT_PATH . '/modules/tag/include/formtag.php';
     $sform->addElement(new XoopsFormTag('item_tag', 60, 255, $item->getVar('product_id'), 0));
 }
Esempio n. 25
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>";
}
Esempio n. 26
0
    if ($forum->getVar('allow_subject_prefix')) {
        $subject_add = new XoopsFormElementTray(_MD_TOPIC_SUBJECTC, '');
        $subjectpres = explode(',', $xoopsModuleConfig['subject_prefix']);
        $subjectpres = array_map('trim', $subjectpres);
        if (count($subjectpres) > 1) {
            foreach ($subjectpres as $subjectpre) {
                $subject_array[] = trim($subjectpre);
            }
            $subject_select = new XoopsFormSelect('', 'subject_pre', $subject_pre);
            $subject_select->addOptionArray($subject_array);
            $subject_add->addElement(new XoopsFormLabel($subject_select->render()));
        }
        $forum_form->addElement($subject_add);
    }
}
$subject_form = new XoopsFormText(_MD_SUBJECTC, 'subject', 60, 100, $subject);
$subject_form->setExtra("tabindex='1'");
$forum_form->addElement($subject_form, true);
if (!is_object($xoopsUser) && empty($admin_form_action)) {
    $required = empty($xoopsModuleConfig["require_name"]) ? false : true;
    $forum_form->addElement(new XoopsFormText(_MD_NAMEMAIL, 'poster_name', 60, 255, !empty($isedit) && !empty($poster_name) ? $poster_name : ''), $required);
}
$icons_radio = new XoopsFormRadio(_MD_MESSAGEICON, 'icon', $icon);
$subject_icons = XoopsLists::getSubjectsList();
foreach ($subject_icons as $iconfile) {
    $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />');
}
$forum_form->addElement($icons_radio);
$nohtml = $forum->getVar('allow_html') ? false : true;
if (!empty($editor)) {
    newbb_setcookie("editor", $editor);
Esempio n. 27
0
 function getEventForm($siteSide = 'user', $mode = 'new', $data = null)
 {
     $catHandler = xoops_getmodulehandler('cat', 'extcal');
     $fileHandler = xoops_getmodulehandler('file', 'extcal');
     if ($siteSide == 'admin') {
         $action = 'event.php?op=enreg';
         $cats = $catHandler->getAllCat($GLOBALS['xoopsUser'], 'all');
     } else {
         $action = 'post.php';
         $cats = $catHandler->getAllCat($GLOBALS['xoopsUser']);
     }
     $reccurOptions = array();
     if ($mode == 'edit') {
         if (!($event = $this->getEventWithNotApprove($data['event_id']))) {
             return false;
         }
         $formTitle = _MD_EXTCAL_EDIT_EVENT;
         $formName = 'modify_event';
         $title = $event->getVar('event_title', 'e');
         $cat = $event->getVar('cat_id');
         $desc = $event->getVar('event_desc', 'e');
         $nbMember = $event->getVar('event_nbmember', 'e');
         $contact = $event->getVar('event_contact', 'e');
         $url = $event->getVar('event_url', 'e');
         $email = $event->getVar('event_email', 'e');
         $address = $event->getVar('event_address', 'e');
         $startDateValue = xoops_getUserTimestamp($event->getVar('event_start'), $this->_extcalTime->_getUserTimeZone($GLOBALS['xoopsUser']));
         $endDateValue = xoops_getUserTimestamp($event->getVar('event_end'), $this->_extcalTime->_getUserTimeZone($GLOBALS['xoopsUser']));
         // Configuring recurring form
         $eventOptions = explode('|', $event->getVar('event_recur_rules'));
         $reccurMode = $eventOptions[0];
         array_shift($eventOptions);
         switch ($reccurMode) {
             case 'daily':
                 $reccurOptions['rrule_freq'] = 'daily';
                 $reccurOptions['rrule_daily_interval'] = $eventOptions[0];
                 break;
             case 'weekly':
                 $reccurOptions['rrule_freq'] = 'weekly';
                 $reccurOptions['rrule_weekly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_weekly_bydays'] = $eventOptions;
                 break;
             case 'monthly':
                 $reccurOptions['rrule_freq'] = 'monthly';
                 $reccurOptions['rrule_monthly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_bymonthday'] = $eventOptions;
                 break;
             case 'yearly':
                 $reccurOptions['rrule_freq'] = 'yearly';
                 $reccurOptions['rrule_yearly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_byday'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_bymonths'] = $eventOptions;
                 break;
         }
         $files = $fileHandler->objectToArray($fileHandler->getEventFiles($data['event_id']));
         $fileHandler->formatFilesSize($files);
     } elseif ($mode == 'preview') {
         $formTitle = _MD_EXTCAL_SUBMIT_EVENT;
         $formName = 'submit_event';
         $title = $data['event_title'];
         $cat = $data['cat_id'];
         $desc = $data['event_desc'];
         $nbMember = $data['event_nbmember'];
         $contact = $data['event_contact'];
         $url = $data['event_url'];
         $email = $data['event_email'];
         $address = $data['event_address'];
         $startDateValue = $data['event_start'];
         $endDateValue = $data['event_end'];
         $eventEndOk = $data['have_end'];
         // Configuring recurring form
         $eventOptions = explode('|', $event['event_recur_rules']);
         $reccurMode = $eventOptions[0];
         array_shift($eventOptions);
         switch ($reccurMode) {
             case 'daily':
                 $reccurOptions['rrule_freq'] = 'daily';
                 $reccurOptions['rrule_daily_interval'] = $eventOptions[0];
                 break;
             case 'weekly':
                 $reccurOptions['rrule_freq'] = 'weekly';
                 $reccurOptions['rrule_weekly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_weekly_bydays'] = $eventOptions;
                 break;
             case 'monthly':
                 $reccurOptions['rrule_freq'] = 'monthly';
                 $reccurOptions['rrule_monthly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_bymonthday'] = $eventOptions;
                 break;
             case 'yearly':
                 $reccurOptions['rrule_freq'] = 'yearly';
                 $reccurOptions['rrule_yearly_interval'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_byday'] = $eventOptions[0];
                 array_shift($eventOptions);
                 $reccurOptions['rrule_yearly_bymonths'] = $eventOptions;
                 break;
         }
         $files = $fileHandler->objectToArray($fileHandler->getEventFiles($data['event_id']));
         $fileHandler->formatFilesSize($files);
     } else {
         $formTitle = _MD_EXTCAL_SUBMIT_EVENT;
         $formName = 'submit_event';
         $title = '';
         $cat = '';
         $desc = '';
         $nbMember = 0;
         $contact = '';
         $url = '';
         $email = '';
         $address = '';
         $startDateValue = 0;
         $endDateValue = 0;
         $eventEndOk = 0;
         $files = array();
     }
     // Create XoopsForm Object
     $form = new ExtcalThemeForm($formTitle, 'event_form', $action, 'post', true);
     // Add this extra to allow file upload
     $form->setExtra('enctype="multipart/form-data"');
     // Category select
     $catSelect = new XoopsFormSelect(_MD_EXTCAL_CATEGORY, 'cat_id', $cat);
     foreach ($cats as $cat) {
         $catSelect->addOption($cat->getVar('cat_id'), $cat->getVar('cat_name'));
     }
     $form->addElement($catSelect, true);
     // Title
     $form->addElement(new XoopsFormText(_MD_EXTCAL_TITLE, 'event_title', 30, 255, $title), true);
     // Start and end
     new ExtcalFormDateTime($form, $startDateValue, $endDateValue);
     // Description
     $form->addElement(new XoopsFormDhtmlTextArea(_MD_EXTCAL_DESCRIPTION, 'event_desc', $desc, 10), false);
     // Max registered member for this event
     $nbMemberElement = new XoopsFormText(_MD_EXTCAL_NBMEMBER, 'event_nbmember', 4, 4, $nbMember);
     $nbMemberElement->setDescription(_MD_EXTCAL_NBMEMBER_DESC);
     $form->addElement($nbMemberElement, false);
     // Contact
     $form->addElement(new XoopsFormText(_MD_EXTCAL_CONTACT, 'event_contact', 30, 255, $contact), false);
     // Url
     $form->addElement(new XoopsFormText(_MD_EXTCAL_URL, 'event_url', 30, 255, $url), false);
     // Email
     $form->addElement(new XoopsFormText(_MD_EXTCAL_EMAIL, 'event_email', 30, 255, $email), false);
     // Address
     $form->addElement(new XoopsFormDhtmlTextArea(_MD_EXTCAL_ADDRESS, 'event_address', $address), false);
     // Recurence form
     $form->addElement(new ExtcalFormRecurRules($reccurOptions));
     // File attachement
     $fileElmtTray = new XoopsFormElementTray(_MD_EXTCAL_FILE_ATTACHEMENT, "<br />");
     // If they are attached file to this event
     if (count($files) > 0) {
         $eventFiles = new ExtcalFormFileCheckBox('', 'filetokeep');
         foreach ($files as $file) {
             $name = $file['file_nicename'] . " (<i>" . $file['file_mimetype'] . "</i>) " . $file['formated_file_size'];
             $eventFiles->addOption($file['file_id'], $name);
         }
         $fileElmtTray->addElement($eventFiles);
     }
     $fileElmtTray->addElement(new XoopsFormFile(_MD_EXTCAL_FILE_ATTACHEMENT, 'event_file', 3145728));
     $form->addElement($fileElmtTray);
     if (isset($data['event_id'])) {
         $form->addElement(new XoopsFormHidden('event_id', $data['event_id']), false);
     }
     $buttonElmtTray = new XoopsFormElementTray('', "&nbsp;");
     $buttonElmtTray->addElement(new XoopsFormButton("", "form_submit", _SEND, "submit"), false);
     if ($siteSide == 'user') {
         $buttonElmtTray->addElement(new XoopsFormButton("", "form_preview", _MD_EXTCAL_PREVIEW, "submit"), false);
     }
     $form->addElement($buttonElmtTray);
     return $form;
 }
Esempio n. 28
0
 function optOther($s = '', $id, $entry, $counter, $checkbox = false)
 {
     static $blankSubformCounters = array();
     global $xoopsModuleConfig, $xoopsDB;
     if (!preg_match('/\\{OTHER\\|+[0-9]+\\}/', $s)) {
         return false;
     }
     // deal with displayElement elements...
     $id_parts = explode("_", $id);
     /* // displayElement elements will be in the format de_{id_req}_{ele_id} (deh?)
     		// regular elements will be in the format ele_{ele_id}
     		if(count($id_parts) == 3) {
     			$ele_id = $id_parts[2];
     		} else {
     			$ele_id = $id_parts[1];
     		}*/
     // NOW, in Formulize 3, id_parts[3] will always be the element id. :-)
     $ele_id = $id_parts[3];
     // gather the current value if there is one
     $other_text = "";
     if (is_numeric($entry)) {
         $otherq = q("SELECT other_text FROM " . $xoopsDB->prefix("formulize_other") . " WHERE id_req='{$entry}' AND ele_id='{$ele_id}' LIMIT 0,1");
         $other_text = $otherq[0]['other_text'];
     }
     if (strstr($_SERVER['PHP_SELF'], "formulize/printview.php")) {
         return $other_text;
     }
     $s = explode('|', preg_replace('/[\\{\\}]/', '', $s));
     $len = !empty($s[1]) ? $s[1] : $xoopsModuleConfig['t_width'];
     if ($entry == "new") {
         $blankSubformCounters[$ele_id] = isset($blankSubformCounters[$ele_id]) ? $blankSubformCounters[$ele_id] + 1 : 0;
         $blankSubformCounter = $blankSubformCounters[$ele_id];
         $otherKey = 'ele_' . $ele_id . '_' . $entry . '_' . $blankSubformCounter;
     } else {
         $otherKey = 'ele_' . $ele_id . '_' . $entry;
     }
     $box = new XoopsFormText('', 'other[' . $otherKey . ']', $len, 255, $other_text);
     if ($checkbox) {
         $box->setExtra("onchange=\"javascript:formulizechanged=1;\" onfocus=\"javascript:this.form.elements['" . $id . "[]'][{$counter}].checked = true;\"");
     } else {
         $box->setExtra("onchange=\"javascript:formulizechanged=1;\" onfocus=\"javascript:this.form." . $id . "[{$counter}].checked = true;\"");
     }
     return $box->render();
 }
Esempio n. 29
0
 function createElements()
 {
     global $xoopsDB;
     $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
     // Parent Category
     ob_start();
     $mytree->makeMySelBox("name", "weight", $this->targetObject->parentid(), 1, 'parentid');
     //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
     $this->addElement(new XoopsFormLabel(_AM_SSECTION_PARENT_CATEGORY_EXP, ob_get_contents()));
     ob_end_clean();
     // Name
     $this->addElement(new XoopsFormText(_AM_SSECTION_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
     // Description
     $this->addElement(new XoopsFormTextArea(_AM_SSECTION_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
     if (SMARTSECTION_LEVEL > 0) {
         // Header
         $text_header = smartsection_getEditor(_AM_SSECTION_CATEGORY_HEADER, 'header', $this->targetObject->header('e'));
         $text_header->setDescription(_AM_SSECTION_CATEGORY_HEADER_DSC);
         $this->addElement($text_header);
     }
     // IMAGE
     $image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('category'));
     $image_select = new XoopsFormSelect('', 'image', $this->targetObject->image());
     //$image_select -> addOption ('-1', '---------------');
     $image_select->addOptionArray($image_array);
     $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
     $image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE, '&nbsp;');
     $image_tray->addElement($image_select);
     $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('category', false) . $this->targetObject->image() . "' name='image3' id='image3' alt='' />"));
     $image_tray->setDescription(_AM_SSECTION_IMAGE_DSC);
     $this->addElement($image_tray);
     // IMAGE UPLOAD
     $max_size = 5000000;
     $file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size);
     $file_box->setExtra("size ='45'");
     $file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_DSC);
     $this->addElement($file_box);
     if (SMARTSECTION_LEVEL > 0) {
         // Short url
         $text_short_url = new XoopsFormText(_AM_SSECTION_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
         $text_short_url->setDescription(_AM_SSECTION_CATEGORY_SHORT_URL_DSC);
         $this->addElement($text_short_url);
         // Meta Keywords
         $text_meta_keywords = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
         $text_meta_keywords->setDescription(_AM_SSECTION_CATEGORY_META_KEYWORDS_DSC);
         $this->addElement($text_meta_keywords);
         // Meta Description
         $text_meta_description = new XoopsFormTextArea(_AM_SSECTION_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
         $text_meta_description->setDescription(_AM_SSECTION_CATEGORY_META_DESCRIPTION_DSC);
         $this->addElement($text_meta_description);
     }
     // Weight
     $this->addElement(new XoopsFormText(_AM_SSECTION_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
     if (SMARTSECTION_LEVEL > 0) {
         // Added by skalpa: custom template support
         $this->addElement(new XoopsFormText("Custom template", 'template', 50, 255, $this->targetObject->template('e')), false);
     }
     // READ PERMISSIONS
     $groups_read_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_READ, 'groups_read[]', $this->targetObject->getGroups_read());
     foreach ($this->userGroups as $group_id => $group_name) {
         if ($group_id != XOOPS_GROUP_ADMIN) {
             $groups_read_checkbox->addOption($group_id, $group_name);
         }
     }
     $this->addElement($groups_read_checkbox);
     // Apply permissions on all items
     $apply = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0;
     $addapplyall_radio = new XoopsFormRadioYN(_AM_SSECTION_PERMISSIONS_APPLY_ON_ITEMS, 'applyall', $apply, ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
     $this->addElement($addapplyall_radio);
     // SUBMIT PERMISSIONS
     $groups_submit_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $this->targetObject->getGroups_submit());
     $groups_submit_checkbox->setDescription(_AM_SSECTION_PERMISSIONS_CAT_SUBMIT_DSC);
     foreach ($this->userGroups as $group_id => $group_name) {
         if ($group_id != XOOPS_GROUP_ADMIN) {
             $groups_submit_checkbox->addOption($group_id, $group_name);
         }
     }
     $this->addElement($groups_submit_checkbox);
     if (SMARTSECTION_LEVEL > 0) {
         // Added by fx2024
         // sub Categories
         $cat_tray = new XoopsFormElementTray(_AM_SSECTION_SCATEGORYNAME, '<br /><br />');
         for ($i = 0; $i < $this->subCatsCount; $i++) {
             if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
                 $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
             } else {
                 $subname = '';
             }
             $cat_tray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname), true);
         }
         $t = new XoopsFormText('', 'nb_subcats', 3, 2);
         $l = new XoopsFormLabel('', sprintf(_AM_SSECTION_ADD_OPT, $t->render()));
         $b = new XoopsFormButton('', 'submit', _AM_SSECTION_ADD_OPT_SUBMIT, 'submit');
         if (!$this->targetObject->categoryid()) {
             $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
         } else {
             $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
         }
         $r = new XoopsFormElementTray('');
         $r->addElement($l);
         $r->addElement($b);
         $cat_tray->addElement($r);
         $this->addElement($cat_tray);
         //End of fx2024 code
     }
     /*
     $module_id = $xoopsModule->getVar('mid');	
     $gperm_handler = &xoops_gethandler('groupperm');
     $mod_perms = $gperm_handler->getGroupIds('category_moderation', $categoryid, $module_id);
     
     $moderators_select = new XoopsFormSelect('', 'moderators', $moderators, 5, true);
     $moderators_tray->addElement($moderators_select);
     
     $butt_mngmods = new XoopsFormButton('', '', 'Manage mods', 'button');
     $butt_mngmods->setExtra('onclick="javascript:small_window(\'pop.php\', 370, 350);"');
     $moderators_tray->addElement($butt_mngmods);
     
     $butt_delmod = new XoopsFormButton('', '', 'Delete mod', 'button');
     $butt_delmod->setExtra('onclick="javascript:deleteSelectedItemsFromList(this.form.elements[\'moderators[]\']);"');
     $moderators_tray->addElement($butt_delmod);
     
     $this->addElement($moderators_tray);
     */
     $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid()));
     //$parentid = $this->targetObject->parentid('s');
     //$this -> addElement( new XoopsFormHidden( 'parentid', $parentid ) );
     $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount));
 }
Esempio n. 30
0
	</script>
';
$member_handler =& xoops_gethandler('member');
if (!empty($_REQUEST["action"])) {
    $rank_handler = xoops_gethandler('rank');
    $ranks =& $rank_handler->getList();
    $groups =& $member_handler->getGroupList();
    $ranks[0] = _NONE;
    $groups[0] = _NONE;
}
if (empty($_REQUEST["action"])) {
    $form_sel = new XoopsThemeForm(_MA_LOOKUP_USER, "selectusers", xoops_getenv('PHP_SELF'));
    $sel_box = new XoopsFormSelect(_MA_SEARCHBY, 'subject', empty($_REQUEST['subject']) ? NULL : $_REQUEST['subject']);
    $sel_box->addOptionArray($valid_subjects);
    $form_sel->addElement($sel_box);
    $searchtext = new XoopsFormText(_MA_SEARCH_TEXT, 'searchText', 60, 255, empty($_REQUEST['searchText']) ? NULL : $_REQUEST['searchText']);
    $searchtext->setDescription(_MA_SEARCH_TEXT_DESC);
    $form_sel->addElement($searchtext);
    $close_button = new XoopsFormButton('', '', _CLOSE, 'button');
    $close_button->setExtra('onclick="window.close()"');
    $button_tray = new XoopsFormElementTray("");
    $button_tray->addElement(new XoopsFormButton('', 'search', _SEARCH, 'submit'));
    $button_tray->addElement($close_button);
    $form_sel->addElement(new XoopsFormHidden('action', $_REQUEST["action"]));
    $form_sel->addElement(new XoopsFormHidden('target', $_REQUEST["target"]));
    $form_sel->addElement(new XoopsFormHidden('multiple', $_REQUEST["multiple"]));
    $form_sel->addElement($button_tray);
    $form_sel->display();
}
if (!empty($_REQUEST["action"]) || !empty($_REQUEST["search"])) {
    $form_user = new XoopsThemeForm(_MA_SEARCH_SELECTUSER, "selectusers", xoops_getenv('PHP_SELF'));