diff --git a/main/admin/course_edit.php b/main/admin/course_edit.php
index 8c62e09174..51a96cbb1e 100644
--- a/main/admin/course_edit.php
+++ b/main/admin/course_edit.php
@@ -92,8 +92,13 @@ $form->addElement('hidden','code',$course_code);
$form->add_textfield('title', get_lang('Title'), true, array ('class' => 'span6'));
$form->applyFilter('title','html_filter');
$form->applyFilter('title','trim');
-// code
-$form->add_textfield('visual_code', array(get_lang('CourseCode'), get_lang('OnlyLettersAndNumbers')), true, array('class' => 'span4'));
+
+// Code
+$element = $form->addElement('text', 'real_code', array(get_lang('CourseCode'), get_lang('ThisValueCantBeChanged')));
+$element->freeze();
+
+// visual code
+$form->add_textfield('visual_code', array(get_lang('VisualCode'), get_lang('OnlyLettersAndNumbers'), get_lang('ThisValueIsUsedInTheCourseURL')), true, array('class' => 'span4'));
$form->applyFilter('visual_code','strtoupper');
$form->applyFilter('visual_code','html_filter');
@@ -154,7 +159,6 @@ $group[]= $form->createElement('radio', 'visibility', null, get_lang('Private'),
$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
$form->addGroup($group,'', get_lang('CourseAccess'), '
');
-
$group = array();
$group[]= $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
$group[]= $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
@@ -190,6 +194,8 @@ $form->addElement('style_submit_button', 'button', get_lang('ModifyCourseInfo'),
$course['disk_quota'] = round(DocumentManager::get_course_quota($course_code) /1024/1024, 1);
$course['title'] = api_html_entity_decode($course['title'], ENT_QUOTES, $charset);
+$course['real_code'] = $course['code'];
+
$form->setDefaults($course);
// Validate form
diff --git a/main/admin/course_list.php b/main/admin/course_list.php
index 1667d8e143..a8b68b352f 100644
--- a/main/admin/course_list.php
+++ b/main/admin/course_list.php
@@ -61,10 +61,19 @@ function get_number_of_courses() {
* Get course data to display
*/
function get_course_data($from, $number_of_items, $column, $direction) {
- $course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
+ $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
- $sql = "SELECT code AS col0, title AS col1, visual_code AS col2, course_language AS col3, category_code AS col4, subscribe AS col5, unsubscribe AS col6,
- code AS col7, visibility AS col8, directory as col9
+ $sql = "SELECT code AS col0,
+ title AS col1,
+ code AS col2,
+ course_language AS col3,
+ category_code AS col4,
+ subscribe AS col5,
+ unsubscribe AS col6,
+ code AS col7,
+ visibility AS col8,
+ directory as col9,
+ visual_code
FROM $course_table";
global $_configuration;
@@ -97,14 +106,12 @@ function get_course_data($from, $number_of_items, $column, $direction) {
$res = Database::query($sql);
$courses = array ();
- while ($course = Database::fetch_row($res)) {
+ while ($course = Database::fetch_array($res)) {
// Place colour icons in front of courses.
- $course[1] = get_course_visibility_icon($course[8]).''.$course[1].'';
+ $course[1] = get_course_visibility_icon($course[8]).''.$course[1].' '.Display::label($course['visual_code'], 'info');
$course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
$course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
-
- $course_rem = array($course[0], $course[1], $course[2], $course[3], $course[4], $course[5], $course[6], $course[7]);
-
+ $course_rem = array($course[0], $course[1], $course[2], $course[3], $course[4], $course[5], $course[6], $course[7]);
$courses[] = $course_rem;
}
return $courses;
@@ -149,15 +156,15 @@ function get_course_visibility_icon($v) {
}
}
-if (isset ($_POST['action'])) {
- switch ($_POST['action']) {
+if (isset ($_POST['action'])) {
+ switch ($_POST['action']) {
// Delete selected courses
case 'delete_courses' :
- $course_codes = $_POST['course'];
+ $course_codes = $_POST['course'];
if (count($course_codes) > 0) {
- foreach ($course_codes as $index => $course_code) {
+ foreach ($course_codes as $index => $course_code) {
CourseManager :: delete_course($course_code);
- $obj_cat=new Category();
+ $obj_cat = new Category();
$obj_cat->update_category_delete($course_code);
}
}