|
|
|
|
@ -2,10 +2,10 @@ |
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Code to display the course settings form (for the course admin) |
|
|
|
|
* and activate the changes. |
|
|
|
|
* Code to display the course settings form (for the course admin) |
|
|
|
|
* and activate the changes. |
|
|
|
|
* |
|
|
|
|
* See ./inc/conf/course_info.conf.php for settings |
|
|
|
|
* See ./inc/conf/course_info.conf.php for settings |
|
|
|
|
* @todo Move $canBeEmpty from course_info.conf.php to config-settings |
|
|
|
|
* @todo Take those config settings into account in this script |
|
|
|
|
* @author Patrick Cool <patrick.cool@UGent.be> |
|
|
|
|
@ -53,48 +53,17 @@ if (api_get_setting('pdf_export_watermark_by_course') == 'true') { |
|
|
|
|
$show_delete_watermark_text_message = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
|
|
|
$tbl_admin = Database::get_main_table(TABLE_MAIN_ADMIN); |
|
|
|
|
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
|
|
|
|
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT tutor_name FROM $tbl_course WHERE id = $courseId"; |
|
|
|
|
$q_tutor = Database::query($sql); |
|
|
|
|
$s_tutor = Database::result($q_tutor, 0, 'tutor_name'); |
|
|
|
|
|
|
|
|
|
$target_name = api_sort_by_first_name() ? 'firstname' : 'lastname'; |
|
|
|
|
$sql = "SELECT DISTINCT username, lastname, firstname |
|
|
|
|
FROM $tbl_user as user, $tbl_course_user as course_rel_user |
|
|
|
|
WHERE (course_rel_user.status='1') AND user.user_id=course_rel_user.user_id AND c_id ='".$courseId."' |
|
|
|
|
ORDER BY ".$target_name." ASC"; |
|
|
|
|
$q_result_titulars = Database::query($sql); |
|
|
|
|
|
|
|
|
|
if (Database::num_rows($q_result_titulars) == 0) { |
|
|
|
|
$sql = "SELECT username, lastname, firstname FROM $tbl_user as user, $tbl_admin as admin |
|
|
|
|
WHERE admin.user_id=user.user_id ORDER BY ".$target_name." ASC"; |
|
|
|
|
$q_result_titulars = Database::query($sql); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$a_profs[0] = '-- '.get_lang('NoManager').' --'; |
|
|
|
|
while ($a_titulars = Database::fetch_array($q_result_titulars)) { |
|
|
|
|
$s_username = $a_titulars['username']; |
|
|
|
|
$s_lastname = $a_titulars['lastname']; |
|
|
|
|
$s_firstname = $a_titulars['firstname']; |
|
|
|
|
|
|
|
|
|
if (api_get_person_name($s_firstname, $s_lastname) == $s_tutor) { |
|
|
|
|
$s_selected_tutor = api_get_person_name($s_firstname, $s_lastname); |
|
|
|
|
} |
|
|
|
|
$s_disabled_select_titular = ''; |
|
|
|
|
if (!api_is_course_admin()) { |
|
|
|
|
$s_disabled_select_titular = 'disabled=disabled'; |
|
|
|
|
} |
|
|
|
|
$a_profs[api_get_person_name($s_firstname, $s_lastname)] = api_get_person_name($s_lastname, $s_firstname).' ('.$s_username.')'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$categories = CourseCategory::getCategoriesCanBeAddedInCourse($_course['categoryCode']); |
|
|
|
|
$categories = CourseCategory::getCategoriesCanBeAddedInCourse( |
|
|
|
|
$_course['categoryCode'] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Build the form |
|
|
|
|
$form = new FormValidator('update_course', 'post', api_get_self().'?'.api_get_cidreq()); |
|
|
|
|
$form = new FormValidator( |
|
|
|
|
'update_course', |
|
|
|
|
'post', |
|
|
|
|
api_get_self().'?'.api_get_cidreq() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$form->addHtml('<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">'); |
|
|
|
|
|
|
|
|
|
@ -791,7 +760,9 @@ if ($form->validate() && is_settings_editable()) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($show_delete_watermark_text_message) { |
|
|
|
|
Display::addFlash(Display::return_message(get_lang('FileDeleted'), 'normal')); |
|
|
|
|
Display::addFlash( |
|
|
|
|
Display::return_message(get_lang('FileDeleted'), 'normal') |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Header */ |
|
|
|
|
|