$thisrole = null; $nextrole = null; foreach ($roles as $role) { if ($role->id == $roleid) { $thisrole = $role; } else { if (!is_null($thisrole)) { $nextrole = $role; break; } } } if (is_null($nextrole)) { print_error('cannotmoverolewithid', 'error', '', $roleid); } if (!switch_roles($thisrole, $nextrole)) { print_error('cannotmoverolewithid', 'error', '', $roleid); } } redirect($baseurl); break; } // Print the page header and tabs. echo $OUTPUT->header(); $currenttab = 'manage'; require 'managetabs.php'; // Initialise table. $table = new html_table(); $table->colclasses = array('leftalign', 'leftalign', 'leftalign', 'leftalign'); $table->id = 'roles'; $table->attributes['class'] = 'admintable generaltable';
$role = $roles[$roleid]; if ($role->sortorder > 0) { $above = $roles[$rolesort[$role->sortorder - 1]]; if (!switch_roles($role, $above)) { error("Cannot move role with ID {$roleid}"); } } } redirect('manage.php'); break; case 'movedown': if (array_key_exists($roleid, $roles) and confirm_sesskey()) { $role = $roles[$roleid]; if ($role->sortorder + 1 < $rolescount) { $below = $roles[$rolesort[$role->sortorder + 1]]; if (!switch_roles($role, $below)) { error("Cannot move role with ID {$roleid}"); } } } redirect('manage.php'); break; case 'duplicate': if (!array_key_exists($roleid, $roles)) { redirect('manage.php'); } if ($confirm and data_submitted() and confirm_sesskey()) { //ok - lets duplicate! } else { // show confirmation admin_externalpage_print_header();