/** * Creamos una nueva categor?a */ function rmmfNew() { global $db, $mc; define('RMCLOCATION', 'newcategory'); MFFunctions::toolbar(); $form = new RMForm(__('New Category', 'admin_myfolder'), 'frmNew', 'categos.php'); $form->addElement(new RMFormText(__('Name', 'admin_mywords'), 'nombre', 50, 150)); $ele = new RMFormSelect(__('Parent category', 'admin_myfolder'), 'parent'); $ele->addOption('', __('Select category...', 'admin_myfolder'), 1); $result = array(); MFFunctions::get_categories($result); foreach ($result as $k => $v) { $ele->addOption($v['id_cat'], $v['nombre']); } $form->addElement($ele); $form->addElement(new RMFormText(__('Display order', 'admin_myfolder'), 'orden', 5, 5, 0)); $ele = new RMFormEditor(__('Description', 'admin_myfolder'), 'desc', '96%', '300px'); $form->addElement($ele); $ele = new RMFormButtonGroup(''); $ele->addButton('sbt', __('Create Category', 'admin_myfolder'), 'submit'); $ele->addButton('cancel', __('Cancel', 'admin_myfolder'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele, false); $form->addElement(new RMFormHidden('op', 'save')); xoops_cp_header(); $form->display(); xoops_cp_footer(); }
/** * @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(); }
/** * Muestra las características existentes de una descarga */ function dt_show_logs($edit = 0) { global $xoopsOption, $db, $tpl, $xoopsTpl, $xoopsUser, $mc, $dtfunc, $page, $item, $xoopsConfig, $xoopsModuleConfig, $log; include 'header.php'; $dtfunc->cpHeader($item, sprintf(__('%s Logs', 'dtransport'), $item->getVar('name'))); if ($log > 0 && $edit) { $log = new DTLog($log); if ($log->isNew() || $log->software() != $item->id()) { redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() . '/' : '/?p=cpanel&action=logs&id=' . $item->id()), 1, __('Specified log does not exists!', 'dtransport')); } } $tc = TextCleaner::getInstance(); $tf = new RMTimeFormatter('', "%M% %d%, %Y%"); $sql = "SELECT * FROM " . $db->prefix('dtrans_logs') . " WHERE id_soft=" . $item->id(); $result = $db->queryF($sql); while ($rows = $db->fetchArray($result)) { $lg = new DTLog(); $lg->assignVars($rows); $xoopsTpl->append('logs', array('id' => $lg->id(), 'title' => $lg->title(), 'date' => $tf->format($lg->date()), 'software' => $item->getVar('name'), 'links' => array('edit' => DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->getVar('nameid') . '/edit/' . $lg->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=logs&log=' . $lg->id()), 'delete' => DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->getVar('nameid') . '/delete/' . $lg->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=delete&log=' . $lg->id())))); } $formurl = DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() . '/save/' . ($edit ? $log->id() : '0') . '/' : '/p=cpanel'); // logs Form $form = new RMForm($edit ? sprintf(__('Editing log of "%s"', 'dtransport'), $item->getVar('name')) : sprintf(__('New log for "%s"', 'dtransport'), $item->getVar('name')), 'frmLog', $formurl); $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $item->getVar('name'))); $form->addElement(new RMFormText(__('Log title', 'dtransport'), 'title', 50, 200, $edit ? $log->title() : ''), true); $form->addElement(new RMFormEditor(__('Log content', 'dtransport'), 'content', 'auto', '350px', $edit ? $log->log('e') : ''), true); $form->addElement(new RMFormHidden('action', 'save')); $form->addElement(new RMFormHidden('id', $item->id())); $form->addElement(new RMFormHidden('log', $edit ? $log->id() : 0)); $form->addElement(new RMFormHidden('op', 'save')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', _SUBMIT, 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'' . (DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() . '/' : '/?p=cpanel&action=logs&id=' . $item->id())) . '\';"'); $form->addElement($buttons); $xoopsTpl->assign('log_form', $form->render()); $tpl->add_xoops_style('cpanel.css', 'dtransport'); $tpl->add_head_script('$(document).ready(function(){ $("a.delete").click(function(){ if(!confirm("' . __('Do you really want to delete selected log?', 'dtransport') . '")) return false; }); });'); $xoopsTpl->assign('lang_id', __('ID', 'dtransport')); $xoopsTpl->assign('lang_title', __('Title', 'dtransport')); $xoopsTpl->assign('lang_created', __('Date', 'dtransport')); $xoopsTpl->assign('lang_options', __('Options', 'dtransport')); $xoopsTpl->assign('lang_edit', __('Edit', 'dtransport')); $xoopsTpl->assign('lang_delete', __('Delete', 'dtransport')); $xoopsTpl->assign('lang_addlog', __('Add Log', 'dtransport')); $xoopsTpl->assign('edit', $edit); include 'footer.php'; }
/** * Muestra las características existentes de una descarga */ function dt_show_features($edit = 0) { global $xoopsOption, $db, $tpl, $xoopsTpl, $xoopsUser, $mc, $dtfunc, $page, $item, $xoopsConfig, $xoopsModuleConfig, $feature; include 'header.php'; $dtfunc->cpHeader($item, sprintf(__('%s Features', 'dtransport'), $item->getVar('name'))); if ($feature > 0 && $edit) { $feature = new DTFeature($feature); if ($feature->isNew() || $feature->software() != $item->id()) { redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/features/' . $item->id() . '/' : '/?p=cpanel&action=features&id=' . $item->id()), 1, __('Specified feature does not exists!', 'dtransport')); } } $tc = TextCleaner::getInstance(); $sql = "SELECT * FROM " . $db->prefix('dtrans_features') . " WHERE id_soft=" . $item->id(); $result = $db->queryF($sql); while ($rows = $db->fetchArray($result)) { $feat = new DTFeature(); $feat->assignVars($rows); $xoopsTpl->append('features', array('id' => $feat->id(), 'title' => $feat->title(), 'content' => $tc->truncate($tc->clean_disabled_tags($feat->content()), 80), 'software' => $item->getVar('name'), 'links' => array('permalink' => $feat->permalink(), 'edit' => DT_URL . ($mc['permalinks'] ? '/cp/features/' . $item->getVar('nameid') . '/edit/' . $feat->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=features&feature=' . $feat->id()), 'delete' => DT_URL . ($mc['permalinks'] ? '/cp/features/' . $item->getVar('nameid') . '/delete/' . $feat->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=delete&feature=' . $feat->id())))); } $formurl = DT_URL . ($mc['permalinks'] ? '/cp/features/' . $item->id() . '/save/' . ($edit ? $feature->id() : '0') . '/' : '/p=cpanel'); // Features Form $form = new RMForm($edit ? sprintf(__('Editing feature of "%s"', 'dtransport'), $item->getVar('name')) : sprintf(__('New feature for "%s"', 'dtransport'), $item->getVar('name')), 'frmfeat', $formurl); $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $item->getVar('name'))); $form->addElement(new RMFormText(__('Feature title', 'dtransport'), 'title', 50, 200, $edit ? $feature->title() : ''), true); $form->addElement(new RMFormText(__('Short name', 'dtransport'), 'nameid', 50, 200, $edit ? $feature->nameId() : '')); $form->addElement(new RMFormEditor(__('Feature content', 'dtransport'), 'content', 'auto', '350px', $edit ? $feature->content('e') : ''), true); $dtfunc->meta_form('feat', $edit ? $feature->id() : 0, $form); $form->addElement(new RMFormHidden('action', 'save')); $form->addElement(new RMFormHidden('id', $item->id())); $form->addElement(new RMFormHidden('feature', $edit ? $feature->id() : 0)); $form->addElement(new RMFormHidden('op', 'save')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', _SUBMIT, 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'' . (DT_URL . ($mc['permalinks'] ? '/cp/features/' . $item->id() . '/' : '/?p=cpanel&action=features&id=' . $item->id())) . '\';"'); $form->addElement($buttons); $xoopsTpl->assign('feat_form', $form->render()); $tpl->add_xoops_style('cpanel.css', 'dtransport'); $tpl->add_head_script('$(document).ready(function(){ $("a.delete").click(function(){ if(!confirm("' . __('Do you really want to delete selected feature?', 'dtransport') . '")) return false; }); });'); $xoopsTpl->assign('lang_id', __('ID', 'dtransport')); $xoopsTpl->assign('lang_title', __('Title', 'dtransport')); $xoopsTpl->assign('lang_content', __('Content', 'dtransport')); $xoopsTpl->assign('lang_edit', __('Edit', 'dtransport')); $xoopsTpl->assign('lang_delete', __('Delete', 'dtransport')); $xoopsTpl->assign('lang_addfeat', __('Add Feature', 'dtransport')); $xoopsTpl->assign('edit', $edit); include 'footer.php'; }
/** * Show the form to edit or create a category * @param int edit */ function m_categories_form($edit = 0) { global $mc, $xoopsModule, $db; MCHFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Category', 'match') : __('Add Category', 'match')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » \n <a href='categories.php'>" . __('Categories', 'match') . '</a> » ' . ($edit ? __('Edit Category', 'match') : __('Add Category', 'match'))); xoops_cp_header(); $id = rmc_server_var($_REQUEST, 'id', 0); if ($edit) { //Verificamos si la categoría es válida if ($id <= 0) { redirectMsg('./categories.php', __('Provide a category ID!', 'match'), 1); die; } //Verificamos si la categoría existe $cat = new MCHCategory($id); if ($cat->isNew()) { redirectMsg('./categories.php', __('Specified category was not found!', 'match'), 1); die; } } $form = new RMForm($edit ? __('Edit Category', 'match') : __('Add Category', 'match'), 'frmNew', 'categories.php'); $form->addElement(new RMFormText(__('Name', 'match'), 'name', 50, 150, $edit ? $cat->getVar('name') : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 150, $cat->getVar('nameid')), true); } $form->addElement(new RMFormEditor(__('Description', 'match'), 'desc', '100%', '250px', $edit ? $cat->getVar('description', 'e') : '')); $sel_cats = new RMFormSelect(__('Parent category:', 'match'), 'parent', 0, $edit ? $cat->getVar('parent') : 0); $categories = array(); MCHFunctions::categories_tree($categories, 0, 0, true, $edit ? $cat->id() : 0, '`name` ASC'); $sel_cats->addOption(0, __('Select category...', 'match'), $edit ? $cat->getVar('parent') == 0 ? 1 : 0 : 1); foreach ($categories as $catego) { $sel_cats->addOption($catego['id'], str_repeat('—', $catego['indent']) . ' ' . $catego['name']); } $form->addElement($sel_cats); $form->addElement(new RMFormYesNo(__('Enable category', 'match'), 'active', $edit ? $cat->getVar('active') : 1)); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $cat->id())); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'categos.php\';"'); $form->addElement($ele); $form = RMEvents::get()->run_event('match.form.categories', $form); $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(); }
/** * @desc Muestra el formulario para la creación de la postal */ function newPostcard() { global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $mc, $tpl, $img, $xoopsOption, $xoopsConfig; if (!$xoopsUser) { redirect_header(XOOPS_URL . '/user.php#register', 1, __('You must be a registered user in order to send postcards!', 'galleries')); die; } $image = new GSImage($img); if ($image->isNew()) { redirect_header(GSFunctions::get_url(), 1, __('Specified image does not exists!', 'galleries')); die; } $xoopsOption['template_main'] = "gs_postcard_form.html"; include 'header.php'; //Eliminamos las postales que han cumplido si tiempo GSFunctions::deletePostcard(); GSFunctions::makeHeader(); $tpl->assign('xoops_pagetitle', sprintf(__('Send Postcard', 'galleries'), $image->title())); $postlink = GSFunctions::get_url() . ($mc['urlmode'] ? 'postcard/new/img/' . $image->id() . '/' : '?postcard=new&img=' . $image->id()); $sendlink = str_replace('/new/', '/send/', $postlink); $form = new RMForm(__('Send Postcard', 'galleries'), 'frmNewPostcard', $sendlink); $form->addElement(new RMFormText(__('Your name', 'galleries'), 'fname', 50, 100, $xoopsUser->getVar('name')), true); $form->addElement(new RMFormText(__('Your email', 'galleries'), 'fmail', 50, 150, $xoopsUser->getVar('email')), true, 'email'); $form->addElement(new RMFormText(__('Friend name', 'galleries'), 'tname', 50, 100, ''), true); $form->addElement(new RMFormText(__('Friend email', 'galleries'), 'tmail', 50, 150, ''), true, 'email'); $form->addElement(new RMFormText(__('Postcard title', 'galleries'), 'title', 50, 150, $image->title(false)), true); $form->addElement(new RMFormTextArea(__('Postcard text', 'galleries'), 'msg', 0, 0, '', '90%', '150px'), true); $cap = RMEvents::get()->run_event('rmcommon.recaptcha.field'); if ($cap != '') { $form->addElement(new RMFormLabel(__('Please enter the captcha below', 'galleries'), $cap)); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', _SUBMIT, 'submit', 'onclick="$(\'op\').value=\'send\';"'); $previewlink = str_replace('/new/', '/preview/', $postlink); $ele->addButton('preview', __('Preview Postcard', 'galleries'), 'button', 'onclick="$(\'#frmNewPostcard\').attr(\'action\', \'' . $previewlink . '\'); $(\'#frmNewPostcard\').submit();"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', 'send')); $form->addElement(new RMFormHidden('img', $image->id())); $form->addElement(new RMFormHidden('uid', $xoopsUser->uid())); $form->addElement(new RMFormHidden('return', base64_encode($postlink))); $tpl->assign('postcard_form', $form->render()); include 'footer.php'; }
/** * 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(); }
function formCategory($edit = 0) { global $mc, $xoopsModule, $db; PWFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Category', 'works') : __('Add Category', 'works')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » \n\t\t<a href='categos.php'>" . __('Categories', 'works') . '</a> » ' . ($edit ? __('Edit Category', 'works') : __('Add Category', 'works'))); xoops_cp_header(); $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; if ($edit) { //Verificamos si la categoría es válida if ($id <= 0) { redirectMsg('./categos.php?op=edit&id=' . $id, __('Provide a category ID!', 'works'), 1); die; } //Verificamos si la categoría existe $cat = new PWCategory($id); if ($cat->isNew()) { redirectMsg('./categos.php?op=edit&id=' . $id, __('Specified category was not found!', 'works'), 1); die; } } $form = new RMForm($edit ? __('Edit Category', 'works') : __('Add Category', 'works'), 'frmNew', 'categos.php'); $form->addElement(new RMFormText(__('Name', 'works'), 'name', 50, 150, $edit ? $cat->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'works'), 'nameid', 50, 150, $cat->nameId()), true); } $form->addElement(new RMFormEditor(__('Description', 'works'), 'desc', '100%', '250px', $edit ? $cat->desc('e') : '')); $form->addElement(new RMFormYesNo(__('Enable category', 'works'), 'active', $edit ? $cat->active() : 1)); $form->addElement(new RMFormText(__('Display order', 'works'), 'order', 8, 3, $edit ? $cat->order() : 0), true, 'num'); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $cat->id())); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes!', 'works') : __('Add Now!', 'works'), 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'categos.php\';"'); $form->addElement($ele); $form = RMEvents::get()->run_event('works.form.categories', $form); $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 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(); }
} } else { include 'header.php'; //include '../../header.php'; $myts =& MyTextSanitizer::getInstance(); $hiddens['ok'] = 1; $hiddens['id'] = $id; $buttons['sbt']['value'] = __('Delete', 'bxpress'); $buttons['sbt']['type'] = 'submit'; $buttons['cancel']['value'] = __('Cancel', 'bxpress'); $buttons['cancel']['type'] = 'button'; $buttons['cancel']['extra'] = 'onclick="window.location=\'topic.php?pid=' . $id . '#p' . $id . '\';"'; $text = __('Dou you really wish to delete specified post?', 'bxpress'); if ($id == bXFunctions::getFirstId($topic->id())) { $text .= "<br /><br /><span class='bbwarning'>" . __('<strong>Warning:</strong> This is the first post in the topic. By deleting this all posts will be deleted also.', 'bxpress') . "</span>"; } $text .= "<br /><br /><strong>" . $post->uname() . ":</strong><br />"; $text .= substr($post->getVar('post_text', 'e'), 0, 100) . '...'; $form = new RMForm(__('Delete post?', 'bxpress'), 'frmDelete', 'delete.php'); $form->addElement(new RMFormHidden('ok', 1)); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormLabel('', $text)); $but = new RMFormButtonGroup(); $but->addButton('sbt', __('Delete!', 'bxpress'), 'submit'); $but->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1);"'); $form->addElement($but); echo $form->render(); $tpl->assign('xoops_pagetitle', __('Delete Post?', 'bxpress') . ' » ' . $xoopsModuleConfig['forum_title']); include 'footer.php'; //include '../../footer.php'; }
/** * Muestra las características existentes de una descarga */ function dt_show_files($edit = 0) { global $xoopsOption, $db, $tpl, $xoopsTpl, $xoopsUser, $mc, $dtfunc, $page, $item, $xoopsConfig, $xoopsModuleConfig, $file; include 'header.php'; $dtfunc->cpHeader($item, sprintf(__('%s files', 'dtransport'), $item->getVar('name'))); if ($file > 0 && $edit) { $file = new DTFile($file); if ($file->isNew() || $file->software() != $item->id()) { redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->id() . '/' : '/?p=cpanel&action=files&id=' . $item->id()), 1, __('Specified feature does not exists!', 'dtransport')); } } $tc = TextCleaner::getInstance(); $tf = new RMTimeFormatter('', "%m%/%d%/%Y% %h%:%i%"); $rmu = RMUtilities::get(); $tfiles = $db->prefix('dtrans_files'); $tgroup = $db->prefix('dtrans_groups'); $sql = "SELECT * FROM {$tfiles} WHERE id_soft=" . $item->id(); $gcache = array(); $result = $db->queryF($sql); while ($rows = $db->fetchArray($result)) { $fl = new DTFile(); $fl->assignVars($rows); if (!isset($gcache[$fl->group()])) { $gcache[$fl->group()] = new DTFileGroup($fl->group()); } $group = $gcache[$fl->group()]; $xoopsTpl->append('files', array('id' => $fl->id(), 'title' => $fl->title(), 'date' => $tf->format($fl->date()), 'software' => $item->getVar('name'), 'remote' => $fl->remote(), 'size' => $rmu->formatBytesSize($fl->size()), 'hits' => $fl->hits(), 'date' => $tf->format($fl->date()), 'group' => $group->isNew() ? '' : $group->name(), 'links' => array('edit' => DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->getVar('nameid') . '/edit/' . $fl->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=files&feature=' . $fl->id()), 'delete' => DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->getVar('nameid') . '/delete/' . $fl->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=delete&feature=' . $fl->id())))); } $formurl = DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->id() . '/save/' . ($edit ? $file->id() : '0') . '/' : '/p=cpanel'); // files Form $form = new RMForm($edit ? sprintf(__('Editing file of "%s"', 'dtransport'), $item->getVar('name')) : sprintf(__('New file for "%s"', 'dtransport'), $item->getVar('name')), 'frmFile', $formurl); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $item->getVar('name'))); $form->addElement(new RMFormText(__('File title', 'dtransport'), 'title', 50, 200, $edit ? $file->title() : ''), true); //Lista de grupos $sql = "SELECT * FROM " . $db->prefix('dtrans_groups') . " WHERE id_soft=" . $item->id(); $result = $db->query($sql); $groups = array(); while ($rows = $db->fetchArray($result)) { $group = new DTFileGroup(); $group->assignVars($rows); $groups[] = array('id' => $group->id(), 'name' => $group->name()); } $ele = new RMFormSelect(__('Group', 'dtransport'), 'group', 0, $edit ? $file->group() : ''); $ele->addOption('', __('Select group...', 'dtransport')); foreach ($groups as $group) { $ele->addOption($group['id'], $group['name']); } $form->addElement($ele); $form->addElement(new RMFormYesNo(__('Default file', 'dtransport'), 'default', $edit ? $file->isDefault() : 0)); $form->addElement(new RMFormYesNo(__('Remote file', 'dtransport'), 'remote', $edit ? $file->remote() : 0)); $form->addElement(new RMFormFile(__('File', 'dtransport'), 'thefile', 50, $xoopsModuleConfig['size_file'] * 1024 * 1024)); if ($edit) { $form->addElement(new RMFormLabel(__('Current file', 'dtransport'), $file->file())); } $form->addElement(new RMFormText(__('File URL', 'dtransport'), 'url', 50, 200, $edit ? $file->title() : ''))->setDescription(__('Used only when remote file is activated.', 'dtransport')); $form->addElement(new RMFormHidden('action', 'save')); $form->addElement(new RMFormHidden('id', $item->id())); $form->addElement(new RMFormHidden('file', $edit ? $file->id() : 0)); $form->addElement(new RMFormHidden('op', 'save')); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save Changes', 'dtransport') : __('Save File', 'dtransport'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'dtransport'), 'button', 'onclick="window.location=\'' . (DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->id() . '/' : '/?p=cpanel&action=files&id=' . $item->id())) . '\';"'); $form->addElement($buttons); $xoopsTpl->assign('file_form', $form->render()); $tpl->add_xoops_style('cpanel.css', 'dtransport'); $tpl->add_head_script('$(document).ready(function(){ $("a.delete").click(function(){ if(!confirm("' . __('Do you really want to delete selected file?', 'dtransport') . '")) return false; }); });'); $xoopsTpl->assign('lang_id', __('ID', 'dtransport')); $xoopsTpl->assign('lang_title', __('Title', 'dtransport')); $xoopsTpl->assign('lang_group', __('Group', 'dtransport')); $xoopsTpl->assign('lang_remote', __('Remote', 'dtransport')); $xoopsTpl->assign('lang_size', __('Size', 'dtransport')); $xoopsTpl->assign('lang_hits', __('Hits', 'dtransport')); $xoopsTpl->assign('lang_date', __('Date', 'dtransport')); $xoopsTpl->assign('lang_edit', __('Edit', 'dtransport')); $xoopsTpl->assign('lang_delete', __('Delete', 'dtransport')); $xoopsTpl->assign('lang_addfile', __('Add File', 'dtransport')); $xoopsTpl->assign('edit', $edit); include 'footer.php'; }
if (!$xoopsModuleConfig['html']) { if ($type == 'tiny' || $type == 'html') { $type = 'simple'; } } $form->addElement(new RMFormEditor(__('Post', 'bxpress'), 'msg', 'auto', '400px', isset($quote) ? $quote : ''), true); // Adjuntar Archivos if ($forum->attachments() && $forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS, 'attach')) { $ele = new RMFormFile(__('Attach file', 'bxpress'), 'attach', 45, $xoopsModuleConfig['maxfilesize'] * 1024); $ele->setDescription(sprintf(__('Allowed file types: %s', 'bxpress'), implode(',', $forum->extensions()))); $form->addElement($ele); $form->setExtra('enctype="multipart/form-data"'); } $form->addElement(new RMFormHidden('op', 'post')); $form->addElement(new RMFormHidden($fid > 0 ? 'fid' : 'tid', $fid > 0 ? $fid : $tid)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Send', 'bxpress'), 'submit'); $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="history.go(-1)";'); $form->addElement($ele); $tpl->assign('topic_form', $form->render()); /** * @desc Cargamos los mensajes realizados en este tema */ if ($mc['numpost'] > 0 && !$create) { $sql = "SELECT * FROM " . $db->prefix("bxpress_posts") . " WHERE id_topic='" . $topic->id() . "' ORDER BY post_time DESC LIMIT 0, {$mc['numpost']}"; $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $post = new bXPost(); $post->assignVars($row); $tpl->append('posts', array('id' => $post->id(), 'text' => $post->text(), 'time' => date($xoopsConfig['datestring'], $post->date()), 'uname' => $post->uname())); }
/** * @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 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(); }
function m_field_form($edit = 0) { global $xoopsModule, $xoopsModuleConfig; MCHFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Field', 'match') : __('Add Field', 'match')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » \n <a href='fields.php'>" . __('Fields', 'match') . '</a> » ' . ($edit ? __('Edit Field', 'match') : __('Add Field', 'match'))); xoops_cp_header(); $id = rmc_server_var($_REQUEST, 'id', 0); if ($edit) { //Verificamos si la categoría es válida if ($id <= 0) { redirectMsg('./fields.php', __('Provide a field ID!', 'match'), 1); die; } //Verificamos si la categoría existe $field = new MCHField($id); if ($field->isNew()) { redirectMsg('./fields.php', __('Specified field was not found!', 'match'), 1); die; } } $form = new RMForm($edit ? __('Edit Field', 'match') : __('Add Field', 'match'), 'frmNew', 'fields.php'); $form->addElement(new RMFormText(__('Name', 'match'), 'name', 50, 200, $edit ? $field->getVar('name') : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 200, $field->getVar('nameid')), true); } $form->addElement(new RMFormEditor(__('Description', 'match'), 'description', '100%', '250px', $edit ? $field->getVar('description', 'e') : '')); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $field->id())); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'fields.php\';"'); $form->addElement($ele); $form = RMEvents::get()->run_event('match.form.fields', $form); $form->display(); RMTemplate::get()->add_style('admin.css', 'match'); xoops_cp_footer(); }
function configure_rm_plugin() { $name = rmc_server_var($_GET, 'plugin', ''); if ($name == '') { redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1); die; } $plugin = new RMPlugin($name); if ($plugin->isNew()) { redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1); die; } if (!$plugin->getVar('status')) { redirectMsg('plugins.php', __('Specified plugin is not active!', 'rmcommon'), 1); die; } $rmc_config = RMFunctions::configs(); $settings = RMFunctions::get()->plugin_settings($name, true); $form = new RMForm(sprintf(__('%s configuration', 'rmcommon'), $plugin->getVar('name')), 'frmconfig', 'plugins.php'); $form->addElement(new RMFormHidden('plugin', $plugin->getVar('dir'))); $form->addElement(new RMFormHidden('action', 'savesettings')); foreach ($plugin->options() as $config => $option) { if (isset($settings[$config])) { $option['value'] = $settings[$config]; } if (isset($option['separator']) && !empty($option['separator'])) { $form->addElement(new RMFormSubTitle($option['separator']['title'], 1, '', $option['separator']['desc'])); continue; } switch ($option['fieldtype']) { case 'checkbox_groups': case 'group_multi': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 1, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio_groups': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 1, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'group': case 'select_groups': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 0, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_groups_multi': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 0, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'editor': if ($rmc_config['editor_type'] == 'tiny') { $tiny = TinyEditor::getInstance(); $tiny->add_config('elements', 'conf_' . $config); } $ele = new RMFormEditor($option['caption'], 'conf_' . $config, is_numeric($option['size']) ? '90%' : $option['size'], '300px', $option['value'], '', 1, array('op')); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'theme': case 'select_theme': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'theme_multi': case 'select_theme_multi': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_theme': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 4); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_theme_admin': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3, 'GUI'); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'yesno': $ele = new RMFormYesNo($option['caption'], 'conf_' . $config, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'email': $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele, false, 'email'); break; case 'select': $ele = new RMFormSelect($option['caption'], 'conf_' . $config); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } foreach ($option['options'] as $op => $opvalue) { $ele->addOption($opvalue, $op, $opvalue == $option['value'] ? 1 : 0); } $form->addElement($ele); break; case 'select_multi': $ele = new RMFormSelect($option['caption'], 'conf_' . $config . '[]', 1, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } foreach ($option['options'] as $op => $opvalue) { $ele->addOption($opvalue, $op); } $form->addElement($ele); break; case 'language': case 'select_language': $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_language_multi': $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_language': $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'startpage': case 'select_modules': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_modules_multi': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_modules': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio_modules': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'timezone': case 'select_timezone': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_timezone_multi': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_timezone': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio_timezone': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'tplset': $ele = new RMFormSelect($option['caption'], 'conf_' . $config); $tplset_handler =& exm_gethandler('tplset'); $tplsetlist =& $tplset_handler->getList(); asort($tplsetlist); foreach ($tplsetlist as $key => $name) { $ele->addOption($key, $name, $option['value'] == $key ? 1 : 0); } $form->addElement($ele); break; case 'textarea': $ele = new RMFormTextArea($option['caption'], 'conf_' . $config, 5, $option['size'] > 0 ? $option['size'] : 50, $option['valuetype'] == 'array' ? $cleaner->htmlspecialchars(implode('|', $option['value'])) : $cleaner->htmlspecialchars($option['value'])); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'module_cache': $ele = new RMFormCacheModuleField($option['caption'], 'conf_' . $config, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'user_select': $ele = new RMFormUser($option['caption'], 'conf_' . $config, $form->getName(), $option['value'], 'select', $limit = '300', ''); $ele->setOnPage("document.forms[0].op.value='config';"); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio': $ele = new RMFormRadio($option['caption'], 'conf_' . $config, 1); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } foreach ($option['options'] as $op => $opvalue) { $ele->addOption($op, $opvalue, $opvalue == $option['value'] ? 1 : 0); } $form->addElement($ele); break; case 'font_select': $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value'])); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $fonts = EXMLists::getFileListAsArray(ABSPATH . '/rmcommon/fonts/'); foreach ($fonts as $font) { $info = pathinfo(ABSPATH . '/rmcommon/fonts/' . $font); if (strtoupper($info['extension']) != 'TTF') { continue; } $ele->addOption($font, $font); } $form->addElement($ele); break; case 'select_editor': $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value'])); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $ele->addOption('tiny', __('Visual Editor', 'rmcommon')); $ele->addOption('code', __('EXMCode Editor', 'rmcommon')); $ele->addOption('textarea', __('Simple Editor', 'rmcommon')); $ele->addOption('html', __('HTML Editor', 'rmcommon')); $form->addElement($ele); break; case 'textbox': case 'password': default: $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['valuetype'] == 'array' ? implode('|', $option['value']) : $option['value'], $option['fieldtype'] == 'password' ? 1 : 0); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele, false, $option['valuetype'] == 'int' || $option['valuetype'] == 'float' ? 'num' : ''); break; } } $ele = new RMFormButtonGroup(); $ele->addButton('', __('Save Settings', 'rmcommon'), 'submit'); $ele->addButton('', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele); // Other components can add items to database $form = RMEvents::get()->run_event("rmcommon.settings.form", $form, $plugin); RMFunctions::create_toolbar(); xoops_cp_header(); $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(); }
/** * 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); } }
$form->addElement(new RMFormLabel(__('Posted date', 'rmcommon'), formatTimestamp($comment->getVar('posted'), 'mysql'))); $form->addElement(new RMFormLabel(__('Module', 'rmcommon'), $comment->getVar('id_obj'))); if ($xoopsUser->isAdmin()) { $user = new RMCommentUser($comment->getVar('user')); $ele = new RMFormUser(__('Poster', 'rmcommon'), 'user', false, $user->getVar('xuid') > 0 ? $user->getVar('xuid') : 0); $form->addElement($ele); } if ($xoopsUser->isAdmin($comment->getVAr('id_obj'))) { $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('action', 'saveedit')); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Update Comment', 'rmcommon'), 'submit'); $ele->addButton('cancel', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele); $form->addElement(new RMFormHidden('ret', rmc_server_var($_GET, 'ret', XOOPS_URL))); $form->addElement(new RMFormHidden('id', $id)); // Event to modify or add new elements to comments form $form = RMEvents::get()->run_event('rmcommon.edit.comment.form', $form); $form->display(); include '../../footer.php'; } elseif ($action == 'saveedit') { $ret = rmc_server_var($_POST, 'ret', ''); $id = rmc_server_var($_POST, 'id', 0); $page = rmc_server_var($_POST, 'page', 1); $filter = rmc_server_var($_POST, 'filter', ''); $w = rmc_server_var($_POST, 'w', '1');
$form->addElement($ele, true); // Grupos autorizados $form->addElement(new RMFormGroups(__('Allowed groups', 'dtransport'), 'groups', 1, 1, 1, $edit ? $item->getVar('groups') : array(0))); // Descarga segura if ($mc['secure_public']) { $form->addElement(new RMFormYesNo(__('Protected download', 'dtransport'), 'secure', $edit ? $item->getVar('secure') : 0))->setDescription(__('Protected downloads will be stored in a secure directory and only can not be download directly.', 'dtransport')); } // Descarga con contraseña if ($mc['pass_public']) { $form->addElement(new RMFormText(__('Password for this download', 'dtransport'), 'password', $edit ? $item->getVar('password') : 0))->setDescription(__('Only users than knows the password will download this item.', 'dtransport')); } // Autor e idioma $form->addElement(new RMFormSubTitle(__('Author Information', 'dtransport'))); $form->addElement(new RMFormText(__('Author name', 'dtransport'), 'author_name', 50, 150, $edit ? $item->getVar('author_name') : ''), true); $form->addElement(new RMFormText(__('Author URL', 'dtransport'), 'author_url', 50, 255, $edit ? $item->getVar('author_url') : ''), true); $form->addElement(new RMFormText(__('Author email', 'dtransport'), 'author_email', 50, 255, $edit ? $item->getVar('author_email') : ''), true); $form->addElement(new RMFormYesNo(__('Author can be contacted', 'dtransport'), 'author_contact', $edit ? $item->getVar('author_contact') : 1)); $form->addElement(new RMFormText(__('Available languages', 'dtransport'), 'langs', 50, 255, $edit ? $item->getVar('langs') : '')); $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', _SUBMIT, 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'' . XOOPS_URL . "/modules/dtransport/mydownloads.php" . '\';"'); $form->addElement($buttons); echo $form->render(); // Ubicación Actual $location = "<strong>" . _MS_DT_YOUREHERE . "</strong> <a href='" . DT_URL . "'>" . $xoopsModule->name() . "</a> » "; $location .= _MS_DT_SEND; $tpl->assign('dt_location', $location); include 'footer.php'; }
function m_teams_form($edit = 0) { global $mc, $xoopsModule, $db; MCHFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Team', 'match') : __('Add Team', 'match')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » \n <a href='teams.php'>" . __('Teams', 'match') . '</a> » ' . ($edit ? __('Edit Team', 'match') : __('Add Team', 'match'))); xoops_cp_header(); $id = rmc_server_var($_REQUEST, 'id', 0); if ($edit) { //Verificamos si la categoría es válida if ($id <= 0) { redirectMsg('./teams.php', __('Provide a team ID!', 'match'), 1); die; } //Verificamos si la categoría existe $team = new MCHTeam($id); if ($team->isNew()) { redirectMsg('./teams.php', __('Specified team was not found!', 'match'), 1); die; } } $form = new RMForm($edit ? __('Edit Team', 'match') : __('Add Team', 'match'), 'frmNew', 'teams.php'); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new RMFormText(__('Name', 'match'), 'name', 50, 150, $edit ? $team->getVar('name') : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 150, $team->getVar('nameid')), true); } $form->addElement(new RMFormEditor(__('Team Information', 'match'), 'info', '100%', '250px', $edit ? $team->getVar('info', 'e') : '')); $sel_cats = new RMFormSelect(__('Category:', 'match'), 'category', 0, $edit ? array($team->getVar('category')) : 0); $categories = array(); MCHFunctions::categories_tree($categories, 0, 0, true, 0, '`name` ASC'); $sel_cats->addOption(0, __('Select category...', 'match'), $edit ? $team->getVar('category') == 0 ? 1 : 0 : 1); foreach ($categories as $catego) { $sel_cats->addOption($catego['id'], str_repeat('—', $catego['indent']) . ' ' . $catego['name']); } $form->addElement($sel_cats, true); $form->addElement(new RMFormYesNo(__('Active', 'match'), 'active', $edit ? $team->getVar('active') : 1)); $form->addElement(new RMFormDate(__('Registered on', 'match'), 'created', $edit ? $team->getVar('created') : time(), false)); $form->addElement(new RMFormFile(__('Team logo', 'match'), 'logo', 45)); if ($edit) { $form->addElement(new RMFormLabel(__('Current logo', 'match'), '<img src="' . MCH_UP_URL . '/' . $team->getVar('logo') . '" alt="' . $team->getVar('name') . '" />')); } $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $team->id())); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'teams.php\';"'); $form->addElement($ele); $form = RMEvents::get()->run_event('match.form.teams', $form); $form->display(); xoops_cp_footer(); }