|
@@ 1530-1563 (lines=34) @@
|
| 1527 |
|
GROUP BY threads.forum_id"; |
| 1528 |
|
|
| 1529 |
|
// Course Admin |
| 1530 |
|
if (api_is_allowed_to_edit()) { |
| 1531 |
|
// Select all the forum information of all forums (that are not deleted). |
| 1532 |
|
$sql = "SELECT item_properties.*, forum.* |
| 1533 |
|
FROM $table_forums forum |
| 1534 |
|
INNER JOIN $table_item_property item_properties |
| 1535 |
|
ON ( |
| 1536 |
|
forum.forum_id = item_properties.ref AND |
| 1537 |
|
forum.c_id = item_properties.c_id |
| 1538 |
|
) |
| 1539 |
|
WHERE |
| 1540 |
|
item_properties.visibility <> 2 AND |
| 1541 |
|
item_properties.tool = '".TOOL_FORUM."' |
| 1542 |
|
$condition_session AND |
| 1543 |
|
forum.c_id = $course_id AND |
| 1544 |
|
item_properties.c_id = $course_id |
| 1545 |
|
$includeGroupsForumSelect |
| 1546 |
|
ORDER BY forum_order ASC"; |
| 1547 |
|
|
| 1548 |
|
// Select the number of threads of the forums (only the threads that are not deleted). |
| 1549 |
|
$sql2 = "SELECT count(*) AS number_of_threads, threads.forum_id |
| 1550 |
|
FROM $table_threads threads |
| 1551 |
|
INNER JOIN $table_item_property item_properties |
| 1552 |
|
ON ( |
| 1553 |
|
threads.thread_id = item_properties.ref AND |
| 1554 |
|
threads.c_id = item_properties.c_id |
| 1555 |
|
$sessionIdLink |
| 1556 |
|
) |
| 1557 |
|
WHERE |
| 1558 |
|
item_properties.visibility<>2 AND |
| 1559 |
|
item_properties.tool='".TOOL_FORUM_THREAD."' AND |
| 1560 |
|
threads.c_id = $course_id AND |
| 1561 |
|
item_properties.c_id = $course_id |
| 1562 |
|
GROUP BY threads.forum_id"; |
| 1563 |
|
} |
| 1564 |
|
} else { |
| 1565 |
|
// GETTING ONE SPECIFIC FORUM |
| 1566 |
|
/* We could do the splitup into student and course admin also but we want |
|
@@ 5096-5125 (lines=30) @@
|
| 5093 |
|
GROUP BY threads.forum_id"; |
| 5094 |
|
|
| 5095 |
|
// Course Admin |
| 5096 |
|
if (api_is_allowed_to_edit()) { |
| 5097 |
|
// Select all the forum information of all forums (that are not deleted). |
| 5098 |
|
$sql = "SELECT * |
| 5099 |
|
FROM $table_forums forum INNER JOIN $table_item_property item_properties |
| 5100 |
|
ON (forum.forum_id = item_properties.ref AND item_properties.c_id = forum.c_id) |
| 5101 |
|
WHERE |
| 5102 |
|
forum.forum_of_group = $groupId AND |
| 5103 |
|
forum.c_id = $course_id AND |
| 5104 |
|
item_properties.c_id = $course_id AND |
| 5105 |
|
item_properties.visibility <> 2 AND |
| 5106 |
|
item_properties.tool = '".TOOL_FORUM."' |
| 5107 |
|
ORDER BY forum_order ASC"; |
| 5108 |
|
|
| 5109 |
|
// Select the number of threads of the forums (only the threads that are not deleted). |
| 5110 |
|
$sql2 = "SELECT count(thread_id) AS number_of_threads, threads.forum_id |
| 5111 |
|
FROM $table_threads threads INNER JOIN $table_item_property item_properties |
| 5112 |
|
ON (threads.thread_id=item_properties.ref AND item_properties.c_id = threads.c_id) |
| 5113 |
|
WHERE |
| 5114 |
|
threads.c_id = $course_id AND |
| 5115 |
|
item_properties.c_id = $course_id AND |
| 5116 |
|
item_properties.visibility <> 2 AND |
| 5117 |
|
item_properties.tool='".TOOL_FORUM_THREAD."' |
| 5118 |
|
GROUP BY threads.forum_id"; |
| 5119 |
|
// Select the number of posts of the forum. |
| 5120 |
|
$sql3 = "SELECT count(post_id) AS number_of_posts, forum_id |
| 5121 |
|
FROM $table_posts |
| 5122 |
|
WHERE c_id = $course_id |
| 5123 |
|
GROUP BY forum_id"; |
| 5124 |
|
} |
| 5125 |
|
|
| 5126 |
|
// Handling all the forum information. |
| 5127 |
|
$result = Database::query($sql); |
| 5128 |
|
$forum_list = array(); |