Пример #1
0
function mch_ranking_bkedit($options)
{
    $ch = $options[0];
    $cat = $options[1];
    $limit = $options[2];
    include_once XOOPS_ROOT_PATH . '/modules/match/class/mchfunctions.php';
    $form = '<label><strong>' . __('Championship:', 'match') . '</strong><br />';
    $form .= '<select name="options[0]">';
    $form .= '<option value="0"' . ($ch == 0 ? ' selected="selected"' : '') . ">" . __('From user selected', 'match') . '</option>';
    $champs = MCHFunctions::all_championships();
    foreach ($champs as $c) {
        $form .= '<option value="' . $c['id'] . '"' . ($ch == $c['id'] ? ' selected="selected"' : '') . '>' . $c['name'] . '</option>';
    }
    $form .= '</select></label><br /><br />';
    $form .= '<label><strong>' . __('Category', 'match') . '</strong><br />';
    $form .= '<select name="options[1]">';
    $form .= '<option value="0"' . ($cat == 0 ? ' selected="selected"' : '') . ">" . __('From user selected', 'match') . '</option>';
    $categories = array();
    MCHFunctions::categories_tree($categories);
    foreach ($categories as $c) {
        $form .= '<option value="' . $c['id_cat'] . '"' . ($cat == $c['id_cat'] ? ' selected="selected"' : '') . '>' . str_repeat("&#151;", $c['indent']) . $c['name'] . '</option>';
    }
    $form .= '</select></label><br /><br />';
    $form .= '<label><strong>' . __('Number of items:', 'match') . '</strong> ';
    $form .= '<input type="text" name="options[3]" value="' . $limit . '" size="5" />';
    return $form;
}
Пример #2
0
function m_show_ranking()
{
    global $xoopsModule;
    $champ = rmc_server_var($_REQUEST, 'champ', 0);
    $category = rmc_server_var($_REQUEST, 'category', 0);
    $champs = MCHFunctions::all_championships();
    $categories = array();
    MCHFunctions::categories_tree($categories);
    if ($champ > 0 && $category > 0) {
        $ranking = MCHFunctions::get_ranking($champ, $category);
    }
    MCHFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Coaches', 'match'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Coaches', 'match'));
    RMTemplate::get()->add_style('admin.css', 'match');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_local_script('admin_match.js', 'match');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar mch_message='" . __('Do you really want to delete selected coaches?', 'match') . "';\n\n        var mch_select_message = '" . __('You must select some coach before to execute this action!', 'match') . "';</script>");
    xoops_cp_header();
    $match_extra_options = RMEvents::get()->run_event('match.more.options');
    include RMTemplate::get()->get_template("admin/mch_ranking.php", 'module', 'match');
    xoops_cp_footer();
}
Пример #3
0
    $category = new MCHCategory($id_cat);
} else {
    $category = MCHFunctions::first_category();
}
$xoopsTpl->assign('category', array('id' => $category->id(), 'name' => $category->getVar('name'), 'desc' => $category->getVar('description')));
// Results
$data = MCHFunctions::latest_results($category->id(), $champ->id(), 20);
$xoopsTpl->assign('results', $data);
$categories = array();
MCHFunctions::categories_tree($categories);
foreach ($categories as $k => $cat) {
    $categories[$k]['guion'] = str_repeat("&#151;", $cat['indent']);
}
$xoopsTpl->assign('categories', $categories);
// Championships
$xoopsTpl->assign('champs', MCHFunctions::all_championships());
// Constants
$xoopsTpl->assign('mch_upurl', MCH_UP_URL);
// Language
$xoopsTpl->assign('lang_ranking', __('Ranking', 'match'));
$xoopsTpl->assign('lang_results', __('Results', 'match'));
$xoopsTpl->assign('lang_wons', __('Won matches:', 'match'));
$xoopsTpl->assign('lang_netxmatches', __('Next Matches', 'match'));
$xoopsTpl->assign('lang_local', __('Local Team', 'match'));
$xoopsTpl->assign('lang_visitor', __('Visitor Team', 'match'));
$xoopsTpl->assign('lang_score', __('Score', 'match'));
$xoopsTpl->assign('lang_info', __('Data', 'match'));
$xoopsTpl->assign('lang_current', __('(Current)', 'match'));
$xoopsTpl->assign('lang_selectchamp', __('Select championship...', 'match'));
$xoopsTpl->assign('lang_selectcat', __('Select category...', 'match'));
$xoopsTpl->assign('xoops_pagetitle', $champ->getVar('name') . ' &raquo; ' . $category->getVar('name') . ' - ' . $xoopsModuleConfig['title']);
Пример #4
0
function m_show_roleplay()
{
    global $xoopsModule, $xoopsModuleConfig, $xoopsSecurity;
    $champ = rmc_server_var($_REQUEST, 'champ', 0);
    $category = rmc_server_var($_REQUEST, 'category', 0);
    $team = rmc_server_var($_REQUEST, 'team', 0);
    $sday = rmc_server_var($_REQUEST, 'sday', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $champs = MCHFunctions::all_championships();
    // Select role item
    if ($champ > 0 && $category > 0) {
        $sql = "SELECT * FROM " . $db->prefix("mch_role") . " WHERE champ='" . $champ . "' AND category='" . $category . "'";
        if ($team > 0) {
            $sql .= " AND (local='{$team}' OR visitor='{$team}')";
        }
        if ($sday > 0) {
            $sql .= " AND time<={$sday} AND time>=" . ($sday - 86400);
        }
        $sql .= " ORDER BY `time`";
        $result = $db->query($sql);
        $role = array();
        $tcache = array();
        $fcache = array();
        $tf = new RMTimeFormatter('', __('%M% %d%, %Y% - %h%:%i%', 'match'));
        $i = 0;
        $days = array();
        $pday = 0;
        while ($row = $db->fetchArray($result)) {
            $item = new MCHRoleItem();
            $item->assignVars($row);
            if (isset($tcache[$item->getVar('local')])) {
                $local = $tcache[$item->getVar('local')];
            } else {
                $tcache[$item->getVar('local')] = new MCHTeam($item->getVar('local'));
                $local = $tcache[$item->getVar('local')];
            }
            if (isset($tcache[$item->getVar('visitor')])) {
                $visitor = $tcache[$item->getVar('visitor')];
            } else {
                $tcache[$item->getVar('visitor')] = new MCHTeam($item->getVar('visitor'));
                $visitor = $tcache[$item->getVar('visitor')];
            }
            if (isset($fcache[$item->getVar('field')])) {
                $field = $fcache[$item->getVar('field')];
            } else {
                $fcache[$item->getVar('field')] = new MCHField($item->getVar('field'));
                $field = $fcache[$item->getVar('field')];
            }
            $role[$i] = array('id' => $item->id(), 'local' => array('id' => $local->id(), 'logo' => MCH_UP_URL . '/' . $local->getVar('logo'), 'name' => $local->getVar('name')), 'visitor' => array('id' => $visitor->id(), 'logo' => MCH_UP_URL . '/' . $visitor->getVar('logo'), 'name' => $visitor->getVar('name')), 'date' => $tf->format($item->getVar('time')), 'hour' => $tf->format($item->getVar('time'), '%h%:%i%'), 'time' => $item->getVar('time'), 'field' => array('id' => $field->id(), 'name' => $field->getVar('name')), 'past' => $item->getVar('time') < time() ? true : false);
            if ($role[$i]['past']) {
                $score = new MCHScoreItem();
                $score->byRole($item->id());
                $role[$i]['local']['score'] = $score->getVar('local');
                $role[$i]['visitor']['score'] = $score->getVar('visitor');
            }
            // Add days to combo
            if ($pday <= 0) {
                $pday = mktime(0, 0, 1, date("m", $item->getVar('time')), date("d", $item->getVar('time')), date('Y', $item->getVar('time')));
                $days[] = $pday;
            }
            $now = mktime(23, 59, 0, date("m", $item->getVar('time')), date("d", $item->getVar('time')), date('Y', $item->getVar('time')));
            if ($now > $pday + 86400) {
                $pday = $now;
                $days[] = $pday;
            }
            $i++;
        }
    }
    // Charge days if incomplete
    if ($champ > 0 && $category > 0 && $sday > 0) {
        $sql = "SELECT * FROM " . $db->prefix("mch_role") . " WHERE champ='" . $champ . "' AND category='" . $category . "'";
        if ($team > 0) {
            $sql .= " AND (local='{$team}' OR visitor='{$team}')";
        }
        $sql .= " ORDER BY `time`";
        $result = $db->query($sql);
        $days = array();
        $pday = 0;
        while ($row = $db->fetchArray($result)) {
            $item = new MCHRoleItem();
            $item->assignVars($row);
            // Add days to combo
            if ($pday <= 0) {
                $pday = mktime(0, 0, 1, date("m", $item->getVar('time')), date("d", $item->getVar('time')), date('Y', $item->getVar('time')));
                $days[] = $pday;
            }
            $now = mktime(23, 59, 0, date("m", $item->getVar('time')), date("d", $item->getVar('time')), date('Y', $item->getVar('time')));
            if ($now > $pday + 86400) {
                $pday = $now;
                $days[] = $pday;
            }
        }
    }
    // Categories
    $categories = array();
    MCHFunctions::categories_tree($categories);
    // Teams
    $teams = MCHFunctions::all_teams(false, 'category=' . $category);
    // Fields
    $fields = MCHFunctions::all_fields();
    // Date field
    $form = new RMForm('', '', '');
    $datetime = new RMFormDate('', 'date', '', '', 1);
    $datetime->options('stepMinute: 15');
    MCHFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Role Play', 'match'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Coaches', 'match'));
    RMTemplate::get()->add_style('admin.css', 'match');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_local_script('admin_match.js', 'match');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar mch_message='" . __('Do you really want to delete selected items?', 'match') . "';\n\n        var mch_select_message = '" . __('You must select some role item before to execute this action!', 'match') . "';</script>");
    xoops_cp_header();
    $match_extra_options = RMEvents::get()->run_event('match.more.options');
    include RMTemplate::get()->get_template("admin/mch_roleplay.php", 'module', 'match');
    xoops_cp_footer();
}