Browse Source

Fix show the course category when edit the course - refs BT#9885 #TMI

Angel Fernando Quiroz Campos 9 years ago
parent
commit
ef4d956643
1 changed files with 14 additions and 4 deletions
  1. 14 4
      main/admin/course_edit.php

+ 14 - 4
main/admin/course_edit.php

@@ -162,12 +162,22 @@ if (!empty($coursesInSession)) {
 // Category code
 $url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_category';
 $categoryList = array();
-if (!empty($course['category_code'])) {
-    $data = getCategory($course['category_code']);
-    $categoryList[] = array('id' => $data['code'], 'text' => $data['name']);
+
+if (!empty($courseInfo['categoryCode'])) {
+    $data = getCategory($courseInfo['categoryCode']);
+    $categoryList[$data['code']] = $data['name'];
 }
 
-$form->addElement('select_ajax', 'category_code', get_lang('CourseFaculty'), null, array('url' => $url, 'defaults' => $categoryList));
+$form->addElement(
+    'select_ajax',
+    'category_code',
+    get_lang('CourseFaculty'),
+    null,
+    array(
+        'url' => $url,
+        'defaults' => $categoryList
+    )
+);
 
 $form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
 $form->applyFilter('department_name', 'html_filter');