+++ /dev/null
-<h1>
- <?php echo $this->Html->link(
- 'Nouvelle instance',
- array('controller' => 'instances', 'action' => 'add')
-); ?>
-</h1>
-<button onclick="checkInfosInstances();">Vérifier ces informations avec Sugar</button>
-<table>
- <tr>
- <th>Référence fiche d'installation</th>
- <th>Client</th>
- <th>Produit</th>
- <th>Version déclarée</th>
- <th>Canal</th>
- <?php if(isset($totalAlertes) && count($totalAlertes) > 0) { ?>
- <th>Alertes</th>
- <?php } ?>
- <th>Actions</th>
- </tr>
-
- <?php foreach ($instances as $instance): ?>
- <tr>
- <td><?php echo $instance['Instance']['reference']; ?></td>
-
- <?php if(array_key_exists($instance['Instance']['id'], $clients)) {
- $client = $clients[$instance['Instance']['id']]; ?>
- <td><?php echo $client['Client']['identifiant_AP']; ?></td>
- <?php } else { ?>
- <td>Client pour cette instance inexistant ou introuvable</td>
- <?php } ?>
-
- <td><?php echo $instance['Instance']['nom']; ?></td>
-
- <td><?php
- if(array_key_exists($instance['Instance']['id'], $last_updates)) {
- $last_update = $last_updates[$instance['Instance']['id']];
- echo $instance['Instance']['version']." le ".$last_update;
- } else {
- echo $instance['Instance']['version'];
- }
-
- ?>
- </td>
-
- <td><?php echo strtoupper($instance['Instance']['canal']); ?></td>
-
- <?php if(array_key_exists($instance['Instance']['id'], $historiques)) {
- $historique = $historiques[$instance['Instance']['id']];
- if(isset($totalAlertes) && count($totalAlertes) > 0) {
- ?>
- <td>
- <table>
- <tr>
- <?php if(array_key_exists($historique['Historique']['id'], $totalAlertes)) { ?>
- <th>Message</th>
- <th>Actions</th>
- <?php } ?>
- </tr>
- <?php if(array_key_exists($historique['Historique']['id'], $totalAlertes)) { ?>
- <?php foreach ($totalAlertes[$historiques[$instance['Instance']['id']]['Historique']['id']] as $alerte): ?>
-
- <tr>
- <td>
- <?php echo $alerte['Alerte']['message'] ?>
- </td>
- <td>
- <?php
- $reference = str_replace("/", "SLASH", $instance['Instance']['reference']);
- echo $this->Html->link(
- $this->Html->image('validate.png', array('class' => 'button')),
- array('controller' => 'historiques', 'action' => 'actionAlerte', $historique['Historique']['id'], $alerte['Alerte']['id'], true, $reference),
- array('escape' => false)
- )
- .' '.
- $this->Html->link(
- $this->Html->image('delete.png', array('class' => 'button')), '#',
- array('escape' => false,
- 'onclick' => 'actionMaintien('.$instance['Instance']['id'].', '.$historique['Historique']['id'].', '.$alerte['Alerte']['id'].')'
- )
- );
- ?>
- </td>
- </tr>
- <?php endforeach; ?>
- <?php unset($alerte);
- } ?>
- </table>
- </td>
- <?php }?>
- <td>
- <?php echo $this->Html->link(
- $this->Html->image('edit.jpg', array('class' => 'button')),
- array('controller' => 'instances', 'action' => 'edit', $instance['Instance']['id']),
- array('escape' => false)
- ).' '.
- $this->Html->link(
- $this->Html->image('delete.png', array('class' => 'button')), '#',
- array('escape' => false,
- 'onclick' => 'supprimerHistorique('.$instance['Instance']['id'].', '.$historique['Historique']['id'].')'
- )
- );
- ?>
- </td>
- <?php } else { ?>
- <td>Historique pour cette instance inexistant ou introuvable</td>
- <td>
- <?php echo $this->Html->link(
- $this->Html->image('edit.jpg', array('class' => 'button')),
- array('controller' => 'instances', 'action' => 'edit', $instance['Instance']['id']),
- array('escape' => false)
- ).' '.
- $this->Form->postLink(
- $this->Html->image('delete.png', array('class' => 'button')),
- array('controller' => 'instances', 'action' => 'delete', $instance['Instance']['id']),
- array('escape' => false, 'confirm' => 'Etes-vous certain ?')
- );
- ?>
- </td>
- <?php } ?>
- </tr>
- <?php endforeach; ?>
- <?php unset($instance); ?>
-</table>
-<script>
- (function() {
- /*var message = "Custom message here";
- var title = "Hello World!";
- var maintenu = true;
-
- var truc = function(bool) {
- maintenu = bool;
- }
-
- eModal.confirm('test', "Supprimer le maintien de l'instance ?", function() {
- // To do : appel du controlleur
- if(maintenu) {
- alert('Maintien conservé');
- } else {
- alert('Maintien supprimé');
- }
- });
-
- var options = {
-
- // for ajax popup
- url: "ajax.html",
-
- // loading indicator
- loadingHtml: '',
-
- // The body message string or the html element.
- message: "The famous question?",
-
- // The header title string
- title: 'Header title',
-
- // The header subtitle string.
- subtitle: 'Sub title',
-
- // custom buttons
- buttons: [
- {text: 'Ok', style: 'info', close: true, click: truc(true) },
- {text: 'KO', style: 'danger', close: true, click: truc(false) }
- ],
-
- // Defines the size of modal ['sm' | 'lg']
- size: 'sm',
-
- // Set loading progress as message
- loading: false,
-
- // set message as recycable
- useBin: false,
-
- // css objext try apply into message body
- css: '',
-
- // use the possitive lable as key
- label: "True",
-
- // callback
- callback: function() { }
-
- };*/
-
- // alert dialog
- /*$("#demo-1").click(function () {
- eModal.alert(message, title);
- });*/
-
- // confirm dialog
- /*$("#demo-2").click(function() {
-
- var test = confirm("Conserver le maintien de l'instance ?");
- if(test) {
- alert('Maintien conservé');
- } else {
- alert('Maintien supprimé');
- $.ajax({
- url: "http://allo_serveur?action=get_instances",
- beforeSend: function( xhr ) {
- xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
- }
- })
- .done(function( data ) {
- if ( console && console.log ) {
- console.log( "Sample of data:", data.slice( 0, 100 ) );
- }
- });
- }
- });*/
-
- // prompt dialog
- /*$("#demo-3").click(function(){
- eModal.prompt(message, title);
- });
-
- var url = "ajax.html";
-
- // ajax popup
- $("#demo-4").click(function(){
- eModal.ajax(url);
- });*/
-
- //eModal.setEModalOptions(options);
- })();
-
- var actionMaintien = function (instance_id, historique_id, alerte_id) {
- var urlActionAlerte = "/historiques/actionAlerte/"+historique_id+"/"+alerte_id+"/false",
- garderMaintien = confirm("Conserver le maintien de l'instance ?");
- if(garderMaintien) {
- alert('Maintien conservé');
- location.href = urlActionAlerte;
- } else {
- alert('Maintien supprimé');
- $.ajax({
- url: "http://allo_serveur?action=disable_maintien&id="+instance_id,
- beforeSend: function( xhr ) {
- xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
- }
- })
- .done(function( data ) {
- if ( console && console.log ) {
- //console.log( "Sample of data:", data.slice( 0, 100 ) );
- }
- location.href = urlActionAlerte;
- });
- }
- };
-
- var supprimerHistorique = function (instance_id, historique_id) {
- var confirmation = confirm("Etes-vous certain ?");
- if (confirmation) {
- var garderHistorique = confirm("Conserver l'historique de l'instance ?");
- if(garderHistorique) {
- alert('Historique conservé');
- location.href = "/instances/delete/"+instance_id;
- } else {
- alert('Historique supprimé');
- $.ajax({
- url: "http://allo_webadmin/historiques/delete/"+historique_id,
- beforeSend: function( xhr ) {
- xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
- }
- })
- .done(function( data ) {
- if ( console && console.log ) {
- //console.log( "Sample of data:", data.slice( 0, 100 ) );
- }
- location.href = "/instances/delete/"+instance_id;
- });
- }
- }
- };
-
- var checkInfosInstances = function () {
- $.ajax({
- url: "http://allo_serveur/?action=check_synchro_info_version",
- beforeSend: function( xhr ) {
- xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
- }
- })
- .done(function( data ) {
- if ( console && console.log ) {
- //console.log( "Sample of data:", data.slice( 0, 100 ) );
- }
- location.href = "/instances";
- });
- };
-</script>
\ No newline at end of file