summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorGeo Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-05 17:47:23 +0300
committerGeo Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-05 17:47:23 +0300
commitaa60f8920261fdfe04232955cb1e4db1b170e816 (patch)
tree99bbbc3b2f01338a9c62f0e45c10ab4615019e34 /public
parent537673748f0b01539fc5839c2af1bacbefafc86d (diff)
downloadgyraf1gov-aa60f8920261fdfe04232955cb1e4db1b170e816.tar.gz
gyraf1gov-aa60f8920261fdfe04232955cb1e4db1b170e816.tar.bz2
gyraf1gov-aa60f8920261fdfe04232955cb1e4db1b170e816.zip
minor changes; final alpha-version is almost ready
Diffstat (limited to 'public')
-rw-r--r--public/app/controllers/Office.php51
-rw-r--r--public/app/controllers/Petition.php63
2 files changed, 67 insertions, 47 deletions
diff --git a/public/app/controllers/Office.php b/public/app/controllers/Office.php
index 44428af..6a55efe 100644
--- a/public/app/controllers/Office.php
+++ b/public/app/controllers/Office.php
@@ -120,8 +120,10 @@ class Office {
/** (any) petition
*
- * check if user is authorized to view the content;
- * if so, prepare and render the petition view
+ * Route method to specific petition;
+ *
+ * also...
+ * checks if user is authorized to view the content;
*
* @param $petition_type (string): [common|penalty]
*/
@@ -160,51 +162,6 @@ class Office {
}
- private static function render_common_petition($opts)
- {
-
- }
-
- private static function render_penalty_form($opts)
- {
- $user_id = $opts['user']->getID();
-
- $form_setup = json_decode(json_encode(PENALTY_FORM, JSON_UNESCAPED_UNICODE));
-
- // get all teachers
- $teachers_array = Registry::use('database')->runQuery(
- "SELECT concat(last_name, ' ', first_name) as TeacherName
- FROM user ORDER BY TeacherName", []
- );
- $teachers = []; // constuct teacher names as a simple array
- foreach($teachers_array as $key => $person) {
- $teachers[] = $person['TeacherName'];
- }
- // print_r( $teachers); die();
-
- // get $key of rapporteur, president and members inside the form_setup->form array
- 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; }
- if ($form_setup->form[$i]->name == 'president') { $keyPresident = $i; }
- if ($form_setup->form[$i]->name == 'members') { $keyMembers = $i; }
- }
- }
-
- // set option sources for rapporteur, president and members
- $form_setup->form[$keyRapporteur]->options = $teachers;
- $form_setup->form[$keyPresident]->options = $teachers;
- $form_setup->form[$keyMembers]->options = $teachers;
-
- // get Form's HTML and Jsvascript
- $form = JsonToForm::json_form($form_setup, [
- ['name' => 'user_id', 'value' => $user_id] // pass user identity
- ]);
-
- Render::view('templates/penalty', ['form' => $form]);
-
- }
-
## -------------------------------------------------------------------------
diff --git a/public/app/controllers/Petition.php b/public/app/controllers/Petition.php
new file mode 100644
index 0000000..fa73cf0
--- /dev/null
+++ b/public/app/controllers/Petition.php
@@ -0,0 +1,63 @@
+<?php
+
+namespace app\controllers;
+
+use Registry;
+use Render;
+use app\controllers\Auth;
+use app\extends\App_manager;
+use app\models\Cms_model;
+use app\extends\Cache_service;
+
+
+class Petition {
+
+ private static function render_common_petition($opts)
+ {
+
+ }
+
+ private static function render_penalty_form($opts)
+ {
+ $user_id = $opts['user']->getID();
+
+ $form_setup = json_decode(json_encode(PENALTY_FORM, JSON_UNESCAPED_UNICODE));
+
+ // get all teachers
+ $teachers_array = Registry::use('database')->runQuery(
+ "SELECT concat(last_name, ' ', first_name) as TeacherName
+ FROM user ORDER BY TeacherName", []
+ );
+ $teachers = []; // constuct teacher names as a simple array
+ foreach($teachers_array as $key => $person) {
+ $teachers[] = $person['TeacherName'];
+ }
+ // print_r( $teachers); die();
+
+ // get $key of rapporteur, president and members inside the form_setup->form array
+ 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; }
+ if ($form_setup->form[$i]->name == 'president') { $keyPresident = $i; }
+ if ($form_setup->form[$i]->name == 'members') { $keyMembers = $i; }
+ }
+ }
+
+ // set option sources for rapporteur, president and members
+ $form_setup->form[$keyRapporteur]->options = $teachers;
+ $form_setup->form[$keyPresident]->options = $teachers;
+ $form_setup->form[$keyMembers]->options = $teachers;
+
+ // get Form's HTML and Jsvascript
+ $form = JsonToForm::json_form($form_setup, [
+ ['name' => 'user_id', 'value' => $user_id] // pass user identity
+ ]);
+
+ Render::view('templates/penalty', ['form' => $form]);
+
+ }
+
+
+
+
+}