@ -3585,6 +3585,12 @@ class CourseManager
return $html;
}
/**
* @param string $main_content
* @param string $sub_content
* @param string $sub_sub_content
* @return string
*/
public static function course_item_parent($main_content, $sub_content, $sub_sub_content = null)
{
return '< div class = "well" > '.$main_content.$sub_content.$sub_sub_content.'< / div > ';
@ -3597,7 +3603,7 @@ class CourseManager
* in the sense that any user clicking them is registered as a student
* @param int User id
* @param bool Whether to show the document quick-loader or not
* @return void
* @return string
*/
public static function display_special_courses($user_id, $load_dirs = false)
{
@ -3702,7 +3708,7 @@ class CourseManager
* @uses display_courses_in_category() to display the courses themselves
* @param int user id
* @param bool Whether to show the document quick-loader or not
* @return void
* @return string
*/
public static function display_courses($user_id, $load_dirs = false)
{
@ -3740,7 +3746,7 @@ class CourseManager
* class userportal-course-item.
* @param int User category id
* @param bool Whether to show the document quick-loader or not
* @return void
* @return string
*/
public static function display_courses_in_category($user_category_id, $load_dirs = false)
{
@ -3748,7 +3754,7 @@ class CourseManager
// Table definitions
$TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$TABLE_ACCESS_URL_REL_COURSE = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$TABLE_ACCESS_URL_REL_COURSE = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id();
// Get course list auto-register
@ -3862,18 +3868,23 @@ class CourseManager
$course_title_url = '';
if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED || $course['status'] == COURSEMANAGER) {
$course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/?id_session=0';
$course_title_url = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/index.php ?id_session=0';
$course_title = Display::url($course_info['title'], $course_title_url);
} else {
$course_title = $course_info['title']." ".Display::tag('span',get_lang('CourseClosed'), array('class'=>'item_closed'));
$course_title = $course_info['title']." ".Display::tag('span', get_lang('CourseClosed'), array('class'=>'item_closed'));
}
// Start displaying the course block itself
if (api_get_setting('display_coursecode_in_courselist') == 'true') {
$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'], self::USER_SEPARATOR, true);
$teachers = CourseManager::get_teacher_list_from_course_code_to_string(
$course['code'],
self::USER_SEPARATOR,
true
);
}
$params['link'] = $course_title_url;
@ -3885,11 +3896,11 @@ class CourseManager
$params['notifications'] = $show_notification;
}
$is_s ubcontent = true;
$isS ubcontent = true;
if (empty($user_category_id)) {
$is_s ubcontent = false;
$isS ubcontent = false;
}
$html .= self::course_item_html($params, $is_s ubcontent);
$html .= self::course_item_html($params, $isS ubcontent);
}
return $html;
@ -3914,18 +3925,23 @@ class CourseManager
}
/**
* Get the course id based on the original id and field name in the extra fields. Returns 0 if course was not found
* Get the course id based on the original id and field name in the extra fields.
* Returns 0 if course was not found
*
* @param string Original course code
* @param string Original field name
* @param string $original_course_id_value Original course code
* @param string $original_course_id_name Original field name
* @return int Course id
*/
public static function get_course_id_from_original_id($original_course_id_value, $original_course_id_name)
{
$t_cfv = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
$table_field = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
$sql_course = "SELECT course_code FROM $table_field cf INNER JOIN $t_cfv cfv ON cfv.field_id=cf.id WHERE field_variable='$original_course_id_name' AND field_value='$original_course_id_value'";
$res = Database::query($sql_course);
$sql = "SELECT course_code FROM $table_field cf
INNER JOIN $t_cfv cfv ON cfv.field_id=cf.id
WHERE
field_variable='$original_course_id_name' AND
field_value='$original_course_id_value'";
$res = Database::query($sql);
$row = Database::fetch_object($res);
if ($row != false) {
return $row->course_code;