@@ 3297-3311 (lines=15) @@ | ||
3294 | * @param int field_id |
|
3295 | * @return int 0 if fails otherwise the tag id |
|
3296 | */ |
|
3297 | public static function get_tag_id_from_id($tag_id, $field_id) |
|
3298 | { |
|
3299 | $table_user_tag = Database::get_main_table(TABLE_MAIN_TAG); |
|
3300 | $tag_id = intval($tag_id); |
|
3301 | $field_id = intval($field_id); |
|
3302 | $sql = "SELECT id FROM $table_user_tag |
|
3303 | WHERE id = '$tag_id' AND field_id = $field_id"; |
|
3304 | $result = Database::query($sql); |
|
3305 | if (Database::num_rows($result) > 0) { |
|
3306 | $row = Database::fetch_array($result, 'ASSOC'); |
|
3307 | return $row['id']; |
|
3308 | } else { |
|
3309 | return false; |
|
3310 | } |
|
3311 | } |
|
3312 | ||
3313 | /** |
|
3314 | * Adds a user-tag value |
@@ 3071-3091 (lines=21) @@ | ||
3068 | * @param array $courseInfo |
|
3069 | * @return int |
|
3070 | */ |
|
3071 | function getWorkCommentCount($id, $courseInfo = array()) |
|
3072 | { |
|
3073 | if (empty($courseInfo)) { |
|
3074 | $courseInfo = api_get_course_info(); |
|
3075 | } |
|
3076 | ||
3077 | $commentTable = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT_COMMENT); |
|
3078 | $id = intval($id); |
|
3079 | ||
3080 | $sql = "SELECT count(*) as count |
|
3081 | FROM $commentTable |
|
3082 | WHERE work_id = $id AND c_id = ".$courseInfo['real_id']; |
|
3083 | ||
3084 | $result = Database::query($sql); |
|
3085 | if (Database::num_rows($result)) { |
|
3086 | $comment = Database::fetch_array($result); |
|
3087 | return $comment['count']; |
|
3088 | } |
|
3089 | ||
3090 | return 0; |
|
3091 | } |
|
3092 | ||
3093 | /** |
|
3094 | * Get comment count for a specific parent |