summaryrefslogtreecommitdiff
path: root/public/app
diff options
context:
space:
mode:
Diffstat (limited to 'public/app')
-rw-r--r--public/app/config/app_constants.php49
-rw-r--r--public/app/controllers/JsonToForm.php18
-rw-r--r--public/app/models/_info.md25
3 files changed, 71 insertions, 21 deletions
diff --git a/public/app/config/app_constants.php b/public/app/config/app_constants.php
index fedba90..9dff566 100644
--- a/public/app/config/app_constants.php
+++ b/public/app/config/app_constants.php
@@ -245,7 +245,7 @@ define('COMMON_REQUEST_FORM', [
'outer_class' => 'col-12',
'inner_class' => 'form-control',
'type' => 'text',
- 'source' => 'user'
+ 'source' => '\app\controllers\User::current'
],
'form' => [
[
@@ -331,20 +331,36 @@ define('PENALTY_FORM', [
'type' => 'label'
],
[
- 'name' => 'of_student',
- 'label' => 'τ.. μαθητ...',
+ 'name' => 'of_article',
+ 'label' => 'του/της...',
+ 'type' => 'select',
+ 'options' => [
+ 'του μαθητή',
+ 'της μαθήτριας',
+ 'των μαθητών',
+ 'των μαθητριών'
+ ],
+ 'class' => 'col-4',
+ 'attributes' => ['required']
+ ],
+ [
+ 'name' => 'student_names',
+ 'label' => '(ονοματεπώνυ-μο/μα, πτώση γενική)',
+ 'type' => 'textarea',
+ 'class' => 'col-8',
'attributes' => ['required']
],
[
'name' => 'of_department',
'label' => 'του τμήματος...',
+ 'class' => 'col-4',
'attributes' => ['required']
],
[
'name' => 'date',
'label' => 'Ημερομηνία',
'type' => 'date',
- 'class' => 'col-5',
+ 'class' => 'col-4',
'attributes' => ['required']
],
[
@@ -356,21 +372,28 @@ define('PENALTY_FORM', [
[
'name' => 'place',
'label' => 'Τόπος',
+ 'type' => 'select',
+ 'options' => [
+ 'Γραφείο Διευθηντή',
+ 'Γραφείο Καθηγητών'
+ ],
'attributes' => ['required']
],
[
'name' => 'rapporteur',
'label' => 'εισηγητής',
+ 'source' => '\app\extends\Cache_service::all_users',
'attributes' => ['required']
],
[
'name' => 'charge',
- 'label' => 'κατηγορία',
+ 'label' => 'Περιγραφή συμβάντος:',
+ 'type' => 'textarea',
'attributes' => ['required']
],
[
'name' => 'apology',
- 'label' => 'Απολογία', // + of_student
+ 'label' => 'Απολογία: (μαθητή/-των)', // + of_student
'type' => 'textarea',
'attributes' => []
],
@@ -378,17 +401,18 @@ define('PENALTY_FORM', [
'name' => 'decision_reasoning',
'label' => 'Αιτιολογία απόφασης (πχ. Επειδή...)',
'type' => 'textarea',
- 'attributes' => ['required']
+ 'attributes' => []
],
[
- 'label' => 'Το Πειθαρχικό Συμβούλιο'
+ 'label' => 'Το Πειθαρχικό Συμβούλιο',
+ 'type' => 'label'
],
[
'name' => 'decision',
'label' => 'Αποφασίζει',
'type' => 'select',
'options' => [
- 'προφορική επίπληψη',
+ 'προφορική επίπληξη',
'ωριαία αποβολή',
'ημερήσια αποβολή'
],
@@ -396,13 +420,14 @@ define('PENALTY_FORM', [
],
[
'name' => 'decision_more',
- 'label' => '(μη τυποποιημένo κείμενο απόφασης)',
+ 'label' => '(μη τυποποιημένο κείμενο απόφασης)',
'attributes' => []
],
[
'name' => 'president',
- 'label' => 'Ημερομηνία αίτησης',
+ 'label' => 'Πρόεδρος συνεδρίασης',
'type' => 'text',
+ 'source' => '\app\extends\Cache_service::all_users',
'attributes' => ['required']
],
[
@@ -410,7 +435,7 @@ define('PENALTY_FORM', [
'label' => 'Μέλη',
'type' => 'select',
'attributes' => ['required', 'multiple'],
- 'source' => 'teachers',
+ 'source' => '\app\extends\Cache_service::all_users',
'options' => [
'Μαρία Χαλκιαδάκη',
'Σπαγκοβαγγελοδημήτρης Νικόλαος',
diff --git a/public/app/controllers/JsonToForm.php b/public/app/controllers/JsonToForm.php
index 5a60891..1b05af7 100644
--- a/public/app/controllers/JsonToForm.php
+++ b/public/app/controllers/JsonToForm.php
@@ -181,7 +181,9 @@ class JsonToForm
- $html = '';
+ $html = "
+ <div class='row'>
+ ";
foreach ($formJson->form as $key => $field) {
@@ -227,13 +229,13 @@ class JsonToForm
} else { // select is single; draw select + add empty option
$html .="
- <select id='{$name}' class='form-select form-select-sm' name='{$name}' style='width:100%'>
- <option value='0'>(επιλέξτε)</option>";
+ <select id='{$name}' class='form-select form-select-sm' name='{$name}' style='width:100%'>";
- // // prepare initialization of select2 (single)
- // $initSelectsJS .= "
- // var {$name} = $('#{$name}');
- // {$name}.select2({ allowClear: true });";
+ // prepare initialization of select2 (single)
+ $initSelectsJS .= "
+ var {$name} = $('#{$name}');
+ {$name}.select2({ });
+ {$name}.val(null).trigger('change')";
// prepare check if empty field
$checkFilledJS .= "
@@ -338,7 +340,7 @@ class JsonToForm
}
return [
- 'html' => $html,
+ 'html' => $html .'</div>',
'init_js' => $initSelectsJS,
'values_js' => $checkFilledJS
];
diff --git a/public/app/models/_info.md b/public/app/models/_info.md
index 401c13c..82143bf 100644
--- a/public/app/models/_info.md
+++ b/public/app/models/_info.md
@@ -45,7 +45,6 @@ active) VALUES (:id,
:active )
-
UPDATE user
SET prefix = :prefix,
first_name = :first_name,
@@ -127,3 +126,27 @@ admin/iinvite
+
+
+# callable/dynamic select options
+
+
+<?php
+
+class myclass {
+ static function say_hello()
+ {
+ echo "Hello!\n";
+ }
+}
+
+$classname = "myclass";
+
+call_user_func(array($classname, 'say_hello'));
+call_user_func($classname .'::say_hello');
+
+$myobject = new myclass();
+
+call_user_func(array($myobject, 'say_hello'));
+
+?>