Juan Carlos Raña 14 năm trước cách đây
mục cha
commit
94148ae25a

+ 10 - 10
main/admin/add_courses_to_session.php

@@ -102,10 +102,10 @@ $noPHP_SELF=true;
 
 if ($_POST['formSent']) {
 
-	$formSent=$_POST['formSent'];
-	$firstLetterCourse=$_POST['firstLetterCourse'];
-	$firstLetterSession=$_POST['firstLetterSession'];
-	$CourseList=$_POST['SessionCoursesList'];
+	$formSent              = $_POST['formSent'];
+	$firstLetterCourse     = $_POST['firstLetterCourse'];
+	$firstLetterSession    = $_POST['firstLetterSession'];
+	$CourseList            = $_POST['SessionCoursesList'];
 	if (!is_array($CourseList)) {
 		$CourseList=array();
 	}
@@ -117,12 +117,12 @@ if ($_POST['formSent']) {
 
 	$rs = Database::query("SELECT course_code FROM $tbl_session_rel_course WHERE id_session=$id_session");
 	$existingCourses = Database::store_result($rs);
-
-	$sql="SELECT id_user
-		FROM $tbl_session_rel_user
-		WHERE id_session = $id_session AND relation_type=".COURSE_RELATION_TYPE_RRHH." ";
-	$result=Database::query($sql);
-	$UserList=Database::store_result($result);
+    
+    // Updating only the RRHH users?? why?
+	//$sql="SELECT id_user FROM $tbl_session_rel_user WHERE id_session = $id_session AND relation_type=".COURSE_RELATION_TYPE_RRHH." ";
+    $sql        = "SELECT id_user FROM $tbl_session_rel_user WHERE id_session = $id_session ";
+	$result     = Database::query($sql);
+	$UserList   = Database::store_result($result);
 
 
 	foreach($CourseList as $enreg_course) {

+ 10 - 12
main/exercice/exercice.php

@@ -744,9 +744,9 @@ if ($show == 'test') {
 	 */
 	if ($origin != 'learnpath') {
 		//avoid sending empty parameters
-		$myorigin = (empty ($origin) ? '' : '&origin=' . $origin);
-		$mylpid = (empty ($learnpath_id) ? '' : '&learnpath_id=' . $learnpath_id);
-		$mylpitemid = (empty ($learnpath_item_id) ? '' : '&learnpath_item_id=' . $learnpath_item_id);
+		$myorigin     = (empty ($origin)              ? '' : '&origin=' . $origin);
+		$mylpid       = (empty ($learnpath_id)        ? '' : '&learnpath_id=' . $learnpath_id);
+		$mylpitemid   = (empty ($learnpath_item_id)   ? '' : '&learnpath_item_id=' . $learnpath_item_id);
 
 		$token = Security::get_token();
 		while ($row = Database :: fetch_array($result,'ASSOC')) {                
@@ -756,20 +756,18 @@ if ($show == 'test') {
 				$time_limits = false;
 				if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') {
 					$time_limits = true;	
-				}
-				
+				}				
 				if ($time_limits) {
 					// check if start time
-									
-					$start_time = api_strtotime($row['start_time'],'UTC');
-					$end_time   = api_strtotime($row['end_time'], 'UTC');								
-					$now 		= time();				
-				
-					$is_actived_time = false;					
+					$start_time = api_strtotime($row['start_time']);
+					$end_time   = api_strtotime($row['end_time']);          							
+					$now 		= time();          
+					$is_actived_time = false;                    
 					if ($now > $start_time && $end_time > $now ) {
 						$is_actived_time = true;
 					}
-				}		
+				}
+                
 				
 				if ($i % 2 == 0)
 					$s_class = "row_odd";

+ 2 - 2
main/exercice/exercise.class.php

@@ -16,7 +16,7 @@ define('EXERCISE_FEEDBACK_TYPE_END',0);
 define('EXERCISE_FEEDBACK_TYPE_DIRECT',1);
 define('EXERCISE_FEEDBACK_TYPE_EXAM',2);
 
-require_once '../inc/lib/exercise_show_functions.lib.php';
+require_once api_get_path(LIBRARY_PATH).'exercise_show_functions.lib.php';
 
 if(!class_exists('Exercise')):
 
@@ -2421,4 +2421,4 @@ class Exercise {
     }
 }
 endif;
-?>
+?>

+ 11 - 21
main/exercice/exercise_admin.php

@@ -12,11 +12,11 @@
 // name of the language file that needs to be included
 $language_file='exercice';
 
-include 'exercise.class.php';
-include 'question.class.php';
-include 'answer.class.php';
-include '../inc/global.inc.php';
-include 'exercise.lib.php';
+require_once 'exercise.class.php';
+require_once 'question.class.php';
+require_once 'answer.class.php';
+require_once '../inc/global.inc.php';
+require_once 'exercise.lib.php';
 $this_section=SECTION_COURSES;
 
 if(!api_is_allowed_to_edit(null,true)) {
@@ -133,18 +133,12 @@ $(document).ready(function () {
 });
 </script>';
 
-/*********************
- * INIT EXERCISE
- *********************/
+// INIT EXERCISE
 
 require_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
 $objExercise = new Exercise();
 
-/*********************
- * INIT FORM
- *********************/
- 
-
+//INIT FORM
 if(isset($_GET['exerciseId'])) {
 	$form = new FormValidator('exercise_admin', 'post', api_get_self().'?'.api_get_cidreq().'&exerciseId='.$_GET['exerciseId']);
 	$objExercise -> read (intval($_GET['exerciseId']));
@@ -156,10 +150,8 @@ if(isset($_GET['exerciseId'])) {
 
 $objExercise -> createForm ($form);
 
-/*********************
- * VALIDATE FORM
- *********************/
-if ($form -> validate()) {
+// VALIDATE FORM
+if ($form->validate()) {
 	$objExercise -> processCreation($form);
 	if ($form -> getSubmitValue('edit') == 'true') {
 		header('Location:exercice.php?message=ExerciseEdited&'.api_get_cidreq());
@@ -168,10 +160,8 @@ if ($form -> validate()) {
 		header('Location:admin.php?message=ExerciseAdded&exerciseId='.$objExercise->id);
 		exit;
 	}
-} else {
-	/*********************
-	 * DISPLAY FORM
-	 *********************/
+} else {	
+    // DISPLAY FORM	 
 	if (isset($_SESSION['gradebook'])) {
 		$gradebook=	$_SESSION['gradebook'];
 	}

+ 120 - 39
main/forum/forumfunction.inc.php

@@ -1563,22 +1563,48 @@ function get_thread_information($thread_id) {
 * @param	string	Course DB name (optional)
 * @return	resource array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[])
 * @author Christian Fasanando <christian.fasanando@dokeos.com>,
+* @todo     this function need to be improved
 * @version octubre 2008, dokeos 1.8
 */
 
 function get_thread_users_details($thread_id, $db_name = null) {
-	$t_posts = Database :: get_course_table(TABLE_FORUM_POST, (empty($db_name)?null:$db_name));
-	$t_users = Database :: get_main_table(TABLE_MAIN_USER);
-	$t_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
-
-	$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, thread_id
-			  FROM $t_posts , $t_users user, $t_course_user course_user
-			  WHERE poster_id = user.user_id
-			  AND user.user_id = course_user.user_id
-			  AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
-			  AND thread_id = '".Database::escape_string($thread_id)."'
-			  AND course_user.status NOT IN('1')
-			  AND course_code = '".api_get_course_id()."'";
+	$t_posts               = Database :: get_course_table(TABLE_FORUM_POST, (empty($db_name)?null:$db_name));
+	$t_users               = Database :: get_main_table(TABLE_MAIN_USER);
+	$t_course_user         = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
+    $t_session_rel_user    = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+    
+    $is_western_name_order = api_is_western_name_order();
+    if ($is_western_name_order) {
+        $orderby = 'ORDER BY user.firstname, user.lastname ';
+    } else {
+        $orderby = 'ORDER BY user.lastname, user.firstname';
+    }
+    
+    
+    if (api_get_session_id()) {
+        $session_info = api_get_session_info(api_get_session_id());
+        $user_to_avoid = "'".$session_info['id_coach']."', '".$session_info['session_admin_id']."'";
+        //not showing coaches
+        $sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, thread_id
+                  FROM $t_posts , $t_users user, $t_session_rel_user session_rel_user_rel_course
+                  WHERE poster_id = user.user_id
+                  AND user.user_id = session_rel_user_rel_course.id_user
+                  AND session_rel_user_rel_course.status<>'2' 
+                  AND session_rel_user_rel_course.id_user NOT IN ($user_to_avoid)
+                  AND thread_id = '".Database::escape_string($thread_id)."'
+                  AND id_session = '".api_get_session_id()."'                        
+                  AND course_code = '".api_get_course_id()."' $orderby ";
+                  
+    } else {
+    	$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, thread_id
+    			  FROM $t_posts , $t_users user, $t_course_user course_user
+    			  WHERE poster_id = user.user_id
+    			  AND user.user_id = course_user.user_id
+    			  AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
+    			  AND thread_id = '".Database::escape_string($thread_id)."'
+    			  AND course_user.status NOT IN('1')
+    			  AND course_code = '".api_get_course_id()."' $orderby";
+    }    
 	$result = Database::query($sql);
 	return $result;
 }
@@ -1589,6 +1615,7 @@ function get_thread_users_details($thread_id, $db_name = null) {
 * @param	string	Course DB name (optional)
 * @return	array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[])
 * @author Jhon Hinojosa<jhon.hinojosa@dokeos.com>,
+* @todo     this function need to be improved
 * @version octubre 2008, dokeos 1.8
 */
 
@@ -1597,21 +1624,48 @@ function get_thread_users_qualify($thread_id, $db_name = null) {
 	$t_qualify = Database :: get_course_table(TABLE_FORUM_THREAD_QUALIFY, (empty($db_name)?null:$db_name));
 	$t_users = Database :: get_main_table(TABLE_MAIN_USER);
 	$t_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
-
-  $sql = "SELECT post.poster_id, user.lastname, user.firstname, post.thread_id,user.user_id,qualify.qualify
-						FROM $t_posts post,
-						     $t_qualify qualify,
-						     $t_users user,
-						     $t_course_user course_user
-						WHERE
-						     post.poster_id = user.user_id
-						     AND post.poster_id = qualify.user_id
-						     AND user.user_id = course_user.user_id
-						     AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
-						     AND qualify.thread_id = '".Database::escape_string($thread_id)."'
-						     AND course_user.status not in('1')
-						     AND course_code = '".api_get_course_id()."'
-						GROUP BY post.poster_id ";
+    $t_session_rel_user    = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+    
+    $is_western_name_order = api_is_western_name_order();
+    if ($is_western_name_order) {
+        $orderby = 'ORDER BY user.firstname, user.lastname ';
+    } else {
+    	$orderby = 'ORDER BY user.lastname, user.firstname';
+    }
+    
+    if (api_get_session_id()) {
+        $session_info = api_get_session_info(api_get_session_id());
+        $user_to_avoid = "'".$session_info['id_coach']."', '".$session_info['session_admin_id']."'";
+        //not showing coaches
+        $sql = "SELECT DISTINCT post.poster_id, user.lastname, user.firstname, post.thread_id,user.user_id,qualify.qualify
+                  FROM $t_posts post , $t_users user, $t_session_rel_user session_rel_user_rel_course, $t_qualify qualify
+                  WHERE poster_id = user.user_id
+                  AND post.poster_id = qualify.user_id
+                  AND user.user_id = session_rel_user_rel_course.id_user
+                  AND session_rel_user_rel_course.status<>'2' 
+                  AND session_rel_user_rel_course.id_user NOT IN ($user_to_avoid)
+                  AND qualify.thread_id = '".Database::escape_string($thread_id)."
+                  AND thread_id = '".Database::escape_string($thread_id)."'
+                  AND id_session = '".api_get_session_id()."'                        
+                  AND course_code = '".api_get_course_id()."'
+                  $orderby ";                  
+    } else {
+          $sql = "SELECT DISTINCT post.poster_id, user.lastname, user.firstname, post.thread_id,user.user_id,qualify.qualify
+        						FROM $t_posts post,
+        						     $t_qualify qualify,
+        						     $t_users user,
+        						     $t_course_user course_user
+        						WHERE
+        						     post.poster_id = user.user_id
+        						     AND post.poster_id = qualify.user_id
+        						     AND user.user_id = course_user.user_id
+        						     AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
+        						     AND qualify.thread_id = '".Database::escape_string($thread_id)."'
+                                     AND post.thread_id = '".Database::escape_string($thread_id)."'
+        						     AND course_user.status not in('1')
+        						     AND course_code = '".api_get_course_id()."'
+        							 $orderby ";
+    }
 	$result = Database::query($sql);
 	return $result;
 }
@@ -1621,7 +1675,8 @@ function get_thread_users_qualify($thread_id, $db_name = null) {
 * @param 	int Thread ID
 * @param	string	Course DB name (optional)
 * @return	array Array of type ([user_id=>w,lastname=>x,firstname=>y,thread_id=>z],[])
-* @author Jhon Hinojosa<jhon.hinojosa@dokeos.com>,
+* @author   Jhon Hinojosa<jhon.hinojosa@dokeos.com>,
+* @todo     i'm a horrible function fix me
 * @version octubre 2008, dokeos 1.8
 */
 
@@ -1630,7 +1685,16 @@ function get_thread_users_not_qualify($thread_id, $db_name = null) {
 	$t_qualify = Database :: get_course_table(TABLE_FORUM_THREAD_QUALIFY, (empty($db_name)?null:$db_name));
 	$t_users = Database :: get_main_table(TABLE_MAIN_USER);
 	$t_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
-
+    $t_session_rel_user    = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
+    
+    
+    $is_western_name_order = api_is_western_name_order();
+    if ($is_western_name_order) {
+        $orderby = 'ORDER BY user.firstname, user.lastname ';
+    } else {
+        $orderby = 'ORDER BY user.lastname, user.firstname';
+    }
+    
   	$sql1 = "select user_id FROM  $t_qualify WHERE thread_id = '".$thread_id."'";
 	$result1 = Database::query($sql1);
     $cad='';
@@ -1642,15 +1706,32 @@ function get_thread_users_not_qualify($thread_id, $db_name = null) {
     } else  {
     	$cad=substr($cad,0,strlen($cad)-1);
     }
-	$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, post.thread_id
-			  FROM $t_posts post, $t_users user,$t_course_user course_user
-			  WHERE post.poster_id = user.user_id
-			  AND user.user_id NOT IN (".$cad.")
-			  AND user.user_id = course_user.user_id
-			  AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
-			  AND post.thread_id = '".Database::escape_string($thread_id)."'
-			  AND course_user.status not in('1')
-			  AND course_code = '".api_get_course_id()."'";
+    
+    if (api_get_session_id()) {
+        $session_info = api_get_session_info(api_get_session_id());
+        $user_to_avoid = "'".$session_info['id_coach']."', '".$session_info['session_admin_id']."'";
+        //not showing coaches
+        $sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, post.thread_id
+                  FROM $t_posts post , $t_users user, $t_session_rel_user session_rel_user_rel_course
+                  WHERE poster_id = user.user_id
+                  AND user.user_id NOT IN (".$cad.")
+                  AND user.user_id = session_rel_user_rel_course.id_user
+                  AND session_rel_user_rel_course.status<>'2' 
+                  AND session_rel_user_rel_course.id_user NOT IN ($user_to_avoid)
+                  AND post.thread_id = '".Database::escape_string($thread_id)."'
+                  AND id_session = '".api_get_session_id()."'                        
+                  AND course_code = '".api_get_course_id()."' $orderby ";
+    } else {    
+    	$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, post.thread_id
+    			  FROM $t_posts post, $t_users user,$t_course_user course_user
+    			  WHERE post.poster_id = user.user_id
+    			  AND user.user_id NOT IN (".$cad.")
+    			  AND user.user_id = course_user.user_id
+    			  AND course_user.relation_type<>".COURSE_RELATION_TYPE_RRHH."
+    			  AND post.thread_id = '".Database::escape_string($thread_id)."'
+    			  AND course_user.status not in('1')
+    			  AND course_code = '".api_get_course_id()."' $orderby";
+    }
 	$result = Database::query($sql);
 	return $result;
 }
@@ -1947,7 +2028,7 @@ function show_add_post_form($action='', $id='', $form_values='') {
 		// thread qualify
 		$form->addElement('static','Group', '<br /><strong>'.get_lang('AlterQualifyThread').'</strong>');
 		$form->applyFilter('numeric_calification', 'html_filter');
-		$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
+		$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
 		$form -> addElement('html','<div id="options_field" style="display:none">');
 		$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'),'Style="width:40px"');
 		$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));

BIN
main/img/go_home.png


+ 24 - 6
main/inc/banner.inc.php

@@ -13,8 +13,31 @@ require_once api_get_path(LIBRARY_PATH).'banner.lib.php';
 $session_id     = api_get_session_id();
 $session_name   = api_get_session_name($my_session_id);
 ?>
+
 <div id="wrapper">
 
+  <ul id="navigation">
+<?php 
+if (!empty($help)) { 
+?>
+        <li class="help"><a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600" class="thickbox" title="<?php echo get_lang('Help'); ?>"><img src="<?php echo api_get_path(WEB_CSS_PATH).$my_style;?>/images/help2.png" alt="<?php echo get_lang('Help');?>" title="<?php echo get_lang('Help');?>" /></a> </li>
+<?php 
+}
+if (api_get_setting('show_link_bug_notification') == 'true') { 
+?>
+    <li class="report"><a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"><img src="<?php echo api_get_path(WEB_IMG_PATH) ?>splash.png" style="vertical-align: middle;" alt="<?php echo get_lang('ReportABug') ?>" title="<?php echo get_lang('ReportABug');?>"/></a></li>
+<?php
+}
+/*
+        <li class="student">            <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600" class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
+        <li class="user-online">        <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600" class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
+        <li class="user-connect">       <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600" class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
+        <li class="student-connect">    <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600" class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
+<?php } 
+*/
+?>
+  </ul>
+
 <div id="header">
 	<div id="header1">
 		<div id="top_corner"></div>
@@ -135,11 +158,6 @@ if ($_user['user_id'] && isset($_cid)) {
 	}
 }
 
-if (api_get_setting('show_link_bug_notification') == 'true') { ?>
-    <li>|<a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank"><img src="<?php echo api_get_path(WEB_IMG_PATH) ?>splash.png" style="vertical-align: middle;" alt="<?php echo get_lang('ReportABug') ?>"/>&nbsp;<?php echo get_lang('ReportABug') ?></a></li>
-<?php
-}
-
 
 if (api_is_allowed_to_edit()) {
 		if (!empty($help)) {			
@@ -149,7 +167,7 @@ if (api_is_allowed_to_edit()) {
 			echo '|';	
 		}
 		//echo get_lang('Help');
-	?>	<?php /*	
+                /*	
 			<a href="#" onclick="javascript: MyWindow=window.open('<?php echo api_get_path(WEB_CODE_PATH).'help/help.php'; ?>?open=<?php echo $help; ?>','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=620,height=600,left=200,top=20'); return false;">
 			<img src="<?php echo api_get_path(WEB_IMG_PATH); ?>help.png" style="vertical-align: middle;" title="<?php echo get_lang('Help'); ?>" alt="<?php echo get_lang('Help'); ?>"/></a>			
 		 */?>

+ 0 - 11
main/inc/header.inc.php

@@ -119,17 +119,6 @@ if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
 <script src= "<?php echo api_get_path(WEB_LIBRARY_PATH);?>javascript/jquery.menu.js" type="text/javascript"></script>
 
-<?php if (!empty($help)) { ?>
-    <ul id="navigation">
-        <li class="help">               <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600", class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
-        <li class="report">             <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600", class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
-        <li class="student">            <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600", class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
-        <li class="user-online">        <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600", class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
-        <li class="user-connect">       <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600", class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
-        <li class="student-connect">    <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>help/help.php?open=Home&height=400&width=600", class="thickbox" title="<?php echo get_lang('Help'); ?>"></a> </li>
-</ul>
-<?php } ?>
-
 <script type="text/javascript">
 //<![CDATA[
 // This is a patch for the "__flash__removeCallback" bug, see FS#4378.

+ 12 - 0
main/inc/lib/svg-edit/extensions/ext-imagelib.js

@@ -14,6 +14,18 @@ svgEditor.addExtension("imagelib", function() {
 			url: 'extensions/imagelib/index.php',
 			//description: 'Demonstration library for SVG-edit on this server'// Chamilo change this line by below
 			description: 'Course gallery'
+		},
+		{
+			name: 'Local library',
+			url: 'extensions/imagelib/groups.php',
+			//description: 'Demonstration library for SVG-edit on this server'// Chamilo change this line by below
+			description: 'Group gallery'
+		},
+		{
+			name: 'Local library',
+			url: 'extensions/imagelib/users.php',
+			//description: 'Demonstration library for SVG-edit on this server'// Chamilo change this line by below
+			description: 'Personal gallery'
 		}, 
 		{
 			name: 'IAN Symbol Libraries',

+ 128 - 0
main/inc/lib/svg-edit/extensions/imagelib/groups.php

@@ -0,0 +1,128 @@
+<?php
+/* Integrate svg-edit libraries with Chamilo default documents
+ * @author Juan Carlos Raña Trabado
+ * @since 25/september/2010
+*/
+//Chamilo load libraries
+require_once '../../../../../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'document.lib.php';
+require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
+
+//Add security from Chamilo
+api_protect_course_script();
+api_block_anonymous_users();
+//
+
+$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
+
+$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
+$groupdirpath = $group_properties['directory'];
+$group_disk_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$groupdirpath.'/';
+$group_web_path  = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$groupdirpath.'/';
+
+//get all group files and folders
+$docs_and_folders = DocumentManager::get_all_document_data($_course, $groupdirpath, $_SESSION['_gid'], null, $is_allowed_to_edit, false);
+	
+//get all group filenames
+$array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array();
+
+if (count($array_to_search) > 0) {
+	while (list($key) = each($array_to_search)) {
+		$all_files[] = basename($array_to_search[$key]['path']);
+	}
+}
+	
+//get all svg and png group files
+$accepted_extensions = array('.svg', '.png');
+
+if (is_array($all_files) && count($all_files) > 0) {
+	foreach ($all_files as & $file) {
+		$slideshow_extension = strrchr($file, '.');
+		$slideshow_extension = strtolower($slideshow_extension);
+		if (in_array($slideshow_extension, $accepted_extensions)) {
+			$png_svg_files[] =$file;
+		}
+	}
+}
+
+?>
+<!doctype html>
+<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
+
+<body>
+
+<?php
+
+if(($group_properties['doc_state'] == 2 && ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid']))) || $group_properties['doc_state'] == 1){
+	echo '<h1>'.get_lang('GroupSingle').': '.$group_properties['name'].'</h1>';
+	echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
+	echo '<ul>';
+	foreach($png_svg_files as $filename) {
+		$image=$group_disk_path.$filename;
+		$new_sizes = api_resize_image($image, 60, 60);			
+		if (strpos($filename, "svg")){
+			echo '<li style="display:inline; padding:8px;"><a href="'.$group_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
+		}else{
+			echo '<li style="display:inline; padding:8px;"><a href="'.$group_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$group_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
+		}		
+	}
+	echo '</ul>';
+}
+else{
+	echo '<h1>'.get_lang('OnlyAccessFromYourGroup').'</h1>';
+}
+?>
+</body>
+
+<script>
+
+$('a').click(function() {
+	var href = this.href;
+	
+	// Convert Non-SVG images to data URL first 
+	// (this could also have been done server-side by the library)
+	if(this.href.indexOf('.svg') === -1) {
+
+		var meta_str = JSON.stringify({
+			name: $(this).text(),
+			id: href
+		});
+		window.top.postMessage(meta_str, "*");
+	
+		var img = new Image();
+		img.onload = function() {
+			var canvas = document.createElement("canvas");
+			canvas.width = this.width;
+			canvas.height = this.height;
+			// load the raster image into the canvas
+			canvas.getContext("2d").drawImage(this,0,0);
+			// retrieve the data: URL
+			try {
+				var dataurl = canvas.toDataURL();
+			} catch(err) {
+				// This fails in Firefox with file:// URLs :(
+				alert("Data URL conversion failed: " + err);
+				var dataurl = "";
+			}
+			window.top.postMessage('|' + href + '|' + dataurl, "*");
+		}
+		img.src = href;
+	} else {
+		// Send metadata (also indicates file is about to be sent)
+		var meta_str = JSON.stringify({
+			name: $(this).text(),
+			id: href
+		});
+		window.top.postMessage(meta_str, "*");
+		// Do ajax request for image's href value
+		$.get(href, function(data) {
+			data = '|' + href + '|' + data;
+			// This is where the magic happens!
+			window.top.postMessage(data, "*");
+			
+		}, 'html'); // 'html' is necessary to keep returned data as a string
+	}
+	return false;
+});
+
+</script>

+ 10 - 14
main/inc/lib/svg-edit/extensions/imagelib/index.php

@@ -9,7 +9,6 @@ require_once api_get_path(LIBRARY_PATH).'document.lib.php';
 //Add security from Chamilo
 api_protect_course_script();
 api_block_anonymous_users();
-//
 
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 
@@ -50,21 +49,18 @@ $web_path = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/images/gal
 
 <body>
 
-<h1>Select an image:</h1>
-
 <?php
-
+echo '<h1>'.get_lang('Course').': '.$_course['name'].'</h1>';
+echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
 echo '<ul>';
 foreach($png_svg_files as $filename) {
-		$image=$disk_path.$filename;
-		$new_sizes = api_resize_image($image, 60, 60);
-		
-if (strpos($filename, "svg")){
-	echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
-}else{
-	echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
-}
-	
+	$image=$disk_path.$filename;
+	$new_sizes = api_resize_image($image, 60, 60);
+	if (strpos($filename, "svg")){
+		echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
+	}else{
+		echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
+	}
 }
 echo '</ul>';
 ?>
@@ -121,4 +117,4 @@ $('a').click(function() {
 	return false;
 });
 
-</script>
+</script>

+ 108 - 0
main/inc/lib/svg-edit/extensions/imagelib/users.php

@@ -0,0 +1,108 @@
+<?php
+/* Integrate svg-edit libraries with Chamilo default documents
+ * @author Juan Carlos Raña Trabado
+ * @since 25/september/2010
+*/
+$language_file = array('userInfo');
+//Chamilo load libraries
+require_once '../../../../../inc/global.inc.php';
+
+//Add security from Chamilo
+api_protect_course_script();
+api_block_anonymous_users();
+//
+
+$user_disk_path = api_get_path(SYS_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
+$user_web_path = api_get_path(WEB_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
+//get all files and folders
+$scan_files = scandir($user_disk_path);
+
+//get all svg and png files
+$accepted_extensions = array('.svg', '.png');
+
+if (is_array($scan_files) && count($scan_files) > 0) {
+	foreach ($scan_files as & $file) {
+		$slideshow_extension = strrchr($file, '.');
+		$slideshow_extension = strtolower($slideshow_extension);
+		if (in_array($slideshow_extension, $accepted_extensions)) {
+			$png_svg_files[] =$file;
+		}
+	}
+}
+
+?>
+<!doctype html>
+<script src="../../jquery.js"></script><!--Chamilo TODO: compress this file and changing loads -->
+
+<body>
+
+<?php
+
+echo '<h1>'.get_lang('SocialNetwork').': '.get_lang('MyFiles').'</h1>';
+echo '<h2>'.get_lang('SelectSVGEditImage').'</h2>';
+echo '<ul>';
+foreach($png_svg_files as $filename) {
+	$image=$user_disk_path.$filename;
+	$new_sizes = api_resize_image($image, 60, 60);
+	if (strpos($filename, "svg")){
+		echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.api_get_path(WEB_IMG_PATH).'svg_medium.png" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
+	}else{
+		echo '<li style="display:inline; padding:8px;"><a href="'.$user_web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$user_web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
+	}
+}
+echo '</ul>';
+?>
+</body>
+
+<script>
+
+$('a').click(function() {
+	var href = this.href;
+	
+	// Convert Non-SVG images to data URL first 
+	// (this could also have been done server-side by the library)
+	if(this.href.indexOf('.svg') === -1) {
+
+		var meta_str = JSON.stringify({
+			name: $(this).text(),
+			id: href
+		});
+		window.top.postMessage(meta_str, "*");
+	
+		var img = new Image();
+		img.onload = function() {
+			var canvas = document.createElement("canvas");
+			canvas.width = this.width;
+			canvas.height = this.height;
+			// load the raster image into the canvas
+			canvas.getContext("2d").drawImage(this,0,0);
+			// retrieve the data: URL
+			try {
+				var dataurl = canvas.toDataURL();
+			} catch(err) {
+				// This fails in Firefox with file:// URLs :(
+				alert("Data URL conversion failed: " + err);
+				var dataurl = "";
+			}
+			window.top.postMessage('|' + href + '|' + dataurl, "*");
+		}
+		img.src = href;
+	} else {
+		// Send metadata (also indicates file is about to be sent)
+		var meta_str = JSON.stringify({
+			name: $(this).text(),
+			id: href
+		});
+		window.top.postMessage(meta_str, "*");
+		// Do ajax request for image's href value
+		$.get(href, function(data) {
+			data = '|' + href + '|' + data;
+			// This is where the magic happens!
+			window.top.postMessage(data, "*");
+			
+		}, 'html'); // 'html' is necessary to keep returned data as a string
+	}
+	return false;
+});
+
+</script>

+ 30 - 36
main/inc/lib/tracking.lib.php

@@ -354,15 +354,15 @@ class Tracking {
 						AND orig_lp_id = 0
 						AND exe_cours_id = '$course_code'
 						AND orig_lp_item_id = 0 $condition_session
-						ORDER BY exe_date DESC";
+					    ORDER BY exe_date DESC";                     
 				$res = Database::query($sql);
 				$row = Database::fetch_array($res);
 				$quiz_avg_score = 0;
 				if (!empty($row['avg_score'])) {
-					$quiz_avg_score = round($row['avg_score'],1);
+					$quiz_avg_score = round($row['avg_score'],2);
 				}
 				if(!empty($row['num_attempts'])) {
-					$quiz_avg_score = $quiz_avg_score / $row['num_attempts'];
+					$quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2);
 		        }
 		        return $quiz_avg_score;
 			}
@@ -380,12 +380,13 @@ class Tracking {
 	 * @param	int		Learning path item id (optional), for showing attempts inside a learning path $lp_id and $lp_item_id params are required.
 	 * @return  int 	count of attempts
 	 */
-	public function count_student_exercise_attempts($student_id, $course_code, $exercise_id, $lp_id = 0, $lp_item_id = 0) {
+	public function count_student_exercise_attempts($student_id, $course_code, $exercise_id, $lp_id = 0, $lp_item_id = 0, $session_id = 0) {
 
 		$course_code = Database::escape_string($course_code);
 		$course_info = CourseManager :: get_course_information($course_code);
 		$student_id  = intval($student_id);
 		$exercise_id = intval($exercise_id);
+        $session_id = intval($session_id);
 		$count_attempts = 0;
 
 		if (!empty($lp_id)) $lp_id = intval($lp_id);
@@ -399,7 +400,8 @@ class Tracking {
 					AND ex.exe_exo_id = $exercise_id
 					AND orig_lp_id = $lp_id
 					AND orig_lp_item_id = $lp_item_id
-					AND exe_user_id= $student_id ";
+					AND exe_user_id= $student_id 
+                    AND session_id = $session_id ";
 			$rs = Database::query($sql);
 			$row = Database::fetch_row($rs);
 			$count_attempts = $row[0];
@@ -429,30 +431,25 @@ class Tracking {
 
 			// Compose a filter based on optional learning paths list given
 			$condition_lp = "";
-			if(count($lp_ids) > 0) {
-				$condition_lp =" WHERE id IN(".implode(',',$lp_ids).") ";
-			}
-
-			// Compose a filter based on optional session id
-			$condition_session = "";
-			
-			$session_id = intval($session_id);
-			if (count($lp_ids) > 0) {
-				$condition_session = " AND session_id = $session_id ";
-			} else {
-				$condition_session = " WHERE session_id = $session_id ";
-			}
-		
             
-            //$sql = "SELECT id FROM $tbl_course_lp lp $condition_lp $condition_session";
+            if (!empty($lp_ids)) {
+    			if (count($lp_ids) > 0) {
+    				$condition_lp =" WHERE id IN(".implode(',',$lp_ids).") ";                    
+    			}
+            }			
+			$session_id = intval($session_id);
             $sql = "SELECT id FROM $tbl_course_lp lp $condition_lp";            
 			$res_count_lp = Database::query($sql);
 			// count the number of learning paths
-			$count_lp = Database::num_rows($res_count_lp);
 			$lp_id = array();
-			while ($row_lp = Database::fetch_array($res_count_lp)) {
-				$lp_id[] = $row_lp[0];
-			}            
+			while ($row_lp = Database::fetch_array($res_count_lp,'ASSOC')) {                
+                //$visibility = api_get_item_visibility($a_course, TOOL_LEARNPATH, $row_lp['id'], $session_id);                
+              //  if ($visibility == 1) {
+				    $lp_id[] = $row_lp['id'];
+                //}
+			}      
+            $count_lp = count($lp_id);            
+            
 			$avg_progress = 0;
 			//if there is at least one learning path and one student
 			if ($count_lp>0 && !empty($student_id)) {
@@ -466,23 +463,20 @@ class Tracking {
                 }
                 // Get last view for each student (in case of multi-attempt)
                 // Also filter on LPs of this session
-                $sql_maxes = "SELECT MAX(view_count), progress ".
-                        "FROM $tbl_course_lp_view lp_view ".
-                        "WHERE $condition_user session_id = $session_id AND ".
-                        "lp_view.lp_id IN (".implode(',',$lp_id).") ".
-                        "GROUP BY lp_id, user_id";
-                
+                $sql_maxes = "SELECT MAX(view_count), progress FROM $tbl_course_lp_view lp_view ".
+                             "WHERE $condition_user session_id = $session_id AND lp_view.lp_id IN (".implode(',',$lp_id).") ".
+                             "GROUP BY lp_id, user_id";                
                 $res_maxes = Database::query($sql_maxes);
-                $sum = $number_items = 0;
+                $sum =  0;
                 while ($row_maxes = Database::fetch_array($res_maxes)) {
                     $sum += $row_maxes[1];
-                    $number_items++;
-                }
-                if ($number_items == 0) {
-                    return 0; //not necessary to return something else if there is no view
-                }
+                }                
                 // average progress = total sum divided by the number of views
                 // summed up.
+                $number_items = count($lp_id);                
+                if ($number_items == 0) {
+                    return 0; //not necessary to return something else if there is no view
+                }                
                 if (!$return_array) {
 					$avg_progress = round($sum / $number_items, 1);
 					return $avg_progress;

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

@@ -249,4 +249,5 @@ $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%)";
+$ExerciseCantBeEditedAfterAddingToTheLP = "Exercise can't be edited after being added to the Learning Path";
 ?>

+ 3 - 0
main/lang/english/trad4all.inc.php

@@ -970,4 +970,7 @@ $IAcceptTermsAndConditions = "I have read and I accept the Terms and Conditions"
 $YouHaveToAcceptTermsAndConditions = "You have to accept our Terms and Conditions to proceed.";
 $BrowserDontSupportsSVG = "Your browser does not support SVG files. To use the drawing tool you must have an advanced browser like: Firefox or Chrome";
 $FillWithExemplaryContent = "Fill with exemplary content";
+$ToolVideoconference = "Videoconference";
+$SelectSVGEditImage = "Select a picture";
+$OnlyAccessFromYourGroup = "Only accessible from your group";
 ?>

+ 1 - 1
main/lang/italian/exercice.inc.php

@@ -358,7 +358,7 @@ $RandomAnswers = "Mescola le risposte";
 $NotMarkActivity = "Non è possibile valutare l'attività";
 $YouHaveToCreateAtLeastOneAnswer = "Devi indicare almeno una risposta valida";
 $ExerciseAttempted = "Quesito affrontato";
-$MultipleSelectCombination = "Selezione esatta";
+$MultipleSelectCombination = "Risposta esatta";
 $MultipleAnswerCombination = "Combinazione esatta";
 $ExerciceExpiredTimeMessage = "Il tempo assegnato allo svolgimento dell'esercizio è scaduto; i quesiti completati saranno comunque presi in considerazione.";
 $CopyExercise = "Duplica il quesito creandone una copia";

+ 1 - 0
main/lang/italian/forum.inc.php

@@ -143,4 +143,5 @@ $ForumcategoryLocked = "Categoria di forum bloccata";
 $PreviewImage = "Anteprima immagine";
 $UpdateImage = "Aggiorna immagine";
 $EnableTimeLimits = "Abilita tempo limite";
+$RemoveSearchResults = "Pulisci il modulo di ricerca";
 ?>

+ 1 - 0
main/lang/italian/learnpath.inc.php

@@ -249,4 +249,5 @@ $ModifyHotPotatoes = "Modifica l'elemento HotPotatoes";
 $SaveHotpotatoes = "Salva hotpotatoes";
 $ReturnToLPList = "Ritorna all'elenco";
 $LpPrerequisiteDescription = "Se un modulo didattico costituisce un prerequisito di un altro, quest'ultimo risulterà invisibile fino al completamento (100%) del primo";
+$ExerciseCantBeEditedAfterAddingToTheLP = "I Quesiti non possono essere modificati dopo esser stati aggiunti ad un modulo didattico";
 ?>

+ 4 - 1
main/lang/spanish/trad4all.inc.php

@@ -608,7 +608,7 @@ $ErrorMessage = "Mensaje de error";
 $Glossary = "Glosario";
 $Coach = "Tutor";
 $Condition = "Condición";
-$CourseSettings = "Configuración de la lección";
+$CourseSettings = "Configuración del curso";
 $EmailNotifications = "Notificaciones por e-mail";
 $UserRights = "Derechos de usuario";
 $Theming = "Tema";
@@ -971,4 +971,7 @@ $IAcceptTermsAndConditions = "He leido y acepto las condiciones del servicio";
 $YouHaveToAcceptTermsAndConditions = "Para continuar debe aceptar nuestros términos y condiciones";
 $BrowserDontSupportsSVG = "Su navegador no soporta archivos SVG. Para poder utilizar esta herramienta debe tener instalado un navegador avanzado del tipo: Firefox o Chrome";
 $FillWithExemplaryContent = "Rellenar con contenido de ejemplo";
+$ToolVideoconference = "Videoconferencia";
+$SelectSVGEditImage = "Selecciones una imagen (svg, png)";
+$OnlyAccessFromYourGroup = "Sólo accesible desde su grupo";
 ?>

+ 2 - 2
main/mySpace/myStudents.php

@@ -755,8 +755,8 @@ if ($timezone !== null) {
 		if (Database :: num_rows($result_exercices) > 0) {
 			while ($exercices = Database :: fetch_array($result_exercices)) {					
 				$exercise_id = intval($exercices['id']);
-				$count_attempts   = Tracking::count_student_exercise_attempts($student_id, $course_code, $exercise_id);
-				$score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id);
+				$count_attempts   = Tracking::count_student_exercise_attempts($student_id, $course_code, $exercise_id,$session_id);
+				$score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $session_id);                
 
 				$csv_content[] = array (
 					$exercices['title'],

+ 58 - 59
main/newscorm/learnpath.class.php

@@ -342,7 +342,7 @@ class learnpath {
      * @param int $parent
      * @param int $previous
      * @param string $type
-     * @param int $id
+     * @param int  resource ID (ref)
      * @param string $title
      * @param string $description
      * @return int
@@ -428,66 +428,65 @@ class learnpath {
 
         if ($prerequisites != 0) {
             $sql_ins = "
-                            INSERT INTO " . $tbl_lp_item . " (
-                                lp_id,
-                                item_type,
-                                ref,
-                                title,
-                                description,
-                                path,
-                                max_score,
-                                parent_item_id,
-                                previous_item_id,
-                                next_item_id,
-                                display_order,
-                                prerequisite,
-                                max_time_allowed
-
-                            ) VALUES (
-                                " . $this->get_id() . ",
-                                '" . $type . "',
-                                '',
-                                '" . $title . "',
-                                '" . $description . "',
-                                '" . $id . "',
-                                '" . $max_score . "',
-                                " . $parent . ",
-                                " . $previous . ",
-                                " . $next . ",
-                                " . ($display_order +1) . ",
-                                " . $prerequisites . ",
-                                " . $max_time_allowed . "
-                            )";
+                            INSERT INTO " . $tbl_lp_item . " ( ".
+                                "lp_id, ".
+                                "item_type, ".
+                                "ref, ".
+                                "title, ".
+                                "description, ".
+                                "path, ".
+                                "max_score, ".
+                                "parent_item_id, ".
+                                "previous_item_id, ".
+                                "next_item_id, ".
+                                "display_order, ".
+                                "prerequisite, ".
+                                "max_time_allowed ".
+                            ") VALUES ( ".
+                                $this->get_id() . ", ".
+                                "'" . $type . "', ".
+                                "'', ".
+                                "'" . $title . "', ".
+                                "'" . $description . "', ".
+                                "'" . $id . "', ".
+                                "'" . $max_score . "', ".
+                                $parent . ", ".
+                                $previous . ", ".
+                                $next . ", ".
+                                ($display_order +1) . ", ".
+                                $prerequisites . ", ".
+                                $max_time_allowed .
+                            ")";
         } else {
             // Insert new item.
             $sql_ins = "
-                            INSERT INTO " . $tbl_lp_item . " (
-                                lp_id,
-                                item_type,
-                                ref,
-                                title,
-                                description,
-                                path,
-                                max_score,
-                                parent_item_id,
-                                previous_item_id,
-                                next_item_id,
-                                display_order,
-                                max_time_allowed
-                            ) VALUES (
-                                " . $this->get_id() . ",
-                                '" . $type . "',
-                                '',
-                                '" . $title . "',
-                                '" . $description . "',
-                                '" . $id . "',
-                                '" . $max_score . "',
-                                " . $parent . ",
-                                " . $previous . ",
-                                " . $next . ",
-                                " . ($display_order +1) . ",
-                                " . $max_time_allowed . "
-                            )";
+                            INSERT INTO " . $tbl_lp_item . " ( ".
+                                "lp_id, ".
+                                "item_type, ".
+                                "ref, ".
+                                "title, ".
+                                "description, ".
+                                "path, ".
+                                "max_score, ".
+                                "parent_item_id, ".
+                                "previous_item_id, ".
+                                "next_item_id, ".
+                                "display_order, ".
+                                "max_time_allowed ".
+                            ") VALUES (".
+                                $this->get_id() . ",".
+                                "'" . $type . "',".
+                                "'',".
+                                "'" . $title . "',".
+                                "'" . $description . "',".
+                                "'" . $id . "',".
+                                "'" . $max_score . "',".
+                                $parent . ",".
+                                $previous . ",".
+                                $next . ",".
+                                ($display_order +1) . ",".
+                                $max_time_allowed .
+                            ")";
         }
 
         if ($this->debug > 2) {
@@ -8495,4 +8494,4 @@ if (!function_exists('trim_value')) {
     function trim_value(& $value) {
         $value = trim($value);
     }
-}
+}

+ 1 - 1
main/newscorm/openoffice_presentation.class.php

@@ -115,7 +115,7 @@ class OpenofficePresentation extends OpenofficeDocument {
                 // Put the document in item_property update.
                 api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentAdded', api_get_user_id(), 0, 0, null, null, api_get_session_id());
 
-                $previous = learnpath::add_item(0, $previous, 'document', $document_id, $slide_name, '');
+                $previous = $this->add_item(0, $previous, 'document', $document_id, $slide_name, '');
                 if ($this->first_item == 0) {
                     $this->first_item = $previous;
                 }

+ 1 - 1
main/wiki/index.php

@@ -101,7 +101,7 @@ if ($_SESSION['_gid'] OR $_GET['group_id']) {
 	$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
 	$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_clean['group_id'], "name"=> get_lang('GroupSpace').' '.$group_properties['name']);
 
-	$add_group_to_title = ' ('.$group_properties['name'].')';
+	$add_group_to_title = ' '.$group_properties['name'];
 	$groupfilter='group_id="'.$_clean['group_id'].'"';
 
 	//ensure this tool in groups whe it's private or deactivated

+ 4 - 1
main/work/work.php

@@ -487,12 +487,15 @@ if (!empty($make_visible)) {
 		Database::query($sql);
 		Display::display_confirmation_message(get_lang('FileVisible'));
 	}
-
+    
+    /* No need to update this because it will break the end date and expiration date code see BT#1775
+     * 
 	// update all the parents in the table item propery
 	$list_id = get_parent_directories($my_cur_dir_path);
 	for ($i = 0; $i < count($list_id); $i++) {
 		api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
 	}
+    */
 }
 
 /*	Create dir command */