Fixed function prototype missing - Fixes CT#1906

skala
Christian Fasanando 14 years ago
parent a8de862c2d
commit d6bf14d7b9
  1. 21
      main/inc/lib/course.lib.php

@ -2784,6 +2784,27 @@ class CourseManager {
}
return $output;
}
/**
* 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 id
* @param string 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 id 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);
$row = Database::fetch_object($res_course);
if($row != false) {
return $row->id;
} else {
return 0;
}
}
/**
* Display code for one specific course a logged in user is subscribed to.
* Shows a link to the course, what's new icons...

Loading…
Cancel
Save