Modification appel surveillance
This commit is contained in:
parent
d12396b2b3
commit
969d9b37e8
29
includes/surveillance/index.php
Normal file
29
includes/surveillance/index.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
isset($_REQUEST['q']) ? $q = $_REQUEST['q'] : $q = '';
|
||||
$params = explode('/', $q);
|
||||
$action = $params[0];
|
||||
|
||||
require_once realpath(dirname(__FILE__)).'/surveillance.php';
|
||||
|
||||
switch ( $action ){
|
||||
case 'ajouter':
|
||||
$siret = $params[1];
|
||||
$source = isset($params[2]) ? $params[2] : '' ;
|
||||
$return = formSurveillance($source, $siret, array(), true);
|
||||
echo $return;
|
||||
break;
|
||||
case 'setsurv':
|
||||
print_r($_REQUEST['formSurv']);
|
||||
exit;
|
||||
$set = setSurveillance($_REQUEST['formSurv']);
|
||||
FB::log($set, 'set');
|
||||
if ( $set == '' ){
|
||||
$return = '';
|
||||
} elseif ( $set===false ){
|
||||
$return = 'Erreur : Mise sous surveillance impossible.'."\n";
|
||||
} else {
|
||||
$return = 'Erreur : '.$set."\n";
|
||||
}
|
||||
echo $return;
|
||||
break;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
$(document).ready(function(){
|
||||
$('input[type=checkbox][name=surveillance]').click(function() {
|
||||
if($(this).attr('checked')== true){
|
||||
$('#survForm').css('display','block');
|
||||
}else{
|
||||
$('#survForm').css('display','none');
|
||||
}
|
||||
});
|
||||
|
||||
var options = {
|
||||
target: '#frmSurv',
|
||||
url: './pages/ajax_surveillance.php',
|
||||
beforeSubmit: showRequest,
|
||||
success: showResponse
|
||||
};
|
||||
|
||||
$('#frmSurv').submit(function() {
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
});
|
||||
|
||||
function showRequest(formData, jqForm, options) {
|
||||
$('#frmSurv').replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
|
||||
return true;
|
||||
}
|
||||
|
||||
function showResponse(responseText, statusText) {
|
||||
$('#frmSurv').replaceWith('' + responseText + '');
|
||||
if(statusText == 'success'){ return true; }else{ return false; }
|
||||
}
|
||||
});
|
@ -1,28 +0,0 @@
|
||||
$(document).ready(function(){
|
||||
var siren = '';
|
||||
var options = {
|
||||
target: '#frmSurv',
|
||||
url: './pages/ajax_surveillance.php',
|
||||
beforeSubmit: showRequest,
|
||||
success: showResponse
|
||||
};
|
||||
|
||||
$('#frmSurv').submit(function() {
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
});
|
||||
|
||||
function showResponse(responseText, statusText) {
|
||||
$("#frmSurv").replaceWith('' + responseText + '');
|
||||
if(statusText == 'success' && siren != ''){
|
||||
document.location.href = './?page=surveillance';
|
||||
}
|
||||
}
|
||||
|
||||
function showRequest(formData, jqForm, options) {
|
||||
var value = $('input[type=hidden][name=formSurv[siret]]').fieldValue();
|
||||
siren = value[0];
|
||||
$("#frmSurv").replaceWith('<div id="frmSurv">Mise sous surveillance en cours...</div>');
|
||||
return true;
|
||||
}
|
||||
});
|
@ -1,23 +0,0 @@
|
||||
form { clear:both; }
|
||||
form em { color:#FF0000;}
|
||||
fieldset {border:0; margin:0; padding:0;}
|
||||
fieldset legend{ padding:0 0 0 10px;}
|
||||
.fieldgrp{clear:both; width:100%; margin-bottom:.5em; overflow:hidden;}
|
||||
.fieldgrp:after{content:"."; display:block; clear:both; visibility:hidden; line-height:0; height:0; }
|
||||
.fieldgrp label{font-weight:bold; margin-left:30px; width:180px; clear:both; padding:0 10px 0 0;line-height:22px;_padding-top:3px; float:left; display:block; font-size:108%;}
|
||||
.fieldgrp label span{font-weight:normal;}
|
||||
.fieldgrp label abbr{color:#4B911C; font-size:120%; vertical-align:middle;}
|
||||
.field {float:left; padding:0 10px 0 0;line-height:22px;_padding-top:3px;}
|
||||
.field .longfield{width:215px;}
|
||||
.field .longfield-select{width:220px;}
|
||||
.field .smallfield{width:95px;}
|
||||
.field .medfield{width:110px;}
|
||||
.field input, .field select{ font-size:110%; margin:2px 0; }
|
||||
.field input[type="radio"] { margin:0 5px 0 5px; }
|
||||
div.submit{ margin-left:200px; padding-left:0px; margin-top:1em; }
|
||||
div.submit p.submit-button{margin-top:0;}
|
||||
div.submit p.details{font-size:85%;color:#666;margin:0;}
|
||||
div.submit p.required-note{margin-top:1em;}
|
||||
div.submit p.required-note span{color:#4B911C;_color:#666;font-size:170%;vertical-align:top;}
|
||||
input.submit {border:none;}
|
||||
#survForm {display:none;}
|
@ -47,10 +47,10 @@ function formSurveillance($source, $siret, $notEmail, $inDialog = false)
|
||||
|
||||
$output = '';
|
||||
|
||||
if($inDialog){
|
||||
if ( $inDialog ){
|
||||
$output.= '<style type="text/css">'.$style.'</style>'."\n";
|
||||
$output.= '<form id="frmSurv" name="frmSurv" '.
|
||||
'action="./pages/ajax_surveillance.php" method="post">'."\n";
|
||||
'action="./?page=surveillance" method="post">'."\n";
|
||||
$output.= '<input name="q" type="hidden" value="setsurv"/>';
|
||||
$output.= '<input name="formSurv[siret]" type="hidden" value="'.
|
||||
$siret.'"/>'."\n";
|
||||
@ -124,14 +124,14 @@ function formSurveillance($source, $siret, $notEmail, $inDialog = false)
|
||||
$output.= '</div>'."\n";
|
||||
$output.= '</form>'."\n";
|
||||
|
||||
}else{
|
||||
$texte = 'Mettre sous surveillance ';
|
||||
if( !empty($source) ) {
|
||||
$texte.= $assocSourceTxt[$source];
|
||||
}
|
||||
$output.= '<br/>';
|
||||
$output.= lienSousSurveillance($texte,
|
||||
'Ajouter la surveillance', $source, $siret);
|
||||
} else {
|
||||
$texte = 'Mettre sous surveillance ';
|
||||
if( !empty($source) ) {
|
||||
$texte.= $assocSourceTxt[$source];
|
||||
}
|
||||
$output.= '<br/>';
|
||||
$output.= lienSousSurveillance($texte,
|
||||
'Ajouter la surveillance', $source, $siret);
|
||||
$output.= '<br/>'."\n";
|
||||
}
|
||||
return $output;
|
||||
@ -181,10 +181,11 @@ function getSurveillance($source, $siret){
|
||||
* @param string $siret
|
||||
*/
|
||||
function lienSousSurveillance($texte, $titre, $source, $siret){
|
||||
return '<a class="dialogsurv" '.
|
||||
'href="./pages/ajax_surveillance.php?q=ajouter&siret='.
|
||||
$siret.'&source='.$source.'" '.
|
||||
'title="'.$titre.' '.$source.'">'. $texte . '</a>';
|
||||
$output = '<a class="dialogsurv" href="./?page=surveillance&q=ajouter';
|
||||
$output.= '/'.$siret;
|
||||
if ( !empty($source) ) { $output.= '/'.$source; }
|
||||
$output.= '" title="'.$titre.' '.$source.'">'. $texte . '</a>';
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,7 +252,7 @@ function inSurveillance($source, $siret){
|
||||
'dateAjout' => $item['dateAjout'],
|
||||
'dateDerEnvoi' => $item['dateDerEnvoi'],
|
||||
);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -300,9 +301,9 @@ function setSurveillance($tabForm)
|
||||
}
|
||||
|
||||
//Mise en surveillance pour une liste de sources
|
||||
if (is_array($source)){
|
||||
foreach ($source as $s){
|
||||
try{
|
||||
if ( is_array($source) ){
|
||||
foreach ( $source as $s ){
|
||||
try {
|
||||
$result = $client->setSurveillance($siret, $email, $ref, $s,
|
||||
false, $encours);
|
||||
$result = '';
|
||||
@ -310,7 +311,6 @@ function setSurveillance($tabForm)
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Mise en surveillance pour une source
|
||||
} else {
|
||||
try{
|
||||
|
@ -156,10 +156,10 @@ switch ($page)
|
||||
$page2 = 'evenements.php';
|
||||
require_once realpath(dirname(__FILE__)).'/pages/main.php';
|
||||
break;
|
||||
|
||||
case 'saisieajax':
|
||||
require_once '../includes/saisie/index.php';
|
||||
exit; break;
|
||||
exit;
|
||||
break;
|
||||
case 'saisie':
|
||||
$title = titreAvecSiren('Saisie/Edition');
|
||||
if (hasModeEdition()){
|
||||
@ -340,6 +340,12 @@ switch ($page)
|
||||
require_once realpath(dirname(__FILE__)).'/pages/main.php';
|
||||
break;
|
||||
case 'surveillance':
|
||||
//Gestion des requetes en Ajax
|
||||
if ( isset($_REQUEST['q']) ){
|
||||
require_once '../includes/surveillance/index.php';
|
||||
exit;
|
||||
}
|
||||
//Affichage des surveillances
|
||||
$title = 'Liste des établissements sous suveillances';
|
||||
if (hasPerm('survliste')){
|
||||
$page2 = 'options_surv.php';
|
||||
|
@ -111,7 +111,7 @@ if($source == ''){
|
||||
<?php
|
||||
//Affichage du nombre de surveillances
|
||||
$nbEtab = count($listTrier);
|
||||
if($vue=='default'){
|
||||
if ( $vue == 'default' ){
|
||||
?>
|
||||
<table id="info">
|
||||
<tr>
|
||||
@ -124,7 +124,7 @@ if($vue=='default'){
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}else{
|
||||
} else {
|
||||
?>
|
||||
<table id="info">
|
||||
<tr>
|
||||
@ -342,20 +342,18 @@ foreach($listTrier as $item)
|
||||
foreach($tabSource as $source => $perm)
|
||||
{
|
||||
FB::log($source, $perm);
|
||||
if(hasPerm('surv'.$perm))
|
||||
if ( hasPerm('surv'.$perm) )
|
||||
{
|
||||
if(array_key_exists($source, $item['sources']))
|
||||
{
|
||||
foreach($item['sources'][$source] as $surveillance)
|
||||
{
|
||||
if ( array_key_exists($source, $item['sources']) ){
|
||||
foreach ( $item['sources'][$source] as $surveillance ){
|
||||
?>
|
||||
<div class="action">
|
||||
<p><?=ucfirst($source)?></p>
|
||||
<a class="dialogsurv" href="./pages/ajax_surveillance.php?q=ajouter&siret=<?=$item['siren'].$item['nic']?>&source=<?=$source?>"
|
||||
<a class="dialogsurv" href="./?page=surveillance&q=ajouter/<?=$item['siren'].$item['nic']?>/<?=$source?>"
|
||||
title="Ajouter la surveillance <?=$source?>">
|
||||
<img src="./img/interface/ajouter.png"/>
|
||||
</a>
|
||||
<a class="dialogsurv" href="./pages/ajax_surveillance.php?q=ajouter&siret=<?=$item['siren'].$item['nic']?>&source=<?=$source?>&ref=<?=$surveillance['ref']?>&email=<?=$surveillance['email']?>"
|
||||
<a class="dialogsurv" href="./?page=surveillance&q=ajouter/<?=$item['siren'].$item['nic']?>/<?=$source?>&ref=<?=$surveillance['ref']?>&email=<?=$surveillance['email']?>"
|
||||
title="Editer la surveillance <?=$source?>">
|
||||
<img src="./img/interface/editer.png"/>
|
||||
</a>
|
||||
@ -366,13 +364,13 @@ foreach($listTrier as $item)
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
?>
|
||||
<div class="action">
|
||||
<p><?=ucfirst($source)?></p>
|
||||
<a class="dialogsurv" href="./pages/ajax_surveillance.php?q=ajouter&siret=<?=$item['siren'].$item['nic']?>&source=<?php print $source;?>" title="Ajouter la surveillance <?=$source?>"><img src="./img/interface/ajouter.png"/></a>
|
||||
<a class="dialogsurv" href="./?page=surveillance&q=ajouter/<?=$item['siren'].$item['nic']?>/<?=$source;?>" title="Ajouter la surveillance <?=$source?>">
|
||||
<img src="./img/interface/ajouter.png"/>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@ -416,12 +414,10 @@ foreach($listTrier as $item)
|
||||
<?php
|
||||
}
|
||||
//si vue=source alors on a forcément qu'une seul source donc 1 ligne par surveillance d'entité
|
||||
}
|
||||
elseif($vue=='source')
|
||||
{
|
||||
foreach($listTrier as $item){
|
||||
?>
|
||||
<tr>
|
||||
} elseif( $vue == 'source' ) {
|
||||
foreach ( $listTrier as $item ){
|
||||
?>
|
||||
<tr>
|
||||
<td class="aleft"><a href="./?page=identite&siret=<?=$item['siren'].$item['nic']?>"><?=$item['siren']?></a></td>
|
||||
<td><?=$item['rs']?><br/><i><?=$item['cp'].' '.$item['ville']?></i></td>
|
||||
<td>
|
||||
@ -434,8 +430,12 @@ foreach($listTrier as $item){
|
||||
<td class="aleft">
|
||||
<div class="action">
|
||||
<p><?=ucfirst($item['source'])?></p>
|
||||
<a class="dialogsurv" href="./pages/ajax_surveillance.php?q=ajouter&siret=<?=$item['siren'].$item['nic']?>&source=<?php print $item['source'];?>&ref=<?php print $item['ref'];?>&email=<?php print $item['email'];?>" title="Editer la surveillance <?php print $item['source'];?>"><img src="./img/interface/editer.png"/></a>
|
||||
<a href="./?page=surveillance&action=supprimer&siret=<?$item['siren'].$item['nic']?>&ref=<?php print $item['ref']; ?>&source=<?php print $item['source'];?>&email=<?php print $item['email']; ?>" title="Supprimer la surveillance <?php print $item['source'].' '.$item['email'];?>"><img src="./img/interface/supprimer.png"/></a>
|
||||
<a class="dialogsurv" href="./?page=surveillance&q=ajouter/<?=$item['siren'].$item['nic']?>/<?=$item['source']?>&ref=<?=$item['ref']?>&email=<?=$item['email']?>" title="Editer la surveillance <?=$item['source']?>">
|
||||
<img src="./img/interface/editer.png"/>
|
||||
</a>
|
||||
<a href="./?page=surveillance&action=supprimer&siret=<?=$item['siren'].$item['nic']?>&ref=<?=$item['ref']?>&source=<?=$item['source']?>&email=<?=$item['email']?>" title="Supprimer la surveillance <?=$item['source'].' '.$item['email']?>">
|
||||
<img src="./img/interface/supprimer.png"/>
|
||||
</a>
|
||||
</div>
|
||||
<br/>
|
||||
</td>
|
||||
@ -450,9 +450,9 @@ foreach($listTrier as $item){
|
||||
if ($pDate!='00/00/0000'){print '<p>'.$pDate.'</p>'; }else{ print '<p>-</p>';}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}//Fin vue==source
|
||||
?>
|
||||
</tbody>
|
||||
|
@ -11,7 +11,7 @@ $position = isset($_REQUEST['p']) ? $_REQUEST['p'] : 0 ;
|
||||
|
||||
$nbAffichage = 100;
|
||||
|
||||
switch($tri){
|
||||
switch ( $tri ){
|
||||
default:
|
||||
case 'siren': $triws = 'siren'; break;
|
||||
case 'rs': $triws = 'rs'; break;
|
||||
@ -22,7 +22,7 @@ switch($tri){
|
||||
}
|
||||
|
||||
//Liste des surveillances score de l'utilisateur
|
||||
try{
|
||||
try {
|
||||
$O = $client->getPortefeuille(0, $position, $nbAffichage, $triws);
|
||||
$listSurveillance = $O['results']['reponses'];
|
||||
|
||||
@ -277,7 +277,7 @@ if(count($listSurveillance)>0)
|
||||
$item['procol']!='P' && $item['actif']!=0)
|
||||
{
|
||||
?>
|
||||
<a class="dialogsurv editencours" href="./pages/ajax_surveillance.php?q=ajouter&siret=<?=$item['siren'].$item['nic']?>&source=score&ref=<?=$item['ref']?>&email=<?=$item['email']?>"
|
||||
<a class="dialogsurv editencours" href="./?page=surveillance&q=ajouter/<?=$item['siren'].$item['nic']?>/score&ref=<?=$item['ref']?>&email=<?=$item['email']?>"
|
||||
title="Editer encours">
|
||||
<img src="./img/interface/editer.png"/>
|
||||
</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user