Fix certification generation when using sessions see #7977

1.10.x
Julio Montoya 10 years ago
parent c3be69c9e3
commit 6e9a619fdc
  1. 1
      main/document/document.php
  2. 1
      main/gradebook/gradebook_display_certificate.php
  3. 24
      main/gradebook/lib/GradebookUtils.php
  4. 17
      main/gradebook/lib/be/category.class.php
  5. 5
      main/gradebook/lib/fe/gradebooktable.class.php
  6. 5
      main/inc/lib/api.lib.php
  7. 23
      main/inc/lib/certificate.lib.php
  8. 16
      main/inc/lib/document.lib.php
  9. 1
      main/inc/lib/export.lib.inc.php
  10. 44
      main/inc/lib/sessionmanager.lib.php
  11. 51
      main/inc/lib/usermanager.lib.php

@ -621,6 +621,7 @@ if (isset($_GET['curdirpath']) &&
$content_html = DocumentManager::replace_user_info_into_html( $content_html = DocumentManager::replace_user_info_into_html(
api_get_user_id(), api_get_user_id(),
api_get_course_id(), api_get_course_id(),
api_get_session_id(),
true true
); );

@ -61,7 +61,6 @@ switch ($action) {
if ($user_info['status'] == INVITEE) { if ($user_info['status'] == INVITEE) {
continue; continue;
} }
Category::register_user_certificate($cat_id, $user_info['user_id']); Category::register_user_certificate($cat_id, $user_info['user_id']);
} }
} }

@ -611,8 +611,10 @@ class GradebookUtils
$table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
$sql = 'SELECT * FROM ' . $table_certificate . ' $sql = 'SELECT * FROM ' . $table_certificate . '
WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"'; WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
$result = Database::query($sql); $result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC'); $row = Database::fetch_array($result, 'ASSOC');
return $row; return $row;
} }
@ -674,16 +676,18 @@ class GradebookUtils
} }
/** /**
* @param $user_id * @param int $user_id
* @param $course_code * @param string $course_code
* @param int $sessionId
* @param bool $is_preview * @param bool $is_preview
* @param bool $hide_print_button * @param bool $hide_print_button
*
* @return array * @return array
*/ */
public static function get_user_certificate_content($user_id, $course_code, $is_preview = false, $hide_print_button = false) public static function get_user_certificate_content($user_id, $course_code, $sessionId, $is_preview = false, $hide_print_button = false)
{ {
// Generate document HTML // Generate document HTML
$content_html = DocumentManager::replace_user_info_into_html($user_id, $course_code, $is_preview); $content_html = DocumentManager::replace_user_info_into_html($user_id, $course_code, $sessionId, $is_preview);
$new_content_html = null; $new_content_html = null;
$variables = null; $variables = null;
$contentHead = null; $contentHead = null;
@ -1201,7 +1205,7 @@ class GradebookUtils
* *
* Get the achieved certificates for a user in courses * Get the achieved certificates for a user in courses
* @param int $userId The user id * @param int $userId The user id
* @param type $includeNonPublicCertificates Whether include the non-plublic certificates * @param bool $includeNonPublicCertificates Whether include the non-plublic certificates
* @return array * @return array
*/ */
public static function getUserCertificatesInCourses($userId, $includeNonPublicCertificates = true) public static function getUserCertificatesInCourses($userId, $includeNonPublicCertificates = true)
@ -1250,7 +1254,7 @@ class GradebookUtils
/** /**
* Get the achieved certificates for a user in course sessions * Get the achieved certificates for a user in course sessions
* @param int $userId The user id * @param int $userId The user id
* @param type $includeNonPublicCertificates Whether include the non-plublic certificates * @param bool $includeNonPublicCertificates Whether include the non-plublic certificates
* @return array * @return array
*/ */
public static function getUserCertificatesInSessions($userId, $includeNonPublicCertificates = true) public static function getUserCertificatesInSessions($userId, $includeNonPublicCertificates = true)
@ -1258,13 +1262,12 @@ class GradebookUtils
$userId = intval($userId); $userId = intval($userId);
$sessionList = []; $sessionList = [];
$sessions = SessionManager::get_sessions_by_user($userId); $sessions = SessionManager::get_sessions_by_user($userId, true, true);
foreach ($sessions as $session) { foreach ($sessions as $session) {
if (empty($session['courses'])) { if (empty($session['courses'])) {
continue; continue;
} }
$sessionCourses = SessionManager::get_course_list_by_session_id($session['session_id']); $sessionCourses = SessionManager::get_course_list_by_session_id($session['session_id']);
foreach ($sessionCourses as $course) { foreach ($sessionCourses as $course) {
@ -1291,7 +1294,10 @@ class GradebookUtils
$courseGradebookId = $courseGradebookCategory[0]->get_id(); $courseGradebookId = $courseGradebookCategory[0]->get_id();
$certificateInfo = GradebookUtils::get_certificate_by_user_id($courseGradebookId, $userId); $certificateInfo = GradebookUtils::get_certificate_by_user_id(
$courseGradebookId,
$userId
);
if (empty($certificateInfo)) { if (empty($certificateInfo)) {
continue; continue;

@ -1900,6 +1900,7 @@ class Category implements GradebookItem
public static function register_user_certificate($category_id, $user_id) public static function register_user_certificate($category_id, $user_id)
{ {
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$courseCode = api_get_course_id();
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
// Generating the total score for a course // Generating the total score for a course
$cats_course = Category::load( $cats_course = Category::load(
@ -1941,7 +1942,7 @@ class Category implements GradebookItem
// A student always sees only the teacher's repartition // A student always sees only the teacher's repartition
$scoretotal_display = $scoredisplay->display_score($scoretotal, SCORE_DIV_PERCENT); $scoretotal_display = $scoredisplay->display_score($scoretotal, SCORE_DIV_PERCENT);
if (!self::userFinishedCourse($user_id, $cats_course[0])) { if (!self::userFinishedCourse($user_id, $cats_course[0], 0, $courseCode, $sessionId)) {
return false; return false;
} }
@ -2150,8 +2151,7 @@ class Category implements GradebookItem
$categoryId = 0, $categoryId = 0,
$courseCode = null, $courseCode = null,
$sessionId = 0 $sessionId = 0
) ) {
{
if (is_null($category) && empty($categoryId)) { if (is_null($category) && empty($categoryId)) {
return false; return false;
} }
@ -2177,7 +2177,12 @@ class Category implements GradebookItem
$category = $cats_course[0]; $category = $cats_course[0];
} }
$currentScore = self::getCurrentScore($userId, $category->get_id(), $courseCode, $sessionId); $currentScore = self::getCurrentScore(
$userId,
$category->get_id(),
$courseCode,
$sessionId
);
$minCertificateScore = $category->get_certificate_min_score(); $minCertificateScore = $category->get_certificate_min_score();
@ -2190,6 +2195,8 @@ class Category implements GradebookItem
* @param int $categoryId The gradebook category * @param int $categoryId The gradebook category
* @param int $courseCode The course code * @param int $courseCode The course code
* @param int $sessionId Optional. The session id * @param int $sessionId Optional. The session id
* @param bool $recalculate
*
* @return float The score * @return float The score
*/ */
public static function getCurrentScore($userId, $categoryId, $courseCode, $sessionId = 0, $recalculate = false) public static function getCurrentScore($userId, $categoryId, $courseCode, $sessionId = 0, $recalculate = false)
@ -2208,7 +2215,7 @@ class Category implements GradebookItem
'order' => 'registered_at DESC', 'order' => 'registered_at DESC',
'limit' => '1' 'limit' => '1'
], ],
'fisrt' 'first'
); );
if (empty($resultData)) { if (empty($resultData)) {

@ -716,7 +716,8 @@ class GradebookTable extends SortableTable
$content_html = DocumentManager::replace_user_info_into_html( $content_html = DocumentManager::replace_user_info_into_html(
api_get_user_id(), api_get_user_id(),
$course_code $course_code,
api_get_session_id()
); );
if (!empty($content_html)) { if (!empty($content_html)) {
@ -962,7 +963,7 @@ class GradebookTable extends SortableTable
case 'E' : case 'E' :
$cat = new Category(); $cat = new Category();
$course_id = CourseManager::get_course_by_category($categoryId); $course_id = CourseManager::get_course_by_category($categoryId);
$show_message = $cat->show_message_resource_delete($course_id); $show_message = $cat->show_message_resource_delete($course_id);
// course/platform admin can go to the view_results page // course/platform admin can go to the view_results page
if (api_is_allowed_to_edit() && $show_message===false) { if (api_is_allowed_to_edit() && $show_message===false) {

@ -1162,7 +1162,6 @@ function api_protect_course_script($print_headers = false, $allow_session_admins
if (api_is_platform_admin($allow_session_admins)) { if (api_is_platform_admin($allow_session_admins)) {
return true; return true;
} }
if (isset($course_info) && isset($course_info['visibility'])) { if (isset($course_info) && isset($course_info['visibility'])) {
switch ($course_info['visibility']) { switch ($course_info['visibility']) {
default: default:
@ -1902,7 +1901,7 @@ function api_format_course_array($course_data)
if (array_key_exists('add_teachers_to_sessions_courses', $course_data)) { if (array_key_exists('add_teachers_to_sessions_courses', $course_data)) {
$_course['add_teachers_to_sessions_courses'] = $course_data['add_teachers_to_sessions_courses']; $_course['add_teachers_to_sessions_courses'] = $course_data['add_teachers_to_sessions_courses'];
} }
if (file_exists(api_get_path(SYS_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png')) { if (file_exists(api_get_path(SYS_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png')) {
$url_image = api_get_path(WEB_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png'; $url_image = api_get_path(WEB_COURSE_PATH).$course_data['directory'].'/course-pic85x85.png';
} else { } else {
@ -8058,7 +8057,7 @@ function api_unique_multidim_array($array, $key){
$temp_array = array(); $temp_array = array();
$i = 0; $i = 0;
$key_array = array(); $key_array = array();
foreach($array as $val){ foreach($array as $val){
if(!in_array($val[$key],$key_array)){ if(!in_array($val[$key],$key_array)){
$key_array[$i] = $val[$key]; $key_array[$i] = $val[$key];

@ -200,6 +200,7 @@ class Certificate extends Model
$new_content_html = GradebookUtils::get_user_certificate_content( $new_content_html = GradebookUtils::get_user_certificate_content(
$this->user_id, $this->user_id,
$my_category[0]->get_course_code(), $my_category[0]->get_course_code(),
$my_category[0]->get_session_id(),
false, false,
$params['hide_print_button'] $params['hide_print_button']
); );
@ -328,7 +329,7 @@ class Certificate extends Model
$final_content = array(); $final_content = array();
if (!empty($content)) { if (!empty($content)) {
foreach($content as $key => $value) { foreach ($content as $key => $value) {
$my_header = str_replace(array('((', '))') , '', $headers[$key]); $my_header = str_replace(array('((', '))') , '', $headers[$key]);
$final_content[$my_header] = $value; $final_content[$my_header] = $value;
} }
@ -353,13 +354,15 @@ class Certificate extends Model
*/ */
$break_space = " \n\r "; $break_space = " \n\r ";
$text =
$text = $final_content['gradebook_institution'].' - '.$final_content['gradebook_sitename'].' - '.get_lang('Certification').$break_space. $final_content['gradebook_institution'].' - '.
get_lang('Student'). ': '.$final_content['user_firstname'].' '.$final_content['user_lastname'].$break_space. $final_content['gradebook_sitename'].' - '.
get_lang('Teacher'). ': '.$final_content['teacher_firstname'].' '.$final_content['teacher_lastname'].$break_space. get_lang('Certification').$break_space.
get_lang('Date'). ': '.$final_content['date_certificate'].$break_space. get_lang('Student'). ': '.$final_content['user_firstname'].' '.$final_content['user_lastname'].$break_space.
get_lang('Score'). ': '.$final_content['gradebook_grade'].$break_space. get_lang('Teacher'). ': '.$final_content['teacher_firstname'].' '.$final_content['teacher_lastname'].$break_space.
'URL'. ': '.$final_content['certificate_link']; get_lang('Date'). ': '.$final_content['date_certificate'].$break_space.
get_lang('Score'). ': '.$final_content['gradebook_grade'].$break_space.
'URL'. ': '.$final_content['certificate_link'];
return $text; return $text;
} }
@ -383,7 +386,9 @@ class Certificate extends Model
} else { } else {
// Check the course-level setting to make sure the certificate // Check the course-level setting to make sure the certificate
// can be printed publicly // can be printed publicly
if (isset($this->certificate_data) && isset($this->certificate_data['cat_id'])) { if (isset($this->certificate_data) &&
isset($this->certificate_data['cat_id'])
) {
$gradebook = new Gradebook(); $gradebook = new Gradebook();
$gradebook_info = $gradebook->get($this->certificate_data['cat_id']); $gradebook_info = $gradebook->get($this->certificate_data['cat_id']);
if (!empty($gradebook_info['course_code'])) { if (!empty($gradebook_info['course_code'])) {

@ -1777,6 +1777,7 @@ class DocumentManager
} }
$sql = 'SELECT document_id FROM ' . $tbl_category . ' $sql = 'SELECT document_id FROM ' . $tbl_category . '
WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session; WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session;
$rs = Database::query($sql); $rs = Database::query($sql);
$num = Database::num_rows($rs); $num = Database::num_rows($rs);
if ($num == 0) { if ($num == 0) {
@ -1791,16 +1792,22 @@ class DocumentManager
* allow replace user info in file html * allow replace user info in file html
* @param int $user_id * @param int $user_id
* @param string $course_code * @param string $course_code
* @param int $sessionId
* @param bool $is_preview * @param bool $is_preview
* @return string The html content of the certificate * @return string The html content of the certificate
*/ */
public static function replace_user_info_into_html($user_id, $course_code, $is_preview = false) public static function replace_user_info_into_html($user_id, $course_code, $sessionId, $is_preview = false)
{ {
$user_id = intval($user_id); $user_id = intval($user_id);
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$tbl_document = Database::get_course_table(TABLE_DOCUMENT); $tbl_document = Database::get_course_table(TABLE_DOCUMENT);
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
$document_id = self::get_default_certificate_id($course_code);
$document_id = self::get_default_certificate_id(
$course_code,
$sessionId
);
$my_content_html = null; $my_content_html = null;
if ($document_id) { if ($document_id) {
$sql = "SELECT path FROM $tbl_document $sql = "SELECT path FROM $tbl_document
@ -1815,6 +1822,7 @@ class DocumentManager
$my_content_html = file_get_contents($filepath); $my_content_html = file_get_contents($filepath);
} }
$all_user_info = self::get_all_info_to_certificate($user_id, $course_code, $is_preview); $all_user_info = self::get_all_info_to_certificate($user_id, $course_code, $is_preview);
$info_to_be_replaced_in_content_html = $all_user_info[0]; $info_to_be_replaced_in_content_html = $all_user_info[0];
$info_to_replace_in_content_html = $all_user_info[1]; $info_to_replace_in_content_html = $all_user_info[1];
$new_content = str_replace( $new_content = str_replace(
@ -1891,7 +1899,8 @@ class DocumentManager
$url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id']; $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id'];
//replace content //replace content
$info_to_replace_in_content_html = array($first_name, $info_to_replace_in_content_html = array(
$first_name,
$last_name, $last_name,
$organization_name, $organization_name,
$portal_name, $portal_name,
@ -1934,6 +1943,7 @@ class DocumentManager
$info_list[] = $info_to_be_replaced_in_content_html; $info_list[] = $info_to_be_replaced_in_content_html;
$info_list[] = $info_to_replace_in_content_html; $info_list[] = $info_to_replace_in_content_html;
return $info_list; return $info_list;
} }

@ -264,6 +264,7 @@ class Export
foreach ($data as &$printable_data_row) { foreach ($data as &$printable_data_row) {
$column = 0; $column = 0;
foreach ($printable_data_row as &$printable_data_cell) { foreach ($printable_data_row as &$printable_data_cell) {
$table->setCellContents($row, $column, $printable_data_cell); $table->setCellContents($row, $column, $printable_data_cell);
//$table->updateCellAttributes($row, $column, $atributes); //$table->updateCellAttributes($row, $column, $atributes);
$column++; $column++;

@ -1340,7 +1340,7 @@ class SessionManager
* @param int $duration * @param int $duration
* @param array $extraFields * @param array $extraFields
* @param int $sessionAdminId * @param int $sessionAdminId
* @param boolean $sendSubscritionNotification Optional. * @param boolean $sendSubscriptionNotification Optional.
* Whether send a mail notification to users being subscribed * Whether send a mail notification to users being subscribed
* @return mixed * @return mixed
*/ */
@ -1361,7 +1361,7 @@ class SessionManager
$duration = null, $duration = null,
$extraFields = array(), $extraFields = array(),
$sessionAdminId = 0, $sessionAdminId = 0,
$sendSubscritionNotification = false $sendSubscriptionNotification = false
) { ) {
$name = trim(stripslashes($name)); $name = trim(stripslashes($name));
$coachId = intval($coachId); $coachId = intval($coachId);
@ -1370,20 +1370,25 @@ class SessionManager
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
if (empty($name)) { if (empty($name)) {
$msg = get_lang('SessionNameIsRequired'); Display::return_message(get_lang('SessionNameIsRequired'), 'warning');
return $msg;
return false;
} elseif (empty($coachId)) { } elseif (empty($coachId)) {
$msg = get_lang('CoachIsRequired'); Display::return_message(get_lang('CoachIsRequired'), 'warning');
return $msg;
return false;
} elseif (!empty($startDate) && !api_is_valid_date($startDate, 'Y-m-d H:i')) { } elseif (!empty($startDate) && !api_is_valid_date($startDate, 'Y-m-d H:i')) {
$msg = get_lang('InvalidStartDate'); Display::return_message(get_lang('InvalidStartDate'), 'warning');
return $msg;
return false;
} elseif (!empty($endDate) && !api_is_valid_date($endDate, 'Y-m-d H:i')) { } elseif (!empty($endDate) && !api_is_valid_date($endDate, 'Y-m-d H:i')) {
$msg = get_lang('InvalidEndDate'); Display::return_message(get_lang('InvalidEndDate'), 'warning');
return $msg;
return false;
} elseif (!empty($startDate) && !empty($endDate) && $startDate >= $endDate) { } elseif (!empty($startDate) && !empty($endDate) && $startDate >= $endDate) {
$msg = get_lang('StartDateShouldBeBeforeEndDate'); Display::return_message(get_lang('StartDateShouldBeBeforeEndDate'), 'warning');
return $msg;
return false;
} else { } else {
$sql = "SELECT id FROM $tbl_session WHERE name='" . Database::escape_string($name) . "'"; $sql = "SELECT id FROM $tbl_session WHERE name='" . Database::escape_string($name) . "'";
$rs = Database::query($sql); $rs = Database::query($sql);
@ -1395,8 +1400,9 @@ class SessionManager
} }
if ($exists) { if ($exists) {
$msg = get_lang('SessionNameAlreadyExists'); Display::return_message(get_lang('SessionNameAlreadyExists'), 'warning');
return $msg;
return false;
} else { } else {
$values = [ $values = [
'name' => $name, 'name' => $name,
@ -1405,7 +1411,7 @@ class SessionManager
'description'=> $description, 'description'=> $description,
'show_description' => intval($showDescription), 'show_description' => intval($showDescription),
'visibility' => $visibility, 'visibility' => $visibility,
'send_subscription_notification' => $sendSubscritionNotification 'send_subscription_notification' => $sendSubscriptionNotification
]; ];
if (!empty($sessionAdminId)) { if (!empty($sessionAdminId)) {
@ -3953,16 +3959,18 @@ class SessionManager
/** /**
* @param int $user_id * @param int $user_id
* @param bool $ignore_visibility_for_admins * @param bool $ignore_visibility_for_admins
* @param bool $ignoreTimeLimit
*
* @return array * @return array
*/ */
public static function get_sessions_by_user($user_id, $ignore_visibility_for_admins = false) public static function get_sessions_by_user($user_id, $ignore_visibility_for_admins = false, $ignoreTimeLimit = false)
{ {
$sessionCategories = UserManager::get_sessions_by_category( $sessionCategories = UserManager::get_sessions_by_category(
$user_id, $user_id,
false, false,
$ignore_visibility_for_admins $ignore_visibility_for_admins,
$ignoreTimeLimit
); );
$sessionArray = array(); $sessionArray = array();
if (!empty($sessionCategories)) { if (!empty($sessionCategories)) {
foreach ($sessionCategories as $category) { foreach ($sessionCategories as $category) {

@ -1622,9 +1622,9 @@ class UserManager
//Crop the image to adjust 1:1 ratio //Crop the image to adjust 1:1 ratio
$image = new Image($source_file); $image = new Image($source_file);
$image->crop($cropParameters); $image->crop($cropParameters);
// Storing the new photos in 4 versions with various sizes. // Storing the new photos in 4 versions with various sizes.
$small = new Image($source_file); $small = new Image($source_file);
$small->resize(22); $small->resize(22);
$small->send_image($path.'small_'.$filename); $small->send_image($path.'small_'.$filename);
@ -1637,9 +1637,9 @@ class UserManager
$big = new Image($source_file); // This is the original picture. $big = new Image($source_file); // This is the original picture.
$big->send_image($path.'big_'.$filename); $big->send_image($path.'big_'.$filename);
$result = $small && $medium && $normal && $big; $result = $small && $medium && $normal && $big;
return $result ? $filename : false; return $result ? $filename : false;
} }
@ -2294,13 +2294,16 @@ class UserManager
* @param integer $user_id * @param integer $user_id
* @param boolean whether to fill the first element or not (to give space for courses out of categories) * @param boolean whether to fill the first element or not (to give space for courses out of categories)
* @param boolean optional true if limit time from session is over, false otherwise * @param boolean optional true if limit time from session is over, false otherwise
* @param boolean $ignoreTimeLimit ignore time start/end
* @return array list of statuses [session_category][session_id] * @return array list of statuses [session_category][session_id]
*
* @todo ensure multiple access urls are managed correctly * @todo ensure multiple access urls are managed correctly
*/ */
public static function get_sessions_by_category( public static function get_sessions_by_category(
$user_id, $user_id,
$is_time_over = true, $is_time_over = true,
$ignore_visibility_for_admins = false $ignore_visibility_for_admins = false,
$ignoreTimeLimit = false
) { ) {
// Database Table Definitions // Database Table Definitions
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
@ -2343,27 +2346,29 @@ class UserManager
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
// User portal filters: // User portal filters:
if ($is_time_over) { if ($ignoreTimeLimit == false) {
// History if ($is_time_over) {
if (empty($row['access_end_date']) || $row['access_end_date'] == '0000-00-00 00:00:00') { // History
continue; if (empty($row['access_end_date']) || $row['access_end_date'] == '0000-00-00 00:00:00') {
}
if (isset($row['access_end_date'])) {
if ($row['access_end_date'] > $now) {
continue; continue;
} }
} if (isset($row['access_end_date'])) {
} else { if ($row['access_end_date'] > $now) {
// Current user portal
if (api_is_allowed_to_create_course()) {
// Teachers can access the session depending in the access_coach date
} else {
if (isset($row['access_end_date']) && $row['access_end_date'] != '0000-00-00 00:00:00') {
if ($row['access_end_date'] <= $now) {
continue; continue;
} }
}
} else {
// Current user portal
if (api_is_allowed_to_create_course()) {
// Teachers can access the session depending in the access_coach date
} else {
if (isset($row['access_end_date']) && $row['access_end_date'] != '0000-00-00 00:00:00') {
if ($row['access_end_date'] <= $now) {
continue;
}
}
} }
} }
} }
@ -2422,7 +2427,9 @@ class UserManager
case SESSION_AVAILABLE: case SESSION_AVAILABLE:
break; break;
case SESSION_INVISIBLE: case SESSION_INVISIBLE:
continue(2); if ($ignore_visibility_for_admins == false) {
continue(2);
}
} }
$categories[$row['session_category_id']]['sessions'][$row['id']] = array( $categories[$row['session_category_id']]['sessions'][$row['id']] = array(

Loading…
Cancel
Save