@@ 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 |
@@ 3313-3327 (lines=15) @@ | ||
3310 | * @param int field_id |
|
3311 | * @return int 0 if fails otherwise the tag id |
|
3312 | */ |
|
3313 | public static function get_tag_id_from_id($tag_id, $field_id) |
|
3314 | { |
|
3315 | $table_user_tag = Database::get_main_table(TABLE_MAIN_TAG); |
|
3316 | $tag_id = intval($tag_id); |
|
3317 | $field_id = intval($field_id); |
|
3318 | $sql = "SELECT id FROM $table_user_tag |
|
3319 | WHERE id = '$tag_id' AND field_id = $field_id"; |
|
3320 | $result = Database::query($sql); |
|
3321 | if (Database::num_rows($result) > 0) { |
|
3322 | $row = Database::fetch_array($result, 'ASSOC'); |
|
3323 | return $row['id']; |
|
3324 | } else { |
|
3325 | return false; |
|
3326 | } |
|
3327 | } |
|
3328 | ||
3329 | /** |
|
3330 | * Adds a user-tag value |