| @@ 2940-2960 (lines=21) @@ | ||
| 2937 | * @param array $courseInfo |
|
| 2938 | * @return int |
|
| 2939 | */ |
|
| 2940 | function getWorkCommentCount($id, $courseInfo = array()) |
|
| 2941 | { |
|
| 2942 | if (empty($courseInfo)) { |
|
| 2943 | $courseInfo = api_get_course_info(); |
|
| 2944 | } |
|
| 2945 | ||
| 2946 | $commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT); |
|
| 2947 | $id = intval($id); |
|
| 2948 | ||
| 2949 | $sql = "SELECT count(*) as count |
|
| 2950 | FROM $commentTable |
|
| 2951 | WHERE work_id = $id AND c_id = ".$courseInfo['real_id']; |
|
| 2952 | ||
| 2953 | $result = Database::query($sql); |
|
| 2954 | if (Database::num_rows($result)) { |
|
| 2955 | $comment = Database::fetch_array($result); |
|
| 2956 | return $comment['count']; |
|
| 2957 | } |
|
| 2958 | ||
| 2959 | return 0; |
|
| 2960 | } |
|
| 2961 | ||
| 2962 | /** |
|
| 2963 | * Get comment count for a specific parent |
|
| @@ 3581-3595 (lines=15) @@ | ||
| 3578 | * |
|
| 3579 | * @return int 0 if fails otherwise the tag id |
|
| 3580 | */ |
|
| 3581 | public static function get_tag_id_from_id($tag_id, $field_id) |
|
| 3582 | { |
|
| 3583 | $table_user_tag = Database::get_main_table(TABLE_MAIN_TAG); |
|
| 3584 | $tag_id = intval($tag_id); |
|
| 3585 | $field_id = intval($field_id); |
|
| 3586 | $sql = "SELECT id FROM $table_user_tag |
|
| 3587 | WHERE id = '$tag_id' AND field_id = $field_id"; |
|
| 3588 | $result = Database::query($sql); |
|
| 3589 | if (Database::num_rows($result) > 0) { |
|
| 3590 | $row = Database::fetch_array($result, 'ASSOC'); |
|
| 3591 | return $row['id']; |
|
| 3592 | } else { |
|
| 3593 | return false; |
|
| 3594 | } |
|
| 3595 | } |
|
| 3596 | ||
| 3597 | /** |
|
| 3598 | * Adds a user-tag value |
|