-
Notifications
You must be signed in to change notification settings - Fork 9
/
message.php
executable file
·127 lines (125 loc) · 5.24 KB
/
message.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
require_once("auth.php");
require_once("../fonctions/divers.php");
if (!est_autorise("acces_configuration"))
exit;
$request = Symfony\Component\HttpFoundation\Request::createFromGlobals();
try
{
ActionsAdminMessage::getInstance()->action($request);
} catch(TheliaAdminException $e) {
$errorCode = $e->getCode();
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<?php require_once("title.php"); ?>
</head>
<body>
<?php
ActionsAdminModules::instance()->inclure_module_admin("message_top");
$menu = "configuration";
$breadcrumbs = Breadcrumb::getInstance()->getConfigurationList(trad('Gestion_messages', 'admin'));
require_once("entete.php");
?>
<div class="row-fluid">
<div class="span12">
<h3><?php echo trad('LISTE_MESSAGES', 'admin'); ?>
<div class="btn-group">
<a class="btn btn-large" title="<?php echo trad('ajouter', 'admin'); ?>" href="#messageAddModal" data-toggle="modal">
<i class="icon-plus-sign icon-white"></i>
</a>
</div>
</h3>
<?php
ActionsAdminModules::instance()->inclure_module_admin("message");
?>
<div class="bigtable">
<table class="table table-striped">
<thead>
<tr>
<th><?php echo trad('Nom_message', 'admin'); ?></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach(MessageAdmin::getInstance()->getList() as $message): ?>
<tr>
<td><?php echo $message["intitule"]?:$message["nom"]; ?></td>
<td>
<div class="btn-group">
<a class="btn btn-mini" href="message_modifier.php?id=<?php echo $message["id"]; ?>"><i class="icon-edit"></i></a>
<a class="btn btn-mini js-delete-message" href="#deleteMessage" message-id="<?php echo $message["id"]; ?>" message-intitule="<?php echo $message["intitule"]?:$message["nom"]; ?>"><i class="icon-trash"></i></a>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal hide fade in" id="deleteMessage">
<div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
<h3><?php echo trad('SUPPRESSION_MESSAGE', 'admin'); ?></h3>
</div>
<div class="modal-body">
<p><?php echo trad('DeleteMessageWarning', 'admin'); ?></p>
<p id="messageDelationInfo"></p>
</div>
<div class="modal-footer">
<a class="btn" data-dismiss="modal" aria-hidden="true"><?php echo trad('Non', 'admin'); ?></a>
<a class="btn btn-primary" id="messageDelationLink"><?php echo trad('Oui', 'admin'); ?></a>
</div>
</div>
<div class="modal hide fade in" id="messageAddModal">
<form method="post" action="message.php">
<input type="hidden" name="action" value="ajouter">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><?php echo trad('CREATION_MESSAGE', 'admin'); ?></h3>
</div>
<div class="modal-body">
<?php if($errorCode == TheliaAdminException::MESSAGE_NAME_EMPTY || $errorCode == TheliaAdminException::MESSAGE_ALREADY_EXISTS){ ?>
<div class="alert alert-block alert-error fade in">
<h4 class="alert-heading"><?php echo trad('message_error_create','admin') ?></h4>
<p><?php echo trad('message_'.$errorCode,'admin'); ?></p>
</div>
<?php } ?>
<table class="table table-striped">
<tbody>
<tr>
<td><?php echo trad('Nom_message', 'admin'); ?></td>
<td><input type="text" name="nom"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<a class="btn" data-dismiss="modal" aria-hidden="true"><?php echo trad('Cancel', 'admin'); ?></a>
<button type="submit" class="btn btn-primary"><?php echo trad('Ajouter', 'admin'); ?></button>
</div>
</form>
</div>
<?php
ActionsAdminModules::instance()->inclure_module_admin("message_bottom");
?>
<?php require_once("pied.php"); ?>
<script type="text/javascript">
$(document).ready(function(){
$(".js-delete-message").click(function(){
$("#messageDelationInfo").html($(this).attr("message-intitule"));
$("#messageDelationLink").attr("href","message.php?action=supprimer&id="+$(this).attr("message-id"));
$("#deleteMessage").modal("show");
})
});
<?php if($errorCode == TheliaAdminException::MESSAGE_NAME_EMPTY || $errorCode == TheliaAdminException::MESSAGE_ALREADY_EXISTS){ ?>
$('#messageAddModal').modal('show');
$('#messageAddModal').on("show", function(){
$(this).find(".alert").remove();
})
<?php } ?>
</script>
</body>
</html>