From: moodler Date: Wed, 14 May 2003 16:27:27 +0000 (+0000) Subject: Revamped "Assign Creators" page with the same code as admins and teachers X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d8eece23c90ef60f11dd73cf35a348a8ddebc3ec;p=moodle.git Revamped "Assign Creators" page with the same code as admins and teachers --- diff --git a/admin/creators.php b/admin/creators.php index da25a73400..d7d704b84e 100755 --- a/admin/creators.php +++ b/admin/creators.php @@ -1,9 +1,11 @@ -shortname: $course->shortname: $strassigncreators", "$site->fullname", - "$stradministration -> - $strassigncreators", ""); + "$stradministration -> + $strassigncreators", ""); /// Get all existing creators $creators = get_creators(); /// Add an creator if one is specified - if ($_REQUEST['add']) { - $user = @get_record("user", "id", $_REQUEST['add']) or - error("That account (id = {$_REQUEST['add']}) doesn't exist"); + if ($add) { + $user = @get_record("user", "id", $add) or + error("That account (id = $add) doesn't exist"); if ($creators) { foreach ($creators as $aa) { @@ -72,10 +80,9 @@ } /// Remove an creator if one is specified. - if ($_REQUEST['remove']) { - - $user = @get_record("user", "id", $_REQUEST['remove']) or - error("That account (id = {$_REQUEST['remove']}) doesn't exist"); + if ($remove) { + $user = @get_record("user", "id", $remove) or + error("That account (id = $remove) doesn't exist"); if ($creators) { foreach ($creators as $key => $aa) { @@ -89,79 +96,69 @@ /// Print the lists of existing and potential creators - echo ""; - echo ""; - echo "
$strexistingcreators$strpotentialcreators
"; + echo ""; + echo ""; + echo "
$strexistingcreators$strpotentialcreators
"; /// First, show existing creators if (! $creators) { - echo "

$strnoexistingcreators"; + echo "

$strnoexistingcreators"; + + $creatorlist = ""; } else { + $creatorarray = array(); foreach ($creators as $creator) { - echo "

$creator->firstname $creator->lastname, + $creatorarray[] = $creator->id; + echo "

$creator->firstname $creator->lastname, $creator->email    "; - echo "id\" - TITLE=\"$strremovecreator\">"; - echo "

"; + echo "id\" + title=\"$strremovecreator\">"; + echo "

"; } + $creatorlist = implode(",",$creatorarray); + unset($creatorarray); } - echo "
"; + echo ""; -/// Print list of potential creators +/// Print list of potential creators - if ($search) { - $users = get_users_search($search); - } else { - $users = get_users_confirmed(); - } + $usercount = get_users(false, $search, true, $creatorlist); - - if ($users) { - foreach ($users as $user) { // Remove users who are already creators - if ($creators) { - foreach ($creators as $creator) { - if ($creator->id == $user->id) { - continue 2; - } - } - } - $potential[] = $user; - } - } + if ($usercount == 0) { + echo "

$strnopotentialcreators

"; - if (! $potential) { - echo "

$strnopotentialcreators"; - if ($search) { - echo "

"; - echo ""; - echo ""; - echo "
"; - } + } else if ($usercount > MAX_USERS_PER_PAGE) { + echo "

$strtoomanytoshow

"; } else { + if ($search) { - echo "

($strsearchresults)

"; + echo "

($strsearchresults : $search)

"; } - if (count($potential) <= 20) { - foreach ($potential as $user) { - echo "

id\" - TITLE=\"$straddcreator\">  $user->firstname $user->lastname, $user->email"; - } - } else { - echo "

There are too many users to show.
"; - echo "Enter a search word here."; - echo "

"; - echo ""; - echo ""; - echo "
"; + + if (!$users = get_users(true, $search, true, $creatorlist)) { + error("Could not get users!"); + } + + foreach ($users as $user) { + echo "

id\"". + "title=\"$straddcreator\">  $user->firstname $user->lastname, $user->email"; } } - echo "

"; + if ($search or $usercount > MAX_USERS_PER_PAGE) { + echo "
"; + echo ""; + echo ""; + echo "
"; + } + + echo "
"; print_footer();