Minor cosmetic changes

skala
Julio Montoya 12 years ago
parent f673f76991
commit 938da944da
  1. 5
      main/coursecopy/classes/CourseRecycler.class.php
  2. 26
      main/exercice/exercise_admin.php
  3. 2
      main/exercice/fill_blanks.class.php
  4. 2
      main/exercice/hotspot_admin.inc.php
  5. 6
      main/exercice/multiple_answer.class.php
  6. 4
      main/exercice/multiple_answer_combination.class.php
  7. 8
      main/exercice/question_list_admin.inc.php
  8. 43
      main/exercice/tests_category.php

@ -303,14 +303,15 @@ class CourseRecycler
/**
* Recycle quizzes - doesn't remove the questions and their answers, as they might still be used later
*/
function recycle_quizzes() {
function recycle_quizzes()
{
if ($this->course->has_resources(RESOURCE_QUIZ)) {
$table_qui_que = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$table_qui_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER);
$table_qui = Database :: get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_qui_que_opt = Database :: get_course_table(TABLE_QUIZ_QUESTION_OPTION);
$table_qui_que_cat = Database :: get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
$table_qui_que_cat = Database :: get_course_table(TABLE_QUIZ_CATEGORY);
$table_qui_que_rel_cat = Database :: get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
$ids = array_keys($this->course->resources[RESOURCE_QUIZ]);

@ -43,7 +43,8 @@ $htmlHeadXtra[] = '<script>
success: function(return_value) {
if (return_value == 0 ) {
alert("'.get_lang('CategoryDoesNotExists').'");
//Deleting select option tag
// Deleting select option tag
$("#category_id").find("option").remove();
$(".holder li").each(function () {
@ -68,7 +69,7 @@ $htmlHeadXtra[] = '<script>
addontab: false,
input_min_size: 1,
cache: false,
complete_text:"'.get_lang('StartToType').'",
complete_text: "'.get_lang('StartToType').'",
firstselected: false,
onselect: check,
oncreate: add_item,
@ -196,7 +197,6 @@ window.onload=advanced_parameters;
$objExercise = new Exercise();
$objExercise->setCategoriesGrouping(false);
$course_id = api_get_course_int_id();
//INIT FORM
@ -213,16 +213,16 @@ $objExercise->createForm($form);
// VALIDATE FORM
if ($form->validate()) {
$objExercise->processCreation($form);
if ($form->getSubmitValue('edit') == 'true') {
$message = 'ExerciseEdited';
} else {
$message = 'ExerciseAdded';
}
$exercise_id = $objExercise->id;
Session::erase('objExercise');
header('Location:admin.php?message='.$message.'&exerciseId='.$exercise_id.'&'.api_get_cidreq());
exit;
$objExercise->processCreation($form);
if ($form->getSubmitValue('edit') == 'true') {
$message = 'ExerciseEdited';
} else {
$message = 'ExerciseAdded';
}
$exercise_id = $objExercise->id;
Session::erase('objExercise');
header('Location:admin.php?message='.$message.'&exerciseId='.$exercise_id.'&'.api_get_cidreq());
exit;
} else {
// DISPLAY FORM
if (isset($_SESSION['gradebook'])) {

@ -41,7 +41,7 @@ class FillBlanks extends Question
* function which redifines Question::createAnswersForm
* @param \Formvalidator instance
*/
function createAnswersForm($form)
public function createAnswersForm($form)
{
$defaults = array();
$a_weightings = null;

@ -890,7 +890,7 @@ if ($modifyAnswers) {
$option_lp = '<option value="0" selected="selected" >' . get_lang('SelectTargetLP') . '</option>' . $option_lp;
}
//Feedback SELECT
// Feedback SELECT
$question_list = $objExercise->selectQuestionList();
$option_feed = '';

@ -70,9 +70,9 @@ class MultipleAnswer extends Question {
$defaults = array();
$correct = 0;
if(!empty($this -> id)) {
$answer = new Answer($this -> id);
$answer -> read();
if(count($answer->nbrAnswers)>0 && !$form->isSubmitted()) {
$answer = new Answer($this->id);
$answer->read();
if (count($answer->nbrAnswers)>0 && !$form->isSubmitted()) {
$nb_answers = $answer->nbrAnswers;
}
}

@ -64,8 +64,8 @@ class MultipleAnswerCombination extends Question
$defaults = array();
$correct = 0;
if(!empty($this -> id)) {
$answer = new Answer($this -> id);
$answer -> read();
$answer = new Answer($this->id);
$answer->read();
if(count($answer->nbrAnswers)>0 && !$form->isSubmitted()) {
$nb_answers = $answer->nbrAnswers;
}

@ -123,13 +123,13 @@ if (!$inATest) {
echo "<div style='clear:both'>&nbsp;</div>";
echo '<div id="question_list">';
if ($nbrQuestions) {
//Always getting list from DB
if ($nbrQuestions) {
// Always getting list from DB.
$objExercise->setCategoriesGrouping(false);
$questionList = $objExercise->selectQuestionList(true);
// Style for columns
// Style for columns.
$styleQuestion = "width:50%; float:left;";
$styleType = "width:4%; float:left; padding-top:4px; text-align:center;";
$styleCat = "width:22%; float:left; padding-top:8px; text-align:center;";

@ -309,51 +309,8 @@ function display_categories($type = 'simple') {
false, //load all children, not only direct
$options
);*/
echo $htmlTree;
return true;
$cat = new Testcategory();
$categories = $cat->get_category_tree_by_type($type);
if (!empty($categories)) {
foreach ($categories as $row) {
// Title with number of questions in the category
$category_id = $row['id'];
$tmpobj = new Testcategory($category_id);
$nb_question = $tmpobj->getCategoryQuestionsNumber();
echo '<div class="sectiontitle" id="id_cat'.$category_id.'">';
$nb_question_label = $nb_question == 1 ? $nb_question . ' ' . get_lang('Question') : $nb_question . ' ' . get_lang('Questions');
$global_label = null;
if ($row['c_id'] == 0) {
$global_label = ' '.Display::label(get_lang('Global'), 'info');
}
echo "<span style='float:right'>" . $nb_question_label . "</span>";
$style = 'margin-left:' . $row['depth'] * 20 . 'px; margin-right:10px;';
echo $title = Display::div($row['title'].$global_label, array('style' => $style));
echo '</div>';
echo '<div class="sectioncomment">';
echo $row['description'];
echo '</div>';
echo '<div>';
if ($row['c_id'] == 0 && $type == 'simple') {
echo Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL);
} else {
echo '<a href="'.api_get_self().'?action=editcategory&category_id='.$category_id.'&type='.$type.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
}
if ($nb_question > 0 || ($row['c_id'] == 0 && $type == 'simple')){
echo '<a href="javascript:void(0)" onclick="alert(\'' . protectJSDialogQuote(get_lang('CannotDeleteCategory')) . '\')">';
echo Display::return_icon('delete_na.png', get_lang('CannotDeleteCategory'), array(), ICON_SIZE_SMALL);
echo '</a>';
} else {
$rowname = protectJSDialogQuote($row['title']);
echo ' <a href="'.api_get_self().'?action=deletecategory&amp;category_id='.$category_id.'&type='.$type.'"';
echo 'onclick="return confirmDelete(\''.protectJSDialogQuote(get_lang('DeleteCategoryAreYouSure').'['.$rowname).'] ?\', \'id_cat'.$category_id.'\');">';
echo Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
}
echo '</div>';
}
}
}
// display goback to category list page link

Loading…
Cancel
Save