本文整理汇总了PHP中Exercise::selectQuestionList方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::selectQuestionList方法的具体用法?PHP Exercise::selectQuestionList怎么用?PHP Exercise::selectQuestionList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::selectQuestionList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LearnpathList
if (empty($course_code)) {
$course_code = 0;
}
$form->setDefaults(array('course_code' => (string) $course_code));
$course_info = api_get_course_info($course_code);
if (!empty($course_info)) {
$list = new LearnpathList('', $course_code);
$lp_list = $list->get_flat_list();
$_course = $course_info;
$main_question_list = array();
foreach ($lp_list as $lp_id => $lp) {
$exercise_list = ExerciseLib::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
foreach ($exercise_list as $exercise) {
$my_exercise = new Exercise();
$my_exercise->read($exercise['path']);
$question_list = $my_exercise->selectQuestionList();
$exercise_stats = get_all_exercise_event_from_lp($exercise['path'], $course_info['real_id'], $session_id);
foreach ($question_list as $question_id) {
$question_data = Question::read($question_id);
$main_question_list[$question_id] = $question_data;
$quantity_exercises = 0;
$question_result = 0;
foreach ($exercise_stats as $stats) {
if (!empty($stats['question_list'])) {
foreach ($stats['question_list'] as $my_question_stat) {
if ($question_id == $my_question_stat['question_id']) {
$question_result = $question_result + $my_question_stat['marks'];
$quantity_exercises++;
}
}
}
示例2: getNumberOfQuestionsInCategoryForTest
/**
* return the number of question of a category id in a test
* @param int $exerciseId
* @param int $categoryId
*
* @return integer
*
* @author hubert.borderiou 07-04-2011
*/
public static function getNumberOfQuestionsInCategoryForTest($exerciseId, $categoryId)
{
$nbCatResult = 0;
$quiz = new Exercise();
$quiz->read($exerciseId);
$tabQuestionList = $quiz->selectQuestionList();
// the array given by selectQuestionList start at indice 1 and not at indice 0 !!! ? ? ?
for ($i = 1; $i <= count($tabQuestionList); $i++) {
if (TestCategory::getCategoryForQuestion($tabQuestionList[$i]) == $categoryId) {
$nbCatResult++;
}
}
return $nbCatResult;
}
示例3: sizeof
}
if ($temp_CurrentDate < $temp_StartDate || $temp_CurrentDate >= $temp_EndDate) {
$message = $langExerciseExpired;
$error = TRUE;
}
if ($error == TRUE) {
echo "<br/><td class='alert alert-warning'>{$message}</td>";
exit;
}
}
if (isset($_SESSION['questionList'][$exerciseId])) {
$questionList = $_SESSION['questionList'][$exerciseId];
}
if (!isset($_SESSION['questionList'][$exerciseId])) {
// selects the list of question ID
$questionList = $randomQuestions ? $objExercise->selectRandomList() : $objExercise->selectQuestionList();
// saves the question list into the session
$_SESSION['questionList'][$exerciseId] = $questionList;
}
$nbrQuestions = sizeof($questionList);
// if questionNum comes from POST and not from GET
if (!isset($questionNum) || $_POST['questionNum']) {
// only used for sequential exercises (see $exerciseType)
if (!isset($questionNum)) {
$questionNum = 1;
} else {
$questionNum++;
}
}
if (@$_POST['questionNum']) {
$QUERY_STRING = "questionNum={$questionNum}";
示例4: prepareQuiz
/**
* Exports an exercise as a SCO.
* This method is intended to be called from the prepare method.
*
* @note There's a lot of nearly cut-and-paste from exercise.lib.php here
* because of some little differences...
* Perhaps something that could be refactorised ?
*
* @see prepare
* @param $quizId The quiz
* @param $raw_to_pass The needed score to attain
* @return False on error, True if everything went well.
* @author Thanos Kyritsis <atkyritsis@upnet.gr>
* @author Amand Tihon <amand@alrj.org>
*/
function prepareQuiz($quizId, $raw_to_pass = 50) {
global $langQuestion, $langOk, $langScore, $claro_stylesheet, $clarolineRepositorySys;
global $charset, $langExerciseDone;
// those two variables are needed by display_attached_file()
global $attachedFilePathWeb;
global $attachedFilePathSys;
$attachedFilePathWeb = 'Exercises';
$attachedFilePathSys = $this->destDir . '/Exercises';
// Generate standard page header
$pageHeader = '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">
<meta http-equiv="expires" content="Tue, 05 DEC 2000 07:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
<link rel="stylesheet" type="text/css" href="bootstrap-custom.css" />
<link rel="stylesheet" type="text/css" href="' . $claro_stylesheet . '" media="screen, projection, tv" />
<script language="javascript" type="text/javascript" src="APIWrapper.js"></script>
<script language="javascript" type="text/javascript" src="scores.js"></script>
' . "\n";
$pageBody = '<body onload="loadPage()">
<div id="claroBody"><form id="quiz">
<table class="table-default"><tr><td>' . "\n";
// read the exercise
$quiz = new Exercise();
if (!$quiz->read($quizId)) {
$this->error[] = $GLOBALS['langErrorLoadingExercise'];
return false;
}
// Get the question list
$questionList = $quiz->selectQuestionList();
$questionCount = $quiz->selectNbrQuestions();
// Keep track of raw scores (ponderation) for each question
$questionPonderationList = array();
// Keep track of correct texts for fill-in type questions
$fillAnswerList = array();
// Counter used to generate the elements' id. Incremented after every <input> or <select>
$idCounter = 0;
// Display each question
$questionCount = 0;
foreach ($questionList as $questionId) {
// Update question number
$questionCount++;
// read the question, abort on error
$question = new Question();
if (!$question->read($questionId)) {
$this->error[] = $GLOBALS['langErrorLoadingQuestion'];
return false;
}
$qtype = $question->selectType();
$qtitle = $question->selectTitle();
$qdescription = $question->selectDescription();
$questionPonderationList[$questionId] = $question->selectWeighting();
// Generic display, valid for all kind of question
$pageBody .= '<table class="table-default">
<tr><th valign="top" colspan="2">' . $langQuestion . ' ' . $questionCount . '</th></tr>
<tfoot>
<tr><td valign="top" colspan="2">' . $qtitle . '</td></tr>
<tr><td valign="top" colspan="2"><i>' . parse_user_text($qdescription) . '</i></td></tr>' . "\n";
// Attached file, if it exists.
//$attachedFile = $question->selectAttachedFile();
if (!empty($attachedFile)) {
// copy the attached file
if (!claro_copy_file($this->srcDirExercise . '/' . $attachedFile, $this->destDir . '/Exercises')) {
$this->error[] = $GLOBALS['langErrorCopyAttachedFile'] . $attachedFile;
return false;
}
// Ok, if it was an mp3, we need to copy the flash mp3-player too.
$extension = substr(strrchr($attachedFile, '.'), 1);
if ($extension == 'mp3') {
$this->mp3Found = true;
}
//.........这里部分代码省略.........
示例5: Exercise
include 'question.class.php';
$exerciseId = $_GET['exerciseId'];
$objExercise = new Exercise();
$objExercise->read($exerciseId);
$pageName = $langExerciseStats;
$navigation[] = array("url" => "index.php?course={$course_code}", "name" => $langExercices);
$tool_content .= action_bar(array(array('title' => $langBack, 'level' => 'primary-label', 'icon' => 'fa-reply', 'url' => "index.php?course={$course_code}")));
$completedAttempts = Database::get()->querySingle("SELECT count(*) AS count FROM exercise_user_record WHERE eid = ?d AND attempt_status = ?d", $exerciseId, ATTEMPT_COMPLETED)->count;
$pausedAttempts = Database::get()->querySingle("SELECT count(*) AS count FROM exercise_user_record WHERE eid = ?d AND attempt_status = ?d", $exerciseId, ATTEMPT_PAUSED)->count;
$pendingAttempts = Database::get()->querySingle("SELECT count(*) AS count FROM exercise_user_record WHERE eid = ?d AND attempt_status = ?d", $exerciseId, ATTEMPT_PENDING)->count;
$cancelledAttempts = Database::get()->querySingle("SELECT count(*) AS count FROM exercise_user_record WHERE eid = ?d AND attempt_status = ?d", $exerciseId, ATTEMPT_CANCELED)->count;
$total_attempts = $completedAttempts + $pausedAttempts + $pendingAttempts + $cancelledAttempts;
$grade_stats = Database::get()->querySingle("SELECT COUNT(DISTINCT uid) AS unique_users, AVG(TIME_TO_SEC(TIMEDIFF(record_end_date, record_start_date))) AS avg_time, AVG(total_score) AS avg_grade, MIN(total_score) AS min_grade, MAX(total_score) AS max_grade FROM exercise_user_record WHERE eid = ?d AND attempt_status = ?d", $exerciseId, ATTEMPT_COMPLETED);
$max_grade = $grade_stats->max_grade;
$min_grade = $grade_stats->min_grade;
$avg_grade = $grade_stats->avg_grade;
$avg_time = $grade_stats->avg_time;
$unique_users = $grade_stats->unique_users;
//average number of attempts
//avg completion time
$tool_content .= "\n <div class='table-responsive'>\n <table class='table-default'>\n <thead>\n <tr>\n <th colspan='4' class='text-center'>{$langAttempts}</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>{$langAttemptsCompleted}</th>\n <td>{$completedAttempts}</td>\n <td>{$langAttemptsPaused}</th>\n <td>{$pausedAttempts}</td> \n </tr>\n <tr>\n <td>{$langAttemptPending}</th>\n <td>{$pendingAttempts}</td>\n <td>{$langAttemptsCanceled}</th>\n <td>{$cancelledAttempts}</td> \n </tr>\n </tbody>\n <tfoot>\n <tr class='active'>\n <th colspan='3'>{$langTotal}:</th>\n <th colspan='1'>{$total_attempts}</th>\n </tr> \n </tfoot>\n </table>\n </div>\n <div class='table-responsive'>\n <table class='table-default'>\n <thead>\n <tr>\n <th colspan='2' class='text-center'>{$langScore}</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>{$langHighestGrade}</th>\n <td>{$max_grade}</td>\n \n </tr>\n <tr>\n <td>{$langLowestGrade}</th>\n <td>{$min_grade}</td> \n </tr>\n <tr>\n <td>{$langRatingAverage}</th>\n <td>{$avg_grade}</td> \n </tr> \n </tbody>\n </table>\n </div>\n <div class='table-responsive'>\n <table class='table-default'>\n <thead>\n <tr>\n <th colspan='2' class='text-center'>{$langStudents}</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>{$langStudentsExerciseCompleted}</th>\n <td>{$unique_users}</td> \n </tr> \n <tr>\n <td>{$langAverage} {$langExerciseDuration}</th>\n <td>" . format_time_duration($avg_time) . "</td> \n </tr> \n </tbody>\n </table>\n </div>";
//Questions Table
$questionList = $objExercise->selectQuestionList();
$tool_content .= "\n <h3>{$langQuestions}</h3>\n <div class='table-responsive'>\n <table class='table-default'>\n <thead>\n <tr>\n <th>{$langTitle}</th>\n <th>Ποσοστό Επιτυχίας</th>\n </tr>\n </thead>\n <tbody>";
foreach ($questionList as $id) {
$objQuestionTmp = new Question();
$objQuestionTmp->read($id);
$tool_content .= "\n <tr>\n <td>" . $objQuestionTmp->selectTitle() . "</th>\n <td>\n <div class='progress'>\n <div class='progress-bar progress-bar-success progress-bar-striped' role='progressbar' aria-valuenow='" . $objQuestionTmp->successRate($exerciseId) . "' aria-valuemin='0' aria-valuemax='100' style='width: " . $objQuestionTmp->successRate($exerciseId) . "%;'>\n " . $objQuestionTmp->successRate($exerciseId) . "%\n </div>\n </div></td> \n </tr>";
}
$tool_content .= "\n </tbody>\n </table>\n </div>";
draw($tool_content, 2, null, $head_content);