Forráskód Böngészése

Minor - format code

jmontoyaa 8 éve
szülő
commit
ce741f7f5c

+ 13 - 8
main/newscorm/learnpath.class.php

@@ -68,10 +68,10 @@ class learnpath
     public $prerequisite = 0;
     public $prerequisite = 0;
     public $use_max_score = 1; // 1 or 0
     public $use_max_score = 1; // 1 or 0
     public $subscribeUsers = 0; // Subscribe users or not
     public $subscribeUsers = 0; // Subscribe users or not
-    public $created_on      = '';
-    public $modified_on     = '';
-    public $publicated_on   = '';
-    public $expired_on      = '';
+    public $created_on = '';
+    public $modified_on = '';
+    public $publicated_on = '';
+    public $expired_on = '';
     public $ref = null;
     public $ref = null;
     public $course_int_id;
     public $course_int_id;
     public $course_info = array();
     public $course_info = array();
@@ -1545,7 +1545,7 @@ class learnpath
         // TODO: Update the item object (can be ignored for now because refreshed).
         // TODO: Update the item object (can be ignored for now because refreshed).
         return true;
         return true;
     }
     }
-    
+
     /**
     /**
      * Static admin function exporting a learnpath into a zip file
      * Static admin function exporting a learnpath into a zip file
      * @param	string	Export type (scorm, zip, cd)
      * @param	string	Export type (scorm, zip, cd)
@@ -10545,13 +10545,18 @@ EOD;
     }
     }
 
 
     /**
     /**
-     * @return \learnpath
+     * @param string $courseCode
+     * @param int $lp_id
+     * @param int $user_id
+     *
+     * @return learnpath
      */
      */
     public static function getLpFromSession($courseCode, $lp_id, $user_id)
     public static function getLpFromSession($courseCode, $lp_id, $user_id)
     {
     {
-        $lpObject = Session::read('lpobject');
         $learnPath = null;
         $learnPath = null;
-        if (isset($lpObject)) {
+
+        $lpObject = Session::read('lpobject');
+        if ($lpObject !== null) {
             $learnPath = unserialize($lpObject);
             $learnPath = unserialize($lpObject);
         }
         }
 
 

+ 4 - 4
main/newscorm/lp_add_audio.php

@@ -16,9 +16,9 @@ require_once 'resourcelinker.inc.php';
 
 
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 
 
-$isStudentView  = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
-$learnpath_id   = (int) $_REQUEST['lp_id'];
-$submit			= isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
+$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null;
+$learnpath_id = (int)$_REQUEST['lp_id'];
+$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
 
 
 $type = isset($_GET['type']) ? $_GET['type'] : null;
 $type = isset($_GET['type']) ? $_GET['type'] : null;
 $action = isset($_GET['action']) ? $_GET['action'] : null;
 $action = isset($_GET['action']) ? $_GET['action'] : null;
@@ -165,7 +165,7 @@ $documentTree = DocumentManager::get_document_preview(
 );
 );
 
 
 $page .= $recordVoiceForm;
 $page .= $recordVoiceForm;
-$page .= $form->return_form();
+$page .= $form->returnForm();
 $page .= '<legend>'.get_lang('SelectAnAudioFileFromDocuments').'</legend>';
 $page .= '<legend>'.get_lang('SelectAnAudioFileFromDocuments').'</legend>';
 $page .= $documentTree;
 $page .= $documentTree;
 $page .= '</div>';
 $page .= '</div>';

+ 1 - 1
main/newscorm/lp_add_category.php

@@ -73,7 +73,7 @@ Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path');
 
 
 echo '<div class="actions">';
 echo '<div class="actions">';
 echo '<a href="lp_controller.php?'.api_get_cidreq().'">'.
 echo '<a href="lp_controller.php?'.api_get_cidreq().'">'.
-    Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).'</a>';
+    Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 echo '</div>';
 
 
 $form->display();
 $form->display();

+ 9 - 13
main/newscorm/lp_admin_view.php

@@ -31,13 +31,11 @@ $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'];
-$submit			= isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
+$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null;
+$learnpath_id = (int)$_REQUEST['lp_id'];
+$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
 $_course = api_get_course_info();
 $_course = api_get_course_info();
 
 
-/* MAIN CODE */
-
 // Using the resource linker as a tool for adding resources to the learning path.
 // Using the resource linker as a tool for adding resources to the learning path.
 if ($action == 'add' and $type == 'learnpathitem') {
 if ($action == 'add' and $type == 'learnpathitem') {
      $htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
      $htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
@@ -62,9 +60,9 @@ if (isset($_SESSION['gradebook'])) {
 
 
 if (!empty($gradebook) && $gradebook == 'view') {
 if (!empty($gradebook) && $gradebook == 'view') {
     $interbreadcrumb[] = array (
     $interbreadcrumb[] = array (
-            'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
-            'name' => get_lang('ToolGradebook')
-        );
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
+        'name' => get_lang('ToolGradebook')
+    );
 }
 }
 
 
 $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
 $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
@@ -87,9 +85,6 @@ if (isset($_REQUEST['updateaudio'])) {
 $show_learn_path = true;
 $show_learn_path = true;
 $lp_theme_css = $_SESSION['oLP']->get_theme();
 $lp_theme_css = $_SESSION['oLP']->get_theme();
 
 
-/* DISPLAY SECTION */
-
-
 // POST action handling (uploading mp3, deleting mp3)
 // POST action handling (uploading mp3, deleting mp3)
 if (isset($_POST['save_audio'])) {
 if (isset($_POST['save_audio'])) {
 
 
@@ -106,13 +101,14 @@ if (isset($_POST['save_audio'])) {
         }
         }
     }
     }
     if (count($lp_items_to_remove_audio)>0) {
     if (count($lp_items_to_remove_audio)>0) {
-        $sql 	= "UPDATE $tbl_lp_item SET audio = '' WHERE c_id = $course_id AND id IN (".$in.")";
+        $sql = "UPDATE $tbl_lp_item SET audio = '' 
+                WHERE c_id = $course_id AND id IN (".$in.")";
         $result = Database::query($sql);
         $result = Database::query($sql);
     }
     }
 
 
     // Uploading the audio files.
     // Uploading the audio files.
     foreach ($_FILES as $key => $value) {
     foreach ($_FILES as $key => $value) {
-        if (substr($key, 0, 7) == 'mp3file' AND !empty($_FILES[$key]['tmp_name'])) {
+        if (substr($key, 0, 7) == 'mp3file' && !empty($_FILES[$key]['tmp_name'])) {
             // The id of the learning path item.
             // The id of the learning path item.
             $lp_item_id = str_ireplace('mp3file', '', $key);
             $lp_item_id = str_ireplace('mp3file', '', $key);
 
 

+ 7 - 3
main/newscorm/lp_ajax_initialize.php

@@ -22,7 +22,8 @@ require_once '../inc/global.inc.php';
  * @param   integer Current item ID
  * @param   integer Current item ID
  * @param   integer New item ID
  * @param   integer New item ID
  */
  */
-function initialize_item($lp_id, $user_id, $view_id, $next_item) {
+function initialize_item($lp_id, $user_id, $view_id, $next_item)
+{
     global $debug;
     global $debug;
     $return = '';
     $return = '';
     if ($debug > 0) { error_log('In initialize_item('.$lp_id.','.$user_id.','.$view_id.','.$next_item.')', 0); }
     if ($debug > 0) { error_log('In initialize_item('.$lp_id.','.$user_id.','.$view_id.','.$next_item.')', 0); }
@@ -61,7 +62,9 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
      */
      */
     $myscore = $mylpi->get_score();
     $myscore = $mylpi->get_score();
     $mymax = $mylpi->get_max();
     $mymax = $mylpi->get_max();
-    if ($mymax === '') { $mymax = "''"; }
+    if ($mymax === '') {
+        $mymax = "''";
+    }
     $mymin = $mylpi->get_min();
     $mymin = $mylpi->get_min();
 
 
     $mylesson_status = $mylpi->get_status();
     $mylesson_status = $mylpi->get_status();
@@ -80,8 +83,8 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
     if (!empty($myistring)) {
     if (!empty($myistring)) {
         $myistring = substr($myistring, 1);
         $myistring = substr($myistring, 1);
     }
     }
-	// Obtention des donnees d'objectifs
 
 
+	// Obtention des donnees d'objectifs
 	$mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
 	$mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
     $course_id = api_get_course_int_id();
     $course_id = api_get_course_int_id();
 	$mylp_iv_id = $mylpi->db_item_view_id;
 	$mylp_iv_id = $mylpi->db_item_view_id;
@@ -166,6 +169,7 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
     $mylp->prerequisites_match(); // Check the prerequisites are all complete.
     $mylp->prerequisites_match(); // Check the prerequisites are all complete.
     if ($debug > 1) { error_log('Prereq_match() returned '.htmlentities($mylp->error), 0); }
     if ($debug > 1) { error_log('Prereq_match() returned '.htmlentities($mylp->error), 0); }
     if ($debug > 1) { error_log("return = $return "); }
     if ($debug > 1) { error_log("return = $return "); }
+    
     return $return;
     return $return;
 }
 }
 echo initialize_item($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid']);
 echo initialize_item($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid']);

+ 3 - 1
main/newscorm/lp_ajax_start_timer.php

@@ -11,8 +11,10 @@
  * var asset_timer
  * var asset_timer
  * @return string JavaScript time intializer
  * @return string JavaScript time intializer
  */
  */
-function start_timer() {
+function start_timer()
+{
     $time = time();
     $time = time();
     return $time; //"olms.asset_timer='$time'; olms.asset_timer_total = 0;";
     return $time; //"olms.asset_timer='$time'; olms.asset_timer_total = 0;";
 }
 }
+
 echo start_timer();
 echo start_timer();

+ 1 - 1
main/newscorm/lp_ajax_switch_item.php

@@ -223,7 +223,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
     }
     }
     // Save the new item ID for the exercise tool to use.
     // Save the new item ID for the exercise tool to use.
     $_SESSION['scorm_item_id'] = $new_item_id;
     $_SESSION['scorm_item_id'] = $new_item_id;
-    $_SESSION['lpobject']      = serialize($mylp);
+    $_SESSION['lpobject'] = serialize($mylp);
     return $return;
     return $return;
 }
 }