Julio Montoya Armas 15 rokov pred
rodič
commit
1913d95c71

+ 28 - 34
main/admin/add_users_to_group.php

@@ -39,7 +39,7 @@ $tbl_group_rel_user	= Database::get_main_table(TABLE_MAIN_USER_REL_GROUP);
 $tool_name = get_lang('SubscribeUsersToGroup');
 $group_id = intval($_GET['id']);
 
-$add_type = 'single';
+$add_type = 'multiple';
 if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
 	$add_type = Security::remove_XSS($_REQUEST['add_type']);
 }
@@ -210,13 +210,17 @@ if($_POST['form_sent']) {
 	$UserList			= $_POST['sessionUsersList'];
 	$ClassList			= $_POST['sessionClassesList'];
 	
+	$group_id			= intval($_POST['id']);
+	
 	if(!is_array($UserList)) {
 		$UserList=array();
 	}
 
 	if ($form_sent == 1) {
-		//added a parameter to send emails when registering a user
-	//	SessionManager::suscribe_users_to_session($id_session,$UserList,true,true);
+		$result = GroupPortalManager::add_users_to_groups($UserList, array($group_id));
+		
+		
+		//SessionManager::suscribe_users_to_session($id_session,$UserList,true,true);
 
 		//adding the session to the access_url_rel_session table
 		/*global $_configuration;
@@ -269,7 +273,7 @@ if ($ajax_search) {
 				WHERE access_url_id = $access_url_id
 				$order_clause";
 		}
-	}
+	}	
 	$result=Database::query($sql,__FILE__,__LINE__);
 	$Users=Database::store_result($result);
 	foreach ($Users as $user) {
@@ -332,14 +336,12 @@ if ($ajax_search) {
 				LEFT JOIN $tbl_session_rel_user
 				ON $tbl_session_rel_user.id_user = u.user_id AND id_session = '$id_session'
 				$where_filter
-			$order_clause";
-			
-		} else {
-			
+			$order_clause";			
+		} else {			
 			$sql="SELECT  u.user_id, lastname, firstname, username, group_id
 				FROM $tbl_user u
 				LEFT JOIN $tbl_group_rel_user gu
-				ON (gu.user_id = u.user_id) WHERE gu.group_id = $group_id
+				ON (gu.user_id = u.user_id) AND gu.group_id = $group_id
 			$order_clause";
 		}
 		
@@ -364,14 +366,14 @@ if ($ajax_search) {
 			if($user['group_id'] != $group_id)
 				$nosessionUsersList[$user['user_id']] = $user ;
 		}
-		var_dump($nosessionUsersList);
+		
 		$user_anonymous=api_get_anonymous_id();
-	/*	foreach($nosessionUsersList as $key_user_list =>$value_user_list) {
+		foreach($nosessionUsersList as $key_user_list =>$value_user_list) {
 			if ($nosessionUsersList[$key_user_list]['user_id']==$user_anonymous) {
 				unset($nosessionUsersList[$key_user_list]);
 			}
-		}*/
-		
+		}
+
 		//filling the correct users in list
 		$sql="SELECT u.user_id, lastname, firstname, username, group_id
 			FROM $tbl_user u
@@ -392,6 +394,7 @@ if ($ajax_search) {
 				$order_clause";
 			}
 		}
+		
 		$result=Database::query($sql,__FILE__,__LINE__);
 		$Users=Database::store_result($result);
 		
@@ -402,7 +405,7 @@ if ($ajax_search) {
 		}
 		
 		foreach ($Users as $user) {
-			if($user['group_id'] == $group_id){
+			if($user['group_id'] == $group_id) {
 				$sessionUsersList[$user['user_id']] = $user;
 				if (array_key_exists($user['user_id'],$nosessionUsersList))
 		            unset($nosessionUsersList[$user['user_id']]);
@@ -411,25 +414,21 @@ if ($ajax_search) {
 }
 
 if ($add_type == 'multiple') {
-	//$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
-	//$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
+	$link_add_type_unique = '<a href="'.api_get_self().'?id='.$group_id.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
+	$link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
 } else {
-	//$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
-	//$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
-	/*
-	 * <div class="actions">
-	<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
-</div>
-	 */
+	$link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
+	$link_add_type_multiple = '<a href="'.api_get_self().'?id='.$group_id.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
 }
-
-
 ?>
 
+<div class="actions">
+	<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
+</div>
 
 <?php echo '<div class="row"><div class="form_header">'.$tool_name.' ('.$session_info['name'].')</div></div><br/>'; ?>
 
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo Security::remove_XSS($_GET['page']); ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $group_id; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
 
 <?php
 if ($add_type=='multiple') {
@@ -461,6 +460,7 @@ if ($add_type=='multiple') {
 ?>
 
 <input type="hidden" name="form_sent" value="1" />
+<input type="hidden" name="id" value="<?=$group_id?>" />
 <input type="hidden" name="add_type"  />
 
 <?php
@@ -537,7 +537,7 @@ if(!empty($errorMsg)) {
 	<?php
   }
   ?>
-	<br /><br /><br /><br /><br /><br />
+	<br /><br /><br /><br /><br />
   </td>
   <td align="center">
   <select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" style="width:360px;">
@@ -559,13 +559,7 @@ unset($sessionUsersList);
 	<td colspan="3" align="center">
 		<br />
 		<?php
-		if(isset($_GET['add'])) {
-			echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>';
-        } else {
-            //@todo see that the call to "valide()" doesn't duplicate the onsubmit of the form (necessary to avoid delete on "enter" key pressed)
-			echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToGroup').'</button>';
-
-        }
+		echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToGroup').'</button>';
 		?>
 	</td>
 </tr>

+ 1 - 1
main/admin/add_users_to_session.php

@@ -373,7 +373,7 @@ if ($ajax_search) {
 			$order_clause";
 			}
 		}
-
+		echo $sql;
 		$result=Database::query($sql,__FILE__,__LINE__);
 		$Users=Database::store_result($result);
 		//var_dump($_REQUEST['id_session']);

+ 2 - 4
main/admin/group_list.php

@@ -105,8 +105,8 @@ function get_group_data($from, $number_of_items, $column, $direction)
 
 	$users = array ();
     $t = time();
-	while ($group = Database::fetch_row($res)) {
-        // forget about the expiration date field		      
+	while ($group = Database::fetch_row($res)) {		
+		$group['1'] = '<a href="/main/social/groups.php?id='.$group['0'].'">'.$group['1'].'</a>';      
         $groups[] = $group;
 	}
 	return $groups;
@@ -180,8 +180,6 @@ function modify_filter($group_id,$url_params,$row)
 		$result .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/add_users_to_group.php?id='.$group_id.'">'.Display::return_icon('add_user_big.gif',get_lang('AddUsersToGroup')).'</a>';
 		$result .= '<a href="group_edit.php?id='.$group_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>&nbsp;&nbsp;';
 		$result .= '<a href="group_list.php?action=delete_group&amp;group_id='.$group_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
-		
-		
 	}
 	return $result;
 }

+ 12 - 0
main/css/blue_lagoon/default.css

@@ -2625,6 +2625,8 @@ input.arrowl {
 
 
 /* UI improvements */
+
+
 * {
 	outline :none;
 }
@@ -2650,3 +2652,13 @@ input, select, textarea {
 input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
 	background-image:url(images/shadow.gif);
 }
+
+
+
+.independent_course_item a {
+	font-size:120%;
+}
+
+.session_course_item a {
+	font-size:120%;
+}

+ 7 - 5
main/exercice/exercice.php

@@ -532,11 +532,13 @@ if ($is_allowedToEdit) {
 					$sql = 'SELECT gl.id FROM ' . $tbl_grade_link . ' gl WHERE gl.type="1" AND gl.ref_id="' . $exerciseId . '";';
 					$result = Database::query($sql, __FILE__, __LINE__);
 					$row = Database :: fetch_array($result, 'ASSOC');
-
-					$link = LinkFactory :: load($row['id']);
-					if ($link[0] != null) {
-						$link[0]->delete();
-					}
+					//see 
+					if (!empty($row['id'])) {
+                 		$link = LinkFactory :: load($row['id']);
+                     		if ($link[0] != null) {
+                            	$link[0]->delete();
+                     		}
+           			}
 					Display :: display_confirmation_message(get_lang('ExerciseDeleted'));
 					break;
 				case 'enable' : // enables an exercise

+ 18 - 12
main/gradebook/gradebook.php

@@ -269,15 +269,18 @@ if (isset ($_GET['visiblelink'])) {
 }
 if (isset ($_GET['deletelink'])) {
 	block_students();
-	$link= LinkFactory :: load(Security::remove_XSS($_GET['deletelink']));
-	if ($link[0] != null) {
-		$sql='UPDATE '.$tbl_forum_thread.' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify="" WHERE thread_id=(SELECT ref_id FROM '.$tbl_grade_links.' where id='.Security::remove_XSS($_GET['deletelink']).');';
-		Database::query($sql);
-		$link[0]->delete();
+	//fixing #5229
+	if (!empty($_GET['deletelink'])) {	
+		$link= LinkFactory :: load(Security::remove_XSS($_GET['deletelink']));
+		if ($link[0] != null) {
+			$sql='UPDATE '.$tbl_forum_thread.' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify="" WHERE thread_id=(SELECT ref_id FROM '.$tbl_grade_links.' where id='.Security::remove_XSS($_GET['deletelink']).');';
+			Database::query($sql);
+			$link[0]->delete();
+		}
+		unset ($link);
+		$confirmation_message = get_lang('LinkDeleted');
+		$filter_confirm_msg = false;
 	}
-	unset ($link);
-	$confirmation_message = get_lang('LinkDeleted');
-	$filter_confirm_msg = false;
 }
 $course_to_crsind = isset ($course_to_crsind) ? $course_to_crsind : '';
 if ($course_to_crsind && !isset($_GET['confirm'])) {
@@ -328,11 +331,14 @@ if (isset ($_POST['action'])) {
 						$number_of_deleted_evaluations++;
 					}
 					if (api_substr($indexstr, 0, 4) == 'LINK') {
-						$link= LinkFactory :: load(api_substr($indexstr, 4));
-						if ($link[0] != null) {
-							$link[0]->delete();
+						$id = api_substr($indexstr, 4);
+						if (!empty($id)) {
+							$link= LinkFactory :: load();
+							if ($link[0] != null) {
+								$link[0]->delete();
+							}
+							$number_of_deleted_links++;
 						}
-						$number_of_deleted_links++;
 					}
 				}
 				$confirmation_message = get_lang('DeletedCategories') . ' : <b>' . $number_of_deleted_categories . '</b><br />' . get_lang('DeletedEvaluations') . ' : <b>' . $number_of_deleted_evaluations . '</b><br />' . get_lang('DeletedLinks') . ' : <b>' . $number_of_deleted_links . '</b><br /><br />' . get_lang('TotalItems') . ' : <b>' . $number_of_selected_items . '</b>';

+ 19 - 13
main/gradebook/index.php

@@ -327,15 +327,18 @@ if (isset ($_GET['visiblelink'])) {
 if (isset ($_GET['deletelink'])) {
 	block_students();
 	$get_delete_link=Security::remove_XSS($_GET['deletelink']);
-	$link= LinkFactory :: load($get_delete_link);
-	if ($link[0] != null) {
-		$sql='UPDATE '.$tbl_forum_thread.' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify="" WHERE thread_id=(SELECT ref_id FROM '.$tbl_grade_links.' where id='.$get_delete_link.');';
-		Database::query($sql);
-		$link[0]->delete();
+	//fixing #5229
+	if (!empty($get_delete_link)) {
+		$link= LinkFactory :: load($get_delete_link);
+		if ($link[0] != null) {
+			$sql='UPDATE '.$tbl_forum_thread.' SET thread_qualify_max=0,thread_weight=0,thread_title_qualify="" WHERE thread_id=(SELECT ref_id FROM '.$tbl_grade_links.' where id='.$get_delete_link.');';
+			Database::query($sql);
+			$link[0]->delete();
+		}
+		unset ($link);
+		$confirmation_message = get_lang('LinkDeleted');
+		$filter_confirm_msg = false;
 	}
-	unset ($link);
-	$confirmation_message = get_lang('LinkDeleted');
-	$filter_confirm_msg = false;
 }
 
 if (!empty($course_to_crsind) && !isset($_GET['confirm'])) {
@@ -387,12 +390,15 @@ if (isset ($_POST['action'])) {
 						$number_of_deleted_evaluations++;
 					}
 					if (substr($indexstr, 0, 4) == 'LINK') {
-						$link= LinkFactory :: load(substr($indexstr, 4));
-						if ($link[0] != null) {
-							$link[0]->delete();
+						//fixing #5229
+						$id = substr($indexstr, 4);
+						if (!empty($id)) {
+							$link= LinkFactory :: load($id);
+							if ($link[0] != null) {
+								$link[0]->delete();
+							}
+							$number_of_deleted_links++;
 						}
-
-						$number_of_deleted_links++;
 					}
 				}
 				$confirmation_message = get_lang('DeletedCategories') . ' : <b>' . $number_of_deleted_categories . '</b><br />' . get_lang('DeletedEvaluations') . ' : <b>' . $number_of_deleted_evaluations . '</b><br />' . get_lang('DeletedLinks') . ' : <b>' . $number_of_deleted_links . '</b><br /><br />' . get_lang('TotalItems') . ' : <b>' . $number_of_selected_items . '</b>';

BIN
main/img/unknown_50_50.jpg


BIN
main/img/unknown_group.png


+ 61 - 68
main/inc/lib/group_portal_manager.lib.php

@@ -4,7 +4,7 @@
 ==============================================================================
 *	This library provides functions for the access_url management.
 *	Include/require it in your code to use its functionality.
-*
+*	@author Julio Montoya <gugli100@gmail.com>
 *	@package dokeos.library
 ==============================================================================
 */
@@ -147,7 +147,10 @@ class GroupPortalManager
 	/**
 	 * Gets data of all groups
 	 * @author Julio Montoya
-	 * @return array
+	 * @param int	visibility
+	 * @param int	from which record the results will begin (use for pagination)
+	 * @param int	number of items
+	 * @return array	
 	 * */
 	function get_all_group_data($visibility = GROUP_PERMISSION_OPEN, $from=0, $number_of_items=10)	
 	{
@@ -163,6 +166,11 @@ class GroupPortalManager
 		return $data;
 	}
 	
+	/**
+	 * Gets the group data
+	 * 
+	 * 
+	 */
 	function get_group_data($group_id)	
 	{
 		$table	= Database :: get_main_table(TABLE_MAIN_GROUP);
@@ -177,6 +185,12 @@ class GroupPortalManager
 		return $item;
 	}
 	
+	/**
+	 * Gets the tags from a given group
+	 * @param int	group id
+	 * @param bool show group links or not 
+	 * 
+	 */
 	function get_group_tags($group_id, $show_tag_links = true)	
 	{
 		$tag					= Database :: get_main_table(TABLE_MAIN_TAG);
@@ -283,7 +297,7 @@ class GroupPortalManager
 		$array = array();
 		while ($row = Database::fetch_array($result, 'ASSOC')) {
 				if ($with_image == true) {
-					$picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],80);
+					$picture = UserManager::get_picture_user($row['user_id'], $row['picture_uri'],80,'medium_');
 					$img = '<img src="'.$picture['file'].'" />';
 					$row['picture_uri'] = $img;
 				}
@@ -374,8 +388,9 @@ class GroupPortalManager
 	* @author Julio Montoya
 	* @param int user id
 	* @param int group_id
-	* @return boolean true if success
+	* @return int 0 if there are not relationship otherwise return GROUP_USER_PERMISSION_ADMIN or GROUP_USER_PERMISSION_READER constants
 	* */
+	
 	function get_user_group_role($user_id, $group_id)
 	{
 		$table_group_rel_user= Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
@@ -425,35 +440,6 @@ class GroupPortalManager
 	}
 
 
-	/**
-	 * Add a group of users into a group of URLs
-	 * @author Julio Montoya
-	 * @param  array of user_ids
-	 * @param  array of url_ids
-	 * */
-	function add_users_to_urls($user_list, $url_list)
-	{
-		$table_url_rel_user= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-		$result_array=array();
-
-		if (is_array($user_list) && is_array($url_list)){
-			foreach ($url_list as $url_id) {
-				foreach ($user_list as $user_id) {
-					$count = UrlManager::relation_url_user_exist($user_id,$url_id);
-					if ($count==0) {
-						$sql = "INSERT INTO $table_url_rel_user
-		               			SET user_id = ".Database::escape_string($user_id).", access_url_id = ".Database::escape_string($url_id);
-						$result = Database::query($sql, __FILE__, __LINE__);
-						if($result)
-							$result_array[$url_id][$user_id]=1;
-						else
-							$result_array[$url_id][$user_id]=0;
-					}
-				}
-			}
-		}
-		return 	$result_array;
-	}
 
 
 	/**
@@ -539,34 +525,40 @@ class GroupPortalManager
 		}
 		return $result;
 	}
-
-	function add_course_to_url($course_code, $url_id=1)
-	{
-		$table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
-		if (empty($url_id)) $url_id=1;
-		$count = UrlManager::relation_url_course_exist($course_code,$url_id);
-		if (empty($count)) {
-			$sql = "INSERT INTO $table_url_rel_course
-           			SET course_code = '".Database::escape_string($course_code)."', access_url_id = ".Database::escape_string($url_id);
-			$result = Database::query($sql, __FILE__, __LINE__);
+	
+	
+	/**
+	 * Add a group of users into a group of URLs
+	 * @author Julio Montoya
+	 * @param  array of user_ids
+	 * @param  array of url_ids
+	 * */
+	function add_users_to_groups($user_list, $group_list, $relation_type = GROUP_USER_PERMISSION_READER) {
+		$table_url_rel_group = Database :: get_main_table(TABLE_MAIN_USER_REL_GROUP);
+		$result_array = array();
+		$relation_type = intval($relation_type);
+		
+		if (is_array($user_list) && is_array($group_list)) {
+			foreach ($group_list as $group_id) {
+				foreach ($user_list as $user_id) {
+					$role = self::get_user_group_role($user_id,$group_id);
+					if ($role == 0) {
+						$sql = "INSERT INTO $table_url_rel_group
+		               			SET user_id = ".intval($user_id).", group_id = ".intval($group_id).", relation_type = ".intval($relation_type)."";
+		               	
+						$result = Database::query($sql, __FILE__, __LINE__);
+						if ($result)
+							$result_array[$group_id][$user_id]=1;
+						else
+							$result_array[$group_id][$user_id]=0;
+					}
+				}
+			}
 		}
-		return $result;
+		return 	$result_array;
 	}
 
 
-	function add_session_to_url($session_id, $url_id=1)
-	{
-		$table_url_rel_session= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-		if (empty($url_id)) $url_id=1;
-		$count = UrlManager::relation_url_session_exist($session_id,$url_id);
-		if (empty($count)) {
-			$sql = "INSERT INTO $table_url_rel_session
-           			SET session_id = ".Database::escape_string($session_id).", access_url_id = ".Database::escape_string($url_id);
-			$result = Database::query($sql, __FILE__, __LINE__);
-		}
-		return $result;
-	}
-
 
 	/**
 	* Deletes an url and user relationship
@@ -815,14 +807,14 @@ class GroupPortalManager
 	
 	
 	/**
-	 * Creates new user pfotos in various sizes of a user, or deletes user pfotos.
+	 * Creates new group pictures in various sizes of a user, or deletes user pfotos.
 	 * Note: This method relies on configuration setting from dokeos/main/inc/conf/profile.conf.php
-	 * @param int $user_id			The user internal identitfication number.
-	 * @param string $file			The common file name for the newly created pfotos. It will be checked and modified for compatibility with the file system.
+	 * @param	int	The group id 
+	 * @param	string $file			The common file name for the newly created pfotos. It will be checked and modified for compatibility with the file system.
 	 * If full name is provided, path component is ignored.
 	 * If an empty name is provided, then old user photos are deleted only, @see UserManager::delete_user_picture() as the prefered way for deletion.
-	 * @param string $source_file	The full system name of the image from which user photos will be created.
-	 * @return string/bool			Returns the resulting common file name of created images which usually should be stored in database.
+	 * @param	string		$source_file	The full system name of the image from which user photos will be created.
+	 * @return	string/bool	Returns the resulting common file name of created images which usually should be stored in database.
 	 * When deletion is recuested returns empty string. In case of internal error or negative validation returns FALSE.
 	 */
 	public static function update_group_picture($group_id, $file = null, $source_file = null) {
@@ -919,7 +911,7 @@ class GroupPortalManager
 	}
 	
 	/**
-	 * Get user picture URL or path from user ID (returns an array).
+	 * Gets the group picture URL or path from group ID (returns an array).
 	 * The return format is a complete path, enabling recovery of the directory
 	 * with dirname() or the file with basename(). This also works for the
 	 * functions dealing with the user's productions, as they are located in
@@ -981,7 +973,7 @@ class GroupPortalManager
 		return array('dir' => $dir, 'file' => $picture_filename);
 	}
 	
-	    /**
+	/**
 	 * Resize a picture
 	 *
 	 * @param  string file picture
@@ -1006,10 +998,11 @@ class GroupPortalManager
 		}
 		return $temp;
 	}
-	    /**
-     * Gets the current user image
-     * @param string user id
-     * @param string picture user name
+	
+	/**
+     * Gets the current group image
+     * @param string group id
+     * @param string picture group name
      * @param string height
      * @param string picture size it can be small_,  medium_  or  big_
      * @param string style css

+ 14 - 5
main/inc/lib/usermanager.lib.php

@@ -2208,8 +2208,18 @@ class UserManager
             $file = $image_array_sys['dir'].$picture_file;            
 			if (file_exists($file) && !is_dir($file)) {				
 				$picture['file'] = $image_array['dir'].$picture_file;
-			} else {				
-				$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown.jpg';
+			} else {
+				switch ($size_picture) {
+					case 'big_' : 
+						$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown.jpg'; break;
+					case 'medium_' : 
+						$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown_50_50.jpg'; break;
+					case 'small_' : 
+						$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown.jpg'; break;
+					default:
+						$picture['file'] = api_get_path(WEB_CODE_PATH).'img/unknown.jpg'; break;
+				}
+				
 			}
 		}
 		return $picture;
@@ -2565,10 +2575,9 @@ class UserManager
 			$where_field = " field_id = $field_id AND ";
 		}
 		// all the information of the field
-		 $sql = "SELECT u.user_id,u.username,firstname, lastname, email, tag, picture_uri FROM $table_user_tag ut INNER JOIN $table_user_tag_values uv ON (uv.tag_id=ut.id)
+		$sql = "SELECT u.user_id,u.username,firstname, lastname, email, tag, picture_uri FROM $table_user_tag ut INNER JOIN $table_user_tag_values uv ON (uv.tag_id=ut.id)
 				INNER JOIN $user_table u ON(uv.user_id =u.user_id)
-				WHERE $where_field tag LIKE '$tag%' ORDER BY tag";
-				
+				WHERE $where_field tag LIKE '$tag%' ORDER BY tag";				
 		$sql .= " LIMIT $from,$number_of_items";
 		
 		$result = Database::query($sql, __FILE__, __LINE__);

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

@@ -883,10 +883,15 @@ class learnpath {
 		$sql = 'SELECT gl.id FROM ' . $tbl_grade_link . ' gl WHERE gl.type="4" AND gl.ref_id="' . $id . '";';
 		$result = Database::query($sql, __FILE__, __LINE__);
 		$row = Database :: fetch_array($result, 'ASSOC');
-		$link = LinkFactory :: load($row['id']);
-		if ($link[0] != null) {
-			$link[0]->delete();
+		
+		//fixing gradebook link deleted see #5229
+		if (!empty($row['id'])) {
+	   		$link = LinkFactory :: load($row['id']);
+	    	if ($link[0] != null) {
+	       		$link[0]->delete();
+	    	}
 		}
+		
 		//TODO: also delete items and item-views
 		if (api_get_setting('search_enabled') == 'true') {
 			require_once (api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');

+ 12 - 8
main/social/groups.php

@@ -25,9 +25,13 @@ if ($group_id != 0 ) {
 	$picture	= GroupPortalManager::get_picture_group($group_id, $group_info['picture_uri'],160,'medium_');
 	$tags		= GroupPortalManager::get_group_tags($group_id,true);
 	$users		= GroupPortalManager::get_users_by_group($group_id,true);
-		
-		
-	//var_dump($users);
+	
+	//@todo this must be move to default.css for dev use only
+	echo '<style> 		
+			#group_members { width:250px; height:300px; overflow-x:none; overflow-y: auto;}
+			.group_member_item { width:80px; float:left;}
+			
+	</style>';
 	
 	
 	//Group's title
@@ -60,13 +64,13 @@ if ($group_id != 0 ) {
 		echo '</div>';
 	}
 	
-	echo '<div id="group_members">';
-		echo get_lang('Members').' : ';
-		foreach($users as $user) {	
-			echo $user['picture_uri'].$user['firstname'].$user['lastname'].'<br />';
+	echo get_lang('Members').' : ';
+	echo '<div id="group_members">';		
+		foreach($users as $user) {			
+			echo '<div class="group_member_item">'.$user['picture_uri'].$user['firstname'].$user['lastname'].'</div>';
 		}
 	echo '</div>';
-		
+	
 		
 	echo '<div id="group_permissions">';
 	if (in_array(api_get_user_id(), $users)) {