/** * @desc Formulario de licencias **/ function formLicences($edit = 0) { global $xoopsModule; $id = rmc_server_var($_REQUEST, 'id', 0); if ($edit) { //Verificamos si la licencia es válida if ($id <= 0) { redirectMsg('licenses.php', __('You must provide a valid licencse ID!', 'dtransport'), 1); die; } //Verificamos si la licencia existe $lc = new DTLicense($id); if ($lc->isNew()) { redirectMsg('licenses.php', __('Specified licence ID does not exists!', 'dtransport'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . ($edit ? __('Edit Licence', 'dtransport') : __('New Licence', 'dtransport'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Licence', 'dtransport') : __('New Licence', 'dtransport'), 'frmlic', 'licenses.php'); $form->addElement(new RMFormText(__('Licence name', 'dtransport'), 'name', 50, 150, $edit ? $lc->name() : ''), true); $form->addElement(new RMFormText(__('Licence reference URL', 'dtransport'), 'url', 50, 255, $edit ? $lc->link() : '')); $ele = new RMFormSelect(__('Licence type', 'dtranport'), 'type'); $ele->addOption(0, __('Open source licence', 'dtransport'), $edit ? $lc->type() == 0 ? 1 : 0 : 0); $ele->addOption(1, __('Restrictive licence', 'dtranport'), $edit ? $lc->type() == 1 ? 1 : 0 : 0); $form->addElement($ele); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Save Changes', 'dtransport'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'stransport'), 'button', 'onclick="window.location=\'licenses.php\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
function categoriesForm($edit = 0) { global $db, $xoopsModule; if ($edit) { $id = TCFunctions::get('id'); if ($id <= 0) { redirectMsg('cats.php', __('¡El ID proporcionado no es válido!'), 1); die; } $cat = new TCCategory($id); if ($cat->isNew()) { redirectMsg('cats.php', __('No existe la categoría especificada'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./cats.php'>" . __('Administración de Categorías', 'admin_team') . "</a> » " . ($edit ? __('Editar Categoría', 'admin_team') : __('Crear Categoría', 'admin_team'))); xoops_cp_header(); $form = new RMForm($edit ? __('Editar Categoría', 'admin_team') : __('Crear Categoría', 'admin_team'), 'frmNew', 'cats.php'); $form->oddClass('oddForm'); $form->addElement(new RMFormText(__('Nombre', 'admin_team'), 'name', 50, 100, $edit ? $cat->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 100, $cat->nameId())); } $form->addElement(new RMFormTextArea(__('Descripción', 'admin_team'), 'desc', 5, 45, $edit ? $cat->getVar('desc') : '')); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Guardar Cambios', 'admin_team') : __('Crear Categoría', 'admin_team'), 'submit'); $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'cats.php\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->display(); xoops_cp_footer(); }
function formCoachs($edit = 0) { global $xoopsModule, $db, $mc, $xoopsConfig; if ($edit) { $id = TCFunctions::get('id'); if ($id <= 0) { redirectMsg('coachs.php', __('Id no válido', 'admin_team'), 1); die; } $coach = new TCCoach($id); if ($coach->isNew()) { redirectMsg('coachs.php', __('El entrenador especificado no existe', 'admin_team'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./coachs.php'>" . __('Entrenadores', 'admin_team') . "</a> » " . ($edit ? __('Editar entrenador', 'admin_team') : __('Crear entrenador', 'admin_team'))); $cHead = '<link href="' . TC_URL . '/styles/admin.css" media="all" rel="stylesheet" type="text/css" />'; xoops_cp_header($cHead); $form = new RMForm($edit ? __('Editar Entrenador', 'admin_team') : __('Crear Entrenador', 'admin_team'), 'frmNew', 'coachs.php', 'post'); $form->oddClass('oddForm'); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new RMFormText(__('Nombre', 'admin_team'), 'name', 50, 150, $edit ? $coach->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 150, $coach->nameId())); } $form->addElement(new RMFormText(__('Cargo', 'admin_team'), 'role', 50, 150, $edit ? $coach->role() : ''), true); $form->addElement(new RMFormFile(__('Imagen', 'admin_team'), 'image', 45, $mc['filesize'] * 1024)); if ($edit && $coach->image() != '') { $form->addElement(new RMFormLabel(__('Imagen actual', 'admin_team'), "<img src='" . XOOPS_URL . "/uploads/teams/coachs/ths/" . $coach->image() . "' alt='' />")); } $form->addElement(new RMFormEditor(__('Biografía', 'admin_team'), 'bio', '90%', '300px', $edit ? $coach->bio('e') : '')); $form->addElement(new RMFormSubTitle(__('Equipos', 'admin_team'), 1)); $ele = new RMFormCheck(__('Seleccionar equipos', 'admin_team')); $ele->asTable(3); $sql = "SELECT * FROM " . $db->prefix("coach_teams") . " ORDER BY name"; $result = $db->query($sql); if ($edit) { $teams = $coach->teams(false); } while ($row = $db->fetchArray($result)) { $team = new TCTeam(); $team->assignVars($row); $cat =& $team->category(true); $ele->addOption($team->name() . " <span class='coachNameCat'>(" . $cat->name() . ")</span>", 'teams[]', $team->id(), $edit ? in_array($team->id(), $teams) ? 1 : 0 : 0); } $form->addElement($ele); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Enviar', 'admin_team'), 'submit'); $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'coachs.php\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de creación/edición de Tipos de cliente **/ function formTypes($edit = 0) { global $tpl, $xoopsModule; $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; if ($edit) { //Verificamos si nos proporcionaron al menos un tipo para editar if (!is_array($ids)) { redirectMsg('./types.php', __('You must provide a type ID at least', 'works'), 1); die; } if (!is_array($ids)) { $ids = array($ids); } } PWFunctions::toolbar(); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » <a href='./types.php'>" . __('Customer types', 'works') . "</a> » " . ($edit ? __('Edit type', 'works') : __('New type', 'works'))); RMTemplate::get()->assign('xoops_pagetitle', __('Add Customers types', 'works')); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Type', 'works') : __('New Type', 'works'), 'frmtype', 'types.php'); $num = 10; if ($edit) { foreach ($ids as $k) { //Verificamos si el tipo es válido if ($k <= 0) { continue; } //Verificamos si el tipo existe $type = new PWType($k); if ($type->isNew()) { continue; } $form->addElement(new RMFormText(__('Type name', 'works'), 'type[' . $type->id() . ']', 50, 100, $edit ? $type->type() : '')); } } else { for ($i = 1; $i <= $num; $i++) { $form->addElement(new RMFormText(__('Type name', 'works'), 'type[' . $i . ']', 50, 100, $edit ? '' : '')); } } $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes', 'works') : __('Save Customer Types', 'works'), 'submit'); $ele->addButton('cancel', __('Cancel', 'works'), 'button', 'onclick="window.location=\'types.php\';"'); $form->addElement($ele); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de Logs **/ function dt_form_logs($edit = 0) { global $xoopsModule, $xoopsConfig; define('RMCSUBLOCATION', 'newlog'); $id = rmc_server_var($_GET, 'id', 0); $item = rmc_server_var($_GET, 'item', 0); //Verificamos si el software es válido if ($item <= 0) { redirectMsg('items.php', __('Download item ID has not been provided!', 'dtransport'), RMMSG_WARN); } //Verificamos si existe el software $sw = new DTSoftware($item); if ($sw->isNew()) { redirectMsg('items.php', __('Specified download item does not exists!', 'dtransport'), 1); } if ($edit) { //Verificamos si log es válido if ($id <= 0) { redirectMsg('logs.php?item=' . $item, __('Log item ID has not been provided!', 'dtransport'), RMMSG_WARN); } //Verificamos si log existe $log = new DTLog($id); if ($log->isNew()) { redirectMsg('logs.php?item=' . $item, __('Specified item log does not exists!', 'dtranport'), 1); } } $dtf = new DTFunctions(); $dtf->toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./items.php'>" . sprintf(__('"%s" Logs', 'dtransport'), $sw->getVar('name')) . "</a> » " . ($edit ? __('Edit Log', 'dtransport') : __('New Log', 'dtransport'))); xoops_cp_header(); $form = new RMForm($edit ? sprintf(__('Edit Change Log of "%s"', 'dtransport'), $sw->getVar('name')) : sprintf(__('New Log for "%s"', 'dtransport'), $sw->getVar('name')), 'frmlog', 'logs.php'); $form->addElement(new RMFormLabel(__('Download Item', 'dtransport'), $sw->getVar('name'))); $form->addElement(new RMFormText(__('Log title', 'dtransport'), 'title', 50, 100, $edit ? $log->title() : ''), true); $form->addElement(new RMFormEditor(__('Log content', 'dtransport'), 'log', '90%', '350px', $edit ? $log->getVar('log', 'e') : ''), true); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('item', $item)); $form->addElement(new RMFormHidden('id', $id)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', _SUBMIT, 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'logs.php?item=' . $item . '\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de creación/edición de categorías **/ function formCategos($edit = 0) { global $xoopsModule, $db; $id = rmc_server_var($_GET, 'id', 0); if ($edit) { //Verificamos si categoría es válida if ($id <= 0) { redirectMsg('categories.php', __('Specified category is not valid!', 'dtransport'), 1); } //Verificamos si la categoría existe $cat = new DTCategory($id); if ($cat->isNew()) { redirectMsg('categories.php', __('Specified category does not exists!', 'dtransport'), 1); } } DTFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . ($edit ? __('Edit category', 'dtransport') : __('New category', 'dtransport'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Category', 'dtransport') : __('New Category', 'dtransport'), 'frmcat', 'categories.php'); $form->addElement(new RMFormText(__('Category name', 'dtransport'), 'name', 50, 150, $edit ? $cat->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Category short name', 'dtransport'), 'nameid', 50, 150, $edit ? $cat->nameId() : '')); } $form->addElement(new RMFormTextArea(__('Description', 'dtransport'), 'desc', 5, 40, $edit ? $cat->desc('e') : '')); //Lista de categorías $ele = new RMFormSelect(__('Root category', 'dtransport'), 'parent'); $ele->addOption(0, __('Select category...', 'dtransport')); $categos = array(); DTFunctions::getCategos($categos, 0, 0, $edit ? $cat->id() : array()); foreach ($categos as $catego) { $ele->addOption($catego['id_cat'], str_repeat('--', $catego['jumps']) . ' ' . $catego['name'], $edit ? $catego['id_cat'] == $cat->parent() ? 1 : 0 : 0); } $form->addElement($ele); $form->addElement(new RMFormYesno(__('Active category', 'dtransport'), 'active', $edit ? $cat->active() : 1)); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Submit', 'dtransport'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'dtransport'), 'button', 'onclick="window.location=\'categories.php\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * Presenta un formulario para la creación de una nueva * categoría para los artículos */ function newForm($edit = 0) { global $xoopsModule; if ($edit) { $id = isset($_GET['id']) ? $_GET['id'] : 0; if ($id <= 0) { redirectMsg('cats.php', __('You must provide a category ID to edit!', 'qpages'), 1); die; } // Cargamos la categoría $catego = new QPCategory($id); // Si no existe entonces devolvemos un error if ($catego->isNew()) { redirectMsg('cats.php', __('Specified category does not exists!', 'qpages'), 1); die; } } xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> » ' . ($edit ? __('Edit Category', 'qpages') : __('New Category', 'qpages'))); xoops_cp_header(); $cats = array(); qpArrayCategos($cats, 0, 0, $edit ? array($id) : 0); $form = new RMForm($edit ? __('Edit Category', 'qpages') : __('New Category', 'qpages'), 'frmNew', 'cats.php'); $form->addElement(new RMFormText(__('Category name', 'qpages'), 'nombre', 50, 150, $edit ? $catego->getName() : ''), true); $form->addElement(new RMFormTextArea(__('Description', 'qpages'), 'descripcion', 5, 45, $edit ? $catego->getVar('descripcion', 'e') : '')); $ele = new RMFormSelect(__('Category parent', 'qpages'), 'parent'); $ele->addOption(0, _SELECT, $edit ? $catego->getParent() == 0 ? 1 : 0 : 1); foreach ($cats as $k) { $ele->addOption($k['id_cat'], str_repeat("-", $k['saltos']) . ' ' . $k['nombre'], $edit ? $catego->getParent() == $k['id_cat'] ? 1 : 0 : 0); } $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $ele = new RMFormButtonGroup('', ' '); $ele->addButton('sbt', $edit ? __('Update Category', 'qpages') : __('Create Category', 'qpages'), 'submit'); $ele->addButton('cancel', __('Cancel', 'qpages'), 'button'); $ele->setExtra('cancel', "onclick='history.go(-1);'"); $form->addElement($ele); $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 = 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(); }
/** * @desc Permitirá al administrador elegir los temas que serán * eliminados despues de un cierto período **/ function prune() { global $xoopsModule; xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Prune Posts', 'bxpress')); xoops_cp_header(); bXFunctions::menu_bar(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $form = new RMForm(__('Prune Posts', 'bxpress'), 'frmprune', 'prune.php'); //Lista de foros $ele = new RMFormSelect(__('Prune from forum', 'bxpress'), 'forums'); $ele->addOption('', __('Select option...', 'bxpress')); $ele->addOption(0, __('All forums', 'bxpress')); $sql = "SELECT id_forum,name FROM " . $db->prefix('bxpress_forums'); $result = $db->queryF($sql); while ($row = $db->fetchArray($result)) { $ele->addOption($row['id_forum'], $row['name']); } $form->addElement($ele, true); //Dias de antigüedad de temas $days = new RMFormText(__('Days old', 'bxpress'), 'days', 3, 3, 30); $days->setDescription(__('Delete topics older than these days', 'bxpress')); $form->addElement($days, true); //Lista de opciones para purgar temas $opc = new RMFormSelect(__('Topics to delete', 'bxpress'), 'option'); $opc->addOption('', __('Select option', 'bxpress')); $opc->addOption(1, __('All topics', 'bxpress')); $opc->addOption(2, __('Unanswered Topics', 'bxpress')); $form->addElement($opc, true); //Temas fijos $form->addElement(new RMFormYesno(__('Delete Sticky Topics', 'bxpress'), 'fixed')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Prune Now!'), 'submit', 'onclick="return confirm(\'' . __('Do you really wish to delete the topics? \\nThis action will delete the data permanently.', 'bxpress') . '\');"'); $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1);"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'deltopics')); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario para la creación de una nueva publicación **/ function formPublish() { global $xoopsModuleConfig, $xoopsUser, $xoopsTpl, $xoopsConfig; include 'header.php'; //Verificamos si existen permisos para crear un nuevo recurso if (!$xoopsModuleConfig['createres']) { redirect_header(RDFunctions::url(), 1, __('The creation of new Documents has been disabled by administrator.', 'docs')); die; } //Verificamos si usuario tiene permisos de crear nuevo recurso $res = new RDResource(); if (!RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS))) { redirect_header(RDFunctions::url(), 1, __('You can not create Documents.', 'docs')); die; } $xoopsTpl->assign('xoops_pagetitle', __('Create Document', 'docs')); $form = new RMForm(__('Create Document', 'docs'), 'frmres', RMFunctions::current_url()); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Document title', 'docs'), 'title', 50, 150), true); $form->addElement(new RMFormTextArea(__('Description', 'docs'), 'desc', 5, 50), true); //editores de la publicación $form->addElement(new RMFormUser(__('Editors', 'docs'), 'editors', 1, $xoopsUser ? array($xoopsUser->uid()) : array(), 30)); //Grupos con permiso de acceso $form->addElement(new RMFormGroups(__('Groups that can read Document', 'docs'), 'groups', 1, 1, 1, array(1, 2)), true); $form->addElement(new RMFormYesno(__('Quick index', 'docs'), 'quick')); $form->addElement(new RMFormYesno(__('Show index to restricted users', 'docs'), 'showindex')); $form->addElement(new RMFormYesno(__('Show content in a single page', 'docs'), 'single')); $form->addElement(new RMFormLabel(__('Approved', 'docs'), $xoopsModuleConfig['approved'] ? __('Inmediatly', 'docs') : __('Wait for approval', 'docs'))); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Publish Document'), 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="history.go(-1);"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'save')); $form->display(); RMTemplate::get()->add_style('forms.css', 'docs'); include 'footer.php'; }
/** * @desc Formulario de Pantallass **/ function formScreens($edit = 0) { global $xoopsModule, $xoopsConfig, $db, $xoopsModuleConfig; $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $item = isset($_REQUEST['item']) ? intval($_REQUEST['item']) : 0; //Verificamos que el software sea válido if ($item <= 0) { redirectMsg('./screens.php', _AS_DT_ERR_ITEMVALID, 1); die; } //Verificamos que el software exista $sw = new DTSoftware($item); if ($sw->isNew()) { redirectMsg('./screens.php', _AS_DT_ERR_ITEMEXIST, 1); die; } //Verificamos el limite de pantallas a almacenar if ($xoopsModuleConfig['limit_screen'] <= $sw->getVar('screens')) { redirectMsg('./screens.php?item=' . $item, _AS_DT_ERRCOUNT, 1); die; } if ($edit) { //Verificamos si pantalla es válida if ($id <= 0) { redirectMsg('./screens.php?item=' . $item, _AS_DT_ERR_SCVALID, 1); // die; } //Verificamos que la pantalla exista $sc = new DTScreenshot($id); if ($sc->isNew()) { redirectMsg('./screens.php?item=' . $item, _AS_DT_ERR_SCEXIST, 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./items.php'>" . _AS_DT_SW . "</a> » " . ($edit ? _AS_DT_EDITSCREEN : _AS_DT_NEWSCREEN)); xoops_cp_header(); $form = new RMForm($edit ? sprintf(_AS_DT_EDITSCREENS, $sw->getVar('name')) : sprintf(_AS_DT_NEWSCREENS, $sw->getVar('name')), 'frmscreen', 'screens.php'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormLabel(_AS_DT_ITEM, $sw->getVar('name'))); $form->addElement(new RMFormText(_AS_DT_TITLE, 'title', 50, 100, $edit ? $sc->title() : ''), true); $form->addElement(new RMFormEditor(_AS_DT_DESC, 'desc', '100%', '100px', $edit ? $sc->desc() : '', 'textarea')); $form->addElement(new RMFormFile(_AS_DT_IMAGE, 'image', 45, $xoopsModuleConfig['image'] * 1024), $edit ? '' : true); if ($edit) { $img = "<img src='" . XOOPS_URL . "/uploads/dtransport/ths/" . $sc->image() . "' border='0' />"; $form->addElement(new RMFormLabel(_AS_DT_IMAGEACT, $img)); } $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('item', $item)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', _SUBMIT, 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'screens.php?item=' . $item . '\';"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * desc Edita Referencias **/ function rd_edit_note() { global $xoopsModule; RMTemplate::get()->assign('xoops_pagetitle', __('Editing Note', 'docs')); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Editing Note', 'docs')); xoops_cp_header(); $id = rmc_server_var($_GET, 'id', 0); $id_res = rmc_server_var($_GET, 'res', 0); if ($id_res <= 0) { redirectMsg('./notes.php', __('Document not specified', 'docs'), 1); die; } $res = new RDResource($id_res); if ($res->isNew()) { redirectMsg('./notes.php', __('Specified Document does not exists!', 'docs'), 1); die; } if ($id <= 0) { redirectMsg('./notes.php?res=' . $res, __('Note not specified', 'docs'), 1); die; } //Verifica que referencia exista $ref = new RDReference($id); if ($ref->isNew()) { redirectMsg('./notes.php?res=' . $res, __('Specified note does not exists!', 'docs'), 1); die; } //Formulario $form = new RMForm(__('Edit Note', 'docs'), 'frmref', 'notes.php'); $form->addElement(new RMFormText(__('Title', 'docs'), 'title', 50, 150, $ref->getVar('title')), true); $form->addElement(new RMFormTextArea(__('Content', 'docs'), 'reference', 5, 50, $ref->getVar('text', 'e')), true); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Save Changes', 'docs'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'notes.php?res=' . $res . '\';"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'saveedit')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('res', $id_res)); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de creación/edición de imágenes **/ function formImages($edit = 0) { global $xoopsModule, $mc, $xoopsUser, $db; $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 10; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $owner = isset($_REQUEST['owner']) ? $_REQUEST['owner'] : ''; $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'; $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 0; $ruta = "page={$page}&limit={$limit}&search={$search}&owner={$owner}&sort={$sort}&mode={$mode}"; if ($edit) { //Verificamos si la imagen es válida if ($id <= 0) { redirectMsg('./images.php?' . $ruta, __('Image ID not valid!', 'galleries'), 1); die; } //Verificamos si la imagen existe $img = new GSImage($id); if ($img->isNew()) { redirectMsg('./images.php?' . $ruta, __('Specified image does not exists!', 'galleries'), 1); die; } } GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./images.php'>" . __('Images', 'galleries') . "</a> » " . ($edit ? __('Edit image', 'galleries') : __('Add image', 'galleries'))); xoops_cp_header(); $form = new RMForm($edit ? __('Editing image', 'galleries') : __('Add image', 'galleries'), 'frmimg', 'images.php'); $form->setExtra("enctype='multipart/form-data'"); if (!$edit) { $ele = new RMFormUser(__('User', 'galleries'), 'uid', 0, $uid ? array($uid) : ($edit ? array($img->owner()) : array($xoopsUser->uid())), 50); $ele->onChange("\$('op').value='" . ($edit ? 'edit' : 'new') . "'; \$('frmimg').submit();"); $form->addElement($ele); } else { $xu = new XoopsUser($img->owner()); $form->addElement(new RMFormLabel(__('User', 'galleries'), $xu->uname())); $form->addElement(new RMFormHidden('uid', $img->owner())); } $form->addElement(new RMFormText(__('Title', 'galleries'), 'title', 50, 100, $edit ? $img->title() : '')); $form->addElement(new RMFormFile(__('Image file', 'galleries'), 'image', 45, $mc['size_image'] * 1024)); if ($edit) { $user = new GSUser($img->owner(), 1); $url = $user->filesURL(); $form->addElement(new RMFormLabel(__('Current image', 'galleries'), "<img src='" . $url . "/ths/" . $img->image() . "' />")); } $form->addElement(new RMFormTextArea(__('Description', 'galleries'), 'desc', 4, 50, $edit ? $img->desc() : '')); $ele = new RMFormSelect(__('Privacy', 'galleries'), 'public'); $ele->addOption(0, __('Private', 'galleries'), $edit ? $img->isPublic() == 0 ? 1 : 0 : 0); $ele->addOption(1, __('Visible for friends', 'galleries'), $edit ? $img->isPublic() == 1 ? 1 : 0 : 0); $ele->addOption(2, __('Visible for all', 'galleries'), $edit ? $img->isPublic() == 2 ? 1 : 0 : 1); $form->addElement($ele, true); $db = Database::getInstance(); //Albumes if ($edit) { $albums = $img->sets(false); foreach ($albums as $k => $v) { $sets[] = $v['id_set']; } } $ele = new RMFormSelect(__('Albums', 'galleries'), 'albums[]', 1, $edit ? $sets : ''); $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . ($uid ? $uid : ($edit ? $img->owner() : $xoopsUser->uid())) . "'"; $result = $db->query($sql); while ($rows = $db->fetchArray($result)) { $ele->addOption($rows['id_set'], $rows['title']); } $form->addElement($ele); $ele = new RMFormText(__('Tags', 'galleries'), 'tags', 50, 100, $edit ? implode(", ", $img->tags(false, 'tag')) : ''); $ele->setDescription(__('Separate each tag with a comma (,)', 'galleries')); $form->addElement($ele, true); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('limit', $limit)); $form->addElement(new RMFormHidden('search', $search)); $form->addElement(new RMFormHidden('owner', $owner)); $form->addElement(new RMFormHidden('sort', $sort)); $form->addElement(new RMFormHidden('mode', $mode)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save changes', 'galleries') : __('Add image', 'galleries'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'images.php?' . $ruta . '\'"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * Presenta un formulario para la creación de una nueva * categoría para los artículos */ function newForm() { global $xoopsModule; $id = isset($_GET['id']) ? $_GET['id'] : 0; if ($id <= 0) { redirectMsg('categories.php', __('You must specify a valid category', 'mywords'), 1); die; } // Cargamos la categoría $catego = new MWCategory($id); // Si no existe entonces devolvemos un error if ($catego->isNew()) { redirectMsg('cats.php', __('Specified category not exists!', 'mywords'), 1); die; } MWFunctions::include_required_files(); xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> » ' . __('New Category', 'mywords')); xoops_cp_header(); $cats = array(); MWFunctions::categos_list($cats, 0, 0, true, $id); $form = new RMForm($edit ? __('Edit Category', 'mywords') : __('Edit Category', 'mywords'), 'frmNew', 'categories.php'); $form->styles('width: 30%;', 'odd'); $form->addElement(new RMFormText(__('Category name', 'mywords'), 'name', 50, 150, $catego->getVar('name')), true); $form->addElement(new RMFormText(__('Category slug', 'mywords'), 'shortname', '', '150', $catego->getVar('shortname', 'n'))); $form->addElement(new RMFormTextArea(__('Category description', 'mywords'), 'desc', 5, 45, $catego->getVar('description', 'e'))); $ele = new RMFormSelect(__('Category Parent', 'mywords'), 'parent'); $ele->addOption(0, _SELECT, $catego->getVar('parent') == 0 ? 1 : 0); foreach ($cats as $k) { $ele->addOption($k['id_cat'], str_repeat("-", $k['indent']) . ' ' . $k['name'], $catego->getVar('parent') == $k['id_cat'] ? 1 : 0); } $form->addElement($ele); $form->addElement(new RMFormHidden('op', 'saveedit')); $form->addElement(new RMFormHidden('id', $id)); $ele = new RMFormButtonGroup('', ' '); $ele->addButton('sbt', __('Update Category', 'mywords'), 'submit'); $ele->addButton('cancel', __('Cancel', 'mywords'), 'button'); $ele->setExtra('cancel', "onclick='history.go(-1);'"); $form->addElement($ele); $form->display(); xoops_cp_footer(); }
/** * @desc Visualiza lista de usuarios para determinar moderadores **/ function bx_moderators() { global $xoopsModule; $id = rmc_server_var($_REQUEST, 'id', 0); if ($id <= 0) { redirectMsg('forums.php', __('No forum ID has been provided!', 'bxpress'), 1); die; } $forum = new bXForum($id); if ($forum->isNew()) { redirectMsg('forums.php', __('Specified forum does not exists!', 'bxpress'), 1); break; } RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/foros/standalone/1/#moderadores'); xoops_cp_header(); //Lista de usuarios $form = new RMForm(sprintf(__('Forum "%s" Moderators', 'bxpress'), $forum->name()), 'formmdt', 'forums.php'); $form->addElement(new RMFormUser(__('Moderators', 'bxpress'), 'users', 1, $forum->moderators(), 30), true, 'checked'); $form->element('users')->setDescription(__('Choose from the list the moderators users', 'bxpress')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Save Moderators', 'bxpress'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location.href=\'forums.php\';"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'savemoderat')); $form->addElement(new RMFormHidden('id', $id)); $form->display(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('forum Moderators', 'bxpress')); xoops_cp_footer(); }
function formPlayer($edit = 0) { global $xoopsModule, $mc, $xoopsConfig, $rmc_config; $idteam = TCFunctions::request('team'); if ($idteam <= 0) { redirectMsg('teams.php', __('Selecciona un equipo antes de crear jugadores', 'admin_team'), 1); die; } $team = new TCTeam($idteam); if ($team->isNew()) { redirectMsg('teams.php', __('El equipo seleccionado no existe', 'admin_team'), 1); die; } if ($edit) { $id = TCFunctions::get('id'); if ($id <= 0) { redirectMsg('players.php?team=' . $idteam, __('El id del jugador no es válido', 'admin_team'), 1); die; } $player = new TCPlayer($id); if ($player->isNew()) { redirectMsg('players.php?team=' . $isteam, __('El jugador seleccionado no existe', 'admin_team'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./players.php?team={$idteam}'>" . __('Jugadores', 'admin_team') . "</a> » " . ($edit ? __('Editar jugador', 'admin_team') : __('Crear jugador', 'admin_team'))); xoops_cp_header(); $form = new RMForm($edit ? __('Editar Jugador', 'admin_team') : __('Crear Jugador', 'admin_team'), 'frmNew', 'players.php'); $form->oddClass('oddForm'); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new RMFormLabel(__('Equipo', 'admin_team'), "<h2 style='margin: 0;'>" . $team->name() . "</h2>")); $form->addElement(new RMFormText(__('Nombre del jugador'), 'name', 50, 100, $edit ? $player->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 100, $player->nameId())); } $ele = new RMFormDate(__('Fecha de nacimiento', 'admin_team'), 'birth', $edit ? $player->birth() : null); $form->addElement($ele); $form->addElement(new RMFormText(__('Número', 'admin_team'), 'number', 5, 3, $edit ? $player->number() : ''), true, 'num'); $form->addElement(new RMFormFile(__('Imagen', 'admin_team'), 'image', 45)); if ($edit && $player->image() != '') { $form->addElement(new RMFormLabel(__('Imagen actual', 'admin_team'), "<img src='" . XOOPS_URL . "/uploads/teams/players/ths/" . $player->image() . "' alt='' />")); } $form->addElement(new RMFormEditor(__('Información', 'admin_team'), 'bio', '90%', '300px', $edit ? $player->bio('e') : '')); if ($edit) { $html = $player->getVar('dohtml'); $xcode = $player->getVar('doxcode'); $doimage = $player->getVar('doimage'); $smiley = $player->getVar('dosmiley'); $br = $player->getVar('dobr'); } else { $html = $rmc_config['editor_type'] == 'tiny' ? 1 : 0; $xcode = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; $doimage = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; $smiley = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; $br = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; } $form->addElement(new RMFormTextOptions(__('Opciones', 'admin_team'), $html, $xcode, $doimage, $smiley, $br)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Enviar', 'admin_team'), 'submit'); $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'players.php?team=' . $team->id() . '\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->addElement(new RMFormHidden('team', $idteam)); $form->display(); xoops_cp_footer(); }
/** * Formulario para crear publicaciones **/ function rd_show_form($edit = 0) { global $xoopsModule, $xoopsConfig, $xoopsModuleConfig; RDFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . ($edit ? __('Editing Document', 'docs') : __('Create Document', 'docs'))); xoops_cp_header(); $id = rmc_server_var($_GET, 'id', 0); $page = rmc_server_var($_GET, 'page', 1); if ($edit) { //Comprueba si la publicación es válida if ($id <= 0) { redirectMsg('./resources.php?page=' . $page, __('You must provide an ID from some Document to edit!', 'docs'), 1); die; } //Comprueba si la publicación existe $res = new RDResource($id); if ($res->isNew()) { redirectMsg('./resources.php?page=' . $page, __('Specified Document does not exists!', 'docs'), 1); die; } } $form = new RMForm($edit ? sprintf(__('Edit Document: %s', 'docs'), $res->getVar('title')) : __('New Document', 'docs'), 'frmres', 'resources.php'); $form->addElement(new RMFormText(__('Document title', 'docs'), 'title', 50, 150, $edit ? $res->getVar('title') : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Document slug', 'docs'), 'nameid', 50, 150, $res->getVar('nameid'))); } $form->addElement(new RMFormTextArea(__('Description', 'docs'), 'desc', 5, 50, $edit ? $res->getVar('description', 'e') : ''), true); $form->addElement(new RMFormUser(__('Editors', 'docs'), 'editors', 1, $edit ? $res->getVar('editors') : '', 30)); //Propietario de la publicacion if ($edit) { $form->addElement(new RMFormUser(__('Document owner', 'docs'), 'owner', 0, $edit ? array($res->getVar('owner')) : '', 30)); } $form->addElement(new RMFormYesno(__('Approve content and changes by editors', 'docs'), 'approvededit', $edit ? $res->getVar('editor_approve') : 0)); $form->addElement(new RMFormGroups(__('Groups that can see this Document', 'docs'), 'groups', 1, 1, 5, $edit ? $res->getVar('groups') : array(1, 2)), true); $form->addElement(new RMFormYesno(__('Set as public', 'docs', 'docs'), 'public', $edit ? $res->getVar('public') : 0)); $form->addElement(new RMFormYesNo(__('Quick index', 'docs'), 'quick', $edit ? $res->getVar('quick') : 0)); //Mostrar índice a usuarios sin permiso de publicación $form->addElement(new RMFormYesno(__('Show index to restricted users', 'docs'), 'showindex', $edit ? $res->getVar('show_index') : 0)); $form->addElement(new RMFormYesno(__('Featured', 'docs'), 'featured', $edit ? $res->getVar('featured') : 0)); $form->addElement(new RMFormYesno(__('Approve inmediatly', 'docs'), 'approvedres', $edit ? $res->getVar('approved') : 1)); $form->addElement(new RMFormYesno(__('Show content in a single page', 'docs'), 'single', $edit ? $res->getVar('single') : 0)); $form->element('single')->setDescription(__('When you enable this option the Document content will show in a single page.', 'docs')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Update Document', 'docs') : __('Create Document', 'docs'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'resources.php\';"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('app', $edit ? $res->getVar('approved') : 0)); $form->display(); xoops_cp_footer(); }
/** * Editamos un trabajo */ function rmmfEdit() { global $db, $mc, $myts; $id = isset($_GET['id']) ? $_GET['id'] : 0; if ($id <= 0) { header('location: index.php'); die; } define('_RMMF_LOCATION', 'WORKS'); include_once '../class/work.class.php'; xoops_cp_header(); rmmf_make_adminnav(); include_once '../common/form.class.php'; $work = new MFWork($id); $form = new RMForm(_MA_RMMF_NEWWORK, 'frmMod', 'index.php?op=saveedit'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMText(_MA_RMMF_TITLE, 'titulo', 50, 150, $work->getVar('titulo'))); $result = array(); $select = "<select name='catego'>\n\t\t\t\t<option value='0'>" . _MA_RMMF_SELECT . "</option>"; rmmf_get_categos($result); foreach ($result as $k => $v) { $select .= "<option value='{$v['id_cat']}'" . ($v['id_cat'] == $work->getVar('catego') ? " selected='selected'" : '') . ">" . str_repeat('-', $v['saltos']) . " {$v['nombre']}</option>"; } $select .= "</select>"; $form->addElement(new RMLabel(_MA_RMMF_CATEGO, $select)); $form->addElement(new RMText(_MA_RMMF_CLIENT, 'cliente', 50, 255, $work->getVar('cliente'))); $form->addElement(new RMText(_MA_RMMF_URL, 'url', 50, 255, $work->getVar('url'))); $form->addElement(new RMTextArea(_MA_RMMF_SHORT, 'short', 4, 45, $myts->makeTareaData4Edit($work->getVar('short'), 0, 0))); $form->addElement(new RMLabel(_MA_RMMF_DESC, rmmf_select_editor('desc', $mc['editor'], $myts->makeTareaData4Edit($work->getVar('desc')), '100%', '250px'))); $form->addElement(new RMTextArea(_MA_RMMF_COMMENT, 'comentario', 4, 45, $work->getVar('comentario'))); $ele = new RMFile(_MA_RMMF_IMG, 'imagen', 45); $ele->setDescription(_MA_RMMF_IMG_INFO); $form->addElement($ele); if ($work->getVar('imagen') != '') { $form->addElement(new RMLabel(_MA_RMMF_CURRIMG, "<img src='" . rmmf_add_slash(rmmf_web_dir($mc['storedir'])) . 'ths/' . $work->getVar('imagen') . "' border='0' />")); } $form->addElement(new RMYesNo(_MA_RMMF_FEATURED, 'resaltado', $work->getVar('resaltado') == 1 ? 1 : 0)); $form->addElement(new RMButton('sbt', _MA_RMMF_SEND)); $form->addElement(new RMHidden('id', $work->getVar('id_w'))); $form->display(); rmmf_make_footer(); xoops_cp_footer(); }
/** * Esta función permite guardar y publicar un envío */ function savePage($edit = 0) { global $xoopsSecurity, $xoopsUser, $myts, $mc, $xoopsModule; $cat = 0; $url = ''; $texto = ''; foreach ($_POST as $k => $v) { ${$k} = $v; } $q = "op=" . ($edit ? 'edit&id=' . $id : 'new') . "&cat={$cat}&page={$page}"; if ($edit) { if ($id <= 0) { redirectMsg("pages.php?cat={$cat}&page={$page}", __('Page ID has not been provided', 'qpages'), 1); die; } $page = new QPPage($id); if ($page->isNew()) { redirectMsg("pages.php?cat={$cat}&page={$page}", __('Specified page does not exists!', 'qpages'), 1); die; } } else { $page = new QPPage(); } if (!$xoopsSecurity->check()) { redirectMsg("pages.php?{$q}", __('Session token expired!', 'qpages'), 1); die; } if ($titulo == '') { redirectMsg("pages.php?{$q}", __('Title is missing', 'qpages'), 1); die; } if (isset($pretitulo)) { if ($pretitulo != $titulo) { $titulo_amigo = TextCleaner::getInstance()->sweetstring($titulo); } else { $titulo_amigo = $titulo_amigo; } $texto = TextCleaner::getInstance()->specialchars_decode($texto, ENT_QUOTES); } else { $titulo_amigo = $edit ? $titulo_amigo != '' ? $titulo_amigo : TextCleaner::getInstance()->sweetstring($titulo) : TextCleaner::getInstance()->sweetstring($titulo); } if ($texto == '' && $type == 0) { redirectMsg("pages.php?op=new&cat={$cat}&page={$page}", __('Content is missing', 'qpages'), 1); die; } if ($catego <= 0) { redirectMsg("pages.php?op=new&cat={$cat}&page={$page}", __('You must select a category for this page', 'qpages'), 1); die; } if (count($grupos) <= 0) { $grupos = array(0); } /** * Comprobamos que no exista otra página con el mismo título */ $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT COUNT(*) FROM " . $db->prefix("qpages_pages") . " WHERE titulo_amigo='{$titulo_amigo}'"; $sql .= $edit ? " AND id_page<>" . $page->getID() : ''; list($num) = $db->fetchRow($db->query($sql)); if ($num > 0) { $form = new RMForm(__('Review Page', 'qpages'), 'frm-review', 'pages.php'); $form->addElement(new RMFormLabel('', __('A page with same friendly name already exists. Please change the freindly title to prevent errors.', 'qpages'))); foreach ($_POST as $k => $v) { if ($k == 'titulo_amigo') { continue; } if ($k == 'texto') { continue; } if ($k == 'grupos') { continue; } if ($k == 'XOOPS_TOKEN_REQUEST') { continue; } if ($k == 'titulo') { $k = 'pretitulo'; } $hiddens[$k] = $v; } $form->addElement(new RMFormText(__('Title', 'qpages'), 'titulo', 50, 255, $titulo), true); $form->addElement(new RMFormText(__('Friendly title', 'qpages'), 'titulo_amigo', 50, 255, $titulo_amigo), true); $form->addElement(new RMFormHidden('texto', TextCleaner::getInstance()->specialchars($texto, ENT_QUOTES))); foreach ($hiddens as $k => $v) { $form->addElement(new RMFormHidden($k, $v)); } foreach ($grupos as $group) { $form->addElement(new RMFormHidden('grupos[]', $group)); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Save Page', 'qpages'), 'submit'); $ele->addButton('cancel', __('Cancel', 'qpages'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele); qpages_toolbar(); xoops_cp_header(); $form->display(); xoops_cp_footer(); die; } #Guardamos los datos del Post $page->setTitle($titulo); $page->setFriendTitle($titulo_amigo); $page->setDate($edit ? $page->getVar('fecha') : time()); $page->setModDate(time()); $page->setText($texto); $page->setCategory($catego); $page->setVar('desc', TextCleaner::getInstance()->clean_disabled_tags($desc)); $page->setGroups($grupos); $page->setHTML(isset($dohtml) ? 1 : 0); $page->setXCode(isset($doxcode) ? 1 : 0); $page->setImage(isset($doimage) ? 1 : 0); $page->setBR(isset($dobr) ? 1 : 0); $page->setSmiley(isset($dosmiley) ? 1 : 0); $page->setUid($xoopsUser->uid()); $page->setType($type); $page->setURL(formatURL($url)); $page->setAccess($acceso); // Add Metas foreach ($meta_name as $k => $v) { $page->add_meta($v, $meta_value[$k]); } $ret = $edit ? $page->update() : $page->save(); if ($ret) { $xoopsUser->incrementPost(); redirectMsg("pages.php?op=" . ($page->type() ? 'editlink' : 'edit') . "&id=" . $page->getID() . "&cat={$cat}&page={$page}", __('Database updated successfully!', 'qpages'), 0); } else { redirectMsg("pages.php?{$q}", __('Errors ocurred while trying to update database', 'qpages') . "<br />" . $page->errors(), 1); } }
/** * @desc Formulario de creación/edición de Imágenes **/ function formImages($edit = 0) { global $xoopsModule, $xoopsModuleConfig; $id = rmc_server_var($_REQUEST, 'id', 0); $work = rmc_server_var($_REQUEST, 'work', 0); $page = rmc_server_var($_REQUEST, 'page', 0); $ruta = "&page={$page}"; //Verificamos que el trabajo sea válido if ($work <= 0) { redirectMsg('./works.php', __('You must specify a work ID!', 'works'), 1); die; } //Verificamos que el trabajo exista $work = new PWWork($work); if ($work->isNew()) { redirectMsg('./works.php', __('Specified work does not exists!', 'works'), 1); die; } if ($edit) { //Verificamos que la imagen sea válida if ($id <= 0) { redirectMsg('./images.php?work=' . $work->id() . $ruta, __('You must specify an image ID!', 'works'), 1); die; } //Verificamos que la imagen exista $img = new PWImage($id); if ($img->isNew()) { redirectMsg('./images.php?work=' . $work->id() . $ruta, __('Specified image does not exists!', 'works'), 1); die; } } PWFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $work->title() . ' » ' . __('Work Images', 'works')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » <a href='./images.php?work=" . $work->id() . "'>" . __('Work Images', 'works') . "</a> »" . ($edit ? __('Edit Image', 'works') : __('Add Image', 'works'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Image', 'works') : __('Add Image', 'works'), 'frmImg', 'images.php'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Title', 'works'), 'title', 50, 100, $edit ? $img->title() : ''), true); $form->addElement(new RMFormFile(__('Image file', 'works'), 'image', 45, $xoopsModuleConfig['size_image'] * 1024), $edit ? false : true); if ($edit) { $form->addElement(new RMFormLabel(__('Current image file', 'works'), "<img src='" . XOOPS_UPLOAD_URL . "/works/ths/" . $img->image() . "' />")); } $form->addElement(new RMFormTextArea(__('Description', 'works'), 'desc', 4, 50, $edit ? $img->desc() : '')); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('work', $work->id())); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('limit', $limit)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', _SUBMIT, 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'images.php?work=' . $work->id() . $ruta . '\';"'); $form->addElement($ele); $form->display(); xoops_cp_footer(); }
/** * This function shows a form to send email to single or multiple users */ function show_mailer() { global $xoopsConfig, $rmc_config, $rmTpl; $uid = rmc_server_var($_GET, 'uid', array()); $query = rmc_server_var($_GET, 'query', ''); if (!is_array($uid) && $uid <= 0 || empty($uid)) { // In admin control panel (side) add_message always must to be called before // ExmGUI::show_header() RMTemplate::get()->add_message(__('You must select one user at least. Please click on "Add Users" and select as many users as you wish.'), 0); } $uid = !is_array($uid) ? array($uid) : $uid; RMBreadCrumb::get()->add_crumb(__('Users Management', 'rmcommon'), 'users.php'); RMBreadCrumb::get()->add_crumb(__('Send E-Mail', 'rmcommon')); $rmTpl->assign('xoops_pagetitle', __('Sending email to users', 'rmcommon')); xoops_cp_header(); $form = new RMForm(__('Send Email to Users', 'rmcommon'), 'frm_mailer', 'users.php'); $form->addElement(new RMFormUser(__('Users', 'global'), 'mailer_users', 1, $uid, 30, 600, 400)); $form->element('mailer_users')->setDescription(__('Please note that the maximun users number that you can select depends of the limit of emails that you can send accourding to your email server policies (or hosting account policies).', 'rmcommon')); $form->addElement(new RMFormText(__('Message subject', 'rmcommon'), 'subject', 50, 255), true); $form->element('subject')->setDescription(__('Subject must be descriptive.', 'rmcommon')); $form->addElement(new RMFormRadio(__('Message type', 'rmcommon'), 'type', ' ', 1, 2)); $form->element('type')->addOption(__('HTML', 'global'), 'html', 1, $rmc_config['editor_type'] == 'tiny' ? 'onclick="switchEditors.go(\'message\', \'tinymce\');"' : ''); $form->element('type')->addOption(__('Plain Text', 'global'), 'text', 0, $rmc_config['editor_type'] == 'tiny' ? 'onclick="switchEditors.go(\'message\', \'html\');"' : ''); $form->addElement(new RMFormEditor(__('Message content', 'rmcommon'), 'message', '99%', '300px', ''), true); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Send E-Mail', 'rmcommon'), 'submit'); $ele->addButton('cancel', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele); $form->addElement(new RMFormHidden('action', 'sendmail')); $form->addElement(new RMFormHidden('query', $query)); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de creación/edición de usuarios **/ function formUsers($edit = 0) { global $xoopsModule, $xoopsModuleConfig; $mc =& $xoopsModuleConfig; $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : ''; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $ruta = "pag={$page}&search={$search}"; if ($edit) { //Verificamos que el usuario sea válido if ($id <= 0) { redirectMsg('./users.php?' . $ruta, __('User id is not valid!', 'galleries'), 1); die; } //Verificamos que el usuario exista $user = new GSUser($id); if ($user->isNew()) { redirectMsg('./users.php?' . $ruta, __('Specified user does not exists!', 'galleries'), 1); die; } } GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./users.php'>" . __('Users management', 'galleries') . "</a> » " . ($edit ? __('Edit User', 'galleries') : __('New User', 'galleries'))); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit User', 'galleries') : __('New User', 'galleries')); xoops_cp_header(); $form = new RMForm($edit ? __('Edit User', 'galleries') : __('New User', 'galleries'), 'frmuser', 'users.php'); $form->addElement(new RMFormUser(__('Xoops User', 'galleries'), 'uid', 0, $edit ? array($user->uid()) : '', 30)); $ele = new RMFormText(__('Max Quota', 'galleries'), 'quota', 10, 10, $edit ? $user->quota() / 1024 / 1024 : $mc['quota']); $ele->setDescription(__('This value determines the total disc quota to be used for user and must be specified in megabytes.', 'galleries')); $form->addElement($ele, true); $form->addElement(new RMFormYesno(__('Blocked', 'galleries'), 'block', $edit ? $user->blocked() : 0)); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('search', $search)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save Changes', 'galleries') : __('Create User', 'galleries'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'users.php?' . $ruta . '\'"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * Editamos una categor?a */ function rmmfEdit() { global $db, $mc, $myts; $id = isset($_GET['id']) ? $_GET['id'] : 0; if ($id <= 0) { header('location: categos.php'); die; } define('_RMMF_LOCATION', 'NEWCATEGO'); xoops_cp_header(); rmmf_make_adminnav(); include_once '../class/catego.class.php'; include_once '../common/form.class.php'; $catego = new MFCategory($id); $form = new RMForm(_MA_RMMF_MODCATEGO, 'frmmod', 'categos.php?op=saveedit'); $form->addElement(new RMText(_MA_RMMF_NAME, 'nombre', 50, 150, $catego->getVar('nombre'))); $result = array(); $select = "<select name='parent'>\n\t\t\t\t<option value='0'>" . _MA_RMMF_SELECT . "</option>"; rmmf_get_categos($result); foreach ($result as $k => $v) { $select .= "<option value='{$v['id_cat']}'" . ($v['id_cat'] == $catego->getVar('parent') ? " selected='selected'" : '') . ">{$v['nombre']}</option>"; } $select .= "</select>"; $form->addElement(new RMLabel(_MA_RMMF_PARENT, $select)); $form->addElement(new RMText(_MA_RMMF_ORDER, 'orden', 5, 5, $catego->getVar('orden'))); $form->addElement(new RMLabel(_MA_RMMF_DESC, rmmf_select_editor('desc', $mc['editor'], $myts->makeTareaData4Edit($catego->getVar('desc')), '100%', '250px'))); $form->addElement(new RMButton('sbt', _MA_RMMF_SEND)); $form->addElement(new RMHidden('id', $id)); $form->display(); rmmf_make_footer(); xoops_cp_footer(); }
function showFormEdits() { global $xoopsModule, $xoopsConfig; $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirectMsg('edits.php', __('You have not specified any waiting section!', 'docs'), 1); die; } $edit = new RDEdit($id); if ($edit->isNew()) { redirectMsg('edits.php', __('Specified content does not exists!', 'docs'), 1); die; } $sec = new RDSection($edit->getVar('id_sec')); if ($sec->isNew()) { redirectMsg('edits.php', __('This waiting content does not have any section assigned!', 'docs'), 1); die; } $res = new RDResource($sec->getVar('id_res')); $form = new RMForm(__('Editing Waiting Content', 'docs'), 'frmsec', 'edits.php'); $form->addElement(new RMFormLabel(__('Belong to', 'docs'), $res->getVar('title'))); $form->addElement(new RMFormText(__('Title', 'docs'), 'title', 50, 200, $edit->getVar('title')), true); $form->addElement(new RMFormEditor(__('Contenido', 'docs'), 'content', '90%', '300px', $edit->getVar('content', 'e')), true); // Arbol de Secciones $ele = new RMFormSelect(__('Parent Section', 'docs'), 'parent'); $ele->addOption(0, __('Select section...', 'docs')); $tree = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $tree, false); foreach ($tree as $k) { $ele->addOption($k['id'], str_repeat('—', $k['jump']) . ' ' . $k['title'], $edit->getVar('parent') == $k['id'] ? 1 : 0); } $form->addElement($ele); $form->addElement(new RMFormText(__('Display order', 'docs'), 'order', 5, 5, $edit->getVar('order')), true); // Usuario $form->addElement(new RMFormUser(__('Owner', 'docs'), 'uid', 0, array($edit->getVar('uid')), 30)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Save Now', 'docs'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'edits.php\';"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'save')); $form->addElement(new RMFormHidden('id', $edit->id())); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./edits.php'>" . __('Waiting Content', 'docs') . "</a> » " . sprintf(__('Editing %s', 'docs'), $edit->getVar('title'))); xoops_cp_header(); RMTemplate::get()->assign('xoops_pagetitle', __('Editing Waiting Content', 'docs')); $form->display(); xoops_cp_footer(); }
function formTeams($edit = 0) { global $db, $xoopsModule, $mc, $xoopsConfig; if ($edit) { $id = TCFunctions::get('id'); if ($id <= 0) { redirectMsg('teams.php', __('Id not valid', 'admin_team'), 1); die; } $team = new TCTeam($id); if ($team->isNew()) { redirectMsg('teams.php', __('No existe el equipo especificado', 'admin_team'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./teams.php'>" . __('Equipos', 'admin_team') . "</a>\n\t\t\t» " . ($edit ? __('Editar Equipo', 'admin_team') : __('Crear Equipo', 'admin_team'))); xoops_cp_header(); $form = new RMForm($edit ? __('Editar Equipo', 'admin_team') : __('Crear Equipo', 'admin_team'), 'frmTeam', 'teams.php'); $form->setExtra('enctype="multipart/form-data"'); $form->oddClass('oddForm'); $ele = new RMFormRadio(__('Categoría', 'admin_team'), 'cat', 0, 1, 1); $result = $db->query("SELECT * FROM " . $db->prefix("coach_categos") . " ORDER BY name"); while ($row = $db->fetchArray($result)) { $ele->addOption($row['name'], $row['id_cat'], $edit ? $team->category() == $row['id_cat'] ? 1 : 0 : 0); } $form->addElement($ele, true, 'checked'); $form->addElement(new RMFormText(__('Nombre', 'admin_team'), 'name', 50, 100, $edit ? $team->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 100, $edit ? $team->nameId() : '')); } $form->addElement(new RMFormFile(__('Imagen', 'admin_team'), 'image', 46, $mc['filesize'] * 1024)); if ($edit && $team->image() != '') { $form->addElement(new RMFormLabel(__('Imagen actual', 'admin_team'), '<img src="' . XOOPS_URL . '/uploads/teams/ths/' . $team->image() . '" alt="" />')); } $form->addElement(new RMFormEditor(__('Información', 'admin_team'), 'desc', '90%', '300px', $edit ? $team->desc('e') : '')); if ($edit) { $html = $team->getVar('dohtml'); $xcode = $team->getVar('doxcode'); $doimage = $team->getVar('doimage'); $smiley = $team->getVar('dosmiley'); $br = $team->getVar('dobr'); } else { $html = $xoopsConfig['editor_type'] == 'tiny' ? 1 : 0; $xcode = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; $doimage = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; $smiley = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; $br = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; } $form->addElement(new RMFormTextOptions(__('Opciones', 'admin_team'), $html, $xcode, $doimage, $smiley, $br)); $form->addElement(new RMFormSubTitle(__('Entrenadores', 'admin_team'), 1)); $ele = new RMFormCheck(__('Entrenadores', 'admin_team')); $ele->asTable(3); $result = $db->query("SELECT * FROM " . $db->prefix("coach_coachs") . " ORDER BY name"); if ($edit) { $coachs = $team->coachs(false); } while ($row = $db->fetchArray($result)) { $coach = new TCCoach(); $coach->assignVars($row); $ele->addOption($coach->name(), 'coachs[]', $coach->id(), $edit ? in_array($coach->id(), $coachs) ? 1 : 0 : 0); } $form->addElement($ele); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Enviar', 'admin_team'), 'submit'); $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'teams.php\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $team->id())); } $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de creación/edición de albums **/ function formAlbums($edit = 0) { global $xoopsModule, $xoopsUser; define('RMSUBLOCATION', 'newalbum'); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : ''; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15; $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'id_set'; $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 0; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $ruta = "pag={$page}&sort={$sort}&mode={$mode}&search={$search}"; if ($edit) { //Verificamos que el album sea válido if ($id <= 0) { redirectMsg('./sets.php?' . $ruta, __('Please provide a valid ID!', 'galleries'), 1); die; } //Verificamos que el album exista $set = new GSSet($id); if ($set->isNew()) { redirectMsg('./sets.php?' . $ruta, __('Specified album does not exists!', 'galleries'), 1); die; } } GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./sets.php'>" . __('Albums management', 'galleries') . "</a> » " . ($edit ? __('Edit album', 'galleries') : __('New album', 'galleries'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit album', 'galleries') : __('New Album', 'galleries'), 'frmsets', 'sets.php'); $form->addElement(new RMFormText(__('Album title', 'galleries'), 'title', 50, 100, $edit ? $set->title() : ''), true); $form->addElement(new RMFormEditor(__('Description', 'galleries'), 'description', '99%', '250px', $edit ? $set->getVar('description', 'e') : '')); $ele = new RMFormSelect(__('Privacy level', 'galleries'), 'public'); $ele->addOption(0, __('Private', 'galleries'), $edit ? $set->isPublic() == 0 ? 1 : 0 : 0); $ele->addOption(1, __('Public for friends', 'galleries'), $edit ? $set->isPublic() == 1 ? 1 : 0 : 0); $ele->addOption(2, __('Public', 'galleries'), $edit ? $set->isPublic() == 2 ? 1 : ($set->isPublic() == 0 ? 1 : 0) : 1); $form->addElement($ele, true); $form->addElement(new RMFormUser(__('Owner', 'galleries'), 'owner', 0, $edit ? array($set->owner()) : array($xoopsUser->uid()), 30)); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('limit', $limit)); $form->addElement(new RMFormHidden('sort', $sort)); $form->addElement(new RMFormHidden('mode', $mode)); $form->addElement(new RMFormHidden('search', $search)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save Changes!', 'galleries') : __('Create Album!', 'galleries'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'sets.php?' . $ruta . '\'"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * @desc Permite la edición de figuras **/ function rd_figures_form($edit = 0) { global $xoopsModule, $xoopsConfig; xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . $edit ? __('Edit Figure', 'docs') : __('Create Figure')); xoops_cp_header(); $id = rmc_server_var($_GET, 'id', 0); $id_res = rmc_server_var($_GET, 'res', 0); if ($id_res <= 0) { redirectMsg('resources.php', __('First select a Document to manage the figures.', 'docs'), 1); } $res = new RDResource($id_res); if ($res->isNew()) { redirectMsg('resources.php', __('Specified Document does not exists!', 'docs'), 1); } if ($edit) { if ($id <= 0) { redirectMsg('figures.php?res=' . $id_res, __('You have not specified a figure to edit!', 'docs')); break; } $fig = new RDFigure($id); if ($fig->isNew()) { redirectMsg('figures.php?res=' . $id_res, __('Specified figure does not exists!', 'docs')); break; } } $form = new RMForm($edit ? __('Editing Figure', 'docs') : __('Create Figure', 'docs'), 'frmfig', 'figures.php'); $form->addElement(new RMFormText(__('Title', 'docs'), 'title', 50, 255, $edit ? $fig->getVar('title') : ''), true); $form->addElement(new RMFormText(__('Description', 'docs'), 'desc', 50, 255, $edit ? $fig->getVar('desc') : ''), true); $form->addElement(new RMFormEditor(__('Content', 'docs'), 'figure', '100%', '300px', $edit ? $fig->getVar('content', 'e') : ''), true); $form->addElement(new RMFormText(__('Attributes', 'docs'), 'attrs', 50, 150, $edit ? $fig->getVar('attrs') : '')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save Changes', 'docs') : __('Save Figure', 'docs'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'docs'), 'button', 'onclick="window.location=\'figures.php?res=' . $id_res . '\';"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->addElement(new RMFormHidden('res', $id_res)); $form->display(); xoops_cp_footer(); }
function edit_comment() { $id = rmc_server_var($_GET, 'id', 0); $page = rmc_server_var($_GET, 'page', 1); $filter = rmc_server_var($_GET, 'filter', ''); $w = rmc_server_var($_GET, 'w', '1'); $qs = "w={$w}&page={$page}&filter={$filter}"; if ($id <= 0) { redirectMsg('comments.php?' . $qs, __('Sorry, comment id is not valid', 'rmcommon'), 1); die; } $comment = new RMComment($id); if ($comment->isNew()) { redirectMsg('comments.php?' . $qs, __('Sorry, comment does not found', 'rmcommon'), 1); die; } $cpath = XOOPS_ROOT_PATH . '/modules/' . $comment->getVar('id_obj') . '/class/' . $comment->getVar('id_obj') . 'controller.php'; if (is_file($cpath)) { include $cpath; $class = ucfirst($comment->getVar('id_obj')) . 'Controller'; $controller = new $class(); } $form = new RMForm(__('Edit Comment', 'rmcommon'), 'editComment', 'comments.php'); $form->addElement(new RMFormLabel(__('In reply to', 'rmcommon'), $controller ? $controller->get_item($comment->getVar('params'), $comment) : '')); $form->addElement(new RMFormLabel(__('Posted date', 'rmcommon'), formatTimestamp($comment->getVar('posted'), 'mysql'))); $form->addElement(new RMFormLabel(__('Module', 'rmcommon'), $comment->getVar('id_obj'))); $form->addElement(new RMFormLabel(__('IP', 'rmcommon'), $comment->getVar('ip'))); $user = new RMCommentUser($comment->getVar('user')); $ele = new RMFormUser(__('Poster', 'rmcommon'), 'user', false, $user->getVar('xuid') > 0 ? $user->getVar('xuid') : 0); $form->addElement($ele); $ele = new RMFormRadio(__('Status', 'rmcommon'), 'status', 1, 0, 2); $ele->addOption(__('Approved', 'rmcommon'), 'approved', $comment->getVar('status') == 'approved' ? 1 : 0); $ele->addOption(__('Unapproved', 'rmcommon'), 'waiting', $comment->getVar('status') == 'waiting' ? 1 : 0); $form->addElement($ele); $form->addElement(new RMFormTextArea(__('Content', 'rmcommon'), 'content', null, null, $comment->getVar('content', 'e'), '100%', '150px'), true); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('filter', $filter)); $form->addElement(new RMFormHidden('w', $w)); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('action', 'save')); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Update Comment', 'rmcommon'), 'submit'); $ele->addButton('cancel', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele); RMFunctions::create_toolbar(); xoops_cp_header(); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de creación/edición de Imágenes **/ function shop_form_images($edit = 0) { global $xoopsModule, $xoopsModuleConfig; $idimg = rmc_server_var($_REQUEST, 'idimg', 0); $id = rmc_server_var($_REQUEST, 'id', 0); $page = rmc_server_var($_REQUEST, 'page', 0); $bname = rmc_server_var($_REQUEST, 'bname', 0); $ruta = "action=images&page={$page}&bname={$bname}&id={$id}"; //Verificamos que el trabajo sea válido if ($id <= 0) { redirectMsg('products.php', __('You must specify a product ID!', 'shop'), 1); die; } //Verificamos que el trabajo exista $product = new ShopProduct($id); if ($product->isNew()) { redirectMsg('products.php', __('Specified product does not exists!', 'shop'), 1); die; } if ($edit) { //Verificamos que la imagen sea válida if ($idimg <= 0) { redirectMsg('products.php?' . $ruta, __('You must specify an image ID!', 'shop'), 1); die; } //Verificamos que la imagen exista $img = new ShopImage($idimg); if ($img->isNew()) { redirectMsg('products.php?' . $ruta, __('Specified image does not exists!', 'shop'), 1); die; } } ShopFunctions::include_required_files(); RMTemplate::get()->assign('xoops_pagetitle', $product->getVar('name') . ' » ' . __('Product Images', 'shop')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » <a href='products.php?id=" . $product->id() . "'>" . __('Product Images', 'shop') . "</a> »" . ($edit ? __('Edit Image', 'shop') : __('Add Image', 'shop'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Image', 'shop') : __('Add Image', 'shop'), 'frmImg', 'products.php'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Title', 'shop'), 'title', 50, 100, $edit ? $img->getVar('title') : ''), true); $form->addElement(new RMFormFile(__('Image file', 'shop'), 'file', 45, $xoopsModuleConfig['size_image'] * 1024), $edit ? false : true); if ($edit) { $form->addElement(new RMFormLabel(__('Current image file', 'shop'), "<img src='" . XOOPS_UPLOAD_URL . "/minishop/ths/" . $img->getVar('file') . "' />")); } $form->addElement(new RMFormTextArea(__('Description', 'shop'), 'desc', 4, 50, $edit ? $img->getVar('description', 'e') : '')); $form->addElement(new RMFormHidden('action', $edit ? 'saveeditedimage' : 'saveimage')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('idimg', $img->id())); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('bname', $bname)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', _SUBMIT, 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'products.php?id=' . $product->id() . '\';"'); $form->addElement($ele); $form->display(); xoops_cp_footer(); }