} $PAGE->set_url('/admin/tool/recyclebin/index.php', array('contextid' => $contextid)); $PAGE->set_title(get_string('pluginname', 'tool_recyclebin')); // If we are doing anything, we need a sesskey! if (!empty($action)) { raise_memory_limit(MEMORY_EXTRA); require_sesskey(); $item = null; if ($action == 'restore' || $action == 'delete') { $itemid = required_param('itemid', PARAM_INT); $item = $recyclebin->get_item($itemid); } switch ($action) { // Restore it. case 'restore': if ($recyclebin->can_restore()) { $recyclebin->restore_item($item); redirect($PAGE->url, get_string('alertrestored', 'tool_recyclebin', $item), 2); } else { print_error('nopermissions', 'error'); } break; // Delete it. // Delete it. case 'delete': if ($recyclebin->can_delete()) { $recyclebin->delete_item($item); redirect($PAGE->url, get_string('alertdeleted', 'tool_recyclebin', $item), 2); } else { print_error('nopermissions', 'error'); }