Adding option allow_teachers_to_create_sessions see BT#4296

1.10.x
Julio Montoya 10 years ago
parent 99675f88f5
commit 1720efd5b7
  1. 33
      main/inc/ajax/model.ajax.php
  2. 21
      main/inc/ajax/session.ajax.php
  3. 39
      main/inc/lib/api.lib.php
  4. 101
      main/inc/lib/sessionmanager.lib.php
  5. 163
      main/mySpace/myStudents.php
  6. 2
      main/session/add_courses_to_session.php
  7. 5
      main/session/add_many_session_to_category.php
  8. 6
      main/session/add_students_to_session.php
  9. 6
      main/session/add_teachers_to_session.php
  10. 39
      main/session/add_users_to_session.php
  11. 4
      main/session/resume_session.php
  12. 176
      main/session/session_add.php
  13. 45
      main/session/session_category_add.php
  14. 5
      main/session/session_category_edit.php
  15. 47
      main/session/session_course_edit.php
  16. 2
      main/session/session_course_list.php
  17. 2
      main/session/session_course_user.php
  18. 2
      main/session/session_course_user_list.php
  19. 86
      main/session/session_edit.php
  20. 31
      main/session/session_list.php
  21. 4
      main/session/session_user_edit.php
  22. 46
      main/session/session_user_import.php
  23. 268
      main/template/default/auth/sessions_catalog.tpl
  24. 8
      src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150511133949.php

@ -45,7 +45,8 @@ if (!in_array(
'get_usergroups_teacher',
'get_user_course_report_resumed',
'get_user_course_report',
'get_sessions_tracking'
'get_sessions_tracking',
'get_sessions'
)
) && !isset($_REQUEST['from_course_session'])) {
api_protect_admin_script(true);
@ -877,6 +878,7 @@ switch ($action) {
}
break;
case 'get_sessions':
$columns = array(
'name',
'nbr_courses',
@ -889,16 +891,27 @@ switch ($action) {
'visibility'
);
// Rename Category_name
$whereCondition = str_replace('category_name', 'sc.name', $whereCondition);
if (SessionManager::allowToManageSessions()) {
if (SessionManager::allowOnlyMySessions()) {
$whereCondition .= ' AND s.id_coach = '.api_get_user_id();
}
// Rename Category_name
$whereCondition = str_replace(
'category_name',
'sc.name',
$whereCondition
);
$result = SessionManager::get_sessions_admin(
array(
'where' => $whereCondition,
'order' => "$sidx $sord",
'limit' => "$start , $limit"
)
);
}
$result = SessionManager::get_sessions_admin(
array(
'where' => $whereCondition,
'order' => "$sidx $sord",
'limit'=> "$start , $limit"
)
);
break;
case 'get_exercise_progress':
$sessionId = intval($_GET['session_id']);

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Responses to AJAX calls
*/
@ -106,19 +107,13 @@ switch ($action) {
}
break;
case 'get_description':
$sessionId = intval($_GET['session']);
$sessionInfo = api_get_session_info($sessionId);
?>
<h2><?php echo $sessionInfo['name'] ?></h2><br>
<div class="home-course-intro">
<div class="page-course">
<div class="page-course-intro">
<p><?php echo $sessionInfo['show_description'] == 1 ? $sessionInfo['description'] : get_lang('None') ?></p>
</div>
</div>
</div>
<?php
if (isset($_GET['session'])) {
$sessionInfo = api_get_session_info($_GET['session']);
echo '<h2>'.$sessionInfo['name'].'</h2>';
echo '<div class="home-course-intro"><div class="page-course"><div class="page-course-intro">';
echo $sessionInfo['show_description'] == 1 ? $sessionInfo['description'] : get_lang('None');
echo '</div></div></div>';
}
default:
echo '';
}

@ -1223,8 +1223,8 @@ function api_protect_teacher_script($allow_sessions_admins = false)
*/
function api_block_anonymous_users($printHeaders = true)
{
$_user = api_get_user_info();
if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'], true)) {
$user = api_get_user_info();
if (!(isset($user['user_id']) && $user['user_id']) || api_is_anonymous($user['user_id'], true)) {
api_not_allowed($printHeaders);
return false;
}
@ -2161,7 +2161,8 @@ function api_get_session_name($session_id) {
* @param int Session ID
* @return array information of the session
*/
function api_get_session_info($session_id) {
function api_get_session_info($session_id)
{
$data = array();
if (!empty($session_id)) {
$session_id = intval($session_id);
@ -2173,6 +2174,7 @@ function api_get_session_info($session_id) {
$data = Database::fetch_array($result, 'ASSOC');
}
}
return $data;
}
@ -2824,35 +2826,38 @@ function api_is_coach($session_id = 0, $courseId = null, $check_student_view = t
* @return boolean True if current user is a course administrator
*/
function api_is_session_admin() {
$_user = api_get_user_info();
return isset($_user['status']) && $_user['status'] == SESSIONADMIN;
$user = api_get_user_info();
return isset($user['status']) && $user['status'] == SESSIONADMIN;
}
/**
* Checks whether the current user is a human resources manager
* @return boolean True if current user is a human resources manager
*/
function api_is_drh() {
$_user = api_get_user_info();
return isset($_user['status']) && $_user['status'] == DRH;
function api_is_drh()
{
$user = api_get_user_info();
return isset($user['status']) && $user['status'] == DRH;
}
/**
* Checks whether the current user is a student
* @return boolean True if current user is a human resources manager
*/
function api_is_student() {
$_user = api_get_user_info();
return isset($_user['status']) && $_user['status'] == STUDENT;
function api_is_student()
{
$user = api_get_user_info();
return isset($user['status']) && $user['status'] == STUDENT;
}
/**
* Checks whether the current user is a teacher
* Checks whether the current user has the status 'teacher'
* @return boolean True if current user is a human resources manager
*/
function api_is_teacher() {
$_user = api_get_user_info();
return isset($_user['status']) && $_user['status'] == COURSEMANAGER;
function api_is_teacher()
{
$user = api_get_user_info();
return isset($user['status']) && $user['status'] == COURSEMANAGER;
}
/**
@ -2860,9 +2865,9 @@ function api_is_teacher() {
* @return boolean
*/
function api_is_invitee() {
$_user = api_get_user_info();
$user = api_get_user_info();
return isset($_user['status']) && $_user['status'] == INVITEE;
return isset($user['status']) && $user['status'] == INVITEE;
}
/**

@ -192,6 +192,7 @@ class SessionManager
if (!empty($id_session_category)) {
$values['session_category_id'] = $id_session_category;
}
$session_id = Database::insert($tbl_session, $values);
$duration = intval($duration);
@ -1484,7 +1485,7 @@ class SessionManager
$id_checked = intval($id_checked);
}
if (!api_is_platform_admin() && !$from_ws) {
if (SessionManager::allowed($id_checked) && !$from_ws) {
$sql = 'SELECT session_admin_id FROM ' . $tbl_session. '
WHERE id IN (' . $id_checked.')';
$rs = Database::query($sql);
@ -3570,22 +3571,106 @@ class SessionManager
/**
* Protect a session to be edited.
* @param int $id
* @param bool $checkSession
*/
public static function protect_session_edit($id)
public static function protectSession($id, $checkSession = true)
{
api_protect_admin_script(true);
$session_info = self::fetch($id);
// api_protect_admin_script(true);
if (self::allowToManageSessions()) {
if (empty($session_info)) {
if (api_is_platform_admin()) {
return true;
}
if ($checkSession) {
if (self::allowed($id)) {
return true;
} else {
api_not_allowed(true);
}
}
} else {
api_not_allowed(true);
}
if (!api_is_platform_admin() &&
}
/**
* @param int $id
* @return bool
*/
private static function allowed($id)
{
$sessionInfo = self::fetch($id);
if (empty($sessionInfo)) {
return false;
}
$userId = api_get_user_id();
if (api_is_session_admin() &&
api_get_setting('allow_session_admins_to_manage_all_sessions') != 'true'
) {
if ($session_info['session_admin_id'] != api_get_user_id()) {
api_not_allowed(true);
if ($sessionInfo['session_admin_id'] != $userId) {
return false;
}
}
if (api_is_teacher() &&
api_get_setting('allow_teachers_to_create_sessions') == 'true'
) {
if ($sessionInfo['id_coach'] != $userId) {
return false;
}
}
return true;
}
/**
* @return bool
*/
public static function allowToManageSessions()
{
if (self::allowManageAllSessions()) {
return true;
}
$setting = api_get_setting('allow_teachers_to_create_sessions');
if (api_is_teacher() && $setting == 'true') {
return true;
}
return false;
}
/**
* @return bool
*/
public static function allowOnlyMySessions()
{
if (self::allowToManageSessions() &&
!api_is_platform_admin() &&
api_is_teacher()
) {
return true;
}
return false;
}
/**
* @return bool
*/
public static function allowManageAllSessions()
{
if (api_is_platform_admin()) {
return true;
}
return false;
}
/**

@ -9,7 +9,11 @@ require_once '../inc/global.inc.php';
api_block_anonymous_users();
if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh() && !api_is_student_boss()) {
if (!api_is_allowed_to_create_course() &&
!api_is_session_admin() &&
!api_is_drh() &&
!api_is_student_boss()
) {
// Check if the user is tutor of the course
$user_course_status = CourseManager::get_tutor_in_course_status(
api_get_user_id(),
@ -29,13 +33,19 @@ function show_image(image,width,height) {
</script>';
$export_csv = isset ($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$sessionId = isset($_GET['id_session']) ? $_GET['id_session'] : 0;
if (empty($sessionId)) {
$sessionId = api_get_session_id();
}
if ($export_csv) {
ob_start();
}
$csv_content = array();
$from_myspace = false;
if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
$from_myspace = true;
$this_section = SECTION_TRACKING;
@ -70,15 +80,11 @@ if (isset($_GET['details'])) {
} else
if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
$interbreadcrumb[] = array (
'url' => '../admin/index.php',
"name" => get_lang('PlatformAdmin')
);
$interbreadcrumb[] = array (
'url' => "../admin/session_list.php",
'url' => "../session/session_list.php",
"name" => get_lang('SessionList')
);
$interbreadcrumb[] = array (
'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']),
'url' => "../session/resume_session.php?id_session=" . $sessionId,
"name" => get_lang('SessionOverview')
);
} else {
@ -109,27 +115,30 @@ if (isset($_GET['details'])) {
$nameTools = get_lang("DetailsStudentInCourse");
} else {
if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
$interbreadcrumb[] = array (
/*$interbreadcrumb[] = array (
'url' => '../admin/index.php',
"name" => get_lang('PlatformAdmin')
);
);*/
$interbreadcrumb[] = array (
'url' => "../admin/session_list.php",
'url' => "../session/session_list.php",
"name" => get_lang('SessionList')
);
$interbreadcrumb[] = array (
'url' => "../admin/resume_session.php?id_session=" . Security :: remove_XSS($_GET['id_session']),
"name" => get_lang('SessionOverview')
);
if (!empty($sessionId)) {
$interbreadcrumb[] = array(
'url' => "../session/resume_session.php?id_session=".$sessionId,
"name" => get_lang('SessionOverview')
);
}
} else {
$interbreadcrumb[] = array (
"url" => "index.php",
"name" => get_lang('MySpace')
);
if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
if (isset ($_GET['id_session']) && intval($_GET['id_session']) != 0) {
if ($sessionId) {
$interbreadcrumb[] = array (
"url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $_GET['id_session'],
"url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $sessionId,
"name" => get_lang("CoachStudents")
);
} else {
@ -157,11 +166,6 @@ if (isset($_GET['user_id']) && $_GET['user_id'] != "") {
$user_id = api_get_user_id();
}
$session_id = isset($_GET['id_session']) ? intval($_GET['id_session']) : 0;
if (empty($session_id)) {
$session_id = api_get_session_id();
}
$student_id = intval($_GET['student']);
// Action behaviour
@ -183,7 +187,7 @@ if ($check) {
$student_id,
$lp_id,
$course_info,
$session_id
$sessionId
);
// @todo delete the stats.track_e_exercises records.
@ -327,7 +331,7 @@ if (!empty($student_id)) {
echo $send_mail;
if (!empty($student_id) && !empty($_GET['course'])) {
// Only show link to connection details if course and student were defined in the URL
echo '<a href="access_details.php?student=' . $student_id . '&course=' . Security :: remove_XSS($_GET['course']) . '&amp;origin=' . Security :: remove_XSS($_GET['origin']) . '&amp;cidReq='.Security::remove_XSS($_GET['course']).'&amp;id_session='.$session_id.'">'.
echo '<a href="access_details.php?student=' . $student_id . '&course=' . Security :: remove_XSS($_GET['course']) . '&amp;origin=' . Security :: remove_XSS($_GET['origin']) . '&amp;cidReq='.Security::remove_XSS($_GET['course']).'&amp;id_session='.$sessionId.'">'.
Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'</a>';
}
if (api_can_login_as($student_id)) {
@ -358,7 +362,7 @@ if (!empty($student_id)) {
$user_info['user_id'],
$course_code,
array(),
$session_id
$sessionId
);
//the score inside the Reporting table
@ -366,7 +370,7 @@ if (!empty($student_id)) {
$user_info['user_id'],
$course_code,
array(),
$session_id
$sessionId
);
}
@ -381,7 +385,7 @@ if (!empty($student_id)) {
Tracking:: get_time_spent_on_the_course(
$user_info['user_id'],
$courseInfo['real_id'],
$session_id
$sessionId
)
);
}
@ -439,10 +443,10 @@ if (!empty($student_id)) {
$session_name = '';
$nb_login = Tracking :: count_login_per_student($user_info['user_id'], $info_course['real_id']);
//get coach and session_name if there is one and if session_mode is activated
if ($session_id > 0) {
$session_info = api_get_session_info($session_id);
$course_coachs = api_get_coachs_from_course($session_id, $info_course['real_id']);
if ($sessionId > 0) {
$session_info = api_get_session_info($sessionId);
$session_coach_id = $session_info['session_admin_id'];
$course_coachs = api_get_coachs_from_course($sessionId, $info_course['real_id']);
$nb_login = '';
if (!empty($course_coachs)) {
$info_tutor_name = array();
@ -544,7 +548,6 @@ if (!empty($student_id)) {
<td align="right"><?php echo get_lang('LatestLogin') ?></td>
<td align="left"><?php echo $last_connection_date ?></td>
</tr>
<?php if (isset($_GET['details']) && $_GET['details'] == 'true') {?>
<tr>
<td align="right"><?php echo get_lang('TimeSpentInTheCourse') ?></td>
@ -580,9 +583,8 @@ if (!empty($student_id)) {
<?php
$table_title = '';
if (!empty($session_id)) {
$session_name = api_get_session_name($session_id);
if (!empty($sessionId)) {
$session_name = api_get_session_name($sessionId);
$table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':'');
}
if (!empty($info_course['title'])) {
@ -606,8 +608,8 @@ if (!empty($student_id)) {
$attendance = new Attendance();
foreach ($courses_in_session as $key => $courses) {
$session_id = $key;
$session_info = api_get_session_info($session_id);
$sessionId = $key;
$session_info = api_get_session_info($sessionId);
$session_name = '';
if ($session_info) {
$session_name = $session_info['name'];
@ -622,14 +624,15 @@ if (!empty($student_id)) {
if (!empty($session_info['date_end']) && $session_info['date_end'] != '0000-00-00') {
$date_end = api_format_date($session_info['date_end'], DATE_FORMAT_SHORT);
}
$date_session = '';
if (!empty($date_start) && !empty($date_end)) {
$date_session = get_lang('From') . ' ' . $date_start . ' ' . get_lang('Until') . ' ' . $date_end;
}
$title = '';
if (empty($session_id)) {
if (empty($sessionId)) {
$title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
} else {
$title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
//$title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
}
// Courses
@ -654,13 +657,13 @@ if (!empty($student_id)) {
if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
$course_info = CourseManager :: get_course_information($course_code);
$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $session_id));
$time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($user_info['user_id'], $courseId, $sessionId));
// get average of faults in attendances by student
$results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $session_id);
$results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $sessionId);
if (!empty($results_faults_avg['total'])) {
if (api_is_drh()) {
$attendances_faults_avg = '<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&id_session='.$session_id.'&student_id='.$student_id.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
$attendances_faults_avg = '<a title="'.get_lang('GoAttendance').'" href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?cidReq='.$course_code.'&id_session='.$sessionId.'&student_id='.$student_id.'">'.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)</a>';
} else {
$attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)';
}
@ -669,12 +672,12 @@ if (!empty($student_id)) {
}
// Get evaluations by student
$cats = Category::load(null, null, $course_code, null, null, $session_id);
$cats = Category::load(null, null, $course_code, null, null, $sessionId);
$scoretotal = array();
if (isset($cats) && isset($cats[0])) {
if (!empty($session_id)) {
$scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $session_id);
if (!empty($sessionId)) {
$scoretotal= $cats[0]->calc_score($student_id, null, $course_code, $sessionId);
} else {
$scoretotal= $cats[0]->calc_score($student_id, null, $course_code);
}
@ -685,8 +688,8 @@ if (!empty($student_id)) {
$scoretotal_display = round($scoretotal[0],1).'/'.round($scoretotal[1],1).' ('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)';
}
$progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $session_id);
$score = Tracking :: get_avg_student_score($user_info['user_id'], $course_code, null, $session_id);
$progress = Tracking::get_avg_student_progress($user_info['user_id'], $course_code, null, $sessionId);
$score = Tracking :: get_avg_student_score($user_info['user_id'], $course_code, null, $sessionId);
$progress = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
@ -709,10 +712,10 @@ if (!empty($student_id)) {
<td >'.$scoretotal_display.'</td>';
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent">
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$sessionId.'#infosStudent">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
} else {
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent">
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$sessionId.'#infosStudent">
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
}
echo '</tr>';
@ -740,7 +743,7 @@ if (!empty($student_id)) {
get_lang('LastConnexion')
);
if (empty($session_id)) {
if (empty($sessionId)) {
$sql_lp = " SELECT lp.name, lp.id FROM $t_lp lp
WHERE session_id = 0 AND c_id = {$info_course['real_id']}
ORDER BY lp.display_order";
@ -782,7 +785,7 @@ if (!empty($student_id)) {
$student_id,
$course_code,
array($lp_id),
$session_id
$sessionId
);
if ($progress === null) {
@ -796,7 +799,7 @@ if (!empty($student_id)) {
$student_id,
$course_code,
array($lp_id),
$session_id
$sessionId
);
if (!empty($total_time)) {
@ -808,7 +811,7 @@ if (!empty($student_id)) {
$student_id,
$course_code,
$lp_id,
$session_id
$sessionId
);
if (!empty($start_time)) {
@ -824,7 +827,7 @@ if (!empty($student_id)) {
$student_id,
$course_code,
array($lp_id),
$session_id
$sessionId
);
// Latest exercise results in a LP
@ -832,7 +835,7 @@ if (!empty($student_id)) {
$student_id,
$course_code,
array($lp_id),
$session_id,
$sessionId,
false,
true
);
@ -889,7 +892,7 @@ if (!empty($student_id)) {
}
$link = Display::url(
'<img src="../img/2rightarrow.gif" border="0" />',
'lp_tracking.php?cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$user_info['user_id'].'&id_session='.$session_id
'lp_tracking.php?cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$user_info['user_id'].'&id_session='.$sessionId
);
echo Display::tag('td', $link);
}
@ -897,7 +900,7 @@ if (!empty($student_id)) {
if (api_is_allowed_to_edit()) {
echo '<td>';
if ($any_result === true) {
echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student='.$user_info['user_id'].'&details=true&id_session='.Security::remove_XSS($_GET['id_session']).'">';
echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student='.$user_info['user_id'].'&details=true&id_session='.$sessionId.'">';
echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
echo '</a>';
}
@ -938,7 +941,7 @@ if (!empty($student_id)) {
$sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
WHERE
quiz.c_id = ".$info_course['real_id']." AND
(quiz.session_id = $session_id OR quiz.session_id = 0) AND
(quiz.session_id = $sessionId OR quiz.session_id = 0) AND
active IN (0, 1)
ORDER BY quiz.title ASC ";
@ -947,11 +950,11 @@ if (!empty($student_id)) {
if (Database :: num_rows($result_exercices) > 0) {
while ($exercices = Database :: fetch_array($result_exercices)) {
$exercise_id = intval($exercices['id']);
$count_attempts = Tracking::count_student_exercise_attempts($student_id, $courseInfo['real_id'], $exercise_id, 0, 0, $session_id, 2);
$score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $session_id, 1, 0);
$count_attempts = Tracking::count_student_exercise_attempts($student_id, $courseInfo['real_id'], $exercise_id, 0, 0, $sessionId, 2);
$score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 1, 0);
if (!isset($score_percentage) && $count_attempts > 0) {
$scores_lp = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $session_id, 2, 1);
$scores_lp = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $sessionId, 2, 1);
$score_percentage = $scores_lp[0];
$lp_name = $scores_lp[1];
} else {
@ -988,23 +991,25 @@ if (!empty($student_id)) {
echo '<td>'.$count_attempts.'</td>';
echo '<td>';
$sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
WHERE exe_exo_id ="'.$exercise_id.'" AND
exe_user_id ="'.$student_id.'" AND
c_id = '.$courseInfo['real_id'].' AND
session_id ="'.$session_id.'" AND
status = ""
ORDER BY exe_date DESC LIMIT 1';
$result_last_attempt = Database::query($sql_last_attempt);
$sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
WHERE
exe_exo_id ="'.$exercise_id.'" AND
exe_user_id ="'.$student_id.'" AND
c_id = '.$courseInfo['real_id'].' AND
session_id ="'.$sessionId.'" AND
status = ""
ORDER BY exe_date DESC
LIMIT 1';
$result_last_attempt = Database::query($sql);
if (Database :: num_rows($result_last_attempt) > 0) {
$id_last_attempt = Database :: result($result_last_attempt, 0, 0);
if ($count_attempts > 0)
echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$session_id.'&student='.$student_id.'&origin='.(empty($_GET['origin'])?'tracking':Security::remove_XSS($_GET['origin'])).'"> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($_GET['origin'])?'tracking':Security::remove_XSS($_GET['origin'])).'"> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" border="0" /> </a>';
}
echo '</td>';
echo '<td>';
$all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$session_id";
$all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
echo '</td></tr>';
@ -1029,8 +1034,8 @@ if (!empty($student_id)) {
}
//@when using sessions we do not show the survey list
if (empty($session_id)) {
$survey_list = SurveyManager::get_surveys($course_code, $session_id);
if (empty($sessionId)) {
$survey_list = SurveyManager::get_surveys($course_code, $sessionId);
$survey_data = array();
foreach($survey_list as $survey) {
@ -1074,12 +1079,12 @@ if (!empty($student_id)) {
echo '<table class="data_table">';
$csv_content[] = array ();
$nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $session_id);
$messages = Tracking::count_student_messages($student_id, $course_code, $session_id);
$links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $session_id);
$chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $session_id);
$documents = Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $session_id);
$uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $session_id);
$nb_assignments = Tracking::count_student_assignments($student_id, $course_code, $sessionId);
$messages = Tracking::count_student_messages($student_id, $course_code, $sessionId);
$links = Tracking::count_student_visited_links($student_id, $info_course['real_id'], $sessionId);
$chat_last_connection = Tracking::chat_last_connection($student_id, $info_course['real_id'], $sessionId);
$documents = Tracking::count_student_downloaded_documents($student_id, $info_course['real_id'], $sessionId);
$uploaded_documents = Tracking::count_student_uploaded_documents($student_id, $course_code, $sessionId);
$csv_content[] = array(
get_lang('OtherTools')

@ -13,7 +13,7 @@ require_once '../inc/global.inc.php';
$sessionId = isset($_GET['id_session']) ? intval($_GET['id_session']) : null;
$add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
SessionManager::protect_session_edit($sessionId);
SessionManager::protectSession($sessionId);
$xajax = new xajax();
$xajax->registerFunction(array('search_courses', 'AddCourseToSession', 'search_courses'));

@ -15,9 +15,6 @@ $xajax->registerFunction('search_courses');
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions
api_protect_admin_script(true);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
@ -34,6 +31,8 @@ $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tool_name = get_lang('SubscribeSessionsToCategory');
$id_session = isset($_GET['id_session']) ? intval($_GET['id_session']) : null;
SessionManager::protectSession($id_session);
$add_type = 'multiple';
if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);

@ -12,9 +12,6 @@ require_once '../inc/global.inc.php';
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions
api_protect_admin_script(true);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
@ -30,6 +27,9 @@ $errorMsg = '';
$users = $sessions = array();
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
SessionManager::protectSession($id);
$htmlResult = null;
if (isset($_POST['form_sent']) && $_POST['form_sent']) {

@ -12,9 +12,6 @@ require_once '../inc/global.inc.php';
// setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions
api_protect_admin_script(true);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
@ -30,6 +27,9 @@ $errorMsg = '';
$users = $sessions = array();
$id = intval($_GET['id']);
SessionManager::protectSession($id);
$htmlResult = null;
if (isset($_POST['form_sent']) && $_POST['form_sent']) {

@ -20,7 +20,7 @@ $id_session = intval($_GET['id_session']);
$addProcess = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
SessionManager::protect_session_edit($id_session);
SessionManager::protectSession($id_session);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
@ -37,7 +37,7 @@ $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tool_name = get_lang('SubscribeUsersToSession');
$add_type = 'unique';
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
@ -88,7 +88,9 @@ function search_users($needle, $type)
$order_clause = ' ORDER BY official_code, firstname, lastname, username';
}
if (api_is_session_admin() && api_get_setting('prevent_session_admins_to_manage_all_users') === 'true') {
if (api_is_session_admin() &&
api_get_setting('prevent_session_admins_to_manage_all_users') === 'true'
) {
$order_clause = " AND user.creator_id = " . api_get_user_id() . $order_clause;
}
@ -305,7 +307,12 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
if ($form_sent == 1) {
// Added a parameter to send emails when registering a user
SessionManager::suscribe_users_to_session($id_session, $UserList, null, true);
SessionManager::suscribe_users_to_session(
$id_session,
$UserList,
null,
true
);
header('Location: resume_session.php?id_session='.$id_session);
exit;
}
@ -390,7 +397,10 @@ if ($ajax_search) {
if (UserManager::is_extra_field_available($new_field['variable'])) {
if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
$use_extra_fields = true;
$extra_field_result[]= UserManager::get_extra_user_data_by_value($new_field['variable'], $_POST[$varname]);
$extra_field_result[] = UserManager::get_extra_user_data_by_value(
$new_field['variable'],
$_POST[$varname]
);
}
}
}
@ -466,8 +476,9 @@ if ($ajax_search) {
$result = Database::query($sql);
$users = Database::store_result($result,'ASSOC');
foreach ($users as $uid => $user) {
if ($user['id_session'] != $id_session) {
if ($user['session_id'] != $id_session) {
$nosessionUsersList[$user['id']] = array(
'fn' => $user['firstname'],
'ln' => $user['lastname'],
@ -480,7 +491,7 @@ if ($ajax_search) {
unset($users); //clean to free memory
//filling the correct users in list
$sql="SELECT u.id, lastname, firstname, username, session_id, official_code
$sql = "SELECT u.id, lastname, firstname, username, session_id, official_code
FROM $tbl_user u
LEFT JOIN $tbl_session_rel_user
ON $tbl_session_rel_user.user_id = u.id AND
@ -507,7 +518,7 @@ if ($ajax_search) {
$result = Database::query($sql);
$users = Database::store_result($result,'ASSOC');
foreach ($users as $uid => $user) {
if ($user['id_session'] == $id_session) {
if ($user['session_id'] == $id_session) {
$sessionUsersList[$user['id']] = $user;
if (array_key_exists($user['id'],$nosessionUsersList)) {
unset($nosessionUsersList[$user['id']]);
@ -519,19 +530,23 @@ if ($ajax_search) {
}
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'.
Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_multiple = Display::url(Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'), '');
} else {
$link_add_type_unique = Display::url(Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'), '');
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&amp;add='.$addProcess.'&amp;add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
$link_add_group = '<a href="usergroups.php">'.Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').'</a>';
$link_add_group = Display::url(
Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'),
api_get_path(WEB_CODE_PATH).'admin/usergroups.php'
);
$newLinks = Display::url(
get_lang('EnrollTrainersFromExistingSessions'), api_get_path(WEB_CODE_PATH).'session/add_teachers_to_session.php'
get_lang('EnrollTrainersFromExistingSessions'), api_get_path(WEB_CODE_PATH).'session/add_teachers_to_session.php?id='.$id_session
);
$newLinks .= Display::url(
get_lang('EnrollStudentsFromExistingSessions'), api_get_path(WEB_CODE_PATH).'session/add_students_to_session.php'
get_lang('EnrollStudentsFromExistingSessions'), api_get_path(WEB_CODE_PATH).'session/add_students_to_session.php?id='.$id_session
);
?>
<div class="actions">

@ -18,7 +18,7 @@ if (empty($sessionId)) {
api_not_allowed(true);
}
SessionManager::protect_session_edit($sessionId);
SessionManager::protectSession($sessionId);
$tool_name = get_lang('SessionOverview');
@ -428,7 +428,7 @@ if (!empty($userList)) {
$reportingLink = Display::url(
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.'&id_session='.$sessionId
);
$courseUserLink = Display::url(

@ -5,27 +5,32 @@
* @package chamilo.admin
*/
$cidReset=true;
$cidReset = true;
// including the global Chamilo file
require_once '../inc/global.inc.php';
$xajax = new xajax();
//$xajax->debugOn();
$xajax -> registerFunction ('search_coachs');
$xajax->registerFunction('search_coachs');
// setting the section (for the tabs)
$this_section=SECTION_PLATFORM_ADMIN;
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
SessionManager::protectSession(null, false);
api_protect_limit_for_session_admin();
$formSent=0;
$errorMsg='';
$interbreadcrumb[]=array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array(
'url' => 'index.php',
'name' => get_lang('PlatformAdmin'),
);
$interbreadcrumb[] = array(
'url' => 'session_list.php',
'name' => get_lang('SessionList'),
);
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@ -40,7 +45,8 @@ function search_coachs($needle) {
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
$sql = 'SELECT username, lastname, firstname
FROM '.$tbl_user.' user
WHERE (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%")
@ -53,15 +59,19 @@ function search_coachs($needle) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql = 'SELECT username, lastname, firstname
FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
WHERE
access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
OR firstname LIKE "'.$needle.'%"
OR lastname LIKE "'.$needle.'%")
AND status=1'.
$order_clause.
' LIMIT 10';
FROM '.$tbl_user.' user
INNER JOIN '.$tbl_user_rel_access_url.' url_user
ON (url_user.user_id=user.user_id)
WHERE
access_url_id = '.$access_url_id.' AND
(
username LIKE "'.$needle.'%" OR
firstname LIKE "'.$needle.'%" OR
lastname LIKE "'.$needle.'%"
)
AND status=1'.
$order_clause.'
LIMIT 10';
}
}
@ -76,7 +86,6 @@ function search_coachs($needle) {
$xajax -> processRequests();
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = "
<script type=\"text/javascript\">
function fill_coach_field (username) {
@ -140,9 +149,9 @@ $defaultAfterDays = isset($_configuration['session_days_after_coach_access'])
$nb_days_acess_before = $defaultBeforeDays;
$nb_days_acess_after = $defaultAfterDays;
$thisYear=date('Y');
$thisMonth=date('m');
$thisDay=date('d');
$thisYear = date('Y');
$thisMonth = date('m');
$thisDay = date('d');
$dayList = array();
@ -193,58 +202,92 @@ $form->addElement('header', $tool_name);
$form->addElement('text', 'name', get_lang('SessionName'), array(
'maxlength' => 50,
'value' => $formSent ? api_htmlentities($name,ENT_QUOTES,$charset) : ''
'value' => $formSent ? api_htmlentities($name, ENT_QUOTES, $charset) : '',
));
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name');
$userInfo = api_get_user_info();
if (!api_is_platform_admin() && api_is_teacher()) {
$form->addElement(
'select',
'coach_username',
get_lang('CoachName'),
[api_get_user_id() => $userInfo['complete_name']],
array(
'id' => 'coach_username',
'class' => 'chzn-select',
'style' => 'width:370px;'
)
);
} else {
$sql = "SELECT COUNT(1) FROM $tbl_user WHERE status = 1";
$rs = Database::query($sql);
$countUsers = Database::result($rs, 0, 0);
if (intval($countUsers) < 50) {
$orderClause = "ORDER BY ";
$orderClause .= api_sort_by_first_name() ? "firstname, lastname, username" : "lastname, firstname, username";
$sql = "SELECT COUNT(1) FROM $tbl_user WHERE status = 1";
$rs = Database::query($sql);
$countUsers = Database::result($rs, 0, 0);
if (intval($countUsers) < 50) {
$orderClause = "ORDER BY ";
$orderClause .= api_sort_by_first_name() ? "firstname, lastname, username" : "lastname, firstname, username";
$sql = "SELECT user_id, lastname, firstname, username
FROM $tbl_user
WHERE status = '1' ".
$orderClause;
if (api_is_multiple_url_enabled()) {
$userRelAccessUrlTable = Database::get_main_table(
TABLE_MAIN_ACCESS_URL_REL_USER
);
$accessUrlId = api_get_current_access_url_id();
if ($accessUrlId != -1) {
$sql = "SELECT user.user_id, username, lastname, firstname
FROM $tbl_user user
INNER JOIN $userRelAccessUrlTable url_user
ON (url_user.user_id = user.user_id)
WHERE
access_url_id = $accessUrlId AND
status = 1 "
.$orderClause;
}
}
$sql="SELECT user_id, lastname, firstname, username FROM $tbl_user "
. "WHERE status = '1' "
. $orderClause;
$result = Database::query($sql);
$coachesList = Database::store_result($result);
if (api_is_multiple_url_enabled()) {
$userRelAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$accessUrlId = api_get_current_access_url_id();
$coachesOptions = array();
if ($accessUrlId != -1) {
$sql = "SELECT user.user_id, username, lastname, firstname FROM $tbl_user user "
. "INNER JOIN $userRelAccessUrlTable url_user ON (url_user.user_id = user.user_id) "
. "WHERE access_url_id = $accessUrlId AND status = 1 "
. $orderClause;
foreach ($coachesList as $coachItem) {
$coachesOptions[$coachItem['username']] = api_get_person_name(
$coachItem['firstname'],
$coachItem['lastname']
).' ('.$coachItem['username'].')';
}
}
$result = Database::query($sql);
$coachesList = Database::store_result($result);
$coachesOptions = array();
foreach($coachesList as $coachItem){
$coachesOptions[$coachItem['username']] = api_get_person_name(
$coachItem['firstname'],
$coachItem['lastname']
).' ('.$coachItem['username'].')';
$form->addElement(
'select',
'coach_username',
get_lang('CoachName'),
$coachesOptions,
array(
'id' => 'coach_username',
'class' => 'chzn-select',
'style' => 'width:370px;'
)
);
} else {
$form->addElement(
'text',
'coach_username',
get_lang('CoachName'),
array(
'maxlength' => 50,
'onkeyup' => "xajax_search_coachs(document.getElementById('coach_username').value)",
'id' => 'coach_username'
)
);
}
$form->addElement('select', 'coach_username', get_lang('CoachName'), $coachesOptions, array(
'id' => 'coach_username',
'class' => 'chzn-select',
'style' => 'width:370px;'
));
} else {
$form->addElement('text', 'coach_username', get_lang('CoachName'), array(
'maxlength' => 50,
'onkeyup' => "xajax_search_coachs(document.getElementById('coach_username').value)",
'id' => 'coach_username'
));
}
$form->addRule('coach_username', get_lang('ThisFieldIsRequired'), 'required');
@ -287,9 +330,7 @@ $form->addElement('checkbox', 'start_limit', '', get_lang('DateStartSession'), a
));
$form->addElement('html','<div id="start_date" style="display:none">');
$form->addElement('date_picker', 'date_start');
$form->addElement('html','</div>');
$form->addElement('checkbox', 'end_limit', '', get_lang('DateEndSession'), array(
@ -346,10 +387,9 @@ $formDefaults = array(
if (!$formSent) {
$formDefaults['date_start'] = "$thisYear-$thisMonth-$thisDay";
$formDefaults['date_end'] = date('Y-m-d', strtotime("$thisYear-$thisMonth-$thisDay +1 year"));
} else {
$formDefaults['name'] = api_htmlentities($name,ENT_QUOTES,$charset);
$formDefaults['name'] = api_htmlentities($name, ENT_QUOTES, $charset);
}
$form->setDefaults($formDefaults);
@ -362,7 +402,7 @@ if ($form->validate()) {
$endDate = $params['date_end'];
$nb_days_acess_before = $params['nb_days_acess_before'];
$nb_days_acess_after = $params['nb_days_acess_after'];
$coach_username = $params['coach_username'];
$coach_username = intval($params['coach_username']);
$id_session_category = $params['session_category'];
$id_visibility = $params['session_visibility'];
$end_limit = isset($params['end_limit']);

@ -1,20 +1,21 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.admin
* @todo use formvalidator for the form
*/
$cidReset=true;
$cidReset = true;
// including the global Dokeos file
require_once '../inc/global.inc.php';
$xajax = new xajax();
$xajax -> registerFunction ('search_coachs');
$xajax->registerFunction('search_coachs');
// setting the section (for the tabs)
$this_section=SECTION_PLATFORM_ADMIN;
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
$formSent=0;
@ -23,27 +24,35 @@ $interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'
$interbreadcrumb[]=array('url' => "session_category_list.php","name" => get_lang('ListSessionCategory'));
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent=1;
$name= $_POST['name'];
$year_start= $_POST['year_start'];
$month_start=$_POST['month_start'];
$day_start=$_POST['day_start'];
$year_end=$_POST['year_end'];
$month_end=$_POST['month_end'];
$day_end=$_POST['day_end'];
$return = SessionManager::create_category_session($name,$year_start,$month_start,$day_start,$year_end,$month_end,$day_end);
$formSent = 1;
$name = $_POST['name'];
$year_start = $_POST['year_start'];
$month_start = $_POST['month_start'];
$day_start = $_POST['day_start'];
$year_end = $_POST['year_end'];
$month_end = $_POST['month_end'];
$day_end = $_POST['day_end'];
$return = SessionManager::create_category_session(
$name,
$year_start,
$month_start,
$day_start,
$year_end,
$month_end,
$day_end
);
if ($return == strval(intval($return))) {
header('Location: session_category_list.php?action=show_message&message='.urlencode(get_lang('SessionCategoryAdded')));
exit();
}
}
$thisYear=date('Y');
$thisMonth=date('m');
$thisDay=date('d');
$thisYear = date('Y');
$thisMonth = date('m');
$thisDay = date('d');
$tool_name = get_lang('AddACategory');
//display the header

@ -27,11 +27,12 @@ $interbreadcrumb[] = array(
);
$sql = "SELECT * FROM $tbl_session_category WHERE id='".$id."' ORDER BY name";
$result=Database::query($sql);
if (!$infos=Database::fetch_array($result)) {
$result = Database::query($sql);
if (!$infos = Database::fetch_array($result)) {
header('Location: session_list.php');
exit();
}
list($year_start,$month_start,$day_start)=explode('-',$infos['date_start']);
list($year_end,$month_end,$day_end)=explode('-',$infos['date_end']);

@ -11,7 +11,7 @@ $cidReset = true;
require_once '../inc/global.inc.php';
$id_session = intval($_GET['id_session']);
SessionManager::protect_session_edit($id_session);
SessionManager::protectSession($id_session);
$course_code = $_GET['course_code'];
$formSent = 0;
@ -69,7 +69,11 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
foreach ($id_coachs as $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
@ -88,8 +92,12 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
exit();
}
} else {
$sql = "SELECT user_id FROM $tbl_session_rel_course_rel_user
WHERE session_id = '$id_session' AND c_id = '".$courseId."' AND status = 2 ";
$sql = "SELECT user_id
FROM $tbl_session_rel_course_rel_user
WHERE
session_id = '$id_session' AND
c_id = '".$courseId."' AND
status = 2 ";
$rs = Database::query($sql);
if (Database::num_rows($rs) > 0) {
@ -104,21 +112,36 @@ $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, usern
if (api_is_multiple_url_enabled()) {
$tbl_access_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
$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)
WHERE status='1' AND active = 1 AND access_url_id = $access_url_id ".$order_clause;
$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)
WHERE
status='1' AND
active = 1 AND
access_url_id = $access_url_id ".
$order_clause;
} else {
$sql="SELECT user_id,lastname,firstname,username
FROM $tbl_user
WHERE status='1' AND active = 1 ".$order_clause;
$sql = "SELECT user_id,lastname,firstname,username
FROM $tbl_user
WHERE
status = '1' AND
active = 1 ".
$order_clause;
}
$result = Database::query($sql);
$coaches = Database::store_result($result);
Display::display_header($tool_name);
if (!api_is_platform_admin() && api_is_teacher()) {
$userInfo = api_get_user_info();
$coaches = [$userInfo];
}
Display::display_header($tool_name);
$tool_name = get_lang('ModifySessionCourse');
api_display_tool_title($tool_name);
?>
<div class="session-course-edit">
@ -147,7 +170,7 @@ api_display_tool_title($tool_name);
<?php echo get_lang('None') ?>
</option>
<?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"'; ?>>
<?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?>

@ -11,7 +11,7 @@ require_once '../inc/global.inc.php';
$this_section=SECTION_PLATFORM_ADMIN;
$id_session = intval($_GET['id_session']);
SessionManager::protect_session_edit($id_session);
SessionManager::protectSession($id_session);
// Database Table Definitions
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);

@ -13,7 +13,7 @@ require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
$id_session = intval($_GET['id_session']);
SessionManager::protect_session_edit($id_session);
SessionManager::protectSession($id_session);
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));

@ -16,7 +16,7 @@ $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSIO
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$id_session = intval($_GET['id_session']);
SessionManager::protect_session_edit($id_session);
SessionManager::protectSession($id_session);
if (empty($id_session )) {
api_not_allowed();

@ -1,9 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Sessions edition script
* @package chamilo.admin
*/
$cidReset = true;
require_once '../inc/global.inc.php';
@ -13,12 +15,13 @@ $this_section = SECTION_PLATFORM_ADMIN;
$formSent = 0;
// Database Table Definitions
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$id = intval($_GET['id']);
SessionManager::protect_session_edit($id);
SessionManager::protectSession($id);
$infos = SessionManager::fetch($id);
$id_coach = $infos['id_coach'];
@ -31,8 +34,6 @@ $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name"
list($year_start, $month_start, $day_start) = explode('-', $infos['date_start']);
list($year_end, $month_end, $day_end) = explode('-', $infos['date_end']);
$end_year_disabled = $end_month_disabled = $end_day_disabled = '';
if (isset($_POST['formSent']) && $_POST['formSent']) {
$formSent = 1;
}
@ -40,7 +41,9 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$order_clause = 'ORDER BY ';
$order_clause .= api_sort_by_first_name() ? 'firstname, lastname, username' : 'lastname, firstname, username';
$sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1'".$order_clause;
$sql = "SELECT user_id,lastname,firstname,username
FROM $tbl_user
WHERE status='1'".$order_clause;
if (api_is_multiple_url_enabled()) {
$table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@ -53,30 +56,9 @@ if (api_is_multiple_url_enabled()) {
}
}
$result = Database::query($sql);
$coaches = Database::store_result($result);
$thisYear = date('Y');
$daysOption = array();
for ($i = 1; $i <= 31; $i++) {
$day = sprintf("%02d", $i);
$daysOption[$day] = $day;
}
$monthsOption = array();
for ($i = 1; $i <= 12; $i++) {
$month = sprintf("%02d", $i);
$monthsOption[$month] = $month;
}
$yearsOption = array();
for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++) {
$yearsOption[$i] = $i;
}
$result = Database::query($sql);
$coaches = Database::store_result($result);
$thisYear = date('Y');
$coachesOption = array(
'' => '----- ' . get_lang('None') . ' -----'
@ -84,7 +66,6 @@ $coachesOption = array(
foreach ($coaches as $coach) {
$personName = api_get_person_name($coach['firstname'], $coach['lastname']);
$coachesOption[$coach['user_id']] = "$personName ({$coach['username']})";
}
@ -113,11 +94,17 @@ $form->addElement('header', $tool_name);
$form->addElement('text', 'name', get_lang('SessionName'), array(
'class' => 'span4',
'maxlength' => 50,
'value' => $formSent ? api_htmlentities($name,ENT_QUOTES,$charset) : ''
'value' => $formSent ? api_htmlentities($name,ENT_QUOTES, $charset) : ''
));
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name');
if (!api_is_platform_admin() && api_is_teacher()) {
$userInfo = api_get_user_info();
$coachesOption = [api_get_user_id() => $userInfo['complete_name']];
}
$form->addElement('select', 'id_coach', get_lang('CoachName'), $coachesOption, array(
'id' => 'coach_username',
'class' => 'chzn-select',
@ -127,7 +114,7 @@ $form->addElement('select', 'id_coach', get_lang('CoachName'), $coachesOption, a
$form->addRule('id_coach', get_lang('ThisFieldIsRequired'), 'required');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html','<div id="advanced_params_options" style="display:none">');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOption, array(
@ -153,12 +140,9 @@ if (!empty($infos['show_description'])) {
}
$form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'), $chkDescriptionAttributes);
$form->addElement('text', 'nb_days_access_before', array('', '', get_lang('DaysBefore')), array(
'input-size' => '2',
));
$form->addElement('text', 'nb_days_access_after', array('', '', get_lang('DaysAfter')), array(
'input-size' => '2',
));
@ -204,13 +188,19 @@ if ($year_end != "0000") {
$form->addElement('date_picker', 'date_end');
$visibilityGroup = array();
$visibilityGroup[] = $form->createElement('select', 'session_visibility', null, array(
SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
SESSION_VISIBLE => get_lang('SessionAccessible'),
SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible'))
), array(
'style' => 'width:250px;'
));
$visibilityGroup[] = $form->createElement(
'select',
'session_visibility',
null,
array(
SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
SESSION_VISIBLE => get_lang('SessionAccessible'),
SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible')),
),
array(
'style' => 'width:250px;',
)
);
$form->addGroup($visibilityGroup, 'visibility_group', get_lang('SessionVisibility'), null, false);
@ -256,14 +246,14 @@ $formDefaults = array(
);
if ($formSent) {
$formDefaults['name'] = api_htmlentities($name,ENT_QUOTES,$charset);
$formDefaults['nb_days_access_before'] = api_htmlentities($nb_days_access_before,ENT_QUOTES,$charset);
$formDefaults['nb_days_access_after'] = api_htmlentities($nb_days_access_after,ENT_QUOTES,$charset);
$formDefaults['name'] = api_htmlentities($name, ENT_QUOTES, $charset);
$formDefaults['nb_days_access_before'] = api_htmlentities($nb_days_access_before, ENT_QUOTES,$charset);
$formDefaults['nb_days_access_after'] = api_htmlentities($nb_days_access_after, ENT_QUOTES,$charset);
$formDefaults['duration'] = Security::remove_XSS($duration);
} else {
$formDefaults['name'] = Security::remove_XSS($infos['name']);
$formDefaults['nb_days_access_before'] = api_htmlentities($infos['nb_days_access_before_beginning'],ENT_QUOTES,$charset);
$formDefaults['nb_days_access_after'] = api_htmlentities($infos['nb_days_access_after_end'],ENT_QUOTES,$charset);
$formDefaults['nb_days_access_before'] = api_htmlentities($infos['nb_days_access_before_beginning'], ENT_QUOTES, $charset);
$formDefaults['nb_days_access_after'] = api_htmlentities($infos['nb_days_access_after_end'], ENT_QUOTES, $charset);
$formDefaults['duration'] = $duration;
}

@ -9,7 +9,7 @@ $cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
SessionManager::protectSession(null, false);
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
@ -42,7 +42,6 @@ if (!empty($error_message)) {
Display::display_normal_message($error_message, false);
}
$sessionFilter = new FormValidator('course_filter', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course';
$courseList = array();
$courseId = isset($_GET['course_id']) ? $_GET['course_id'] : null;
@ -52,7 +51,15 @@ if (!empty($courseId)) {
$courseList[] = array('id' => $courseInfo['code'], 'text' => $parents.$courseInfo['title']);
}
$sessionFilter->addElement('select_ajax', 'course_name', get_lang('SearchCourse'), null, array('url' => $url, 'defaults' => $courseList));
$sessionFilter = new FormValidator('course_filter', 'get', '', '', array(), FormValidator::LAYOUT_INLINE);
$sessionFilter->addElement(
'select_ajax',
'course_name',
get_lang('SearchCourse'),
null,
array('url' => $url, 'defaults' => $courseList)
);
$url = api_get_self();
$actions = '
<script>
@ -213,15 +220,19 @@ $(function() {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'.
Display::return_icon('new_session.png',get_lang('AddSession'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/add_many_session_to_category.php">'.
Display::return_icon('session_to_category.png',get_lang('AddSessionsInCategories'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_category_list.php">'.
Display::return_icon('folder.png',get_lang('ListSessionCategory'),'',ICON_SIZE_MEDIUM).'</a>';
if (api_is_platform_admin()) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/add_many_session_to_category.php">'.
Display::return_icon('session_to_category.png',get_lang('AddSessionsInCategories'),'',ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_category_list.php">'.
Display::return_icon('folder.png',get_lang('ListSessionCategory'),'',ICON_SIZE_MEDIUM).'</a>';
}
echo $actions;
echo '<div class="pull-right">';
echo $sessionFilter->return_form();
echo '</div>';
if (api_is_platform_admin()) {
echo '<div class="pull-right">';
echo $sessionFilter->returnForm();
echo '</div>';
}
echo '</div>';
echo Display::grid_html('sessions');
Display::display_footer();

@ -6,12 +6,10 @@ $cidReset = true;
// including the global Chamilo file
require_once '../inc/global.inc.php';
api_protect_admin_script(true);
$sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null;
$userId = isset($_GET['user_id']) ? $_GET['user_id'] : null;
SessionManager::protect_session_edit($sessionId);
SessionManager::protectSession($sessionId);
$sessionInfo = api_get_session_info($sessionId);
if (empty($sessionInfo)) {

@ -12,29 +12,30 @@ require_once '../inc/global.inc.php';
set_time_limit(0);
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(true);
$session_id = isset($_GET['id_session']) ? intval($_GET['id_session']) : null;
SessionManager::protectSession($session_id);
$form_sent = 0;
$error_message = ''; // Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php.
$error_message = '';
// Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php.
if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
$error_message = Security::remove_XSS($_GET['message']);
}
$tool_name = get_lang('ImportUsers');
$session_id = isset($_GET['id_session']) ? intval($_GET['id_session']) : null;
if (empty($session_id)) {
api_not_allowed(true);
}
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => "session_list.php", "name" => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$session_id,
"name" => get_lang('SessionOverview')
$interbreadcrumb[] = array(
'url' => "resume_session.php?id_session=".$session_id,
"name" => get_lang('SessionOverview'),
);
if (isset($_POST['formSent']) && $_POST['formSent']) {
if (isset($_FILES['import_file']['tmp_name']) && !empty($_FILES['import_file']['tmp_name'])) {
if (isset($_FILES['import_file']['tmp_name']) &&
!empty($_FILES['import_file']['tmp_name'])
) {
$form_sent = $_POST['formSent'];
$send_mail = $_POST['sendMail'] ? 1 : 0;
@ -50,7 +51,13 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
}
if (!empty($user_list)) {
SessionManager::suscribe_users_to_session($session_id, $user_list, null, false, $send_mail);
SessionManager::suscribe_users_to_session(
$session_id,
$user_list,
null,
false,
$send_mail
);
foreach ($user_list as & $user_id) {
$user_info = api_get_user_info($user_id);
$user_id = $user_info['complete_name'];
@ -65,15 +72,6 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
// Display the header.
Display::display_header($tool_name);
/*if (count($inserted_in_course) > 1) {
$msg = get_lang('SeveralCoursesSubscribedToSessionBecauseOfSameVisualCode').': ';
foreach ($inserted_in_course as $code => $title) {
$msg .= ' '.$title.' ('.$title.'),';
}
$msg = substr($msg, 0, -1);
Display::display_warning_message($msg);
}*/
echo '<div class="actions">';
echo '<a href="resume_session.php?id_session='.$session_id.'">'.
Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM).
@ -84,7 +82,13 @@ if (!empty($error_message)) {
Display::display_normal_message($error_message, false);
}
$form = new FormValidator('import_sessions', 'post', api_get_self().'?id_session='.$session_id, null, array('enctype' => 'multipart/form-data'));
$form = new FormValidator(
'import_sessions',
'post',
api_get_self().'?id_session='.$session_id,
null,
array('enctype' => 'multipart/form-data')
);
$form->addElement('hidden', 'formSent', 1);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
$form->addElement('checkbox', 'sendMail', null, get_lang('SendMailToUsers'));

@ -1,161 +1,157 @@
{% extends template ~ "/layout/main.tpl" %}
{% block body %}
<script type="text/javascript">
$().ready(function() {
$('#date').datepicker({
dateFormat: 'yy-mm-dd'
});
$('#list-course').click(function(e) {
e.preventDefault();
var tempTarget = e.target.toString().split('#');
tempTarget = '#' + tempTarget[1];
// use the target of the link as the ID of the element to find
var target = $(tempTarget);
var targetContent = target.find('.list');
if (targetContent.is(':empty')) {
var idParts = tempTarget.split('-');
var sessionId = parseInt(idParts[1], 10);
$.ajax('{{ web_session_courses_ajax_url }}', {
data: {
a: 'display_sessions_courses',
session: sessionId
},
dataType: 'json',
success: function(response) {
var coursesUL = '';
$.each(response, function(index, course) {
coursesUL += '<li><img src="{{ _p.web }}main/img/check.png"/> <strong>' + course.name + '</strong>';
if (course.coachName != '') {
coursesUL += ' (' + course.coachName + ')';
}
coursesUL += '</li>';
});
targetContent.html('<ul class="items-session">' + coursesUL + '</ul>');
target.css({
height: targetContent.outerHeight()
}).addClass(' in');
}
});
} else {
target.addClass(' in');
}
});
<script type="text/javascript">
$().ready(function() {
$('#date').datepicker({
dateFormat: 'yy-mm-dd'
});
</script>
<div class="col-md-3">
{% if showCourses %}
<div class="panel panel-default">
<div class="panel-body">
{% if not hiddenLinks %}
<form class="form-search" method="post" action="{{ courseUrl }}">
<input type="hidden" name="sec_token" value="{{ searchToken }}">
<input type="hidden" name="search_course" value="1" />
<div class="form-group">
<input type="text" name="search_term" class="form-control"/>
<button class="btn btn-block btn-default" type="submit"><i class="fa fa-search"></i> {{ 'Search' | get_lang }}</button>
</div>
</form>
{% endif %}
{% if coursesCategoriesList is not empty %}
<a class="btn btn-block btn-default" href="{{ api_get_self }}?action=display_random_courses">{{ 'RandomPick' | get_lang }}</a>
{% endif %}
$('#list-course').click(function(e) {
e.preventDefault();
var tempTarget = e.target.toString().split('#');
tempTarget = '#' + tempTarget[1];
// use the target of the link as the ID of the element to find
var target = $(tempTarget);
var targetContent = target.find('.list');
if (targetContent.is(':empty')) {
var idParts = tempTarget.split('-');
var sessionId = parseInt(idParts[1], 10);
$.ajax('{{ web_session_courses_ajax_url }}', {
data: {
a: 'display_sessions_courses',
session: sessionId
},
dataType: 'json',
success: function(response) {
var coursesUL = '';
$.each(response, function(index, course) {
coursesUL += '<li><img src="{{ _p.web }}main/img/check.png"/> <strong>' + course.name + '</strong>';
if (course.coachName != '') {
coursesUL += ' (' + course.coachName + ')';
}
coursesUL += '</li>';
});
targetContent.html('<ul class="items-session">' + coursesUL + '</ul>');
target.css({
height: targetContent.outerHeight()
}).addClass(' in');
}
});
} else {
target.addClass(' in');
}
});
});
</script>
<div class="col-md-3">
{% if showCourses %}
<div class="panel panel-default">
<div class="panel-body">
{% if not hiddenLinks %}
<form class="form-search" method="post" action="{{ courseUrl }}">
<input type="hidden" name="sec_token" value="{{ searchToken }}">
<input type="hidden" name="search_course" value="1" />
<div class="form-group">
<input type="text" name="search_term" class="form-control"/>
<button class="btn btn-block btn-default" type="submit"><i class="fa fa-search"></i> {{ 'Search' | get_lang }}</button>
</div>
</div>
</form>
{% endif %}
{% if coursesCategoriesList is not empty %}
<div class="sidebar-nav">
<div class="panel panel-default">
<div class="panel-heading">
{{ 'CourseCategories' | get_lang }}
</div>
<div class="panel-body">
<ul class="list-categories">
{{ coursesCategoriesList }}
</ul>
</div>
</div>
</div>
<a class="btn btn-block btn-default" href="{{ api_get_self }}?action=display_random_courses">{{ 'RandomPick' | get_lang }}</a>
{% endif %}
{% endif %}
{% if showSessions %}
<div class="sidebar-nav">
<div class="panel panel-default">
<div class="panel-heading">
{{ 'Sessions' | get_lang }}
</div>
<div class="panel-body">
<form class="form-search" method="post" action="{{ api_get_self }}?action=display_sessions">
<div class="form-group">
<input type="date" name="date" id="date" class="form-control" value="{{ searchDate }}" readonly>
<button class="btn btn-block btn-default" type="submit"><i class="fa fa-search"></i> {{ 'Search' | get_lang }}</button>
</div>
</form>
</div>
</div>
</div>
{% endif %}
</div>
</div>
<div class="col-md-9">
{% for session in sessions_blocks %}
<div class="panel panel-default" id="panel-{{ session.id }}">
{% if coursesCategoriesList is not empty %}
<div class="sidebar-nav">
<div class="panel panel-default">
<div class="panel-heading">
{{ session.icon }} {{ session.name }}
{{ 'CourseCategories' | get_lang }}
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-9">
{% if showTutor %}
<div class="tutor">
<img src="{{ 'teacher.png' | icon(22) }}" width="16"> {{ 'GeneralCoach' | get_lang }} {{ session.coach_name }}
</div>
{% endif %}
<a id="list-course" class="btn btn-default" data-toggle="collapse" href="#session-{{ session.id }}-courses">
{{ 'CourseList' | get_lang }}
<ul class="list-categories">
{{ coursesCategoriesList }}
</ul>
</div>
</div>
</div>
{% endif %}
{% endif %}
{% if showSessions %}
<div class="sidebar-nav">
<div class="panel panel-default">
<div class="panel-heading">
{{ 'Sessions' | get_lang }}
</div>
<div class="panel-body">
<form class="form-search" method="post" action="{{ api_get_self }}?action=display_sessions">
<div class="form-group">
<input type="date" name="date" id="date" class="form-control" value="{{ searchDate }}" readonly>
<button class="btn btn-block btn-default" type="submit"><i class="fa fa-search"></i> {{ 'Search' | get_lang }}</button>
</div>
</form>
</div>
</div>
</div>
{% endif %}
</div>
<div class="col-md-9">
{% for session in sessions_blocks %}
<div class="panel panel-default" id="panel-{{ session.id }}">
<div class="panel-heading">
{{ session.icon }} {{ session.name }}
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-9">
{% if showTutor %}
<div class="tutor">
<img src="{{ 'teacher.png' | icon(22) }}" width="16"> {{ 'GeneralCoach' | get_lang }} {{ session.coach_name }}
</div>
{% endif %}
<a id="list-course" class="btn btn-default" data-toggle="collapse" href="#session-{{ session.id }}-courses">
{{ 'CourseList' | get_lang }}
</a>
<div class="collapse" id="session-{{ session.id }}-courses">
<div class="list"></div>
</div>
</div>
<div class="col-md-3">
{% if session.showDescription %}
<div class="buttom-subscribed">
<a class="ajax btn btn-large btn-info" href="{{ _p.web_ajax }}session.ajax.php?a=get_description&session={{ session.id }}">
{{ 'Description' | get_lang }}
</a>
<div class="collapse" id="session-{{ session.id }}-courses">
<div class="list"></div>
</div>
</div>
<div class="col-md-3">
{% if session.showDescription %}
<div class="buttom-subscribed">
<a class="ajax btn btn-large btn-info" href="{{ _p.web_ajax }}session.ajax.php?a=get_description&session={{ session.id }}">{{ 'Description' | get_lang }}</a>
</div>
{% endif %}
{% endif %}
<div class="buttom-subscribed">
{% if session.is_subscribed %}
<div class="buttom-subscribed">
{% if session.is_subscribed %}
{{ already_subscribed_label }}
{% else %}
{% else %}
{{ session.subscribe_button }}
{% endif %}
</div>
<div class="time"><img src="{{ 'agenda.png' | icon(22) }}"> {{ session.date }}</div>
{% endif %}
</div>
<div class="time"><img src="{{ 'agenda.png' | icon(22) }}"> {{ session.date }}</div>
</div>
</div>
</div>
{% endfor %}
{{ cataloguePagination }}
</div>
</div>
{% endfor %}
{{ cataloguePagination }}
</div>
{% endblock %}

@ -20,6 +20,11 @@ class Version20150511133949 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE user ADD username_canonical VARCHAR(100) NOT NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D64992FC23A8 ON user (username_canonical)');
$this->addSql('ALTER TABLE user CHANGE password password VARCHAR(255) NOT NULL');
$this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_teachers_to_create_sessions', NULL,'radio','Session','false','AllowTeachersToCreateSessionsTitle','AllowTeachersToCreateSessionsComment', NULL, NULL, 0)");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'true', 'Yes')");
$this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_teachers_to_create_sessions', 'false', 'No')");
}
/**
@ -31,5 +36,8 @@ class Version20150511133949 extends AbstractMigrationChamilo
$this->addSql('DROP INDEX UNIQ_8D93D64992FC23A8 ON user');
$this->addSql('ALTER TABLE user DROP username_canonical');
$this->addSql('ALTER TABLE user CHANGE password password VARCHAR(50) NOT NULL COLLATE utf8_unicode_ci');
$this->addSql('DELETE FROM settings_current WHERE variable = "allow_teachers_to_create_sessions" ');
$this->addSql('DELETE FROM settings_options WHERE variable = "allow_teachers_to_create_sessions" ');
}
}

Loading…
Cancel
Save