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
db7b5d2e
Commit
db7b5d2e
authored
Mar 01, 2021
by
stph
Browse files
Implement admin functions activeSemester and Year
parent
5431b78e
Changes
7
Hide whitespace changes
Inline
Side-by-side
INSTALL
View file @
db7b5d2e
...
...
@@ -38,8 +38,7 @@ psql -h localhost -U apisub -d apisub
## Install
apt install php-pgsql
apt install php-xml
apt install php php-pgsql php-xml
## Connexion
cp lib/connexion-sample.php lib/connexion.php
MAJ
View file @
db7b5d2e
...
...
@@ -6,16 +6,16 @@ su postgres
pg_dump apisub -f /home/stc/apidump/apisub20200929.sql
scp stc@pic.crzt.fr:/home/stc/apidump/* .
## Mise à jour des dates
## Mise à jour des dates
d'inscription
```
UPDATE config SET closed='f', openbegin='202
0-10-20
', openend='202
0-12-18
';
UPDATE config SET closed='f', openbegin='202
1-01-08
', openend='202
1-06-04
';
```
## Niveau des étudiants
- Vider la table student
- Vider la table student
- Ré-insérer les données à jour dans la table student
```
DELETE FROM student;
...
...
README.md
View file @
db7b5d2e
...
...
@@ -11,4 +11,4 @@ See INSTALL & MAJ
### `TABLE config`
-
Set
`closed`
to
`TRUE`
to disable subscription (and unsubscription)
-
Set
`closed`
to
`FALSE`
to enable subscription (and unsubscription) and set openbegin and openend to in
tersemester
dates.
-
Set
`closed`
to
`FALSE`
to enable subscription (and unsubscription) and set openbegin and openend to in
scription
dates.
lib/admin.php
View file @
db7b5d2e
...
...
@@ -13,11 +13,11 @@ class Admin {
}
public
function
activeSemester
()
{
return
'H'
;
return
$this
->
db
->
config
()[
'semester'
];
;
}
public
function
activeYear
()
{
return
2021
;
return
$this
->
db
->
config
()[
'year'
];
;
}
}
sql/apisub_admin.sql
View file @
db7b5d2e
...
...
@@ -22,6 +22,8 @@ CREATE OR REPLACE VIEW vconfig AS
SELECT
TO_CHAR
(
openbegin
,
'TMday FMDD TMmonth FMYYYY'
)
AS
openbegin
,
TO_CHAR
(
openend
,
'TMday FMDD TMmonth FMYYYY'
)
AS
openend
,
semester
(
openend
)
AS
semester
,
DATE_PART
(
'year'
,
openend
)
AS
year
,
NOT
(
closed
)
AND
CURRENT_DATE
>=
openbegin
AND
CURRENT_DATE
<=
openend
AS
isactive
FROM
config
;
...
...
sql/apisub_functions.sql
View file @
db7b5d2e
...
...
@@ -84,11 +84,11 @@ DECLARE
m
INTEGER
;
BEGIN
m
=
DATE_PART
(
'month'
,
$
1
);
/* Winter intersemester i
s eith
er
j
an
uary or february or march
*/
IF
m
=
1
OR
m
=
2
OR
m
=
3
THEN
/* Winter intersemester i
nscriptions begin in septemb
er an
d Api end in february
*/
IF
m
>
=
9
OR
m
<
=
2
THEN
RETURN
'H'
;
/* Summer intersemester i
s either june or july or august or september
*/
ELSIF
m
=
6
OR
m
=
7
OR
m
=
8
OR
m
=
9
THEN
/* Summer intersemester i
nscriptions begin in march and Api end in august
*/
ELSIF
m
>
=
3
OR
m
<
=
8
THEN
RETURN
'E'
;
ELSE
RETURN
'X'
;
...
...
tmp/import/README.md
View file @
db7b5d2e
...
...
@@ -28,7 +28,7 @@ COMMIT;
INSERT INTO api (id,dbegin,code,name,description,duration,size,ects,resplogin) VALUES (
gen_random_uuid(),
TO_DATE('01/01/2020','DD/MM/YYYY'),
'
code
'
,
code,
'title,
'longtitle',
duration,
...
...
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