From 2b1f4aed56c5bfbf014f3f871e9dcc336b5a31b7 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Wed, 24 May 2023 18:38:04 +0300 Subject: new application form is ready --- public/app/config/setup_application.php | 89 +++++++++++++++++++++++---------- public/app/controllers/Auth.php | 15 ++---- public/app/controllers/JsonToForm.php | 4 +- public/app/controllers/Office.php | 24 +++++++-- 4 files changed, 89 insertions(+), 43 deletions(-) (limited to 'public/app') 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`