function tc_block_players($options)
{
    global $xoopsModule;
    if ($xoopsModule && $xoopsModule->dirname() == 'team') {
        global $xoopsModuleConfig;
        $mc =& $xoopsModuleConfig;
    } else {
        $util =& RMUtils::getInstance();
        $mc =& $util->moduleConfig('team');
    }
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("coach_players");
    if ($options[0] > 0) {
        $sql .= " WHERE team='" . $options[0] . "'";
    }
    $sql .= " ORDER BY RAND() LIMIT 0,{$options['1']}";
    $result = $db->query($sql);
    $block = array();
    while ($row = $db->fetchArray($result)) {
        $rtn = array();
        $player = new TCPlayer();
        $player->assignVars($row);
        $rtn['link'] = XOOPS_URL . '/modules/team/' . ($mc['urlmode'] ? 'player/' . $player->nameId() . '/' : 'player.php?id=' . $player->id());
        $rtn['name'] = $player->name();
        $rtn['number'] = $player->number();
        $rtn['image'] = $player->image();
        $block['players'][] = $rtn;
    }
    $block['cols'] = $options[2];
    return $block;
}
Example #2
0
// Un modulo sencillo para el manejo de equipos
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
define('TC_LOCATION', 'players');
include '../../mainfile.php';
$id = TCFunctions::get('id');
if ($id == '') {
    redirect_header(TC_URL, 1, _MS_TC_ERRID);
    die;
}
$myts =& MyTextSanitizer::getInstance();
$id = $myts->addSlashes($id);
$id = str_replace("/", "", $id);
$player = new TCPlayer($id);
if ($player->isNew()) {
    redirect_header(TC_URL, 1, _MS_TC_ERRNOEXISTIS);
    die;
}
$xoopsOption['template_main'] = "coach_player.html";
include 'header.php';
$tpl->assign('coach_title', $player->name() . " (#" . $player->number() . ")");
$tpl->assign('lang_comment', _MS_TC_COMMENT);
$tpl->assign('lang_data', _MS_TC_DATA);
$tpl->assign('lang_name', _MS_TC_NAME);
$tpl->assign('lang_number', _MS_TC_NUMBER);
$tpl->assign('lang_team', _MS_TC_TEAM);
$tpl->assign('lang_age', _MS_TC_AGE);
$tpl->assign('lang_date', _MS_TC_DATE);
$tpl->assign('lang_bio', _MS_TC_BIO);
Example #3
0
 public function players($obj = true, $order = '')
 {
     $sql = "SELECT * FROM " . $this->db->prefix("coach_players") . " WHERE team='" . $this->id() . "'";
     if ($order != '') {
         $sql .= " ORDER BY {$order}";
     }
     $result = $this->db->query($sql);
     $players = array();
     while ($row = $this->db->fetchArray($result)) {
         if ($obj) {
             $player = new TCPlayer();
             $player->assignVars($row);
             $players[] = $player;
         } else {
             $players[] = $row['id_play'];
         }
     }
     return $players;
 }
Example #4
0
function deletePlayer()
{
    global $db;
    $team = TCFunctions::request('team');
    $players = TCFunctions::request('players');
    if (empty($players)) {
        redirectMsg('players.php?team=' . $team, __('No has seleccionado jugadores para eliminar', 'admin_team'), 1);
        die;
    }
    foreach ($players as $k) {
        $player = new TCPlayer($k);
        $player->delete();
    }
    redirectMsg('players.php?team=' . $team, __('¡Jugadores eliminados!', 'admin_team'), 0);
}