wcConfig = $configWC->worldcheck->toArray(); } /** * Get nameIdentifier and set all data into the session */ public function indexAction() { $request = $this->getRequest(); $param = new stdClass(); $dirNom = $request->getParam('dirNom'); $param->dirNom = ($dirNom)?$dirNom:$request->getParam('dirSociete'); $param->dirPrenom = $request->getParam('dirPrenom'); $param->dirType = $request->getParam('dirType'); $entityId = $request->getParam('entityId', null); $user = new Scores_Utilisateur(); $session = new SessionWorldcheck(); $wc = new WsWorldCheck(); $wcLocal = new Application_Model_Worldcheck(); //check worldcheck data correctness in the session if (!$session->getName() || $session->getName()!=$param->dirNom || substr($session->getNameIdentifier(),0,3)!='so_' || $session->getNameType()!=$param->dirType) { $param->idClient = $user->getIdClient(); $param->login = $user->getLogin(); $localDBParams = $wcLocal->getScreenerId($param); $param->matchCount = $localDBParams->matchCount; $param->nameIdentifier = $localDBParams->nameIdentifier; $session->setSession($param); } if ($entityId===null) { $this->_redirect('/worldcheck/list'); } else { $id = $request->getParam('id', null); $data = new stdClass(); $data->nameIdentifier = $session->getNameIdentifier(); $data->matchType = 'WATCHLIST'; $matchArr = $wc->getMatchesArrName($data); $paramAssoc = new stdClass(); $paramAssoc->matchIdentifier = $matchArr[$entityId]; $paramAssoc->nameType = $session->getNameType(); $nodeParam = $wc->getAssociates($paramAssoc); $wcLocal->setTree($nodeParam); $this->_redirect('/worldcheck/orgchildren/entityid/'.$entityId.'/id/'.$id); } } /** * List results of WorldCheck search */ public function listAction() { $request = $this->getRequest(); $wc = new WsWorldCheck(); $session = new SessionWorldcheck(); $param = new stdClass(); $nameIdentifier = $session->getNameIdentifier(); $matchCount = $session->getMatchCount(); $param->dirNom = $session->getName(); $param->dirPrenom = $session->getFName(); $param->dirType = $session->getNameType(); if ($matchCount!==0) { $summary = new stdClass(); $summary->nameIdentifier = $nameIdentifier; $summary->matchType = 'WATCHLIST'; $cache = new Cache(); $unfilteredWC = $cache->wcCache($this->wcConfig['cachedir'], $wc, "getSummariesArr", $summary, $nameIdentifier); //check if display all results (search by lastName), or filtered results (search by fullName) $filtre = $request->getParam('filtre', 'tout'); $resultWC = $unfilteredWC; if ($filtre=='filtered') { //get results by fullName (lastName and givenName) $filteredWC = array(); foreach ($unfilteredWC as $entityId=>$shortData) { if (stripos($shortData->lastName, $param->dirNom)!==false || stripos($param->dirNom, $shortData->lastName)!==false) { if (stripos($shortData->givenName, $param->dirPrenom)!==false || stripos($param->dirPrenom, $shortData->givenName)!==false) { $filteredWC[$entityId] = $shortData; } } } //end $resultWC = $filteredWC; } $filtres = array( 'tout' => array( 'txt'=>'Résultats par Nom', 'select'=>'', 'value' => 2, ), 'filtered' => array( 'txt'=>'Résultats précis', 'select'=>'', 'value' => 1, ) ); $filtres[$filtre]['select'] = ' selected'; $this->view->assign('filtres', $filtres); //end //paginate results list Zend_View_Helper_PaginationControl::setDefaultViewPartial('worldcheck/controls.phtml'); $paginator = Zend_Paginator::factory($resultWC); $this->view->paginator = $paginator; $itemCount = $this->wcConfig['page']['items']; $page = $this->_getParam('page', 1); $ol_number = ($page-1)*$itemCount+1; $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($itemCount); $this->view->assign('ol_number', $ol_number); $this->view->assign('itemCount', $itemCount); //end $this->view->assign('resultWC', $resultWC); $this->view->assign('allMatches', $wc->getMatchesArrName($summary)); $this->view->assign('param', $param); } } /** * Affichage le quantite des occurences de la bdd en popup. */ public function occurenceAction() { $request = $this->getRequest(); if ( $request->isXmlHttpRequest() ) { $this->_helper->layout()->disableLayout(); $data = new stdClass(); if ($request->getParam('dirType')) $data->Type = $request->getParam('dirType'); if ($request->getParam('dirNom')) $data->Nom = $request->getParam('dirNom'); if ($request->getParam('dirPrenom')) $data->Prenom = $request->getParam('dirPrenom'); if ($request->getParam('dirSociete')) $data->Societe = $request->getParam('dirSociete'); $data->Soc = new stdClass(); if ($request->getParam('dirSocNom2')) $data->Soc->Nom2 = $request->getParam('dirSocNom2'); if ($request->getParam('dirSocNomLong')) $data->Soc->NomLong = $request->getParam('dirSocNomLong'); if ($request->getParam('dirSocCommercial')) $data->Soc->NomCommercial = $request->getParam('dirSocCommercial'); if ($request->getParam('dirSocSigle')) $data->Soc->Sigle = $request->getParam('dirSocSigle'); if ($request->getParam('dirSocSigleLong')) $data->Soc->SigleLong = $request->getParam('dirSocSigleLong'); if ($request->getParam('dirSocEnseigne')) $data->Soc->Enseigne = $request->getParam('dirSocEnseigne'); if ($request->getParam('dirSocEnseigneLong')) $data->Soc->EnseigneLong = $request->getParam('dirSocEnseigneLong'); $wcLocal = new Application_Model_Worldcheck(); $this->view->assign('occurrence', $wcLocal->getCount($data)); $this->view->assign('data', $data); } } /** * Affichage le resultat de recherche en WorldCheck */ public function matchcontentAction() { $request = $this->getRequest(); $session = new SessionWorldcheck(); $param = new stdClass(); $param->matchIdentifier = $request->getParam('matchIdentifier'); $param->nameType = $session->getNameType(); $wc = new WsWorldCheck(); $nodeParam = $wc->getAssociates($param); //print_r($nodeParam); $db = new Application_Model_Worldcheck(); $db->setTree($nodeParam); $cache = new Cache(); $content = $cache->wcCache($this->wcConfig['cachedir'], $wc, "getDetailsContent", $param, $param->matchIdentifier); $this->view->assign('content', $content); $this->view->assign('nameType', $param->nameType); $this->view->assign('exportObjet', $content); } /** * le Parent de l'organigramme des associés */ public function organigrammeAction() { $this->_helper->layout()->disableLayout(); $wc = new WsWorldCheck(); $request = $this->getRequest(); $entityId = $request->getParam('entityid', null); $wcLocal = new Application_Model_Worldcheck(); $currentBranch = $wcLocal->getTree($entityId); $primary = $currentBranch['primary']; $parent = array(); $data = new stdClass(); $data->title = $primary['fullName']; $data->icon = "/themes/default/images/worldcheck/".strtolower($primary['nameType']).".png"; $attr = new stdClass(); $attr->id = uniqid('wc_'); $attr->entityId = $primary['entityId']; $attr->nameType = $primary['nameType']; $attr->lastName = $primary['lastName']; $attr->givenName = $primary['givenName']; $parent[] = array( "data" => $data, "attr" => $attr, "state" => "closed", "parent" => "#" ); $jData = json_encode($parent); $this->view->assign('data', $jData); } /** * les associés du parent de l'organigramme */ public function orgchildrenAction() { $this->_helper->layout()->disableLayout(); $wc = new WsWorldCheck(); $request = $this->getRequest(); $entityId = $request->getParam('entityid', null); $id = $request->getParam('id', null); $wcLocal = new Application_Model_Worldcheck(); $currentBranch = $wcLocal->getTree($entityId); $associates = $currentBranch['associates']; $children = array(); foreach ($associates as $associate) { $data = new stdClass(); $data->title = $associate['fullName']; $data->icon = "/themes/default/images/worldcheck/".strtolower($associate['nameType']).".png"; $attr = new stdClass(); $attr->id = uniqid('wc_'); $attr->entityId = $associate['entityId']; $attr->nameType = $associate['nameType']; $attr->lastName = $associate['lastName']; $attr->givenName = $associate['givenName']; $children[] = array( "data" => $data, "attr" => $attr, "state" => "closed", "parent" => $id, ); } $jData = json_encode($children); $this->view->assign('data', $jData); } /** * Affichage de l'information courte de chaque node dans le popup */ public function popupAction() { $this->_helper->layout()->disableLayout(); $request = $this->getRequest(); $entityId = $request->getParam('entityId', null); $entityIdP = $request->getParam('entityIdP', null); $wc = new WsWorldCheck(); $user = new Scores_Utilisateur(); $paramP = new stdClass(); $paramP->idClient = $user->getIdClient(); $paramP->dirNom = $request->getParam('dirNomP'); $paramP->dirPrenom = $request->getParam('dirPrenomP'); $paramP->dirType = $request->getParam('dirTypeP'); $wcLocal = new Application_Model_Worldcheck(); $result = $wcLocal->getScreenerId($paramP); $data = new stdClass(); $data->nameIdentifier = $result->nameIdentifier; $data->matchType = "WATCHLIST"; $matches = $wc->getMatchesArrName($data); $param = new stdClass(); $param->matchIdentifier = $matches[$entityIdP]; $param->nameType = $paramP->dirType; $associates = $wc->getAssociates($param); foreach($associates['associates'] as $assoc) { if ($assoc['entityId']==$entityId) break; } $this->view->assign('data', $assoc); } }