本文整理汇总了PHP中Results类的典型用法代码示例。如果您正苦于以下问题:PHP Results类的具体用法?PHP Results怎么用?PHP Results使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Results类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: launch
/**
* Process incoming parameters and display search results or a record.
*
* @return void
* @access public
*/
public function launch()
{
$params = $this->parseOpenURL();
$searchObject = $this->processOpenURL($params);
// If we were asked to return just information whether something was found,
// do it here
if (isset($_REQUEST['vufind_response_type']) && $_REQUEST['vufind_response_type'] == 'resultcount') {
echo $searchObject->getResultTotal();
return;
}
// Otherwise just display results
$results = new Results();
$results->showResults($searchObject);
}
示例2: postIndex
public function postIndex()
{
$postData = Input::all();
$Qlenght = $postData['questionsLenght'];
$anArr = array();
$total = 0;
$questionArr = [];
for ($i = 0; $i < $Qlenght; $i++) {
$j = $i + 1;
$currentQuestionArr = $postData["currentQuestion{$j}"];
$question = Question::find($currentQuestionArr);
$correctAn = $question->correct_answer;
$questionId = $question->id;
if (isset($postData['optionsRadios' . $j . $questionId])) {
$answer = $postData['optionsRadios' . $j . $questionId];
if ($answer == $correctAn) {
$total = $total + 1;
}
$formOrigin = "quizz";
$questionArr[$questionId] = $answer;
Results::where('user_id', Auth::user()->id)->delete();
} else {
return Redirect::to('backends/dashboard')->withInput()->with('flash_message', 'Please select all option to check answer.');
}
}
$results = Results::create(['user_id' => Auth::user()->id, 'question_quizzler_answer' => json_encode($questionArr), 'active' => 1]);
$total = $total / $Qlenght * 100;
return Redirect::to('backends/dashboard?keyword=' . $formOrigin . "&total=" . $total . "&resultId=" . $results->id)->withInput();
}
示例3: postLoginform
public function postLoginform()
{
$postData = Input::all();
$rules = array('username' => 'required');
$validator = Validator::make($postData, $rules);
if ($validator->fails()) {
return Redirect::to('/login')->withInput()->withErrors($validator);
} else {
$credentials = array('username' => $postData['username'], 'password' => $postData['password']);
if (Auth::attempt($credentials)) {
if (Auth::user()->active == 1) {
if (Auth::user()->user_role_id == 2) {
return Redirect::to('backends/dashboard')->with('flash_message', 'Welcome To : The Quizzler.');
exit;
} else {
$results = Results::where('user_id', Auth::user()->id)->first();
if (isset($results)) {
return Redirect::to('backends/dashboard/viewresult');
exit;
} else {
return Redirect::to('backends/dashboard')->with('flash_message', 'Welcome To : The Quizzler.');
exit;
}
}
} else {
return Redirect::to('/login')->withInput()->with('flash_message', 'Your Username and Password are Invalide.');
exit;
}
} else {
return Redirect::to('/login')->withInput()->with('flash_message', 'Your Username and Password are Invalide.');
exit;
}
}
}
示例4: destroy
public function destroy($id)
{
if (\Input::get('bulk_opa_items')) {
$result = Results::find(Input::get('bulk_opa_items')[0]);
$result->delete();
}
return Redirect::to("/admin/surveys/" . $id . "/results");
}
示例5: getResults
public static function getResults($id)
{
//比赛成绩
$winners = Results::model()->with(array('person', 'person.country', 'round', 'event', 'format'))->findAllByAttributes(array('competitionId' => $id, 'pos' => 1, 'roundId' => array('c', 'f')), array('order' => 'event.rank, round.rank, t.pos'));
$top3 = Results::model()->with(array('person', 'person.country', 'round', 'event', 'format'))->findAllByAttributes(array('competitionId' => $id, 'pos' => array(1, 2, 3), 'roundId' => array('c', 'f')), array('order' => 'event.rank, round.rank, t.pos'));
$all = Results::model()->with(array('person', 'person.country', 'round', 'event', 'format'))->findAllByAttributes(array('competitionId' => $id), array('order' => 'event.rank, round.rank, t.pos'));
$scrambles = Scrambles::model()->with(array('round', 'event'))->findAllByAttributes(array('competitionId' => $id), array('order' => 'event.rank, round.rank, t.groupId, t.isExtra, t.scrambleNum'));
return array('winners' => $winners, 'top3' => $top3, 'all' => $all, 'scrambles' => $scrambles);
}
示例6: getEventsString
public function getEventsString($event)
{
$str = '';
if (in_array($event, $this->events)) {
$str = '<span class="fa fa-check"></span>';
if ($this->best > 0 && self::$sortAttribute === $event && self::$sortDesc !== true) {
$str = self::$sortDesc === true ? '' : '[' . $this->pos . ']' . $str;
$str .= Results::formatTime($this->best, $event);
}
}
return $str;
}
示例7: getTestagain
public function getTestagain($userId = 0)
{
$result = Results::where('user_id', $userId)->first();
$result = Results::find($result['id']);
//return $result->active;
if ($result->active == 0) {
$result->active = 1;
} elseif ($result->active == 1) {
$result->active = 0;
}
$result->save();
return Redirect::to('backends/users');
}
示例8: main
public function main()
{
if (!isset($_GET['pod_id'])) {
return R('/');
}
$podId = $_GET['pod_id'];
$pod = new Pod($podId);
$args = (array) $pod;
if (A()->isAdmin() && $pod->awaitingPairings()) {
$args['pairUrl'] = U('/pair/', false, ['pod_id' => $podId]);
}
$results = new Results();
foreach ($args['rounds'] as &$round) {
foreach ($round['matches'] as &$match) {
$needsReport = $match['wins'] === null;
$canReport = A()->isAdmin() || $match['playerId'] === S()->id() || $match['opponentId'] === S()->id();
if ($needsReport && $canReport) {
$match['potentialResults'] = $results->potentialResults($match['matchId']);
}
}
}
$args['standings'] = (new Standings($podId))->getStandings();
return T()->pod($args);
}
示例9: formatSum
private static function formatSum($row)
{
switch ($row['eventId']) {
case '333mbf':
return array_sum(array_map(function ($row) {
$result = $row[0]['average'];
$difference = 99 - substr($result, 0, 2);
return $difference;
}, array($row['first'], $row['second'], $row['third'])));
case '333fm':
return $row['sum'] / 100;
default:
return Results::formatTime($row['sum'], $row['eventId']);
}
}
示例10: DataObjectList
/**
* Constructor
*
* If provided, executes SQL query via parent Results object
*
* @param string Name of table in database
* @param string Prefix of fields in the table
* @param string Name of the ID field (including prefix)
* @param string Name of Class for objects within this list
* @param string SQL query
* @param integer number of lines displayed on one screen
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param string default ordering of columns (special syntax)
*/
function DataObjectList($tablename, $prefix = '', $dbIDname = 'ID', $objType = 'Item', $sql = NULL, $limit = 20, $param_prefix = '', $default_order = NULL)
{
$this->dbtablename = $tablename;
$this->dbprefix = $prefix;
$this->dbIDname = $dbIDname;
$this->objType = $objType;
if (!is_null($sql)) {
// We have an SQL query to execute:
parent::Results($sql, $param_prefix, $default_order, $limit);
} else {
// TODO: do we want to autogenerate a query here???
// Temporary...
parent::Results($sql, $param_prefix, $default_order, $limit);
}
}
示例11: getResultsYear
public function getResultsYear()
{
session_start();
$headers = apache_request_headers();
$token = $headers['X-Auth-Token'];
if (!$headers['X-Auth-Token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, '1msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
if ($token != $_SESSION['form_token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, 'msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
Results::getResultsYear();
}
}
}
示例12: build
public static function build($statistic)
{
$command = Yii::app()->wcaDb->createCommand()->select(array('r.*', 'rs.personName', 'rs.competitionId', 'c.cellName', 'c.cityName', 'c.year', 'c.month', 'c.day'))->leftJoin('Persons p', 'r.personId=p.id AND p.subid=1')->where('r.countryRank=1 AND rs.personCountryId="China"');
$rows = array();
foreach (Results::getRankingTypes() as $type) {
$cmd = clone $command;
$cmd->from(sprintf('Ranks%s r', ucfirst($type)))->leftJoin('Results rs', sprintf('r.best=rs.%s AND r.personId=rs.personId AND r.eventId=rs.eventId', $type == 'single' ? 'best' : $type))->leftJoin('Competitions c', 'rs.competitionId=c.id');
foreach ($cmd->queryAll() as $row) {
$row['type'] = $type;
if (isset($rows[$type][$row['eventId']])) {
$temp = $rows[$type][$row['eventId']];
if ($temp['year'] > $row['year'] || $temp['month'] > $row['month'] || $temp['day'] > $row['day']) {
continue;
}
}
$row = self::getCompetition($row);
$rows[$type][$row['eventId']] = $row;
}
}
$rows = array_merge(array_values($rows['single']), array_values($rows['average']));
usort($rows, function ($rowA, $rowB) {
$temp = $rowA['year'] - $rowB['year'];
if ($temp == 0) {
$temp = $rowA['month'] - $rowB['month'];
}
if ($temp == 0) {
$temp = $rowA['day'] - $rowB['day'];
}
if ($temp == 0) {
$temp = strcmp($rowA['personName'], $rowB['personName']);
}
return $temp;
});
$rows = array_slice($rows, 0, self::$limit);
//person days event type result record competition
$columns = array(array('header' => 'Yii::t("statistics", "Person")', 'value' => 'Persons::getLinkByNameNId($data["personName"], $data["personId"])', 'type' => 'raw'), array('header' => 'Yii::t("statistics", "Days")', 'value' => 'CHtml::tag("b", array(), floor((time() - strtotime(sprintf("%s-%s-%s", $data["year"], $data["month"], $data["day"]))) / 86400))', 'type' => 'raw'), array('header' => 'Yii::t("common", "Event")', 'value' => 'Yii::t("event", Events::getFullEventName($data["eventId"]))'), array('header' => 'Yii::t("common", "Type")', 'value' => 'Yii::t("common", ucfirst($data["type"]))'), array('header' => 'Yii::t("common", "Result")', 'value' => 'Results::formatTime($data["best"], $data["eventId"])'), array('header' => 'Yii::t("common", "Records")', 'value' => '$data["worldRank"] == 1 ? "WR" : ($data["continentRank"] == 1 ? "AsR" : "NR")'), array('header' => 'Yii::t("common", "Competition")', 'value' => 'CHtml::link(ActiveRecord::getModelAttributeValue($data, "name"), $data["url"])', 'type' => 'raw'));
return self::makeStatisticsData($statistic, $columns, $rows);
}
示例13: die
* @copyright (c)2009-2015 by Francois Planque - {@link http://fplanque.com/}
* Parts of this file are copyright (c)2009 by The Evo Factory - {@link http://www.evofactory.com/}.
*
* @package evocore
*/
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
global $Blog;
// Create query
$SQL = new SQL();
$SQL->SELECT('t.*, IF( tb.itc_ityp_ID > 0, 1, 0 ) AS type_enabled');
$SQL->FROM('T_items__type AS t');
$SQL->FROM_add('LEFT JOIN T_items__type_coll AS tb ON itc_ityp_ID = ityp_ID AND itc_coll_ID = ' . $Blog->ID);
// Create result set:
$Results = new Results($SQL->get(), 'ityp_');
$Results->title = T_('Item/Post/Page types') . get_manual_link('managing-item-types');
// get reserved and default ids
global $default_ids;
$default_ids = ItemType::get_default_ids();
/**
* Callback to build possible actions depending on post type id
*
*/
function get_actions_for_itemtype($id)
{
global $default_ids;
$action = action_icon(T_('Duplicate this Post Type...'), 'copy', regenerate_url('action', 'ityp_ID=' . $id . '&action=new'));
if (!ItemType::is_reserved($id)) {
// Edit all post types except of not reserved post type
$action = action_icon(T_('Edit this Post Type...'), 'edit', regenerate_url('action', 'ityp_ID=' . $id . '&action=edit')) . $action;
示例14: SQL
$group_filtered_SQL = new SQL();
$group_filtered_SQL->SELECT('cgr_ID AS ID, cgr_name AS name, COUNT(cgu_user_ID) AS count_users');
$group_filtered_SQL->FROM('T_messaging__contact_groups');
$group_filtered_SQL->FROM_add('LEFT JOIN T_messaging__contact_groupusers ON cgu_cgr_ID = cgr_ID');
$group_filtered_SQL->WHERE('cgr_ID = ' . $DB->quote($g));
$group_filtered_SQL->WHERE_and('cgr_user_ID = ' . $current_User->ID);
$group_filtered_SQL->GROUP_BY('cgr_ID');
$group_filtered = $DB->get_row($group_filtered_SQL->get());
}
// Create result set:
if ($Settings->get('allow_avatars')) {
$default_order = '--A';
} else {
$default_order = '-A';
}
$Results = new Results($select_SQL->get(), 'mct_', $default_order, NULL, $count_SQL->get());
$Results->title = T_('Contacts list');
if (is_admin_page()) {
// Set an url for manual page:
$Results->title .= get_manual_link('contacts-list');
}
/**
* Callback to add filters on top of the result set
*
* @param Form
*/
function filter_contacts(&$Form)
{
global $item_ID;
$Form->text('s', get_param('s'), 30, T_('Search'), '', 255);
$Form->select_input('g', get_param('g'), 'get_contacts_groups_options', T_('Group'));
示例15: ob_flush
* Created on Jul 4, 2007
*
* Author: Andrew Nelson
* Processes the input from home.html
*/
$action = $_POST["operation"];
if ($action != null && $action != "") {
if ($action == "generate") {
$fileName = $_POST["saveFile"];
$runs = $_POST["runs"];
if ($fileName != null && $fileName != "") {
echo "Generating Your Results. Please be Patient<br />";
ob_flush();
flush();
include "results.php";
$result = new Results();
$result->runTests($runs);
$result->writeXML($fileName);
echo "Your file has been saved to {$fileName}<br />";
echo "<a href = 'home.php'>Run the Tool Again</a><br />";
return;
} else {
echo "You must input a file name!<br />";
}
}
if ($action == "compare") {
$fileOne = $_POST["firstFile"];
$fileTwo = $_POST["secondFile"];
if ($fileOne != null && $fileOne != "" && $fileTwo != null && $fileTwo != "") {
if (!file_exists($fileOne)) {
echo "The first specified file doesn't exist<br/>";