示例#1
0
 /**
  * @return XoopsThemeForm
  */
 function getForm()
 {
     if ($this->isNew()) {
         $blank_img = 'blank.gif';
     } else {
         $blank_img = str_replace('avatars/', '', $this->getVar('avatar_file', 'e'));
     }
     // Get User Config
     $config_handler =& xoops_gethandler('config');
     $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
     // New and edit form
     $form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', "post", true);
     $form->setExtra('enctype="multipart/form-data"');
     // Name
     $form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
     // Name description
     $maxpixel = '<div>' . _US_MAXPIXEL . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
     $maxsize = '<div>' . _US_MAXIMGSZ . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
     // Upload part
     $imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br />');
     $imgtray_img->setDescription($maxpixel . $maxsize);
     $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars');
     $imageselect_img->addOption("{$blank_img}", $blank_img);
     foreach ($image_array_img as $image_img) {
         $imageselect_img->addOption("{$image_img}", $image_img);
     }
     $imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
     $fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
     $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
     $imgtray_img->addElement($fileseltray_img);
     $form->addElement($imgtray_img);
     // Weight
     $form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
     // Display
     $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
     // Hidden
     if ($this->isNew()) {
         $form->addElement(new XoopsFormHidden('avatar_type', 's'));
     }
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormHidden('fct', 'avatars'));
     $form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
     // Button
     $form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
     return $form;
 }
示例#2
0
 function getForm($action = false)
 {
     if ($this->isNew()) {
         $blank_img = 'blank.gif';
     } else {
         $blank_img = str_replace('ranks/', '', $this->getVar('rank_image', 'e'));
     }
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? sprintf(_AM_SYSTEM_USERRANK_ADD) : sprintf(_AM_SYSTEM_USERRANK_EDIT);
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     $form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_TITLE, 'rank_title', 50, 50, $this->getVar('rank_title'), true));
     $form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MINPOST, 'rank_min', 10, 10, $this->getVar('rank_min')));
     $form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MAXPOST, 'rank_max', 10, 10, $this->getVar('rank_max')));
     $imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_IMAGE, '<br />');
     $imgpath_img = sprintf(_AM_SYSTEM_USERRANK_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/ranks/');
     $imageselect_img = new XoopsFormSelect($imgpath_img, 'rank_image', $blank_img);
     $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/ranks');
     $imageselect_img->addOption("{$blank_img}", $blank_img);
     foreach ($image_array_img as $image_img) {
         $imageselect_img->addOption("{$image_img}", $image_img);
     }
     $imageselect_img->setExtra("onchange='showImgSelected(\"xo-ranks-img\", \"rank_image\", \"ranks\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />"));
     $fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
     $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_USERRANK_UPLOAD, 'rank_image', 500000), false);
     $fileseltray_img->addElement(new XoopsFormLabel(''), false);
     $imgtray_img->addElement($fileseltray_img);
     $form->addElement($imgtray_img);
     if (!$this->isNew()) {
         $rank_special = $this->getVar('rank_special');
     } else {
         $rank_special = 0;
     }
     $special_tray = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_SPECIAL, '<br />');
     $special_tray->setDescription(_AM_SYSTEM_USERRANK_SPECIAL_CAN);
     $special_tray->addElement(new XoopsFormRadioYN('', 'rank_special', $rank_special));
     $form->addElement($special_tray);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormHidden('rank_id', $this->getVar('rank_id')));
     }
     $form->addElement(new XoopsFormHidden('op', 'userrank_save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
 function adminUI($form, $value, $ele_id)
 {
     $myts =& MyTextSanitizer::getInstance();
     $options = array();
     $opt_count = 0;
     $addopt = $_POST['addopt'];
     if (!empty($ele_id)) {
         $keys = array_keys($value);
         for ($i = 0; $i < count($keys); $i++) {
             $r = $value[$keys[$i]] ? $opt_count : null;
             $v = $myts->makeTboxData4PreviewInForm($keys[$i]);
             $options[] = new xoopsFormText('', 'ele_value[' . $opt_count . ']', 40, 255, $v);
             // function in the admin/elements.php file
             $opt_count++;
         }
     }
     // added check below to add in blank rows that are unaccounted for above.
     // above code adds in all the options the user has typed in.  If there are blank rows on the form, this code will add in the appropriate amount, based on the 'rowcount' hidden element.
     // This code added by jwe 01/05/05
     if ($opt_count < $_POST['rowcount']) {
         for ($i = $opt_count; $i < $_POST['rowcount']; $i++) {
             $options[] = new xoopsFormText('', 'ele_value[' . $i . ']', 40, 255, '');
         }
         $opt_count = $_POST['rowcount'];
         // make the opt_count equal to the number of rows, since we've now brought the number back up to where it should be.
     }
     if (empty($addopt) and empty($ele_id)) {
         $addopt = 2;
     }
     for ($i = 0; $i < $addopt; $i++) {
         $options[] = new xoopsFormText('', 'ele_value[' . $opt_count . ']', 40, 255, '');
         $opt_count++;
     }
     // these two lines part of the jwe added code
     $rowcount = new XoopsFormHidden("rowcount", $opt_count);
     $form->addElement($rowcount);
     $opt_tray = new XoopsFormElementTray(_AM_ELE_OPT, '<br />');
     $opt_tray->setDescription(_AM_ELE_OPT_DESC_RANKORDERLISTS . '<br /><br />' . _AM_ELE_OPT_UITEXT);
     for ($i = 0; $i < count($options); $i++) {
         $opt_tray->addElement($options[$i]);
     }
     $opt_tray->addElement(addOptionsTray());
     $form->addElement($opt_tray);
     return $form;
 }
示例#4
0
 // Define Breadcrumb and tips
 $xoBreadCrumb->addLink(_AM_SYSTEM_MAINTENANCE_NAV_MANAGER, system_adminVersion('maintenance', 'adminpath'));
 $xoBreadCrumb->addHelp(system_adminVersion('maintenance', 'help'));
 $xoBreadCrumb->addTips(_AM_SYSTEM_MAINTENANCE_TIPS);
 $xoBreadCrumb->render();
 $maintenance = new SystemMaintenance();
 //Form Maintenance
 $form_maintenance = new XoopsThemeForm(_AM_SYSTEM_MAINTENANCE, 'maintenance_save', 'admin.php?fct=maintenance', 'post', true);
 $cache = new XoopsFormSelect(_AM_SYSTEM_MAINTENANCE_CACHE, 'cache', '', 3, true);
 $cache->setDescription(XOOPS_VAR_PATH . '/cache/smarty_cache/<br>' . XOOPS_VAR_PATH . '/cache/smarty_compile/<br>' . XOOPS_VAR_PATH . '/cache/xoops_cache/');
 $cache_arr = array(1 => 'smarty_cache', 2 => 'smarty_compile', 3 => 'xoops_cache');
 $cache->addOptionArray($cache_arr);
 $form_maintenance->addElement($cache);
 $form_maintenance->addElement(new XoopsFormRadioYN(_AM_SYSTEM_MAINTENANCE_SESSION, 'session', '', _YES, _NO));
 $tables_tray = new XoopsFormElementTray(_AM_SYSTEM_MAINTENANCE_TABLES, '');
 $tables_tray->setDescription(_AM_SYSTEM_MAINTENANCE_TABLES_DESC);
 $select_tables = new XoopsFormSelect('', 'tables', '', 7, true);
 $select_tables->addOptionArray($maintenance->displayTables(true));
 $tables_tray->addElement($select_tables, false);
 $tables_tray->addElement(new xoopsFormLabel('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . _AM_SYSTEM_MAINTENANCE_DUMP_AND . '&nbsp;'));
 $choice = new XoopsFormSelect('&nbsp;&nbsp;', 'maintenance', '', 4, true);
 $options = array('1' => _AM_SYSTEM_MAINTENANCE_CHOICE1, '2' => _AM_SYSTEM_MAINTENANCE_CHOICE2, '3' => _AM_SYSTEM_MAINTENANCE_CHOICE3, '4' => _AM_SYSTEM_MAINTENANCE_CHOICE4);
 $choice->addOptionArray($options);
 $tables_tray->addElement($choice, false);
 $form_maintenance->addElement($tables_tray);
 $form_maintenance->addElement(new XoopsFormRadioYN(_AM_SYSTEM_MAINTENANCE_AVATAR, 'avatar', '', _YES, _NO));
 $form_maintenance->addElement(new XoopsFormHidden('op', 'maintenance_save'));
 $form_maintenance->addElement(new XoopsFormButton('', 'maintenance_save', _SEND, 'submit'));
 //Form Dump
 $form_dump = new XoopsThemeForm(_AM_SYSTEM_MAINTENANCE_DUMP, 'dump_save', 'admin.php?fct=maintenance', 'post', true);
 $dump_tray = new XoopsFormElementTray(_AM_SYSTEM_MAINTENANCE_DUMP_TABLES_OR_MODULES, '');
示例#5
0
 echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SPARTNER_IMPORT_INFO . "</span>";
 global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts;
 include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
 $module_handler =& xoops_gethandler('module');
 if ($module_handler->getByDirname('xoopspartners')) {
     $importfile_select_array["xoopspartners"] = _AM_SPARTNER_IMPORT_XOOPSPARTNERS_110;
 }
 if (isset($importfile_select_array) && count($importfile_select_array) > 0) {
     $sform = new XoopsThemeForm(_AM_SPARTNER_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF'));
     $sform->setExtra('enctype="multipart/form-data"');
     // Partners to import
     $importfile_select = new XoopsFormSelect('', 'importfile', $importfile);
     $importfile_select->addOptionArray($importfile_select_array);
     $importfile_tray = new XoopsFormElementTray(_AM_SPARTNER_IMPORT_SELECT_FILE, '&nbsp;');
     $importfile_tray->addElement($importfile_select);
     $importfile_tray->setDescription(_AM_SPARTNER_IMPORT_SELECT_FILE_DSC);
     $sform->addElement($importfile_tray);
     // Buttons
     $button_tray = new XoopsFormElementTray('', '');
     $hidden = new XoopsFormHidden('op', 'importExecute');
     $button_tray->addElement($hidden);
     $butt_import = new XoopsFormButton('', '', _AM_SPARTNER_IMPORT, 'submit');
     $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
     $button_tray->addElement($butt_import);
     $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);
 } else {
示例#6
0
     $email_text = new XoopsFormText('', 'email', 30, 60, $xoopsUser->getVar('email'));
 } else {
     $email_text = new XoopsFormLabel('', $xoopsUser->getVar('email'));
 }
 $email_tray->addElement($email_text);
 $email_cbox_value = $xoopsUser->user_viewemail() ? 1 : 0;
 $email_cbox = new XoopsFormCheckBox('', 'user_viewemail', $email_cbox_value);
 $email_cbox->addOption(1, _US_ALLOWVIEWEMAIL);
 $email_tray->addElement($email_cbox);
 if (defined('ICMS_VERSION_NAME')) {
     $config_handler =& xoops_gethandler('config');
     $icmsauthConfig =& $config_handler->getConfigsByCat(XOOPS_CONF_AUTH);
     if ($icmsauthConfig['auth_openid'] == 1) {
         $openid_tray = new XoopsFormElementTray(_US_OPENID_FORM_CAPTION, '<br />');
         $openid_text = new XoopsFormText('', 'openid', 30, 255, $xoopsUser->getVar('openid'));
         $openid_tray->setDescription(_US_OPENID_FORM_DSC);
         $openid_tray->addElement($openid_text);
         $openid_cbox_value = $xoopsUser->user_viewoid() ? 1 : 0;
         $openid_cbox = new XoopsFormCheckBox('', 'user_viewoid', $openid_cbox_value);
         $openid_cbox->addOption(1, _US_ALLOWVIEWEMAILOPENID);
         $openid_tray->addElement($openid_cbox);
         $form->addElement($openid_tray);
     }
 }
 $form->addElement($email_tray);
 $url_text = new XoopsFormText(_US_WEBSITE, 'url', 30, 100, $xoopsUser->getVar('url', 'E'));
 $form->addElement($url_text);
 $timezone_select = new XoopsFormSelectTimezone(_US_TIMEZONE, 'timezone_offset', $xoopsUser->getVar('timezone_offset'));
 $icq_text = new XoopsFormText(_US_ICQ, 'user_icq', 15, 15, $xoopsUser->getVar('user_icq', 'E'));
 $aim_text = new XoopsFormText(_US_AIM, 'user_aim', 18, 18, $xoopsUser->getVar('user_aim', 'E'));
 $yim_text = new XoopsFormText(_US_YIM, 'user_yim', 25, 25, $xoopsUser->getVar('user_yim', 'E'));
示例#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;
}
示例#8
0
function edititem($showmenu = false, $itemid = 0, $clone = false)
{
    global $smartsection_current_page, $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    include_once SMARTSECTION_ROOT_PATH . '/class/formdatetime.php';
    // if there is a parameter, and the id exists, retrieve data: we're editing a item
    if ($itemid != 0) {
        // Creating the ITEM object
        $itemObj = $smartsection_item_handler->get($itemid);
        if (!$itemObj) {
            redirect_header("item.php", 1, _AM_SSECTION_NOITEMSELECTED);
            exit;
        }
        if ($clone) {
            $itemObj->setNew();
            $itemObj->setVar('status', _SSECTION_STATUS_NOTSET);
            $itemObj->setVar('datesub', time());
        }
        switch ($itemObj->status()) {
            case _SSECTION_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SSECTION_SUBMITTED;
                $breadcrumb_action2 = _AM_SSECTION_APPROVING;
                $page_title = _AM_SSECTION_SUBMITTED_TITLE;
                $page_info = _AM_SSECTION_SUBMITTED_INFO;
                $button_caption = _AM_SSECTION_APPROVE;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
            case _SSECTION_STATUS_PUBLISHED:
                $breadcrumb_action1 = _AM_SSECTION_PUBLISHED;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_PUBLISHEDEDITING;
                $page_info = _AM_SSECTION_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
            case _SSECTION_STATUS_OFFLINE:
                $breadcrumb_action1 = _AM_SSECTION_OFFLINE;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_OFFLINEEDITING;
                $page_info = _AM_SSECTION_OFFLINEEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_OFFLINE;
                break;
            case _SSECTION_STATUS_REJECTED:
                $breadcrumb_action1 = _AM_SSECTION_REJECTED;
                $breadcrumb_action2 = _AM_SSECTION_REJECTED;
                $page_title = _AM_SSECTION_REJECTED_EDIT;
                $page_info = _AM_SSECTION_REJECTED_EDIT_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_REJECTED;
                break;
            case _SSECTION_STATUS_NOTSET:
                // Then it's a clone...
                $breadcrumb_action1 = _AM_SSECTION_ITEMS;
                $breadcrumb_action2 = _AM_SSECTION_CLONE_NEW;
                $button_caption = _AM_SSECTION_CREATE;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                $page_title = _AM_SSECTION_ITEM_DUPLICATING;
                $page_info = _AM_SSECTION_ITEM_DUPLICATING_DSC;
                break;
            case "default":
            default:
                $breadcrumb_action1 = _AM_SSECTION_ITEMS;
                $breadcrumb_action2 = _AM_SSECTION_EDITING;
                $page_title = _AM_SSECTION_PUBLISHEDEDITING;
                $page_info = _AM_SSECTION_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SSECTION_MODIFY;
                $new_status = _SSECTION_STATUS_PUBLISHED;
                break;
        }
        $categoryObj = $itemObj->category();
        if ($showmenu) {
            smartsection_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        smartsection_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info);
        if (!$clone) {
            echo "<form><div style=\"margin-bottom: 10px;\">";
            echo "<input type='button' name='button' onclick=\"location='item.php?op=clone&itemid=" . $itemObj->itemid() . "'\" value='" . _AM_SSECTION_CLONE_ITEM . "'>&nbsp;&nbsp;";
            echo "</div></form>";
        }
    } else {
        // there's no parameter, so we're adding an item
        $itemObj =& $smartsection_item_handler->create();
        $itemObj->setVar('uid', $xoopsUser->uid());
        $categoryObj =& $smartsection_category_handler->create();
        $breadcrumb_action1 = _AM_SSECTION_ITEMS;
        $breadcrumb_action2 = _AM_SSECTION_CREATINGNEW;
        $button_caption = _AM_SSECTION_CREATE;
        $new_status = _SSECTION_STATUS_PUBLISHED;
        if ($showmenu) {
            smartsection_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0;
        $categoryObj->setVar('categoryid', $sel_categoryid);
        smartsection_collapsableBar('createitemtable', 'createitemicon', _AM_SSECTION_ITEM_CREATING, _AM_SSECTION_ITEM_CREATING_DSC);
    }
    // ITEM FORM
    $sform = new XoopsThemeForm(_AM_SSECTION_ITEMS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // CATEGORY
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    ob_start();
    //$sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid()));
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $category_label = new XoopsFormLabel(_AM_SSECTION_CATEGORY, ob_get_contents());
    $category_label->setDescription(_AM_SSECTION_CATEGORY_DSC);
    $sform->addElement($category_label);
    ob_end_clean();
    // TITLE
    $title_text = new XoopsFormText(_AM_SSECTION_TITLE, 'title', 50, 255, $itemObj->title(0, 'e'));
    $sform->addElement($title_text, true);
    if (SMARTSECTION_LEVEL >= 5) {
        // SUMMARY
        $summary_text = smartsection_getEditor(_AM_SSECTION_SUMMARY, 'summary', $itemObj->getVar('summary', 'e'));
        $summary_text->setDescription(_AM_SSECTION_SUMMARY_DSC);
        $sform->addElement($summary_text, false);
        // DISPLAY_SUMMARY
        $display_summary_radio = new XoopsFormRadioYN(_AM_SSECTION_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
        $sform->addElement($display_summary_radio);
    }
    // BODY
    /*if ($itemObj->address()) {
    		// Main body : pagewrap
    		$address_select = new XoopsFormSelect(_AM_SSECTION_BODY_SELECTFILE, "address", $itemObj->address());
    		$address_select->setDescription(_AM_SSECTION_BODY_SELECTFILE_DSC);
    	    $dir = smartsection_getUploadDir(true, 'content');
    		$folder = dir($dir);
    		while($file = $folder->read()) {
    	      if ($file != "." && $file != "..") {
    		     $address_select->addOption($file, "".$file."");
    		  }
    		}
    	    $folder->close();
    		$sform->addElement($address_select);
    
    		$sform->addElement(new XoopsFormHidden('body', ''));
    	} else {*/
    $body_text = smartsection_getEditor(_AM_SSECTION_BODY, 'body', $itemObj->getVar('body', 'e'));
    if (SMARTSECTION_LEVEL >= 5) {
        $body_text->setDescription(sprintf(_AM_SSECTION_BODY_DSC, SMARTSECTION_URL . "/admin/pagewrap_lookup.php"));
    }
    $sform->addElement($body_text);
    //}
    if (SMARTSECTION_LEVEL >= 5) {
        // Available pages to wrap
        $wrap_pages = XoopsLists::getHtmlListAsArray(smartsection_getUploadDir(true, 'content'));
        $available_wrap_pages_text = array();
        foreach ($wrap_pages as $page) {
            $available_wrap_pages_text[] = "<span onclick='smartsectionPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
        }
        $available_wrap_pages = new XoopsFormLabel(_AM_SSECTION_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text));
        $available_wrap_pages->setDescription(_AM_SSECTION_AVAILABLE_PAGE_WRAP_DSC);
        $sform->addElement($available_wrap_pages);
        // Tags
        if (smartsection_tag_module_included()) {
            include_once XOOPS_ROOT_PATH . "/modules/tag/include/formtag.php";
            $text_tags = new XoopsFormTag("item_tag", 60, 255, $itemObj->getVar('item_tag', 'e'), 0);
            $sform->addElement($text_tags);
        }
        // IMAGE
        $image_array = XoopsLists::getImgListAsArray(smartsection_getImageDir('item'));
        $image_select = new XoopsFormSelect('', 'image', $itemObj->image());
        //$image_select -> addOption ('-1', '---------------');
        $image_select->addOptionArray($image_array);
        $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
        $image_tray = new XoopsFormElementTray(_AM_SSECTION_IMAGE_ITEM, '&nbsp;');
        $image_tray->addElement($image_select);
        $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
        $image_tray->setDescription(_AM_SSECTION_IMAGE_ITEM_DSC);
        $sform->addElement($image_tray);
        // IMAGE UPLOAD
        $max_size = 5000000;
        $image_file_box = new XoopsFormFile(_AM_SSECTION_IMAGE_UPLOAD, "image_file", $max_size);
        $image_file_box->setExtra("size ='50'");
        $image_file_box->setDescription(_AM_SSECTION_IMAGE_UPLOAD_ITEM_DSC);
        $sform->addElement($image_file_box);
    }
    // File upload UPLOAD
    $file_box = new XoopsFormFile(smartsection_new_feature_tag() . _AM_SSECTION_ITEM_UPLOAD_FILE, "userfile", 0);
    $file_box->setDescription(_AM_SSECTION_ITEM_UPLOAD_FILE_DSC . smartsection_new_feature_tag());
    $file_box->setExtra("size ='50'");
    $sform->addElement($file_box);
    // Uid
    /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
    	    the method users::getobjects encounters a memory error
    	*/
    $uid = $itemObj->uid();
    $uid_select = new XoopsFormSelect(_AM_SSECTION_UID, 'uid', $uid, 1, false);
    $uid_select->setDescription(_AM_SSECTION_UID_DSC);
    $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC";
    $result = $xoopsDB->query($sql);
    $users_array = array();
    $users_array[0] = $xoopsConfig['anonymous'];
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $users_array[$myrow['uid']] = $myrow['uname'];
    }
    $uid_select->addOptionArray($users_array);
    $sform->addElement($uid_select);
    // Datesub
    $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub');
    $datesub_datetime = new SmartsectionFormDateTime(_AM_SSECTION_DATESUB, 'datesub', $size = 15, $datesub);
    $datesub_datetime->setDescription(_AM_SSECTION_DATESUB_DSC);
    $sform->addElement($datesub_datetime);
    // STATUS
    $options = array(_SSECTION_STATUS_PUBLISHED => _AM_SSECTION_PUBLISHED, _SSECTION_STATUS_OFFLINE => _AM_SSECTION_OFFLINE, _SSECTION_STATUS_SUBMITTED => _AM_SSECTION_SUBMITTED, _SSECTION_STATUS_REJECTED => _AM_SSECTION_REJECTED);
    $status_select = new XoopsFormSelect(_AM_SSECTION_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SSECTION_STATUS_DSC);
    $sform->addElement($status_select);
    if (SMARTSECTION_LEVEL > 0) {
        // Short url
        $text_short_url = new XoopsFormText(_AM_SSECTION_ITEM_SHORT_URL, 'short_url', 50, 255, $itemObj->short_url('e'));
        $text_short_url->setDescription(_AM_SSECTION_ITEM_SHORT_URL_DSC);
        $sform->addElement($text_short_url);
        // Meta Keywords
        $text_meta_keywords = new XoopsFormTextArea(_AM_SSECTION_ITEM_META_KEYWORDS, 'meta_keywords', $itemObj->meta_keywords('e'), 7, 60);
        $text_meta_keywords->setDescription(_AM_SSECTION_ITEM_META_KEYWORDS_DSC);
        $sform->addElement($text_meta_keywords);
        // Meta Description
        $text_meta_description = new XoopsFormTextArea(_AM_SSECTION_ITEM_META_DESCRIPTION, 'meta_description', $itemObj->meta_description('e'), 7, 60);
        $text_meta_description->setDescription(_AM_SSECTION_ITEM_META_DESCRIPTION_DSC);
        $sform->addElement($text_meta_description);
    }
    // WEIGHT
    $sform->addElement(new XoopsFormText(_AM_SSECTION_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true);
    if (SMARTSECTION_LEVEL >= 5) {
        // COMMENTS
        $addcomments_radio = new XoopsFormRadioYN(_AM_SSECTION_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
        $sform->addElement($addcomments_radio);
    }
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list = $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read());
    $groups_checkbox->setDescription(_AM_SSECTION_PERMISSIONS_ITEM_DSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    $p_view_checkbox = new XoopsFormCheckBox(_AM_SSECTION_PARTIAL_VIEW, 'partial_view[]', $itemObj->partial_view());
    $p_view_checkbox->setDescription(_AM_SSECTION_PARTIAL_VIEWDSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $p_view_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($p_view_checkbox);
    /*$partial_view_radio = new XoopsFormRadioYN(_AM_SSECTION_PARTIAL_VIEW, 'partial_view', $itemObj->partial_view(), ' ' . _AM_SSECTION_YES . '', ' ' . _AM_SSECTION_NO . '');
    	$partial_view_radio->setDescription(_AM_SSECTION_PARTIAL_VIEWDSC);
    	$sform->addElement($partial_view_radio);*/
    if (SMARTSECTION_LEVEL >= 5) {
        // VARIOUS OPTIONS
        $options_tray = new XoopsFormElementTray(_AM_SSECTION_OPTIONS, '<br />');
        $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml());
        $html_checkbox->addOption(1, _AM_SSECTION_DOHTML);
        $options_tray->addElement($html_checkbox);
        $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley());
        $smiley_checkbox->addOption(1, _AM_SSECTION_DOSMILEY);
        $options_tray->addElement($smiley_checkbox);
        $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode());
        $xcodes_checkbox->addOption(1, _AM_SSECTION_DOXCODE);
        $options_tray->addElement($xcodes_checkbox);
        $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage());
        $images_checkbox->addOption(1, _AM_SSECTION_DOIMAGE);
        $options_tray->addElement($images_checkbox);
        $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr());
        $linebreak_checkbox->addOption(1, _AM_SSECTION_DOLINEBREAK);
        $options_tray->addElement($linebreak_checkbox);
        $sform->addElement($options_tray);
    }
    // item ID
    if ($clone) {
        $itemid = 0;
    }
    $sform->addElement(new XoopsFormHidden('itemid', $itemid));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'additem');
    $button_tray->addElement($hidden);
    if (!$itemid) {
        // there's no itemid? Then it's a new item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SSECTION_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SSECTION_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SSECTION_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartsection_close_collapsable('createitemtable', 'createitemicon');
    } else {
        // else, we're editing an existing item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SSECTION_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        smartsection_close_collapsable('edititemtable', 'edititemicon');
    }
    if (SMARTSECTION_LEVEL >= 5) {
        smartsection_collapsableBar('pagewraptable', 'pagewrapicon', _AM_SSECTION_PAGEWRAP, _AM_SSECTION_PAGEWRAPDSC);
        $dir = smartsection_getUploadDir(true, 'content');
        if (!eregi("777", decoct(fileperms($dir)))) {
            echo "<font color='FF0000'><h4>" . _AM_SSECTION_PERMERROR . "</h4></font>";
        }
        // Upload File
        echo "<form name='form_name2' id='form_name2' action='pw_upload_file.php' method='post' enctype='multipart/form-data'>";
        echo "<table cellspacing='1' width='100%' class='outer'>";
        echo "<tr><th colspan='2'>" . _AM_SSECTION_UPLOAD_FILE . "</th></tr>";
        echo "<tr valign='top' align='left'><td class='head'>" . _AM_SSECTION_SEARCH_PW . "</td><td class='even'><input type='file' name='fileupload' id='fileupload' size='30' /></td></tr>";
        echo "<tr valign='top' align='left'><td class='head'><input type='hidden' name='MAX_FILE_SIZE' id='op' value='500000' /></td><td class='even'><input type='submit' name='submit' value='" . _AM_SSECTION_UPLOAD . "' /></td></tr>";
        echo "<input type='hidden' name='backto' value='{$smartsection_current_page}'/>";
        echo "</table>";
        echo "</form>";
        // Delete File
        $form = new XoopsThemeForm(_AM_SSECTION_DELETEFILE, "form_name", "pw_delete_file.php");
        $pWrap_select = new XoopsFormSelect(smartsection_getUploadDir(true, 'content'), "address");
        $folder = dir($dir);
        while ($file = $folder->read()) {
            if ($file != "." && $file != "..") {
                $pWrap_select->addOption($file, $file);
            }
        }
        $folder->close();
        $form->addElement($pWrap_select);
        $delfile = "delfile";
        $form->addElement(new XoopsFormHidden('op', $delfile));
        $submit = new XoopsFormButton("", "submit", _AM_SSECTION_BUTTON_DELETE, "submit");
        $form->addElement($submit);
        $form->addElement(new XoopsFormHidden('backto', $smartsection_current_page));
        $form->display();
        smartsection_close_collapsable('pagewraptable', 'pagewrapicon');
    }
    unset($hidden);
    if ($itemid != 0) {
        showfiles($itemObj);
    }
}
示例#9
0
    $keys = array_keys($value);
    for ($i = 0; $i < count($keys); $i++) {
        $v = $myts->makeTboxData4PreviewInForm($keys[$i]);
        $options[] = addOption('ele_value[' . $opt_count . ']', 'checked[' . $opt_count . ']', $v, 'check', $value[$keys[$i]]);
        $opt_count++;
    }
} else {
    while ($v = each($ele_value)) {
        $v['value'] = $myts->makeTboxData4PreviewInForm($v['value']);
        if (!empty($v['value'])) {
            if (!isset($checked[$opt_count])) {
                $checked[$opt_count] = "";
            }
            $options[] = addOption('ele_value[' . $opt_count . ']', 'checked[' . $opt_count . ']', $v['value'], 'check', $checked[$v['key']]);
            $opt_count++;
        }
    }
    $addopt = empty($addopt) ? 2 : $addopt;
    for ($i = 0; $i < $addopt; $i++) {
        $options[] = addOption('ele_value[' . $opt_count . ']', 'checked[' . $opt_count . ']', '', 'check', '');
        $opt_count++;
    }
}
$add_opt = addOptionsTray();
$options[] = $add_opt;
$opt_tray = new XoopsFormElementTray(_AM_ELE_OPT, '<br />');
$opt_tray->setDescription(_AM_ELE_OPT_DESC);
for ($i = 0; $i < count($options); $i++) {
    $opt_tray->addElement($options[$i]);
}
$form->addElement($opt_tray);
示例#10
0
   If ($moduleObj) {
   $from_module_version = round($moduleObj->getVar('version') / 100, 2);
   if ($from_module_version > 1.00) {
   $importfile_select_array["xfsection"] = "XF-Section " . $from_module_version;
   $xfs_version = $from_module_version;
   }
   } */
 if (isset($importfile_select_array) && count($importfile_select_array) > 0) {
     $sform = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SELECTION, 'op', xoops_getenv('PHP_SELF'));
     $sform->setExtra('enctype="multipart/form-data"');
     // Partners to import
     $importfile_select = new XoopsFormSelect('', 'importfile', $importfile);
     $importfile_select->addOptionArray($importfile_select_array);
     $importfile_tray = new XoopsFormElementTray(_AM_PUBLISHER_IMPORT_SELECT_FILE, '&nbsp;');
     $importfile_tray->addElement($importfile_select);
     $importfile_tray->setDescription(_AM_PUBLISHER_IMPORT_SELECT_FILE_DSC);
     $sform->addElement($importfile_tray);
     // Buttons
     $button_tray = new XoopsFormElementTray('', '');
     $hidden = new XoopsFormHidden('op', 'importExecute');
     $button_tray->addElement($hidden);
     $butt_import = new XoopsFormButton('', '', _AM_PUBLISHER_IMPORT, 'submit');
     $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
     $button_tray->addElement($butt_import);
     $butt_cancel = new XoopsFormButton('', '', _AM_PUBLISHER_CANCEL, 'button');
     $butt_cancel->setExtra('onclick="history.go(-1)"');
     $button_tray->addElement($butt_cancel);
     $sform->addElement($button_tray);
     /*$sform->addElement(new XoopsFormHidden('xfs_version', $xfs_version));
       $sform->addElement(new XoopsFormHidden('wfs_version', $wfs_version));*/
     $sform->addElement(new XoopsFormHidden('news_version', $news_version));
示例#11
0
     $words = array();
     $metablack = new mysearch_blacklist();
     $words = $metablack->getAllKeywords();
     if (is_array($words) && count($words) > 0) {
         foreach ($words as $key => $value) {
             $blacklist->addOption($key, $value);
         }
     }
     $blacklist->setDescription(_AM_MYSEARCH_BLACKLIST_DESC);
     $remove_tray->addElement($blacklist, false);
     $remove_btn = new XoopsFormButton('', 'go', _AM_MYSEARCH_DELETE, 'submit');
     $remove_tray->addElement($remove_btn, false);
     $sform->addElement($remove_tray);
     // Add some words
     $add_tray = new XoopsFormElementTray(_AM_MYSEARCH_BLACKLIST_ADD);
     $add_tray->setDescription(_AM_MYSEARCH_BLACKLIST_ADD_DSC);
     $add_field = new XoopsFormTextArea('', 'keywords', '', 5, 70);
     $add_tray->addElement($add_field, false);
     $add_btn = new XoopsFormButton('', 'go', _AM_MYSEARCH_BLACKLIST_ADD, 'submit');
     $add_tray->addElement($add_btn, false);
     $sform->addElement($add_tray);
     $sform->display();
     echo "<br /><div align='center'><a href='http://xoops.instant-zero.com' target='_blank'><img src='../images/instantzero.gif'></a></div>";
     break;
     /**
      * Add a word in the blacklist
      */
 /**
  * Add a word in the blacklist
  */
 case 'addblacklist':
示例#12
0
<?php

$form = new XoopsThemeForm(_AM_SCLONE_CLONE_A_MODULE, "form", xoops_getenv('PHP_SELF'));
$form->setExtra("enctype='multipart/form-data'");
$module_select = new XoopsFormSelect('', 'module', '', 1, false);
$plugins_handler = new SmartclonePlugins();
$module_select->addOptionArray($plugins_handler->getPluginsArray());
$plugins_tray = new XoopsFormElementTray(_AM_SCLONE_MODULE_SELECT, '');
$plugins_tray->setDescription(_AM_SCLONE_MODULE_SELECT_DSC);
$plugins_tray->addElement($module_select, true);
include_once SMARTOBJECT_ROOT_PATH . 'class/smarttip.php';
$oTip = new SmartTip('smartclone_info1', _AM_SCLONE_WHERE_OTHER_MODULE, _AM_SCLONE_WHERE_OTHER_MODULE_EXP);
$module_selec_tip = new XoopsFormLabel('', $oTip->render(false));
$plugins_tray->addElement($module_selec_tip);
$form->addElement($plugins_tray);
$newname_text = new XoopsFormText(_AM_SCLONE_NEWNAME, 'newname', 50, 255, '');
$newname_text->setDescription(_AM_SCLONE_NEWNAME_DSC);
$form->addElement($newname_text, true);
$install_check = new XoopsFormRadioYN(_AM_SCLONE_INSTALL_CHECK, 'install', true);
$form->addElement($install_check);
$form_button_tray = new XoopsFormElementTray('', '');
$form_hidden = new XoopsFormHidden('op', '');
$form_button_tray->addElement($form_hidden);
$form_butt_create = new XoopsFormButton('', '', _GO, 'submit');
$form_butt_create->setExtra('onclick="this.form.elements.op.value=\'doclone\'"');
$form_button_tray->addElement($form_butt_create);
$butt_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$form_button_tray->addElement($butt_cancel);
$form->addElement($form_button_tray);
$form->display();
示例#13
0
function editcat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null)
{
    global $xoopsDB, $smartpartner_category_handler, $xoopsUser, $myts, $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 category
    if ($categoryid != 0) {
        // Creating the category object for the selected category
        //$categoryObj = new SmartpartnerCategory($categoryid);
        $categoryObj = $smartpartner_category_handler->get($categoryid);
        if ($showmenu) {
            smartpartner_adminMenu(1, _AM_SPARTNER_CATEGORIES . " > " . _AM_SPARTNER_EDITING);
        }
        echo "<br />\n";
        if ($categoryObj->notLoaded()) {
            redirect_header("category.php", 1, _AM_SPARTNER_NOCOLTOEDIT);
            exit;
        }
        smartpartner_collapsableBar('edittable', 'edittableicon', _AM_SPARTNER_CATEGORY_EDIT, _AM_SPARTNER_CATEGORY_EDIT_INFO);
    } else {
        if (!$categoryObj) {
            $categoryObj = $smartpartner_category_handler->create();
        }
        if ($showmenu) {
            smartpartner_adminMenu(1, _AM_SPARTNER_CATEGORIES . " > " . _AM_SPARTNER_CATEGORY_CREATING);
        }
        //echo "<br />\n";
        smartpartner_collapsableBar('createtable', 'createtableicon', _AM_SPARTNER_CATEGORY_CREATE, _AM_SPARTNER_CATEGORY_CREATE_INFO);
    }
    // Start category form
    $mytree = new XoopsTree($xoopsDB->prefix("smartpartner_categories"), "categoryid", "parentid");
    $sform = new XoopsThemeForm(_AM_SPARTNER_CATEGORY, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // Name
    $sform->addElement(new XoopsFormText(_AM_SPARTNER_CATEGORY, 'name', 50, 255, $categoryObj->name('e')), true);
    // Description
    $sform->addElement(new XoopsFormTextArea(_AM_SPARTNER_CATEGORY_DSC, 'description', $categoryObj->description('e'), 7, 60));
    // IMAGE
    $image_array =& XoopsLists::getImgListAsArray(smartpartner_getImageDir('category'));
    $image_select = new XoopsFormSelect('', 'image', $categoryObj->image());
    $image_select->addOption('-1', '---------------');
    $image_select->addOptionArray($image_array);
    $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartpartner/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $image_tray = new XoopsFormElementTray(_AM_SPARTNER_CATEGORY_IMAGE, '&nbsp;');
    $image_tray->addElement($image_select);
    $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartpartner_getImageDir('category', false) . $categoryObj->image() . "' name='image3' id='image3' alt='' />"));
    $image_tray->setDescription(_AM_SPARTNER_CATEGORY_IMAGE_DSC);
    $sform->addElement($image_tray);
    // IMAGE UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SPARTNER_CATEGORY_IMAGE_UPLOAD, "image_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(_AM_SPARTNER_CATEGORY_IMAGE_UPLOAD_DSC);
    $sform->addElement($file_box);
    // Weight
    $sform->addElement(new XoopsFormText(_AM_SPARTNER_CATEGORY_WEIGHT, 'weight', 4, 4, $categoryObj->weight()));
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $module_id = $xoopsModule->getVar('mid');
    // Parent Category
    ob_start();
    $mytree->makeMySelBox("name", "weight", $categoryObj->parentid(), 1, 'parentid');
    //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
    $parent_cat_select = new XoopsFormLabel(_AM_SPARTNER_CATEGORY_PARENT, ob_get_contents());
    $parent_cat_select->setDescription(_AM_SPARTNER_CATEGORY_PARENT_DSC);
    $sform->addElement($parent_cat_select);
    ob_end_clean();
    // Added by fx2024
    // sub Categories
    $cat_tray = new XoopsFormElementTray(_AM_SPARTNER_CATEGORY_SUBCATS_CREATE, '<br /><br />');
    $cat_tray->setDescription(_AM_SPARTNER_CATEGORY_SUBCATS_CREATE_DSC);
    for ($i = 0; $i < $nb_subcats; $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_SPARTNER_ADD_OPT, $t->render()));
    $b = new XoopsFormButton('', 'submit', _AM_SPARTNER_ADD_OPT_SUBMIT, 'submit');
    if ($categoryid == 0) {
        $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);
    $sform->addElement($cat_tray);
    //End of fx2024 code
    /*$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);
    
         $sform->addElement($moderators_tray);
         */
    $sform->addElement(new XoopsFormHidden('categoryid', $categoryid));
    //$parentid = $categoryObj->parentid('s');
    //$sform -> addElement( new XoopsFormHidden( 'parentid', $parentid ) );
    $sform->addElement(new XoopsFormHidden('nb_sub_yet', $nb_subcats));
    // Action buttons tray
    $button_tray = new XoopsFormElementTray('', '');
    /*for ($i = 0; $i < sizeof($moderators); $i++) {
         $allmods[] = $moderators[$i];
         }
    
         $hiddenmods = new XoopsFormHidden('allmods', $allmods);
         $button_tray->addElement($hiddenmods);
         */
    $hidden = new XoopsFormHidden('op', 'addcategory');
    $button_tray->addElement($hidden);
    // No ID for category -- then it's new category, button says 'Create'
    if (!$categoryid) {
        $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $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);
        $sform->addElement($button_tray);
        $sform->display();
        smartpartner_close_collapsable('createtable', 'createtableicon');
    } else {
        // button says 'Update'
        $butt_create = new XoopsFormButton('', '', _AM_SPARTNER_MODIFY, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $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();
        smartpartner_close_collapsable('edittable', 'edittableicon');
    }
    /*
    //Added by fx2024
    if ($categoryid) {
        // TODO : displaysubcats comes from smartpartner and need to be adapted for smartpartner
        include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/displaysubcats.php";
    
        // TODO : displayitems comes from smartpartner and need to be adapted for smartpartner
        //include_once XOOPS_ROOT_PATH . "/modules/smartpartner/include/displayitems.php";
    }
    //end of fx2024 code
    */
    unset($hidden);
}
示例#14
0
function build_form($formid = 0)
{
    global $xoopsDB, $xoopsUser, $myts, $fields, $xoopsConfig, $xoopsModuleConfig, $xoopsTpl;
    include_once dirname(dirname(__FILE__)) . "/language/" . $xoopsConfig['language'] . '/main.php';
    if (isset($_POST['formid'])) {
        $data = array();
        $fields[] = 'priuid';
        $fields[] = 'cgroup';
        foreach ($fields as $name) {
            $data[$name] = $myts->stripSlashesGPC($_POST[$name]);
        }
        $data['optvars'] = post_optvars();
        $data['grpperm'] = $_POST['grpperm'];
        $formid = intval($_POST['formid']);
        // form preview
        get_attr_value($data['optvars']);
        // set default values
        $items = get_form_attribute($data['defs']);
        assign_form_widgets($items);
        if ($_POST['preview']) {
            echo "<h2>" . _PREVIEW . " : " . htmlspecialchars($data['title'], ENT_QUOTES) . "</h2>\n";
            echo "<div class='preview'>\n";
            $data['action'] = '';
            $data['check_script'] = "";
            $data['items'] =& $items;
            if (empty($xoopsTpl)) {
                $xoopsTpl = new XoopsTpl();
            }
            $out = $xoopsTpl->fetch('db:' . render_form($data, 'form'));
            echo preg_replace('/type=["\']submit["\']/', 'type="submit" disabled="disabled"', $out);
            echo "</div>\n<hr size='5'/>\n";
        }
    } elseif ($formid) {
        $res = $xoopsDB->query('SELECT * FROM ' . FORMS . " WHERE formid={$formid}");
        $data = $xoopsDB->fetchArray($res);
        $data['grpperm'] = explode('|', trim($data['grpperm'], '|'));
    } else {
        $data = array('title' => '', 'description' => '', 'defs' => '', 'store' => 1, 'custom' => 0, 'weight' => 0, 'active' => 1, 'priuid' => $xoopsUser->getVar('uid'), 'cgroup' => XOOPS_GROUP_ADMIN, 'optvars' => '', 'grpperm' => array(XOOPS_GROUP_USERS));
    }
    $form = new XoopsThemeForm($formid ? _AM_FORM_EDIT : _AM_FORM_NEW, 'myform', 'index.php');
    $form->addElement(new XoopsFormHidden('formid', $formid));
    $form->addElement(new XoopsFormText(_AM_FORM_TITLE, 'title', 35, 80, $data['title']), true);
    if (!empty($data['mtime'])) {
        $form->addElement(new XoopsFormLabel(_AM_FORM_MTIME, formatTimestamp($data['mtime'])));
    }
    $desc = new XoopsFormElementTray(_AM_FORM_DESCRIPTION, "<br/>");
    $description = $data['description'];
    $editor = get_attr_value(null, 'use_fckeditor');
    if ($editor) {
        $desc->addElement(new XoopsFormTextArea('', 'description', $description, 10, 60));
    } else {
        $desc->addElement(new XoopsFormDhtmlTextArea('', 'description', $description, 10, 60));
    }
    if (!$editor) {
        $button = new XoopsFormButton('', 'ins_tpl', _AM_INS_TEMPLATE);
        $button->setExtra("onClick=\"myform.description.value += defsToString();\"");
        $desc->addElement($button);
    }
    $error = check_form_tags($data['custom'], $data['defs'], $description);
    if ($error) {
        $desc->addElement(new XoopsFormLabel('', "<div style='color:red;'>{$error}</div>"));
    }
    $form->addElement($desc);
    $custom = new XoopsFormSelect(_AM_FORM_CUSTOM, 'custom', $data['custom']);
    $custom->setExtra(' onChange="myform.ins_tpl.disabled = (this.value==0||this.value==4);"');
    $custom_type = unserialize_vars(_AM_CUSTOM_DESCRIPTION);
    if ($editor) {
        unset($custom_type[0]);
    }
    $custom->addOptionArray($custom_type);
    $form->addElement($custom);
    $grpperm = new XoopsFormSelectGroup(_AM_FORM_ACCEPT_GROUPS, 'grpperm', true, $data['grpperm'], 4, true);
    $grpperm->setDescription(_AM_FORM_ACCEPT_GROUPS_DESC);
    $form->addElement($grpperm);
    $defs_tray = new XoopsFormElementTray(_AM_FORM_DEFS);
    $defs_tray->addElement(new XoopsFormTextArea('', 'defs', $data['defs'], 10, 60));
    $defs_tray->addElement(new XoopsFormLabel('', '<div id="itemhelper" style="display:none; white-space:nowrap;">
  ' . _AM_FORM_LAB . ' <input name="xelab" size="10">
  <input type="checkbox" name="xereq" title="' . _AM_FORM_REQ . '">
  <select name="xetype">
    <option value="text">text</option>
    <option value="checkbox">checkbox</option>
    <option value="radio">radio</option>
    <option value="textarea">textarea</option>
    <option value="select">select</option>
    <option value="const">const</option>
    <option value="hidden">hidden</option>
    <option value="mail">mail</option>
    <option value="file">file</option>
  </select>
  <input name="xeopt" size="30" />
  <button onClick="return addFieldItem();">' . _AM_FORM_ADD . '</button>
</div>'));
    $defs_tray->setDescription(_AM_FORM_DEFS_DESC);
    $form->addElement($defs_tray);
    $member_handler =& xoops_gethandler('member');
    $groups = $member_handler->getGroupList(new Criteria('groupid', XOOPS_GROUP_ANONYMOUS, '!='));
    $groups = $member_handler->getGroupList(new Criteria('groupid', XOOPS_GROUP_ANONYMOUS, '!='));
    $options = array();
    foreach ($groups as $k => $v) {
        $options[-$k] = sprintf(_CC_FORM_PRIM_GROUP, $v);
    }
    $options[0] = _AM_FORM_PRIM_NONE;
    $priuid = new MyFormSelect(_AM_FORM_PRIM_CONTACT, 'priuid', $data['priuid']);
    $priuid->addOptionArray($options);
    $priuid->addOptionUsers($data['cgroup']);
    $priuid->setDescription(_AM_FORM_PRIM_DESC);
    $form->addElement($priuid);
    $cgroup = new XoopsFormSelect('', 'cgroup', $data['cgroup']);
    $cgroup->setExtra(' onChange="setSelectUID(\'priuid\', 0);"');
    $cgroup->addOption(0, _AM_FORM_CGROUP_NONE);
    $groups = $member_handler->getGroupList(new Criteria('groupid', XOOPS_GROUP_ANONYMOUS, '!='));
    $cgroup->addOptionArray($groups);
    $cgroup_tray = new XoopsFormElementTray(_AM_FORM_CONTACT_GROUP);
    $cgroup_tray->addElement($cgroup);
    $cgroup_tray->addElement(new XoopsFormLabel('', '<noscript><input type="submit" name="chggrp" id="chggrp" value="' . _AM_CHANGE . '"/></noscript>'));
    $form->addElement($cgroup_tray);
    $store = new XoopsFormSelect(_AM_FORM_STORE, 'store', $data['store']);
    $store->addOptionArray(unserialize_vars(_CC_STORE_MODE, 1));
    $form->addElement($store);
    $form->addElement(new XoopsFormRadioYN(_AM_FORM_ACTIVE, 'active', $data['active']));
    $form->addElement(new XoopsFormText(_AM_FORM_WEIGHT, 'weight', 2, 8, $data['weight']));
    $items = get_form_attribute(_CC_OPTDEFS, _AM_OPTVARS_LABEL, 'optvar');
    $vars = unserialize_vars($data['optvars']);
    $others = "";
    foreach ($items as $k => $item) {
        $name = $item['name'];
        if (isset($vars[$name])) {
            $items[$k]['default'] = $vars[$name];
            unset($vars[$name]);
        }
    }
    $val = "";
    foreach ($vars as $i => $v) {
        $val .= "{$i}={$v}\n";
    }
    $items[$k]['default'] = $val;
    assign_form_widgets($items);
    $varform = "";
    foreach ($items as $item) {
        $br = $item['type'] == "textarea" ? "<br/>" : "";
        $class = $item['default'] ? ' class="changed"' : '';
        $varform .= "<div><span{$class}>" . $item['label'] . "</span>: {$br}" . $item['input'] . "</div>";
    }
    $ck = empty($data['optvars']) ? "" : " checked='checked'";
    $optvars = new XoopsFormLabel(_AM_FORM_OPTIONS, "<script type='text/javascript'>document.write(\"<input type='checkbox' id='optshow' onChange='toggle(this);'{$ck}/> " . _AM_OPTVARS_SHOW . "\");</script><div id='optvars'" . ($ck ? '' : ' style="display:none;"') . ">{$varform}</div>");
    $form->addElement($optvars);
    $submit = new XoopsFormElementTray('');
    $submit->addElement(new XoopsFormButton('', 'formdefs', _SUBMIT, 'submit'));
    $submit->addElement(new XoopsFormButton('', 'preview', _PREVIEW, 'submit'));
    $form->addElement($submit);
    echo "<a name='form'></a><style>.changed {font-weight: bold;}</style>";
    $form->display();
    if ($editor) {
        $base = XOOPS_URL . "/common/fckeditor";
        global $xoopsTpl;
        echo "<script type='text/javascript' src='{$base}/fckeditor.js'></script>\n";
        $editor = "var ccFCKeditor = new FCKeditor('description', '100%', '350', '{$editor}');\nccFCKeditor.BasePath = '{$base}/';\nccFCKeditor.ReplaceTextarea();";
    }
    echo '<script language="JavaScript">' . $priuid->renderSupportJS(false) . '
// display only JavaScript enable
xoopsGetElementById("itemhelper").style.display = "block";
' . $editor . '
function toggle(a) {
    xoopsGetElementById("optvars").style.display = a.checked?"block":"none";
}
togle(xoopsGetElementById("optshow"));

function addFieldItem() {
    var myform = window.document.myform;
    var item=myform.xelab.value;
    if (item == "") {
	alert("' . _AM_FORM_LABREQ . '");
	myform.xelab.focus();
	return false;
    }
    if (myform.xereq.checked) item += "*";
    var ty = myform.xetype.value;
    var ov = myform.xeopt.value;
    item += ","+ty;
    if (ty != "text" && ty != "textarea" && ty != "file" && ty != "mail" && ov == "") {
	alert(ty+": ' . _AM_FORM_OPTREQ . '");
	myform.xeopt.focus();
	return false;
    }
    if (ov != "") item += ","+ov;
    opts = myform.defs;
    if (opts.value!="" && !opts.value.match(/[\\n\\r]$/)) item = "\\n"+item;
    opts.value += item;
    myform.xelab.value = ""; // clear old value
    myform.xeopt.value = "";
    return false; // always return false
}
function defsToString() {
    value = window.document.myform.defs.value;
    ret = "";
    lines = value.split("\\n");
    conf = "' . _MD_CONF_LABEL . '";
    for (i in lines) {
       lab = lines[i].replace(/,.*$/, "");
       if (lab.match(/^\\s*#/)) {
           ret += "[desc]<div>"+lines[i].replace(/^\\s*#/, "")+"</div>[/desc]\\n";
       } else if (lab != "") {
           ret += "<div>"+lab+": {"+lab.replace(/\\*?$/,"")+"}</div>\\n";
           if (lines[i].match(/^[^,]+,\\s*mail/i)) {
              lab = conf.replace(/%s/, lab);
              ret += "[desc]<div>"+lab+": {"+lab.replace(/\\*?$/,"")+"}</div>[/desc]\\n";
           }
       }
    }
    return "<form {FORM_ATTR}>\\n"+ret+
      "<p>{SUBMIT} {BACK}</p>\\n</form>\\n{CHECK_SCRIPT}";
}

fvalue = document.myform.custom.value;
document.myform.ins_tpl.disabled = (fvalue==0 || fvalue==4);
</script>
';
}
示例#15
0
 echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SCLIENT_IMPORT_INFO . "</span>";
 global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts;
 include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
 $module_handler =& xoops_gethandler('module');
 if ($module_handler->getByDirname('xoopsclients')) {
     $importfile_select_array["xoopsclients"] = _AM_SCLIENT_IMPORT_XOOPSCLIENTS_110;
 }
 if (isset($importfile_select_array) && count($importfile_select_array) > 0) {
     $sform = new XoopsThemeForm(_AM_SCLIENT_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF'));
     $sform->setExtra('enctype="multipart/form-data"');
     // Clients to import
     $importfile_select = new XoopsFormSelect('', 'importfile', $importfile);
     $importfile_select->addOptionArray($importfile_select_array);
     $importfile_tray = new XoopsFormElementTray(_AM_SCLIENT_IMPORT_SELECT_FILE, '&nbsp;');
     $importfile_tray->addElement($importfile_select);
     $importfile_tray->setDescription(_AM_SCLIENT_IMPORT_SELECT_FILE_DSC);
     $sform->addElement($importfile_tray);
     // Buttons
     $button_tray = new XoopsFormElementTray('', '');
     $hidden = new XoopsFormHidden('op', 'importExecute');
     $button_tray->addElement($hidden);
     $butt_import = new XoopsFormButton('', '', _AM_SCLIENT_IMPORT, 'submit');
     $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
     $button_tray->addElement($butt_import);
     $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);
 } else {
示例#16
0
 function createElements()
 {
     global $xoopsUser;
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $mytree = new XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), "categoryid", "parentid");
     $cat_select = $mytree->makeSelBox('parentid', 'name', '--', $this->targetObject->parentid(), true);
     $this->addElement(new XoopsFormLabel(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $cat_select));
     // Name
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
     // Description
     $this->addElement(new XoopsFormTextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
     // EDITOR
     $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
     $gperm_handler = $this->publisher->getHandler('groupperm');
     $module_id = $this->publisher->getModule()->mid();
     $allowed_editors = publisher_getEditors($gperm_handler->getItemIds('editors', $groups, $module_id));
     $nohtml = false;
     if (count($allowed_editors) > 0) {
         $editor = @$_POST['editor'];
         if (!empty($editor)) {
             publisher_setCookieVar('publisher_editor', $editor);
         } else {
             $editor = publisher_getCookieVar('publisher_editor');
             if (empty($editor) && is_object($xoopsUser)) {
                 $editor = @$xoopsUser->getVar('publisher_editor');
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowed_editors) ? $this->publisher->getConfig('submit_editor') : $editor;
         $form_editor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
         $this->addElement($form_editor);
     } else {
         $editor = $this->publisher->getConfig('submit_editor');
     }
     $editor_configs = array();
     $editor_configs['rows'] = $this->publisher->getConfig('submit_editor_rows') == '' ? 35 : $this->publisher->getConfig('submit_editor_rows');
     $editor_configs['cols'] = $this->publisher->getConfig('submit_editor_cols') == '' ? 60 : $this->publisher->getConfig('submit_editor_cols');
     $editor_configs['width'] = $this->publisher->getConfig('submit_editor_width') == '' ? "100%" : $this->publisher->getConfig('submit_editor_width');
     $editor_configs['height'] = $this->publisher->getConfig('submit_editor_height') == '' ? "400px" : $this->publisher->getConfig('submit_editor_height');
     $editor_configs['name'] = 'header';
     $editor_configs['value'] = $this->targetObject->header('e');
     $text_header = new XoopsFormEditor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editor_configs, $nohtml, $onfailure = null);
     $text_header->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($text_header);
     // IMAGE
     $image_array = XoopsLists::getImgListAsArray(publisher_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/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
     $image_tray = new XoopsFormElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $image_tray->addElement($image_select);
     $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . publisher_getImageDir('category', false) . $this->targetObject->image() . "' name='image3' id='image3' alt='' />"));
     $image_tray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($image_tray);
     // IMAGE UPLOAD
     $max_size = 5000000;
     $file_box = new XoopsFormFile(_AM_PUBLISHER_IMAGE_UPLOAD, "image_file", $max_size);
     $file_box->setExtra("size ='45'");
     $file_box->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($file_box);
     // Short url
     $text_short_url = new XoopsFormText(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
     $text_short_url->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($text_short_url);
     // Meta Keywords
     $text_meta_keywords = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
     $text_meta_keywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($text_meta_keywords);
     // Meta Description
     $text_meta_description = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
     $text_meta_description->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($text_meta_description);
     // Weight
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new XoopsFormText("Custom template", 'template', 50, 255, $this->targetObject->template('e')), false);
     // READ PERMISSIONS
     $groups_read_checkbox = new XoopsFormCheckBox(_AM_PUBLISHER_PERMISSIONS_CAT_READ, 'groups_read[]', $this->targetObject->getGroups_read());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groups_read_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_read_checkbox);
     // SUBMIT PERMISSIONS
     $groups_submit_checkbox = new XoopsFormCheckBox(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $this->targetObject->getGroups_submit());
     $groups_submit_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     foreach ($this->userGroups as $group_id => $group_name) {
         $groups_submit_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_submit_checkbox);
     // MODERATION PERMISSIONS
     $groups_moderation_checkbox = new XoopsFormCheckBox(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, 'groups_moderation[]', $this->targetObject->getGroups_moderation());
     $groups_moderation_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     foreach ($this->userGroups as $group_id => $group_name) {
         $groups_moderation_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_moderation_checkbox);
     $moderator = new XoopsFormSelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $this->targetObject->moderator('e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     $cat_tray = new XoopsFormElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->subCatsCount; $i++) {
         if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
             $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
         } else {
             $subname = '';
         }
         $cat_tray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new XoopsFormText('', 'nb_subcats', 3, 2);
     $l = new XoopsFormLabel('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new XoopsFormButton('', 'submit_subcats', _AM_PUBLISHER_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);
     $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid()));
     $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount));
 }
示例#17
0
 public function createElements()
 {
     include_once dirname(dirname(__DIR__)) . '/include/common.php';
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $myTree = new XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), 'categoryid', 'parentid');
     $catSelect = $myTree->makeSelBox('parentid', 'name', '--', $this->targetObject->parentid(), true);
     $this->addElement(new XoopsFormLabel(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $catSelect));
     // Name
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
     // Description
     $this->addElement(new XoopsFormTextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
     // EDITOR
     $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
     $gpermHandler =& $this->publisher->getHandler('groupperm');
     $moduleId = $this->publisher->getModule()->mid();
     $allowedEditors = publisherGetEditors($gpermHandler->getItemIds('editors', $groups, $moduleId));
     $nohtml = false;
     if (count($allowedEditors) > 0) {
         $editor = XoopsRequest::getString('editor', '', 'POST');
         if (!empty($editor)) {
             publisherSetCookieVar('publisher_editor', $editor);
         } else {
             $editor = publisherGetCookieVar('publisher_editor');
             if (empty($editor) && is_object($GLOBALS['xoopsUser'])) {
                 $editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $this->publisher->getConfig('submit_editor') : $editor;
         $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
         $this->addElement($formEditor);
     } else {
         $editor = $this->publisher->getConfig('submit_editor');
     }
     $editorConfigs = array();
     $editorConfigs['rows'] = $this->publisher->getConfig('submit_editor_rows') == '' ? 35 : $this->publisher->getConfig('submit_editor_rows');
     $editorConfigs['cols'] = $this->publisher->getConfig('submit_editor_cols') == '' ? 60 : $this->publisher->getConfig('submit_editor_cols');
     $editorConfigs['width'] = $this->publisher->getConfig('submit_editor_width') == '' ? '100%' : $this->publisher->getConfig('submit_editor_width');
     $editorConfigs['height'] = $this->publisher->getConfig('submit_editor_height') == '' ? '400px' : $this->publisher->getConfig('submit_editor_height');
     $editorConfigs['name'] = 'header';
     $editorConfigs['value'] = $this->targetObject->header('e');
     $textHeader = new XoopsFormEditor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editorConfigs, $nohtml, $onfailure = null);
     $textHeader->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($textHeader);
     // IMAGE
     $imageArray = XoopsLists::getImgListAsArray(publisherGetImageDir('category'));
     $imageSelect = new XoopsFormSelect('', 'image', $this->targetObject->getImage());
     //$imageSelect -> addOption ('-1', '---------------');
     $imageSelect->addOptionArray($imageArray);
     $imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
     $imageTray = new XoopsFormElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $imageTray->addElement($imageSelect);
     $imageTray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . publisherGetImageDir('category', false) . $this->targetObject->getImage() . "' name='image3' id='image3' alt='' />"));
     $imageTray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($imageTray);
     // IMAGE UPLOAD
     $max_size = 5000000;
     $fileBox = new XoopsFormFile(_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $max_size);
     $fileBox->setExtra("size ='45'");
     $fileBox->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($fileBox);
     // Short url
     $textShortUrl = new XoopsFormText(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
     $textShortUrl->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($textShortUrl);
     // Meta Keywords
     $textMetaKeywords = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
     $textMetaKeywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($textMetaKeywords);
     // Meta Description
     $textMetaDescription = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
     $textMetaDescription->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($textMetaDescription);
     // Weight
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new XoopsFormText('Custom template', 'template', 50, 255, $this->targetObject->template('e')), false);
     // READ PERMISSIONS
     $readPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_READ, '');
     $selectAllReadCheckbox = new XoopsFormCheckBox('', "adminbox", 1);
     $selectAllReadCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllReadCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox\" , \"groupsRead[]\");' ");
     $selectAllReadCheckbox->setClass('xo-checkall');
     $readPermissionsTray->addElement($selectAllReadCheckbox);
     $groupsReadCheckbox = new XoopsFormCheckBox('', 'groupsRead[]', $this->targetObject->getGroupsRead());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsReadCheckbox->addOption($group_id, $group_name);
     }
     $readPermissionsTray->addElement($groupsReadCheckbox);
     $this->addElement($readPermissionsTray);
     // SUBMIT PERMISSIONS
     $submitPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, '');
     $submitPermissionsTray->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     $selectAllSubmitCheckbox = new XoopsFormCheckBox('', "adminbox2", 1);
     $selectAllSubmitCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllSubmitCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox2\" , \"groupsSubmit[]\");' ");
     $selectAllSubmitCheckbox->setClass('xo-checkall');
     $submitPermissionsTray->addElement($selectAllSubmitCheckbox);
     $groupsSubmitCheckbox = new XoopsFormCheckBox('', 'groupsSubmit[]', $this->targetObject->getGroupsSubmit());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsSubmitCheckbox->addOption($group_id, $group_name);
     }
     $submitPermissionsTray->addElement($groupsSubmitCheckbox);
     $this->addElement($submitPermissionsTray);
     // MODERATION PERMISSIONS
     $moderatePermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, '');
     $moderatePermissionsTray->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     $selectAllModerateCheckbox = new XoopsFormCheckBox('', "adminbox3", 1);
     $selectAllModerateCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllModerateCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox3\" , \"groupsModeration[]\");' ");
     $selectAllModerateCheckbox->setClass('xo-checkall');
     $moderatePermissionsTray->addElement($selectAllModerateCheckbox);
     $groupsModerationCheckbox = new XoopsFormCheckBox('', 'groupsModeration[]', $this->targetObject->getGroupsModeration());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsModerationCheckbox->addOption($group_id, $group_name);
     }
     $moderatePermissionsTray->addElement($groupsModerationCheckbox);
     $this->addElement($moderatePermissionsTray);
     $moderator = new XoopsFormSelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $this->targetObject->moderator('e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     //SUBCATEGORY
     $catTray = new XoopsFormElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->subCatsCount; ++$i) {
         $subname = '';
         if ($i < (($scname = XoopsRequest::getArray('scname', array(), 'POST')) ? count($scname) : 0)) {
             $temp = XoopsRequest::getArray('scname', array(), 'POST');
             $subname = ($scname = XoopsRequest::getArray('scname', '', 'POST')) ? $temp[$i] : '';
         }
         $catTray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new XoopsFormText('', 'nb_subcats', 3, 2);
     $l = new XoopsFormLabel('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new XoopsFormButton('', 'submit_subcats', _AM_PUBLISHER_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);
     $catTray->addElement($r);
     $this->addElement($catTray);
     $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid()));
     $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount));
 }
示例#18
0
function edititem($showmenu = false, $itemid = 0)
{
    global $smartsection_file_handler, $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsModule, $xoopsConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a item
    if ($itemid != 0) {
        // Creating the ITEM object
        $itemObj = new ssItem($itemid);
        if ($itemObj->notLoaded()) {
            redirect_header("item.php", 1, _AM_SS_NOITEMSELECTED);
            exit;
        }
        switch ($itemObj->status()) {
            case _SS_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SS_SUBMITTED;
                $breadcrumb_action2 = _AM_SS_APPROVING;
                $page_title = _AM_SS_SUBMITTED_TITLE;
                $page_info = _AM_SS_SUBMITTED_INFO;
                $button_caption = _AM_SS_APPROVE;
                $new_status = _SS_STATUS_PUBLISHED;
                break;
            case _SS_STATUS_PUBLISHED:
                $breadcrumb_action1 = _AM_SS_PUBLISHED;
                $breadcrumb_action2 = _AM_SS_EDITING;
                $page_title = _AM_SS_PUBLISHEDEDITING;
                $page_info = _AM_SS_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SS_MODIFY;
                $new_status = _SS_STATUS_PUBLISHED;
                break;
            case _SS_STATUS_OFFLINE:
                $breadcrumb_action1 = _AM_SS_OFFLINE;
                $breadcrumb_action2 = _AM_SS_EDITING;
                $page_title = _AM_SS_OFFLINEEDITING;
                $page_info = _AM_SS_OFFLINEEDITING_INFO;
                $button_caption = _AM_SS_MODIFY;
                $new_status = _SS_STATUS_OFFLINE;
                break;
            case "default":
            default:
                break;
        }
        $categoryObj =& $itemObj->category();
        if ($showmenu) {
            ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        ss_collapsableBar('edititemtable', 'edititemicon', $page_title, $page_info);
    } else {
        // there's no parameter, so we're adding an item
        $itemObj =& $smartsection_item_handler->create();
        $categoryObj =& $smartsection_category_handler->create();
        $breadcrumb_action1 = _AM_SS_ITEMS;
        $breadcrumb_action2 = _AM_SS_CREATINGNEW;
        $button_caption = _AM_SS_CREATE;
        $new_status = _SS_STATUS_PUBLISHED;
        if ($showmenu) {
            ss_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0;
        $categoryObj->setVar('categoryid', $sel_categoryid);
        ss_collapsableBar('createitemtable', 'createitemicon', _AM_SS_ITEM_CREATING, _AM_SS_ITEM_CREATING_DSC);
    }
    // ITEM FORM
    $sform = new XoopsThemeForm(_AM_SS_ITEMS, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // CATEGORY
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    ob_start();
    $sform->addElement(new XoopsFormHidden('categoryid', $categoryObj->categoryid()));
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $category_label = new XoopsFormLabel(_AM_SS_CATEGORY, ob_get_contents());
    $category_label->setDescription(_AM_SS_CATEGORY_DSC);
    $sform->addElement($category_label);
    ob_end_clean();
    // TITLE
    $title_text = new XoopsFormText(_AM_SS_TITLE, 'title', 50, 255, $itemObj->title(0, 'e'));
    $sform->addElement($title_text, true);
    // SUMMARY
    $summary_text = ss_getEditor(_AM_SS_SUMMARY, 'summary', $itemObj->summary(0, 'e'));
    $summary_text->setDescription(_AM_SS_SUMMARY_DSC);
    $sform->addElement($summary_text, false);
    // DISPLAY_SUMMARY
    $display_summary_radio = new XoopsFormRadioYN(_AM_SS_DISPLAY_SUMMARY, 'display_summary', $itemObj->display_summary(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($display_summary_radio);
    // BODY
    $body_text = ss_getEditor(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'));
    //$body_text = new XoopsFormDhtmlTextArea(_AM_SS_BODY, 'body', $itemObj->body(0, 'e'), 20, 60);
    $body_text->setDescription(_AM_SS_BODY_DSC);
    $sform->addElement($body_text, true);
    // IMAGE
    $image_array =& XoopsLists::getImgListAsArray(ss_getImageDir('item'));
    $image_select = new XoopsFormSelect('', 'image', $itemObj->image());
    //$image_select -> addOption ('-1', '---------------');
    $image_select->addOptionArray($image_array);
    $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $image_tray = new XoopsFormElementTray(_AM_SS_IMAGE_ITEM, '&nbsp;');
    $image_tray->addElement($image_select);
    $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . ss_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
    $image_tray->setDescription(_AM_SS_IMAGE_ITEM_DSC);
    $sform->addElement($image_tray);
    // IMAGE UPLOAD
    $max_size = 5000000;
    $file_box = new XoopsFormFile(_AM_SS_IMAGE_UPLOAD, "image_file", $max_size);
    $file_box->setExtra("size ='45'");
    $file_box->setDescription(_AM_SS_IMAGE_UPLOAD_ITEM_DSC);
    $sform->addElement($file_box);
    // Uid
    /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
    	    the method users::getobjects encounters a memory error 
    	*/
    $uid = $itemObj->uid() == 0 ? $xoopsUser->uid() : $itemObj->uid();
    $uid_select = new XoopsFormSelect(_AM_SS_UID, 'uid', $uid, 1, false);
    $uid_select->setDescription(_AM_SS_UID_DSC);
    $sql = "SELECT uid, uname FROM " . $xoopsDB->prefix('users') . " ORDER BY uname ASC";
    $result = $xoopsDB->query($sql);
    $users_array = array();
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $users_array[$myrow['uid']] = $myrow['uname'];
    }
    $uid_select->addOptionArray($users_array);
    $sform->addElement($uid_select);
    // Datesub
    $datesub = $itemObj->getVar('datesub') == 0 ? time() : $itemObj->getVar('datesub');
    $datesub_datetime = new XoopsFormDateTime(_AM_SS_DATESUB, 'datesub', $size = 15, $datesub);
    $datesub_datetime->setDescription(_AM_SS_DATESUB_DSC);
    $sform->addElement($datesub_datetime);
    // STATUS
    $options = array(_SS_STATUS_PUBLISHED => _AM_SS_PUBLISHED, _SS_STATUS_OFFLINE => _AM_SS_OFFLINE);
    $status_select = new XoopsFormSelect(_AM_SS_STATUS, 'status', $new_status);
    $status_select->addOptionArray($options);
    $status_select->setDescription(_AM_SS_STATUS_DSC);
    $sform->addElement($status_select);
    // WEIGHT
    $sform->addElement(new XoopsFormText(_AM_SS_WEIGHT, 'weight', 5, 5, $itemObj->weight()), true);
    // COMMENTS
    $addcomments_radio = new XoopsFormRadioYN(_AM_SS_ALLOWCOMMENTS, 'cancomment', $itemObj->cancomment(), ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($addcomments_radio);
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_ITEM, 'groups[]', $itemObj->getGroups_read());
    $groups_checkbox->setDescription(_AM_SS_PERMISSIONS_ITEM_DSC);
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    // VARIOUS OPTIONS
    $options_tray = new XoopsFormElementTray(_AM_SS_OPTIONS, '<br />');
    $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml());
    $html_checkbox->addOption(1, _AM_SS_DOHTML);
    $options_tray->addElement($html_checkbox);
    $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley());
    $smiley_checkbox->addOption(1, _AM_SS_DOSMILEY);
    $options_tray->addElement($smiley_checkbox);
    $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $itemObj->doxcode());
    $xcodes_checkbox->addOption(1, _AM_SS_DOXCODE);
    $options_tray->addElement($xcodes_checkbox);
    $images_checkbox = new XoopsFormCheckBox('', 'doimage', $itemObj->doimage());
    $images_checkbox->addOption(1, _AM_SS_DOIMAGE);
    $options_tray->addElement($images_checkbox);
    $linebreak_checkbox = new XoopsFormCheckBox('', 'dobr', $itemObj->dobr());
    $linebreak_checkbox->addOption(1, _AM_SS_DOLINEBREAK);
    $options_tray->addElement($linebreak_checkbox);
    $sform->addElement($options_tray);
    // item ID
    $sform->addElement(new XoopsFormHidden('itemid', $itemObj->itemid()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'additem');
    $button_tray->addElement($hidden);
    if (!$itemid) {
        // there's no itemid? Then it's a new item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SS_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SS_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        ss_close_collapsable('createitemtable', 'createitemicon');
    } else {
        // else, we're editing an existing item
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SS_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'additem\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SS_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $sform->addElement($button_tray);
        $sform->display();
        ss_close_collapsable('edititemtable', 'edititemicon');
    }
    unset($hidden);
    if ($itemid != 0) {
        showfiles($itemObj);
    }
}
示例#19
0
     $idle->addElement($idle_more);
     $idle->addElement($idle_less);
     $regd_min = new XoopsFormTextDateSelect(_AM_SYSTEM_MAILUSERS_REGDMIN . '<span class="bold green">*</span>', 'mail_regd_min');
     $regd_min->setValue('');
     $regd_max = new XoopsFormTextDateSelect(_AM_SYSTEM_MAILUSERS_REGDMAX . '<span class="bold green">*</span>', 'mail_regd_max');
     $regd_max->setValue('');
     $regdate = new XoopsFormElementTray('<div class="bold spacer">' . _AM_SYSTEM_MAILUSERS_REGDATE . '</div>', '');
     $regdate->addElement($regd_min);
     $regdate->addElement($regd_max);
     $mailok_cbox = new XoopsFormCheckBox('', 'mail_mailok');
     $mailok_cbox->addOption(1, _AM_SYSTEM_MAILUSERS_MAILOK . '<span class="bold green">*</span>');
     $inactive_cbox = new XoopsFormCheckBox('', 'mail_inactive');
     $inactive_cbox->addOption(1, _AM_SYSTEM_MAILUSERS_INACTIVE . '<span class="bold green">*</span>');
     $inactive_cbox->setExtra("onclick='javascript:disableElement(\"mail_lastlog_min\");disableElement(\"mail_lastlog_max\");disableElement(\"mail_idle_more\");disableElement(\"mail_idle_less\");disableElement(\"mail_to_group[]\");'");
     $criteria_tray = new XoopsFormElementTray(_AM_SYSTEM_MAILUSERS_SENDTOUSERS, '<br><br>');
     $criteria_tray->setDescription('<span class="bold green">*</span>' . _AM_SYSTEM_MAILUSERS_OPTIONAL);
     $criteria_tray->addElement($group_select);
     //$criteria_tray->addElement($lastlog);
     $criteria_tray->addElement($date);
     //$criteria_tray->addElement($lastlog_max);
     $criteria_tray->addElement($idle);
     //$criteria_tray->addElement($idle_less);
     $criteria_tray->addElement($regdate);
     $criteria_tray->addElement($mailok_cbox);
     $criteria_tray->addElement($inactive_cbox);
     //$criteria_tray->addElement($regd_max);
     $form->addElement($criteria_tray);
 }
 $fname_text = new XoopsFormText(_AM_SYSTEM_MAILUSERS_MAILFNAME, 'mail_fromname', 30, 255, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
 $fromemail = !empty($xoopsConfig['adminmail']) ? $xoopsConfig['adminmail'] : $xoopsUser->getVar('email', 'E');
 $femail_text = new XoopsFormText(_AM_SYSTEM_MAILUSERS_MAILFMAIL, 'mail_fromemail', 30, 255, $fromemail);
示例#20
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);
    }
}
示例#21
0
     $property7->setDescription(_AM_OLEDRION_PRODUCT_PROPERTY_DESC);
     $sform->addElement($property7);
     $property8 = new XoopsFormElementTray(_AM_OLEDRION_PRODUCT_PROPERTY8, '<br />');
     $property8->addElement(new XoopsFormText(_AM_OLEDRION_PRODUCT_PROPERTY_TITLE, 'product_property8_title', 50, 255, oledrion_utils::getModuleOption('product_property8_title')));
     $property8->addElement(new XoopsFormTextArea('', 'product_property8', oledrion_utils::getModuleOption('product_property8'), 5, 90));
     $property8->setDescription(_AM_OLEDRION_PRODUCT_PROPERTY_DESC);
     $sform->addElement($property8);
     $property9 = new XoopsFormElementTray(_AM_OLEDRION_PRODUCT_PROPERTY9, '<br />');
     $property9->addElement(new XoopsFormText(_AM_OLEDRION_PRODUCT_PROPERTY_TITLE, 'product_property9_title', 50, 255, oledrion_utils::getModuleOption('product_property9_title')));
     $property9->addElement(new XoopsFormTextArea('', 'product_property9', oledrion_utils::getModuleOption('product_property9'), 5, 90));
     $property9->setDescription(_AM_OLEDRION_PRODUCT_PROPERTY_DESC);
     $sform->addElement($property9);
     $property10 = new XoopsFormElementTray(_AM_OLEDRION_PRODUCT_PROPERTY10, '<br />');
     $property10->addElement(new XoopsFormText(_AM_OLEDRION_PRODUCT_PROPERTY_TITLE, 'product_property10_title', 50, 255, oledrion_utils::getModuleOption('product_property10_title')));
     $property10->addElement(new XoopsFormTextArea('', 'product_property10', oledrion_utils::getModuleOption('product_property10'), 5, 90));
     $property10->setDescription(_AM_OLEDRION_PRODUCT_PROPERTY_DESC);
     $sform->addElement($property10);
     $button_tray = new XoopsFormElementTray('', '');
     $submit_btn = new XoopsFormButton('', 'post', _AM_OLEDRION_MODIFY, 'submit');
     $button_tray->addElement($submit_btn);
     $sform->addElement($button_tray);
     $sform = oledrion_utils::formMarkRequiredFields($sform);
     $sform->display();
     include_once OLEDRION_ADMIN_PATH . 'admin_footer.php';
     break;
 case 'fromproperty':
     if (isset($_POST['product_property1'])) {
         if (oledrion_utils::getModuleOption('product_property1') != $_POST['product_property1']) {
             $criteria = new CriteriaCompo();
             $criteria->add($moduleIdCriteria);
             $criteria->add(new Criteria('conf_name', 'product_property1'));
示例#22
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>";
}
示例#23
0
 $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('', '');
 $post_button = new XoopsFormButton('', 'post_messages', _MP_SUBMIT, "submit");
 $post_button->setExtra("onclick='document.read.action=\"contbox.php?op=envoimp\",selectfill(" . $xoopsModuleConfig['senduser'] . ")'");
 $button_tray->addElement($post_button);
 $button_tray->addElement(new XoopsFormButton('', 'reset', _MP_CLEAR, 'reset'));
 $form->addElement($button_tray);
 if ($view_perms & GPERM_MESS) {
     if (empty($mpstop)) {
         $box_actions[] = '<select name="add" class="xo-message-form"  OnChange="window.document.location=this.options[this.selectedIndex].value;"><option selected>' . _MP_MNEWS . '</option><option value="' . XOOPS_URL . '/modules/' . $mydirname . '/msgbox.php?op=sendbox&send=1">-> ' . _MP_MMES . '</option><option value="' . XOOPS_URL . '/modules/' . $mydirname . '/contbox.php?op=sendbox">-> ' . _MP_MCONT . '</option><option value="' . XOOPS_URL . '/modules/' . $mydirname . '/filebox.php?op=sendbox">-> ' . _MP_MFILE . '</option></select>';
         $box_actions[] = "<input type='submit' class='xo-message-form' onclick='document.prvmsg.action=\"contbox.php?op=envoimp\"' id='post_messages' value='" . _MP_SUBMIT . "'>";
     } else {
         $box_actions[] = '<select name="add" class="xo-message-form"  OnChange="window.document.location=this.options[this.selectedIndex].value;" disabled><option selected>' . _MP_MNEWS . '</option><option value="' . XOOPS_URL . '/modules/' . $mydirname . '/msgbox.php?op=sendbox&send=1">-> ' . _MP_MMES . '</option><option value="' . XOOPS_URL . '/modules/' . $mydirname . '/contbox.php?op=sendbox">-> ' . _MP_MCONT . '</option><option value="' . XOOPS_URL . '/modules/' . $mydirname . '/filebox.php?op=sendbox">-> ' . _MP_MFILE . '</option></select>';
示例#24
0
$sform->addElement($summary_text, false);
// BODY
//$body_text = new XoopsFormDhtmlTextArea(_MD_SSECTION_BODY, 'body', '', 15, 60);
$body_text = smartsection_getEditor(_MD_SSECTION_BODY_REQ, 'body', $itemObj->getVar('body'));
$body_text->setDescription(_MD_SSECTION_BODY_DSC);
$sform->addElement($body_text);
// IMAGE
$image_array =& XoopsLists::getImgListAsArray(smartsection_getImageDir('item'));
$image_select = new XoopsFormSelect('', 'image', $itemObj->image());
//$image_select -> addOption ('-1', '---------------');
$image_select->addOptionArray($image_array);
$image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/smartsection/images/item/' . "\", \"\", \"" . XOOPS_URL . "\")'");
$image_tray = new XoopsFormElementTray(_MD_SSECTION_IMAGE_ITEM, '&nbsp;');
$image_tray->addElement($image_select);
$image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartsection_getImageDir('item', false) . $itemObj->image() . "' name='image3' id='image3' alt='' />"));
$image_tray->setDescription(_MD_SSECTION_IMAGE_ITEM_DSC);
$sform->addElement($image_tray);
// IMAGE UPLOAD
$max_size = 5000000;
$file_box = new XoopsFormFile(_MD_SSECTION_IMAGE_UPLOAD, "image_file", $max_size);
$file_box->setExtra("size ='45'");
$file_box->setDescription(_MD_SSECTION_IMAGE_UPLOAD_ITEM_DSC);
$sform->addElement($file_box);
if (SMARTSECTION_LEVEL > 0) {
    // VARIOUS OPTIONS
    $options_tray = new XoopsFormElementTray(_AM_SSECTION_OPTIONS, '<br />');
    $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $itemObj->dohtml());
    $html_checkbox->addOption(1, _AM_SSECTION_DOHTML);
    $options_tray->addElement($html_checkbox);
    $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $itemObj->dosmiley());
    $smiley_checkbox->addOption(1, _AM_SSECTION_DOSMILEY);
示例#25
0
/**
 * Metagen
 *
 * Metagen is a system that can help you to have your page best indexed by search engines.
 * Except if you type meta keywords and meta descriptions yourself, the module will automatically create them.
 * From here you can also manage some other options like the maximum number of meta keywords to create and
 * the keywords apparition's order.
 */
function Metagen()
{
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    global $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $cfg;
    xoops_cp_header();
    $myts =& MyTextSanitizer::getInstance();
    if (file_exists(XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php')) {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php';
    } else {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php';
    }
    adminmenu(8);
    echo "<h1>" . _AM_NEWS_METAGEN . "</h1>";
    echo _AM_NEWS_METAGEN_DESC . "<br /><br />";
    // Metagen Options
    $registry = new news_registryfile('news_metagen_options.txt');
    $content = '';
    $content = $registry->getfile();
    if (xoops_trim($content) != '') {
        list($keywordscount, $keywordsorder) = explode(',', $content);
    } else {
        $keywordscount = $cfg['meta_keywords_count'];
        $keywordsorder = $cfg['meta_keywords_order'];
    }
    $sform = new XoopsThemeForm(_OPTIONS, 'metagenoptions', XOOPS_URL . '/modules/news/admin/index.php', 'post');
    $sform->addElement(new XoopsFormHidden('op', 'metagenoptions'), false);
    $sform->addElement(new XoopsFormText(_AM_NEWS_META_KEYWORDS_CNT, 'keywordscount', 4, 6, $keywordscount), true);
    $keywordsorder = new XoopsFormRadio(_AM_NEWS_META_KEYWORDS_ORDER, 'keywordsorder', $keywordsorder);
    $keywordsorder->addOption(0, _AM_NEWS_META_KEYWORDS_INTEXT);
    $keywordsorder->addOption(1, _AM_NEWS_META_KEYWORDS_FREQ1);
    $keywordsorder->addOption(2, _AM_NEWS_META_KEYWORDS_FREQ2);
    $sform->addElement($keywordsorder, false);
    $button_tray = new XoopsFormElementTray('', '');
    $submit_btn = new XoopsFormButton('', 'post', _AM_MODIFY, 'submit');
    $button_tray->addElement($submit_btn);
    $sform->addElement($button_tray);
    $sform->display();
    // Blacklist
    $sform = new XoopsThemeForm(_AM_NEWS_BLACKLIST, 'metagenblacklist', XOOPS_URL . '/modules/news/admin/index.php', 'post');
    $sform->addElement(new XoopsFormHidden('op', 'metagenblacklist'), false);
    // Remove words
    $remove_tray = new XoopsFormElementTray(_AM_NEWS_BLACKLIST);
    $remove_tray->setDescription(_AM_NEWS_BLACKLIST_DESC);
    $blacklist = new XoopsFormSelect('', 'blacklist', '', 5, true);
    $words = array();
    $metablack = new news_blacklist();
    $words = $metablack->getAllKeywords();
    if (is_array($words) && count($words) > 0) {
        foreach ($words as $key => $value) {
            $blacklist->addOption($key, $value);
        }
    }
    $blacklist->setDescription(_AM_NEWS_BLACKLIST_DESC);
    $remove_tray->addElement($blacklist, false);
    $remove_btn = new XoopsFormButton('', 'go', _AM_DELETE, 'submit');
    $remove_tray->addElement($remove_btn, false);
    $sform->addElement($remove_tray);
    // Add some words
    $add_tray = new XoopsFormElementTray(_AM_NEWS_BLACKLIST_ADD);
    $add_tray->setDescription(_AM_NEWS_BLACKLIST_ADD_DSC);
    $add_field = new XoopsFormTextArea('', 'keywords', '', 5, 70);
    $add_tray->addElement($add_field, false);
    $add_btn = new XoopsFormButton('', 'go', _AM_ADD, 'submit');
    $add_tray->addElement($add_btn, false);
    $sform->addElement($add_tray);
    $sform->display();
}
示例#26
0
    /**
     * @param $obj
     *
     * @return $this
     */
    public function createElements($obj)
    {
        $publisher =& PublisherPublisher::getInstance();
        $allowedEditors = publisherGetEditors($publisher->getHandler('permission')->getGrantedItems('editors'));
        if (!is_object($GLOBALS['xoopsUser'])) {
            $group = array(XOOPS_GROUP_ANONYMOUS);
        } else {
            $group = $GLOBALS['xoopsUser']->getGroups();
        }
        $this->setExtra('enctype="multipart/form-data"');
        $this->startTab(_CO_PUBLISHER_TAB_MAIN);
        // Category
        $categoryFormSelect = new XoopsFormSelect(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
        $categoryFormSelect->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
        $categoryFormSelect->addOptionArray($publisher->getHandler('category')->getCategoriesForSubmit());
        $this->addElement($categoryFormSelect);
        // ITEM TITLE
        $this->addElement(new XoopsFormText(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true);
        // SUBTITLE
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUBTITLE)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e')));
        }
        // SHORT URL
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_SHORT_URL)) {
            $textShortUrl = new XoopsFormText(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->short_url('e'));
            $textShortUrl->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC);
            $this->addElement($textShortUrl);
        }
        // TAGS
        if (xoops_isActiveModule('tag') && $this->isGranted(PublisherConstants::PUBLISHER_ITEM_TAG)) {
            include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
            $textTags = new XoopsFormTag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
            $this->addElement($textTags);
        }
        // SELECT EDITOR
        $nohtml = !$obj->dohtml();
        if (count($allowedEditors) === 1) {
            $editor = $allowedEditors[0];
        } elseif (count($allowedEditors) > 0) {
            $editor = XoopsRequest::getString('editor', '', 'POST');
            if (!empty($editor)) {
                publisherSetCookieVar('publisher_editor', $editor);
            } else {
                $editor = publisherGetCookieVar('publisher_editor');
                if (empty($editor) && is_object($GLOBALS['xoopsUser'])) {
                    //                    $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile
                    $editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
                    // Need set through user profile
                }
            }
            $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $publisher->getConfig('submit_editor') : $editor;
            $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
            $this->addElement($formEditor);
        } else {
            $editor = $publisher->getConfig('submit_editor');
        }
        $editorConfigs = array();
        $editorConfigs['rows'] = !$publisher->getConfig('submit_editor_rows') ? 35 : $publisher->getConfig('submit_editor_rows');
        $editorConfigs['cols'] = !$publisher->getConfig('submit_editor_cols') ? 60 : $publisher->getConfig('submit_editor_cols');
        $editorConfigs['width'] = !$publisher->getConfig('submit_editor_width') ? '100%' : $publisher->getConfig('submit_editor_width');
        $editorConfigs['height'] = !$publisher->getConfig('submit_editor_height') ? '400px' : $publisher->getConfig('submit_editor_height');
        // SUMMARY
        if ($this->isGranted(PublisherConstants::PUBLISHER_SUMMARY)) {
            // Description
            //$summaryText = new XoopsFormTextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60);
            $editorConfigs['name'] = 'summary';
            $editorConfigs['value'] = $obj->getVar('summary', 'e');
            $summaryText = new XoopsFormEditor(_CO_PUBLISHER_SUMMARY, $editor, $editorConfigs, $nohtml, $onfailure = null);
            $summaryText->setDescription(_CO_PUBLISHER_SUMMARY_DSC);
            $this->addElement($summaryText);
        }
        // BODY
        $editorConfigs['name'] = 'body';
        $editorConfigs['value'] = $obj->getVar('body', 'e');
        $bodyText = new XoopsFormEditor(_CO_PUBLISHER_BODY, $editor, $editorConfigs, $nohtml, $onfailure = null);
        $bodyText->setDescription(_CO_PUBLISHER_BODY_DSC);
        $this->addElement($bodyText);
        // VARIOUS OPTIONS
        if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML) || $this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY) || $this->isGranted(PublisherConstants::PUBLISHER_DOXCODE) || $this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE) || $this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOHTML)) {
                $html_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->dohtml(), _YES, _NO);
                $this->addElement($html_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOSMILEY)) {
                $smiley_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->dosmiley(), _YES, _NO);
                $this->addElement($smiley_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOXCODE)) {
                $xcode_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->doxcode(), _YES, _NO);
                $this->addElement($xcode_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOIMAGE)) {
                $image_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->doimage(), _YES, _NO);
                $this->addElement($image_radio);
            }
            if ($this->isGranted(PublisherConstants::PUBLISHER_DOLINEBREAK)) {
                $linebreak_radio = new XoopsFormRadioYN(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->dobr(), _YES, _NO);
                $this->addElement($linebreak_radio);
            }
        }
        // Available pages to wrap
        if ($this->isGranted(PublisherConstants::PUBLISHER_AVAILABLE_PAGE_WRAP)) {
            $wrapPages = XoopsLists::getHtmlListAsArray(publisherGetUploadDir(true, 'content'));
            $availableWrapPagesText = array();
            foreach ($wrapPages as $page) {
                $availableWrapPagesText[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
            }
            $availableWrapPages = new XoopsFormLabel(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $availableWrapPagesText));
            $availableWrapPages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
            $this->addElement($availableWrapPages);
        }
        // Uid
        /*  We need to retreive the users manually because for some reason, on the frxoops.org server,
            the method users::getobjects encounters a memory error
            */
        // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
        if ($this->isGranted(PublisherConstants::PUBLISHER_UID)) {
            $uidSelect = new XoopsFormSelect(_CO_PUBLISHER_UID, 'uid', $obj->uid(), 1, false);
            $uidSelect->setDescription(_CO_PUBLISHER_UID_DSC);
            $sql = 'SELECT uid, uname FROM ' . $obj->db->prefix('users') . ' ORDER BY uname ASC';
            $result = $obj->db->query($sql);
            $usersArray = array();
            $usersArray[0] = $GLOBALS['xoopsConfig']['anonymous'];
            while (($myrow = $obj->db->fetchArray($result)) !== false) {
                $usersArray[$myrow['uid']] = $myrow['uname'];
            }
            $uidSelect->addOptionArray($usersArray);
            $this->addElement($uidSelect);
        }
        /* else {
           $hidden = new XoopsFormHidden('uid', $obj->uid());
           $this->addElement($hidden);
           unset($hidden);
           }*/
        // Author ALias
        if ($this->isGranted(PublisherConstants::PUBLISHER_AUTHOR_ALIAS)) {
            $element = new XoopsFormText(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e'));
            $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC);
            $this->addElement($element);
            unset($element);
        }
        // STATUS
        if ($this->isGranted(PublisherConstants::PUBLISHER_STATUS)) {
            $options = array(PublisherConstants::PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, PublisherConstants::PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, PublisherConstants::PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, PublisherConstants::PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
            $statusSelect = new XoopsFormSelect(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
            $statusSelect->addOptionArray($options);
            $statusSelect->setDescription(_CO_PUBLISHER_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
        }
        // Datesub
        if ($this->isGranted(PublisherConstants::PUBLISHER_DATESUB)) {
            if ($obj->isNew()) {
                $datesub = time();
            } else {
                $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub');
            }
            $datesub_datetime = new PublisherFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            // $datesub_datetime = new XoopsFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub, true, true);
            $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC);
            $this->addElement($datesub_datetime);
        }
        // NOTIFY ON PUBLISH
        if ($this->isGranted(PublisherConstants::PUBLISHER_NOTIFY)) {
            $notify_radio = new XoopsFormRadioYN(_CO_PUBLISHER_NOTIFY, 'notify', $obj->notifypub(), _YES, _NO);
            $this->addElement($notify_radio);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_IMAGES)) {
            $this->startTab(_CO_PUBLISHER_TAB_IMAGES);
        }
        // IMAGE
        if ($this->isGranted(PublisherConstants::PUBLISHER_IMAGE_ITEM)) {
            $objimages = $obj->getImages();
            $mainarray = is_object($objimages['main']) ? array($objimages['main']) : array();
            $mergedimages = array_merge($mainarray, $objimages['others']);
            $objimage_array = array();
            foreach ($mergedimages as $imageObj) {
                $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $catids = array_keys($catlist);
            $imageObjs = array();
            if (!empty($catids)) {
                $imageHandler =& xoops_getHandler('image');
                $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . implode(',', $catids) . ')', 'IN'));
                $criteria->add(new Criteria('image_display', 1));
                $criteria->setSort('image_nicename');
                $criteria->setOrder('ASC');
                $imageObjs = $imageHandler->getObjects($criteria, true);
                unset($criteria);
            }
            $image_array = array();
            foreach ($imageObjs as $imageObj) {
                $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
            }
            $image_array = array_diff($image_array, $objimage_array);
            $imageSelect = new XoopsFormSelect('', 'image_notused', '', 5);
            $imageSelect->addOptionArray($image_array);
            $imageSelect->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            //$imageSelect->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'");
            unset($image_array);
            $imageSelect2 = new XoopsFormSelect('', 'image_item', '', 5, true);
            $imageSelect2->addOptionArray($objimage_array);
            $imageSelect2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $buttonadd = new XoopsFormButton('', 'buttonadd', _CO_PUBLISHER_ADD);
            $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $buttonremove = new XoopsFormButton('', 'buttonremove', _CO_PUBLISHER_REMOVE);
            $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
            $opentable = new XoopsFormLabel('', '<table><tr><td>');
            $addcol = new XoopsFormLabel('', '</td><td>');
            $addbreak = new XoopsFormLabel('', '<br />');
            $closetable = new XoopsFormLabel('', '</td></tr></table>');
            $GLOBALS['xoTheme']->addScript(PUBLISHER_URL . '/assets/js/ajaxupload.3.9.js');
            $js_data = new XoopsFormLabel('', '
<script type= "text/javascript">/*<![CDATA[*/
$publisher(document).ready(function () {
    var button = $publisher("#publisher_upload_button"), interval;
    new AjaxUpload(button,{
        action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons
        responseType: "text/html",
        name: "publisher_upload_file",
        onSubmit : function (file, ext) {
            // change button text, when user selects file
            $publisher("#publisher_upload_message").html(" ");
            button.html("<img src=\'' . PUBLISHER_URL . '/assets/images/loadingbar.gif\'/>"); this.setData({
                "image_nicename": $publisher("#image_nicename").val(),
                "imgcat_id" : $publisher("#imgcat_id").val()
            });
            // If you want to allow uploading only 1 file at time,
            // you can disable upload button
            this.disable();
            interval = window.setInterval(function () {
            }, 200);
        },
        onComplete: function (file, response) {
            button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '");
            window.clearInterval(interval);
            // enable upload button
            this.enable();
            // add file to the list
            var result = eval(response);
            if ("success" == result[0]) {
                 $publisher("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>");
                 publisher_updateSelectOption(\'image_item\', \'image_featured\');
                 showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XOOPS_URL . '\')
            } else {
                 $publisher("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>");
            }
        }
    });
});
/*]]>*/</script>
');
            $messages = new XoopsFormLabel('', "<div id='publisher_upload_message'></div>");
            $button = new XoopsFormLabel('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '</div>');
            $nicename = new XoopsFormText('', 'image_nicename', 30, 30, _CO_PUBLISHER_IMAGE_NICENAME);
            $imgcatHandler =& xoops_getHandler('imagecategory');
            if (method_exists($imgcatHandler, 'getListByPermission')) {
                $catlist = $imgcatHandler->getListByPermission($group, 'imgcat_read', 1);
            } else {
                $catlist = $imgcatHandler->getList($group, 'imgcat_read', 1);
            }
            $imagecat = new XoopsFormSelect('', 'imgcat_id', '', 1);
            $imagecat->addOptionArray($catlist);
            $imageUploadTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, '');
            $imageUploadTray->addElement($js_data);
            $imageUploadTray->addElement($messages);
            $imageUploadTray->addElement($opentable);
            $imageUploadTray->addElement($imagecat);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($nicename);
            $imageUploadTray->addElement($addbreak);
            $imageUploadTray->addElement($button);
            $imageUploadTray->addElement($closetable);
            $this->addElement($imageUploadTray);
            $imageTray = new XoopsFormElementTray(_CO_PUBLISHER_IMAGE_ITEMS, '');
            $imageTray->addElement($opentable);
            $imageTray->addElement($imageSelect);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonadd);
            $imageTray->addElement($addcol);
            $imageTray->addElement($imageSelect2);
            $imageTray->addElement($addbreak);
            $imageTray->addElement($buttonremove);
            $imageTray->addElement($closetable);
            $imageTray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC);
            $this->addElement($imageTray);
            $imagename = is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : '';
            $imageforpath = $imagename != '' ? $imagename : 'blank.gif';
            $imageSelect3 = new XoopsFormSelect(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1);
            $imageSelect3->addOptionArray($objimage_array);
            $imageSelect3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . XOOPS_URL . "\")'");
            $imageSelect3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC);
            $this->addElement($imageSelect3);
            $image_preview = new XoopsFormLabel(_CO_PUBLISHER_IMAGE_PREVIEW, "<img src='" . XOOPS_URL . '/uploads/' . $imageforpath . "' name='image_display' id='image_display' alt='' />");
            $this->addElement($image_preview);
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_FILES)) {
            $this->startTab(_CO_PUBLISHER_TAB_FILES);
        }
        // File upload UPLOAD
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_UPLOAD_FILE)) {
            // NAME
            $nameText = new XoopsFormText(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, '');
            $nameText->setDescription(_CO_PUBLISHER_FILE_NAME_DSC);
            $this->addElement($nameText);
            unset($nameText);
            // DESCRIPTION
            $descriptionText = new XoopsFormTextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', '');
            $descriptionText->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC);
            $this->addElement($descriptionText);
            unset($descriptionText);
            $statusSelect = new XoopsFormRadioYN(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1);
            //1 - active
            $statusSelect->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC);
            $this->addElement($statusSelect);
            unset($statusSelect);
            $fileBox = new XoopsFormFile(_CO_PUBLISHER_ITEM_UPLOAD_FILE, 'item_upload_file', 0);
            $fileBox->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC);
            $fileBox->setExtra("size ='50'");
            $this->addElement($fileBox);
            unset($fileBox);
            if (!$obj->isNew()) {
                $filesObj =& $publisher->getHandler('file')->getAllFiles($obj->itemid());
                if (count($filesObj) > 0) {
                    $table = '';
                    $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
                    $table .= '<tr>';
                    $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>";
                    $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . '</strong></td>';
                    $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . '</strong></td>';
                    $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . '</strong></td>';
                    $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
                    $table .= '</tr>';
                    foreach ($filesObj as $fileObj) {
                        $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>";
                        $delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>";
                        if ($fileObj->status() == 0) {
                            $not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'/>";
                        } else {
                            $not_visible = '';
                        }
                        $table .= '<tr>';
                        $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . '</td>';
                        $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . '</td>';
                        $table .= "<td class='even' align='left'>" . $fileObj->description() . '</td>';
                        $table .= "<td class='even' align='center'>" . $fileObj->counter() . '';
                        $table .= "<td class='even' align='center'>" . $fileObj->getDatesub() . '</td>';
                        $table .= "<td class='even' align='center'> {$modify} {$delete} </td>";
                        $table .= '</tr>';
                    }
                    $table .= '</table>';
                    $files_box = new XoopsFormLabel(_CO_PUBLISHER_FILES_LINKED, $table);
                    $this->addElement($files_box);
                    unset($files_box, $filesObj, $fileObj);
                }
            }
        }
        if ($this->hasTab(_CO_PUBLISHER_TAB_OTHERS)) {
            $this->startTab(_CO_PUBLISHER_TAB_OTHERS);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_META);
        // Meta Keywords
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_KEYWORDS)) {
            $text_meta_keywords = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->meta_keywords('e'), 7, 60);
            $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC);
            $this->addElement($text_meta_keywords);
        }
        // Meta Description
        if ($this->isGranted(PublisherConstants::PUBLISHER_ITEM_META_DESCRIPTION)) {
            $text_meta_description = new XoopsFormTextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->meta_description('e'), 7, 60);
            $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC);
            $this->addElement($text_meta_description);
        }
        //$this->startTab(_CO_PUBLISHER_TAB_PERMISSIONS);
        // COMMENTS
        if ($this->isGranted(PublisherConstants::PUBLISHER_ALLOWCOMMENTS)) {
            $addcomments_radio = new XoopsFormRadioYN(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->cancomment(), _YES, _NO);
            $this->addElement($addcomments_radio);
        }
        // WEIGHT
        if ($this->isGranted(PublisherConstants::PUBLISHER_WEIGHT)) {
            $this->addElement(new XoopsFormText(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->weight()));
        }
        $this->endTabs();
        //COMMON TO ALL TABS
        $button_tray = new XoopsFormElementTray('', '');
        if (!$obj->isNew()) {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _SUBMIT, 'submit'));
            //orclone
        } else {
            $button_tray->addElement(new XoopsFormButton('', 'additem', _CO_PUBLISHER_CREATE, 'submit'));
            $button_tray->addElement(new XoopsFormButton('', '', _CO_PUBLISHER_CLEAR, 'reset'));
        }
        $button_tray->addElement(new XoopsFormButton('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit'));
        $butt_cancel = new XoopsFormButton('', '', _CO_PUBLISHER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $this->addElement($button_tray);
        $hidden = new XoopsFormHidden('itemid', $obj->itemid());
        $this->addElement($hidden);
        unset($hidden);
        return $this;
    }
示例#27
0
 if ($moduleObj) {
     $from_module_version = round($moduleObj->getVar('version') / 100, 2);
     if ($from_module_version >= 1.1) {
         $importfile_select_array["news"] = "News " . $from_module_version;
         $news_version = $from_module_version;
     }
 }
 if (isset($importfile_select_array) && count($importfile_select_array) > 0) {
     $sform = new XoopsThemeForm(_AM_SSECTION_IMPORT_SELECTION, "op", xoops_getenv('PHP_SELF'));
     $sform->setExtra('enctype="multipart/form-data"');
     // Partners to import
     $importfile_select = new XoopsFormSelect('', 'importfile', $importfile);
     $importfile_select->addOptionArray($importfile_select_array);
     $importfile_tray = new XoopsFormElementTray(_AM_SSECTION_IMPORT_SELECT_FILE, '&nbsp;');
     $importfile_tray->addElement($importfile_select);
     $importfile_tray->setDescription(_AM_SSECTION_IMPORT_SELECT_FILE_DSC);
     $sform->addElement($importfile_tray);
     // Buttons
     $button_tray = new XoopsFormElementTray('', '');
     $hidden = new XoopsFormHidden('op', 'importExecute');
     $button_tray->addElement($hidden);
     $butt_import = new XoopsFormButton('', '', _AM_SSECTION_IMPORT, 'submit');
     $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
     $button_tray->addElement($butt_import);
     $butt_cancel = new XoopsFormButton('', '', _AM_SSECTION_CANCEL, 'button');
     $butt_cancel->setExtra('onclick="history.go(-1)"');
     $button_tray->addElement($butt_cancel);
     $sform->addElement($button_tray);
     $sform->addElement(new XoopsFormHidden('wfs_version', $wfs_version));
     $sform->addElement(new XoopsFormHidden('news_version', $news_version));
     $sform->display();
示例#28
0
function editfolder($showmenu = false, $folderid = 0, $categoryid = 0)
{
    global $xoopsDB, $smartmedia_folder_handler, $xoopsUser, $myts, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // if $folderid == 0 then we are adding a new folder
    $newFolder = $folderid == 0;
    echo "<script type=\"text/javascript\" src=\"funcs.js\"></script>";
    echo "<style>";
    echo "<!-- ";
    echo "select { width: 130px; }";
    echo "-->";
    echo "</style>";
    $cat_sel = '';
    if (!$newFolder) {
        // We are editing a folder
        // Creating the folder object for the selected folder
        $folderObj = $smartmedia_folder_handler->get($folderid);
        $cat_sel = "&folderid=" . $folderObj->folderid();
        $folderObj->loadLanguage($folderObj->default_languageid());
        if ($showmenu) {
            smartmedia_adminMenu(2, _AM_SMEDIA_FOLDERS . " > " . _AM_SMEDIA_EDITING);
        }
        echo "<br />\n";
        if ($folderObj->notLoaded()) {
            redirect_header("folder.php", 1, _AM_SMEDIA_NOFOLDERTOEDIT);
            exit;
        }
        smartmedia_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SMEDIA_FOLDER_EDIT . "</h3>";
        echo "<div id='bottomtable'>";
        echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">" . _AM_SMEDIA_FOLDER_EDIT_INFO . "</span>";
    } else {
        // We are creating a new folder
        $folderObj = $smartmedia_folder_handler->create();
        if ($showmenu) {
            smartmedia_adminMenu(2, _AM_SMEDIA_FOLDERS . " > " . _AM_SMEDIA_CREATINGNEW);
        }
        echo "<br />\n";
        smartmedia_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SMEDIA_FOLDER_CREATE . "</h3>";
        echo "<div id='bottomtable'>";
        echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">" . _AM_SMEDIA_FOLDER_CREATE_INFO . "</span>";
    }
    if (!$newFolder) {
        /* If it's not a new folder, lets display the already created folder language info
           for this folder, as well as a button to create a new folder language info */
        if ($folderObj->canAddLanguage()) {
            // If not all languages have been added
            echo "<form><div style=\"margin-bottom: 0px;\">";
            echo "<input type='button' name='button' onclick=\"location='folder.php?op=modtext&folderid=" . $folderObj->folderid() . "'\" value='" . _AM_SMEDIA_FOLDER_TEXT_CREATE . "'>&nbsp;&nbsp;";
            echo "</div></form>";
            echo "</div>";
        }
        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
        echo "<tr>";
        echo "<td width='20%' class='bg3' align='left'><b>" . _AM_SMEDIA_LANGUAGE . "</b></td>";
        echo "<td class='bg3' align='left'><b>" . _AM_SMEDIA_FOLDER_TITLE . "</b></td>";
        echo "<td width='60' class='bg3' align='center'><b>" . _AM_SMEDIA_ACTION . "</b></td>";
        echo "</tr>";
        $folder_textObjs = $folderObj->getAllLanguages(true);
        if (count($folder_textObjs) > 0) {
            foreach ($folder_textObjs as $key => $thiscat) {
                displayFolder_text($thiscat);
            }
        } else {
            echo "<tr>";
            echo "<td class='head' align='center' colspan= '3'>" . _AM_SMEDIA_NO_LANGUAGE_INFO . "</td>";
            echo "</tr>";
        }
        echo "</table>\n<br/>";
    }
    // Start folder form
    $sform = new XoopsThemeForm(_AM_SMEDIA_FOLDER, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    $sform->addElement(new XoopsFormHidden('folderid', $folderid));
    // Language
    $languageid_select = new XoopsFormSelectLang(_AM_SMEDIA_LANGUAGE_ITEM, 'default_languageid', $folderObj->default_languageid());
    $languageid_select->setDescription(_AM_SMEDIA_LANGUAGE_ITEM_DSC);
    $languageid_select->addOptionArray(XoopsLists::getLangList());
    if (!$newFolder) {
        $languageid_select->setExtra("style='color: grey;' disabled='disabled'");
    }
    $sform->addElement($languageid_select);
    // title
    $sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_TITLE_REQ, 'title', 50, 255, $folderObj->title('e')), true);
    // short_title
    //$sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_SHORT_TITLE, 'short_title', 50, 255, $folderObj->short_title('e')));
    $sform->addElement(new XoopsFormHidden('short_title', ''));
    // summary
    $summary = new XoopsFormTextArea(_AM_SMEDIA_FOLDER_SUMMARY, 'summary', $folderObj->summary('e'), 3, 60);
    $summary->setDescription(_AM_SMEDIA_FOLDER_SUMMARYDSC);
    $sform->addElement($summary);
    // Description
    $description_text = new XoopsFormTextArea(_AM_SMEDIA_FOLDER_DESCRIPTION, 'description', $folderObj->description('e'), 7, 60);
    $description_text->setDescription(_AM_SMEDIA_FOLDER_DESCRIPTIONDSC);
    $sform->addElement($description_text);
    // Meta-Description
    $meta = new XoopsFormTextArea(_AM_SMEDIA_FOLDER_META_DESCRIPTION, 'meta_description', $folderObj->meta_description('e'), 7, 60);
    $meta->setDescription(_AM_SMEDIA_CLIP_META_DESCRIPTIONDSC);
    $sform->addElement($meta);
    $sform->addElement(new XoopsFormHidden('itemType', 'item_text'));
    $category_tray = new XoopsFormElementTray(_AM_SMEDIA_CATEGORY);
    if (!$newFolder) {
        $category_action_select = new XoopsFormSelect('', 'category_action', 'change');
        $category_action_select_array['change'] = _AM_SMEDIA_CATEGORY_CHANGE;
        $category_action_select_array['add'] = _AM_SMEDIA_CATEGORY_ADD;
        $category_action_select->addOptionArray($category_action_select_array);
        $category_tray->addElement($category_action_select);
    } else {
        $sform->addElement(new XoopsFormHidden('category_action', 'add'));
    }
    include_once SMARTMEDIA_ROOT_PATH . "class/smarttree.php";
    $smarttree = new SmartTree($xoopsDB->prefix("smartmedia_categories"), "categoryid", "parentid");
    ob_start();
    $smarttree->makeMySelBox("title", "weight", $categoryid, 0, 'categoryid', '');
    //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
    $category_tray->addElement(new XoopsFormLabel('', ob_get_contents()));
    ob_end_clean();
    $sform->addElement($category_tray);
    // status
    $status_select = new XoopsFormSelect(_AM_SMEDIA_FOLDER_STATUS, 'statusid', $folderObj->statusid());
    $status_select->addOptionArray(smartmedia_getStatusArray());
    $sform->addElement($status_select);
    /*	// LR IMAGE
         $lr_image_array = & XoopsLists :: getImgListAsArray( smartmedia_getImageDir('folder') );
         $lr_image_select = new XoopsFormSelect( '', 'image_lr', $folderObj->image_lr() );
         $lr_image_select -> addOption ('-1', '---------------');
         $lr_image_select -> addOptionArray( $lr_image_array );
         $lr_image_select -> setExtra( "onchange='showImgSelected(\"the_image_lr\", \"image_lr\", \"" . 'uploads/smartmedia/images/folder' . "\", \"\", \"" . XOOPS_URL . "\")'" );
         $lr_image_tray = new XoopsFormElementTray( _AM_SMEDIA_FOLDER_IMAGE_LR, '&nbsp;' );
         $lr_image_tray -> addElement( $lr_image_select );
         $lr_image_tray -> addElement( new XoopsFormLabel( '', "<br /><br /><img src='" . smartmedia_getImageDir('folder', false) .$folderObj->image_lr() . "' name='the_image_lr' id='the_image_lr' alt='' />" ) );
         $lr_image_tray->setDescription(_AM_SMEDIA_FOLDER_IMAGE_LR_DSC);
         $sform -> addElement( $lr_image_tray );
    
         // LR IMAGE UPLOAD
         $max_size = 5000000;
         $lr_file_box = new XoopsFormFile(_AM_SMEDIA_FOLDER_IMAGE_LR_UPLOAD, "lr_image_file", $max_size);
         $lr_file_box->setExtra( "size ='45'") ;
         $lr_file_box->setDescription(_AM_SMEDIA_FOLDER_IMAGE_LR_UPLOAD_DSC);
         $sform->addElement($lr_file_box);
         */
    // HR IMAGE
    $hr_image_array =& XoopsLists::getImgListAsArray(smartmedia_getImageDir('folder'));
    $hr_image_select = new XoopsFormSelect('', 'image_hr', $folderObj->image_hr());
    $hr_image_select->addOption('-1', '---------------');
    $hr_image_select->addOptionArray($hr_image_array);
    $hr_image_select->setExtra("onchange='showImgSelected(\"the_image_hr\", \"image_hr\", \"" . 'uploads/smartmedia/images/folder' . "\", \"\", \"" . XOOPS_URL . "\")'");
    $hr_image_tray = new XoopsFormElementTray(_AM_SMEDIA_FOLDER_IMAGE_HR, '&nbsp;');
    $hr_image_tray->addElement($hr_image_select);
    $hr_image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartmedia_getImageDir('folder', false) . $folderObj->image_hr() . "' name='the_image_hr' id='the_image_hr' alt='' />"));
    $hr_image_tray->setDescription(sprintf(_AM_SMEDIA_FOLDER_IMAGE_HR_DSC, $xoopsModuleConfig['main_image_width']));
    $sform->addElement($hr_image_tray);
    // HR IMAGE UPLOAD
    $max_size = 5000000;
    $hr_file_box = new XoopsFormFile(_AM_SMEDIA_FOLDER_IMAGE_HR_UPLOAD, "hr_image_file", $max_size);
    $hr_file_box->setExtra("size ='45'");
    $hr_file_box->setDescription(_AM_SMEDIA_FOLDER_IMAGE_HR_UPLOAD_DSC);
    $sform->addElement($hr_file_box);
    // Weight
    $sform->addElement(new XoopsFormText(_AM_SMEDIA_FOLDER_WEIGHT, 'weight', 4, 4, $folderObj->weight()));
    $sform->addElement(new XoopsFormHidden('itemType', 'item'));
    // Action buttons tray
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addfolder');
    $button_tray->addElement($hidden);
    if ($newFolder) {
        // We are creating a new folder
        $butt_create = new XoopsFormButton('', '', _AM_SMEDIA_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfolder\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SMEDIA_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SMEDIA_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // We are editing a folder
        $butt_create = new XoopsFormButton('', '', _AM_SMEDIA_MODIFY, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfolder\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SMEDIA_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    echo "</div>";
    unset($hidden);
}
示例#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));
 }
示例#30
0
 /**
  * XoopsfaqContents::displayForm()
  *
  * @return
  */
 function displayForm()
 {
     global $xoopsModuleConfig;
     $category_handler =& xoops_getModuleHandler('category');
     if (!$category_handler->getCount()) {
         xoops_error(_AM_XOOPSFAQ_ERRORNOCAT, $title = '');
         xoops_cp_footer();
         exit;
     }
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $caption = $this->isNew() ? _AM_XOOPSFAQ_CREATENEW : sprintf(_AM_XOOPSFAQ_MODIFYITEM, $this->getVar('contents_title'));
     $form = new XoopsThemeForm($caption, 'content', $_SERVER['REQUEST_URI']);
     $form->addElement(new XoopsFormHiddenToken());
     $form->addElement(new xoopsFormHidden('op', 'save'));
     $form->addElement(new xoopsFormHidden('contents_id', $this->getVar('contents_id', 'e')));
     // title
     $category_handler =& xoops_getModuleHandler('category');
     $objects = $category_handler->getList();
     $contents_cid = new XoopsFormSelect(_AM_XOOPSFAQ_E_CONTENTS_CATEGORY, 'contents_cid', $this->getVar('contents_cid', 'e'), 1, false);
     $contents_cid->setDescription(_AM_XOOPSFAQ_E_CONTENTS_CATEGORY_DSC);
     $contents_cid->addOptionArray($objects);
     $form->addElement($contents_cid);
     $contents_title = new XoopsFormText(_AM_XOOPSFAQ_E_CONTENTS_TITLE, 'contents_title', 50, 150, $this->getVar('contents_title', 'e'));
     $contents_title->setDescription(_AM_XOOPSFAQ_E_CONTENTS_TITLE_DSC);
     $form->addElement($contents_title, true);
     /**
      */
     $options_tray = new XoopsFormElementTray(_AM_XOOPSFAQ_E_CONTENTS_CONTENT, '<br />');
     if (class_exists('XoopsFormEditor')) {
         $options['name'] = 'contents_contents';
         $options['value'] = $this->getVar('contents_contents', 'e');
         $options['rows'] = 25;
         $options['cols'] = '100%';
         $options['width'] = '100%';
         $options['height'] = '600px';
         $contents_contents = new XoopsFormEditor('', $xoopsModuleConfig['use_wysiwyg'], $options, $nohtml = false, $onfailure = 'textarea');
         $options_tray->addElement($contents_contents);
     } else {
         $contents_contents = new XoopsFormDhtmlTextArea('', 'contents_contents', $this->getVar('contents_contents', 'e'), '100%', '100%');
         $options_tray->addElement($contents_contents);
     }
     $options_tray->setDescription(_AM_XOOPSFAQ_E_CONTENTS_CONTENT_DSC);
     if (false == xoopsFaq_isEditorHTML()) {
         if ($this->isNew()) {
             $this->setVar('dohtml', 0);
             $this->setVar('dobr', 1);
         }
         $html_checkbox = new XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml', 'e'));
         $html_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOHTML);
         $options_tray->addElement($html_checkbox);
         $breaks_checkbox = new XoopsFormCheckBox('', 'dobr', $this->getVar('dobr', 'e'));
         $breaks_checkbox->addOption(1, _AM_XOOPSFAQ_E_BREAKS);
         $options_tray->addElement($breaks_checkbox);
     } else {
         $form->addElement(new xoopsFormHidden('dohtml', 1));
         $form->addElement(new xoopsFormHidden('dobr', 0));
     }
     $doimage_checkbox = new XoopsFormCheckBox('', 'doimage', $this->getVar('doimage', 'e'));
     $doimage_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOIMAGE);
     $options_tray->addElement($doimage_checkbox);
     $xcodes_checkbox = new XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode', 'e'));
     $xcodes_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOXCODE);
     $options_tray->addElement($xcodes_checkbox);
     $smiley_checkbox = new XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley', 'e'));
     $smiley_checkbox->addOption(1, _AM_XOOPSFAQ_E_DOSMILEY);
     $options_tray->addElement($smiley_checkbox);
     $form->addElement($options_tray);
     $contents_publish = new XoopsFormTextDateSelect(_AM_XOOPSFAQ_E_CONTENTS_PUBLISH, 'contents_publish', 20, $this->getVar('contents_publish'), $this->isNew());
     $contents_publish->setDescription(_AM_XOOPSFAQ_E_CONTENTS_PUBLISH_DSC);
     $form->addElement($contents_publish);
     $contents_weight = new XoopsFormText(_AM_XOOPSFAQ_E_CONTENTS_WEIGHT, 'contents_weight', 5, 5, $this->getVar('contents_weight', 'e'));
     $contents_weight->setDescription(_AM_XOOPSFAQ_E_CONTENTS_WEIGHT_DSC);
     $form->addElement($contents_weight, false);
     $contents_active = new XoopsFormRadioYN(_AM_XOOPSFAQ_E_CONTENTS_ACTIVE, 'contents_active', $this->getVar('contents_active', 'e'), ' ' . _YES . '', ' ' . _NO . '');
     $contents_active->setDescription(_AM_XOOPSFAQ_E_CONTENTS_ACTIVE_DSC);
     $form->addElement($contents_active, false);
     //$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     $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();
 }