Ejemplo n.º 1
0
function rankingTribe_getContent()
{
    global $template;
    // open template
    $template->setFile('rankingTribe.tmpl');
    $template->setShowResource(false);
    $numRows = rankingTribe_getMaxRows();
    $offset = 0;
    $row = array();
    if ($numRows > 0) {
        $search = Request::getVar('search', '');
        $page = Request::getVar('page', 0);
        if ($search !== '') {
            $offset = rankingTribe_checkOffsetBySearch($search, $numRows);
            if ($offset < 0) {
                $offset = 0;
                $template->addVar('status_msg', array('type' => 'error', 'message' => 'Der gesuchte Stamm wurde nicht gefunden'));
            }
        } else {
            $offset = rankingTribe_checkOffsetByPage($_SESSION['player']->tribeID, $page, $numRows);
        }
        $row = rankingTribe_getRowsByOffset($offset);
    }
    $template->addVars(array('page' => ceil($offset / RANKING_ROWS) + 1, 'max_pages' => ceil($numRows / RANKING_ROWS), 'rows_per_page' => RANKING_ROWS, 'row' => $row));
}
Ejemplo n.º 2
0
function rankingTribe_getContent($caveID, $offset)
{
    global $template;
    // open template
    $template->setFile('rankingTribe.tmpl');
    $template->setShowRresource(false);
    $row = rankingTribe_getRowsByOffset($caveID, $offset);
    $template->addVars(array('offset_up' => $offset - RANKING_ROWS > 0 ? $offset - RANKING_ROWS : 0, 'offset_down' => $offset + RANKING_ROWS, 'row' => $row));
}
Ejemplo n.º 3
0
function rankingTribe_getContent($caveID, $offset)
{
    global $no_resource_flag, $config, $params;
    $no_resource_flag = 1;
    // ADDED by chris--- for ranking sorting
    $order = $params->POST->order;
    if ($order != "rank" && $order != "tribe" && $order != "points" && $order != "fame" && $order != "points_rank" && $order != "members" && $order != "playerAverage" && $order != "caves") {
        $order = "rank";
    }
    $direct = $params->POST->direct;
    if ($direct != "ASC" && $direct != "DESC") {
        $direct = "ASC";
    }
    $row = rankingTribe_getRowsByOffset($caveID, $offset, $order, $direct);
    // ADDED by chris--- for ranking sorting
    //  $up   = array('link' => "?modus=" . RANKING_TRIBE . "&offset=" . ($offset - RANKING_ROWS));
    //  $down = array('link' => "?modus=" . RANKING_TRIBE . "&offset=" . ($offset + RANKING_ROWS));
    $up_link = "?modus=" . RANKING_TRIBE . "&offset=" . ($offset - RANKING_ROWS);
    $down_link = "?modus=" . RANKING_TRIBE . "&offset=" . ($offset + RANKING_ROWS);
    if ($order) {
        $up_link .= "&amp;order=" . $order;
        $down_link .= "&amp;order=" . $order;
    }
    if ($direct) {
        $up_link .= "&amp;direct=" . $direct;
        $down_link .= "&amp;direct=" . $direct;
    }
    $up = array('link' => $up_link);
    $down = array('link' => $down_link);
    // Header links
    $link_rank = "?modus=" . RANKING_TRIBE . "&amp;order=rank";
    $link_points_rank = "?modus=" . RANKING_TRIBE . "&amp;order=points_rank";
    $link_caves = "?modus=" . RANKING_TRIBE . "&amp;order=caves";
    $link_points = "?modus=" . RANKING_TRIBE . "&amp;order=points";
    $link_tribe = "?modus=" . RANKING_TRIBE . "&amp;order=tribe";
    $link_fame = "?modus=" . RANKING_TRIBE . "&amp;order=fame";
    $link_members = "?modus=" . RANKING_TRIBE . "&amp;order=members";
    $link_playerAverage = "?modus=" . RANKING_TRIBE . "&amp;order=playerAverage";
    if ($direct) {
        $link_rank .= "&amp;direct=" . $direct;
        $link_points_rank .= "&amp;direct=" . $direct;
        $link_caves .= "&amp;direct=" . $direct;
        $link_points .= "&amp;direct=" . $direct;
        $link_tribe .= "&amp;direct=" . $direct;
        $link_fame .= "&amp;direct=" . $direct;
        $link_members .= "&amp;direct=" . $direct;
        $link_playerAverage .= "&amp;direct=" . $direct;
    }
    if ($order == "rank" && $direct == "ASC") {
        $link_rank = "?modus=" . RANKING_TRIBE . "&amp;order=rank&amp;direct=DESC";
    }
    if ($order == "rank" && $direct == "DESC") {
        $link_rank = "?modus=" . RANKING_TRIBE . "&amp;order=rank&amp;direct=ASC";
    }
    if ($order == "points_rank" && $direct == "ASC") {
        $link_points_rank = "?modus=" . RANKING_TRIBE . "&amp;order=points_rank&amp;direct=DESC";
    }
    if ($order == "points_rank" && $direct == "DESC") {
        $link_points_rank = "?modus=" . RANKING_TRIBE . "&amp;order=points_rank&amp;direct=ASC";
    }
    if ($order == "caves" && $direct == "ASC") {
        $link_caves = "?modus=" . RANKING_TRIBE . "&amp;order=caves&amp;direct=DESC";
    }
    if ($order == "caves" && $direct == "DESC") {
        $link_caves = "?modus=" . RANKING_TRIBE . "&amp;order=caves&amp;direct=ASC";
    }
    if ($order == "points" && $direct == "ASC") {
        $link_points = "?modus=" . RANKING_TRIBE . "&amp;order=points&amp;direct=DESC";
    }
    if ($order == "points" && $direct == "DESC") {
        $link_points = "?modus=" . RANKING_TRIBE . "&amp;order=points&amp;direct=ASC";
    }
    if ($order == "tribe" && $direct == "ASC") {
        $link_tribe = "?modus=" . RANKING_TRIBE . "&amp;order=tribe&amp;direct=DESC";
    }
    if ($order == "tribe" && $direct == "DESC") {
        $link_tribe = "?modus=" . RANKING_TRIBE . "&amp;order=tribe&amp;direct=ASC";
    }
    if ($order == "members" && $direct == "ASC") {
        $link_members = "?modus=" . RANKING_TRIBE . "&amp;order=members&amp;direct=DESC";
    }
    if ($order == "members" && $direct == "DESC") {
        $link_members = "?modus=" . RANKING_TRIBE . "&amp;order=members&amp;direct=ASC";
    }
    if ($order == "fame" && $direct == "ASC") {
        $link_fame = "?modus=" . RANKING_TRIBE . "&amp;order=fame&amp;direct=DESC";
    }
    if ($order == "fame" && $direct == "DESC") {
        $link_fame = "?modus=" . RANKING_TRIBE . "&amp;order=fame&amp;direct=ASC";
    }
    if ($order == "playerAverage" && $direct == "ASC") {
        $link_playerAverage = "?modus=" . RANKING_TRIBE . "&amp;order=playerAverage&amp;direct=DESC";
    }
    if ($order == "playerAverage" && $direct == "DESC") {
        $link_playerAverage = "?modus=" . RANKING_TRIBE . "&amp;order=playerAverage&amp;direct=ASC";
    }
    // ------------------------------------------------------
    $hidden = array(array('name' => "modus", 'value' => RANKING_TRIBE));
    $template = tmpl_open($params->SESSION->player->getTemplatePath() . 'rankingTribe.ihtml');
    for ($i = 0; $i < sizeof($row); ++$i) {
        tmpl_iterate($template, 'ROWS');
        if ($i % 2) {
            tmpl_set($template, 'ROWS/ROW_ALTERNATE', $row[$i]);
        } else {
            tmpl_set($template, 'ROWS/ROW', $row[$i]);
        }
    }
    tmpl_set($template, array('modus' => RANKING, 'UP' => $up, 'DOWN' => $down, 'update' => getUpdateTime(), 'HIDDEN' => $hidden, 'link_rank' => $link_rank, 'link_caves' => $link_caves, 'link_points' => $link_points, 'link_tribe' => $link_tribe, 'link_fame' => $link_fame, 'link_points_rank' => $link_points_rank, 'link_members' => $link_members, 'link_playerAverage' => $link_playerAverage));
    return tmpl_parse($template);
}