} } } } $smarty->assign("T_BASIC_ROLES_ARRAY", $rolesBasic); if (isset($_GET['ajax']) && $_GET['ajax'] == 'courseUsersTable') { //pr($studentRoles); $smarty->assign("T_DATASOURCE_COLUMNS", array('login', 'active_in_course', 'completed', 'to_timestamp', 'score', 'issued_certificate', 'expire_certificate', 'operations')); $smarty->assign("T_DATASOURCE_SORT_BY", 0); $constraints = array('archive' => false, 'active' => true) + createConstraintsFromSortedTable(); $constraints['condition'] = "uc.user_type in ('" . implode("','", $studentRoles) . "')"; if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) { //this applies to supervisors only $stats_filters = array(); $branches = array($_SESSION['s_current_branch']); $branchesTree = new EfrontBranchesTree(); $iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($branchesTree->getNodeChildren($_SESSION['s_current_branch'])), RecursiveIteratorIterator::SELF_FIRST)); foreach ($iterator as $key => $value) { $branches[] = $key; } $stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches) . ") AND filter_eb.assigned = 1)"); $constraints['table_filters'] = $stats_filters; } $users = $currentCourse->getCourseUsers($constraints); $totalEntries = $currentCourse->countCourseUsers($constraints); $smarty->assign("T_TABLE_SIZE", $totalEntries); foreach ($users as $key => $value) { $users[$key]->user['issued_certificate'] = $value->user['issued_certificate']; $expire_certificateTimestamp = ""; if ($value->user['issued_certificate']) { $issuedData = unserialize($value->user['issued_certificate']);
$branches[] = $key; } $stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches) . ") AND filter_eb.assigned = 1)"); } } else { $branches_array = explode(",", $_GET['branch_filter']); $flag = 1; foreach ($branches_array as $value) { $flag = $flag && eF_checkParameter($value, 'id'); } if ($flag) { if (!$_GET['subbranches']) { $stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches_array) . ") AND filter_eb.assigned = 1)"); } else { $branches = $branches_array; $branchesTree = new EfrontBranchesTree(); foreach ($branches_array as $branch) { $iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($branchesTree->getNodeChildren($branch)), RecursiveIteratorIterator::SELF_FIRST)); foreach ($iterator as $key => $value) { $branches[] = $key; } } $branches = array_unique($branches); $stats_filters[] = array("table" => "module_hcd_employee_works_at_branch as filter_eb", "joinField" => "filter_eb.users_LOGIN", "condition" => "(filter_eb.branch_ID in (" . implode(",", $branches) . ") AND filter_eb.assigned = 1)"); } } } } else { if ($currentEmployee->isSupervisor()) { $isProfessor = false; if (isset($_GET['sel_course']) && $currentUser->hasCourse($_GET['sel_course'])) {
private static function addWhereConditionToCourseConstraints($constraints) { $where = array(); if (isset($constraints['archive'])) { $constraints['archive'] ? $where[] = 'c.archive!=0' : ($where[] = 'c.archive=0'); } if (isset($constraints['active'])) { $constraints['active'] ? $where[] = 'c.active=1' : ($where[] = 'c.active=0'); } if (isset($constraints['instance'])) { if ($constraints['instance'] === true) { $where[] = 'c.instance_source!=0'; } else { if ($constraints['instance'] == false) { $where[] = 'c.instance_source=0'; } else { if (eF_checkParameter($constraints['instance'], 'id')) { $where[] = '(c.instance_source=' . $constraints['instance'] . ' or c.id=' . $constraints['instance'] . ')'; } } } } if (isset($constraints['filter']) && eF_checkParameter($constraints['filter'], 'text')) { $constraints['filter'] = trim(urldecode($constraints['filter']), "||||"); $result = eF_describeTable("courses"); $tableFields = array(); foreach ($result as $value) { $tableFields[] = "c." . $value['Field'] . ' like "%' . $constraints['filter'] . '%"'; } $where[] = "(" . implode(" OR ", $tableFields) . ")"; } if (isset($constraints['condition'])) { $where[] = $constraints['condition']; } if (isset($constraints['table_filters'])) { foreach ($constraints['table_filters'] as $constraint) { $where[] = $constraint['condition']; } } if (isset($constraints['branch_url']) && defined('G_BRANCH_URL') && G_BRANCH_URL) { $tree = new EfrontBranchesTree(); $iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($tree->getNodeChildren($_SESSION['s_current_branch'])), RecursiveIteratorIterator::SELF_FIRST)); $subbranches[] = $_SESSION['s_current_branch']; foreach ($iterator as $key => $value) { $subbranches[] = $key; } $where[] = 'cb.branches_ID in (' . implode(',', $subbranches) . ')'; } return $where; }
if ($field['rule']) { $form->addRule($field['name'], _INVALIDFIELDDATA, 'checkRule', $field['rule']); } if ($field['type'] == 'date' && $field['default_value'] == 0) { $form->setDefaults(array($field['name'] => time())); } else { $form->setDefaults(array($field['name'] => $field['default_value'])); } } elseif ($field['type'] == 'branchinfo') { if (G_VERSIONTYPE == 'enterprise') { #cpp#ifdef ENTERPRISE $loadScripts[] = 'includes/index'; $options = unserialize($field['options']); //$branches1 = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID","","father_branch_ID ASC,branch_ID ASC"); //$branches = eF_createBranchesTreeSelect($branches1, 0); $branchesTree = new EfrontBranchesTree(); $pathStrings = $branchesTree->toPathStringShortened(); if (!empty($pathStrings)) { $branches = array(0 => '') + $pathStrings; } else { $branches = array(0 => ''); } /** Create the branches selects according to this employee's data **/ if (!empty($branches)) { $userProfileFields[] = $field['name'] . '_branches'; $form->addElement('select', $field['name'] . '_branches', $options['name'], $branches, 'class = "inputSelect" id="' . $field['name'] . '_branches" name="' . $field['name'] . '_branches" onchange="javascript:change_branch(\'' . $field['name'] . '_branches\', \'' . $field['name'] . '_jobs\');change_supervisors(\'' . $field['name'] . '_branches\',\'' . $field['name'] . '_supervisors\');"'); if ($field['mandatory']) { $form->addRule($field['name'] . '_branches', _THEFIELD . ' ' . $options['name'] . ' ' . _ISMANDATORY, 'required', null, 'client'); } //IE does not support options.disabled.... Special treatment needed if ($options['job']['description'] != "") {
private function doJobCourses() { $smarty = $this->getSmartyVar(); $currentUser = $this->getCurrentUser(); $result = eF_getTableData("module_hcd_job_description j left outer join module_hcd_course_to_job_description cj on cj.job_description_ID=j.job_description_ID", "j.job_description_ID,description,branch_ID,count(courses_ID) as total_courses", "", "", "j.job_description_ID"); $branchesTree = new EfrontBranchesTree(); $branchesTreePaths = $branchesTree->toPathString(); $jobs = array(); foreach ($result as $value) { $jobsArray[$value['job_description_ID']] = $value; $jobs[$value['job_description_ID']] = $branchesTreePaths[$value['branch_ID']] . " → " . $value['description'] . " (" . $value['total_courses'] . ")"; } $form = new HTML_QuickForm("job_courses_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_administrator_tools&tab=job_courses&do=enterprise", "", null, true); $form->addElement('select', 'job', _JOBDESCRIPTION, $jobs); $form->addElement("submit", "submit", _MODULE_ADMINISTRATOR_TOOLS_COPYCOURSESELECTION, 'class = "flatButton"'); $form->addElement("static", "", _MODULE_ADMINISTRATOR_TOOLS_COPYCOURSESELECTIONTOALLSIMILARJOBS); $form->setDefaults(array("idle_from_timestamp" => $_SESSION['timestamp_from'])); if ($form->isSubmitted() && $form->validate()) { $GLOBALS['currentEmployee'] = $currentUser->aspects['hcd']; $job = new EfrontJob($form->exportValue('job')); $courses = $job->getJobCourses(); foreach ($sameJobs = $job->getSameDescriptions() as $value) { eF_deleteTableData("module_hcd_course_to_job_description", "job_description_id = '" . $value . "'"); } $job->associateCoursesToJob($courses, true); $message = str_replace(array("%x", "%y"), array(sizeof($sameJobs), sizeof($courses)), _MODULE_ADMINISTRATOR_TOOLS_SUCCESSFULLYASSIGNEDCOURSESTOJOBS); $message_type = 'success'; $this->setMessageVar($message, $message_type); } $smarty->assign("T_JOB_COURSES_FORM", $form->toArray()); }
$editedEmployee->removeJob($_GET['edit_placement']); } elseif (isset($userJobs[$newJob]) && $userJobs[$newJob]['supervisor'] != $_POST['position']) { $editedEmployee->removeJob($_GET['edit_placement']); } } $editedEmployee->addJob($editedUser, $newJob, $values['branch'], $_POST['position']); $message = _OPERATIONCOMPLETEDSUCCESFULLY; $message_type = 'success'; } } } catch (Exception $e) { handleNormalFlowExceptions($e); } $smarty->assign("T_FORM", $form->toArray()); } else { $branchTree = new EfrontBranchesTree(); $branches = $branchTree->toPathString(); $smarty->assign("T_BRANCHES_PATH", $branches); $placements = $editedEmployee->getJobs(); $smarty->assign("T_PLACEMENTS", $placements); } } } #cpp#endif function eF_local_printBranchJobs($branch) { $result = $branch->getJobDescriptions(); $branchJobs = array("--- {$branch->branch['name']} ---"); foreach ($result as $value) { $branchJobs[$value['description']] = $value['description']; }
/** * The main functionality * * (non-PHPdoc) * @see libraries/EfrontModule#getModule() */ public function getModule() { $smarty = $this->getSmartyVar(); $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir); $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink); $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl); $dir = $this->moduleBaseDir . 'assets/'; if (!is_dir($dir)) { mkdir($dir, 0755); } if ($_SESSION['s_type'] == 'administrator') { try { $form = new HTML_QuickForm("upload_files_form", "post", $this->moduleBaseUrl . '&tab=upload', "", null, true); $form->registerRule('checkParameter', 'callback', 'eF_checkParameter'); //Register this rule for checking user input with our function, eF_checkParameter $form->addElement('file', 'file', _UPLOADFILE); if (G_VERSIONTYPE == 'enterprise') { $tree = new EfrontBranchesTree(); $pathString = $tree->toPathString(); //$result = eF_getTableData("module_hcd_branch", "*", "url is not null and url !=''"); $handle = '<img id = "busy" src = "images/16x16/clock.png" style = "display:none;" alt = "{$smarty.const._LOADING}" title = "{$smarty.const._LOADING}"/><div id = "autocomplete_leaflet_branches" class = "autocomplete"></div> '; $form->addElement('static', 'sidenote', $handle); $form->addElement('text', 'leaflet_branch_autoselect', _BRANCH, 'class = "autoCompleteTextBox" id = "autocomplete"'); $form->addElement('hidden', 'leaflet_branch', '', 'id = "leaflet_branch_value"'); } $form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024); $form->addElement('submit', 'submit_upload', _UPLOAD, 'class = "flatButton"'); if ($form->isSubmitted() && $form->validate()) { $values = $form->exportValues(); try { if ($values['leaflet_branch'] && eF_checkParameter($values['leaflet_branch'], 'id')) { $branch = new EfrontBranch($values['leaflet_branch']); if (!$branch->branch['url']) { throw new Exception("You must assign a url to the selected branch to upload files for it"); } $dir = $this->moduleBaseDir . 'assets/' . $branch->branch['url']; mkdir($dir, 0755); } $filesystem = new FileSystemTree($dir); $file = $filesystem->uploadFile("file", $dir); } catch (Exception $e) { $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString()); $message = $e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>'; $message_type = failure; $this->setMessageVar($message, $message_type); } } $smarty->assign('T_UPLOAD_FORM', $form->toArray()); $url = $this->moduleBaseUrl; $basedir = $dir; $options = array('zip' => false, 'upload' => false, 'create_folder' => false, 'folders' => true); /**The file manager*/ include "file_manager.php"; } catch (Exception $e) { $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString()); $message = $e->getMessage() . ' (' . $e->getCode() . ') <a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>'; $message_type = 'failure'; $this->setMessageVar($message, $message_type); } } else { if (defined('G_BRANCH_URL') && G_BRANCH_URL) { try { $assets_path = $root_path = $this->moduleBaseDir . 'assets/' . G_BRANCH_URL; } catch (Exception $e) { //do nothing here if the directory doesn't exist } } else { $assets_path = $root_path = $this->moduleBaseDir . 'assets/'; } $files = array(); if (!empty($_GET['folder'])) { $folder = urldecode($_GET['folder']); if (is_dir($assets_path . $folder)) { $folder = new EfrontDirectory($assets_path . $folder); if (strpos(realpath($folder['path']), $root_path) === false) { throw new Exception("Invalid folder"); } $parent_folder = dirname($folder['path']); $url = urlencode(str_replace($root_path, '', $folder['path'])); $assets_path = $folder['path']; $parent_url = $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', dirname($folder['path']) . '/')); $parent_url or $parent_url = $this->moduleBaseUrl . 'assets/'; $files[] = array('text' => '.. (Up one level)', 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $parent_url); } } //pr($url);pr($parent_url); // $filesystem = new FileSystemTree($assets_path, true); foreach ($filesystem->tree as $key => $value) { if ($value instanceof EfrontDirectory) { $files[] = array('text' => basename($key), 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', $value['path'] . '/'))); } } foreach ($filesystem->tree as $key => $value) { if ($value instanceof EfrontFile) { if (is_file($this->moduleBaseDir . 'ico/' . pathinfo($key, PATHINFO_EXTENSION) . '.png')) { $icon = $this->moduleBaseLink . 'ico/' . pathinfo($key, PATHINFO_EXTENSION) . '.png'; } else { $icon = $this->moduleBaseLink . 'ico/unknown.png'; } $files[] = array('text' => basename($key), 'image' => $icon, 'href' => $this->moduleBaseLink . str_replace($this->moduleBaseDir, '', $key)); } } $smarty->assign("T_FILES", $files); } return true; }
if ($position2 = strpos($previous_url, "sidebar")) { } else { if ($position3 = strpos($previous_url, "show_profile")) { $form->setDefaults(array('previous_url' => "?new_message.php")); } else { $form->setDefaults(array('previous_url' => $previous_url)); } } /* **************************************************** */ /** MODULE HCD: Insert new radio buttons for more recipient options **/ /* **************************************************** */ // GGET DATA FOR CREATING THE SELECTS if (G_VERSIONTYPE == 'enterprise') { #cpp#ifdef ENTERPRISE require_once $path . "module_hcd_tools.php"; $branchesTree = new EfrontBranchesTree(); $branches_list = $branchesTree->toPathStringShortened(); if (!empty($branches_list)) { $smarty->assign("T_BRANCHES", 1); if ($_SESSION['s_type'] != 'administrator') { if ($currentEmployee->isSupervisor()) { foreach ($currentEmployee->getSupervisedBranches() as $value) { $employee_branches[] = $value['branch_ID']; } } else { $employee_branches = $currentEmployee->getBranches(true); } if (!empty($employee_branches)) { foreach ($branches_list as $key => $value) { if (!in_array($key, $employee_branches)) { unset($branches_list[$key]);
$constraints = array('archive' => false, 'active' => true, 'return_objects' => false); $constraints['required_fields'] = array('active_in_course', 'user_type', 'completed'); $courses = $user->getUserCoursesAggregatingResults($constraints); $totalCourses = sizeof($courses); $incompleteCourses = 0; foreach ($courses as $key => $course) { $course['completed'] or $incompleteCourses++; } if ($totalCourses) { $tooltipInfo[] = '<div class = "infoEntry"> <span>' . _COURSESINCOMPLETETOTAL . "</span><span>: " . $incompleteCourses . "/" . $totalCourses . "</span></div>"; } } if (G_VERSIONTYPE == 'enterprise') { #cpp#ifdef ENTERPRISE $branchesTree = new EfrontBranchesTree(); $pathStrings = $branchesTree->toPathString(); $jobs = $user->aspects['hcd']->getJobs(); $branches = $user->aspects['hcd']->getBranches(); foreach ($jobs as $value) { $tooltipInfo[] = ' <div class = "infoEntry"> <span>' . _JOBDESCRIPTION . '</span><span>: ' . $value['description'] . ' <b>(' . (isset($branches['supervisor'][$value['branch_ID']]) ? _SUPERVISOR : _USER) . ')</b></span> <span> ' . _ATBRANCH . ': </span><span style = "font-weight:bold">' . $pathStrings[$value['branch_ID']] . '</span> </div> '; } $supervisors = array(); foreach ($user->aspects['hcd']->getSupervisors() as $value) { $supervisors[] = formatLogin($value); }
function askBranches() { try { if (G_VERSIONTYPE == 'enterprise') { #cpp#ifdef ENTERPRISE if (!isset($_SESSION['supervises_branches'])) { include_once $path . "module_hcd_tools.php"; //Automatically fix missing branch assignments for supervisors eF_assignSupervisorMissingSubBranchesRecursive(); //discover employee role in the hierarchy eF_getRights(); } } #cpp#endif eF_checkParameter($_POST['preffix'], 'text') ? $preffix = $_POST['preffix'] : ($preffix = '%'); if ($_SESSION['s_type'] == "administrator") { $result = eF_getTableData("(module_hcd_branch LEFT OUTER JOIN (module_hcd_employee_works_at_branch JOIN users ON module_hcd_employee_works_at_branch.users_LOGIN = users.login) ON module_hcd_branch.branch_ID = module_hcd_employee_works_at_branch.branch_ID AND module_hcd_employee_works_at_branch.assigned = '1') LEFT OUTER JOIN module_hcd_branch as branch1 ON module_hcd_branch.father_branch_ID = branch1.branch_ID GROUP BY module_hcd_branch.branch_ID ORDER BY branch1.branch_ID", "module_hcd_branch.branch_ID, module_hcd_branch.name, module_hcd_branch.city, module_hcd_branch.address, sum(CASE WHEN users.active=1 THEN 1 END) as employees, sum(CASE WHEN users.active=0 THEN 1 END) as inactive_employees, branch1.branch_ID as father_ID, branch1.name as father, supervisor", ""); } elseif ($_SESSION['supervises_branches']) { $result = eF_getTableData("(module_hcd_branch LEFT OUTER JOIN (module_hcd_employee_works_at_branch JOIN users ON module_hcd_employee_works_at_branch.users_LOGIN = users.login) ON module_hcd_branch.branch_ID = module_hcd_employee_works_at_branch.branch_ID AND module_hcd_employee_works_at_branch.assigned = '1') LEFT OUTER JOIN module_hcd_branch as branch1 ON module_hcd_branch.father_branch_ID = branch1.branch_ID WHERE module_hcd_branch.branch_ID IN (" . $_SESSION['supervises_branches'] . ") GROUP BY module_hcd_branch.branch_ID ORDER BY branch1.branch_ID", "module_hcd_branch.name, module_hcd_branch.city, module_hcd_branch.address, sum(CASE WHEN users.active=1 THEN 1 END) as employees, sum(CASE WHEN users.active=0 THEN 1 END) as inactive_employees, module_hcd_branch.branch_ID, branch1.branch_ID as father_ID, branch1.name as father", ""); } else { $result = array(); } $branches = array(); foreach ($result as $value) { $branches[$value['branch_ID']] = $value; } $tree = new EfrontBranchesTree(); $branchKeys = array_keys($branches); $branchKeys = array_combine($branchKeys, $branchKeys); $branch_results = array(); foreach ($tree->toPathString() as $key => $branch) { if (isset($branchKeys[$key])) { if ($preffix == '%' || stripos($branch, $preffix) !== false || stripos($branch, htmlentities($preffix)) !== false) { $truncated = eF_truncatePath($branch, 80, 6, "...", " → "); $hiname = highlightSearch($truncated, $preffix); $branch_results[$key] = array('branch_ID' => $key, 'name' => $branch, 'path_string' => $hiname); } } } $strs = array(); $strs[] = '<ul>'; foreach ($branch_results as $key => $branch) { $strs[] = '<li id=' . $key . '>' . $branch['path_string'] . '</li>'; } $strs[] = '</ul>'; echo implode("", $strs); } catch (Exception $e) { handleAjaxExceptions($e); } }
/** * Return a list of all calendar events that should be presented to a user * that is not an administrator * * @param mixed $user A user login or an EfrontUser object * @return array A list of calendar events * @since 3.6.7 * @access public * @static */ public static function getCalendarEventsForNonAdministrator($user) { $user = EfrontUser::convertArgumentToUserLogin($user); $personalEvents = $globalEvents = $lessonEvents = $courseEvents = $groupEvents = $branchEvents = $subbranchEvents = array(); $result = eF_getTableData("calendar c", "c.*", "type = 'global' and foreign_ID=0"); foreach ($result as $value) { $globalEvents[$value['id']] = $value; } $result = eF_getTableData("lessons l, calendar ca, users_to_lessons ul", "ca.*, l.name", "ul.users_LOGIN='******' and ca.foreign_ID=ul.lessons_ID and ul.lessons_ID=l.id and l.archive=0 and ul.archive=0 and ca.type = 'lesson'"); foreach ($result as $value) { $lessonEvents[$value['id']] = $value; } $result = eF_getTableData("courses c, calendar ca, users_to_courses uc", "ca.*, c.name", "uc.users_LOGIN='******' and ca.foreign_ID=uc.courses_ID and uc.courses_ID=c.id and c.archive=0 and uc.archive=0 and ca.type = 'course'"); foreach ($result as $value) { $courseEvents[$value['id']] = $value; } $result = eF_getTableData("groups g, calendar ca, users_to_groups ug", "ca.*, g.name", "ug.users_LOGIN='******' and ca.foreign_ID=ug.groups_ID and ug.groups_ID=g.id and ca.type = 'group'"); foreach ($result as $value) { $groupEvents[$value['id']] = $value; } if (G_VERSIONTYPE == 'enterprise') { #cpp#ifdef ENTERPRISE $result = eF_getTableData("module_hcd_branch b, calendar ca, module_hcd_employee_works_at_branch wb", "ca.*, b.name", "wb.users_LOGIN='******' and ca.foreign_ID=wb.branch_ID and b.branch_ID=wb.branch_ID and ca.type = 'branch'"); foreach ($result as $value) { $branchEvents[$value['id']] = $value; } $userParentBranches = array(); $branchesTree = new EfrontBranchesTree(); $result = eF_getTableData("module_hcd_employee_works_at_branch", "branch_ID", "users_login='******' and assigned=1"); foreach ($result as $value) { foreach ($branchesTree->getNodeAncestors($value['branch_ID']) as $node) { $userParentBranches[] = $node['branch_ID']; } } $userParentBranches = array_unique($userParentBranches); if (!empty($userParentBranches)) { $result = eF_getTableData("module_hcd_branch b, calendar ca", "ca.*, b.name", "ca.foreign_ID=b.branch_ID and b.branch_ID in (" . implode(",", $userParentBranches) . ") and ca.type = 'sub_branch'"); foreach ($result as $value) { $subbranchEvents[$value['id']] = $value; } } } #cpp#endif $personalEvents = self::getUserCalendarEvents($user); $userEvents = $personalEvents + $globalEvents + $lessonEvents + $courseEvents + $groupEvents + $branchEvents + $subbranchEvents; return $userEvents; }