Code Duplication    Length = 9-10 lines in 5 locations

main/wiki/wiki.inc.php 5 locations

@@ 1138-1146 (lines=9) @@
1135
            $protect_page = null;
1136
            $lock_unlock_protect = null;
1137
            // page action: protecting (locking) the page
1138
            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1139
                if (self::check_protect_page() == 1) {
1140
                    $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_MEDIUM);
1141
                    $lock_unlock_protect = 'unlock';
1142
                } else {
1143
                    $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_MEDIUM);
1144
                    $lock_unlock_protect = 'lock';
1145
                }
1146
            }
1147
1148
            if ($row['id']) {
1149
                $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_protect.'&title='.api_htmlentities(urlencode($page)).'">'.
@@ 1156-1165 (lines=10) @@
1153
            $visibility_page = null;
1154
            $lock_unlock_visibility = null;
1155
            //page action: visibility
1156
            if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
1157
                if (self::check_visibility_page() == 1) {
1158
                    $visibility_page = Display::return_icon(
1159
                        'visible.png',
1160
                        get_lang('ShowPageExtra'),
1161
                        '',
1162
                        ICON_SIZE_MEDIUM
1163
                    );
1164
                    $lock_unlock_visibility = 'invisible';
1165
1166
                } else {
1167
                    $visibility_page = Display::return_icon(
1168
                        'invisible.png',
@@ 3730-3738 (lines=9) @@
3727
                // discussion action: protecting (locking) the discussion
3728
                $addlock_disc = null;
3729
                $lock_unlock_disc = null;
3730
                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3731
                    if (self::check_addlock_discuss() == 1) {
3732
                        $addlock_disc = Display::return_icon(
3733
                            'unlock.png',
3734
                            get_lang('UnlockDiscussExtra'),
3735
                            '',
3736
                            ICON_SIZE_SMALL
3737
                        );
3738
                        $lock_unlock_disc = 'unlockdisc';
3739
                    } else {
3740
                        $addlock_disc = Display::return_icon(
3741
                            'lock.png',
@@ 3756-3765 (lines=10) @@
3753
                // discussion action: visibility.  Show discussion to students if isn't hidden. Show page to all teachers if is hidden.
3754
                $visibility_disc = null;
3755
                $hide_show_disc = null;
3756
                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3757
                    if (self::check_visibility_discuss() == 1) {
3758
                        /// TODO: 	Fix Mode assignments: If is hidden, show discussion to student only if student is the author
3759
                        $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'), '', ICON_SIZE_SMALL);
3760
                        $hide_show_disc = 'hidedisc';
3761
                    } else {
3762
                        $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'), '', ICON_SIZE_SMALL);
3763
                        $hide_show_disc = 'showdisc';
3764
                    }
3765
                }
3766
                echo '<span style="float:right">';
3767
                echo '<a href="index.php?action=discuss&amp;actionpage='.$hide_show_disc.'&amp;title='.api_htmlentities(urlencode($page)).'">'.$visibility_disc.'</a>';
3768
                echo '</span>';
@@ 3773-3781 (lines=9) @@
3770
                //discussion action: check add rating lock. Show/Hide list to rating for all student
3771
                $lock_unlock_rating_disc = null;
3772
                $ratinglock_disc = null;
3773
                if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
3774
                    if (self::check_ratinglock_discuss() == 1) {
3775
                        $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3776
                        $lock_unlock_rating_disc = 'unlockrating';
3777
                    } else {
3778
                        $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'), '', ICON_SIZE_SMALL);
3779
                        $lock_unlock_rating_disc = 'lockrating';
3780
                    }
3781
                }
3782
3783
                echo '<span style="float:right">';
3784
                echo '<a href="index.php?action=discuss&actionpage='.$lock_unlock_rating_disc.'&title='.api_htmlentities(urlencode($page)).'">'.$ratinglock_disc.'</a>';