summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-10-09 14:58:30 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-10-09 14:58:30 -0400
commit710942016b2a363f1301259dac01410188707d85 (patch)
tree9b825119ff3b7910a5a9d819178a7f345f426a8c /src/views
parent01003f1761631394360697530d3418c1acaf1cd9 (diff)
Change users/index.html a bit depending on if logged in or not.
Diffstat (limited to 'src/views')
-rw-r--r--src/views/pages/users/index.html.php58
1 files changed, 30 insertions, 28 deletions
diff --git a/src/views/pages/users/index.html.php b/src/views/pages/users/index.html.php
index daed9f7..d004c54 100644
--- a/src/views/pages/users/index.html.php
+++ b/src/views/pages/users/index.html.php
@@ -2,6 +2,7 @@
$t = $VARS['template'];
$attribs = $VARS['attribs'];
$users = $VARS['users'];
+require_once('Login.class.php');
$t->header('Users');
@@ -10,35 +11,34 @@ $t->paragraph($t->link($t->url('users.csv'), "Download this as a spreadsheet."))
$t->openTag('form', array('action'=>$t->url('users/index'),
'method'=>'post'));
-$t->tag('input', array('type'=>'submit',
- 'value'=>'Save/Update'));
+if (Login::isLoggedIn()) {
+ $t->tag('input', array('type'=>'submit',
+ 'value'=>'Save/Update'));
+}
$t->openTag('table', array('class'=>'sortable', 'id'=>'bar'));
-$t->openTag('thead');
-$t->openTag('tr');
-foreach ($attribs as $attrib) {
- switch ($attrib['type']) {
- case 'bool': $class = 'small'; break;
- default: $class = ''; break;
+function table_head($attribs, $t) {
+ $t->openTag('tr');
+ foreach ($attribs as $attrib) {
+ switch ($attrib['type']) {
+ case 'bool': $class = 'small'; break;
+ default: $class = ''; break;
+ }
+ $t->tag('th', array('class'=>$class), $attrib['name']);
+ }
+ if (Login::isLoggedIn()) {
+ $t->tag('th', array(), '-');
}
- $t->tag('th', array('class'=>$class), $attrib['name']);
+ $t->closeTag('tr');
}
-$t->tag('th', array(), '-');
-$t->closeTag('tr');
+
+$t->openTag('thead');
+table_head($attribs, $t);
$t->closeTag('thead');
$t->openTag('tfoot');
-$t->openTag('tr');
-foreach ($attribs as $attrib) {
- switch ($attrib['type']) {
- case 'bool': $class = 'small'; break;
- default: $class = ''; break;
- }
- $t->tag('th', array('class'=>$class), $attrib['name']);
-}
-$t->tag('th', array(), '-');
-$t->closeTag('tr');
+table_head($attribs, $t);
$t->closeTag('tfoot');
$t->openTag('tbody');
@@ -85,18 +85,20 @@ foreach ($users as $user) {
$t->closeTag('td');
}
- $t->openTag('td');
- $t->link($t->url('users/'.$user['auth_name']['value']), 'More');
- $t->closeTag('td');
-
+ if (Login::isLoggedIn()) {
+ $t->openTag('td');
+ $t->link($t->url('users/'.$user['auth_name']['value']), 'More');
+ $t->closeTag('td');
+ }
$t->closeTag('tr');
}
$t->closeTag('tbody');
$t->closeTag('table');
-$t->tag('input', array('type'=>'submit',
- 'value'=>'Save/Update'));
-$t->closeTag('form');
+if (Login::isLoggedIn()) {
+ $t->tag('input', array('type'=>'submit',
+ 'value'=>'Save/Update'));
+}
$t->footer();