示例#1
0
/**
* @desc Muestra todos los equipos registrados
*/
function showTeams()
{
    global $db, $tpl, $xoopsModule, $xoopsConfig, $adminTemplate;
    $tpl->assign('lang_existing', _AS_TC_EXISTING);
    $tpl->assign('lang_id', _AS_TC_ID);
    $tpl->assign('lang_image', _AS_TC_IMAGE);
    $tpl->assign('lang_name', _AS_TC_NAME);
    $tpl->assign('lang_catego', _AS_TC_CATEGO);
    $tpl->assign('lang_coachs', _AS_TC_COACHS);
    $tpl->assign('lang_options', _OPTIONS);
    $tpl->assign('lang_edit', _EDIT);
    $tpl->assign('lang_delete', _DELETE);
    $tpl->assign('lang_confirmm', _AS_TC_CONFM);
    $tpl->assign('lang_confirm', _AS_TC_CONFDEL);
    $tpl->assign('lang_date', _AS_TC_DATE);
    $tpl->assign('lang_players', _AS_TC_PLAYERS);
    $result = $db->query("SELECT * FROM " . $db->prefix("coach_teams") . " ORDER BY name");
    $teams = array();
    while ($row = $db->fetchArray($result)) {
        $team = new TCTeam();
        $team->assignVars($row);
        $cat = new TCCategory($team->category());
        $coachs = '';
        foreach ($team->coachs(true) as $coach) {
            $coachs .= $coachs == '' ? $coach->name() : '<br />' . $coach->name();
        }
        $teams[] = array('id' => $team->id(), 'name' => $team->name(), 'image' => $team->image(), 'catego' => $cat->name(), 'coachs' => $coachs, 'date' => formatTimestamp($team->created(), 'c'));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . _AS_TC_TEAMSLOC);
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/coach_teams.php", 'module', 'team');
    xoops_cp_footer();
}