summaryrefslogtreecommitdiff
path: root/src/controllers/Users.class.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-09-04 21:13:47 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-09-04 21:13:47 -0400
commitad4a7ff9159c2c64cea98d7189f46fa7d6174fc2 (patch)
tree508f971f1dbc6c6f01207426c675542b55e0333e /src/controllers/Users.class.php
parentf3b3ea69fb46e45bf3598aa7a6bcf62aa80e4703 (diff)
Screw it, I'm tired of trying to break this into individual commits
Diffstat (limited to 'src/controllers/Users.class.php')
-rw-r--r--src/controllers/Users.class.php54
1 files changed, 50 insertions, 4 deletions
diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php
index 617c57a..9781ab0 100644
--- a/src/controllers/Users.class.php
+++ b/src/controllers/Users.class.php
@@ -84,8 +84,14 @@ class Users extends Controller {
}
break;
}
+
+ $config_options = array();
+ $mm->pluginManager()->callHook('userConfig', &$config_options);
+
+ $vars['config_options'] = $config_options;
$vars['user'] = $user;
$vars['groups'] = $mm->listGroupNames();
+ require_once('ContactMethod.class.php');
$this->showView('users/individual', $vars);
}
}
@@ -179,10 +185,20 @@ class Users extends Controller {
}
// Change information //////////////////////////////////////////
+ global $mm;
+ $config_options = array();
+ $mm->pluginManager()->callHook('userConfig', &$config_options);
+
+ foreach ($config_options as $group=>$options) {
+ foreach ($options as $option) {
+ $this->confText($user, $option[0]);
+ }
+ }
+ /*
$this->confText($user, 'firstname');
$this->confText($user, 'lastname');
$this->confText($user, 'hsclass');
-
+ */
// Change contact info /////////////////////////////////////////
global $CONTACT_METHODS;
foreach ($CONTACT_METHODS as $method) {
@@ -213,7 +229,15 @@ class Users extends Controller {
* This will parse POST (really, PUT) data to update multiple users.
*/
private function update_users() {
- // TODO
+ $attribs = $this->getIndexAttribs();
+ foreach ($attribs as $attrib) {
+ $key = $attrib['key'];
+ if (isset($_POST[$key]) && is_array($_POST[$key])) {
+ foreach ($_POST[$key] as $uid => $value) {
+ $this->setConf($uid, $key, $value);
+ }
+ }
+ }
}
/**
@@ -264,8 +288,9 @@ class Users extends Controller {
$editable = $editable && $logged_in_user->isAdmin();
$value = $user->isAdmin();
break;
- default:
+ default:
$value = $user->getConf($key);
+ if ($value===false) $value='';
break;
}
@@ -273,6 +298,27 @@ class Users extends Controller {
'post_key'=>$post_key,
'editable'=>$editable);
}
+ private function setConf($uid, $key, $value) {
+ // So, this rocks because we don't have to check permissions,
+ // the User object does that.
+ global $mm;
+ $user = $mm->getAuthObj($uid);
+
+ switch ($key) {
+ case 'auth_name':
+ $user->setName($value);
+ break;
+ case 'auth_user':
+ $user->setUser($value=='true');
+ break;
+ case 'auth_admin':
+ $user->setAdmin($value=='true');
+ break;
+ default:
+ $user->setConf($key, $value);
+ break;
+ }
+ }
function attrib($key, $name) {
return array('key'=>$key, 'name'=>$name);
@@ -286,6 +332,6 @@ class Users extends Controller {
$this->attrib('email','Email'),
$this->attrib('auth_name', 'Username'),
);
- return $attrib;
+ return $attribs;
}
}