diff --git a/course/format/topics/format.php b/course/format/topics/format.php index 62ca069..580487a 100644 --- a/course/format/topics/format.php +++ b/course/format/topics/format.php @@ -111,6 +111,14 @@ $section = 0; $thissection = $sections[$section]; + require_once $CFG->dirroot."/course/massaction/lib.php"; + + if (isediting($course->id)) { + echo "
'."\n".$hideshow.$groupmode."\n".'';
+ ' alt="'.$str->delete.'" />'."\n".$hideshow.$groupmode."\n".$checkbox.'';
}
/**
diff --git a/course/massaction/action.php b/course/massaction/action.php
new file mode 100644
index 0000000..a0f731d
--- /dev/null
+++ b/course/massaction/action.php
@@ -0,0 +1,117 @@
+libdir .'/dmllib.php');
+
+$sesskey = required_param('sesskey');
+$return_to = required_param('return_to');
+
+$continue = optional_param('continue', false);
+$do = optional_param('do', false);
+$modids = array();
+$section = -1;
+
+foreach ($_POST as $key => $val) {
+ if (str_replace('massaction_check_', "", $key) == $val) {
+ $modids[] = $val;
+ } else if (substr($key, 0, 4) == 'act_') {
+ $action = substr($key, 4);
+ }
+}
+
+if ($encoded_modids = optional_param('modids', false)) {
+ $modids = decode_array($encoded_modids);
+}
+
+// Turn arrays into strings that can easily be passed
+$encoded_post = encode_array($_POST);
+$encoded_mods = encode_array($modids);
+
+if (! isset($action) && isset($_POST['action'])) {
+ $action = $_POST['action'];
+}
+
+if (optional_param('cancel', false)) {
+ redirect($return_to);
+}
+
+if (! isset($action)) {
+ redirect($return_to, "No action was specified");
+} else if (empty($modids)) {
+ redirect($return_to, "No modules were selected");
+}
+
+$include_file = $CFG->dirroot.'/course/massaction/'.$action.".php";
+$include_file_exists = file_exists($include_file);
+
+if (! $include_file_exists) {
+ error("Required file '$include_file' does not exist");
+}
+require_once($include_file);
+
+
+$confirm_function = "ma_".$action."_confirm";
+$continue_function = "ma_".$action."_continue";
+$execute_function = "ma_".$action."_execute";
+
+$confirm_function_exists = function_exists($confirm_function);
+$continue_function_exists = function_exists($continue_function);
+$execute_function_exists = function_exists($execute_function);
+
+$do_page = $do || ! $confirm_function_exists; // action has been confirmed or there is no confirm function
+$confirm_page = ($continue || ! $continue_function_exists) && ! $do_page; // past the continue page, or no continue function
+
+if ($do_page) { // Action has been confirmed OR there is no confirm function
+ if ($do) {
+ $modids = decode_array($_POST['modids']);
+ $post = decode_array($_POST['post']);
+ } else {
+ $post = $_POST;
+ }
+ if ($modids) {
+ if (! $execute_function_exists) {
+ error("Required function '$execute_function' does not exist");
+ }
+ $message = $execute_function($modids, $post);
+ redirect($return_to, $message);
+ }
+} else {
+ $modnames = massaction_get_modnames($modids);
+
+ $string = '';
+ // Get the custom string for the chosen action;
+ if ($confirm_page) {
+ $string .= $confirm_function($modnames, $_POST);
+ } else {
+ $string .= $continue_function($modnames, $_POST);
+ }
+
+ // Print the form
+
+ print_header_simple(get_string($action, 'massaction')." (Mass Action)");
+ print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
+
+ echo $string;
+
+ echo "\n";
+ print_simple_box_end();
+ print_footer();
+}
+?>
diff --git a/course/massaction/delete.php b/course/massaction/delete.php
new file mode 100644
index 0000000..2604c2a
--- /dev/null
+++ b/course/massaction/delete.php
@@ -0,0 +1,79 @@
+";
+ $string .= "| ".get_string('delete_continue', 'massaction')." |
| $modname |
+This toolbar allows instructors to perform actions upon +multiple resources or activities in the class view, rather +than having to perform repeated actions on individual items. +
+ ++To use this toolbar, Javascript must be enabled in your +browser, you must be in editing mode in the course +home page, and Ajax must be disabled. Only the +courses in the Week or Topics formats are supported. +
+ ++Supported actions include mass deletion, mass hiding, +mass showing, and mass moving. To select items to perform +actions on, simply click the checkbox to the right of it +in the course home page, then at the top or bottom +of the page, click the action you would like to perform. +
diff --git a/lang/en_utf8/massaction.php b/lang/en_utf8/massaction.php new file mode 100644 index 0000000..8c92aab --- /dev/null +++ b/lang/en_utf8/massaction.php @@ -0,0 +1,14 @@ +Mass Actions'; +$string['cancel'] = 'Cancel'; +$string['section'] = 'Section'; +$string['sectionzero'] = 'Section 0'; +?> \ No newline at end of file