Minor - format code

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 3ae340930e
commit e8bea58fdf
  1. 3
      main/coursecopy/import_moodle.php
  2. 28
      main/exercise/TestCategory.php
  3. 4
      main/exercise/tests_category.php

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
@ -31,7 +32,7 @@ $this_section = SECTION_COURSES;
// Breadcrumbs
$interbreadcrumb[] = array(
'url' => '../course_info/maintenance.php',
'url' => api_get_path(WEB_CODE_PATH).'course_info/maintenance.php?'.api_get_cidreq(),
'name' => get_lang('Maintenance')
);

@ -26,9 +26,9 @@ class TestCategory
*
* @author - Hubert Borderiou
*/
public function __construct($id = 0, $name = '', $description = "")
public function __construct($id = 0, $name = '', $description = '')
{
if ($id != 0 && $name == "") {
if ($id != 0 && $name == '') {
$obj = new TestCategory();
$obj->getCategory($id);
$this->id = $obj->id;
@ -108,12 +108,12 @@ class TestCategory
return false;
}
}
}
/**
/**
* Removes the category from the database
* if there were question in this category, the link between question and category is removed
*/
*/
public function removeCategory()
{
$table = Database :: get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
@ -233,8 +233,8 @@ class TestCategory
}
}
return $categories;
}
return $categories;
}
/**
* Return the TestCategory id for question with question_id = $questionId
@ -247,7 +247,6 @@ class TestCategory
*/
public static function getCategoryForQuestion($questionId, $courseId = 0)
{
$result = 0;
if (empty($courseId)) {
$courseId = api_get_course_int_id();
}
@ -257,6 +256,7 @@ class TestCategory
FROM $table
WHERE question_id = $questionId AND c_id = $courseId";
$res = Database::query($sql);
$result = 0;
if (Database::num_rows($res) > 0) {
$data = Database::fetch_array($res);
$result = $data['category_id'];
@ -293,12 +293,12 @@ class TestCategory
if (empty($courseId)) {
$courseId = api_get_course_int_id();
}
$catid = TestCategory::getCategoryForQuestion($questionId, $courseId);
$result = ''; // result
$categoryId = TestCategory::getCategoryForQuestion($questionId, $courseId);
$result = '';
$table = Database::get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
$catid = intval($catid);
$categoryId = intval($categoryId);
$sql = "SELECT title FROM $table
WHERE id = $catid AND c_id = $courseId";
WHERE id = $categoryId AND c_id = $courseId";
$res = Database::query($sql);
$data = Database::fetch_array($res);
if (Database::num_rows($res) > 0) {
@ -314,6 +314,8 @@ class TestCategory
* return : array of category id (integer)
* hubert.borderiou 07-04-2011
* @param int $exerciseId
*
* @return array
*/
public static function getListOfCategoriesIDForTest($exerciseId)
{
@ -325,7 +327,6 @@ class TestCategory
$categories = array();
if (!empty($categoriesInExercise)) {
foreach ($categoriesInExercise as $category) {
//$category['id'] = $category['iid'];
$categories[$category['id']] = $category;
}
}
@ -406,6 +407,7 @@ class TestCategory
$cat['title'] = $cat['name'];
$result[$cat['id']] = $cat;
}
return $result;
}

@ -49,7 +49,7 @@ switch ($action) {
$content = edit_category_form('editcategory');
break;
case 'deletecategory':
delete_category_form('deletecategory');
delete_category_form();
break;
case 'export_category':
$archiveFile = 'export_exercise_categoroes_'.api_get_course_id().'_'.api_get_local_time();
@ -174,7 +174,7 @@ function edit_category_form($action)
}
// process to delete a category
function delete_category_form($action)
function delete_category_form()
{
if (isset($_GET['category_id']) && is_numeric($_GET['category_id'])) {
$category = new TestCategory($_GET['category_id']);

Loading…
Cancel
Save