Issue #0001653: Petite optimisation du code

This commit is contained in:
Aram HARUTYUNYAN 2014-02-14 08:44:22 +00:00
parent 2cf3d88763
commit 864baed501
2 changed files with 34 additions and 34 deletions

View File

@ -196,9 +196,9 @@ class WorldcheckController extends Zend_Controller_Action
$cache = new Cache();
$content = $cache->wcCache($this->wcConfig['cachedir'], $wc, "getDetailsContent", $param, $param->matchIdentifier);
$this->view->assign('content', $content);
$this->view->assign('content', $content[0]);
$this->view->assign('nameType', $param->nameType);
$this->view->assign('exportObjet', $content);
$this->view->assign('exportObjet', $content[0]);
}
/**

View File

@ -13,19 +13,19 @@
} else {
$content = $this->content;
?>
<h2><?=$this->content[0]->names->name[0]->fullName;?>
<h2><?=$content->names->name[0]->fullName;?>
<?php
if (strtolower($this->nameType)=='individual')
{
$day = $month = $year = '';
if ($content[0]->events->event[0]->day>0) $day = $content[0]->events->event[0]->day;
if ($content[0]->events->event[0]->month>0) $month = $content[0]->events->event[0]->month;
if ($content[0]->events->event[0]->year>0) $year = $content[0]->events->event[0]->year;
if ($content->events->event[0]->day>0) $day = $content->events->event[0]->day;
if ($content->events->event[0]->month>0) $month = $content->events->event[0]->month;
if ($content->events->event[0]->year>0) $year = $content->events->event[0]->year;
$param = array(
'controller'=>'recherche',
'action'=>'dirigeant',
'dirNom'=>$content[0]->names->name[0]->lastName,
'dirPrenom'=>$content[0]->names->name[0]->givenName,
'dirNom'=>$content->names->name[0]->lastName,
'dirPrenom'=>$content->names->name[0]->givenName,
'dirDateNaissJJ' =>$day,
'dirDateNaissMM' =>$month,
'dirDateNaissAAAA' =>$year,
@ -36,7 +36,7 @@ if (strtolower($this->nameType)=='individual')
'controller'=>'recherche',
'action'=>'entreprise',
'siret'=>'',
'raisonSociale'=>$content[0]->names->name[0]->fullName,
'raisonSociale'=>$content->names->name[0]->fullName,
'numero'=>'',
'voie'=>'',
'cpVille' =>'',
@ -51,39 +51,39 @@ if (strtolower($this->nameType)=='individual')
</h2>
<div class="paragraph">
<table cellpadding=3>
<?php if (isset($content[0]->category)) { ?>
<?php if (isset($content->category)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Category</td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($content[0]->category));?></div></td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($content->category));?></div></td>
</tr>
<?php } ?>
<?php
if (isset($content[0]->names->name)){?>
if (isset($content->names->name)){?>
<tr>
<td class="StyleInfoLib" width="150">All names</td>
<td class="StyleInfoData"><div class="wrap">
<?php
foreach($content[0]->names->name as $name)
foreach($content->names->name as $name)
{
if (isset($name->fullName) && $name->fullName!='') {echo $name->fullName.'<br/>';}
} ?>
</div></td></tr>
<?php } ?>
<?php if (isset($content[0]->gender)) { ?>
<?php if (isset($content->gender)) { ?>
<tr><td class="StyleInfoLib" width="150">Gender</td>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($content[0]->gender));?></div></td></tr>
<td class="StyleInfoData"><div class="wrap"><?=ucfirst(strtolower($content->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)) { ?>
<?php if (isset($content->events->event) && ($content->events->event[0]->day>0) && ($content->events->event[0]->month>0) && ($content->events->event[0]->year>0)) { ?>
<tr><td class="StyleInfoLib" width="150">Birthday</td>
<?php $date = new Zend_Date($content[0]->events->event[0]->fullDate, 'yyyy-MM-dd');?>
<?php $date = new Zend_Date($content->events->event[0]->fullDate, 'yyyy-MM-dd');?>
<td class="StyleInfoData"><div class="wrap"><?=$date->toString('dd/MM/yyyy')?></div></td></tr>
<?php } ?>
<?php if (isset($content[0]->events->event[0]->address->region)) { ?>
<?php if (isset($content->events->event[0]->address->region)) { ?>
<tr><td class="StyleInfoLib" width="150">Birth place</td>
<td class="StyleInfoData"><div class="wrap"><?=$content[0]->events->event[0]->address->region;?></div></td></tr>
<td class="StyleInfoData"><div class="wrap"><?=$content->events->event[0]->address->region;?></div></td></tr>
<?php } ?>
<?php
foreach($content[0]->details->detail as $detail)
foreach($content->details->detail as $detail)
{ ?>
<?php if (isset($detail->text)) { ?>
<tr>
@ -92,12 +92,12 @@ foreach($content[0]->details->detail as $detail)
</tr>
<?php }} ?>
<?php
if (isset($content[0]->addresses->address[0])){
if (isset($content->addresses->address[0])){
?>
<tr><td class="StyleInfoLib" width="150">All Addresses</td>
<td class="StyleInfoData"><div class="wrap">
<?php
foreach($content[0]->addresses->address as $address) {
foreach($content->addresses->address as $address) {
$fullAddress = array();
if (isset($address->city)) { $fullAddress[] = $address->city;}
if (isset($address->region)) { $fullAddress[] = $address->region;}
@ -108,8 +108,8 @@ foreach($content[0]->addresses->address as $address) {
</div></td></tr>
<?php } ?>
<?php
if (isset($content[0]->actionDetails->actionDetail)){
foreach($content[0]->actionDetails->actionDetail as $actionDetail)
if (isset($content->actionDetails->actionDetail)){
foreach($content->actionDetails->actionDetail as $actionDetail)
{?>
<tr><td class="StyleInfoLib" width="150"><?=ucfirst(strtolower($actionDetail->actionType)); ?></td>
<td class="StyleInfoData"><div class="wrap"><?=$actionDetail->text;?></div></td></tr>
@ -118,7 +118,7 @@ if (isset($content[0]->actionDetails->actionDetail)){
<?php }} ?>
<?php
foreach($content[0]->countryLinks->countryLink as $countryLink)
foreach($content->countryLinks->countryLink as $countryLink)
{ ?>
<?php if (isset($countryLink->countryText)) { ?>
<tr>
@ -128,8 +128,8 @@ foreach($content[0]->countryLinks->countryLink as $countryLink)
<?php } ?>
<?php } ?>
<?php
if (isset($content[0]->sources->sourceDetail)){
foreach($content[0]->sources->sourceDetail as $source)
if (isset($content->sources->sourceDetail)){
foreach($content->sources->sourceDetail as $source)
{
if (isset($source->name) && $source->name!='') { ?>
<tr><td class="StyleInfoLib" width="150"><?=$source->ProviderSourceTypeDetail->category->name?></td>
@ -138,18 +138,18 @@ foreach($content[0]->sources->sourceDetail as $source)
<td class="StyleInfoData"><div class="wrap"><?=$source->name.' ('.$source->abbreviation.')';?></div></td></tr>
<?php }}} ?>
<?php
if (isset($content[0]->roles->role)){
foreach($content[0]->roles->role as $role)
if (isset($content->roles->role)){
foreach($content->roles->role as $role)
{
if (isset($role->title) && $role->title!='') { ?>
<tr><td class="StyleInfoLib" width="150"><?=$role->type?></td>
<td class="StyleInfoData"><div class="wrap"><?=$role->title;?></div></td></tr>
<?php }}} ?>
<?php if (isset($content[0]->weblinks->weblink)) { ?>
<?php if (isset($content->weblinks->weblink)) { ?>
<tr>
<td class="StyleInfoLib" width="150">Weblinks</td>
<td class="StyleInfoData"><div class="wrap">
<?php foreach($content[0]->weblinks->weblink as $weblink)
<?php foreach($content->weblinks->weblink as $weblink)
{ ?>
<a href="<?=$weblink->URI;?>" target="_blank"><?=$weblink->URI;?></a><br/>
<?php } ?>
@ -160,11 +160,11 @@ foreach($content[0]->roles->role as $role)
</div>
<?php
if (isset($content[0]->associates->associate)) {
if (isset($content->associates->associate)) {
$wcOrganigramme = array(
'controller' => 'worldcheck',
'action' => 'organigramme',
'entityid' => $content[0]->entityId);
'entityid' => $content->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>
@ -190,7 +190,7 @@ $( "a.organigramme" ).on('click', function(e){
});
</script>
<?php
foreach($content[0]->associates->associate as $associate)
foreach($content->associates->associate as $associate)
{ ?>
<h2>
<?php