• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP formatValue函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中formatValue函数的典型用法代码示例。如果您正苦于以下问题:PHP formatValue函数的具体用法?PHP formatValue怎么用?PHP formatValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了formatValue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: showRegionalRecordsSeparate

function showRegionalRecordsSeparate()
{
    #----------------------------------------------------------------------
    global $chosenRegionId;
    require 'regions_get_current_records.php';
    tableBegin('results', 6);
    tableCaption(false, "Single");
    tableHeader(explode('|', 'Event|Result|Person|Citizen of|Competition|'), array(1 => "class='R2'", 5 => 'class="f"'));
    foreach ($results as $result) {
        extract($result);
        if ($type == 'Single') {
            $isNewEvent = !isset($currentEventId) || $eventId != $currentEventId;
            $currentEventId = $eventId;
            tableRow(array($isNewEvent ? eventLink($eventId, $eventCellName) : '', $isNewEvent ? formatValue($value, $format) : '', personLink($personId, $personName), $countryName, competitionLink($competitionId, $competitionName), ''));
        }
    }
    tableCaption(false, "Average");
    tableHeader(explode('|', 'Event|Result|Person|Citizen of|Competition|Result Details'), array(1 => "class='R2'", 5 => 'class="f"'));
    $currentEventId = '';
    foreach ($results as $result) {
        extract($result);
        if ($type == 'Average') {
            $isNewEvent = $eventId != $currentEventId;
            $currentEventId = $eventId;
            tableRow(array($isNewEvent ? eventLink($eventId, $eventCellName) : '', $isNewEvent ? formatValue($value, $format) : '', personLink($personId, $personName), $countryName, competitionLink($competitionId, $competitionName), formatAverageSources(true, $result, $format)));
        }
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:29,代码来源:regions_separate.php


示例2: showCompetitionResultsByPerson

function showCompetitionResultsByPerson($resultsTable = 'Results')
{
    #----------------------------------------------------------------------
    global $chosenByPerson, $chosenAllResults, $chosenTop3, $chosenWinners;
    global $chosenCompetitionId;
    #--- Get the results.
    $competitionResults = getCompetitionResults($resultsTable);
    startTimer();
    tableBegin('results', 8);
    foreach ($competitionResults as $result) {
        extract($result);
        $isNewPerson = !isset($previousPersonId) || $personId != $previousPersonId;
        $isNewEvent = !isset($previousEventId) || $eventId != $previousEventId || $isNewPerson;
        #--- Welcome new persons.
        if ($isNewPerson) {
            if (isset($previousPersonId)) {
                tableRowBlank();
            }
            $bo3_as_mo3 = $formatId == '3' && ($eventId == '333bf' || $eventId == '333fm' || $eventId == '333ft');
            $headerAverage = $formatId == 'a' || $formatId == 'm' || $bo3_as_mo3 ? 'Average' : '';
            $headerAllResults = $formatId != '1' ? 'Result Details' : '';
            tableCaptionNew(false, $personId, spaced(array(personLink($personId, $personName), $countryName)));
            tableHeader(explode('|', "Event|Round|Place|Best||{$headerAverage}||{$headerAllResults}"), array(2 => 'class="r"', 3 => 'class="R"', 5 => 'class="R"', 7 => 'class="f"'));
        }
        #--- One result row.
        tableRowStyled($isNewEvent ? '' : 'color:#AAA', array($isNewEvent ? eventLink($eventId, $eventCellName) : '', $roundCellName, $isNewEvent ? "<b>{$pos}</b>" : $pos, formatValue($best, $valueFormat), $regionalSingleRecord, formatValue($average, $valueFormat), $regionalAverageRecord, formatAverageSources($formatId != '1', $result, $valueFormat)));
        $previousPersonId = $personId;
        $previousEventId = $eventId;
    }
    tableEnd();
    stopTimer("printing the huge table");
}
开发者ID:yuxuibbs,项目名称:worldcubeassociation.org,代码行数:32,代码来源:competition_results.php


示例3: showBody

function showBody($eventId)
{
    #----------------------------------------------------------------------
    #--- Get the data
    $rows = dbQuery("\n    SELECT    personId, personName, min(value1+value2+value3) minSum, count(*) means, 0 minSum2, 0 means2\n    FROM      Results\n    WHERE     eventId = '{$eventId}' and (value1>0)+(value2>0)+(value3>0) = 3\n    GROUP BY  personId\n    ORDER BY  minSum, personName\n  ");
    $also2 = $eventId == '444bf' || $eventId == '555bf';
    if ($also2) {
        $rows = array_merge($rows, dbQuery("\n      SELECT    personId, personName, 0 minSum, 0 means, min(greatest(0,value1)+greatest(0,value2)+greatest(0,value3)) minSum2, count(*) means2\n      FROM      Results\n      WHERE     eventId = '{$eventId}' and (value1>0)+(value2>0)+(value3>0) = 2\n      GROUP BY  personId\n      ORDER BY  minSum2, personName\n    "));
    }
    #--- Output the table header
    TableBegin('results', 7);
    TableHeader(array('Pos', 'Name', 'Best Mean', 'Means', $also2 ? 'Best 2-Mean' : '', $also2 ? '2-Means' : '', ''), array('class="r"', 'class="p"', 'class="r"', 'class="r"', 'class="r"', 'class="r"', 'class="f"'));
    #--- Output the table contents
    $listed = array();
    $pos = 0;
    foreach ($rows as $row) {
        list($personId, $personName, $minSum, $means, $minSum2, $means2) = $row;
        if (!isset($listed[$personId])) {
            $mean = formatValue(round($minSum / 3));
            $mean2 = formatValue(round($minSum2 / 2));
            TableRow(array(++$pos, personLink($personId, $personName), $mean, $means, $mean2, $means2, ''));
        }
        $listed[$personId] = true;
    }
    #--- Output the table end
    TableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:27,代码来源:update7205.php


示例4: formatSub20Streak

function formatSub20Streak($data)
{
    extract($data);
    $best = formatValue($best, 'time');
    $worst = formatValue($worst, 'time');
    $average = formatValue($average, 'time');
    return array($idAndName, $length, "<span style='color:#0E0;font-weight:bold'>{$best}</span>", $average, "<span style='color:#E33;font-weight:bold'>{$worst}</span>");
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:8,代码来源:333_consecutive_sub20.php


示例5: add_blindfold_333_consecutive_successes

function add_blindfold_333_consecutive_successes()
{
    global $lists, $WHERE;
    #--- Get ...
    $results = dbQuery("\n    SELECT personId, value1, value2, value3, value4, value5, year, month\n    FROM Results result, Competitions competition\n    {$WHERE} 1\n      AND eventId = '333bf'\n      AND competition.id = competitionId\n    ORDER BY personId, year, month, day, roundId\n  ");
    foreach (structureBy($results, 'personId') as $personResults) {
        extract($personResults[0]);
        #--- Collect all values of this person, add a 'current DNF' sentinel at the end.
        unset($datedValues);
        foreach ($personResults as $personResult) {
            foreach (range(1, 5) as $i) {
                $v = $personResult["value{$i}"];
                if ($v > 0 || $v == -1) {
                    $datedValues[] = array(getMonthName($personResult['month']) . " {$personResult['year']}", $v);
                }
            }
        }
        $datedValues[] = array('current', -1);
        #--- Find longest streak.
        $streak = array();
        $bestStreak = array();
        $streakFirstDate = "";
        $streakLastDate = "";
        foreach ($datedValues as $dv) {
            if ($dv[1] > 0) {
                if (!$streak) {
                    $streakFirstDate = $dv[0];
                }
                $streakLastDate = $dv[0];
                $streak[] = $dv[1];
            } else {
                if (count($streak) >= count($bestStreak)) {
                    $bestStreak = $streak;
                    $bestStreakFirstDate = $streakFirstDate;
                    $bestStreakLastDate = $dv[0] == 'current' ? '<b>ongoing...</b>' : $streakLastDate;
                }
                $streak = array();
            }
        }
        #--- This person doesn't have any streak? Next person, please.
        if (!$bestStreak) {
            continue;
        }
        #--- Determine properties of the streak.
        $length = count($bestStreak);
        $best = min($bestStreak);
        $worst = max($bestStreak);
        $average = array_sum($bestStreak) / $length;
        #--- Format and memorize this person with its streak
        $persons[] = array($personId, $length, '', '<span style="color:#0C0">' . formatValue($best) . '</span>', $average, '<span style="color:#E00">' . formatValue($worst) . '</span>', "{$bestStreakFirstDate} - {$bestStreakLastDate}");
    }
    usort($persons, 'compareBlindfoldStreaks');
    $persons = array_slice($persons, 0, 10);
    $lists[] = array("blind_streak_3x3", "Rubik's Cube Blindfolded longest success streak", "", "[P] Person [N] Length [t] &nbsp; [r] Best [r] Avg [r] Worst [t] When?", $persons);
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:55,代码来源:blindfold_333_consecutive_successes.php


示例6: showResults

function showResults()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenRegionId, $chosenYears, $chosenShow, $chosenSingle, $chosenAverage;
    #--- Try the cache
    tryCache('event', $chosenEventId, preg_replace('/ /', '', $chosenRegionId), $chosenYears, preg_replace('/ /', '', $chosenShow), $chosenSingle, $chosenAverage);
    #------------------------------
    # Prepare stuff for the query.
    #------------------------------
    $eventCondition = eventCondition();
    $yearCondition = yearCondition();
    $regionCondition = regionCondition('result');
    $limitCondition = '';
    if (preg_match('/^10+/', $chosenShow, $matches)) {
        $limitNumber = $matches[0];
        $limitCondition = 'LIMIT ' . 2 * $limitNumber;
    }
    $valueSource = $chosenAverage ? 'average' : 'best';
    $valueName = $chosenAverage ? 'Average' : 'Single';
    #------------------------------
    # Get results from database.
    #------------------------------
    if ($chosenShow == 'By Region') {
        require 'includes/events_regions.php';
        return;
    }
    if ($chosenShow == '100 Results' || $chosenShow == '1000 Results') {
        require 'includes/events_results.php';
    } else {
        require 'includes/events_persons.php';
    }
    #------------------------------
    # Show the table.
    #------------------------------
    startTimer();
    $event = getEvent($chosenEventId);
    tableBegin('results', 6);
    tableCaption(true, spaced(array($event['name'], chosenRegionName(), $chosenYears, $chosenShow)));
    $headerSources = $chosenAverage ? 'Result Details' : '';
    tableHeader(explode('|', "Rank|Person|Result|Citizen of|Competition|{$headerSources}"), array(0 => "class='r'", 2 => "class='R2'", 5 => 'class="f"'));
    $ctr = 0;
    foreach ($results as $result) {
        extract($result);
        $ctr++;
        $no = isset($previousValue) && $value == $previousValue ? '&nbsp;' : $ctr;
        if ($limitCondition && $no > $limitNumber) {
            break;
        }
        tableRow(array($no, personLink($personId, $personName), formatValue($value, $event['format']), htmlEntities($countryName), competitionLink($competitionId, $competitionName), formatAverageSources($chosenAverage, $result, $event['format'])));
        $previousValue = $value;
    }
    tableEnd();
    stopTimer("printing the table");
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:54,代码来源:events.php


示例7: sdRanking

function sdRanking()
{
    global $WHERE;
    #--- Get ...
    $results = dbQuery("\n    SELECT personName, personId, value1, value2, value3, value4, value5,\n      (((value1*value1 + value2*value2 + value3*value3 + value4*value4 + value5*value5) / 5) - (((value1 + value2 + value3 + value4 + value5) / 5)*((value1 + value2 + value3 + value4 + value5) / 5))) sd\n    FROM Results result\n    {$WHERE} 1\n      AND eventId = '333'\n      AND value1 > 0\n      AND value2 > 0\n      AND value3 > 0\n      AND value4 > 0\n      AND value5 > 0\n    ORDER BY sd, personName\n    LIMIT 0, 10\n  ");
    foreach ($results as $result) {
        extract($result);
        $rows[] = array($personId, formatValue(sqrt($sd), 'time'), formatAverageSources(true, $result, 'time'));
    }
    return $rows;
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:11,代码来源:standard_deviation.php


示例8: showRegionalRecordsHistory

function showRegionalRecordsHistory()
{
    #----------------------------------------------------------------------
    global $chosenRegionId, $chosenHistory, $chosenMixHist;
    #--- Compute the region condition and the normal record name.
    if (preg_match('/^(world)?$/i', $chosenRegionId)) {
        $regionCondition = "AND recordName = 'WR'";
        $normalRecordName = '';
    } elseif (preg_match('/^_/', $chosenRegionId)) {
        $tmp = dbQuery("SELECT recordName FROM Continents WHERE id = '{$chosenRegionId}'");
        $normalRecordName = $tmp[0][0];
        $regionCondition = "AND recordName in ('WR', '{$normalRecordName}' ) AND continentId = '{$chosenRegionId}'";
    } else {
        $regionCondition = "AND (recordName <> '') AND (result.countryId = '{$chosenRegionId}')";
        $normalRecordName = 'NR';
    }
    #--- Order: normal history or mixed?
    $order = $chosenHistory ? 'event.rank, type, value, year desc, month desc, day desc, roundId desc' : 'year desc, month desc, day desc, roundId desc, event.rank, type, value';
    #--- Get the results.
    $results = dbQuery("\n    SELECT\n      year, month, day,\n\n      event.id         eventId,\n      event.name       eventName,\n      event.cellName   eventCellName,\n\n      result.type      type,\n      result.value     value,\n      event.format     valueFormat,\n                       recordName,\n\n      result.personId   personId,\n      result.personName personName,\n\n      country.name     countryName,\n\n      competition.id   competitionId,\n      competition.cellName competitionName,\n\n      value1, value2, value3, value4, value5\n    FROM\n      (SELECT Results.*, 1 type, best    value, regionalSingleRecord  recordName FROM Results WHERE regionalSingleRecord<>'' UNION\n       SELECT Results.*, 2 type, average value, regionalAverageRecord recordName FROM Results WHERE regionalAverageRecord<>'') result,\n      Events event,\n      Competitions competition,\n      Countries country\n    WHERE " . randomDebug() . "\n      AND event.id = eventId\n      AND event.rank < 1000\n      AND competition.id = competitionId\n      AND country.id = result.countryId\n      {$regionCondition}\n      " . eventCondition() . yearCondition() . "\n    ORDER BY\n      {$order}\n  ");
    #--- Start the table
    if ($chosenHistory) {
        tableBegin('results', 7);
    } else {
        tableBegin('results', 9);
        tableHeader(explode('|', 'Date circa|Event|What|Single|Average|Person|Citizen of|Competition|Result Details'), array(3 => 'class="R2"', 4 => 'class="R2"', 8 => 'class="f"'));
    }
    #--- Process the results.
    $currentEventId = false;
    foreach ($results as $result) {
        extract($result);
        #--- Announce the event (only for normal history, not mixed)
        if ($chosenHistory && $eventId != $currentEventId) {
            $currentEventId = $eventId;
            tableCaptionNew(false, $eventId, eventLink($eventId, $eventName));
            tableHeader(explode('|', '|Single|Average|Person|Citizen of|Competition|Result Details'), array(1 => 'class="R2"', 2 => 'class="R2"', 6 => 'class="f"'));
        }
        #--- Determine how to display the record name.
        if ($recordName != $normalRecordName) {
            $recordName = "<span style='color:#f93;font-weight:bold'>{$recordName}</span>";
        }
        #--- Prepare the table row.
        $data = array($recordName, $type == 1 ? formatValue($value, $valueFormat) : '', $type == 2 ? formatValue($value, $valueFormat) : '', personLink($personId, $personName), $countryName, competitionLink($competitionId, $competitionName), formatAverageSources($type == 2, $result, $valueFormat));
        if ($chosenMixHist) {
            array_unshift($data, sprintf('%4d-%02d-%02d', $year, $month, $day), eventLink($eventId, $eventCellName));
        }
        #--- Show the table row.
        tableRow($data);
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:51,代码来源:regions_history.php


示例9: showResultsByEvents

function showResultsByEvents()
{
    #----------------------------------------------------------------------
    global $chosenPersonId;
    $results = dbQuery("\n    SELECT\n                           result.*,\n      event.name           eventName,\n      competition.cellName competitionCellName,\n      event.format         valueFormat,\n      round.cellName       roundCellName\n    FROM\n      Results result,\n      Events  event,\n      Competitions competition,\n      Rounds round\n    WHERE " . randomDebug() . "\n      AND personId = '{$chosenPersonId}'\n      AND event.id = eventId\n      AND event.rank < 1000\n      AND competition.id = competitionId\n      AND round.id = roundId\n    ORDER BY\n      event.rank, year DESC, month DESC, day DESC, competitionCellName, round.rank DESC\n  ");
    tableBegin('results', 8);
    tableCaption(false, "History (<a href='person_map.php?i={$chosenPersonId}'>Map</a>)");
    #--- Process results by event.
    foreach (structureBy($results, 'eventId') as $eventResults) {
        extract($eventResults[0]);
        #--- Announce the event.
        tableCaptionNew(false, $eventId, eventLink($eventId, $eventName));
        tableHeader(explode('|', 'Competition|Round|Place|Best||Average||Result Details'), array(2 => 'class="r"', 3 => 'class="R"', 5 => 'class="R"', 7 => 'class="f"'));
        #--- Initialize.
        $currentCompetitionId = '';
        #--- Compute PB Markers
        //$pbMarkers = [];
        $bestBest = 9999999999;
        $bestAverage = 9999999999;
        foreach (array_reverse($eventResults) as $result) {
            extract($result);
            $pbMarkers[$competitionId][$roundCellName] = 0;
            if ($best > 0 && $best <= $bestBest) {
                $bestBest = $best;
                $pbMarkers[$competitionId][$roundCellName] += 1;
            }
            if ($average > 0 && $average <= $bestAverage) {
                $bestAverage = $average;
                $pbMarkers[$competitionId][$roundCellName] += 2;
            }
        }
        #--- Show the results.
        foreach ($eventResults as $result) {
            extract($result);
            $isNewCompetition = $competitionId != $currentCompetitionId;
            $currentCompetitionId = $competitionId;
            $formatBest = formatValue($best, $valueFormat);
            if ($pbMarkers[$competitionId][$roundCellName] % 2) {
                $formatBest = "<span style='color:#F60;font-weight:bold'>{$formatBest}</span>";
            }
            $formatAverage = formatValue($average, $valueFormat);
            if ($pbMarkers[$competitionId][$roundCellName] > 1) {
                $formatAverage = "<span style='color:#F60;font-weight:bold'>{$formatAverage}</span>";
            }
            tableRowStyled($isNewCompetition ? '' : 'color:#AAA', array($isNewCompetition ? competitionLink($competitionId, $competitionCellName) : '', $roundCellName, $isNewCompetition ? "<b>{$pos}</b>" : $pos, $formatBest, $regionalSingleRecord, $formatAverage, $regionalAverageRecord, formatAverageSources(true, $result, $valueFormat)));
        }
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:49,代码来源:person_events.php


示例10: showCurrentPersonalRecords

function showCurrentPersonalRecords()
{
    #----------------------------------------------------------------------
    global $chosenPersonId;
    $bests = dbQuery("\n\n  SELECT * FROM\n\n   (SELECT \n      eventId,\n      best single,\n      worldRank singleRank,\n      continentRank singleRankContinent,\n      countryRank singleRankCountry\n    FROM RanksSingle\n    WHERE personId='{$chosenPersonId}') singles\n    \n    LEFT JOIN\n   \n   (SELECT \n      eventId eC,\n      best average,\n      worldRank averageRank,\n      continentRank averageRankContinent,\n      countryRank averageRankCountry\n    FROM RanksAverage\n    WHERE personId='{$chosenPersonId}') average\n    \n    ON eventId = eC,\n    Events event\n    WHERE\n      eventId = event.id\n    ORDER BY\n      event.rank\n\n\n  ");
    tableBegin('results', 10);
    tableCaption(false, "Current Personal Records");
    tableHeader(explode(" ", "Event NR CR WR Single Average WR CR NR "), array("", "class='r'", "class='r'", "class='R'", "class='R2'", "class='R2'", "class='R'", "class='r'", "class='r'", "class='f'"));
    $oddMessage = "A missing or worse country/continent rank compared to a larger region rank is due to the change of country because results from previous regions don&#39;t count for differing current regions.";
    foreach ($bests as $best) {
        extract($best);
        $odd = $singleRankCountry > $singleRankContinent || $singleRankContinent > $singleRank || $averageRankCountry > $averageRankContinent || $averageRankContinent > $averageRank || !$singleRankCountry && $singleRankContinent || !$singleRankContinent && $singleRank || !$averageRankCountry && $averageRankContinent || !$averageRankContinent && $averageRank;
        tableRow(array(internalEventLink("#{$eventId}", eventCellName($eventId)), "<span style='color:#999'>" . colorMe($singleRankCountry) . "</span>", colorMe($singleRankContinent), colorMe($singleRank), eventLink($eventId, formatValue($single, valueFormat($eventId))), eventAverageLink($eventId, formatValue($average, valueFormat($eventId))), colorMe($averageRank), colorMe($averageRankContinent), "<span style='color:#999'>" . colorMe($averageRankCountry) . "</span>", $odd ? "<a title='{$oddMessage}' style='color:#66F' onclick='alert(\"{$oddMessage}\")'>(*)</a>" : ''));
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:16,代码来源:person_personal_records_current.php


示例11: showRegionalRecordsSlim

function showRegionalRecordsSlim()
{
    #----------------------------------------------------------------------
    global $chosenYears;
    require 'regions_get_current_records.php';
    tableBegin('results', 6);
    $caption = spaced(array(chosenRegionName(), $chosenYears));
    if ($caption) {
        tableCaption(true, $caption);
    } else {
        tableRowBlank();
    }
    tableHeader(explode('|', 'Person|Single|Event|Average|Person|Result Details'), array(1 => "class='R2'", 2 => "class='c'", 3 => "class='R2'", 5 => 'class="f"'));
    #--- Process events.
    foreach (structureBy($results, 'eventId') as $eventResults) {
        $structure = structureBy($eventResults, 'type');
        $singles = $structure[0];
        $averages = isset($structure[1]) ? $structure[1] : array();
        $wasShownSinglePerson = $wasShownAveragePerson = array();
        #--- Process records for this event.
        $first = true;
        while ($singles || $averages) {
            #--- Get next single.
            $s = array_shift($singles);
            if (isset($wasShownSinglePerson[$s['personId']])) {
                $s = false;
            }
            $wasShownSinglePerson[$s['personId']] = true;
            #--- Get next average.
            $a = array_shift($averages);
            if (isset($wasShownAveragePerson[$a['personId']])) {
                $a = false;
            }
            $wasShownAveragePerson[$a['personId']] = true;
            if ($s || $a) {
                tableRow(array($s ? personLink($s['personId'], $s['personName']) : '', $first ? formatValue($s['value'], $s['format']) : '', $first ? eventLink($s['eventId'], $s['eventCellName']) : '', $first ? formatValue($a['value'], $a['format']) : '', $a ? personLink($a['personId'], $a['personName']) : '', $a ? formatAverageSources(true, $a, $a['format']) : ''));
            }
            $first = false;
        }
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:42,代码来源:regions_slim.php


示例12: showHistoryOfContinentalRecords

function showHistoryOfContinentalRecords()
{
    #----------------------------------------------------------------------
    global $chosenPersonId;
    $results = dbQuery("\n    SELECT\n      result.*,\n      event.format         valueFormat,\n      event.cellName       eventCellName,\n      competition.cellName competitionCellName,\n      round.cellName       roundCellName\n    FROM\n      Results      result,\n      Competitions competition,\n      Events       event,\n      Rounds       round\n    WHERE " . randomDebug() . "\n      AND result.personId = '{$chosenPersonId}'\n      AND ((result.regionalSingleRecord != '' AND result.regionalSingleRecord != 'NR' AND result.regionalSingleRecord != 'WR') OR (result.regionalAverageRecord != '' AND result.regionalAverageRecord != 'NR' AND result.regionalAverageRecord != 'WR'))\n      AND event.id = result.eventId\n      AND event.rank < 1000\n      AND competition.id = result.competitionId\n      AND round.id = result.roundId\n    ORDER BY\n      event.rank, year DESC, month DESC, day DESC, roundId DESC\n  ");
    if (!count($results)) {
        return;
    }
    tableBegin('results', 6);
    tableCaption(false, 'History of Continental Records');
    tableHeader(explode('|', 'Event|Single|Average|Competition|Round|Result Details'), array(1 => "class='R2'", 2 => "class='R2'", 5 => "class='f'"));
    foreach ($results as $result) {
        extract($result);
        if (isset($currentEventId) && $eventId != $currentEventId) {
            tableRowEmpty();
        }
        tableRow(array(isset($currentEventId) && $eventId == $currentEventId ? '' : eventLink($eventId, $eventCellName), ($regionalSingleRecord == '' or $regionalSingleRecord == 'NR' or $regionalSingleRecord == 'WR') ? '' : formatValue($best, $valueFormat), ($regionalAverageRecord == '' or $regionalAverageRecord == 'NR' or $regionalAverageRecord == 'WR') ? '' : formatValue($average, $valueFormat), competitionLink($competitionId, $competitionCellName), $roundCellName, formatAverageSources($regionalAverageRecord != '' and $regionalAverageRecord != 'NR' and $regionalAverageRecord != 'WR', $result, $valueFormat)));
        $currentEventId = $eventId;
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:21,代码来源:person_continent_records_history.php


示例13: showRegionalRecordsMixed

function showRegionalRecordsMixed()
{
    #----------------------------------------------------------------------
    global $chosenRegionId, $chosenYears;
    require 'regions_get_current_records.php';
    tableBegin('results', 6);
    tableCaption(false, spaced(array(chosenRegionName(), $chosenYears)));
    tableHeader(explode('|', 'Type|Result|Person|Citizen of|Competition|Result Details'), array(1 => "class='R2'", 5 => 'class="f"'));
    foreach ($results as $result) {
        extract($result);
        $isNewEvent = !isset($currentEventId) || $eventId != $currentEventId;
        $currentEventId = $eventId;
        $isNewType = $isNewEvent || !isset($currentType) || $type != $currentType;
        $currentType = $type;
        if ($isNewEvent) {
            tableCaption(false, eventLink($eventId, $eventName));
        }
        tableRow(array($isNewType ? $type : '', $isNewType ? formatValue($value, $format) : '', personLink($personId, $personName), $countryName, competitionLink($competitionId, $competitionName), formatAverageSources($type == 'Average', $result, $format)));
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:21,代码来源:regions_mixed.php


示例14: showWorldChampionshipPodiums

function showWorldChampionshipPodiums()
{
    #----------------------------------------------------------------------
    global $chosenPersonId;
    $results = dbQuery("\n    SELECT\n      result.*,\n      event.format         valueFormat,\n      event.cellName       eventCellName,\n      competition.cellName competitionCellName,\n      year\n    FROM\n      Results      result,\n      Competitions competition,\n      Events       event\n    WHERE " . randomDebug() . "\n      AND best > 0\n      AND pos <= 3\n      AND roundId in ('f', 'c')\n      AND competition.cellName like 'World Championship %'\n      AND result.personId = '{$chosenPersonId}'\n      AND event.id = result.eventId\n      AND competition.id = result.competitionId\n      AND event.rank < 1000\n    ORDER BY\n      year DESC, event.rank\n  ");
    if (!count($results)) {
        return;
    }
    tableBegin('results', 6);
    tableCaption(false, 'World Championship Podiums');
    tableHeader(explode('|', 'Year|Event|Place|Single|Average|Result Details'), array(0 => "class='R2'", 2 => "class='R2'", 3 => "class='r'", 4 => "class='r'", 5 => "class='f'"));
    $lastYear = 0;
    foreach ($results as $result) {
        extract($result);
        if ($year < $lastYear) {
            tableRowEmpty();
        }
        tableRow(array($year != $lastYear ? $year : '', eventLink($eventId, $eventCellName), competitionLink($competitionId, $pos, $eventId, $roundId), formatValue($best, $valueFormat), formatValue($average, $valueFormat), formatAverageSources(true, $result, $valueFormat)));
        $lastYear = $year;
    }
    tableEnd();
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:22,代码来源:person_world_championship_podiums.php


示例15: createStaticAsset

 public static function createStaticAsset($name, $asset, $ext)
 {
     StaticAsset::releaseCurrentField($name);
     $query = "INSERT INTO static_asset (name, asset, current, extension) VALUES ('{$name}', '" . formatValue($asset) . "', 1, '{$ext}')";
     $result = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
 }
开发者ID:standup75,项目名称:standupweb-cms,代码行数:6,代码来源:StaticAsset.php


示例16: createStaticField

 public static function createStaticField($name, $value)
 {
     StaticField::releaseCurrentField($name);
     $query = "INSERT INTO static_field (name, value, current) VALUES ('{$name}', '" . formatValue($value) . "', 1)";
     $result = mysql_query($query) or die(sqlError(__FILE__, __LINE__, $query));
 }
开发者ID:standup75,项目名称:standupweb-cms,代码行数:6,代码来源:StaticField.php


示例17: rows_as_table

 public function rows_as_table($dbrows, $formats = array())
 {
     $ret = "";
     if (!empty($dbrows)) {
         $ret .= "<table class='table table-bordered' border=1>";
         // Print the header
         $ret .= "<thead>";
         if (!empty($dbrows[0])) {
             foreach ($dbrows[0] as $key => $val) {
                 $ret .= "<th>";
                 $ret .= ucwords(str_replace("_", " ", strtolower($key)));
                 $ret .= "</th>";
             }
         }
         $ret .= "</thead>";
         // Print the body of the table
         $ret .= "<tbody>";
         if (!empty($dbrows) && is_array($dbrows)) {
             foreach ($dbrows as $dbrow) {
                 $ret .= "<tr>";
                 if (!empty($dbrow) && is_array($dbrow)) {
                     foreach ($dbrow as $id => $val) {
                         if (is_array($formats) && isset($formats[$id])) {
                             $format = $formats[$id];
                         } else {
                             if (!is_array($formats)) {
                                 $format = $formats;
                             }
                         }
                         $ret .= "<td>";
                         $val = $this->undbize($val);
                         if (isset($format)) {
                             $val = formatValue($val, $format);
                         }
                         $ret .= $val;
                         $ret .= "</td>";
                     }
                 }
                 $ret .= "</tr>";
             }
             $ret .= "</tbody>";
             $ret .= "</table>";
         }
     }
     return $ret;
 }
开发者ID:hughlaura,项目名称:php_oracle_handytools,代码行数:46,代码来源:Engine.class.php


示例18: foreach

            } else {
                for ($j = 0; $j < count($cell[$i]); $j++) {
                    $key = $property[$j]['id'];
                    $value = $cell[$i][$j];
                    $pair[$n][$key] = $value;
                }
            }
            $n++;
            //$n should only be raised when $pair[$n] has been filled
        }
    }
    echo '<table>';
    for ($i = 1; $i <= count($pair); $i++) {
        if ($_POST['cu'] == 'create') {
            echo "<tr><td>CREATE</td>\r\n";
            foreach ($pair[$i] as $key => $value) {
                if ($value != "") {
                    echo "<tr><td>LAST</td><td>{$key}</td><td>" . formatValue($value, getDataType($key)) . "</td></tr>\r\n";
                }
            }
        } else {
            $item = getPropertyId($pair[$i]['item'], "item");
            foreach ($pair[$i] as $key => $value) {
                if ($key != "item" && $value != "") {
                    echo "<tr><td>{$item}</td><td>{$key}</td><td>" . formatValue($value, getDataType($key)) . "</td></tr>\r\n";
                }
            }
        }
    }
    echo '</table>';
}
开发者ID:mbch331,项目名称:QSGenerator,代码行数:31,代码来源:index.php


示例19: foreach

echo "</tr>\n";
foreach ($statList as $key => $values) {
    if (!isset($dates) && $key == "average") {
        continue;
    }
    if (!$config["UNUSED_STATS"] && !in_array($key, array("total", "average", "everyHour")) && array_sum(array_column($players, $key)) <= 0) {
        if (!isset($unlisted)) {
            $unlisted = "<b>Non-listés :</b> ";
        }
        $unlisted .= $values[0] . " | ";
        continue;
    }
    echo "<tr>";
    $sorted = $key == $sortStat;
    echo "<th " . (in_array($key, array("total", "average", "everyHour")) ? "" : "title='{$key}'") . "onclick='printStats(" . makeUrl($statCat, $key, $sortPlayer) . ");' " . ($sorted ? " class='sorted'>" : "class='unsorted'>") . "{$values['0']}</td>";
    foreach ($players as $name => $player) {
        $sorted = $name == $sortPlayer || $key == $sortStat;
        echo "<td" . ($sorted ? " class='sorted'>" : ">") . formatValue($player[$key], $statList[$key][1]) . "</td>";
        if ($name == "Total") {
            echo "<td class='blank'></td>";
        }
    }
    echo "</tr>\n";
    if ($key == "everyHour" || $statCat == "biomes" && $key == "total") {
        echo "<tr><td class='blank'></td></tr>\n";
    }
}
echo "</table>";
if ($showUnlisted) {
    echo isset($unlisted) ? "<br>" . substr($unlisted, 0, -3) : "";
}
开发者ID:Olybri,项目名称:Minecrew,代码行数:31,代码来源:stats.php


示例20: computeRegionalRecordMarkers


//.........这里部分代码省略.........
    $queryRelevantIds = "\n   (SELECT id FROM Results WHERE regional{$valueName}Record<>'' " . eventCondition() . competitionCondition() . ")\n   UNION\n   (SELECT id\n    FROM\n      Results result,\n      (SELECT eventId, competitionId, roundId, countryId, min({$valueId}) value\n       FROM Results\n       WHERE {$valueId} > 0\n       " . eventCondition() . competitionCondition() . "\n       GROUP BY eventId, competitionId, roundId, countryId) helper\n    WHERE result.eventId       = helper.eventId\n      AND result.competitionId = helper.competitionId\n      AND result.roundId       = helper.roundId\n      AND result.countryId     = helper.countryId\n      AND result.{$valueId}      = helper.value)";
    #--- Get the results, ordered appropriately
    $results = dbQueryHandle("\n    SELECT\n      year*10000 + month*100 + day startDate,\n      result.id resultId,\n      result.eventId,\n      result.competitionId,\n      result.roundId,\n      result.personId,\n      result.personName,\n      result.countryId,\n      result.regional{$valueName}Record storedMarker,\n      {$valueId} value,\n      continentId,\n      continent.recordName continentalRecordName,\n      event.format valueFormat\n    FROM\n      ({$queryRelevantIds}) relevantIds,\n      Results      result,\n      Competitions competition,\n      Countries    co 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP formatVariable函数代码示例发布时间:2022-05-15
下一篇:
PHP formatUserName函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap