From 1f65f7737cb4f4c2b87d543ffcaa12000c35c331 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 24 Mar 2017 16:39:50 +0100 Subject: [PATCH] - Splitted Usersfilters_widget in: - Aufnahmegruppe_widget - Reihungstest_widget - Studiengang_widget - Studiensemester_widget - Stufe_widget - Renamed /system/Users controller to system/aufnahme/PrestudentMultiAssign - Added method getPrestudentMultiAssign to Prestudent_model - Changed WidgetLib to allow to set the name and the id html attributes of a widget --- application/controllers/system/Users.php | 222 ------------ .../system/aufnahme/PrestudentMultiAssign.php | 157 +++++++++ application/libraries/WidgetLib.php | 44 ++- application/models/crm/Prestudent_model.php | 83 +++++ .../system/aufnahme/prestudentMultiAssign.php | 333 ++++++++++++++++++ application/views/system/users.php | 305 ---------------- application/views/widgets/aufnahmegruppe.php | 14 + application/views/widgets/reihungstest.php | 14 + application/views/widgets/studiengang.php | 23 ++ application/views/widgets/studiensemester.php | 14 + application/views/widgets/stufe.php | 14 + application/views/widgets/usersfilters.php | 107 ------ application/widgets/Aufnahmegruppe_widget.php | 36 ++ application/widgets/Reihungstest_widget.php | 56 +++ application/widgets/Studiengang_widget.php | 37 ++ .../widgets/Studiensemester_widget.php | 37 ++ application/widgets/Stufe_widget.php | 37 ++ application/widgets/Usersfilters_widget.php | 183 ---------- 18 files changed, 896 insertions(+), 820 deletions(-) delete mode 100644 application/controllers/system/Users.php create mode 100644 application/controllers/system/aufnahme/PrestudentMultiAssign.php create mode 100644 application/views/system/aufnahme/prestudentMultiAssign.php delete mode 100644 application/views/system/users.php create mode 100644 application/views/widgets/aufnahmegruppe.php create mode 100644 application/views/widgets/reihungstest.php create mode 100644 application/views/widgets/studiengang.php create mode 100644 application/views/widgets/studiensemester.php create mode 100644 application/views/widgets/stufe.php delete mode 100644 application/views/widgets/usersfilters.php create mode 100644 application/widgets/Aufnahmegruppe_widget.php create mode 100644 application/widgets/Reihungstest_widget.php create mode 100644 application/widgets/Studiengang_widget.php create mode 100644 application/widgets/Studiensemester_widget.php create mode 100644 application/widgets/Stufe_widget.php delete mode 100644 application/widgets/Usersfilters_widget.php diff --git a/application/controllers/system/Users.php b/application/controllers/system/Users.php deleted file mode 100644 index db58980ea..000000000 --- a/application/controllers/system/Users.php +++ /dev/null @@ -1,222 +0,0 @@ -load->helper('message'); - - // Load the library to use the widgets - $this->load->library('TemplateLib'); - } - - public function index() - { - $studiengang = $this->input->post('studiengang'); - $studiensemester = $this->input->post('studiensemester'); - $gruppe = $this->input->post('gruppe'); - $reihungstest = $this->input->post('reihungstest'); - $stufe = $this->input->post('stufe'); - - $returnUsers = null; - if ($studiengang != null || $studiensemester != null || $gruppe!= null - || $reihungstest != null || $stufe != null) - { - $returnUsers = $this->_getUsers($studiengang, $studiensemester, $gruppe, $reihungstest, $stufe); - } - - $users = null; - if (hasData($returnUsers)) - { - $users = $returnUsers->retval; - } - - // Gruppen - $this->load->model('organisation/Gruppe_model', 'GruppeModel'); - $this->GruppeModel->addOrder('beschreibung'); - $gruppen = $this->GruppeModel->loadWhere(array('aktiv' => true, 'aufnahmegruppe' => true)); - if (hasData($gruppen)) - { - // Adding an empty element at the beginning - $emptyElement = new stdClass(); - $emptyElement->gruppe_kurzbz = '-1'; - $emptyElement->beschreibung = 'Select a group...'; - array_unshift($gruppen->retval, $emptyElement); - } - else - { - show_error($gruppen->retval); - } - - // Stufe - $this->load->model('crm/Reihungstest_model', 'ReihungstestModel'); - $this->ReihungstestModel->addSelect('DISTINCT ON(stufe) stufe, stufe AS beschreibung'); - $this->ReihungstestModel->addOrder('stufe'); - $stufen = $this->ReihungstestModel->loadWhere('stufe IS NOT NULL'); - if (hasData($stufen)) - { - // Adding an empty element at the beginning - $emptyElement = new stdClass(); - $emptyElement->stufe = '-1'; - $emptyElement->beschreibung = 'Select a stufe...'; - array_unshift($stufen->retval, $emptyElement); - } - else - { - show_error($stufen->retval); - } - - if ($returnUsers == null || isSuccess($returnUsers)) - { - $viewData = array( - 'studiengang' => $studiengang, - 'studiensemester' => $studiensemester, - 'gruppe' => $gruppe, - 'reihungstest' => $reihungstest, - 'stufe' => $stufe, - 'users' => $users, - 'gruppen' => $gruppen->retval, - 'stufen' => $stufen->retval - ); - - $this->load->view('system/users', $viewData); - } - else if (isError($returnUsers)) - { - show_error($returnUsers->retval); - } - } - - public function linkToStufe() - { - $prestudentIdArray = $this->input->post('prestudent_id'); - $stufe = $this->input->post('stufe'); - - // Load model PrestudentstatusModel - $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); - - $result = error("No valid parameters"); - if (isset($stufe) && isset($prestudentIdArray) && is_array($prestudentIdArray) && count($prestudentIdArray) >0) - { - $result = $this->PrestudentstatusModel->updateStufe($prestudentIdArray, $stufe); - } - - $this->output->set_header('Content-Type: application/json; charset=utf-8'); - - if (isSuccess($result)) - { - $href = str_replace("/system/Users/linkToStufe", "/system/Users", $_SERVER["REQUEST_URI"]); - echo '{"msg": "Data correctly saved"}'; - } - else - { - echo '{"msg": "Error occurred while saving data, please contact the administrator"}'; - } - } - - public function linkToAufnahmegruppe() - { - $prestudentIdArray = $this->input->post('prestudent_id'); - $aufnahmegruppe = $this->input->post('aufnahmegruppe'); - - // Load model PrestudentstatusModel - $this->load->model('crm/Prestudent_model', 'PrestudentModel'); - - $result = error("No valid parameters"); - if (isset($aufnahmegruppe) && isset($prestudentIdArray) && is_array($prestudentIdArray) && count($prestudentIdArray) >0) - { - $result = $this->PrestudentModel->updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe); - } - - if (isSuccess($result)) - { - $href = str_replace("/system/Users/linkToAufnahmegruppe", "/system/Users", $_SERVER["REQUEST_URI"]); - echo '{"msg": "Data correctly saved"}'; - } - else - { - echo '{"msg": "Error occurred while saving data, please contact the administrator"}'; - } - } - - private function _getUsers($studiengang, $studiensemester, $gruppe, $reihungstest, $stufe) - { - // Load model prestudentm_model - $this->load->model('crm/Prestudent_model', 'PrestudentModel'); - - $this->PrestudentModel->addSelect( - 'DISTINCT ON(p.person_id, prestudent_id) p.person_id, - prestudent_id, - p.nachname, - p.vorname, - p.geschlecht, - p.gebdatum, - k.kontakt AS email, - sg.kurzbzlang, - sg.bezeichnung, - sg.orgform_kurzbz, - sgt.bezeichnung AS typ, - s.bezeichnung AS studienplan, - ps.rt_stufe, - aufnahmegruppe_kurzbz, - rtp.punkte' - ); - - $this->PrestudentModel->addJoin('public.tbl_rt_person rtp', 'person_id'); - $this->PrestudentModel->addJoin('public.tbl_person p', 'person_id', 'LEFT'); - $this->PrestudentModel->addJoin( - '( - SELECT person_id, - kontakt - FROM public.tbl_kontakt - WHERE zustellung = TRUE - AND kontakttyp = \'email\' - ORDER BY kontakt_id DESC - ) k', - 'person_id', - 'LEFT' - ); - $this->PrestudentModel->addJoin('public.tbl_prestudentstatus ps', 'prestudent_id'); - $this->PrestudentModel->addJoin('lehre.tbl_studienplan s', 's.studienplan_id = ps.studienplan_id'); - $this->PrestudentModel->addJoin('lehre.tbl_studienordnung so', 'studienordnung_id'); - $this->PrestudentModel->addJoin('public.tbl_studiengang sg', 'sg.studiengang_kz = so.studiengang_kz'); - $this->PrestudentModel->addJoin('public.tbl_studiengangstyp sgt', 'typ'); - - $this->PrestudentModel->addOrder('p.person_id', 'ASC'); - $this->PrestudentModel->addOrder('prestudent_id', 'ASC'); - - $parametersArray = array('p.aktiv' => true, 'ps.status_kurzbz' => 'Interessent'); - - if ($studiengang != null && $studiengang != '-1') - { - $parametersArray['sg.studiengang_kz'] = $studiengang; - } - - if ($studiensemester != null && $studiensemester != '-1') - { - $parametersArray['ps.studiensemester_kurzbz'] = $studiensemester; - } - - if ($gruppe != null && $gruppe != '-1') - { - $parametersArray['aufnahmegruppe_kurzbz'] = $gruppe; - } - - if ($reihungstest != null && $reihungstest != '-1') - { - $parametersArray['rtp.rt_id'] = $reihungstest; - } - - if ($stufe != null && $stufe != '-1') - { - $parametersArray['ps.rt_stufe'] = $stufe; - } - - return $this->PrestudentModel->loadWhere($parametersArray); - } -} \ No newline at end of file diff --git a/application/controllers/system/aufnahme/PrestudentMultiAssign.php b/application/controllers/system/aufnahme/PrestudentMultiAssign.php new file mode 100644 index 000000000..b171f432e --- /dev/null +++ b/application/controllers/system/aufnahme/PrestudentMultiAssign.php @@ -0,0 +1,157 @@ +load->helper('message'); + + // Loads the widget library + $this->load->library('WidgetLib'); + } + + public function index() + { + $studiengang = $this->input->post('studiengang'); + $studiensemester = $this->input->post('studiensemester'); + $aufnahmegruppe = $this->input->post('aufnahmegruppe'); + $reihungstest = $this->input->post('reihungstest'); + $stufe = $this->input->post('stufe'); + + $returnUsers = null; + if ($studiengang != null || $studiensemester != null || $aufnahmegruppe!= null + || $reihungstest != null || $stufe != null) + { + $returnUsers = $this->_getPrestudents($studiengang, $studiensemester, $aufnahmegruppe, $reihungstest, $stufe); + } + + $users = null; + if (hasData($returnUsers)) + { + $users = $returnUsers->retval; + } + + if ($returnUsers == null || isSuccess($returnUsers)) + { + $viewData = array( + 'studiengang' => $studiengang, + 'studiensemester' => $studiensemester, + 'aufnahmegruppe' => $aufnahmegruppe, + 'reihungstest' => $reihungstest, + 'stufe' => $stufe, + 'users' => $users + ); + + $this->load->view('system/aufnahme/prestudentMultiAssign', $viewData); + } + else if (isError($returnUsers)) + { + show_error($returnUsers->retval); + } + } + + /** + * To assign a stufe to one or more prestudents + */ + public function linkToStufe() + { + $prestudentIdArray = $this->input->post('prestudent_id'); + $stufe = $this->input->post('stufe'); + + // Load model PrestudentstatusModel + $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + + $result = error("No valid parameters"); + if (isset($stufe) && isset($prestudentIdArray) && is_array($prestudentIdArray) && count($prestudentIdArray) >0) + { + $result = $this->PrestudentstatusModel->updateStufe($prestudentIdArray, $stufe); + } + + $this->output->set_header('Content-Type: application/json; charset=utf-8'); + + if (isSuccess($result)) + { + echo '{"msg": "Data correctly saved"}'; + } + else + { + echo '{"msg": "Error occurred while saving data, please contact the administrator"}'; + } + } + + /** + * To assign one or more prestudents to a gruppe + */ + public function linkToAufnahmegruppe() + { + $prestudentIdArray = $this->input->post('prestudent_id'); + $aufnahmegruppe = $this->input->post('aufnahmegruppe'); + + // Load model PrestudentstatusModel + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + + $result = error("No valid parameters"); + if (isset($aufnahmegruppe) && isset($prestudentIdArray) && is_array($prestudentIdArray) && count($prestudentIdArray) >0) + { + $result = $this->PrestudentModel->updateAufnahmegruppe($prestudentIdArray, $aufnahmegruppe); + } + + $this->output->set_header('Content-Type: application/json; charset=utf-8'); + + if (isSuccess($result)) + { + echo '{"msg": "Data correctly saved"}'; + } + else + { + echo '{"msg": "Error occurred while saving data, please contact the administrator"}'; + } + } + + /** + * Get the prestudents using search parameters + */ + private function _getPrestudents($studiengang, $studiensemester, $aufnahmegruppe, $reihungstest, $stufe) + { + // Load model prestudentm_model + $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + + if ($studiengang == '' || empty($studiengang)) + { + $studiengang = null; + } + + if ($studiensemester == '' || empty($studiensemester)) + { + $studiensemester = null; + } + + if ($aufnahmegruppe == '' || empty($aufnahmegruppe)) + { + $aufnahmegruppe = null; + } + + if ($reihungstest == '' || empty($reihungstest)) + { + $reihungstest = null; + } + + if ($stufe == '' || empty($stufe)) + { + $stufe = null; + } + + return $this->PrestudentModel->getPrestudentMultiAssign( + $studiengang, + $studiensemester, + $aufnahmegruppe, + $reihungstest, + $stufe + ); + } +} \ No newline at end of file diff --git a/application/libraries/WidgetLib.php b/application/libraries/WidgetLib.php index e8e8d302a..61128d7ed 100644 --- a/application/libraries/WidgetLib.php +++ b/application/libraries/WidgetLib.php @@ -181,7 +181,8 @@ class WidgetLib * @param array $data * @return Widget */ - public function widget($name, $data = array()) { + public function widget($name, $data = array(), $htmlArgs = array()) + { $class = str_replace('.php', '', trim($name, '/')); // determine path and widget class name @@ -208,7 +209,7 @@ class WidgetLib show_error("Widget '" . $class . "' was not found."); } - return new $class($class, $data); + return new $class($class, $data, $htmlArgs); } /** @@ -333,6 +334,7 @@ class WidgetLib class Partial { + const HTML_DEFAULT_VALUE = ''; // Default value of the html element protected $_ci, $_content, $_name, $_cache_ttl = 0, $_cached = false, $_identifier, $_trigger; protected $_args = array(); @@ -341,10 +343,17 @@ class Partial * Construct with optional parameters * @param array $args */ - public function __construct($name, $args = array()) { + public function __construct($name, $args = array(), $htmlArgs = array()) + { $this->_ci = &get_instance(); $this->_args = $args; $this->_name = $name; + + // Initialising properties + $this->_setHtmlProperties($htmlArgs); + + // Loads helper message to manage returning messages + $this->load->helper('message'); } /** @@ -598,6 +607,35 @@ class Partial $this->_trigger = FALSE; } } + + /** + * Initialising properties + */ + private function _setHtmlProperties($htmlArgs) + { + if (isset($htmlArgs) && is_array($htmlArgs)) + { + $this->_args['html'] = array(); + + if (!isset($htmlArgs['id']) || (isset($htmlArgs['id']) && $htmlArgs['id'] == '')) + { + $this->_args['html']['id'] = ''; + } + else + { + $this->_args['html']['id'] = $htmlArgs['id']; + } + + if (!isset($htmlArgs['name']) || (isset($htmlArgs['name']) && $htmlArgs['name'] == '')) + { + $this->_args['html']['name'] = ''; + } + else + { + $this->_args['html']['name'] = $htmlArgs['name']; + } + } + } } class Widget extends Partial diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index a638f04fa..eeeaf5c69 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -74,4 +74,87 @@ class Prestudent_model extends DB_Model ) ); } + + /** + * Returns a list of prestudent with additional information: + * - person_id + * - name, surname, gender and birthday + * - email + * - studiengang and orgform + * - studienplan + * - stufe and aufnahmegruppe + * - reihungstest score + */ + public function getPrestudentMultiAssign($studiengang = null, $studiensemester = null, $gruppe = null, $reihungstest = null, $stufe = null) + { + $this->addSelect( + 'DISTINCT ON(p.person_id, prestudent_id) p.person_id, + prestudent_id, + p.nachname, + p.vorname, + p.geschlecht, + p.gebdatum, + k.kontakt AS email, + sg.kurzbzlang, + sg.bezeichnung, + sg.orgform_kurzbz, + sgt.bezeichnung AS typ, + s.bezeichnung AS studienplan, + ps.rt_stufe, + aufnahmegruppe_kurzbz, + rtp.punkte' + ); + + $this->addJoin('public.tbl_rt_person rtp', 'person_id'); + $this->addJoin('public.tbl_person p', 'person_id', 'LEFT'); + $this->addJoin( + '( + SELECT person_id, + kontakt + FROM public.tbl_kontakt + WHERE zustellung = TRUE + AND kontakttyp = \'email\' + ORDER BY kontakt_id DESC + ) k', + 'person_id', + 'LEFT' + ); + $this->addJoin('public.tbl_prestudentstatus ps', 'prestudent_id'); + $this->addJoin('lehre.tbl_studienplan s', 's.studienplan_id = ps.studienplan_id'); + $this->addJoin('lehre.tbl_studienordnung so', 'studienordnung_id'); + $this->addJoin('public.tbl_studiengang sg', 'sg.studiengang_kz = so.studiengang_kz'); + $this->addJoin('public.tbl_studiengangstyp sgt', 'typ'); + + $this->addOrder('p.person_id', 'ASC'); + $this->addOrder('prestudent_id', 'ASC'); + + $parametersArray = array('p.aktiv' => true, 'ps.status_kurzbz' => 'Interessent'); + + if ($studiengang != null) + { + $parametersArray['sg.studiengang_kz'] = $studiengang; + } + + if ($studiensemester != null) + { + $parametersArray['ps.studiensemester_kurzbz'] = $studiensemester; + } + + if ($gruppe != null) + { + $parametersArray['aufnahmegruppe_kurzbz'] = $gruppe; + } + + if ($reihungstest != null) + { + $parametersArray['rtp.rt_id'] = $reihungstest; + } + + if ($stufe != null) + { + $parametersArray['ps.rt_stufe'] = $stufe; + } + + return $this->loadWhere($parametersArray); + } } \ No newline at end of file diff --git a/application/views/system/aufnahme/prestudentMultiAssign.php b/application/views/system/aufnahme/prestudentMultiAssign.php new file mode 100644 index 000000000..769e6f834 --- /dev/null +++ b/application/views/system/aufnahme/prestudentMultiAssign.php @@ -0,0 +1,333 @@ +load->view("templates/header", array("title" => "Users manager", "jquery" => true, "tablesort" => true, "jquery_checkboxes" => true, "jquery_custom" => true)); ?> + + +
+ + + + + + + + +
+ widgetlib->widget( + 'Studiengang_widget', + array('studiengang' => $studiengang), + array('name' => 'studiengang', 'id' => 'studiengangFilter') + ); + ?> + + widgetlib->widget( + 'Studiensemester_widget', + array('studiensemester' => $studiensemester), + array('name' => 'studiensemester', 'id' => 'studiensemesterFilter') + ); + ?> + + widgetlib->widget( + 'Reihungstest_widget', + array('reihungstest' => $reihungstest, 'studiengang' => $studiengang, 'studiensemester' => $studiensemester), + array('name' => 'reihungstest', 'id' => 'reihungstestFilter') + ); + ?> + + widgetlib->widget( + 'Aufnahmegruppe_widget', + array('aufnahmegruppe' => $aufnahmegruppe), + array('name' => 'aufnahmegruppe', 'id' => 'aufnahmegruppeFilter') + ); + ?> + + widgetlib->widget( + 'Stufe_widget', + array('stufe' => $stufe), + array('name' => 'stufe', 'id' => 'stufeFilter') + ); + ?> +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + +
+ Assign to: +
+ widgetlib->widget( + 'Stufe_widget', + array('stufe' => $stufe), + array('name' => 'stufe', 'id' => 'stufeAssign') + ); + ?> +   + +
+ widgetlib->widget( + 'Aufnahmegruppe_widget', + array('aufnahmegruppe' => $aufnahmegruppe), + array('name' => 'aufnahmegruppe', 'id' => 'aufnahmegruppeAssign') + ); + ?> +   + +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + "; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + } + ?> + +
 Prestudent IDPerson IDVornameNachnameGeschlechtStudiengangOrgFormStudienplanGeburtsdatumEmailStufeGruppePunkte
"; + echo ''; + echo ""; + echo $user->prestudent_id; + echo ""; + echo $user->person_id; + echo ""; + echo $user->vorname; + echo ""; + echo $user->nachname; + echo ""; + echo $user->geschlecht; + echo ""; + echo $user->kurzbzlang; + echo ""; + echo $user->orgform_kurzbz; + echo ""; + echo $user->studienplan; + echo ""; + echo $user->gebdatum; + echo ""; + echo $user->email; + echo ""; + echo $user->rt_stufe; + echo ""; + echo $user->aufnahmegruppe_kurzbz; + echo ""; + echo $user->punkte; + echo "
+ +
+
+ + + + + + +load->view("templates/footer"); ?> \ No newline at end of file diff --git a/application/views/system/users.php b/application/views/system/users.php deleted file mode 100644 index 564c2c95d..000000000 --- a/application/views/system/users.php +++ /dev/null @@ -1,305 +0,0 @@ -load->view("templates/header", array("title" => "Users manager", "jquery" => true, "tablesort" => true, "jquery_checkboxes" => true, "jquery_custom" => true)); ?> - - -
-
- widgetlib->widget( - 'Usersfilters_widget', - array( - 'studiengang' => $studiengang, - 'studiensemester' => $studiensemester, - 'gruppe' => $gruppe, - 'reihungstest' => $reihungstest, - 'stufe' => $stufe - ) - ); - ?> -
-
- -
- -
- - - - - - - - - - - - - - - - - -
- Assign to: -
- -   - -
- -   - -
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - "; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - } - ?> - -
 Prestudent IDPerson IDVornameNachnameGeschlechtStudiengangOrgFormStudienplanGeburtsdatumEmailStufeGruppePunkte
"; - echo ''; - echo ""; - echo $user->prestudent_id; - echo ""; - echo $user->person_id; - echo ""; - echo $user->vorname; - echo ""; - echo $user->nachname; - echo ""; - echo $user->geschlecht; - echo ""; - echo $user->kurzbzlang; - echo ""; - echo $user->orgform_kurzbz; - echo ""; - echo $user->studienplan; - echo ""; - echo $user->gebdatum; - echo ""; - echo $user->email; - echo ""; - echo $user->rt_stufe; - echo ""; - echo $user->aufnahmegruppe_kurzbz; - echo ""; - echo $user->punkte; - echo "
- -
-
- - - - - -load->view("templates/footer"); ?> \ No newline at end of file diff --git a/application/views/widgets/aufnahmegruppe.php b/application/views/widgets/aufnahmegruppe.php new file mode 100644 index 000000000..ade8c6ce2 --- /dev/null +++ b/application/views/widgets/aufnahmegruppe.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/application/views/widgets/reihungstest.php b/application/views/widgets/reihungstest.php new file mode 100644 index 000000000..e6bb66570 --- /dev/null +++ b/application/views/widgets/reihungstest.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/application/views/widgets/studiengang.php b/application/views/widgets/studiengang.php new file mode 100644 index 000000000..d9286e19a --- /dev/null +++ b/application/views/widgets/studiengang.php @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/application/views/widgets/studiensemester.php b/application/views/widgets/studiensemester.php new file mode 100644 index 000000000..2e5945b62 --- /dev/null +++ b/application/views/widgets/studiensemester.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/application/views/widgets/stufe.php b/application/views/widgets/stufe.php new file mode 100644 index 000000000..cf77770e5 --- /dev/null +++ b/application/views/widgets/stufe.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/application/views/widgets/usersfilters.php b/application/views/widgets/usersfilters.php deleted file mode 100644 index aa4bea151..000000000 --- a/application/views/widgets/usersfilters.php +++ /dev/null @@ -1,107 +0,0 @@ - 0) - { -?> -
- - retval; ?>
- -
- - - - - - - - - - - -
- - - - - -
- - - -
\ No newline at end of file diff --git a/application/widgets/Aufnahmegruppe_widget.php b/application/widgets/Aufnahmegruppe_widget.php new file mode 100644 index 000000000..a0bc21d45 --- /dev/null +++ b/application/widgets/Aufnahmegruppe_widget.php @@ -0,0 +1,36 @@ +load->model('organisation/Gruppe_model', 'GruppeModel'); + $this->GruppeModel->addOrder('beschreibung'); + $gruppen = $this->GruppeModel->loadWhere(array('aktiv' => true, 'aufnahmegruppe' => true)); + if (hasData($gruppen)) + { + // Adding an empty element at the beginning + $emptyElement = new stdClass(); + $emptyElement->gruppe_kurzbz = Partial::HTML_DEFAULT_VALUE; + $emptyElement->beschreibung = 'Select a group...'; + array_unshift($gruppen->retval, $emptyElement); + } + else + { + show_error($gruppen); + } + + // Data to be used in the widget view + $widgetData['aufnahmegruppen'] = $gruppen->retval; + + // Loads widget view + $this->view('widgets/aufnahmegruppe', $widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Reihungstest_widget.php b/application/widgets/Reihungstest_widget.php new file mode 100644 index 000000000..bd49b8863 --- /dev/null +++ b/application/widgets/Reihungstest_widget.php @@ -0,0 +1,56 @@ +load->model('crm/Reihungstest_model', 'ReihungstestModel'); + $this->ReihungstestModel->addSelect('reihungstest_id, concat(datum, \' \', uhrzeit, \' \', anmerkung) AS beschreibung'); + $this->ReihungstestModel->addOrder('datum', 'DESC'); + + $parametersArray = array(); + if ($widgetData['studiengang'] != null) + { + $parametersArray['studiengang_kz'] = $widgetData['studiengang']; + } + if ($widgetData['studiensemester'] != null) + { + $parametersArray['studiensemester_kurzbz'] = $widgetData['studiensemester']; + } + + $reihungstest = $this->ReihungstestModel->loadWhere($parametersArray); + if (isError($reihungstest)) + { + show_error($reihungstest); + } + } + + if (!isError($reihungstest)) + { + // Adding an empty element at the beginning + $emptyElement = new stdClass(); + $emptyElement->reihungstest_id = Partial::HTML_DEFAULT_VALUE; + $emptyElement->beschreibung = 'Select a reihungstest...'; + array_unshift($reihungstest->retval, $emptyElement); + } + + // Data to be used in the widget view + $widgetData['reihungstests'] = $reihungstest->retval; + + // Loads widget view + $this->view('widgets/reihungstest', $widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Studiengang_widget.php b/application/widgets/Studiengang_widget.php new file mode 100644 index 000000000..43fcacb45 --- /dev/null +++ b/application/widgets/Studiengang_widget.php @@ -0,0 +1,37 @@ +load->model('organisation/Studiengang_model', 'StudiengangModel'); + $this->StudiengangModel->addOrder('kurzbzlang'); + $studiengaenge = $this->StudiengangModel->loadWhere(array('aktiv' => true)); + if (hasData($studiengaenge)) + { + // Adding an empty element at the beginning + $emptyElement = new stdClass(); + $emptyElement->studiengang_kz = Partial::HTML_DEFAULT_VALUE; + $emptyElement->kurzbzlang = 'Select a studiengang...'; + $emptyElement->bezeichnung = ''; + array_unshift($studiengaenge->retval, $emptyElement); + } + else + { + show_error($studiengaenge); + } + + // Data to be used in the widget view + $widgetData['studiengaenge'] = $studiengaenge->retval; + + // Loads widget view + $this->view('widgets/studiengang', $widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Studiensemester_widget.php b/application/widgets/Studiensemester_widget.php new file mode 100644 index 000000000..2b6c13228 --- /dev/null +++ b/application/widgets/Studiensemester_widget.php @@ -0,0 +1,37 @@ +load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); + $this->StudiengangModel->addSelect('studiensemester_kurzbz, studiensemester_kurzbz AS beschreibung'); + $this->StudiengangModel->addOrder('studiensemester_kurzbz', 'DESC'); + $studiensemester = $this->StudiensemesterModel->load(); + if (hasData($studiensemester)) + { + // Adding an empty element at the beginning + $emptyElement = new stdClass(); + $emptyElement->studiensemester_kurzbz = Partial::HTML_DEFAULT_VALUE; + $emptyElement->beschreibung = 'Select a studiensemester...'; + array_unshift($studiensemester->retval, $emptyElement); + } + else + { + show_error($studiensemester); + } + + // Data to be used in the widget view + $widgetData['studiensemesters'] = $studiensemester->retval; + + // Loads widget view + $this->view('widgets/studiensemester', $widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Stufe_widget.php b/application/widgets/Stufe_widget.php new file mode 100644 index 000000000..a3a556d32 --- /dev/null +++ b/application/widgets/Stufe_widget.php @@ -0,0 +1,37 @@ +load->model('crm/Reihungstest_model', 'ReihungstestModel'); + $this->ReihungstestModel->addSelect('DISTINCT ON(stufe) stufe, stufe AS beschreibung'); + $this->ReihungstestModel->addOrder('stufe'); + $stufen = $this->ReihungstestModel->loadWhere('stufe IS NOT NULL'); + if (hasData($stufen)) + { + // Adding an empty element at the beginning + $emptyElement = new stdClass(); + $emptyElement->stufe = Partial::HTML_DEFAULT_VALUE; + $emptyElement->beschreibung = 'Select a stufe...'; + array_unshift($stufen->retval, $emptyElement); + } + else + { + show_error($stufen); + } + + // Data to be used in the widget view + $widgetData['stufen'] = $stufen->retval; + + // Loads widget view + $this->view('widgets/stufe', $widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Usersfilters_widget.php b/application/widgets/Usersfilters_widget.php deleted file mode 100644 index fe8018473..000000000 --- a/application/widgets/Usersfilters_widget.php +++ /dev/null @@ -1,183 +0,0 @@ -load->helper('message'); - - // Initialising properties - $this->_setProperties($args); - } - - public function display($widgetData) - { - $errors = array(); // Array containing possible errors - - // Studiengaenge - $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); - $this->StudiengangModel->addOrder('kurzbzlang'); - $studiengaenge = $this->StudiengangModel->loadWhere(array('aktiv' => true)); - if (hasData($studiengaenge)) - { - // Adding an empty element at the beginning - $emptyElement = new stdClass(); - $emptyElement->studiengang_kz = '-1'; - $emptyElement->kurzbzlang = 'Select a studiengang...'; - $emptyElement->bezeichnung = ''; - array_unshift($studiengaenge->retval, $emptyElement); - } - else - { - $errors[] = $studiengaenge; // Adding the error to the array of errors - } - - // Studiensemester - $this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); - $this->StudiengangModel->addSelect('studiensemester_kurzbz, studiensemester_kurzbz AS beschreibung'); - $this->StudiengangModel->addOrder('studiensemester_kurzbz', 'DESC'); - $studiensemester = $this->StudiensemesterModel->load(); - if (hasData($studiensemester)) - { - // Adding an empty element at the beginning - $emptyElement = new stdClass(); - $emptyElement->studiensemester_kurzbz = '-1'; - $emptyElement->beschreibung = 'Select a studiensemester...'; - array_unshift($studiensemester->retval, $emptyElement); - } - else - { - $errors[] = $studiensemester; // Adding the error to the array of errors - } - - // Gruppen - $this->load->model('organisation/Gruppe_model', 'GruppeModel'); - $this->GruppeModel->addOrder('beschreibung'); - $gruppen = $this->GruppeModel->loadWhere(array('aktiv' => true, 'aufnahmegruppe' => true)); - if (hasData($gruppen)) - { - // Adding an empty element at the beginning - $emptyElement = new stdClass(); - $emptyElement->gruppe_kurzbz = '-1'; - $emptyElement->beschreibung = 'Select a group...'; - array_unshift($gruppen->retval, $emptyElement); - } - else - { - $errors[] = $gruppen; // Adding the error to the array of errors - } - - // Stufe - $this->load->model('crm/Reihungstest_model', 'ReihungstestModel'); - $this->ReihungstestModel->addSelect('DISTINCT ON(stufe) stufe, stufe AS beschreibung'); - $this->ReihungstestModel->addOrder('stufe'); - $stufen = $this->ReihungstestModel->loadWhere('stufe IS NOT NULL'); - if (hasData($stufen)) - { - // Adding an empty element at the beginning - $emptyElement = new stdClass(); - $emptyElement->stufe = '-1'; - $emptyElement->beschreibung = 'Select a stufe...'; - array_unshift($stufen->retval, $emptyElement); - } - else - { - $errors[] = $stufen; // Adding the error to the array of errors - } - - // Reihungstest - $reihungstest = success(array()); // default value empty array - // If the parameters studiengang or studiensemester are given and are not empty - if (($this->studiengang != null && !empty($this->studiengang)) - || ($this->studiensemester != null && !empty($this->studiensemester))) - { - $this->ReihungstestModel->resetQuery(); // cleans any previous setting - $this->ReihungstestModel->addSelect('reihungstest_id, concat(datum, \' \', uhrzeit, \' \', anmerkung) AS beschreibung'); - $this->ReihungstestModel->addOrder('datum', 'DESC'); - - $parametersArray = array(); - if ($this->studiengang != null) - { - $parametersArray['studiengang_kz'] = $this->studiengang; - } - if ($this->studiensemester != null) - { - $parametersArray['studiensemester_kurzbz'] = $this->studiensemester; - } - - $reihungstest = $this->ReihungstestModel->loadWhere($parametersArray); - if (isError($reihungstest)) - { - $errors[] = $reihungstest; // Adding the error to the array of errors - } - } - - if (!isError($reihungstest)) - { - // Adding an empty element at the beginning - $emptyElement = new stdClass(); - $emptyElement->reihungstest_id = '-1'; - $emptyElement->beschreibung = 'Select a reihungstest...'; - array_unshift($reihungstest->retval, $emptyElement); - } - - // Data to be used in the widget view - $viewData = array( - 'studiengaenge' => $studiengaenge->retval, - 'studiensemester' => $studiensemester->retval, - 'gruppen' => $gruppen->retval, - 'stufen' => $stufen->retval, - 'reihungstest' => $reihungstest->retval, - 'errors' => $errors, - 'selectedStudiengang' => $this->studiengang, - 'selectedStudiensemester' => $this->studiensemester, - 'selectedGruppe' => $this->gruppe, - 'selectedReihungstest' => $this->reihungstest, - 'selectedStufe' => $this->stufe - ); - - // Loads widget view - $this->view('widgets/usersfilters', $viewData); - } - - /** - * Initialising properties - */ - private function _setProperties($args) - { - if (isset($args) && is_array($args)) - { - if (isset($args['studiengang']) && $args['studiengang'] != '-1') - { - $this->studiengang = $args['studiengang']; - } - if (isset($args['studiensemester']) && $args['studiensemester'] != '-1') - { - $this->studiensemester = $args['studiensemester']; - } - if (isset($args['gruppe']) && $args['gruppe'] != '-1') - { - $this->gruppe = $args['gruppe']; - } - if (isset($args['reihungstest']) && $args['reihungstest'] != '-1') - { - $this->reihungstest = $args['reihungstest']; - } - if (isset($args['stufe']) && $args['stufe'] != '-1') - { - $this->stufe = $args['stufe']; - } - } - } -} \ No newline at end of file