Code Duplication    Length = 9-10 lines in 5 locations

main/wiki/wiki.inc.php 5 locations

@@ 1021-1029 (lines=9) @@
1018
            $protect_page = null;
1019
            $lock_unlock_protect = null;
1020
            // page action: protecting (locking) the page
1021
            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1022
                if (self::check_protect_page() == 1) {
1023
                    $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_MEDIUM);
1024
                    $lock_unlock_protect = 'unlock';
1025
                } else {
1026
                    $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_MEDIUM);
1027
                    $lock_unlock_protect = 'lock';
1028
                }
1029
            }
1030
1031
            if ($row['id']) {
1032
                $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_protect.'&title='.api_htmlentities(urlencode($page)).'">'.
@@ 1039-1048 (lines=10) @@
1036
            $visibility_page = null;
1037
            $lock_unlock_visibility = null;
1038
            //page action: visibility
1039
            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1040
                if (self::check_visibility_page() == 1) {
1041
                    $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'), '', ICON_SIZE_MEDIUM);
1042
                    $lock_unlock_visibility = 'invisible';
1043
1044
                } else {
1045
                    $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'), '', ICON_SIZE_MEDIUM);
1046
                    $lock_unlock_visibility = 'visible';
1047
                }
1048
            }
1049
1050
            if ($row['id']) {
1051
                $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_visibility.'&title='.api_htmlentities(urlencode($page)).'">'.
@@ 3440-3448 (lines=9) @@
3437
                // discussion action: protecting (locking) the discussion
3438
                $addlock_disc = null;
3439
                $lock_unlock_disc = null;
3440
                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3441
                    if (self::check_addlock_discuss() == 1) {
3442
                        $addlock_disc = Display::return_icon(
3443
                            'unlock.png',
3444
                            get_lang('UnlockDiscussExtra'),
3445
                            '',
3446
                            ICON_SIZE_SMALL
3447
                        );
3448
                        $lock_unlock_disc = 'unlockdisc';
3449
                    } else {
3450
                        $addlock_disc = Display::return_icon(
3451
                            'lock.png',
@@ 3466-3475 (lines=10) @@
3463
                // discussion action: visibility.  Show discussion to students if isn't hidden. Show page to all teachers if is hidden.
3464
                $visibility_disc = null;
3465
                $hide_show_disc = null;
3466
                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3467
                    if (self::check_visibility_discuss() == 1) {
3468
                        /// TODO: 	Fix Mode assignments: If is hidden, show discussion to student only if student is the author
3469
                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'), '', ICON_SIZE_SMALL);
3470
                        $hide_show_disc = 'hidedisc';
3471
                    } else {
3472
                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'), '', ICON_SIZE_SMALL);
3473
                        $hide_show_disc = 'showdisc';
3474
                    }
3475
                }
3476
                echo '<span style="float:right">';
3477
                echo '<a href="index.php?action=discuss&amp;actionpage='.$hide_show_disc.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$visibility_disc.'</a>';
3478
                echo '</span>';
@@ 3483-3491 (lines=9) @@
3480
                //discussion action: check add rating lock. Show/Hide list to rating for all student
3481
                $lock_unlock_rating_disc = null;
3482
                $ratinglock_disc = null;
3483
                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3484
                    if (self::check_ratinglock_discuss() == 1) {
3485
                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3486
                        $lock_unlock_rating_disc = 'unlockrating';
3487
                    } else {
3488
                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3489
                        $lock_unlock_rating_disc = 'lockrating';
3490
                    }
3491
                }
3492
3493
                echo '<span style="float:right">';
3494
                echo '<a href="index.php?action=discuss&actionpage='.$lock_unlock_rating_disc.'&title='.api_htmlentities(urlencode($page)).'">'.$ratinglock_disc.'</a>';