Example #1
0
 /**
  * Get a {@link XoopsForm} object for creating/editing Spotlight articles
  *
  * @return object
  */
 function getForm($action = false)
 {
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = _AMS_AM_SPOTLIGHT;
     include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/formimageselect.php";
     $form = new XoopsThemeForm($title, 'spotlightform', $action);
     if (!$this->isNew()) {
         $form->addElement(new XoopsFormHidden('id', $this->getVar('spotlightid')));
     }
     $mode_select = new XoopsFormRadio('', 'mode', $this->getVar('mode'));
     $mode_select->addOption(1, _AMS_AM_SPOT_LATESTARTICLE);
     $mode_select->addOption(2, _AMS_AM_SPOT_LATESTINTOPIC);
     $mode_select->addOption(3, _AMS_AM_SPOT_SPECIFICARTICLE);
     $mode_select->addOption(4, _AMS_AM_SPOT_CUSTOM);
     include_once XOOPS_ROOT_PATH . "/class/tree.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newstopic.php";
     include_once XOOPS_ROOT_PATH . "/modules/AMS/class/class.newsstory.php";
     $xt = new AmsTopic($GLOBALS['xoopsDB']->prefix("ams_topics"));
     $allTopics = $xt->getAllTopics();
     $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
     $topic_select = new XoopsFormLabel(_AMS_AM_TOPIC, $topic_obj_tree->makeSelBox('topicid', 'topic_title', '--', $this->getVar('topicid'), false));
     $topic_select->setDescription(_AMS_AM_SPOT_TOPIC_DESC);
     $article_select = new XoopsFormSelect(_AMS_AM_ARTICLE, 'storyid', $this->getVar('storyid'));
     $article_select->addOptionArray(AmsStory::getAllPublished($GLOBALS['xoopsModuleConfig']['spotlight_art_num'], 0, false, 0, 1, false));
     $article_select->setDescription(_AMS_AM_SPOT_ARTICLE_DESC);
     $mode_tray = new XoopsFormElementTray(_AMS_AM_SPOT_MODE_SELECT);
     $mode_tray->addElement($mode_select);
     $showimage_select = new XoopsFormRadio(_AMS_AM_SPOT_SHOWIMAGE, 'showimage', $this->getVar('showimage'));
     $showimage_select->addOption(0, _AMS_AM_SPOT_SPECIFYIMAGE);
     $showimage_select->addOption(1, _AMS_AM_SPOT_TOPICIMAGE);
     $showimage_select->addOption(2, _AMS_AM_SPOT_AUTHORIMAGE);
     $showimage_select->addOption(3, _AMS_AM_SPOT_NOIMAGE);
     $showimage_select->setDescription(_AMS_AM_SPOT_SHOWIMAGE_DESC);
     $image_select = new XoopsFormImageSelect(_AMS_AM_SPOT_IMAGE, 'image', $this->getVar('image', 'e'), 70, 255);
     $autoteaser_select = new XoopsFormRadioYN(_AMS_AM_SPOT_AUTOTEASER, 'autoteaser', $this->getVar('autoteaser'));
     $teaser_text = new XoopsFormDhtmlTextArea(_AMS_AM_SPOT_TEASER, 'teaser', $this->getVar('teaser', 'e'));
     $maxlength_text = new XoopsFormText(_AMS_AM_SPOT_MAXLENGTH, 'maxlength', 10, 10, $this->getVar('maxlength'));
     $display_select = new XoopsFormRadioYN(_AMS_AM_SPOT_DISPLAY, 'display', $this->getVar('display'));
     $weight_text = new XoopsFormText(_AMS_AM_SPOT_WEIGHT, 'weight', 10, 10, $this->getVar('weight'));
     $form->addElement($mode_tray);
     $form->addElement($topic_select);
     $form->addElement($article_select);
     $form->addElement($showimage_select);
     $form->addElement($image_select);
     $form->addElement($autoteaser_select);
     $form->addElement($maxlength_text);
     $form->addElement($teaser_text);
     $form->addElement($display_select);
     $form->addElement($weight_text);
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'spotlightsubmit', _AMS_AM_SUBMIT, 'submit'));
     return $form;
 }
Example #2
0
 /**
  * @param MenusMenu $obj
  */
 public function __construct(MenusMenu $obj)
 {
     global $menu_id;
     $xoops = Xoops::getInstance();
     $helper = Menus::getInstance();
     $this_handler = $helper->getHandlerMenu();
     $decorators = MenusDecorator::getAvailableDecorators();
     $title = $obj->isNew() ? sprintf(_AM_MENUS_ADD_MENUS) : sprintf(_AM_MENUS_EDIT_MENUS);
     parent::__construct($title, 'form', 'admin_menu.php', 'post', true);
     $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_TITLE, 'title', 50, 255, $obj->getVar('title'), ''), true);
     $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_ALTTITLE, 'alt_title', 50, 255, $obj->getVar('alt_title'), ''));
     $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_LINK, 'link', 50, 255, $obj->getVar('link'), ''));
     $this->addElement(new Xoops\Form\Text(_AM_MENUS_MENU_IMAGE, 'image', 50, 255, $obj->getVar('image'), ''));
     $criteria = new CriteriaCompo(new Criteria('mid', $menu_id));
     $criteria->add(new Criteria('id', $obj->getVar('id'), '<>'));
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $results = $this_handler->getAll($criteria, array('title', 'id', 'pid'));
     $parent_tree = new XoopsObjectTree($results, 'id', 'pid');
     $parent_select = $parent_tree->makeSelBox('pid', 'title', '-- ', $obj->getVar('pid'), true);
     $this->addElement(new Xoops\Form\Label(_AM_MENUS_MENU_PARENT, $parent_select));
     $formvis = new Xoops\Form\Select(_AM_MENUS_MENU_VISIBLE, "visible", $obj->getVar('visible'));
     $formvis->addOption("0", XoopsLocale::NO);
     $formvis->addOption("1", XoopsLocale::YES);
     $this->addElement($formvis);
     $formtarget = new Xoops\Form\Select(_AM_MENUS_MENU_TARGET, "target", $obj->getVar('target'));
     $formtarget->addOption("_self", _AM_MENUS_MENU_TARG_SELF);
     $formtarget->addOption("_blank", _AM_MENUS_MENU_TARG_BLANK);
     $formtarget->addOption("_parent", _AM_MENUS_MENU_TARG_PARENT);
     $formtarget->addOption("_top", _AM_MENUS_MENU_TARG_TOP);
     $this->addElement($formtarget);
     $formgroups = new Xoops\Form\SelectGroup(_AM_MENUS_MENU_GROUPS, "groups", true, $obj->getVar('groups'), 5, true);
     $formgroups->setDescription(_AM_MENUS_MENU_GROUPS_HELP);
     $this->addElement($formgroups);
     $formhooks = new Xoops\Form\Select(_AM_MENUS_MENU_ACCESS_FILTER, "hooks", $obj->getVar('hooks'), 5, true);
     $accessFilter = array();
     foreach ($decorators as $decorator) {
         $decorator->accessFilter($accessFilter);
     }
     foreach ($accessFilter as $result) {
         $formhooks->addOption($result['method'], $result['name']);
     }
     $this->addElement($formhooks);
     $formcss = new Xoops\Form\Text(_AM_MENUS_MENU_CSS, 'css', 50, 255, $obj->getVar('css'));
     $this->addElement($formcss);
     $this->addElement(new Xoops\Form\Hidden('id', $obj->getVar('id')));
     $this->addElement(new Xoops\Form\Hidden('mid', $obj->getVar('mid')));
     $this->addElement(new Xoops\Form\Hidden('op', 'save'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Example #3
0
 /**
  * @param bool $action
  * @return XoopsThemeForm
  */
 public function getForm($action = false)
 {
     global $xoopsDB, $xoopsModuleConfig;
     if ($action === false) {
         $action = $_SERVER['REQUEST_URI'];
     }
     $title = $this->isNew() ? sprintf(_AM_PRESENTER_CAT_ADD) : sprintf(_AM_PRESENTER_CAT_EDIT);
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
     $form->setExtra('enctype="multipart/form-data"');
     // Cat_pid
     include_once XOOPS_ROOT_PATH . '/class/tree.php';
     $categoriesHandler =& xoops_getModuleHandler('categories', 'presenter');
     $criteria = new CriteriaCompo();
     $categories = $categoriesHandler->getObjects($criteria);
     if ($categories) {
         $categories_tree = new XoopsObjectTree($categories, 'cat_id', 'cat_pid');
         $cat_pid = $categories_tree->makeSelBox('cat_pid', 'cat_title', '--', $this->getVar('cat_pid', 'e'), false);
         $form->addElement(new XoopsFormLabel(_AM_PRESENTER_CAT_PID, $cat_pid));
     }
     // Cat_title
     $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_TITLE, 'cat_title', 50, 255, $this->getVar('cat_title')), true);
     // Cat_desc
     $form->addElement(new XoopsFormTextArea(_AM_PRESENTER_CAT_DESC, 'cat_desc', $this->getVar('cat_desc'), 4, 47), true);
     // Cat_image
     $cat_image = $this->getVar('cat_image') ? $this->getVar('cat_image') : 'blank.gif';
     $uploadir = '/uploads/presenter/images/categories';
     $imgtray = new XoopsFormElementTray(_AM_PRESENTER_CAT_IMAGE, '<br />');
     $imgpath = sprintf(_AM_PRESENTER_FORMIMAGE_PATH, $uploadir);
     $imageselect = new XoopsFormSelect($imgpath, 'cat_image', $cat_image);
     $image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadir);
     foreach ($image_array as $image) {
         $imageselect->addOption("{$image}", $image);
     }
     $imageselect->setExtra("onchange='showImgSelected(\"image_cat_image\", \"cat_image\", \"" . $uploadir . "\", \"\", \"" . XOOPS_URL . "\")'");
     $imgtray->addElement($imageselect);
     $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadir . "/" . $cat_image . "' name='image_cat_image' id='image_cat_image' alt='' />"));
     $fileseltray = new XoopsFormElementTray('', '<br />');
     $fileseltray->addElement(new XoopsFormFile(_AM_PRESENTER_FORMUPLOAD, 'cat_image', $xoopsModuleConfig['maxsize']));
     $fileseltray->addElement(new XoopsFormLabel(''));
     $imgtray->addElement($fileseltray);
     $form->addElement($imgtray);
     // Cat_weight
     $form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_WEIGHT, 'cat_weight', 50, 255, $this->getVar('cat_weight')), false);
     // Cat_color
     //      $form->addElement(new XoopsFormColorPicker(_AM_PRESENTER_CAT_COLOR, 'cat_color', $this->getVar('cat_color')), false);
     $form->addElement(new XoopsFormHidden('op', 'save'));
     $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
     return $form;
 }
Example #4
0
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once XOOPS_ROOT_PATH . "/class/tree.php";
$fform = new XoopsThemeForm(_AMS_AM_FILTER, "filterform", 'index.php');
$fform->setExtra('enctype="multipart/form-data"');
$first_row = new XoopsFormElementTray(_OPTIONS);
$first_row->addElement(new XoopsFormText(_AMS_AM_TITLE, 'title', 50, 80, $title));
global $xoopsDB;
$xt = new AmsTopic($xoopsDB->prefix("ams_topics"));
$alltopics = $xt->getAllTopics();
$topic_obj_tree = new XoopsObjectTree($alltopics, 'topic_id', 'topic_pid');
$first_row->addElement(new XoopsFormLabel(_AMS_AM_TOPIC, $topic_obj_tree->makeSelBox('topicid', 'topic_title', '--', $topicid, true)));
$author_select = new XoopsFormSelect(_AMS_AM_POSTER, 'author', $author, 5, true);
$authors = $xt->getAllAuthors();
//$authors = array_flip($authors);
foreach ($authors as $key => $user_arr) {
    $author_select->addOption($user_arr['uid'], $user_arr['uname']);
}
$first_row->addElement($author_select);
$second_row = new XoopsFormElementTray(_AMS_AM_SORTING);
$status_select = new XoopsFormSelect(_AMS_AM_STATUS, 'status', $status);
$status_select->addOption('none', '---');
$status_select->addOption('published', _AMS_AM_PUBLISHED);
$status_select->addOption('expired', _AMS_AM_EXPIRED);
$second_row->addElement($status_select);
$order = isset($order) ? $order : "DESC";
$order_select = new XoopsFormSelect(_AMS_AM_ORDER, 'order', $order);
Example #5
0
 if ($cnt_tla_contents) {
     $cat_cbox_options[0] = _AM_PUBLISHER_IMPORT_FMCONTENT_NAME . " ({$cnt_tla_contents})";
 }
 natcasesort($cat_cbox_options);
 //put them in "alphabetical" order
 echo "<span style='color: #567; margin: 3px 0 12px 0; font-size: small; display: block;'>" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $fmContentCount, count($cat_cbox_options)) . '</span>';
 $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/{$scriptname}");
 $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
 xoops_load('tree');
 $categoryHdlr =& $publisher->getHandler('category');
 $catObjs = $categoryHdlr->getAll();
 $myObjTree = new XoopsObjectTree($catObjs, 'categoryid', 'parentid');
 $catSelBox = $myObjTree->makeSelBox('parent_category', 'name', '-', 0, true);
 $parent_cat_sel = new XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, $catSelBox);
 $parent_cat_sel->setDescription(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY_DSC);
 $form->addElement($parent_cat_sel);
 /*
             $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'));
Example #6
0
 }
 $categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters());
 if (count($categories) == 0) {
     oledrion_utils::redirect(_AM_OLEDRION_ERROR_8, $baseurl, 5);
 }
 // TVA
 $vats = $vatsForDisplay = array();
 $vats = $h_oledrion_vat->getAllVats(new oledrion_parameters());
 if (count($vats) == 0 && oledrion_utils::getModuleOption('use_price')) {
     oledrion_utils::redirect(_AM_OLEDRION_ERROR_9, $baseurl, 5);
 }
 foreach ($vats as $onevat) {
     $vatsForDisplay[$onevat->getVar('vat_id')] = $onevat->getVar('vat_rate');
 }
 $mytree = new XoopsObjectTree($categories, 'cat_cid', 'cat_pid');
 $select_categ = $mytree->makeSelBox('product_cid', 'cat_title', '-', $item->getVar('product_cid'));
 $sform = new XoopsThemeForm($title, 'frmproduct', $baseurl);
 $sform->setExtra('enctype="multipart/form-data"');
 $sform->addElement(new XoopsFormHidden('op', 'products'));
 $sform->addElement(new XoopsFormHidden('action', 'saveedit'));
 $sform->addElement(new XoopsFormHidden('product_id', $item->getVar('product_id')));
 $sform->addElement(new XoopsFormHidden('product_submitter', $xoopsUser->getVar('uid')));
 $sform->addElement(new XoopsFormText(_OLEDRION_TITLE, 'product_title', 50, 255, $item->getVar('product_title', 'e')), true);
 // Vendeurs *************************************************************
 $vendors = $vendorsForDisplay = array();
 $vendors = $h_oledrion_vendors->getAllVendors(new oledrion_parameters());
 foreach ($vendors as $oneVendor) {
     $vendorsForDisplay[$oneVendor->getVar('vendor_id')] = $oneVendor->getVar('vendor_name');
 }
 $vendorsSelect = new XoopsFormSelect(_OLEDRION_VENDOR, 'product_vendor_id', $item->getVar('product_vendor_id'));
 $vendorsSelect->addOptionArray($vendorsForDisplay);
Example #7
0
     $xoopsTpl->assign('lang_ratingc', _NW_RATINGC);
     $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS);
 } else {
     $xoopsTpl->assign('rates', false);
 }
 if ($xoopsOption['storytopic']) {
     $xt->getTopic($xoopsOption['storytopic']);
     $xoopsTpl->assign('topic_description', $xt->topic_description('S'));
     $xoopsTpl->assign('topic_color', '#' . $xt->topic_color('S'));
     $topictitle = $xt->topic_title();
 }
 if ($xoopsModuleConfig['displaynav'] == 1) {
     $xoopsTpl->assign('displaynav', true);
     $allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex']);
     $topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
     $topic_select = $topic_tree->makeSelBox('storytopic', 'topic_title', '-- ', $xoopsOption['storytopic'], true);
     $xoopsTpl->assign('topic_select', $topic_select);
     $storynum_options = '';
     for ($i = 5; $i <= 30; $i = $i + 5) {
         $sel = '';
         if ($i == $xoopsOption['storynum']) {
             $sel = ' selected="selected"';
         }
         $storynum_options .= '<option value="' . $i . '"' . $sel . '>' . $i . '</option>';
     }
     $xoopsTpl->assign('storynum_options', $storynum_options);
 } else {
     $xoopsTpl->assign('displaynav', false);
 }
 if ($xoopsOption['storytopic'] == 0) {
     $topic_frontpage = true;
Example #8
0
    // if none of editor installed
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
}
$sform = new XoopsThemeForm(_AMS_NW_SUBMITNEWS, "storyform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php');
$sform->setExtra('enctype="multipart/form-data"');
$sform->addElement(new XoopsFormText(_AMS_NW_TITLE, 'title', 50, 80, $story->title('Edit')), true);
//Todo: Change to only display topics, which a user has submit privileges for
if (!isset($xt)) {
    $xt = new AmsTopic($xoopsDB->prefix("ams_topics"));
}
$alltopics = $xt->getAllTopics(true, "ams_submit");
if (count($alltopics) == 0) {
    redirect_header(XOOPS_URL . '/modules/AMS/index.php', 3, _AMS_NW_NOTOPICS);
}
$topic_obj_tree = new XoopsObjectTree($alltopics, 'topic_id', 'topic_pid');
$sform->addElement(new XoopsFormLabel(_AMS_NW_TOPIC, $topic_obj_tree->makeSelBox('topic_id', 'topic_title', '--', $story->topicid())));
//If admin - show admin form
//TODO: Change to "If submit privilege"
if ($approveprivilege) {
    //Show topic image?
    $topic_img = new XoopsFormRadio(_AMS_AM_TOPICDISPLAY, 'topicdisplay', $story->topicdisplay());
    $topic_img->addOption(0, _AMS_AM_NONE);
    $topic_img->addOption(1, _AMS_AM_TOPIC);
    $topic_img->addOption(2, _AMS_AM_AUTHOR);
    $sform->addElement($topic_img);
    //Select image position
    $posselect = new XoopsFormSelect(_AMS_AM_TOPICALIGN, 'topicalign', $story->topicalign());
    $posselect->addOption('R', _AMS_AM_RIGHT);
    $posselect->addOption('L', _AMS_AM_LEFT);
    $sform->addElement($posselect);
    //Publish in home?
Example #9
0
function topicsmanager()
{
    global $xoopsModule, $xoopsModuleConfig, $xoopsDB;
    include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
    //$uploadfolder=sprintf(_AMS_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule -> dirname().'/images/topics');
    $uploadirectory = "/modules/" . $xoopsModule->dirname() . '/images/topics';
    $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
    include_once XOOPS_ROOT_PATH . "/class/tree.php";
    $xt = new AmsTopic($xoopsDB->prefix("ams_topics"));
    $allTopics = $xt->getAllTopics();
    $totaltopics = count($allTopics);
    if ($totaltopics > 0) {
        $topic_obj_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
        $topics_arr = $topic_obj_tree->getAllChild(0);
    }
    echo "<form action='index.php' method='POST'>";
    echo "<div class=\"odd\">";
    echo "<div style='text-align: center;'><b>" . _AMS_AM_TOPICSMNGR . ' (' . ($start + 1) . '-' . ($start + $xoopsModuleConfig['storycountadmin'] > $totaltopics ? $totaltopics : $start + $xoopsModuleConfig['storycountadmin']) . ' ' . _AMS_AM_OF . ' ' . $totaltopics . ')' . "</b><br /><br />";
    echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AMS_AM_TOPIC . "</td><td align='left'>" . _AMS_AM_TOPICNAME . "</td><td align='center'>" . _AMS_AM_PARENTTOPIC . "</td><td> " . _AMS_AM_WEIGHT . " </td><td align='center'>" . _AMS_AM_ACTION . "</td></tr>";
    //If topic not empty
    if ($totaltopics > 0) {
        $i = 0;
        foreach ($topics_arr as $thisTopic) {
            $i++;
            if ($i > $start && $i - $start <= $xoopsModuleConfig['storycountadmin']) {
                $linkedit = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=topicsmanager&amp;topic_id=' . $thisTopic->topic_id();
                $linkdelete = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/index.php?op=delTopic&amp;topic_id=' . $thisTopic->topic_id();
                $action = sprintf("<a href='%s'>%s</a> - <a href='%s'>%s</a>", $linkedit, _AMS_AM_EDIT, $linkdelete, _AMS_AM_DELETE);
                $parent = '&nbsp;';
                $pid = $thisTopic->topic_pid();
                if ($pid > 0) {
                    $parent = $topics_arr[$pid]->topic_title();
                    $thisTopic->prefix = str_replace(".", "-", $thisTopic->prefix) . '&nbsp;&nbsp;';
                } else {
                    $thisTopic->prefix = str_replace(".", "", $thisTopic->prefix);
                }
                echo "<tr><td>" . $thisTopic->topic_id() . "</td><td align='left'>" . $thisTopic->prefix() . $thisTopic->topic_title() . "</td><td align='left'>" . $parent . "</td><td align='center'><input type='text' name='weight[" . $thisTopic->topic_id() . "]' value='" . $thisTopic->weight . "' size='10' maxlength='10' /> </td><td>" . $action . "</td></tr>";
            }
        }
        echo "<tr><td colspan='3'></td><td><input type='hidden' name='op' value='reorder' />\r\n                <input type='submit' name='submit' value='" . _AMS_AM_SUBMIT . "' /></td><td></td></tr>";
    }
    echo "</table></div></div></form>";
    if ($totaltopics > $xoopsModuleConfig['storycountadmin']) {
        $pagenav = new XoopsPageNav($totaltopics, $xoopsModuleConfig['storycountadmin'], $start, 'start', 'op=topicsmanager');
        echo "<div align='right'>";
        echo $pagenav->renderNav() . '</div><br />';
    }
    $topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : 0;
    if ($topic_id > 0) {
        $xtmod = $topics_arr[$topic_id];
        $topic_title = $xtmod->topic_title('E');
        $op = 'modTopicS';
        if (trim($xtmod->topic_imgurl()) != '') {
            $topicimage = $xtmod->topic_imgurl();
        } else {
            $topicimage = "blank.png";
        }
        $btnlabel = _AMS_AM_MODIFY;
        $parent = $xtmod->topic_pid();
        $formlabel = _AMS_AM_MODIFYTOPIC;
        $banner = $xtmod->banner;
        $banner_inherit = $xtmod->banner_inherit;
        $forum = $xtmod->forum_id;
        unset($xtmod);
    } else {
        $topic_title = '';
        $op = 'addTopic';
        $topicimage = 'xoops.gif';
        $btnlabel = _AMS_AM_ADD;
        $parent = 0;
        $formlabel = _AMS_AM_ADD_TOPIC;
        $banner = '';
        $banner_inherit = 0;
        $forum = 0;
    }
    $sform = new XoopsThemeForm($formlabel, "topicform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/index.php', 'post');
    $sform->setExtra('enctype="multipart/form-data"');
    $sform->addElement(new XoopsFormText(_AMS_AM_TOPICNAME . ' ' . _AMS_AM_MAX40CHAR, 'topic_title', 40, 50, $topic_title), true);
    $sform->addElement(new XoopsFormHidden('op', $op), false);
    $sform->addElement(new XoopsFormHidden('topic_id', $topic_id), false);
    if ($totaltopics > 0) {
        $sform->addElement(new XoopsFormLabel(_AMS_AM_PARENTTOPIC, $topic_obj_tree->makeSelBox('topic_pid', 'topic_title', '--', $parent, true)));
    } else {
        $sform->addElement(new XoopsFormHidden('topic_pid', 0));
    }
    // ********** Picture
    $imgtray = new XoopsFormElementTray(_AMS_AM_TOPICIMG, '<br />');
    $imgpath = sprintf(_AMS_AM_IMGNAEXLOC, "modules/" . $xoopsModule->dirname() . "/images/topics/");
    $imageselect = new XoopsFormSelect($imgpath, 'topic_imgurl', $topicimage);
    $topics_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/AMS/images/topics/");
    foreach ($topics_array as $image) {
        $imageselect->addOption("{$image}", $image);
    }
    $imageselect->setExtra("onchange='showImgSelected(\"image3\", \"topic_imgurl\", \"" . $uploadirectory . "\", \"\", \"" . XOOPS_URL . "\")'");
    $imgtray->addElement($imageselect, false);
    $imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadirectory . "/" . $topicimage . "' name='image3' id='image3' alt='' />"));
    $uploadfolder = sprintf(_AMS_AM_UPLOAD_WARNING, XOOPS_URL . "/modules/" . $xoopsModule->dirname() . '/images/topics');
    $fileseltray = new XoopsFormElementTray('', '<br />');
    $fileseltray->addElement(new XoopsFormFile(_AMS_AM_TOPIC_PICTURE, 'attachedfile', $xoopsModuleConfig['maxuploadsize']), false);
    $fileseltray->addElement(new XoopsFormLabel($uploadfolder), false);
    $imgtray->addElement($fileseltray);
    $sform->addElement($imgtray);
    //Forum linking
    $module_handler =& xoops_gethandler('module');
    $forum_module =& $module_handler->getByDirname('newbb');
    if (is_object($forum_module) && $forum_module->getVar('version') >= 200) {
        $forum_handler =& xoops_getmodulehandler('forum', 'newbb', true);
        if (is_object($forum_handler)) {
            $forums = $forum_handler->getForums();
            if (count($forums) > 0) {
                $forum_tree = new XoopsObjectTree($forums, 'forum_id', 'parent_forum');
                $sform->addElement(new XoopsFormLabel(_AMS_AM_LINKEDFORUM, $forum_tree->makeSelBox('forum_id', 'forum_name', '--', $forum, true)));
            }
        }
    }
    //Banner
    $sform->addElement(new XoopsFormDhtmlTextArea(_AMS_AM_TOPICBANNER, 'banner', $banner));
    $inherit_checkbox = new XoopsFormCheckBox(_AMS_AM_BANNERINHERIT, 'banner_inherit', $banner_inherit);
    $inherit_checkbox->addOption(1, _YES);
    $sform->addElement($inherit_checkbox);
    //Added in AMS 2.50 Final. Use News 1.62 permission style
    //Enhance in AMS 3.0 Beta 1. Add default permission for approval=admin, submit=admin,User.
    // Permissions
    $member_handler =& xoops_gethandler('member');
    $group_list =& $member_handler->getGroupList();
    $gperm_handler =& xoops_gethandler('groupperm');
    $group_type_ref =& $member_handler->getGroups(null, true);
    $admin_list = array();
    $user_list = array();
    $full_list = array();
    $admincount = 1;
    $usercount = 1;
    $fullcount = 1;
    foreach (array_keys($group_type_ref) as $i) {
        if ($group_type_ref[$i]->getVar('group_type') == 'Admin') {
            $admin_list[$i] = $group_list[$i];
            $admincount++;
            $user_list[$i] = $group_list[$i];
            $usercount++;
        }
        if ($group_type_ref[$i]->getVar('group_type') == 'User') {
            $user_list[$i] = $group_list[$i];
            $usercount++;
        }
        $full_list[$i] = $group_list[$i];
        $fullcount++;
    }
    $admin_list = array_keys($admin_list);
    $user_list = array_keys($user_list);
    $full_list = array_keys($full_list);
    $groups_ids = array();
    if ($topic_id > 0) {
        // Edit mode
        $groups_ids = $gperm_handler->getGroupIds('ams_approve', $topic_id, $xoopsModule->getVar('mid'));
        $groups_ids = array_values($groups_ids);
        $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $groups_ids);
    } else {
        // Creation mode
        $groups_AMS_can_approve_checkbox = new XoopsFormCheckBox(_AMS_AM_APPROVEFORM, 'groups_AMS_can_approve[]', $admin_list);
    }
    $groups_AMS_can_approve_checkbox->addOptionArray($group_list);
    $sform->addElement($groups_AMS_can_approve_checkbox);
    $groups_ids = array();
    if ($topic_id > 0) {
        // Edit mode
        $groups_ids = $gperm_handler->getGroupIds('ams_submit', $topic_id, $xoopsModule->getVar('mid'));
        $groups_ids = array_values($groups_ids);
        $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $groups_ids);
    } else {
        // Creation mode
        $groups_AMS_can_submit_checkbox = new XoopsFormCheckBox(_AMS_AM_SUBMITFORM, 'groups_AMS_can_submit[]', $user_list);
    }
    $groups_AMS_can_submit_checkbox->addOptionArray($group_list);
    $sform->addElement($groups_AMS_can_submit_checkbox);
    $groups_ids = array();
    if ($topic_id > 0) {
        // Edit mode
        $groups_ids = $gperm_handler->getGroupIds('ams_view', $topic_id, $xoopsModule->getVar('mid'));
        $groups_ids = array_values($groups_ids);
        $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $groups_ids);
    } else {
        // Creation mode
        $groups_AMS_can_view_checkbox = new XoopsFormCheckBox(_AMS_AM_VIEWFORM, 'groups_AMS_can_view[]', $full_list);
    }
    $groups_AMS_can_view_checkbox->addOptionArray($group_list);
    $sform->addElement($groups_AMS_can_view_checkbox);
    // Submit buttons
    $button_tray = new XoopsFormElementTray('', '');
    $submit_btn = new XoopsFormButton('', 'post', $btnlabel, 'submit');
    $button_tray->addElement($submit_btn);
    $sform->addElement($button_tray);
    $sform->display();
}
Example #10
0
function modCat()
{
    global $xoopsDB, $myts, $eh, $xoopsModule;
    $cid = mylinksUtility::mylinks_cleanVars($_POST, 'cid', 0, 'int', array('min' => 0));
    //xoops_cp_header();
    echo "<h4>" . _MD_MYLINKS_WEBLINKSCONF . "</h4>\n" . "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>\n" . "  <tr><th>" . _MD_MYLINKS_MODCAT . "<br /></th></tr>\n" . "  <tr class='odd'>\n" . "    <td>\n";
    $mylinksCatHandler =& xoops_getmodulehandler('category', $xoopsModule->getVar('dirname'));
    $catObj = $mylinksCatHandler->get($cid);
    if (isset($catObj) && is_object($catObj)) {
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('cid', $cid, "!="));
        $catListObjs = $mylinksCatHandler->getAll($criteria);
        $catListTree = new XoopsObjectTree($catListObjs, 'cid', 'pid');
        $title = $myts->htmlSpecialChars($catObj->getVar('title'));
        $imgurl = $myts->htmlSpecialChars($catObj->getVar('imgurl'));
        $pid = $catObj->getVar('pid');
        echo "      <form action='main.php' method='post'>" . _MD_MYLINKS_TITLEC . "\n" . "        <input type='text' name='title' value='{$title}' size='51' maxlength='50' />\n" . "\t\t  <br /><br />\n";
        if (0 == $catObj->getVar('pid')) {
            echo "        " . _MD_MYLINKS_IMGURLMAIN . "<br />\n" . "        <input type='text' name='imgurl' value='{$imgurl}' size='100' maxlength='150' />\n" . "        <br /><br />\n";
        }
        echo "        " . _MD_MYLINKS_PARENT . "&nbsp;\n" . "        " . $catListTree->makeSelBox("pid", "title", '- ', $pid, true) . "\n" . "        <br />\n" . "        <input type='hidden' name='cid' value='{$cid}' />\n" . "        <input type='hidden' name='op' value='modCatS' /><br />\n" . "        <input type='submit' value='" . _MD_MYLINKS_SAVE . "' />\n" . "        <input type='button' value='" . _DELETE . "' onclick=\"location='main.php?pid={$pid}&amp;cid={$cid}&amp;op=delCat'\" />&nbsp;\n" . "        <input type='button' value='" . _CANCEL . "' onclick=\"javascript:history.go(-1)\" />\n" . "      </form>\n";
    } else {
        echo "  <tr><td>" . _MD_MYLINKS_CIDERROR . "</td></tr>\n" . "  <tr><td><input type='button' value='" . _BACK . "' onclick=\"javascript:history.go(-1)\" /></td></tr>\n";
    }
    echo "    </td>\n" . "  </tr>\n" . "</table>\n";
    include 'footer.php';
}
Example #11
0
function mymenus_admin_form($id = null, $pid = null)
{
    global $menu_id;
    $registry =& MymenusRegistry::getInstance();
    $plugin =& MymenusPlugin::getInstance();
    $this_handler =& xoops_getModuleHandler('menu', 'mymenus');
    $objArray = array();
    if (isset($id)) {
        $ftitle = _EDIT;
        $obj = $this_handler->get($id);
        $objArray = $obj->getValues();
    } else {
        $ftitle = _ADD;
        $obj = $this_handler->create();
        $objArray = $obj->getValues();
        if (isset($pid)) {
            $objArray['pid'] = $pid;
        }
    }
    $form = new XoopsThemeForm($ftitle, 'admin_form', $GLOBALS['mymenus_adminpage'], "post", true);
    $formtitle = new XoopsFormText(_AM_MYMENUS_MENU_TITLE, 'title', 50, 255, $objArray['title']);
    $formalttitle = new XoopsFormText(_AM_MYMENUS_MENU_ALTTITLE, 'alt_title', 50, 255, $objArray['alt_title']);
    $formlink = new XoopsFormText(_AM_MYMENUS_MENU_LINK, 'link', 50, 255, $objArray['link']);
    /*$plugin->triggerEvent('FormLinkDescription');
      $formlink->setDescription($registry->getEntry('form_link_description'));  */
    $formimage = new XoopsFormText(_AM_MYMENUS_MENU_IMAGE, 'image', 50, 255, $objArray['image']);
    $criteria = new CriteriaCompo(new Criteria('mid', $menu_id));
    $criteria->add(new Criteria('id', $id, '<>'));
    // $criteria->add(new Criteria('pid', 0));
    $criteria->setSort('weight');
    $criteria->setOrder('ASC');
    $results = $this_handler->getAll($criteria, array('title', 'id', 'pid'));
    include_once $GLOBALS['xoops']->path('class/tree.php');
    $parent_tree = new XoopsObjectTree($results, 'id', 'pid');
    $parent_select = $parent_tree->makeSelBox('pid', 'title', '-- ', $objArray['pid'], true);
    $formparent = new XoopsFormLabel(_AM_MYMENUS_MENU_PARENT, $parent_select);
    $formvis = new XoopsFormSelect(_AM_MYMENUS_MENU_VISIBLE, "visible", $objArray['visible']);
    $formvis->addOption("0", _NO);
    $formvis->addOption("1", _YES);
    $formtarget = new XoopsFormSelect(_AM_MYMENUS_MENU_TARGET, "target", $objArray['target']);
    $formtarget->addOption("_self", _AM_MYMENUS_MENU_TARG_SELF);
    $formtarget->addOption("_blank", _AM_MYMENUS_MENU_TARG_BLANK);
    $formtarget->addOption("_parent", _AM_MYMENUS_MENU_TARG_PARENT);
    $formtarget->addOption("_top", _AM_MYMENUS_MENU_TARG_TOP);
    $formgroups = new XoopsFormSelectGroup(_AM_MYMENUS_MENU_GROUPS, "groups", true, $objArray['groups'], 5, true);
    $formgroups->setDescription(_AM_MYMENUS_MENU_GROUPS_HELP);
    //$formhooks = new XoopsFormTextArea(_AM_MYMENUS_MENU_HOOKS, "hooks", $objArray['hooks'], 7, 60);
    $formhooks = new XoopsFormSelect(_AM_MYMENUS_MENU_ACCESS_FILTER, "hooks", $objArray['hooks'], 5, true);
    $plugin->triggerEvent('AccessFilter');
    $results = $registry->getEntry('access_filter');
    if ($results) {
        foreach ($results as $result) {
            $formhooks->addOption($result['method'], $result['name']);
        }
    }
    $formcss = new XoopsFormText(_AM_MYMENUS_MENU_CSS, 'css', 50, 255, $objArray['css']);
    $form->addElement($formtitle, true);
    $form->addElement($formalttitle);
    $form->addElement($formlink);
    $form->addElement($formimage);
    $form->addElement($formparent);
    $form->addElement($formvis);
    $form->addElement($formtarget);
    $form->addElement($formgroups);
    $form->addElement($formhooks);
    $form->addElement($formcss);
    //$form->addElement($formhooks2);
    $tray = new XoopsFormElementTray('', '');
    $tray->addElement(new XoopsFormButton('', 'submit_button', _SUBMIT, 'submit'));
    $btn = new XoopsFormButton('', 'reset', _CANCEL, 'button');
    if (isset($id)) {
        $btn->setExtra('onclick="document.location.href=\'' . $GLOBALS['mymenus_adminpage'] . '?op=list&amp;menu_id=' . $menu_id . ' \'"');
    } else {
        $btn->setExtra('onclick="document.getElementById(\'addform\').style.display = \'none\'; return false;"');
    }
    $tray->addElement($btn);
    $form->addElement($tray);
    if (isset($id)) {
        $form->addElement(new XoopsFormHidden('op', 'editok'));
        $form->addElement(new XoopsFormHidden('id', $id));
    } else {
        $form->addElement(new XoopsFormHidden('op', 'add'));
    }
    $form->addElement(new XoopsFormHidden('mid', $menu_id));
    return $form->render();
}
Example #12
0
 $notify_show = !empty($xoopsUser) && !$xoopsModuleConfig['autoapprove'] ? 1 : 0;
 $xoopsTpl->assign('notify_show', $notify_show);
 $xoopsTpl->assign('lang_submitonce', _MD_MYLINKS_SUBMITONCE);
 $xoopsTpl->assign('lang_submitlinkh', _MD_MYLINKS_SUBMITLINKHEAD);
 $xoopsTpl->assign('lang_allpending', _MD_MYLINKS_ALLPENDING);
 $xoopsTpl->assign('lang_dontabuse', _MD_MYLINKS_DONTABUSE);
 $xoopsTpl->assign('lang_wetakeshot', _MD_MYLINKS_TAKESHOT);
 $xoopsTpl->assign('lang_sitetitle', _MD_MYLINKS_SITETITLE);
 $xoopsTpl->assign('lang_siteurl', _MD_MYLINKS_SITEURL);
 $xoopsTpl->assign('lang_category', _MD_MYLINKS_CATEGORYC);
 $xoopsTpl->assign('lang_options', _MD_MYLINKS_OPTIONS);
 $xoopsTpl->assign('lang_notify', _MD_MYLINKS_NOTIFYAPPROVE);
 $xoopsTpl->assign('lang_description', _MD_MYLINKS_DESCRIPTIONC);
 $xoopsTpl->assign('lang_submit', _SUBMIT);
 $xoopsTpl->assign('lang_cancel', _CANCEL);
 $xoopsTpl->assign('category_selbox', $myCatTree->makeSelBox('cid', 'title', '-', 0, false));
 //wanikoo theme changer
 $xoopsTpl->assign('lang_themechanger', _MD_MYLINKS_THEMECHANGER);
 $mymylinkstheme_options = '';
 foreach ($GLOBALS['mylinks_allowed_theme'] as $mymylinkstheme) {
     $mymylinkstheme_options .= "<option value='{$mymylinkstheme}'";
     if ($mymylinkstheme == $GLOBALS['mylinks_theme']) {
         $mymylinkstheme_options .= " selected='selected'";
     }
     $mymylinkstheme_options .= ">{$mymylinkstheme}</option>";
 }
 $mylinkstheme_select = "<select name='mylinks_theme_select' onchange='submit();' size='1'>{$mymylinkstheme_options}</select>";
 $xoopsTpl->assign('mylinksthemeoption', $mylinkstheme_select);
 //wanikoo search
 if (file_exists(XOOPS_ROOT_PATH . "/language/" . $xoopsConfig['language'] . "/search.php")) {
     include_once XOOPS_ROOT_PATH . "/language/" . $xoopsConfig['language'] . "/search.php";
Example #13
0
 /**
  * @param AlumniCategory|XoopsObject $obj
  */
 public function __construct(AlumniListing &$obj)
 {
     $xoops = Xoops::getInstance();
     if ($xoops->getModuleConfig('alumni_moderated') == '1') {
         $title = $obj->isNew() ? sprintf(AlumniLocale::ADD_MOD) : sprintf(AlumniLocale::EDIT_MOD);
     } else {
         $title = $obj->isNew() ? sprintf(AlumniLocale::ADD_LISTING) : sprintf(AlumniLocale::EDIT_LISTING);
     }
     parent::__construct($title, 'form', false, 'post', true);
     $this->setExtra('enctype="multipart/form-data"');
     $member_handler = $xoops->getHandlerMember();
     $userGroups = $member_handler->getGroupList();
     $lid = Request::getInt('lid', 0);
     if (isset($lid)) {
         $lid = $lid;
     }
     $this->addElement(new Xoops\Form\Label(AlumniLocale::SUBMITTER, $xoops->user->uname()));
     $categoryHandler = $xoops->getmodulehandler('category', 'alumni');
     $categories = $categoryHandler->getObjects();
     $mytree = new XoopsObjectTree($categories, 'cid', 'pid');
     if ($obj->isNew()) {
         $this_cid = Request::getInt('cid', 0);
     } else {
         $this_cid = $obj->getVar('cid');
     }
     $categories_Handler = $xoops->getmodulehandler('category', 'alumni');
     $categories = $categories_Handler->getObjects();
     $mytree = new XoopsObjectTree($categories, 'cid', 'pid');
     $category_select = $mytree->makeSelBox('cid', 'title', '--', $this_cid, true);
     $this->addElement(new Xoops\Form\Label(AlumniLocale::SCHOOL, $category_select), true);
     $cat_name = '';
     $categories_Handler = $xoops->getModuleHandler('category', 'alumni');
     $catObj = $categories_Handler->get($obj->getVar('cid'));
     $cat_name = $catObj->getVar('title');
     $this->addElement(new Xoops\Form\Hidden('school', $cat_name));
     $this->addElement(new Xoops\Form\Text(AlumniLocale::NAME_2, 'name', 50, 255, $obj->getVar('name')), true);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::MNAME_2, 'mname', 50, 255, $obj->getVar('mname')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::LNAME_2, 'lname', 50, 255, $obj->getVar('lname')), true);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::CLASS_OF_2, 'year', 50, 255, $obj->getVar('year')), true);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::STUDIES_2, 'studies', 50, 255, $obj->getVar('studies')), false);
     $activities = $obj->getVar('activities', 'e') ? $obj->getVar('activities', 'e') : '';
     $editor_configs = array();
     $editor_configs['name'] = 'activities';
     $editor_configs['value'] = $activities;
     $editor_configs['editor'] = $xoops->getModuleConfig('alumni_form_options');
     $editor_configs['rows'] = 6;
     $editor_configs['cols'] = 8;
     $this->addElement(new Xoops\Form\Editor(AlumniLocale::ACTIVITIES, 'activities', $editor_configs), false);
     $extrainfo = $obj->getVar('extrainfo', 'e') ? $obj->getVar('extrainfo', 'e') : '';
     $editor_configs = array();
     $editor_configs['name'] = 'extrainfo';
     $editor_configs['value'] = $extrainfo;
     $editor_configs['editor'] = $xoops->getModuleConfig('alumni_form_options');
     $editor_configs['rows'] = 6;
     $editor_configs['cols'] = 8;
     $this->addElement(new Xoops\Form\Editor(AlumniLocale::EXTRAINFO, 'extrainfo', $editor_configs), false);
     $photo_old = $obj->getVar('photo') ? $obj->getVar('photo') : '';
     $uploadirectory_photo = XOOPS_ROOT_PATH . "/modules/alumni/photos/grad_photo";
     $imgtray_photo = new Xoops\Form\ElementTray(AlumniLocale::GRAD_PHOTO, '<br />');
     $imgpath_photo = sprintf(AlumniLocale::FORMIMAGE_PATH, $uploadirectory_photo);
     $fileseltray_photo = new Xoops\Form\ElementTray('', '<br />');
     $fileseltray_photo->addElement(new Xoops\Form\File(AlumniLocale::FORMUPLOAD, 'photo', $xoops->getModuleConfig('alumni_photomax')), false);
     if ($photo_old) {
         $fileseltray_photo->addElement(new Xoops\Form\Label(AlumniLocale::PHOTO2, '<a href="photos/grad_photo/' . $photo_old . '">' . $photo_old . '</a>', false));
         $imgtray_checkbox = new Xoops\Form\Checkbox('', 'del_photo', 0);
         $imgtray_checkbox->addOption(1, AlumniLocale::DELPICT);
         $fileseltray_photo->addElement($imgtray_checkbox);
     }
     $imgtray_photo->addElement($fileseltray_photo);
     $this->addElement($imgtray_photo);
     $this->addElement(new Xoops\Form\Hidden('photo_old', $photo_old));
     $photo2_old = $obj->getVar('photo2') ? $obj->getVar('photo2') : '';
     $uploadirectory_photo2 = XOOPS_ROOT_PATH . "/modules/alumni/photos/now_photo";
     $imgtray_photo2 = new Xoops\Form\ElementTray(AlumniLocale::NOW_PHOTO, '<br />');
     $imgpath_photo2 = sprintf(AlumniLocale::FORMIMAGE_PATH, $uploadirectory_photo2);
     $fileseltray_photo2 = new Xoops\Form\ElementTray('', '<br />');
     $fileseltray_photo2->addElement(new Xoops\Form\File(AlumniLocale::FORMUPLOAD, 'photo2', $xoops->getModuleConfig('alumni_photomax')), false);
     if ($photo2_old) {
         $fileseltray_photo2->addElement(new Xoops\Form\Label(AlumniLocale::PHOTO2, '<a href="photos/now_photo/' . $photo2_old . '">' . $photo2_old . '</a>', false));
         $imgtray_checkbox2 = new Xoops\Form\Checkbox('', 'del_photo2', 0);
         $imgtray_checkbox2->addOption(1, AlumniLocale::DELPICT);
         $fileseltray_photo2->addElement($imgtray_checkbox2);
     }
     $imgtray_photo2->addElement($fileseltray_photo2);
     $this->addElement($imgtray_photo2);
     $this->addElement(new Xoops\Form\Hidden('photo2_old', $photo2_old));
     $this->addElement(new Xoops\Form\Text(AlumniLocale::EMAIL_2, 'email', 50, 255, $obj->getVar('email')), true);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::OCC_2, 'occ', 50, 255, $obj->getVar('occ')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::TOWN_2, 'town', 50, 255, $obj->getVar('town')), false);
     if ($xoops->user->isAdmin()) {
         $this->addElement(new Xoops\Form\RadioYesNo(AlumniLocale::APPROVE_2, 'valid', $obj->getVar('valid'), XoopsLocale::YES, XoopsLocale::NO));
     }
     if ($xoops->getModuleConfig('alumni_use_captcha') == '1') {
         $this->addElement(new Xoops\Form\Captcha());
     }
     $this->addElement(new Xoops\Form\Hidden('security', $xoops->security()->createToken()));
     if (isset($_REQUEST['date'])) {
         $this->addElement(new Xoops\Form\Hidden('date', $_REQUEST['date']));
     } else {
         $this->addElement(new XoopsFormHidden('date', time()));
     }
     $this->addElement(new Xoops\Form\Hidden('submitter', $xoops->user->uname()));
     $this->addElement(new Xoops\Form\Hidden('usid', $xoops->user->uid()));
     $this->addElement(new Xoops\Form\Hidden('op', 'save_listing'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Example #14
0
 function createElements()
 {
     global $xoopsUser;
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $mytree = new XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), "categoryid", "parentid");
     $cat_select = $mytree->makeSelBox('parentid', 'name', '--', $this->targetObject->parentid(), true);
     $this->addElement(new XoopsFormLabel(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $cat_select));
     // Name
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
     // Description
     $this->addElement(new XoopsFormTextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
     // EDITOR
     $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
     $gperm_handler = $this->publisher->getHandler('groupperm');
     $module_id = $this->publisher->getModule()->mid();
     $allowed_editors = publisher_getEditors($gperm_handler->getItemIds('editors', $groups, $module_id));
     $nohtml = false;
     if (count($allowed_editors) > 0) {
         $editor = @$_POST['editor'];
         if (!empty($editor)) {
             publisher_setCookieVar('publisher_editor', $editor);
         } else {
             $editor = publisher_getCookieVar('publisher_editor');
             if (empty($editor) && is_object($xoopsUser)) {
                 $editor = @$xoopsUser->getVar('publisher_editor');
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowed_editors) ? $this->publisher->getConfig('submit_editor') : $editor;
         $form_editor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
         $this->addElement($form_editor);
     } else {
         $editor = $this->publisher->getConfig('submit_editor');
     }
     $editor_configs = array();
     $editor_configs['rows'] = $this->publisher->getConfig('submit_editor_rows') == '' ? 35 : $this->publisher->getConfig('submit_editor_rows');
     $editor_configs['cols'] = $this->publisher->getConfig('submit_editor_cols') == '' ? 60 : $this->publisher->getConfig('submit_editor_cols');
     $editor_configs['width'] = $this->publisher->getConfig('submit_editor_width') == '' ? "100%" : $this->publisher->getConfig('submit_editor_width');
     $editor_configs['height'] = $this->publisher->getConfig('submit_editor_height') == '' ? "400px" : $this->publisher->getConfig('submit_editor_height');
     $editor_configs['name'] = 'header';
     $editor_configs['value'] = $this->targetObject->header('e');
     $text_header = new XoopsFormEditor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editor_configs, $nohtml, $onfailure = null);
     $text_header->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($text_header);
     // IMAGE
     $image_array = XoopsLists::getImgListAsArray(publisher_getImageDir('category'));
     $image_select = new XoopsFormSelect('', 'image', $this->targetObject->image());
     //$image_select -> addOption ('-1', '---------------');
     $image_select->addOptionArray($image_array);
     $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
     $image_tray = new XoopsFormElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $image_tray->addElement($image_select);
     $image_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . publisher_getImageDir('category', false) . $this->targetObject->image() . "' name='image3' id='image3' alt='' />"));
     $image_tray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($image_tray);
     // IMAGE UPLOAD
     $max_size = 5000000;
     $file_box = new XoopsFormFile(_AM_PUBLISHER_IMAGE_UPLOAD, "image_file", $max_size);
     $file_box->setExtra("size ='45'");
     $file_box->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($file_box);
     // Short url
     $text_short_url = new XoopsFormText(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
     $text_short_url->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($text_short_url);
     // Meta Keywords
     $text_meta_keywords = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
     $text_meta_keywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($text_meta_keywords);
     // Meta Description
     $text_meta_description = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
     $text_meta_description->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($text_meta_description);
     // Weight
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new XoopsFormText("Custom template", 'template', 50, 255, $this->targetObject->template('e')), false);
     // READ PERMISSIONS
     $groups_read_checkbox = new XoopsFormCheckBox(_AM_PUBLISHER_PERMISSIONS_CAT_READ, 'groups_read[]', $this->targetObject->getGroups_read());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groups_read_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_read_checkbox);
     // SUBMIT PERMISSIONS
     $groups_submit_checkbox = new XoopsFormCheckBox(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $this->targetObject->getGroups_submit());
     $groups_submit_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     foreach ($this->userGroups as $group_id => $group_name) {
         $groups_submit_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_submit_checkbox);
     // MODERATION PERMISSIONS
     $groups_moderation_checkbox = new XoopsFormCheckBox(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, 'groups_moderation[]', $this->targetObject->getGroups_moderation());
     $groups_moderation_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     foreach ($this->userGroups as $group_id => $group_name) {
         $groups_moderation_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_moderation_checkbox);
     $moderator = new XoopsFormSelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $this->targetObject->moderator('e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     $cat_tray = new XoopsFormElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->subCatsCount; $i++) {
         if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
             $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
         } else {
             $subname = '';
         }
         $cat_tray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new XoopsFormText('', 'nb_subcats', 3, 2);
     $l = new XoopsFormLabel('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new XoopsFormButton('', 'submit_subcats', _AM_PUBLISHER_ADD_OPT_SUBMIT, 'submit');
     if (!$this->targetObject->categoryid()) {
         $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
     } else {
         $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
     }
     $r = new XoopsFormElementTray('');
     $r->addElement($l);
     $r->addElement($b);
     $cat_tray->addElement($r);
     $this->addElement($cat_tray);
     $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid()));
     $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount));
 }
Example #15
0
     $item = null;
     $item = $h_oledrion_cat->get($id);
     if (!is_object($item)) {
         oledrion_utils::redirect(_AM_OLEDRION_NOT_FOUND, $baseurl, 5);
     }
     $edit = true;
     $label_submit = _AM_OLEDRION_MODIFY;
 } else {
     $title = _AM_OLEDRION_ADD_CATEG;
     $item = $h_oledrion_cat->create(true);
     $label_submit = _AM_OLEDRION_ADD;
     $edit = false;
 }
 $tbl_categories = $h_oledrion_cat->getAllCategories(new oledrion_parameters());
 $mytree = new XoopsObjectTree($tbl_categories, 'cat_cid', 'cat_pid');
 $select_categ = $mytree->makeSelBox('cat_pid', 'cat_title', '-', $item->getVar('cat_pid'), true);
 $sform = new XoopsThemeForm($title, 'frmcategory', $baseurl);
 $sform->setExtra('enctype="multipart/form-data"');
 $sform->addElement(new XoopsFormHidden('op', 'categories'));
 $sform->addElement(new XoopsFormHidden('action', 'saveedit'));
 $sform->addElement(new XoopsFormHidden('cat_cid', $item->getVar('cat_cid')));
 $sform->addElement(new XoopsFormText(_AM_OLEDRION_CATEG_TITLE, 'cat_title', 50, 255, $item->getVar('cat_title', 'e')), true);
 $sform->addElement(new XoopsFormLabel(_AM_OLEDRION_PARENT_CATEG, $select_categ), false);
 if ($action == 'edit' && $item->pictureExists()) {
     $pictureTray = new XoopsFormElementTray(_AM_OLEDRION_CURRENT_PICTURE, '<br />');
     $pictureTray->addElement(new XoopsFormLabel('', "<img src='" . $item->getPictureUrl() . "' alt='' border='0' />"));
     $deleteCheckbox = new XoopsFormCheckBox('', 'delpicture');
     $deleteCheckbox->addOption(1, _DELETE);
     $pictureTray->addElement($deleteCheckbox);
     $sform->addElement($pictureTray);
     unset($pictureTray, $deleteCheckbox);
Example #16
0
    $mymylinkstheme_options .= ">{$mymylinkstheme}</option>";
}
$mylinkstheme_select = "<select name='mylinks_theme_select' onchange='submit();' size='1'>{$mymylinkstheme_options}</select>";
$xoopsTpl->assign('mylinksthemeoption', $mylinkstheme_select);
//wanikoo end
//wanikoo search
if (file_exists(XOOPS_ROOT_PATH . "/language/" . $xoopsConfig['language'] . "/search.php")) {
    include_once XOOPS_ROOT_PATH . "/language/" . $xoopsConfig['language'] . "/search.php";
} else {
    include_once XOOPS_ROOT_PATH . "/language/english/search.php";
}
$xoopsTpl->assign('lang_all', _SR_ALL);
$xoopsTpl->assign('lang_any', _SR_ANY);
$xoopsTpl->assign('lang_exact', _SR_EXACT);
$xoopsTpl->assign('lang_search', _SR_SEARCH);
$xoopsTpl->assign('module_id', $xoopsModule->getVar('mid'));
//category head
$catarray = array();
if ($mylinks_show_letters) {
    $catarray['letters'] = ml_wfd_letters();
}
if ($mylinks_show_toolbar) {
    $catarray['toolbar'] = ml_wfd_toolbar();
}
$xoopsTpl->assign('catarray', $catarray);
//pagetitle (module name - category)
$xoopsTpl->assign('xoops_pagetitle', $xoopsModule->getVar('name') . ' - ' . $thisPageTitle);
//category jump box
$catjumpbox = "<form name='catjumpbox' method='get' action='viewcat.php'>\n" . "  <strong>" . _MD_MYLINKS_CATEGORYC . "</strong>&nbsp;\n" . "  " . $myCatTree->makeSelBox('cid', 'title', ' - ', $cid) . "\n" . "  &nbsp;<input type='submit' value='" . _SUBMIT . "' />\n</form>\n";
$xoopsTpl->assign('mylinksjumpbox', $catjumpbox);
include_once XOOPSMYLINKPATH . '/footer.php';
Example #17
0
     $label_submit = _AM_OLEDRION_ADD;
     $edit = false;
 }
 // Get delivery methods
 $deliveres = $h_oledrion_delivery->getLocationDelivery(new oledrion_parameters(array('limit' => $limit, 'location' => $id)));
 if (empty($deliveres)) {
     oledrion_utils::redirect(_AM_OLEDRION_LOCATION_DELIVERYADD, $baseurl, 5);
 }
 $sform = new XoopsThemeForm($title, 'frmaddlocation', $baseurl);
 $sform->addElement(new XoopsFormHidden('op', 'location'));
 $sform->addElement(new XoopsFormHidden('action', 'save'));
 $sform->addElement(new XoopsFormHidden('location_id', $item->getVar('location_id')));
 $sform->addElement(new XoopsFormText(_AM_OLEDRION_LOCATION_TITLE, 'location_title', 50, 150, $item->getVar('location_title', 'e')), true);
 $location_pid = $h_oledrion_location->getAllPid(new oledrion_parameters());
 $mytree = new XoopsObjectTree($location_pid, 'location_id', 'location_pid');
 $select_pid = $mytree->makeSelBox('location_pid', 'location_title', '-', $item->getVar('location_pid'), true);
 $sform->addElement(new XoopsFormLabel(_AM_OLEDRION_LOCATION_PID, $select_pid), false);
 $product_type = new XoopsFormSelect(_AM_OLEDRION_LOCATION_TYPE, 'location_type', $item->getVar('location_type'));
 $product_type->addOption('location', _AM_OLEDRION_LOCATION_LOCATION);
 $product_type->addOption('parent', _AM_OLEDRION_LOCATION_PARENT);
 $sform->addElement($product_type, true);
 $sform->addElement(new XoopsFormRadioYN(_OLEDRION_ONLINE_HLP, 'location_online', $item->getVar('location_online')), true);
 $delivery_options = new XoopsFormElementTray(_AM_OLEDRION_LOCATION_DELIVERY, '<br />');
 foreach ($deliveres as $delivery) {
     if (isset($delivery['ld_id']) && is_array($delivery['ld_id'])) {
         $delivery_checkbox = new XoopsFormCheckBox('', $delivery['delivery_id'] . '_ld_select', $delivery['ld_id']['delivery_select']);
         $delivery_checkbox->addOption(1, $delivery['delivery_title']);
         $delivery_options->addElement($delivery_checkbox);
         $delivery_options->addElement(new XoopsFormText(_AM_OLEDRION_LOCATION_PRICE, $delivery['delivery_id'] . '_ld_price', 16, 16, $delivery['ld_id']['ld_price']));
         $delivery_options->addElement(new XoopsFormText(_AM_OLEDRION_LOCATION_DELIVERY_TIME, $delivery['delivery_id'] . '_ld_delivery_time', 8, 8, $delivery['ld_id']['ld_delivery_time']));
         $delivery_options->addElement(new XoopsFormHidden($delivery['delivery_id'] . '_ld_id', $delivery['ld_id']['ld_id']));
Example #18
0
 /**
  * @param PublisherCategory $obj
  */
 public function __construct(PublisherCategory $obj)
 {
     $xoops = Xoops::getInstance();
     $publisher = Publisher::getInstance();
     $member_handler = $xoops->getHandlerMember();
     $userGroups = $member_handler->getGroupList();
     parent::__construct(_AM_PUBLISHER_CATEGORY, "form", $xoops->getEnv('PHP_SELF'));
     $this->setExtra('enctype="multipart/form-data"');
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $categories = $publisher->getCategoryHandler()->getObjects($criteria);
     $mytree = new XoopsObjectTree($categories, "categoryid", "parentid");
     $cat_select = $mytree->makeSelBox('parentid', 'name', '--', $obj->getVar('parentid'), true);
     $this->addElement(new Xoops\Form\Label(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $cat_select));
     // Name
     $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $obj->getVar('name', 'e')), true);
     // Description
     $this->addElement(new Xoops\Form\TextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $obj->getVar('description', 'e'), 7, 60));
     // EDITOR
     $groups = $xoops->getUserGroups();
     $gperm_handler = $publisher->getGrouppermHandler();
     $module_id = $publisher->getModule()->mid();
     $allowed_editors = PublisherUtils::getEditors($gperm_handler->getItemIds('editors', $groups, $module_id));
     $nohtml = false;
     if (count($allowed_editors) > 0) {
         $editor = @$_POST['editor'];
         if (!empty($editor)) {
             PublisherUtils::setCookieVar('publisher_editor', $editor);
         } else {
             $editor = PublisherUtils::getCookieVar('publisher_editor');
             if (empty($editor) && $xoops->isUser()) {
                 $editor = $xoops->user->getVar('publisher_editor');
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowed_editors) ? $publisher->getConfig('submit_editor') : $editor;
         $form_editor = new Xoops\Form\SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
         $this->addElement($form_editor);
     } else {
         $editor = $publisher->getConfig('submit_editor');
     }
     $editor_configs = array();
     $editor_configs['rows'] = $publisher->getConfig('submit_editor_rows') == '' ? 35 : $publisher->getConfig('submit_editor_rows');
     $editor_configs['cols'] = $publisher->getConfig('submit_editor_cols') == '' ? 60 : $publisher->getConfig('submit_editor_cols');
     $editor_configs['width'] = $publisher->getConfig('submit_editor_width') == '' ? "100%" : $publisher->getConfig('submit_editor_width');
     $editor_configs['height'] = $publisher->getConfig('submit_editor_height') == '' ? "400px" : $publisher->getConfig('submit_editor_height');
     $editor_configs['name'] = 'header';
     $editor_configs['value'] = $obj->getVar('header', 'e');
     $text_header = new Xoops\Form\Editor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editor_configs, $nohtml, $onfailure = null);
     $text_header->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($text_header);
     // IMAGE
     $image_array = XoopsLists::getImgListAsArray(PublisherUtils::getImageDir('category'));
     $image_select = new Xoops\Form\Select('', 'image', $obj->image());
     //$image_select -> addOption ('-1', '---------------');
     $image_select->addOptionArray($image_array);
     $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
     $image_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $image_tray->addElement($image_select);
     $image_tray->addElement(new Xoops\Form\Label('', "<br /><br /><img src='" . PublisherUtils::getImageDir('category', false) . $obj->image() . "' name='image3' id='image3' alt='' />"));
     $image_tray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($image_tray);
     // IMAGE UPLOAD
     //$max_size = 5000000;
     $file_box = new Xoops\Form\File(_AM_PUBLISHER_IMAGE_UPLOAD, "image_file");
     $file_box->setExtra("size ='45'");
     $file_box->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($file_box);
     // Short url
     $text_short_url = new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $obj->getVar('short_url', 'e'));
     $text_short_url->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($text_short_url);
     // Meta Keywords
     $text_meta_keywords = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $obj->getVar('meta_keywords', 'e'), 7, 60);
     $text_meta_keywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($text_meta_keywords);
     // Meta Description
     $text_meta_description = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $obj->getVar('meta_description', 'e'), 7, 60);
     $text_meta_description->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($text_meta_description);
     // Weight
     $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $obj->getVar('weight')));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new Xoops\Form\Text("Custom template", 'template', 50, 255, $obj->getVar('template', 'e')), false);
     // READ PERMISSIONS
     $groups_read_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_READ, 'groups_read[]', $obj->getGroups_read());
     foreach ($userGroups as $group_id => $group_name) {
         $groups_read_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_read_checkbox);
     // SUBMIT PERMISSIONS
     $groups_submit_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $obj->getGroups_submit());
     $groups_submit_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     foreach ($userGroups as $group_id => $group_name) {
         $groups_submit_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_submit_checkbox);
     // MODERATION PERMISSIONS
     $groups_moderation_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, 'groups_moderation[]', $obj->getGroups_moderation());
     $groups_moderation_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     foreach ($userGroups as $group_id => $group_name) {
         $groups_moderation_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_moderation_checkbox);
     $moderator = new Xoops\Form\SelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $obj->getVar('moderator', 'e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     $cat_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->_subCatsCount; ++$i) {
         if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
             $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
         } else {
             $subname = '';
         }
         $cat_tray->addElement(new Xoops\Form\Text('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new Xoops\Form\Text('', 'nb_subcats', 3, 2);
     $l = new Xoops\Form\Label('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new Xoops\Form\Button('', 'submit_subcats', _AM_PUBLISHER_ADD_OPT_SUBMIT, 'submit');
     if (!$obj->getVar('categoryid')) {
         $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
     } else {
         $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
     }
     $r = new Xoops\Form\ElementTray('');
     $r->addElement($l);
     $r->addElement($b);
     $cat_tray->addElement($r);
     $this->addElement($cat_tray);
     $this->addElement(new Xoops\Form\Hidden('categoryid', $obj->getVar('categoryid')));
     $this->addElement(new Xoops\Form\Hidden('nb_sub_yet', $this->_subCatsCount));
     // Action buttons tray
     $button_tray = new Xoops\Form\ElementTray('', '');
     // No ID for category -- then it's new category, button says 'Create'
     if (!$obj->getVar('categoryid')) {
         $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_CREATE, 'submit'));
         $butt_clear = new Xoops\Form\Button('', '', _AM_PUBLISHER_CLEAR, 'reset');
         $button_tray->addElement($butt_clear);
         $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
         $butt_cancel->setExtra('onclick="history.go(-1)"');
         $button_tray->addElement($butt_cancel);
         $this->addElement($button_tray);
     } else {
         $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_MODIFY, 'submit'));
         $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
         $butt_cancel->setExtra('onclick="history.go(-1)"');
         $button_tray->addElement($butt_cancel);
         $this->addElement($button_tray);
     }
 }
Example #19
0
 /**
  * @param AlumniCategory|XoopsObject $obj
  */
 public function __construct(AlumniCategory &$obj)
 {
     $xoops = Xoops::getInstance();
     $moduleDirName = basename(dirname(__DIR__));
     $admin_lang = '_AM_' . strtoupper($moduleDirName);
     $title = $obj->isNew() ? sprintf(AlumniLocale::ADD_CAT) : sprintf(AlumniLocale::EDIT_CAT);
     parent::__construct($title, 'form', false, 'post', true);
     include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
     $this->setExtra('enctype="multipart/form-data"');
     include_once XOOPS_ROOT_PATH . '/class/tree.php';
     $categoryHandler = $xoops->getModuleHandler('category', 'alumni');
     $arr = $categoryHandler->getall();
     $mytree = new XoopsObjectTree($arr, 'cid', 'pid');
     $this->addElement(new Xoops\Form\Label(AlumniLocale::CATEGORY_PID, $mytree->makeSelBox('pid', 'title', '-', $obj->getVar('pid'), true)));
     $this->addElement(new Xoops\Form\Text(AlumniLocale::CATEGORY_TITLE, 'title', 50, 255, $obj->getVar('title')), true);
     if ($obj->isNew()) {
         $default_img = 'default.gif';
     } else {
         $default_img = str_replace('alumni/', '', $obj->getVar('img', 'e'));
     }
     $img = $obj->getVar("img") ? $obj->getVar("img") : 'default.gif';
     $imgtray_img = new Xoops\Form\ElementTray(AlumniLocale::IMGCAT, '<br />');
     $img_path = \XoopsBaseConfig::get('root-path') . '/modules/alumni/images/cat';
     $imgpath_img = sprintf(AlumniLocale::FORMIMAGE_PATH, $img_path);
     $imageselect_img = new Xoops\Form\Select(sprintf(XoopsLocale::F_FILE_EXISTS_IN, $img_path . '/'), 'img', $img);
     $image_array_img = XoopsLists::getImgListAsArray($img_path);
     $imageselect_img->addOption("{$default_img}", $default_img);
     foreach ($image_array_img as $image_img) {
         $imageselect_img->addOption("{$image_img}", $image_img);
     }
     $alumni_upload_url = \XoopsBaseConfig::get('url') . '/modules/alumni/images/cat';
     $imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"img\", \"\", \"\", \"" . $alumni_upload_url . "\")'");
     $imgtray_img->addElement($imageselect_img, false);
     $imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $alumni_upload_url . "/" . $img . "' name='image_img' id='image_img' alt='' />"));
     $fileseltray_category_img = new Xoops\Form\ElementTray('<br />', '<br />');
     $fileseltray_category_img->addElement(new Xoops\Form\File(AlumniLocale::FORMUPLOAD, "img"), false);
     $fileseltray_category_img->addElement(new Xoops\Form\Label(''), false);
     $imgtray_img->addElement($fileseltray_category_img);
     $this->addElement($imgtray_img);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::ORDER, 'ordre', 4, 4, $obj->getVar('ordre')), false);
     $this->addElement(new Xoops\Form\Label(AlumniLocale::IFSCHOOL, ''));
     $photo_old = $obj->getVar('scphoto') ? $obj->getVar('scphoto') : '';
     $uploadirectory_photo = XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/photos/school_photos";
     $imgtray_photo = new Xoops\Form\ElementTray(AlumniLocale::SCPHOTO, '<br />');
     $imgpath_photo = sprintf(AlumniLocale::FORMIMAGE_PATH, $uploadirectory_photo);
     $fileseltray_photo = new Xoops\Form\ElementTray('', '<br />');
     $fileseltray_photo->addElement(new XoopsFormFile(AlumniLocale::FORMUPLOAD, 'scphoto', $xoops->getModuleConfig('alumni_photomax')), false);
     if ($photo_old) {
         $fileseltray_photo->addElement(new Xoops\Form\Label(AlumniLocale::SELECTED_PHOTO, '<a href="../photos/school_photos/' . $photo_old . '">' . $photo_old . '</a>', false));
         $imgtray_checkbox = new Xoops\Form\Checkbox('', 'del_photo', 0);
         $imgtray_checkbox->addOption(1, AlumniLocale::DELPICT);
         $fileseltray_photo->addElement($imgtray_checkbox);
     }
     $imgtray_photo->addElement($fileseltray_photo);
     $this->addElement($imgtray_photo);
     $this->addElement(new Xoops\Form\Hidden('photo_old', $photo_old));
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCADDRESS, 'scaddress', 50, 255, $obj->getVar('scaddress')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCADDRESS2, 'scaddress2', 50, 255, $obj->getVar('scaddress2')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCCITY, 'sccity', 50, 255, $obj->getVar('sccity')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCSTATE, 'scstate', 50, 255, $obj->getVar('scstate')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCZIP, 'sczip', 50, 255, $obj->getVar('sczip')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCPHONE, 'scphone', 50, 255, $obj->getVar('scphone')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCFAX, 'scfax', 50, 255, $obj->getVar('scfax')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCMOTTO, 'scmotto', 50, 255, $obj->getVar('scmotto')), false);
     $this->addElement(new Xoops\Form\Text(AlumniLocale::SCURL, 'scurl', 50, 255, $obj->getVar('scurl')), false);
     $this->addElement(new Xoops\Form\Hidden('op', 'save_category'));
     $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
 }
Example #20
0
include_once XOOPS_ROOT_PATH . '/modules/news/config.php';
$sform = new XoopsThemeForm(_NW_SUBMITNEWS, "storyform", XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/submit.php');
$sform->setExtra('enctype="multipart/form-data"');
$sform->addElement(new XoopsFormText(_NW_TITLE, 'title', 50, 255, $title), true);
// Topic's selection box
if (!isset($xt)) {
    $xt = new NewsTopic();
}
if ($xt->getAllTopicsCount() == 0) {
    redirect_header("index.php", 4, _NW_POST_SORRY);
    exit;
}
include_once XOOPS_ROOT_PATH . "/class/tree.php";
$allTopics = $xt->getAllTopics($xoopsModuleConfig['restrictindex'], 'news_submit');
$topic_tree = new XoopsObjectTree($allTopics, 'topic_id', 'topic_pid');
$topic_select = $topic_tree->makeSelBox('topic_id', 'topic_title', '-- ', $topicid, false);
$sform->addElement(new XoopsFormLabel(_NW_TOPIC, $topic_select));
//If admin - show admin form
//TODO: Change to "If submit privilege"
if ($approveprivilege) {
    //Show topic image?
    $sform->addElement(new XoopsFormRadioYN(_AM_TOPICDISPLAY, 'topicdisplay', $topicdisplay));
    //Select image position
    $posselect = new XoopsFormSelect(_AM_TOPICALIGN, 'topicalign', $topicalign);
    $posselect->addOption('R', _AM_RIGHT);
    $posselect->addOption('L', _AM_LEFT);
    $sform->addElement($posselect);
    //Publish in home?
    //TODO: Check that pubinhome is 0 = no and 1 = yes (currently vice versa)
    $sform->addElement(new XoopsFormRadioYN(_AM_PUBINHOME, 'ihome', $ihome, _NO, _YES));
}
Example #21
0
 public function createElements()
 {
     include_once dirname(dirname(__DIR__)) . '/include/common.php';
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $myTree = new XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), 'categoryid', 'parentid');
     $catSelect = $myTree->makeSelBox('parentid', 'name', '--', $this->targetObject->parentid(), true);
     $this->addElement(new XoopsFormLabel(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $catSelect));
     // Name
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $this->targetObject->name('e')), true);
     // Description
     $this->addElement(new XoopsFormTextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $this->targetObject->description('e'), 7, 60));
     // EDITOR
     $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
     $gpermHandler =& $this->publisher->getHandler('groupperm');
     $moduleId = $this->publisher->getModule()->mid();
     $allowedEditors = publisherGetEditors($gpermHandler->getItemIds('editors', $groups, $moduleId));
     $nohtml = false;
     if (count($allowedEditors) > 0) {
         $editor = XoopsRequest::getString('editor', '', 'POST');
         if (!empty($editor)) {
             publisherSetCookieVar('publisher_editor', $editor);
         } else {
             $editor = publisherGetCookieVar('publisher_editor');
             if (empty($editor) && is_object($GLOBALS['xoopsUser'])) {
                 $editor = null !== $GLOBALS['xoopsUser']->getVar('publisher_editor') ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : '';
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowedEditors) ? $this->publisher->getConfig('submit_editor') : $editor;
         $formEditor = new XoopsFormSelectEditor($this, 'editor', $editor, $nohtml, $allowedEditors);
         $this->addElement($formEditor);
     } else {
         $editor = $this->publisher->getConfig('submit_editor');
     }
     $editorConfigs = array();
     $editorConfigs['rows'] = $this->publisher->getConfig('submit_editor_rows') == '' ? 35 : $this->publisher->getConfig('submit_editor_rows');
     $editorConfigs['cols'] = $this->publisher->getConfig('submit_editor_cols') == '' ? 60 : $this->publisher->getConfig('submit_editor_cols');
     $editorConfigs['width'] = $this->publisher->getConfig('submit_editor_width') == '' ? '100%' : $this->publisher->getConfig('submit_editor_width');
     $editorConfigs['height'] = $this->publisher->getConfig('submit_editor_height') == '' ? '400px' : $this->publisher->getConfig('submit_editor_height');
     $editorConfigs['name'] = 'header';
     $editorConfigs['value'] = $this->targetObject->header('e');
     $textHeader = new XoopsFormEditor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editorConfigs, $nohtml, $onfailure = null);
     $textHeader->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($textHeader);
     // IMAGE
     $imageArray = XoopsLists::getImgListAsArray(publisherGetImageDir('category'));
     $imageSelect = new XoopsFormSelect('', 'image', $this->targetObject->getImage());
     //$imageSelect -> addOption ('-1', '---------------');
     $imageSelect->addOptionArray($imageArray);
     $imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . XOOPS_URL . "\")'");
     $imageTray = new XoopsFormElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $imageTray->addElement($imageSelect);
     $imageTray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . publisherGetImageDir('category', false) . $this->targetObject->getImage() . "' name='image3' id='image3' alt='' />"));
     $imageTray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($imageTray);
     // IMAGE UPLOAD
     $max_size = 5000000;
     $fileBox = new XoopsFormFile(_AM_PUBLISHER_IMAGE_UPLOAD, 'image_file', $max_size);
     $fileBox->setExtra("size ='45'");
     $fileBox->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($fileBox);
     // Short url
     $textShortUrl = new XoopsFormText(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $this->targetObject->short_url('e'));
     $textShortUrl->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($textShortUrl);
     // Meta Keywords
     $textMetaKeywords = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $this->targetObject->meta_keywords('e'), 7, 60);
     $textMetaKeywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($textMetaKeywords);
     // Meta Description
     $textMetaDescription = new XoopsFormTextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $this->targetObject->meta_description('e'), 7, 60);
     $textMetaDescription->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($textMetaDescription);
     // Weight
     $this->addElement(new XoopsFormText(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $this->targetObject->weight()));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new XoopsFormText('Custom template', 'template', 50, 255, $this->targetObject->template('e')), false);
     // READ PERMISSIONS
     $readPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_READ, '');
     $selectAllReadCheckbox = new XoopsFormCheckBox('', "adminbox", 1);
     $selectAllReadCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllReadCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox\" , \"groupsRead[]\");' ");
     $selectAllReadCheckbox->setClass('xo-checkall');
     $readPermissionsTray->addElement($selectAllReadCheckbox);
     $groupsReadCheckbox = new XoopsFormCheckBox('', 'groupsRead[]', $this->targetObject->getGroupsRead());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsReadCheckbox->addOption($group_id, $group_name);
     }
     $readPermissionsTray->addElement($groupsReadCheckbox);
     $this->addElement($readPermissionsTray);
     // SUBMIT PERMISSIONS
     $submitPermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, '');
     $submitPermissionsTray->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     $selectAllSubmitCheckbox = new XoopsFormCheckBox('', "adminbox2", 1);
     $selectAllSubmitCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllSubmitCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox2\" , \"groupsSubmit[]\");' ");
     $selectAllSubmitCheckbox->setClass('xo-checkall');
     $submitPermissionsTray->addElement($selectAllSubmitCheckbox);
     $groupsSubmitCheckbox = new XoopsFormCheckBox('', 'groupsSubmit[]', $this->targetObject->getGroupsSubmit());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsSubmitCheckbox->addOption($group_id, $group_name);
     }
     $submitPermissionsTray->addElement($groupsSubmitCheckbox);
     $this->addElement($submitPermissionsTray);
     // MODERATION PERMISSIONS
     $moderatePermissionsTray = new XoopsFormElementTray(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, '');
     $moderatePermissionsTray->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     $selectAllModerateCheckbox = new XoopsFormCheckBox('', "adminbox3", 1);
     $selectAllModerateCheckbox->addOption('allbox', _AM_SYSTEM_ALL);
     $selectAllModerateCheckbox->setExtra(" onclick='xoopsCheckGroup(\"form\", \"adminbox3\" , \"groupsModeration[]\");' ");
     $selectAllModerateCheckbox->setClass('xo-checkall');
     $moderatePermissionsTray->addElement($selectAllModerateCheckbox);
     $groupsModerationCheckbox = new XoopsFormCheckBox('', 'groupsModeration[]', $this->targetObject->getGroupsModeration());
     foreach ($this->userGroups as $group_id => $group_name) {
         $groupsModerationCheckbox->addOption($group_id, $group_name);
     }
     $moderatePermissionsTray->addElement($groupsModerationCheckbox);
     $this->addElement($moderatePermissionsTray);
     $moderator = new XoopsFormSelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $this->targetObject->moderator('e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     //SUBCATEGORY
     $catTray = new XoopsFormElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->subCatsCount; ++$i) {
         $subname = '';
         if ($i < (($scname = XoopsRequest::getArray('scname', array(), 'POST')) ? count($scname) : 0)) {
             $temp = XoopsRequest::getArray('scname', array(), 'POST');
             $subname = ($scname = XoopsRequest::getArray('scname', '', 'POST')) ? $temp[$i] : '';
         }
         $catTray->addElement(new XoopsFormText('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new XoopsFormText('', 'nb_subcats', 3, 2);
     $l = new XoopsFormLabel('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new XoopsFormButton('', 'submit_subcats', _AM_PUBLISHER_ADD_OPT_SUBMIT, 'submit');
     if (!$this->targetObject->categoryid()) {
         $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
     } else {
         $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
     }
     $r = new XoopsFormElementTray('');
     $r->addElement($l);
     $r->addElement($b);
     $catTray->addElement($r);
     $this->addElement($catTray);
     $this->addElement(new XoopsFormHidden('categoryid', $this->targetObject->categoryid()));
     $this->addElement(new XoopsFormHidden('nb_sub_yet', $this->subCatsCount));
 }