public function content() { global $STRINGS; if (empty($this->_data->intervals)) { return BootstrapHelper::alert('info', $STRINGS['event:noactivity'], $STRINGS['event:noactivityinterval:message']); } $intervals_list = '<table class="table inner-table">'; foreach ($this->_data->intervals as $interval) { $intervals_list .= '<tr> <td>' . $interval->h . 'h ' . $interval->i . 'm ' . $interval->s . 's</td> <td><span class="label label-success"> ' . date('G:i:s D M j Y', $interval->timestart) . ' </span></td> <td><span class="label label-important"> ' . date('G:i:s D M j Y', $interval->timestop) . ' </span></td> </tr>'; } $intervals_list .= '</table>'; $incidences_list = '<ul>'; foreach ($this->_data->incidences as $incidence) { $incidences_list .= '<li> <span class="label label-warning"> ' . date('G:i:s D M j Y', $incidence->timestamp) . ' </span> </li>'; } $incidences_list .= '</ul>'; return ' <section id="report-show" class="well"> <table class="table report-table"> <tr> <td><strong>' . $STRINGS['user'] . ' </strong></td> <td>' . $this->_data->user->firstname . ' ' . $this->_data->user->lastname . ' (<b>' . $this->_data->user->identifier . '</b>)</td> </tr> <tr> <td><strong>' . $STRINGS['issued'] . '</strong></td> <td>' . date("F j Y g:i a") . '</td> </tr> <tr> <td><strong>' . $STRINGS['period'] . ' </strong></td> <td>' . $this->_data->range->timestart . ' to ' . $this->_data->range->timeend . '</td> </tr> <tr> <td><strong>' . $STRINGS['intervals'] . ' </strong></td> <td>' . $intervals_list . '</td> </tr> <tr> <td><strong>' . $STRINGS['incidences'] . '</strong></td> <td>' . $incidences_list . '</td> </tr> <tr> <td><strong>' . $STRINGS['total'] . ' </strong></td> <td>' . $this->_data->range->total . '</td> </tr> </table> </section>'; }
/** * Contstructs the class with the given View and settings * Also merges $settings into the root $_options - useful for Entities that are 'disposable' (are created at run-time) * @param View $view * @param mixed $settings * @return BootstrapHelperEntity */ public function __construct(View $view, $settings = array()) { parent::__construct($view, $settings); $this->_view = $view; $this->_settings = $settings; #things passed to $settings can be used to seed $_options #useful for disposable entity classes if (!empty($settings) && is_array($settings)) { $this->mergeOptions(null, $settings); $this->_options = $settings; } return $this; }
public function content() { global $CONFIG, $STRINGS; $this->_data->week == date('W') ? $next = false : ($next = true); if (empty($this->_data->intervals)) { return BootstrapHelper::alert('info', Lang::get('event:noactivity'), Lang::get('event:noactivitythisweek:message')); } $intervals_list = '<table class="table inner-table">'; foreach ($this->_data->intervals as $interval) { $intervals_list .= '<tr> <td>' . $interval->d . 'd ' . $interval->h . 'h ' . $interval->i . 'm ' . $interval->s . 's</td> <td><span class="label label-success"> ' . date('G:i:s D M j Y', $interval->timestart) . ' </span></td> <td><span class="label label-important"> ' . date('G:i:s D M j Y', $interval->timestop) . ' </span></td> </tr>'; } $intervals_list .= '</table>'; $incidences_list = '<ul>'; foreach ($this->_data->incidences as $incidence) { $incidences_list .= '<li> <span class="label label-warning"> ' . date('G:i:s D M j Y', $incidence->timestamp) . ' </span> </li>'; } $incidences_list .= '</ul>'; $monday = date('d/m/Y', strtotime('Last Monday', mktime(1, 1, 1, 1, 7 * $this->_data->week, date('Y')))); $sunday = date('d/m/Y', strtotime('Next Sunday', mktime(1, 1, 1, 1, 7 * $this->_data->week, date('Y')))); return ' <section id="user-activity" class="well"> <div class="week-header"> <b>' . Lang::get('period') . '</b> ' . $monday . ' - ' . $sunday . ' </div> <table class="table report-table"> <tr> <td><strong>' . $STRINGS['intervals'] . ' </strong></td> <td>' . $intervals_list . '</td> </tr> <tr> <td><strong>' . $STRINGS['incidences'] . '</strong></td> <td>' . $incidences_list . '</td> </tr> </table> ' . MenuHelper::get_pagination_links($CONFIG->wwwroot . '/user/activity/', $this->_data->week, $next) . ' <div class="container"></div> </section>'; }
public function content() { global $CONFIG, $STRINGS; $users_table_content = ''; if (empty($this->_data->users)) { return BootstrapHelper::alert('info', $STRINGS['event:nousers'], $STRINGS['event:nouser:message']); } //check if there is a next page $this->_data->page + 1 < UserModel::pages() ? $next = true : ($next = false); foreach ($this->_data->users as $user) { $users_table_content .= ' <tr> <td>' . $user->id . '</td> <td>' . utf8_encode($user->firstname) . '</td> <td>' . utf8_encode($user->lastname) . '</td> <td>' . $user->role . '</td> <td>' . $user->position . '</td> <td><a href="' . $CONFIG->wwwroot . '/admin/users/' . $user->id . '/details">' . $user->identifier . '</a></td> </tr> '; } return ' <section id="users" class="well"> <table class="table"> <thead> <tr> <th>#</th> <th>' . $STRINGS['firstname'] . '</th> <th>' . $STRINGS['lastname'] . '</th> <th>' . $STRINGS['role'] . '</th> <th>' . $STRINGS['position'] . '</th> <th>' . $STRINGS['identifier'] . '</th> </tr> </thead> <tbody> ' . $users_table_content . ' </tbody> </table> <form action="' . $CONFIG->wwwroot . '/admin/users/new/add" method="post"> <button class="btn btn-success ">+ ' . $STRINGS['add:user'] . '</button> ' . MenuHelper::get_pagination_links($CONFIG->wwwroot . '/admin/users/', $this->_data->page, $next) . ' </form> </section>'; }
public function content() { global $CONFIG; if (empty($this->_data->activity)) { return BootstrapHelper::alert('info', Lang::get('event:noactivity'), Lang::get('event:noactivity:message')); } //check if there is a next page (page count starts at 0 thus the +1) $this->_data->page + 1 < ActivityModel::pages() ? $next = true : ($next = false); $activity_table_content = ''; foreach ($this->_data->activity as $entry) { $activity_table_content .= '<tr> <td>' . $entry->id . '</td> <td><span class="label ' . BootstrapHelper::get_label_for_action($entry->action) . '">' . BootstrapHelper::get_event_description($entry->action) . '</span></td> <td>' . Lang::get('dayofweek' . date('N', $entry->timestamp)) . '</td> <td>' . date('d/m/Y', $entry->timestamp) . '</td> <td>' . date('G:i:s', $entry->timestamp) . '</td> <td>' . utf8_encode($entry->firstname) . '</td> <td>' . utf8_encode($entry->lastname) . '</td> <td><a href="' . $CONFIG->wwwroot . '/admin/users/' . $entry->userid . '/details">' . $entry->identifier . '</a></td> </tr> '; } return ' <section id="activity" class="well"> <table class="table"> <thead> <tr> <th>#</th> <th>' . Lang::get('action') . '</th> <th>' . Lang::get('day') . '</th> <th>' . Lang::get('date') . '</th> <th>' . Lang::get('time') . '</th> <th>' . Lang::get('firstname') . '</th> <th>' . Lang::get('lastname') . '</th> <th>' . Lang::get('identifier') . '</th> </tr> </thead> <tbody>' . $activity_table_content . ' </tbody> </table> ' . MenuHelper::get_pagination_links($CONFIG->wwwroot . '/admin/activity/', $this->_data->page, $next) . ' <div class="container"></div> </section>'; }
/** * Updates the user data * * @global type $STRINGS * @param type $params */ public function profile_update($params) { global $STRINGS; $userid = array_shift($params); //remove url params $params = array_slice($params, 1); //check if the password is set if (empty($params['password'])) { //no password is provided -> remove key unset($params['password']); } else { //compute new password and store $params['password'] = sha1($params['password']); } $success = UserModel::update($userid, $params); $success == true ? $alert = BootstrapHelper::alert('success', $STRINGS['event:success'], $STRINGS['user:update:success']) : ($alert = BootstrapHelper::alert('error', $STRINGS['event:error'], $STRINGS['user:update:failed'])); //refresh the user data $this->_data->user = UserModel::find($userid); new UserProfileView($this->_data, $alert); }
/** * Builds a report using the passed parameters, and displays the result * using the report show view * * @param Array $params */ public function report_build($params) { global $STRINGS; $formdata = (object) $params; $this->_data->user = UserModel::find($formdata->user); $this->_data->range = IntervalModel::get_range_total($formdata); $this->_data->intervals = IntervalModel::get_between($formdata); $this->_data->incidences = ActivityModel::find_all_incidences($formdata->user); //check if the report is not empty if (empty($this->_data->range->total) && empty($this->_data->intervals) && empty($this->_data->incidences)) { $alert = BootstrapHelper::alert('info', $STRINGS['event:noactivity'], $STRINGS['event:noactivityinterval:message']); new AdminReportView(UserModel::find_all(), $alert); } else { new AdminReportShowView($this->_data); } }
<?php require_once '../public/themes/bootstrap/php/helper.php'; $t = $this; # templater object $helper = new BootstrapHelper(); ?> <div role="navigation" class="navbar navbar-inverse navbar-static-top"> <div class="container"> <div class="navbar-header"> <button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="/" class="navbar-brand">Neechy</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <!-- TODO: dynamically build menu <li class="<?php echo $t->nav_tab_class('Niches'); ?> "> <?php echo $t->neechy_link('Niches'); ?>