summaryrefslogtreecommitdiff
path: root/src/views/pages/users/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/pages/users/index.php')
-rw-r--r--src/views/pages/users/index.php116
1 files changed, 0 insertions, 116 deletions
diff --git a/src/views/pages/users/index.php b/src/views/pages/users/index.php
deleted file mode 100644
index d801faf..0000000
--- a/src/views/pages/users/index.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php global $mm;
-
-$logged_in_user = $mm->getAuthObj($mm->isLoggedIn());
-if (!$logged_in_user->isUser()) {
- include(VIEWPATH.'/pages/users/401.php');
- exit();
-}
-
-function attrib($key, $name, $check=false) {
- return array('key'=>$key, 'name'=>$name, 'checkbox'=>$check);
-}
-
-function getSetConf($user, $key) {
- global $mm;
- $logged_in_user = $mm->getAuthObj($mm->isLoggedIn());
- $uid = $user->getUID();
- $post_key = $key."[$uid]";
- @$value = $_POST[$post_key];
- $editable = $user->canEdit();
- $edit = isset($_POST[$post_key]);
-
- switch ($key) {
- case 'auth_name':
- if ($editable && $edit) $user->setName($value);
- $value = $user->getName();
- break;
- case 'auth_user':
- $editable = $editable && $logged_in_user->isAdmin();
- if ($editable && $edit) $user->setUser($value=='true');
- $value = $user->isUser();
- break;
- case 'auth_admin':
- $editable = $editable && $logged_in_user->isAdmin();
- if ($editable && $edit) $user->setAdmin($value=='true');
- $value = $user->isAdmin();
- break;
- default:
- if ($editable && $edit) $user->setConf($key, $value);
- $value = $user->getConf($key);
- break;
- }
-
- return array(
- 'value'=>$value,
- 'post_key'=>$post_key,
- 'editable'=>$editable);
-}
-
-$attribs = array(attrib('auth_user', 'Active', true),
- attrib('lastname','Last'),
- attrib('firstname','First'),
- attrib('hsclass','Class of'),
- attrib('phone','Phone number'),
- attrib('email','Email'),
- attrib('auth_name', 'Username'),
- );
-
-////////////////////////////////////////////////////////////////////////////////
-
-$t = $mm->template();
-$mm->header('Users');
-
-$t->openTag('form', array('action'=>$mm->baseUrl().'users',
- 'method'=>'post'));
-
-$t->openTag('table');
-
-$t->openTag('tr');
-foreach ($attribs as $attrib) {
- $t->tag('th', array(), $attrib['name']);
-}
-$t->tag('th');
-$t->closeTag('tr');
-
-$uids = $mm->listUsers();
-foreach ($uids as $uid) {
- $user = $mm->getAuthObj($uid);
- $t->openTag('tr');
-
- foreach ($attribs as $attrib) {
- $props = getSetConf($user, $attrib['key']);
-
- $arr = array('name'=>$props['post_key']);
- if (!$props['editable']) {
- $arr['readonly'] = 'readonly';
- if ($attrib['checkbox']) $arr['disabled'] = $disabled;
- }
- if ($attrib['checkbox']) {
- if ($props['value'])
- $arr['checked'] = 'checked';
- $arr['value'] = 'true';
- $arr['type'] = 'checkbox';
- } else {
- $arr['value'] = $props['value'];
- $arr['type'] = 'text';
- }
-
- $t->openTag('td');
- $t->tag('input', $arr);
- $t->closeTag('td');
- }
-
- $t->openTag('td');
- $t->link($mm->baseUrl().'users/'.$user->getName(), 'More');
- $t->closeTag('td');
-
- $t->closeTag('tr');
-}
-
-$t->closeTag('table');
-
-$t->tag('input', array('type'=>'submit',
- 'value'=>'Save/Update'));
-$t->closeTag('form');
-
-$mm->footer(); \ No newline at end of file