11<?php
22
3+ declare (strict_types=1 );
4+
35/* For licensing terms, see /license.txt */
46
57use Chamilo \CoreBundle \Enums \ActionIcon ;
2325 * - quoting a message.
2426 *
2527 * @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University
28+ *
2629 * @Copyright Ghent University
2730 * @Copyright Patrick Cool
2831 */
@@ -107,16 +110,19 @@ function setFocus() {
107110$ userId = api_get_user_id ();
108111
109112$ repo = Container::getForumRepository ();
113+
110114/** @var CForum $forum */
111115$ forum = $ repo ->find ($ forumId );
112116
113117$ repoThread = Container::getForumThreadRepository ();
118+
114119/** @var CForumThread $thread */
115120$ thread = $ repoThread ->find ($ _GET ['thread ' ]);
116121
117122$ category = $ forum ->getForumCategory ();
118123
119124$ postRepo = Container::getForumPostRepository ();
125+
120126/** @var CForumPost $post */
121127$ post = $ postRepo ->find ($ _GET ['post ' ]);
122128
@@ -176,7 +182,7 @@ function setFocus() {
176182 'name ' => prepare4display ($ forum ->getTitle ()),
177183 ];
178184 $ interbreadcrumb [] = [
179- 'url ' => api_get_path (WEB_CODE_PATH ).'forum/viewthread.php? ' .api_get_cidreq ().'&forum= ' .$ forumId .'&thread= ' .(int ) ( $ _GET ['thread ' ]) ,
185+ 'url ' => api_get_path (WEB_CODE_PATH ).'forum/viewthread.php? ' .api_get_cidreq ().'&forum= ' .$ forumId .'&thread= ' .(int ) $ _GET ['thread ' ],
180186 'name ' => prepare4display ($ thread ->getTitle ()),
181187 ];
182188 $ interbreadcrumb [] = ['url ' => 'javascript: void (0); ' , 'name ' => get_lang ('Edit a post ' )];
@@ -185,7 +191,7 @@ function setFocus() {
185191$ table_link = Database::get_main_table (TABLE_MAIN_GRADEBOOK_LINK );
186192
187193/* Header */
188- $ htmlHeadXtra [] = <<<JS
194+ $ htmlHeadXtra [] = <<<'JS'
189195 <script>
190196 $(function() {
191197 $('#reply-add-attachment').on('click', function(e) {
@@ -209,20 +215,20 @@ function setFocus() {
209215// 4. if editing of replies is not allowed
210216// The only exception is the course manager
211217// I have split this is several pieces for clarity.
212- if (!api_is_allowed_to_create_course () &&
213- (
214- (false === $ categoryIsVisible ) ||
215- false === $ forumIsVisible
218+ if (!api_is_allowed_to_create_course ()
219+ && (
220+ (false === $ categoryIsVisible )
221+ || false === $ forumIsVisible
216222 ) && (!api_is_course_admin ())
217223) {
218224 api_not_allowed (true );
219225}
220226
221- if (!api_is_allowed_to_edit (null , true ) &&
222- (
223- ( $ category ->getLocked ()) ||
224- 0 != $ forum ->getLocked () ||
225- 0 != $ thread ->getLocked ()
227+ if (!api_is_allowed_to_edit (null , true )
228+ && (
229+ $ category ->getLocked ()
230+ || 0 != $ forum ->getLocked ()
231+ || 0 != $ thread ->getLocked ()
226232 )
227233) {
228234 api_not_allowed (true );
@@ -234,9 +240,9 @@ function setFocus() {
234240
235241$ group_id = api_get_group_id ();
236242
237- if (!api_is_allowed_to_edit (null , true ) &&
238- 0 == $ forum ->getAllowEdit () &&
239- !GroupManager::isTutorOfGroup (api_get_user_id (), $ groupEntity )
243+ if (!api_is_allowed_to_edit (null , true )
244+ && 0 == $ forum ->getAllowEdit ()
245+ && !GroupManager::isTutorOfGroup (api_get_user_id (), $ groupEntity )
240246) {
241247 api_not_allowed (true );
242248}
@@ -246,7 +252,7 @@ function setFocus() {
246252// Action links
247253if ('learnpath ' !== $ origin ) {
248254 $ actions = '' ;
249- //$actions .= '<span style="float:right;">'.search_link().'</span>';
255+ // $actions .= '<span style="float:right;">'.search_link().'</span>';
250256 if ('group ' === $ origin ) {
251257 $ actions .= '<a href="../group/group_space.php? ' .api_get_cidreq ().'"> ' .
252258 Display::getMdiIcon (ActionIcon::BACK , 'ch-tool-icon ' , null , ICON_SIZE_MEDIUM , get_lang ('Back to ' ).' ' .get_lang ('Groups ' )).
@@ -263,8 +269,8 @@ function setFocus() {
263269}
264270
265271/* Display Forum Category and the Forum information */
266- /*New display forum div*/
267- /*New display forum div*/
272+ /* New display forum div */
273+ /* New display forum div */
268274echo '<div class="forum_title"> ' ;
269275echo '<h1> ' ;
270276echo Display::url (
0 commit comments