function modifyAreaUnidad() { $permits = $this->session->userdata(); if (!$this->access) { redirect('inicio'); } $val = is_null($this->session->flashdata('success')) ? 2 : $this->session->flashdata('success'); $result = array('title' => 'Configuración de Areas y Unidades', 'success' => $val, 'departments' => getAllOrgsByDpto($this->Organization_model)); $this->load->view('configurar-areas-unidades', array_merge($result, defaultResult($permits, $this->Dashboard_model))); }
function getTree($orgs) { $all = getAllOrgsByDpto($this->Organization_model); $result = $all; foreach ($all as $key_data => $data) { foreach ($data['areas'] as $key_area => $area) { foreach ($area['unidades'] as $key_unit => $unidad) { if (is_array($orgs) && !in_array($unidad->getId(), $orgs)) { unset($result[$key_data]['areas'][$key_area]['unidades'][$key_unit]); } } $result[$key_data]['areas'][$key_area]['unidades'] = array_values($result[$key_data]['areas'][$key_area]['unidades']); if (count($result[$key_data]['areas'][$key_area]['unidades']) == 0 && is_array($orgs) && !in_array($result[$key_data]['areas'][$key_area]['area']->getId(), $orgs)) { unset($result[$key_data]['areas'][$key_area]); } } $result[$key_data]['areas'] = array_values($result[$key_data]['areas']); if (count($result[$key_data]['areas']) == 0) { unset($result[$key_data]); } } return $result; }
public function configurarMetricas() { $permits = $this->session->userdata(); if (count($permits['conf']['edit']) + count($permits['conf']['view']) <= 0) { redirect('inicio'); } $success = $this->session->flashdata('success'); if (is_null($success)) { $success = 2; } $this->load->model('Organization_model'); $this->load->model('Dashboard_model'); $this->load->model('Metrics_model'); $metrics = $this->Metrics_model->getAllMetrics(); $result = array('departments' => getAllOrgsByDpto($this->Organization_model), 'metrics' => $metrics, 'success' => $success); $this->load->view('configurar-metricas', array_merge($result, defaultResult($permits, $this->Dashboard_model))); }