| @@ 1812-1836 (lines=25) @@ | ||
| 1809 | GROUP BY ip.ref |
|
| 1810 | ORDER BY display_order DESC |
|
| 1811 | LIMIT 0, $maximum"; |
|
| 1812 | } else { |
|
| 1813 | ||
| 1814 | if (api_get_course_setting('allow_user_edit_announcement')) { |
|
| 1815 | $cond_user_id = " AND ( |
|
| 1816 | ip.lastedit_user_id = '".api_get_user_id()."' OR ip.to_group_id='0' OR ip.to_group_id IS NULL |
|
| 1817 | ) "; |
|
| 1818 | } else { |
|
| 1819 | $cond_user_id = " AND ip.to_group_id='0' "; |
|
| 1820 | } |
|
| 1821 | ||
| 1822 | // the user is not identiefied => show only the general announcements |
|
| 1823 | $sql = "SELECT |
|
| 1824 | announcement.*, |
|
| 1825 | ip.visibility, |
|
| 1826 | ip.to_group_id, |
|
| 1827 | ip.insert_user_id |
|
| 1828 | FROM $tbl_announcement announcement |
|
| 1829 | INNER JOIN $tbl_item_property ip |
|
| 1830 | ON (announcement.id = ip.ref AND announcement.c_id = ip.c_id) |
|
| 1831 | WHERE |
|
| 1832 | announcement.c_id = $course_id AND |
|
| 1833 | ip.c_id = $course_id AND |
|
| 1834 | ip.tool='announcement' AND |
|
| 1835 | ip.visibility='1' AND |
|
| 1836 | ip.to_group_id='0' |
|
| 1837 | $condition_session |
|
| 1838 | GROUP BY ip.ref |
|
| 1839 | ORDER BY display_order DESC |
|
| @@ 167-190 (lines=24) @@ | ||
| 164 | GROUP BY ip.ref |
|
| 165 | ORDER BY display_order DESC |
|
| 166 | LIMIT 0,$maximum"; |
|
| 167 | } else { |
|
| 168 | if (api_get_course_setting('allow_user_edit_announcement')) { |
|
| 169 | $cond_user_id = " AND ( |
|
| 170 | ip.lastedit_user_id = '".api_get_user_id()."' OR ip.to_group_id='0' OR ip.to_group_id IS NULL |
|
| 171 | ) "; |
|
| 172 | } else { |
|
| 173 | $cond_user_id = " AND ip.to_group_id='0' "; |
|
| 174 | } |
|
| 175 | ||
| 176 | // the user is not identiefied => show only the general announcements |
|
| 177 | $sql = "SELECT |
|
| 178 | announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
|
| 179 | FROM $tbl_announcement announcement, $tbl_item_property ip |
|
| 180 | WHERE announcement.id = ip.ref |
|
| 181 | AND ip.tool='announcement' |
|
| 182 | AND ip.visibility='1' |
|
| 183 | AND ip.to_group_id='0' |
|
| 184 | $announcement_id |
|
| 185 | $condition_session |
|
| 186 | GROUP BY ip.ref |
|
| 187 | ORDER BY display_order DESC |
|
| 188 | LIMIT 0,$maximum"; |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| 192 | $result = Database::query($sql); |
|
| 193 | ||