$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; $variable_modules[$variable_module]['vars'] = array(); $variables = new collection(); $variables->Load(TABLE_VARIABLE, false, '"module"=\'' . db_class::str2base($variable_module) . '\'', '"name" ASC'); $variable_modules[$variable_module]['vars'] = $variables->_collection; } // Получаем все модули и все операции, связанные с ними $modules = new collection(); $modules->Load(TABLE_MODULE, false, '', '"name" ASC'); $modules = $modules->_collection; $module_actions = array(); for ($i = 0; $i < count($modules); $i++) { $module_action_collection = new collection(); $module_action_collection->Load(TABLE_MODULE_ACTION, false, 'module_id=' . $modules[$i]->id_module . ' AND public_flag=\'yes\'', '"name" ASC'); $module_actions[$modules[$i]->id_module] = $module_action_collection->_collection; unset($module_action_collection); } if ($save) { $role_actions = array();
$complete_flag = ''; $id = html_entity_decode(preg_replace('~%(u[a-f\\d]{4}|[a-f\\d]{2})~ie', '"&#".hexdec("$1").";"', $id), ENT_NOQUOTES, "utf-8"); $id = str_replace('..', '', $id); $db = db_class::get_instance(); echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; echo '<tree id="' . escape($id) . '">' . "\n"; $id = mb_convert_encoding($id, 'windows-1251', 'utf-8'); file_put_contents('C:\\Temp\\aaa.txt', SITE_PROJECT_FILE_ROOT . $id); if ($id === 'root') { if (access_enable($STORAGE, 'project', 'view')) { $status = 'active'; $where = array(); $where[] = '"status"=\'' . $db->str2base($status) . '\''; $query = 'SELECT * FROM "' . TABLE_PROJECT . '"'; if ($complete_flag != '') { $where[] = '"complete_flag"=\'' . db_class::str2base($complete_flag) . '\''; } if (!check_current_employee_admin($STORAGE)) { $query .= ' LEFT JOIN "' . TABLE_PROJECT_EMPLOYEE . '" ON "id_project"="project_id"'; $where[] = '"employee_id"=' . $STORAGE['current_employee']->id_employee; } if (count($where) > 0) { $query .= ' WHERE ' . join(' AND ', $where); } $db->query($query); $projects = $db->value; for ($i = 0; $i < count($projects); $i++) { $childs = false; if (file_exists(SITE_PROJECT_FILE_ROOT . $projects[$i]['id_project']) && is_dir(SITE_PROJECT_FILE_ROOT . $projects[$i]['id_project'])) { $files = scandir(SITE_PROJECT_FILE_ROOT . $projects[$i]['id_project']); if (count($files) > 2) {