Beispiel #1
0
function showPlayers()
{
    global $xoopsModule, $mc, $adminTemplate, $tpl, $db;
    $gteam = TCFunctions::get('team');
    $team = new TCTeam($gteam);
    // Equipos
    $tpl->assign('team', $team->isNew() ? 0 : $team->id());
    $result = $db->query("SELECT * FROM " . $db->prefix("coach_teams") . " ORDER BY name");
    $teams = array();
    while ($row = $db->fetchArray($result)) {
        $ct = new TCTeam();
        $ct->assignVars($row);
        $cat =& $ct->category(true);
        $teams[] = array('id' => $ct->id(), 'name' => $ct->name() . " (" . $cat->name() . ")");
    }
    // Entrenadores
    $coachs = array();
    if (!$team->isNew()) {
        foreach ($team->coachs(true) as $coach) {
            $coachs[] = array('id' => $coach->id(), 'name' => $coach->name(), 'image' => $coach->image());
        }
    }
    // Jugadores
    $result = $db->query("SELECT * FROM " . $db->prefix("coach_players") . " WHERE team='" . $team->id() . "'");
    $players = array();
    while ($row = $db->fetchArray($result)) {
        $player = new TCPlayer();
        $player->assignVars($row);
        $players[] = array('id' => $player->id(), 'name' => $player->name(), 'image' => $player->image(), 'number' => $player->number(), 'age' => $player->age(), 'date' => formatTimestamp($player->date(), 'c'));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Jugadores', 'admin_team'));
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/coach_players.php", 'module', 'team');
    xoops_cp_footer();
}
Beispiel #2
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();
}
Beispiel #3
0
$id = str_replace("/", "", $id);
$team = new TCTeam($id);
if ($team->isNew()) {
    redirect_header(XOOPS_URL . '/modules/team/', 1, _MS_TC_ERRNOEXISTIS);
    die;
}
$xoopsOption['template_main'] = "coach_team.html";
include 'header.php';
$cat = $team->category(true);
$tpl->assign('coach_title', $team->name() . " <em>(" . $cat->name() . ")</em>");
$tpl->assign('lang_comment', _MS_TC_COMMENT);
$tpl->assign('lang_players', _MS_TC_PLAYERS);
$tpl->assign('lang_info', _MS_TC_INFO);
$tpl->assign('lang_coachs', _MS_TC_COACHS);
$tpl->assign('team', array('id' => $team->id(), 'desc' => $team->desc()));
// Integrantes
$players = $team->players(true);
foreach ($players as $player) {
    $link = TC_URL . '/' . ($xoopsModuleConfig['urlmode'] ? 'player/' . $player->nameId() . '/' : 'player.php?id=' . $player->id());
    $tpl->append('players', array('id' => $player->id(), 'name' => $player->name(), 'image' => $player->image(), 'number' => $player->number(), 'link' => $link));
}
// ENtrenadores
$coachs = $team->coachs(true);
foreach ($coachs as $coach) {
    $link = TC_URL . '/' . ($xoopsModuleConfig['urlmode'] ? 'coach/' . $coach->nameId() . '/' : 'player.php?t=c&amp;id=' . $coach->id());
    $tpl->append('coachs', array('id' => $coach->id(), 'name' => $coach->name(), 'role' => $coach->role(), 'link' => $link, 'image' => $coach->image()));
}
$tpl->assign('xoops_pagetitle', sprintf(_MS_TC_PTITLE, $team->name()));
$location = "<a href='" . TC_URL . "'>" . $xoopsModule->name() . "</a> &raquo; \n\t<a href='" . TC_URL . "/" . ($xoopsModuleConfig['urlmode'] ? 'cat/' . $cat->nameId() . "/" : 'category.php?id=' . $cat->id()) . "'>\n\t" . $cat->name() . "</a> &raquo; " . sprintf(_MS_TC_PTITLE, $team->name());
$tpl->assign('coach_location', $location);
include 'footer.php';