예제 #1
0
파일: edit.php 프로젝트: YuriyRusinov/reper
<?php

$page_title = 'Редактирование роли';
$id = intval(get_request_variable('id', 0));
$parent_id = intval(get_request_variable('parent_id', 0));
$name = get_request_variable('name', '');
$save = get_request_variable('save', '');
$enabled_action = get_request_variable('enabled_action', array());
$enabled_role_variables = get_request_variable('enabled_role_variables', array());
$_REQUEST['callback'] = get_request_variable('callback', '');
$role_actions = array();
$role = new role();
$role->id_role = $id;
if ($id > 0) {
    if (!$role->Load()) {
        $role->id_role = 0;
    } else {
        $role_actions = $role->GetRoleActionsId();
        $role_actions = array_flip($role_actions);
        $role_variables = $role->GetRoleVariablesId();
        $role_variables = array_flip($role_variables);
    }
}
// Получаем все типы дополнительных полей и сами поля
$variable = new variable();
$variable_modules = $variable->GetModules();
reset($variable_modules);
$variables = array();
while (list($variable_module, $variable_module_name) = each($variable_modules)) {
    $variable_modules[$variable_module] = array();
    $variable_modules[$variable_module]['name'] = $variable_module_name;
예제 #2
0
<?php

$page_title = 'Удаление роли';
$errors = array();
$id = intval(get_request_variable('id', 0));
$_REQUEST['callback'] = get_request_variable('callback', '');
$role = new role();
$role->id_role = $id;
if ($id > 0) {
    if ($role->Load()) {
        $errors = $role->IsValidData();
        if (!$errors) {
            $role->Delete();
        }
    }
}
include SITE_FILE_ROOT . 'template/simple_header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/' . $STORAGE['action'] . '.php';
include SITE_FILE_ROOT . 'template/simple_footer.php';