-
Notifications
You must be signed in to change notification settings - Fork 3
/
eleve_delete.sql
177 lines (166 loc) · 6.05 KB
/
eleve_delete.sql
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
SELECT 'redirect' AS component,
'signin.sql?error' AS link
WHERE NOT EXISTS (SELECT 1 FROM login_session WHERE id=sqlpage.cookie('session'));
SET group_id = (SELECT user_info.groupe FROM login_session join user_info on user_info.username=login_session.username WHERE id = sqlpage.cookie('session'));
SELECT 'redirect' AS component,
'notification.sql?restriction&id='||$id AS link
WHERE $group_id<'3';
--Menu
SELECT 'dynamic' AS component, sqlpage.read_file_as_text('menu.json') AS properties;
--Bouton retour sans valider
select
'button' as component,
'sm' as size,
'pill' as shape;
select
'Retour à la liste' as title,
'eleves.sql' as link,
'arrow-back-up' as icon,
'green' as outline;
select
'Retour à la fiche élève' as title,
'notification.sql?id='|| $id||'&tab=Profil' as link,
'briefcase' as icon,
'green' as outline;
SELECT
'alert' as component,
'Alerte' as title,
'Toute suppression est définitive !' as description,
'alert-triangle' as icon,
'red' as color;
-- Set a variable
SET var_suivi = (SELECT count(suivi.id) FROM suivi where suivi.eleve_id=$id);
SET var_amenag = (SELECT count(amenag.id) FROM amenag where amenag.eleve_id=$id);
SET var_notif = (SELECT count(notification.id) FROM notification where notification.eleve_id=$id);
-- Isolement de l'élève dans une liste
SELECT 'table' as component,
'actions' AS markdown,
1 as sort,
1 as search;
SELECT
eleve.nom as Nom,
eleve.prenom as Prénom,
strftime('%d/%m/%Y',eleve.naissance) AS Naissance,
eleve.classe as Classe,
etab.nom_etab as Établissement,
CASE WHEN $var_suivi>=1 OR $var_amenag>=1 OR $var_notif>=1
THEN
'[
![](./icons/trash-off.svg)
]() '
ELSE
'[
![](./icons/trash.svg)
](eleve_delete_confirm.sql?id='||eleve.id||')'
END
as actions
FROM eleve LEFT JOIN etab on eleve.etab_id=etab.id Where eleve.id=$id;
-- Gestion de la photo
SELECT 'list' as component,
'Photo : ' as title,
'Photo : ' as empty_title,
'Aucune donnée correspondante pour cet élève' as empty_description;
SELECT
image_url as image_url,
'photo_delete_confirm.sql?id='||image.id||'&eleve_id='||$id as delete_link
FROM image join eleve on image.eleve_id=eleve.id Where image.eleve_id=$id;
SELECT 'list' as component,
'Parcours : ' as title,
'Parcours : ' as empty_title,
'Aucune donnée correspondante pour cet élève' as empty_description;
SELECT
parcours.annee_id as title,
parcours.niveau as description,
'parcours_delete_confirm.sql?id='||parcours.id||'&eleve_id='||$id as delete_link
FROM parcours join eleve on parcours.eleve_id=eleve.id Where parcours.eleve_id=$id;
-- Isolement de ses notifications dans une liste
SELECT
'alert' as component,
TRUE as important,
'NOTIFICATION(S)' as title,
CASE WHEN $var_notif>=1
THEN 'alert-triangle'
ELSE 'thumb-up'
END as icon,
CASE WHEN $var_notif>=1
THEN 'Il est nécessaire de supprimer les notifications avant de pouvoir supprimer l''élève.'
ELSE 'Pas de notification trouvée'
END as description,
CASE WHEN $var_notif>=1
THEN 'orange'
ELSE 'green'
END as color;
--
SELECT 'table' as component,
'Aucune donnée correspondante pour cet élève' as empty_description,
'actions' AS markdown;
SELECT
eleve.nom as Nom,
eleve.prenom as Prénom,
strftime('%d/%m/%Y',datefin) AS Fin,
group_concat(DISTINCT modalite.type) as Droits,
'[
![](./icons/trash.svg)
](notif_delete_confirm.sql?id='||notification.id||'&eleve_id='||$id||') ' as actions
/*FROM notification INNER JOIN eleve on notification.eleve_id=eleve.id LEFT join notif on notif.eleve_id=eleve.id LEFT join modalite on modalite.id=notif.modalite_id Where notification.eleve_id=$id GROUP BY notification.id ; */
FROM notif INNER JOIN notification on notif.notification_id=notification.id join eleve on notif.eleve_id=eleve.id LEFT join modalite on modalite.id=notif.modalite_id Where notification.eleve_id=$id GROUP BY notification.id ;
-- Isolement de ses aménagements dans une liste
SELECT
'alert' as component,
TRUE as important,
'AMÉNAGEMENT(S)' as title,
CASE WHEN $var_amenag>=1
THEN 'alert-triangle'
ELSE 'thumb-up'
END as icon,
CASE WHEN $var_amenag>=1
THEN 'Il est nécessaire de supprimer les aménagements avant de pouvoir supprimer l''élève.'
ELSE 'Pas d''aménagement trouvé'
END as description,
CASE WHEN $var_amenag>=1
THEN 'orange'
ELSE 'green'
END as color;
--
SELECT 'table' as component,
'Aucune donnée correspondante pour cet élève' as empty_description,
'actions' AS markdown;
SELECT
eleve.nom as Nom,
eleve.prenom as Prénom,
amenag.amenagements AS Aménagements,
amenag.objectifs AS Objectifs,
'[
![](./icons/trash.svg)
](amenag_delete_confirm.sql?id='||amenag.id||'&eleve_id='||$id||') ' as actions
FROM amenag INNER JOIN eleve on amenag.eleve_id=eleve.id Where amenag.eleve_id=$id GROUP BY amenag.id ;
-- Isolement de ses suivis dans une liste
SELECT
'alert' as component,
TRUE as important,
'SUIVI(S)' AS title,
CASE WHEN $var_suivi>=1
THEN 'alert-triangle'
ELSE 'thumb-up'
END as icon,
CASE WHEN $var_suivi>=1
THEN 'Il est nécessaire de supprimer les suivis avant de pouvoir supprimer l''élève.'
ELSE 'Pas de suivi trouvé'
END as description,
CASE WHEN $var_suivi>=1
THEN 'orange'
ELSE 'green'
END as color;
--
SELECT 'table' as component,
'Aucune donnée correspondante pour cet élève' as empty_description,
'actions' AS markdown;
SELECT
eleve.nom as Nom,
eleve.prenom as Prénom,
suivi.temps as Temps,
SUBSTR(aesh.aesh_firstname, 1, 1) ||'. '||aesh.aesh_name as AESH,
'[
![](./icons/trash.svg)
](suivi_delete_confirm.sql?id='||suivi.id||'&eleve_id='||$id||') ' as actions
FROM suivi INNER JOIN eleve on suivi.eleve_id=eleve.id JOIn aesh on aesh.id=suivi.aesh_id Where suivi.eleve_id=$id GROUP BY suivi.id ;