当前位置: 首页>>代码示例>>PHP>>正文


PHP Question::getQuestion方法代码示例

本文整理汇总了PHP中Question::getQuestion方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::getQuestion方法的具体用法?PHP Question::getQuestion怎么用?PHP Question::getQuestion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Question的用法示例。


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

示例1: flush

 /**
  * 
  * @param Question $question
  * @return int id of the Question inserted in base. False if it didn't work.
  */
 public static function flush($question)
 {
     $questionId = $question->getId();
     $questionVar = $question->getQuestion();
     $theme = $question->getTheme()->getIdTheme();
     if ($questionId > 0) {
         $sql = 'UPDATE question SET ' . 'question = ?, ' . 'THEME_id_theme = ? ' . 'WHERE id_question = ?';
         $params = array('sii', &$questionVar, &$theme, &$questionId);
     } else {
         $sql = 'INSERT INTO question (question, THEME_id_theme) VALUES (?, ?)';
         $params = array('si', &$questionVar, &$theme);
     }
     $idInsert = BaseSingleton::insertOrEdit($sql, $params);
     if ($idInsert !== false && $questionId > 0) {
         $idInsert = $questionId;
     }
     return $idInsert;
 }
开发者ID:Eurymone,项目名称:Student-Exam-Report-System,代码行数:23,代码来源:QuestionDAL.php

示例2: adminQuestion

 public static function adminQuestion($id)
 {
     $title = "Question";
     $currentQuestion = Question::getCurrentQuestion();
     $remaining_time = Question::getRemainingTime($currentQuestion);
     $leading = Post::getLeadingBant($currentQuestion);
     $get_question = Question::getQuestion($id);
     return View::make('admin.questions-show')->with(['question' => $currentQuestion, 'remaining_time' => $remaining_time, 'leading' => $leading, 'questions' => $get_question, 'title' => $title]);
 }
开发者ID:anthrotech,项目名称:laravel_sample,代码行数:9,代码来源:ProfileController.php

示例3: random

    $random = new random();
    $wylosowane = null;
    for ($i = 1; $i <= $ile_wylosowac; $i++) {
        do {
            $liczba = $random->getRandom($ile_pytan);
            $losowanie_ok = true;
            $losowanie_ok = $random->checkRandom($liczba, $ile_juz_wylosowano, $wylosowane);
            if ($losowanie_ok == true) {
                $ile_juz_wylosowano++;
                $wylosowane[$ile_juz_wylosowano] = $liczba;
            }
        } while ($losowanie_ok != true);
    }
    echo '<form action="check.php?category=' . $category . '" method="post" role="form">';
    for ($i = 1; $i <= $ile_wylosowac; $i++) {
        $question = $questions->getQuestion($wylosowane[$i], $category);
        echo '<div class=" well well-lg " style="background-color:rgba(16,16,16,0.95);border:15px solid #272727;">' . '<li style="list-style-type:none;text-align:left;font-weight:bold;font-size:19px;color:white;">
    <div style="post-border><p style="font-size:20px;">' . $question['pytanie'] . '</p></div>
    <div class="radio post-border">
      <label><input type="radio" name="' . $i . '" value="A"><b>A</b>.' . $question['A'] . '</label>
    </div>
    <div class="radio post-border">
      <label><input type="radio" name="' . $i . '" value="B"><b>B</b>.' . $question['B'] . '</label>
    </div>
    <div class="radio post-border">
      <label><input type="radio" name="' . $i . '" value="C"><b>C</b>.' . $question['C'] . '</label>
    </div>
    <div class="radio post-border">
      <label><input type="radio" name="' . $i . '" value="D"><b>D</b>.' . $question['D'] . '</label>
    </div>
</li></div>';
开发者ID:CodeEmperor,项目名称:Quiz,代码行数:31,代码来源:index.php

示例4: writePrompt

 /**
  * Outputs the question prompt.
  *
  * @param OutputInterface $output
  * @param Question        $question
  */
 protected function writePrompt(OutputInterface $output, Question $question)
 {
     $message = $question->getQuestion();
     if ($question instanceof ChoiceQuestion) {
         $width = max(array_map('strlen', array_keys($question->getChoices())));
         $messages = (array) $question->getQuestion();
         foreach ($question->getChoices() as $key => $value) {
             $messages[] = sprintf("  [<info>%-{$width}s</info>] %s", $key, $value);
         }
         $output->writeln($messages);
         $message = $question->getPrompt();
     }
     $output->write($message);
 }
开发者ID:regularjack,项目名称:frontend-bundle,代码行数:20,代码来源:QuestionHelper.php

示例5: getData

function getData($limit, $quest)
{
    for ($i = 0; $i < $limit; $i++) {
        $j = $i + 1;
        $qu = new Question();
        $topics = new Topic();
        $qu->setID($quest[$i]['q_id']);
        $qu->loadQuestion();
        $qu_text = $qu->getQuestion();
        echo "<tr>";
        echo "<td class='td'>{$j}</td>";
        echo "<td class='td'>" . $quest[$i]['q_id'] . "</td>";
        echo "<td class='td'>" . stripslashes($qu_text) . "</td>";
        // array Werte ausgeben
        echo "<td class='td'> " . $quest[$i]['count'] . "</td>";
        echo "<td class='td' > " . $quest[$i]['percentagCorrect'] . "%</td>";
        echo "</tr>";
    }
}
开发者ID:eruedin,项目名称:cats,代码行数:19,代码来源:statisticFunctions.php

示例6: Question

 function test_update()
 {
     //Arrange
     $test_field = "What is their name?";
     $test_description = "What you want to call your character.";
     $test_question = new Question($test_field, $test_description);
     $test_question->save();
     $new_quest = "How tall are they?";
     $new_desc = "The height you want your character to be.";
     //Act
     $test_question->update($new_quest, $new_desc);
     //Assert
     $this->assertEquals(["How tall are they?", "The height you want your character to be."], [$test_question->getQuestion(), $test_question->getDescription()]);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:14,代码来源:QuestionTest.php

示例7: getCorrectAnswer

 /**
  * Docimology
  * To get the number of answers with the 'correct' status.
  *
  *
  * @param int      $exerciseId
  * @param Question $sq         questions
  *
  * @return array
  */
 private function getCorrectAnswer($exerciseId, $sq)
 {
     $em = $this->doctrine->getManager();
     $question = $sq->getQuestion();
     $responses = $em->getRepository('UJMExoBundle:Response')->getExerciseInterResponsesWithCount($exerciseId, $question->getId());
     $typeInter = $question->getType();
     $interSer = $this->container->get('ujm.exo_' . $typeInter);
     $interX = $interSer->getInteractionX($question->getId());
     $scoreMax = $interSer->maxScore($interX);
     $responsesTab = $this->responseStatus($responses, $scoreMax);
     return $responsesTab;
 }
开发者ID:claroline,项目名称:distribution,代码行数:22,代码来源:Docimology.php

示例8: newQuestion

 public function newQuestion($id)
 {
     try {
         $report = new Report($id);
         if (!$report->allowQuestion()) {
             throw new fValidationException('Not allowed to ask question.');
         }
         $category = fRequest::get('category', 'integer');
         if ($category == 0) {
             throw new fValidationException('Please choose a category.');
         }
         $question = new Question();
         $question->setUsername(fAuthorization::getUserToken());
         $question->setReportId($report->getId());
         if ($category < 0) {
             $question->setCategory($category);
         } else {
             $question->setCategory(Question::ABOUT_PROBLEM_HIDDEN);
             $problem = new Problem($category);
             $question->setProblemId($problem->getId());
         }
         $question->setAskTime(new fTimestamp());
         $question->setQuestion(trim(fRequest::get('question')));
         if (strlen($question->getQuestion()) < 10) {
             throw new fValidationException('Question too short (minimum 10 bytes).');
         }
         if (strlen($question->getQuestion()) > 500) {
             throw new fValidationException('Question too long (maximum 500 bytes).');
         }
         $question->store();
         fMessaging::create('success', 'Question saved.');
     } catch (fExpectedException $e) {
         fMessaging::create('warning', $e->getMessage());
     } catch (fUnexpectedException $e) {
         fMessaging::create('error', $e->getMessage());
     }
     Util::redirect("/contest/{$id}");
 }
开发者ID:daerduoCarey,项目名称:oj,代码行数:38,代码来源:ReportController.php

示例9: odpowiedz

if ($is_get_ok = isset($_GET['category'])) {
    $category = $_GET['category'];
    for ($i = 1; $i <= $how_much; $i++) {
        echo '<div class=" well well-lg " style="background-color:rgba(16,16,16,0.95);border:15px solid #272727;">';
        //   echo '<li style="list-style-type:none;text-align:center;font-weight:bold;color:white;">';
        if (!($is_ok = isset($_POST["{$i}"]))) {
            $correct_answer = $question->getAnswer($id[$i - 1], $category);
            echo "<p class=\"text-center\" style=\"font-size:20px;color:red;\">W pytaniu {$i} nie udzieliłeś żadnej odpowiedzi!</p>";
        } else {
            if ($is_ok = isset($_POST["{$i}"])) {
                $correct_answer = $question->getAnswer($id[$i - 1], $category);
                if ($correct_answer['answer'] == $_POST["{$i}"]) {
                    echo "<p class=\"text-center\" style=\"font-size:20px;color:green;\">Pytanie {$i} - poprawna odpowiedź! (" . $_POST["{$i}"] . ")</p>";
                    $score++;
                } else {
                    echo "<p class=\"text-center\" style=\"font-size:20px;color:red;\">Pytanie {$i} - błędna odpowiedz (" . $_POST["{$i}"] . ")</p>";
                }
            }
        }
        $complete_question = $question->getQuestion($id[$i - 1], $category);
        echo $twig->render('check.twig', array('question' => $complete_question['pytanie'], 'A' => $complete_question['A'], 'B' => $complete_question['B'], 'C' => $complete_question['C'], 'D' => $complete_question['D'], 'correct_answer' => $correct_answer['answer'], 'iterator' => $i));
    }
    if ($score > 3) {
        echo "<h1 class=\"score\" style=\"\">Uzyskałeś/-aś wynik {$score}/5. Dobrze!</h1>";
    } else {
        echo "<h1 class=\"score2\" style=\"\">Uzyskałeś/-aś wynik {$score}/5. Słabo!</h1>";
    }
} else {
    echo "<h1 style=\"color:grey;text-align: center;\">Wystąpił błąd, nie znaleziono kategorii!</h1>";
}
include 'footer.html';
开发者ID:CodeEmperor,项目名称:Quiz,代码行数:31,代码来源:check.php


注:本文中的Question::getQuestion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。