Quellcode durchsuchen

Sessions can't be added to a URL see #3733

Julio Montoya vor 12 Jahren
Ursprung
Commit
b12413cb67

+ 0 - 167
main/admin/access_url_add_sessions_to_url.php

@@ -1,167 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
-*	This script allows platform admins to add users to urls.
-*	It displays a list of users and a list of courses;
-*	you can select multiple users and courses and then click on
-*	@package chamilo.admin
-*	@author Julio Montoya <gugli100@gmail.com>
-*/
-
-// name of the language file that needs to be included
-$language_file = 'admin';
-$cidReset = true;
-require_once '../inc/global.inc.php';
-$this_section=SECTION_PLATFORM_ADMIN;
-
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-api_protect_global_admin_script();
-if (!api_get_multiple_access_url()) {
-	header('Location: index.php');
-	exit;
-}
-
-/*
-	Global constants and variables
-*/
-
-$form_sent = 0;
-$first_letter_session = '';
-$sessions = array ();
-$url_list = array();
-$users = array();
-
-$tbl_access_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-$tbl_access_url 			= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
-$tbl_user 					= Database :: get_main_table(TABLE_MAIN_USER);
-$tbl_session				= Database :: get_main_table(TABLE_MAIN_SESSION);
-
-/*	Header	*/
-$tool_name = get_lang('AddSessionToURL');
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
-
-/*		MAIN CODE	*/
-
-Display :: display_header($tool_name);
-echo '<div class="actions">';
-echo Display::url(Display::return_icon('edit.gif',get_lang('EditSessionToURL'),''), api_get_path(WEB_CODE_PATH).'admin/access_url_edit_sessions_to_url.php');
-echo '</div>';
-
-api_display_tool_title($tool_name);
-
-if ($_POST['form_sent']) {
-	$form_sent = $_POST['form_sent'];
-	$sessions = is_array($_POST['session_list']) ? $_POST['session_list'] : array() ;
-	$url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
-	$first_letter_session = $_POST['first_letter_session'];
-
-	foreach($users as $key => $value) {
-		$users[$key] = intval($value);
-	}
-
-	if ($form_sent == 1) {
-		if ( count($sessions) == 0 || count($url_list) == 0) {
-			Display :: display_error_message(get_lang('AtLeastOneSessionAndOneURL'));
-			//header('Location: access_urls.php?action=show_message&message='.get_lang('AtLeastOneUserAndOneURL'));
-		} else {
-			UrlManager::add_sessions_to_urls($sessions,$url_list);
-			Display :: display_confirmation_message(get_lang('SessionBelongURL'));
-			//header('Location: access_urls.php?action=show_message&message='.get_lang('UsersBelongURL'));
-		}
-	}
-}
-
-
-
-/*
-	Display GUI
-*/
-/*
-if(empty($first_letter_user)) {
-	$sql = "SELECT count(*) as num_courses FROM $tbl_course";
-	$result = Database::query($sql);
-	$num_row = Database::fetch_array($result);
-	if($num_row['num_courses']>1000)
-	{//if there are too much num_courses to gracefully handle with the HTML select list,
-	 // assign a default filter on users names
-		$first_letter_user = 'A';
-	}
-	unset($result);
-}
-*/
-$first_letter_session = Database::escape_string($first_letter_session);
-$sql = "SELECT id, name FROM $tbl_session
-		WHERE name LIKE '".$first_letter_session."%' OR name LIKE '".api_strtolower($first_letter_session)."%'
-		ORDER BY name DESC ";
-
-$result = Database::query($sql);
-$db_sessions = Database::store_result($result);
-unset($result);
-
-$sql = "SELECT id, url FROM $tbl_access_url  WHERE active=1 ORDER BY url";
-$result = Database::query($sql);
-$db_urls = Database::store_result($result);
-unset($result);
-?>
-
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;">
- <input type="hidden" name="form_sent" value="1"/>
-  <table border="0" cellpadding="5" cellspacing="0" width="100%">
-   <tr>
-    <td width="40%" align="center">
-     <b><?php echo get_lang('SessionList'); ?></b>
-     <br/><br/>
-     <?php echo get_lang('FirstLetterSession'); ?> :
-     <select name="first_letter_session" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();">
-      <option value="">--</option>
-      <?php
-        echo Display :: get_alphabet_options($first_letter_session);
-        echo Display :: get_numeric_options(0,9,$first_letter_session);
-      ?>
-     </select>
-    </td>
-        <td width="20%">&nbsp;</td>
-    <td width="40%" align="center">
-     <b><?php echo get_lang('URLList'); ?> :</b>
-    </td>
-   </tr>
-   <tr>
-    <td width="40%" align="center">
-     <select name="session_list[]" multiple="multiple" size="20" style="width:380px;">
-		<?php
-
-		foreach ($db_sessions as $session) {
-			?>
-			<option value="<?php echo $session['id']; ?>"
-			<?php if(in_array($session['id'],$sessions))
-			echo 'selected="selected"'; ?>>
-			<?php echo $session['name']; ?></option>
-			<?php
-		}
-		?>
-    </select>
-   </td>
-   <td width="20%" valign="middle" align="center">    
-    <button type="submit" class="add"> <?php echo get_lang('AddSessionsToThatURL'); ?> </button>
-   </td>
-   <td width="40%" align="center">
-    <select name="url_list[]" multiple="multiple" size="20" style="width:230px;">
-		<?php
-		foreach ($db_urls as $url_obj) {
-			?>
-			<option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?></option>
-			<?php
-		}
-		?>
-    </select>
-   </td>
-  </tr>
- </table>
-</form>
-<?php
-/*
-		FOOTER
-*/
-Display :: display_footer();
-?>

+ 0 - 389
main/admin/access_url_edit_sessions_to_url.php

@@ -1,389 +0,0 @@
-<?php
-/* For licensing terms, see /license.txt */
-/**
-*	@package chamilo.admin
-*	@author Julio Montoya <gugli100@gmail.com>
-*/
-
-//Removing funcionality due #3733
-exit;
-
-// name of the language file that needs to be included
-$language_file='admin';
-
-// resetting the course id
-$cidReset = true;
-
-// including some necessary chamilo files
-require_once '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-require_once api_get_path(LIBRARY_PATH).'access_url_edit_sessions_to_url_functions.lib.php';
-
-$xajax = new xajax();
-
-$xajax -> registerFunction (array('search_sessions', 'Accessurleditsessionstourl', 'search_sessions'));
-
-
-// setting the section (for the tabs)
-$this_section = SECTION_PLATFORM_ADMIN;
-
-// Access restrictions
-api_protect_global_admin_script();
-if (!api_get_multiple_access_url()) {
-	header('Location: index.php');
-	exit;
-}
-
-
-// Database Table Definitions
-$tbl_access_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-$tbl_session 			 	= Database :: get_main_table(TABLE_MAIN_SESSION);
-$tbl_access_url 		 	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
-
-// setting breadcrumbs
-$tool_name = get_lang('EditSessionsToURL');
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
-
-$add_type = 'multiple';
-if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
-	$add_type = Security::remove_XSS($_REQUEST['add_type']);
-}
-
-$access_url_id=1;
-if(isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!=''){
-	$access_url_id = Security::remove_XSS(intval($_REQUEST['access_url_id']));
-}
-
-$xajax -> processRequests();
-$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
-$htmlHeadXtra[] = '
-<script type="text/javascript">
-function add_user_to_url(code, content) {
-
-	document.getElementById("course_to_add").value = "";
-	document.getElementById("ajax_list_courses").innerHTML = "";
-
-	destination = document.getElementById("destination_users");
-	destination.options[destination.length] = new Option(content,code);
-
-	destination.selectedIndex = -1;
-	sortOptions(destination.options);
-}
-
-function send() {
-
-	if (document.formulaire.access_url_id.value!=0) {
-		document.formulaire.form_sent.value=0;
-		document.formulaire.add_type.value=\''.$add_type.'\';
-		document.formulaire.submit();
-	}
-}
-
-function remove_item(origin)
-{
-	for(var i = 0 ; i<origin.options.length ; i++) {
-		if(origin.options[i].selected) {
-			origin.options[i]=null;
-			i = i-1;
-		}
-	}
-}
-</script>';
-
-$form_sent=0;
-$errorMsg='';
-$UserList=$SessionList=array();
-$users=$sessions=array();
-
-if($_POST['form_sent']) {
-	$form_sent=$_POST['form_sent'];
-	$session_list=$_POST['session_list'];
-
-	if(!is_array($session_list)) {
-		$session_list=array();
-	}
-
-	if($form_sent == 1) {
-		if ($access_url_id==0) {
-			header('Location: access_url_edit_users_to_url.php?action=show_message&message='.get_lang('SelectURL'));
-			exit;
-		} elseif(is_array($session_list) ) {
-			UrlManager::update_urls_rel_session($session_list,$access_url_id);
-			header('Location: access_urls.php?action=show_message&message='.get_lang('SessionsWereEdited'));
-			exit;
-		}
-	}
-}
-
-Display::display_header($tool_name);
-
-echo '<div class="actions">';
-echo Display::url(Display::return_icon('view_more_stats.gif',get_lang('AddSessionsToURL'),''), api_get_path(WEB_CODE_PATH).'admin/access_url_add_sessions_to_url.php');
-echo '</div>';
-
-api_display_tool_title($tool_name);
-
-if ($_GET['action'] == 'show_message')
-	Display :: display_normal_message(Security::remove_XSS(stripslashes($_GET['message'])));
-
-$no_session_list = $session_list = array();
-$ajax_search = $add_type == 'unique' ? true : false;
-
-if($ajax_search) {
-	$sessions=UrlManager::get_url_rel_session_data($access_url_id);
-	foreach($sessions as $session) {
-		$session_list[$session['id']] = $session ;
-	}
-} else {
-	$sessions=UrlManager::get_url_rel_session_data();
-	foreach($sessions as $session) {
-		if($session['access_url_id'] == $access_url_id) {
-			$session_list[$session['id']] = $session ;
-		}
-	}
-
-	$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
-	$sql="SELECT id, name
-	  	  	FROM $tbl_session u
-			ORDER BY name, id";
-	$result=Database::query($sql);
-	$sessions=Database::store_result($result);
-	$session_list_leys = array_keys($session_list);
-	foreach($sessions as $session) {
-		if (!in_array($session['id'],$session_list_leys))
-			$no_session_list[$session['id']] = $session ;
-	}
-}
-
-
-if($add_type == 'multiple') {
-	$link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>';
-	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
-} else {
-	$link_add_type_unique = get_lang('SessionAddTypeUnique');
-	$link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>';
-}
-
-$url_list = UrlManager::get_url_data();
-
-?>
-
-<div style="text-align: left;">
-	<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
-</div>
-<br /><br />
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?> >
-<?php echo get_lang('SelectUrl').' : '; ?>
-<select name="access_url_id" onchange="javascript:send();">
-<option value="0"> <?php echo get_lang('SelectUrl')?></option>
-	<?php
-	$url_selected='';
-	foreach ($url_list as $url_obj) {
-		$checked = '';
-		if (!empty($access_url_id)) {
-			if ($url_obj[0]==$access_url_id) {
-			$checked = 'selected=true';
-			$url_selected=$url_obj[1];
-			}
-		}
-		if ($url_obj['active']==1) {
-			?>
-				<option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
-			<?php
-		}
-	}
-	?>
-</select>
-<br /><br />
-<input type="hidden" name="form_sent" value="1" />
-<input type="hidden" name="add_type" value = "<?php echo $add_type ?>" />
-
-<?php
-if(!empty($errorMsg)) {
-	Display::display_normal_message($errorMsg); //main API
-}
-?>
-
-<table border="0" cellpadding="5" cellspacing="0" width="100%">
-
-<!-- Users -->
-<tr>
-  <td align="center"><b><?php echo get_lang('SessionListInPlatform') ?> :</b>
-  </td>
-  <td></td>
-  <td align="center"><b><?php echo get_lang('SessionListIn').' '.$url_selected; ?></b></td>
-</tr>
-
-<tr>
-  <td align="center">
-  <div id="content_source">
-  	  <?php
-  	  if($ajax_search) {
-  	  	?>
-		<input type="text" id="course_to_add" onkeyup="xajax_search_sessions(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
-		<div id="ajax_list_courses"></div>
-		<?php
-  	  } else {
-  	  ?>
-	  <select id="origin_users" name="no_session_list[]" multiple="multiple" size="15" style="width:380px;">
-		<?php
-		foreach($no_session_list as $no_session) {
-		?>
-			<option value="<?php echo $no_session['id']; ?>"><?php echo $no_session['name'].''; ?></option>
-		<?php
-		}
-		unset($no_session_list);
-		?>
-
-	  </select>
-	<?php
-  	  }
-  	 ?>
-  </div>
-  </td>
-  <td width="10%" valign="middle" align="center">
-  <?php
-  if($ajax_search) {
-	?>
-	<button class="arrowl" type="button" onclick="remove_item(document.getElementById('destination_users'))" ></button>
-  	<?php
-  } else {
-  	?>
-	<button class="arrowr" type="button" onclick="moveItem(document.getElementById('origin_users'), document.getElementById('destination_users'))" ></button>
-	<br /><br />
-	<button class="arrowl" type="button" onclick="moveItem(document.getElementById('destination_users'), document.getElementById('origin_users'))" ></button>
-	<?php
-  }
-  ?>
-	<br /><br /><br /><br /><br /><br />
-  </td>
-  <td align="center">
-  <select id="destination_users" name="session_list[]" multiple="multiple" size="15" style="width:380px;">
-
-<?php
-
-foreach($session_list as $session) {
-?>
-	<option value="<?php echo $session['id']; ?>"><?php echo $session['name']; ?></option>
-
-<?php
-}
-unset($session_list);
-?>
-
-  </select></td>
-</tr>
-
-<tr>
-	<td colspan="3" align="center">
-		<br />
-		<?php
-		if(isset($_GET['add']))
-			echo '<button class="save" type="button" onclick="valide()" >'.get_lang('AddSessionsToURL').'</button>';
-		else
-			echo '<button class="save" type="button" onclick="valide()" >'.get_lang('EditSessionsToURL').'</button>';
-		?>
-	</td>
-</tr>
-
-
-
-
-</table>
-
-</form>
-<script type="text/javascript">
-<!--
-function moveItem(origin , destination) {
-	for(var i = 0 ; i<origin.options.length ; i++) {
-		if(origin.options[i].selected) {
-			destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
-			origin.options[i]=null;
-			i = i-1;
-		}
-	}
-	destination.selectedIndex = -1;
-	sortOptions(destination.options);
-}
-
-function sortOptions(options) {
-	newOptions = new Array();
-	for (i = 0 ; i<options.length ; i++)
-		newOptions[i] = options[i];
-
-	newOptions = newOptions.sort(mysort);
-	options.length = 0;
-	for(i = 0 ; i < newOptions.length ; i++)
-		options[i] = newOptions[i];
-
-}
-
-function mysort(a, b) {
-	if(a.text.toLowerCase() > b.text.toLowerCase()){
-		return 1;
-	}
-	if(a.text.toLowerCase() < b.text.toLowerCase()){
-		return -1;
-	}
-	return 0;
-}
-
-function valide(){
-	var options = document.getElementById('destination_users').options;
-	for (i = 0 ; i<options.length ; i++)
-		options[i].selected = true;
-	/*
-	var options = document.getElementById('destination_classes').options;
-	for (i = 0 ; i<options.length ; i++)
-		options[i].selected = true;
-		*/
-	document.forms.formulaire.submit();
-}
-
-
-function loadUsersInSelect(select){
-
-	var xhr_object = null;
-
-	if(window.XMLHttpRequest) // Firefox
-		xhr_object = new XMLHttpRequest();
-	else if(window.ActiveXObject) // Internet Explorer
-		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
-	else  // XMLHttpRequest non supporté par le navigateur
-	alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
-
-	//xhr_object.open("GET", "loadUsersInSelect.ajax.php?id_session=<?php echo $id_session ?>&letter="+select.options[select.selectedIndex].text, false);
-	xhr_object.open("POST", "loadUsersInSelect.ajax.php");
-
-	xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
-
-
-	nosessionUsers = makepost(document.getElementById('origin_users'));
-	sessionUsers = makepost(document.getElementById('destination_users'));
-	nosessionClasses = makepost(document.getElementById('origin_classes'));
-	sessionClasses = makepost(document.getElementById('destination_classes'));
-	xhr_object.send("nosessionusers="+nosessionUsers+"&sessionusers="+sessionUsers+"&nosessionclasses="+nosessionClasses+"&sessionclasses="+sessionClasses);
-
-	xhr_object.onreadystatechange = function() {
-		if(xhr_object.readyState == 4) {
-			document.getElementById('content_source').innerHTML = result = xhr_object.responseText;
-			//alert(xhr_object.responseText);
-		}
-	}
-}
-
-function makepost(select){
-	var options = select.options;
-	var ret = "";
-	for (i = 0 ; i<options.length ; i++)
-		ret = ret + options[i].value +'::'+options[i].text+";;";
-
-	return ret;
-
-}
--->
-
-</script>
-<?php
-Display::display_footer();

+ 7 - 18
main/admin/dashboard_add_sessions_to_user.php

@@ -36,7 +36,6 @@ $interbreadcrumb[] = array('url' => 'user_list.php','name' => get_lang('UserList
 // Database Table Definitions
 $tbl_session 			= 	Database::get_main_table(TABLE_MAIN_SESSION);
 $tbl_session_rel_user 	= 	Database::get_main_table(TABLE_MAIN_SESSION_USER);
-$tbl_session_rel_access_url = 	Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
 
 // initializing variables
 $id_session=intval($_GET['id_session']);
@@ -64,7 +63,7 @@ if (!api_is_platform_admin() && !api_is_session_admin()) {
 }
 
 function search_sessions($needle,$type) {
-	global $_configuration, $tbl_session_rel_access_url, $tbl_session, $user_id;
+	global $_configuration, $tbl_session, $user_id;
 
 	$xajax_response = new XajaxResponse();
 	$return = '';
@@ -80,13 +79,8 @@ function search_sessions($needle,$type) {
 			$without_assigned_sessions = " AND s.id NOT IN(".implode(',',$assigned_sessions_id).")";
 		}
 
-		if ($_configuration['multiple_access_urls']) {
-			$sql 	= " SELECT s.id, s.name FROM $tbl_session s LEFT JOIN $tbl_session_rel_access_url a ON (s.id = a.session_id)
-						WHERE  s.name LIKE '$needle%' $without_assigned_sessions AND access_url_id = ".api_get_current_access_url_id()."";
-		} else {
-			$sql = "SELECT s.id, s.name FROM $tbl_session s
+        $sql = "SELECT s.id, s.name FROM $tbl_session s
 				WHERE  s.name LIKE '$needle%' $without_assigned_sessions ";
-		}
 
 		$rs	= Database::query($sql);
 
@@ -195,16 +189,11 @@ if (isset($_POST['firstLetterSession'])) {
 	$needle = "$needle%";
 }
 
-if ($_configuration['multiple_access_urls']) {
-	$sql 	= " SELECT s.id, s.name FROM $tbl_session s LEFT JOIN $tbl_session_rel_access_url a ON (s.id = a.session_id)
-				WHERE  s.name LIKE '$needle%' $without_assigned_sessions AND access_url_id = ".api_get_current_access_url_id()." 
-                ORDER BY s.name";
-} else {
-	$sql 	= " SELECT s.id, s.name FROM $tbl_session s
-				WHERE  s.name LIKE '$needle%' $without_assigned_sessions 
-                ORDER BY s.name
-                ";
-}
+$sql 	= " SELECT s.id, s.name FROM $tbl_session s
+        WHERE  s.name LIKE '$needle%' $without_assigned_sessions
+        ORDER BY s.name
+        ";
+
 
 $result	= Database::query($sql);
 ?>

+ 16 - 33
main/admin/resume_session.php

@@ -59,11 +59,11 @@ if (Database::num_rows($rs)>0) {
 
 $action = $_GET['action'];
 
-$url_id = api_get_current_access_url_id();     
+$url_id = api_get_current_access_url_id();
 
 
 switch($action) {
-    case 'add_user_to_url':        
+    case 'add_user_to_url':
         $user_id = $_REQUEST['user_id'];
         $result = UrlManager::add_user_to_url($user_id, $url_id);
         $user_info = api_get_user_info($user_id);
@@ -123,7 +123,7 @@ echo Display::page_header(Display::return_icon('session.png', get_lang('Session'
 <!-- General properties -->
 <table class="data_table" width="100%">
 <tr>
-  <th colspan="2">
+  <th align="center" colspan="2">
       <?php echo get_lang('GeneralProperties'); ?>
       <a href="session_edit.php?page=resume_session.php&id=<?php echo $id_session; ?>">
           <?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?>
@@ -188,31 +188,14 @@ echo Display::page_header(Display::return_icon('session.png', get_lang('Session'
 		<?php if ($session['visibility']==1) echo get_lang('ReadOnly'); elseif($session['visibility']==2) echo get_lang('Visible');elseif($session['visibility']==3) echo api_ucfirst(get_lang('Invisible'))  ?>
 	</td>
 </tr>
-
-<?php 
-
-$multiple_url_is_on = api_get_multiple_access_url();
-
-if ($multiple_url_is_on) {
-    echo '<tr><td>';   
-    echo 'URL';    
-    echo '</td>';
-    echo '<td>';
-    $url_list = UrlManager::get_access_url_from_session($id_session);
-    foreach($url_list as $url_data) {
-        echo $url_data['url'].'<br />';
-    }        
-    echo '</td></tr>';
-}
-?>
 </table>
 <br />
 <!--List of courses -->
 <table class="data_table" width="100%">
 <tr>
-  <th colspan="4"><?php echo get_lang('CourseList'); ?>
+  <th align="center" colspan="4"><?php echo get_lang('CourseList'); ?>
   	<a href="add_courses_to_session.php?page=resume_session.php&id_session=<?php echo $id_session; ?>">
-        <?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>  
+        <?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?></a>
   </th>
 </tr>
 <tr>
@@ -275,9 +258,9 @@ if ($session['nbr_courses'] == 0){
 			<td>'.$coach.'</td>
 			<td>'.$course['nbr_users'].'</td>
 			<td>
-                <a href="'.api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session.'">'.Display::return_icon('course_home.gif', get_lang('Course')).'</a>   
+                <a href="'.api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session.'">'.Display::return_icon('course_home.gif', get_lang('Course')).'</a>
                 <a href="session_course_user_list.php?id_session='.$id_session.'&course_code='.$course['code'].'">'.Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>
-				<a href="../tracking/courseLog.php?id_session='.$id_session.'&cidReq='.$course['code'].$orig_param.'&hide_course_breadcrumb=1">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;                
+				<a href="../tracking/courseLog.php?id_session='.$id_session.'&cidReq='.$course['code'].$orig_param.'&hide_course_breadcrumb=1">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>&nbsp;
 				<a href="session_course_edit.php?id_session='.$id_session.'&page=resume_session.php&course_code='.$course['code'].''.$orig_param.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>
 				<a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&idChecked[]='.$course['code'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>
 			</td>
@@ -290,7 +273,7 @@ if ($session['nbr_courses'] == 0){
 <!--List of courses -->
 <table class="data_table" width="100%">
 <tr>
-  <th colspan="4"><?php echo get_lang('UserList'); ?>
+  <th align="center" colspan="4"><?php echo get_lang('UserList'); ?>
   	<a href="add_users_to_session.php?page=resume_session.php&id_session=<?php echo $id_session; ?>">
         <?php Display::display_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL); ?>
     </a></th>
@@ -303,10 +286,10 @@ if ($session['nbr_users']==0) {
 	echo '<tr>
 			<td colspan="2">'.get_lang('NoUsersForThisSession').'</td>
 		</tr>';
-} else {    
+} else {
 	$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
-    
-    if ($multiple_url_is_on) {           
+
+    if ($multiple_url_is_on) {
         $sql = "SELECT u.user_id, lastname, firstname, username, access_url_id
                 FROM $tbl_user u
                 INNER JOIN $tbl_session_rel_user su
@@ -330,21 +313,21 @@ if ($session['nbr_users']==0) {
         if (!empty($user['user_id'])) {
             $user_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.intval($user['user_id']).'">'.api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']),ENT_QUOTES,$charset).' ('.$user['username'].')</a>';
         }
-        
+
         $link_to_add_user_in_url = '';
-        
+
         if ($multiple_url_is_on) {
-            if ($user['access_url_id'] != $url_id) {            
+            if ($user['access_url_id'] != $url_id) {
                 $user_link .= ' '.Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), array(), ICON_SIZE_SMALL);
                 $add = Display::return_icon('add.png', get_lang('AddUsersToURL'), array(), ICON_SIZE_SMALL);
                 $link_to_add_user_in_url = '<a href="resume_session.php?action=add_user_to_url&id_session='.$id_session.'&user_id='.$user['user_id'].'">'.$add.'</a>';
-            }                
+            }
         }
 		echo '<tr>
                 <td width="90%">
                     <b>'.$user_link.'</b>
                 </td>
-                <td>               
+                <td>
                     <a href="../mySpace/myStudents.php?student='.$user['user_id'].''.$orig_param.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;
                     <a href="session_course_user.php?id_user='.$user['user_id'].'&id_session='.$id_session.'">'.Display::return_icon('course.gif', get_lang('BlockCoursesForThisUser')).'</a>&nbsp;
                     <a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&user='.$user['user_id'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>

+ 2 - 32
main/admin/session_export.php

@@ -48,31 +48,14 @@ if ($_POST['formSent']) {
 	if (empty($session_id)) {
 		$sql = "SELECT id,name,id_coach,username,date_start,date_end,visibility,session_category_id FROM $tbl_session INNER JOIN $tbl_user
 					ON $tbl_user.user_id = $tbl_session.id_coach ORDER BY id";
-
-		
-		if ($_configuration['multiple_access_urls']) {
-			$tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-			$access_url_id = api_get_current_access_url_id();
-			if ($access_url_id != -1){
-			$sql = "SELECT id, name,id_coach,username,date_start,date_end,visibility,session_category_id FROM $tbl_session s INNER JOIN $tbl_session_rel_access_url as session_rel_url
-				ON (s.id= session_rel_url.session_id) INNER JOIN $tbl_user u ON (u.user_id = s.id_coach)
-				WHERE access_url_id = $access_url_id
-				ORDER BY id";
-
-			}
-		}
 		$result=Database::query($sql);
-	}
-	else
-	{
+	} else {
 		$sql = "SELECT id,name,username,date_start,date_end,visibility,session_category_id
 				FROM $tbl_session
 				INNER JOIN $tbl_user
 					ON $tbl_user.user_id = $tbl_session.id_coach
 				WHERE id='$session_id'";
-
 		$result = Database::query($sql);
-
 	}
 
 	if(Database::num_rows($result))
@@ -251,20 +234,7 @@ Display::display_header($tool_name);
 
 //select of sessions
 $sql = "SELECT id, name FROM $tbl_session ORDER BY name";
-
-if ($_configuration['multiple_access_urls']) {
-	$tbl_session_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-	$access_url_id = api_get_current_access_url_id();
-	if ($access_url_id != -1){
-	$sql = "SELECT id, name FROM $tbl_session s INNER JOIN $tbl_session_rel_access_url as session_rel_url
-		ON (s.id= session_rel_url.session_id)
-		WHERE access_url_id = $access_url_id
-		ORDER BY name";
-	}
-}
-
-
-$result=Database::query($sql);
+$result = Database::query($sql);
 
 $Sessions=Database::store_result($result);
 

+ 10 - 23
main/admin/session_import.php

@@ -39,7 +39,7 @@ $purification_option_for_usernames = false;
 
 $inserted_in_course = array();
 
-global $_configuration;                            
+global $_configuration;
 
 if ($_POST['formSent']) {
     if (isset($_FILES['import_file']['tmp_name'])) {
@@ -110,7 +110,7 @@ if ($_POST['formSent']) {
                             // When it is applicable, adding the access_url rel user relationship too.
                             Database::query($sql);
                             $return = Database::insert_id();
-                            
+
                             if ($_configuration['multiple_access_urls']) {
                                 if (api_get_current_access_url_id() != -1) {
                                     UrlManager::add_user_to_url($return, api_get_current_access_url_id());
@@ -173,12 +173,12 @@ if ($_POST['formSent']) {
                         $sql = "SELECT user_id, lastname, firstname FROM $tbl_user WHERE username='$username'";
                         $rs = Database::query($sql);
                         list($user_id, $lastname, $firstname) = Database::fetch_array($rs);
-                        
+
                         if (empty($title)) {
                             $title = $course_code;
                         }
-                        
-                        $course_info = CourseManager::create_course($title, $course_code, lang2db($description), false, 
+
+                        $course_info = CourseManager::create_course($title, $course_code, lang2db($description), false,
                                                                     api_get_person_name($firstname, $lastname, null, null, $language), '', $language, $user_id);
                     }
                 }*/
@@ -300,19 +300,6 @@ if ($_POST['formSent']) {
                             }
                         }
 
-                        // Associate the session with access_url.
-                        global $_configuration;
-                        require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
-                        if ($_configuration['multiple_access_urls']) {
-                            $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-                            $access_url_id = api_get_current_access_url_id();
-                            UrlManager::add_session_to_url($session_id, $access_url_id);
-                        } else {
-                            // We fill by default the access_url_rel_session table.
-                            UrlManager::add_session_to_url($session_id, 1);
-                        }
-
-
                         // Adding users to the new session.
                         foreach ($node_session->User as $node_user) {
                             $username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
@@ -632,19 +619,19 @@ if ($_POST['formSent']) {
                                     id_session='$session_id'";
                             $rs_course = Database::query($sql_course);
                             $course_counter++;
-                            
+
                             $course_split = array();
                             $pattern = "/\[(.*?)\]/";
                             preg_match_all($pattern, $course, $matches);
                             if (isset($matches[1])) {
-                                $course_coaches = $matches[1][0]; 
+                                $course_coaches = $matches[1][0];
                                 $course_users   = $matches[1][1];
                             }
-                            
+
                             $course_users   = explode(',', $course_users);
                             $course_coaches = explode(',', $course_coaches);
                             var_dump($course_coaches, $course_users);
-                            
+
                             // Adding coaches to session course user
                             if (!empty($course_coaches)) {
                                 foreach ($course_coaches as $course_coach) {
@@ -663,7 +650,7 @@ if ($_POST['formSent']) {
                             }
 
                             $users_in_course_counter = 0;
-                            
+
                             // Adding the relationship "Session - Course - User".
                             foreach ($course_users as $user) {
                                 $user_id = UserManager::get_user_id_from_username($user);

+ 5 - 6
main/inc/lib/database.constants.inc.php

@@ -2,16 +2,16 @@
 /* For licensing terms, see /license.txt */
 /**
  *	This is the database constants definition for Chamilo
- *  This file is called by database.lib.php and database.mysqli.lib.php  
- *  
+ *  This file is called by database.lib.php and database.mysqli.lib.php
+ *
  *  @todo the table constants have all to start with TABLE_
  *        This is because of the analogy with the tool constants TOOL_
  *
- *	@package chamilo.library 
+ *	@package chamilo.library
  */
 
 /**
- * CONSTANTS 
+ * CONSTANTS
  */
 
 //See #3910 defines the default prefix for the single course database
@@ -81,7 +81,6 @@ define('TABLE_MAIN_SEARCH_ENGINE_REF',      'search_engine_ref');
 define('TABLE_MAIN_ACCESS_URL', 'access_url');
 define('TABLE_MAIN_ACCESS_URL_REL_USER',    'access_url_rel_user');
 define('TABLE_MAIN_ACCESS_URL_REL_COURSE',  'access_url_rel_course');
-define('TABLE_MAIN_ACCESS_URL_REL_SESSION', 'access_url_rel_session');
 
 // Global calendar
 define('TABLE_MAIN_SYSTEM_CALENDAR', 'sys_calendar');
@@ -113,7 +112,7 @@ define('TABLE_MAIN_LEGAL', 'legal');
 // Dashboard blocks plugin
 define('TABLE_MAIN_BLOCK', 'block');
 
-// Statistic database tables 
+// Statistic database tables
 define('TABLE_STATISTIC_TRACK_E_LASTACCESS',        'track_e_lastaccess');
 define('TABLE_STATISTIC_TRACK_E_ACCESS',            'track_e_access');
 define('TABLE_STATISTIC_TRACK_E_LOGIN',             'track_e_login');

+ 157 - 211
main/inc/lib/sessionmanager.lib.php

@@ -15,10 +15,10 @@
 *
 *	@package chamilo.library
 */
-class SessionManager {    
+class SessionManager {
 	private function __construct() {
 	}
-    
+
     /**
      * Fetches a session from the database
      * @param   int     Session ID
@@ -32,7 +32,7 @@ class SessionManager {
         if (Database::num_rows($r) != 1) { return array(); }
         return Database::fetch_array($r,'ASSOC');
     }
-    
+
 	 /**
 	  * Create a session
 	  * @author Carlos Vargas from existing code
@@ -54,9 +54,9 @@ class SessionManager {
       * @todo use an array to replace all this parameters or use the model.lib.php ...
 	  * @return mixed       Session ID on success, error message otherwise
       **/
-	public static function create_session($sname,$syear_start,$smonth_start,$sday_start,$syear_end,$smonth_end,$sday_end,$snb_days_acess_before,$snb_days_acess_after, $nolimit,$coach_username, $id_session_category,$id_visibility, $start_limit = true, $end_limit = true, $fix_name = false) {		
+	public static function create_session($sname,$syear_start,$smonth_start,$sday_start,$syear_end,$smonth_end,$sday_end,$snb_days_acess_before,$snb_days_acess_after, $nolimit,$coach_username, $id_session_category,$id_visibility, $start_limit = true, $end_limit = true, $fix_name = false) {
 		global $_configuration;
-        
+
 		//Check portal limits
         $access_url_id = 1;
         if (api_get_multiple_access_url()) {
@@ -81,8 +81,8 @@ class SessionManager {
 		$id_session_category  = intval($id_session_category);
 		$id_visibility        = intval($id_visibility);
 		$tbl_user		      = Database::get_main_table(TABLE_MAIN_USER);
-		$tbl_session	      = Database::get_main_table(TABLE_MAIN_SESSION);        
-    
+		$tbl_session	      = Database::get_main_table(TABLE_MAIN_SESSION);
+
 		if (is_int($coach_username)) {
 			$id_coach = $coach_username;
 		} else {
@@ -99,16 +99,16 @@ class SessionManager {
 			$date_start      ="0000-00-00";
 			$date_end        ="0000-00-00";
 		}
-        
+
         if (empty($end_limit)) {
             $date_end ="0000-00-00";
             $id_visibility   = 1; // by default session visibility is read only
         }
-              
+
         if (empty($start_limit)) {
             $date_start ="0000-00-00";
-        }            
-         
+        }
+
 		if (empty($name)) {
 			$msg=get_lang('SessionNameIsRequired');
 			return $msg;
@@ -127,44 +127,41 @@ class SessionManager {
 		} else {
 		    $ready_to_create = false;
 		    if ($fix_name) {
-		        $name = self::generate_nice_next_session_name($name);		    
+		        $name = self::generate_nice_next_session_name($name);
 		        if ($name) {
 		            $ready_to_create = true;
 		        } else {
 		            $msg=get_lang('SessionNameAlreadyExists');
     				return $msg;
-		        }	        
+		        }
 		    } else {
     		    $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".$name."'");
     			if (Database::num_rows($rs)) {
     				$msg=get_lang('SessionNameAlreadyExists');
     				return $msg;
-    			} 
+    			}
     			$ready_to_create = true;
 		    }
-			
+
 			if ($ready_to_create) {
 				$sql_insert = "INSERT INTO $tbl_session(name,date_start,date_end,id_coach,session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id,visibility)
 							   VALUES('".$name."','$date_start','$date_end','$id_coach',".api_get_user_id().",".$nb_days_acess_before.", ".$nb_days_acess_after.", ".$id_session_category.", ".$id_visibility.")";
 				Database::query($sql_insert);
 				$session_id = Database::insert_id();
-                
+
                 if (!empty($session_id)) {
                     /*
                     Sends a message to the user_id = 1
-                                        
+
                     $user_info = api_get_user_info(1);
                     $complete_name = $user_info['firstname'].' '.$user_info['lastname'];
-                    $subject = api_get_setting('siteName').' - '.get_lang('ANewSessionWasCreated');                    
-                    $message = get_lang('ANewSessionWasCreated')." <br /> ".get_lang('NameOfTheSession').' : '.$name;                                        
+                    $subject = api_get_setting('siteName').' - '.get_lang('ANewSessionWasCreated');
+                    $message = get_lang('ANewSessionWasCreated')." <br /> ".get_lang('NameOfTheSession').' : '.$name;
                     api_mail_html($complete_name, $user_info['email'], $subject, $message);
-                    * 
-                    */                    
-    				//Adding to the correct URL                    
-                    $access_url_id = api_get_current_access_url_id();
-                    UrlManager::add_session_to_url($session_id,$access_url_id);            
-    
-    				// add event to system log				
+                    *
+                    */
+    				
+    				// add event to system log
     				$user_id = api_get_user_id();
     				event_system(LOG_SESSION_CREATE, LOG_SESSION_ID, $session_id, api_get_utc_datetime(), $user_id);
     		    }
@@ -172,111 +169,80 @@ class SessionManager {
 			}
 		}
 	}
-	
+
 	function session_name_exists($session_name) {
 	    $session_name = Database::escape_string($session_name);
         $result = Database::fetch_array(Database::query("SELECT COUNT(*) as count FROM ".Database::get_main_table(TABLE_MAIN_SESSION)." WHERE name = '$session_name' "));
         return $result['count'] > 0;
 	}
-    
+
     function get_count_admin() {
         $tbl_session            = Database::get_main_table(TABLE_MAIN_SESSION);
-        $tbl_session_category   = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);        
+        $tbl_session_category   = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
         $tbl_user               = Database::get_main_table(TABLE_MAIN_USER);
 
         $where = 'WHERE 1=1 ';
         $user_id = api_get_user_id();
-		
+
         if (api_is_session_admin() && api_get_setting('allow_session_admins_to_see_all_sessions') == 'false') {
             $where.=" WHERE s.session_admin_id = $user_id ";
         }
-        
+
         $query_rows = "SELECT count(*) as total_rows
          FROM $tbl_session s
             LEFT JOIN  $tbl_session_category sc ON s.session_category_id = sc.id
             INNER JOIN $tbl_user u ON s.id_coach = u.user_id
-         $where ";
-         
-        global $_configuration;
-        if ($_configuration['multiple_access_urls']) {
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-            $access_url_id = api_get_current_access_url_id();
-            if ($access_url_id != -1) {
-				$where.= " AND ar.access_url_id = $access_url_id ";
-				
-                $query_rows = "SELECT count(*) as total_rows
-                 FROM $tbl_session s
-                    LEFT JOIN  $tbl_session_category sc ON s.session_category_id = sc.id
-                    INNER JOIN $tbl_user u ON s.id_coach = u.user_id
-                    INNER JOIN $table_access_url_rel_session ar ON ar.session_id = s.id
-                 $where ";
-            }
-        }
+        $where ";
         $result_rows = Database::query($query_rows);
         $recorset = Database::fetch_array($result_rows);
         $num = $recorset['total_rows'];
-        return $num;    
+        return $num;
     }
-    
+
     /**
      * Gets the admin session list callback of the admin/session_list.php page
      * @param array order and limit keys
      */
 	public function get_sessions_admin($options) {
 		$tbl_session            = Database::get_main_table(TABLE_MAIN_SESSION);
-		$tbl_session_category   = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);        
-		$tbl_user               = Database::get_main_table(TABLE_MAIN_USER);        
+		$tbl_session_category   = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
+		$tbl_user               = Database::get_main_table(TABLE_MAIN_USER);
 
 		$where = 'WHERE 1=1 ';
 		$user_id = api_get_user_id();
-        
+
 		if (api_is_session_admin() && api_get_setting('allow_session_admins_to_see_all_sessions') == 'false') {
 			$where.=" AND s.session_admin_id = $user_id ";
-		}        
+		}
 
 		$coach_name = " CONCAT (u.lastname , ' ', u.firstname) as coach_name ";
 
-		if (api_is_western_name_order()) {            
+		if (api_is_western_name_order()) {
 			$coach_name = " CONCAT (u.firstname, ' ', u.lastname) as coach_name ";
-		}        
+		}
 
 		$today = api_get_utc_datetime();
 		$today = api_strtotime($today, 'UTC');
 		$today = date('Y-m-d', $today);
 
-		$select = "SELECT * FROM (SELECT 
-				IF ( 
-					(s.date_start <= '$today' AND '$today' < s.date_end) OR 
+		$select = "SELECT * FROM (SELECT
+				IF (
+					(s.date_start <= '$today' AND '$today' < s.date_end) OR
 					(s.date_start  = '0000-00-00' AND s.date_end  = '0000-00-00' ) OR
 					(s.date_start <= '$today' AND '0000-00-00' = s.date_end) OR
 					('$today' < s.date_end AND '0000-00-00' = s.date_start)
-				, 1, 0) 
-				as session_active, 
+				, 1, 0)
+				as session_active,
 				s.name, nbr_courses, nbr_users, s.date_start, s.date_end, $coach_name, sc.name as category_name, s.visibility, u.user_id, s.id";
 
-		$query = "$select FROM $tbl_session s 
-				LEFT JOIN  $tbl_session_category sc ON s.session_category_id = sc.id 
+		$query = "$select FROM $tbl_session s
+				LEFT JOIN  $tbl_session_category sc ON s.session_category_id = sc.id
 				INNER JOIN $tbl_user u ON s.id_coach = u.user_id ".
 			 $where;
-		global $_configuration;
-		if ($_configuration['multiple_access_urls']) {
-			$table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-			$access_url_id = api_get_current_access_url_id();
-			if ($access_url_id != -1) {
-				$where.= " AND ar.access_url_id = $access_url_id ";
-				$query = "$select
-				 FROM $tbl_session s
-					LEFT JOIN  $tbl_session_category sc ON s.session_category_id = sc.id
-					INNER JOIN $tbl_user u ON s.id_coach = u.user_id
-					INNER JOIN $table_access_url_rel_session ar ON ar.session_id = s.id
-				 $where";
-			}
-		}  
-		$query .= ") AS session_table";   
-
+		$query .= ") AS session_table";
 
 		if (!empty($options['where'])) {
-		   $query .= ' WHERE '.$options['where']; 
+		   $query .= ' WHERE '.$options['where'];
 		}
 
 		$query .= " ORDER BY ".$options['order']." LIMIT ".$options['limit'];
@@ -307,7 +273,7 @@ class SessionManager {
 				if ($session['date_end'] == '0000-00-00') {
 					$session['date_end'] = '';
 				}
-                
+
 				switch ($session['visibility']) {
 					case SESSION_VISIBLE_READ_ONLY: //1
 						$session['visibility'] =  get_lang('ReadOnly');
@@ -322,13 +288,13 @@ class SessionManager {
 			  $formatted_sessions[] = $session;
 			}
 		}
-		
+
 		return $formatted_sessions;
-	}    
-    	
+	}
+
     /**
      * Creates a new course code based in given code
-     * 
+     *
      * @param string	wanted code
      * <code>
      * $wanted_code = 'curse' if there are in the DB codes like curse1 curse2 the function will return: course3
@@ -336,12 +302,12 @@ class SessionManager {
      * </code>
      * @return string	wanted unused code
      */
-	function generate_nice_next_session_name($session_name) {        
-        $session_name_ok = !self::session_name_exists($session_name);        
-        if (!$session_name_ok) {           
+	function generate_nice_next_session_name($session_name) {
+        $session_name_ok = !self::session_name_exists($session_name);
+        if (!$session_name_ok) {
            $table = Database::get_main_table(TABLE_MAIN_SESSION);
            $session_name = Database::escape_string($session_name);
-           $sql = "SELECT count(*) as count FROM $table WHERE name LIKE '$session_name%'";           
+           $sql = "SELECT count(*) as count FROM $table WHERE name LIKE '$session_name%'";
            $result = Database::query($sql);
            if (Database::num_rows($result) > 0 ) {
 		       $row = Database::fetch_array($result);
@@ -350,13 +316,13 @@ class SessionManager {
 		       $result = self::session_name_exists($session_name);
 		       if (!$result) {
 		           return $session_name;
-		       }		    
+		       }
            }
-           return false;     
-        }     
+           return false;
+        }
         return $session_name;
     }
-    
+
 	/**
 	 * Edit a session
 	 * @author Carlos Vargas from existing code
@@ -394,7 +360,7 @@ class SessionManager {
 		$tbl_user		= Database::get_main_table(TABLE_MAIN_USER);
 		$tbl_session	= Database::get_main_table(TABLE_MAIN_SESSION);
 		$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
-              
+
 		if (empty($nolimit)) {
 			$date_start  = "$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start);
 			$date_end    = "$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end);
@@ -403,20 +369,20 @@ class SessionManager {
 			$date_end    = "0000-00-00";
 			$id_visibility = 1;//force read only
 		}
-        
+
         if (!empty($no_end_limit)) {
         	$date_end   = "0000-00-00";
         }
-        
+
         if (empty($end_limit)) {
             $date_end ="0000-00-00";
             $id_visibility = 1;//force read only
         }
-              
+
         if (empty($start_limit)) {
             $date_start ="0000-00-00";
         }
-               
+
 		if (empty($name)) {
 			$msg=get_lang('SessionNameIsRequired');
 			return $msg;
@@ -472,8 +438,7 @@ class SessionManager {
 		$tbl_session_rel_course_rel_user=	Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 		$tbl_session_rel_user=				Database::get_main_table(TABLE_MAIN_SESSION_USER);
 		$tbl_user = 						Database::get_main_table(TABLE_MAIN_USER);
-		$tbl_url_session                  = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-		
+
 		global $_user;
 		if(is_array($id_checked)) {
 			$id_checked = Database::escape_string(implode(',',$id_checked));
@@ -492,7 +457,7 @@ class SessionManager {
 		Database::query("DELETE FROM $tbl_session_rel_course WHERE id_session IN($id_checked)");
 		Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE id_session IN($id_checked)");
 		Database::query("DELETE FROM $tbl_session_rel_user WHERE id_session IN($id_checked)");
-		Database::query("DELETE FROM $tbl_url_session WHERE session_id IN($id_checked)");
+
 
 		// delete extra session fields
 		$t_sf 		= Database::get_main_table(TABLE_MAIN_SESSION_FIELD);
@@ -555,7 +520,7 @@ class SessionManager {
 			}
 		}
 		*/
-		// Add event to system log		
+		// Add event to system log
 		$user_id = api_get_user_id();
 		event_system(LOG_SESSION_DELETE, LOG_SESSION_ID, $id_checked, api_get_utc_datetime(), $user_id);
 	}
@@ -583,7 +548,7 @@ class SessionManager {
 		$session_info 		= api_get_session_info($id_session);
 		$session_name 		= $session_info['name'];
 
-		//from function parameter		
+		//from function parameter
 	   	if (empty($session_visibility)) {
 	   		$session_visibility	= $session_info['visibility']; //loaded from DB
 	   		//default status loaded if empty
@@ -596,7 +561,7 @@ class SessionManager {
 	   	}
 
         $sql = "SELECT id_user FROM $tbl_session_rel_course_rel_user WHERE id_session = '$id_session' ";
-        
+
 		$result = Database::query($sql);
 		$existingUsers = array();
 		while($row = Database::fetch_array($result)) {
@@ -630,9 +595,9 @@ class SessionManager {
 					    $emailsubject = '['.get_setting('siteName').'] '.get_lang('YourReg').' '.get_setting('siteName');
 					    $emailheaders = 'From: '.get_setting('administratorName').' '.get_setting('administratorSurname').' <'.get_setting('emailAdministrator').">\n";
 					    $emailheaders .= 'Reply-To: '.get_setting('emailAdministrator');
-		
+
 					    $emailbody	= get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".sprintf(get_lang('YouAreRegisterToSessionX'), $session_name) ." \n\n" .get_lang('Address') ." ". get_setting('siteName') ." ". get_lang('Is') ." : ". api_get_path(WEB_PATH) ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".get_setting('administratorName')." ".get_setting('administratorSurname')."\n". get_lang('Manager'). " ".get_setting('siteName')."\nT. ".get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".get_setting('emailAdministrator');
-			
+
 					    @api_send_mail($emailto, $emailsubject, $emailbody, $emailheaders);
 
 					}
@@ -656,7 +621,7 @@ class SessionManager {
 					}
 				}
 			}
-            
+
 			//Replace with this new function
             //
 			// insert new users into session_rel_course_rel_user and ignore if they already exist
@@ -683,9 +648,9 @@ class SessionManager {
 		if ($empty_users===true) {
 			Database::query("DELETE FROM $tbl_session_rel_user WHERE id_session = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH."");
 		}
-		
+
 		// Insert missing users into session
-		$nbr_users = 0;		
+		$nbr_users = 0;
 		foreach ($user_list as $enreg_user) {
 	        $enreg_user = Database::escape_string($enreg_user);
 			$nbr_users++;
@@ -694,34 +659,34 @@ class SessionManager {
 		}
 
 		// update number of users in the session
-		$nbr_users = count($user_list);		
+		$nbr_users = count($user_list);
         if ($empty_users) {
-            // update number of users in the session            
+            // update number of users in the session
             $update_sql = "UPDATE $tbl_session SET nbr_users= $nbr_users WHERE id='$id_session' ";
             Database::query($update_sql);
         } else {
             $update_sql = "UPDATE $tbl_session SET nbr_users= nbr_users + $nbr_users WHERE id='$id_session' ";
-            Database::query($update_sql);           
+            Database::query($update_sql);
         }
 	}
-    
+
     function subscribe_users_to_session_course($user_list, $session_id, $course_code, $session_visibility = SESSION_VISIBLE_READ_ONLY ) {
            	$tbl_session_rel_course				= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
             $tbl_session_rel_course_rel_user	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-            
+
             if (empty($user_list) || empty($session_id) || empty($course_code)) {
-                return false;                
+                return false;
             }
-            
+
             $session_id = intval($session_id);
             $course_code = Database::escape_string($course_code);
-            $session_visibility = intval($session_visibility);                      
-    
+            $session_visibility = intval($session_visibility);
+
             $nbr_users = 0;
 			foreach ($user_list as $enreg_user) {
 				//if (!in_array($enreg_user, $existingUsers)) {
 	                $enreg_user = intval($enreg_user);
-					$insert_sql = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user(id_session,course_code,id_user,visibility) 
+					$insert_sql = "INSERT IGNORE INTO $tbl_session_rel_course_rel_user(id_session,course_code,id_user,visibility)
                                    VALUES ('$session_id','$course_code','$enreg_user','$session_visibility')";
 					Database::query($insert_sql);
 					if (Database::affected_rows()) {
@@ -1105,7 +1070,7 @@ class SessionManager {
         		VALUES('".Database::escape_string($name)."','$date_start','$date_end', '$access_url_id')";
         Database::query($sql);
         $id_session = Database::insert_id();
-        // Add event to system log        
+        // Add event to system log
         $user_id = api_get_user_id();
         event_system(LOG_SESSION_CATEGORY_CREATE, LOG_SESSION_CATEGORY_ID, $id_session, api_get_utc_datetime(), $user_id);
         return $id_session;
@@ -1182,11 +1147,11 @@ class SessionManager {
 		} else {
 			$id_checked = intval($id_checked);
 		}
-		
+
 		//Setting session_category_id to 0
 		$sql = "UPDATE $tbl_session SET session_category_id = 0 WHERE session_category_id IN (".$id_checked.")";
         $result = Database::query($sql);
-        
+
 		$sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")";
 		$result = @Database::query($sql);
 		while ($rows = Database::fetch_array($result)) {
@@ -1203,9 +1168,9 @@ class SessionManager {
 		$rs = @Database::query($sql);
 		$result = Database::affected_rows();
 
-		// Add event to system log		
+		// Add event to system log
 		$user_id = api_get_user_id();
-        
+
 		event_system(LOG_SESSION_CATEGORY_DELETE, LOG_SESSION_CATEGORY_ID, $id_checked, api_get_utc_datetime(), $user_id);
 
 
@@ -1247,19 +1212,15 @@ class SessionManager {
 		$session_table                = Database::get_main_table(TABLE_MAIN_SESSION);
 		$session_category_table       = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
 		$user_table                   = Database::get_main_table(TABLE_MAIN_USER);
-		$table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-		
-		$access_url_id = api_get_current_access_url_id();
-		  
+
         $return_array = array();
 
 		$sql_query = " SELECT s.id, s.name, s.nbr_courses, s.date_start, s.date_end, u.firstname, u.lastname, sc.name as category_name, s.promotion_id
 				FROM $session_table s
 				INNER JOIN $user_table u ON s.id_coach = u.user_id
-				INNER JOIN $table_access_url_rel_session ar ON ar.session_id = s.id
 				LEFT JOIN  $session_category_table sc ON s.session_category_id = sc.id
-				WHERE ar.access_url_id = $access_url_id ";
-        
+				WHERE 1=1 ";
+
 		if (count($conditions)>0) {
 			$sql_query .= ' AND ';
 			foreach ($conditions as $field=>$value) {
@@ -1280,7 +1241,7 @@ class SessionManager {
         }
 		return $return_array;
 	}
-	
+
 	/**
 	 * Get the session category information by id
 	 * @param string session category ID
@@ -1298,16 +1259,16 @@ class SessionManager {
 			return false;
 		}
 	}
-	
+
 	/**
 	 * Get all session categories (filter by access_url_id)
 	 * @return mixed false if the session category does not exist, array if the session category exists
 	 */
-	public static function get_all_session_category() {		
+	public static function get_all_session_category() {
 		$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
 		$id = api_get_current_access_url_id();
 		$sql = 'SELECT * FROM '.$tbl_session_category.' WHERE access_url_id ="'.$id.'" ORDER BY name ASC';
-		$result = Database::query($sql);		
+		$result = Database::query($sql);
 		if (Database::num_rows($result) > 0 ){
 		    $data = Database::store_result($result,'ASSOC');
 		    return $data;
@@ -1408,19 +1369,15 @@ class SessionManager {
         // Database Table Definitions
         $tbl_session                    =   Database::get_main_table(TABLE_MAIN_SESSION);
         $tbl_session_rel_user           =   Database::get_main_table(TABLE_MAIN_SESSION_USER);
-        $tbl_session_rel_course_user    =   Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);        
-        $tbl_session_rel_access_url     =   Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);        
+        $tbl_session_rel_course_user    =   Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 
         $hr_manager_id = intval($hr_manager_id);
         $affected_rows = 0;
 
         //Deleting assigned sessions to hrm_id
-        if ($_configuration['multiple_access_urls']) {  
-            $sql = "SELECT id_session FROM $tbl_session_rel_user s INNER JOIN $tbl_session_rel_access_url a ON (a.session_id = s.id_session) WHERE id_user = $hr_manager_id AND relation_type=".SESSION_RELATION_TYPE_RRHH." AND access_url_id = ".api_get_current_access_url_id()."";
-        } else {
-            $sql = "SELECT id_session FROM $tbl_session_rel_user s WHERE id_user = $hr_manager_id AND relation_type=".SESSION_RELATION_TYPE_RRHH."";
-        }
-        $result = Database::query($sql);  
+         $sql = "SELECT id_session FROM $tbl_session_rel_user s WHERE id_user = $hr_manager_id AND relation_type=".SESSION_RELATION_TYPE_RRHH."";
+
+        $result = Database::query($sql);
 
         if (Database::num_rows($result) > 0) {
             while ($row = Database::fetch_array($result))   {
@@ -1450,7 +1407,6 @@ class SessionManager {
 			}
 		}
 		return $affected_rows;
-
 	}
 
 	/**
@@ -1463,18 +1419,13 @@ class SessionManager {
 		// Database Table Definitions
 		$tbl_session 			= 	Database::get_main_table(TABLE_MAIN_SESSION);
 		$tbl_session_rel_user 	= 	Database::get_main_table(TABLE_MAIN_SESSION_USER);
-        $tbl_session_rel_access_url =   Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
 
 		$hr_manager_id = intval($hr_manager_id);
 		$assigned_sessions_to_hrm = array();
 
-		if ($_configuration['multiple_access_urls']) {   
-           $sql = "SELECT * FROM $tbl_session s INNER JOIN $tbl_session_rel_user sru ON (sru.id_session = s.id) LEFT JOIN $tbl_session_rel_access_url a  ON (s.id = a.session_id)
-                   WHERE sru.id_user = '$hr_manager_id' AND sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND access_url_id = ".api_get_current_access_url_id()."";
-        } else {
-            $sql = "SELECT * FROM $tbl_session s
-                     INNER JOIN $tbl_session_rel_user sru ON sru.id_session = s.id AND sru.id_user = '$hr_manager_id' AND sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' ";   
-        }
+        $sql = "SELECT * FROM $tbl_session s INNER JOIN $tbl_session_rel_user sru
+                ON sru.id_session = s.id AND sru.id_user = '$hr_manager_id' AND sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' ";
+
 		$rs_assigned_sessions = Database::query($sql);
 		if (Database::num_rows($rs_assigned_sessions) > 0) {
 			while ($row_assigned_sessions = Database::fetch_array($rs_assigned_sessions))	{
@@ -1484,7 +1435,7 @@ class SessionManager {
 		return $assigned_sessions_to_hrm;
 	}
 
-	
+
 
 	/**
 	 * Gets the list of courses by session filtered by access_url
@@ -1494,9 +1445,9 @@ class SessionManager {
 	public static function get_course_list_by_session_id ($session_id) {
 		$tbl_course				= Database::get_main_table(TABLE_MAIN_COURSE);
 		$tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
-        
+
 		// select the courses
-		$sql = "SELECT * FROM $tbl_course c INNER JOIN $tbl_session_rel_course src ON c.code = src.course_code 
+		$sql = "SELECT * FROM $tbl_course c INNER JOIN $tbl_session_rel_course src ON c.code = src.course_code
 		        WHERE src.id_session = '$session_id' ORDER BY title;";
 		$result 	= Database::query($sql);
 		$num_rows 	= Database::num_rows($result);
@@ -1528,11 +1479,11 @@ class SessionManager {
 			return 0;
 		}
 	}
-    
+
     /**
      * Get users by session
      * @param   int sesssion id
-     * @param	int	filter by status 
+     * @param	int	filter by status
      * @return  array a list with an user list
      */
     public static function get_users_by_session($id, $with_status = false) {
@@ -1546,35 +1497,35 @@ class SessionManager {
         $sql = 'SELECT '.$tbl_user.'.user_id, lastname, firstname, username
                 FROM '.$tbl_user.'
                 INNER JOIN '.$tbl_session_rel_user.'
-                    ON '.$tbl_user.'.user_id = '.$tbl_session_rel_user.'.id_user 
+                    ON '.$tbl_user.'.user_id = '.$tbl_session_rel_user.'.id_user
                     AND '.$tbl_session_rel_user.'.id_session = '.$id;
         if ($with_status !== false) {
         	$with_status = intval($with_status);
         	$sql .= " WHERE relation_type = $with_status ";
-        }        
+        }
         $result = Database::query($sql);
         while ($row = Database::fetch_array($result,'ASSOC')) {
             $return_array[] = $row;
         }
-        
+
         return $return_array;
     }
-    
+
     public static function get_sessions_by_coach($user_id) {
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
-        return Database::select('*', $session_table, array('where'=>array('id_coach = ?'=>$user_id)));    	
+        return Database::select('*', $session_table, array('where'=>array('id_coach = ?'=>$user_id)));
     }
-    
+
     /*
     public static function get_coaches_by_session($session_id, $course_code) {
         $tbl_session_rel_course_rel_user    = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
         $tbl_user                           = Database::get_main_table(TABLE_MAIN_USER);
-        
+
         $sql = "SELECT user.user_id
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
-                WHERE session_rcru.id_user = user.user_id AND 
-                session_rcru.id_session = '".intval($session_id)."' AND 
-                session_rcru.course_code ='".Database::escape_string($course_code)."' AND 
+                WHERE session_rcru.id_user = user.user_id AND
+                session_rcru.id_session = '".intval($session_id)."' AND
+                session_rcru.course_code ='".Database::escape_string($course_code)."' AND
                 session_rcru.status = 2 ";
         $result = Database::query($sql);
         while ($row = Database::fetch_array($result,'ASSOC')) {
@@ -1582,9 +1533,9 @@ class SessionManager {
         }
         return $return_array;
     }*/
-    
+
     /**
-     * Gets user status within a session 
+     * Gets user status within a session
      * @param $user_id
      * @param $course_code
      * @param $session_id
@@ -1592,13 +1543,13 @@ class SessionManager {
      */
     public function get_user_status_in_session($user_id, $course_code, $session_id) {
         $tbl_session_rel_course_rel_user    = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-        $tbl_user                           = Database::get_main_table(TABLE_MAIN_USER);        
+        $tbl_user                           = Database::get_main_table(TABLE_MAIN_USER);
         $sql = "SELECT session_rcru.status
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
-                WHERE session_rcru.id_user = user.user_id AND 
-                session_rcru.id_session = '".intval($session_id)."' AND 
-                session_rcru.course_code ='".Database::escape_string($course_code)."' AND 
-                user.user_id = ".intval($user_id);        
+                WHERE session_rcru.id_user = user.user_id AND
+                session_rcru.id_session = '".intval($session_id)."' AND
+                session_rcru.course_code ='".Database::escape_string($course_code)."' AND
+                user.user_id = ".intval($user_id);
         $result = Database::query($sql);
         $status = false;
         if (Database::num_rows($result)) {
@@ -1607,32 +1558,32 @@ class SessionManager {
         }
         return $status;
     }
-        
-    
+
+
     public static function get_session_by_user($coach_id, $user_id) {
-    	
+
     }
-    
+
     function get_all_sessions_by_promotion($id) {
         $t = Database::get_main_table(TABLE_MAIN_SESSION);
         return Database::select('*', $t, array('where'=>array('promotion_id = ?'=>$id)));
     }
-    
+
     function suscribe_sessions_to_promotion($promotion_id, $list) {
         $t = Database::get_main_table(TABLE_MAIN_SESSION);
         $params = array();
-        $params['promotion_id'] = 0;             
+        $params['promotion_id'] = 0;
         Database::update($t, $params, array('promotion_id = ?'=>$promotion_id));
-        
+
         $params['promotion_id'] = $promotion_id;
         if (!empty($list)) {
             foreach ($list as $session_id) {
                 $session_id= intval($session_id);
                 Database::update($t, $params, array('id = ?'=>$session_id));
-            }                
+            }
         }
     }
-    
+
     /**
     * Updates a session status
     * @param	int 	session id
@@ -1643,9 +1594,9 @@ class SessionManager {
         $params['visibility'] = $status;
     	Database::update($t, $params, array('id = ?'=>$session_id));
     }
-    
+
     /**
-     * Copies a session with the same data to a new session. 
+     * Copies a session with the same data to a new session.
      * The new copy is not assigned to the same promotion. @see suscribe_sessions_to_promotions() for that
      * @param   int     Session ID
      * @param   bool    Whether to copy the relationship with courses
@@ -1670,7 +1621,7 @@ class SessionManager {
         $s['day_start']     = substr($s['date_start'],8,2);
         $s['year_end']      = substr($s['date_end'],0,4);
         $s['month_end']     = substr($s['date_end'],5,2);
-        $s['day_end']       = substr($s['date_end'],8,2);        
+        $s['day_end']       = substr($s['date_end'],8,2);
         $consider_start = true;
         if ($s['year_start'].'-'.$s['month_start'].'-'.$s['day_start'] == '0000-00-00') {
             $consider_start = false;
@@ -1679,22 +1630,22 @@ class SessionManager {
         if ($s['year_end'].'-'.$s['month_end'].'-'.$s['day_end'] == '0000-00-00') {
             $consider_end = false;
         }
-        
+
         $sid = self::create_session($s['name'].' '.get_lang('Copy'),
              $s['year_start'], $s['month_start'], $s['day_start'],
              $s['year_end'],$s['month_end'],$s['day_end'],
              $s['nb_days_acess_before_beginning'],$s['nb_days_acess_after_end'],
              false,(int)$s['id_coach'], $s['session_category_id'],
              (int)$s['visibility'],$consider_start, $consider_end, true);
-        
+
         if (!is_numeric($sid) || empty($sid)) {
         	return false;
         }
-        
+
         if ($copy_courses) {
             // Register courses from the original session to the new session
             $courses = self::get_course_list_by_session_id($id);
-            
+
             $short_courses = $new_short_courses = array();
             if (is_array($courses) && count($courses)>0) {
             	foreach ($courses as $course) {
@@ -1702,7 +1653,7 @@ class SessionManager {
             	}
             }
             $courses = null;
-            
+
             //We will copy the current courses of the session to new courses
             if (!empty($short_courses)) {
                 if ($create_new_courses) {
@@ -1710,20 +1661,20 @@ class SessionManager {
                     if (function_exists('ini_set')) {
                     	ini_set('memory_limit','256M');
                     	ini_set('max_execution_time',0);
-                    }      
-                    $params = array();                    
-                    $params['skip_lp_dates'] = true;                    
-                    
+                    }
+                    $params = array();
+                    $params['skip_lp_dates'] = true;
+
                     foreach ($short_courses as $course_data) {
                         $course_info = CourseManager::copy_course_simple($course_data['title'].' '.get_lang('Copy'), $course_data['course_code'], $id, $sid, $params);
                         if ($course_info) {
                             //By default new elements are invisible
-                            if ($set_exercises_lp_invisible) {    
+                            if ($set_exercises_lp_invisible) {
                                 require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php';
                                 $list       = new LearnpathList('', $course_info['code'], $sid);
-                                $flat_list  = $list->get_flat_list(); 
-                                if (!empty($flat_list)) {                               
-                                    foreach($flat_list as $lp_id => $data) { 
+                                $flat_list  = $list->get_flat_list();
+                                if (!empty($flat_list)) {
+                                    foreach($flat_list as $lp_id => $data) {
                                         api_item_property_update($course_info, TOOL_LEARNPATH, $lp_id, 'invisible', api_get_user_id(), 0 ,0, 0, 0, $sid);
                                         api_item_property_update($course_info, TOOL_LEARNPATH, $lp_id, 'invisible', api_get_user_id(), 0 ,0, 0, 0);
                                     }
@@ -1732,11 +1683,11 @@ class SessionManager {
                                 $course_id	 = $course_info['real_id'];
                                 //@todo check this query
                                 $sql = "UPDATE $quiz_table SET active = 0 WHERE c_id = $course_id ";
-                                $result=Database::query($sql);                                
+                                $result=Database::query($sql);
                             }
                             $new_short_courses[] = $course_info['code'];
-                        }                             
-                    }                    
+                        }
+                    }
                 } else {
                     foreach($short_courses as $course_data) {
                          $new_short_courses[] = $course_data['code'];
@@ -1763,15 +1714,15 @@ class SessionManager {
         }
     	return $sid;
     }
-    
+
     function user_is_general_coach($user_id, $session_id) {
     	$session_id = intval($session_id);
     	$user_id = intval($user_id);
-    	$session_table = Database::get_main_table(TABLE_MAIN_SESSION);    	
+    	$session_table = Database::get_main_table(TABLE_MAIN_SESSION);
     	$sql = "SELECT DISTINCT id
 	         	FROM $session_table
 	         	WHERE session.id_coach =  '".$user_id."' AND id = '$session_id'";
-    	$result = Database::query($sql);	
+    	$result = Database::query($sql);
     	if ($result && Database::num_rows($result)) {
     		return true;
     	}
@@ -1782,14 +1733,9 @@ class SessionManager {
      * @param  int ID of the URL we want to filter on (optional)
      * @return int Number of sessions
      */
-    public function count_sessions($access_url_id=null) {
+    public function count_sessions() {
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
-        $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
         $sql = "SELECT count(id) FROM $session_table s";
-        if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
-            $sql .= ", $access_url_rel_session_table u ".
-                    " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
-        }
         $res = Database::query($sql);
         $row = Database::fetch_row($res);
         return $row[0];

Datei-Diff unterdrückt, da er zu groß ist
+ 185 - 255
main/inc/lib/tracking.lib.php


+ 7 - 151
main/inc/lib/urlmanager.lib.php

@@ -204,22 +204,14 @@ class UrlManager
 	 * @param int  access url id
 	 * @return array   Database::store_result of the result
 	 * */
-	public static function get_url_rel_session_data($access_url_id='')
-	{
-		$where ='';
-		$table_url_rel_session	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-		$tbl_session 			= Database :: get_main_table(TABLE_MAIN_SESSION);
-
-		if (!empty($access_url_id))
-			$where ="WHERE $table_url_rel_session.access_url_id = ".Database::escape_string($access_url_id);
+	public static function get_url_rel_session_data($access_url_id='') {
 
+		$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
 		$sql="SELECT id, name, access_url_id
 				FROM $tbl_session u
 				INNER JOIN $table_url_rel_session
 				ON $table_url_rel_session.session_id = id
-				$where
 				ORDER BY name, id";
-
 		$result=Database::query($sql);
 		$sessions=Database::store_result($result);
 		return $sessions;
@@ -280,24 +272,6 @@ class UrlManager
 	}
 
 
-	/**
-	* Checks the relationship between an URL and a Session (return the num_rows)
-	* @author Julio Montoya
-	* @param int user id
-	* @param int url id
-	* @return boolean true if success
-	* */
-	public static function relation_url_session_exist($session_id, $url_id) {
-		$table_url_rel_session= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);		
-		$session_id = intval($session_id);
-		$url_id		= intval($url_id);		
-		$sql= "SELECT session_id FROM $table_url_rel_session WHERE access_url_id = ".Database::escape_string($url_id)." AND session_id = ".Database::escape_string($session_id);
-		$result 	= Database::query($sql);
-		$num 		= Database::num_rows($result);
-		return $num;
-	}
-
-
 	/**
 	 * Add a group of users into a group of URLs
 	 * @author Julio Montoya
@@ -359,36 +333,6 @@ class UrlManager
 	}
 
 
-	/**
-	 * Add a group of sessions into a group of URLs
-	 * @author Julio Montoya
-	 * @param  array of session ids
-	 * @param  array of url_ids
-	 * */
-	public static function add_sessions_to_urls($session_list,$url_list)
-	{
-		$table_url_rel_session= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-		$result_array=array();
-
-		if (is_array($session_list) && is_array($url_list)){
-			foreach ($url_list as $url_id) {
-				foreach ($session_list as $session_id) {
-					$count = UrlManager::relation_url_session_exist($session_id,$url_id);
-					
-					if ($count==0) {
-						$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);
-						if($result)
-							$result_array[$url_id][$session_id]=1;
-						else
-							$result_array[$url_id][$session_id]=0;
-					}
-				}
-			}
-		}
-		return 	$result_array;
-	}
 
 	/**
 	 * Add a user into a url
@@ -422,28 +366,6 @@ class UrlManager
 		return $result;
 	}
 
-    /**
-     * Inserts a session to a URL (access_url_rel_session table)
-     * @param   int     Session ID
-     * @param   int     URL ID
-     * @return  bool    True on success, false session already exists or insert failed
-     */
-	public static 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;
-		$result = false;
-		$count = UrlManager::relation_url_session_exist($session_id,$url_id);
-		$session_id	= intval($session_id);
-		if (empty($count) && !empty($session_id)) {			
-			$url_id = intval($url_id);
-			$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);
-		}
-		return $result;
-	}
-
-
 	/**
 	* Deletes an url and user relationship
 	* @author Julio Montoya
@@ -476,33 +398,18 @@ class UrlManager
 		return $result;
 	}
 
-	/**
-	* Deletes an url and session relationship
-	* @author Julio Montoya
-	* @param  char  course code
-	* @param  int url id
-	* @return boolean true if success
-	* */
-	public static function delete_url_rel_session($session_id, $url_id) {
-		$table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-		$sql= "DELETE FROM $table_url_rel_session WHERE session_id = ".Database::escape_string($session_id)." AND access_url_id=".Database::escape_string($url_id)."  ";
-		$result = Database::query($sql,'ASSOC');
-		return $result;
-	}
-
-
 	/**
 	 * Updates the access_url_rel_user table  with a given user list
 	 * @author Julio Montoya
 	 * @param array user list
 	 * @param int access_url_id
 	 * */
-	public static function update_urls_rel_user($user_list, $access_url_id) {		
+	public static function update_urls_rel_user($user_list, $access_url_id) {
 		$table_url_rel_user	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 		$sql = "SELECT user_id FROM $table_url_rel_user WHERE access_url_id = ".intval($access_url_id);
 		$result = Database::query($sql);
 		$existing_users = array();
-        
+
         //Getting all users
 		while($row = Database::fetch_array($result)){
 			$existing_users[] = $row['user_id'];
@@ -518,7 +425,7 @@ class UrlManager
                 }
 			}
 		}
-        
+
         $users_deleted = array();
 		//deleting old users
 		foreach($existing_users as $user_id_to_delete) {
@@ -529,7 +436,7 @@ class UrlManager
                 }
 			}
 		}
-        
+
         if (empty($users_added) && empty($users_deleted)) {
             return false;
         }
@@ -574,44 +481,6 @@ class UrlManager
 		}
 	}
 
-	/**
-	 * Updates the access_url_rel_session table with a given user list
-	 * @author Julio Montoya
-	 * @param array user list
-	 * @param int access_url_id
-	 * */
-	public static function update_urls_rel_session($session_list,$access_url_id) {
-		$table_session	= Database :: get_main_table(TABLE_MAIN_SESSION);
-		$table_url_rel_session	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-
-		$sql = "SELECT session_id FROM $table_url_rel_session WHERE access_url_id=".Database::escape_string($access_url_id);
-		$result = Database::query($sql);
-		$existing_sessions = array();
-
-		while($row = Database::fetch_array($result)){
-			$existing_sessions[] = $row['session_id'];
-		}
-
-		//adding users
-		foreach($session_list as $session) {
-			if(!in_array($session, $existing_sessions)) {
-				if (!empty($session) && !empty($access_url_id)) {
-					UrlManager::add_session_to_url($session, $access_url_id);
-				}	
-			}
-		}
-
-		//deleting old users
-		foreach($existing_sessions as $existing_session) {
-			if(!in_array($existing_session, $session_list)) {
-				if (!empty($existing_session) && !empty($access_url_id)) {
-					UrlManager::delete_url_rel_session($existing_session,$access_url_id);
-				}
-			}
-		}
-	}
-
-
 	public static function get_access_url_from_user($user_id) {
 		$table_url_rel_user	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 		$table_url	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
@@ -622,24 +491,11 @@ class UrlManager
 		$url_list = Database::store_result($result,'ASSOC');
 		return $url_list;
 	}
-	
-   public static function get_access_url_from_session($session_id) {
-        $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-        $table_url  = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
-        $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session INNER JOIN $table_url u
-                ON (url_rel_session.access_url_id = u.id)
-                WHERE session_id = ".Database::escape_string($session_id);
-        $result = Database::query($sql);
-        $url_list = Database::store_result($result);
-        return $url_list;
-    }
-    
 
 	/**
 	 *
 	 * */
-	public static function get_url_id($url)
-	{
+	public static function get_url_id($url) {
 		$table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
 		$sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."'";
 		$result = Database::query($sql);

Datei-Diff unterdrückt, da er zu groß ist
+ 171 - 181
main/inc/lib/usermanager.lib.php


+ 0 - 8
main/install/db_main.sql

@@ -1550,14 +1550,6 @@ CREATE TABLE IF NOT EXISTS access_url_rel_course (
   PRIMARY KEY (access_url_id, course_code)
 );
 
-
-DROP TABLE IF EXISTS access_url_rel_session;
-CREATE TABLE IF NOT EXISTS access_url_rel_session (
-  access_url_id int unsigned NOT NULL,
-  session_id int unsigned NOT NULL,
-  PRIMARY KEY (access_url_id, session_id)
-);
-
 --
 -- Table structure for table sys_calendar
 --

+ 1 - 0
main/install/migrate-db-1.8.8-1.9.0-pre.sql

@@ -258,6 +258,7 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value,
 INSERT INTO settings_options (variable, value, display_text) values ('platform_unsubscribe_allowed', 'true', 'Yes');
 INSERT INTO settings_options (variable, value, display_text) values ('platform_unsubscribe_allowed', 'false', 'No');
 
+DROP TABLE IF EXISTS access_url_rel_session;
 
 -- Do not move this query
 UPDATE settings_current SET selected_value = '1.9.0.18163' WHERE variable = 'chamilo_database_version';

+ 59 - 81
main/mySpace/index.php

@@ -120,15 +120,15 @@ global $_configuration;
 if (api_is_allowed_to_create_course() || api_is_drh()) {
 }
 
-if ($is_platform_admin) {	
+if ($is_platform_admin) {
 	if ($view == 'admin') {
 		$title = get_lang('CoachList');
 		$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_self().'?view=teacher');
-		$menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin');		
-        $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');        
-        $menu_items[] = Display::url(Display::return_icon('statistics.png', get_lang('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php');        
-	} else {		
-		$menu_items[] = Display::return_icon('teacher_na.png', get_lang('TeacherInterface'), array(), 32);		
+		$menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin');
+        $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
+        $menu_items[] = Display::url(Display::return_icon('statistics.png', get_lang('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php');
+	} else {
+		$menu_items[] = Display::return_icon('teacher_na.png', get_lang('TeacherInterface'), array(), 32);
 		$menu_items[] = Display::url(Display::return_icon('star.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin');
         $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
         $menu_items[] = Display::url(Display::return_icon('statistics.png', get_lang('CurrentCoursesReport'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/current_courses.php');
@@ -147,47 +147,47 @@ echo '<div id="actions" class="actions">';
 
 echo '<span style="float:right">';
 
-if ($display == 'useroverview' || $display == 'sessionoverview' || $display == 'courseoverview') {    
+if ($display == 'useroverview' || $display == 'sessionoverview' || $display == 'courseoverview') {
 	echo '<a href="'.api_get_self().'?display='.$display.'&export=csv&view='.$view.'">';
     echo Display::return_icon("export_csv.png", get_lang('ExportAsCSV'),array(), 32);
-    echo '</a>';        
+    echo '</a>';
 }
 echo '<a href="javascript: void(0);" onclick="javascript: window.print()">'.Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
 echo '</span>';
-    
+
 if (!empty($session_id)) {
 	echo '<a href="index.php">'.Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
 } else {
 	echo Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
-} 
+}
 
 // Actions menu
 $nb_menu_items = count($menu_items);
 if (empty($session_id)) {
 	if ($nb_menu_items > 1) {
     	foreach ($menu_items as $key => $item) {
-	    	echo $item;    			
+	    	echo $item;
 		}
 	}
-}		
+}
 echo '</div>';
 
 if (empty($session_id)) {
-	
+
 	//Getting courses followed by a coach (No session courses)
-	$courses  = CourseManager::get_course_list_as_coach($user_id, false);	
-	
+	$courses  = CourseManager::get_course_list_as_coach($user_id, false);
+
 	if (isset($courses[0])) {
-		$courses = $courses[0]; 
+		$courses = $courses[0];
 	}
-	
+
 	//Getting students from courses and courses in sessions (For show the total students that the user follows)
 	$students 		= CourseManager::get_user_list_from_courses_as_coach($user_id);
-		
+
 	// Sessions for the coach
-	$sessions 	 	= Tracking::get_sessions_coached_by_user($user_id);	
-	
-	//If is drh	
+	$sessions 	 	= Tracking::get_sessions_coached_by_user($user_id);
+
+	//If is drh
 	if ($is_drh) {
 		// get data for human resources manager
 		$students = array_keys(UserManager::get_users_followed_by_drh($user_id, STUDENT));
@@ -196,25 +196,25 @@ if (empty($session_id)) {
 			$courses[$course['code']] = $course['code'];
 		}
 	}
-		
-	
+
+
 	//Courses for the user
 	$count_courses = count($courses);
-	
+
 	//Sessions for the user
 	$count_sessions = count($sessions);
-		
-	//Students	
+
+	//Students
 	$nb_students = count($students);
-	
-	
+
+
 	$total_time_spent 			= 0;
 	$total_courses 				= 0;
 	$avg_total_progress 		= 0;
 	$avg_results_to_exercises 	= 0;
 	$nb_inactive_students 		= 0;
 	$nb_posts = $nb_assignments = 0;
-	    
+
 	if (!empty($students))
 	foreach ($students as $student_id) {
 		// inactive students
@@ -226,7 +226,7 @@ if (empty($session_id)) {
 		} else {
 			$nb_inactive_students++;
 		}
-	
+
 		$total_time_spent += Tracking :: get_time_spent_on_the_platform($student_id);
 		$total_courses += Tracking :: count_course_per_student($student_id);
 		$avg_student_progress = $avg_student_score = 0;
@@ -238,10 +238,10 @@ if (empty($session_id)) {
 				$nb_assignments 	   += Tracking :: count_student_assignments($student_id, $course_code);
 				$avg_student_progress  += Tracking :: get_avg_student_progress($student_id, $course_code);
 				$myavg_temp 			= Tracking :: get_avg_student_score($student_id, $course_code);
-	
+
 				 if (is_numeric($myavg_temp))
 				 	$avg_student_score += $myavg_temp;
-	
+
 				if ($nb_posts !== null && $nb_assignments !== null && $avg_student_progress !== null && $avg_student_score !== null) {
 					//if one of these scores is null, it means that we had a problem connecting to the right database, so don't count it in
 					$nb_courses_student++;
@@ -251,16 +251,16 @@ if (empty($session_id)) {
 		// average progress of the student
 		$avg_student_progress = $nb_courses_student ?$avg_student_progress / $nb_courses_student:0;
 		$avg_total_progress += $avg_student_progress;
-	
+
 		// average test results of the student
 		$avg_student_score = $avg_student_score?$avg_student_score / $nb_courses_student:0;
 		$avg_results_to_exercises += $avg_student_score;
 	}
 
 	if ($nb_students > 0 && $view != 'admin') {
-		
+
 		echo Display::page_subheader('<img src="'.api_get_path(WEB_IMG_PATH).'students.gif">&nbsp;'.get_lang('Students').' ('.$nb_students.')');
-		
+
 		// average progress
 		$avg_total_progress = $avg_total_progress / $nb_students;
 		// average results to the tests
@@ -273,7 +273,7 @@ if (empty($session_id)) {
 		$nb_assignments = $nb_assignments / $nb_students;
 		// average posts
 		$nb_posts = $nb_posts / $nb_students;
-		
+
 		if ($export_csv) {
 			//csv part
 			$csv_content[] = array(get_lang('Students', ''));
@@ -288,7 +288,7 @@ if (empty($session_id)) {
 		} else {
 			// html part
 			echo '
-				 <div class="report_section">			
+				 <div class="report_section">
 					<table class="data_table">
 						<tr>
 							<td>'.get_lang('InactivesStudents').'</td>
@@ -322,7 +322,7 @@ if (empty($session_id)) {
 					<a href="student.php">'.get_lang('SeeStudentList').'</a>
 				 </div><br />';
 		}
-		
+
 	} else {
 		$avg_total_progress = null;
 		$avg_results_to_exercises = null;
@@ -332,8 +332,8 @@ if (empty($session_id)) {
 		$nb_posts = null;
 	}
 } else {
-	$courses = Tracking::get_courses_followed_by_coach($user_id, $session_id);	
-	   
+	$courses = Tracking::get_courses_followed_by_coach($user_id, $session_id);
+
     //Courses for the user
     $count_courses = count($courses);
 }
@@ -353,12 +353,12 @@ if ($count_courses || $count_sessions) {
 }
 
 if (api_is_allowed_to_create_course() && $view == 'teacher') {
-	
+
 	//Courses
 	if ($count_courses) {
-		
-		echo Display::page_subheader($title);		
-		
+
+		echo Display::page_subheader($title);
+
 		$table = new SortableTable('courses_my_space', 'get_number_of_courses', array('MySpace','get_course_data'));
 		$parameters['view'] = 'teacher';
 		$parameters['class'] = 'data_table';
@@ -397,12 +397,12 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') {
 
 		$all_data = array();
 		foreach ($sessions as $session) {
-			
+
 			$count_courses_in_session = count(Tracking::get_courses_followed_by_coach($user_id, $session['id']));
 			$row = array();
 			$row[] = $session['name'];
 
-			if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {				
+			if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') {
 				$row[] = get_lang('From').' '.api_format_date($session['date_start'], DATE_FORMAT_SHORT).' '.get_lang('Until').' '.api_format_date($session['date_end'], DATE_FORMAT_SHORT);
 			} else {
 				$row[] = ' - ';
@@ -433,9 +433,9 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') {
 		$table -> setColAttributes(1, array('align' => 'center'));
 		$table -> setColAttributes(2, array('align' => 'center'));
 		$table -> setColAttributes(3, array('align' => 'center'));
-		
+
 		/*  Start session over view stats */
-		
+
 		$nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0;
 		$courses = array();
 		foreach ($sessions as $session) {
@@ -456,15 +456,15 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') {
 			}
 			$courses = array_merge($courses, Tracking::get_courses_list_from_session($session['id']));
 		}
-		
+
 		if ($nb_sessions > 0) {
 			$nb_courses_per_session = round(count($courses) / $nb_sessions, 2);
 			$nb_students_per_session = round($nb_students / $nb_sessions, 2);
 		} else {
 			$nb_courses_per_session = null;
 			$nb_students_per_session = null;
-		}		
-		
+		}
+
 		if ($export_csv) {
 			//csv part
 			$csv_content[] = array(get_lang('Sessions', ''));
@@ -477,7 +477,7 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') {
 		} else {
 			// html part
 			echo '
-			<div class="report_section">				
+			<div class="report_section">
 				<table class="data_table">
 					<tr>
 						<td>'.get_lang('NbActiveSessions').'</td>
@@ -499,28 +499,28 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') {
 						<td>'.get_lang('NbCoursesPerSession').'</td>
 						<td align="right">'.(is_null($nb_courses_per_session) ? '' : $nb_courses_per_session).'</td>
 					</tr>
-				</table>				
+				</table>
 			</div>';
 		}
-		/*  End session overview */				 
+		/*  End session overview */
 		$table -> display();
 	}
 }
 
 
 if ($is_platform_admin && $view == 'admin' && $display != 'yourstudents') {
-    
+
 	echo '<a href="'.api_get_self().'?view=admin&amp;display=coaches">'.get_lang('DisplayCoaches').'</a> | ';
 	echo '<a href="'.api_get_self().'?view=admin&amp;display=useroverview">'.get_lang('DisplayUserOverview').'</a>';
 	if ($display == 'useroverview') {
 		echo ' ( <a href="'.api_get_self().'?view=admin&amp;display=useroverview&amp;export=options">'.get_lang('ExportUserOverviewOptions').'</a> )';
 	}
 	echo ' | <a href="'.api_get_self().'?view=admin&amp;display=sessionoverview">'.get_lang('DisplaySessionOverview').'</a>';
-	echo ' | <a href="'.api_get_self().'?view=admin&amp;display=courseoverview">'.get_lang('DisplayCourseOverview').'</a>';    
-    echo ' | <a href="'.api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin">'.get_lang('LPQuestionListResults').'</a>';    
+	echo ' | <a href="'.api_get_self().'?view=admin&amp;display=courseoverview">'.get_lang('DisplayCourseOverview').'</a>';
+    echo ' | <a href="'.api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin">'.get_lang('LPQuestionListResults').'</a>';
     echo ' | <a href="'.api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin">'.get_lang('LPExerciseResultsBySession').'</a>';
-    
-    
+
+
 	echo '<br /><br />';
 	if ($display === 'useroverview') {
 		MySpace::display_tracking_user_overview();
@@ -589,16 +589,6 @@ if ($is_platform_admin && $view == 'admin' && $display != 'yourstudents') {
 			WHERE scu.id_user=user_id AND scu.status=2  AND login_user_id=user_id
 			GROUP BY user_id ";
 
-		if ($_configuration['multiple_access_urls']) {
-			$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-			$access_url_id = api_get_current_access_url_id();
-			if ($access_url_id != -1) {
-				$sqlCoachs = "SELECT DISTINCT scu.id_user as id_coach, user_id, lastname, firstname, MAX(login_date) as login_date
-					FROM $tbl_user, $tbl_session_course_user scu, $tbl_track_login , $tbl_session_rel_access_url session_rel_url
-					WHERE scu.id_user=user_id AND scu.status=2 AND login_user_id=user_id AND access_url_id = $access_url_id AND session_rel_url.session_id=id_session
-					GROUP BY user_id ";
-			}
-		}
 		if (!empty($order[$tracking_column])) {
 			$sqlCoachs .= "ORDER BY ".$order[$tracking_column]." ".$tracking_direction;
 		}
@@ -616,18 +606,6 @@ if ($is_platform_admin && $view == 'admin' && $display != 'yourstudents') {
 			GROUP BY user_id
 			ORDER BY login_date '.$tracking_direction;
 
-		if ($_configuration['multiple_access_urls']) {
-			$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
-			$access_url_id = api_get_current_access_url_id();
-			if ($access_url_id != -1) {
-				$sql_session_coach = 'SELECT session.id_coach, user_id, lastname, firstname, MAX(login_date) as login_date
-					FROM '.$tbl_user.','.$tbl_sessions.' as session,'.$tbl_track_login.' , '.$tbl_session_rel_access_url.' as session_rel_url
-					WHERE id_coach=user_id AND login_user_id=user_id  AND access_url_id = '.$access_url_id.' AND  session_rel_url.session_id=session.id
-					GROUP BY user_id
-					ORDER BY login_date '.$tracking_direction;
-			}
-		}
-
 		$result_sessions_coach = Database::query($sql_session_coach);
 		$total_no_coaches += Database::num_rows($result_sessions_coach);
 		while ($coach = Database::fetch_array($result_sessions_coach)) {

+ 0 - 33
tests/main/inc/lib/urlmanager.lib.test.php

@@ -31,13 +31,6 @@ class TestUrlManager extends UnitTestCase {
         //var_dump($res);
 	}
 
-	function testadd_session_to_url() {
-		$session_id=1; //arbitrary session name - isn't checked in the function anyway
-		$res=UrlManager::add_session_to_url($session_id, $url_id=1);
-		$this->assertTrue($res);
-        UrlManager::delete_url_rel_session($session_id,$url_id);
-	}
-
 	function testadd_user_to_url() {
 		$user_id=1;
 		$url_id=1;
@@ -69,14 +62,6 @@ class TestUrlManager extends UnitTestCase {
         //var_dump($res);
 	}
 
-	function testdelete_url_rel_session() {
-		$session_id='';
-		$url_id='';
-		$res=UrlManager::delete_url_rel_session($session_id, $url_id);
-		$this->assertTrue(is_bool($res));
-        //var_dump($res);
-	}
-
 	function testdelete_url_rel_user() {
 		$user_id='';
 		$url_id='';
@@ -140,16 +125,6 @@ class TestUrlManager extends UnitTestCase {
 		//var_dump($resu);
 	}
 
-	function testrelation_url_session_exist() {
-		$session_id=1;
-		$url_id=1;
-		$res=UrlManager::relation_url_session_exist($session_id, $url_id);
-		if(!is_numeric($res)){
-			$this->assertTrue(is_bool($res));
-		}
-		//var_dump($res);
-	}
-
 	function testrelation_url_user_exist() {
 		$user_id=1;
 		$url_id=1;
@@ -186,14 +161,6 @@ class TestUrlManager extends UnitTestCase {
 		//var_dump($res);
 	}
 
-	function testupdate_urls_rel_session(){
-		$session_list=array();
-		$access_url_id=1;
-		$res=UrlManager::update_urls_rel_session($session_list,$access_url_id);
-		$this->assertTrue(is_null($res));
-		//var_dump($res);
-	}
-
 	function testupdate_urls_rel_user() {
 		$user_list=array();
 		$access_url_id=1;

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.