<?php if (!$this->get('full_screen')) { ?> <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">
?> <i class="glyphicon glyphicon-warning-sign" style="margin-right:3px"></i><span>Disabled</span> <?php } else { ?> <i class="glyphicon glyphicon-" style="margin-right:3px"></i><span>Enabled</span> <?php } ?> </td> <td><a href="<?php echo Subscription::makeURL('edit', $subscription); ?> ">Edit</a> | <a href="<?php echo Subscription::makeURL('delete', $subscription); ?> ">Delete</a></td> </tr> <?php } ?> </tbody></table> <?php //check to see if paging is needed $total_pages = ceil($subscriptions->count(TRUE) / $GLOBALS['PAGE_SIZE']); if ($total_pages > 1) { $prev_class = 'previous'; $prev_link = fURL::replaceInQueryString('page', $page_num - 1); $next_class = 'next'; $next_link = fURL::replaceInQueryString('page', $page_num + 1);
</td> <td><?php echo $over_under_array[$check->getOver_Under()]; ?> </td> <td><?php echo $visibility_array[$check->getVisibility()]; ?> </td> <td><?php if (fSession::get('user_id') == $check->getUserId()) { echo '<a href="' . Check::makeURL('edit', $check_type, $check) . '">Edit</a> |'; } ?> <a href="<?php echo Subscription::makeURL('add', $check); ?> ">Subscribe</a></td> </tr> <?php } ?> </tbody> </table> </div> <?php } catch (fEmptySetException $e) { ?> <div class="info"> There are currently no <?php echo $check_type;
$first = TRUE; foreach ($checks as $check) { ?> <tr> <td><?='<a href="' . CheckResult::makeUrl('list',$check) . '">' . $check->prepareName(); ?></a></td> <td><?=$check->prepareTarget(); ?></td> <td><?=$check->prepareWarn(); ?></td> <td><?=$check->prepareError(); ?></td> <td><?=$check->prepareSample(); ?></td> <td><?=$check->prepareBaseline(); ?></td> <td><?=$over_under_array[$check->getOver_Under()]; ?></td> <td><?=$visibility_array[$check->getVisibility()]; ?></td> <td><?php if (fSession::get('user_id') == $check->getUserId()) { echo '<a href="' . Check::makeURL('edit', $check) . '">Edit</a> |'; } ?> <a href="<?=Subscription::makeURL('add', $check); ?>">Subscribe</a></td> </tr> <?php } ?> </tbody></table> <? //check to see if paging is needed $total_pages = ceil($checks->count(TRUE) / $GLOBALS['PAGE_SIZE']); if ($total_pages > 1) { $prev_class = 'previous'; $prev_link = fURL::get() . '?page=' . ($page_num - 1); $next_class = 'next'; $next_link = fURL::get() . '?page=' . ($page_num + 1); if ($page_num == 1) { $prev_class .= ' disabled'; $prev_link = '#'; } elseif ($page_num == $total_pages) {
<th>Method</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $first = TRUE; foreach ($subscriptions as $subscription) { $check = $subscription->createCheck(); ?> <tr> <td><?php echo $check->prepareName() ?></td> <td><?php echo $status_array[$subscription->prepareThreshold()] ?></td> <td><?php echo $subscription->prepareMethod() ?></td> <td><?php echo ($subscription->getStatus() ? 'Disabled' : 'Enabled') ?></td> <td><a href="<?php echo Subscription::makeURL('edit', $subscription) ?>">Edit</a> | <a href="<?php echo Subscription::makeURL('delete', $subscription) ?>">Delete</a></td> </tr> <?php } ?> </tbody></table> <? } catch (fEmptySetException $e) { ?> <p class="info">There are currently no Tattle check subscriptions for your account. <a href="<?php echo Check::makeURL('list') ?>">Add one now</a></p> <?php } ?> </div> <?php $tmpl->place('footer') ?>
<?php include 'inc/init.php'; fAuthorization::requireLoggedIn(); $breadcrumbs[] = array('name' => 'Subscription', 'url' => Subscription::makeURL('list'), 'active' => true); $action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete')); $sort = fCRUD::getSortColumn(array('name', 'status', 'method', 'state')); $sort_order = fCRUD::getSortDirection('asc'); $subscription_id = fRequest::get('subscription_id', 'integer'); $check_id = fRequest::get('check_id', 'integer'); $manage_url = $_SERVER['SCRIPT_NAME']; // --------------------------------- // if ('delete' == $action) { $class_name = 'Subscription'; try { $obj = new Subscription($subscription_id); $check = new Check($obj->getCheckId()); $delete_text = 'Are you sure you want to delete your subscription to <strong>' . $check->getName() . '</strong>?'; if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); $obj->delete(); fMessaging::create('success', $manage_url, 'The subscription for ' . $check->getName() . ' was successfully deleted'); fURL::redirect($manage_url); } } catch (fNotFoundException $e) { fMessaging::create('error', $manage_url, 'The subscription requested, ' . fHTML::encode($date) . ', could not be found'); fURL::redirect($manage_url); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/delete.php';
$tmpl->set('title', 'Delete Subscription'); $tmpl->place('header'); ?> <form action="<?php echo Subscription::makeURL('delete', $subscription); ?> " method="post"> <div class="main" id="main"> <div class="warning">Are you sure you want to delete the subscription to this check <strong><?php echo $check->prepareName(); ?> </strong>? </div> <div class="actions"> <input class="btn danger" type="submit" value="Yes, delete this subscription" /> <a class="btn" href="<?php echo Subscription::makeURL('list'); ?> ">No, please keep it</a> <input type="hidden" name="token" value="<?php echo fRequest::generateCSRFToken(); ?> " /> </div> </div> </form> <?php $tmpl->place('footer');
<?php $first = TRUE; foreach ($checks as $check) { ?> <tr> <td><?php echo '<a href="' . CheckResult::makeUrl('list',$check) . '">' . $check->prepareName() ?></a></td> <td><?php echo $check->prepareTarget() ?></td> <td><?php echo $check->prepareWarn() ?></td> <td><?php echo $check->prepareError() ?></td> <td><?php echo $check->prepareSample() ?></td> <td><?php echo $check->prepareBaseline() ?></td> <td><?php echo $over_under_array[$check->getOver_Under()] ?></td> <td><?php echo $visibility_array[$check->getVisibility()] ?></td> <td><?php if (fSession::get('user_id') == $check->getUserId()) { echo '<a href="' . Check::makeURL('edit', $check) . '">Edit</a> |'; } ?> <a href="<?php echo Subscription::makeURL('add', $check) ?>">Subscribe</a></td> </tr> <?php } ?> </tbody></table> <? } catch (fEmptySetException $e) { ?> <p class="info">There are currently no Tattle checks. <a href="<?php echo Check::makeURL('add') ?>">Add one now</a></p> <?php } ?> </div> <?php $tmpl->place('footer') ?>