예제 #1
0
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> &raquo; <a href='./cats.php'>" . __('Administración de Categorías', 'admin_team') . "</a> &raquo; " . ($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();
}
예제 #2
0
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> &raquo; <a href='./coachs.php'>" . __('Entrenadores', 'admin_team') . "</a> &raquo; " . ($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();
}
예제 #3
0
/**
* @desc Presenta el formulario para creación o edición de un anuncio
*/
function showForm($edit = 0)
{
    global $tpl, $xoopsModule, $db;
    if ($edit) {
        $id = rmc_server_var($_GET, 'id', 0);
        if ($id <= 0) {
            redirectMsg('announcements.php', __('Provided ID is not valid!', 'bxpress'), 1);
            die;
        }
        $an = new bXAnnouncement($id);
        if ($an->isNew()) {
            redirectMsg('announcements.php', __('Specified announcement does not exists!', 'bxpress'), 1);
            die;
        }
    }
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/anuncios/standalone/1/#crear-un-anuncio');
    bXFunctions::menu_bar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . ($edit ? __('Edit Announcement', 'bxpress') : __('New Announcement', 'bxpress')));
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Announcement', 'bxpress') : __('New Announcement', 'bxpress'), 'frmAnnouncements', 'announcements.php');
    $form->oddClass('oddForm');
    $form->addElement(new RMFormEditor(__('Text', 'bxpress'), 'text', '100%', '300px', $edit ? $an->text('e') : ''), true);
    // Caducidad
    $ele = new RMFormDate(__('Expire on', 'bxpress'), 'expire', $edit ? $an->expire() : time());
    $form->addElement($ele);
    // Mostran en
    $ele = new RMFormRadio(__('Show on', 'bxpress'), 'where', 1, 0);
    $ele->addOption(__('Module home page', 'bxpress'), 0, $edit ? $an->where() == 0 : 1);
    $ele->addOption(__('Forum', 'bxpress'), 1, $edit ? $an->where() == 1 : 0);
    $ele->addOption(__('All module', 'bxpress'), 2, $edit ? $an->where() == 2 : 0);
    $form->addElement($ele);
    // Foros
    $ele = new RMFormSelect(__('Forum', 'bxpress'), 'forum', 0, $edit ? array($an->forum()) : array());
    $ele->setDescription(__('Please select the forum where this announcement will be shown. This option only is valid when "In Forum" has been selected.', 'bxpress'));
    $tbl1 = $db->prefix("bxpress_categories");
    $tbl2 = $db->prefix("bxpress_forums");
    $sql = "SELECT b.*, a.title FROM {$tbl1} a, {$tbl2} b WHERE b.cat=a.id_cat AND b.active='1' ORDER BY a.order, b.order";
    $result = $db->query($sql);
    $categories = array();
    while ($row = $db->fetchArray($result)) {
        $cforum = array('id' => $row['id_forum'], 'name' => $row['name']);
        if (isset($categores[$row['cat']])) {
            $categories[$row['cat']]['forums'][] = $cforum;
        } else {
            $categories[$row['cat']]['title'] = $row['title'];
            $categories[$row['cat']]['forums'][] = $cforum;
        }
    }
    foreach ($categories as $cat) {
        $ele->addOption(0, $cat['title'], 0, true, 'color: #000; font-weight: bold; font-style: italic; border-bottom: 1px solid #c8c8c8;');
        foreach ($cat['forums'] as $cforum) {
            $ele->addOption($cforum['id'], $cforum['name'], 0, false, 'padding-left: 10px;');
        }
    }
    $form->addElement($ele);
    $ele = new RMFormButtonGroup();
    $ele->addButton('sbt', $edit ? __('Save Changes', 'bxpress') : __('Create Announcement', 'bxpress'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'bxpress'), 'button', 'onclick="window.location=\'announcements.php\';"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('action', $edit ? 'saveedit' : 'save'));
    if ($edit) {
        $form->addElement(new RMFormHidden('id', $id));
    }
    $form = RMEvents::get()->run_event('bxpress.form.announcement', $form);
    $form->display();
    xoops_cp_footer();
}
예제 #4
0
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> &raquo; <a href='./teams.php'>" . __('Equipos', 'admin_team') . "</a>\n\t\t\t&raquo; " . ($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();
}
예제 #5
0
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> &raquo; <a href='./players.php?team={$idteam}'>" . __('Jugadores', 'admin_team') . "</a> &raquo; " . ($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();
}