Issue #0001653: modified to be able select nameType (Individual or Organisation)

This commit is contained in:
Aram HARUTYUNYAN 2013-08-27 11:35:09 +00:00
parent 34ce491d13
commit 9da60b4254
6 changed files with 94 additions and 49 deletions

View File

@ -16,6 +16,7 @@ class WorldcheckController extends Zend_Controller_Action
{
$request = $this->getRequest();
$param = new stdClass();
$request->getParam('dirNom');
$param->dirNom = $request->getParam('dirNom');
$param->dirPrenom = $request->getParam('dirPrenom');
$param->dirType = $request->getParam('dirType');
@ -39,6 +40,7 @@ class WorldcheckController extends Zend_Controller_Action
$wcheck->screenerNameIdentifier = $this->nameIdentifier;
$wcheck->screenerName = $param->dirNom;
$wcheck->matchCount = $localDBParams->matchCount;
$wcheck->nameType = $param->dirType;
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
@ -63,21 +65,24 @@ class WorldcheckController extends Zend_Controller_Action
$unfilteredWC = $wc->getSummariesArr($summary);
//end
//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
//check if display all results (search by lastName), or filtered results (search by fullName)
$filtre = $request->getParam('filtre', 'tout');
$resultWC = ($filtre=='filtered')?$filteredWC:$unfilteredWC;
$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(
@ -120,12 +125,14 @@ class WorldcheckController extends Zend_Controller_Action
public function matchcontentAction()
{
$request = $this->getRequest();
$user = new Scores_Utilisateur();
$param = new stdClass();
$param->matchIdentifier = $request->getParam('matchIdentifier');
$param->nameType = $user->getNameType();
$wc = new WsWorldCheck();
$content = $wc->getDetailsContent($param->matchIdentifier);
$content = $wc->getDetailsContent($param);
$this->view->assign('matchIdentifier', $param->matchIdentifier);
$this->view->assign('content', $content);

View File

@ -30,6 +30,7 @@ class Application_Model_Worldcheck extends Zend_Db_Table_Abstract
'nameIdentifier' => $result->nameIdentifier,
'matchCount' => $result->matchCount,
'name' => $data->name,
'nameType' => $data->nameType,
'dateInsert' => date('Y-m-d')
);
$sql = $this->insert($param);

View File

@ -1,4 +1,11 @@
<div id="center">
<style>
.wrap {
border: none;
width:450px;
word-wrap:break-word;
}
</style>
<h1>World-Check</h1>
<?php
require_once 'common/dates.php';
@ -7,7 +14,7 @@ $content = array();
if (!$this->content)
{
?>
<p><div style='margin-left: 10px;'>Aucune Information</div></p>
<p><div style='margin-left: 10px;'>Aucune Information</div></div>
<?php
}
else
@ -20,31 +27,31 @@ else
<?php if (isset($content[0]->category)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Category</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($content[0]->category));?></td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($content[0]->category));?></div></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->gender)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Gender</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($content[0]->gender));?></td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($content[0]->gender));?></div></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->events->event) && ($content[0]->events->event[0]->day>0) && ($content[0]->events->event[0]->month>0) && ($content[0]->events->event[0]->year>0)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Birthday</td>
<td class="StyleInfoData" width="450"><?=$wdate->dateT('Y-m-d', 'd/m/Y', $content[0]->events->event[0]->fullDate);?></td>
<td class="StyleInfoData"><div class="wrap"><?=$wdate->dateT('Y-m-d', 'd/m/Y', $content[0]->events->event[0]->fullDate);?></div></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->events->event[0]->address->region)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Birth place</td>
<td class="StyleInfoData" width="450"><?=$content[0]->events->event[0]->address->region;?></td>
<td class="StyleInfoData"><div class="wrap"><?=$content[0]->events->event[0]->address->region;?></div></td>
</tr>
<?php } ?>
<?php if (isset($content[0]->countryLinks->countryLink[0]->countryText)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Nationality</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($content[0]->countryLinks->countryLink[0]->countryText));?></td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($content[0]->countryLinks->countryLink[0]->countryText));?></div></td>
</tr>
<?php } ?>
<?php
@ -52,41 +59,47 @@ foreach($content[0]->details->detail as $detail)
{ ?>
<?php if (isset($detail->text)) { ?>
<tr>
<td class="StyleInfoLib" width="150"><?=ucfirst(strtolower($detail->detailType));?></td>
<td class="StyleInfoData" width="450"><?=$detail->text;?></td>
<td class="StyleInfoLib" width="150"><?=ucfirst(strtolower($detail->detailType));?></div></td>
<td class="StyleInfoData"><div class="wrap"><?=$detail->text;?></td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="StyleInfoLib" width="150">Address</td>
<td class="StyleInfoData"><div class="wrap">
<?php
$address = array();
if (isset($content[0]->addresses->address[0]->city)) { $address[] = $content[0]->addresses->address[0]->city;}
if (isset($content[0]->addresses->address[0]->region)) { $address[] = $content[0]->addresses->address[0]->region;}
if (isset($content[0]->addresses->address[0]->country)) { $address[] = ucfirst(strtolower($content[0]->addresses->address[0]->country->name));}
if (isset($content[0]->addresses->address[0])){
foreach($content[0]->addresses->address as $address) {
$fullAddress = array();
if (isset($address->city)) { $fullAddress[] = $address->city;}
if (isset($address->region)) { $fullAddress[] = $address->region;}
if (isset($address->country)) { $fullAddress[] = ucfirst(strtolower($address->country->name));}
?>
<td class="StyleInfoData" width="450"><?=implode(', ', $address);?></td>
<?=implode(', ', $fullAddress);?>
<br/>
<?php unset($fullAddress); }}?>
</div></td>
</tr>
<?php
if (isset($content[0]->roles->role)){
foreach($content[0]->roles->role as $role)
{ ?>
<?php if (isset($role->title)) { ?>
<?php if (isset($role->title) && $role->title!='') { ?>
<tr>
<td class="StyleInfoLib" width="150"><?=$role->type?></td>
<td class="StyleInfoData" width="450"><?=$role->title;?></td>
<td class="StyleInfoData"><div class="wrap"><?=$role->title;?></div></td>
</tr>
<?php } ?>
<?php }} ?>
<?php if (isset($content[0]->weblinks->weblink)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Weblinks</td>
<td class="StyleInfoData" width="450">
<td class="StyleInfoData"><div class="wrap">
<?php foreach($content[0]->weblinks->weblink as $weblink)
{ ?>
<a href="<?=$weblink->URI;?>" target="_blank"><?=$weblink->URI;?></a><br/>
<?php } ?>
</td>
</div></td>
</tr>
<?php } ?>
</table>
@ -112,25 +125,25 @@ Associate: <?=$associate->targetEntity->names->name[0]->fullName;?>
<?php if (isset($associate->targetEntity->category)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Category</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($associate->targetEntity->category));?></td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($associate->targetEntity->category));?></div></td>
</tr>
<?php } ?>
<?php if (isset($associate->targetEntity->gender)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Gender</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($associate->targetEntity->gender));?></td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($associate->targetEntity->gender));?></div></td>
</tr>
<?php } ?>
<?php if (isset($associate->targetEntity->events->event) && ($associate->targetEntity->events->event[0]->day>0) && ($associate->targetEntity->events->event[0]->month>0) && ($associate->targetEntity->events->event[0]->year>0)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Birthday</td>
<td class="StyleInfoData" width="450"><?=$wdate->dateT('Y-m-d', 'd/m/Y', $associate->targetEntity->events->event[0]->fullDate);?></td>
<td class="StyleInfoData"><div class="wrap"><?=$wdate->dateT('Y-m-d', 'd/m/Y', $associate->targetEntity->events->event[0]->fullDate);?></div></td>
</tr>
<?php } ?>
<?php if (isset($associate->targetEntity->countryLinks->countryLink[0]->countryText)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Nationality</td>
<td class="StyleInfoData" width="450"><?=ucfirst(strtolower($associate->targetEntity->countryLinks->countryLink[0]->countryText));?></td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($associate->targetEntity->countryLinks->countryLink[0]->countryText));?></div></td>
</tr>
<?php } ?>
<?php
@ -139,29 +152,35 @@ foreach($associate->targetEntity->details->detail as $detailAssoc)
<?php if (isset($detailAssoc->text)) { ?>
<tr>
<td class="StyleInfoLib" width="150"><?=ucfirst(strtolower($detailAssoc->detailType)); ?></td>
<td class="StyleInfoData" width="450"><?=$detailAssoc->text;?></td>
<td class="StyleInfoData"><div class="wrap"><?=$detailAssoc->text;?></div></td>
</tr>
<?php } ?>
<?php } ?>
<tr>
<td class="StyleInfoLib" width="150">Adresse</td>
<td class="StyleInfoData"><div class="wrap">
<?php
$address = array();
if (isset($associate->targetEntity->addresses->address[0]->city)) { $address[] = $associate->targetEntity->addresses->address[0]->city;}
if (isset($associate->targetEntity->addresses->address[0]->region)) { $address[] = $associate->targetEntity->addresses->address[0]->region;}
if (isset($associate->targetEntity->addresses->address[0]->country)) { $address[] = ucfirst(strtolower($associate->targetEntity->addresses->address[0]->country->name));}
if (isset($associate->targetEntity->addresses->address[0])){
foreach($associate->targetEntity->addresses->address as $address) {
$fullAddress = array();
if (isset($address->city)) { $fullAddress[] = $address->city;}
if (isset($address->region)) { $fullAddress[] = $address->region;}
if (isset($address->country)) { $fullAddress[] = ucfirst(strtolower($address->country->name));}
?>
<td class="StyleInfoData" width="450"><?=implode(', ', $address);?></td>
<?=implode(', ', $fullAddress);?>
<br/>
<?php unset($fullAddress); }}?>
</div></td>
</tr>
<?php if (isset($associate->targetEntity->weblinks->weblink)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Weblinks</td>
<td class="StyleInfoData" width="450">
<td class="StyleInfoData"><div class="wrap">
<?php foreach($associate->targetEntity->weblinks->weblink as $weblink)
{ ?>
<a href="<?=$weblink->URI;?>" target="_blank"><?=$weblink->URI;?></a><br/>
<?php } ?>
</td>
</div></td>
</tr>
<?php } ?>
</table></div>

View File

@ -312,6 +312,21 @@ class Scores_Utilisateur
}
}
/**
* Retourne nameType of WorldCheck search
*/
public function getNameType()
{
if (isset($this->identity->wcheck))
{
return $this->identity->wcheck->nameType;
}
else
{
return false;
}
}
/**
* Retourne match count of WorldCheck search by lastName
*/

View File

@ -119,16 +119,18 @@ class WsWorldCheck
/**
* getDetails
* @param string matchIdentifier
* @param object: matchIdentifier, nameType
* @return object content
*/
public function getDetailsContent($matchIdentifier)
public function getDetailsContent($params)
{
$client = $this->loadClientWC('content');
$param = new stdClass();
$param->matchIdentifier = $matchIdentifier;
$nameType = strtolower($params->nameType);
$param->matchIdentifier = $params->matchIdentifier;
try {
return $client->getDetails($param)->return->entitySet->entities->individual;
if ($nameType=='individual') return $client->getDetails($param)->return->entitySet->entities->individual;
else return $client->getDetails($param)->return->entitySet->entities->organisation;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;

View File

@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `worldcheck` (
`idClient` char(5) NOT NULL,
`nameIdentifier` varchar(23) NOT NULL,
`name` varchar(50) NOT NULL,
`nameType` varchar(12) NOT NULL,
`matchCount` int(4) DEFAULT NULL,
`dateInsert` date NOT NULL,
PRIMARY KEY (`id`)