예제 #1
0
 function makeTopicSelBox($none = false, $seltopic = null, $selname = '', $onchange = '')
 {
     $seltopic = is_null($seltopic) ? intval($this->topic_id) : intval($seltopic);
     ob_start();
     $tree = new XoopsTree($this->table, "topic_id", "topic_pid");
     $tree->makeMySelBox("topic_title", "topic_title", $seltopic, $none, $selname, $onchange);
     $ret = ob_get_contents();
     ob_end_clean();
     //$ret = str_replace('topic_id','topicid', $ret); // non-sense code?
     return $ret;
 }
예제 #2
0
 /**
  * created elements
  * @license http://www.blags.org/
  * @created:2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author Martin <*****@*****.**> 
  * */
 function createElements()
 {
     global $xoopsDB;
     $mytree = new XoopsTree($xoopsDB->prefix("martin_hotel_city"), "city_id", "city_parentid");
     // Parent Category
     ob_start();
     $mytree->makeMySelBox("city_name", "", $this->Obj->city_parentid(), 1, 'city_parentid');
     //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
     $this->addElement(new XoopsFormLabel("父类", ob_get_contents()));
     ob_end_clean();
     // City Name
     $this->addElement(new XoopsFormText('名称', 'city_name', 50, 255, $this->Obj->city_name()), true);
     $this->addElement(new XoopsFormText('网址', 'city_alias', 50, 255, $this->Obj->city_alias()), true);
     $this->addElement(new XoopsFormHidden('id', $this->Obj->city_id()));
 }
예제 #3
0
 /**
  * @get city tree
  * @license http://www.blags.org/
  * @created:2010年05月29日 11时31分
  * @copyright 1997-2010 The Martin Group
  * @author Martin <*****@*****.**> 
  * */
 function &getTree($name, $city_id, $prefix = '--')
 {
     $mytree = new XoopsTree($this->db->prefix("martin_hotel_city"), "city_id", "city_parentid");
     // Parent Category
     ob_start();
     $mytree->makeMySelBox("city_name", "", $city_id, 1, $name);
     //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
     $str = ob_get_contents();
     ob_end_clean();
     return $str;
 }
예제 #4
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);
    }
}
예제 #5
0
function gf_makeFilemgmtCatSelect($uid)
{
    global $_CONF, $_FM_TABLES, $_DB_name;
    include_once $_CONF[path_html] . "filemgmt/include/xoopstree.php";
    include_once $_CONF[path_html] . "filemgmt/include/textsanitizer.php";
    $_GROUPS = SEC_getUserGroups($uid);
    $mytree = new XoopsTree($_DB_name, $_FM_TABLES['filemgmt_cat'], "cid", "pid");
    $mytree->setGroupUploadAccessFilter($_GROUPS);
    return $mytree->makeMySelBox('title', 'title', '', '', 'filemgmtcat');
}
예제 #6
0
function editfaq($showmenu = false, $faqid = -1)
{
    global $faq_handler, $category_handler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a faq
    if ($faqid != -1) {
        // Creating the FAQ object
        $faqObj = new sfFaq($faqid);
        if ($faqObj->notLoaded()) {
            redirect_header("faq.php", 1, _AM_SF_NOARTTOEDIT);
            exit;
        }
        switch ($faqObj->status()) {
            case _SF_STATUS_ASKED:
                $breadcrumb_action = _AM_SF_APPROVING;
                $collapsableBar_title = _AM_SF_QUESTION_APPROVING;
                $collapsableBar_info = _AM_SF_QUESTION_APPROVING_INFO;
                $button_caption = _AM_SF_QUEUE;
                break;
            case "default":
            default:
                $breadcrumb_action = _AM_SF_EDITING;
                $collapsableBar_title = _AM_SF_EDITQUES;
                $collapsableBar_info = _AM_SF_EDITING_INFO;
                $button_caption = _AM_SF_MODIFY;
                break;
        }
        // Creating the category of this FAQ
        $categoryObj =& $category_handler->get($faqObj->categoryid());
        if ($showmenu) {
            sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action);
        }
        echo "<br />\n";
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . $collapsableBar_title . "</h3>";
        echo "<div id='bottomtable'>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $collapsableBar_info . "</span>";
    } else {
        // there's no parameter, so we're adding a faq
        $faqObj =& $faq_handler->create();
        $faqObj->setVar('uid', $xoopsUser->getVar('uid'));
        $categoryObj =& $category_handler->create();
        $breadcrumb_action = _AM_SF_CREATINGNEW;
        $button_caption = _AM_SF_CREATE;
        if ($showmenu) {
            sf_adminMenu(3, _AM_SF_OPEN_QUESTIONS . " > " . $breadcrumb_action);
        }
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SF_CREATEQUESTION . "</h3>";
        echo "<div id='bottomtable'>";
    }
    $sform = new XoopsThemeForm(_AM_SF_OPEN_QUESTION, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // faq requester
    $sform->addElement(new XoopsFormLabel(_AM_SF_REQUESTED_BY, sf_getLinkedUnameFromId($faqObj->uid(), $xoopsModuleConfig['userealname'])));
    // CATEGORY
    /*
     * Get information for pulldown menu using XoopsTree.
     * First var is the database table
     * Second var is the unique field ID for the categories
     * Last one is not set as we do not have sub menus in Smartfaq
     */
    $mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
    ob_start();
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $sform->addElement(new XoopsFormLabel(_AM_SF_CATEGORY_QUESTION, ob_get_contents()));
    ob_end_clean();
    // faq QUESTION
    $sform->addElement(new XoopsFormTextArea(_AM_SF_QUESTION, 'question', $faqObj->question(), 7, 60));
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SF_PERMISSIONS_QUESTION, 'groups[]', $faqObj->getGroups_read());
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    // faq ID
    $sform->addElement(new XoopsFormHidden('faqid', $faqObj->faqid()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addfaq');
    $button_tray->addElement($hidden);
    $sform->addElement(new XoopsFormHidden('status', $faqObj->status()));
    // Setting the FAQ Status
    /*	$status_select = new XoopsFormSelect('', 'status', $status);
    	$status_select->addOptionArray(sf_getStatusArray());
    	$status_tray = new XoopsFormElementTray(_AM_SF_STATUS_EXP , '&nbsp;');
    	$status_tray->addElement($status_select);
    	$sform->addElement($status_tray);
    	*/
    if ($faqid == -1) {
        // there's no faqid? Then it's a new faq
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // else, we're editing an existing faq
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
        $button_tray->addElement($butt_create);
        $butt_edit = new XoopsFormButton('', '', _AM_SF_OPEN_QUESTION_EDIT, 'button');
        $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&amp;faqid=" . $faqid . "'\"");
        $button_tray->addElement($butt_edit);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    echo "</div>";
    unset($hidden);
}
예제 #7
0
파일: news.php 프로젝트: ming-hai/XoopsCore
            $form = new Xoops\Form\ThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}");
            // Categories to be imported
            $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM " . $xoopsDB->prefix("topics") . " AS cat INNER JOIN " . $xoopsDB->prefix("stories") . " AS art ON cat.topic_id=art.topicid GROUP BY art.topicid";
            $result = $xoopsDB->query($sql);
            $cat_cbox_options = array();
            while (list($cid, $pid, $cat_title, $art_count) = $xoopsDB->fetchRow($result)) {
                $cat_title = $myts->displayTarea($cat_title);
                $cat_cbox_options[$cid] = "{$cat_title} ({$art_count})";
            }
            $cat_label = new Xoops\Form\Label(_AM_PUBLISHER_IMPORT_CATEGORIES, implode("<br />", $cat_cbox_options));
            $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC);
            $form->addElement($cat_label);
            // Publisher parent category
            $mytree = new XoopsTree($xoopsDB->prefix("publisher_categories"), "categoryid", "parentid");
            ob_start();
            $mytree->makeMySelBox("name", "weight", $preset_id = 0, $none = 1, $sel_name = "parent_category");
            $parent_cat_sel = new Xoops\Form\Label(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents());
            $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC);
            $form->addElement($parent_cat_sel);
            ob_end_clean();
            $form->addElement(new Xoops\Form\Hidden('op', 'go'));
            $form->addElement(new Xoops\Form\Button('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));
            $form->addElement(new Xoops\Form\Hidden('from_module_version', $_POST['news_version']));
            $form->display();
        }
    }
    PublisherUtils::closeCollapsableBar('newsimport', 'newsimporticon');
    $xoops->footer();
}
if ($op === 'go') {
    PublisherUtils::cpHeader();
예제 #8
0
// setting physical & virtual paths
$mod_path = XOOPS_ROOT_PATH . "/modules/{$mydirname}";
$mod_url = XOOPS_URL . "/modules/{$mydirname}";
// creating an instance of piCal
$cal = new piCal_xoops("", $xoopsConfig['language'], true);
// setting properties of piCal
$cal->conn = $conn;
include '../include/read_configs.php';
$cal->base_url = $mod_url;
$cal->base_path = $mod_path;
$cal->images_url = "{$mod_url}/images/{$skin_folder}";
$cal->images_path = "{$mod_path}/images/{$skin_folder}";
// カテゴリー一覧の処理
$cattree = new XoopsTree($cal->cat_table, "cid", "pid");
ob_start();
$cattree->makeMySelBox("cat_title", "weight", $cid, 1, 'cid', '');
$cat_selbox = ob_get_contents();
ob_end_clean();
$cat_selbox4extract = str_replace("<option value='0'>", "<option value='0'>" . _ALL . "</option>\n<option value='-1'" . ($cid == -1 ? "selected" : "") . ">", $cat_selbox);
// Timezone の処理
$serverTZ = $cal->server_TZ;
$userTZ = $xoopsUser->timezone();
$tzoptions = "\n\t<option value='s'>" . _AM_TZOPT_SERVER . "</option>\n\t<option value='g'>" . _AM_TZOPT_GMT . "</option>\n\t<option value='y'>" . _AM_TZOPT_USER . "</option>\n";
switch ($tz) {
    case 's':
        $tzoffset = 0;
        $tzdisp = ($serverTZ >= 0 ? "+" : "-") . sprintf("%02d:%02d", abs($serverTZ), abs($serverTZ) * 60 % 60);
        $tzoptions = str_replace("'s'>", "'s' selected='selected'>", $tzoptions);
        break;
    case 'g':
        $tzoffset = -$serverTZ * 3600;
예제 #9
0
    $notification_handler->triggerEvent('global', 0, 'link_modify', $tags);
    redirect_header("index.php", 2, _MD_THANKSFORINFO);
    exit;
} else {
    $lid = intval($HTTP_GET_VARS['lid']);
    if (empty($xoopsUser)) {
        redirect_header(XOOPS_URL . "/user.php", 2, _MD_MUSTREGFIRST);
        exit;
    }
    $xoopsOption['template_main'] = 'mylinks_modlink.html';
    include XOOPS_ROOT_PATH . "/header.php";
    $result = $xoopsDB->query("select cid, title, url, logourl from " . $xoopsDB->prefix("mylinks_links") . " where lid={$lid} and status>0");
    $xoopsTpl->assign('lang_requestmod', _MD_REQUESTMOD);
    list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result);
    $result2 = $xoopsDB->query("SELECT description FROM " . $xoopsDB->prefix("mylinks_text") . " WHERE lid={$lid}");
    list($description) = $xoopsDB->fetchRow($result2);
    $xoopsTpl->assign('link', array('id' => $lid, 'rating' => number_format($rating, 2), 'title' => $myts->htmlSpecialChars($title), 'url' => $myts->htmlSpecialChars($url), '$logourl' => $myts->htmlSpecialChars($logourl), 'updated' => formatTimestamp($time, "m"), 'description' => $myts->htmlSpecialChars($description), 'adminlink' => $adminlink, 'hits' => $hits, 'votes' => $votestring));
    $xoopsTpl->assign('lang_linkid', _MD_LINKID);
    $xoopsTpl->assign('lang_sitetitle', _MD_SITETITLE);
    $xoopsTpl->assign('lang_siteurl', _MD_SITEURL);
    $xoopsTpl->assign('lang_category', _MD_CATEGORYC);
    ob_start();
    $mytree->makeMySelBox("title", "title", $cid);
    $selbox = ob_get_contents();
    ob_end_clean();
    $xoopsTpl->assign('category_selbox', $selbox);
    $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC);
    $xoopsTpl->assign('lang_sendrequest', _MD_SENDREQUEST);
    $xoopsTpl->assign('lang_cancel', _CANCEL);
    include XOOPS_ROOT_PATH . '/footer.php';
}
예제 #10
0
* Licence: GNU
*/
if (!defined("XOOPS_ROOT_PATH")) {
    die("XOOPS root path not defined");
}
global $_POST, $xoopsDB;
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once 'functions.php';
$mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
$form = new XoopsThemeForm(_MD_SF_SUB_SMNAME, "form", xoops_getenv('PHP_SELF'));
// Category
ob_start();
$form->addElement(new XoopsFormHidden('categoryid', ''));
$mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
$category_label = new XoopsFormLabel(_MD_SF_CATEGORY_FAQ, ob_get_contents());
$category_label->setDescription(_MD_SF_CATEGORY_FAQ_DSC);
$form->addElement($category_label);
ob_end_clean();
// FAQ QUESTION
$form->addElement(new XoopsFormTextArea(_MD_SF_QUESTION, 'question', $faqObj->question(), 7, 60), true);
// ANSWER
$answer_text = new XoopsFormDhtmlTextArea(_MD_SF_ANSWER_FAQ, 'answer', $answerObj->answer(), 15, 60);
$answer_text->setDescription(_MD_SF_ANSWER_FAQ_DSC);
$form->addElement($answer_text, true);
// HOW DO I
$howdoi_text = new XoopsFormText(_MD_SF_HOWDOI_FAQ, 'howdoi', 50, 255, $faqObj->howdoi());
$howdoi_text->setDescription(_MD_SF_HOWDOI_FAQ_DSC);
$form->addElement($howdoi_text, false);
// DIDUNO
예제 #11
0
    $xoopsOption['template_main'] = 'mylinks_submit.html';
    include XOOPS_ROOT_PATH . "/header.php";
    ob_start();
    xoopsCodeTarea("message", 37, 8);
    $xoopsTpl->assign('xoops_codes', ob_get_contents());
    ob_end_clean();
    ob_start();
    xoopsSmilies("message");
    $xoopsTpl->assign('xoops_smilies', ob_get_contents());
    ob_end_clean();
    $xoopsTpl->assign('notify_show', !empty($xoopsUser) && !$xoopsModuleConfig['autoapprove'] ? 1 : 0);
    $xoopsTpl->assign('lang_submitonce', _MD_SUBMITONCE);
    $xoopsTpl->assign('lang_submitlinkh', _MD_SUBMITLINKHEAD);
    $xoopsTpl->assign('lang_allpending', _MD_ALLPENDING);
    $xoopsTpl->assign('lang_dontabuse', _MD_DONTABUSE);
    $xoopsTpl->assign('lang_wetakeshot', _MD_TAKESHOT);
    $xoopsTpl->assign('lang_sitetitle', _MD_SITETITLE);
    $xoopsTpl->assign('lang_siteurl', _MD_SITEURL);
    $xoopsTpl->assign('lang_category', _MD_CATEGORYC);
    $xoopsTpl->assign('lang_options', _MD_OPTIONS);
    $xoopsTpl->assign('lang_notify', _MD_NOTIFYAPPROVE);
    $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC);
    $xoopsTpl->assign('lang_submit', _SUBMIT);
    $xoopsTpl->assign('lang_cancel', _CANCEL);
    ob_start();
    $mytree->makeMySelBox("title", "title", 0, 1);
    $selbox = ob_get_contents();
    ob_end_clean();
    $xoopsTpl->assign('category_selbox', $selbox);
    include XOOPS_ROOT_PATH . '/footer.php';
}
예제 #12
0
/**
 * editForum()
 *
 * @param integer $catid
 * @return
 */
function editForum($ff = null, $parent_forum = 0)
{
    global $myts, $xoopsDB, $xoopsModule;
    $forum_handler =& xoops_getmodulehandler('forum', 'newbb');
    if ($ff == null) {
        $ff =& $forum_handler->create();
        $new = true;
        $forum = 0;
    } else {
        $forum = $ff->getVar('forum_id');
        $new = false;
    }
    if ($parent_forum > 0) {
        $pf =& $forum_handler->get($parent_forum);
    }
    $mytree = new XoopsTree($xoopsDB->prefix("bb_categories"), "cat_id", "0");
    if ($forum) {
        $sform = new XoopsThemeForm(_AM_NEWBB_EDITTHISFORUM . " " . $ff->getVar('forum_name'), "op", xoops_getenv('PHP_SELF'));
    } else {
        $sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWFORUM, "op", xoops_getenv('PHP_SELF'));
        $ff->setVar('forum_order', 0);
        $ff->setVar('forum_name', '');
        $ff->setVar('forum_desc', '');
        $ff->setVar('forum_moderator', array(1));
        $ff->setVar('forum_type', 0);
        $ff->setVar('allow_html', 1);
        $ff->setVar('allow_sig', 1);
        $ff->setVar('allow_polls', 1);
        $ff->setVar('allow_subject_prefix', 0);
        $ff->setVar('hot_threshold', 10);
        $ff->setVar('allow_attachments', 1);
        $ff->setVar('attach_maxkb', 1000);
        $ff->setVar('attach_ext', 'zip|gif|jpg');
    }
    $sform->addElement(new XoopsFormText(_AM_NEWBB_FORUMNAME, 'forum_name', 50, 80, $ff->getVar('forum_name', 'E')), true);
    $sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_FORUMDESCRIPTION, 'forum_desc', $ff->getVar('forum_desc', 'E'), 10, 60), false);
    $sform->addElement(new XoopsFormHidden('parent_forum', $parent_forum));
    if ($parent_forum == 0) {
        ob_start();
        if ($new) {
            $mytree->makeMySelBox("cat_title", "cat_id", @$_GET['cat_id']);
        } else {
            $mytree->makeMySelBox("cat_title", "cat_id", $ff->getVar('cat_id'));
        }
        $sform->addElement(new XoopsFormLabel(_AM_NEWBB_CATEGORY, ob_get_contents()));
        ob_end_clean();
    } else {
        $sform->addElement(new XoopsFormHidden('cat_id', $pf->getVar('cat_id')));
    }
    $sform->addElement(new XoopsFormText(_AM_NEWBB_SET_FORUMORDER, 'forum_order', 5, 10, $ff->getVar('forum_order')), false);
    $status_select = new XoopsFormSelect(_AM_NEWBB_STATE, "forum_type", $ff->getVar('forum_type'));
    $status_select->addOptionArray(array('0' => _AM_NEWBB_ACTIVE, '1' => _AM_NEWBB_INACTIVE));
    $sform->addElement($status_select);
    $allowhtml_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOWHTML, 'allow_html', $ff->getVar('allow_html'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowhtml_radio);
    $allowsig_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOWSIGNATURES, 'allow_sig', $ff->getVar('allow_sig'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowsig_radio);
    $allowpolls_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOWPOLLS, 'allow_polls', $ff->getVar('allow_polls'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowpolls_radio);
    $allowprefix_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOW_SUBJECT_PREFIX, 'allow_subject_prefix', $ff->getVar('allow_subject_prefix'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowprefix_radio);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_HOTTOPICTHRESHOLD, 'hot_threshold', 5, 10, $ff->getVar('hot_threshold')), true);
    $allowattach_radio = new XoopsFormRadioYN(_AM_NEWBB_ALLOW_ATTACHMENTS, 'allow_attachments', $ff->getVar('allow_attachments'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowattach_radio);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_ATTACHMENT_SIZE, 'attach_maxkb', 5, 10, $ff->getVar('attach_maxkb')), true);
    $sform->addElement(new XoopsFormText(_AM_NEWBB_ALLOWED_EXTENSIONS, 'attach_ext', 50, 512, $ff->getVar('attach_ext')), true);
    $sform->addElement(new XoopsFormSelectUser(_AM_NEWBB_MODERATOR, 'forum_moderator', $ff->getVar("forum_moderator"), false, 5, true));
    $sform->addElement(new XoopsFormHidden('forum', $forum));
    $sform->addElement(new XoopsFormHidden('op', "save"));
    $button_tray = new XoopsFormElementTray('', '');
    $button_tray->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
    $button_tray->addElement(new XoopsFormButton('', '', _AM_NEWBB_CLEAR, 'reset'));
    $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
    $butt_cancel->setExtra('onclick="history.go(-1)"');
    $button_tray->addElement($butt_cancel);
    $sform->addElement($button_tray);
    $sform->display();
}
예제 #13
0
function editcat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null)
{
    global $xoopsDB, $smartsection_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 ssCategory($categoryid);
        if ($showmenu) {
            ss_adminMenu(1, _AM_SS_CATEGORIES . " > " . _AM_SS_EDITING);
        }
        echo "<br />\n";
        if ($categoryObj->notLoaded()) {
            redirect_header("category.php", 1, _AM_SS_NOCOLTOEDIT);
            exit;
        }
        ss_collapsableBar('edittable', 'edittableicon', _AM_SS_EDITCOL, _AM_SS_CATEGORY_EDIT_INFO);
    } else {
        if (!$categoryObj) {
            $categoryObj = $smartsection_category_handler->create();
        }
        if ($showmenu) {
            ss_adminMenu(1, _AM_SS_CATEGORIES . " > " . _AM_SS_CREATINGNEW);
        }
        //echo "<br />\n";
        ss_collapsableBar('createtable', 'createtableicon', _AM_SS_CATEGORY_CREATE, _AM_SS_CATEGORY_CREATE_INFO);
    }
    // Start category form
    $mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
    $sform = new XoopsThemeForm(_AM_SS_CATEGORY, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // Name
    $sform->addElement(new XoopsFormText(_AM_SS_CATEGORY, 'name', 50, 255, $categoryObj->name('e')), true);
    // Decsription
    $sform->addElement(new XoopsFormTextArea(_AM_SS_COLDESCRIPT, 'description', $categoryObj->description('e'), 7, 60));
    /*
    // IMAGE
    $image_array = & XoopsLists :: getImgListAsArray( ss_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/smartsection/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'" );
    $image_tray = new XoopsFormElementTray( _AM_SS_IMAGE, '&nbsp;' );
    $image_tray -> addElement( $image_select );
    $image_tray -> addElement( new XoopsFormLabel( '', "<br /><br /><img src='" . ss_getImageDir('category', false) .$categoryObj->image() . "' name='image3' id='image3' alt='' />" ) );
    $image_tray->setDescription(_AM_SS_IMAGE_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_DSC);
    $sform->addElement($file_box);
    */
    // Weight
    $sform->addElement(new XoopsFormText(_AM_SS_COLPOSIT, 'weight', 4, 4, $categoryObj->weight()));
    // READ PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_read_checkbox = new XoopsFormCheckBox(_AM_SS_PERMISSIONS_CAT_READ, 'groups_read[]', $categoryObj->getGroups_read());
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_read_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_read_checkbox);
    // Apply permissions on all items
    $apply = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0;
    $addapplyall_radio = new XoopsFormRadioYN(_AM_SS_PERMISSIONS_APPLY_ON_ITEMS, 'applyall', $apply, ' ' . _AM_SS_YES . '', ' ' . _AM_SS_NO . '');
    $sform->addElement($addapplyall_radio);
    // MODERATORS
    //$moderators_tray = new XoopsFormElementTray(_AM_SS_MODERATORS_DEF, '');
    $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="")
    $sform->addElement(new XoopsFormLabel(_AM_SS_PARENT_CATEGORY_EXP, ob_get_contents()));
    ob_end_clean();
    // Added by fx2024
    // sub Categories
    $cat_tray = new XoopsFormElementTray(_AM_SS_SCATEGORYNAME, '<br /><br />');
    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_SS_ADD_OPT, $t->render()));
    $b = new XoopsFormButton('', 'submit', _AM_SS_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_SS_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $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('createtable', 'createtableicon');
    } else {
        // button says 'Update'
        $butt_create = new XoopsFormButton('', '', _AM_SS_MODIFY, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"');
        $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('edittable', 'edittableicon');
    }
    //Added by fx2024
    if ($categoryid) {
        include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/displaysubcats.php";
        include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/displayitems.php";
    }
    //end of fx2024 code
    unset($hidden);
}
예제 #14
0
function editfaq($showmenu = false, $faqid = -1, $answerid = -1, $merge = false)
{
    global $answer_handler, $faq_handler, $category_handler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    // If there is a parameter, and the id exists, retrieve data: we're editing a faq
    if ($faqid != -1) {
        // Creating the FAQ object
        $faqObj = new sfFaq($faqid);
        if ($faqObj->notLoaded()) {
            redirect_header("faq.php", 1, _AM_SF_NOFAQSELECTED);
            exit;
        }
        if ($answerid == -1) {
            // Creating the object for the official answer
            $answerObj =& $faqObj->answer();
            if (!$answerObj) {
                $answerObj = $answer_handler->create();
            }
        } else {
            $answerObj = new sfAnswer($answerid);
            $originalAnswerObj =& $faqObj->answer();
        }
        switch ($faqObj->status()) {
            case _SF_STATUS_ASKED:
                $breadcrumb_action1 = _AM_SF_ASKED;
                $breadcrumb_action2 = _AM_SF_APPROVING;
                $collapsableBar_title = _AM_SF_ASKED_TITLE;
                $collapsableBar_info = _AM_SF_ASKED_TITLE_INFO;
                $button_caption = _AM_SF_PUBLISHED;
                $an_status = _SF_AN_STATUS_APPROVED;
                $answerObj->setVar('uid', $xoopsUser->getVar('uid'));
                break;
            case _SF_STATUS_ANSWERED:
                $breadcrumb_action1 = _AM_SF_ANSWERED;
                $breadcrumb_action2 = _AM_SF_APPROVING;
                $collapsableBar_title = _AM_SF_ANSWERED_TITLE;
                $collapsableBar_info = _AM_SF_ANSWERED_TITLE_INFO;
                $button_caption = _AM_SF_APPROVE;
                $an_status = _SF_AN_STATUS_PROPOSED;
                break;
            case _SF_STATUS_SUBMITTED:
                $breadcrumb_action1 = _AM_SF_SUBMITTED;
                $breadcrumb_action2 = _AM_SF_APPROVING;
                $collapsableBar_title = _AM_SF_SUBMITTED_TITLE;
                $collapsableBar_info = _AM_SF_SUBMITTED_INFO;
                $button_caption = _AM_SF_APPROVE;
                $an_status = _SF_AN_STATUS_PROPOSED;
                break;
            case _SF_STATUS_PUBLISHED:
                $breadcrumb_action1 = _AM_SF_PUBLISHED;
                $breadcrumb_action2 = _AM_SF_EDITING;
                $collapsableBar_title = _AM_SF_PUBLISHEDEDITING;
                $collapsableBar_info = _AM_SF_PUBLISHEDEDITING_INFO;
                $button_caption = _AM_SF_MODIFY;
                $an_status = _SF_AN_STATUS_APPROVED;
                break;
            case _SF_STATUS_OFFLINE:
                $breadcrumb_action1 = _AM_SF_OFFLINE;
                $breadcrumb_action2 = _AM_SF_EDITING;
                $collapsableBar_title = _AM_SF_OFFLINEEDITING;
                $collapsableBar_info = _AM_SF_OFFLINEEDITING_INFO;
                $button_caption = _AM_SF_MODIFY;
                $an_status = _SF_AN_STATUS_APPROVED;
                break;
            case _SF_STATUS_OPENED:
                $breadcrumb_action1 = _AM_SF_OPEN_QUESTIONS;
                $breadcrumb_action2 = _AM_SF_ANSWERING;
                $collapsableBar_title = _AM_SF_OPEN_QUESTION_ANSWERING;
                $collapsableBar_info = _AM_SF_OPEN_QUESTION_ANSWERING_INFO;
                $button_caption = _AM_SF_PUBLISH;
                $an_status = _SF_AN_STATUS_NOTSET;
                $answerObj->setVar('uid', $xoopsUser->getVar('uid'));
                break;
            case _SF_STATUS_NEW_ANSWER:
                $breadcrumb_action1 = _AM_SF_PUBLISHED;
                $breadcrumb_action2 = _AM_SF_EDITING;
                $collapsableBar_title = _AM_SF_NEW_ANSWER_EDITING;
                $collapsableBar_info = _AM_SF_NEW_ANSWER_EDITING_INFO;
                $button_caption = _AM_SF_PUBLISH;
                $an_status = _SF_AN_STATUS_NOTSET;
                break;
            case "default":
            default:
                break;
        }
        /*		if (!$answerObj) {
        			redirect_header("faq.php", 2, _AM_SF_ANSWERNOTFOUND);
        			exit();
        		}		*/
        // Creating the category of this FAQ
        $categoryObj =& $faqObj->category();
        if ($showmenu) {
            sf_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        echo "<br />\n";
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . $collapsableBar_title . "</h3>";
        echo "<div id='bottomtable'>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $collapsableBar_info . "</span>";
    } else {
        // there's no parameter, so we're adding a faq
        $faqObj =& $faq_handler->create();
        $faqObj->setVar('uid', $xoopsUser->getVar('uid'));
        $categoryObj =& $category_handler->create();
        $answerObj =& $answer_handler->create();
        $answerObj->setVar('uid', $xoopsUser->getVar('uid'));
        $breadcrumb_action1 = _AM_SF_SMARTFAQS;
        $breadcrumb_action2 = _AM_SF_CREATINGNEW;
        $button_caption = _AM_SF_CREATE;
        if ($showmenu) {
            sf_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
        }
        sf_collapsableBar('bottomtable', 'bottomtableicon');
        echo "<img id='bottomtableicon' src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/close12.gif alt='' /></a>&nbsp;" . _AM_SF_CREATESMARTFAQ . "</h3>";
        echo "<div id='bottomtable'>";
    }
    $sform = new XoopsThemeForm(_AM_SF_SMARTFAQ, "op", xoops_getenv('PHP_SELF'));
    $sform->setExtra('enctype="multipart/form-data"');
    // faq requester
    $sform->addElement(new XoopsFormLabel(_AM_SF_REQUESTED_BY, sf_getLinkedUnameFromId($faqObj->uid(), $xoopsModuleConfig['userealname'])));
    // faq answered by
    $sform->addElement(new XoopsFormLabel(_AM_SF_ANSWERED_BY, sf_getLinkedUnameFromId($answerObj->uid(), $xoopsModuleConfig['userealname'])));
    // CATEGORY
    /*
     * Get information for pulldown menu using XoopsTree.
     * First var is the database table
     * Second var is the unique field ID for the categories
     * Last one is not set as we do not have sub menus in Smartfaq
     */
    $mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
    ob_start();
    $mytree->makeMySelBox("name", "weight", $categoryObj->categoryid());
    $sform->addElement(new XoopsFormLabel(_AM_SF_CATEGORY_FAQ, ob_get_contents()));
    ob_end_clean();
    // faq QUESTION
    $sform->addElement(new XoopsFormTextArea(_AM_SF_QUESTION, 'question', $faqObj->question(0, 'e'), 7, 60));
    // ANSWER
    if ($merge) {
        $theanswer = $originalAnswerObj->answer('e') . "\n\n" . sprintf(_AM_SF_NEW_CONTRIBUTION, sf_getLinkedUnameFromId($answerObj->uid(), $xoopsModuleConfig['userealname']), $answerObj->datesub(), $answerObj->answer('e'));
    } else {
        $theanswer = $answerObj->answer('e');
    }
    $sform->addElement(new XoopsFormDhtmlTextArea(_AM_SF_ANSWER_FAQ, 'answer', $theanswer, 15, 60), true);
    // HOW DO I
    $sform->addElement(new XoopsFormText(_AM_SF_HOWDOI_FAQ, 'howdoi', 50, 255, $faqObj->howdoi('e')), false);
    // DIDUNO
    $sform->addElement(new XoopsFormTextArea(_AM_SF_DIDUNO_FAQ, 'diduno', $faqObj->diduno('e'), 3, 60));
    // CONTEXT MODULE LINK
    // Retreive the list of module currently installed. The key value is the dirname
    $module_handler =& xoops_gethandler('module');
    $modules_array = $module_handler->getList(null, true);
    $modulelink_select_array = array("url" => _AM_SF_SPECIFIC_URL_SELECT);
    $modulelink_select_array = array_merge($modules_array, $modulelink_select_array);
    $modulelink_select_array = array_merge(array("None" => _AM_SF_NONE, "All" => _AM_SF_ALL), $modulelink_select_array);
    $modulelink_select = new XoopsFormSelect('', 'modulelink', $faqObj->modulelink());
    $modulelink_select->addOptionArray($modulelink_select_array);
    $modulelink_tray = new XoopsFormElementTray(_AM_SF_CONTEXTMODULELINK_FAQ, '&nbsp;');
    $modulelink_tray->addElement($modulelink_select);
    $sform->addElement($modulelink_tray);
    // SPECIFICURL
    $sform->addElement(new XoopsFormText(_AM_SF_SPECIFIC_URL, 'contextpage', 50, 60, $faqObj->contextpage()), false);
    // EXACT URL?
    $excaturl_radio = new XoopsFormRadioYN(_AM_SF_EXACTURL, 'exacturl', $faqObj->exacturl(), ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '');
    $sform->addElement($excaturl_radio);
    // WEIGHT
    $sform->addElement(new XoopsFormText(_AM_SF_WEIGHT, 'weight', 5, 5, $faqObj->weight()), true);
    // COMMENTS
    // Code to allow comments
    $addcomments_radio = new XoopsFormRadioYN(_AM_SF_ALLOWCOMMENTS, 'cancomment', $faqObj->cancomment(), ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '');
    $sform->addElement($addcomments_radio);
    // PER ITEM PERMISSIONS
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $groups_checkbox = new XoopsFormCheckBox(_AM_SF_PERMISSIONS_FAQ, 'groups[]', $faqObj->getGroups_read());
    foreach ($group_list as $group_id => $group_name) {
        if ($group_id != XOOPS_GROUP_ADMIN) {
            $groups_checkbox->addOption($group_id, $group_name);
        }
    }
    $sform->addElement($groups_checkbox);
    $partial_view = new XoopsFormRadioYN(_AM_SF_PARTIALVIEW, 'partialview', $faqObj->partialview(), ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '');
    $sform->addElement($partial_view);
    // VARIOUS OPTIONS
    $options_tray = new XoopsFormElementTray(_AM_SF_OPTIONS, '<br />');
    $html_checkbox = new XoopsFormCheckBox('', 'html', $faqObj->html());
    $html_checkbox->addOption(1, _AM_SF_DOHTML);
    $options_tray->addElement($html_checkbox);
    $smiley_checkbox = new XoopsFormCheckBox('', 'smiley', $faqObj->smiley());
    $smiley_checkbox->addOption(1, _AM_SF_DOSMILEY);
    $options_tray->addElement($smiley_checkbox);
    $xcodes_checkbox = new XoopsFormCheckBox('', 'xcodes', $faqObj->xcodes());
    $xcodes_checkbox->addOption(1, _AM_SF_DOXCODE);
    $options_tray->addElement($xcodes_checkbox);
    $sform->addElement($options_tray);
    // OFFLINE
    if ($faqObj->status() == _SF_STATUS_OFFLINE) {
        // Back OnLine
        $offline_radio = new XoopsFormRadioYN(_AM_SF_OFFLINE_FIELD, 'offline', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . '');
        $sform->addElement($offline_radio);
    }
    // faq ID
    $sform->addElement(new XoopsFormHidden('faqid', $faqObj->faqid()));
    // requester id
    $sform->addElement(new XoopsFormHidden('requester_uid', $faqObj->uid()));
    // answerer id
    $sform->addElement(new XoopsFormHidden('answerer_uid', $answerObj->uid()));
    // ANSWER ID
    $sform->addElement(new XoopsFormHidden('answerid', $answerObj->answerid()));
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'addfaq');
    $button_tray->addElement($hidden);
    $sform->addElement(new XoopsFormHidden('status', $faqObj->status()));
    // Setting the FAQ Status
    /*	$status_select = new XoopsFormSelect('', 'status', $status);
    	$status_select->addOptionArray(sf_getStatusArray());
    	$status_tray = new XoopsFormElementTray(_AM_SF_STATUS_EXP , '&nbsp;');
    	$status_tray->addElement($status_select);
    	$sform->addElement($status_tray);
    	*/
    if (!$faqid) {
        // there's no faqid? Then it's a new faq
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_CREATE, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', _AM_SF_CREATE, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
        $button_tray->addElement($butt_create);
        $butt_clear = new XoopsFormButton('', '', _AM_SF_CLEAR, 'reset');
        $button_tray->addElement($butt_clear);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    } else {
        // else, we're editing an existing faq
        // $button_tray -> addElement( new XoopsFormButton( '', 'mod', _AM_SF_MODIFY, 'submit' ) );
        $butt_create = new XoopsFormButton('', '', $button_caption, 'submit');
        $butt_create->setExtra('onclick="this.form.elements.op.value=\'addfaq\'"');
        $button_tray->addElement($butt_create);
        $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
    }
    $sform->addElement($button_tray);
    $sform->display();
    echo "</div>";
    unset($hidden);
}
예제 #15
0
/**
 * editForum()
 *
 * @param integer $catid
 * @return
 */
function editForum($ff, $parent_forum = 0)
{
    global $myts, $xoopsDB, $xoopsModule, $forum_handler;
    //$forum_handler = &xoops_getmodulehandler('forum', 'xforum');
    if (!is_object($ff)) {
        $ff =& $forum_handler->create();
        $new = true;
        $xforum = 0;
    } else {
        $xforum = $ff->getVar('forum_id');
        $new = false;
    }
    if ($parent_forum > 0) {
        $pf =& $forum_handler->get($parent_forum);
    }
    $mytree = new XoopsTree($xoopsDB->prefix("xf_categories"), "cat_id", "0");
    require_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php";
    if ($xforum) {
        $sform = new XoopsThemeForm(_AM_XFORUM_EDITTHISFORUM . " " . $ff->getVar('forum_name'), "op", xoops_getenv('PHP_SELF'));
    } else {
        $sform = new XoopsThemeForm(_AM_XFORUM_CREATENEWFORUM, "op", xoops_getenv('PHP_SELF'));
        $ff->setVar('parent_forum', $parent_forum);
        $ff->setVar('forum_order', 0);
        $ff->setVar('forum_name', '');
        $ff->setVar('forum_desc', '');
        $ff->setVar('forum_moderator', array(1));
        $ff->setVar('forum_type', 0);
        $ff->setVar('allow_html', 1);
        $ff->setVar('allow_sig', 1);
        $ff->setVar('allow_polls', 1);
        $ff->setVar('allow_subject_prefix', 1);
        $ff->setVar('hot_threshold', 10);
        //$ff->setVar('allow_attachments', 1);
        $ff->setVar('attach_maxkb', 1000);
        $ff->setVar('attach_ext', 'zip|gif|jpg');
    }
    $sform->addElement(new XoopsFormText(_AM_XFORUM_FORUMNAME, 'forum_name', 50, 80, $ff->getVar('forum_name', 'E')), true);
    $sform->addElement(new XoopsFormDhtmlTextArea(_AM_XFORUM_FORUMDESCRIPTION, 'forum_desc', $ff->getVar('forum_desc', 'E'), 10, 60), false);
    $sform->addElement(new XoopsFormHidden('parent_forum', $ff->getVar('parent_forum')));
    if ($parent_forum == 0) {
        ob_start();
        if ($new) {
            $mytree->makeMySelBox("cat_title", "cat_id", @$_GET['cat_id']);
        } else {
            $mytree->makeMySelBox("cat_title", "cat_id", $ff->getVar('cat_id'));
        }
        $sform->addElement(new XoopsFormLabel(_AM_XFORUM_CATEGORY, ob_get_contents()));
        ob_end_clean();
    } else {
        $sform->addElement(new XoopsFormHidden('cat_id', $pf->getVar('cat_id')));
    }
    $sform->addElement(new XoopsFormText(_AM_XFORUM_SET_FORUMORDER, 'forum_order', 5, 10, $ff->getVar('forum_order')), false);
    $status_select = new XoopsFormSelect(_AM_XFORUM_STATE, "forum_type", $ff->getVar('forum_type'));
    $status_select->addOptionArray(array('0' => _AM_XFORUM_ACTIVE, '1' => _AM_XFORUM_INACTIVE));
    $sform->addElement($status_select);
    $allowhtml_radio = new XoopsFormRadioYN(_AM_XFORUM_ALLOWHTML, 'allow_html', $ff->getVar('allow_html'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowhtml_radio);
    $allowsig_radio = new XoopsFormRadioYN(_AM_XFORUM_ALLOWSIGNATURES, 'allow_sig', $ff->getVar('allow_sig'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowsig_radio);
    $allowpolls_radio = new XoopsFormRadioYN(_AM_XFORUM_ALLOWPOLLS, 'allow_polls', $ff->getVar('allow_polls'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowpolls_radio);
    $allowprefix_radio = new XoopsFormRadioYN(_AM_XFORUM_ALLOW_SUBJECT_PREFIX, 'allow_subject_prefix', $ff->getVar('allow_subject_prefix'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowprefix_radio);
    $sform->addElement(new XoopsFormText(_AM_XFORUM_HOTTOPICTHRESHOLD, 'hot_threshold', 5, 10, $ff->getVar('hot_threshold')), true);
    /*
    $allowattach_radio = new XoopsFormRadioYN(_AM_XFORUM_ALLOW_ATTACHMENTS, 'allow_attachments', $ff->getVar('allow_attachments'), '' . _YES . '', ' ' . _NO . '');
    $sform->addElement($allowattach_radio);
    */
    $sform->addElement(new XoopsFormText(_AM_XFORUM_ATTACHMENT_SIZE, 'attach_maxkb', 5, 10, $ff->getVar('attach_maxkb')), true);
    //$sform->addElement(new XoopsFormText(_AM_XFORUM_ALLOWED_EXTENSIONS, 'attach_ext', 50, 255, $ff->getVar('attach_ext')), true);
    $ext = $ff->getVar('attach_ext');
    $sform->addElement(new XoopsFormText(_AM_XFORUM_ALLOWED_EXTENSIONS, 'attach_ext', 50, 255, $ext), true);
    $sform->addElement(new XoopsFormSelectUser(_AM_XFORUM_MODERATOR, 'forum_moderator', false, $ff->getVar("forum_moderator"), 5, true));
    $perm_tray = new XoopsFormElementTray(_AM_XFORUM_PERMISSIONS_TO_THIS_FORUM, '');
    $perm_checkbox = new XoopsFormCheckBox('', 'perm_template', $ff->isNew());
    $perm_checkbox->addOption(1, _AM_XFORUM_PERM_TEMPLATEAPP);
    $perm_tray->addElement($perm_checkbox);
    $perm_tray->addElement(new XoopsFormLabel('', '<a href="admin_permissions.php?action=template" target="_blank">' . _AM_XFORUM_PERM_TEMPLATE . '</a>'));
    $sform->addElement($perm_tray);
    $sform->addElement(new XoopsFormHidden('forum', $xforum));
    $sform->addElement(new XoopsFormHidden('op', "save"));
    $button_tray = new XoopsFormElementTray('', '');
    $button_tray->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
    $button_tray->addElement(new XoopsFormButton('', '', _AM_XFORUM_CLEAR, 'reset'));
    $butt_cancel = new XoopsFormButton('', '', _CANCEL, 'button');
    $butt_cancel->setExtra('onclick="history.go(-1)"');
    $button_tray->addElement($butt_cancel);
    $sform->addElement($button_tray);
    $sform->display();
}
예제 #16
0
 $display .= COM_startBlock("<b>" . _MD_UPLOADTITLE . "</b>");
 $display .= "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"8\" class=\"plugin\">" . LB;
 $display .= "<tr><td style=\"padding-top:10px;padding-left:50px;\">" . LB;
 $display .= "<ul><li>" . _MD_SUBMITONCE . "</li>" . LB;
 $display .= "<li>" . _MD_ALLPENDING . "</li>" . LB;
 $display .= "<li>" . _MD_DONTABUSE . "</li>" . LB;
 $display .= "<li>" . _MD_TAKEDAYS . "</li></ul>" . LB;
 $display .= '<form action="submit.php" method="post" enctype="multipart/form-data"><div>' . LB;
 $display .= "<table width=\"80%\"><tr>";
 $display .= "<td style=\"text-align:right; white-space:nowrap;\"><b>" . _MD_FILETITLE . "</b></td><td>";
 $display .= "<input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"" . XHTML . ">";
 $display .= "</td></tr><tr><td style=\"text-align:right; white-space:nowrap;\"><b>" . _MD_DLFILENAME . "</b></td><td>";
 $display .= "<input type=\"file\" name=\"newfile\" size=\"50\" maxlength=\"100\"" . XHTML . ">";
 $display .= "</td></tr>";
 $display .= "<tr><td style=\"text-align:right; white-space:nowrap;\"><b>" . _MD_CATEGORY . "</b></td><td>";
 $display .= $mytree->makeMySelBox('title', 'title');
 $display .= "</td></tr>" . LB;
 $display .= "<tr><td style=\"text-align:right; white-space:nowrap;\"><b>" . _MD_HOMEPAGEC . "</b></td><td>" . LB;
 $display .= "<input type=\"text\" name=\"homepage\" size=\"50\" maxlength=\"100\"" . XHTML . "></td></tr>" . LB;
 $display .= "<tr><td style=\"text-align:right; white-space:nowrap;\"><b>" . _MD_VERSIONC . "</b></td><td>" . LB;
 $display .= "<input type=\"text\" name=\"version\" size=\"10\" maxlength=\"10\"" . XHTML . "></td></tr>" . LB;
 $display .= "<tr><td style=\"text-align:right; vertical-align:top; white-space:nowrap;\"><b>" . _MD_DESCRIPTIONC . "</b></td><td>" . LB;
 $display .= '<textarea name="description" cols="50" rows="6"></textarea>' . LB;
 $display .= "</td></tr>" . LB;
 $display .= "<tr><td style=\"text-align:right; white-space:nowrap;\"><b>" . _MD_SHOTIMAGE . "</b></td><td>" . LB;
 $display .= "<input type=\"file\" name=\"newfileshot\" size=\"50\" maxlength=\"60\"" . XHTML . "></td></tr>" . LB;
 $display .= "<tr><td align=\"right\"></td><td>";
 $display .= "</td></tr><tr><td align=\"right\"><b>" . _MD_COMMENTOPTION . "</b></td><td>";
 $display .= "<input type=\"radio\" name=\"commentoption\" value=\"1\" checked=\"checked\"" . XHTML . ">&nbsp;" . _MD_YES . "&nbsp;";
 $display .= "<input type=\"radio\" name=\"commentoption\" value=\"0\"" . XHTML . ">&nbsp;" . _MD_NO . "&nbsp;";
 $display .= "</td></tr>" . LB;
예제 #17
0
* Module: SmartSection
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
global $_POST, $xoopsDB;
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once SMARTSECTION_ROOT_PATH . "include/functions.php";
$categoryid = isset($_GET['categoryid']) ? intval($_GET['categoryid']) : 0;
$mytree = new XoopsTree($xoopsDB->prefix("smartsection_categories"), "categoryid", "parentid");
$sform = new XoopsThemeForm(_MD_SS_SUB_SMNAME, "form", xoops_getenv('PHP_SELF'));
// Category
ob_start();
$sform->addElement(new XoopsFormHidden('categoryid', $newItemObj->categoryid()));
$mytree->makeMySelBox("name", "weight", $categoryid);
$category_label = new XoopsFormLabel(_MD_SS_CATEGORY, ob_get_contents());
$category_label->setDescription(_MD_SS_CATEGORY_DSC);
$sform->addElement($category_label);
ob_end_clean();
// ITEM TITLE
$sform->addElement(new XoopsFormText(_MD_SS_TITLE, 'title', 50, 255, $newItemObj->title('e')), true);
// SUMMARY
$summary_text = new XoopsFormTextArea(_MD_SS_SUMMARY, 'summary', $newItemObj->summary(0, 'e'), 7, 60);
$summary_text->setDescription(_MD_SS_SUMMARY_DSC);
$sform->addElement($summary_text, false);
// BODY
//$body_text = new XoopsFormDhtmlTextArea(_MD_SS_BODY, 'body', '', 15, 60);
$body_text = ss_getEditor(_MD_SS_BODY_REQ, 'body', $newItemObj->body(0, 'e'));
$body_text->setDescription(_MD_SS_BODY_DSC);
$sform->addElement($body_text, true);
예제 #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
 /**
  * created elements
  * @license   http://www.blags.org/
  * @created   :2010年05月21日 20时40分
  * @copyright 1997-2010 The Martin Group
  * @author    Martin <*****@*****.**>
  * */
 public function createElements()
 {
     global $hotel_handler, $xoopsDB, $xoopsModuleConfig;
     //编辑器
     include_once XOOPS_ROOT_PATH . "/modules/martin/class/xoopsformloader.php";
     include_once MARTIN_ROOT_PATH . '/include/formdatetime.php';
     $this->google_api = $xoopsModuleConfig['google_api'];
     /*$this->City = $hotel_handler->GetCityList('WHERE city_parentid = 0');
       $CityElement = new XoopsFormSelect(_AM_MARTIN_HOTEL_CITY, 'hotel_city', $this->Obj->hotel_city() , 1 );
       $CityElement->addOptionArray($this->City);
       $this->addElement($CityElement , true);*/
     $mytree = new XoopsTree($xoopsDB->prefix("martin_hotel_city"), "city_id", "city_parentid");
     // Parent Category
     //multiple
     $js = '<script type="text/javascript">
         jQuery(document).ready(function(){
             jQuery("#hotel_city").find("option").each(function(i){
                 var v = jQuery(this).text();
                 if(v.indexOf("----") != -1) jQuery(this).remove();
             });
         });
         </script>';
     ob_start();
     $mytree->makeMySelBox("city_name", "", $this->Obj->hotel_city(), 1, 'hotel_city');
     //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
     $this->addElement(new XoopsFormLabel($js . _AM_MARTIN_ADMIN_AREA . "<br>" . _AM_MARTIN_SELECT_2ND_LEVEL, ob_get_contents()));
     ob_end_clean();
     // Parent Category
     //multiple
     $mytree->_SetMultiple(true);
     $hotel_city_id = explode(',', $this->Obj->hotel_city_id());
     ob_start();
     $mytree->makeMySelBox("city_name", '', $hotel_city_id, 1, 'hotel_city_id[]');
     //makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="");
     $this->addElement(new XoopsFormLabel(_AM_MARTIN_CIRCLE . "<br>" . _AM_MARTIN_SELECT_3RD_LEVEL, ob_get_contents()));
     ob_end_clean();
     // City Name
     //$this->addElement( new XoopsFormText(_AM_MARTIN_ADMIN_CITY_AREA, 'hotel_environment', 50, 255, $this->Obj->hotel_environment()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_RANK, 'hotel_rank', 11, 11, $this->Obj->hotel_rank()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_NAME, 'hotel_name', 50, 255, $this->Obj->hotel_name()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_NAME_ENGLISH, 'hotel_enname', 50, 255, $this->Obj->hotel_enname()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_WEBSITE . "<br>" . _AM_MARTIN_NO_HTML, 'hotel_alias', 50, 255, $this->Obj->hotel_alias()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_KEYWORDS_SEO, 'hotel_keywords', 50, 255, $this->Obj->hotel_keywords()), true);
     $this->addElement(new XoopsFormTextArea(_AM_MARTIN_HOTEL_DESC_SEO, 'hotel_description', $this->Obj->hotel_description()), true);
     //hotel tags
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTELS_TAGS . "<br>" . _AM_MARTIN_USE_SPACE_AS_SEPARATOR, 'hotel_tags', 50, 255, $this->Obj->hotel_tags()), true);
     //hotel star
     $rankElement = new XoopsFormSelect(_AM_MARTIN_RANK, 'hotel_star', $this->Obj->hotel_star(), 1);
     $rankElement->addOptionArray($this->Ranks);
     $this->addElement($rankElement, true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_ADDRESS, 'hotel_address', 50, 255, $this->Obj->hotel_address()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_PHONE, 'hotel_telephone', 50, 255, $this->Obj->hotel_telephone()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_FAX, 'hotel_fax', 50, 255, $this->Obj->hotel_fax()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_FEATURES, 'hotel_characteristic', 50, 255, $this->Obj->hotel_characteristic()), true);
     $this->addElement(new XoopsFormText(_AM_MARTIN_THE_NUMBER_OF_ROOMS, 'hotel_room_count', 11, 11, $this->Obj->hotel_room_count()), true);
     $open_time = $this->Obj->hotel_open_time();
     $this->addElement(new XoopsFormText(_AM_MARTIN_HOTEL_OPENED, 'hotel_open_time', 50, 255, date('Y', $open_time > 0 ? $open_time : time())), true);
     //        $this->addElement( new XoopsFormText(_AM_MARTIN_HOTEL_ROOM_PHOTOS, 'hotel_image', 50, 255, $this->Obj->hotel_image()), true);
     list($width, $height) = getimagesize('../images/hotelicon/' . $this->Obj->hotel_icon());
     $hotel_icon = '<script type="text/javascript">
                     function showbox(src)
                     {
                         window.open(src , "_blank" , "width = \' . $width . \',height = \' . $height . \'");
                     }
                     </script>';
     //Hotel Logo
     $hotel_icon .= '<a href = "javascript:void(0);" onclick = "showbox(\'../images/hotelicon/' . $this->Obj->hotel_icon() . '\')"><img src = "../images/hotelicon/' . $this->Obj->hotel_icon() . '" width = 100 height = 100 class="showicon" ></a><br > ';
     $hotelIcon = new XoopsFormElementTray(_AM_MARTIN_HOTEL_LOGO_IMAGE);
     $hotelIcon->addElement(new XoopsFormFile("" . $hotel_icon, "hotel_icon", ""), false);
     $this->addElement($hotelIcon, false);
     //特殊处理
     //酒店地图
     $Coordinate = $this->Obj->hotel_google();
     $google = new XoopsFormElementTray(_AM_MARTIN_GOOGLE_MAP);
     $google->addElement(new XoopsFormText(_AM_MARTIN_LATITTUDE, 'GmapLatitude', 25, 25, $Coordinate[0]), true);
     $google->addElement(new XoopsFormText(_AM_MARTIN_LONGITUDE, 'GmapLongitude', 25, 25, $Coordinate[1]), true);
     $google->addElement(new XoopsFormLabel("<br><br><font style='background - color:#2F5376;color:#FFFFFF;padding:2px;vertical-align:middle;'>google map:</font><br>", $this->googleMap($Coordinate)));
     //酒店图片
     $Img = new XoopsFormElementTray(_AM_MARTIN_HOTEL_PHOTOS);
     $Img->addElement(new XoopsFormLabel("", $this->Swfupload()));
     $this->addElement($Img);
     $this->addElement($google, true);
     //特殊处理
     //编辑器 酒店详细信息
     $this->addElement(new XoopsFormTextArea(_AM_MARTIN_HOTELS_NOTES, 'hotel_reminded', $this->Obj->hotel_reminded()), true);
     //hotel Facility
     $this->addElement(new XoopsFormTextArea(_AM_MARTIN_FACILITIES_SERVICES, 'hotel_facility', $this->Obj->hotel_facility()), true);
     $editor = 'tinymce';
     $hotel_info = $this->Obj->hotel_info();
     $editor_configs = array();
     $editor_configs["name"] = "hotel_info";
     $editor_configs["value"] = $hotel_info;
     $editor_configs["rows"] = empty($xoopsModuleConfig["editor_rows"]) ? 35 : $xoopsModuleConfig["editor_rows"];
     $editor_configs["cols"] = empty($xoopsModuleConfig["editor_cols"]) ? 60 : $xoopsModuleConfig["editor_cols"];
     $editor_configs["width"] = empty($xoopsModuleConfig["editor_width"]) ? "100%" : $xoopsModuleConfig["editor_width"];
     $editor_configs["height"] = empty($xoopsModuleConfig["editor_height"]) ? "400px" : $xoopsModuleConfig["editor_height"];
     $this->addElement(new XoopsFormEditor(_AM_MARTIN_HOTEL_DETALS, $editor, $editor_configs, false, $onfailure = null), false);
     //$this->addElement(new XoopsFormHidden("hotel_info", $hotel_info) , true );
     $this->addElement(new XoopsFormRadioYN(_AM_MARTIN_HOTEL_EDIT_STATUS, 'hotel_status', $this->Obj->hotel_status(), _AM_MARTIN_PUBLISHED, _AM_MARTIN_DRAFT), true);
     //$this->addElement( new MartinFormDateTime("酒店发布时间", 'hotel_open_time', $size = 15, $this->Obj->hotel_open_time() ) ,true);
     $this->addElement(new XoopsFormHidden('hotel_icon_old', $this->Obj->hotel_icon()));
     $this->addElement(new XoopsFormHidden('id', $this->Obj->hotel_id()));
 }
예제 #20
0
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
if (!defined("XOOPS_ROOT_PATH")) {
    die("XOOPS root path not defined");
}
global $_POST;
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
$form = new XoopsThemeForm(_MD_SF_REQUEST, "form", xoops_getenv('PHP_SELF'));
// CATEGORY
$mytree = new XoopsTree($xoopsDB->prefix("smartfaq_categories"), "categoryid", "parentid");
ob_start();
$form->addElement(new XoopsFormHidden('categoryid', ''));
$mytree->makeMySelBox("name", "weight", '');
$category_label = new XoopsFormLabel(_MD_SF_CATEGORY_QUESTION, ob_get_contents());
$category_label->setDescription(_MD_SF_CATEGORY_QUESTION_DSC);
$form->addElement($category_label);
ob_end_clean();
// QUESTION
$form->addElement(new XoopsFormTextArea(_MD_SF_QUESTION, 'question', '', 10, 38), true);
$button_tray = new XoopsFormElementTray('', '');
$hidden = new XoopsFormHidden('op', 'post');
$button_tray->addElement($hidden);
$button_tray->addElement(new XoopsFormButton('', 'post', _SUBMIT, 'submit'));
$form->addElement($button_tray);
// NOTIFY ON PUBLISH
if (is_object($xoopsUser)) {
    $notify_checkbox = new XoopsFormCheckBox('', 'notifypub', 1);
    $notify_checkbox->addOption(1, _MD_SF_NOTIFY);
 function b_myalbum_rphoto_edit($options)
 {
     global $xoopsDB;
     $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
     $box_size = empty($options[1]) ? 140 : intval($options[1]);
     $photos_num = empty($options[2]) ? 1 : intval($options[2]);
     $cat_limitation = empty($options[3]) ? 0 : intval($options[3]);
     $cat_limit_recursive = empty($options[4]) ? 0 : 1;
     $cycle = empty($options[5]) ? 60 : intval($options[5]);
     $cols = empty($options[6]) ? 1 : intval($options[6]);
     include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
     if (!preg_match('/^(\\D+)(\\d*)$/', $mydirname, $regs)) {
         echo "invalid dirname: " . htmlspecialchars($mydirname);
     }
     $mydirnumber = $regs[2] === '' ? '' : intval($regs[2]);
     $cattree = new XoopsTree($xoopsDB->prefix("myalbum{$mydirnumber}_cat"), "cid", "pid");
     ob_start();
     $cattree->makeMySelBox("title", "title", $cat_limitation, 1, 'options[3]');
     $catselbox = ob_get_contents();
     ob_end_clean();
     $form = "\n\t\t" . _ALBM_TEXT_BLOCK_WIDTH . "&nbsp;\n\t\t<input type='hidden' name='options[0]' value='{$mydirname}' />\n\t\t<input type='text' size='6' name='options[1]' value='{$box_size}' style='text-align:right;' />&nbsp;pixel " . _ALBM_TEXT_BLOCK_WIDTH_NOTES . "\n\t\t<br />\n\t\t" . _ALBM_TEXT_DISP . "&nbsp;\n\t\t<input type='text' size='3' name='options[2]' value='{$photos_num}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _ALBM_TEXT_CATLIMITATION . " &nbsp; {$catselbox}\n\t\t" . _ALBM_TEXT_CATLIMITRECURSIVE . "\n\t\t<input type='radio' name='options[4]' value='1' " . ($cat_limit_recursive ? "checked='checked'" : "") . "/>" . _YES . "\n\t\t<input type='radio' name='options[4]' value='0' " . ($cat_limit_recursive ? "" : "checked='checked'") . "/>" . _NO . "\n\t\t<br />\n\t\t" . _ALBM_TEXT_RANDOMCYCLE . "&nbsp;\n\t\t<input type='text' size='6' name='options[5]' value='{$cycle}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _ALBM_TEXT_COLS . "&nbsp;\n\t\t<input type='text' size='2' name='options[6]' value='{$cols}' style='text-align:right;' />\n\t\t<br />\n\t\t\n";
     return $form;
 }
예제 #22
0
    return;
}
require_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
// The forum instanciation
$form_forum = new XoopsThemeForm(_AM_NEWBB_EDITTHISFORUM . " " . $forum_obj->getVar('forum_name'), "form_forum", xoops_getenv('PHP_SELF'));
// Forum name
$form_forum->addElement(new XoopsFormText(_AM_NEWBB_FORUMNAME, 'forum_name', 50, 80, $forum_obj->getVar('forum_name', 'E')), true);
// Forum description
$form_forum->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_FORUMDESCRIPTION, 'forum_desc', $forum_obj->getVar('forum_desc', 'E'), 10, 60));
// Category
$form_forum->addElement(new XoopsFormHidden('cat_id', $forum_obj->getVar('cat_id')), true);
// Parent forums
ob_start();
$mytree = new XoopsTree($xoopsDB->prefix("bb_forums"), "forum_id", "parent_forum");
$mytree->makeMySelBox("forum_name", "parent_forum", $forum_obj->getVar("parent_forum"), 1, "parent_forum");
$form_forum->addElement(new XoopsFormLabel(_AM_NEWBB_MAKE_SUBFORUM_OF, ob_get_contents()));
ob_end_clean();
// Forum order
$form_forum->addElement(new XoopsFormText(_AM_NEWBB_SET_FORUMORDER, 'forum_order', 5, 10, $forum_obj->getVar('forum_order')));
// Threshold for "Hot Topic"
$form_forum->addElement(new XoopsFormText(_AM_NEWBB_HOTTOPICTHRESHOLD, 'hot_threshold', 5, 10, $forum_obj->getVar('hot_threshold')));
// Maximum attachment file size
$form_forum->addElement(new XoopsFormText(_AM_NEWBB_ATTACHMENT_SIZE, 'attach_maxkb', 5, 10, $forum_obj->getVar('attach_maxkb')));
// Allowed extensions for attachments
$form_forum->addElement(new XoopsFormText(_AM_NEWBB_ALLOWED_EXTENSIONS, 'attach_ext', 50, 512, $forum_obj->getVar('attach_ext')));
// Forum moderators
$form_forum->addElement(new XoopsFormSelectUser(_AM_NEWBB_MODERATOR, 'forum_moderator', false, $forum_obj->getVar("forum_moderator"), 5, true));
// Permission tray
$perm_tray = new XoopsFormElementTray(_AM_NEWBB_PERMISSIONS_TO_THIS_FORUM, '');
$perm_checkbox = new XoopsFormCheckBox('', 'perm_template', $forum_obj->isNew());
예제 #23
0
            $mytree->makeMySelBox("name", "catid");
            $sform->addElement(new XoopsFormLabel(_AM_MODIFYTHISCAT, ob_get_contents()));
            ob_end_clean();
            $button_tray = new XoopsFormElementTray('', '');
            $hidden = new XoopsFormHidden('modify', 1);
            $hidden = new XoopsFormHidden('op', 'mod');
            $button_tray->addElement($hidden);
            $button_tray->addElement(new XoopsFormButton('', 'mod', _AM_MODIFY, 'submit'));
            $sform->addElement($button_tray);
            $sform->display();
            //Delete Category
            $mytree2 = new XoopsTree($xoopsDB->prefix("faqcategories"), "catid", "0");
            $dform = new XoopsThemeForm(_AM_DELCAT, "storyform", xoops_getenv('PHP_SELF'));
            ob_start();
            $dform->addElement(new XoopsFormHidden('catid', ''));
            $mytree2->makeMySelBox("name", "catid");
            $dform->addElement(new XoopsFormLabel(_AM_DELETETHISCAT, ob_get_contents()));
            ob_end_clean();
            $button_tray = new XoopsFormElementTray('', '');
            $hidden = new XoopsFormHidden('modify', 1);
            $hidden = new XoopsFormHidden('op', 'del');
            $button_tray->addElement($hidden);
            $button_tray->addElement(new XoopsFormButton('', 'mod', _AM_DELETE, 'submit'));
            $dform->addElement($button_tray);
            $dform->display();
        }
        editcat();
        break;
}
wffaqfooter();
xoops_cp_footer();
예제 #24
0
 function b_myalbum_tophits_edit($options)
 {
     global $xoopsDB;
     // For myAlbum-P < 2.70
     if (strncmp($options[0], 'myalbum', 7) != 0) {
         $title_max_length = intval($options[1]);
         $photos_num = intval($options[0]);
         $mydirname = 'myalbum';
     } else {
         $title_max_length = intval($options[2]);
         $photos_num = intval($options[1]);
         $mydirname = $options[0];
     }
     $cat_limitation = empty($options[3]) ? 0 : intval($options[3]);
     $cat_limit_recursive = empty($options[4]) ? 0 : 1;
     $cols = empty($options[6]) ? 1 : intval($options[6]);
     include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
     $cattree = new XoopsTree($xoopsDB->prefix("{$mydirname}_cat"), "cid", "pid");
     ob_start();
     $cattree->makeMySelBox("title", "title", $cat_limitation, 1, 'options[3]');
     $catselbox = ob_get_contents();
     ob_end_clean();
     return "\n\t\t" . _ALBM_TEXT_DISP . " &nbsp;\n\t\t<input type='hidden' name='options[0]' value='{$mydirname}' />\n\t\t<input type='text' size='4' name='options[1]' value='{$photos_num}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _ALBM_TEXT_STRLENGTH . " &nbsp;\n\t\t<input type='text' size='6' name='options[2]' value='{$title_max_length}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _ALBM_TEXT_CATLIMITATION . " &nbsp; {$catselbox}\n\t\t" . _ALBM_TEXT_CATLIMITRECURSIVE . "\n\t\t<input type='radio' name='options[4]' value='1' " . ($cat_limit_recursive ? "checked='checked'" : "") . "/>" . _YES . "\n\t\t<input type='radio' name='options[4]' value='0' " . ($cat_limit_recursive ? "" : "checked='checked'") . "/>" . _NO . "\n\t\t<br />\n\t\t<input type='hidden' name='options[5]' value='' />\n\t\t" . _ALBM_TEXT_COLS . "&nbsp;\n\t\t<input type='text' size='2' name='options[6]' value='{$cols}' style='text-align:right;' />\n\t\t<br />\n\t\t\n";
 }
예제 #25
0
            $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}");
            // Categories to be imported
            $sql = 'SELECT cat.categoryid, cat.parentid, cat.name, COUNT(art.itemid) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories') . ' AS cat INNER JOIN ' . $GLOBALS['xoopsDB']->prefix('smartsection_items') . ' AS art ON cat.categoryid=art.categoryid GROUP BY art.categoryid';
            $result = $GLOBALS['xoopsDB']->query($sql);
            $cat_cbox_options = array();
            while ((list($cid, $pid, $cat_title, $art_count) = $GLOBALS['xoopsDB']->fetchRow($result)) !== false) {
                $cat_title = $myts->displayTarea($cat_title);
                $cat_cbox_options[$cid] = "{$cat_title} ({$art_count})";
            }
            $cat_label = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_CATEGORIES, implode('<br />', $cat_cbox_options));
            $cat_label->setDescription(_AM_PUBLISHER_IMPORT_CATEGORIES_DSC);
            $form->addElement($cat_label);
            // Publisher parent category
            $mytree = new XoopsTree($GLOBALS['xoopsDB']->prefix('publisher_categories'), 'categoryid', 'parentid');
            ob_start();
            $mytree->makeMySelBox('name', 'weight', $preset_id = 0, $none = 1, $sel_name = 'parent_category');
            $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, ob_get_contents());
            $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC);
            $form->addElement($parent_cat_sel);
            ob_end_clean();
            $form->addElement(new XoopsFormHidden('op', 'go'));
            $form->addElement(new XoopsFormButton('', 'import', _AM_PUBLISHER_IMPORT, 'submit'));
            $form->addElement(new XoopsFormHidden('from_module_version', XoopsRequest::getString('news_version', '', 'POST')));
            $form->display();
        }
    }
    publisherCloseCollapsableBar('newsimport', 'newsimporticon');
    xoops_cp_footer();
}
if ($op === 'go') {
    publisherCpHeader();
예제 #26
0
function edittopic($topicID = '')
{
    /*
     * Clear all variable before we start
     */
    $question = '';
    $answer = '';
    $summary = '';
    $catid = 0;
    $oldid = 0;
    global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify;
    include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
    /* 
     * checks to see if we are modifying a FAQ
     */
    if ($modify) {
        /*
         * Get FAQ info from database
         */
        $result = $xoopsDB->query("SELECT topicID, catID, question, answer, summary FROM " . $xoopsDB->prefix("faqtopics") . " WHERE topicID = '{$topicID}'");
        list($topicID, $catID, $question, $answer, $summary) = $xoopsDB->fetchrow($result);
        $oldid = $catID;
        /* 
         * If no FAQ are found, tell user and exit
         */
        if ($xoopsDB->getRowsNum($result) == 0) {
            redirect_header("index.php", 1, _AM_NOTOPICTOEDIT);
            exit;
        }
        $sform = new XoopsThemeForm(_AM_MODIFYEXSITFAQ, "op", xoops_getenv('PHP_SELF'));
    } else {
        $sform = new XoopsThemeForm(_AM_ADDFAQ, "op", xoops_getenv('PHP_SELF'));
    }
    /*
     * Get information for pulldown menu using XoopsTree.
     * First var is the database table
     * Second var is the unique field ID for the categories
     * Last one is not set as we do not have sub menus in WF-FAQ
     */
    $mytree = new XoopsTree($xoopsDB->prefix("faqcategories"), "catid", "0");
    /*
     * Get the mytree pulldown object for use with XoopsForm class 
     */
    ob_start();
    $sform->addElement(new XoopsFormHidden('catid', $catid));
    $mytree->makeMySelBox("name", $catid);
    $sform->addElement(new XoopsFormLabel(_AM_CREATEIN, ob_get_contents()));
    ob_end_clean();
    /*
     * Set the user textboxs using XoopsForm Class for user input
     */
    $sform->addElement(new XoopsFormText(_AM_TOPICQ, 'question', 50, 80, $question), true);
    $sform->addElement(new XoopsFormDhtmlTextArea(_AM_TOPICA, 'answer', $answer, 15, 60), true);
    $sform->addElement(new XoopsFormTextArea(_AM_SUMMARY, 'summary', $summary, 7, 60));
    /*
     * XoopsFormHidden, pass on 'unseen' var's' 
     */
    $sform->addElement(new XoopsFormHidden('topicID', $topicID));
    $sform->addElement(new XoopsFormHidden('modify', $modify));
    $sform->addElement(new XoopsFormHidden('oldid', $oldid));
    /*
     * XoopsForm Class Buttons
     */
    $button_tray = new XoopsFormElementTray('', '');
    $hidden = new XoopsFormHidden('op', 'save');
    $button_tray->addElement($hidden);
    /*
     * Switch to show different buttons for either when creating or modifying a FAQ.
     */
    if (!$modify) {
        $button_tray->addElement(new XoopsFormButton('', 'create', _AM_CREATE, 'submit'));
    } else {
        $button_tray->addElement(new XoopsFormButton('', 'update', _AM_MODIFY, 'submit'));
    }
    $sform->addElement($button_tray);
    $sform->display();
    unset($hidden);
    /*
     *End of XoopsForm 
     */
}
예제 #27
0
 function makeTopicSelBox($none = 0, $seltopic = -1, $selname = "", $onchange = "")
 {
     $xt = new XoopsTree($this->table, "topic_id", "topic_pid");
     if ($seltopic != -1) {
         $xt->makeMySelBox("topic_title", "topic_title", $seltopic, $none, $selname, $onchange);
     } elseif (!empty($this->topic_id)) {
         $xt->makeMySelBox("topic_title", "topic_title", $this->topic_id, $none, $selname, $onchange);
     } else {
         $xt->makeMySelBox("topic_title", "topic_title", 0, $none, $selname, $onchange);
     }
 }
예제 #28
0
 /**
  * @param int    $none
  * @param        $seltopic
  * @param string $selname
  * @param string $onchange
  */
 public function makeTopicSelBox($none = 0, $seltopic = -1, $selname = '', $onchange = '')
 {
     $xt = new XoopsTree($this->table, 'topic_id', 'topic_pid');
     if ($seltopic != -1) {
         $xt->makeMySelBox('topic_title', 'topic_title', $seltopic, $none, $selname, $onchange);
     } elseif (!empty($this->topic_id)) {
         $xt->makeMySelBox('topic_title', 'topic_title', $this->topic_id, $none, $selname, $onchange);
     } else {
         $xt->makeMySelBox('topic_title', 'topic_title', 0, $none, $selname, $onchange);
     }
 }
예제 #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
function b_gnavi_itemblock_edit($options)
{
    global $xoopsDB;
    $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
    $photos_num = empty($options[1]) ? 5 : intval($options[1]);
    $title_max_length = empty($options[2]) ? 20 : intval($options[2]);
    $cat_limitation = empty($options[3]) ? 0 : intval($options[3]);
    $cat_limit_recursive = empty($options[4]) ? 0 : 1;
    $cols = empty($options[6]) ? 1 : intval($options[6]);
    $show_image = empty($options[7]) ? 0 : 1;
    $show_noimage = empty($options[8]) ? 0 : 1;
    $box_size = empty($options[9]) ? 0 : intval($options[9]);
    include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
    $cattree = new XoopsTree($xoopsDB->prefix("{$mydirname}_cat"), "cid", "pid");
    ob_start();
    $cattree->makeMySelBox("title", "weight", $cat_limitation, 1, 'options[3]');
    $catselbox = ob_get_contents();
    ob_end_clean();
    return "\n\t\t" . _GNAV_TEXT_DISP . " &nbsp;\n\t\t<input type='hidden' name='options[0]' value='{$mydirname}' />\n\t\t<input type='text' size='4' name='options[1]' value='{$photos_num}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _GNAV_TEXT_STRLENGTH . " &nbsp;\n\t\t<input type='text' size='6' name='options[2]' value='{$title_max_length}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _GNAV_TEXT_CATLIMITATION . " &nbsp; {$catselbox}\n\t\t" . _GNAV_TEXT_CATLIMITRECURSIVE . "\n\t\t<input type='radio' name='options[4]' value='1' " . ($cat_limit_recursive ? "checked='checked'" : "") . "/>" . _YES . "\n\t\t<input type='radio' name='options[4]' value='0' " . ($cat_limit_recursive ? "" : "checked='checked'") . "/>" . _NO . "\n\t\t<br />\n\t\t<input type='hidden' name='options[5]' value='' />\n\t\t" . _GNAV_TEXT_COLS . "&nbsp;\n\t\t<input type='text' size='2' name='options[6]' value='{$cols}' style='text-align:right;' />\n\t\t<br />\n\t\t" . _GNAV_TEXT_SHOWIMAGE . "\n\t\t<input type='radio' name='options[7]' value='1' " . ($show_image ? "checked='checked'" : "") . "/>" . _YES . "\n\t\t<input type='radio' name='options[7]' value='0' " . ($show_image ? "" : "checked='checked'") . "/>" . _NO . "\n\t\t<br />\n\t\t" . _GNAV_TEXT_SHOWNOIMAGE . "\n\t\t<input type='radio' name='options[8]' value='1' " . ($show_noimage ? "checked='checked'" : "") . "/>" . _YES . "\n\t\t<input type='radio' name='options[8]' value='0' " . ($show_noimage ? "" : "checked='checked'") . "/>" . _NO . "\n\t\t<br />\n\t\t<input type='text' size='6' name='options[9]' value='{$box_size}' style='text-align:right;' />&nbsp;pixel " . _GNAV_TEXT_BLOCK_WIDTH_NOTES . "\n\t\t\n";
}