Fixing teacher names in userportal.php

skala
Julio Montoya 13 years ago
parent 60c1f2d3ee
commit 9030411627
  1. 42
      main/inc/lib/course.lib.php

@ -97,18 +97,21 @@ define('NOT_VISIBLE_SUBSCRIPTION_ALLOWED', 1);
define('VISIBLE_SUBSCRIPTION_ALLOWED', 2);
define('VISIBLE_NO_SUBSCRIPTION_ALLOWED', 3);
define('TEACHER_SEPARATOR_STRING', '|'); //Use to show teacher names in userportal.php
/**
* Variables
*/
/*
$TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSDOMAIN = Database::get_main_table(TABLE_MAIN_CATEGORY);
$TABLEUSER = Database::get_main_table(TABLE_MAIN_USER);
$TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLEANNOUNCEMENTS = 'announcement';
$coursesRepositories = $_configuration['root_sys'];
*/
/**
* CourseManager Class
@ -1374,7 +1377,7 @@ class CourseManager {
$list[]= api_get_person_name($teacher['firstname'], $teacher['lastname']);
}
if (!empty($list)) {
$teacher_string = implode($separator.' ', $list);
$teacher_string = implode(' '.$separator.' ', $list);
}
}
return $teacher_string;
@ -2713,7 +2716,8 @@ class CourseManager {
return self::course_code_exists($wanted_course_code);
}
/* Builds the course block
/**
* Builds the course block in userportal.php
* @todo use smarty
*/
public function course_item_html($params, $is_sub_content = false) {
@ -2829,7 +2833,7 @@ class CourseManager {
$course_title .= $course_info['visual_code'];
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
$params['teachers'] = CourseManager::get_teacher_list_from_course_code_to_string($course['code'], TEACHER_SEPARATOR_STRING);
}
$course_title .= ' ';
$course_title .= Display::return_icon('klipper.png', get_lang('CourseAutoRegister'));
@ -2971,7 +2975,7 @@ class CourseManager {
$course_title .= $course_info['visual_code'];
}
if (api_get_setting('display_teacher_in_courselist') == 'true') {
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code'], TEACHER_SEPARATOR_STRING);
}
$params['icon'] = $status_icon;
@ -3145,7 +3149,7 @@ class CourseManager {
if (api_get_setting('display_teacher_in_courselist') == 'true') {
if (api_get_setting('use_session_mode') == 'true' && !$nosession) {
$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code']);
$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_info['code'], TEACHER_SEPARATOR_STRING);
$coachs_course = api_get_coachs_from_course($course_info['id_session'], $course['code']);
$course_coachs = array();
@ -3286,7 +3290,7 @@ class CourseManager {
/**
* Creates a new course code based in given code
* Creates a new course code based in a given code
*
* @param string wanted code
* <code> $wanted_code = 'curse' if there are in the DB codes like curse1 curse2 the function will return: course3</code>
@ -3317,7 +3321,14 @@ class CourseManager {
}
/**
* Gets the status of the users agreement in a course course-session
*
* @param int user id
* @param string course code
* @param int session id
* @return boolean
*/
function is_user_accepted_legal($user_id, $course_code, $session_id = null) {
$user_id = intval($user_id);
$course_code = Database::escape_string($course_code);
@ -3350,6 +3361,12 @@ class CourseManager {
return false;
}
/**
* Saves the user-course legal agreement
* @param int user id
* @param string course code
* @param int session id
*/
function save_user_legal($user_id, $course_code, $session_id = null) {
$user_id = intval($user_id);
@ -3501,7 +3518,7 @@ class CourseManager {
* @param int vote [1..5]
* @param int course id
* @param int session id
* @param int url id
* @param int url id (access_url_id)
* @return mixed 'added', 'updated' or 'nothing'
*
*/
@ -3579,8 +3596,11 @@ class CourseManager {
}
}
//Stats functions
/**
* Returns an array with the hottest courses
* @param int number of days
* @param int number of hottest courses
*/
function return_hot_courses($days = 30, $limit = 5) {
$limit = intval($limit);
$table_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);

Loading…
Cancel
Save