+++ /dev/null
-
-<form name="adminform" id="adminform" method="post" action="admin.php">
-<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>">
-<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
- <table align="center" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td valign="top">
- <?php
- $a->count = count($admins);
- $a->items = $strexistingadmins;
- print_string('counteditems', '', $a);
- ?>
- </td>
- <td></td>
- <td valign="top">
- <?php
- $a->count = $usercount;
- $a->items = $strpotentialadmins;
- print_string('counteditems', '', $a);
- ?>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <select name="removeselect[]" size="20" id="removeselect" multiple
- onFocus="document.adminform.add.disabled=true;
- document.adminform.remove.disabled=false;
- document.adminform.addselect.selectedIndex=-1;">
- <?php
- if (count($admins) == 1) {
- $disabled = 'disabled';
- $removebuttontype = 'hidden';
- } else {
- $disabled = '';
- $removebuttontype = 'submit';
- }
-
- foreach ($admins as $admin) {
- $fullname = fullname($admin, true);
- echo "<option value=\"$admin->id\" $disabled>".$fullname.", ".$admin->email."</option>\n";
- }
- ?>
-
- </select></td>
- <td valign="top">
- <br />
- <input name="add" type="submit" id="add" value="←" />
- <br />
- <input name="remove" type="<?php echo $removebuttontype ?>" id="remove" value="→" />
- <br />
- </td>
- <td valign="top">
- <select name="addselect[]" size="20" id="addselect" multiple
- onFocus="document.adminform.add.disabled=false;
- document.adminform.remove.disabled=true;
- document.adminform.removeselect.selectedIndex=-1;">
- <?php
- if (!empty($searchusers)) {
- echo "<optgroup label=\"$strsearchresults (" . count($searchusers) . ")\">\n";
- foreach ($searchusers as $user) {
- $fullname = fullname($user, true);
- echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
- }
- echo "</optgroup>\n";
- } else {
- if ($usercount > MAX_USERS_PER_PAGE) {
- echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
- .'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
- } else {
- if (!empty($users)) {
- foreach ($users as $user) {
- $fullname = fullname($user, true);
- echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
- }
- }
- }
- }
- ?>
- </select>
- <br />
- <input type="text" name="searchtext" size="30" value="<?php p($searchtext, true) ?>"
- onFocus ="document.adminform.add.disabled=true;
- document.adminform.remove.disabled=true;
- document.adminform.removeselect.selectedIndex=-1;
- document.adminform.addselect.selectedIndex=-1;"
- onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
- if (keyCode == 13) {
- document.adminform.previoussearch.value=1;
- document.adminform.submit();
- } " />
-
- <input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
- <?php
- if (!empty($searchusers)) {
- echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
- }
- ?>
- </td>
- </tr>
- </table>
-</form>
-
-
+++ /dev/null
-<?PHP // $Id$
- // Admin-only script to assign administrative rights to users
-
- /// this file is depreciated, assigning of admin is done in admin/roles/assign.php
-
- require_once('../config.php');
-
- define("MAX_USERS_PER_PAGE", 50);
-
- if (! $site = get_site()) {
- redirect("$CFG->wwwroot/$CFG->admin/index.php");
- }
-
- require_login();
-
- require_capability('moodle/user:assign', get_context_instance(CONTEXT_SYSTEM, SITEID));
-
- if (!confirm_sesskey()) {
- error(get_string('confirmsesskeybad', 'error'));
- }
-
- $primaryadmin = get_admin();
-
-/// If you want any administrator to have the ability to assign admin
-/// rights, then comment out the following if statement
- if ($primaryadmin->id != $USER->id) {
- error("You must be the primary administrator to use this page.");
- }
-
-/// assign all of the configurable language strings
- $stringstoload = array (
- "assignadmins",
- "administration",
- "existingadmins",
- "potentialadmins",
- "search",
- "users",
- "searchresults",
- "showall"
- );
-
- foreach ($stringstoload as $stringtoload){
- $strstringtoload = "str" . $stringtoload;
- $$strstringtoload = get_string($stringtoload);
- }
-
- print_header("$site->shortname: $strassignadmins",
- "$site->fullname",
- "<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> -> $strassignadmins", "adminform.searchtext");
-
-
- if (!$frm = data_submitted()) {
- print_simple_box("<center>".get_string("adminhelpassignadmins")."</center>", "center", "50%");
-
-/// A form was submitted so process the input
-
- } else {
- if (!empty($frm->add) and !empty($frm->addselect)) {
- foreach ($frm->addselect as $addadmin) {
- if (! add_admin($addadmin)) {
- error("Could not add admin with user id $addadmin!");
- }
- }
- } else if (!empty($frm->remove) and !empty($frm->removeselect)) {
- $admins = get_admins();
- if (count($admins) > count($frm->removeselect)) {
- foreach ($frm->removeselect as $removeadmin) {
- if (! remove_admin($removeadmin)) {
- error("Could not remove admin with user id $removeadmin!");
- }
- }
- }
- } else if (!empty($frm->showall)) {
- unset($frm->searchtext);
- $frm->previoussearch = 0;
- }
- }
-
-/// Is there a current search?
- $previoussearch = (!empty($frm->search) or (isset($frm->previoussearch) and $frm->previoussearch == 1)) ;
-
-/// Get all existing admins
- $admins = get_admins();
-
-
- $adminarray = array();
- foreach ($admins as $admin) {
- $adminarray[] = $admin->id;
- }
- $adminlist = implode(',', $adminarray);
-
- unset($adminarray);
-
- $usercount = get_users(false, '', true, $adminlist);
-
-/// Get search results excluding any current admins
- if (!empty($frm->searchtext) and $previoussearch) {
- $searchusers = get_users(true, $frm->searchtext, true, $adminlist, 'firstname ASC, lastname ASC',
- '', '', 0, MAX_USERS_PER_PAGE, 'id, firstname, lastname, email');
- }
-
-/// If no search results then get potential users excluding current admins
- if (empty($searchusers)) {
- $users = array();
-
- if ($usercount <= MAX_USERS_PER_PAGE) {
- if (!$users = get_users(true, '', true, $adminlist, 'firstname ASC, lastname ASC', '', '',
- 0, MAX_USERS_PER_PAGE, 'id, firstname, lastname, email') ) {
- $users = array();
- }
- }
- }
-
- $searchtext = (isset($frm->searchtext)) ? $frm->searchtext : "";
- $previoussearch = ($previoussearch) ? '1' : '0';
-
- include('./admin.html');
-
- print_footer();
-
-?>
+++ /dev/null
-
-<form name="creatorsform" id="creatorsform" method="post" action="creators.php">
-<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>">
-<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
- <table align="center" border="0" cellpadding="5" cellspacing="0">
- <tr>
- <td valign="top">
- <?php
- $a->count = count($creators);
- $a->items = $strexistingcreators;
- print_string('counteditems', '', $a);
- ?>
- </td>
- <td></td>
- <td valign="top">
- <?php
- $a->count = $usercount;
- $a->items = $strpotentialcreators;
- print_string('counteditems', '', $a);
- ?>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <select name="removeselect[]" size="20" id="removeselect" multiple
- onFocus="document.creatorsform.add.disabled=true;
- document.creatorsform.remove.disabled=false;
- document.creatorsform.addselect.selectedIndex=-1;">
- <?php
- foreach ($creators as $creator) {
- $fullname = fullname($creator, true);
- echo "<option value=\"$creator->id\">".$fullname.", ".$creator->email."</option>\n";
- }
- ?>
-
- </select></td>
- <td valign="top">
- <br />
- <input name="add" type="submit" id="add" value="←" />
- <br />
- <input name="remove" type="submit" id="remove" value="→" />
- <br />
- </td>
- <td valign="top">
- <select name="addselect[]" size="20" id="addselect" multiple
- onFocus="document.creatorsform.add.disabled=false;
- document.creatorsform.remove.disabled=true;
- document.creatorsform.removeselect.selectedIndex=-1;">
- <?php
- if (!empty($searchusers)) {
- echo "<optgroup label=\"$strsearchresults (" . count($searchusers) . ")\">\n";
- foreach ($searchusers as $user) {
- $fullname = fullname($user, true);
- echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
- }
- echo "</optgroup>\n";
- }
- if (!empty($users)) {
- foreach ($users as $user) {
- $fullname = fullname($user, true);
- echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
- }
- }
- ?>
- </select>
- <br />
- <input type="text" name="searchtext" size="30" value="<?php p($searchtext) ?>"
- onFocus ="document.creatorsform.add.disabled=true;
- document.creatorsform.remove.disabled=true;
- document.creatorsform.removeselect.selectedIndex=-1;
- document.creatorsform.addselect.selectedIndex=-1;"
- onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
- if (keyCode == 13) {
- document.creatorsform.previoussearch.value=1;
- document.creatorsform.submit();
- } " />
- <input name="search" id="search" type="submit" value="<?php p($strsearch) ?>"/>
- <?php
- if (!empty($searchusers)) {
- echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
- }
- ?>
- </td>
- </tr>
- </table>
-</form>
-
-
+++ /dev/null
-<?PHP // $Id$
- // Admin only script to assign course creator rights to users
-
- /// this file is depreciated, assigning of course creators is done in admin/roles/assign.php
-
- require_once('../config.php');
-
- define("MAX_USERS_PER_PAGE", 5000);
-
- if (! $site = get_site()) {
- redirect("$CFG->wwwroot/$CFG->admin/index.php");
- }
-
- require_login();
-
- require_capability('moodle/user:assign', get_context_instance(CONTEXT_SYSTEM, SITEID));
-
- if (!confirm_sesskey()) {
- error(get_string('confirmsesskeybad', 'error'));
- }
-
- $primaryadmin = get_admin();
-
-/// assign all of the configurable language strings
- $stringstoload = array (
- "assigncreators",
- "administration",
- "existingcreators",
- "potentialcreators",
- "search",
- "users",
- "searchresults",
- "showall"
- );
-
- foreach ($stringstoload as $stringtoload){
- $strstringtoload = "str" . $stringtoload;
- $$strstringtoload = get_string($stringtoload);
- }
-
- print_header("$site->shortname: $strassigncreators",
- "$site->fullname",
- "<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> ->
- $strassigncreators", "creatorsform.searchtext");
-
-
- if (!$frm = data_submitted()) {
- print_simple_box("<center>".get_string("adminhelpassigncreators")."</center>", "center", "50%");
- $frm = new object();
-
-/// A form was submitted so process the input
-
- } else {
- if (!empty($frm->add) and !empty($frm->addselect)) {
- foreach ($frm->addselect as $addcreator) {
- if (! add_creator($addcreator)) {
- error("Could not add course creator with user id $addcreator!");
- }
- }
- } else if (!empty($frm->remove) and !empty($frm->removeselect)) {
- foreach ($frm->removeselect as $removecreator) {
- if (! remove_creator($removecreator)) {
- error("Could not remove course creator with user id $removecreator!");
- }
- }
- } else if (!empty($frm->showall)) {
- unset($frm->searchtext);
- $frm->previoussearch = 0;
- }
- }
-
-/// Is there a current search?
- $previoussearch = (!empty($frm->search) or (isset($frm->previoussearch) && $frm->previoussearch == 1)) ;
-
-
-/// Get all existing creators
- if (! $creators = get_creators()) {
- $creators = array();
- }
-
- $creatorsarray = array();
- foreach ($creators as $creator) {
- $creatorsarray[] = $creator->id;
- }
- $creatorlist = implode(',', $creatorsarray);
-
- unset($creatorarray);
-
- $usercount = get_users(false, '', true, $creatorlist);
-
-/// Get search results excluding any current admins
- if (!empty($frm->searchtext) and $previoussearch) {
- $searchusers = get_users(true, $frm->searchtext, true, $creatorlist, 'firstname ASC, lastname ASC',
- '', '', 0, MAX_USERS_PER_PAGE, 'id, firstname, lastname, email');
- }
-
-/// If no search results then get potential users excluding current creators
- if (empty($searchusers)) {
- $users = array();
- if ($usercount <= MAX_USERS_PER_PAGE) {
- if (!$users = get_users(true, '', true, $creatorlist, 'firstname ASC, lastname ASC', '', '',
- 0, MAX_USERS_PER_PAGE, 'id, firstname, lastname, email') ) {
- $users = array();
- }
- }
- }
-
- $searchtext = (isset($frm->searchtext)) ? $frm->searchtext : "";
- $previoussearch = ($previoussearch) ? '1' : '0';
-
- include('./creators.html');
-
- print_footer();
-
-?>