function editCategoryForm($id=0) { // global $xoopsConfig, $wfsConfig, $modify, $xoopsUser; global $xoopsConfig, $wfsConfig, $xoopsUser; $modify = 0; if ( isset($_POST['modify']) ) { $modify = intval($_POST['modify']); } $xt = new WfsCategory($id); if (!isset($xt->imgurl)) $xt->imgurl = 'blank.gif'; include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; if ($id) { $sform = new XoopsThemeForm(_AM_MODIFYCATEGORY, "op", xoops_getenv('PHP_SELF')); } else { $sform = new XoopsThemeForm(_AM_ADDMCATEGORY, "op", xoops_getenv('PHP_SELF')); } //if ( $xoopsUser->uid() == 1 ) { // if ($modify) { // $sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'editaccess', true, getGroupIda($xt->editaccess), 5, true)); // }else{ // $sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'editaccess', true, true, 5, true)); // } //} if ($modify) { $sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'groupid', true, getGroupIda($xt->groupid), 5, true)); }else{ $sform->addElement(new XoopsFormSelectGroup(_WFS_GROUPPROMPT, 'groupid', true, true, 5, true)); } if (!$modify) $xt->orders = '1'; $sform->addElement(new XoopsFormText(_AM_CATEGORYWEIGHT, 'orders', 10, 80, $xt->orders), false); $sform->addElement(new XoopsFormText(_AM_CATEGORYNAME, 'title', 50, 80, $xt->title()), true); ob_start(); $sform->addElement(new XoopsFormHidden('pid', 0)); if ($id) { $xt->makeSelBox(1, $xt->pid(), "pid"); }else{ $xt->makeSelBox(1, 0, "pid"); } if ($id) { $sform->addElement(new XoopsFormLabel(_AM_MOVETO, ob_get_contents())); }else{ $sform->addElement(new XoopsFormLabel(_AM_IN, ob_get_contents())); } ob_end_clean(); $graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/".$wfsConfig['sgraphicspath']); $indeximage_select = new XoopsFormSelect('', 'indeximage', $xt->imgurl); $indeximage_select->addOptionArray($graph_array); // Section Image can't display // $indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"".$wfsConfig['sgraphicspath']."\", \"\")'"); $xoops_url = $xoopsConfig['xoops_url']; $indeximage_select->setExtra("onchange='showImgSelected(\"image\",\"indeximage\", \"".$wfsConfig['sgraphicspath']."\",\"\", \"$xoops_url\")'"); $indeximage_tray = new XoopsFormElementTray(_AM_CATEGORYIMG, ' '); $indeximage_tray->addElement($indeximage_select); $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='".$xoopsConfig['xoops_url']."/". $wfsConfig['sgraphicspath']."/".$xt->imgurl."' name='image' id='image' alt='' />" )); $sform->addElement($indeximage_tray); if (!isset($xt->displayimg)) $xt->displayimg = '0'; $submenus_radio = new XoopsFormRadioYN(_AM_SHOWCATEGORYIMG, 'displayimg', $xt->displayimg, ' Yes', ' No'); $sform->addElement($submenus_radio); $sform->addElement(new XoopsFormTextArea(_AM_CATEGORYDESC, 'description', $xt->description("E")), false); $sform->addElement(new XoopsFormDhtmlTextArea(_WFS_CATEGORYHEAD, 'catdescription', $xt->catdescription("E"), 10, 60), false); $sform->addElement(new XoopsFormTextArea(_WFS_CATEGORYFOOT, 'catfooter', $xt->catfooter("E"), 10, 60), false); $button_tray = new XoopsFormElementTray('',''); if ($id) { $button_tray->addElement(new XoopsFormHidden('id', $id)); $button_tray->addElement(new XoopsFormButton('', 'save', _AM_SAVECHANGE, 'submit')); $button_tray->addElement(new XoopsFormButton('', 'delete', _AM_DEL, 'submit')); } else { $button_tray->addElement(new XoopsFormButton('', 'save', _AM_ADD, 'submit')); } $sform->addElement($button_tray); $sform->display(); }