Browse Source

Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

Angel Fernando Quiroz Campos 7 years ago
parent
commit
c246105927

+ 7 - 0
app/Resources/public/css/base.css

@@ -6192,6 +6192,13 @@ ul#toolnavbox-two li a.btn{
     display: block;
     width: 100%;
 }
+.label-subscribed{
+    font-size: 12px;
+    position: absolute;
+    top: -65px;
+    right: 0;
+    width: 100px;
+}
 /* CSS NEW TOP ******************************************************************************/
 /* CSS Responsive */
 @media (min-width: 1025px) and (max-width: 1200px) {

+ 5 - 5
main/admin/course_import.php

@@ -172,19 +172,19 @@ $tool_name = get_lang('ImportCourses').' CSV';
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 
 set_time_limit(0);
-Display :: display_header($tool_name);
+Display::display_header($tool_name);
 
 if (isset($_POST['formSent']) && $_POST['formSent']) {
     if (empty($_FILES['import_file']['tmp_name'])) {
         $error_message = get_lang('UplUploadFailed');
-        Display :: display_error_message($error_message, false);
+        echo Display::return_message($error_message, 'error', false);
     } else {
         $allowed_file_mimetype = array('csv');
 
         $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
 
         if (!in_array($ext_import_file, $allowed_file_mimetype)) {
-            Display :: display_error_message(get_lang('YouMustImportAFileAccordingToSelectedOption'));
+            echo Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error');
         } else {
             $courses = parse_csv_courses_data($_FILES['import_file']['tmp_name']);
 
@@ -204,7 +204,7 @@ if (isset($errors) && count($errors) != 0) {
         $error_message .= '</li>';
     }
     $error_message .= '</ul>';
-    Display :: display_error_message($error_message, false);
+    echo Display::return_message($error_message, 'error', false);
 }
 
 $form = new FormValidator('import', 'post', api_get_self(), null, array('enctype' => 'multipart/form-data'));
@@ -229,4 +229,4 @@ BIO0017;Language;LANG;;;english
 </blockquote>
 
 <?php
-Display :: display_footer();
+Display::display_footer();

+ 17 - 16
main/admin/course_intro_pdf_import.php

@@ -13,24 +13,25 @@ api_protect_admin_script();
 // Should default to '', and start with a '/' and end without it, if defined
 $subDir = '';
 $tool_name = get_lang('ImportPDFIntroToCourses');
+$errors = [];
 
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
 
 set_time_limit(0);
-Display :: display_header($tool_name);
+Display::display_header($tool_name);
 
 if ($_POST['formSent']) {
     if (empty($_FILES['import_file']['tmp_name'])) {
         $error_message = get_lang('UplUploadFailed');
-        Display :: display_error_message($error_message, false);
+        Display::addFlash(Display::return_message($error_message, 'error', false));
     } else {
         $allowed_file_mimetype = array('zip');
         $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'], '.') + 1));
 
         if (!in_array($ext_import_file, $allowed_file_mimetype)) {
-            Display :: display_error_message(get_lang('YouMustImportAZipFile'));
+            Display::addFlash(Display::return_message(get_lang('YouMustImportAZipFile'), 'error'));
         } else {
-            $errors = import_pdfs($courses, $subDir);
+            $errors = import_pdfs($subDir);
             if (count($errors) == 0) {
                 error_log('Course intros imported successfully in '.__FILE__.', line '.__LINE__);
             }
@@ -46,11 +47,11 @@ if (count($errors) != 0) {
     $error_message .= '</ul>';
     Display::addFlash(Display::return_message($error_message, 'normal', false));
 } elseif ($_POST['formSent']) {
-    Display :: display_confirmation_message('CourseIntroductionsAllImportesSuccessfully', false);
+    Display::addFlash(Display::return_message('CourseIntroductionsAllImportesSuccessfully', 'confirmation', false));
 }
 ?>
-    <form method="post" action="<?php echo api_get_self(); ?>" enctype="multipart/form-data" style="margin: 0px;">
-        <legend><?php echo $tool_name; ?></legend>
+    <form method="post" action="<?php echo api_get_self(); ?>" enctype="multipart/form-data" style="margin: 0;">
+        <h3><?php echo $tool_name; ?></h3>
         <div class="control-group">
             <label><?php echo get_lang('ImportZipFileLocation'); ?></label>
             <div class="control">
@@ -71,21 +72,21 @@ if (count($errors) != 0) {
 <pre>
 <strong>CourseCode</strong>_<strong>NameOfDocument</strong>_<strong>CourseName</strong>.pdf
 e.g.
-MAT101_Introduction_Mathematics-101.pdf
-MAT102_Introduction_Mathematics-102.pdf
-ENG101_Introduction_English-101.pdf
+MAT101_Introduction_to_Mathematics-101.pdf
+MAT102_Introduction_to_Mathematics-102.pdf
+ENG101_Introduction_to_English-101.pdf
 </pre>
     </blockquote>
 
 <?php
-Display :: display_footer();
+Display::display_footer();
 
 /**
  * Import PDFs
- * @param   string  Filename
- * @param   string  The subdirectory in which to put the files in each course
+ * @param   string $subDir  The subdirectory in which to put the files in each course
+ * @return array List of possible errors found
  */
-function import_pdfs($file, $subDir = '/')
+function import_pdfs($subDir = '/')
 {
     $baseDir = api_get_path(SYS_ARCHIVE_PATH);
     $uploadPath = 'pdfimport/';
@@ -120,7 +121,7 @@ function import_pdfs($file, $subDir = '/')
                     error_log('Destination '.api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$subDir.' is NOT writeable in '.__FILE__);
                 }
                 // Place each file in its folder in each course
-                $move = rename($baseDir.$uploadPath.$file, api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$subDir.'/'.$file);
+                rename($baseDir.$uploadPath.$file, api_get_path(SYS_COURSE_PATH).$course['path'].'/document'.$subDir.'/'.$file);
                 api_item_property_update($course, TOOL_DOCUMENT, $docId, 'DocumentAdded', api_get_user_id());
                 // Redo visibility
                 api_set_default_visibility($docId, TOOL_DOCUMENT);
@@ -134,7 +135,7 @@ function import_pdfs($file, $subDir = '/')
                 $session_id = api_get_session_id();
                 $course_description->set_course_id($course['real_id']);
                 $course_description->set_session_id($session_id);
-                $course_description->set_title('Presentación de la asignatura');
+                $course_description->set_title('Course presentation');
                 $course_description->set_content($link);
                 $course_description->set_description_type(1);
                 $course_description->insert();

+ 8 - 8
main/admin/course_user_import_by_email.php

@@ -99,8 +99,8 @@ function save_data($users_courses)
             foreach ($to_subscribe as $courseId) {
                 $courseInfo = api_get_course_info_by_id($courseId);
                 $course_code = $courseInfo['code'];
-                if (CourseManager :: course_exists($course_code)) {
-                    $course_info = CourseManager::get_course_information($course_code);
+                if (CourseManager::course_exists($course_code)) {
+                    $course_info = api_get_course_info($course_code);
                     $inserted_in_course[$course_code] = $course_info['title'];
 
                     CourseManager::subscribe_user(
@@ -117,9 +117,9 @@ function save_data($users_courses)
             foreach ($to_unsubscribe as $courseId) {
                 $courseInfo = api_get_course_info_by_id($courseId);
                 $course_code = $courseInfo['code'];
-                if (CourseManager :: course_exists($course_code)) {
+                if (CourseManager::course_exists($course_code)) {
                     CourseManager::unsubscribe_user($user_id, $course_code);
-                    $course_info = CourseManager::get_course_information($course_code);
+                    $course_info = api_get_course_info($course_code);
                     CourseManager::unsubscribe_user($user_id, $course_code);
                     $inserted_in_course[$course_info['code']] = $course_info['title'];
                 }
@@ -137,7 +137,7 @@ function save_data($users_courses)
  */
 function parse_csv_data($file)
 {
-    $courses = Import :: csvToArray($file);
+    $courses = Import::csv_reader($file);
     return $courses;
 }
 
@@ -198,7 +198,7 @@ if ($form->validate()) {
 }
 
 // Displaying the header.
-Display :: display_header($tool_name);
+Display::display_header($tool_name);
 
 if (count($errors) != 0) {
     $error_message = '<ul>';
@@ -208,7 +208,7 @@ if (count($errors) != 0) {
         $error_message .= '</li>';
     }
     $error_message .= '</ul>';
-    Display :: display_error_message($error_message, false);
+    echo Display::return_message($error_message, 'error', false);
 }
 
 // Displaying the form.
@@ -229,4 +229,4 @@ echo STUDENT.': '.get_lang('Student').'<br />';
 </blockquote>
 <?php
 
-Display :: display_footer();
+Display::display_footer();

+ 4 - 4
main/admin/extra_field_options.php

@@ -151,7 +151,7 @@ switch ($action) {
                 $values = $form->exportValues();
                 $res = $obj->save_one_item($values);
                 if ($res) {
-                    Display::display_confirmation_message(get_lang('ItemAdded'));
+                    echo Display::return_message(get_lang('ItemAdded'), 'confirmation');
                 }
             }
             $obj->display();
@@ -171,7 +171,7 @@ switch ($action) {
             if ($check) {
                 $values = $form->exportValues();
                 $res = $obj->update($values);
-                Display::display_confirmation_message(sprintf(get_lang('ItemUpdated'), $values['display_text']), false);
+                echo Display::return_message(sprintf(get_lang('ItemUpdated'), $values['display_text']), 'confirmation', false);
             }
             $obj->display();
         } else {
@@ -185,7 +185,7 @@ switch ($action) {
         if ($check) {
             $res = $obj->delete($_GET['id']);
             if ($res) {
-                Display::display_confirmation_message(get_lang('ItemDeleted'));
+                echo Display::return_message(get_lang('ItemDeleted'), 'confirmation');
             }
         }
         $obj->display();
@@ -194,4 +194,4 @@ switch ($action) {
         $obj->display();
         break;
 }
-Display :: display_footer();
+Display::display_footer();

+ 5 - 4
main/admin/extra_fields.php

@@ -127,7 +127,7 @@ switch ($action) {
             unset($values['id']);
             $res = $obj->save($values);
             if ($res) {
-                Display::display_confirmation_message(get_lang('ItemAdded'));
+                echo Display::return_message(get_lang('ItemAdded'), 'confirmation');
             }
             $obj->display();
         } else {
@@ -149,8 +149,9 @@ switch ($action) {
         if ($form->validate()) {
             $values = $form->exportValues();
             $res = $obj->update($values);
-            Display::display_confirmation_message(
+            echo Display::return_message(
                 sprintf(get_lang('ItemUpdated'), $values['variable']),
+                'confirmation',
                 false
             );
             $obj->display();
@@ -168,7 +169,7 @@ switch ($action) {
         // Action handling: delete
         $res = $obj->delete($_GET['id']);
         if ($res) {
-            Display::display_confirmation_message(get_lang('ItemDeleted'));
+            echo Display::return_message(get_lang('ItemDeleted'), 'confirmation');
         }
         $obj->display();
         break;
@@ -176,4 +177,4 @@ switch ($action) {
         $obj->display();
         break;
 }
-Display :: display_footer();
+Display::display_footer();

+ 6 - 4
main/admin/settings.lib.php

@@ -458,7 +458,7 @@ function handleStylesheets()
             </script>';
             echo Display::tabs(
                 array(get_lang('Update'),get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')),
-                array($form_change->return_form(), $logoForm->returnForm(), $form->returnForm())
+                array($form_change->returnForm(), $logoForm->returnForm(), $form->returnForm())
             );
         } else {
             $form_change->display();
@@ -540,8 +540,9 @@ function uploadStylesheet($values, $picture)
                     $error_string .= '<li>'.$invalid_file.'</li>';
                 }
                 $error_string .= '</ul>';
-                Display::display_error_message(
+                echo Display::return_message(
                     get_lang('ErrorStylesheetFilesExtensionsInsideZip').$error_string,
+                    'error',
                     false
                 );
             } else {
@@ -1691,8 +1692,9 @@ function showSearchToolsStatusTable()
         $table->set_header(2, get_lang('Status'), false);
         echo $table->display();
     } else {
-        Display::display_warning_message(
-            get_lang('YouAreUsingChamiloInAWindowsPlatformSadlyYouCantConvertDocumentsInOrderToSearchTheContentUsingThisTool')
+        echo Display::return_message(
+            get_lang('YouAreUsingChamiloInAWindowsPlatformSadlyYouCantConvertDocumentsInOrderToSearchTheContentUsingThisTool'),
+            'warning'
         );
     }
 }

+ 11 - 12
main/auth/courses_categories.php

@@ -134,10 +134,10 @@ $code = isset($code) ? $code : null;
 <?php
 if ($showCourses && $action != 'display_sessions') {
     if (!empty($message)) {
-        Display::display_confirmation_message($message, false);
+        echo Display::return_message($message, 'confirmation', false);
     }
     if (!empty($error)) {
-        Display::display_error_message($error, false);
+        echo Display::return_message($error, 'error', false);
     }
 
     if (!empty($content)) {
@@ -213,7 +213,7 @@ if ($showCourses && $action != 'display_sessions') {
 
             // display course title and button bloc
             $html .= '<div class="description">';
-            $html .= return_title($course, $userRegisterd);
+            $html .= return_title($course, $userRegisterdInCourse);
             $html .= return_teacher($course);
 
             // display button line
@@ -226,7 +226,6 @@ if ($showCourses && $action != 'display_sessions') {
             // if user registered as student
             if ($userRegisterdInCourse) {
                 $html .= return_already_registered_label('student');
-
                 if (!$course_closed) {
                     if ($course_unsubscribe_allowed) {
                         $html .= return_unregister_button($course, $stok, $search_term, $code);
@@ -263,7 +262,7 @@ if ($showCourses && $action != 'display_sessions') {
         if (!isset($_REQUEST['subscribe_user_with_password']) &&
             !isset($_REQUEST['subscribe_course'])
         ) {
-            Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
+            echo Display::return_message(get_lang('ThereAreNoCoursesInThisCategory'), 'warning');
         }
     }
 }
@@ -434,9 +433,9 @@ function return_already_registered_label($in_status)
     }
 
     $html = Display::tag(
-        'button',
-        $icon,
-        array('id' => 'register', 'class' => 'btn btn-default btn-sm', 'title' => $title, 'aria-label' => $title)
+        'span',
+        $icon . ' ' . $title,
+        array('id' => 'register', 'class' => 'label-subscribed text-success', 'title' => $title, 'aria-label' => $title)
     );
 
     return $html;
@@ -455,7 +454,7 @@ function return_register_button($course, $stok, $code, $search_term)
 {
     $title = get_lang('Subscribe');
     $html = Display::url(
-        Display::returnFontAwesomeIcon('sign-in'),
+        Display::returnFontAwesomeIcon('check') . ' ' . $title,
         api_get_self() . '?action=subscribe_course&sec_token=' . $stok.
         '&subscribe_course='.$course['code'].'&search_term='.$search_term.'&category_code='.$code,
         array('class' => 'btn btn-success btn-sm', 'title' => $title, 'aria-label' => $title)
@@ -474,12 +473,12 @@ function return_register_button($course, $stok, $code, $search_term)
  */
 function return_unregister_button($course, $stok, $search_term, $code)
 {
-    $title = get_lang('Unsubscribe');
+    $title = get_lang('UnsubscriptionAllowed');
     $html = Display::url(
-        Display::returnFontAwesomeIcon('sign-in'),
+        Display::returnFontAwesomeIcon('sign-in').' '.$title,
         api_get_self() . '?action=unsubscribe&sec_token='.$stok
         .'&unsubscribe='.$course['code'].'&search_term='.$search_term.'&category_code='.$code,
-        array('class' => 'btn btn-success btn-sm', 'title' => $title, 'aria-label' => $title)
+        array('class' => 'btn btn-danger btn-sm', 'title' => $title, 'aria-label' => $title)
     );
     return $html;
 }

+ 3 - 3
main/inc/ajax/exercise.ajax.php

@@ -186,7 +186,7 @@ switch ($action) {
                 );
                 $counter++;
             }
-            Display::display_confirmation_message(get_lang('Saved'));
+            echo Display::return_message(get_lang('Saved'), 'confirmation');
         }
         break;
     case 'update_question_order':
@@ -195,7 +195,7 @@ switch ($action) {
         $exercise_id = isset($_REQUEST['exercise_id']) ? $_REQUEST['exercise_id'] : null;
 
         if (empty($exercise_id)) {
-            return Display::display_error_message(get_lang('Error'));
+            return Display::return_message(get_lang('Error'), 'error');
         }
         if (api_is_allowed_to_edit(null, true)) {
             $new_question_list = $_POST['question_id_list'];
@@ -209,7 +209,7 @@ switch ($action) {
                 ;
                 $counter++;
             }
-            Display::display_confirmation_message(get_lang('Saved'));
+            echo Display::return_message(get_lang('Saved'), 'confirmation');
         }
         break;
     case 'add_question_to_reminder':

+ 3 - 3
main/inc/ajax/message.ajax.php

@@ -51,15 +51,15 @@ switch ($action) {
         $messageContent = isset($_REQUEST['content']) ? trim($_REQUEST['content']) : null;
 
         if (empty($subject) || empty($messageContent)) {
-            echo Display::display_error_message(get_lang('ErrorSendingMessage'));
+            echo Display::return_message(get_lang('ErrorSendingMessage'), 'error');
             exit;
         }
 
         $result = MessageManager::send_message($_REQUEST['user_id'], $subject, $messageContent);
         if ($result) {
-            echo Display::display_confirmation_message(get_lang('MessageHasBeenSent'));
+            echo Display::return_message(get_lang('MessageHasBeenSent'), 'confirmation');
         } else {
-            echo Display::display_error_message(get_lang('ErrorSendingMessage'));
+            echo Display::return_message(get_lang('ErrorSendingMessage'), 'confirmation');
         }
         break;
     case 'send_invitation':

+ 3 - 3
main/inc/lib/blog.lib.php

@@ -379,7 +379,7 @@ class Blog
                 $file_name = $_FILES['user_upload']['name'];
 
                 if (!filter_extension($new_file_name)) {
-                    Display::display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
+                    echo Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'error');
                 } else {
                     $new_file_name = uniqid('');
                     $new_path = $updir.'/'.$new_file_name;
@@ -404,7 +404,7 @@ class Blog
 
             return $last_post_id;
         } else {
-            Display::display_error_message(get_lang('UplNoFileUploaded'));
+            echo Display::return_message(get_lang('UplNoFileUploaded'), 'error');
         }
     }
 
@@ -540,7 +540,7 @@ class Blog
                     $file_name = Database::escape_string($_FILES['user_upload']['name']);
 
                     if (!filter_extension($new_file_name)) {
-                        Display:: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
+                        echo Display::return_message(get_lang('UplUnableToSaveFileFilteredExtension'), 'error');
                     } else {
                         $new_file_name = uniqid('');
                         $new_path = $updir . '/' . $new_file_name;

+ 10 - 4
main/inc/lib/zombie/zombie_report.class.php

@@ -91,7 +91,13 @@ class ZombieReport implements Countable
             return null;
         }
         if (empty($this->parameters_form)) {
-            $this->parameters_form = FormValidator::create($parameters);
+            $this->parameters_form = new FormValidator(
+                $parameters['name'],
+                $parameters['method'],
+                null,
+                null,
+                $parameters['attributes']
+            );
         }
 
         return $this->parameters_form;
@@ -104,7 +110,7 @@ class ZombieReport implements Countable
             return '';
         }
 
-        $result = $form->return_form();
+        $result = $form->returnForm();
         if ($return) {
             return $result;
         } else {
@@ -312,9 +318,9 @@ class ZombieReport implements Countable
         $result = $this->display_parameters($return);
         if ($this->perform_action()) {
             if ($return) {
-                $result .= Display::return_confirmation_message(get_lang('Done'));
+                $result .= Display::return_message(get_lang('Done'), 'confirmation');
             } else {
-                Display::display_confirmation_message(get_lang('Done'));
+                echo Display::return_message(get_lang('Done'), 'confirmation');
             }
         }
         $result .= $this->display_data($return);

+ 7 - 7
main/survey/survey.download.inc.php

@@ -14,7 +14,7 @@
 function check_download_survey($course, $invitation, $doc_url)
 {
     // Getting all the course information
-    $_course = CourseManager::get_course_information($course);
+    $_course = api_get_course_info($course);
     $course_id = $_course['real_id'];
 
     // Database table definitions
@@ -30,16 +30,16 @@ function check_download_survey($course, $invitation, $doc_url)
                 invitation_code = '".Database::escape_string($invitation)."'";
     $result = Database::query($sql);
     if (Database::num_rows($result) < 1) {
-        Display :: display_error_message(get_lang('WrongInvitationCode'), false);
-        Display :: display_footer();
+        echo Display::return_message(get_lang('WrongInvitationCode'), 'error', false);
+        Display::display_footer();
         exit;
     }
     $survey_invitation = Database::fetch_assoc($result);
 
     // Now we check if the user already filled the survey
     if ($survey_invitation['answered'] == 1) {
-        Display :: display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false);
-        Display :: display_footer();
+        echo Display::return_message(get_lang('YouAlreadyFilledThisSurvey'), 'error', false);
+        Display::display_footer();
         exit;
     }
 
@@ -102,8 +102,8 @@ function check_download_survey($course, $invitation, $doc_url)
                     )";
     $result = Database::query($sql);
     if (Database::num_rows($result) == 0) {
-        Display :: display_error_message(get_lang('WrongInvitationCode'), false);
-        Display :: display_footer();
+        echo Display::return_message(get_lang('WrongInvitationCode'), 'error', false);
+        Display::display_footer();
         exit;
     }
 

+ 4 - 4
main/survey/survey.php

@@ -108,7 +108,7 @@ $message_information = isset($_GET['message']) ? Security::remove_XSS($_GET['mes
 if (isset($action)) {
 	if (($action == 'moveup' || $action == 'movedown') && isset($_GET['question_id'])) {
 		SurveyManager::move_survey_question($my_action_survey,$my_question_id_survey,$my_survey_id_survey);
-		Display::display_confirmation_message(get_lang('SurveyQuestionMoved'));
+		echo Display::return_message(get_lang('SurveyQuestionMoved'), 'confirmation');
 	}
 	if ($action == 'delete' AND is_numeric($_GET['question_id'])) {
 		SurveyManager::delete_survey_question($my_survey_id_survey, $my_question_id_survey, $survey_data['is_shared']);
@@ -238,11 +238,11 @@ if ($is_survey_type_1) {
 	echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
 
 	if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully', 'GroupDeletedSuccessfully', 'GroupCreatedSuccessfully'))) {
-		echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
+		echo Display::return_message(get_lang($_GET['sendmsg']), 'confirmation', false);
 	}
 
 	if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
-		echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
+		echo Display::return_message(get_lang($_GET['sendmsg']), 'warning', false);
 	}
 	echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
 	echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
@@ -285,4 +285,4 @@ if ($is_survey_type_1) {
 Session::erase('answer_count');
 
 // Footer
-Display :: display_footer();
+Display::display_footer();

+ 8 - 8
main/tracking/question_course_report.php

@@ -14,9 +14,9 @@ $this_section = "session_my_space";
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
 
 if (!$is_allowedToTrack) {
-	Display :: display_header(null);
+	Display::display_header(null);
 	api_not_allowed();
-	Display :: display_footer();
+	Display::display_footer();
 }
 
 $export_to_xls = false;
@@ -45,13 +45,13 @@ function load_courses() {
 $session_id = isset($_REQUEST['session_id']) ? intval($_REQUEST['session_id']) : null;
 
 if (empty($session_id)) {
-	$temp_course_list = CourseManager :: get_courses_list();
+	$temp_course_list = CourseManager::get_courses_list();
 } else {
 	$temp_course_list = SessionManager::get_course_list_by_session_id($session_id);
 }
 
 foreach ($temp_course_list  as $temp_course_item) {
-	$course_item = CourseManager ::get_course_information($temp_course_item['code']);
+	$course_item = api_get_course_info($temp_course_item['code']);
 	$course_select_list[$temp_course_item['code']] = $course_item['title'];
 }
 
@@ -148,7 +148,7 @@ if (!empty($course_info)) {
 }
 
 if (!$export_to_xls) {
-	Display :: display_header(get_lang("MySpace"));
+	Display::display_header(get_lang("MySpace"));
 	echo '<div class="actions">';
 	if ($global) {
 		echo MySpace::getTopMenu();
@@ -171,7 +171,7 @@ if (!$export_to_xls) {
 	$form->display();
 
 	if (empty($course_code)) {
-		Display::display_warning_message(get_lang('PleaseSelectACourse'));
+		echo Display::return_message(get_lang('PleaseSelectACourse'), 'warning');
 	}
 }
 
@@ -215,7 +215,7 @@ if (!empty($main_question_list) && is_array($main_question_list)) {
 	$html_result .= '</table>';
 } else {
 	if (!empty($course_code)) {
-		Display::display_warning_message(get_lang('NoResults'));
+		echo Display::return_message(get_lang('NoResults'), 'warning');
 	}
 }
 
@@ -223,4 +223,4 @@ if (!$export_to_xls) {
 	echo $html_result;
 }
 
-Display :: display_footer();
+Display::display_footer();

+ 4 - 19
plugin/search_course/lib/register_course_widget.class.php

@@ -77,12 +77,12 @@ class RegisterCourseWidget
 
         if ($this->subscribe_user($course_code, $registration_code))
         {
-            Display::display_confirmation_message(get_lang('EnrollToCourseSuccessful'));
+            echo Display::return_message(get_lang('EnrollToCourseSuccessful'), 'confirmation');
             return;
         }
         if (!empty($registration_code))
         {
-            Display::display_error_message(get_lang('CourseRegistrationCodeIncorrect'));
+            echo Display::return_message(get_lang('CourseRegistrationCodeIncorrect'), 'error');
         }
         $this->display_form($course_code);
         return true;
@@ -99,7 +99,7 @@ class RegisterCourseWidget
      */
     function subscribe_user($course_code, $registration_code = '', $user_id = null)
     {
-        $course = $this->retrieve_course($course_code);
+        $course = api_get_course_info($course_code);
         $course_regisration_code = $course['registration_code'];
         if (!empty($course_regisration_code) && $registration_code != $course_regisration_code)
         {
@@ -125,7 +125,7 @@ class RegisterCourseWidget
     {
         global $stok;
 
-        $course = $this->retrieve_course($course_code);
+        $course = api_get_course_info($course_code);
         $self = $_SERVER['REQUEST_URI'];
         $course_code = $course['code'];
         $course_visual_code = $course['visual_code'];
@@ -144,19 +144,4 @@ class RegisterCourseWidget
 EOT;
         echo $result;
     }
-
-    /**
-     * DB functions - DB functions - DB functions
-     */
-
-    /**
-     *
-     * @param type $course_code
-     * @return type
-     */
-    function retrieve_course($course_code)
-    {
-        return CourseManager::get_course_information($course_code);
-    }
-
 }