本文整理汇总了PHP中Exercise::selectNbrQuestions方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::selectNbrQuestions方法的具体用法?PHP Exercise::selectNbrQuestions怎么用?PHP Exercise::selectNbrQuestions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::selectNbrQuestions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToList
/**
* adds an exercise into the exercise list
*
* @author - Olivier Brouckaert
* @param integer $exerciseId - exercise ID
* @param boolean $fromSave - coming from $this->save() or not
*/
public function addToList($exerciseId, $fromSave = false)
{
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$id = $this->id;
// checks if the exercise ID is not in the list
if (!in_array($exerciseId, $this->exerciseList)) {
$this->exerciseList[] = $exerciseId;
$new_exercise = new Exercise();
$new_exercise->read($exerciseId);
$count = $new_exercise->selectNbrQuestions();
$count++;
$sql = "INSERT INTO {$TBL_EXERCICE_QUESTION} (c_id, question_id, exercice_id, question_order) VALUES\n\t\t\t\t ({$this->course['real_id']}, '" . Database::escape_string($id) . "','" . Database::escape_string($exerciseId) . "', '{$count}' )";
Database::query($sql);
// we do not want to reindex if we had just saved adnd indexed the question
if (!$fromSave) {
$this->search_engine_edit($exerciseId, true);
}
}
}
示例2: indexAction
//.........这里部分代码省略.........
$where_condition .= ' AND ( ';
$where_condition .= implode($filters->groupOp, $condition_array);
$where_condition .= ' ) ';
}
}
}
// get index row - i.e. user click to sort $sord = $_GET['sord'];
// get the direction
if (!$sidx) {
$sidx = 1;
}
//2. Selecting the count FIRST
//@todo rework this
switch ($action) {
case 'get_questions':
$categoryId = $request->get('categoryId');
$exerciseId = $request->get('exerciseId');
//$courseId = null; //$request->get('courseId');
$courseId = $request->get('courseId');
// Question manager can view all questions
if (api_is_question_manager()) {
$courseId = null;
}
$count = \Question::getQuestions($app, $categoryId, $exerciseId, $courseId, array('where' => $where_condition, 'extra' => $extra_fields, 'question' => $questionFields), true);
break;
case 'get_user_list_plugin_widescale':
$count = \UserManager::get_user_data(null, null, null, null, true);
break;
case 'get_question_list':
require_once api_get_path(SYS_CODE_PATH) . 'exercice/exercise.class.php';
$exerciseId = $request->get('exerciseId');
$exercise = new \Exercise(api_get_course_int_id());
$exercise->read($exerciseId);
$count = $exercise->selectNbrQuestions();
break;
case 'get_group_reporting':
$course_id = $request->get('course_id');
$group_id = $request->get('gidReq');
$count = \Tracking::get_group_reporting($course_id, $group_id, 'count');
break;
case 'get_user_course_report_resumed':
$count = \CourseManager::get_count_user_list_from_course_code(true, 'ruc');
break;
case 'get_user_course_report':
$count = \CourseManager::get_count_user_list_from_course_code(false);
break;
case 'get_course_exercise_medias':
$course_id = api_get_course_int_id();
$count = \Question::get_count_course_medias($course_id);
break;
case 'get_user_skill_ranking':
$skill = new \Skill();
$count = $skill->get_user_list_skill_ranking_count();
break;
case 'get_work_user_list':
require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php';
$work_id = $request->get('work_id');
//$_REQUEST['work_id'];
$count = get_count_work($work_id);
break;
case 'get_exercise_results':
$exercise_id = $request->get('exerciseId');
//$_REQUEST['exerciseId'];
$filter_by_user = $request->get('filter_by_user');
if (isset($filter_by_user) && !empty($filter_by_user)) {
$filter_user = intval($filter_by_user);
示例3: 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;
}
//.........这里部分代码省略.........
示例4: stripslashes
if (is_string($val)) {
$_POST[$key] = stripslashes($val);
} elseif (is_array($val)) {
foreach ($val as $key2 => $val2) {
$_POST[$key][$key2] = stripslashes($val2);
}
}
$GLOBALS[$key] = $_POST[$key];
}
}
// construction of the Exercise object
$objExercise = new Exercise();
if (isset($_GET['exerciseId'])) {
$exerciseId = intval($_GET['exerciseId']);
$objExercise->read($exerciseId);
$nbrQuestions = $objExercise->selectNbrQuestions();
}
// intializes the Question object
if (isset($_GET['editQuestion']) || isset($_GET['newQuestion']) || isset($_GET['modifyQuestion']) || isset($_GET['modifyAnswers'])) {
// construction of the Question object
$objQuestion = new Question();
// reads question data
if (isset($_GET['editQuestion']) || isset($_GET['modifyQuestion']) || isset($_GET['modifyAnswers'])) {
if (isset($_GET['editQuestion'])) {
$question_id = intval($_GET['editQuestion']);
} elseif (isset($_GET['modifyQuestion'])) {
$question_id = intval($_GET['modifyQuestion']);
} elseif (isset($_GET['modifyAnswers'])) {
$question_id = intval($_GET['modifyAnswers']);
}
// if question not found