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


PHP Quiz::getTitle方法代码示例

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


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

示例1: Question

}
// get mode from the post - popup we don't show menus - otherwise we do
// also show offline header / footer for popup - but normal for basic
// The type can be either on post or get
if (isset($_POST['type']) && $_POST['type'] == 'popup' || isset($_GET['type']) && $_GET['type'] == 'popup') {
    $mode = 'popup';
    $template_mode = 'offline';
} else {
    $template_mode = 'normal';
}
// Pull in templates
$templates->includeTemplate('header', $template_mode);
$quiz_info = $quiz_session->getSessionInfo();
// print titles
// could get quizname from $quiz_session, but we've already got it from before into quiz_info array
print "<h1>" . $this_quiz->getTitle() . "</h1>\n";
print "<h1>Answers " . $quiz_session->getOfflineId() . "</h1>\n";
print "<p>Please ensure that the serial number above matches the question sheet.</p>\n";
// load and print the questions
for ($i = 0; $i < count($questions_array); $i++) {
    // load this question - note -1 used to select array position (ie. question 1 = array 0)
    $question = new Question($qdb->getQuestion($questions_array[$i]));
    print "<h2>Question " . ($i + 1) . "</h2>\n";
    if ($show_question) {
        print $question->getOfflineHtmlString();
    }
    print "<p class=\"" . CSS_CLASS_ANSWER_REASON . "\">\n";
    print $question->getReason();
    print "</p>\n";
}
// add navigation buttons - if we are not in popup mode (move to answers)
开发者ID:avirtualmedia,项目名称:wquiz,代码行数:31,代码来源:offlineanswer.php

示例2: CreateAQuiz

 public function CreateAQuiz($data)
 {
     // denna skapar quizen
     $title = "";
     // sätter titeln till tom
     $description = "no description";
     if (isset($data["title"]) && trim($data["title"]) != "") {
         $title = $data["title"];
     }
     if (isset($data["description"]) && trim($data["description"]) != "") {
         $description = $data["description"];
     }
     $quiz = new Quiz($title, $description);
     if ($data["questions"] == null || $title == "") {
         throw new Exception("No questions in quiz");
     }
     if (strip_tags($title) != $title || strip_tags($description) != $description) {
         throw new Exception("No tags in my quiz");
     }
     $questioncount = 0;
     foreach ($data["questions"] as $q) {
         if (strip_tags($q["title"]) != $q["title"]) {
             throw new Exception("No tags in questions in my quiz");
         }
         if (!isset($q["options"])) {
             continue;
         }
         $options = array();
         $correcModifier = 0;
         $currentOption = 1;
         foreach ($q["options"] as $o) {
             if (trim($o) == "") {
                 if ($q["correct"] > $currentOption) {
                     // om den optionen man är på är mindre än den option som är rätt så plussar den på correct svaret
                     $correcModifier++;
                 }
                 $currentOption++;
                 //och plussar på den man är på så man kan kolla nästa
                 continue;
             }
             if (strip_tags($o) != $o) {
                 throw new Exception("No tags in option in my quiz");
             }
             $currentOption++;
             array_push($options, $o);
             //lägger in allt i arrayen
         }
         if (count($options) == 0) {
             continue;
         }
         $correct = min($q["correct"] - 1 - $correcModifier, count($options) - 1);
         //denna modifiererar den tar det lägsta i options och sätter om det rätta till den nya anpassade listan (Fick hjälp med denna!)
         $questioncount++;
         $quiz->addQuestion(new QuizQuestion($q["title"], $options, $correct));
     }
     if ($questioncount == 0) {
         throw new Exception("No questions in quiz");
     }
     $count = "";
     while (file_exists("Model/quizes/" . $quiz->getTitle() . $count . ".bin")) {
         if ($count == "") {
             $count = 1;
         } else {
             $count++;
         }
     }
     $this->quizDAL->writeToBin("Model/quizes/" . $quiz->getTitle() . $count . ".bin", $quiz);
 }
开发者ID:KevinUd2014,项目名称:Php_newProject,代码行数:68,代码来源:CreateQuizModel.php


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