From 59cd40235bf4746a119421609b25d7e9b7f65f83 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Mon, 15 May 2023 18:15:37 +0300 Subject: refactoring framework defaults --- Dockerfile | 1 + core/auth/env.example | 36 -- core/classes/Database.php | 2 +- core/config/anom_settings.php | 209 ---------- core/config/constants.php | 28 -- core/config/init.php | 11 +- core/config/xx--anom_settings.php | 66 +++ core/config/xx--constants.php | 28 ++ core/helpers/autoload.php | 2 +- env.example | 36 ++ public/app/config/app_constants.php | 708 -------------------------------- public/app/config/setup-application.php | 478 +++++++++++++++++++++ public/app/config/setup-framework.php | 469 +++++++++++++++++++++ public/app/routes/api.php | 46 +-- public/app/routes/frontend.php | 6 + public/index.php | 26 +- tests/settings.php | 1 + 17 files changed, 1131 insertions(+), 1022 deletions(-) delete mode 100644 core/auth/env.example delete mode 100644 core/config/anom_settings.php delete mode 100644 core/config/constants.php create mode 100644 core/config/xx--anom_settings.php create mode 100644 core/config/xx--constants.php create mode 100644 env.example delete mode 100644 public/app/config/app_constants.php create mode 100644 public/app/config/setup-application.php create mode 100644 public/app/config/setup-framework.php diff --git a/Dockerfile b/Dockerfile index adb4c79..16662a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,7 @@ COPY core /var/www/core COPY storage /var/www/storage # Copy configuration files for the container (application based) +COPY .env /var/www/ COPY docker /var/www/docker COPY tests /var/www/tests COPY composer.json /var/www/ diff --git a/core/auth/env.example b/core/auth/env.example deleted file mode 100644 index fd47dd8..0000000 --- a/core/auth/env.example +++ /dev/null @@ -1,36 +0,0 @@ -ENVIRONMENT='development' - -# MySQL connection -# --- -- -- - - - -DB_NAME= -DB_USER= -DB_PASS= -PDO_HOST= - -# mailhog -# == testting/fake email service -# --- -- -- - - - -# MAIL_HOST=mailhog_server -# MAIL_PORT=1025 -# MAIL_USERNAME= -# MAIL_PASSWORD= -# MAIL_ENCRYPTION= - -# SMTP setup -# == read mail server -# --- -- -- - - - -MAIL_MAILER=smtp -MAIL_HOST= -MAIL_PORT=465 -MAIL_USERNAME= -MAIL_PASSWORD= -MAIL_ENCRYPTION=ssl -NO_REPLY_EMAIL=noreply@... -REPLY_TO_EMAIL=webmaster@r... -MAIL_FROM_NAME=Classroom - -# redis cache server -# --- -- -- - - - -# REDIS_HOST=redis -# REDIS_PASSWORD= -# REDIS_PORT=6379 \ No newline at end of file diff --git a/core/classes/Database.php b/core/classes/Database.php index 0a8a10a..9de9872 100644 --- a/core/classes/Database.php +++ b/core/classes/Database.php @@ -125,7 +125,7 @@ class Database { } // keep rowCount (valid for INSERT, UPDATE, DELETE) - $this->rowCount = $stmt->rowCount(); + $this->rowCount = $stmt->rowCount(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); diff --git a/core/config/anom_settings.php b/core/config/anom_settings.php deleted file mode 100644 index 03e4cc5..0000000 --- a/core/config/anom_settings.php +++ /dev/null @@ -1,209 +0,0 @@ - 'text/html; charset=UTF-8', - 'html' => 'text/html; charset=UTF-8', - 'json' => 'application/json; charset=utf-8', - 'js' => 'application/javascript; charset=utf-8', - 'css' => 'text/css', - 'png' => 'image/png', - 'jpeg' => 'image/jpeg', - 'webp' => 'image/web' - ) -); - - -// PROXY_FLAGS -// ----------------------------------------------------------------------------- -// These options represend altered/non-default behaviour -// and will be resolved bitwise, so use powers of 2 -// ----------------------------------------------------------------------------- -define('PROXY_CACHE_ERRORS', 1); // cache result even if error -define('PROXY_IGNORE_CACHE', 2); // ignore cache if exist -define('PROXY_DO_NOT_CACHE', 4); // do not cache result diff --git a/core/config/init.php b/core/config/init.php index 589a486..40624d3 100644 --- a/core/config/init.php +++ b/core/config/init.php @@ -18,14 +18,9 @@ // setup error-handliing // ----------------------------------------------------------------------------- -require_once '../core/helpers/error_handling.php'; +require_once APP_ROOT.'/core/helpers/error_handling.php'; -// depricated: -/// // Load rendering sub-system -/// // ----------------------------------------------------------------------------- -/// require_once RENDERING_SYSTEM; - // Setup Application Engiine // ----------------------------------------------------------------------------- @@ -55,10 +50,10 @@ Registry::set('REQUEST', new Request()); // (these patterns use some of the project's central objects (Registry, // Cache, Database), so laod them after. // ----------------------------------------------------------------------------- -require_once '../core/helpers/design_patterns.php'; +require_once APP_ROOT.'/core/helpers/design_patterns.php'; // Add Routes // ----------------------------------------------------------------------------- -require_once 'app/config/init_routes.php'; // initialize routes +require_once WEB_ROOT.'/app/config/init_routes.php'; // initialize routes diff --git a/core/config/xx--anom_settings.php b/core/config/xx--anom_settings.php new file mode 100644 index 0000000..06fe5af --- /dev/null +++ b/core/config/xx--anom_settings.php @@ -0,0 +1,66 @@ + 'text/html; charset=UTF-8', + 'html' => 'text/html; charset=UTF-8', + 'json' => 'application/json; charset=utf-8', + 'js' => 'application/javascript; charset=utf-8', + 'css' => 'text/css', + 'png' => 'image/png', + 'jpeg' => 'image/jpeg', + 'webp' => 'image/web' + ) +); + + +// PROXY_FLAGS +// ----------------------------------------------------------------------------- +// These options represend altered/non-default behaviour +// and will be resolved bitwise, so use powers of 2 +// ----------------------------------------------------------------------------- +define('PROXY_CACHE_ERRORS', 1); // cache result even if error +define('PROXY_IGNORE_CACHE', 2); // ignore cache if exist +define('PROXY_DO_NOT_CACHE', 4); // do not cache result diff --git a/core/helpers/autoload.php b/core/helpers/autoload.php index c4359c6..c72c335 100644 --- a/core/helpers/autoload.php +++ b/core/helpers/autoload.php @@ -18,7 +18,7 @@ spl_autoload_register( // check all possible classPaths for class foreach(CLASSPATHS as $key => $basePath) { - $file = APP_ROOT . $basePath . $classPath .'.php'; + $file = WEB_ROOT . $basePath . $classPath .'.php'; // if class-file exist, include it if (file_exists($file)) { diff --git a/env.example b/env.example new file mode 100644 index 0000000..fd47dd8 --- /dev/null +++ b/env.example @@ -0,0 +1,36 @@ +ENVIRONMENT='development' + +# MySQL connection +# --- -- -- - - - +DB_NAME= +DB_USER= +DB_PASS= +PDO_HOST= + +# mailhog +# == testting/fake email service +# --- -- -- - - - +# MAIL_HOST=mailhog_server +# MAIL_PORT=1025 +# MAIL_USERNAME= +# MAIL_PASSWORD= +# MAIL_ENCRYPTION= + +# SMTP setup +# == read mail server +# --- -- -- - - - +MAIL_MAILER=smtp +MAIL_HOST= +MAIL_PORT=465 +MAIL_USERNAME= +MAIL_PASSWORD= +MAIL_ENCRYPTION=ssl +NO_REPLY_EMAIL=noreply@... +REPLY_TO_EMAIL=webmaster@r... +MAIL_FROM_NAME=Classroom + +# redis cache server +# --- -- -- - - - +# REDIS_HOST=redis +# REDIS_PASSWORD= +# REDIS_PORT=6379 \ No newline at end of file diff --git a/public/app/config/app_constants.php b/public/app/config/app_constants.php deleted file mode 100644 index 6974bd8..0000000 --- a/public/app/config/app_constants.php +++ /dev/null @@ -1,708 +0,0 @@ - 'Login', - 2 => 'Account', - 3 => 'Request' -]); - - - -// ERRORS AND ERROR MESSAGES /////////////////////////////////////////////////// -// ----------------------------------------------------------------------------- - -define('EMPTY_REQUIRED_FIELDS', 'Δεν έχουν συμπληρωθεί όλα τα υποχρεωτικά πεδία'); - - - -// ASSETS: PATHS USED HEAVILY ////////////////////////////////////////////////// -// ----------------------------------------------------------------------------- -// these paths are used in order to easily find and autoload useful elemets - - -// JAVASCRIPT LIBRARY PATHS -// ----------------------------------------------------------------------------- -define('JS_DIR', '/content/'); // path to contruct link - - - -// CSS ASSET PATHS -// ----------------------------------------------------------------------------- -define('CSS_DIR', '/content/css/'); // path to contruct link -define('CSS_FILES', array( // path after to the actual file - 'main' => 'main.min.css', - 'filter' => 'filter.css', - 'overides' => 'overides.css', - ) -); - - - -// Mesagges //////////////////////////////////////////////////////////////////// -// ----------------------------------------------------------------------------- - -// 404 -// --- -define('PAGE_404_TITLE', '404: Not Found'); - -// registration -// --- -define('REGISTRATION_SUCCESS', "

Επιτυχής Εγγραφή

-

- Παρακαλώ ελέγξτε το email σας και ακολουθήστε το σύνδεσμο ενεργοποίησης - που σας 'εχει αποσταλεί, ώστε να έχετε πρόσβαση σε επιπλέον περιεχόμενο του site -

" -); -define ('REGISTRATION_USER_EXISTS', "

Αποτυχία Εγγραφής

-

- Υπάρχει ήδη χρήστης με αυτό το email. Αν δεν θυμάστε το password - μπορείτε να κάνετε επαναφορά του ακολουθώντας - αυτό το σύνδεσμο. -

" -); - - -// activation -// --- -define('ACCOUNT_ACTIVATED_TITLE', 'Ο λογαριασμός σας έχει ενεργοποιηθεί'); -define('ACCOUNT_ACTIVATED_MESSAGE', 'Τώρα μπορείτε να - συνδεθείτε στο σύστημα.'); -define('NOT_VALID_ACTIVATION_TITLE', 'Σφάλμα!'); -define('NOT_VALID_ACTIVATION_MESSAGE', 'Ο λογαριασμός δεν έχει ενεργοποιηθεί. - Ξαναδοκιμάστε αργότερα κι αν το σφάλμα επιμείνει, επικοινωνήστε με την υπεύθυνη του προγράμμαρος.'); - -define ('PETITION_TYPE', [ - 1 => 'common', - 2 => 'penalty' -]); - - - -// forms -// --- -- -- - - - - -// registration/activation form (from invitation) -// --- -define('REGISTRATION_FORM', [ - 'defaults' => [ - 'outer_class' => 'col-12', - 'inner_class' => 'form-control', - 'type' => 'text', - 'source' => '\app\controllers\User::current' - ], - 'form' => [ - [ - 'name' => 'first_name', - 'label' => 'Όνομα', - 'value' => 'auto', - 'attributes' => ['required'] - ], - [ - 'name' => 'last_name', - 'label' => 'Επίθετο', - 'value' => 'auto', - 'attributes' => ['required'] - ], - [ - 'name' => 'email', - 'label' => 'Email', - 'type' => 'email', - 'value' => 'auto', - 'attributes' => ['required'] - ], - [ - 'name' => 'father_name', - 'label' => 'Πατρώνυμο', - 'value' => 'auto', - 'attributes' => ['required'] - ], - [ - 'name' => 'registration_number', - 'label' => 'Αριθμός μητρώου', - 'class' => 'col-8', - 'value' => 'auto', - 'attributes' => ['required'] - ], - [ - 'name' => 'sector', - 'label' => 'Κλάδος / Ειδικότητα', - '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 ΓΕΩΠΟΝΟΙ' - ] - ], - [ - 'name' => 'belonging_school', - 'label' => 'Σχολείο τοποθέτησης', - 'value' => 'auto', - 'attributes' => ['required'] - ], - // [ // working school = (obviously) is the current school - // 'name' => 'working_school', - // 'label' => 'Σχολείο εργασίας', - // 'attributes' => ['required'] - // ], - [ - 'name' => 'position', - 'label' => 'Θέση', - 'type' => 'select', - 'value' => 'auto', - 'attributes' => ['required'], - 'options' => [] - ], - [ - 'name' => 'phone', - 'label' => 'Τηλέφωνο', - 'class' => 'col-8', - 'value' => 'auto', - 'attributes' => ['required'] - ], - [ - 'name' => 'password', - 'label' => 'Κωδικός πρόσβασης', - 'type' => 'password', - 'class' => 'col-8', - 'attributes' => ['required'] - ], - [ - 'name' => 'confirm_password', - 'label' => 'Επαλήθευση κωδικού πρόσβασης', - 'type' => 'password', - 'class' => 'col-8', - 'attributes' => ['required'] - ] - ] -]); - -// common requesy form (for any application) -// --- -define('COMMON_REQUEST_FORM', [ - 'defaults' => [ - 'outer_class' => 'col-12', - 'inner_class' => 'form-control', - 'type' => 'text', - 'source' => '\app\controllers\User::current' - ], - 'form' => [ - [ - 'name' => 'subject', - 'label' => 'Θέμα (χαρακτηριστικός τίτλος για αναφορά)', - 'attributes' => ['required'] - ], - [ - 'name' => 'first_name', - 'label' => 'Όνομα', - 'attributes' => ['auto'] - ], - [ - 'name' => 'last_name', - 'label' => 'Επίθετο', - 'attributes' => ['auto'] - ], - [ - 'name' => 'email', - 'label' => 'e-mail', - 'type' => 'email', - 'attributes' => ['auto'] - ], - [ - 'name' => 'father_name', - 'label' => 'Πατρώνυμο', - 'attributes' => ['auto'] - ], - [ - 'name' => 'registration_number', - 'label' => 'Αριθμός μητρώου', - 'class' => 'col-5', - 'attributes' => ['auto'] - ], - [ - 'name' => 'sector', - 'label' => 'Κλάδος / Ειδικότητα', - 'attributes' => ['auto'] - ], - [ - 'name' => 'belonging_school', - 'label' => 'Σχολείο τοποθέτησης', - 'attributes' => ['required'] - ], - [ - 'name' => 'working_school', - 'label' => 'Σχολείο εργασίας', - 'attributes' => ['required'] - ], - [ - 'name' => 'position', - 'label' => 'Θέση', - 'type' => 'select', - 'source' => 'positions', - 'attributes' => ['required'] - ], - [ - 'name' => 'phone', - 'label' => 'Τηλέφωνο', - 'attributes' => ['required'] - ], - [ - 'name' => 'request', - 'label' => 'Αίτημα (πχ, Παρακαλώ να μου χορηγήσετε ...)', - 'type' => 'textarea', - 'attributes' => ['required'] - ], - [ - 'name' => 'date', - 'label' => 'Ημερομηνία αίτησης', - 'type' => 'date', - 'attributes' => ['required'] - ] - ] -]); - -// penalty form -// --- - -define('PENALTY_FORM', [ - 'defaults' => [ - 'outer_class' => 'col-12', - 'inner_class' => 'form-control', - 'type' => 'text', - 'source' => 'user' - ], - 'form' => [ - [ - 'name' => 'subject', - 'label' => 'Θέμα (χαρακτηριστικός τίτλος για αναφορά)', - 'attributes' => ['required'] - ], - [ - 'label' => '', - 'type' => 'label' - ], - [ - 'label' => 'Πειθαρχική υπόθεση', - 'type' => 'label' - ], - [ - 'name' => 'of_article', - 'label' => 'του/της/των...', - 'type' => 'select', - 'options' => [ - 'του μαθητή', - 'της μαθήτριας', - 'των μαθητών', - 'των μαθητριών' - ], - 'class' => 'col-md-4', - 'attributes' => ['required'] - ], - [ - 'name' => 'student_names', - 'label' => '(ονοματεπώνυ-μο/μα, πτώση γενική)', - 'type' => 'textarea', - 'class' => 'col-md-8', - 'attributes' => ['required'] - ], - [ - 'name' => 'of_department', - 'label' => 'του τμήματος...', - 'class' => 'col-md-4', - 'attributes' => ['required'] - ], - [ - 'name' => 'date', - 'label' => 'Ημερομηνία', - 'type' => 'date', - 'class' => 'col-md-4', - 'attributes' => ['required'] - ], - [ - 'name' => 'time', - 'label' => 'Ώρα', - 'class' => 'col-md-4', - 'attributes' => ['required'] - ], - [ - 'name' => 'place', - 'label' => 'Τόπος', - 'type' => 'select', - 'options' => [ - 'Γραφείο Διευθηντή', - 'Γραφείο Καθηγητών' - ], - 'attributes' => ['required'] - ], - [ - 'name' => 'rapporteur', - 'label' => 'εισηγητής', - 'type' => 'select', - 'source' => '\app\extends\Cache_service::all_users', - 'attributes' => ['required'] - ], - [ - 'name' => 'charge', - 'label' => 'Περιγραφή συμβάντος:', - 'type' => 'textarea', - 'attributes' => ['required'] - ], - [ - 'name' => 'apology', - 'label' => 'Απολογία: (μαθητή/-των)', // + of_student - 'type' => 'textarea', - 'attributes' => [] - ], - [ - 'name' => 'decision_reasoning', - 'label' => 'Αιτιολογία απόφασης (πχ. Επειδή...)', - 'type' => 'textarea', - 'attributes' => [] - ], - [ - 'label' => 'Το Πειθαρχικό Συμβούλιο', - 'type' => 'label' - ], - [ - 'name' => 'decision', - 'label' => 'Αποφασίζει', - 'type' => 'select', - 'options' => [ - 'προφορική επίπληξη', - 'ωριαία αποβολή', - 'ημερήσια αποβολή' - ], - 'attributes' => [] - ], - [ - 'name' => 'decision_more', - 'label' => '(μη τυποποιημένο κείμενο απόφασης)', - 'attributes' => [] - ], - [ - 'name' => 'president', - 'label' => 'Πρόεδρος συνεδρίασης', - 'type' => 'select', - 'source' => '\app\extends\Cache_service::all_users', - 'attributes' => ['required'] - ], - [ - 'name' => 'members', - 'label' => 'Μέλη', - 'type' => 'select', - 'attributes' => ['required', 'multiple'], - 'source' => '\app\extends\Cache_service::all_users' - ] - ] -]); - - diff --git a/public/app/config/setup-application.php b/public/app/config/setup-application.php new file mode 100644 index 0000000..ec9a7bb --- /dev/null +++ b/public/app/config/setup-application.php @@ -0,0 +1,478 @@ + 'Login', + 2 => 'Account', + 3 => 'Request' +]); + + + +// ERRORS AND ERROR MESSAGES /////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- + +define('EMPTY_REQUIRED_FIELDS', 'Δεν έχουν συμπληρωθεί όλα τα υποχρεωτικά πεδία'); + + + +// ASSETS: PATHS USED HEAVILY ////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- +// these paths are used in order to easily find and autoload useful elemets + + +// JAVASCRIPT LIBRARY PATHS +// ----------------------------------------------------------------------------- +define('JS_DIR', '/content/'); // path to contruct link + + + +// CSS ASSET PATHS +// ----------------------------------------------------------------------------- +define('CSS_DIR', '/content/css/'); // path to contruct link +define('CSS_FILES', array( // path after to the actual file + 'main' => 'main.min.css', + 'filter' => 'filter.css', + 'overides' => 'overides.css', + ) +); + + + +// Mesagges //////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- + +// 404 +// --- +define('PAGE_404_TITLE', '404: Not Found'); + +// registration +// --- +define('REGISTRATION_SUCCESS', "

Επιτυχής Εγγραφή

+

+ Παρακαλώ ελέγξτε το email σας και ακολουθήστε το σύνδεσμο ενεργοποίησης + που σας 'εχει αποσταλεί, ώστε να έχετε πρόσβαση σε επιπλέον περιεχόμενο του site +

" +); +define ('REGISTRATION_USER_EXISTS', "

Αποτυχία Εγγραφής

+

+ Υπάρχει ήδη χρήστης με αυτό το email. Αν δεν θυμάστε το password + μπορείτε να κάνετε επαναφορά του ακολουθώντας + αυτό το σύνδεσμο. +

" +); + + +// activation +// --- +define('ACCOUNT_ACTIVATED_TITLE', 'Ο λογαριασμός σας έχει ενεργοποιηθεί'); +define('ACCOUNT_ACTIVATED_MESSAGE', 'Τώρα μπορείτε να + συνδεθείτε στο σύστημα.'); +define('NOT_VALID_ACTIVATION_TITLE', 'Σφάλμα!'); +define('NOT_VALID_ACTIVATION_MESSAGE', 'Ο λογαριασμός δεν έχει ενεργοποιηθεί. + Ξαναδοκιμάστε αργότερα κι αν το σφάλμα επιμείνει, επικοινωνήστε με την υπεύθυνη του προγράμμαρος.'); + +define ('PETITION_TYPE', [ + 1 => 'common', + 2 => 'penalty' +]); + + + +// the forms /////////////////////////////////////////////////////////////////// +// ----------------------------------------------------------------------------- + +// registration/activation form (from invitation) +// --- +define('REGISTRATION_FORM', [ + 'defaults' => [ + 'outer_class' => 'col-12', + 'inner_class' => 'form-control', + 'type' => 'text', + 'source' => '\app\controllers\User::current' + ], + 'form' => [ + [ + 'name' => 'first_name', + 'label' => 'Όνομα', + 'value' => 'auto', + 'attributes' => ['required'] + ], + [ + 'name' => 'last_name', + 'label' => 'Επίθετο', + 'value' => 'auto', + 'attributes' => ['required'] + ], + [ + 'name' => 'email', + 'label' => 'Email', + 'type' => 'email', + 'value' => 'auto', + 'attributes' => ['required'] + ], + [ + 'name' => 'father_name', + 'label' => 'Πατρώνυμο', + 'value' => 'auto', + 'attributes' => ['required'] + ], + [ + 'name' => 'registration_number', + 'label' => 'Αριθμός μητρώου', + 'class' => 'col-8', + 'value' => 'auto', + 'attributes' => ['required'] + ], + [ + 'name' => 'sector', + 'label' => 'Κλάδος / Ειδικότητα', + '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 ΓΕΩΠΟΝΟΙ' + ] + ], + [ + 'name' => 'belonging_school', + 'label' => 'Σχολείο τοποθέτησης', + 'value' => 'auto', + 'attributes' => ['required'] + ], + // [ // working school = (obviously) is the current school + // 'name' => 'working_school', + // 'label' => 'Σχολείο εργασίας', + // 'attributes' => ['required'] + // ], + [ + 'name' => 'position', + 'label' => 'Θέση', + 'type' => 'select', + 'value' => 'auto', + 'attributes' => ['required'], + 'options' => [] + ], + [ + 'name' => 'phone', + 'label' => 'Τηλέφωνο', + 'class' => 'col-8', + 'value' => 'auto', + 'attributes' => ['required'] + ], + [ + 'name' => 'password', + 'label' => 'Κωδικός πρόσβασης', + 'type' => 'password', + 'class' => 'col-8', + 'attributes' => ['required'] + ], + [ + 'name' => 'confirm_password', + 'label' => 'Επαλήθευση κωδικού πρόσβασης', + 'type' => 'password', + 'class' => 'col-8', + 'attributes' => ['required'] + ] + ] +]); + +// common requesy form (for any application) +// --- +define('COMMON_REQUEST_FORM', [ + 'defaults' => [ + 'outer_class' => 'col-12', + 'inner_class' => 'form-control', + 'type' => 'text', + 'source' => '\app\controllers\User::current' + ], + 'form' => [ + [ + 'name' => 'subject', + 'label' => 'Θέμα (χαρακτηριστικός τίτλος για αναφορά)', + 'attributes' => ['required'] + ], + [ + 'name' => 'first_name', + 'label' => 'Όνομα', + 'attributes' => ['auto'] + ], + [ + 'name' => 'last_name', + 'label' => 'Επίθετο', + 'attributes' => ['auto'] + ], + [ + 'name' => 'email', + 'label' => 'e-mail', + 'type' => 'email', + 'attributes' => ['auto'] + ], + [ + 'name' => 'father_name', + 'label' => 'Πατρώνυμο', + 'attributes' => ['auto'] + ], + [ + 'name' => 'registration_number', + 'label' => 'Αριθμός μητρώου', + 'class' => 'col-5', + 'attributes' => ['auto'] + ], + [ + 'name' => 'sector', + 'label' => 'Κλάδος / Ειδικότητα', + 'attributes' => ['auto'] + ], + [ + 'name' => 'belonging_school', + 'label' => 'Σχολείο τοποθέτησης', + 'attributes' => ['required'] + ], + [ + 'name' => 'working_school', + 'label' => 'Σχολείο εργασίας', + 'attributes' => ['required'] + ], + [ + 'name' => 'position', + 'label' => 'Θέση', + 'type' => 'select', + 'source' => 'positions', + 'attributes' => ['required'] + ], + [ + 'name' => 'phone', + 'label' => 'Τηλέφωνο', + 'attributes' => ['required'] + ], + [ + 'name' => 'request', + 'label' => 'Αίτημα (πχ, Παρακαλώ να μου χορηγήσετε ...)', + 'type' => 'textarea', + 'attributes' => ['required'] + ], + [ + 'name' => 'date', + 'label' => 'Ημερομηνία αίτησης', + 'type' => 'date', + 'attributes' => ['required'] + ] + ] +]); + +// penalty form +// --- + +define('PENALTY_FORM', [ + 'defaults' => [ + 'outer_class' => 'col-12', + 'inner_class' => 'form-control', + 'type' => 'text', + 'source' => 'user' + ], + 'form' => [ + [ + 'name' => 'subject', + 'label' => 'Θέμα (χαρακτηριστικός τίτλος για αναφορά)', + 'attributes' => ['required'] + ], + [ + 'label' => '', + 'type' => 'label' + ], + [ + 'label' => 'Πειθαρχική υπόθεση', + 'type' => 'label' + ], + [ + 'name' => 'of_article', + 'label' => 'του/της/των...', + 'type' => 'select', + 'options' => [ + 'του μαθητή', + 'της μαθήτριας', + 'των μαθητών', + 'των μαθητριών' + ], + 'class' => 'col-md-4', + 'attributes' => ['required'] + ], + [ + 'name' => 'student_names', + 'label' => '(ονοματεπώνυ-μο/μα, πτώση γενική)', + 'type' => 'textarea', + 'class' => 'col-md-8', + 'attributes' => ['required'] + ], + [ + 'name' => 'of_department', + 'label' => 'του τμήματος...', + 'class' => 'col-md-4', + 'attributes' => ['required'] + ], + [ + 'name' => 'date', + 'label' => 'Ημερομηνία', + 'type' => 'date', + 'class' => 'col-md-4', + 'attributes' => ['required'] + ], + [ + 'name' => 'time', + 'label' => 'Ώρα', + 'class' => 'col-md-4', + 'attributes' => ['required'] + ], + [ + 'name' => 'place', + 'label' => 'Τόπος', + 'type' => 'select', + 'options' => [ + 'Γραφείο Διευθηντή', + 'Γραφείο Καθηγητών' + ], + 'attributes' => ['required'] + ], + [ + 'name' => 'rapporteur', + 'label' => 'εισηγητής', + 'type' => 'select', + 'source' => '\app\extends\Cache_service::all_users', + 'attributes' => ['required'] + ], + [ + 'name' => 'charge', + 'label' => 'Περιγραφή συμβάντος:', + 'type' => 'textarea', + 'attributes' => ['required'] + ], + [ + 'name' => 'apology', + 'label' => 'Απολογία: (μαθητή/-των)', // + of_student + 'type' => 'textarea', + 'attributes' => [] + ], + [ + 'name' => 'decision_reasoning', + 'label' => 'Αιτιολογία απόφασης (πχ. Επειδή...)', + 'type' => 'textarea', + 'attributes' => [] + ], + [ + 'label' => 'Το Πειθαρχικό Συμβούλιο', + 'type' => 'label' + ], + [ + 'name' => 'decision', + 'label' => 'Αποφασίζει', + 'type' => 'select', + 'options' => [ + 'προφορική επίπληξη', + 'ωριαία αποβολή', + 'ημερήσια αποβολή' + ], + 'attributes' => [] + ], + [ + 'name' => 'decision_more', + 'label' => '(μη τυποποιημένο κείμενο απόφασης)', + 'attributes' => [] + ], + [ + 'name' => 'president', + 'label' => 'Πρόεδρος συνεδρίασης', + 'type' => 'select', + 'source' => '\app\extends\Cache_service::all_users', + 'attributes' => ['required'] + ], + [ + 'name' => 'members', + 'label' => 'Μέλη', + 'type' => 'select', + 'attributes' => ['required', 'multiple'], + 'source' => '\app\extends\Cache_service::all_users' + ] + ] +]); diff --git a/public/app/config/setup-framework.php b/public/app/config/setup-framework.php new file mode 100644 index 0000000..63eb486 --- /dev/null +++ b/public/app/config/setup-framework.php @@ -0,0 +1,469 @@ + APP_NAME ?? 'undefined', 'site_title' => SITE_TITLE ?? 'undefined', 'appRoot' => APP_ROOT, + 'webRoot' => WEB_ROOT, 'views' => VIEWS_DIRECTORY, 'init' => INIT_APPLICATION, 'site_url' => SITE_URL ?? 'undefined', -- cgit v1.2.3