本文整理汇总了PHP中Question::selectType方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::selectType方法的具体用法?PHP Question::selectType怎么用?PHP Question::selectType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question::selectType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Question
// for each question
foreach ($_SESSION['questionList'][$exerciseId] as $questionId) {
// gets the student choice for this question
$choice = @$_SESSION['exerciseResult'][$exerciseId][$questionId];
// creates a temporary Question object
$objQuestionTmp = new Question();
$objQuestionTmp->read($questionId);
$questionName = $objQuestionTmp->selectTitle();
$questionDescription = $objQuestionTmp->selectDescription();
$questionDescription_temp = nl2br(make_clickable($questionDescription));
$questionDescription_temp = mathfilter($questionDescription_temp, 12, "$webDir/courses/mathimg/");
$questionWeighting = $objQuestionTmp->selectWeighting();
$answerType = $objQuestionTmp->selectType();
// destruction of the Question object
unset($objQuestionTmp);
if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER || $answerType == TRUE_FALSE) {
$colspan = 4;
} elseif ($answerType == MATCHING) {
$colspan = 2;
} else {
$colspan = 1;
}
$iplus = $i + 1;
echo "<br/>
<table class='table-default graded'>
示例2: showQuestion
/**
* Shows a question
* @param Question $objQuestionTmp
* @param bool $only_questions if true only show the questions, no exercise title
* @param bool $origin origin i.e = learnpath
* @param string $current_item current item from the list of questions
* @param bool $show_title
* @param bool $freeze
* @param array $user_choice
* @param bool $show_comment
* @param null $exercise_feedback
* @param bool $show_answers
* @param null $modelType
* @param bool $categoryMinusOne
* @return bool|null|string
*/
public function showQuestion(Question $objQuestionTmp, $only_questions = false, $origin = false, $current_item = '', $show_title = true, $freeze = false, $user_choice = array(), $show_comment = false, $exercise_feedback = null, $show_answers = false, $modelType = null, $categoryMinusOne = true)
{
// Text direction for the current language
//$is_ltr_text_direction = api_get_text_direction() != 'rtl';
// Change false to true in the following line to enable answer hinting
$debug_mark_answer = $show_answers;
//api_is_allowed_to_edit() && false;
// Reads question information
if (!$objQuestionTmp) {
// Question not found
return false;
}
$html = null;
$questionId = $objQuestionTmp->id;
if ($exercise_feedback != EXERCISE_FEEDBACK_TYPE_END) {
$show_comment = false;
}
$answerType = $objQuestionTmp->selectType();
$pictureName = $objQuestionTmp->selectPicture();
$s = null;
$form = new FormValidator('question');
$renderer = $form->defaultRenderer();
$form_template = '{content}';
$renderer->setFormTemplate($form_template);
if ($answerType != HOT_SPOT && $answerType != HOT_SPOT_DELINEATION) {
// Question is not a hotspot
if (!$only_questions) {
$questionDescription = $objQuestionTmp->selectDescription();
if ($show_title) {
$categoryName = TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id, null, true, $categoryMinusOne);
$html .= $categoryName;
$html .= Display::div($current_item . '. ' . $objQuestionTmp->selectTitle(), array('class' => 'question_title'));
if (!empty($questionDescription)) {
$html .= Display::div($questionDescription, array('class' => 'question_description'));
}
} else {
$html .= '<div class="media">';
$html .= '<div class="pull-left">';
$html .= '<div class="media-object">';
$html .= Display::div($current_item, array('class' => 'question_no_title'));
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="media-body">';
if (!empty($questionDescription)) {
$html .= Display::div($questionDescription, array('class' => 'question_description'));
}
$html .= '</div>';
$html .= '</div>';
}
}
if (in_array($answerType, array(FREE_ANSWER, ORAL_EXPRESSION)) && $freeze) {
return null;
}
$html .= '<div class="question_options">';
// construction of the Answer object (also gets all answers details)
$objAnswerTmp = new Answer($questionId, null, $this);
$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
$course_id = api_get_course_int_id();
$quiz_question_options = Question::readQuestionOption($questionId, $course_id);
// For "matching" type here, we need something a little bit special
// because the match between the suggestions and the answers cannot be
// done easily (suggestions and answers are in the same table), so we
// have to go through answers first (elems with "correct" value to 0).
$select_items = array();
//This will contain the number of answers on the left side. We call them
// suggestions here, for the sake of comprehensions, while the ones
// on the right side are called answers
$num_suggestions = 0;
if ($answerType == MATCHING || $answerType == DRAGGABLE) {
if ($answerType == DRAGGABLE) {
$s .= '<div class="ui-widget ui-helper-clearfix">
<ul class="drag_question ui-helper-reset ui-helper-clearfix">';
} else {
$s .= '<div id="drag' . $questionId . '_question" class="drag_question">';
$s .= '<table class="data_table">';
}
$j = 1;
//iterate through answers
$letter = 'A';
//mark letters for each answer
$answer_matching = array();
$capital_letter = array();
//for ($answerId=1; $answerId <= $nbrAnswers; $answerId++) {
foreach ($objAnswerTmp->answer as $answerId => $answer_item) {
//.........这里部分代码省略.........
示例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: update_answer_records
/**
* Update user answers
*/
private function update_answer_records($key, $value)
{
// construction of the Question object
$objQuestionTmp = new Question();
// reads question informations
$objQuestionTmp->read($key);
$question_type = $objQuestionTmp->selectType();
$id = $this->id;
$eurid = $_SESSION['exerciseUserRecordID'][$id];
if ($question_type == FREE_TEXT) {
if (!empty($value)) {
Database::get()->query("UPDATE exercise_answer_record SET answer = ?s, answer_id = 1, weight = NULL,\n is_answered = 1 WHERE eurid = ?d AND question_id = ?d", $value, $eurid, $key);
} else {
Database::get()->query("UPDATE exercise_answer_record SET answer = ?s, \n answer_id = 0, weight = 0, is_answered = 1 WHERE eurid = ?d AND question_id = ?d", $value, $eurid, $key);
}
} elseif ($question_type == FILL_IN_BLANKS) {
$objAnswersTmp = new Answer($key);
$answer_field = $objAnswersTmp->selectAnswer(1);
//splits answer string from weighting string
list($answer, $answerWeighting) = explode('::', $answer_field);
// splits weightings that are joined with a comma
$rightAnswerWeighting = explode(',', $answerWeighting);
//getting all matched strings between [ and ] delimeters
preg_match_all('#\\[(.*?)\\]#', $answer, $match);
foreach ($value as $row_key => $row_choice) {
//if user's choice is right assign rightAnswerWeight else 0
$weight = $row_choice == $match[1][$row_key - 1] ? $rightAnswerWeighting[$row_key - 1] : 0;
Database::get()->query("UPDATE exercise_answer_record SET answer = ?s, weight = ?f, is_answered = 1 \n WHERE eurid = ?d AND question_id = ?d AND answer_id = ?d", $row_choice, $weight, $eurid, $key, $row_key);
}
} elseif ($question_type == MULTIPLE_ANSWER) {
if ($value == 0) {
$row_key = 0;
$answer_weight = 0;
Database::get()->query("UPDATE exercise_answer_record SET is_answered= 1 WHERE eurid = ?d AND question_id = ?d", $eurid, $key);
} else {
$objAnswersTmp = new Answer($key);
$i = 1;
// the first time in the loop we should update in order to keep question position in the DB
// and then insert a new record if there are more than one answers
foreach ($value as $row_key => $row_choice) {
$answer_weight = $objAnswersTmp->selectWeighting($row_key);
if ($i == 1) {
Database::get()->query("UPDATE exercise_answer_record SET answer_id = ?d, weight = ?f , is_answered = 1 WHERE eurid = ?d AND question_id = ?d", $row_key, $answer_weight, $eurid, $key);
} else {
Database::get()->query("INSERT INTO exercise_answer_record (eurid, question_id, answer_id, weight, is_answered)\n VALUES (?d, ?d, ?d, ?f, 1)", $eurid, $key, $row_key, $answer_weight);
}
unset($answer_weight);
$i++;
}
unset($objAnswersTmp);
}
} elseif ($question_type == MATCHING) {
$objAnswersTmp = new Answer($key);
foreach ($value as $row_key => $row_choice) {
// In matching questions isCorrect() returns position of left column answers while $row_key returns right column position
$correct_match = $objAnswersTmp->isCorrect($row_key);
if ($correct_match == $row_choice) {
$answer_weight = $objAnswersTmp->selectWeighting($row_key);
} else {
$answer_weight = 0;
}
Database::get()->query("UPDATE exercise_answer_record SET answer_id = ?d, weight = ?f , is_answered = 1\n WHERE eurid = ?d AND question_id = ?d AND answer = ?d", $row_choice, $answer_weight, $eurid, $key, $row_key);
unset($answer_weight);
}
} else {
if ($value != 0) {
$objAnswersTmp = new Answer($key);
$answer_weight = $objAnswersTmp->selectWeighting($value);
} else {
$answer_weight = 0;
}
Database::get()->query("UPDATE exercise_answer_record SET answer_id = ?d, weight = ?f , is_answered = 1\n WHERE eurid = ?d AND question_id = ?d", $value, $answer_weight, $eurid, $key);
}
unset($objQuestionTmp);
}
示例5: showQuestion
function showQuestion($questionId, $onlyAnswers = false)
{
global $picturePath, $urlServer;
global $langNoAnswer, $langColumnA, $langColumnB, $langMakeCorrespond;
// construction of the Question object
$objQuestionTmp = new Question();
// reads question informations
if (!$objQuestionTmp->read($questionId)) {
// question not found
return false;
}
$answerType = $objQuestionTmp->selectType();
if (!$onlyAnswers) {
$questionName = $objQuestionTmp->selectTitle();
$questionDescription = $objQuestionTmp->selectDescription();
$questionDescription_temp = standard_text_escape($questionDescription);
echo "<tr class='even'>\n <td colspan='2'><b>" . q($questionName) . "</b><br />\n {$questionDescription_temp}\n </td>\n </tr>";
if (file_exists($picturePath . '/quiz-' . $questionId)) {
echo "<tr class='even'>\n <td class='center' colspan='2'><img src='{$urlServer}/{$picturePath}/quiz-{$questionId}' /></td>\n </tr>";
}
}
// end if(!$onlyAnswers)
// construction of the Answer object
$objAnswerTmp = new Answer($questionId);
$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
// only used for the answer type "Matching"
if ($answerType == MATCHING) {
$cpt1 = 'A';
$cpt2 = 1;
$select = array();
echo "\n <tr class='even'>\n <td colspan='2'>\n <table class='tbl_border' width='100%'>\n <tr>\n <th width='200'>{$langColumnA}</th>\n <th width='130'>{$langMakeCorrespond}</th>\n <th width='200'>{$langColumnB}</th>\n </tr>\n </table>\n </td>\n </tr>";
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answer = mathfilter($answer, 12, '../../courses/mathimg/');
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
if ($answerType == FILL_IN_BLANKS) {
// splits text and weightings that are joined with the character '::'
list($answer) = explode('::', $answer);
// replaces [blank] by an input field
$answer = preg_replace('/\\[[^]]+\\]/', '<input type="text" name="choice[' . $questionId . '][]" size="10" />', standard_text_escape($answer));
}
// unique answer
if ($answerType == UNIQUE_ANSWER) {
echo "\n <tr class='even'>\n <td class='center' width='1'>\n <input type='radio' name='choice[{$questionId}]' value='{$answerId}' />\n </td>\n <td>" . standard_text_escape($answer) . "</td>\n </tr>";
} elseif ($answerType == MULTIPLE_ANSWER) {
echo "\n <tr class='even'>\n <td width='1' align='center'>\n <input type='checkbox' name='choice[{$questionId}][{$answerId}]' value='1' />\n </td>\n <td>" . standard_text_escape($answer) . "</td>\n </tr>";
} elseif ($answerType == FILL_IN_BLANKS) {
echo "\n <tr class='even'>\n <td colspan='2'>" . $answer . "</td>\n </tr>";
} elseif ($answerType == MATCHING) {
if (!$answerCorrect) {
// options (A, B, C, ...) that will be put into the list-box
$select[$answerId]['Lettre'] = $cpt1++;
// answers that will be shown at the right side
$select[$answerId]['Reponse'] = standard_text_escape($answer);
} else {
echo "<tr class='even'>\n <td colspan='2'>\n <table class='tbl'>\n <tr>\n <td width='200'><b>{$cpt2}.</b> " . standard_text_escape($answer) . "</td>\n <td width='130'><div align='center'>\n <select name='choice[{$questionId}][{$answerId}]'>\n <option value='0'>--</option>";
// fills the list-box
foreach ($select as $key => $val) {
echo "<option value=\"{$key}\">{$val['Lettre']}</option>";
}
echo "</select></div></td>\n <td width='200'>";
if (isset($select[$cpt2])) {
echo '<b>' . $select[$cpt2]['Lettre'] . '.</b> ' . $select[$cpt2]['Reponse'];
} else {
echo ' ';
}
echo "</td></tr></table></td></tr>";
$cpt2++;
// if the left side of the "matching" has been completely shown
if ($answerId == $nbrAnswers) {
// if it remains answers to shown at the right side
while (isset($select[$cpt2])) {
echo "<tr class='even'>\n <td colspan='2'>\n <table>\n <tr>\n <td width='60%' colspan='2'> </td>\n <td width='40%' align='right' valign='top'>" . "<b>" . $select[$cpt2]['Lettre'] . ".</b> " . $select[$cpt2]['Reponse'] . "</td>\n </tr>\n </table>\n </td>\n </tr>";
$cpt2++;
}
// end while()
}
// end if()
}
} elseif ($answerType == TRUE_FALSE) {
echo "<tr class='even'>\n <td width='1' align='center'>\n <input type='radio' name='choice[{$questionId}]' value='{$answerId}' />\n </td><td>{$answer}</td>\n </tr>";
}
}
// end for()
if (!$nbrAnswers) {
echo "<tr><td colspan='2'><div class='alert alert-danger'>{$langNoAnswer}</div></td></tr>";
}
// destruction of the Answer object
unset($objAnswerTmp);
// destruction of the Question object
unset($objQuestionTmp);
return $nbrAnswers;
}
示例6: Question
$deleteQuestion = $_GET['deleteQuestion'];
// construction of the Question object
$objQuestionTmp = new Question();
// if the question exists
if ($objQuestionTmp->read($deleteQuestion)) {
$objQuestionTmp->delete($exerciseId);
// if the question has been removed from the exercise
if ($objExercise->removeFromList($deleteQuestion)) {
$nbrQuestions--;
}
}
redirect_to_home_page("modules/exercise/admin.php?course={$course_code}&exerciseId={$exerciseId}");
}
$tool_content .= action_bar(array(array('title' => $langNewQu, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&exerciseId={$exerciseId}&newQuestion=yes", 'icon' => 'fa-plus-circle', 'level' => 'primary-label', 'button-class' => 'btn-success'), array('title' => $langSelection . ' ' . $langWithCriteria, 'class' => 'randomSelection', 'url' => "#", 'icon' => 'fa-random', 'level' => 'primary-label'), array('title' => $langSelection . ' ' . $langFrom2 . ' ' . $langQuestionPool, 'url' => "question_pool.php?course={$course_code}&fromExercise={$exerciseId}", 'icon' => 'fa-bank', 'level' => 'primary-label')));
if ($nbrQuestions) {
$questionList = $objExercise->selectQuestionList();
$i = 1;
$tool_content .= "\n <div class='table-responsive'>\n\t <table class='table-default'>\n\t <tr>\n\t <th colspan='2' class='text-left'>{$langQuestionList}</th>\n\t <th class='text-center'>" . icon('fa-gears', $langActions) . "</th>\n\t </tr>";
foreach ($questionList as $id) {
$objQuestionTmp = new Question();
$objQuestionTmp->read($id);
$tool_content .= "<tr>\n\t\t\t<td align='right' width='1'>" . $i . ".</td>\n\t\t\t<td> " . q($objQuestionTmp->selectTitle()) . "<br />\n\t\t\t" . $aType[$objQuestionTmp->selectType() - 1] . "</td>\n\t\t\t<td class='option-btn-cell'>" . action_button(array(array('title' => $langModify, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&exerciseId={$exerciseId}&editQuestion={$id}", 'icon-class' => 'warnLink', 'icon-extra' => $objQuestionTmp->selectNbrExercises() > 1 ? "data-toggle='modal' data-target='#modalWarning' data-remote='false'" : "", 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "?course={$course_code}&exerciseId={$exerciseId}&deleteQuestion={$id}", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmYourChoice, 'show' => !isset($fromExercise)), array('title' => $langUp, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&exerciseId={$exerciseId}&moveUp={$id}", 'level' => 'primary', 'icon' => 'fa-arrow-up', 'disabled' => $i == 1), array('title' => $langDown, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&exerciseId={$exerciseId}&moveDown={$id}", 'level' => 'primary', 'icon' => 'fa-arrow-down', 'disabled' => $i == $nbrQuestions))) . "</td></tr>";
$i++;
unset($objQuestionTmp);
}
$tool_content .= "</table></div>";
}
$tool_content .= "\n<!-- Modal -->\n<div class='modal fade' id='modalWarning' tabindex='-1' role='dialog' aria-labelledby='modalWarningLabel' aria-hidden='true'>\n <div class='modal-dialog'>\n <div class='modal-content'>\n <div class='modal-header'>\n <button type='button' class='close' data-dismiss='modal'><span aria-hidden='true'>×</span><span class='sr-only'>Close</span></button>\n </div>\n <div class='modal-body'>\n {$langUsedInSeveralExercises}\n </div>\n <div class='modal-footer'>\n <a href='#' id='modifyAll' class='btn btn-primary'>{$langModifyInAllExercises}</a>\n <a href='#' id='modifyOne' class='btn btn-success'>{$langModifyInThisExercise}</a>\n </div>\n </div>\n </div>\n</div> \n";
if ($nbrQuestions == 0) {
$tool_content .= "<div class='alert alert-warning'>{$langNoQuestion}</div>";
}
示例7: Exercise
// see checked exercises to add
$resultex = Database::get()->queryArray("SELECT * FROM exercise WHERE course_id = ?d AND active = 1", $course_id);
// for each exercise checked, try to add it to the learning path.
foreach ($resultex as $listex) {
if (isset($_REQUEST['insertExercise']) && isset($_REQUEST['check_' . $listex->id])) {
//add
$insertedExercise = $listex->id;
// check if the exercise is compatible with LP
$incompatible = false;
$objExercise = new Exercise();
$objExercise->read($insertedExercise);
$questionList = $objExercise->selectQuestionList();
foreach ($questionList as $questionId) {
$objQuestion = new Question();
$objQuestion->read($questionId);
if ($objQuestion->selectType() == 6) {
$incompatible = true;
break;
}
}
if ($incompatible) {
$messBox .= "<tr>" . disp_message_box(q($listex->title) . " : " . $langExIncompatibleWithLP . "<br>", "caution") . "</td></tr>";
continue;
}
// check if a module of this course already used the same exercise
$exerciseModuleFrom = "FROM lp_module AS M, lp_asset AS A\n WHERE A.module_id = M.module_id\n AND A.path LIKE ?s\n AND M.contentType = ?s\n AND M.course_id = ?d";
$num = Database::get()->querySingle("SELECT COUNT(*) AS count " . $exerciseModuleFrom, $insertedExercise, CTEXERCISE_, $course_id)->count;
$thisExerciseModule = Database::get()->querySingle("SELECT * " . $exerciseModuleFrom, $insertedExercise, CTEXERCISE_, $course_id);
// determine the default order of this Learning path
$order = 1 + intval(Database::get()->querySingle("SELECT MAX(rank) AS max\n FROM lp_rel_learnPath_module\n WHERE learnPath_id = ?d", $_SESSION['path_id'])->max);
$exercise = Database::get()->querySingle("SELECT * FROM exercise WHERE course_id = ?d AND id = ?d", $course_id, $insertedExercise);
示例8: foreach
$tool_content .= "
<div class='table-responsive'>
<table class='table-default'>
<tr>
<th colspan='2' class='text-left'>$langQuestionList</th>
<th class='text-center'>".icon('fa-gears', $langActions)."</th>
</tr>";
foreach ($questionList as $id) {
$objQuestionTmp = new Question();
$objQuestionTmp->read($id);
$tool_content .= "<tr>
<td align='right' width='1'>" . $i . ".</td>
<td> " . q_math($objQuestionTmp->selectTitle()) . "<br />
" . $aType[$objQuestionTmp->selectType() - 1] . "</td>
<td class='option-btn-cell'>".
action_button(array(
array('title' => $langEditChange,
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&exerciseId=$exerciseId&editQuestion=$id",
'icon-class' => 'warnLink',
'icon-extra' => $objQuestionTmp->selectNbrExercises()>1? "data-toggle='modal' data-target='#modalWarning' data-remote='false'" : "",
'icon' => 'fa-edit'),
array('title' => $langUp,
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&exerciseId=$exerciseId&moveUp=$id",
'level' => 'primary',
'icon' => 'fa-arrow-up',
'disabled' => $i == 1
),
array('title' => $langDown,
'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&exerciseId=$exerciseId&moveDown=$id",