function formCoachs($edit = 0) { global $xoopsModule, $db, $mc, $xoopsConfig; if ($edit) { $id = TCFunctions::get('id'); if ($id <= 0) { redirectMsg('coachs.php', __('Id no válido', 'admin_team'), 1); die; } $coach = new TCCoach($id); if ($coach->isNew()) { redirectMsg('coachs.php', __('El entrenador especificado no existe', 'admin_team'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./coachs.php'>" . __('Entrenadores', 'admin_team') . "</a> » " . ($edit ? __('Editar entrenador', 'admin_team') : __('Crear entrenador', 'admin_team'))); $cHead = '<link href="' . TC_URL . '/styles/admin.css" media="all" rel="stylesheet" type="text/css" />'; xoops_cp_header($cHead); $form = new RMForm($edit ? __('Editar Entrenador', 'admin_team') : __('Crear Entrenador', 'admin_team'), 'frmNew', 'coachs.php', 'post'); $form->oddClass('oddForm'); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new RMFormText(__('Nombre', 'admin_team'), 'name', 50, 150, $edit ? $coach->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 150, $coach->nameId())); } $form->addElement(new RMFormText(__('Cargo', 'admin_team'), 'role', 50, 150, $edit ? $coach->role() : ''), true); $form->addElement(new RMFormFile(__('Imagen', 'admin_team'), 'image', 45, $mc['filesize'] * 1024)); if ($edit && $coach->image() != '') { $form->addElement(new RMFormLabel(__('Imagen actual', 'admin_team'), "<img src='" . XOOPS_URL . "/uploads/teams/coachs/ths/" . $coach->image() . "' alt='' />")); } $form->addElement(new RMFormEditor(__('Biografía', 'admin_team'), 'bio', '90%', '300px', $edit ? $coach->bio('e') : '')); $form->addElement(new RMFormSubTitle(__('Equipos', 'admin_team'), 1)); $ele = new RMFormCheck(__('Seleccionar equipos', 'admin_team')); $ele->asTable(3); $sql = "SELECT * FROM " . $db->prefix("coach_teams") . " ORDER BY name"; $result = $db->query($sql); if ($edit) { $teams = $coach->teams(false); } while ($row = $db->fetchArray($result)) { $team = new TCTeam(); $team->assignVars($row); $cat =& $team->category(true); $ele->addOption($team->name() . " <span class='coachNameCat'>(" . $cat->name() . ")</span>", 'teams[]', $team->id(), $edit ? in_array($team->id(), $teams) ? 1 : 0 : 0); } $form->addElement($ele); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Enviar', 'admin_team'), 'submit'); $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'coachs.php\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->display(); xoops_cp_footer(); }
/** * @desc Formulario 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'; }
/** * 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'; }
/** * @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(); }
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(); }
} //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); $form->addElement(new RMFormImage(__('Default image', 'dtransport'), 'image', $edit ? $item->getVar('image') : ''));
$quote = "[quote=" . $post->uname() . "]" . $post->getVar('post_text', 'n') . "[/quote]\n\n"; } $type = $rmc_config['editor_type']; // Verificamos el tipo de editor 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)) {
function formPlayer($edit = 0) { global $xoopsModule, $mc, $xoopsConfig, $rmc_config; $idteam = TCFunctions::request('team'); if ($idteam <= 0) { redirectMsg('teams.php', __('Selecciona un equipo antes de crear jugadores', 'admin_team'), 1); die; } $team = new TCTeam($idteam); if ($team->isNew()) { redirectMsg('teams.php', __('El equipo seleccionado no existe', 'admin_team'), 1); die; } if ($edit) { $id = TCFunctions::get('id'); if ($id <= 0) { redirectMsg('players.php?team=' . $idteam, __('El id del jugador no es válido', 'admin_team'), 1); die; } $player = new TCPlayer($id); if ($player->isNew()) { redirectMsg('players.php?team=' . $isteam, __('El jugador seleccionado no existe', 'admin_team'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./players.php?team={$idteam}'>" . __('Jugadores', 'admin_team') . "</a> » " . ($edit ? __('Editar jugador', 'admin_team') : __('Crear jugador', 'admin_team'))); xoops_cp_header(); $form = new RMForm($edit ? __('Editar Jugador', 'admin_team') : __('Crear Jugador', 'admin_team'), 'frmNew', 'players.php'); $form->oddClass('oddForm'); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new RMFormLabel(__('Equipo', 'admin_team'), "<h2 style='margin: 0;'>" . $team->name() . "</h2>")); $form->addElement(new RMFormText(__('Nombre del jugador'), 'name', 50, 100, $edit ? $player->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 100, $player->nameId())); } $ele = new RMFormDate(__('Fecha de nacimiento', 'admin_team'), 'birth', $edit ? $player->birth() : null); $form->addElement($ele); $form->addElement(new RMFormText(__('Número', 'admin_team'), 'number', 5, 3, $edit ? $player->number() : ''), true, 'num'); $form->addElement(new RMFormFile(__('Imagen', 'admin_team'), 'image', 45)); if ($edit && $player->image() != '') { $form->addElement(new RMFormLabel(__('Imagen actual', 'admin_team'), "<img src='" . XOOPS_URL . "/uploads/teams/players/ths/" . $player->image() . "' alt='' />")); } $form->addElement(new RMFormEditor(__('Información', 'admin_team'), 'bio', '90%', '300px', $edit ? $player->bio('e') : '')); if ($edit) { $html = $player->getVar('dohtml'); $xcode = $player->getVar('doxcode'); $doimage = $player->getVar('doimage'); $smiley = $player->getVar('dosmiley'); $br = $player->getVar('dobr'); } else { $html = $rmc_config['editor_type'] == 'tiny' ? 1 : 0; $xcode = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; $doimage = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; $smiley = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; $br = $rmc_config['editor_type'] == 'tiny' ? 0 : 1; } $form->addElement(new RMFormTextOptions(__('Opciones', 'admin_team'), $html, $xcode, $doimage, $smiley, $br)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Enviar', 'admin_team'), 'submit'); $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'players.php?team=' . $team->id() . '\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->addElement(new RMFormHidden('team', $idteam)); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de creación/edición de Imágenes **/ function formImages($edit = 0) { global $xoopsModule, $xoopsModuleConfig; $id = rmc_server_var($_REQUEST, 'id', 0); $work = rmc_server_var($_REQUEST, 'work', 0); $page = rmc_server_var($_REQUEST, 'page', 0); $ruta = "&page={$page}"; //Verificamos que el trabajo sea válido if ($work <= 0) { redirectMsg('./works.php', __('You must specify a work ID!', 'works'), 1); die; } //Verificamos que el trabajo exista $work = new PWWork($work); if ($work->isNew()) { redirectMsg('./works.php', __('Specified work does not exists!', 'works'), 1); die; } if ($edit) { //Verificamos que la imagen sea válida if ($id <= 0) { redirectMsg('./images.php?work=' . $work->id() . $ruta, __('You must specify an image ID!', 'works'), 1); die; } //Verificamos que la imagen exista $img = new PWImage($id); if ($img->isNew()) { redirectMsg('./images.php?work=' . $work->id() . $ruta, __('Specified image does not exists!', 'works'), 1); die; } } PWFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $work->title() . ' » ' . __('Work Images', 'works')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » <a href='./images.php?work=" . $work->id() . "'>" . __('Work Images', 'works') . "</a> »" . ($edit ? __('Edit Image', 'works') : __('Add Image', 'works'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Image', 'works') : __('Add Image', 'works'), 'frmImg', 'images.php'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Title', 'works'), 'title', 50, 100, $edit ? $img->title() : ''), true); $form->addElement(new RMFormFile(__('Image file', 'works'), 'image', 45, $xoopsModuleConfig['size_image'] * 1024), $edit ? false : true); if ($edit) { $form->addElement(new RMFormLabel(__('Current image file', 'works'), "<img src='" . XOOPS_UPLOAD_URL . "/works/ths/" . $img->image() . "' />")); } $form->addElement(new RMFormTextArea(__('Description', 'works'), 'desc', 4, 50, $edit ? $img->desc() : '')); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('work', $work->id())); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('limit', $limit)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', _SUBMIT, 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'images.php?work=' . $work->id() . $ruta . '\';"'); $form->addElement($ele); $form->display(); xoops_cp_footer(); }
function formTeams($edit = 0) { global $db, $xoopsModule, $mc, $xoopsConfig; if ($edit) { $id = TCFunctions::get('id'); if ($id <= 0) { redirectMsg('teams.php', __('Id not valid', 'admin_team'), 1); die; } $team = new TCTeam($id); if ($team->isNew()) { redirectMsg('teams.php', __('No existe el equipo especificado', 'admin_team'), 1); die; } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./teams.php'>" . __('Equipos', 'admin_team') . "</a>\n\t\t\t» " . ($edit ? __('Editar Equipo', 'admin_team') : __('Crear Equipo', 'admin_team'))); xoops_cp_header(); $form = new RMForm($edit ? __('Editar Equipo', 'admin_team') : __('Crear Equipo', 'admin_team'), 'frmTeam', 'teams.php'); $form->setExtra('enctype="multipart/form-data"'); $form->oddClass('oddForm'); $ele = new RMFormRadio(__('Categoría', 'admin_team'), 'cat', 0, 1, 1); $result = $db->query("SELECT * FROM " . $db->prefix("coach_categos") . " ORDER BY name"); while ($row = $db->fetchArray($result)) { $ele->addOption($row['name'], $row['id_cat'], $edit ? $team->category() == $row['id_cat'] ? 1 : 0 : 0); } $form->addElement($ele, true, 'checked'); $form->addElement(new RMFormText(__('Nombre', 'admin_team'), 'name', 50, 100, $edit ? $team->name() : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Nombre corto', 'admin_team'), 'nameid', 50, 100, $edit ? $team->nameId() : '')); } $form->addElement(new RMFormFile(__('Imagen', 'admin_team'), 'image', 46, $mc['filesize'] * 1024)); if ($edit && $team->image() != '') { $form->addElement(new RMFormLabel(__('Imagen actual', 'admin_team'), '<img src="' . XOOPS_URL . '/uploads/teams/ths/' . $team->image() . '" alt="" />')); } $form->addElement(new RMFormEditor(__('Información', 'admin_team'), 'desc', '90%', '300px', $edit ? $team->desc('e') : '')); if ($edit) { $html = $team->getVar('dohtml'); $xcode = $team->getVar('doxcode'); $doimage = $team->getVar('doimage'); $smiley = $team->getVar('dosmiley'); $br = $team->getVar('dobr'); } else { $html = $xoopsConfig['editor_type'] == 'tiny' ? 1 : 0; $xcode = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; $doimage = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; $smiley = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; $br = $xoopsConfig['editor_type'] == 'tiny' ? 0 : 1; } $form->addElement(new RMFormTextOptions(__('Opciones', 'admin_team'), $html, $xcode, $doimage, $smiley, $br)); $form->addElement(new RMFormSubTitle(__('Entrenadores', 'admin_team'), 1)); $ele = new RMFormCheck(__('Entrenadores', 'admin_team')); $ele->asTable(3); $result = $db->query("SELECT * FROM " . $db->prefix("coach_coachs") . " ORDER BY name"); if ($edit) { $coachs = $team->coachs(false); } while ($row = $db->fetchArray($result)) { $coach = new TCCoach(); $coach->assignVars($row); $ele->addOption($coach->name(), 'coachs[]', $coach->id(), $edit ? in_array($coach->id(), $coachs) ? 1 : 0 : 0); } $form->addElement($ele); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', __('Enviar', 'admin_team'), 'submit'); $ele->addButton('cancel', __('Cancelar', 'admin_team'), 'button', 'onclick="window.location=\'teams.php\';"'); $form->addElement($ele); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $team->id())); } $form->display(); xoops_cp_footer(); }
/** * @desc Visualiza las pantallas del software y * el formulario de creación de pantallas **/ function dt_screens($edit = 0) { global $xoopsOption, $db, $tpl, $xoopsTpl, $xoopsUser, $mc, $dtfunc, $page, $item, $xoopsConfig, $xoopsModuleConfig, $screen; include 'header.php'; $dtfunc->cpHeader($item, sprintf(__('Screenshots for "%s"', 'dtransport'), $item->getVar('name'))); $tc = TextCleaner::getInstance(); $sql = "SELECT * FROM " . $db->prefix('dtrans_screens') . " WHERE id_soft=" . $item->id(); $result = $db->queryF($sql); while ($rows = $db->fetchArray($result)) { $sc = new DTScreenshot(); $sc->assignVars($rows); $xoopsTpl->append('screens', array('id' => $sc->id(), 'title' => $sc->title(), 'desc' => $tc->clean_disabled_tags($sc->desc()), 'software' => $item->getVar('name'), 'image' => $sc->url('ths'), 'links' => array('edit' => DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->getVar('nameid') . '/edit/' . $sc->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=screens&screen=' . $sc->id()), 'delete' => DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->getVar('nameid') . '/delete/' . $sc->id() . '/' : '/?p=cpanel&id=' . $item->id() . '&action=delete&screen=' . $sc->id())))); } //Formulario de pantallas if ($edit) { //Verificamos si la pantalla es válida if ($screen <= 0) { redirect_header(DT_URL . ($mc['permalinks'] ? '/screens/' . $item->getVar('nameid') : '/?p=cpanel&action=screens&id=' . $item->id()), 1, __('Invalid screen', 'dtransport')); } //Verificamos si la pantalla existe $sc = new DTScreenshot($screen); if ($sc->isNew()) { redirect_header(DT_URL . ($mc['permalinks'] ? '/screens/' . $item->getVar('nameid') : '/?p=cpanel&action=screens&id=' . $item->id()), 1, __('Invalid screen', 'dtransport')); } } if ($edit || $mc['limit_screen'] > $item->getVar('screens')) { if ($edit) { $faction = DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->id() . '/save/' . $sc->id() . '/' : ''); } else { $faction = DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->id() . '/save/0/' : ''); } $form = new RMForm($edit ? sprintf(__('Edit Screenshot of %s', 'dtransport'), $item->getVar('name')) : sprintf(__('Add screen for %s', 'dtransport'), $item->getVar('name')), 'frmscreen', $faction); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $item->getVar('name'))); $form->addElement(new RMFormText(__('Title', 'dtransport'), 'title', 50, 100, $edit ? $sc->title() : ''), true); $form->addElement(new RMFormEditor(__('Description', 'dtransport'), 'desc', 'auto', '100px', $edit ? $sc->desc() : '', 'simple')); $form->addElement(new RMFormFile(__('Image file', 'dtransport'), 'image', 45, $xoopsModuleConfig['image'] * 1024), $edit ? '' : true); if ($edit) { $img = "<img src='" . $sc->url('ths') . "' border='0' />"; $form->addElement(new RMFormLabel(__('Current image', 'dtransport'), $img)); } $form->addElement(new RMFormHidden('p', 'cpanel')); $form->addElement(new RMFormHidden('action', 'screens')); $form->addElement(new RMFormHidden('id', $item->id())); $form->addElement(new RMFormHidden('op', 'save')); $form->addElement(new RMFormHidden('screen', $edit ? $sc->id() : 0)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save Changes', 'dtransport') : __('Save Screenshot', 'dtransport'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'dtransport'), 'button', 'onclick="window.location=\'' . DT_URL . ($mc['permalinks'] ? '/cp/screens/' . $item->getVar('nameid') . '/' : '/?p=cpanel&action=screens&id=' . $item->id()) . '\';"'); $form->addElement($buttons); $xoopsTpl->assign('formscreens', $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 images?', 'dtransport') . '")) return false; }); });'); $xoopsTpl->assign('lang_id', __('ID', 'dtransport')); $xoopsTpl->assign('lang_title', __('Title', 'dtransport')); $xoopsTpl->assign('lang_desc', __('Description', 'dtransport')); $xoopsTpl->assign('lang_opts', __('Options', 'dtransport')); $xoopsTpl->assign('lang_edit', __('Edit', 'dtransport')); $xoopsTpl->assign('lang_delete', __('Delete', 'dtransport')); $xoopsTpl->assign('lang_image', __('Image', 'dtransport')); $xoopsTpl->assign('lang_deletescreen', _MS_DT_DELETESCREEN); $xoopsTpl->assign('lang_deletescreens', _MS_DT_DELETESCREENS); $xoopsTpl->assign('edit', $edit); include 'footer.php'; }
/** * @desc Formulario de creación/edición de imágenes **/ function formImages($edit = 0) { global $xoopsModule, $mc, $xoopsUser, $db; $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 10; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $owner = isset($_REQUEST['owner']) ? $_REQUEST['owner'] : ''; $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'created'; $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 0; $ruta = "page={$page}&limit={$limit}&search={$search}&owner={$owner}&sort={$sort}&mode={$mode}"; if ($edit) { //Verificamos si la imagen es válida if ($id <= 0) { redirectMsg('./images.php?' . $ruta, __('Image ID not valid!', 'galleries'), 1); die; } //Verificamos si la imagen existe $img = new GSImage($id); if ($img->isNew()) { redirectMsg('./images.php?' . $ruta, __('Specified image does not exists!', 'galleries'), 1); die; } } GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='./images.php'>" . __('Images', 'galleries') . "</a> » " . ($edit ? __('Edit image', 'galleries') : __('Add image', 'galleries'))); xoops_cp_header(); $form = new RMForm($edit ? __('Editing image', 'galleries') : __('Add image', 'galleries'), 'frmimg', 'images.php'); $form->setExtra("enctype='multipart/form-data'"); if (!$edit) { $ele = new RMFormUser(__('User', 'galleries'), 'uid', 0, $uid ? array($uid) : ($edit ? array($img->owner()) : array($xoopsUser->uid())), 50); $ele->onChange("\$('op').value='" . ($edit ? 'edit' : 'new') . "'; \$('frmimg').submit();"); $form->addElement($ele); } else { $xu = new XoopsUser($img->owner()); $form->addElement(new RMFormLabel(__('User', 'galleries'), $xu->uname())); $form->addElement(new RMFormHidden('uid', $img->owner())); } $form->addElement(new RMFormText(__('Title', 'galleries'), 'title', 50, 100, $edit ? $img->title() : '')); $form->addElement(new RMFormFile(__('Image file', 'galleries'), 'image', 45, $mc['size_image'] * 1024)); if ($edit) { $user = new GSUser($img->owner(), 1); $url = $user->filesURL(); $form->addElement(new RMFormLabel(__('Current image', 'galleries'), "<img src='" . $url . "/ths/" . $img->image() . "' />")); } $form->addElement(new RMFormTextArea(__('Description', 'galleries'), 'desc', 4, 50, $edit ? $img->desc() : '')); $ele = new RMFormSelect(__('Privacy', 'galleries'), 'public'); $ele->addOption(0, __('Private', 'galleries'), $edit ? $img->isPublic() == 0 ? 1 : 0 : 0); $ele->addOption(1, __('Visible for friends', 'galleries'), $edit ? $img->isPublic() == 1 ? 1 : 0 : 0); $ele->addOption(2, __('Visible for all', 'galleries'), $edit ? $img->isPublic() == 2 ? 1 : 0 : 1); $form->addElement($ele, true); $db = Database::getInstance(); //Albumes if ($edit) { $albums = $img->sets(false); foreach ($albums as $k => $v) { $sets[] = $v['id_set']; } } $ele = new RMFormSelect(__('Albums', 'galleries'), 'albums[]', 1, $edit ? $sets : ''); $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . ($uid ? $uid : ($edit ? $img->owner() : $xoopsUser->uid())) . "'"; $result = $db->query($sql); while ($rows = $db->fetchArray($result)) { $ele->addOption($rows['id_set'], $rows['title']); } $form->addElement($ele); $ele = new RMFormText(__('Tags', 'galleries'), 'tags', 50, 100, $edit ? implode(", ", $img->tags(false, 'tag')) : ''); $ele->setDescription(__('Separate each tag with a comma (,)', 'galleries')); $form->addElement($ele, true); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $id)); } $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('limit', $limit)); $form->addElement(new RMFormHidden('search', $search)); $form->addElement(new RMFormHidden('owner', $owner)); $form->addElement(new RMFormHidden('sort', $sort)); $form->addElement(new RMFormHidden('mode', $mode)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save changes', 'galleries') : __('Add image', 'galleries'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'images.php?' . $ruta . '\'"'); $form->addElement($buttons); $form->display(); xoops_cp_footer(); }
/** * @desc Formulario de imágenes **/ function formImages($edit = 0) { global $xoopsOption, $tpl, $db, $xoopsUser, $xoopsModuleConfig, $xoopsUser, $xoopsConfig, $id, $referer, $page; $mc =& $xoopsModuleConfig; if (!$referer) { $referer = GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/images/pag/' . $page . '/' : '?cp=images&pag=' . $page); } else { $referer = base64_decode($referer); } if ($edit) { //Verificamos si la imagen es válida if ($id <= 0) { redirect_header($referer, 1, __('Sepecified images is not valid!', 'galleries')); die; } //Verificamos si la imagen existe $img = new GSImage($id); if ($img->isNew()) { redirect_header($referer, 1, __('Sepecified image does not exists!', 'galleries')); die; } //Verificamos que el usuario se el dueño de la imagen if ($img->owner() != $xoopsUser->uid()) { redirect_header($referer, 1, __('You are not authorized!', 'galleries')); die; } } $xoopsOption['template_main'] = 'gs_formpics.html'; include 'header.php'; GSFunctions::makeHeader(); $form = new RMForm($edit ? __('Edit Image', 'galleries') : __('New Image', 'galleries'), 'frmimg', GSFunctions::get_url() . ($mc['urlmode'] ? 'cp/saveedit/' : '?cp=saveedit')); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Image title', 'galleries'), 'title', 50, 100, $edit ? $img->title(false) : '')); if ($edit) { $user = new GSUser($img->owner(), 1); $url = $user->filesURL(); $form->addElement(new RMFormLabel(__('Current picture', 'galleries'), "<img src='" . $url . "/ths/" . $img->image() . "' />")); } else { $form->addElement(new RMFormFile(__('Image file', 'galleries'), 'image', 45, $mc['size_image'] * 1024)); } $form->addElement(new RMFormTextArea(__('Description', 'galleries'), 'desc', 4, 50, $edit ? $img->desc() : '')); $ele = new RMFormSelect(__('Access level', 'galleries'), 'public'); $ele->addOption(0, __('Private', 'galleries'), $edit ? $img->isPublic() == 0 ? 1 : 0 : 0); $ele->addOption(1, __('Public for friends', 'galleries'), $edit ? $img->isPublic() == 1 ? 1 : 0 : 0); $ele->addOption(2, __('Public for all', 'galleries'), $edit ? $img->isPublic() == 2 ? 1 : 0 : 0); $form->addElement($ele, true); //Albumes if ($edit) { $albums = $img->sets(false); foreach ($albums as $k => $v) { $sets[] = $v['id_set']; } } $ele = new RMFormSelect(__('Albums', 'galleries'), 'albums[]', 1, $edit ? $sets : ''); $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . $xoopsUser->uid() . "'"; $result = $db->query($sql); while ($rows = $db->fetchArray($result)) { $ele->addOption($rows['id_set'], $rows['title']); } $form->addElement($ele); $ele = new RMFormText(__('Tags', 'galleries'), 'tags', 50, 255, $edit ? implode(", ", $img->tags(false, 'tag')) : ''); $ele->setDescription(__('Separe each tag with commas.', 'galleries')); $form->addElement($ele, true); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('referer', $referer)); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', $edit ? __('Save Changes', 'galleries') : __('Create Image', 'galleries'), 'submit'); $buttons->addButton('cancel', __('Cancel', 'galleries'), 'button', 'onclick="window.location=\'' . $referer . '\'"'); $form->addElement($buttons); $tpl->assign('form_pics', $form->render()); createLinks(); RMTemplate::get()->add_style('panel.css', 'galleries'); include 'footer.php'; }
/** * @desc Formulario de creación/edición de Imágenes **/ function shop_form_images($edit = 0) { global $xoopsModule, $xoopsModuleConfig; $idimg = rmc_server_var($_REQUEST, 'idimg', 0); $id = rmc_server_var($_REQUEST, 'id', 0); $page = rmc_server_var($_REQUEST, 'page', 0); $bname = rmc_server_var($_REQUEST, 'bname', 0); $ruta = "action=images&page={$page}&bname={$bname}&id={$id}"; //Verificamos que el trabajo sea válido if ($id <= 0) { redirectMsg('products.php', __('You must specify a product ID!', 'shop'), 1); die; } //Verificamos que el trabajo exista $product = new ShopProduct($id); if ($product->isNew()) { redirectMsg('products.php', __('Specified product does not exists!', 'shop'), 1); die; } if ($edit) { //Verificamos que la imagen sea válida if ($idimg <= 0) { redirectMsg('products.php?' . $ruta, __('You must specify an image ID!', 'shop'), 1); die; } //Verificamos que la imagen exista $img = new ShopImage($idimg); if ($img->isNew()) { redirectMsg('products.php?' . $ruta, __('Specified image does not exists!', 'shop'), 1); die; } } ShopFunctions::include_required_files(); RMTemplate::get()->assign('xoops_pagetitle', $product->getVar('name') . ' » ' . __('Product Images', 'shop')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » <a href='products.php?id=" . $product->id() . "'>" . __('Product Images', 'shop') . "</a> »" . ($edit ? __('Edit Image', 'shop') : __('Add Image', 'shop'))); xoops_cp_header(); $form = new RMForm($edit ? __('Edit Image', 'shop') : __('Add Image', 'shop'), 'frmImg', 'products.php'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Title', 'shop'), 'title', 50, 100, $edit ? $img->getVar('title') : ''), true); $form->addElement(new RMFormFile(__('Image file', 'shop'), 'file', 45, $xoopsModuleConfig['size_image'] * 1024), $edit ? false : true); if ($edit) { $form->addElement(new RMFormLabel(__('Current image file', 'shop'), "<img src='" . XOOPS_UPLOAD_URL . "/minishop/ths/" . $img->getVar('file') . "' />")); } $form->addElement(new RMFormTextArea(__('Description', 'shop'), 'desc', 4, 50, $edit ? $img->getVar('description', 'e') : '')); $form->addElement(new RMFormHidden('action', $edit ? 'saveeditedimage' : 'saveimage')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('idimg', $img->id())); $form->addElement(new RMFormHidden('page', $page)); $form->addElement(new RMFormHidden('bname', $bname)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', _SUBMIT, 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'products.php?id=' . $product->id() . '\';"'); $form->addElement($ele); $form->display(); xoops_cp_footer(); }
/** * 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(); }
/** * Form to create a new player * * @param int Create (0) or edit (1) a player */ function m_coaches_form($edit = 0) { global $xoopsModule, $xoopsModuleConfig; MCHFunctions::toolbar(); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Coach', 'match') : __('Add Coach', 'match')); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » \n <a href='coaches.php'>" . __('Coaches', 'match') . '</a> » ' . ($edit ? __('Edit Coach', 'match') : __('Add Coach', '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('./coaches.php', __('Provide a coach ID!', 'match'), 1); die; } //Verificamos si la categoría existe $coach = new MCHCoach($id); if ($coach->isNew()) { redirectMsg('./coaches.php', __('Specified coach was not found!', 'match'), 1); die; } } $form = new RMForm($edit ? __('Edit Coach', 'match') : __('Add Coach', 'match'), 'frmNew', 'coaches.php'); $form->setExtra('enctype="multipart/form-data"'); $form->addElement(new RMFormText(__('Name(s)', 'match'), 'name', 50, 200, $edit ? $coach->getVar('name') : ''), true); $form->addElement(new RMFormText(__('Lastname', 'match'), 'lastname', 50, 200, $edit ? $coach->getVar('lastname') : ''), true); $form->addElement(new RMFormText(__('Surname', 'match'), 'surname', 50, 200, $edit ? $coach->getVar('surname') : ''), true); if ($edit) { $form->addElement(new RMFormText(__('Short name', 'match'), 'nameid', 50, 200, $coach->getVar('nameid')), true); } $form->addElement(new RMFormEditor(__('Biography', 'match'), 'bio', '100%', '250px', $edit ? $coach->getVar('bio', 'e') : '')); $form->addElement(new MCHTeamsField(__('Team', 'match'), 'team', $edit ? $coach->getVar('team') : 0), true); $form->addElement(new RMFormDate(__('Registered', 'match'), 'created', $edit ? $coach->getVar('created') : time(), $xoopsModuleConfig['year_range']), 1); $charges = new RMFormSelect(__('Charge', 'match'), 'charge', 0, $edit ? array($coach->getVar('charge')) : 0); $charges->addOption(0, __('Select position...', 'match')); $charges->addOption(1, __('Manager', 'match')); $charges->addOption(2, __('Coach', 'match')); $charges->addOption(3, __('Assistant', 'match')); $form->addElement($charges); $form->addElement(new RMFormFile(__('Picture', 'match'), 'photo', 45)); if ($edit) { $form->addElement(new RMFormLabel(__('Current picture', 'match'), '<img src="' . MCH_UP_URL . '/coaches/ths/' . $coach->getVar('photo') . '" alt="' . $coach->getVar('name') . '" />')); } $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save')); if ($edit) { $form->addElement(new RMFormHidden('id', $coach->id())); } $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes!', 'match') : __('Add Now!', 'match'), 'submit'); $ele->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'coaches.php\';"'); $form->addElement($ele); $form = RMEvents::get()->run_event('match.form.coaches', $form); $form->display(); RMTemplate::get()->add_style('admin.css', 'match'); xoops_cp_footer(); }
/** * @desc Formulario de creacion/edición de trabajos **/ function formWorks($edit = 0) { global $xoopsModule, $xoopsModuleConfig; $page = rmc_server_var($_REQUEST, 'page', 1); $ruta = "page={$page}"; PWFunctions::toolbar(); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » <a href='./works.php'>" . __('Works Management', 'works') . "</a> » " . ($edit ? __('Editing work', 'works') : __('New work', 'works'))); xoops_cp_header(); $id = rmc_server_var($_REQUEST, 'id', 0); if ($edit) { //Verificamos que el trabajo sea válido if ($id <= 0) { redirectMsg('./works.php?' . $ruta, __('Provided Work ID is not valid!', 'works'), 1); die; } //Verificamos que el trabajo exista $work = new PWWork($id); if ($work->isNew()) { redirectMsg('./works.php?' . $ruta, __('Specified work does not exists!', 'works'), 1); die; } } $form = new RMForm($edit ? __('Edit Work', 'works') : __('Create Work', 'works'), 'frmwork', 'works.php'); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Title', 'works'), 'title', 50, 200, $edit ? $work->title() : ''), true); $form->addElement(new RMFormTextArea(__('Short description', 'works'), 'short', 4, 50, $edit ? $work->descShort() : ''), true); $form->addElement(new RMFormEditor(__('Description', 'works'), 'desc', '90%', '200px', $edit ? $work->desc('e') : ''), true); if ($edit) { $dohtml = $work->getVar('dohtml'); $doxcode = $work->getVar('doxcode'); $dobr = $work->getVar('dobr'); $dosmiley = $work->getVar('dosmiley'); $doimage = $work->getVar('doimage'); } else { $dohtml = 1; $doxcode = 0; $dobr = 0; $dosmiley = 0; $doimage = 0; } $form->addElement(new RMFormTextOptions(_OPTIONS, $dohtml, $doxcode, $doimage, $dosmiley, $dobr)); $ele = new RMFormSelect(__('Category', 'works'), 'catego'); $ele->addOption(0, __('Select...', 'works')); //Categorias existentes $db = XoopsDatabaseFactory::getDatabaseConnection(); $result = $db->query("SELECT * FROM " . $db->prefix("pw_categos") . " ORDER BY `order`"); while ($rows = $db->fetchArray($result)) { $ele->addOption($rows['id_cat'], $rows['name'], $edit ? $work->category() == $rows['id_cat'] ? 1 : 0 : ''); } $form->addElement($ele, true, 'noselect:0'); if ($xoopsModuleConfig['show_customer']) { //Clientes Existentes $ele = new RMFormSelect(__('Customer', 'works'), 'client'); $ele->addOption(0, __('Select...', 'works')); $sql = "SELECT * FROM " . $db->prefix('pw_clients'); $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $ele->addOption($row['id_client'], $row['name'], $edit ? $work->client() == $row['id_client'] ? 1 : 0 : ''); } $form->addElement($ele, true, 'noselect:0'); $form->addElement(new RMFormTextArea(__('Customer comment', 'works'), 'comment', 4, 50, $edit ? $work->comment() : '')); } if ($xoopsModuleConfig['show_web']) { $form->addElement(new RMFormText(__('Web site', 'works'), 'site', 50, 150, $edit ? $work->nameSite() : '')); $form->addElement(new RMFormText(__('Site URL', 'works'), 'url', 50, 255, $edit ? $work->url() : '')); } $form->addElement(new RMFormDate(__('Start date', 'works'), 'start', $edit ? $work->start() : time())); $form->addElement(new RMFormText(__('Long time', 'works'), 'period', 50, 255, $edit ? $work->period() : '')); $form->addElement(new RMFormText(__('Monetary cost', 'works'), 'cost', 10, 20, $edit ? $work->cost() : 0)); $form->addElement(new RMFormYesno(__('Featured', 'works'), 'mark', $edit ? $work->mark() : 0)); $form->addElement(new RMFormYesno(__('Visible', 'works'), 'public', $edit ? $work->isPublic() : 1)); $form->addElement(new RMFormFile(__('Work image', 'works'), 'image', 45, $xoopsModuleConfig['size_image'] * 1024)); if ($edit) { $form->addElement(new RMFormLabel(__('Current image', 'works'), "<img src='" . XOOPS_UPLOAD_URL . "/works/ths/" . $work->image() . "' />")); } $ele = new RMFormSelect(__('Rating', 'works'), 'rating'); for ($i = 0; $i <= 10; $i++) { $ele->addOption($i, $i, $edit ? $work->rating() == $i ? 1 : 0 : 0); } $form->addElement($ele, true); $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save')); $form->addElement(new RMFormHidden('id', $id)); $form->addElement(new RMFormHidden('page', $page)); $ele = new RMFormButtonGroup(); $ele->addButton('sbt', $edit ? __('Save Changes', 'works') : __('Create Work', 'works'), 'submit'); $ele->addButton('cancel', __('Cancel', 'works'), 'button', 'onclick="window.location=\'works.php?' . $ruta . '\';"'); $form->addElement($ele); if ($edit) { include RMTemplate::get()->get_template("admin/pw_work_options.php", 'module', 'works'); RMTemplate::get()->add_style('admin.css', 'works'); } $form->display(); xoops_cp_footer(); }