Пример #1
0
$_REQUEST['callback'] = get_request_variable('callback', '');
$department = new department();
$department->id_department = $id;
if ($id > 0) {
    if (!$department->Load()) {
        $department->id_department = 0;
    }
}
$department->parent_id = $parent_id;
if ($save) {
    $department->head_id = $head_id;
    if ($department->parent_id === 0) {
        $department->parent_id = null;
    }
    if ($department->head_id === 0) {
        $department->head_id = null;
    }
    $department->name = $name;
    $department->prefix = $prefix;
    $department->description = $description;
    $errors = $department->IsValidData();
    if (count($errors) == 0) {
        $department->Save();
    }
}
$employees = new collection();
$employees->Load(TABLE_EMPLOYEE, false, '', 'name ASC');
$employees = $employees->_collection;
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';