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


PHP Question::load方法代码示例

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


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

示例1: DialogBox

}
$dialogBox = new DialogBox();
/*
 * Execute commands
 */
// use question in exercise
if ($cmd == 'rqUse' && !is_null($quId) && !is_null($exId)) {
    if ($exercise->addQuestion($quId)) {
        // TODO show confirmation and back link
        header('Location: ' . Url::Contextualize('edit_exercise.php?exId=' . $exId));
    }
}
// delete question
if ($cmd == 'delQu' && !is_null($quId)) {
    $question = new Question();
    if ($question->load($quId)) {
        if (!$question->delete()) {
            // TODO show confirmation and list
        }
    }
}
// export question
if ($cmd == 'exExport' && get_conf('enableExerciseExportQTI')) {
    require_once '../export/qti2/qti2_export.php';
    require_once get_path('incRepositorySys') . '/lib/fileManage.lib.php';
    require_once get_path('incRepositorySys') . '/lib/file.lib.php';
    require_once get_path('incRepositorySys') . '/lib/thirdparty/pclzip/pclzip.lib.php';
    $question = new Qti2Question();
    $question->load($quId);
    // contruction of XML flow
    $xml = $question->export();
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:question_pool.php

示例2: Question

}
if (isset($_REQUEST['exId']) && is_numeric($_REQUEST['exId'])) {
    $exId = (int) $_REQUEST['exId'];
} else {
    $exId = null;
}
if (isset($_REQUEST['quId']) && is_numeric($_REQUEST['quId'])) {
    $quId = (int) $_REQUEST['quId'];
} else {
    $quId = null;
}
/*
 * Init other vars
 */
$question = new Question();
if (is_null($quId) || !$question->load($quId)) {
    header('Location: ' . Url::Contextualize('../exercise.php'));
    exit;
}
if (!is_null($exId)) {
    $exercise = new Exercise();
    // if exercise cannot be load set exId to null , it probably don't exist
    if (!$exercise->load($exId)) {
        $exId = null;
    }
}
$askDuplicate = false;
// do not duplicate when there is no $exId, it means that we modify the question from pool
// do not duplicate when there is no $quId, it means that question is a new one
// check that question is used in several exercises
if (count_exercise_using_question($quId) > 1 && !is_null($quId) && !is_null($exId)) {
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:edit_answers.php

示例3: 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

示例4: unset

        }
        unset($questionObj);
    }
} elseif (isset($loadRandomQuestionsList) && is_array($loadRandomQuestionsList)) {
    $questionList = array();
    if (isset($loadRandomQuestionsList['questions']) && is_array($loadRandomQuestionsList['questions'])) {
        $questions = $loadRandomQuestionsList['questions'];
    } elseif (is_array($loadRandomQuestionsList)) {
        $questions = $loadRandomQuestionsList;
    } else {
        $questions = array();
    }
    foreach ($questions as $question) {
        $questionObj = new Question();
        $questionObj->setExerciseId($exId);
        if ($questionObj->load($question['id'])) {
            $_SESSION['serializedQuestionList'][] = serialize($questionObj);
            $questionList[] = $questionObj;
        }
    }
} else {
    $questionList = array();
    foreach ($_SESSION['serializedQuestionList'] as $serializedQuestion) {
        $questionList[] = unserialize($serializedQuestion);
    }
}
$questionCount = count($questionList);
$now = time();
if (!isset($_SESSION['exeStartTime'])) {
    if ($startExercise) {
        $_SESSION['exeStartTime'] = $now;
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:exercise_submit.php

示例5: Question

}
if (isset($_REQUEST['exId']) && is_numeric($_REQUEST['exId'])) {
    $exId = (int) $_REQUEST['exId'];
} else {
    $exId = null;
}
if (isset($_REQUEST['quId']) && is_numeric($_REQUEST['quId'])) {
    $quId = (int) $_REQUEST['quId'];
} else {
    $quId = null;
}
/*
 * Init other vars
 */
$question = new Question();
if (!is_null($quId) && !$question->load($quId)) {
    // question cannot be load, display new question creation form
    $cmd = 'rqEdit';
    $quId = null;
}
if (!is_null($exId)) {
    $exercise = new Exercise();
    // if exercise cannot be load set exId to null , it probably don't exist
    if (!$exercise->load($exId)) {
        $exId = null;
    }
}
$askDuplicate = false;
// quId and exId have been specified and load operations worked
if (!is_null($quId) && !is_null($exId)) {
    // do not duplicate when there is no $exId,
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:edit_question.php

示例6: array

$titleTab['mainTitle'] = $nameTools;
// Command list
$cmdList = array();
$cmdList[] = array('img' => 'back', 'name' => get_lang('Back'), 'url' => claro_htmlspecialchars(Url::Contextualize('./track_exercises.php?exId=' . $exId . $src)));
$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']) {
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:track_questions.php


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