Explorar o código

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

jmontoyaa %!s(int64=7) %!d(string=hai) anos
pai
achega
c5633ec67e

+ 4 - 4
main/admin/careers.php

@@ -83,9 +83,9 @@ $extra_params['height'] = 'auto';
 
 
 //With this function we can add actions to the jgrid (edit, delete, etc)
 //With this function we can add actions to the jgrid (edit, delete, etc)
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
-    return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
-    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
-    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
+    return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
+    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL).'</a>'.
+    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'.
     '\';
     '\';
 }';
 }';
 ?>
 ?>
@@ -133,7 +133,7 @@ switch ($action) {
         break;
         break;
     case 'edit':
     case 'edit':
         // Action handling: Editing
         // Action handling: Editing
-        $url  = api_get_self() . '?action=' . Security::remove_XSS($_GET['action']) . '&id=' . intval($_GET['id']);
+        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']);
         $form = $career->return_form($url, 'edit');
         $form = $career->return_form($url, 'edit');
 
 
         // The validation or display
         // The validation or display

+ 15 - 15
main/inc/lib/course_home.lib.php

@@ -359,7 +359,7 @@ class CourseHome
                         array(),
                         array(),
                         null,
                         null,
                         ICON_SIZE_MEDIUM
                         ICON_SIZE_MEDIUM
-                    ) . '&nbsp;' . $tool_name . '</a>';
+                    ).'&nbsp;'.$tool_name.'</a>';
 
 
                 // This part displays the links to hide or remove a tool.
                 // This part displays the links to hide or remove a tool.
                 // These links are only visible by the course manager.
                 // These links are only visible by the course manager.
@@ -699,7 +699,7 @@ class CourseHome
         $session_id = api_get_session_id();
         $session_id = api_get_session_id();
         $is_platform_admin = api_is_platform_admin();
         $is_platform_admin = api_is_platform_admin();
 
 
-        if ($session_id == 0 ) {
+        if ($session_id == 0) {
             $is_allowed_to_edit = api_is_allowed_to_edit(null, true) && api_is_course_admin();
             $is_allowed_to_edit = api_is_allowed_to_edit(null, true) && api_is_course_admin();
         } else {
         } else {
             $is_allowed_to_edit = api_is_allowed_to_edit(null, true) && !api_is_coach();
             $is_allowed_to_edit = api_is_allowed_to_edit(null, true) && !api_is_coach();
@@ -1075,8 +1075,8 @@ class CourseHome
 
 
         $toolName = api_underscore_to_camel_case($toolName);
         $toolName = api_underscore_to_camel_case($toolName);
 
 
-        if (isset($GLOBALS['Tool' . $toolName])) {
-            return get_lang('Tool' . $toolName);
+        if (isset($GLOBALS['Tool'.$toolName])) {
+            return get_lang('Tool'.$toolName);
         }
         }
 
 
         return $toolName;
         return $toolName;
@@ -1186,7 +1186,7 @@ class CourseHome
         $navigation_items = self::get_navigation_items(true);
         $navigation_items = self::get_navigation_items(true);
         $course_id = api_get_course_id();
         $course_id = api_get_course_id();
 
 
-        $class= null;
+        $class = null;
         $idLearn = null;
         $idLearn = null;
         $item = null;
         $item = null;
         $marginLeft = 160;
         $marginLeft = 160;
@@ -1211,10 +1211,10 @@ class CourseHome
             } else if (api_get_setting('show_navigation_menu') == 'icons') {
             } else if (api_get_setting('show_navigation_menu') == 'icons') {
                 $class = 'icons';
                 $class = 'icons';
                 $marginLeft = 25;
                 $marginLeft = 25;
-                $item = Display::return_icon(substr($navigation_item['image'],0,-3)."png", $navigation_item['name'], array('class'=>'tool-img'), ICON_SIZE_SMALL);
+                $item = Display::return_icon(substr($navigation_item['image'], 0, -3)."png", $navigation_item['name'], array('class'=>'tool-img'), ICON_SIZE_SMALL);
             } else {
             } else {
                 $class = 'icons-text';
                 $class = 'icons-text';
-                $item = $navigation_item['name'] . Display::return_icon(substr($navigation_item['image'],0,-3)."png", $navigation_item['name'], array('class'=>'tool-img'), ICON_SIZE_SMALL);
+                $item = $navigation_item['name'].Display::return_icon(substr($navigation_item['image'], 0, -3)."png", $navigation_item['name'], array('class'=>'tool-img'), ICON_SIZE_SMALL);
             }
             }
 
 
             if (stristr($url_item['path'], $url_current['path'])) {
             if (stristr($url_item['path'], $url_current['path'])) {
@@ -1226,13 +1226,13 @@ class CourseHome
             if (strpos($navigation_item['link'], 'chat') !== false &&
             if (strpos($navigation_item['link'], 'chat') !== false &&
                 api_get_course_setting('allow_open_chat_window', $course_id)
                 api_get_course_setting('allow_open_chat_window', $course_id)
             ) {
             ) {
-                $html .= '<a ' . $idLearn . ' class="btn btn-default text-left ' . $class . ' " href="javascript: void(0);" onclick="javascript: window.open(\''.$navigation_item['link'].'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$navigation_item['target'].'"';
+                $html .= '<a '.$idLearn.' class="btn btn-default text-left '.$class.' " href="javascript: void(0);" onclick="javascript: window.open(\''.$navigation_item['link'].'\',\'window_chat'.api_get_course_id().'\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="'.$navigation_item['target'].'"';
                 $html .= ' title="'.$navigation_item['name'].'">';
                 $html .= ' title="'.$navigation_item['name'].'">';
-                $html .=  $item;
+                $html .= $item;
                 $html .= '</a>';
                 $html .= '</a>';
             } else {
             } else {
-                $html .= '<a ' . $idLearn . ' class="btn btn-default text-left ' . $class . '" href="'.$navigation_item['link'].'" target="_top" title="'.$navigation_item['name'].'">';
-                $html .=  $item;
+                $html .= '<a '.$idLearn.' class="btn btn-default text-left '.$class.'" href="'.$navigation_item['link'].'" target="_top" title="'.$navigation_item['name'].'">';
+                $html .= $item;
                 $html .= '</a>';
                 $html .= '</a>';
             }
             }
 
 
@@ -1240,14 +1240,14 @@ class CourseHome
         }
         }
         $html .= '</ul>';
         $html .= '</ul>';
         $html .= '<script>$(function() {
         $html .= '<script>$(function() {
-                $("#toolnavbox a").stop().animate({"margin-left":"-' . $marginLeft . 'px"},1000);
+                $("#toolnavbox a").stop().animate({"margin-left":"-' . $marginLeft.'px"},1000);
                 $("#toolnavbox > li").hover(
                 $("#toolnavbox > li").hover(
                     function () {
                     function () {
                         $("a",$(this)).stop().animate({"margin-left":"-2px"},200);
                         $("a",$(this)).stop().animate({"margin-left":"-2px"},200);
                         $("span",$(this)).css("display","block");
                         $("span",$(this)).css("display","block");
                     },
                     },
                     function () {
                     function () {
-                        $("a",$(this)).stop().animate({"margin-left":"-' . $marginLeft . 'px"},200);
+                        $("a",$(this)).stop().animate({"margin-left":"-' . $marginLeft.'px"},200);
                         $("span",$(this)).css("display","initial");
                         $("span",$(this)).css("display","initial");
                     }
                     }
                 );
                 );
@@ -1348,7 +1348,7 @@ class CourseHome
             return array();
             return array();
         }
         }
 
 
-        $table  = Database::get_course_table(TABLE_TOOL_LIST);
+        $table = Database::get_course_table(TABLE_TOOL_LIST);
         $sql = "SELECT * FROM $table
         $sql = "SELECT * FROM $table
                 WHERE category in ('authoring','interaction')
                 WHERE category in ('authoring','interaction')
                 AND c_id = $courseId
                 AND c_id = $courseId
@@ -1454,7 +1454,7 @@ class CourseHome
             $temp = new Image($path);
             $temp = new Image($path);
             $r = $temp->convert2bw();
             $r = $temp->convert2bw();
             $ext = pathinfo($path, PATHINFO_EXTENSION);
             $ext = pathinfo($path, PATHINFO_EXTENSION);
-            $bwPath = substr($path,0,-(strlen($ext)+1)) . '_na.' . $ext;
+            $bwPath = substr($path, 0, -(strlen($ext) + 1)).'_na.'.$ext;
 
 
             if ($r === false) {
             if ($r === false) {
                 error_log('Conversion to B&W of '.$path.' failed in '.__FILE__.' at line '.__LINE__);
                 error_log('Conversion to B&W of '.$path.' failed in '.__FILE__.' at line '.__LINE__);

+ 85 - 85
main/inc/lib/fileUpload.lib.php

@@ -94,7 +94,7 @@ function process_uploaded_file($uploaded_file, $show_output = true)
                 if ($show_output) {
                 if ($show_output) {
                     Display::addFlash(
                     Display::addFlash(
                         Display::return_message(
                         Display::return_message(
-                            get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size),
+                            get_lang('UplExceedMaxPostSize').format_file_size($max_file_size),
                             'error'
                             'error'
                         )
                         )
                     );
                     );
@@ -118,7 +118,7 @@ function process_uploaded_file($uploaded_file, $show_output = true)
                 if ($show_output) {
                 if ($show_output) {
                     Display::addFlash(
                     Display::addFlash(
                         Display::return_message(
                         Display::return_message(
-                            get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst'),
+                            get_lang('UplNoFileUploaded').' '.get_lang('UplSelectFileFirst'),
                             'error'
                             'error'
                         )
                         )
                     );
                     );
@@ -476,7 +476,7 @@ function handle_uploaded_document(
                             if ($output) {
                             if ($output) {
                                 Display::addFlash(
                                 Display::addFlash(
                                     Display::return_message(
                                     Display::return_message(
-                                        get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle . ' ' . get_lang('UplFileOverwritten'),
+                                        get_lang('UplUploadSucceeded').'<br /> '.$documentTitle.' '.get_lang('UplFileOverwritten'),
                                         'confirmation',
                                         'confirmation',
                                         false
                                         false
                                     )
                                     )
@@ -613,7 +613,7 @@ function handle_uploaded_document(
                         if ($output) {
                         if ($output) {
                             Display::addFlash(
                             Display::addFlash(
                                 Display::return_message(
                                 Display::return_message(
-                                    get_lang('UplUploadSucceeded') . '<br />' . get_lang('UplFileSavedAs') . ' ' . $documentTitle,
+                                    get_lang('UplUploadSucceeded').'<br />'.get_lang('UplFileSavedAs').' '.$documentTitle,
                                     'success',
                                     'success',
                                     false
                                     false
                                 )
                                 )
@@ -690,7 +690,7 @@ function handle_uploaded_document(
                             if ($output) {
                             if ($output) {
                                 Display::addFlash(
                                 Display::addFlash(
                                     Display::display_confirmation_message(
                                     Display::display_confirmation_message(
-                                        get_lang('UplUploadSucceeded') . '<br /> ' . $documentTitle,
+                                        get_lang('UplUploadSucceeded').'<br /> '.$documentTitle,
                                         false,
                                         false,
                                         true
                                         true
                                     )
                                     )
@@ -776,12 +776,12 @@ function enough_size($file_size, $dir, $max_dir_space)
 function dir_total_space($dir_path)
 function dir_total_space($dir_path)
 {
 {
     $save_dir = getcwd();
     $save_dir = getcwd();
-    chdir($dir_path) ;
+    chdir($dir_path);
     $handle = opendir($dir_path);
     $handle = opendir($dir_path);
     $sumSize = 0;
     $sumSize = 0;
     $dirList = array();
     $dirList = array();
     while ($element = readdir($handle)) {
     while ($element = readdir($handle)) {
-        if ( $element == '.' || $element == '..') {
+        if ($element == '.' || $element == '..') {
             continue; // Skip the current and parent directories
             continue; // Skip the current and parent directories
         }
         }
         if (is_file($element)) {
         if (is_file($element)) {
@@ -792,11 +792,11 @@ function dir_total_space($dir_path)
         }
         }
     }
     }
 
 
-    closedir($handle) ;
+    closedir($handle);
 
 
     if (sizeof($dirList) > 0) {
     if (sizeof($dirList) > 0) {
         foreach ($dirList as $j) {
         foreach ($dirList as $j) {
-            $sizeDir = dir_total_space($j);	// Recursivity
+            $sizeDir = dir_total_space($j); // Recursivity
             $sumSize += $sizeDir;
             $sumSize += $sizeDir;
         }
         }
     }
     }
@@ -830,63 +830,63 @@ function add_ext_on_mime($file_name, $file_type)
 
 
         static $mime_type = array();
         static $mime_type = array();
 
 
-        $mime_type[] = 'application/msword';             $extension[] = '.doc';
-        $mime_type[] = 'application/rtf';                $extension[] = '.rtf';
-        $mime_type[] = 'application/vnd.ms-powerpoint';  $extension[] = '.ppt';
-        $mime_type[] = 'application/vnd.ms-excel';       $extension[] = '.xls';
-        $mime_type[] = 'application/pdf';                $extension[] = '.pdf';
-        $mime_type[] = 'application/postscript';         $extension[] = '.ps';
-        $mime_type[] = 'application/mac-binhex40';       $extension[] = '.hqx';
-        $mime_type[] = 'application/x-gzip';             $extension[] = 'tar.gz';
-        $mime_type[] = 'application/x-shockwave-flash';  $extension[] = '.swf';
-        $mime_type[] = 'application/x-stuffit';          $extension[] = '.sit';
-        $mime_type[] = 'application/x-tar';              $extension[] = '.tar';
-        $mime_type[] = 'application/zip';                $extension[] = '.zip';
-        $mime_type[] = 'application/x-tar';              $extension[] = '.tar';
-        $mime_type[] = 'text/html';                      $extension[] = '.html';
-        $mime_type[] = 'text/plain';                     $extension[] = '.txt';
-        $mime_type[] = 'text/rtf';                       $extension[] = '.rtf';
-        $mime_type[] = 'img/gif';                        $extension[] = '.gif';
-        $mime_type[] = 'img/jpeg';                       $extension[] = '.jpg';
-        $mime_type[] = 'img/png';                        $extension[] = '.png';
-        $mime_type[] = 'audio/midi';                     $extension[] = '.mid';
-        $mime_type[] = 'audio/mpeg';                     $extension[] = '.mp3';
-        $mime_type[] = 'audio/x-aiff';                   $extension[] = '.aif';
-        $mime_type[] = 'audio/x-pn-realaudio';           $extension[] = '.rm';
-        $mime_type[] = 'audio/x-pn-realaudio-plugin';    $extension[] = '.rpm';
-        $mime_type[] = 'audio/x-wav';                    $extension[] = '.wav';
-        $mime_type[] = 'video/mpeg';                     $extension[] = '.mpg';
-        $mime_type[] = 'video/mpeg4-generic';            $extension[] = '.mp4';
-        $mime_type[] = 'video/quicktime';                $extension[] = '.mov';
-        $mime_type[] = 'video/x-msvideo';                $extension[] = '.avi';
-
-        $mime_type[] = 'video/x-ms-wmv';                 $extension[] = '.wmv';
-        $mime_type[] = 'video/x-flv';                    $extension[] = '.flv';
-        $mime_type[] = 'image/svg+xml';                  $extension[] = '.svg';
-        $mime_type[] = 'image/svg+xml';                  $extension[] = '.svgz';
-        $mime_type[] = 'video/ogg';                  	 $extension[] = '.ogv';
-        $mime_type[] = 'audio/ogg';                  	 $extension[] = '.oga';
-        $mime_type[] = 'application/ogg';                $extension[] = '.ogg';
-        $mime_type[] = 'application/ogg';                $extension[] = '.ogx';
-        $mime_type[] = 'application/x-freemind';         $extension[] = '.mm';
-
-        $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12';							$extension[] = '.docm';
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';	$extension[] = '.docx';
-        $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12';							$extension[] = '.dotm';
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template';	$extension[] = '.dotx';
-        $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12';					$extension[] = '.potm';
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template';		$extension[] = '.potx';
-        $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12';						$extension[] = '.ppam';
-        $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12';					$extension[] = '.ppsm';
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow';	$extension[] = '.ppsx';
-        $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12';				$extension[] = '.pptm';
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';	$extension[] = '.pptx';
-        $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12';							$extension[] = '.xlam';
-        $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12';						$extension[] = '.xlsb';
-        $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12';							$extension[] = '.xlsm';
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';			$extension[] = '.xlsx';
-        $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12';							$extension[] = '.xltm';
-        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template';		$extension[] = '.xltx';
+        $mime_type[] = 'application/msword'; $extension[] = '.doc';
+        $mime_type[] = 'application/rtf'; $extension[] = '.rtf';
+        $mime_type[] = 'application/vnd.ms-powerpoint'; $extension[] = '.ppt';
+        $mime_type[] = 'application/vnd.ms-excel'; $extension[] = '.xls';
+        $mime_type[] = 'application/pdf'; $extension[] = '.pdf';
+        $mime_type[] = 'application/postscript'; $extension[] = '.ps';
+        $mime_type[] = 'application/mac-binhex40'; $extension[] = '.hqx';
+        $mime_type[] = 'application/x-gzip'; $extension[] = 'tar.gz';
+        $mime_type[] = 'application/x-shockwave-flash'; $extension[] = '.swf';
+        $mime_type[] = 'application/x-stuffit'; $extension[] = '.sit';
+        $mime_type[] = 'application/x-tar'; $extension[] = '.tar';
+        $mime_type[] = 'application/zip'; $extension[] = '.zip';
+        $mime_type[] = 'application/x-tar'; $extension[] = '.tar';
+        $mime_type[] = 'text/html'; $extension[] = '.html';
+        $mime_type[] = 'text/plain'; $extension[] = '.txt';
+        $mime_type[] = 'text/rtf'; $extension[] = '.rtf';
+        $mime_type[] = 'img/gif'; $extension[] = '.gif';
+        $mime_type[] = 'img/jpeg'; $extension[] = '.jpg';
+        $mime_type[] = 'img/png'; $extension[] = '.png';
+        $mime_type[] = 'audio/midi'; $extension[] = '.mid';
+        $mime_type[] = 'audio/mpeg'; $extension[] = '.mp3';
+        $mime_type[] = 'audio/x-aiff'; $extension[] = '.aif';
+        $mime_type[] = 'audio/x-pn-realaudio'; $extension[] = '.rm';
+        $mime_type[] = 'audio/x-pn-realaudio-plugin'; $extension[] = '.rpm';
+        $mime_type[] = 'audio/x-wav'; $extension[] = '.wav';
+        $mime_type[] = 'video/mpeg'; $extension[] = '.mpg';
+        $mime_type[] = 'video/mpeg4-generic'; $extension[] = '.mp4';
+        $mime_type[] = 'video/quicktime'; $extension[] = '.mov';
+        $mime_type[] = 'video/x-msvideo'; $extension[] = '.avi';
+
+        $mime_type[] = 'video/x-ms-wmv'; $extension[] = '.wmv';
+        $mime_type[] = 'video/x-flv'; $extension[] = '.flv';
+        $mime_type[] = 'image/svg+xml'; $extension[] = '.svg';
+        $mime_type[] = 'image/svg+xml'; $extension[] = '.svgz';
+        $mime_type[] = 'video/ogg'; $extension[] = '.ogv';
+        $mime_type[] = 'audio/ogg'; $extension[] = '.oga';
+        $mime_type[] = 'application/ogg'; $extension[] = '.ogg';
+        $mime_type[] = 'application/ogg'; $extension[] = '.ogx';
+        $mime_type[] = 'application/x-freemind'; $extension[] = '.mm';
+
+        $mime_type[] = 'application/vnd.ms-word.document.macroEnabled.12'; $extension[] = '.docm';
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'; $extension[] = '.docx';
+        $mime_type[] = 'application/vnd.ms-word.template.macroEnabled.12'; $extension[] = '.dotm';
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'; $extension[] = '.dotx';
+        $mime_type[] = 'application/vnd.ms-powerpoint.template.macroEnabled.12'; $extension[] = '.potm';
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.template'; $extension[] = '.potx';
+        $mime_type[] = 'application/vnd.ms-powerpoint.addin.macroEnabled.12'; $extension[] = '.ppam';
+        $mime_type[] = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12'; $extension[] = '.ppsm';
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'; $extension[] = '.ppsx';
+        $mime_type[] = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12'; $extension[] = '.pptm';
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; $extension[] = '.pptx';
+        $mime_type[] = 'application/vnd.ms-excel.addin.macroEnabled.12'; $extension[] = '.xlam';
+        $mime_type[] = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12'; $extension[] = '.xlsb';
+        $mime_type[] = 'application/vnd.ms-excel.sheet.macroEnabled.12'; $extension[] = '.xlsm';
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $extension[] = '.xlsx';
+        $mime_type[] = 'application/vnd.ms-excel.template.macroEnabled.12'; $extension[] = '.xltm';
+        $mime_type[] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'; $extension[] = '.xltx';
 
 
         // Test on PC (files with no extension get application/octet-stream)
         // Test on PC (files with no extension get application/octet-stream)
         //$mime_type[] = 'application/octet-stream';      $extension[] = '.ext';
         //$mime_type[] = 'application/octet-stream';      $extension[] = '.ext';
@@ -895,7 +895,7 @@ function add_ext_on_mime($file_name, $file_type)
 
 
         foreach ($mime_type as $key => & $type) {
         foreach ($mime_type as $key => & $type) {
             if ($type == $file_type) {
             if ($type == $file_type) {
-                $file_name .=  $extension[$key];
+                $file_name .= $extension[$key];
                 break;
                 break;
             }
             }
         }
         }
@@ -971,12 +971,12 @@ function unzip_uploaded_file($uploaded_file, $upload_path, $base_work_dir, $max_
         }
         }
 
 
         // It happens on Linux that $upload_path sometimes doesn't start with '/'
         // It happens on Linux that $upload_path sometimes doesn't start with '/'
-        if ($upload_path[0] != '/' && substr($base_work_dir,-1,1) != '/') {
+        if ($upload_path[0] != '/' && substr($base_work_dir, -1, 1) != '/') {
             $upload_path = '/'.$upload_path;
             $upload_path = '/'.$upload_path;
         }
         }
 
 
         if ($upload_path[strlen($upload_path) - 1] == '/') {
         if ($upload_path[strlen($upload_path) - 1] == '/') {
-            $upload_path=substr($upload_path, 0, -1);
+            $upload_path = substr($upload_path, 0, -1);
         }
         }
 
 
         /*	Uncompressing phase */
         /*	Uncompressing phase */
@@ -988,15 +988,15 @@ function unzip_uploaded_file($uploaded_file, $upload_path, $base_work_dir, $max_
             - add it to the database
             - add it to the database
             - parse & change relative html links
             - parse & change relative html links
         */
         */
-        if (PHP_OS == 'Linux' && ! get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC ***
+        if (PHP_OS == 'Linux' && !get_cfg_var('safe_mode') && false) { // *** UGent, changed by OC ***
             // Shell Method - if this is possible, it gains some speed
             // Shell Method - if this is possible, it gains some speed
-            exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." " .$uploaded_file['tmp_name']);
+            exec("unzip -d \"".$base_work_dir.$upload_path."/\"".$uploaded_file['name']." ".$uploaded_file['tmp_name']);
         } else {
         } else {
             // PHP method - slower...
             // PHP method - slower...
             $save_dir = getcwd();
             $save_dir = getcwd();
             chdir($base_work_dir.$upload_path);
             chdir($base_work_dir.$upload_path);
             $unzippingState = $zip_file->extract();
             $unzippingState = $zip_file->extract();
-            for ($j=0; $j < count($unzippingState); $j++) {
+            for ($j = 0; $j < count($unzippingState); $j++) {
                 $state = $unzippingState[$j];
                 $state = $unzippingState[$j];
 
 
                 // Fix relative links in html files
                 // Fix relative links in html files
@@ -1010,8 +1010,8 @@ function unzip_uploaded_file($uploaded_file, $upload_path, $base_work_dir, $max_
                         if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
                         if (is_dir($base_work_dir.$upload_path.'/'.$file)) $filetype = 'folder';
 
 
                         $safe_file = api_replace_dangerous_char($file);
                         $safe_file = api_replace_dangerous_char($file);
-                        @rename($base_work_dir.$upload_path.'/'.$file,$base_work_dir.$upload_path.'/'.$safe_file);
-                        set_default_settings($upload_path, $safe_file,$filetype);
+                        @rename($base_work_dir.$upload_path.'/'.$file, $base_work_dir.$upload_path.'/'.$safe_file);
+                        set_default_settings($upload_path, $safe_file, $filetype);
                     }
                     }
                 }
                 }
 
 
@@ -1061,7 +1061,7 @@ function unzip_uploaded_document(
     $zip = new PclZip($uploaded_file['tmp_name']);
     $zip = new PclZip($uploaded_file['tmp_name']);
 
 
     // Check the zip content (real size and file extension)
     // Check the zip content (real size and file extension)
-    $zip_content_array = (array)$zip->listContent();
+    $zip_content_array = (array) $zip->listContent();
 
 
     $realSize = 0;
     $realSize = 0;
     foreach ($zip_content_array as & $this_content) {
     foreach ($zip_content_array as & $this_content) {
@@ -1163,7 +1163,7 @@ function clean_up_path($path)
 function filter_extension(&$filename)
 function filter_extension(&$filename)
 {
 {
     if (substr($filename, -1) == '/') {
     if (substr($filename, -1) == '/') {
-        return 1;  // Authorize directories
+        return 1; // Authorize directories
     }
     }
     $blacklist = api_get_setting('upload_extensions_list_type');
     $blacklist = api_get_setting('upload_extensions_list_type');
     if ($blacklist != 'whitelist') { // if = blacklist
     if ($blacklist != 'whitelist') { // if = blacklist
@@ -1396,9 +1396,9 @@ function set_default_settings($upload_path, $filename, $filetype = 'file')
     $upload_path = str_replace('//', '/', $upload_path);
     $upload_path = str_replace('//', '/', $upload_path);
 
 
     if ($upload_path == '/') {
     if ($upload_path == '/') {
-        $upload_path='';
+        $upload_path = '';
     } elseif (!empty($upload_path) && $upload_path[0] != '/') {
     } elseif (!empty($upload_path) && $upload_path[0] != '/') {
-        $upload_path="/$upload_path";
+        $upload_path = "/$upload_path";
     }
     }
 
 
     $endchar = substr($filename, strlen($filename) - 1, 1);
     $endchar = substr($filename, strlen($filename) - 1, 1);
@@ -1436,7 +1436,7 @@ function search_img_from_html($html_file) {
     $img_path_list = array();
     $img_path_list = array();
 
 
     if (!$fp = fopen($html_file, 'r')) {
     if (!$fp = fopen($html_file, 'r')) {
-        return ;
+        return;
     }
     }
 
 
     // Aearch and store occurences of the <img> tag in an array
     // Aearch and store occurences of the <img> tag in an array
@@ -1456,7 +1456,7 @@ function search_img_from_html($html_file) {
         $img_tag_list = $matches[0];
         $img_tag_list = $matches[0];
     }
     }
 
 
-    fclose ($fp);
+    fclose($fp);
     unset($buffer);
     unset($buffer);
 
 
     // Search the image file path from all the <IMG> tag detected
     // Search the image file path from all the <IMG> tag detected
@@ -1555,7 +1555,7 @@ function create_unexisting_directory(
 
 
     if (!is_dir($base_work_dir.$systemFolderName)) {
     if (!is_dir($base_work_dir.$systemFolderName)) {
         $result = mkdir(
         $result = mkdir(
-            $base_work_dir . $systemFolderName,
+            $base_work_dir.$systemFolderName,
             api_get_permissions_for_new_directories(),
             api_get_permissions_for_new_directories(),
             true
             true
         );
         );
@@ -1568,7 +1568,7 @@ function create_unexisting_directory(
                     WHERE
                     WHERE
                         c_id = $course_id AND
                         c_id = $course_id AND
                         (
                         (
-                            path = '" . Database::escape_string($systemFolderName). "'
+                            path = '".Database::escape_string($systemFolderName)."'
                         )
                         )
             ";
             ";
 
 
@@ -1724,7 +1724,7 @@ function replace_img_path_in_html_file($original_img_path, $new_img_path, $html_
 
 
     // Fix the image tags
     // Fix the image tags
 
 
-    for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb ; $i++) {
+    for ($i = 0, $fileNb = count($original_img_path); $i < $fileNb; $i++) {
         $replace_what = $original_img_path[$i];
         $replace_what = $original_img_path[$i];
         // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif
         // We only need the directory and the filename /path/to/file_html_files/missing_file.gif -> file_html_files/missing_file.gif
         $exploded_file_path = explode('/', $new_img_path[$i]);
         $exploded_file_path = explode('/', $new_img_path[$i]);
@@ -1765,7 +1765,7 @@ function create_link_file($file_path, $url)
         .'</body>'
         .'</body>'
         .'</html>';
         .'</html>';
     if (file_exists($file_path)) {
     if (file_exists($file_path)) {
-        if (!($fp = fopen ($file_path, 'w'))) {
+        if (!($fp = fopen($file_path, 'w'))) {
             return false;
             return false;
         }
         }
         return fwrite($fp, $file_content);
         return fwrite($fp, $file_content);
@@ -1802,7 +1802,7 @@ function build_missing_files_form($missing_files, $upload_path, $file_name)
 {
 {
     // Do we need a / or not?
     // Do we need a / or not?
     $added_slash = ($upload_path == '/') ? '' : '/';
     $added_slash = ($upload_path == '/') ? '' : '/';
-    $folder_id      = DocumentManager::get_document_id(api_get_course_info(), $upload_path);
+    $folder_id = DocumentManager::get_document_id(api_get_course_info(), $upload_path);
     // Build the form
     // Build the form
     $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>"
     $form = "<p><strong>".get_lang('MissingImagesDetected')."</strong></p>"
         ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">"
         ."<form method=\"post\" action=\"".api_get_self()."\" enctype=\"multipart/form-data\">"

+ 1 - 1
main/inc/lib/formvalidator/Element/Color.php

@@ -34,7 +34,7 @@ class Color extends HTML_QuickForm_text
      */
      */
     public function toHtml()
     public function toHtml()
     {
     {
-        return parent::toHtml() . <<<JS
+        return parent::toHtml().<<<JS
             <script>
             <script>
                 $(document).on('ready', function () {
                 $(document).on('ready', function () {
                     var txtColor = $('#{$this->getAttribute('id')}'),
                     var txtColor = $('#{$this->getAttribute('id')}'),

+ 23 - 23
main/lp/aicc_api.php

@@ -80,33 +80,33 @@ var G_LastError = G_NoError ;
 var commit = false ;
 var commit = false ;
 
 
 // Strictly SCORM variables.
 // Strictly SCORM variables.
-var score=<?php echo $oItem->get_score();?>;
-var max=<?php echo $oItem->get_max();?>;
-var min=<?php echo $oItem->get_min();?>;
-var lesson_status='<?php echo $oItem->get_status();?>';
-var session_time='<?php echo $oItem->get_scorm_time('js');?>';
-var suspend_data = '<?php echo $oItem->get_suspend_data();?>';
-var lesson_location = '<?php echo $oItem->get_lesson_location();?>';
-var total_time = '<?php echo $oItem->get_scorm_time('js');?>';
+var score=<?php echo $oItem->get_score(); ?>;
+var max=<?php echo $oItem->get_max(); ?>;
+var min=<?php echo $oItem->get_min(); ?>;
+var lesson_status='<?php echo $oItem->get_status(); ?>';
+var session_time='<?php echo $oItem->get_scorm_time('js'); ?>';
+var suspend_data = '<?php echo $oItem->get_suspend_data(); ?>';
+var lesson_location = '<?php echo $oItem->get_lesson_location(); ?>';
+var total_time = '<?php echo $oItem->get_scorm_time('js'); ?>';
 
 
 // Chamilo internal variables.
 // Chamilo internal variables.
 var saved_lesson_status = 'not attempted';
 var saved_lesson_status = 'not attempted';
-var lms_lp_id = <?php echo $oLP->get_id();?>;
-var lms_item_id = <?php echo $oItem->get_id();?>;
+var lms_lp_id = <?php echo $oLP->get_id(); ?>;
+var lms_item_id = <?php echo $oItem->get_id(); ?>;
 //var lms_new_item_id = 0; //temporary value (only there between a load_item() and a LMSInitialize())
 //var lms_new_item_id = 0; //temporary value (only there between a load_item() and a LMSInitialize())
 var lms_been_synchronized = 0;
 var lms_been_synchronized = 0;
 var lms_initialized = 0;
 var lms_initialized = 0;
 var lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>;
 var lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>;
-var lms_complete_lessons = <?php echo $oLP->get_complete_items_count();?>;
-var lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode;?>';
+var lms_complete_lessons = <?php echo $oLP->get_complete_items_count(); ?>;
+var lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode; ?>';
 if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';}
 if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';}
-var lms_view_id = '<?php echo $oLP->get_view();?>';
+var lms_view_id = '<?php echo $oLP->get_view(); ?>';
 if(lms_view_id == ''){ lms_view_id = 1;}
 if(lms_view_id == ''){ lms_view_id = 1;}
-var lms_user_id = '<?php echo $_user['user_id'];?>';
-var lms_next_item = '<?php echo $oLP->get_next_item_id();?>';
-var lms_previous_item = '<?php echo $oLP->get_previous_item_id();?>';
-var lms_lp_type = '<?php echo $oLP->get_type();?>';
-var lms_item_type = '<?php echo $oItem->get_type();?>';
+var lms_user_id = '<?php echo $_user['user_id']; ?>';
+var lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>';
+var lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>';
+var lms_lp_type = '<?php echo $oLP->get_type(); ?>';
+var lms_item_type = '<?php echo $oItem->get_type(); ?>';
 
 
 // Backup for old values.
 // Backup for old values.
 var old_score = 0;
 var old_score = 0;
@@ -164,11 +164,11 @@ function LMSGetValue(param) {
     }else if(param == 'cmi.core.lesson_mode'){
     }else if(param == 'cmi.core.lesson_mode'){
         result='normal';
         result='normal';
     }else if(param == 'cmi.suspend_data'){
     }else if(param == 'cmi.suspend_data'){
-        result='<?php echo $oItem->get_suspend_data();?>';
+        result='<?php echo $oItem->get_suspend_data(); ?>';
     }else if(param == 'cmi.launch_data'){
     }else if(param == 'cmi.launch_data'){
         result='';
         result='';
     }else if(param == 'cmi.objectives._count'){
     }else if(param == 'cmi.objectives._count'){
-        result='<?php echo $oItem->get_view_count();?>';
+        result='<?php echo $oItem->get_view_count(); ?>';
     }
     }
     /*
     /*
     // Switch not working??? WTF???
     // Switch not working??? WTF???
@@ -229,13 +229,13 @@ function LMSGetValue(param) {
             result='normal';
             result='normal';
             break;
             break;
         case 'cmi.suspend_data'		:
         case 'cmi.suspend_data'		:
-            result='<?php echo $oItem->get_suspend_data();?>';
+            result='<?php echo $oItem->get_suspend_data(); ?>';
             break;
             break;
         case 'cmi.launch_data'		:
         case 'cmi.launch_data'		:
             result='';
             result='';
             break;
             break;
         case 'cmi.objectives._count':
         case 'cmi.objectives._count':
-            result='<?php echo $oItem->get_view_count();?>';
+            result='<?php echo $oItem->get_view_count(); ?>';
             break;
             break;
         default 					:
         default 					:
             result='';
             result='';
@@ -287,7 +287,7 @@ function savedata(origin) { //origin can be 'commit', 'finish' or 'terminate'
     $url = $_SERVER['HTTP_HOST'].$self;
     $url = $_SERVER['HTTP_HOST'].$self;
     $url = substr($url, 0, -14); // 14 is the length of this file's name (/scorm_api.php).
     $url = substr($url, 0, -14); // 14 is the length of this file's name (/scorm_api.php).
     echo $url;
     echo $url;
-    ?>/lp_controller.php?<?php echo api_get_cidreq(); ?>&action=save&lp_id=<?php echo $oLP->get_id();?>&" + param + "";
+    ?>/lp_controller.php?<?php echo api_get_cidreq(); ?>&action=save&lp_id=<?php echo $oLP->get_id(); ?>&" + param + "";
     logit_lms('saving data (status='+lesson_status+')',1);
     logit_lms('saving data (status='+lesson_status+')',1);
     xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location);
     xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location);
     //xajax_update_pgs();
     //xajax_update_pgs();

+ 5 - 5
main/lp/lp_admin_view.php

@@ -20,8 +20,8 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
 $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
 $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
 $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
 
 
-$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null;
-$learnpath_id = (int)$_REQUEST['lp_id'];
+$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
+$learnpath_id = (int) $_REQUEST['lp_id'];
 $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
 $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
 $_course = api_get_course_info();
 $_course = api_get_course_info();
 
 
@@ -44,7 +44,7 @@ if (isset($_SESSION['gradebook'])) {
 }
 }
 
 
 if (!empty($gradebook) && $gradebook == 'view') {
 if (!empty($gradebook) && $gradebook == 'view') {
-    $interbreadcrumb[] = array (
+    $interbreadcrumb[] = array(
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook')
         'name' => get_lang('ToolGradebook')
     );
     );
@@ -85,7 +85,7 @@ if (isset($_POST['save_audio'])) {
             $in = implode(',', $lp_items_to_remove_audio);
             $in = implode(',', $lp_items_to_remove_audio);
         }
         }
     }
     }
-    if (count($lp_items_to_remove_audio)>0) {
+    if (count($lp_items_to_remove_audio) > 0) {
         $sql = "UPDATE $tbl_lp_item SET audio = '' 
         $sql = "UPDATE $tbl_lp_item SET audio = '' 
                 WHERE c_id = $course_id AND id IN (".$in.")";
                 WHERE c_id = $course_id AND id IN (".$in.")";
         $result = Database::query($sql);
         $result = Database::query($sql);
@@ -120,7 +120,7 @@ if (isset($_POST['save_audio'])) {
                 // Adding something random to prevent overwriting.
                 // Adding something random to prevent overwriting.
                 $filename_components[count($filename_components) - 1] = time();
                 $filename_components[count($filename_components) - 1] = time();
                 // Reconstructing the new filename.
                 // Reconstructing the new filename.
-                $clean_name = implode($filename_components) .'.'.$file_extension;
+                $clean_name = implode($filename_components).'.'.$file_extension;
                 // Using the new name in the $_FILES superglobal.
                 // Using the new name in the $_FILES superglobal.
                 $_FILES[$key]['name'] = $clean_name;
                 $_FILES[$key]['name'] = $clean_name;
             }
             }

+ 30 - 30
main/lp/lp_ajax_initialize.php

@@ -104,21 +104,21 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
 	$myobjectives = json_encode($phpobjectives);
 	$myobjectives = json_encode($phpobjectives);
 
 
     $return .=
     $return .=
-            "olms.score=".$myscore.";" .
-            "olms.max=".$mymax.";" .
-            "olms.min=".$mymin.";" .
-            "olms.lesson_status='".$mylesson_status."';" .
-            "olms.lesson_location='".$mylesson_location."';" .
-            "olms.session_time='".$mysession_time."';" .
-            "olms.suspend_data='".$mysuspend_data."';" .
-            "olms.total_time = '".$mytotal_time."';" .
-            "olms.mastery_score = '".$mymastery_score."';" .
-            "olms.max_time_allowed = '".$mymax_time_allowed."';" .
-            "olms.launch_data = '".$mylaunch_data."';" .
-            "olms.interactions = new Array(".$myistring.");" .
+            "olms.score=".$myscore.";".
+            "olms.max=".$mymax.";".
+            "olms.min=".$mymin.";".
+            "olms.lesson_status='".$mylesson_status."';".
+            "olms.lesson_location='".$mylesson_location."';".
+            "olms.session_time='".$mysession_time."';".
+            "olms.suspend_data='".$mysuspend_data."';".
+            "olms.total_time = '".$mytotal_time."';".
+            "olms.mastery_score = '".$mymastery_score."';".
+            "olms.max_time_allowed = '".$mymax_time_allowed."';".
+            "olms.launch_data = '".$mylaunch_data."';".
+            "olms.interactions = new Array(".$myistring.");".
             //"olms.item_objectives = new Array();" .
             //"olms.item_objectives = new Array();" .
-            "olms.item_objectives = ".$myobjectives.";" .
-            "olms.G_lastError = 0;" .
+            "olms.item_objectives = ".$myobjectives.";".
+            "olms.G_lastError = 0;".
             "olms.G_LastErrorMessage = 'No error';".
             "olms.G_LastErrorMessage = 'No error';".
             "olms.finishSignalReceived = 0;";
             "olms.finishSignalReceived = 0;";
     /*
     /*
@@ -147,22 +147,22 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item)
     $mycore_exit = $mylpi->get_core_exit();
     $mycore_exit = $mylpi->get_core_exit();
 
 
     $return .=
     $return .=
-            "olms.lms_lp_id=".$lp_id.";" .
-            "olms.lms_item_id=".$next_item.";" .
-            "olms.lms_old_item_id=0;" .
-            "olms.lms_initialized=0;" .
-            "olms.lms_view_id=".$view_id.";" .
-            "olms.lms_user_id=".$user_id.";" .
-            "olms.next_item=".$next_item.";" . // This one is very important to replace possible literal strings.
-            "olms.lms_next_item=".$mynext.";" .
-            "olms.lms_previous_item=".$myprevious.";" .
-            "olms.lms_item_type = '".$myitemtype."';" .
-            "olms.lms_item_credit = '".$mycredit."';" .
-            "olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
-            "olms.lms_item_launch_data = '".$mylaunch_data."';" .
-            "olms.lms_item_interactions_count = '".$myinteractions_count."';" .
-            "olms.lms_item_objectives_count = '".$myinteractions_count."';" .
-            "olms.lms_item_core_exit = '".$mycore_exit."';" .
+            "olms.lms_lp_id=".$lp_id.";".
+            "olms.lms_item_id=".$next_item.";".
+            "olms.lms_old_item_id=0;".
+            "olms.lms_initialized=0;".
+            "olms.lms_view_id=".$view_id.";".
+            "olms.lms_user_id=".$user_id.";".
+            "olms.next_item=".$next_item.";".// This one is very important to replace possible literal strings.
+            "olms.lms_next_item=".$mynext.";".
+            "olms.lms_previous_item=".$myprevious.";".
+            "olms.lms_item_type = '".$myitemtype."';".
+            "olms.lms_item_credit = '".$mycredit."';".
+            "olms.lms_item_lesson_mode = '".$mylesson_mode."';".
+            "olms.lms_item_launch_data = '".$mylaunch_data."';".
+            "olms.lms_item_interactions_count = '".$myinteractions_count."';".
+            "olms.lms_item_objectives_count = '".$myinteractions_count."';".
+            "olms.lms_item_core_exit = '".$mycore_exit."';".
             "olms.asset_timer = 0;";
             "olms.asset_timer = 0;";
 
 
     $mylp->set_error_msg('');
     $mylp->set_error_msg('');

+ 4 - 4
main/lp/lp_ajax_save_objectives.php

@@ -28,10 +28,10 @@ function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = arr
         error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0);
         error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0);
     }
     }
     $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id);
     $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id);
-    $mylpi =& $mylp->items[$item_id];
-    if (is_array($objectives) && count($objectives)>0){
-        foreach ($objectives as $index=>$objective){
-            $mylpi->add_objective($index,$objectives[$index]);
+    $mylpi = & $mylp->items[$item_id];
+    if (is_array($objectives) && count($objectives) > 0) {
+        foreach ($objectives as $index=>$objective) {
+            $mylpi->add_objective($index, $objectives[$index]);
         }
         }
         $mylpi->write_objectives_to_db();
         $mylpi->write_objectives_to_db();
     }
     }

+ 16 - 16
main/lp/lp_ajax_switch_item_toc.php

@@ -127,22 +127,22 @@ function switch_item_toc($lpId, $userId, $viewId, $currentItem, $nextItem)
     $coreExit = $myLPI->get_core_exit();
     $coreExit = $myLPI->get_core_exit();
 
 
     $return .=
     $return .=
-        "olms.lms_lp_id=".$lpId.";" .
-        "olms.lms_item_id=".$newItemId.";" .
-        "olms.lms_old_item_id=".$oldItemId.";" .
-        "olms.lms_initialized=0;" .
-        "olms.lms_view_id=".$viewId.";" .
-        "olms.lms_user_id=".$userId.";" .
-        "olms.next_item=".$newItemId.";" . // This one is very important to replace possible literal strings.
-        "olms.lms_next_item=".$nextItemId.";" .
-        "olms.lms_previous_item=".$previousItemId.";" .
-        "olms.lms_item_type = '".$itemType."';" .
-        "olms.lms_item_credit = '".$credit."';" .
-        "olms.lms_item_lesson_mode = '".$lessonMode."';" .
-        "olms.lms_item_launch_data = '".$launchData."';" .
-        "olms.lms_item_interactions_count = '".$interactionsCount."';" .
-        "olms.lms_item_objectives_count = '".$objectivesCount."';" .
-        "olms.lms_item_core_exit = '".$coreExit."';" .
+        "olms.lms_lp_id=".$lpId.";".
+        "olms.lms_item_id=".$newItemId.";".
+        "olms.lms_old_item_id=".$oldItemId.";".
+        "olms.lms_initialized=0;".
+        "olms.lms_view_id=".$viewId.";".
+        "olms.lms_user_id=".$userId.";".
+        "olms.next_item=".$newItemId.";".// This one is very important to replace possible literal strings.
+        "olms.lms_next_item=".$nextItemId.";".
+        "olms.lms_previous_item=".$previousItemId.";".
+        "olms.lms_item_type = '".$itemType."';".
+        "olms.lms_item_credit = '".$credit."';".
+        "olms.lms_item_lesson_mode = '".$lessonMode."';".
+        "olms.lms_item_launch_data = '".$launchData."';".
+        "olms.lms_item_interactions_count = '".$interactionsCount."';".
+        "olms.lms_item_objectives_count = '".$objectivesCount."';".
+        "olms.lms_item_core_exit = '".$coreExit."';".
         "olms.asset_timer = 0;";
         "olms.asset_timer = 0;";
 
 
     $return .= "update_toc('unhighlight','".$currentItem."');".
     $return .= "update_toc('unhighlight','".$currentItem."');".

+ 31 - 31
main/lp/scorm_api.php

@@ -25,7 +25,7 @@ $use_anonymous = true;
 
 
 require_once __DIR__.'/../inc/global.inc.php';
 require_once __DIR__.'/../inc/global.inc.php';
 
 
-$file   = (empty($_SESSION['file'])?'':$_SESSION['file']);
+$file = (empty($_SESSION['file']) ? '' : $_SESSION['file']);
 /** @var learnpath $oLP */
 /** @var learnpath $oLP */
 $oLP = unserialize($_SESSION['lpobject']);
 $oLP = unserialize($_SESSION['lpobject']);
 /** @var learnpathItem $oItem */
 /** @var learnpathItem $oItem */
@@ -41,7 +41,7 @@ $userId = api_get_user_id();
 
 
 header('Content-type: text/javascript');
 header('Content-type: text/javascript');
 
 
-?>var scorm_logs=<?php echo ((empty($oLP->scorm_debug) or (!api_is_course_admin() && !api_is_platform_admin()) )?'0':'3');?>; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame
+?>var scorm_logs=<?php echo ((empty($oLP->scorm_debug) or (!api_is_course_admin() && !api_is_platform_admin())) ? '0' : '3'); ?>; //debug log level for SCORM. 0 = none, 1=light, 2=a lot, 3=all - displays logs in log frame
 var lms_logs = 0; //debug log level for LMS actions. 0=none, 1=light, 2=a lot, 3=all
 var lms_logs = 0; //debug log level for LMS actions. 0=none, 1=light, 2=a lot, 3=all
 
 
 // API Object initialization (eases access later on)
 // API Object initialization (eases access later on)
@@ -144,25 +144,25 @@ olms.finishSignalReceived = 0;
 olms.statusSignalReceived = 0;
 olms.statusSignalReceived = 0;
 
 
 // Strictly scorm variables
 // Strictly scorm variables
-olms.score=<?php echo $oItem->get_score();?>;
-olms.max='<?php echo $oItem->get_max();?>';
-olms.min='<?php echo $oItem->get_min();?>';
-olms.lesson_status='<?php echo $oItem->get_status();?>';
-olms.session_time='<?php echo $oItem->get_scorm_time('js');?>';
-olms.suspend_data = '<?php echo $oItem->get_suspend_data();?>';
-olms.lesson_location = '<?php echo $oItem->get_lesson_location();?>';
-olms.total_time = '<?php echo $oItem->get_scorm_time('js');?>';
-olms.mastery_score = '<?php echo $oItem->get_mastery_score();?>';
+olms.score=<?php echo $oItem->get_score(); ?>;
+olms.max='<?php echo $oItem->get_max(); ?>';
+olms.min='<?php echo $oItem->get_min(); ?>';
+olms.lesson_status='<?php echo $oItem->get_status(); ?>';
+olms.session_time='<?php echo $oItem->get_scorm_time('js'); ?>';
+olms.suspend_data = '<?php echo $oItem->get_suspend_data(); ?>';
+olms.lesson_location = '<?php echo $oItem->get_lesson_location(); ?>';
+olms.total_time = '<?php echo $oItem->get_scorm_time('js'); ?>';
+olms.mastery_score = '<?php echo $oItem->get_mastery_score(); ?>';
 olms.launch_data = '<?php echo $oItem->get_launch_data(); ?>';
 olms.launch_data = '<?php echo $oItem->get_launch_data(); ?>';
-olms.max_time_allowed = '<?php echo $oItem->get_max_time_allowed();?>';
-olms.interactions = new Array(<?php echo $oItem->get_interactions_js_array();?>);
+olms.max_time_allowed = '<?php echo $oItem->get_max_time_allowed(); ?>';
+olms.interactions = new Array(<?php echo $oItem->get_interactions_js_array(); ?>);
 olms.item_objectives = new Array();
 olms.item_objectives = new Array();
 olms.info_lms_item = new Array();
 olms.info_lms_item = new Array();
 
 
 // Chamilo internal variables (not SCORM)
 // Chamilo internal variables (not SCORM)
 // olms.saved_lesson_status = 'not attempted';
 // olms.saved_lesson_status = 'not attempted';
-olms.lms_lp_id = <?php echo $oLP->get_id();?>;
-olms.lms_item_id = <?php echo $oItem->get_id();?>;
+olms.lms_lp_id = <?php echo $oLP->get_id(); ?>;
+olms.lms_item_id = <?php echo $oItem->get_id(); ?>;
 olms.lms_initialized = 0;
 olms.lms_initialized = 0;
 // switch_finished indicates if the switch process is finished (if it has gone
 // switch_finished indicates if the switch process is finished (if it has gone
 // through LMSInitialize() for the new item. Until then, all LMSSetValue()
 // through LMSInitialize() for the new item. Until then, all LMSSetValue()
@@ -171,26 +171,26 @@ olms.lms_initialized = 0;
 olms.switch_finished = 0;
 olms.switch_finished = 0;
 
 
 //olms.lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>;
 //olms.lms_total_lessons = <?php echo $oLP->get_total_items_count(); ?>;
-//olms.lms_complete_lessons = <?php echo $oLP->get_complete_items_count();?>;
-//olms.lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode;?>';
+//olms.lms_complete_lessons = <?php echo $oLP->get_complete_items_count(); ?>;
+//olms.lms_progress_bar_mode = '<?php echo $oLP->progress_bar_mode; ?>';
 //if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';}
 //if(lms_progress_bar_mode == ''){lms_progress_bar_mode='%';}
 
 
-olms.lms_view_id = '<?php echo $oLP->get_view();?>';
+olms.lms_view_id = '<?php echo $oLP->get_view(); ?>';
 if(olms.lms_view_id == ''){ olms.lms_view_id = 1;}
 if(olms.lms_view_id == ''){ olms.lms_view_id = 1;}
-olms.lms_user_id = '<?php echo $userId;?>';
-olms.lms_next_item = '<?php echo $oLP->get_next_item_id();?>';
-olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id();?>';
-olms.lms_lp_type = '<?php echo $oLP->get_type();?>';
-olms.lms_item_type = '<?php echo $oItem->get_type();?>';
-olms.lms_item_credit = '<?php echo $oItem->get_credit();?>';
-olms.lms_item_lesson_mode = '<?php echo $oItem->get_lesson_mode();?>';
-olms.lms_item_launch_data = '<?php echo addslashes($oItem->get_launch_data());?>';
-olms.lms_item_core_exit = '<?php echo $oItem->get_core_exit();?>';
+olms.lms_user_id = '<?php echo $userId; ?>';
+olms.lms_next_item = '<?php echo $oLP->get_next_item_id(); ?>';
+olms.lms_previous_item = '<?php echo $oLP->get_previous_item_id(); ?>';
+olms.lms_lp_type = '<?php echo $oLP->get_type(); ?>';
+olms.lms_item_type = '<?php echo $oItem->get_type(); ?>';
+olms.lms_item_credit = '<?php echo $oItem->get_credit(); ?>';
+olms.lms_item_lesson_mode = '<?php echo $oItem->get_lesson_mode(); ?>';
+olms.lms_item_launch_data = '<?php echo addslashes($oItem->get_launch_data()); ?>';
+olms.lms_item_core_exit = '<?php echo $oItem->get_core_exit(); ?>';
 olms.lms_course_id = '<?php echo $oLP->get_course_int_id(); ?>';
 olms.lms_course_id = '<?php echo $oLP->get_course_int_id(); ?>';
 olms.lms_session_id = '<?php echo api_get_session_id(); ?>';
 olms.lms_session_id = '<?php echo api_get_session_id(); ?>';
 olms.lms_course_code = '<?php echo $oLP->getCourseCode(); ?>';
 olms.lms_course_code = '<?php echo $oLP->getCourseCode(); ?>';
 olms.lms_course_id =  '<?php echo $oLP->get_course_int_id(); ?>';
 olms.lms_course_id =  '<?php echo $oLP->get_course_int_id(); ?>';
-<?php echo $oLP->get_items_details_as_js('olms.lms_item_types');?>
+<?php echo $oLP->get_items_details_as_js('olms.lms_item_types'); ?>
 
 
 // Following definition of cmi.core.score.raw in SCORM 1.2, "LMS should
 // Following definition of cmi.core.score.raw in SCORM 1.2, "LMS should
 // initialize this to an empty string ("") upon initial launch of a SCO. The
 // initialize this to an empty string ("") upon initial launch of a SCO. The
@@ -227,8 +227,8 @@ $(document).ready(function() {
     logit_scorm('Other SCORM calls are shown in orange.', 1);
     logit_scorm('Other SCORM calls are shown in orange.', 1);
     logit_lms('To add new messages to these logs, use logit_lms() or logit_scorm().');
     logit_lms('To add new messages to these logs, use logit_lms() or logit_scorm().');
 
 
-    olms.info_lms_item[0] = '<?php echo $oItem->get_id();?>';
-    olms.info_lms_item[1] = '<?php echo $oItem->get_id();?>';
+    olms.info_lms_item[0] = '<?php echo $oItem->get_id(); ?>';
+    olms.info_lms_item[1] = '<?php echo $oItem->get_id(); ?>';
 
 
     $("#content_id").load(function() {
     $("#content_id").load(function() {
         logit_lms('#content_id load event starts');
         logit_lms('#content_id load event starts');
@@ -499,7 +499,7 @@ function LMSGetValue(param) {
         result = 'id,score,status';
         result = 'id,score,status';
     } else if(param == 'cmi.objectives._count'){
     } else if(param == 'cmi.objectives._count'){
     // ---- cmi.objectives._count
     // ---- cmi.objectives._count
-        //result='<?php echo $oItem->get_view_count();?>';
+        //result='<?php echo $oItem->get_view_count(); ?>';
         result = olms.item_objectives.length;
         result = olms.item_objectives.length;
     } else if(param.substring(0,15)== 'cmi.objectives.'){
     } else if(param.substring(0,15)== 'cmi.objectives.'){
         var myres = '';
         var myres = '';

+ 2 - 2
main/lp/storageapi.php

@@ -103,7 +103,7 @@ function storage_get_leaders($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $s
         and sco_id = '$sv_sco'
         and sco_id = '$sv_sco'
         and course_id = '$sv_course'
         and course_id = '$sv_course'
         and sv_key = '$sv_key'
         and sv_key = '$sv_key'
-        order by sv_value ".($sv_asc ? "ASC": "DESC")." limit $sv_length";
+        order by sv_value ".($sv_asc ? "ASC" : "DESC")." limit $sv_length";
 //	$sql_data = "select sv.user_id as user_id, sv_key as variable, sv_value as value
 //	$sql_data = "select sv.user_id as user_id, sv_key as variable, sv_value as value
 //		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." sv
 //		from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)." sv
 //		where sv.user_id in (select u2.user_id from ($sql_leaders) u2)
 //		where sv.user_id in (select u2.user_id from ($sql_leaders) u2)
@@ -135,7 +135,7 @@ function storage_get_position($sv_user, $sv_course, $sv_sco, $sv_key, $sv_asc, $
         and search.sco_id = '$sv_sco'
         and search.sco_id = '$sv_sco'
         and search.course_id = '$sv_course'
         and search.course_id = '$sv_course'
         and search.sv_key = '$sv_key'
         and search.sv_key = '$sv_key'
-        and list.sv_value ".($sv_asc ? "<=": ">=")." search.sv_value
+        and list.sv_value ".($sv_asc ? "<=" : ">=")." search.sv_value
         and list.sco_id = search.sco_id
         and list.sco_id = search.sco_id
         and list.course_id = search.course_id
         and list.course_id = search.course_id
         and list.sv_key = search.sv_key
         and list.sv_key = search.sv_key

+ 13 - 13
main/tracking/courseLog.php

@@ -109,7 +109,7 @@ $js = "<script>
                             get_lang('HideColumn'),
                             get_lang('HideColumn'),
                             array('align' => 'absmiddle', 'hspace' => '3px'),
                             array('align' => 'absmiddle', 'hspace' => '3px'),
                             ICON_SIZE_SMALL
                             ICON_SIZE_SMALL
-                         ) . "</div>'
+                         )."</div>'
                     );
                     );
                 }
                 }
             );
             );
@@ -144,7 +144,7 @@ $TABLETRACK_ACCESS      = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTA
 $TABLETRACK_LINKS       = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
 $TABLETRACK_LINKS       = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
 $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
 $TABLETRACK_DOWNLOADS   = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
 $TABLETRACK_ACCESS_2    = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
 $TABLETRACK_ACCESS_2    = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
-$TABLETRACK_EXERCISES 	= Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
+$TABLETRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
 $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
 $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
 $table_user = Database::get_main_table(TABLE_MAIN_USER);
 $table_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -154,8 +154,8 @@ $sessionId = api_get_session_id();
 
 
 // Breadcrumbs.
 // Breadcrumbs.
 if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
 if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') {
-    $interbreadcrumb[] = array('url' => '../admin/index.php','name' => get_lang('PlatformAdmin'));
-    $interbreadcrumb[] = array('url' => '../session/session_list.php','name' => get_lang('SessionList'));
+    $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin'));
+    $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList'));
     $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.$sessionId, 'name' => get_lang('SessionOverview'));
     $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.$sessionId, 'name' => get_lang('SessionOverview'));
 }
 }
 
 
@@ -226,21 +226,21 @@ $actionsLeft .= Display::url(
 if (!empty($sessionId)) {
 if (!empty($sessionId)) {
     $actionsLeft .= Display::url(
     $actionsLeft .= Display::url(
         Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
         Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . 'attendance/index.php?' . api_get_cidreq() . '&action=calendar_logins'
+        api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=calendar_logins'
     );
     );
 }
 }
 
 
 $actionsRight = '<div class="pull-right">';
 $actionsRight = '<div class="pull-right">';
 $actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
 $actionsRight .= '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
-    Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
 
 
 $addional_param = '';
 $addional_param = '';
 if (isset($_GET['additional_profile_field'])) {
 if (isset($_GET['additional_profile_field'])) {
-    $addional_param ='additional_profile_field='.intval($_GET['additional_profile_field']);
+    $addional_param = 'additional_profile_field='.intval($_GET['additional_profile_field']);
 }
 }
 $users_tracking_per_page = '';
 $users_tracking_per_page = '';
 if (isset($_GET['users_tracking_per_page'])) {
 if (isset($_GET['users_tracking_per_page'])) {
-    $users_tracking_per_page= '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
+    $users_tracking_per_page = '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']);
 }
 }
 $actionsRight .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
 $actionsRight .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&'.$addional_param.$users_tracking_per_page.'">
      '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
      '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
@@ -264,7 +264,7 @@ echo Display::toolbarAction('toolbar-courselog', [$actionsLeft, $form_search->re
 $course_name = get_lang('Course').' '.$courseInfo['name'];
 $course_name = get_lang('Course').' '.$courseInfo['name'];
 if ($session_id) {
 if ($session_id) {
     $titleSession = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id);
     $titleSession = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id);
-    $titleCourse =  Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name;
+    $titleCourse = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name;
 } else {
 } else {
     $titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name'];
     $titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name'];
 }
 }
@@ -304,7 +304,7 @@ if (!empty($sessionList)) {
     $html .= '<ul class="session-list">';
     $html .= '<ul class="session-list">';
     foreach ($sessionList as $session) {
     foreach ($sessionList as $session) {
         $url = api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'].'&cidReq='.$courseInfo['code'];
         $url = api_get_path(WEB_CODE_PATH).'mySpace/course.php?session_id='.$session['id'].'&cidReq='.$courseInfo['code'];
-        $html .= Display::tag('li', $iconCourse . ' ' . Display::url($session['name'], $url));
+        $html .= Display::tag('li', $iconCourse.' '.Display::url($session['name'], $url));
     }
     }
     $html .= '</ul>';
     $html .= '</ul>';
 }
 }
@@ -319,12 +319,12 @@ if (count($a_students) > 0) {
     $form = new FormValidator(
     $form = new FormValidator(
         'reminder_form',
         'reminder_form',
         'get',
         'get',
-        api_get_path(WEB_CODE_PATH).'announcements/announcements.php?' . api_get_cidreq(),
+        api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
         null,
         null,
         ['style' => 'margin-bottom: 10px'],
         ['style' => 'margin-bottom: 10px'],
         FormValidator::LAYOUT_INLINE
         FormValidator::LAYOUT_INLINE
     );
     );
-    $options = array (
+    $options = array(
         2 => sprintf($getLangXDays, 2),
         2 => sprintf($getLangXDays, 2),
         3 => sprintf($getLangXDays, 3),
         3 => sprintf($getLangXDays, 3),
         4 => sprintf($getLangXDays, 4),
         4 => sprintf($getLangXDays, 4),
@@ -337,7 +337,7 @@ if (count($a_students) > 0) {
     );
     );
     $el = $form->addSelect(
     $el = $form->addSelect(
         'since',
         'since',
-        Display::returnFontAwesomeIcon('warning') . get_lang('RemindInactivesLearnersSince'),
+        Display::returnFontAwesomeIcon('warning').get_lang('RemindInactivesLearnersSince'),
         $options,
         $options,
         ['class' => 'col-sm-3']
         ['class' => 'col-sm-3']
     );
     );

+ 5 - 5
plugin/vchamilo/cli/bulkdestroynodes.php

@@ -19,7 +19,7 @@ echo "Starting tool\n";
 echo "Chamilo Bulk Nodes Creation v.1.0\n";
 echo "Chamilo Bulk Nodes Creation v.1.0\n";
 echo "=================================\n";
 echo "=================================\n";
 require_once('../../../main/inc/global.inc.php');
 require_once('../../../main/inc/global.inc.php');
-require_once('clilib.php');       // cli only functions
+require_once('clilib.php'); // cli only functions
 // Ensure errors are well explained
 // Ensure errors are well explained
 ini_set('debug_display', 1);
 ini_set('debug_display', 1);
 ini_set('debug_level', E_ALL);
 ini_set('debug_level', E_ALL);
@@ -91,19 +91,19 @@ if (!empty($options['config'])) {
     }
     }
 }
 }
 
 
-require_once($_configuration['root_sys'].'local/classes/database.class.php');       // cli only functions
+require_once($_configuration['root_sys'].'local/classes/database.class.php'); // cli only functions
 if ($options['verbose']) {
 if ($options['verbose']) {
     echo "loaded dbclass\n";
     echo "loaded dbclass\n";
 }
 }
-require_once($_configuration['root_sys'].'local/classes/textlib.class.php');       // cli only functions
+require_once($_configuration['root_sys'].'local/classes/textlib.class.php'); // cli only functions
 if ($options['verbose']) {
 if ($options['verbose']) {
     echo "loaded textlib\n";
     echo "loaded textlib\n";
 }
 }
-require_once($_configuration['root_sys'].'local/classes/mootochamlib.php');       // moodle like API
+require_once($_configuration['root_sys'].'local/classes/mootochamlib.php'); // moodle like API
 if ($options['verbose']) {
 if ($options['verbose']) {
     echo "loaded moodle wrapping\n";
     echo "loaded moodle wrapping\n";
 }
 }
-require_once($_configuration['root_sys'] . '/plugin/vchamilo/lib/vchamilo_plugin.class.php');
+require_once($_configuration['root_sys'].'/plugin/vchamilo/lib/vchamilo_plugin.class.php');
 if ($options['verbose']) {
 if ($options['verbose']) {
     echo "loaded vchamilo plugin\n";
     echo "loaded vchamilo plugin\n";
 }
 }

+ 10 - 10
plugin/vchamilo/cli/clilib.php

@@ -6,12 +6,12 @@ exit;
 * @param string $location
 * @param string $location
 *
 *
 */
 */
-function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null){
+function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null) {
     global $_configuration;
     global $_configuration;
 
 
     $vnodes = array();
     $vnodes = array();
 
 
-    if (empty($nodelistlocation)){
+    if (empty($nodelistlocation)) {
         $nodelistlocation = $_configuratioh['root_sys'].'/plugin/vchamilo/nodelist.csv';
         $nodelistlocation = $_configuratioh['root_sys'].'/plugin/vchamilo/nodelist.csv';
     }
     }
 
 
@@ -70,7 +70,7 @@ function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null){
     // Jump any empty or comment line
     // Jump any empty or comment line
     $text = fgets($fp, 1024);
     $text = fgets($fp, 1024);
     $i = 0;
     $i = 0;
-    while(vchamilo_is_empty_line_or_format($text, $i == 0)){
+    while (vchamilo_is_empty_line_or_format($text, $i == 0)) {
         $text = fgets($fp, 1024);
         $text = fgets($fp, 1024);
         $i++;
         $i++;
     }
     }
@@ -80,7 +80,7 @@ function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null){
     // Check for valid field names
     // Check for valid field names
     foreach ($headers as $h) {
     foreach ($headers as $h) {
         $header[] = trim($h);
         $header[] = trim($h);
-        $patternized = implode('|', $patterns) . "\\d+";
+        $patternized = implode('|', $patterns)."\\d+";
         $metapattern = implode('|', $metas);
         $metapattern = implode('|', $metas);
         if (!(isset($required[$h]) ||
         if (!(isset($required[$h]) ||
                 isset($optionalDefaults[$h]) ||
                 isset($optionalDefaults[$h]) ||
@@ -109,7 +109,7 @@ function vchamilo_parse_csv_nodelist($nodelistlocation = '', $plugin = null){
     $linenum = 2; // Since header is line 1.
     $linenum = 2; // Since header is line 1.
 
 
     // Take some from admin profile, other fixed by hardcoded defaults.
     // Take some from admin profile, other fixed by hardcoded defaults.
-    while (!feof ($fp)) {
+    while (!feof($fp)) {
 
 
         // Make a new base record.
         // Make a new base record.
         $vnode = new StdClass();
         $vnode = new StdClass();
@@ -196,7 +196,7 @@ function vchamilo_is_empty_line_or_format(&$text, $resetfirst = false) {
  * @param bool $casesensitive true if options are case sensitive
  * @param bool $casesensitive true if options are case sensitive
  * @return string entered text
  * @return string entered text
  */
  */
-function cli_input($prompt, $default='', array $options=null, $casesensitiveoptions=false) {
+function cli_input($prompt, $default = '', array $options = null, $casesensitiveoptions = false) {
     echo $prompt;
     echo $prompt;
     echo "\n: ";
     echo "\n: ";
     $input = fread(STDIN, 2048);
     $input = fread(STDIN, 2048);
@@ -222,8 +222,8 @@ function cli_input($prompt, $default='', array $options=null, $casesensitiveopti
  * @param array $shortmapping array describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose')
  * @param array $shortmapping array describing mapping of short to long style options ex:('h'=>'help', 'v'=>'verbose')
  * @return array array of arrays, options, unrecognised as optionlongname=>value
  * @return array array of arrays, options, unrecognised as optionlongname=>value
  */
  */
-function cli_get_params(array $longoptions, array $shortmapping=null) {
-    $shortmapping = (array)$shortmapping;
+function cli_get_params(array $longoptions, array $shortmapping = null) {
+    $shortmapping = (array) $shortmapping;
     $options      = array();
     $options      = array();
     $unrecognized = array();
     $unrecognized = array();
 
 
@@ -292,7 +292,7 @@ function cli_get_params(array $longoptions, array $shortmapping=null) {
  * @param bool $return false means print, true return as string
  * @param bool $return false means print, true return as string
  * @return mixed void or string
  * @return mixed void or string
  */
  */
-function cli_separator($return=false) {
+function cli_separator($return = false) {
     $separator = str_repeat('-', 79)."\n";
     $separator = str_repeat('-', 79)."\n";
     if ($return) {
     if ($return) {
         return $separator;
         return $separator;
@@ -307,7 +307,7 @@ function cli_separator($return=false) {
  * @param bool $return false means print, true return as string
  * @param bool $return false means print, true return as string
  * @return mixed void or string
  * @return mixed void or string
  */
  */
-function cli_heading($string, $return=false) {
+function cli_heading($string, $return = false) {
     $string = "== $string ==\n";
     $string = "== $string ==\n";
     if ($return) {
     if ($return) {
         return $string;
         return $string;

+ 29 - 29
plugin/vchamilo/vcron.php

@@ -31,13 +31,13 @@ define('LOWEST_POSSIBLE_GAP', 1);
 global $VCRON;
 global $VCRON;
 
 
 $VCRON = new stdClass();
 $VCRON = new stdClass();
-$VCRON->ACTIVATION = 'cli';                         // choose how individual cron are launched, 'cli' or 'web'
-$VCRON->STRATEGY = ROUND_ROBIN ;                    // choose vcron rotation mode
-$VCRON->PERIOD = 15 * MINSECS ;                     // used if LOWEST_POSSIBLE_GAP to setup the max gap
-$VCRON->TIMEOUT = 300;                              // time out for CURL call to effective cron
+$VCRON->ACTIVATION = 'cli'; // choose how individual cron are launched, 'cli' or 'web'
+$VCRON->STRATEGY = ROUND_ROBIN; // choose vcron rotation mode
+$VCRON->PERIOD = 15 * MINSECS; // used if LOWEST_POSSIBLE_GAP to setup the max gap
+$VCRON->TIMEOUT = 300; // time out for CURL call to effective cron
 // $VCRON->TRACE = $_configuration['root_sys'].'plugin/vchamilo/log/vcrontrace.log';   // Trace file where to collect cron outputs
 // $VCRON->TRACE = $_configuration['root_sys'].'plugin/vchamilo/log/vcrontrace.log';   // Trace file where to collect cron outputs
-$VCRON->TRACE = '/data/log/chamilo/vcrontrace.log';   // Trace file where to collect cron outputs
-$VCRON->TRACE_ENABLE = true;                        // enables tracing
+$VCRON->TRACE = '/data/log/chamilo/vcrontrace.log'; // Trace file where to collect cron outputs
+$VCRON->TRACE_ENABLE = true; // enables tracing
 
 
 if (!is_dir($_configuration['root_sys'].'plugin/vchamilo/log')) {
 if (!is_dir($_configuration['root_sys'].'plugin/vchamilo/log')) {
     mkdir($_configuration['root_sys'].'plugin/vchamilo/log', 0777, true);
     mkdir($_configuration['root_sys'].'plugin/vchamilo/log', 0777, true);
@@ -98,32 +98,32 @@ function fire_vhost_cron($vhost) {
     $timestamp_receive = time();
     $timestamp_receive = time();
 
 
     if ($rawresponse === false) {
     if ($rawresponse === false) {
-        $error = curl_errno($ch) .':'. curl_error($ch);
-        if ($VCRON->TRACE_ENABLE){
-            if ($CRONTRACE){
-                fputs($CRONTRACE, "VCron start on $vhost->root_web : ".api_time_to_hms($timestamp_send)."\n" );
+        $error = curl_errno($ch).':'.curl_error($ch);
+        if ($VCRON->TRACE_ENABLE) {
+            if ($CRONTRACE) {
+                fputs($CRONTRACE, "VCron start on $vhost->root_web : ".api_time_to_hms($timestamp_send)."\n");
                 fputs($CRONTRACE, "VCron Error : $error \n");
                 fputs($CRONTRACE, "VCron Error : $error \n");
-                fputs($CRONTRACE, "VCron stop on $vhost->root_web : $timestamp_receive\n#################\n\n" );
+                fputs($CRONTRACE, "VCron stop on $vhost->root_web : $timestamp_receive\n#################\n\n");
                 fclose($CRONTRACE);
                 fclose($CRONTRACE);
             }
             }
         }
         }
-        echo("VCron started on $vhost->root_web : ".api_time_to_hms($timestamp_send)."\n" );
+        echo("VCron started on $vhost->root_web : ".api_time_to_hms($timestamp_send)."\n");
         echo("VCron Error : $error \n");
         echo("VCron Error : $error \n");
-        echo("VCron stop on $vhost->root_web : ".api_time_to_hms($timestamp_receive)."\n#################\n\n" );
+        echo("VCron stop on $vhost->root_web : ".api_time_to_hms($timestamp_receive)."\n#################\n\n");
         return false;
         return false;
     }
     }
 
 
     if ($VCRON->TRACE_ENABLE) {
     if ($VCRON->TRACE_ENABLE) {
         if ($CRONTRACE) {
         if ($CRONTRACE) {
-            fputs($CRONTRACE, "VCron start on $vhost->vhostname : ".api_time_to_hms($timestamp_send)."\n" );
+            fputs($CRONTRACE, "VCron start on $vhost->vhostname : ".api_time_to_hms($timestamp_send)."\n");
             fputs($CRONTRACE, $rawresponse."\n");
             fputs($CRONTRACE, $rawresponse."\n");
-            fputs($CRONTRACE, "VCron stop on $vhost->vhostname : ".api_time_to_hms($timestamp_receive)."\n#################\n\n" );
+            fputs($CRONTRACE, "VCron stop on $vhost->vhostname : ".api_time_to_hms($timestamp_receive)."\n#################\n\n");
             fclose($CRONTRACE);
             fclose($CRONTRACE);
         }
         }
     }
     }
-    echo("VCron start on $vhost->root_web : ".api_time_to_hms($timestamp_send)."\n" );
+    echo("VCron start on $vhost->root_web : ".api_time_to_hms($timestamp_send)."\n");
     echo($rawresponse."\n");
     echo($rawresponse."\n");
-    echo("VCron stop on $vhost->root_web : ".api_time_to_hms($timestamp_receive)."\n#################\n\n" );
+    echo("VCron stop on $vhost->root_web : ".api_time_to_hms($timestamp_receive)."\n#################\n\n");
     $vhost->lastcrongap = time() - $vhost->lastcron;
     $vhost->lastcrongap = time() - $vhost->lastcron;
     $vhost->lastcron = $timestamp_send;
     $vhost->lastcron = $timestamp_send;
     $vhost->croncount++;
     $vhost->croncount++;
@@ -131,7 +131,7 @@ function fire_vhost_cron($vhost) {
     $vhostid = $vhost->id;
     $vhostid = $vhost->id;
     unset($vhost->id);
     unset($vhost->id);
 
 
-    Database::update('vchamilo', (array)$vhost, array('id = ?' => $vhostid));
+    Database::update('vchamilo', (array) $vhost, array('id = ?' => $vhostid));
 
 
 }
 }
 
 
@@ -155,9 +155,9 @@ function exec_vhost_cron($vhost) {
 
 
     if ($VCRON->TRACE_ENABLE) {
     if ($VCRON->TRACE_ENABLE) {
         if ($CRONTRACE) {
         if ($CRONTRACE) {
-            fputs($CRONTRACE, "VCron start on $vhost->root_web : $timestamp_send\n" );
+            fputs($CRONTRACE, "VCron start on $vhost->root_web : $timestamp_send\n");
             fputs($CRONTRACE, $rawresponse."\n");
             fputs($CRONTRACE, $rawresponse."\n");
-            fputs($CRONTRACE, "VCron stop on $vhost->root_web : $timestamp_receive\n#################\n\n" );
+            fputs($CRONTRACE, "VCron stop on $vhost->root_web : $timestamp_receive\n#################\n\n");
             fclose($CRONTRACE);
             fclose($CRONTRACE);
         }
         }
     }
     }
@@ -210,14 +210,14 @@ function is_proxybypass($url)
         $match = trim($match);
         $match = trim($match);
 
 
         // try for IP match (Left side)
         // try for IP match (Left side)
-        $lhs = substr($host,0,strlen($match));
-        if (strcasecmp($match,$lhs)==0) {
+        $lhs = substr($host, 0, strlen($match));
+        if (strcasecmp($match, $lhs) == 0) {
             return true;
             return true;
         }
         }
 
 
         // try for host match (Right side)
         // try for host match (Right side)
-        $rhs = substr($host,-strlen($match));
-        if (strcasecmp($match,$rhs)==0) {
+        $rhs = substr($host, -strlen($match));
+        if (strcasecmp($match, $rhs) == 0) {
             return true;
             return true;
         }
         }
     }
     }
@@ -228,7 +228,7 @@ function is_proxybypass($url)
 
 
 // Main execution sequence
 // Main execution sequence
 
 
-if (!$vchamilos = Database::select('*', 'vchamilo', array(), 'all')){
+if (!$vchamilos = Database::select('*', 'vchamilo', array(), 'all')) {
     die("Nothing to do. No Vhosts");
     die("Nothing to do. No Vhosts");
 }
 }
 
 
@@ -241,7 +241,7 @@ echo("Last croned : ".api_get_setting('vchamilo_cron_lasthost', 'vchamilo')."\n"
 if ($VCRON->STRATEGY == ROUND_ROBIN) {
 if ($VCRON->STRATEGY == ROUND_ROBIN) {
     $rr = 0;
     $rr = 0;
     foreach ($allvhosts as $vhostassoc) {
     foreach ($allvhosts as $vhostassoc) {
-        $vhost = (object)$vhostassoc;
+        $vhost = (object) $vhostassoc;
         if ($rr == 1) {
         if ($rr == 1) {
             api_set_setting('vchamilo_cron_lasthost', $vhost->id);
             api_set_setting('vchamilo_cron_lasthost', $vhost->id);
             echo("Round Robin : ".$vhost->root_web."\n");
             echo("Round Robin : ".$vhost->root_web."\n");
@@ -253,13 +253,13 @@ if ($VCRON->STRATEGY == ROUND_ROBIN) {
 
 
             die('Done.');
             die('Done.');
         }
         }
-        if ($vhost->id == api_get_setting('vchamilo_cron_lasthost', 'vchamilo')){
+        if ($vhost->id == api_get_setting('vchamilo_cron_lasthost', 'vchamilo')) {
             $rr = 1; // take next one
             $rr = 1; // take next one
         }
         }
     }
     }
 
 
     // We were at last. Loop back and take first.
     // We were at last. Loop back and take first.
-    $firsthost = (object)$allvhosts[0];
+    $firsthost = (object) $allvhosts[0];
     api_set_setting('vchamilo_cron_lasthost', $firsthost->id, 'vchamilo');
     api_set_setting('vchamilo_cron_lasthost', $firsthost->id, 'vchamilo');
     echo("Round Robin : ".$firsthost->root_web."\n");
     echo("Round Robin : ".$firsthost->root_web."\n");
     if ($VCRON->ACTIVATION == 'cli') {
     if ($VCRON->ACTIVATION == 'cli') {
@@ -278,7 +278,7 @@ if ($VCRON->STRATEGY == ROUND_ROBIN) {
     $hostsperturn = max(1, $VCRON->PERIOD / api_get_setting('vcrontickperiod', 'vchamilo') * count($allvhosts));
     $hostsperturn = max(1, $VCRON->PERIOD / api_get_setting('vcrontickperiod', 'vchamilo') * count($allvhosts));
     $i = 0;
     $i = 0;
     foreach ($allvhosts as $vhostassoc) {
     foreach ($allvhosts as $vhostassoc) {
-        $vhost = (object)$vhostassoc;
+        $vhost = (object) $vhostassoc;
         if ((time() - $vhost->lastcron) > $VCRON->PERIOD) {
         if ((time() - $vhost->lastcron) > $VCRON->PERIOD) {
             if ($VCRON->ACTIVATION == 'cli') {
             if ($VCRON->ACTIVATION == 'cli') {
                 exec_vhost_cron($vhost);
                 exec_vhost_cron($vhost);