| @@ 3968-3985 (lines=18) @@ | ||
| 3965 | * @param int $ref |
|
| 3966 | * @return array|resource |
|
| 3967 | */ |
|
| 3968 | function api_get_track_item_property_history($tool, $ref) |
|
| 3969 | { |
|
| 3970 | $tbl_stats_item_property = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY); |
|
| 3971 | $course_id = api_get_course_int_id(); //numeric |
|
| 3972 | $course_code = api_get_course_id(); //alphanumeric |
|
| 3973 | $item_property_id = api_get_item_property_id($course_code, $tool, $ref); |
|
| 3974 | $sql = "SELECT * FROM $tbl_stats_item_property |
|
| 3975 | WHERE item_property_id = $item_property_id AND course_id = $course_id |
|
| 3976 | ORDER BY lastedit_date DESC"; |
|
| 3977 | $result = Database::query($sql); |
|
| 3978 | if ($result == false) { |
|
| 3979 | $result = array(); |
|
| 3980 | } else { |
|
| 3981 | $result = Database::store_result($result,'ASSOC'); |
|
| 3982 | } |
|
| 3983 | ||
| 3984 | return $result; |
|
| 3985 | } |
|
| 3986 | ||
| 3987 | /** |
|
| 3988 | * Gets item property data from tool of a course id |
|
| @@ 4664-4685 (lines=22) @@ | ||
| 4661 | * @return bool True if the user is a coach |
|
| 4662 | * |
|
| 4663 | */ |
|
| 4664 | public static function is_session_course_coach($user_id, $courseId, $session_id) |
|
| 4665 | { |
|
| 4666 | $tbl_session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 4667 | // Protect data |
|
| 4668 | $user_id = intval($user_id); |
|
| 4669 | $courseId = intval($courseId); |
|
| 4670 | $session_id = intval($session_id); |
|
| 4671 | $result = false; |
|
| 4672 | ||
| 4673 | $sql = "SELECT session_id FROM $tbl_session_course_rel_user |
|
| 4674 | WHERE |
|
| 4675 | session_id = $session_id AND |
|
| 4676 | c_id = $courseId AND |
|
| 4677 | user_id = $user_id AND |
|
| 4678 | status = 2 "; |
|
| 4679 | $res = Database::query($sql); |
|
| 4680 | ||
| 4681 | if (Database::num_rows($res) > 0) { |
|
| 4682 | $result = true; |
|
| 4683 | } |
|
| 4684 | return $result; |
|
| 4685 | } |
|
| 4686 | ||
| 4687 | /** |
|
| 4688 | * This function returns an icon path that represents the favicon of the website of which the url given. |
|