This commit is contained in:
Aram HARUTYUNYAN 2014-02-12 08:46:25 +00:00
parent d0962da03a
commit e634c136cf
10 changed files with 473 additions and 72 deletions

View File

@ -14,7 +14,7 @@ class WorldcheckController extends Zend_Controller_Action
}
/**
*
* Get nameIdentifier and set all data into the session
*/
public function indexAction()
{
@ -24,7 +24,8 @@ class WorldcheckController extends Zend_Controller_Action
$param->dirNom = ($dirNom)?$dirNom:$request->getParam('dirSociete');
$param->dirPrenom = $request->getParam('dirPrenom');
$param->dirType = $request->getParam('dirType');
$param->Siren = $request->getParam('siren');
$entityId = $request->getParam('entityId', null);
$user = new Scores_Utilisateur();
$session = new SessionWorldcheck();
@ -41,10 +42,45 @@ class WorldcheckController extends Zend_Controller_Action
$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();
@ -155,13 +191,141 @@ class WorldcheckController extends Zend_Controller_Action
$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('matchIdentifier', $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);
}
}

View File

@ -2,6 +2,8 @@
class Application_Model_Worldcheck extends Zend_Db_Table_Abstract
{
protected $_name = 'worldcheck';
protected $tbList = 'worldcheck_list';
protected $tbAssoc = 'worldcheck_a';
/**
* Return nameIdentifier and matchCount from local DB if found.
@ -70,4 +72,73 @@ class Application_Model_Worldcheck extends Zend_Db_Table_Abstract
}
return false;
}
/**
* Set WorldCheck associates tree data into DB
* @param array $nodeParams
* @param string $nodeType, value must be 'p'[parent] or 'a'[associate]
*/
public function setTree($nodeParams)
{
$primary = array(
'entityId'=>'',
'nameType'=>'',
'fullName'=>'',
'givenName'=>'',
'lastName'=>'');
$assoc = array(
'entityIdP'=>'',
'entityId'=>'',
'nameType'=>'',
'fullName'=>'',
'givenName'=>'',
'lastName'=>'');
$primary = array_intersect_key($nodeParams['primary'], $primary);
$sql = $this->getAdapter()->select()
->from($this->tbList, 'entityId')
->where('entityId=?', $primary['entityId']);
if (!$this->getAdapter()->fetchRow($sql)) {
$this->getAdapter()->insert($this->tbList, $primary);
}
$associates = $nodeParams['associates'];
foreach($associates as $associate) {
$associate = array_intersect_key($associate, $assoc);
$associate['entityIdP'] = $primary['entityId'];
$sql = $this->getAdapter()->select()
->from($this->tbAssoc, array('entityId', 'entityIdP'))
->where('entityId=?', $associate['entityId'])
->where('entityIdP=?', $primary['entityId']);
if (!$this->getAdapter()->fetchRow($sql)) {
$this->getAdapter()->insert($this->tbAssoc, $associate);
}
}
}
/**
* Get WorldCheck associates tree data from DB
* @param string $entityId
* @return Ambigous <multitype:, multitype:mixed Ambigous <string, boolean, mixed> >
*/
public function getTree($entityId)
{
$sql = $this->getAdapter()->select()
->from(array('a' => $this->tbAssoc), array('a.entityId', 'a.fullName', 'a.givenName', 'a.lastName', 'a.nameType'))
->join(array('l' => $this->tbList), 'a.entityIdP = l.entityId', array())
->where('a.entityIdP=?', $entityId);
$associates = $this->getAdapter()->fetchAll($sql);
$sql = $this->getAdapter()->select()
->from(array('l' => $this->tbList), array('l.entityId', 'l.fullName', 'l.givenName', 'l.lastName', 'l.nameType'))
->where('l.entityId=?', $entityId);
$primary = $this->getAdapter()->fetchRow($sql);
$output = array('primary' => $primary, 'associates' => $associates);
return $output;
}
}

View File

@ -1,64 +0,0 @@
<div id="center">
<h1>World-Check</h1>
<div id="center-recherche" style='margin-left: 10px; margin-right:10px'>
<?php if ($this->filtres) { ?>
<?php if ($this->param->dirType =='INDIVIDUAL') {?>
<div style='float:right;'>
<select name="filtre">
<?php foreach ($this->filtres as $k => $filtre) {?>
<option value="<?=$this->url(array('filtre'=>$k, 'page'=>''))?>"<?=$filtre['select']?>><?=$filtre['txt']?></option>
<?php }?>
</select>
</div>
<?php }?>
<?php }?>
<script type="text/javascript">
$('select[name=filtre]').change(function(e){
window.location = $(this).val();
});
</script>
</div>
<?php
if (!$this->resultWC)
{
?>
<div>Aucun résultat.</div>
<? }
else
{
$resultWC = $this->resultWC;
$reponse = count($resultWC)==1?'réponse':'réponses';
$title = count($resultWC).' '.$reponse.' avec les critères "'.$this->param->dirNom.' '.$this->param->dirPrenom.'"';
?>
<div style='float:left; margin-left:15px;'><?=$title;?></div>
<br/>
<div>
<ol start=<?=$this->ol_number; ?>>
<?php
foreach ($this->paginator as $entityId=>$shortData)
{
?>
<li>
<strong><a href="<?=$this->url(array('controller'=>'worldcheck', 'action'=>'matchcontent', 'matchIdentifier'=>$this->allMatches[$entityId]), null, true)?>"><?= $shortData->lastName.' '.$shortData->givenName;?></a></strong><br/>
<table>
<?php if (isset($shortData->description) && $shortData->description!='') {?>
<tr>
<td class="StyleInfoLib" width="150">Description</td>
<td class="StyleInfoData" width="450"><?=$shortData->description;?></td>
</tr>
<?php } ?>
<?php if (isset($shortData->country) && $shortData->country!='') {?>
<tr>
<td class="StyleInfoLib" width="150">Country</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($shortData->country));?></td>
</tr>
<?php } ?>
</table>
</li>
<?php } ?>
</ol>
</div>
<p><div id="center-recherche"><?php if (count($resultWC)>$this->itemCount) { echo $this->paginator; } ?></div></p>
<?php } ?>
</div>

View File

@ -0,0 +1,64 @@
<div id="center">
<h1>World-Check</h1>
<div id="center-recherche" style='margin-left: 10px; margin-right:10px'>
<?php if ($this->filtres) { ?>
<?php if ($this->param->dirType =='INDIVIDUAL') {?>
<div style='float:right;'>
<select name="filtre">
<?php foreach ($this->filtres as $k => $filtre) {?>
<option value="<?=$this->url(array('filtre'=>$k, 'page'=>''))?>"<?=$filtre['select']?>><?=$filtre['txt']?></option>
<?php }?>
</select>
</div>
<?php }?>
<?php }?>
<script type="text/javascript">
$('select[name=filtre]').change(function(e){
window.location = $(this).val();
});
</script>
</div>
<?php
if (!$this->resultWC)
{
?>
<div>Aucun résultat.</div>
<? }
else
{
$resultWC = $this->resultWC;
$reponse = count($resultWC)==1?'réponse':'réponses';
$title = count($resultWC).' '.$reponse.' avec les critères "'.$this->param->dirNom.' '.$this->param->dirPrenom.'"';
?>
<div style='float:left; margin-left:15px;'><?=$title;?></div>
<br/>
<div>
<ol start=<?=$this->ol_number; ?>>
<?php
foreach ($this->paginator as $entityId=>$shortData)
{
?>
<li>
<strong><a href="<?=$this->url(array('controller'=>'worldcheck', 'action'=>'matchcontent', 'matchIdentifier'=>$this->allMatches[$entityId]), null, true)?>"><?= $shortData->lastName.' '.$shortData->givenName;?></a></strong><br/>
<table>
<?php if (isset($shortData->description) && $shortData->description!='') {?>
<tr>
<td class="StyleInfoLib" width="150">Description</td>
<td class="StyleInfoData" width="450"><?=$shortData->description;?></td>
</tr>
<?php } ?>
<?php if (isset($shortData->country) && $shortData->country!='') {?>
<tr>
<td class="StyleInfoLib" width="150">Country</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($shortData->country));?></td>
</tr>
<?php } ?>
</table>
</li>
<?php } ?>
</ol>
</div>
<p><div id="center-recherche"><?php if (count($resultWC)>$this->itemCount) { echo $this->paginator; } ?></div></p>
<?php } ?>
</div>

View File

@ -161,6 +161,35 @@ foreach($content[0]->roles->role as $role)
<?php
if (isset($content[0]->associates->associate)) {
$wcOrganigramme = array(
'controller' => 'worldcheck',
'action' => 'organigramme',
'entityid' => $content[0]->entityId);
?>
<div class="paragraph"><a class="organigramme" title="Organigramme des associés" href="<?=$this->url($wcOrganigramme, null, true);?>">Organigramme des associés</a></div>
<script>
$( "a.organigramme" ).on('click', function(e){
e.preventDefault();
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
resizable: false,
title: $(this).attr('title'),
width: 600,
height: 650,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: { "Fermer": function() { $(this).dialog("close"); }},
close: function() { $('#confirm').remove(); }
};
$('<div id="confirm"></div>').dialog(dialogOpts);
return false;
});
</script>
<?php
foreach($content[0]->associates->associate as $associate)
{ ?>
<h2>
@ -203,16 +232,16 @@ if ($associate->associatetype=='ASSOCIATE')
?>
Associate: <?=$associate->targetEntity->names->name[0]->fullName;?>
<?php $id='/dirType/'.$dirType.'/'.$dirName.'/'.$associate->targetEntity->names->name[0]->lastName.'/dirPrenom/'.$associate->targetEntity->names->name[0]->givenName;?>
<div style='float:right;'><img class="wcheck" id="<?=$id;?>" src='/themes/default/images/worldcheck/wc-blanc.png'/></div>
<div style='float:right;'><img class="wcheck" id="<?=$id;?>" style="cursor:pointer;" src='/themes/default/images/worldcheck/wc-blanc.png'/></div>
<div style='float:right;'><a style="color:white;" href="<?=$this->url($param, null, true)?>">&nbsp;Search in Extranet&nbsp;&nbsp;</a></div>
<script>
$('img.wcheck').each(function(){
$(this).qtip({
hide: { event: 'unfocus' },
show: { solo: true, delay: 1000 },
content: { title: {button: true}, text: "Chargement...",
show: { solo: true, delay: 500 },
content: { title: 'WorldCheck', button: true, text: "Chargement...",
ajax: { url: '<?=$this->url(array('controller'=>'worldcheck','action'=>'occurence'));?>'+$(this).attr('id') } },
position: { my: "bottom left", at: "top center" }
position: { my: 'right center', at: 'left center' }
});
});
</script>

View File

@ -0,0 +1,58 @@
<div id="assocTree" class="jstree jstree-default" style="overflow:auto;"></div>
<script src="/libs/jstree/jstree.js"></script>
<script>
$("#assocTree").jstree({
"core" : { "html_titles" : true },
"plugins" : [ "themes", "json_data", "ui" ],
"json_data" : {
"data":<?=$this->data ?>,
"ajax":{
"type": 'POST',
"url": "/worldcheck/index/",
"data": function(node) {
var dirNom = node.attr("lastName");
var dirPrenom = node.attr("givenName");
var dirType = node.attr("nameType");
var entityId = node.attr("entityId");
var id = node.attr("id");
return {dirNom:dirNom, dirPrenom:dirPrenom, dirType:dirType, entityId:entityId, id:id};
},
"success": function (data) { return data; },
"error": function (xhr, ajaxOptions, thrownError){
alert('Error xhr : ' + xhr.status);
alert('Error: ' + thrownError);
}
}
},
"themes" : {
"theme" : "default",
"url" : "/libs/jstree/themes/default/style.css",
"dots" : true,
"icons" : true
}
});
//using qtip popup to get short information about each node
$("#assocTree").bind("hover_node.jstree", function (e, data) {
var id = data.rslt.obj.attr("id");
var entityId = data.rslt.obj.attr("entityId");
var entityIdP = data.inst._get_parent(data.rslt.obj).attr("entityId");
var dirNomP = data.inst._get_parent(data.rslt.obj).attr("lastName");
var dirPrenomP = data.inst._get_parent(data.rslt.obj).attr("givenName");
var dirTypeP = data.inst._get_parent(data.rslt.obj).attr("nameType");
$('#'+id).qtip({
hide: { event: 'mouseout', delay:3000 },
show: { when: false, ready: true, solo: true, delay: 1000 },
content: {
button: true,
title: 'WorldCheck',
text: 'Chargement...',
ajax: {
'url': '/worldcheck/popup',
'data': {id:id, entityId:entityId, entityIdP:entityIdP, dirNomP:dirNomP, dirPrenomP:dirPrenomP, dirTypeP:dirTypeP} }},
position: { my: 'right top', at: 'right top' },
style: {tip:false}
});
});
</script>

View File

@ -0,0 +1 @@
<?=$this->data ?>

View File

@ -0,0 +1,78 @@
<style>
.InfoTitle {
color: #535353;
font-family: Arial,Helvetica,sans-serif;
font-size: 11px;
font-weight: bold;
line-height: 16px;
vertical-align: top;
float: left;
border: none;
width:70px;
}
.InfoData {
color: #535353;
font-family: Arial,Helvetica,sans-serif;
font-size: 11px;
line-height: 16px;
float: left;
border: none;
width:230px;
word-wrap:break-word;
padding: 0px 0px 5px 0px;
}
</style>
<div>
<?php $data=$this->data;?>
<h5 style="text-align: left;"><?=$data['fullName'];?></h5>
<div>
<div class="InfoTitle">Category</div>
<div class="InfoData"><?=$data['category'];?></div>
</div>
<div>
<div class="InfoTitle">Biography</div>
<div class="InfoData"><?=$data['biography'];?></div>
</div>
<div>
<div class="InfoTitle">Relations</div>
<div class="InfoData"><?=str_replace(").", ")</br>", $data['identification']);?></div>
</div>
<div>
<div class="InfoTitle">Links</div>
<div class="InfoData">
<?php
if (strtolower($data['nameType'])=='individual')
{
$paramExtranet = array(
'controller'=>'recherche',
'action'=>'dirigeant',
'dirNom'=>$data['lastName'],
'dirPrenom'=>$data['givenName'],
);
} else {
$paramExtranet = array(
'controller'=>'recherche',
'action'=>'entreprise',
'raisonSociale'=>$data['fullName'],
);
}
?>
<a href="<?=$this->url($paramExtranet, null, true)?>">Search more in Extranet</a>
<br/>
<?php
$paramWorldcheck = array(
'controller'=>'worldcheck',
'action'=>'index',
'dirNom'=>$data['lastName'],
'dirPrenom'=>$data['givenName'],
'dirType'=>$data['nameType']
);
?>
<a href="<?=$this->url($paramWorldcheck, null, true)?>">Search more in WorldCheck</a>
</div>
</div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB