public function __viewIndex()
 {
     // Add in custom assets
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/sections_event/assets/sections_event.permissions_index.css', 'screen', 111);
     $this->setPageType('table');
     $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), __('Section permissions'))));
     $this->appendSubheading(__('Section permissions'));
     // check if roles exist
     $roles = RoleManager::fetch();
     if (!is_array($roles) || empty($roles)) {
         return $this->Form->appendChild($this->buildErrorMessage(__('No roles found. <a href="%s">Add a new one?</a>', array(extension_Members::baseURL() . 'roles/new/'))));
     }
     // build table
     $aTableHead = array(array(__('Member role'), 'col'));
     $aTableBody = array();
     foreach ($roles as $role) {
         // Setup each cell
         $td1 = Widget::TableData(Widget::Anchor($role->get('name'), Administration::instance()->getCurrentPageURL() . 'edit/' . $role->get('id') . '/', null, 'content'));
         // Add cells to a row
         $aTableBody[] = Widget::TableRow(array($td1));
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), null, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
 }
예제 #2
0
 public function __actionDelete($role_id = null, $redirect = null, $purge_members = false)
 {
     if (array_key_exists('delete', $_POST['action'])) {
         if (!$role_id) {
             redirect(extension_Members::baseURL() . 'roles/');
         }
         if ($role_id == Role::PUBLIC_ROLE) {
             return $this->pageAlert(__('The Public role cannot be removed'), Alert::ERROR);
         }
         if (!($existing = RoleManager::fetch($role_id))) {
             throw new SymphonyErrorPage(__('The role you requested to delete does not exist.'), __('Role not found'));
         }
         // @todo What should happen to any Members that had this Role?
         RoleManager::delete($role_id, $purge_members);
         if (!is_null($redirect)) {
             redirect($redirect);
         }
     }
 }