コード例 #1
0
ファイル: edit.php プロジェクト: YuriyRusinov/reper
        $db->begin();
        // Save user roles
        if (access_enable($STORAGE, $STORAGE['module'], 'role')) {
            $employee->DeleteEmployeeRoles();
            reset($enabled_employee_roles);
            $employee_role = new employee_role();
            $employee_role->employee_id = $employee->id_employee;
            while (list(, $role_id) = each($enabled_employee_roles)) {
                $employee_role->role_id = $role_id;
                $employee_role->Save();
            }
        }
        $db->commit();
    }
} else {
    $enabled_employee_roles = $employee->GetEmployeeRolesId();
}
$department_name = '---';
if ($employee->department_id > 0) {
    $department = new department();
    $department->id_department = $employee->department_id;
    if ($department->Load()) {
        $department_name = $department->name;
    }
}
$enabled_employee_roles = array_flip($enabled_employee_roles);
$where = '';
//if ($employee->id_employee>0) $where = 'id_employee<>'.$employee->id_employee;
$employees = new collection();
$employees->Load(TABLE_EMPLOYEE, false, $where, 'name ASC');
$employees = $employees->_collection;