本文整理汇总了PHP中Answer::addAnswer方法的典型用法代码示例。如果您正苦于以下问题:PHP Answer::addAnswer方法的具体用法?PHP Answer::addAnswer怎么用?PHP Answer::addAnswer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Answer
的用法示例。
在下文中一共展示了Answer::addAnswer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
$question->setType($_SESSION['values']['question']['qt']);
$question->setTopic($_SESSION['values']['question']['t_id']);
if ($_SESSION['values']['question']['descriptionText'] == '') {
$_SESSION['values']['question']['description'] = 0;
}
if ($_SESSION['values']['question']['description'] == 0 && $_SESSION['values']['question']['descriptionText'] != '') {
$_SESSION['values']['question']['descriptionText'] = '';
}
$check = $question->checkQuestion();
if ($check == 1 && $_SESSION['values']['question']['t_id'] != '') {
$topic->getTopic();
$topicArray = $topic->getTopicArray();
$question->setAllTopics($topicArray);
$question->showQuestionInfos();
$answer->setQuestionType($_SESSION['values']['question']['qt']);
$answer->addAnswer();
$answer->addAnswer();
$answer->setType();
} elseif ($check == 2) {
echo "<meta http-equiv='refresh' content='0; url=index.php?site=collect_question&error=exists' />";
} elseif ($check == 0) {
echo "<meta http-equiv='refresh' content='0; url=index.php?site=collect_question&error=missing' />";
} elseif ($check == 3) {
echo " <meta http-equiv='refresh' content='0; url=index.php?site=collect_question&error=blank' />";
}
break;
case 'setAnswers':
// Antworten setzen
// Wertzuweisung
$id = 0;
if (isset($_REQUEST["questionId"])) {
示例2: LatLong
$game = Game::findGame();
if ($game->type == "geo" || $game->type == "places" || $game->type == "pt") {
$distanceAway = LatLong::findDistance($correct->location, new LatLong($lat, $long));
} else {
$distanceAway = abs($answer - $correct->value);
}
if ($answer > 100000) {
$distanceAway = round($distanceAway, -5);
}
//die ($questionNumber);
$questionNumberSite = $game->round;
//if ($questionNumberSite!=$questionNumber)
if ($questionNumberSite < 0) {
header('Location: waitingScreen.php?message=' . "Submit your answer in time");
}
$place = Answer::addAnswer($_SESSION["user_id"], $questionNumber, $lat, $long, $answer, $distanceAway, $color, $game->type);
//NOW WE FIND THE OVERALL PERCENT PLACE THAT PERCENT DID ON THAT question_id
//Answer::findPercentPlace()
//echo $sql;
//die();
//SOCKET SENDING MESSAGE
if ($place >= 0) {
$entryData = array('category' => "Game" . $_SESSION['game_id'] . $questionNumber, 'title' => stripslashes($_SESSION["name"]), 'miles' => number_format($distanceAway), 'color' => $color);
$context = new ZMQContext();
$socket = $context->getSocket(ZMQ::SOCKET_PUSH, 'my pusher');
$socket->connect("tcp://localhost:5555");
$socket->send(json_encode($entryData));
}
//END SOCKET SENDING
if ($distanceAway > 1000) {
$distanceAway = number_format($distanceAway);
示例3: fillMissingAnswers
public function fillMissingAnswers()
{
global $conn;
$allUsers = array();
$sql = "SELECT * from `users` WHERE `game_id`= '" . $_SESSION['game_id'] . "'";
$result = $conn->query($sql);
//$row = $result->fetch_assoc();
//echo $sql. " rea".$result;
//print_r($this->allAnswers);
while ($row = $result->fetch_assoc()) {
// echo $sql;
$name = $row["name"];
$user_id = $row["user_id"];
$color = $row["color"];
$ans = -999;
if (!array_key_exists($user_id, $this->allAnswers)) {
Answer::addAnswer($user_id, $_SESSION["questionNumber"], -99, -99, $ans, -1, $color, "no");
$this->allAnswers[] = Answer::addUser($_SESSION["questionNumber"], new LatLong(-99, -99), $ans, $user_id, 0, 0, $color);
}
}
}