1414// You should have received a copy of the GNU General Public License
1515// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616
17- /**
18- * Primary block class.
19- *
20- * @package block_massaction
21- * @copyright 2013 University of Minnesota
22- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23- */
24-
2517use block_massaction \hook \filter_sections_different_course ;
2618use block_massaction \hook \filter_sections_same_course ;
2719
3224 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3325 */
3426class block_massaction extends block_base {
35-
3627 /**
3728 * Initialize the plugin. This method is being called by the parent constructor by default.
3829 */
@@ -140,30 +131,38 @@ public function get_content(): stdClass {
140131 $ context = context_course::instance ($ COURSE ->id );
141132 // Actions to be rendered later on.
142133 $ actionicons = [];
143- if (has_capability ('moodle/course:activityvisibility ' , $ context )
144- && has_capability ('block/massaction:activityshowhide ' , $ blockcontext )) {
134+ if (
135+ has_capability ('moodle/course:activityvisibility ' , $ context )
136+ && has_capability ('block/massaction:activityshowhide ' , $ blockcontext )
137+ ) {
145138 // As we want to use this symbol for the *operation*, not the state, we switch the icons hide/show.
146139 $ actionicons ['show ' ] = 't/hide ' ;
147140 $ actionicons ['hide ' ] = 't/show ' ;
148141 if (!empty ($ CFG ->allowstealth )) {
149142 $ actionicons ['makeavailable ' ] = 't/block ' ;
150143 }
151144 }
152- if (has_capability ('moodle/backup:backuptargetimport ' , $ context )
153- && has_capability ('moodle/restore:restoretargetimport ' , $ context )
154- && has_capability ('block/massaction:duplicate ' , $ blockcontext )) {
145+ if (
146+ has_capability ('moodle/backup:backuptargetimport ' , $ context )
147+ && has_capability ('moodle/restore:restoretargetimport ' , $ context )
148+ && has_capability ('block/massaction:duplicate ' , $ blockcontext )
149+ ) {
155150 $ actionicons ['duplicate ' ] = 't/copy ' ;
156151 }
157- if (has_capability ('moodle/backup:backuptargetimport ' , $ context )
158- && has_capability ('block/massaction:duplicatetocourse ' , $ blockcontext )) {
152+ if (
153+ has_capability ('moodle/backup:backuptargetimport ' , $ context )
154+ && has_capability ('block/massaction:duplicatetocourse ' , $ blockcontext )
155+ ) {
159156 $ actionicons ['duplicatetocourse ' ] = 't/copy ' ;
160157 }
161158 if (has_capability ('moodle/course:manageactivities ' , $ context )) {
162159 if (has_capability ('block/massaction:delete ' , $ blockcontext )) {
163160 $ actionicons ['delete ' ] = 't/delete ' ;
164161 }
165- if (course_get_format ($ COURSE ->id )->uses_indentation ()
166- && has_capability ('block/massaction:indent ' , $ blockcontext )) {
162+ if (
163+ course_get_format ($ COURSE ->id )->uses_indentation ()
164+ && has_capability ('block/massaction:indent ' , $ blockcontext )
165+ ) {
167166 // From Moodle 4.0 on the course format has to declare if it supports indentation or not.
168167 $ actionicons ['moveright ' ] = 't/right ' ;
169168 $ actionicons ['moveleft ' ] = 't/left ' ;
@@ -183,19 +182,26 @@ public function get_content(): stdClass {
183182 'actiontext ' => get_string ('action_ ' . $ action , 'block_massaction ' )];
184183 }
185184
186- $ this ->content ->text = $ OUTPUT ->render_from_template ('block_massaction/block_massaction ' ,
187- ['actions ' => $ actions ,
188- 'formaction ' => $ CFG ->wwwroot . '/blocks/massaction/action.php ' ,
189- 'instanceid ' => $ this ->instance ->id , 'requesturi ' => $ _SERVER ['REQUEST_URI ' ],
190- 'helpicon ' => $ OUTPUT ->help_icon ('usage ' , 'block_massaction ' ),
191- 'show_moveto_select ' => (has_capability ('moodle/course:manageactivities ' , $ context ) &&
192- has_capability ('block/massaction:movetosection ' , $ context )),
193- 'show_duplicateto_select ' => (has_capability ('moodle/backup:backuptargetimport ' , $ context ) &&
194- has_capability ('moodle/restore:restoretargetimport ' , $ context ) &&
195- has_capability ('block/massaction:movetosection ' , $ context )),
196- 'sectionselecthelpicon ' => $ OUTPUT ->help_icon ('sectionselect ' , 'block_massaction ' ),
185+ $ this ->content ->text = $ OUTPUT ->render_from_template (
186+ 'block_massaction/block_massaction ' ,
187+ [
188+ 'actions ' => $ actions ,
189+ 'formaction ' => $ CFG ->wwwroot . '/blocks/massaction/action.php ' ,
190+ 'instanceid ' => $ this ->instance ->id , 'requesturi ' => $ _SERVER ['REQUEST_URI ' ],
191+ 'helpicon ' => $ OUTPUT ->help_icon ('usage ' , 'block_massaction ' ),
192+ 'show_moveto_select ' => (
193+ has_capability ('moodle/course:manageactivities ' , $ context ) &&
194+ has_capability ('block/massaction:movetosection ' , $ context )
195+ ),
196+ 'show_duplicateto_select ' => (
197+ has_capability ('moodle/backup:backuptargetimport ' , $ context ) &&
198+ has_capability ('moodle/restore:restoretargetimport ' , $ context ) &&
199+ has_capability ('block/massaction:movetosection ' , $ context )
200+ ),
201+ 'sectionselecthelpicon ' => $ OUTPUT ->help_icon ('sectionselect ' , 'block_massaction ' ),
197202 'availabletargetsections ' => implode (', ' , $ sectionsavailable ),
198- ]);
203+ ]
204+ );
199205 }
200206 return $ this ->content ;
201207 }
0 commit comments