<div class="topbar"> <div class="topbar-inner"> <div class="container-fluid"> <a class="brand" href="index.php">Tattle </a> <ul class="nav"> <? $current_url = fURL::getWithQueryString(); echo '<li' . ($current_url == '' ? ' class="active"' : '') . '><a href="index.php">Alerts</a></li>'. "\n"; $check_list = Check::makeURL('list'); echo '<li' . ($current_url == $check_list ? ' class="active"' : '') . '><a href="' . $check_list . '" >Checks</a></li>' . "\n"; $subscription_list = Subscription::makeURL('list'); echo '<li' . ($current_url == $subscription_list ? ' class="active"' : '') .'><a href="' . $subscription_list . '" >Subscriptions</a></li>' . "\n"; $dashboard_list = Dashboard::makeURL('list'); echo '<li' . ($current_url == $dashboard_list ? ' class="active"' : '') . '><a href="' . $dashboard_list . '">Dashboards</a></li>'; $setting_list = Setting::makeURL('list'); echo '<li' . ($current_url == $setting_list ? ' class="active"' : '') . '><a href="' . $setting_list . '" >Settings</a></li>' . "\n"; if (fAuthorization::checkAuthLevel('admin')) { $user_list = User::makeURL('list'); echo '<li><a href="' . User::makeURL('list') . '" >Users</a></li>'; } ?> </ul> <?php if (is_numeric(fSession::get('user_id'))) { ?> <p class="pull-right"> Logged in as <a href="<?php echo User::makeUrl('edit', fSession::get('user_id')); ?> "><?php
$first = TRUE; foreach ($list_plugin_settings as $setting_name => $setting) { ?> <tr> <td><?=$setting['friendly_name']; ?></td> <td><?=(isset($setting['value']) ? $setting['value'] : 'Default'); ?></td> <td><?=$setting['default']; ?></td> <td><?php if (!isset($owner_id)) { $owner_id = NULL; } if (isset($setting['value'])) { echo '<a href="' . Setting::makeURL('edit',$setting_type,$setting_name,$owner_id) . '">Update</a> | '; echo '<a href="' . Setting::makeURL('delete',$setting_type,$setting_name,$owner_id) . '">Delete</a>'; } else { echo '<a href="' . Setting::makeURL('add',$setting_type,$setting_name,$owner_id) . '">Override</a>'; } ?> </td> </tr> <?php } ?> </tbody></table> <? } catch (fEmptySetException $e) { ?> <p class="info">No settings? uh-oh</p> <?php } ?> </div> <?php $tmpl->place('footer') ?>
$current_url = '?' . fURL::getQueryString(); echo '<li' . (fURL::is_menu_active('index') ? ' class="active"' : '') . '><a href="index.php">Alerts</a></li>' . "\n"; $threshold_check_list = Check::makeURL('list', 'threshold'); echo '<li' . (fURL::is_menu_active('check', 'type=threshold') ? ' class="active"' : '') . '><a href="' . $threshold_check_list . '" >Threshold Checks</a></li>' . "\n"; $predictive_check_list = Check::makeURL('list', 'predictive'); echo '<li' . (fURL::is_menu_active('check', 'type=predictive') ? ' class="active"' : '') . '><a href="' . $predictive_check_list . '" >Predictive Checks</a></li>' . "\n"; $subscription_list = Subscription::makeURL('list'); echo '<li' . (fURL::is_menu_active('subscription') ? ' class="active"' : '') . '><a href="' . $subscription_list . '" >Subscriptions</a></li>' . "\n"; $dashboard_list = Dashboard::makeURL('list'); echo '<li' . (fURL::is_menu_active('dashboard') ? ' class="active"' : '') . '><a href="' . $dashboard_list . '">Dashboards</a></li>'; $group_list = Group::makeURL('list'); echo '<li' . (fURL::is_menu_active('group') ? ' class="active"' : '') . '><a href="' . $group_list . '">Groups</a></li>'; $setting_list = Setting::makeURL('list', 'user'); echo '<li' . (fURL::is_menu_active('setting', 'type=user') ? ' class="active"' : '') . '><a href="' . $setting_list . '" >Settings</a></li>' . "\n"; if (fAuthorization::checkAuthLevel('admin')) { $setting_list = Setting::makeURL('list', 'system'); echo '<li' . (fURL::is_menu_active('setting', 'type=system') ? ' class="active"' : '') . '><a href="' . $setting_list . '" >System Settings</a></li>' . "\n"; $user_list = User::makeURL('list'); echo '<li' . (fURL::is_menu_active('user') ? ' class="active"' : '') . '><a href="' . User::makeURL('list') . '" >Users</a></li>'; } ?> </ul> <?php if (is_numeric(fSession::get('user_id'))) { ?> <p class="navbar-text navbar-right"> <a href="<?php echo User::makeUrl('edit', fSession::get('user_id')); ?> "> <span style="color:white;">Logged in as</span>
fURL::redirect(Setting::makeUrl('list')); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/delete.php'; // --------------------------------- // } elseif ('edit' == $action) { try { $setting = new Setting(array('name' => $setting_name, 'owner_id' => $owner_id)); if (fRequest::isPost()) { $setting->populate(); fRequest::validateCSRFToken(fRequest::get('token')); $setting->store(); fMessaging::create('affected', fURL::get(), $setting->getFriendlyName()); fMessaging::create('success', fURL::get(), 'The setting ' . $setting->getFriendlyName() . ' was successfully updated'); fURL::redirect(Setting::makeURL('list', $setting_type, NULL, $owner_id)); } } catch (fNotFoundException $e) { fMessaging::create('error', fURL::get(), 'The Setting requested, ' . fHTML::encode($setting_name) . ', could not be found'); fURL::redirect(Setting::makeUrl('list')); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/add_edit_setting.php'; // --------------------------------- // } elseif ('add' == $action) { $setting = new Setting(); if ('user' == $setting_type) { $list_plugin_settings = $plugin_user_settings; } else { $list_plugin_settings = $plugin_settings;
<thead> <tr> <th>Username</th> <th>Email</th> <th>Action</th> </tr></thead><tbody> <?php $first = TRUE; foreach ($users as $user) { ?> <tr> <td><?=$user->prepareUsername(); ?></td> <td><?=$user->prepareEmail(); ?></td> <td><?php if (fSession::get('user_id') == $user->getUserId() || fAuthorization::checkAuthLevel('admin')) { echo '<a href="' . User::makeUrl('edit',$user) . '">Edit</a> | '; echo '<a href="' . Setting::makeURL('list','user',NULL,$user->getUserId()) . '">Settings</a>'; } ?> <?php if (fAuthorization::checkAuthLevel('admin') && $user->getUserId() != 1) { ?> <a href="<?=User::makeUrl('delete',$user); ?>">Delete</a></td> <?php } ?> </tr> <?php } ?> </tbody></table> <? } catch (fEmptySetException $e) { ?> <p class="info">There are currently no Tattle users? <a href="<?=User::makeUrl('add'); ?>">Add one now</a></p> <?php } ?> </div>
<?php $page_title = $action == 'add' ? 'Override setting' : 'Edit Setting'; $tmpl->set('title', $page_title); $breadcrumbs[] = array('name' => 'Settings', 'url' => Setting::makeURL('list'), 'active' => false); $breadcrumbs[] = array('name' => $page_title, 'url' => '?' . fURL::getQueryString(), 'active' => true); //$tmpl->set('breadcrumbs',$breadcrumbs); $tmpl->place('header'); $query_string = ''; if (isset($setting_name)) { $query_string = "&setting_name={$setting_name}"; } if (isset($user_id)) { $query_string .= "&user_id={$user_id}"; } if (isset($setting_type)) { $query_string .= "&setting_type={$setting_type}"; } ?> <div class="row"> <div class="col-md-6"> <form action="?action=<?php echo $action . $query_string; ?> " method="post" class="form-horizontal"> <div class="form-group"> <label for="line-friendly_name" class="col-sm-2 control-label">Name<em>*</em></label> <div class="col-sm-10"> <?php echo $setting->encodeFriendlyName(); ?>