|
@@ 1142-1157 (lines=16) @@
|
| 1139 |
|
$tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING); |
| 1140 |
|
$course_id = api_get_course_int_id(); |
| 1141 |
|
|
| 1142 |
|
if ($type == 'post') { |
| 1143 |
|
// Check if the user has already rated this post |
| 1144 |
|
$sql = "SELECT rating_id FROM $tbl_blogs_rating |
| 1145 |
|
WHERE c_id = $course_id AND |
| 1146 |
|
blog_id = '".(int)$blog_id."' |
| 1147 |
|
AND item_id = '".(int)$post_id."' |
| 1148 |
|
AND rating_type = '".Database::escape_string($type)."' |
| 1149 |
|
AND user_id = '".(int)$_user['user_id']."'"; |
| 1150 |
|
$result = Database::query($sql); |
| 1151 |
|
// Add rating |
| 1152 |
|
if (Database::num_rows($result) == 0) { |
| 1153 |
|
return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $post_id . '" name="frm_rating_' . $type . '_' . $post_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $post_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /></form>'; |
| 1154 |
|
} else { |
| 1155 |
|
return ''; |
| 1156 |
|
} |
| 1157 |
|
} |
| 1158 |
|
|
| 1159 |
|
if ($type = 'comment') { |
| 1160 |
|
// Check if the user has already rated this comment |
|
@@ 1159-1173 (lines=15) @@
|
| 1156 |
|
} |
| 1157 |
|
} |
| 1158 |
|
|
| 1159 |
|
if ($type = 'comment') { |
| 1160 |
|
// Check if the user has already rated this comment |
| 1161 |
|
$sql = "SELECT rating_id FROM $tbl_blogs_rating |
| 1162 |
|
WHERE c_id = $course_id AND blog_id = '".(int)$blog_id ."' |
| 1163 |
|
AND item_id = '".(int)$comment_id."' |
| 1164 |
|
AND rating_type = '".Database::escape_string($type)."' |
| 1165 |
|
AND user_id = '".(int)$_user['user_id']."'"; |
| 1166 |
|
$result = Database::query($sql); |
| 1167 |
|
|
| 1168 |
|
if (Database::num_rows($result) == 0) { |
| 1169 |
|
return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $comment_id . '" name="frm_rating_' . $type . '_' . $comment_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $comment_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /><input type="hidden" name="comment_id" value="' . $comment_id . '" /></form>'; |
| 1170 |
|
} else { |
| 1171 |
|
return ''; |
| 1172 |
|
} |
| 1173 |
|
} |
| 1174 |
|
} |
| 1175 |
|
|
| 1176 |
|
/** |