| @@ 3996-4013 (lines=18) @@ | ||
| 3993 | * @param int $ref |
|
| 3994 | * @return array|resource |
|
| 3995 | */ |
|
| 3996 | function api_get_track_item_property_history($tool, $ref) |
|
| 3997 | { |
|
| 3998 | $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); |
|
| 3999 | $course_id = api_get_course_int_id(); //numeric |
|
| 4000 | $course_code = api_get_course_id(); //alphanumeric |
|
| 4001 | $item_property_id = api_get_item_property_id($course_code, $tool, $ref); |
|
| 4002 | $sql = "SELECT * FROM $tbl_stats_item_property |
|
| 4003 | WHERE item_property_id = $item_property_id AND course_id = $course_id |
|
| 4004 | ORDER BY lastedit_date DESC"; |
|
| 4005 | $result = Database::query($sql); |
|
| 4006 | if ($result == false) { |
|
| 4007 | $result = array(); |
|
| 4008 | } else { |
|
| 4009 | $result = Database::store_result($result,'ASSOC'); |
|
| 4010 | } |
|
| 4011 | ||
| 4012 | return $result; |
|
| 4013 | } |
|
| 4014 | ||
| 4015 | /** |
|
| 4016 | * Gets item property data from tool of a course id |
|
| @@ 4708-4729 (lines=22) @@ | ||
| 4705 | * @return bool True if the user is a coach |
|
| 4706 | * |
|
| 4707 | */ |
|
| 4708 | public static function is_session_course_coach($user_id, $courseId, $session_id) |
|
| 4709 | { |
|
| 4710 | $tbl_session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 4711 | // Protect data |
|
| 4712 | $user_id = intval($user_id); |
|
| 4713 | $courseId = intval($courseId); |
|
| 4714 | $session_id = intval($session_id); |
|
| 4715 | $result = false; |
|
| 4716 | ||
| 4717 | $sql = "SELECT session_id FROM $tbl_session_course_rel_user |
|
| 4718 | WHERE |
|
| 4719 | session_id = $session_id AND |
|
| 4720 | c_id = $courseId AND |
|
| 4721 | user_id = $user_id AND |
|
| 4722 | status = 2 "; |
|
| 4723 | $res = Database::query($sql); |
|
| 4724 | ||
| 4725 | if (Database::num_rows($res) > 0) { |
|
| 4726 | $result = true; |
|
| 4727 | } |
|
| 4728 | return $result; |
|
| 4729 | } |
|
| 4730 | ||
| 4731 | /** |
|
| 4732 | * This function returns an icon path that represents the favicon of the website of which the url given. |
|