/** * @desc Muestra el formulario para edición/creación de categorías */ function showForm($edit = 0) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig; define('RMSUBLOCATION', 'newcategory'); if ($edit) { $id = RMHttpRequest::get('id', 'integer', 0); if ($id <= 0) { RMUris::redirect_with_message(__('You had not provided a category ID', 'bxpress'), 'categories.php', RMMSG_WARN); die; } $catego = new bXCategory($id); if ($catego->isNew()) { RMUris::redirect_with_message(__('Specified category does not exists!', 'bxpress'), 'categories.php', RMMSG_ERROR); die; } } $bc = RMBreadCrumb::get(); $bc->add_crumb(__('Categories', 'bxpress'), 'categories.php'); $bc->add_crumb(__('Edit category', 'bxpress')); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'), 'frmCat', 'categories.php'); $form->addElement(new RMFormText(__('Name', 'bxpress'), 'title', 50, 100, $edit ? $catego->title() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'bxpress'), 'friendname', 50, 100, $catego->friendName())); } $form->addElement(new RMFormEditor(__('Description', 'bxpress'), 'desc', '90%', '300px', $edit ? $catego->description() : '')); $form->addElement(new RMFormYesNo(__('Show description', 'bxpress'), 'showdesc', $edit ? $catego->showDesc() : 1)); $form->addElement(new RMFormYesNo(__('Activate', 'bxpress'), 'status', $edit ? $catego->status() : 1)); $form->addElement(new RMFormGroups(__('Groups', 'bxpress'), 'groups', 1, 1, 4, $edit ? $catego->groups() : array(0)), true, 'checked'); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $catego->id())); } $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Submit', 'bxpress'), 'submit', '', true); $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'categories.php\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * @desc Muestra el formulario para edición/creación de categorías */ function showForm($edit = 0) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig; define('RMSUBLOCATION', 'newcategory'); if ($edit) { $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirectMsg('categos.php', __('You had not provided a category ID', 'bxpress'), 1); die; } $catego = new bXCategory($id); if ($catego->isNew()) { redirectMsg('categos.php', __('Specified category does not exists!', 'bxpress'), 1); die; } } bXFunctions::menu_bar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . ($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Category', 'bxpress') : __('New Category', 'bxpress'), 'frmCat', 'categos.php'); $form->addElement(new RMFormText(__('Name', 'bxpress'), 'title', 50, 100, $edit ? $catego->title() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'bxpress'), 'friendname', 50, 100, $catego->friendName())); } $form->addElement(new RMFormEditor(__('Description', 'bxpress'), 'desc', '90%', '300px', $edit ? $catego->description() : '')); $form->addElement(new RMFormYesNo(__('Show description', 'bxpress'), 'showdesc', $edit ? $catego->showDesc() : 1)); $form->addElement(new RMFormYesNo(__('Activate', 'bxpress'), 'status', $edit ? $catego->status() : 1)); $form->addElement(new RMFormGroups(__('Groups', 'bxpress'), 'groups', 1, 1, 4, $edit ? $catego->groups() : array(0)), true, 'checked'); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $catego->id())); } $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Submit', 'bxpress'), 'submit', '', true); $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'categos.php\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }