@@ 3002-3022 (lines=21) @@ | ||
2999 | * @param array $courseInfo |
|
3000 | * @return int |
|
3001 | */ |
|
3002 | function getWorkCommentCount($id, $courseInfo = array()) |
|
3003 | { |
|
3004 | if (empty($courseInfo)) { |
|
3005 | $courseInfo = api_get_course_info(); |
|
3006 | } |
|
3007 | ||
3008 | $commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT); |
|
3009 | $id = intval($id); |
|
3010 | ||
3011 | $sql = "SELECT count(*) as count |
|
3012 | FROM $commentTable |
|
3013 | WHERE work_id = $id AND c_id = ".$courseInfo['real_id']; |
|
3014 | ||
3015 | $result = Database::query($sql); |
|
3016 | if (Database::num_rows($result)) { |
|
3017 | $comment = Database::fetch_array($result); |
|
3018 | return $comment['count']; |
|
3019 | } |
|
3020 | ||
3021 | return 0; |
|
3022 | } |
|
3023 | ||
3024 | /** |
|
3025 | * Get comment count for a specific parent |
@@ 3296-3310 (lines=15) @@ | ||
3293 | * @param int field_id |
|
3294 | * @return int 0 if fails otherwise the tag id |
|
3295 | */ |
|
3296 | public static function get_tag_id_from_id($tag_id, $field_id) |
|
3297 | { |
|
3298 | $table_user_tag = Database::get_main_table(TABLE_MAIN_TAG); |
|
3299 | $tag_id = intval($tag_id); |
|
3300 | $field_id = intval($field_id); |
|
3301 | $sql = "SELECT id FROM $table_user_tag |
|
3302 | WHERE id = '$tag_id' AND field_id = $field_id"; |
|
3303 | $result = Database::query($sql); |
|
3304 | if (Database::num_rows($result) > 0) { |
|
3305 | $row = Database::fetch_array($result, 'ASSOC'); |
|
3306 | return $row['id']; |
|
3307 | } else { |
|
3308 | return false; |
|
3309 | } |
|
3310 | } |
|
3311 | ||
3312 | /** |
|
3313 | * Adds a user-tag value |