summaryrefslogtreecommitdiff
path: root/modules/user/controllers/admin_users.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-10-16 07:41:33 -0700
committerTim Almdal <tnalmdal@shaw.ca>2009-10-16 08:55:26 -0700
commitbc241e44c2e4d10ac19ccc32a40c90426672d963 (patch)
treeaade0e13346a059c061e2f2f4a767e25a45fe17b /modules/user/controllers/admin_users.php
parent00eacd659f27df9c13246c510057c4f42c8866a2 (diff)
Cleanup merge of user/group helpers into Identity interface. Reduce redundant code in the user module and remove references to the Identity helper from the user module as the user module should be able to access things directly. Simplify the get_user_list api method to just accept an array of ids to return user objects for.
Diffstat (limited to 'modules/user/controllers/admin_users.php')
-rw-r--r--modules/user/controllers/admin_users.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php
index 3465c4b1..fed872a5 100644
--- a/modules/user/controllers/admin_users.php
+++ b/modules/user/controllers/admin_users.php
@@ -21,8 +21,12 @@ class Admin_Users_Controller extends Admin_Controller {
public function index() {
$view = new Admin_View("admin.html");
$view->content = new View("admin_users.html");
- $view->content->users = user::get_user_list(array("orderby" => array("name" => "ASC")));
- $view->content->groups = group::get_group_list(array("orderby" => array("name" => "ASC")));
+ $view->content->users = ORM::factory("user")
+ ->orderby("name", "ASC")
+ ->find_all();
+ $view->content->groups = ORM::factory("group")
+ ->orderby("name", "ASC")
+ ->find_all();
print $view;
}
@@ -303,7 +307,7 @@ class Admin_Users_Controller extends Admin_Controller {
$group->input("email")->label(t("Email"))->id("g-email")->value($user->email);
$group->input("url")->label(t("URL"))->id("g-url")->value($user->url);
$group->checkbox("admin")->label(t("Admin"))->id("g-admin")->checked($user->admin);
- $form->add_rules_from(user::get_edit_rules());
+ $form->add_rules_from($user);
$form->edit_user->password->rules("-required");
module::event("user_edit_form_admin", $user, $form);
@@ -325,8 +329,7 @@ class Admin_Users_Controller extends Admin_Controller {
$group->input("url")->label(t("URL"))->id("g-url");
self::_add_locale_dropdown($group);
$group->checkbox("admin")->label(t("Admin"))->id("g-admin");
- $user = ORM::factory("user");
- $form->add_rules_from(user::get_edit_rules());
+ $form->add_rules_from(ORM::factory("user"));
module::event("user_add_form_admin", $user, $form);
$group->submit("")->value(t("Add User"));
@@ -366,7 +369,7 @@ class Admin_Users_Controller extends Admin_Controller {
$form_group->inputs["name"]->error_messages(
"in_use", t("There is already a group with that name"));
$form_group->submit("")->value(t("Save"));
- $form->add_rules_from(group::get_edit_rules());
+ $form->add_rules_from($group);
return $form;
}
@@ -378,8 +381,7 @@ class Admin_Users_Controller extends Admin_Controller {
$form_group->inputs["name"]->error_messages(
"in_use", t("There is already a group with that name"));
$form_group->submit("")->value(t("Add Group"));
- $group = ORM::factory("group");
- $form->add_rules_from(group::get_edit_rules());
+ $form->add_rules_from(ORM::factory("group"));
return $form;
}