/** * 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(); }
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 pw_comments_edit($options, &$form) { global $db; $form = new RMForm(__('Block Options', 'works')); $form->addElement(new RMFormText(__('Comments number', 'works'), 'options[0]', 5, 5, $options[0] ? $options[0] : 1), true); $ele = new RMFormSelect(__('Works type', 'works'), 'options[1]'); $ele->addOption(0, __('Random', 'works'), $options[1] == 0 ? 1 : 0); $ele->addOption(1, __('Recent works', 'works'), $options[1] == 1 ? 1 : 0); $form->addElement($ele); return $form->render(false); }
/** * 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'; }
/** * @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(); }
/** * @desc Formulario de creación/edición de clientes **/ function formClients($edit = 0) { global $xoopsModule, $db; $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : ''; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15; $ruta = "pag={$page}&limit={$limit}"; if ($edit) { //Verificamos si el cliente es válido if ($id <= 0) { redirectMsg('./clients.php?' . $ruta, __('You must provide a customer ID', 'works'), 1); die; } //Verificamos si el cliente existe $client = new PWClient($id); if ($client->isNew()) { redirectMsg('./clients.php?' . $ruta, __('Specified customer does not exists!', 'works'), 1); die; } } xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » <a href='./clients.php'>" . __('Customers', 'works') . "</a> »" . ($edit ? __('Edit Customer', 'works') : __('New Customer', 'works'))); RMTemplate::get()->assign('xoops_pagetitle', __('Customers', 'works')); PWFunctions::toolbar(); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Customer', 'works') : __('New Customer', 'works'), 'frmClient', 'clients.php'); $form->addElement(new RMFormText(__('Name', 'works'), 'name', 50, 200, $edit ? $client->name() : ''), true); $form->addElement(new RMFormText(__('Company', 'works'), 'business', 50, 200, $edit ? $client->businessName() : '')); $form->addElement(new RMFormText(__('Email address', 'works'), 'mail', 50, 100, $edit ? $client->email() : '')); $form->addElement(new RMFormTextArea(__('Description', 'works'), 'desc', 4, 50, $edit ? $client->desc() : ''), true); //Tipos de Cliente $ele = new RMFormSelect(__('Type', 'works'), 'type'); $ele->addOption(0, _SELECT); $result = $db->query("SELECT * FROM " . $db->prefix('pw_types')); while ($row = $db->fetchArray($result)) { $ele->addOption($row['id_type'], $row['type'], $edit ? $row['id_type'] == $client->type() ? 1 : 0 : 0); } $form->addElement($ele, true, 'noselect: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('limit', $limit)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes', 'works') : __('Create Customer', 'works'), 'submit'); $ele->addButton('cancel', __('Cancel', 'works'), 'button', 'onclick="window.location=\'clients.php?' . $ruta . '\';"'); $form->addElement($ele); //Event $form = RMEvents::get()->run_event('works.form.customers', $form); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de características **/ function dt_form_features($edit = 0) { global $xoopsModule, $xoopsConfig, $functions, $tpl; define('RMCSUBLOCATION', 'newfeature'); $id = rmc_server_var($_REQUEST, 'id', 0); $item = rmc_server_var($_REQUEST, 'item', 0); //Verificamos que el software sea válido if ($item <= 0) { redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN); } //Verificamos que el software exista $sw = new DTSoftware($item); if ($sw->isNew()) { redirectMsg('items.php', __('Specified download item does not exists!', 'dtransport'), RMMSG_ERROR); } if ($edit) { if ($id <= 0) { redirectMsg('features.php?item=' . $item, __('Feature ID not specified!', 'dtransport'), RMMSG_WARN); } //Verificamos que la característica exista $ft = new DTFeature($id); if ($ft->isNew()) { redirectMsg('features.php?item=' . $item, __('Specified feature does not exists!', 'dtransport'), RMMSG_ERROR); } } $functions->toolbar(); //styles $tpl->add_style('admin.css', 'dtransport'); //scripts include_once DT_PATH . '/include/js_strings.php'; xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='items.php'>" . __('Downloads', 'dtransport') . "</a> » " . ($edit ? __('Edit Feature', 'dtransport') : __('New Feature', 'dtransport'))); xoops_cp_header(); $form = new RMForm($edit ? sprintf(__('Editing feature of "%s"', 'dtransport'), $sw->getVar('name')) : sprintf(__('New feature for "%s"', 'dtransport'), $sw->getVar('name')), 'frmfeat', 'features.php'); $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $sw->getVar('name'))); $form->addElement(new RMFormText(__('Feature title', 'dtransport'), 'title', 50, 200, $edit ? $ft->title() : ''), true); $form->addElement(new RMFormText(__('Short name', 'dtransport'), 'nameid', 50, 200, $edit ? $ft->nameId() : '')); $form->addElement(new RMFormEditor(__('Feature content', 'dtransport'), 'content', '90%', '350px', $edit ? $ft->content() : ''), true); $functions->meta_form('feat', $edit ? $ft->id() : 0, $form); $form->addElement(new RMFormHidden('action', $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=\'features.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(); }
/** * 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(); }
function pw_works_edit($options) { global $db; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwcategory.class.php'; //Tipo de Trabajo $form = new RMForm(__('Block Options', 'works'), 'form_options', ''); $ele = new RMFormSelect(__('Works type', 'works'), 'options[0]'); $ele->addOption(0, __('Reandom works', 'works'), $options[0] == 0 ? 1 : 0); $ele->addOption(1, __('Featured works', 'works'), $options[0] == 1 ? 1 : 0); $ele->addOption(2, __('Recent works', 'works'), $options[0] == 2 ? 1 : 0); $form->addElement($ele); //Obtenemos las categorías $ele = new RMFormSelect(__('Category', 'works'), 'options[1]'); $ele->addOption(0, __('All categories', 'works')); $db = XoopsDatabaseFactory::getDatabaseConnection(); $result = $db->query("SELECT * FROM " . $db->prefix('pw_categos') . " WHERE active=1"); while ($row = $db->fetchArray($result)) { $cat = new PWCategory(); $cat->assignVars($row); $ele->addOption($cat->id(), $cat->name(), $options[1] == $cat->id() ? 1 : 0); } $form->addElement($ele, true); //Obtenemos los clientes $ele = new RMFormSelect(__('Customer', 'works'), 'options[2]'); $ele->addOption(0, __('All customers', 'works')); $result = $db->query("SELECT * FROM " . $db->prefix('pw_clients')); while ($row = $db->fetchArray($result)) { $client = new PWClient(); $client->assignVars($row); $ele->addOption($client->id(), $client->name(), isset($ptions[2]) ? $options[2] == $client->id() ? 1 : 0 : 0); } $form->addElement($ele, true); //Número de trabajos $form->addElement(new RMFormText(__('Works number', 'works'), 'options[3]', 5, 5, isset($options[3]) ? $options[3] : ''), true); $form->addElement(new RMFormText(__('Columns', 'works'), 'options[4]', 5, 5, isset($options[4]) ? $options[4] : ''), true); $form->addElement(new RMFormYesno(__('Show work image', 'works'), 'options[5]', isset($options[5]) ? $options[5] ? 1 : 0 : 0), true); $form->addElement(new RMFormYesno(__('Show description', 'works'), 'options[6]', isset($options[6]) ? $options[6] ? 1 : 0 : 0), true); return $form->render(false); }
/** * @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(); }
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(); }
/** * 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'; }
/** * 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 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(); }
/** * @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(); }
function showForm() { global $xoopsUser, $tpl, $xoopsOption, $xoopsModule, $xoopsModuleConfig; $xoopsOption['template_main'] = "coach_comments.html"; include 'header.php'; $tpl->assign('comment_text', $mc['comment']); $tpl->assign('coach_title', _MS_TC_PTITLE); $tpl->assign('lang_comment', _MS_TC_COMMENT); $tpl->assign('xoops_pagetitle', _MS_TC_PTITLE); $location = "<a href='" . TC_URL . "'>" . $xoopsModule->name() . "</a> » " . _MS_TC_PTITLE; $tpl->assign('coach_location', $location); $form = new RMForm(_MS_TC_FTITLE, 'frmComment', 'comment.php'); $form->addElement(new RMFormText(_MS_TC_FNAME, 'name', 50, 150), true); $form->addElement(new RMFormText(_MS_TC_FEMAIL, 'email', 50, 150, $xoopsUser ? $xoopsUser->getVar('email') : ''), true, 'email'); $form->addElement(new RMFormTextArea(_MS_TC_FCOMMENT, 'comment', 10, 60, ''), true); $form->addElement(new RMFormButton('sbt', _SUBMIT, 'submit')); $form->addElement(new RMFormHidden('op', 'send')); $tpl->assign('form', $form->render()); include 'footer.php'; }
/** * @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 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(); }
/** * 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); } }
} } 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'; }
/** * @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); $form->addElement(new RMFormLabel(__('Please enter the captcha below', 'galleries'), RMEvents::get()->run_event('rmcommon.recaptcha.field'))); $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'; }
/** * 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'; }
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(); }
/** * @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(); }
redirect_header(DT_URL, 2, __('Item not found. Please try again!', 'dtransport')); } //Verificamos si se aprueba la edicion if (!$mc['aprove_edit'] && $item->getVar('approved')) { // Si no se aprueba almacenaremos los datos en // la tabla para elementos editados $item = new DTSoftwareEdited($id); $item->setSoftware($id); } if ($item->getVar('uid') != $xoopsUser->uid()) { redirect_header(DT_URL, 1, __('You can not edit this download item!', 'dtransport')); } } include 'header.php'; $dtfunc->makeHeader(); $form = new RMForm($edit ? __('Editing Download Item', 'dtransport') : __('Create New Download Item', 'dtransport'), 'frmsw', $mc['permalinks'] ? DT_URL . '/submit/' : DT_URL . '/?p=submit'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Download name', 'dtransport'), 'name', 50, 150, $edit ? $item->getVar('name') : ''), true); $form->addElement(new RMFormText(__('Download version', 'dtransport'), 'version', 10, 50, $edit ? $item->getVar('version') : ''), true); //Lista de categorías $ele = new RMFormSelect(__('Categories', 'dtransport'), 'category[]', 1, $edit ? $item->categories() : array()); $ele->addOption(0, __('Select...', 'dtransport'), $edit ? 0 : 1); $categos = array(); $dtfunc->getCategos($categos, 0, 0, array(), true, 1); foreach ($categos as $k) { $cat =& $k['object']; $ele->addOption($cat->id(), str_repeat('--', $k['jumps']) . ' ' . $cat->name(), $edit ? in_array($cat->id(), $item->categories()) ? 1 : 0 : 0); } $form->addElement($ele, true, 'noselect:0'); $form->addElement(new RMFormEditor(__('Short description', 'dtransport'), 'shortdesc', 'auto', '50px', $edit ? $item->getVar('shortdesc') : '', 'simple'), true); $form->addElement(new RMFormEditor(__('Full description', 'dtransport'), 'description', 'auto', '350px', $edit ? $item->getVar('desc') : ''), true);
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(); }
die; } // Check if user is owner $editor = new RMCommentUser($comment->getVar('user')); if ($xoopsUser->uid() != $editor->getVar('xuid') && !$xoopsUser->isAdmin($comment->getVar('id_obj'))) { redirect_header(rmc_server_var($_REQUEST, 'ret', XOOPS_URL), 1, __('You are not allowed to edit this comment!', 'rmcommon')); die; } include '../../header.php'; $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', 'post_comment.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'))); 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);