示例#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();
}
示例#2
0
if ($xoopsDB->getRowsNum($result) == 1) {
    $row = $xoopsDB->fetchArray($result);
    $link = XOOPS_URL . "/modules/team/" . ($mc['urlmode'] ? "t/{$row['nameid']}/" : "team.php?id={$row['nameid']}");
    header('Location: ' . $link);
    die;
}
$xoopsOption['template_main'] = "coach_index.html";
include 'header.php';
$tpl->assign('coach_title', _MS_TC_TITLE);
$tpl->assign('lang_comment', _MS_TC_COMMENT);
// Categorías
$tpl->assign('lang_categos', _MS_TC_CATTITLE);
$result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("coach_categos") . " ORDER BY name");
$cats = array();
while ($row = $xoopsDB->fetchArray($result)) {
    $cat = new TCCategory();
    $cat->assignVars($row);
    $cats[$cat->id()] = $cat;
    $link = TC_URL . '/' . ($mc['urlmode'] ? 'cat/' . $cat->nameId() . '/' : 'category.php?id=' . $cat->id());
    $tpl->append('categos', array('id' => $cat->id(), 'name' => $cat->name(), 'desc' => $cat->desc(), 'link' => $link));
}
// Equipos
$tpl->assign('lang_teams', _MS_TC_TEAMSTITLE);
$result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("coach_teams") . " ORDER BY name");
while ($row = $xoopsDB->fetchArray($result)) {
    $team = new TCTeam();
    $team->assignVars($row);
    $link = TC_URL . '/' . ($mc['urlmode'] ? 't/' . $team->nameId() . '/' : 'team.php?id=' . $team->id());
    $tpl->append('teams', array('id' => $team->id(), 'name' => $team->name() . " <em>(" . $cats[$team->category(false)]->name() . ")</em>", 'link' => $link));
}
include 'footer.php';
示例#3
0
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
// MA 02111-1307 USA
// --------------------------------------------------------
// @copyright: 2008 Red México
define('TC_LOCATION', 'categories');
include '../../mainfile.php';
$id = TCFunctions::get('id');
if ($id == '') {
    redirect_header(XOOPS_URL . '/modules/team/', 1, _MS_TC_ERRID);
    die;
}
$myts =& MyTextSanitizer::getInstance();
$id = $myts->addSlashes($id);
$id = str_replace("/", "", $id);
$cat = new TCCategory($id);
if ($cat->isNew()) {
    redirect_header(XOOPS_URL . '/modules/team/', 1, _MS_TC_ERRNOEXISTIS);
    die;
}
$xoopsOption['template_main'] = "coach_category.html";
include 'header.php';
$tpl->assign('coach_title', $cat->name());
$tpl->assign('lang_comment', _MS_TC_COMMENT);
$tpl->assign('lang_in', _MS_TC_TEAMIN);
$tpl->assign('xoops_pagetitle', sprintf(_MS_TC_PTITLE, $cat->name()));
$location = "<a href='" . TC_URL . "'>" . $xoopsModule->name() . "</a> &raquo; " . sprintf(_MS_TC_PTITLE, $cat->name());
$tpl->assign('coach_location', $location);
$teams = $cat->teams();
foreach ($teams as $team) {
    $link = TC_URL . '/' . ($mc['urlmode'] ? 't/' . $team->nameId() . '/' : 'team.php?id=' . $team->id());
示例#4
0
function deleteCategory()
{
    $id = TCFunctions::get('id');
    if ($id <= 0) {
        redirectMsg('cats.php', __('Id no válido', 'admin_team'), 1);
        die;
    }
    $cat = new TCCategory($id);
    if ($cat->isNew()) {
        redirectMsg('cats.php', __('La categoría especificada no existe', 'admin_team'), 1);
        die;
    }
    if ($cat->delete()) {
        redirectMsg('cats.php', __('Base de datos actualizada correctamente', 'admin_team'), 0);
    } else {
        redirectMsg('cats.php', __('No se puedo actualizar la base de datos', 'admin_team') . "<br />" . $cat->errors(), 1);
    }
}