コード例 #1
0
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;
}
コード例 #2
0
ファイル: player.php プロジェクト: laiello/bitcero-modules
$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);
$tpl->assign('lang_link', _MS_TC_LINK);
$link = TC_URL . '/' . ($mc['urlmode'] ? 'player/' . $player->nameId() . '/' : 'player.php?id=' . $player->id());
$tpl->assign('player', array('id' => $player->id(), 'name' => $player->name(), 'image' => $player->image(), 'number' => $player->number(), 'age' => $player->age(), 'date' => formatTimestamp($player->date(), 'c'), 'bio' => $player->bio(), 'link' => $link));
$team = new TCTeam($player->team());
$tpl->assign('xoops_pagetitle', sprintf(_MS_TC_PTITLE, $team->name(), $player->number()));
$tlink = TC_URL . '/' . ($mc['urlmode'] ? 't/' . $team->nameId() . '/' : 'team.php?id=' . $team->id());
$location = "<a href='" . TC_URL . "'>" . $xoopsModule->name() . "</a> &raquo; <a href='{$tlink}'>" . $team->name() . "</a> &raquo; " . $player->name();
コード例 #3
0
ファイル: players.php プロジェクト: laiello/bitcero-modules
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();
}