parent
							
								
									a60cc9254d
								
							
						
					
					
						commit
						128ca5b7a0
					
				@ -1,494 +1,494 @@ | 
				
			|||||||
<?php | 
					<?php | 
				
			||||||
/* For licensing terms, see /license.txt */ | 
					/* For licensing terms, see /license.txt */ | 
				
			||||||
 | 
					
 | 
				
			||||||
/** | 
					/** | 
				
			||||||
*	@author Bart Mollet, Julio Montoya lot of fixes | 
					*	@author Bart Mollet, Julio Montoya lot of fixes | 
				
			||||||
*	@package chamilo.admin | 
					*	@package chamilo.admin | 
				
			||||||
*/ | 
					*/ | 
				
			||||||
 | 
					
 | 
				
			||||||
$cidReset = true; | 
					$cidReset = true; | 
				
			||||||
require_once '../inc/global.inc.php'; | 
					require_once '../inc/global.inc.php'; | 
				
			||||||
 | 
					
 | 
				
			||||||
// setting the section (for the tabs) | 
					// setting the section (for the tabs) | 
				
			||||||
$this_section = SECTION_PLATFORM_ADMIN; | 
					$this_section = SECTION_PLATFORM_ADMIN; | 
				
			||||||
 | 
					
 | 
				
			||||||
$sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : null; | 
					$sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : null; | 
				
			||||||
 | 
					
 | 
				
			||||||
if (empty($sessionId)) { | 
					if (empty($sessionId)) { | 
				
			||||||
    api_not_allowed(true); | 
					    api_not_allowed(true); | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
SessionManager::protect_session_edit($sessionId); | 
					SessionManager::protect_session_edit($sessionId); | 
				
			||||||
 | 
					
 | 
				
			||||||
$tool_name = get_lang('SessionOverview'); | 
					$tool_name = get_lang('SessionOverview'); | 
				
			||||||
 | 
					
 | 
				
			||||||
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); | 
					$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); | 
				
			||||||
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); | 
					$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); | 
				
			||||||
 | 
					
 | 
				
			||||||
$orig_param = '&origin=resume_session'; | 
					$orig_param = '&origin=resume_session'; | 
				
			||||||
 | 
					
 | 
				
			||||||
// Database Table Definitions | 
					// Database Table Definitions | 
				
			||||||
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); | 
					$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); | 
				
			||||||
$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); | 
					$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); | 
				
			||||||
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); | 
					$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); | 
				
			||||||
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); | 
					$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); | 
				
			||||||
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); | 
					$tbl_user = Database::get_main_table(TABLE_MAIN_USER); | 
				
			||||||
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); | 
					$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); | 
				
			||||||
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); | 
					$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); | 
				
			||||||
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); | 
					$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); | 
				
			||||||
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); | 
					$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); | 
				
			||||||
 | 
					
 | 
				
			||||||
$sql = 'SELECT | 
					$sql = 'SELECT | 
				
			||||||
            name, | 
					            name, | 
				
			||||||
            nbr_courses, | 
					            nbr_courses, | 
				
			||||||
            nbr_users, | 
					            nbr_users, | 
				
			||||||
            nbr_classes, | 
					            nbr_classes, | 
				
			||||||
            DATE_FORMAT(date_start,"%d-%m-%Y") as date_start, | 
					            DATE_FORMAT(date_start,"%d-%m-%Y") as date_start, | 
				
			||||||
            DATE_FORMAT(date_end,"%d-%m-%Y") as date_end, | 
					            DATE_FORMAT(date_end,"%d-%m-%Y") as date_end, | 
				
			||||||
            lastname, | 
					            lastname, | 
				
			||||||
            firstname, | 
					            firstname, | 
				
			||||||
            username, | 
					            username, | 
				
			||||||
            session_admin_id, | 
					            session_admin_id, | 
				
			||||||
            nb_days_access_before_beginning, | 
					            nb_days_access_before_beginning, | 
				
			||||||
            nb_days_access_after_end, | 
					            nb_days_access_after_end, | 
				
			||||||
            session_category_id, | 
					            session_category_id, | 
				
			||||||
            visibility, | 
					            visibility, | 
				
			||||||
            show_description, description | 
					            show_description, description | 
				
			||||||
		FROM '.$tbl_session.' | 
							FROM '.$tbl_session.' | 
				
			||||||
		LEFT JOIN '.$tbl_user.' | 
							LEFT JOIN '.$tbl_user.' | 
				
			||||||
		ON id_coach = user_id | 
							ON id_coach = user_id | 
				
			||||||
		WHERE '.$tbl_session.'.id='.$sessionId; | 
							WHERE '.$tbl_session.'.id='.$sessionId; | 
				
			||||||
 | 
					
 | 
				
			||||||
$rs      = Database::query($sql); | 
					$rs      = Database::query($sql); | 
				
			||||||
$session = Database::store_result($rs); | 
					$session = Database::store_result($rs); | 
				
			||||||
$session = $session[0]; | 
					$session = $session[0]; | 
				
			||||||
 | 
					
 | 
				
			||||||
$sql = 'SELECT name FROM  '.$tbl_session_category.' | 
					$sql = 'SELECT name FROM  '.$tbl_session_category.' | 
				
			||||||
        WHERE id = "'.intval($session['session_category_id']).'"'; | 
					        WHERE id = "'.intval($session['session_category_id']).'"'; | 
				
			||||||
$rs = Database::query($sql); | 
					$rs = Database::query($sql); | 
				
			||||||
$session_category = ''; | 
					$session_category = ''; | 
				
			||||||
 | 
					
 | 
				
			||||||
if (Database::num_rows($rs)>0) { | 
					if (Database::num_rows($rs)>0) { | 
				
			||||||
	$rows_session_category = Database::store_result($rs); | 
						$rows_session_category = Database::store_result($rs); | 
				
			||||||
	$rows_session_category = $rows_session_category[0]; | 
						$rows_session_category = $rows_session_category[0]; | 
				
			||||||
	$session_category = $rows_session_category['name']; | 
						$session_category = $rows_session_category['name']; | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
$action = isset($_GET['action']) ? $_GET['action'] : null; | 
					$action = isset($_GET['action']) ? $_GET['action'] : null; | 
				
			||||||
 | 
					
 | 
				
			||||||
$url_id = api_get_current_access_url_id(); | 
					$url_id = api_get_current_access_url_id(); | 
				
			||||||
 | 
					
 | 
				
			||||||
switch ($action) { | 
					switch ($action) { | 
				
			||||||
    case 'move_up': | 
					    case 'move_up': | 
				
			||||||
        SessionManager::moveUp($sessionId, $_GET['course_id']); | 
					        SessionManager::moveUp($sessionId, $_GET['course_id']); | 
				
			||||||
        header('Location: resume_session.php?id_session='.$sessionId); | 
					        header('Location: resume_session.php?id_session='.$sessionId); | 
				
			||||||
        exit; | 
					        exit; | 
				
			||||||
        break; | 
					        break; | 
				
			||||||
    case 'move_down': | 
					    case 'move_down': | 
				
			||||||
        SessionManager::moveDown($sessionId, $_GET['course_id']); | 
					        SessionManager::moveDown($sessionId, $_GET['course_id']); | 
				
			||||||
        header('Location: resume_session.php?id_session='.$sessionId); | 
					        header('Location: resume_session.php?id_session='.$sessionId); | 
				
			||||||
        exit; | 
					        exit; | 
				
			||||||
        break; | 
					        break; | 
				
			||||||
    case 'add_user_to_url': | 
					    case 'add_user_to_url': | 
				
			||||||
        $user_id = $_REQUEST['user_id']; | 
					        $user_id = $_REQUEST['user_id']; | 
				
			||||||
        $result = UrlManager::add_user_to_url($user_id, $url_id); | 
					        $result = UrlManager::add_user_to_url($user_id, $url_id); | 
				
			||||||
        $user_info = api_get_user_info($user_id); | 
					        $user_info = api_get_user_info($user_id); | 
				
			||||||
        if ($result) { | 
					        if ($result) { | 
				
			||||||
            $message = Display::return_message( | 
					            $message = Display::return_message( | 
				
			||||||
                get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']), | 
					                get_lang('UserAdded').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']), | 
				
			||||||
                'confirm' | 
					                'confirm' | 
				
			||||||
            ); | 
					            ); | 
				
			||||||
        } | 
					        } | 
				
			||||||
        break; | 
					        break; | 
				
			||||||
    case 'delete': | 
					    case 'delete': | 
				
			||||||
        // Delete course from session. | 
					        // Delete course from session. | 
				
			||||||
        $idChecked = isset($_GET['idChecked']) ? $_GET['idChecked'] : null; | 
					        $idChecked = isset($_GET['idChecked']) ? $_GET['idChecked'] : null; | 
				
			||||||
        if (is_array($idChecked)) { | 
					        if (is_array($idChecked)) { | 
				
			||||||
            $usersToDelete = array(); | 
					            $usersToDelete = array(); | 
				
			||||||
            foreach ($idChecked as $courseCode) { | 
					            foreach ($idChecked as $courseCode) { | 
				
			||||||
                // forcing the escape_string | 
					                // forcing the escape_string | 
				
			||||||
                $courseInfo = api_get_course_info($courseCode); | 
					                $courseInfo = api_get_course_info($courseCode); | 
				
			||||||
                SessionManager::unsubscribe_course_from_session( | 
					                SessionManager::unsubscribe_course_from_session( | 
				
			||||||
                    $sessionId, | 
					                    $sessionId, | 
				
			||||||
                    $courseInfo['real_id'] | 
					                    $courseInfo['real_id'] | 
				
			||||||
                ); | 
					                ); | 
				
			||||||
            } | 
					            } | 
				
			||||||
        } | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!empty($_GET['class'])) { | 
					        if (!empty($_GET['class'])) { | 
				
			||||||
            $result = Database::query("DELETE FROM $tbl_session_rel_class | 
					            $result = Database::query("DELETE FROM $tbl_session_rel_class | 
				
			||||||
                             WHERE session_id='$sessionId' AND class_id=".intval($_GET['class'])); | 
					                             WHERE session_id='$sessionId' AND class_id=".intval($_GET['class'])); | 
				
			||||||
            $nbr_affected_rows = Database::affected_rows($result); | 
					            $nbr_affected_rows = Database::affected_rows($result); | 
				
			||||||
            Database::query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$sessionId'"); | 
					            Database::query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$sessionId'"); | 
				
			||||||
        } | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!empty($_GET['user'])) { | 
					        if (!empty($_GET['user'])) { | 
				
			||||||
            SessionManager::unsubscribe_user_from_session( | 
					            SessionManager::unsubscribe_user_from_session( | 
				
			||||||
                $sessionId, | 
					                $sessionId, | 
				
			||||||
                $_GET['user'] | 
					                $_GET['user'] | 
				
			||||||
            ); | 
					            ); | 
				
			||||||
        } | 
					        } | 
				
			||||||
        break; | 
					        break; | 
				
			||||||
} | 
					} | 
				
			||||||
Display::display_header($tool_name); | 
					Display::display_header($tool_name); | 
				
			||||||
 | 
					
 | 
				
			||||||
if (!empty($_GET['warn'])) { | 
					if (!empty($_GET['warn'])) { | 
				
			||||||
    Display::display_warning_message(urldecode($_GET['warn'])); | 
					    Display::display_warning_message(urldecode($_GET['warn'])); | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
if (!empty($message)) { | 
					if (!empty($message)) { | 
				
			||||||
    echo $message; | 
					    echo $message; | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
echo Display::page_header( | 
					echo Display::page_header( | 
				
			||||||
    Display::return_icon('session.png', get_lang('Session')).' '.$session['name'] | 
					    Display::return_icon('session.png', get_lang('Session')).' '.$session['name'] | 
				
			||||||
); | 
					); | 
				
			||||||
 | 
					
 | 
				
			||||||
$url = Display::url( | 
					$url = Display::url( | 
				
			||||||
    Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), | 
					    Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), | 
				
			||||||
    "session_edit.php?page=resume_session.php&id=$sessionId" | 
					    "session_edit.php?page=resume_session.php&id=$sessionId" | 
				
			||||||
); | 
					); | 
				
			||||||
echo Display::page_subheader(get_lang('GeneralProperties').$url); | 
					echo Display::page_subheader(get_lang('GeneralProperties').$url); | 
				
			||||||
 | 
					
 | 
				
			||||||
?> | 
					?> | 
				
			||||||
<!-- General properties --> | 
					<!-- General properties --> | 
				
			||||||
<table class="data_table"> | 
					<table class="data_table"> | 
				
			||||||
<tr> | 
					<tr> | 
				
			||||||
	<td><?php echo get_lang('GeneralCoach'); ?> :</td>
 | 
						<td><?php echo get_lang('GeneralCoach'); ?> :</td>
 | 
				
			||||||
	<td><?php echo api_get_person_name($session['firstname'], $session['lastname']).' ('.$session['username'].')' ?></td>
 | 
						<td><?php echo api_get_person_name($session['firstname'], $session['lastname']).' ('.$session['username'].')' ?></td>
 | 
				
			||||||
</tr> | 
					</tr> | 
				
			||||||
<?php if(!empty($session_category)) { ?> | 
					<?php if(!empty($session_category)) { ?> | 
				
			||||||
<tr> | 
					<tr> | 
				
			||||||
	<td><?php echo get_lang('SessionCategory') ?></td>
 | 
						<td><?php echo get_lang('SessionCategory') ?></td>
 | 
				
			||||||
	<td><?php echo $session_category;  ?></td>
 | 
						<td><?php echo $session_category;  ?></td>
 | 
				
			||||||
</tr> | 
					</tr> | 
				
			||||||
<?php } ?> | 
					<?php } ?> | 
				
			||||||
<tr> | 
					<tr> | 
				
			||||||
	<td><?php echo get_lang('Date'); ?> :</td>
 | 
						<td><?php echo get_lang('Date'); ?> :</td>
 | 
				
			||||||
	<td> | 
						<td> | 
				
			||||||
	<?php | 
						<?php | 
				
			||||||
		if ($session['date_start'] == '00-00-0000' && $session['date_end']== '00-00-0000' ) | 
							if ($session['date_start'] == '00-00-0000' && $session['date_end']== '00-00-0000' ) | 
				
			||||||
			echo get_lang('NoTimeLimits'); | 
								echo get_lang('NoTimeLimits'); | 
				
			||||||
		else { | 
							else { | 
				
			||||||
            if ($session['date_start'] != '00-00-0000') { | 
					            if ($session['date_start'] != '00-00-0000') { | 
				
			||||||
                $session['date_start'] =  get_lang('From').' '.$session['date_start']; | 
					                $session['date_start'] =  get_lang('From').' '.$session['date_start']; | 
				
			||||||
            } else { | 
					            } else { | 
				
			||||||
            	$session['date_start'] = ''; | 
					            	$session['date_start'] = ''; | 
				
			||||||
            } | 
					            } | 
				
			||||||
            if ($session['date_end'] == '00-00-0000') { | 
					            if ($session['date_end'] == '00-00-0000') { | 
				
			||||||
                $session['date_end'] =''; | 
					                $session['date_end'] =''; | 
				
			||||||
            } else { | 
					            } else { | 
				
			||||||
            	$session['date_end'] = get_lang('Until').' '.$session['date_end']; | 
					            	$session['date_end'] = get_lang('Until').' '.$session['date_end']; | 
				
			||||||
            } | 
					            } | 
				
			||||||
			echo $session['date_start'].' '.$session['date_end']; | 
								echo $session['date_start'].' '.$session['date_end']; | 
				
			||||||
        } | 
					        } | 
				
			||||||
        ?> | 
					        ?> | 
				
			||||||
	</td> | 
						</td> | 
				
			||||||
</tr> | 
					</tr> | 
				
			||||||
<!-- show nb_days_before and nb_days_after only if they are different from 0 --> | 
					<!-- show nb_days_before and nb_days_after only if they are different from 0 --> | 
				
			||||||
<tr> | 
					<tr> | 
				
			||||||
	<td> | 
						<td> | 
				
			||||||
		<?php echo api_ucfirst(get_lang('DaysBefore')) ?> :
 | 
							<?php echo api_ucfirst(get_lang('DaysBefore')) ?> :
 | 
				
			||||||
	</td> | 
						</td> | 
				
			||||||
	<td> | 
						<td> | 
				
			||||||
		<?php echo intval($session['nb_days_access_before_beginning']) ?> | 
							<?php echo intval($session['nb_days_access_before_beginning']) ?> | 
				
			||||||
	</td> | 
						</td> | 
				
			||||||
</tr> | 
					</tr> | 
				
			||||||
<tr> | 
					<tr> | 
				
			||||||
	<td> | 
						<td> | 
				
			||||||
		<?php echo api_ucfirst(get_lang('DaysAfter')) ?> :
 | 
							<?php echo api_ucfirst(get_lang('DaysAfter')) ?> :
 | 
				
			||||||
	</td> | 
						</td> | 
				
			||||||
	<td> | 
						<td> | 
				
			||||||
		<?php echo intval($session['nb_days_access_after_end']) ?> | 
							<?php echo intval($session['nb_days_access_after_end']) ?> | 
				
			||||||
	</td> | 
						</td> | 
				
			||||||
</tr> | 
					</tr> | 
				
			||||||
<tr> | 
					<tr> | 
				
			||||||
	<td> | 
						<td> | 
				
			||||||
		<?php echo api_ucfirst(get_lang('SessionVisibility')) ?> :
 | 
							<?php echo api_ucfirst(get_lang('SessionVisibility')) ?> :
 | 
				
			||||||
	</td> | 
						</td> | 
				
			||||||
	<td> | 
						<td> | 
				
			||||||
		<?php | 
							<?php | 
				
			||||||
        if ($session['visibility']==1) | 
					        if ($session['visibility']==1) | 
				
			||||||
            echo get_lang('ReadOnly'); | 
					            echo get_lang('ReadOnly'); | 
				
			||||||
        elseif($session['visibility']==2) | 
					        elseif($session['visibility']==2) | 
				
			||||||
            echo get_lang('Visible'); | 
					            echo get_lang('Visible'); | 
				
			||||||
        elseif($session['visibility']==3) | 
					        elseif($session['visibility']==3) | 
				
			||||||
            echo api_ucfirst(get_lang('Invisible')); | 
					            echo api_ucfirst(get_lang('Invisible')); | 
				
			||||||
        ?> | 
					        ?> | 
				
			||||||
	</td> | 
						</td> | 
				
			||||||
</tr> | 
					</tr> | 
				
			||||||
 | 
					
 | 
				
			||||||
<?php | 
					<?php | 
				
			||||||
$sessionField = new ExtraField('session'); | 
					$sessionField = new ExtraField('session'); | 
				
			||||||
$extraFieldData = $sessionField->getDataAndFormattedValues($sessionId); | 
					$extraFieldData = $sessionField->getDataAndFormattedValues($sessionId); | 
				
			||||||
 | 
					
 | 
				
			||||||
foreach ($extraFieldData as $displayExtraField) { | 
					foreach ($extraFieldData as $displayExtraField) { | 
				
			||||||
?> | 
					?> | 
				
			||||||
    <tr> | 
					    <tr> | 
				
			||||||
        <td><?php echo $displayExtraField['text'] ?></td>
 | 
					        <td><?php echo $displayExtraField['text'] ?></td>
 | 
				
			||||||
        <td><?php echo $displayExtraField['value'] ?></td>
 | 
					        <td><?php echo $displayExtraField['value'] ?></td>
 | 
				
			||||||
    </tr> | 
					    </tr> | 
				
			||||||
<?php | 
					<?php | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
$multiple_url_is_on = api_get_multiple_access_url(); | 
					$multiple_url_is_on = api_get_multiple_access_url(); | 
				
			||||||
 | 
					
 | 
				
			||||||
if ($multiple_url_is_on) { | 
					if ($multiple_url_is_on) { | 
				
			||||||
    echo '<tr><td>'; | 
					    echo '<tr><td>'; | 
				
			||||||
    echo 'URL'; | 
					    echo 'URL'; | 
				
			||||||
    echo '</td>'; | 
					    echo '</td>'; | 
				
			||||||
    echo '<td>'; | 
					    echo '<td>'; | 
				
			||||||
    $url_list = UrlManager::get_access_url_from_session($sessionId); | 
					    $url_list = UrlManager::get_access_url_from_session($sessionId); | 
				
			||||||
    foreach ($url_list as $url_data) { | 
					    foreach ($url_list as $url_data) { | 
				
			||||||
        echo $url_data['url'].'<br />'; | 
					        echo $url_data['url'].'<br />'; | 
				
			||||||
    } | 
					    } | 
				
			||||||
    echo '</td></tr>'; | 
					    echo '</td></tr>'; | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
$sessionInfo = api_get_session_info($sessionId); | 
					$sessionInfo = api_get_session_info($sessionId); | 
				
			||||||
echo '<tr><td>'; | 
					echo '<tr><td>'; | 
				
			||||||
echo get_lang('Duration'); | 
					echo get_lang('Duration'); | 
				
			||||||
echo '</td>'; | 
					echo '</td>'; | 
				
			||||||
echo '<td>'; | 
					echo '<td>'; | 
				
			||||||
echo $sessionInfo['duration'].' '; | 
					echo $sessionInfo['duration'].' '; | 
				
			||||||
echo get_lang('Days'); | 
					echo get_lang('Days'); | 
				
			||||||
echo '</td></tr>'; | 
					echo '</td></tr>'; | 
				
			||||||
 | 
					
 | 
				
			||||||
?> | 
					?> | 
				
			||||||
    <tr> | 
					    <tr> | 
				
			||||||
        <td><?php echo get_lang('Description'); ?></td>
 | 
					        <td><?php echo get_lang('Description'); ?></td>
 | 
				
			||||||
        <td><?php echo $session['description'] ?></td>
 | 
					        <td><?php echo $session['description'] ?></td>
 | 
				
			||||||
    </tr> | 
					    </tr> | 
				
			||||||
    <tr> | 
					    <tr> | 
				
			||||||
        <td><?php echo get_lang('ShowDescription'); ?></td>
 | 
					        <td><?php echo get_lang('ShowDescription'); ?></td>
 | 
				
			||||||
        <td><?php echo $session['show_description'] == 1 ? get_lang('Yes') : get_lang('No') ?></td>
 | 
					        <td><?php echo $session['show_description'] == 1 ? get_lang('Yes') : get_lang('No') ?></td>
 | 
				
			||||||
    </tr> | 
					    </tr> | 
				
			||||||
</table> | 
					</table> | 
				
			||||||
<br /> | 
					<br /> | 
				
			||||||
 | 
					
 | 
				
			||||||
<?php | 
					<?php | 
				
			||||||
 | 
					
 | 
				
			||||||
$url = Display::url( | 
					$url = Display::url( | 
				
			||||||
    Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), | 
					    Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), | 
				
			||||||
    "add_courses_to_session.php?page=resume_session.php&id_session=$sessionId" | 
					    "add_courses_to_session.php?page=resume_session.php&id_session=$sessionId" | 
				
			||||||
); | 
					); | 
				
			||||||
echo Display::page_subheader(get_lang('CourseList').$url); | 
					echo Display::page_subheader(get_lang('CourseList').$url); | 
				
			||||||
 | 
					
 | 
				
			||||||
?> | 
					?> | 
				
			||||||
 | 
					
 | 
				
			||||||
<!--List of courses --> | 
					<!--List of courses --> | 
				
			||||||
<table class="data_table"> | 
					<table class="data_table"> | 
				
			||||||
<tr> | 
					<tr> | 
				
			||||||
  <th width="35%"><?php echo get_lang('CourseTitle'); ?></th>
 | 
					  <th width="35%"><?php echo get_lang('CourseTitle'); ?></th>
 | 
				
			||||||
  <th width="30%"><?php echo get_lang('CourseCoach'); ?></th>
 | 
					  <th width="30%"><?php echo get_lang('CourseCoach'); ?></th>
 | 
				
			||||||
  <th width="10%"><?php echo get_lang('UsersNumber'); ?></th>
 | 
					  <th width="10%"><?php echo get_lang('UsersNumber'); ?></th>
 | 
				
			||||||
  <th width="25%"><?php echo get_lang('Actions'); ?></th>
 | 
					  <th width="25%"><?php echo get_lang('Actions'); ?></th>
 | 
				
			||||||
</tr> | 
					</tr> | 
				
			||||||
<?php | 
					<?php | 
				
			||||||
if ($session['nbr_courses'] == 0) { | 
					if ($session['nbr_courses'] == 0) { | 
				
			||||||
	echo '<tr> | 
						echo '<tr> | 
				
			||||||
			<td colspan="4">'.get_lang('NoCoursesForThisSession').'</td> | 
								<td colspan="4">'.get_lang('NoCoursesForThisSession').'</td> | 
				
			||||||
		</tr>'; | 
							</tr>'; | 
				
			||||||
} else { | 
					} else { | 
				
			||||||
	// select the courses | 
						// select the courses | 
				
			||||||
 | 
					
 | 
				
			||||||
    $orderBy = "ORDER BY position"; | 
					    $orderBy = "ORDER BY position"; | 
				
			||||||
	$sql = "SELECT c.id, code, title, visual_code, nbr_users | 
						$sql = "SELECT c.id, code, title, visual_code, nbr_users | 
				
			||||||
			FROM $tbl_course c INNER JOIN $tbl_session_rel_course sc | 
								FROM $tbl_course c INNER JOIN $tbl_session_rel_course sc | 
				
			||||||
			ON (c.id = sc.c_id) | 
								ON (c.id = sc.c_id) | 
				
			||||||
			WHERE | 
								WHERE | 
				
			||||||
			    sc.c_id = c.id AND | 
								    sc.c_id = c.id AND | 
				
			||||||
			    session_id='$sessionId' | 
								    session_id='$sessionId' | 
				
			||||||
			$orderBy"; | 
								$orderBy"; | 
				
			||||||
 | 
					
 | 
				
			||||||
    $result = Database::query($sql); | 
					    $result = Database::query($sql); | 
				
			||||||
    $courses = Database::store_result($result); | 
					    $courses = Database::store_result($result); | 
				
			||||||
    $count = 0; | 
					    $count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
	foreach ($courses as $course) { | 
						foreach ($courses as $course) { | 
				
			||||||
		//select the number of users | 
							//select the number of users | 
				
			||||||
		$sql = "SELECT count(*) | 
							$sql = "SELECT count(*) | 
				
			||||||
                FROM $tbl_session_rel_user sru, | 
					                FROM $tbl_session_rel_user sru, | 
				
			||||||
                $tbl_session_rel_course_rel_user srcru | 
					                $tbl_session_rel_course_rel_user srcru | 
				
			||||||
				WHERE | 
									WHERE | 
				
			||||||
				    srcru.user_id = sru.user_id AND | 
									    srcru.user_id = sru.user_id AND | 
				
			||||||
				    srcru.session_id = sru.session_id AND | 
									    srcru.session_id = sru.session_id AND | 
				
			||||||
				    srcru.c_id = '".intval($course['id'])."' AND | 
									    srcru.c_id = '".intval($course['id'])."' AND | 
				
			||||||
				    sru.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND | 
									    sru.relation_type <> ".SESSION_RELATION_TYPE_RRHH." AND | 
				
			||||||
				    srcru.session_id = '".intval($sessionId)."'"; | 
									    srcru.session_id = '".intval($sessionId)."'"; | 
				
			||||||
 | 
					
 | 
				
			||||||
		$rs = Database::query($sql); | 
							$rs = Database::query($sql); | 
				
			||||||
		$course['nbr_users'] = Database::result($rs, 0, 0); | 
							$course['nbr_users'] = Database::result($rs, 0, 0); | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Get coachs of the courses in session | 
							// Get coachs of the courses in session | 
				
			||||||
 | 
					
 | 
				
			||||||
		$sql = "SELECT user.lastname, user.firstname, user.username | 
							$sql = "SELECT user.lastname, user.firstname, user.username | 
				
			||||||
                FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user | 
					                FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user | 
				
			||||||
				WHERE | 
									WHERE | 
				
			||||||
				    session_rcru.user_id = user.user_id AND | 
									    session_rcru.user_id = user.user_id AND | 
				
			||||||
				    session_rcru.session_id = '".intval($sessionId)."' AND | 
									    session_rcru.session_id = '".intval($sessionId)."' AND | 
				
			||||||
				    session_rcru.c_id ='".intval($course['id'])."' AND | 
									    session_rcru.c_id ='".intval($course['id'])."' AND | 
				
			||||||
				    session_rcru.status=2"; | 
									    session_rcru.status=2"; | 
				
			||||||
		$rs = Database::query($sql); | 
							$rs = Database::query($sql); | 
				
			||||||
 | 
					
 | 
				
			||||||
		$coachs = array(); | 
							$coachs = array(); | 
				
			||||||
		if (Database::num_rows($rs) > 0) { | 
							if (Database::num_rows($rs) > 0) { | 
				
			||||||
			while($info_coach = Database::fetch_array($rs)) { | 
								while($info_coach = Database::fetch_array($rs)) { | 
				
			||||||
				$coachs[] = api_get_person_name($info_coach['firstname'], $info_coach['lastname']).' ('.$info_coach['username'].')'; | 
									$coachs[] = api_get_person_name($info_coach['firstname'], $info_coach['lastname']).' ('.$info_coach['username'].')'; | 
				
			||||||
			} | 
								} | 
				
			||||||
		} else { | 
							} else { | 
				
			||||||
			$coach = get_lang('None'); | 
								$coach = get_lang('None'); | 
				
			||||||
		} | 
							} | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (count($coachs) > 0) { | 
							if (count($coachs) > 0) { | 
				
			||||||
			$coach = implode('<br />',$coachs); | 
								$coach = implode('<br />',$coachs); | 
				
			||||||
		} else { | 
							} else { | 
				
			||||||
			$coach = get_lang('None'); | 
								$coach = get_lang('None'); | 
				
			||||||
		} | 
							} | 
				
			||||||
 | 
					
 | 
				
			||||||
        $orderButtons = null; | 
					        $orderButtons = null; | 
				
			||||||
 | 
					
 | 
				
			||||||
        $upIcon = 'up.png'; | 
					        $upIcon = 'up.png'; | 
				
			||||||
        $urlUp = api_get_self().'?id_session='.$sessionId.'&course_id='.$course['id'].'&action=move_up'; | 
					        $urlUp = api_get_self().'?id_session='.$sessionId.'&course_id='.$course['id'].'&action=move_up'; | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($count == 0) { | 
					        if ($count == 0) { | 
				
			||||||
            $upIcon = 'up_na.png'; | 
					            $upIcon = 'up_na.png'; | 
				
			||||||
            $urlUp = '#'; | 
					            $urlUp = '#'; | 
				
			||||||
        } | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
        $orderButtons = Display::url( | 
					        $orderButtons = Display::url( | 
				
			||||||
            Display::return_icon($upIcon, get_lang('MoveUp')), | 
					            Display::return_icon($upIcon, get_lang('MoveUp')), | 
				
			||||||
            $urlUp | 
					            $urlUp | 
				
			||||||
        ); | 
					        ); | 
				
			||||||
 | 
					
 | 
				
			||||||
        $downIcon = 'down.png'; | 
					        $downIcon = 'down.png'; | 
				
			||||||
        $downUrl = api_get_self().'?id_session='.$sessionId.'&course_id='.$course['id'].'&action=move_down'; | 
					        $downUrl = api_get_self().'?id_session='.$sessionId.'&course_id='.$course['id'].'&action=move_down'; | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($count +1 == count($courses)) { | 
					        if ($count +1 == count($courses)) { | 
				
			||||||
            $downIcon = 'down_na.png'; | 
					            $downIcon = 'down_na.png'; | 
				
			||||||
            $downUrl = '#'; | 
					            $downUrl = '#'; | 
				
			||||||
        } | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
        $orderButtons .= Display::url( | 
					        $orderButtons .= Display::url( | 
				
			||||||
            Display::return_icon($downIcon, get_lang('MoveDown')), | 
					            Display::return_icon($downIcon, get_lang('MoveDown')), | 
				
			||||||
            $downUrl | 
					            $downUrl | 
				
			||||||
        ); | 
					        ); | 
				
			||||||
 | 
					
 | 
				
			||||||
		//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb | 
							//hide_course_breadcrumb the parameter has been added to hide the name of the course, that appeared in the default $interbreadcrumb | 
				
			||||||
		echo ' | 
							echo ' | 
				
			||||||
		<tr> | 
							<tr> | 
				
			||||||
			<td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$sessionId),'</td> | 
								<td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$sessionId),'</td> | 
				
			||||||
			<td>'.$coach.'</td> | 
								<td>'.$coach.'</td> | 
				
			||||||
			<td>'.$course['nbr_users'].'</td> | 
								<td>'.$course['nbr_users'].'</td> | 
				
			||||||
			<td> | 
								<td> | 
				
			||||||
                <a href="'.api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$sessionId.'">'.Display::return_icon('course_home.gif', get_lang('Course')).'</a> | 
					                <a href="'.api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$sessionId.'">'.Display::return_icon('course_home.gif', get_lang('Course')).'</a> | 
				
			||||||
                '.$orderButtons.' | 
					                '.$orderButtons.' | 
				
			||||||
                <a href="session_course_user_list.php?id_session='.$sessionId.'&course_code='.$course['code'].'">'.Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a> | 
					                <a href="session_course_user_list.php?id_session='.$sessionId.'&course_code='.$course['code'].'">'.Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a> | 
				
			||||||
                <a href="'.api_get_path(WEB_CODE_PATH).'/user/user_import.php?action=import&cidReq='.$course['code'].'&id_session='.$sessionId.'">'.Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), null, ICON_SIZE_SMALL).'</a> | 
					                <a href="'.api_get_path(WEB_CODE_PATH).'/user/user_import.php?action=import&cidReq='.$course['code'].'&id_session='.$sessionId.'">'.Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), null, ICON_SIZE_SMALL).'</a> | 
				
			||||||
				<a href="../tracking/courseLog.php?id_session='.$sessionId.'&cidReq='.$course['code'].$orig_param.'&hide_course_breadcrumb=1">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>  | 
									<a href="../tracking/courseLog.php?id_session='.$sessionId.'&cidReq='.$course['code'].$orig_param.'&hide_course_breadcrumb=1">'.Display::return_icon('statistics.gif', get_lang('Tracking')).'</a>  | 
				
			||||||
				<a href="session_course_edit.php?id_session='.$sessionId.'&page=resume_session.php&course_code='.$course['code'].''.$orig_param.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a> | 
									<a href="session_course_edit.php?id_session='.$sessionId.'&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='.$sessionId.'&action=delete&idChecked[]='.$course['code'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a> | 
									<a href="'.api_get_self().'?id_session='.$sessionId.'&action=delete&idChecked[]='.$course['code'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a> | 
				
			||||||
			</td> | 
								</td> | 
				
			||||||
		</tr>'; | 
							</tr>'; | 
				
			||||||
        $count++; | 
					        $count++; | 
				
			||||||
	} | 
						} | 
				
			||||||
} | 
					} | 
				
			||||||
?> | 
					?> | 
				
			||||||
</table> | 
					</table> | 
				
			||||||
<br /> | 
					<br /> | 
				
			||||||
 | 
					
 | 
				
			||||||
<?php | 
					<?php | 
				
			||||||
 | 
					
 | 
				
			||||||
$url = Display::url( | 
					$url = Display::url( | 
				
			||||||
    Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), | 
					    Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), | 
				
			||||||
    "add_users_to_session.php?page=resume_session.php&id_session=$sessionId" | 
					    "add_users_to_session.php?page=resume_session.php&id_session=$sessionId" | 
				
			||||||
); | 
					); | 
				
			||||||
$url .= Display::url( | 
					$url .= Display::url( | 
				
			||||||
    Display::return_icon('import_csv.png', get_lang('ImportUsers'), array(), ICON_SIZE_SMALL), | 
					    Display::return_icon('import_csv.png', get_lang('ImportUsers'), array(), ICON_SIZE_SMALL), | 
				
			||||||
    "session_user_import.php?id_session=$sessionId" | 
					    "session_user_import.php?id_session=$sessionId" | 
				
			||||||
); | 
					); | 
				
			||||||
echo Display::page_subheader(get_lang('UserList').$url); | 
					echo Display::page_subheader(get_lang('UserList').$url); | 
				
			||||||
 | 
					
 | 
				
			||||||
$userList = SessionManager::get_users_by_session($sessionId); | 
					$userList = SessionManager::get_users_by_session($sessionId); | 
				
			||||||
 | 
					
 | 
				
			||||||
if (!empty($userList)) { | 
					if (!empty($userList)) { | 
				
			||||||
    $table = new HTML_Table(array('class' => 'data_table')); | 
					    $table = new HTML_Table(array('class' => 'data_table')); | 
				
			||||||
 | 
					
 | 
				
			||||||
    $table->setHeaderContents(0, 0, get_lang('User')); | 
					    $table->setHeaderContents(0, 0, get_lang('User')); | 
				
			||||||
    $table->setHeaderContents(0, 1, get_lang('Status')); | 
					    $table->setHeaderContents(0, 1, get_lang('Status')); | 
				
			||||||
    $table->setHeaderContents(0, 2, get_lang('Actions')); | 
					    $table->setHeaderContents(0, 2, get_lang('Actions')); | 
				
			||||||
 | 
					
 | 
				
			||||||
    $row = 1; | 
					    $row = 1; | 
				
			||||||
    foreach ($userList as $user) { | 
					    foreach ($userList as $user) { | 
				
			||||||
        $userId = $user['user_id']; | 
					        $userId = $user['user_id']; | 
				
			||||||
        $userInfo = api_get_user_info($userId); | 
					        $userInfo = api_get_user_info($userId); | 
				
			||||||
 | 
					
 | 
				
			||||||
        $userLink = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.$userId.'">'. | 
					        $userLink = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.$userId.'">'. | 
				
			||||||
            api_htmlentities($userInfo['complete_name_with_username']).'</a>'; | 
					            api_htmlentities($userInfo['complete_name_with_username']).'</a>'; | 
				
			||||||
 | 
					
 | 
				
			||||||
        $reportingLink = Display::url( | 
					        $reportingLink = Display::url( | 
				
			||||||
            Display::return_icon('statistics.gif', get_lang('Reporting')), | 
					            Display::return_icon('statistics.gif', get_lang('Reporting')), | 
				
			||||||
            api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$user['user_id'].''.$orig_param | 
					            api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$user['user_id'].''.$orig_param | 
				
			||||||
        ); | 
					        ); | 
				
			||||||
 | 
					
 | 
				
			||||||
        $courseUserLink = Display::url( | 
					        $courseUserLink = Display::url( | 
				
			||||||
            Display::return_icon('course.gif', get_lang('BlockCoursesForThisUser')), | 
					            Display::return_icon('course.gif', get_lang('BlockCoursesForThisUser')), | 
				
			||||||
            api_get_path(WEB_CODE_PATH).'admin/session_course_user.php?id_user='.$user['user_id'].'&id_session='.$sessionId | 
					            api_get_path(WEB_CODE_PATH).'admin/session_course_user.php?id_user='.$user['user_id'].'&id_session='.$sessionId | 
				
			||||||
        ); | 
					        ); | 
				
			||||||
 | 
					
 | 
				
			||||||
        $removeLink = Display::url( | 
					        $removeLink = Display::url( | 
				
			||||||
            Display::return_icon('delete.png', get_lang('Delete')), | 
					            Display::return_icon('delete.png', get_lang('Delete')), | 
				
			||||||
            api_get_self().'?id_session='.$sessionId.'&action=delete&user='.$user['user_id'], | 
					            api_get_self().'?id_session='.$sessionId.'&action=delete&user='.$user['user_id'], | 
				
			||||||
            array('onclick' => "javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;") | 
					            array('onclick' => "javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;") | 
				
			||||||
        ); | 
					        ); | 
				
			||||||
 | 
					
 | 
				
			||||||
        $addUserToUrlLink= ''; | 
					        $addUserToUrlLink= ''; | 
				
			||||||
        if ($multiple_url_is_on) { | 
					        if ($multiple_url_is_on) { | 
				
			||||||
            if ($user['access_url_id'] != $url_id) { | 
					            if ($user['access_url_id'] != $url_id) { | 
				
			||||||
                $userLink .= ' '.Display::return_icon( | 
					                $userLink .= ' '.Display::return_icon( | 
				
			||||||
                    'warning.png', | 
					                    'warning.png', | 
				
			||||||
                    get_lang('UserNotAddedInURL'), | 
					                    get_lang('UserNotAddedInURL'), | 
				
			||||||
                    array(), | 
					                    array(), | 
				
			||||||
                    ICON_SIZE_SMALL | 
					                    ICON_SIZE_SMALL | 
				
			||||||
                ); | 
					                ); | 
				
			||||||
                $add = Display::return_icon( | 
					                $add = Display::return_icon( | 
				
			||||||
                    'add.png', | 
					                    'add.png', | 
				
			||||||
                    get_lang('AddUsersToURL'), | 
					                    get_lang('AddUsersToURL'), | 
				
			||||||
                    array(), | 
					                    array(), | 
				
			||||||
                    ICON_SIZE_SMALL | 
					                    ICON_SIZE_SMALL | 
				
			||||||
                ); | 
					                ); | 
				
			||||||
                $addUserToUrlLink = '<a href="resume_session.php?action=add_user_to_url&id_session='.$sessionId.'&user_id='.$user['user_id'].'">'.$add.'</a>'; | 
					                $addUserToUrlLink = '<a href="resume_session.php?action=add_user_to_url&id_session='.$sessionId.'&user_id='.$user['user_id'].'">'.$add.'</a>'; | 
				
			||||||
            } | 
					            } | 
				
			||||||
        } | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
        $editUrl = null; | 
					        $editUrl = null; | 
				
			||||||
        if (isset($sessionInfo['duration']) && !empty($sessionInfo['duration'])) { | 
					        if (isset($sessionInfo['duration']) && !empty($sessionInfo['duration'])) { | 
				
			||||||
            $editUrl = api_get_path(WEB_CODE_PATH) . 'admin/session_user_edit.php?session_id=' . $sessionId . '&user_id=' . $userId; | 
					            $editUrl = api_get_path(WEB_CODE_PATH) . 'admin/session_user_edit.php?session_id=' . $sessionId . '&user_id=' . $userId; | 
				
			||||||
            $editUrl = Display::url( | 
					            $editUrl = Display::url( | 
				
			||||||
                Display::return_icon('agenda.png', get_lang('SessionDurationEdit')), | 
					                Display::return_icon('agenda.png', get_lang('SessionDurationEdit')), | 
				
			||||||
                $editUrl | 
					                $editUrl | 
				
			||||||
            ); | 
					            ); | 
				
			||||||
        } | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
        $table->setCellContents($row, 0, $userLink); | 
					        $table->setCellContents($row, 0, $userLink); | 
				
			||||||
        $link = $reportingLink.$courseUserLink.$removeLink.$addUserToUrlLink.$editUrl; | 
					        $link = $reportingLink.$courseUserLink.$removeLink.$addUserToUrlLink.$editUrl; | 
				
			||||||
        switch ($user['relation_type']) { | 
					        switch ($user['relation_type']) { | 
				
			||||||
            case 1: | 
					            case 1: | 
				
			||||||
                $status = get_lang('Drh'); | 
					                $status = get_lang('Drh'); | 
				
			||||||
                $link = Display::url( | 
					                $link = Display::url( | 
				
			||||||
                    Display::return_icon('edit.png', get_lang('Edit')), | 
					                    Display::return_icon('edit.png', get_lang('Edit')), | 
				
			||||||
                    api_get_path(WEB_CODE_PATH).'admin/dashboard_add_sessions_to_user.php?user='.$userId | 
					                    api_get_path(WEB_CODE_PATH).'admin/dashboard_add_sessions_to_user.php?user='.$userId | 
				
			||||||
                ); | 
					                ); | 
				
			||||||
                break; | 
					                break; | 
				
			||||||
            default: | 
					            default: | 
				
			||||||
                $status = get_lang('Student'); | 
					                $status = get_lang('Student'); | 
				
			||||||
        } | 
					        } | 
				
			||||||
 | 
					
 | 
				
			||||||
        $table->setCellContents($row, 1, $status); | 
					        $table->setCellContents($row, 1, $status); | 
				
			||||||
        $table->setCellContents($row, 2, $link); | 
					        $table->setCellContents($row, 2, $link); | 
				
			||||||
        $row++; | 
					        $row++; | 
				
			||||||
    } | 
					    } | 
				
			||||||
    $table->display(); | 
					    $table->display(); | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
Display :: display_footer(); | 
					Display :: display_footer(); | 
				
			||||||
@ -1,172 +1,172 @@ | 
				
			|||||||
<?php | 
					<?php | 
				
			||||||
/* For licensing terms, see /license.txt */ | 
					/* For licensing terms, see /license.txt */ | 
				
			||||||
 | 
					
 | 
				
			||||||
/** | 
					/** | 
				
			||||||
 * Implements the edition of course-session settings | 
					 * Implements the edition of course-session settings | 
				
			||||||
 * @package chamilo.admin | 
					 * @package chamilo.admin | 
				
			||||||
 */ | 
					 */ | 
				
			||||||
 | 
					
 | 
				
			||||||
$cidReset = true; | 
					$cidReset = true; | 
				
			||||||
 | 
					
 | 
				
			||||||
require_once '../inc/global.inc.php'; | 
					require_once '../inc/global.inc.php'; | 
				
			||||||
 | 
					
 | 
				
			||||||
$id_session = intval($_GET['id_session']); | 
					$id_session = intval($_GET['id_session']); | 
				
			||||||
SessionManager::protect_session_edit($id_session); | 
					SessionManager::protect_session_edit($id_session); | 
				
			||||||
$course_code = $_GET['course_code']; | 
					$course_code = $_GET['course_code']; | 
				
			||||||
 | 
					
 | 
				
			||||||
$formSent = 0; | 
					$formSent = 0; | 
				
			||||||
$errorMsg = ''; | 
					$errorMsg = ''; | 
				
			||||||
 | 
					
 | 
				
			||||||
// Database Table Definitions | 
					// Database Table Definitions | 
				
			||||||
$tbl_user = Database::get_main_table(TABLE_MAIN_USER); | 
					$tbl_user = Database::get_main_table(TABLE_MAIN_USER); | 
				
			||||||
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); | 
					$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); | 
				
			||||||
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); | 
					$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); | 
				
			||||||
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); | 
					$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); | 
				
			||||||
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); | 
					$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); | 
				
			||||||
 | 
					
 | 
				
			||||||
$course_info = api_get_course_info($_REQUEST['course_code']); | 
					$course_info = api_get_course_info($_REQUEST['course_code']); | 
				
			||||||
$courseId = $course_info['real_id']; | 
					$courseId = $course_info['real_id']; | 
				
			||||||
$tool_name = $course_info['name']; | 
					$tool_name = $course_info['name']; | 
				
			||||||
$sql = "SELECT s.name, c.title | 
					$sql = "SELECT s.name, c.title | 
				
			||||||
        FROM $tbl_session_course sc, $tbl_session s, $tbl_course c | 
					        FROM $tbl_session_course sc, $tbl_session s, $tbl_course c | 
				
			||||||
        WHERE | 
					        WHERE | 
				
			||||||
            sc.session_id = s.id AND | 
					            sc.session_id = s.id AND | 
				
			||||||
            sc.c_id = c.id AND | 
					            sc.c_id = c.id AND | 
				
			||||||
            sc.session_id='$id_session' AND | 
					            sc.session_id='$id_session' AND | 
				
			||||||
            sc.c_id ='".$courseId."'"; | 
					            sc.c_id ='".$courseId."'"; | 
				
			||||||
$result = Database::query($sql); | 
					$result = Database::query($sql); | 
				
			||||||
 | 
					
 | 
				
			||||||
if (!list($session_name,$course_title) = Database::fetch_row($result)) { | 
					if (!list($session_name,$course_title) = Database::fetch_row($result)) { | 
				
			||||||
	header('Location: session_course_list.php?id_session='.$id_session); | 
						header('Location: session_course_list.php?id_session='.$id_session); | 
				
			||||||
	exit(); | 
						exit(); | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); | 
					$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin')); | 
				
			||||||
$interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang("SessionList")); | 
					$interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang("SessionList")); | 
				
			||||||
$interbreadcrumb[]=array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview')); | 
					$interbreadcrumb[]=array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview')); | 
				
			||||||
$interbreadcrumb[]=array('url' => "session_course_list.php?id_session=$id_session","name" =>api_htmlentities($session_name,ENT_QUOTES,$charset)); | 
					$interbreadcrumb[]=array('url' => "session_course_list.php?id_session=$id_session","name" =>api_htmlentities($session_name,ENT_QUOTES,$charset)); | 
				
			||||||
 | 
					
 | 
				
			||||||
$arr_infos = array(); | 
					$arr_infos = array(); | 
				
			||||||
if (isset($_POST['formSent']) && $_POST['formSent']) { | 
					if (isset($_POST['formSent']) && $_POST['formSent']) { | 
				
			||||||
	$formSent = 1; | 
						$formSent = 1; | 
				
			||||||
 | 
					
 | 
				
			||||||
	// get all tutor by course_code in the session | 
						// get all tutor by course_code in the session | 
				
			||||||
	$sql = "SELECT user_id | 
						$sql = "SELECT user_id | 
				
			||||||
	        FROM $tbl_session_rel_course_rel_user | 
						        FROM $tbl_session_rel_course_rel_user | 
				
			||||||
	        WHERE session_id = '$id_session' AND c_id = '".$courseId."' AND status = 2"; | 
						        WHERE session_id = '$id_session' AND c_id = '".$courseId."' AND status = 2"; | 
				
			||||||
	$rs_coachs = Database::query($sql); | 
						$rs_coachs = Database::query($sql); | 
				
			||||||
 | 
					
 | 
				
			||||||
	$coachs_course_session = array(); | 
						$coachs_course_session = array(); | 
				
			||||||
	if (Database::num_rows($rs_coachs) > 0){ | 
						if (Database::num_rows($rs_coachs) > 0){ | 
				
			||||||
		while ($row_coachs = Database::fetch_row($rs_coachs)) { | 
							while ($row_coachs = Database::fetch_row($rs_coachs)) { | 
				
			||||||
			$coachs_course_session[] = $row_coachs[0]; | 
								$coachs_course_session[] = $row_coachs[0]; | 
				
			||||||
		} | 
							} | 
				
			||||||
	} | 
						} | 
				
			||||||
 | 
					
 | 
				
			||||||
	$id_coachs= $_POST['id_coach']; | 
						$id_coachs= $_POST['id_coach']; | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (is_array($id_coachs) && count($id_coachs) > 0) { | 
						if (is_array($id_coachs) && count($id_coachs) > 0) { | 
				
			||||||
 | 
					
 | 
				
			||||||
		foreach ($id_coachs as $id_coach) { | 
							foreach ($id_coachs as $id_coach) { | 
				
			||||||
			$id_coach = intval($id_coach); | 
								$id_coach = intval($id_coach); | 
				
			||||||
			$rs1 = SessionManager::set_coach_to_course_session($id_coach, $id_session, $courseId); | 
								$rs1 = SessionManager::set_coach_to_course_session($id_coach, $id_session, $courseId); | 
				
			||||||
		} | 
							} | 
				
			||||||
 | 
					
 | 
				
			||||||
		// set status to 0 other tutors from multiple list | 
							// set status to 0 other tutors from multiple list | 
				
			||||||
		$array_intersect = array_diff($coachs_course_session,$id_coachs); | 
							$array_intersect = array_diff($coachs_course_session,$id_coachs); | 
				
			||||||
 | 
					
 | 
				
			||||||
		foreach ($array_intersect as $nocoach_user_id) { | 
							foreach ($array_intersect as $nocoach_user_id) { | 
				
			||||||
			$rs2 = SessionManager::set_coach_to_course_session( | 
								$rs2 = SessionManager::set_coach_to_course_session( | 
				
			||||||
				$nocoach_user_id, | 
									$nocoach_user_id, | 
				
			||||||
				$id_session, | 
									$id_session, | 
				
			||||||
                $courseId, | 
					                $courseId, | 
				
			||||||
				true | 
									true | 
				
			||||||
			); | 
								); | 
				
			||||||
		} | 
							} | 
				
			||||||
 | 
					
 | 
				
			||||||
		header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session); | 
							header('Location: '.Security::remove_XSS($_GET['page']).'?id_session='.$id_session); | 
				
			||||||
		exit(); | 
							exit(); | 
				
			||||||
	} | 
						} | 
				
			||||||
} else { | 
					} else { | 
				
			||||||
	$sql = "SELECT user_id FROM $tbl_session_rel_course_rel_user | 
						$sql = "SELECT user_id FROM $tbl_session_rel_course_rel_user | 
				
			||||||
	        WHERE session_id = '$id_session' AND c_id = '".$courseId."' AND status = 2 "; | 
						        WHERE session_id = '$id_session' AND c_id = '".$courseId."' AND status = 2 "; | 
				
			||||||
	$rs = Database::query($sql); | 
						$rs = Database::query($sql); | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (Database::num_rows($rs) > 0) { | 
						if (Database::num_rows($rs) > 0) { | 
				
			||||||
		while ($infos = Database::fetch_array($rs)) { | 
							while ($infos = Database::fetch_array($rs)) { | 
				
			||||||
			$arr_infos[] = $infos['user_id']; | 
								$arr_infos[] = $infos['user_id']; | 
				
			||||||
		} | 
							} | 
				
			||||||
	} | 
						} | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; | 
					$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; | 
				
			||||||
 | 
					
 | 
				
			||||||
if (api_is_multiple_url_enabled()) { | 
					if (api_is_multiple_url_enabled()) { | 
				
			||||||
    $tbl_access_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); | 
					    $tbl_access_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); | 
				
			||||||
    $access_url_id = api_get_current_access_url_id(); | 
					    $access_url_id = api_get_current_access_url_id(); | 
				
			||||||
    $sql="SELECT u.user_id,lastname,firstname,username | 
					    $sql="SELECT u.user_id,lastname,firstname,username | 
				
			||||||
        FROM $tbl_user u LEFT JOIN $tbl_access_rel_user  a ON(u.user_id= a.user_id) | 
					        FROM $tbl_user u LEFT JOIN $tbl_access_rel_user  a ON(u.user_id= a.user_id) | 
				
			||||||
        WHERE status='1' AND active = 1 AND access_url_id = $access_url_id ".$order_clause; | 
					        WHERE status='1' AND active = 1 AND access_url_id = $access_url_id ".$order_clause; | 
				
			||||||
} else { | 
					} else { | 
				
			||||||
    $sql="SELECT user_id,lastname,firstname,username | 
					    $sql="SELECT user_id,lastname,firstname,username | 
				
			||||||
    FROM $tbl_user | 
					    FROM $tbl_user | 
				
			||||||
    WHERE status='1' AND active = 1 ".$order_clause; | 
					    WHERE status='1' AND active = 1 ".$order_clause; | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
$result = Database::query($sql); | 
					$result = Database::query($sql); | 
				
			||||||
$coaches = Database::store_result($result); | 
					$coaches = Database::store_result($result); | 
				
			||||||
Display::display_header($tool_name); | 
					Display::display_header($tool_name); | 
				
			||||||
 | 
					
 | 
				
			||||||
$tool_name = get_lang('ModifySessionCourse'); | 
					$tool_name = get_lang('ModifySessionCourse'); | 
				
			||||||
api_display_tool_title($tool_name); | 
					api_display_tool_title($tool_name); | 
				
			||||||
?> | 
					?> | 
				
			||||||
<div class="session-course-edit"> | 
					<div class="session-course-edit"> | 
				
			||||||
 | 
					
 | 
				
			||||||
<form method="post" action="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo Security::remove_XSS($_GET['page']) ?>" style="margin:0px;">
 | 
					<form method="post" action="<?php echo api_get_self(); ?>?id_session=<?php echo $id_session; ?>&course_code=<?php echo urlencode($course_code); ?>&page=<?php echo Security::remove_XSS($_GET['page']) ?>" style="margin:0px;">
 | 
				
			||||||
<input type="hidden" name="formSent" value="1"> | 
					<input type="hidden" name="formSent" value="1"> | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="row"> | 
					<div class="row"> | 
				
			||||||
    <div class="col-md-12"> | 
					    <div class="col-md-12"> | 
				
			||||||
        <div class="title"></div> | 
					        <div class="title"></div> | 
				
			||||||
        <?php | 
					        <?php | 
				
			||||||
            if(!empty($errorMsg)) { | 
					            if(!empty($errorMsg)) { | 
				
			||||||
                Display::display_normal_message($errorMsg); | 
					                Display::display_normal_message($errorMsg); | 
				
			||||||
            } | 
					            } | 
				
			||||||
        ?> | 
					        ?> | 
				
			||||||
    </div> | 
					    </div> | 
				
			||||||
</div> | 
					</div> | 
				
			||||||
<div class="row"> | 
					<div class="row"> | 
				
			||||||
    <div class="col-md-2"> | 
					    <div class="col-md-2"> | 
				
			||||||
        <?php echo get_lang("CoachName") ?> | 
					        <?php echo get_lang("CoachName") ?> | 
				
			||||||
    </div> | 
					    </div> | 
				
			||||||
    <div class="col-md-8"> | 
					    <div class="col-md-8"> | 
				
			||||||
 | 
					
 | 
				
			||||||
        <select name="id_coach[]" class="form-control"> | 
					        <select name="id_coach[]" class="form-control"> | 
				
			||||||
            <option value="0">----- <?php echo get_lang("Choose") ?> -----</option>
 | 
					            <option value="0">----- <?php echo get_lang("Choose") ?> -----</option>
 | 
				
			||||||
            <option value="0" <?php if(count($arr_infos) == 0) echo 'selected="selected"'; ?>>
 | 
					            <option value="0" <?php if(count($arr_infos) == 0) echo 'selected="selected"'; ?>>
 | 
				
			||||||
                <?php echo get_lang('None') ?> | 
					                <?php echo get_lang('None') ?> | 
				
			||||||
            </option> | 
					            </option> | 
				
			||||||
            <?php | 
					            <?php | 
				
			||||||
            foreach($coaches as $enreg) { | 
					            foreach($coaches as $enreg) { | 
				
			||||||
                ?> | 
					                ?> | 
				
			||||||
                <option value="<?php echo $enreg['user_id']; ?>" <?php if(((is_array($arr_infos) && in_array($enreg['user_id'], $arr_infos)))) echo 'selected="selected"'; ?>>
 | 
					                <option value="<?php echo $enreg['user_id']; ?>" <?php if(((is_array($arr_infos) && in_array($enreg['user_id'], $arr_infos)))) echo 'selected="selected"'; ?>>
 | 
				
			||||||
                    <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?> | 
					                    <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?> | 
				
			||||||
                </option> | 
					                </option> | 
				
			||||||
            <?php | 
					            <?php | 
				
			||||||
            } | 
					            } | 
				
			||||||
            unset($coaches); | 
					            unset($coaches); | 
				
			||||||
            ?> | 
					            ?> | 
				
			||||||
        </select> | 
					        </select> | 
				
			||||||
        <div class="control"> | 
					        <div class="control"> | 
				
			||||||
        <button class="btn btn-success" type="submit" name="name" value="<?php echo get_lang('AssignCoach') ?>">
 | 
					        <button class="btn btn-success" type="submit" name="name" value="<?php echo get_lang('AssignCoach') ?>">
 | 
				
			||||||
            <i class="fa fa-plus"></i> | 
					            <i class="fa fa-plus"></i> | 
				
			||||||
            <?php echo get_lang('AssignCoach') ?> | 
					            <?php echo get_lang('AssignCoach') ?> | 
				
			||||||
        </button> | 
					        </button> | 
				
			||||||
        </div> | 
					        </div> | 
				
			||||||
    </div> | 
					    </div> | 
				
			||||||
    <div class="col-md-2"></div> | 
					    <div class="col-md-2"></div> | 
				
			||||||
</div> | 
					</div> | 
				
			||||||
</form> | 
					</form> | 
				
			||||||
</div> | 
					</div> | 
				
			||||||
<?php | 
					<?php | 
				
			||||||
Display::display_footer(); | 
					Display::display_footer(); | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue