<?php theme::header_start('Access', 'manage access attached to roles.'); theme::header_button_new(); theme::header_end(); theme::table_empty($records['records']); theme::table_tabs($records['records'], ['human' => true]); theme::table_tabs_start(); asort($records['records']); foreach ($records['records'] as $tab => $tab_records) { theme::table_tab_pane_start($tab); theme::table_start(['Name', 'Description', 'Key', 'Actions' => 'text-center']); uasort($tab_records, function ($a, $b) { return $a->name > $b->name ? 1 : -1; }); foreach ($tab_records as $record) { theme::table_start_tr(); o::e($record->name); theme::table_row(); o::e($record->description); theme::table_row(); o::e($record->key); theme::table_row('actions text-center'); if ($record->is_editable) { theme::table_action('edit', $this->controller_path . '/edit/' . $record->id); } if ($record->is_deletable) { o_dialog::confirm_a_delete($this->controller_path . '/delete/' . $record->id); } theme::table_action('list-ul', $this->controller_path . '/details/' . $record->id); theme::table_end_tr();
<?php $config = ENVIRONMENT ? 'Config "' . ENVIRONMENT . '"' : ''; theme::header_start('Settings', 'Manage application wide settings. ' . $config); theme::header_button_new(); theme::header_button('Built in', $controller_path . '/list-all', 'file'); theme::header_end(); theme::table_empty($records['records']); theme::table_tabs($records['records']); theme::table_tabs_start(); foreach ($records['records'] as $tab => $tab_records) { theme::table_tab_pane_start($tab); theme::table_start(['Name', 'Value', 'Managed' => 'text-center', 'Actions' => 'text-center']); /* show them in the order they where entered */ uasort($tab_records, function ($a, $b) { return $a->id > $b->id ? 1 : -1; }); foreach ($tab_records as $record) { theme::table_start_tr(); echo !$record->enabled ? '<i class="text-muted">' : ''; o::e($record->name); echo !$record->enabled ? '</i>' : ''; theme::table_row(); echo theme::format_value($record->value, 128); theme::table_row('larger text-center'); echo theme::enum_icon((int) $record->managed); theme::table_row('actions text-center'); if ($record->is_editable) { theme::table_action('edit', $this->controller_path . '/edit/' . $record->id); } if (has_access('orange::advanced settings')) {
theme::header_end(); o::hr(0, 12); theme::start_form_section('Role', true, 3); o::text('name', $record->name); theme::end_form_section(); theme::start_form_section('Description', 6); o::text('description', $record->description); theme::end_form_section(); theme::start_form_section('Access'); /* sort the tabs */ sort($access_tabs); /* sort all the entries by name - then when they are shown in tabs they are in order */ uasort($all_access, function ($a, $b) { return $a->name > $b->name ? 1 : -1; }); theme::table_tabs($records); theme::table_tabs_start(); echo '<ul id="tabs" class="nav nav-pills js-tabs" data-tabs="tabs">'; foreach ($access_tabs as $idx => $tab) { echo '<li><a href="#tab-' . md5($tab) . '" data-toggle="tab">' . $tab . '</a></li> '; } echo '</ul>'; echo '<div class="well" style="overflow: hidden">'; echo '<div id="my-tab-content" class="tab-content">'; foreach ($access_tabs as $idx => $tab) { echo '<div class="tab-pane" id="tab-' . md5($tab) . '" style="margin-top: -14px">'; foreach ($all_access as $access_record) { if ($access_record->group == $tab) { echo '<div style="padding: 2px 0">'; theme::checkbox('access[' . $access_record->id . ']', $access_record->id, array_key_exists($access_record->id, $access), ['text' => $access_record->name . ' <small class="text-info">' . $access_record->description . '</small>']); echo '</div>';