Revize c1bdc1c4
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/controllers/aro_groups.php | ||
---|---|---|
public function show_all()
|
||
{
|
||
// check access
|
||
if (!$this->acl_check_view('Settings_Controller', 'access_rights'))
|
||
if (!$this->acl_check_view('Aro_groups_Controller', 'aro_group'))
|
||
{
|
||
Controller::Error(ACCESS);
|
||
}
|
||
... | ... | |
. '</td><td style="width:30px; text-align: center" >'
|
||
. $count . '</td><td>'
|
||
. __('Show')
|
||
.'</td><td>' . __('Edit')
|
||
. '</td><td>' . __('Delete')
|
||
. '</td></tr>';
|
||
.'</td>';
|
||
|
||
if ($this->acl_check_edit('Aro_groups_Controller', 'aro_group'))
|
||
{
|
||
$rows[$i + 1] .= '<td>' . __('Edit') . '</td>';
|
||
}
|
||
|
||
if ($this->acl_check_delete('Aro_groups_Controller', 'aro_group'))
|
||
{
|
||
$rows[$i + 1] .= '<td>' . __('Delete') . '</td>';
|
||
}
|
||
|
||
$rows[$i + 1] .= '</tr>';
|
||
}
|
||
else
|
||
{
|
||
... | ... | |
. '</td><td style="width:30px; text-align: center" >'
|
||
. $count . '</td><td>'
|
||
. html::anchor('aro_groups/show/'.$group->id, __('Show'))
|
||
.'</td><td>' . html::anchor(url_lang::base()
|
||
.'</td>';
|
||
|
||
if ($this->acl_check_edit('Aro_groups_Controller', 'aro_group'))
|
||
{
|
||
$rows[$i + 1] .= '<td>' . html::anchor(url_lang::base()
|
||
. 'aro_groups/edit/' . $group->id, __('Edit'))
|
||
. '</td><td>';
|
||
. '</td>';
|
||
}
|
||
|
||
if (!$aro_group_model->count_childrens($group->id))
|
||
if ($this->acl_check_delete('Aro_groups_Controller', 'aro_group'))
|
||
{
|
||
$rows[$i + 1] .= html::anchor(url_lang::base()
|
||
. 'aro_groups/delete/' . $group->id, __('Delete'),
|
||
array('class' => 'delete_link'));
|
||
$rows[$i + 1] .= '<td>';
|
||
|
||
if (!$aro_group_model->count_childrens($group->id) &&
|
||
$aro_group_model->is_deletable($group->id))
|
||
{
|
||
$rows[$i + 1] .= html::anchor(url_lang::base()
|
||
. 'aro_groups/delete/' . $group->id, __('Delete'),
|
||
array('class' => 'delete_link'));
|
||
}
|
||
else
|
||
$rows[$i + 1] .= __('Delete');
|
||
|
||
$rows[$i + 1] .= '</td>';
|
||
}
|
||
else
|
||
$rows[$i + 1] .= __('Delete');
|
||
|
||
$rows[$i + 1] .= '</td></tr>';
|
||
$rows[$i + 1] .= '</tr>';
|
||
}
|
||
|
||
$groups->next();
|
||
... | ... | |
$breadcrumbs = breadcrumbs::add()
|
||
->text('Access control groups of users');
|
||
|
||
$submenu = array();
|
||
$submenu[] = html::anchor('acl/show_all', __('Access control rules'));
|
||
$submenu[] = __('Access control groups of users');
|
||
if ($this->acl_check_view('Acl_Controller', 'acl'))
|
||
{
|
||
$submenu = array();
|
||
$submenu['acl/show_all'] = __('Access control rules');
|
||
$submenu['aro_groups/show_all'] = __('Access control groups of users');
|
||
}
|
||
else
|
||
{
|
||
$submenu = NULL;
|
||
}
|
||
|
||
//vykresleni
|
||
$view = new View('main');
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->title = $headline;
|
||
$view->content = new View('access_rights/aro_groups_show_all');
|
||
$view->content->submenu = implode(' | ',$submenu);
|
||
$this->sections = $submenu;
|
||
$view->content->current = 'aro_groups/show_all';
|
||
$view->content->links = implode(' | ', $links);
|
||
$view->content->rows = $rows;
|
||
$view->content->headline = $headline;
|
||
... | ... | |
public function show ($group_id = NULL)
|
||
{
|
||
// access check
|
||
if (!$this->acl_check_edit('Settings_Controller', 'access_rights'))
|
||
if (!$this->acl_check_view('Aro_groups_Controller', 'aro_group'))
|
||
Controller::Error(ACCESS);
|
||
|
||
// bad parameter
|
||
... | ... | |
|
||
$actions = $acl_grid->grouped_action_field();
|
||
|
||
$actions->add_action('id')
|
||
->icon_action('show')
|
||
->url('acl/show');
|
||
if ($this->acl_check_view('Acl_Controller', 'acl'))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('show')
|
||
->url('acl/show');
|
||
}
|
||
|
||
$actions->add_action('id')
|
||
->icon_action('edit')
|
||
->url('acl/edit');
|
||
if ($this->acl_check_edit('Acl_Controller', 'acl'))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('edit')
|
||
->url('acl/edit');
|
||
}
|
||
|
||
$actions->add_action('id')
|
||
->icon_action('delete')
|
||
->url('acl/delete')
|
||
->class('delete_link');
|
||
if ($this->acl_check_delete('Acl_Controller', 'acl'))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('delete')
|
||
->url('acl/delete')
|
||
->class('delete_link');
|
||
}
|
||
|
||
$acl_grid->datasource($acls);
|
||
|
||
... | ... | |
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('aro_groups/show_all', 'Access control groups of users',
|
||
$this->acl_check_edit('Settings_Controller', 'access_rights'))
|
||
$this->acl_check_view('Aro_groups_Controller', 'aro_group'))
|
||
->disable_translation()
|
||
->text($aro_group->name.' ('.$aro_group->id.')');
|
||
|
||
... | ... | |
public function add()
|
||
{
|
||
// check access
|
||
if (!$this->acl_check_edit('Settings_Controller', 'access_rights'))
|
||
if (!$this->acl_check_new('Aro_groups_Controller', 'aro_group'))
|
||
Controller::Error(ACCESS);
|
||
|
||
$aro_group_model = new Aro_group_Model();
|
||
... | ... | |
|
||
$aro_group = new Aro_group_Model($form_data['parent_id']);
|
||
|
||
try
|
||
if ($aro_group->id)
|
||
{
|
||
$aro_group->transaction_start();
|
||
|
||
if ($aro_group->id)
|
||
try
|
||
{
|
||
$aro_group->transaction_start();
|
||
|
||
$rgt = $aro_group->rgt;
|
||
|
||
|
||
$aro_group->increase($rgt);
|
||
|
||
|
||
$aro_group->clear();
|
||
$aro_group->parent_id = $form_data['parent_id'];
|
||
$aro_group->lft = $rgt;
|
||
$aro_group->rgt = $rgt+1;
|
||
$aro_group->name = $form_data['name'];
|
||
$aro_group->value = url::title($form_data['name'], '_');
|
||
|
||
|
||
$aro_group->save_throwable();
|
||
$aro_group->transaction_commit();
|
||
|
||
status::success('Group has been successfully added.');
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$aro_group->transaction_rollback();
|
||
Log::add_exception($e);
|
||
status::error('Error - cannot add new group.', $e);
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$aro_group->transaction_rollback();
|
||
Log::add_exception($e);
|
||
status::error('Error - cannot add new group.');
|
||
}
|
||
|
||
url::redirect('aro_groups/show_all');
|
||
}
|
||
|
||
... | ... | |
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('aro_groups/show_all', 'Access control groups of users',
|
||
$this->acl_check_view('Settings_Controller', 'access_rights'))
|
||
$this->acl_check_view('Aro_groups_Controller', 'aro_group'))
|
||
->text($headline);
|
||
|
||
$view = new View('main');
|
||
... | ... | |
public function edit ($group_id = NULL)
|
||
{
|
||
// access check
|
||
if (!$this->acl_check_edit('Settings_Controller', 'access_rights'))
|
||
if (!$this->acl_check_edit('Aro_groups_Controller', 'aro_group'))
|
||
Controller::Error(ACCESS);
|
||
|
||
// bad parameter
|
||
... | ... | |
{
|
||
$aro_group->transaction_rollback();
|
||
Log::add_exception($e);
|
||
status::error('Error - cannot update access control group.');
|
||
status::error('Error - cannot update access control group.', $e);
|
||
}
|
||
url::redirect (url_lang::base().'aro_groups/show/'.$aro_group->id);
|
||
}
|
||
... | ... | |
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('aro_groups/show_all', 'Access control groups of users',
|
||
$this->acl_check_edit('Settings_Controller', 'access_rights'))
|
||
$this->acl_check_view('Aro_groups_Controller', 'aro_group'))
|
||
->disable_translation()
|
||
->link('aro_groups/show/'.$aro_group->id, $aro_group->name.' ('.$aro_group->id.')',
|
||
$this->acl_check_edit('Settings_Controller', 'access_rights'))
|
||
$this->acl_check_view('Aro_groups_Controller', 'aro_group'))
|
||
->enable_translation()
|
||
->text('Edit');
|
||
|
||
... | ... | |
public function delete ($group_id = NULL)
|
||
{
|
||
// access check
|
||
if (!$this->acl_check_edit('Settings_Controller', 'access_rights'))
|
||
if (!$this->acl_check_delete('Aro_groups_Controller', 'aro_group'))
|
||
Controller::Error(ACCESS);
|
||
|
||
// bad parameter
|
||
... | ... | |
{
|
||
$group->transaction_rollback();
|
||
Log::add_exception($e);
|
||
status::error('Error - cannot delete group.');
|
||
status::error('Error - cannot delete group.', $e);
|
||
}
|
||
url::redirect('aro_groups/show_all');
|
||
}
|
Také k dispozici: Unified diff
Release 1.1.0