Skip to content

Commit 6870836

Browse files
committed
MBS-10415: Fix codestyle for moodle_501
1 parent 879d93d commit 6870836

17 files changed

Lines changed: 424 additions & 294 deletions

action.php

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@
8888
$duplicatetask->set_userid($USER->id);
8989
$duplicatetask->set_custom_data(['modules' => $modulerecords]);
9090
manager::queue_adhoc_task($duplicatetask);
91-
redirect($returnurl, get_string('backgroundtaskinformation', 'block_massaction'), null,
92-
notification::NOTIFY_SUCCESS);
91+
redirect(
92+
$returnurl,
93+
get_string('backgroundtaskinformation', 'block_massaction'),
94+
null,
95+
notification::NOTIFY_SUCCESS
96+
);
9397
} else {
9498
block_massaction\actions::duplicate($modulerecords);
9599
}
@@ -139,8 +143,12 @@
139143
$duplicatetask->set_userid($USER->id);
140144
$duplicatetask->set_custom_data(['modules' => $modulerecords, 'sectionid' => $data->duplicateToTarget]);
141145
manager::queue_adhoc_task($duplicatetask);
142-
redirect($returnurl, get_string('backgroundtaskinformation', 'block_massaction'), null,
143-
notification::NOTIFY_SUCCESS);
146+
redirect(
147+
$returnurl,
148+
get_string('backgroundtaskinformation', 'block_massaction'),
149+
null,
150+
notification::NOTIFY_SUCCESS
151+
);
144152
} else {
145153
block_massaction\actions::duplicate($modulerecords, $data->duplicateToTarget);
146154
}
@@ -178,7 +186,6 @@
178186
actions::print_course_select_form($courseselectform);
179187
break;
180188
} else if ($data = $sectionselectform->get_data()) {
181-
182189
// We validate the section number and default to 'same section than source course' if it is not a proper section
183190
// number.
184191
$targetsectionnum = property_exists($data, 'targetsectionnum') && is_numeric($data->targetsectionnum)
@@ -190,15 +197,22 @@
190197
$duplicatetask->set_custom_data(['modules' => $modulerecords, 'sectionnum' => $targetsectionnum,
191198
'courseid' => $targetcourseid]);
192199
manager::queue_adhoc_task($duplicatetask);
193-
redirect($returnurl, get_string('backgroundtaskinformation', 'block_massaction'), null,
194-
notification::NOTIFY_SUCCESS);
200+
redirect(
201+
$returnurl,
202+
get_string('backgroundtaskinformation', 'block_massaction'),
203+
null,
204+
notification::NOTIFY_SUCCESS
205+
);
195206
} else {
196207
block_massaction\actions::duplicate_to_course($modulerecords, $targetcourseid, $targetsectionnum);
197208
}
198209

199-
redirect($returnurl, get_string('actionexecuted', 'block_massaction'), null,
200-
notification::NOTIFY_SUCCESS);
201-
210+
redirect(
211+
$returnurl,
212+
get_string('actionexecuted', 'block_massaction'),
213+
null,
214+
notification::NOTIFY_SUCCESS
215+
);
202216
} else {
203217
$redirect = false;
204218
actions::print_section_select_form($sectionselectform);
@@ -213,6 +227,10 @@
213227
// Redirect back to the previous page.
214228
// If an error has occurred, the action handler functions already should have thrown an exception to the user, so if we get to
215229
// this point in the code, the demanded action should have been successful.
216-
redirect($returnurl, get_string('actionexecuted', 'block_massaction'), null,
217-
notification::NOTIFY_SUCCESS);
230+
redirect(
231+
$returnurl,
232+
get_string('actionexecuted', 'block_massaction'),
233+
null,
234+
notification::NOTIFY_SUCCESS
235+
);
218236
}

block_massaction.php

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
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-
2517
use block_massaction\hook\filter_sections_different_course;
2618
use block_massaction\hook\filter_sections_same_course;
2719

@@ -32,7 +24,6 @@
3224
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3325
*/
3426
class 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

Comments
 (0)