Showing differences between visual code and "real code" see #5670

skala
Julio Montoya 12 years ago
parent 3cb76ac40f
commit 4f7ee3db1d
  1. 12
      main/admin/course_edit.php
  2. 19
      main/admin/course_list.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'), '<br />');
$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

@ -63,8 +63,17 @@ function get_number_of_courses() {
function get_course_data($from, $number_of_items, $column, $direction) {
$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]).'<a href="'.api_get_path(WEB_COURSE_PATH).$course[9].'/index.php">'.$course[1].'</a>';
$course[1] = get_course_visibility_icon($course[8]).'<a href="'.api_get_path(WEB_COURSE_PATH).$course[9].'/index.php">'.$course[1].'</a> '.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]);
$courses[] = $course_rem;
}
return $courses;

Loading…
Cancel
Save