| @@ 4659-4680 (lines=22) @@ | ||
| 4656 | * @return bool True if the user is a coach |
|
| 4657 | * |
|
| 4658 | */ |
|
| 4659 | public static function is_session_course_coach($user_id, $courseId, $session_id) |
|
| 4660 | { |
|
| 4661 | $tbl_session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 4662 | // Protect data |
|
| 4663 | $user_id = intval($user_id); |
|
| 4664 | $courseId = intval($courseId); |
|
| 4665 | $session_id = intval($session_id); |
|
| 4666 | $result = false; |
|
| 4667 | ||
| 4668 | $sql = "SELECT session_id FROM $tbl_session_course_rel_user |
|
| 4669 | WHERE |
|
| 4670 | session_id = $session_id AND |
|
| 4671 | c_id = $courseId AND |
|
| 4672 | user_id = $user_id AND |
|
| 4673 | status = 2 "; |
|
| 4674 | $res = Database::query($sql); |
|
| 4675 | ||
| 4676 | if (Database::num_rows($res) > 0) { |
|
| 4677 | $result = true; |
|
| 4678 | } |
|
| 4679 | return $result; |
|
| 4680 | } |
|
| 4681 | ||
| 4682 | /** |
|
| 4683 | * This function returns an icon path that represents the favicon of the website of which the url given. |
|
| @@ 3938-3955 (lines=18) @@ | ||
| 3935 | * @param int $ref |
|
| 3936 | * @return array|resource |
|
| 3937 | */ |
|
| 3938 | function api_get_track_item_property_history($tool, $ref) |
|
| 3939 | { |
|
| 3940 | $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); |
|
| 3941 | $course_id = api_get_course_int_id(); //numeric |
|
| 3942 | $course_code = api_get_course_id(); //alphanumeric |
|
| 3943 | $item_property_id = api_get_item_property_id($course_code, $tool, $ref); |
|
| 3944 | $sql = "SELECT * FROM $tbl_stats_item_property |
|
| 3945 | WHERE item_property_id = $item_property_id AND course_id = $course_id |
|
| 3946 | ORDER BY lastedit_date DESC"; |
|
| 3947 | $result = Database::query($sql); |
|
| 3948 | if ($result == false) { |
|
| 3949 | $result = array(); |
|
| 3950 | } else { |
|
| 3951 | $result = Database::store_result($result,'ASSOC'); |
|
| 3952 | } |
|
| 3953 | ||
| 3954 | return $result; |
|
| 3955 | } |
|
| 3956 | ||
| 3957 | /** |
|
| 3958 | * Gets item property data from tool of a course id |
|