本文整理汇总了PHP中Exercise::setCategoriesGrouping方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::setCategoriesGrouping方法的具体用法?PHP Exercise::setCategoriesGrouping怎么用?PHP Exercise::setCategoriesGrouping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::setCategoriesGrouping方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFocus
}
}
</script>';
// to correct #4029 Random and number of attempt menu empty added window.onload=advanced_parameters;
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#exercise_title").focus();
}
$(document).ready(function () {
setFocus();
});
window.onload = advanced_parameters;
</script>';
// INIT EXERCISE
$objExercise = new Exercise();
$objExercise->setCategoriesGrouping(false);
$course_id = api_get_course_int_id();
//INIT FORM
if (isset($_GET['exerciseId'])) {
$form = new FormValidator('exercise_admin', 'post', api_get_self() . '?' . api_get_cidreq() . '&exerciseId=' . intval($_GET['exerciseId']));
$objExercise->read($_GET['exerciseId']);
$form->addElement('hidden', 'edit', 'true');
} else {
$form = new FormValidator('exercise_admin', 'post', api_get_self() . '?' . api_get_cidreq());
$form->addElement('hidden', 'edit', 'false');
}
$objExercise->createForm($form);
// VALIDATE FORM
if ($form->validate()) {
$objExercise->processCreation($form);
if ($form->getSubmitValue('edit') == 'true') {
示例2: get_action_icon_for_question
function get_action_icon_for_question($in_action, $from_exercice, $in_questionid, $in_questiontype, $in_questionname, $in_selected_course, $in_courseCategoryId, $in_exerciseLevel, $in_answerType, $in_session_id, $in_exercice_id)
{
$res = "";
$getParams = "&selected_course={$in_selected_course}&courseCategoryId={$in_courseCategoryId}&exerciseId={$in_exercice_id}&exerciseLevel={$in_exerciseLevel}&answerType={$in_answerType}&session_id={$in_session_id}";
switch ($in_action) {
case "delete":
$res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . "&delete={$in_questionid}{$getParams}' onclick='return confirm_your_choice()'>";
$res .= Display::return_icon("delete.gif", get_lang('Delete'));
$res .= "</a>";
break;
case "edit":
$res = get_a_tag_for_question(1, $from_exercice, $in_questionid, $in_questiontype, Display::return_icon("edit.gif", get_lang('Modify')));
break;
case "add":
// add if question is not already in test
$myObjEx = new Exercise();
$myObjEx->setCategoriesGrouping(false);
$myObjEx->read($from_exercice);
if (!$myObjEx->isInList($in_questionid)) {
$res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . "&recup={$in_questionid}&fromExercise={$from_exercice}{$getParams}'>";
$res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
$res .= "</a>";
} else {
$res = "-";
}
unset($myObjEx);
break;
case "clone":
$res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . "&copy_question={$in_questionid}&course_id={$in_selected_course}&fromExercise={$from_exercice}{$getParams}'>";
$res .= Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest'));
$res .= "</a>";
break;
default:
$res = $in_action;
break;
}
return $res;
}
示例3: copy_exercise
/**
* Copies an exercise (duplicate all questions and answers)
*/
public function copy_exercise()
{
$original_exercise = $this;
$exercise_obj = new Exercise();
$exercise_obj->setCategoriesGrouping(false);
$exercise_obj->read($this->id);
// force the creation of a new exercise
$exercise_obj->updateTitle($exercise_obj->selectTitle() . ' - ' . get_lang('Copy'));
//Hides the new exercise
$exercise_obj->updateStatus(false);
$exercise_obj->updateId(0);
$exercise_obj->save();
$exercise_obj->save_exercise_list_order($this->course['real_id'], api_get_session_id());
$new_exercise_id = $exercise_obj->selectId();
if ($new_exercise_id) {
$original_exercise->copy_exercise_categories($exercise_obj);
$question_list = $exercise_obj->getQuestionListWithMediasUncompressed();
if (!empty($question_list)) {
//Question creation
foreach ($question_list as $old_question_id) {
$old_question_obj = Question::read($old_question_id);
$new_id = $old_question_obj->duplicate();
if ($new_id) {
$new_question_obj = Question::read($new_id);
if (isset($new_question_obj) && $new_question_obj) {
$new_question_obj->addToList($new_exercise_id);
// This should be moved to the duplicate function
$new_answer_obj = new Answer($old_question_id);
//$new_answer_obj->read();
$new_answer_obj->duplicate($new_id);
}
}
}
}
}
}