Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
apisub
Commits
44ee3209
Commit
44ee3209
authored
Jun 04, 2019
by
Stephane Crozat
Browse files
Add super-pouvoir mail des responsables
parent
1c183986
Changes
5
Show whitespace changes
Inline
Side-by-side
index.php
View file @
44ee3209
...
...
@@ -28,7 +28,7 @@ if (isset($_GET['mode'])) {
$view
->
respValidation
(
$db
->
apiListResp
(
$admin
,
$_SESSION
[
'utclogin'
]));
}
if
(
$_GET
[
'mode'
]
==
'admin'
)
{
$view
->
adminFunction
(
$_SESSION
[
'utclogin'
]);
$view
->
adminFunction
(
$_SESSION
[
'utclogin'
]
,
$db
->
mailresp
(),
$db
->
apiStudentsAll
()
);
}
}
else
{
...
...
lib/db.php
View file @
44ee3209
...
...
@@ -208,18 +208,23 @@ class DB {
}
public
function
apiStudents
(
$utclogin
,
$api
)
{
if
(
$this
->
isAdmin
(
$utclogin
))
{
$sql
=
'SELECT *
FROM vsubscription
WHERE id=:api AND resplogin=:utclogin AND validation
ORDER BY surname, firstname'
;
//TODO donner accès aux admins même si ne sont pas les resp
ORDER BY surname, firstname'
;
$st
=
$this
->
conn
->
prepare
(
$sql
);
$st
->
bindValue
(
':api'
,
$api
,
PDO
::
PARAM_STR
);
$st
->
bindValue
(
':utclogin'
,
$utclogin
,
PDO
::
PARAM_STR
);
$st
->
execute
();
$res
=
$st
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
return
$res
;
}
else
{
public
function
apiStudentsAll
()
{
$sql
=
'SELECT *
FROM vsubscription
WHERE id=:api AND resplogin=:utclogin AND validation
ORDER BY surname, firstname'
;
}
WHERE validation
ORDER BY code, surname, firstname'
;
$st
=
$this
->
conn
->
prepare
(
$sql
);
$st
->
bindValue
(
':api'
,
$api
,
PDO
::
PARAM_STR
);
$st
->
bindValue
(
':utclogin'
,
$utclogin
,
PDO
::
PARAM_STR
);
...
...
@@ -228,5 +233,17 @@ class DB {
return
$res
;
}
public
function
mailResp
()
{
$sql
=
"SELECT DISTINCT u.email AS email
FROM vapi a JOIN localuser u ON a.resplogin=u.utclogin
ORDER BY u.email"
;
$st
=
$this
->
conn
->
prepare
(
$sql
);
$st
->
execute
();
$res
=
$st
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
return
$res
;
}
}
lib/views.php
View file @
44ee3209
...
...
@@ -224,7 +224,19 @@ class Views {
}
}
public
function
adminFunction
(
$utclogin
)
{
echo
"<p>Je dois vérifier que
$utclogin
a vraiment des super-pouvoirs...</p>"
;
public
function
adminFunction
(
$utclogin
,
$mailresp
,
$students
)
{
echo
'<h2>Super-pouvoirs</h2>'
;
echo
"<p>Je suis en train d'ajouter des super-pouvoirs à
$utclogin
...</p>"
;
// Resp Emails
echo
'<h3>Mails aux reponsables d\'Api</h3>'
;
$all
=
''
;
foreach
(
$mailresp
as
$m
)
{
echo
"<a href='mailto:
$m[email]'>$m[email]
</a> |"
;
$all
=
"
$all
,
$m[email]
"
;
}
echo
"<b><a href='mailto:
$all
'>[all]</a></b>"
;
//
}
}
tmp/export/README.md
View file @
44ee3209
...
...
@@ -17,7 +17,6 @@ cat /var/www/html/apisub/lib/connexion.php && psql -U apisub -d apisub -h localh
# Génération CSV depuis la base Postgres
\C
OPY (SELECT
*
FROM vapi) TO '/home/stc/api.csv' CSV HEADER DELIMITER ';' QUOTE '"'
\C
OPY (SELECT DISTINCT mail FROM vapi) TO '/home/stc/api_ml.txt'
\C
OPY (SELECT
*
FROM vsubscription) TO '/home/stc/api_sub.csv' CSV HEADER DELIMITER ';' QUOTE '"'
\C
OPY (SELECT
*
FROM vsubscription_anonymous) TO '/home/stc/api_sub_anonymous.csv' CSV HEADER DELIMITER ';' QUOTE '"'
...
...
tmp/import/README.md
View file @
44ee3209
# Procédures d'import
## Import des niveaux des étudiants
fichier CSV : utclogin;level
```
DELETE FROM student;
\copy student FROM 'data/students.csv' DELIMITER ';'
```
## TODO
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment