Issue #0001653: use ajax call for qtip in dirigeant/liste and identite/fiche

This commit is contained in:
Aram HARUTYUNYAN 2013-09-19 08:15:33 +00:00
parent b74dee239a
commit 8f487fb10f
7 changed files with 92 additions and 81 deletions

View File

@ -87,13 +87,29 @@ class WorldcheckController extends Zend_Controller_Action
$this->view->assign('filtres', $filtres);
//end
$configWC = new Zend_Config_Ini('/Worldcheck/applicationWC.ini');
$cacheConfig = $configWC->worldcheck->toArray();
$frontendOptions = array(
'lifetime' => $cacheConfig['cachedir']['lifetime'],
'automatic_serialization' => true
);
$backendOptions = array('cache_dir' => $cacheConfig['cachedir']['path'].$cacheConfig['cachedir']['name']);
$cache = Zend_Cache::factory('Output','File',$frontendOptions,$backendOptions);
//paginate results list
Zend_View_Helper_PaginationControl::setDefaultViewPartial('worldcheck/controls.phtml');
$paginator = Zend_Paginator::factory($resultWC);
$this->view->paginator = $paginator;
$itemCount = 15;
$itemCount = $cacheConfig['page']['items'];
$page = $this->_getParam('page', 1);
$ol_number = ($page-1)*$itemCount+1;
if(!($cache->load('page_'.$page))) {
$cache->save($paginator, 'page_'.$page);
}
$paginator->setCurrentPageNumber($page);
$paginator->setItemCountPerPage($itemCount);
@ -109,27 +125,21 @@ class WorldcheckController extends Zend_Controller_Action
/**
* Affichage le quantite des occurences de la bdd en popup.
* Changer le couleur de l'icone WorldCheck en gris, s'il n'y a pas d'occurence
*/
public function occurenceAction()
{
$request = $this->getRequest();
if ( $request->isXmlHttpRequest() ) {
//use in future if Ajax call needed
} else {
$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');
if ($request->getParam('siren')) $data->Siren = $request->getParam('siren');
$wcLocal = new Application_Model_Worldcheck();
$occurrence = $wcLocal->getCount($data);
$this->view->assign('occurrence', $occurrence);
$this->view->assign('data', $data);
$this->view->assign('occurrence', $wcLocal->getCount($data));
}
}

View File

@ -102,15 +102,25 @@ table.data td { border:1px solid #ccc; padding:5px; }
</td>
<?php if (empty($this->AutrePage)) { ?>
<?php if( $this->permission ) { ?>
<td>
<?php
if ($dir->Societe != '') {
echo $this->action('occurence','worldcheck', null, array('dirSociete'=>$dir->Societe, 'dirType' =>'ORGANISATION', 'siren'=>$dir->Siren));
}
if ($dir->Nom != '') {
echo $this->action('occurence','worldcheck', null, array('dirNom'=>$dir->Nom, 'dirPrenom'=>$dir->Prenom, 'dirType' =>'INDIVIDUAL', 'siren'=>$dir->Siren));
}
?>
<?php if ($dir->Societe != '') { ?>
<a class="wcheck" id="<?='/dirType/ORGANISATION/dirSociete/'.$dir->Societe;?>" href="<?=$this->url(array(
'controller'=>'worldcheck',
'action'=>'index',
'dirSociete'=>$dir->Societe,
'dirType' =>'ORGANISATION',
'siren'=>$dir->Siren), null, true)?>"><img src='/themes/default/images/worldcheck/wc.png'/></a>
<?php }
if ($dir->Nom != '') { ?>
<a class="wcheck" id="<?='/dirType/INDIVIDUAL/dirNom/'.$dir->Nom.'/dirPrenom/'.$dir->Prenom;?>" href="<?=$this->url(array(
'controller'=>'worldcheck',
'action'=>'index',
'dirNom'=>$dir->Nom,
'dirPrenom'=>$dir->Prenom,
'dirType' =>'INDIVIDUAL',
'siren'=>$dir->Siren), null, true)?>"><img src='/themes/default/images/worldcheck/wc.png'/></a>
<?php } ?>
</td>
<?php } ?>
<?php }?>
@ -162,18 +172,13 @@ $('a.dialog').on('click', function(){
}
});
$(document).ready(function(){
$('a.wcheck div').each(function(){
if ($(this).attr('id')=='0') {
$(this).css("backgroundImage", 'url(/themes/default/images/worldcheck/wc0.png)');
}
});
});
$('a.wcheck').each(function(){
$(this).qtip({
content: $(this).attr('tooltip'),
position: { at: "right center", my: "bottom left" }
hide: { event: 'unfocus' },
show: { solo: true, delay: 1000 },
content: { title: {button: true}, text: "Chargement...",
ajax: { url: '<?=$this->url(array('controller'=>'worldcheck','action'=>'occurence','siren'=>substr($this->siret, 0, 9)),null,true);?>'+$(this).attr('id') } },
position: { my: "bottom left", at: "top left" }
});
});
</script>

View File

@ -59,8 +59,26 @@ echo $this->partial('identite/fiche-item.phtml', $this->dBlock['AutreSiren']);
<h2>Raison sociale &amp; Coordonnées</h2>
<div class="paragraph">
<div style="float:right;">
<?php if($this->permission) echo $this->action('occurence','worldcheck', null, array('dirSociete'=>$this->infos->Nom, 'dirType' =>'ORGANISATION', 'siren' => substr($this->siret, 0, 9)));?>
<?php if($this->permission) ?><?php
//echo $this->action('occurence','worldcheck', null, array('dirSociete'=>$this->infos->Nom, 'dirType' =>'ORGANISATION', 'siren' => substr($this->siret, 0, 9)));?>
<a class="wcheck" href="<?=$this->url(array(
'controller'=>'worldcheck',
'action'=>'index',
'dirSociete'=>$this->infos->Nom,
'dirType' =>'ORGANISATION',
'siren'=>substr($this->siret, 0, 9)), null, true)?>"><img src='/themes/default/images/worldcheck/wc.png'/></a>
</div>
<script>
$('a.wcheck').each(function(){
$(this).qtip({
hide: { event: 'unfocus' },
show: { solo: true, delay: 1000 },
content: { title: {button: true}, text: "Chargement...",
ajax: { url: '<?=$this->url(array('controller'=>'worldcheck','action'=>'occurence', 'dirSociete'=>$this->infos->Nom, 'dirType' =>'ORGANISATION', 'siren'=>substr($this->siret, 0, 9)),null,true);?>' } },
position: { my: "bottom left", at: "top left" }
});
});
</script>
<table>
<?php
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['RaisonSociale']);

View File

@ -146,11 +146,25 @@ if ($associate->associatetype=='ASSOCIATE')
}
?>
<? $params = array(
'controller'=>'worldcheck',
'action'=>'index',
$dirName => $associate->targetEntity->names->name[0]->lastName,
'dirPrenom' => $associate->targetEntity->names->name[0]->givenName,
'dirType' => $dirType);?>
Associate: <?=$associate->targetEntity->names->name[0]->fullName;?>
<div style='float:right;'><?=$this->action('occurence','worldcheck', null, $params);?></div>
<div style='float:right;'><a class="wcheck" id="<?='/dirType/'.$dirType.'/'.$dirName.'/'.$associate->targetEntity->names->name[0]->lastName.'/dirPrenom/'.$associate->targetEntity->names->name[0]->givenName?>" href="<?=$this->url($params, null, true)?>">
<img src='/themes/default/images/worldcheck/wc-blanc.png'/></a></div>
<script>
$('a.wcheck').each(function(){
$(this).qtip({
hide: { event: 'unfocus' },
show: { solo: true, delay: 1000 },
content: { title: {button: true}, text: "Chargement...",
ajax: { url: '<?=$this->url(array('controller'=>'worldcheck','action'=>'occurence'));?>'+$(this).attr('id') } },
position: { my: "bottom left", at: "top left" }
});
});
</script>
</h2>
<div class="paragraph">
<table cellpadding=3>

View File

@ -1,41 +1 @@
<?php if ($this->data->Type) {?>
<?php
if ($this->occurrence===false) {
$qtipContent = "WorldCheck<br/>Cliquez sur l&rsquo;icone WorldCheck";
} else {
$qtipContent = "WorldCheck<br/>Occurrences: ".$this->occurrence;
}
$params = array(
'controller' => 'worldcheck',
'action' => 'index',
'dirNom' => $this->data->Nom,
'dirPrenom' => $this->data->Prenom,
'dirSociete' => $this->data->Societe,
'dirType' => $this->data->Type,
'siren' => $this->data->Siren,);
?>
<a class='wcheck' tooltip='<?=$qtipContent ?>' href="<?=$this->url($params, null, true)?>" style="cursor: pointer;" >
<div id='<?=$this->occurrence;?>' class='img'></div></a><br/>
<style>
div.img {background:url(/themes/default/images/worldcheck/wc.png) no-repeat; height:19px; width:19px; float:left;}
</style>
<script>
$(document).ready(function(){
$('a.wcheck div').each(function(){
if ($(this).attr('id')=='0') {
$(this).css("backgroundImage", 'url(/themes/default/images/worldcheck/wc0.png)');
}
});
});
$('a.wcheck').each(function(){
$(this).qtip({
content: $(this).attr('tooltip'),
position: { at: "right center", my: "bottom left" }
});
});
</script>
<?php } else {}?>
<?=($this->occurrence===false) ? "WorldCheck<br/>Cliquez sur l&rsquo;icone WorldCheck" : "WorldCheck<br/>Occurrences: ".$this->occurrence;?>

View File

@ -1,9 +1,13 @@
worldcheck.username = ylenaour@scores-decisions.com
worldcheck.password = accelus
worldcheck.passwordType = http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
worldcheck.namespace = http://screening.complinet.com/
worldcheck.securityType = Security
worldcheck.groupIdentifier = cng_so_64
worldcheck.assigneeIdentifier = cnu_so_77
worldcheck.response.limit = 1000
worldcheck.response.start = 0
wsworldcheck.username = ylenaour@scores-decisions.com
wsworldcheck.password = accelus
wsworldcheck.passwordType = http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText
wsworldcheck.namespace = http://screening.complinet.com/
wsworldcheck.securityType = Security
wsworldcheck.groupIdentifier = cng_so_64
wsworldcheck.assigneeIdentifier = cnu_so_77
wsworldcheck.response.limit = 200
wsworldcheck.response.start = 0
worldcheck.page.items = 15
worldcheck.cachedir.path = ../data/cache/
worldcheck.cachedir.name = worldcheck
worldcheck.cachedir.lifetime = 7200

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB