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


PHP Question::getType方法代码示例

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


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

示例1: stripslashes

                $answer = -1;
            }
        } else {
            if (!isset($_POST['answer']) || $_POST['answer'] == '') {
                $answer = -1;
            } else {
                if ($question_from->validateAnswer($_POST['answer'])) {
                    $answer = $_POST['answer'];
                    // remove magic quotes if applied - so that the regular expression matching works correctly
                    if (get_magic_quotes_gpc()) {
                        $answer = stripslashes($answer);
                    }
                } else {
                    // set message as this may have been a genuine error (eg. seven instead of 7)
                    $err = Errors::getInstance();
                    $err->errorEvent(INFO_PARAMETER, "Answer provided is not a valid response for " . $question_from->getType());
                    $message = 'Answer provided is not a valid response';
                    $action = 'display';
                }
            }
        }
    }
}
// check that we haven't changed back to display due to invalid entry before we save
if ($action != 'display') {
    $all_answers = $quiz_session->getAnswers();
    // check for exact match (checkbox 01 == 1 which is wrong)
    if ($all_answers[$question_num - 1] !== $answer) {
        $all_answers[$question_num - 1] = $answer;
        $quiz_session->setAnswers($all_answers);
    }
开发者ID:avirtualmedia,项目名称:wquiz,代码行数:31,代码来源:question.php

示例2: foreach

        <h4>
            <?php 
echo $survey->getTitle();
?>
        </h4>
    </div>
    <?php 
$survey_questions = get_survey_questions($survey->getId());
if (!empty($survey_questions)) {
    ?>
        <div class="accordion">
            <?php 
    foreach ($survey_questions as $question_id) {
        $question = new Question();
        $question->get_from_db($question_id);
        if ($question->getType() == 1) {
            ?>
                </div>
                <h3 class="no-float ac"><?php 
            print_r($question->getTitle());
            ?>
</h3>
                <div class="al">
                    <?php 
            $answers = get_survey_answers($question->getId());
            foreach ($answers as $answer_id) {
                $answer = new Answer();
                $answer->get_from_db($answer_id);
                ?>
                        <p>&emsp;&emsp;&emsp;<?php 
                print_r($answer->getValue());
开发者ID:tttodorov13,项目名称:suSurvey,代码行数:31,代码来源:survey.php

示例3: htmlspecialchars

     //Aktivieren einer Frage
     $question->setID($q_id);
     $question->setActive();
     echo " <meta http-equiv='refresh' content='0; url=?{$site}'>";
     break;
 case 'showDetails':
     // Anzeigen der Fragedetails
     if ($q_id != 0) {
         $_SESSION['values']['question']['q_id'] = $q_id;
     }
     if ($error == 'conflict') {
         echo "<h5>" . Topic_01 . " <br /></h5>";
     }
     $question->setID($_SESSION['values']['question']['q_id']);
     $question->loadQuestion();
     $type = $question->getType();
     $topics->getTopic();
     $topicArray = $topics->getTopicArray();
     $question->setAllTopics($topicArray);
     $question->showQuestionDetails();
     $answer->setQuestionID($_SESSION['values']['question']['q_id']);
     $answer->setAnswerType($_SESSION['values']['question']['qt']);
     $answer->getAnswers();
     $answer->showAnswers();
     break;
 case 'updateQuestion':
     // Question updaten
     // Wertzuweisung
     $questionText = "";
     if (isset($_REQUEST["question"])) {
         $questionText = htmlspecialchars($_REQUEST["question"]);
开发者ID:eruedin,项目名称:cats,代码行数:31,代码来源:topic.php

示例4: export_question_tracking

/**
 * @return string csv data or empty string
 */
function export_question_tracking($quId, $exId = '')
{
    $question = new Question();
    if (!$question->load($quId)) {
        return "";
    }
    switch ($question->getType()) {
        case 'TF':
            $csvTrack = new CsvTrackTrueFalse($question, $exId);
            break;
        case 'MCUA':
        case 'MCMA':
            $csvTrack = new CsvTrackMultipleChoice($question, $exId);
            break;
        case 'FIB':
            $csvTrack = new CsvTrackFIB($question, $exId);
            break;
        case 'MATCHING':
            $csvTrack = new CsvTrackMatching($question, $exId);
            break;
        default:
            break;
    }
    if (isset($csvTrack)) {
        $csvTrack->buildRecords();
        return $csvTrack->export();
    } else {
        return "";
    }
}
开发者ID:rhertzog,项目名称:lcs,代码行数:33,代码来源:export_tracking.class.php

示例5: Question

\t<th>Created</th>
\t<th>Reviewed</th>
\t<th></th>
</tr>
EOT;
/** Display questions - could use a table formatter function, but for now coded in this file **/
/* This is very inefficient and results in very slow load times - need to reduce the number of sql queries */
foreach ($questions_array as $this_question_entry) {
    print "<tr>\n";
    //print "<td>$this_question_entry</td>";
    $this_question = new Question($qdb->getQuestion($this_question_entry));
    // Allow either q number or summary to be clicked (as summary may be null - eg. picture quiz)
    print "<td><a href=\"" . ADMIN_EDIT_FILE . "?question=" . $this_question->getQuestionID() . "\">{$this_question_entry}</a></td>";
    // Note hard coded length of summary (this file to be discontinued)
    print "<td><a href=\"" . ADMIN_EDIT_FILE . "?question=" . $this_question->getQuestionID() . "\">" . $this_question->getSummary(45) . "</a></td>";
    print "<td>" . $this_question->getType() . "</td>";
    print "<td>" . $this_question->getQuizzes() . "</td>";
    print "<td>" . $this_question->getCreated() . "</td>";
    print "<td>" . $this_question->getReviewed() . "</td>\n";
    print "<td><a href=\"" . ADMIN_Q_FILE . "?question=" . $this_question->getQuestionID() . "\">Test</a></td>\n";
    print "</tr>\n";
}
print "</table>\n";
if (isset($debug) && $debug) {
    $end_time = time();
    $total_time = $end_time - $start_time;
    print "Start time: {$start_time} \n";
    print "End time: {$end_time} \n";
    print "Time taken: {$total_time} secs\n";
}
// footer template
开发者ID:avirtualmedia,项目名称:wquiz,代码行数:31,代码来源:adminlist-old.php

示例6: update

 public function update($id, Question $question)
 {
     $this->_access->update(StudyPressDB::getTableNameQuestions(), array(StudyPressDB::COL_CONTENT_QUESTION => $question->getContent(), StudyPressDB::COL_ID_QUIZ_QUESTION => $question->getQuizId(), StudyPressDB::COL_TYPE_QUESTION => $question->getType(), StudyPressDB::COL_ORDER_QUESTION => $question->getOrder()), array(StudyPressDB::COL_ID_QUESTION => $id));
 }
开发者ID:Cossumo,项目名称:studypress,代码行数:4,代码来源:QuestionManager.class.php

示例7: foreach

$out .= claro_html_tool_title($titleTab, null, $cmdList);
// build back link
$backLink = "\n\n" . '<a class="backLink" href="' . claro_htmlspecialchars(Url::Contextualize('./track_exercises.php?exId=' . $exId . $src)) . '">' . get_lang('Back') . '</a>' . "\n\n";
if ($is_allowedToTrack && get_conf('is_trackingEnabled')) {
    $out .= "\n" . '<table width="100%" border="0" cellpadding="1" cellspacing="0" class="claroTable">' . "\n";
    if (count($questionIdsToShow) > 1) {
        $questionIterator = 1;
    }
    foreach ($questionIdsToShow as $questionId) {
        // get infos about the question
        $question = new Question();
        if (!$question->load($questionId)) {
            break;
        }
        // prepare list to display
        if ($question->getType() == 'MCUA' || $question->getType() == 'MCMA') {
            // get the list of all possible answer and the number of times it was choose
            $sql = "SELECT `TEA`.`answer`, COUNT(`TEA`.`answer`) as `nbr`\n                        FROM `" . $tbl_qwz_tracking . "` AS `TE`\n                    LEFT JOIN `" . $tbl_qwz_tracking_questions . "` AS `TED`\n                        ON `TED`.`exercise_track_id` = `TE`.`id`\n                    LEFT JOIN `" . $tbl_qwz_tracking_answers . "` AS `TEA`\n                        ON `TEA`.`details_id` = `TED`.`id`\n                    WHERE `TED`.`question_id` = " . (int) $questionId . "\n                        AND `TE`.`exo_id` = " . (int) $exId . "\n                    GROUP BY `TEA`.`answer`";
            $trackedAnswers = claro_sql_query_fetch_all($sql);
            // we need to know the total number of answer given
            $multipleChoiceTotal = 0;
            $i = 0;
            foreach ($question->answer->answerList as $answer) {
                $results[$i] = $answer;
                $results[$i]['nbr'] = 0;
                foreach ($trackedAnswers as $trackedAnswer) {
                    if ($results[$i]['answer'] == $trackedAnswer['answer']) {
                        $results[$i]['nbr'] = $trackedAnswer['nbr'];
                        $multipleChoiceTotal += $trackedAnswer['nbr'];
                        break;
                    }
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:track_questions.php

示例8:

}
// Intro
if ($questionid > 0) {
    $value = $question->getIntro();
} else {
    $value = "";
}
print "Intro:<br />\n";
print "<textarea name=\"intro\" cols=\"60\" rows=\"20\">";
print $value;
print "</textarea><br />\n";
// Type
print "Question Type:";
print "<select name=\"type\" id=\"type\">\n";
foreach ($question_types as $qtype_key => $qtype_value) {
    if ($questionid > 0 && $question->getType() == $qtype_key) {
        print " <option value=\"{$qtype_key}\" selected=\"selected\">{$qtype_value}</option>\n";
    } else {
        print " <option value=\"{$qtype_key}\">{$qtype_value}</option>\n";
    }
}
print "</select><br />\n";
// Input
if ($questionid > 0) {
    $value = $question->getInput();
} else {
    $value = "";
}
print "Input : <br />\n";
print "<textarea name=\"input\" cols=\"60\" rows=\"5\">";
print $value;
开发者ID:avirtualmedia,项目名称:wquiz,代码行数:31,代码来源:edit.php

示例9: foreach

 $exercise->load($exId);
 if ($exercise->getShuffle() && isset($_REQUEST['shuffle']) && $_REQUEST['shuffle'] == 1) {
     $questionList = $exercise->getRandomQuestionList();
 } else {
     $questionList = $exercise->getQuestionList();
 }
 foreach ($questionList as $_id => $question) {
     $questionObj = new Question();
     $questionObj->setExerciseId($exId);
     if ($questionObj->load($question['id'])) {
         $questionList[$_id]['description'] = $questionObj->getDescription();
         $questionList[$_id]['attachment'] = $questionObj->getAttachment();
         if (!empty($questionList[$_id]['attachment'])) {
             $questionList[$_id]['attachmentURL'] = get_conf('rootWeb') . 'courses/' . claro_get_current_course_id() . '/exercise/question_' . $questionObj->getId() . '/' . $questionObj->getAttachment();
         }
         switch ($questionObj->getType()) {
             case 'MCUA':
             case 'MCMA':
                 $questionList[$_id]['answers'] = $questionObj->answer->answerList;
                 break;
             case 'TF':
                 $questionList[$_id]['answers'][0]['answer'] = get_lang('True');
                 $questionList[$_id]['answers'][0]['feedback'] = $questionObj->answer->trueFeedback;
                 $questionList[$_id]['answers'][1]['answer'] = get_lang('False');
                 $questionList[$_id]['answers'][1]['feedback'] = $questionObj->answer->falseFeedback;
                 break;
             case 'FIB':
                 $questionList[$_id]['answerText'] = $questionObj->answer->answerDecode($questionObj->answer->answerText);
                 $questionList[$_id]['answerList'] = $questionObj->answer->answerList;
                 foreach ($questionList[$_id]['answerList'] as $i => $answer) {
                     $questionList[$_id]['answerList'][$i] = $questionObj->answer->answerDecode($questionObj->answer->addslashesEncodedBrackets($answer));
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:exercise.php


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