예제 #1
1
 function action()
 {
     if (isset($_POST['action']['save'])) {
         $fields = $_POST['fields'];
         $permissions = $fields['permissions'];
         $name = trim($fields['name']);
         $page_access = $fields['page_access'];
         if (strlen($name) == 0) {
             $this->_errors['name'] = 'This is a required field';
             return;
         } elseif ($this->_driver->roleExists($name)) {
             $this->_errors['name'] = 'A role with the name <code>' . $name . '</code> already exists.';
             return;
         }
         $sql = "INSERT INTO `tbl_members_roles` VALUES (NULL, \n\t\t\t\t\t\t\t\t\t\t\t\t'{$name}', \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_subject'])) > 0 ? "'" . addslashes($fields['email_subject']) . "'" : 'NULL') . ", \n\t\t\t\t\t\t\t\t\t\t\t\t" . (strlen(trim($fields['email_body'])) > 0 ? "'" . addslashes($fields['email_body']) . "'" : 'NULL') . ")";
         $this->_Parent->Database->query($sql);
         $role_id = $this->_Parent->Database->getInsertID();
         if (is_array($page_access) && !empty($page_access)) {
             foreach ($page_access as $page_id) {
                 $this->_Parent->Database->query("INSERT INTO `tbl_members_roles_page_permissions` VALUES (NULL, {$role_id}, {$page_id}, 'yes')");
             }
         }
         if (is_array($permissions) && !empty($permissions)) {
             $sql = "INSERT INTO `tbl_members_roles_event_permissions` VALUES ";
             foreach ($permissions as $event_handle => $p) {
                 foreach ($p as $action => $allow) {
                     $sql .= "(NULL,  {$role_id}, '{$event_handle}', '{$action}', '{$allow}'),";
                 }
             }
             $this->_Parent->Database->query(trim($sql, ','));
         }
         redirect(extension_members::baseURL() . 'edit/' . $role_id . '/created/');
     }
 }
 function view()
 {
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
     $create_button = Widget::Anchor('Create a New Role', extension_members::baseURL() . 'new/', 'Create a new role', 'create button');
     $this->setPageType('table');
     $this->appendSubheading('Member Roles ' . $create_button->generate(false));
     $aTableHead = array(array('Name', 'col'), array('Members', 'col'));
     $roles = $this->_driver->fetchRoles();
     $aTableBody = array();
     if (!is_array($roles) || empty($roles)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $sectionManager = new SectionManager($this->_Parent);
         $section = $sectionManager->fetch($this->_Parent->Database->fetchVar('parent_section', 0, "SELECT `parent_section` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->usernameAndPasswordField() . "' LIMIT 1"));
         $bEven = true;
         $role_field_name = $this->_Parent->Database->fetchVar('element_name', 0, "SELECT `element_name` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->roleField() . "' LIMIT 1");
         foreach ($roles as $role) {
             $member_count = $this->_Parent->Database->fetchVar('count', 0, "SELECT COUNT(*) AS `count` FROM `tbl_entries_data_" . $this->_driver->roleField() . "` WHERE `role_id` = '" . $role->id() . "'");
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($role->name(), extension_members::baseURL() . 'edit/' . $role->id() . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$member_count}", URL . '/symphony/publish/' . $section->get('handle') . '/?filter=' . $role_field_name . ':' . $role->id()));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2), $bEven ? 'odd' : NULL);
             $bEven = !$bEven;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
 }
예제 #3
0
 public function action()
 {
     if (isset($_POST['action']['save'])) {
         $fields = $_POST['fields'];
         $permissions = $fields['permissions'];
         $name = trim($fields['name']);
         $page_access = $fields['page_access'];
         if (strlen($name) == 0) {
             $this->_errors['name'] = __('This is a required field');
             return;
         } elseif ($this->_driver->roleExists($name)) {
             $this->_errors['name'] = __('A role with the name <code>%s</code> already exists.', array($name));
             return;
         }
         ASDCLoader::instance()->query("INSERT INTO `tbl_members_roles` VALUES (NULL, '{$name}')");
         $role_id = ASDCLoader::instance()->lastInsertID();
         if (is_array($page_access) && !empty($page_access)) {
             foreach ($page_access as $page_id) {
                 ASDCLoader::instance()->query("INSERT INTO `tbl_members_roles_forbidden_pages` VALUES (NULL, {$role_id}, {$page_id})");
             }
         }
         if (is_array($permissions) && !empty($permissions)) {
             $sql = "INSERT INTO `tbl_members_roles_event_permissions` VALUES ";
             foreach ($permissions as $event_handle => $p) {
                 foreach ($p as $action => $level) {
                     $sql .= "(NULL,  {$role_id}, '{$event_handle}', '{$action}', '{$level}'),";
                 }
             }
             Symphony::Database()->query(trim($sql, ','));
         }
         redirect(extension_members::baseURL() . 'roles_edit/' . $role_id . '/created/');
     }
 }
예제 #4
0
 public function view()
 {
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9126341);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/scripts.js', 9126342);
     $create_button = Widget::Anchor(__('Create a new role'), extension_members::baseURL() . 'roles_new/', __('Create a new role'), 'create button');
     $this->setPageType('table');
     $this->appendSubheading(__('Member Roles ') . $create_button->generate(false));
     $aTableHead = array(array(__('Name'), 'col'), array(__('Members'), 'col'));
     $roles = $this->_driver->fetchRoles();
     $aTableBody = array();
     if (!is_array($roles) || empty($roles)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } elseif (is_null(extension_members::memberSectionID())) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('No Member section has been specified in <a href="' . URL . '/symphony/extension/members/setup/">Member Setup</a>. Please do this first.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $sectionManager = new SectionManager($this->_Parent);
         $section = $sectionManager->fetch($this->_driver->memberSectionID());
         $bEven = true;
         $role_field_name = Symphony::Database()->fetchVar('element_name', 0, "SELECT `element_name` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->roleField() . "' LIMIT 1");
         $with_selected_roles = array();
         foreach ($roles as $role) {
             $member_count = Symphony::Database()->fetchVar('count', 0, "SELECT COUNT(*) AS `count` FROM `tbl_entries_data_" . $this->_driver->roleField() . "` WHERE `role_id` = '" . $role->id() . "'");
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($role->name(), extension_members::baseURL() . 'roles_edit/' . $role->id() . '/', NULL, 'content'));
             if (extension_Members::GUEST_ROLE_ID == $role->id()) {
                 $td2 = Widget::TableData(__('N/A'), 'inactive');
             } else {
                 $td2 = Widget::TableData(Widget::Anchor("{$member_count}", URL . '/symphony/publish/' . $section->get('handle') . '/?filter=' . $role_field_name . ':' . $role->id()));
             }
             if (!in_array($role->id(), array(extension_Members::GUEST_ROLE_ID, extension_Members::INACTIVE_ROLE_ID))) {
                 $td2->appendChild(Widget::Input("items[" . $role->id() . "]", null, 'checkbox'));
             }
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2), $bEven ? 'odd' : NULL);
             if ($role->id() != extension_Members::GUEST_ROLE_ID) {
                 $with_selected_roles[] = array("move::" . $role->id(), false, $role->name());
             }
             $bEven = !$bEven;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), 2 => array('delete-members', false, __('Delete Members')), array('delete', false, __('Delete')));
     if (count($with_selected_roles) > 0) {
         $options[1] = array('label' => __('Move Members To'), 'options' => $with_selected_roles);
     }
     ksort($options);
     $tableActions->appendChild(Widget::Select('with-selected', $options, array('id' => 'with-selected')));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
 public function action()
 {
     if (isset($_POST['action']['save'])) {
         $fields = $_POST['fields'];
         $et = new EmailTemplate();
         $et->subject = $fields['subject'];
         $et->type = $fields['type'];
         $et->body = $fields['body'];
         if (isset($fields['roles']) && strlen(trim($fields['roles'])) > 0) {
             $roles = preg_split('/\\s*,\\s*/i', $fields['roles'], -1, PREG_SPLIT_NO_EMPTY);
             foreach ($roles as $r) {
                 $et->addRoleFromName($r);
             }
         }
         EmailTemplate::save($et);
         redirect(extension_members::baseURL() . 'email_templates_edit/' . $et->id . '/created/');
     }
 }
 public function view()
 {
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9126341);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/scripts.js', 9126342);
     $create_button = Widget::Anchor('Create a new email template', extension_members::baseURL() . 'email_templates_new/', 'Create a new email template', 'create button');
     $this->setPageType('table');
     $this->appendSubheading('Email Templates ' . $create_button->generate(false));
     $aTableHead = array(array('Subject', 'col'), array('Type', 'col'), array('Roles', 'col'));
     $iterator = new EmailTemplateIterator();
     $aTableBody = array();
     if ($iterator->length() == 0) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $bEven = true;
         foreach ($iterator as $e) {
             $td1 = Widget::TableData(Widget::Anchor($e->subject, extension_members::baseURL() . 'email_templates_edit/' . $e->id . '/', NULL, 'content'));
             $td2 = Widget::TableData($e->type);
             if (count($e->roles()) > 0) {
                 $links = array();
                 foreach ($e->roles() as $role_id => $r) {
                     $links[] = Widget::Anchor($r->name(), extension_members::baseURL() . 'roles_edit/' . $r->id() . '/', 'Edit this role.')->generate();
                 }
                 $td3 = Widget::TableData(implode(', ', $links));
             } else {
                 $td3 = Widget::TableData('None', 'inactive');
             }
             $td3->appendChild(Widget::Input("items[{$e->id}]", null, 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), $bEven ? 'odd' : NULL);
             $bEven = !$bEven;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options, array('id' => 'with-selected')));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
예제 #7
0
 function view()
 {
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
     $create_button = Widget::Anchor('Create a New Role', extension_members::baseURL() . 'new/', 'Create a new role', 'create button');
     $this->setPageType('table');
     $this->appendSubheading('Member Roles ' . $create_button->generate(false));
     $aTableHead = array(array('Name', 'col'), array('Members', 'col'));
     $roles = $this->_driver->fetchRoles();
     $aTableBody = array();
     if (!is_array($roles) || empty($roles)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } elseif (!$this->_driver->memberSectionID()) {
         $this->pageAlert(__('You must set a section in <a href="%1$s">Member Preferences?</a>', array(extension_members::baseURL() . 'preferences/')), Alert::ERROR);
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None Found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $sectionManager = new SectionManager($this->_Parent);
         $section = $sectionManager->fetch($this->_Parent->Database->fetchVar('parent_section', 0, "SELECT `parent_section` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->usernameAndPasswordField() . "' LIMIT 1"));
         $bEven = true;
         $role_field_name = $this->_Parent->Database->fetchVar('element_name', 0, "SELECT `element_name` FROM `tbl_fields` WHERE `id` = '" . $this->_driver->roleField() . "' LIMIT 1");
         foreach ($roles as $role) {
             $member_count = $this->_Parent->Database->fetchVar('count', 0, "SELECT COUNT(*) AS `count` FROM `tbl_entries_data_" . $this->_driver->roleField() . "` WHERE `role_id` = '" . $role->id() . "'");
             ## Setup each cell
             $td1 = Widget::TableData(Widget::Anchor($role->name(), extension_members::baseURL() . 'edit/' . $role->id() . '/', NULL, 'content'));
             $td2 = Widget::TableData(Widget::Anchor("{$member_count}", URL . '/symphony/publish/' . $section->get('handle') . '/?filter=' . $role_field_name . ':' . $role->id()));
             $td2->appendChild(Widget::Input("items[" . $role->id() . "]", null, 'checkbox'));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2), $bEven ? 'odd' : NULL);
             $bEven = !$bEven;
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody));
     $this->Form->appendChild($table);
     $tableActions = new XMLElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete-members', false, __('Delete Members')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
예제 #8
0
 public function view()
 {
     $sectionManager = new SectionManager(Administration::instance());
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
     $this->appendSubheading('Setup');
     $bIsWritable = true;
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if (!is_writable(CONFIG)) {
         $this->pageAlert('The Symphony configuration file, <code>/manifest/config.php</code>, is not writable. You will not be able to save changes to preferences.', AdministrationPage::PAGE_ALERT_ERROR);
         $bIsWritable = false;
     } elseif ($formHasErrors) {
         $this->pageAlert('An error occurred while processing this form. <a href="#error">See below for details.</a>', AdministrationPage::PAGE_ALERT_ERROR);
     }
     if (!is_null(extension_members::memberSectionID())) {
         $member_section = $sectionManager->fetch(extension_members::memberSectionID());
     }
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Instructions'));
     $p = new XMLElement('p', 'A section is required for storing member details. Use the button below to automatically create a compatible section (you can always edit or add fields later), or use the dropdowns to link to an existing section containing the required fields.');
     $group->appendChild($p);
     $this->Form->appendChild($group);
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Smart Setup'));
     $attr = array('name' => 'action[smart-setup]', 'type' => 'submit');
     if ($member_section instanceof Section) {
         $attr['disabled'] = 'disabled';
     }
     $div = new XMLElement('div', NULL, array('id' => 'file-actions', 'class' => 'label'));
     $span = new XMLElement('span');
     $span->appendChild(new XMLElement('button', 'Create', $attr));
     $div->appendChild($span);
     $div->appendChild(new XMLElement('p', 'Automatically creates a new section, called Members, containing Username/Password, Role, Email Address, and Timezone Offset fields.', array('class' => 'help')));
     $group->appendChild($div);
     $this->Form->appendChild($group);
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Essentials'));
     $p = new XMLElement('p', 'Must contain a <code>Member</code> type field. Will be used to validate login details.');
     $p->setAttribute('class', 'help');
     $group->appendChild($p);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $section_list = Symphony::Database()->fetchCol('parent_section', "SELECT `parent_section` FROM `tbl_fields` WHERE `type` = 'member'");
     $label = Widget::Label('Member Section');
     $options = array();
     foreach ($section_list as $section_id) {
         $section = $sectionManager->fetch($section_id);
         $options[] = array($section_id, extension_members::memberSectionID('member_section', 'members') == $section_id, $section->get('name'));
     }
     $label->appendChild(Widget::Select('fields[member_section]', $options));
     $div->appendChild($label);
     $label = Widget::Label('Email Address Field');
     if ($member_section instanceof Section) {
         $options = array(array('', false, ''));
         foreach ($member_section->fetchFields() as $f) {
             $options[] = array($f->get('id'), Symphony::Configuration()->get('email_address_field_id', 'members') == $f->get('id'), $f->get('label'));
         }
     } else {
         $options = array(array('', false, 'Must set Member section first'));
     }
     $label->appendChild(Widget::Select('fields[email_address_field_id]', $options, $member_section instanceof Section ? NULL : array('disabled' => 'disabled')));
     $div->appendChild($label);
     $group->appendChild($div);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $label = Widget::Label('Timezone Offset Field');
     if ($member_section instanceof Section) {
         $options = array(array('', false, ''));
         foreach ($member_section->fetchFields() as $f) {
             $options[] = array($f->get('id'), Symphony::Configuration()->get('timezone_offset_field_id', 'members') == $f->get('id'), $f->get('label'));
         }
     } else {
         $options = array(array('', false, 'Must set Member section first'));
     }
     $label->appendChild(Widget::Select('fields[timezone_offset_field_id]', $options, $member_section instanceof Section ? NULL : array('disabled' => 'disabled')));
     $div->appendChild($label);
     $group->appendChild($div);
     $group->appendChild(new XMLElement('p', 'Stores member timezones. Used to dynamically adjust date displays. Defaults to Symphony configuration offset.', array('class' => 'help')));
     $this->Form->appendChild($group);
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Registration'));
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $label = Widget::Label('New Member Default Role');
     $options = array(array(NULL, false, NULL));
     foreach ($this->_driver->fetchRoles() as $r) {
         if (in_array($r->id(), array(extension_Members::GUEST_ROLE_ID, extension_Members::INACTIVE_ROLE_ID))) {
             continue;
         }
         $options[] = array($r->id(), Symphony::Configuration()->get('new_member_default_role', 'members') == $r->id(), $r->name());
     }
     $label->appendChild(Widget::Select('fields[new_member_default_role]', $options));
     $div->appendChild($label);
     $group->appendChild($div);
     $label = Widget::Label();
     $input = Widget::Input('fields[require_activation]', 'yes', 'checkbox');
     if (Symphony::Configuration()->get('require_activation', 'members') == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $label->setValue($input->generate() . ' ' . __('New members require activation'));
     $group->appendChild($label);
     $group->appendChild(new XMLElement('p', __('If activation is required, new members will be added to the \'Inactive\' role until they reply to the \'Activate Account\' email. Activated members will be added to the role selected above.'), array('class' => 'help')));
     $this->Form->appendChild($group);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     if (!$bIsWritable) {
         $attr['disabled'] = 'disabled';
     }
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', $attr));
     $this->Form->appendChild($div);
 }
 public function view()
 {
     if (!($email_template_id = $this->_context[0])) {
         redirect(extension_members::baseURL());
     }
     if (!($existing = EmailTemplate::loadFromID($email_template_id))) {
         throw new SymphonyErrorPage(__('The email template you requested to edit does not exist.'), __('Email Template not found'), 'error');
     }
     if (isset($this->_context[1])) {
         switch ($this->_context[1]) {
             case 'saved':
                 $this->pageAlert(__('Email Template updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Email Template</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), extension_members::baseURL() . 'email_templates_new/', extension_members::baseURL() . 'email_templates/')), Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Email Template created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Email Template</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), extension_members::baseURL() . 'email_templates_new/', extension_members::baseURL() . 'email_templates/')), Alert::SUCCESS);
                 break;
         }
     }
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9125341);
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if ($formHasErrors) {
         $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), AdministrationPage::PAGE_ALERT_ERROR);
     }
     $this->setPageType('form');
     $this->setTitle('Symphony &ndash; Member Roles &ndash; ' . $existing->subject);
     $this->appendSubheading($existing->subject);
     $fields = array();
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     } else {
         $fields['subject'] = $existing->subject;
         $fields['body'] = $existing->body;
         $fields['type'] = $existing->type;
         $fields['roles'] = NULL;
         foreach ($existing->roles() as $role_id => $r) {
             $fields['roles'] .= $r->name() . ", ";
         }
         $fields['roles'] = trim($fields['roles'], ', ');
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'primary');
     $label = Widget::Label('Subject');
     $label->appendChild(Widget::Input('fields[subject]', General::sanitize($fields['subject'])));
     if (isset($this->_errors['subject'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['subject']));
     } else {
         $fieldset->appendChild($label);
     }
     $label = Widget::Label('Body');
     $label->appendChild(Widget::Textarea('fields[body]', 15, 75, General::sanitize($fields['body'])));
     if (isset($this->_errors['body'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['body']));
     } else {
         $fieldset->appendChild($label);
     }
     $fieldset->appendChild(new XMLElement('p', 'Dynamic fields and parameters can be included in the subject or body of the email using the <code>{$param}</code> syntax. Please see the <a href="http://github.com/symphony/members/blob/master/README.markdown">readme</a> for a complete list of available parameters.', array('class' => 'help')));
     $this->Form->appendChild($fieldset);
     $sidebar = new XMLElement('fieldset');
     $sidebar->setAttribute('class', 'secondary');
     $label = Widget::Label('Type');
     $options = array(array(NULL, false, NULL), array('reset-password', $fields['type'] == 'reset-password', 'Reset Password'), array('new-password', $fields['type'] == 'new-password', 'New Password'), array('activate-account', $fields['type'] == 'activate-account', 'Activate Account'), array('welcome', $fields['type'] == 'welcome', 'Welcome Email'));
     $label->appendChild(Widget::Select('fields[type]', $options));
     if (isset($this->_errors['type'])) {
         $sidebar->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['type']));
     } else {
         $sidebar->appendChild($label);
     }
     $label = Widget::Label('Roles');
     $label->appendChild(Widget::Input('fields[roles]', $fields['roles']));
     if (isset($this->_errors['roles'])) {
         $sidebar->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['roles']));
     } else {
         $sidebar->appendChild($label);
     }
     $roles = DatabaseUtilities::resultColumn(ASDCLoader::instance()->query("SELECT `name` FROM `tbl_members_roles` ORDER BY `name` ASC"), 'name');
     if (is_array($roles) && !empty($roles)) {
         $taglist = new XMLElement('ul');
         $taglist->setAttribute('class', 'tags');
         foreach ($roles as $tag) {
             $taglist->appendChild(new XMLElement('li', $tag));
         }
         $sidebar->appendChild($taglist);
     }
     $this->Form->appendChild($sidebar);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', array('accesskey' => 's')));
     $button = new XMLElement('button', __('Delete'));
     $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this email template')));
     $div->appendChild($button);
     $this->Form->appendChild($div);
 }
예제 #10
0
 function view()
 {
     if (!($role_id = $this->_context[0])) {
         redirect(extension_members::baseURL());
     }
     if (!($existing = $this->_driver->fetchRole($role_id, true))) {
         $this->_Parent->customError(E_USER_ERROR, 'Role not found', 'The role you requested to edit does not exist.', false, true, 'error', array('header' => 'HTTP/1.0 404 Not Found'));
     }
     if (isset($this->_context[1])) {
         switch ($this->_context[1]) {
             case 'saved':
                 $this->pageAlert(__('%1$s updated successfully. <a href="%2$s">Create another?</a>', array('Role', extension_members::baseURL() . 'new/')), Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('%1$s created successfully. <a href="%2$s">Create another?</a>', array('Role', extension_members::baseURL() . 'new/')), Alert::SUCCESS);
                 break;
             case 'moved':
                 $this->pageAlert('All members have been successfully moved to new role.', Alert::SUCCESS);
                 break;
         }
     }
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if ($formHasErrors) {
         $this->pageAlert('An error occurred while processing this form. <a href="#error">See below for details.</a>', AdministrationPage::PAGE_ALERT_ERROR);
     }
     $this->setPageType('form');
     $this->setTitle('Symphony &ndash; Member Roles &ndash; ' . $existing->name());
     $this->appendSubheading($existing->name());
     $fields = array();
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     } else {
         $fields['name'] = $existing->name();
         $fields['permissions'] = $existing->eventPermissions();
         $fields['page_access'] = $existing->forbiddenPages();
         $fields['email_subject'] = $existing->email_subject();
         $fields['email_body'] = $existing->email_body();
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Essentials'));
     $label = Widget::Label('Name');
     $label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
     if (isset($this->_errors['name'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
     } else {
         $fieldset->appendChild($label);
     }
     $this->Form->appendChild($fieldset);
     $EventManager = new EventManager($this->_Parent);
     $events = $EventManager->listAll();
     if (is_array($events) && !empty($events)) {
         foreach ($events as $handle => $e) {
             $show_in_role_permissions = method_exists("event{$handle}", 'showInRolePermissions') && call_user_func(array("event{$handle}", 'showInRolePermissions')) === true ? true : false;
             if (!$e['can_parse'] && !$show_in_role_permissions) {
                 unset($events[$handle]);
             }
         }
     }
     if (is_array($events) && !empty($events)) {
         $fieldset = new XMLElement('fieldset');
         $fieldset->setAttribute('class', 'settings type-file');
         $fieldset->appendChild(new XMLElement('legend', 'Event Level Permissions'));
         $aTableHead = array(array('Event', 'col'), array('Add', 'col'), array('Edit', 'col'), array('Edit Own *', 'col'), array('Delete', 'col'), array('Delete Own *', 'col'));
         $aTableBody = array();
         foreach ($events as $event_handle => $event) {
             $permissions = $fields['permissions'][$event_handle];
             ## Setup each cell
             $td1 = Widget::TableData($event['name']);
             $td2 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][add]', 'yes', 'checkbox', isset($permissions['add']) ? array('checked' => 'checked') : NULL));
             $td3 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][edit]', 'yes', 'checkbox', isset($permissions['edit']) ? array('checked' => 'checked') : NULL));
             $td4 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][edit_own]', 'yes', 'checkbox', isset($permissions['edit_own']) ? array('checked' => 'checked') : NULL));
             $td5 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][delete]', 'yes', 'checkbox', isset($permissions['delete']) ? array('checked' => 'checked') : NULL));
             $td6 = Widget::TableData(Widget::Input('fields[permissions][' . $event_handle . '][delete_own]', 'yes', 'checkbox', isset($permissions['delete_own']) ? array('checked' => 'checked') : NULL));
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3, $td4, $td5, $td6));
         }
         $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'role-permissions');
         $fieldset->appendChild($table);
         $fieldset->appendChild(new XMLElement('p', '* <em>Does not apply if global edit/delete is allowed</em>', array('class' => 'help')));
         $this->Form->appendChild($fieldset);
     }
     ####
     # Delegate: MemberRolePermissionFieldsetsEdit
     # Description: Add custom fieldsets to the role page
     $ExtensionManager = new ExtensionManager($this->_Parent);
     $ExtensionManager->notifyMembers('MemberRolePermissionFieldsetsEdit', '/extension/members/edit/', array('form' => &$this->Form, 'permissions' => $fields['permissions']));
     #####
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Page Level Permissions'));
     $pages = $this->_Parent->Database->fetch("SELECT * FROM `tbl_pages` " . ($this->_context[0] == 'edit' ? "WHERE `id` != '{$page_id}' " : '') . "ORDER BY `title` ASC");
     $label = Widget::Label('Deny Access');
     $options = array();
     if (is_array($pages) && !empty($pages)) {
         foreach ($pages as $page) {
             $options[] = array($page['id'], in_array($page['id'], $fields['page_access']), '/' . $this->_Parent->resolvePagePath($page['id']));
             //$page['title']);
         }
     }
     $label->appendChild(Widget::Select('fields[page_access][]', $options, array('multiple' => 'multiple')));
     $fieldset->appendChild($label);
     $this->Form->appendChild($fieldset);
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Operations'));
     if ($role_id == 1) {
         $fieldset->appendChild(new XMLElement('p', 'The default role cannot be deleted', array('class' => 'help')));
     }
     $aTableBody = array();
     $roles = $this->_driver->fetchRoles();
     $options = array();
     foreach ($roles as $role) {
         if ($role_id == $role->id()) {
             continue;
         }
         $options[] = array($role->id(), false, $role->name());
     }
     ## Setup each cell
     $td1 = Widget::TableData('Move');
     $td2 = Widget::TableData(Widget::Select('fields[new_role]', $options));
     $td3 = Widget::TableData(Widget::Input('action[move]', 'Move', 'submit', array('class' => 'confirm')));
     ## Add a row to the body array, assigning each cell to the row
     $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
     if ($role_id != 1) {
         ## Setup each cell
         $td1 = Widget::TableData('Move and Delete');
         $td2 = Widget::TableData(Widget::Select('fields[replacement_role]', $options));
         $td3 = Widget::TableData(Widget::Input('action[delete]', 'Delete', 'submit', array('class' => 'confirm')));
         ## Add a row to the body array, assigning each cell to the row
         $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
     }
     $table = Widget::Table(NULL, NULL, Widget::TableBody($aTableBody), NULL, 'role-operations');
     $table->setAttributeArray(array('cellspacing' => '0', 'cellpadding' => '0'));
     $fieldset->appendChild($table);
     $this->Form->appendChild($fieldset);
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Email Template'));
     $fieldset->appendChild(new XMLElement('p', 'When adding a member, they will receive an email based on the template you specify. <br /><br />Leave everything blank if you do not wish for new members in this group to receive an email.', array('class' => 'help')));
     $label = Widget::Label('Subject');
     $label->appendChild(Widget::Input('fields[email_subject]', General::sanitize($fields['email_subject'])));
     if (isset($this->_errors['email_subject'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['email_subject']));
     } else {
         $fieldset->appendChild($label);
     }
     $label = Widget::Label('Body');
     $label->appendChild(Widget::Textarea('fields[email_body]', '25', '50', General::sanitize($fields['email_body'])));
     $fieldset->appendChild(isset($this->_errors['email_body']) ? $this->wrapFormElementWithError($label, $this->_errors['email_body']) : $label);
     $fieldset->appendChild(new XMLElement('p', 'You can add dynamic elements to the email by using <code>{$field-name}</code> syntax, where <code>field-name</code> corresponds to the fields of the new member.', array('class' => 'help')));
     $this->Form->appendChild($fieldset);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', array('accesskey' => 's')));
     $this->Form->appendChild($div);
 }
예제 #11
0
 public function __actionEdit()
 {
     if (array_key_exists('delete', $_POST['action'])) {
         return $this->__actionDelete($this->_context[1], extension_Members::baseURL() . 'roles/');
     }
     if (array_key_exists('save', $_POST['action'])) {
         $isNew = $this->_context[0] !== "edit";
         $fields = $_POST['fields'];
         // If we are editing, we need to make sure the current `$role_id` exists
         if (!$isNew) {
             if (!($role_id = $this->_context[1])) {
                 redirect(extension_Members::baseURL() . 'roles/');
             }
             if (!($existing = RoleManager::fetch($role_id))) {
                 throw new SymphonyErrorPage(__('The role you requested to edit does not exist.'), __('Role not found'));
             }
         }
         $name = trim($fields['name']);
         if (strlen($name) == 0) {
             $this->_errors['name'] = __('This is a required field');
             return false;
         }
         $handle = Lang::createHandle($name);
         // Make sure there isn't already a Role with the same name.
         if ($isNew) {
             if (RoleManager::fetchRoleIDByHandle($handle)) {
                 $this->_errors['name'] = __('A role with the name <code>%s</code> already exists.', array($name));
                 return false;
             }
         } else {
             if ($handle != $existing->get('handle') && RoleManager::fetchRoleIDByHandle($handle)) {
                 $this->_errors['name'] = __('A role with the name <code>%s</code> already exists.', array($name));
                 return false;
             }
         }
         $data['roles'] = array('name' => $name, 'handle' => $handle);
         $data['roles_forbidden_pages'] = array('page_access' => $fields['page_access']);
         $data['roles_event_permissions'] = array('permissions' => $fields['permissions']);
         if ($isNew) {
             if ($role_id = RoleManager::add($data)) {
                 redirect(extension_members::baseURL() . 'roles/edit/' . $role_id . '/created/');
             }
         } else {
             if (RoleManager::edit($role_id, $data)) {
                 redirect(extension_members::baseURL() . 'roles/edit/' . $role_id . '/saved/');
             }
         }
     }
 }
 function view()
 {
     $this->_Parent->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 70);
     $this->appendSubheading('Preferences');
     $bIsWritable = true;
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if (!is_writable(CONFIG)) {
         $this->pageAlert('The Symphony configuration file, <code>/manifest/config.php</code>, is not writable. You will not be able to save changes to preferences.', AdministrationPage::PAGE_ALERT_ERROR);
         $bIsWritable = false;
     } elseif ($formHasErrors) {
         $this->pageAlert('An error occurred while processing this form. <a href="#error">See below for details.</a>', AdministrationPage::PAGE_ALERT_ERROR);
     }
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', 'Essentials'));
     $p = new XMLElement('p', 'Must contain a <code>Member</code> type field. Will be used to validate login details.');
     $p->setAttribute('class', 'help');
     $group->appendChild($p);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $section_list = $this->_Parent->Database->fetchCol('parent_section', "SELECT `parent_section` FROM `tbl_fields` WHERE `type` = 'member'");
     $sectionManager = new SectionManager($this->_Parent);
     $label = Widget::Label('Member Section');
     $options = array();
     foreach ($section_list as $section_id) {
         $section = $sectionManager->fetch($section_id);
         $options[] = array($section_id, extension_members::memberSectionID('member_section', 'members') == $section_id, $section->get('name'));
     }
     $label->appendChild(Widget::Select('fields[member_section]', $options));
     $div->appendChild($label);
     $label = Widget::Label('Email Address');
     $member_section_id = extension_members::memberSectionID();
     if (!empty($member_section_id)) {
         $options = array(array('', false, ''));
         $sectionManager = new SectionManager($this->_Parent);
         $section = $sectionManager->fetch($member_section_id);
         foreach ($section->fetchFields() as $f) {
             $options[] = array($f->get('id'), ConfigurationAccessor::get('email_address_field_id', 'members') == $f->get('id'), $f->get('label'));
         }
     } else {
         $options = array(array('', false, 'Must set Member section first'));
     }
     $label->appendChild(Widget::Select('fields[email_address_field_id]', $options, empty($member_section_id) ? array('disabled' => 'disabled') : NULL));
     $div->appendChild($label);
     $group->appendChild($div);
     $this->Form->appendChild($group);
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Forgotten Password Email Template'));
     $fieldset->appendChild(new XMLElement('p', 'When a member triggers the forgotten password event, this is the email template used when providing them a login link.', array('class' => 'help')));
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $label = Widget::Label('Subject');
     $label->appendChild(Widget::Input('fields[forgotten_pass_email_subject]', General::sanitize(stripslashes(ConfigurationAccessor::get('forgotten_pass_email_subject', 'members')))));
     if (isset($this->_errors['forgotten_pass_email_subject'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['forgotten_pass_email_subject']));
     } else {
         $fieldset->appendChild($label);
     }
     $label = Widget::Label('Body');
     $label->appendChild(Widget::Textarea('fields[forgotten_pass_email_body]', '25', '50', General::sanitize(stripslashes(ConfigurationAccessor::get('forgotten_pass_email_body', 'members')))));
     $fieldset->appendChild(isset($this->_errors['forgotten_pass_email_body']) ? $this->wrapFormElementWithError($label, $this->_errors['forgotten_pass_email_body']) : $label);
     $fieldset->appendChild(new XMLElement('p', 'You can add dynamic elements to the email by using <code>{$field-name}</code> syntax, where <code>field-name</code> corresponds to the fields of the member, and <code>{$member-token}</code> which is the unique token allowing them to login E.G. <code>' . URL . '/login/{$member-token}/</code>. The page must have a param called <code>member-token</code>.', array('class' => 'help')));
     $this->Form->appendChild($fieldset);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     if (!$bIsWritable) {
         $attr['disabled'] = 'disabled';
     }
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', $attr));
     $this->Form->appendChild($div);
 }
 public function view()
 {
     if (!($role_id = $this->_context[0])) {
         redirect(extension_members::baseURL());
     }
     if (!($existing = $this->_driver->fetchRole($role_id, true))) {
         throw new SymphonyErrorPage(__('The role you requested to edit does not exist.'), __('Role not found'), 'error');
     }
     if (isset($this->_context[1])) {
         switch ($this->_context[1]) {
             case 'saved':
                 $this->pageAlert(__('Role updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Roles</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), extension_members::baseURL() . 'roles_new/', extension_members::baseURL() . 'roles/')), Alert::SUCCESS);
                 break;
             case 'created':
                 $this->pageAlert(__('Role created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all Roles</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), extension_members::baseURL() . 'roles_new/', extension_members::baseURL() . 'roles/')), Alert::SUCCESS);
                 break;
         }
     }
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9125341);
     Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/jquery-ui.css', 'screen', 9125342);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/jquery-ui.js', 9126342);
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/members.js', 9126343);
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if ($formHasErrors) {
         $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), AdministrationPage::PAGE_ALERT_ERROR);
     }
     $this->setPageType('form');
     $this->setTitle('Symphony &ndash; Member Roles &ndash; ' . $existing->name());
     $this->appendSubheading($existing->name());
     $fields = array();
     if (isset($_POST['fields'])) {
         $fields = $_POST['fields'];
     } else {
         $fields['name'] = $existing->name();
         $fields['permissions'] = $existing->eventPermissions();
         $fields['page_access'] = $existing->forbiddenPages();
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Essentials'));
     $label = Widget::Label('Name');
     $label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
     if (isset($this->_errors['name'])) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
     } else {
         $fieldset->appendChild($label);
     }
     $this->Form->appendChild($fieldset);
     $EventManager = new EventManager($this->_Parent);
     $events = $EventManager->listAll();
     if (is_array($events) && !empty($events)) {
         foreach ($events as $handle => $e) {
             $show_in_role_permissions = method_exists("event{$handle}", 'showInRolePermissions') && call_user_func(array("event{$handle}", 'showInRolePermissions')) === true ? true : false;
             if (!$e['can_parse'] && !$show_in_role_permissions) {
                 unset($events[$handle]);
             }
         }
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Event Level Permissions'));
     $aTableHead = array(array('Event', 'col'), array('Create', 'col'), array('Edit', 'col'));
     $aTableBody = array();
     /*
     <tr class="global">
     	<td>Set Global Permissions</td>
     	<td class="add">
     		<input type="checkbox" name="add-global" value="no"/>
     	</td>
     	<td class="edit">
     		<p class="global-slider"></p>
     		<span>n/a</span>
     	</td>
     	<!--<td class="delete">
     		<p class="global-slider"></p>
     		<span>n/a</span>
     	</td>-->
     </tr>
     */
     ## Setup each cell
     $td1 = Widget::TableData('Global Permissions');
     $td2 = Widget::TableData(Widget::Input('global-add', '1', 'checkbox'), 'add');
     $td3 = Widget::TableData(NULL, 'edit');
     $td3->appendChild(new XMLElement('p', NULL, array('class' => 'global-slider')));
     $td3->appendChild(new XMLElement('span', 'n/a'));
     $td4 = Widget::TableData(NULL, 'delete');
     $td4->appendChild(new XMLElement('p', NULL, array('class' => 'global-slider')));
     $td4->appendChild(new XMLElement('span', 'n/a'));
     ## Add a row to the body array, assigning each cell to the row
     $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), 'global');
     //, $td4
     if (is_array($events) && !empty($events)) {
         foreach ($events as $event_handle => $event) {
             $permissions = $fields['permissions'][$event_handle];
             ## Setup each cell
             $td1 = Widget::TableData($event['name']);
             $td2 = Widget::TableData(Widget::Input("fields[permissions][{$event_handle}][create]", '1', 'checkbox', $permissions['create'] == 1 ? array('checked' => 'checked') : NULL), 'add');
             $td3 = Widget::TableData(NULL, 'edit');
             $td3->appendChild(new XMLElement('p', NULL, array('class' => 'slider')));
             $span = new XMLElement('span');
             $span->setSelfClosingTag(false);
             $td3->appendChild($span);
             $td3->appendChild(Widget::Input('fields[permissions][' . $event_handle . '][edit]', isset($permissions['edit']) ? $permissions['edit'] : '0', 'hidden'));
             $td4 = Widget::TableData(NULL, 'delete');
             $td4->appendChild(new XMLElement('p', NULL, array('class' => 'slider')));
             $span = new XMLElement('span');
             $span->setSelfClosingTag(false);
             $td4->appendChild($span);
             $td4->appendChild(Widget::Input('fields[permissions][' . $event_handle . '][delete]', isset($permissions['delete']) ? $permissions['delete'] : '0', 'hidden'));
             /*
             <tr>
             	<td>{EVENT-NAME}</td>
             	<td class="add">
             		<input type="checkbox" name="{ANY NAME}" value="{EXISTING STATE:No}"/>
             	</td>
             	<td class="edit">
             		<p class="slider"></p>
             		<span></span>
             		<input type="hidden" name="{ANY NAME}" value="{EXISTING-VALUE:1}"/>
             	</td>
             	<!--<td class="delete">
             		<p class="slider"></p>
             		<span></span>
             		<input type="hidden" name="{ANY NAME}" value="{EXISTING-VALUE:1}"/>
             	</td>-->
             </tr>
             */
             ## Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
             //, $td4));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'role-permissions');
     $fieldset->appendChild($table);
     $this->Form->appendChild($fieldset);
     ####
     # Delegate: MemberRolePermissionFieldsetsEdit
     # Description: Add custom fieldsets to the role page
     Administration::instance()->ExtensionManager->notifyMembers('MemberRolePermissionFieldsetsEdit', '/extension/members/roles_edit/', array('form' => &$this->Form, 'permissions' => $fields['permissions']));
     #####
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings type-file');
     $fieldset->appendChild(new XMLElement('legend', 'Page Level Permissions'));
     $pages = ASDCLoader::instance()->query(sprintf("SELECT * FROM `tbl_pages` %s ORDER BY `title` ASC", $this->_context[0] == 'edit' ? "WHERE `id` != '{$page_id}' " : NULL));
     $label = Widget::Label('Deny Access');
     $options = array();
     if ($pages->length() > 0) {
         foreach ($pages as $page) {
             $options[] = array($page->id, in_array($page->id, $fields['page_access']), '/' . Administration::instance()->resolvePagePath($page->id));
         }
     }
     $label->appendChild(Widget::Select('fields[page_access][]', $options, array('multiple' => 'multiple')));
     $fieldset->appendChild($label);
     $this->Form->appendChild($fieldset);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', 'Save Changes', 'submit', array('accesskey' => 's')));
     $this->Form->appendChild($div);
 }