summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/app/config/setup_application.php89
-rw-r--r--public/app/controllers/Auth.php15
-rw-r--r--public/app/controllers/JsonToForm.php4
-rw-r--r--public/app/controllers/Office.php24
4 files changed, 89 insertions, 43 deletions
diff --git a/public/app/config/setup_application.php b/public/app/config/setup_application.php
index 54f14de..d44f59d 100644
--- a/public/app/config/setup_application.php
+++ b/public/app/config/setup_application.php
@@ -138,6 +138,67 @@ define ('PETITION_TYPE', [
+// standard arrays
+// --- -- -- - - -
+define('TEACHER_SECTORS', [
+ 'ΠΕ01 ΘΕΟΛΟΓΟΙ',
+ 'ΠΕ02 ΦΙΛΟΛΟΓΟΙ',
+ 'ΠΕ02.50 ΦΙΛΟΛΟΓΟΙ ΕΙΔΙΚΗΣ ΑΓΩΓΗΣ',
+ 'ΠΕ03 ΜΑΘΗΜΑΤΙΚΟΙ',
+ 'ΠΕ03.50 ΜΑΘΗΜΑΤΙΚΟΙ ΕΙΔΙΚΗΣ ΑΓΩΓΗΣ',
+ 'ΠΕ04.01 ΦΥΣΙΚΟΙ',
+ 'ΠΕ04.01.50 ΦΥΣΙΚΟΙ ΕΙΔΙΚΗΣ ΑΓΩΓΗΣ',
+ 'ΠΕ04.02 ΧΗΜΙΚΟΙ',
+ 'ΠΕ04.04 ΒΙΟΛΟΓΟΙ',
+ 'ΠΕ05 ΓΑΛΛΙΚΗΣ ΦΙΛΟΛΟΓΙΑΣ',
+ 'ΠΕ06 ΑΓΓΛΙΚΗΣ ΦΙΛΟΛΟΓΙΑΣ',
+ 'ΠΕ07 ΓΕΡΜΑΝΙΚΗΣ ΦΙΛΟΛΟΓΙΑΣ',
+ 'ΠΕ08 ΚΑΛΛΙΤΕΧΝΙΚΩΝ',
+ 'ΠΕ11 ΦΥΣΙΚΗΣ ΑΓΩΓΗΣ',
+ 'ΠΕ23-ΣΔΕΥ ΨΥΧΟΛΟΓΟΙ',
+ 'ΠΕ30-ΣΔΕΥ ΚΟΙΝΩΝΙΚΟΙ ΛΕΙΤΟΥΡΓΟΙ',
+ 'ΠΕ78 ΚΟΙΝΩΝΙΚΩΝ ΕΠΙΣΤΗΜΩΝ',
+ 'ΠΕ79.01 ΜΟΥΣΙΚΗΣ ΕΠΙΣΤΗΜΗΣ',
+ 'ΠΕ80 ΟΙΚΟΝΟΜΙΑΣ',
+ 'ΠΕ81 ΠΟΛ.ΜΗΧΑΝΙΚΩΝ-ΑΡΧΙΤΕΚΤΟΝΩΝ',
+ 'ΠΕ82 ΜΗΧΑΝΟΛΟΓΩΝ',
+ 'ΠΕ86 ΠΛΗΡΟΦΟΡΙΚΗΣ',
+ 'ΠΕ88.01 ΓΕΩΠΟΝΟΙ'
+]);
+
+
+
+/** GENDER-ed constant arrays (LGBTQIA+ inclusive)
+ * they use pronounces as key instead of binary gender-flag
+ * -----------------------------------------------------------------------------
+ */
+
+define('GENDERED_POSITIONS', [ // gender-ed positions
+ 'he' => [
+ 'Διευθυντής',
+ 'Υποδιευθυντής',
+ 'Μόνιμος Καθηγητής',
+ 'Αναπληρωτής Καθηγητής'
+ ],
+ 'she' => [
+ 'Διευθύντρια',
+ 'Υποδιευθύντρια',
+ 'Μόνιμη Καθηγήτρια',
+ 'Αναπληρώτρια Καθηγήτρια'
+ ],
+ 'ze' => [
+ 'Διευθυντ@',
+ 'Υποδιευθυντ@',
+ 'Μόνιμ@ Καθηγητ@',
+ 'Αναπληρωτ@ Καθηγητ@'
+ ]
+]);
+
+define('GENDERED_ARTICLE',[ // gendered (grammar) articles
+ 'he' => 'ο',
+ 'she' => 'η',
+ 'ze' => '@'
+]);
@@ -192,31 +253,7 @@ define('REGISTRATION_FORM', [
'value' => 'auto',
'type' => 'select',
'attributes' => ['required'],
- 'options' => [
- 'ΠΕ01 ΘΕΟΛΟΓΟΙ',
- 'ΠΕ02 ΦΙΛΟΛΟΓΟΙ',
- 'ΠΕ02.50 ΦΙΛΟΛΟΓΟΙ ΕΙΔΙΚΗΣ ΑΓΩΓΗΣ',
- 'ΠΕ03 ΜΑΘΗΜΑΤΙΚΟΙ',
- 'ΠΕ03.50 ΜΑΘΗΜΑΤΙΚΟΙ ΕΙΔΙΚΗΣ ΑΓΩΓΗΣ',
- 'ΠΕ04.01 ΦΥΣΙΚΟΙ',
- 'ΠΕ04.01.50 ΦΥΣΙΚΟΙ ΕΙΔΙΚΗΣ ΑΓΩΓΗΣ',
- 'ΠΕ04.02 ΧΗΜΙΚΟΙ',
- 'ΠΕ04.04 ΒΙΟΛΟΓΟΙ',
- 'ΠΕ05 ΓΑΛΛΙΚΗΣ ΦΙΛΟΛΟΓΙΑΣ',
- 'ΠΕ06 ΑΓΓΛΙΚΗΣ ΦΙΛΟΛΟΓΙΑΣ',
- 'ΠΕ07 ΓΕΡΜΑΝΙΚΗΣ ΦΙΛΟΛΟΓΙΑΣ',
- 'ΠΕ08 ΚΑΛΛΙΤΕΧΝΙΚΩΝ',
- 'ΠΕ11 ΦΥΣΙΚΗΣ ΑΓΩΓΗΣ',
- 'ΠΕ23-ΣΔΕΥ ΨΥΧΟΛΟΓΟΙ',
- 'ΠΕ30-ΣΔΕΥ ΚΟΙΝΩΝΙΚΟΙ ΛΕΙΤΟΥΡΓΟΙ',
- 'ΠΕ78 ΚΟΙΝΩΝΙΚΩΝ ΕΠΙΣΤΗΜΩΝ',
- 'ΠΕ79.01 ΜΟΥΣΙΚΗΣ ΕΠΙΣΤΗΜΗΣ',
- 'ΠΕ80 ΟΙΚΟΝΟΜΙΑΣ',
- 'ΠΕ81 ΠΟΛ.ΜΗΧΑΝΙΚΩΝ-ΑΡΧΙΤΕΚΤΟΝΩΝ',
- 'ΠΕ82 ΜΗΧΑΝΟΛΟΓΩΝ',
- 'ΠΕ86 ΠΛΗΡΟΦΟΡΙΚΗΣ',
- 'ΠΕ88.01 ΓΕΩΠΟΝΟΙ'
- ]
+ 'options' => TEACHER_SECTORS
],
[
'name' => 'belonging_school',
@@ -321,6 +358,7 @@ define('APPLICATION_FORM', [
[
'name' => 'sector',
'label' => 'Κλάδος / Ειδικότητα',
+ 'type' => 'select',
'class' => 'col-7',
'attributes' => ['auto']
],
@@ -341,7 +379,6 @@ define('APPLICATION_FORM', [
'label' => 'Θέση',
'type' => 'select',
'class' => 'col-7',
- 'source' => 'positions',
'attributes' => ['required', 'auto']
],
[
diff --git a/public/app/controllers/Auth.php b/public/app/controllers/Auth.php
index e191c53..d52b6c9 100644
--- a/public/app/controllers/Auth.php
+++ b/public/app/controllers/Auth.php
@@ -163,18 +163,9 @@ class Auth {
// prepare gendered options to position field
$positions = ($user->prefix != 'η')
- ? [
- 'Διευθυντής',
- 'Υποδιευθυντής',
- 'Μόνιμος Καθηγητής',
- 'Αναπληρωτής Καθηγητής'
- ]
- : [
- 'Διευθύντρια',
- 'Υποδιευθύντρια',
- 'Μόνιμη Καθηγήτρια',
- 'Αναπληρώτρια Καθηγήτρια'
- ];
+ ? GENDERED_POSITIONS['he']
+ : GENDERED_POSITIONS['she'];
+
$gendered_position = json_decode( json_encode( $positions, JSON_UNESCAPED_UNICODE ));
// attach gendered options
diff --git a/public/app/controllers/JsonToForm.php b/public/app/controllers/JsonToForm.php
index 1e0b99b..5e16472 100644
--- a/public/app/controllers/JsonToForm.php
+++ b/public/app/controllers/JsonToForm.php
@@ -119,12 +119,12 @@ class JsonToForm
* construct a form (html, javasctipt)
* from a json designer
*
- * @param stdClass $formJson : form descriptor
+ * @param stdClass $formJson : form descriptor
*
* @param array $require_identity : array of properties and values;
* they identify the record; injected into form as hidden fields
*
- * @return array [ html=>(string), init_js=>(string), values_js=>String ]
+ * @return array [ html=>(string), init_js=>(string), values_js=>String ]
* -------------------------------------------------------------------------
*/
public static function json_form($formJson, $require_identity = [])
diff --git a/public/app/controllers/Office.php b/public/app/controllers/Office.php
index 9eb2a4c..5038200 100644
--- a/public/app/controllers/Office.php
+++ b/public/app/controllers/Office.php
@@ -160,6 +160,9 @@ class Office {
}
+ /** render application form
+ *
+ */
private static function render_application_form($opts)
{
// #1: user-id ---------------------------------------------------------
@@ -170,15 +173,30 @@ class Office {
// #3: inject default values -------------------------------------------
+ $userData = Auth::user_data();
+
// #3.1: inject user data
$form_setup->defaults = json_decode( json_encode(
- Auth::user_data(), JSON_UNESCAPED_UNICODE
+ $userData, JSON_UNESCAPED_UNICODE
));
+
// #3.2 inject `sector` and `position` <option>s
+ for($i=0; $i < sizeof($form_setup->form) ; $i++) { // get key-IDs
+ if (isset($form_setup->form[$i]->name)) {
+ if ($form_setup->form[$i]->name == 'sector') { $keySector = $i; }
+ if ($form_setup->form[$i]->name == 'position') { $keyPosition = $i; }
+ }
+ }
+ $form_setup->form[$keySector]->options = TEACHER_SECTORS;
+ $form_setup->form[$keyPosition]->options = ($userData['prefix'] == 'η')
+ ? GENDERED_POSITIONS['she']
+ : GENDERED_POSITIONS['he'];
+
+
// #4: get Form's HTML and Javascript ----------------------------------
$form = JsonToForm::json_form($form_setup, [
- ['name' => 'user_id', 'value' => $user_id] // pass user identity
+ ['name' => 'user_id', 'value' => $user_id] // pass user identity
]);
// #5: render the view -------------------------------------------------
@@ -209,7 +227,7 @@ class Office {
$teachers[] = $person['TeacherName'];
}
- // #3.2: get $key of rapporteur, president and members <select>s
+ // #3.2: get $key of `rapporteur`, `president` and `members` <select>s
for($i=0; $i < sizeof($form_setup->form) ; $i++) {
if (isset($form_setup->form[$i]->name)) {
if ($form_setup->form[$i]->name == 'rapporteur') { $keyRapporteur = $i; }