@@ 3816-3841 (lines=26) @@ | ||
3813 | ||
3814 | $course_id = api_get_course_int_id(); |
|
3815 | ||
3816 | if (api_is_allowed_to_edit(null, true)) { |
|
3817 | $sql = "SELECT count(*) as number_of_posts |
|
3818 | FROM $table_posts posts, $table_threads threads, $table_item_property item_property |
|
3819 | WHERE |
|
3820 | posts.c_id = $course_id AND |
|
3821 | item_property.c_id = $course_id AND |
|
3822 | posts.forum_id='".Database::escape_string($forum_id)."' |
|
3823 | AND posts.thread_id=threads.thread_id |
|
3824 | AND item_property.ref=threads.thread_id |
|
3825 | AND item_property.visibility<>2 |
|
3826 | AND item_property.tool='".TOOL_FORUM_THREAD."' |
|
3827 | "; |
|
3828 | } else { |
|
3829 | $sql = "SELECT count(*) as number_of_posts |
|
3830 | FROM $table_posts posts, $table_threads threads, $table_item_property item_property |
|
3831 | WHERE |
|
3832 | posts.c_id = $course_id AND |
|
3833 | item_property.c_id = $course_id AND |
|
3834 | posts.forum_id='".Database::escape_string($forum_id)."' |
|
3835 | AND posts.thread_id=threads.thread_id |
|
3836 | AND item_property.ref=threads.thread_id |
|
3837 | AND item_property.visibility=1 |
|
3838 | AND posts.visible=1 |
|
3839 | AND item_property.tool='".TOOL_FORUM_THREAD."' |
|
3840 | "; |
|
3841 | } |
|
3842 | $result = Database::query($sql); |
|
3843 | $row = Database::fetch_array($result); |
|
3844 | $number_of_posts = $row['number_of_posts']; |
|
@@ 3847-3869 (lines=23) @@ | ||
3844 | $number_of_posts = $row['number_of_posts']; |
|
3845 | ||
3846 | // We could loop through the result array and count the number of different group_ids, but I have chosen to use a second sql statement. |
|
3847 | if (api_is_allowed_to_edit(null, true)) { |
|
3848 | $sql = "SELECT count(*) as number_of_topics |
|
3849 | FROM $table_threads threads, $table_item_property item_property |
|
3850 | WHERE |
|
3851 | threads.c_id = $course_id AND |
|
3852 | item_property.c_id = $course_id AND |
|
3853 | threads.forum_id='".Database::escape_string($forum_id)."' |
|
3854 | AND item_property.ref=threads.thread_id |
|
3855 | AND item_property.visibility<>2 |
|
3856 | AND item_property.tool='".TOOL_FORUM_THREAD."' |
|
3857 | "; |
|
3858 | } else { |
|
3859 | $sql = "SELECT count(*) as number_of_topics |
|
3860 | FROM $table_threads threads, $table_item_property item_property |
|
3861 | WHERE |
|
3862 | threads.c_id = $course_id AND |
|
3863 | item_property.c_id = $course_id AND |
|
3864 | threads.forum_id='".Database::escape_string($forum_id)."' |
|
3865 | AND item_property.ref=threads.thread_id |
|
3866 | AND item_property.visibility=1 |
|
3867 | AND item_property.tool='".TOOL_FORUM_THREAD."' |
|
3868 | "; |
|
3869 | } |
|
3870 | $result = Database::query($sql); |
|
3871 | $row = Database::fetch_array($result); |
|
3872 | $number_of_topics = $row['number_of_topics']; |