<td><?php echo $instance['Instance']['reference']; ?></td>
<td><?php echo $instance['Instance']['nom']; ?></td>
<td><?php echo $instance['Instance']['version']; ?></td>
+
+ <?php if(array_key_exists($instance['Instance']['id'], $historiques)) {
+ $historique = $historiques[$instance['Instance']['id']];
+ ?>
<td>
- <?php if(array_key_exists($instance['Instance']['id'], $historiques)) {
- $historique = $historiques[$instance['Instance']['id']];
- ?>
<table>
<tr>
<?php if(array_key_exists($historique['Historique']['id'], $totalAlertes)) { ?>
<td>
<?php
echo $this->Html->link(
- 'Valider',
- array('controller' => 'historiques', 'action' => 'validerAlerte', $historique['Historique']['id'], $alerte['Alerte']['id'])
+ $this->Html->image('validate.png', array('class' => 'button')),
+ array('controller' => 'historiques', 'action' => 'actionAlerte', $historique['Historique']['id'], $alerte['Alerte']['id']),
+ array('escape' => false)
)
- . " - " .
+ .' '.
$this->Html->link(
- 'Refuser',
- array('controller' => 'historiques', 'action' => 'refuserAlerte', $historique['Historique']['id'], $alerte['Alerte']['id'])
+ $this->Html->image('delete.png', array('class' => 'button')), '#',
+ array('escape' => false,
+ 'onclick' => 'actionMaintien('.$instance['Instance']['id'].', '.$historique['Historique']['id'].', '.$alerte['Alerte']['id'].')'
+ )
);
?>
</td>
} ?>
</tr>
</table>
- <?php } else { echo "TEST"; } ?>
</td>
<td>
<?php echo $this->Html->link(
- 'Editer',
- array('controller' => 'instances', 'action' => 'edit', $instance['Instance']['id'])
- ).' - '.
+ $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(
- 'Supprimer',
- array('action' => 'delete', $instance['Instance']['id']),
- array('confirm' => 'Etes-vous certain ?')
+ $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 garderMaintien = confirm("Conserver le maintien de l'instance ?");
+ if(garderMaintien) {
+ alert('Maintien conservé');
+ location.href = "/historiques/actionAlerte/"+historique_id+"/"+alerte_id;
+ } 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 = "/historiques/actionAlerte/"+historique_id+"/"+alerte_id;
+ });
+ }
+ };
+
+ 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;
+ });
+ }
+ }
+ };
+</script>
\ No newline at end of file