Example #1
0
 /**
  *  Akce pro zobrazení detailů vyšší organizační jednotky
  */
 public function voj()
 {
     $view =& $this->getView('Voj', $this->document->getType());
     $app = JFactory::getApplication();
     $params = $app->getParams();
     //exit(var_dump($params));
     $idUnit = $params->get('idUnit');
     $session = JFactory::getSession();
     $skautIsToken = $session->get('skautIsToken', null, 'skautIs');
     $soapOrg = new SoapClient($this->skautisUrl . '/JunakWebservice/OrganizationUnit.asmx?WSDL');
     $paramsArr = array('unitDetailInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID' => $idUnit));
     $unitDetail = @$soapOrg->UnitDetail($paramsArr)->UnitDetailResult;
     $view =& $this->getView('Voj', $this->document->getType());
     $view->assignRef('unitDetail', $unitDetail);
     //chceme kontakty?
     if ($params->get('showContacts') == 'true') {
         $paramsArr = array('unitContactAllInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID_Unit' => $idUnit));
         $unitContactAll = @$soapOrg->UnitContactAll($paramsArr)->UnitContactAllResult;
         $view->assignRef('unitContactAll', $unitContactAll);
     }
     //chceme info o bankovních účtech?
     if ($params->get('showAccounts') == 'true') {
         $paramsArr = array('accountAllInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID_Unit' => $idUnit, 'IsValid' => true));
         $accountAll = @$soapOrg->AccountAll($paramsArr)->AccountAllResult;
         $view->assignRef('accountAll', $accountAll);
     }
     //chceme informace o funkcích?
     if ($params->get('showFunctions') == 'true') {
         //nacteni funkci v jednotce
         if ($skautIsToken) {
             $paramsArr = array('functionAllInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID_Unit' => $idUnit, 'IsValid' => true));
             $functionAll = @$soapOrg->FunctionAll($paramsArr)->FunctionAllResult;
             $view->assignRef('functionAll', $functionAll);
         } else {
             $functionAllRegistry = array();
             $paramsArr = array('functionAllRegistryInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID_Unit' => $idUnit, 'ReturnStatutory' => true));
             $functionAllRegistry['Statutory'] = @$soapOrg->FunctionAllRegistry($paramsArr)->FunctionAllRegistryResult;
             $paramsArr = array('functionAllRegistryInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID_Unit' => $idUnit, 'ReturnAssistant' => true));
             $functionAllRegistry['Assistant'] = @$soapOrg->FunctionAllRegistry($paramsArr)->FunctionAllRegistryResult;
             $paramsArr = array('functionAllRegistryInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID_Unit' => $idUnit, 'ReturnContact' => true));
             $functionAllRegistry['Contact'] = @$soapOrg->FunctionAllRegistry($paramsArr)->FunctionAllRegistryResult;
             $view->assign('functionAllRegistry', (object) $functionAllRegistry);
         }
         //--nacteni funkci v jednotce
     }
     //chceme informace o podřízených jednotkách?
     if ($params->get('showUnitsTree') == 'true') {
         $paramsArr = array('unitTreeAllInput' => array('ID_Login' => $skautIsToken, 'ID_Application' => $this->skautisAppId, 'ID_UnitParent' => $idUnit, 'IsValid' => true));
         $unitTreeAll = @$soapOrg->UnitTreeAll($paramsArr)->UnitTreeAllResult;
         $view->assignRef('unitTreeAll', $unitTreeAll);
     }
     //načtení informací o článcích
     $idArticleTop = $params->get('idArticleTop');
     $idArticleBottom = $params->get('idArticleBottom');
     if ($idArticleTop || $idArticleBottom) {
         $articlesModel =& $this->getModel('Articles', 'SkautisModel');
         if ($idArticleTop > 0) {
             $view->assign('topText', $articlesModel->getArticleContent($idArticleTop));
         }
         if ($idArticleBottom > 0) {
             $view->assign('bottomText', $articlesModel->getArticleContent($idArticleBottom));
         }
     }
     $view->display();
 }
 /**
  * Call OU->UnitDetail
  *
  * @ignore
  * @param \SoapClient $ouClient Nastavený SoapClient
  * @param int $unitId
  * @param string $idLogin
  * @return \HybridAuth\SkautIS\Unit
  */
 protected function fetchUnitDetails(\SoapClient $ouClient, $unitId, $idLogin)
 {
     if (isset($this->unitDataCache[$unitId])) {
         if (!$this->unitDataCache[$unitId]) {
             return null;
         }
         return $this->unitDataCache[$unitId];
     }
     try {
         $unitDetailResult = $ouClient->UnitDetail(array("unitDetailInput" => array("ID_Login" => $idLogin, "ID" => $unitId)));
         \Hybrid_Logger::debug("Called SkautIS's OU->UnitDetail", $unitDetailResult);
     } catch (\Exception $e) {
         $this->unitDataCache[$unitId] = false;
         return null;
     }
     if ($unitDetailResult) {
         $unitObject = new Unit($unitDetailResult->UnitDetailResult);
         $this->unitDataCache[$unitId] = $unitObject;
         return $unitObject;
     }
     $this->unitDataCache[$unitId] = false;
     return null;
 }