arnaud 14 years ago
parent
commit
ca56788dfd

+ 2 - 1
main/inc/lib/add_course.lib.inc.php

@@ -1207,7 +1207,8 @@ function update_Db_course($courseDbName, $language = null)
 		"preview_image	varchar(255)    not null default '', " . //stores the theme of the LP
 		"author 		varchar(255)    not null default '', " . //stores the theme of the LP
 		"session_id  	int	unsigned not null  default 0, " . //the session_id
-		"prerequisite  	int	unsigned not null  default 0 " . // pre requisite for next lp
+		"prerequisite  	int	unsigned not null  default 0," . // pre requisite for next lp
+    "hide_toc_frame tinyint NOT NULL DEFAULT 0".
 		")" . $charset_clause;
 	if(!Database::query($sql))
 	{

+ 1 - 0
main/install/migrate-db-1.8.6.2-1.8.7-pre.sql

@@ -168,3 +168,4 @@ ALTER TABLE lp ADD prerequisite int unsigned NOT NULL DEFAULT 0;
 ALTER TABLE student_publication MODIFY COLUMN description TEXT DEFAULT NULL;
 ALTER TABLE student_publication ADD COLUMN user_id INTEGER  NOT NULL AFTER session_id;
 INSERT INTO course_setting(variable,value,category) VALUES ('email_alert_students_on_new_homework',0,'work');
+ALTER TABLE lp ADD COLUMN hide_toc_frame TINYINT NOT NULL DEFAULT 0;

+ 3 - 1
main/lang/english/learnpath.inc.php

@@ -249,4 +249,6 @@ $ModifyHotPotatoes = "Modify hotpotatoes";
 $SaveHotpotatoes = "Save hotpotatoes";
 $ReturnToLPList = "Return to list";
 $LpPrerequisiteDescription = "Selecting another learning path as a prerequisite will hide the current prerequisite until the one in prerequisite is fully completed (100%)";
-?>
+$HideTocFrame = "Hide the table of content";
+
+?>

+ 2 - 1
main/lang/french/learnpath.inc.php

@@ -249,4 +249,5 @@ $ModifyHotPotatoes = "Modifier hotpotatoes";
 $SaveHotpotatoes = "Enregistrer hotpotatoes";
 $ReturnToLPList = "Retour liste";
 $LpPrerequisiteDescription = "Sélectionner un autre parcours comme prérequis cachera le parcours actuel jusqu'à ce que celui en prérequis soit complété à 100%";
-?>
+$HideTocFrame = "Cacher la table des matières";
+?>

+ 39 - 0
main/newscorm/learnpath.class.php

@@ -133,6 +133,7 @@ class learnpath {
 	   			$this->path = $row['path'];
 	   			$this->preview_image= $row['preview_image'];
 	   			$this->author= $row['author'];
+          $this->hide_toc_frame = $row['hide_toc_frame'];
 	   			$this->lp_session_id = $row['session_id'];
 
 	   			if ($this->type == 2) {
@@ -2156,6 +2157,20 @@ class learnpath {
 			return '';
 		}
 	}
+	/**
+	 * Gets the learnpath author
+	 * @return	string	LP's author
+	 */
+	public function get_hide_toc_frame() {
+		if ($this->debug > 0) {
+			error_log('New LP - In learnpath::get_author()', 0);
+		}
+		if (!empty ($this->hide_toc_frame)) {
+			return $this->hide_toc_frame;
+		} else {
+			return '';
+		}
+	}
 
 	/**
 	 * Generate a new prerequisites string for a given item. If this item was a sco and
@@ -3896,6 +3911,30 @@ class learnpath {
 		$res = Database::query($sql);
 		return true;
 	}
+	/**
+	* Sets the hide_toc_frame parameter of a LP (and save)
+	* @param	int	1 if frame is hiddent 0 thenelse
+	* @return   bool    Returns true if author's name is not empty
+	*/
+	public function set_hide_toc_frame($hide) {
+		if ($this->debug > 0) {
+			error_log('New LP - In learnpath::set_hide_toc_frame()', 0);
+		}
+    if (intval($hide) == $hide){
+      $this->hide_toc_frame = $hide;
+      $lp_table = Database :: get_course_table(TABLE_LP_MAIN);
+      $lp_id = $this->get_id();
+      $sql = "UPDATE $lp_table SET hide_toc_frame = '" . $this->hide_toc_frame . "' WHERE id = '$lp_id'";
+      if ($this->debug > 2) {
+        error_log('New LP - lp updated with new preview hide_toc_frame : ' . $this->author, 0);
+      }
+      $res = Database::query($sql);
+      return true;
+    }
+    else {
+      return false;
+    }
+	}
 
 	/**
 	* Sets the prerequisite of a LP (and save)

+ 1 - 0
main/newscorm/lp_controller.php

@@ -603,6 +603,7 @@ switch($action)
 			$_SESSION['oLP']->set_maker($_REQUEST['lp_maker']);
 			$_SESSION['oLP']->set_proximity($_REQUEST['lp_proximity']);
 			$_SESSION['oLP']->set_theme($_REQUEST['lp_theme']);
+			$_SESSION['oLP']->set_hide_toc_frame($_REQUEST['hide_toc_frame']);
 			$_SESSION['oLP']->set_prerequisite($_REQUEST['prerequisites']);
 
 			if ($_REQUEST['remove_picture'])

+ 11 - 2
main/newscorm/lp_edit.php

@@ -96,6 +96,8 @@ if ($lp_prox != 'local') {
 $content_proximity_select->addOption(get_lang('Local'), 'local');
 $content_proximity_select->addOption(get_lang('Remote'), 'remote');
 
+//Hide toc frame
+$hide_toc_frame = &$form->addElement('checkbox', 'hide_toc_frame', get_lang('HideTocFrame'),'', array('onclick' => '$("#lp_layout_column").toggle()' ));
 
 if (api_get_setting('allow_course_theme') == 'true') {
 	$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
@@ -156,6 +158,7 @@ $origin_select -> setSelected($s_selected_origin);
 $encoding_select -> setSelected($s_selected_encoding);
 $defaults['lp_name'] = Security::remove_XSS($_SESSION['oLP']->get_name());
 $defaults['lp_author'] = Security::remove_XSS($_SESSION['oLP']->get_author());
+$defaults['hide_toc_frame'] = Security::remove_XSS($_SESSION['oLP']->get_hide_toc_frame());
 
 // prerequisites
 $form->addElement('html', '<div class="row"><div class="label">'.get_lang('Prerequisites').'</div><div class="formw">'.$_SESSION['oLP']->display_lp_prerequisites_list().'</div></div>');
@@ -171,6 +174,12 @@ $form->addElement('hidden', 'lp_id', $_SESSION['oLP']->get_id());
 $form->setDefaults($defaults);
 echo '<table><tr><td width="550px">';
 	$form -> display();
-echo '</td><td valign="top"><img src="../img/course_setting_layout.png" /></td></tr></table>';
+if ($_SESSION['oLP']->get_hide_toc_frame() == 1  ){
+  $display_img='none';
+}
+else{
+  $display_img='block';
+}
+echo '</td><td id="lp_layout_column" style="display:'.$display_img.'"valign="top"><img src="../img/course_setting_layout.png" /></td></tr></table>';
 
-Display::display_footer();
+Display::display_footer();

+ 15 - 2
main/newscorm/lp_view.php

@@ -226,7 +226,13 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 ?>
 <body>
 <div id="learning_path_main"  style="width:100%;height:100%;" >
-    <div id="learning_path_left_zone" style="float:left;width:280px;height:100%">
+    <?php
+  if ($_SESSION['oLP']->get_hide_toc_frame()==1 and !api_is_allowed_to_edit()) {?>
+    <div id="learning_path_left_zone" style="float:left;width:280px;height:100%;display:none">
+  <?php
+  }else{?>
+    <div id="learning_path_left_zone" style="float:left;width:280px;height:100%;">
+<?php }?> 
 
 		<!-- header -->
 		<div id="header">
@@ -343,7 +349,14 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
     <!-- end left Zone -->
 
     <!-- right Zone -->
+    <?php
+  if (($_SESSION['oLP']->get_hide_toc_frame()==1) && !api_is_allowed_to_edit() ) {?>
+	<div id="learning_path_right_zone" style="height:100%">
+  <?php } else {?>
 	<div id="learning_path_right_zone" style="margin-left:282px;height:100%">
+  <?php } ?>
+
+
 	<?php
 		// hub 26-05-2010 Fullscreen or not fullscreen
 		if($_SESSION['oLP']->mode == 'fullscreen') {
@@ -420,4 +433,4 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 </body>
 <?php
 //restore global setting
-$_setting['show_navigation_menu'] = $save_setting;
+$_setting['show_navigation_menu'] = $save_setting;