Minor - format code

skala
Julio Montoya 12 years ago
parent 4aefb77f8c
commit 1c8d7c9707
  1. 9
      main/exercice/question.class.php
  2. 8
      main/exercice/testcategory.class.php

@ -2700,6 +2700,7 @@ abstract class Question
}
return $result;
}
/**
* Makes a question valid inside a global category in another course as well
* This might be used in combination with the ExerciseController::reuseQuestionAction()
@ -2710,9 +2711,9 @@ abstract class Question
*
* This might get deprecated if we start using c_id = 0 in the c_quiz_question_rel_category
*/
function enableGlobalCategoryInNewCourse($questionId, $courseIdDest) {
function enableGlobalCategoryInNewCourse($questionId, $courseIdDest)
{
$questionRelCategoryTable = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
$categoryTable = Database::get_course_table(TABLE_QUIZ_CATEGORY);
$questionId = intval($questionId);
$courseIdDest = intval($courseIdDest);
// First check whether the category is global: if it's not, we don't need to do anything
@ -2732,10 +2733,10 @@ abstract class Question
}
}
}
$diff = array_diff($origCats,$destCats);
$diff = array_diff($origCats, $destCats);
foreach ($diff as $cat) {
$sql = "INSERT INTO $questionRelCategoryTable (c_id, question_id, category_id) VALUES ($courseIdDest, $questionId, $cat)";
Database::query($sql);
}
}
}
}

@ -1251,7 +1251,7 @@ class Testcategory
break;
}
// settting the form elements
// setting the form elements
$form->addElement('header', $header);
$form->addElement('hidden', 'category_id');
$form->addElement('text', 'category_name', get_lang('CategoryName'), array('class' => 'span6'));
@ -1288,13 +1288,15 @@ class Testcategory
// setting the rules
$form->addRule('category_name', get_lang('ThisFieldIsRequired'), 'required');
}
/**
* Checks whether a category is global or not
* @param Category ID
* @param int $categoryId
* @return bool True if it is global, false otherwise
* @assert (0) == false
*/
function isGlobal($categoryId) {
function isGlobal($categoryId)
{
$categoryTable = Database::get_course_table(TABLE_QUIZ_CATEGORY);
$sql = "SELECT parent_id, c_id FROM $categoryTable WHERE iid = $categoryId";
$res = Database::query($sql);

Loading…
Cancel
Save