diff --git a/main/admin/subscribe_class2course.php b/main/admin/subscribe_class2course.php index 77a60b92e0..56798cf06f 100755 --- a/main/admin/subscribe_class2course.php +++ b/main/admin/subscribe_class2course.php @@ -3,24 +3,24 @@ // $Id: subscribe_class2course.php 20441 2009-05-10 07:39:15Z ivantcholakov $ /* ============================================================================== - Dokeos - elearning and course management software + Dokeos - elearning and course management software - Copyright (c) 2004 Dokeos S.A. - Copyright (c) 2003 Ghent University (UGent) - Copyright (c) 2001 Universite catholique de Louvain (UCL) - Copyright (c) Olivier Brouckaert + Copyright (c) 2004 Dokeos S.A. + Copyright (c) 2003 Ghent University (UGent) + Copyright (c) 2001 Universite catholique de Louvain (UCL) + Copyright (c) Olivier Brouckaert - For a full list of contributors, see "credits.txt". - The full license can be read in "license.txt". + For a full list of contributors, see "credits.txt". + The full license can be read in "license.txt". - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. - See the GNU General Public License for more details. + See the GNU General Public License for more details. - Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com + Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com ============================================================================== */ /** @@ -61,41 +61,41 @@ Display :: display_header($tool_name); if ($_POST['formSent']) { - $form_sent = $_POST['formSent']; - $classes = is_array($_POST['ClassList']) ? $_POST['ClassList'] : array(); - $courses = is_array($_POST['CourseList']) ? $_POST['CourseList'] : array(); - $first_letter_class = $_POST['firstLetterClass']; - $first_letter_course = $_POST['firstLetterCourse']; - - if ($form_sent == 1) - { - if (count($classes) == 0 || count($courses) == 0) - { - Display::display_error_message(get_lang('AtLeastOneClassAndOneCourse')); - } - elseif (api_substr($_POST['formSubmit'], -2) == '>>') // add classes to courses - { - foreach ($courses as $course_code) - { - foreach ($classes as $class_id) - { - ClassManager :: subscribe_to_course($class_id, $course_code); - } - } - Display::display_normal_message(get_lang('ClassesSubscribed')); - } - else // remove classes from courses - { - foreach ($courses as $course_code) - { - foreach ($classes as $class_id) - { - ClassManager :: unsubscribe_from_course($class_id, $course_code); - } - } - Display::display_normal_message(get_lang('ClassesUnsubscribed')); - } - } + $form_sent = $_POST['formSent']; + $classes = is_array($_POST['ClassList']) ? $_POST['ClassList'] : array(); + $courses = is_array($_POST['CourseList']) ? $_POST['CourseList'] : array(); + $first_letter_class = $_POST['firstLetterClass']; + $first_letter_course = $_POST['firstLetterCourse']; + + if ($form_sent == 1) + { + if (count($classes) == 0 || count($courses) == 0) + { + Display::display_error_message(get_lang('AtLeastOneClassAndOneCourse')); + } + elseif (api_substr($_POST['formSubmit'], -2) == '>>') // add classes to courses + { + foreach ($courses as $course_code) + { + foreach ($classes as $class_id) + { + ClassManager :: subscribe_to_course($class_id, $course_code); + } + } + Display::display_normal_message(get_lang('ClassesSubscribed')); + } + else // remove classes from courses + { + foreach ($courses as $course_code) + { + foreach ($classes as $class_id) + { + ClassManager :: unsubscribe_from_course($class_id, $course_code); + } + } + Display::display_normal_message(get_lang('ClassesUnsubscribed')); + } + } } $sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ". (count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name"; @@ -106,7 +106,7 @@ $result = Database::query($sql); $db_courses = Database::store_result($result); if (!empty ($error_message)) { - Display :: display_normal_message($error_message); + Display :: display_normal_message($error_message); } ?>