/** * Gera Menus para a View */ public function getMenu() { # Monto a opção de escolha dos sistemas do Usuario try { $sess = Session::getLiveSession('sisicmbio', 'USER'); SIALException::ThrowsExceptionIfParamIsNull($sess, 'Não foi encontrada a sessão para o objeto informado'); } catch (SIALException $e) { # Não foi encontrada a Sessão para Este Sistema header("Location: " . $this->bootstrap()->config()->get('app')->get('authSystem')); } $count = 0; foreach ($sess->sistemas as $sistema) { $arrSistema[$count]['href'] = $sistema['sqSistema']; $arrSistema[$count]['text'] = $sistema['sgSistema']; $count++; } $Menuoptions = array('__DIVIDER_VERTICAL__', 'Início' => array(), '__DIVIDER_VERTICAL__', 'Sistemas' => $arrSistema, '__DIVIDER_VERTICAL__'); $menuParam = new \stdClass(); $menuParam->options = $Menuoptions; $menuParam->type = 'h'; $this->_SIALApplication->set('menuH', $this->getSAF()->create('menu', $menuParam)); $this->_SIALApplication->set('param', array('nome' => $sess->noPessoa, 'perfil' => $sess->noPerfil, 'uorg' => isset($sess->noUnidadeOrg) ? $sess->noUnidadeOrg : NULL, 'help' => 'HTML', 'sysId' => $sess->sqSistema, 'multiProfile' => count($sess->allProfile) > 1 ? TRUE : FALSE)); # Monta os Menus $menu = $sess->MenuExterno; $arrMenu = array(); foreach ($menu as $no) { #Sq da Raíz $curr = $no['MenuPai']['sqMenu']; $arrMenu[$curr]['text'] = $no['MenuPai']['noMenu']; $arrMenu[$curr]['href'] = $no['Acao']; #adiciona cada filho if (isset($no['MenuFilho'])) { foreach ($no['MenuFilho'] as $filho) { if (isset($filho['Acao']) && NULL !== $filho['Acao']) { $arrMenu[$curr][$filho['MenuFilho']['sqMenu']]['href'] = $filho['Acao']; } if (!empty($filho['MenuFilho']['noMenu'])) { $arrMenu[$curr][$filho['MenuFilho']['sqMenu']]['text'] = $filho['MenuFilho']['noMenu']; } } } if (isset($no['MenuNeto'])) { foreach ($no['MenuNeto'] as $menuNeto) { $netoList = current($menuNeto); if (isset($arrMenu[$curr][$netoList['sqMenuPai']])) { $arrMenu[$curr][$netoList['sqMenuPai']][$netoList['sqMenu']]['href'] = isset($menuNeto['Acao']) ? $menuNeto['Acao'] : '#'; if (isset($netoList['noMenu'])) { $arrMenu[$curr][$netoList['sqMenuPai']][$netoList['sqMenu']]['text'] = $netoList['noMenu']; } } } } } $menuParam = new \stdClass(); $menuParam->title = 'Menu'; $menuParam->options = $arrMenu; $menuParam->type = 'v'; $this->_SIALApplication->set('menuV', $this->getSAF()->create('menu', $menuParam)); }