Browse Source

Should fix bug when creating LP with long titles and when adding images in a LP using FCKEditor see #3696

Julio Montoya 13 years ago
parent
commit
b79f4eade7

+ 94 - 120
main/newscorm/learnpath.class.php

@@ -408,19 +408,12 @@ class learnpath {
                 $display_order = 0;
             } else {
                 $previous = (int) $previous;
-                $sql = "
-                               SELECT
-                                   id,
-                                   previous_item_id,
-                                   next_item_id,
-                                   display_order
-                               FROM " . $tbl_lp_item . "
-                               WHERE
-                                   lp_id = " . $this->get_id() . " AND
-                                   id = " . $previous;
+                $sql = "SELECT id, previous_item_id, next_item_id, display_order
+						FROM " . $tbl_lp_item . "
+                        WHERE lp_id = " . $this->get_id() . " AND id = " . $previous;
 
                 $result = Database::query($sql);
-                $row = Database :: fetch_array($result);
+                $row 	= Database :: fetch_array($result);
 
                 $tmp_previous = $row['id'];
                 $next = $row['next_item_id'];
@@ -438,10 +431,10 @@ class learnpath {
 
         if ($type == 'quiz') {
             $sql = 'SELECT SUM(ponderation)
-                                FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
-                                INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
-                                ON quiz_question.id = quiz_rel_question.question_id
-                                AND quiz_rel_question.exercice_id = ' . $id;
+					FROM ' . Database :: get_course_table(TABLE_QUIZ_QUESTION) . ' as quiz_question
+                    INNER JOIN  ' . Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION) . ' as quiz_rel_question
+                    ON quiz_question.id = quiz_rel_question.question_id
+                    AND quiz_rel_question.exercice_id = ' . $id;
             $rsQuiz = Database::query($sql);
             $max_score = Database :: result($rsQuiz, 0, 0);
         } else {
@@ -449,8 +442,7 @@ class learnpath {
         }
 
         if ($prerequisites != 0) {
-            $sql_ins = "
-                            INSERT INTO " . $tbl_lp_item . " ( ".
+            $sql_ins = "INSERT INTO " . $tbl_lp_item . " ( ".
                                 "lp_id, ".
                                 "item_type, ".
                                 "ref, ".
@@ -549,11 +541,9 @@ class learnpath {
             $res_update_previous = Database::query($sql_update_order);
 
             // Update the item that should come after the new item.
-            $sql_update_ref = "
-                            UPDATE " . $tbl_lp_item . "
-                            SET ref = " . $new_item_id . "
-                            WHERE id = " . $new_item_id;
-
+            $sql_update_ref = "UPDATE " . $tbl_lp_item . "
+                               SET ref = " . $new_item_id . "
+                               WHERE id = " . $new_item_id;
             Database::query($sql_update_ref);
 
         }
@@ -4708,7 +4698,7 @@ class learnpath {
             					} else {
             						$parent_id = $item['parent_item_id'];
             						if (empty($parent_arrays)) {
-            							$parent_arrays[] = $item['id'];
+            							$parent_arrays[] = intval($item['id']);
             						}
             						$parent_arrays[] = $parent_id;            						
             						break;
@@ -4731,13 +4721,10 @@ class learnpath {
 	            		$x++;
 	            	}
 	            	$val .= "";
-	            	$generated_array = null;
-	            	//".$row."	            	
-	            	$code_str = $val."[".$arrLP[$i]['id']."][\"load_data\"] = '".$arrLP[$i]['id']."' ; ";            	
-	            	//var_dump($code_str);
+	            	$generated_array = null;            	
+	            	$code_str = $val."[".$arrLP[$i]['id']."][\"load_data\"] = '".$arrLP[$i]['id']."' ; ";
 	            	eval($code_str);	            
             	} else {            	            	
-	            	//var_dump($parent_arrays);
 	            	$elements[$parent_id]['children'][$arrLP[$i]['id']]['data'] = $row;            	
 	            	$elements[$parent_id]['children'][$arrLP[$i]['id']]['type'] = $arrLP[$i]['item_type'];
             	}
@@ -4902,6 +4889,38 @@ class learnpath {
         return $return;
     }
 
+    public function generate_lp_folder($course, $dir) {
+    	$filepath = '';
+    	//Creating learning_path folder
+    	$dir = '/learning_path';
+    	$filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
+    	$folder = null;
+    	if (!is_dir($filepath.'/'.$dir)) {
+    		$folder = create_unexisting_directory($course, api_get_user_id(), api_get_session_id(), 0, 0, $filepath, $dir , get_lang('LearningPaths'));
+    	} else {
+    		$folder = true;
+    	}
+    	
+    	$dir = '/learning_path/';
+    	//Creating LP folder
+    	if ($folder) {
+    		//Limits title size
+    		$title = api_substr(replace_dangerous_char($this->name), 0 , 80);
+    		$dir   = $dir.$title;
+    		$filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document';
+    		if (!is_dir($filepath.'/'.$dir)) {
+    			$folder = create_unexisting_directory($course, api_get_user_id(), api_get_session_id(), 0, 0, $filepath, $dir , $this->name);
+    		} else {
+    			$folder = true;
+    		}
+    		$dir = $dir.'/';
+    		if ($folder) {
+    			$filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'.$dir;
+    		}
+    	}
+    	$array =  array('dir' => $dir, 'filepath' => $filepath);
+    	return $array;
+    }
     /**
      * Create a new document //still needs some finetuning
      * @param array $_course
@@ -4922,43 +4941,19 @@ class learnpath {
         $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
         
         if (empty($_POST['dir']) && empty($_GET['dir'])) {
-            
-            //Creating learning_path folder
-            $dir = '/learning_path';
-            $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
-            $folder = null;
-            if (!is_dir($filepath.'/'.$dir)) {
-                $folder = create_unexisting_directory($_course, api_get_user_id(), api_get_session_id(), 0, 0, $filepath, $dir , get_lang('LearningPaths'));                 
-            } else {
-                $folder = true;
-            }            
-            
-            $dir = '/learning_path/';
-            //Creating LP folder
-            if ($folder) {                                
-                $title = replace_dangerous_char($this->name);
-                $dir   = $dir.$title;
-                $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
-                if (!is_dir($filepath.'/'.$dir)) {
-                    $folder = create_unexisting_directory($_course, api_get_user_id(), api_get_session_id(), 0, 0, $filepath, $dir , $this->name);    
-                } else {
-                    $folder = true;
-                }                    
-                $dir = $dir.'/';
-                if ($folder) {                    
-                    $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'.$dir;
-                }
-            }          
+            var_dump($dir);
+        	$result = $this->generate_lp_folder($_course, $dir);
+        	$dir 		= $result['dir'];
+        	$filepath 	= $result['filepath'];
         }
                 
         if (!is_dir($filepath)) {
             $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
             $dir = '/';
-        }
-        
+        }        
       
         // stripslashes() before calling replace_dangerous_char() because $_POST['title']
-        // is already escaped twice when it gets here.
+        // is already escaped twice when it gets here.        
         $title = replace_dangerous_char(stripslashes($_POST['title']));
         $title = disable_dangerous_file($title);
 
@@ -4972,10 +4967,14 @@ class learnpath {
             $tmp_filename = $filename . '_' . ++ $i;
         
         $filename = $tmp_filename . '.html';
-        $content = stripslashes(text_filter($content));
-        $content = str_replace(api_get_path(WEB_COURSE_PATH), api_get_path(REL_PATH) . 'courses/', $content);
+        $content = stripslashes($content);
+        
+        $content = str_replace(api_get_path(WEB_COURSE_PATH), api_get_path(REL_PATH).'courses/', $content);
+        
         // Change the path of mp3 to absolute.
+        
         // The first regexp deals with ../../../ urls.
+        
         $content = preg_replace("|(flashvars=\"file=)(\.+/)+|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/', $content);
         // The second regexp deals with audio/ urls.
         $content = preg_replace("|(flashvars=\"file=)([^/]+)/|", "$1" . api_get_path(REL_COURSE_PATH) . $_course['path'] . '/document/$2/', $content);
@@ -4988,7 +4987,7 @@ class learnpath {
                 fclose($fp);
 
                 $file_size = filesize($filepath . $filename);
-                $save_file_path = $dir . $filename;
+                $save_file_path = $dir.$filename;
 
                 $document_id = add_document($_course, $save_file_path, 'file', $file_size, $tmp_filename);
 
@@ -5001,10 +5000,8 @@ class learnpath {
                     if ($new_comment || $new_title) {
                         $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
                         $ct = '';
-
                         if ($new_comment)
                             $ct .= ", comment='" . Database::escape_string($new_comment). "'";
-
                         if ($new_title)
                             $ct .= ", title='" . Database :: escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset))."' ";
 
@@ -6336,7 +6333,7 @@ class learnpath {
     public function display_document_form($action = 'add', $id = 0, $extra_info = 'new') {
         global $charset;
         $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
-        $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
+        $tbl_doc 	 = Database :: get_course_table(TABLE_DOCUMENT);
 
         $path_parts = pathinfo($extra_info['dir']);
         $no_display_edit_textarea = false;
@@ -6379,7 +6376,7 @@ class learnpath {
                         WHERE id = " . Database :: escape_string($extra_info);
 
             $result = Database::query($sql_doc);
-            $row 	= Database :: fetch_array($result);
+            $row 	= Database::fetch_array($result);
 
             $explode = explode('.', $row['title']);
 
@@ -6395,14 +6392,12 @@ class learnpath {
                 $path_parts = pathinfo($row['path']);
                 $item_title = stripslashes($path_parts['filename']);
             }
-
         } else {
             $item_title = '';
             $item_description = '';
         }
-
-        $return = '	<div class="row">
-                                <div class="form_header">';
+        $return = '<div class="row">
+                    	<div class="form_header">';
 
         if ($id != 0 && is_array($extra_info))
             $parent = $extra_info['parent_item_id'];
@@ -6547,21 +6542,6 @@ class learnpath {
                     }
                 }
             }
-            // Commented the prerequisites, only visible in edit (new document).
-            //$select_prerequisites=$form->addElement('select', 'prerequisites', get_lang('Prerequisites'),null,'id="prerequisites" class="learnpath_item_form" style="width:263px;"');
-            //$select_prerequisites->addOption(get_lang('NoPrerequisites'), 0);
-
-            // Form element for uploading an mp3 file.
-            //$form->addElement('file','mp3',get_lang('UploadMp3audio'),'id="mp3" size="33"');
-            //$form->addRule('file', 'The extension of the Song file should be *.mp3', 'filename', '/^.*\.mp3$/');
-
-            /* Code deprecated - moved to lp level (not lp-item).
-            if (api_get_setting('search_enabled') === 'true') {
-                //add terms field
-                $terms = $form->addElement('text', 'terms', get_lang('SearchFeatureTerms').'&nbsp;:', 'id="idTerms" class="learnpath_item_form"');
-                $terms->setValue($item_terms);
-            }
-            */
 
             $arrHide = array ();
 
@@ -6575,20 +6555,9 @@ class learnpath {
 
                 }
             }
-
-            /*	foreach ($arrHide as $key => $value) {
-                    $select_prerequisites->addOption($value['value'], $key, 'style="padding-left:'.$value['padding'].'px;"');
-                    if ($key == $s_selected_position && $action == 'add') {
-                        $select_prerequisites -> setSelected(0);
-                    }
-                    elseif ($key == $id_prerequisite && $action == 'edit') {
-                        $select_prerequisites -> setSelected($id_prerequisite);
-                    }
-                }
-                */
+            
             if (!$no_display_add) {
                 if (($extra_info == 'new' || $extra_info['item_type'] == TOOL_DOCUMENT || $_GET['edit'] == 'true')) {
-
                     if (isset ($_POST['content']))
                         $content = stripslashes($_POST['content']);
                     elseif (is_array($extra_info)) {
@@ -6596,40 +6565,49 @@ class learnpath {
                         if (!$no_display_edit_textarea) {
                             $content = $this->display_document($extra_info['path'], false, false);
                         }
-                    }
-                    elseif (is_numeric($extra_info)) $content = $this->display_document($extra_info, false, false);
+                    } elseif (is_numeric($extra_info)) 
+                    	$content = $this->display_document($extra_info, false, false);
                     else
                         $content = '';
-
+				
                     if (!$no_display_edit_textarea) {
-                        // We need to claculate here some specific settings for the online editor.
+                        // We need to calculate here some specific settings for the online editor.
                         // The calculated settings work for documents in the Documents tool
                         // (on the root or in subfolders).
                         // For documents in native scorm packages it is unclear whether the
                         // online editor should be activated or not.
-                        $relative_path = $extra_info['dir'];
-                        if ($relative_path == 'n/') {
-                            // A new document, it is in the root of the repository.
-                            $relative_path = '';
-                            $relative_prefix = '';
-                        } else {
+                        
+                    	// A new document, it is in the root of the repository.
+                    	$relative_path 	 = '';
+                    	$relative_prefix = '';
+                    	
+                    	if (is_array($extra_info) && $extra_info != 'new') {                        	                 
                             // The document already exists. Whe have to determine its relative path towards the repository root.
-                            $relative_path = explode('/', $relative_path);
+                            $relative_path = explode('/', $extra_info['dir']);
                             $cnt = count($relative_path) - 2;
                             if ($cnt < 0) {
                                 $cnt = 0;
                             }
                             $relative_prefix = str_repeat('../', $cnt);
-                            $relative_path = array_slice($relative_path, 1, $cnt);
-                            $relative_path = implode('/', $relative_path);
+                            $relative_path 	 = array_slice($relative_path, 1, $cnt);
+                            $relative_path 	 = implode('/', $relative_path);
                             if (strlen($relative_path) > 0) {
                                 $relative_path = $relative_path . '/';
                             }
-                        }
-                        $editor_config = array('ToolbarSet' => 'LearningPathDocuments', 'Width' => '100%', 'Height' => '700', 'FullPage' => true,
-                            'CreateDocumentDir' => $relative_prefix,
-                            'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/',
-                            'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path
+                        } else {
+                        	global $_course;
+							$result = $this->generate_lp_folder($_course, '');
+							$relative_path = api_substr($result['dir'], 1, strlen($result['dir']));
+							$relative_prefix = '../../';
+                        }                        
+                                              
+                        $editor_config = array( 'ToolbarSet' 			=> 'LearningPathDocuments', 
+                        						'Width' 				=> '100%', 
+                        						'Height' 				=> '500', 
+                        						'FullPage' 				=> true,
+                            					'CreateDocumentDir' 	=> $relative_prefix,
+                            					'CreateDocumentWebDir' 	=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/',
+                            					'BaseHref' 				=> api_get_path(WEB_COURSE_PATH) . api_get_course_path().'/document/'.$relative_path
                         );
 
                         if ($_GET['action'] == 'add_item') {
@@ -6650,18 +6628,14 @@ class learnpath {
                         $form->addElement('html', '</div>');
                         $defaults['content_lp'] = $content;
                     }
-                }
-
-                elseif (is_numeric($extra_info)) {
-
+                } elseif (is_numeric($extra_info)) {
                     $form->addElement('style_submit_button', 'submit_button', get_lang('SaveDocument'), 'class="save"');
-
                     $return = $this->display_document($extra_info, true, true, true);
                     $form->addElement('html', $return);
                 }
             }
-
         }
+        
         if ($action == 'move') {
             $form->addElement('hidden', 'title', $item_title);
             $form->addElement('hidden', 'description', $item_description);

+ 2 - 23
main/newscorm/lp_add_item.php

@@ -25,15 +25,9 @@ api_protect_course_script();
 // libraries are included by default.
 
 include 'learnpath_functions.inc.php';
-//include '../resourcelinker/resourcelinker.inc.php';
 include 'resourcelinker.inc.php';
-// Rewrite the language file, sadly overwritten by resourcelinker.inc.php.
-// Name of the language file that needs to be included.
-$language_file = 'learnpath';
-
-/* Header and action code */
-
 
+$language_file = 'learnpath';
 
 $htmlHeadXtra[] = '
 <script type="text/javascript">
@@ -150,28 +144,13 @@ $htmlHeadXtra[] =  api_get_jquery_ui_js(); //jQuery
 
 $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_view = Database::get_course_table(TABLE_LP_VIEW);
 
 $isStudentView  = (int) $_REQUEST['isStudentView'];
 $learnpath_id   = (int) $_REQUEST['lp_id'];
 $submit			= $_POST['submit_button'];
-/*
-$chapter_id     = $_GET['chapter_id'];
-$title          = $_POST['title'];
-$description   = $_POST['description'];
-$Submititem     = $_POST['Submititem'];
-$action         = $_REQUEST['action'];
-$id             = (int) $_REQUEST['id'];
-$type           = $_REQUEST['type'];
-$direction      = $_REQUEST['direction'];
-$moduleid       = $_REQUEST['moduleid'];
-$prereq         = $_REQUEST['prereq'];
-$type           = $_REQUEST['type'];
-*/
-
-/* MAIN CODE */
 
 // Using the resource linker as a tool for adding resources to the learning path.
 if ($action == 'add' && $type == 'learnpathitem') {

+ 0 - 4
main/newscorm/lp_controller.php

@@ -8,10 +8,6 @@
  * @author Yannick Warnier <ywarnier@beeznest.org>
  */
 
-/**
- * Initialisation
- */
-
 $debug = 0;
 if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
 

+ 16 - 43
main/newscorm/lp_view.php

@@ -16,12 +16,10 @@
 /**
  * Code
  */
-/* INIT SECTION */
-
 $_SESSION['whereami'] = 'lp/view';
 $this_section = SECTION_COURSES;
 
-if ($lp_controller_touched != 1){
+if ($lp_controller_touched != 1) {
     header('location: lp_controller.php?action=view&item_id='.$_REQUEST['item_id']);
     exit;
 }
@@ -29,27 +27,19 @@ if ($lp_controller_touched != 1){
 /* Libraries */
 
 require_once 'back_compat.inc.php';
-//require_once '../learnpath/learnpath_functions.inc.php';
 require_once 'scorm.lib.php';
 require_once 'learnpath.class.php';
 require_once 'learnpathItem.class.php';
-//require_once 'lp_comm.common.php'; //xajax functions
 
 if (!$is_allowed_in_course) api_not_allowed();
+
 $oLearnpath     = false;
 $course_code    = api_get_course_id();
 $user_id        = api_get_user_id();
 $platform_theme = api_get_setting('stylesheets'); // Plataform's css.
 $my_style       = $platform_theme;
-// Escape external variables.
-
-/*  Header  */
-
-// Se incluye la libreria en el lp_controller.php
 
-$htmlHeadXtra[] = api_get_jquery_ui_js(); //jQuery-UI
-
-// se incluye la librería para el mini panel
+$htmlHeadXtra[] = api_get_jquery_ui_js();
 $htmlHeadXtra[] = '<script  src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.lp_minipanel.js" type="text/javascript" language="javascript"></script>';
 
 if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
@@ -64,9 +54,9 @@ if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setti
 }
 $htmlHeadXtra[] = '<script language="javascript" type="text/javascript">
 $(document).ready(function (){
-    $("div#log_content_cleaner").bind("click", function(){
-      $("div#log_content").empty();
-    });
+	$("div#log_content_cleaner").bind("click", function() {
+    	$("div#log_content").empty();
+	});
 });
 </script>';
 
@@ -107,13 +97,10 @@ if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
      api_not_allowed();
 }
 
-//$lp_item_id = learnpath::escape_string($_GET['item_id']);
-//$_SESSION['oLP']->set_current_item($lp_item_id); // Already done by lp_controller.php.
-
 // Prepare variables for the test tool (just in case) - honestly, this should disappear later on.
 $_SESSION['scorm_view_id'] = $_SESSION['oLP']->get_view_id();
 $_SESSION['scorm_item_id'] = $lp_item_id;
-$_SESSION['lp_mode'] = $_SESSION['oLP']->mode;
+$_SESSION['lp_mode'] 	   = $_SESSION['oLP']->mode;
 
 // Reinit exercises variables to avoid spacename clashes (see exercise tool)
 if (isset($exerciseResult) || isset($_SESSION['exerciseResult'])) {
@@ -125,15 +112,17 @@ unset($_SESSION['questionList']);
 /**
  * Get a link to the corresponding document.
  */
+
 if (!isset($src)) {
-     $src = '';
+    $src = '';
     switch($lp_type) {
         case 1:
             $_SESSION['oLP']->stop_previous_item();
             $htmlHeadXtra[] = '<script src="scorm_api.php" type="text/javascript" language="javascript"></script>';
             $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
-            if ($prereq_check === true) {
+            if ($prereq_check === true) {            	
                 $src = $_SESSION['oLP']->get_link('http', $lp_item_id);
+                
                 //Prevents FF 3.6 + Adobe Reader 9 bug see BT#794 when calling a pdf file in a LP.
                 $file_info = pathinfo($src);
                 if (api_strtolower(substr($file_info['extension'], 0, 3) == 'pdf')) {
@@ -175,12 +164,6 @@ if (!isset($src)) {
 
 $list = $_SESSION['oLP']->get_toc();
 $type_quiz = false;
-/*
-$current_item = $_SESSION['oLP']->items[$_SESSION['oLP']->get_current_item_id()];
-$attempt_id =  $current_item->get_attempt_id();
-error_log('get attempts'.$current_item->get_attempt_id());
-*/
-
 
 foreach($list as $toc) {
     if ($toc['id'] == $lp_item_id && ($toc['type']=='quiz')) {
@@ -214,10 +197,6 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp
         $score = (float)$row_dates['exe_result'];
         $max_score = (float)$row_dates['exe_weighting'];
 
-        /*$sql_upd_status = "UPDATE $TBL_LP_ITEM_VIEW SET status = 'completed' WHERE lp_item_id = '".(int)$safe_item_id."'
-                 AND lp_view_id = (SELECT lp_view.id FROM $TBL_LP_VIEW lp_view WHERE user_id = '".(int)$_SESSION['oLP']->user_id."' AND lp_id='".(int)$safe_id."')";
-        Database::query($sql_upd_status);*/
-
         $sql_upd_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '$max_score' WHERE id = '".(int)$safe_item_id."'";
         Database::query($sql_upd_max_score);
 
@@ -279,16 +258,15 @@ if ($_SESSION['oLP']->mode == 'embedframe') {
 <body dir="<?php echo api_get_text_direction(); ?>">
 <div id="learning_path_main"  style="width:100%;height:100%;" >
     <div id="learning_path_left_zone" style="float:left;width:280px;height:100%<?php echo $display_none;?>">
-
         <!-- header -->
         <div id="header">
             <div id="learning_path_header" style="font-size:14px;">
-                <table >
+                <table>
                     <tr>
-                        <td >
+                        <td>
                             <a href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();"><img src="../img/lp_arrow.gif" /></a>
                         </td>
-                        <td >
+                        <td>
                             <a class="link" href="lp_controller.php?action=return_to_course_homepage&<?php echo api_get_cidreq(); ?>" target="_self" onclick="javascript: window.parent.API.save_asset();">
                             <?php echo get_lang('CourseHomepageLink'); ?></a>
                         </td>
@@ -407,11 +385,7 @@ if ($_SESSION['oLP']->mode == 'embedframe') {
     </div>
     <!-- end right Zone -->
 </div>
-<script language="JavaScript" type="text/javascript">
-    // Need to be called after the <head> to be sure window.oxajax is defined.
-    //var dokeos_xajax_handler = window.oxajax;
-</script>
-<script language="JavaScript" type="text/javascript">
+<script language="javascript" type="text/javascript">
     // Resize right and left pane to full height (HUB 20-05-2010).
     function updateContentHeight() {
         document.body.style.overflow = 'hidden';
@@ -466,10 +440,9 @@ if ($_SESSION['oLP']->mode == 'embedframe') {
 }
     window.onload = updateContentHeight;
     window.onresize = updateContentHeight;
-
 -->
 </script>
 </body>
 <?php
 // Restore a global setting.
-$_setting['show_navigation_menu'] = $save_setting;
+$_setting['show_navigation_menu'] = $save_setting;

+ 1 - 25
main/newscorm/lp_view_item.php

@@ -64,21 +64,6 @@ $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
 
 $isStudentView  = (empty($_REQUEST['isStudentView']) ? 0 : (int) $_REQUEST['isStudentView']);
 $learnpath_id   = (int) $_REQUEST['lp_id'];
-/*
-$chapter_id     = $_GET['chapter_id'];
-$title          = $_POST['title'];
-$description   = $_POST['description'];
-$Submititem     = $_POST['Submititem'];
-$action         = $_REQUEST['action'];
-$id             = (int) $_REQUEST['id'];
-$type           = $_REQUEST['type'];
-$direction      = $_REQUEST['direction'];
-$moduleid       = $_REQUEST['moduleid'];
-$prereq         = $_REQUEST['prereq'];
-$type           = $_REQUEST['type'];
-*/
-
-/* MAIN CODE */
 
 // Using the resource linker as a tool for adding resources to the learning path.
 if ($action == 'add' && $type == 'learnpathitem') {
@@ -94,12 +79,6 @@ $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
 $result=Database::query($sql_query);
 $therow=Database::fetch_array($result);
 
-//$admin_output = '';
-/*
-    Course admin section
-    - all the functions not available for students - always available in this case (page only shown to admin)
-*/
-
 /* SHOWING THE ADMIN TOOLS	*/
 
 if (isset($_SESSION['gradebook'])) {
@@ -124,7 +103,6 @@ Display::display_header(null,'Path');
 //api_display_tool_title($therow['name']);
 
 $suredel = trim(get_lang('AreYouSureToDelete'));
-//$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
 ?>
 <script type='text/javascript'>
 /* <![CDATA[ */
@@ -166,6 +144,4 @@ echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
     echo '</tr>';
 echo '</table>';
 
-/* FOOTER */
-
-Display::display_footer();
+Display::display_footer();