예제 #1
0
 public function admin()
 {
     if ($this->is_back()) {
         $this->parent->reset();
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     Base_ActionBarCommon::add('add', __('Add Home Page'), $this->create_callback_href(array($this, 'edit_home_page')));
     $gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'home_page_admin');
     $gb->set_table_columns(array(array('name' => 'Home Page'), array('name' => 'Clearance')));
     $pages = DB::Execute('SELECT * FROM base_home_page ORDER BY priority');
     $next = null;
     while ($row = $pages->FetchRow()) {
         $gbr = $gb->get_new_row();
         $clearances = DB::GetAssoc('SELECT id, clearance FROM base_home_page_clearance WHERE home_page_id=%d', array($row['id']));
         $gbr->add_data($row['home_page'], Base_AclCommon::display_clearances($clearances));
         if ($next) {
             $next->add_action($this->create_callback_href(array($this, 'change_priority'), array($last_row['id'], $last_row['priority'], +1)), 'Move down', null, 'move-down');
         }
         if ($row['priority'] > 1) {
             $gbr->add_action($this->create_callback_href(array($this, 'change_priority'), array($row['id'], $row['priority'], -1)), 'Move up', null, 'move-up');
         }
         $gbr->add_action($this->create_callback_href(array($this, 'delete_home_page'), array($row['id'])), 'Delete');
         $gbr->add_action($this->create_callback_href(array($this, 'edit_home_page'), array($row['id'])), 'Edit');
         $next = $gbr;
         $last_row = $row;
     }
     $this->display_module($gb);
     eval_js('base_home_page__initialized = false;');
 }
예제 #2
0
파일: Acl_0.php 프로젝트: cretzu89/EPESI
 public function edit_permissions($permission_name = null)
 {
     if ($this->is_back()) {
         Base_BoxCommon::pop_main();
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     Base_ThemeCommon::load_css('Base_Acl', 'edit_permissions');
     $gb = $this->init_module('Utils_GenericBrowser', 'acl_editor', 'acl_editor');
     $gb->set_table_columns(array(array('name' => ' ', 'width' => 20)));
     $sql = 'SELECT id, name FROM base_acl_permission';
     $args = array();
     $perm_id = null;
     if ($permission_name) {
         $sql .= ' WHERE name=%s';
         $args[] = $permission_name;
         $perm_id = DB::GetOne('SELECT id FROM base_acl_permission WHERE name=%s', array($permission_name));
     }
     $sql .= ' ORDER BY name ASC';
     $perms = DB::GetAssoc($sql, $args);
     Base_ActionBarCommon::add('add', __('Add rule'), $this->create_callback_href(array($this, 'edit_rule'), array(null, $perm_id)));
     foreach ($perms as $p_id => $p_name) {
         $gb_row = $gb->get_new_row();
         $gb_row->add_data(array('value' => _V($p_name), 'class' => 'Base_Acl__permission', 'attrs' => 'colspan="2"'));
         $gb_row->no_actions();
         $perms = DB::GetAssoc('SELECT id, id FROM base_acl_rules WHERE permission_id=%d', array($p_id));
         foreach ($perms as $r_id) {
             $clearances = DB::GetAssoc('SELECT id, clearance FROM base_acl_rules_clearance WHERE rule_id=%d', array($r_id));
             $gb_row = $gb->get_new_row();
             $gb_row->add_action($this->create_confirm_callback_href(__('Are you sure you want to delete this rule?'), array($this, 'delete_rule'), array($r_id)), 'delete', __('Delete Rule'));
             $gb_row->add_action($this->create_callback_href(array($this, 'edit_rule'), array($r_id, $p_id)), 'edit', __('Edit Rule'));
             $gb_row->add_data(Base_AclCommon::display_clearances($clearances));
         }
     }
     $this->display_module($gb);
     eval_js('base_acl__initialized = false;');
 }