From 9a33e44491b1b3cab2c6d473de11dbfac9171647 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 19 Jun 2018 16:34:23 +0200 Subject: [PATCH] - Replaced "index.ci.php" with $this->config->item('index_page') - Replaced base_url that contains "index.ci.php" with site_url - Replaced APP_ROOT with base_url or site_url where needed - InfoCenter controller added comments and improved the code --- application/config/message.php | 6 +- application/config/navigation.php | 16 +- .../controllers/jobs/Prestudentstatus.php | 2 +- .../system/infocenter/InfoCenter.php | 154 ++++++++++-------- application/views/crm/statusgrundEdit.php | 4 +- application/views/crm/statusgrundNew.php | 2 +- .../views/organisation/studienjahrEdit.php | 4 +- .../views/organisation/studienjahrNew.php | 2 +- .../organisation/studiensemesterEdit.php | 2 +- .../views/organisation/studiensemesterNew.php | 4 +- application/views/system/messageList.php | 4 +- application/views/system/udf.php | 2 +- application/views/templates/FHC-Header.php | 9 +- 13 files changed, 112 insertions(+), 99 deletions(-) diff --git a/application/config/message.php b/application/config/message.php index 8e7249feb..1dc1c67ea 100644 --- a/application/config/message.php +++ b/application/config/message.php @@ -7,8 +7,8 @@ $config['send_immediately'] = false; $config['msg_delivery'] = true; // Default true $config['system_person_id'] = 1; // Dummy sender, used for sending messages from the system -$config['redirect_view_message_url'] = 'index.ci.php/Redirect/redirectByToken/'; // -$config['message_html_view_url'] = 'index.ci.php/ViewMessage/toHTML/'; +$config['redirect_view_message_url'] = site_url('Redirect/redirectByToken/'); // +$config['message_html_view_url'] = site_url('ViewMessage/toHTML/'); $config['message_server'] = 'http://www.fhcomplete.org/'; $config['assistent_function'] = 'ass'; @@ -65,4 +65,4 @@ define('MSG_ERR_INVALID_RECIPIENTS', 105); define('MSG_ERR_INVALID_RECEIVER_ID', 106); define('MSG_ERR_INVALID_OU', 107); define('MSG_ERR_INVALID_TEMPLATE', 108); -define('MSG_ERR_INVALID_TOKEN', 109); \ No newline at end of file +define('MSG_ERR_INVALID_TOKEN', 109); diff --git a/application/config/navigation.php b/application/config/navigation.php index 86dc3bdde..0ce27d318 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -3,7 +3,7 @@ $config['navigation_header'] = array( '*' => array( 'FH-Complete' => site_url(''), - 'Vilesci' => base_url('/vilesci'), + 'Vilesci' => base_url('vilesci'), 'CIS' => CIS_ROOT ) ); @@ -29,7 +29,7 @@ $config['navigation_menu']['Vilesci/index'] = array( 'expand' => true ), 'Infocenter' => array( - 'link' => site_url('/system/infocenter/InfoCenter'), + 'link' => site_url('system/infocenter/InfoCenter'), 'icon' => 'info', 'description' => 'Infocenter', 'expand' => true @@ -43,13 +43,13 @@ $config['navigation_menu']['Vilesci/index'] = array( 'expand' => false, 'children'=> array( 'Vilesci' => array( - 'link' => base_url('vilesci/'), + 'link' => base_url('vilesci'), 'icon' => '', 'description' => 'Vilesci', 'expand' => true ), 'Extensions' => array( - 'link' => site_url('/system/extensions/Manager'), + 'link' => site_url('system/extensions/Manager'), 'icon' => 'cubes', 'description' => 'Extensions Manager', 'expand' => true @@ -60,16 +60,16 @@ $config['navigation_menu']['Vilesci/index'] = array( $config['navigation_menu']['system/infocenter/InfoCenter/index'] = array( - 'Freigegeben' => array( - 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/freigegeben'), + 'freigegeben' => array( + 'link' => site_url('system/infocenter/InfoCenter/freigegeben'), 'description' => 'Freigegeben', 'icon' => 'thumbs-up' ) ); $config['navigation_menu']['system/infocenter/InfoCenter/freigegeben'] = array( - 'Zurück' => array( - 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/index'), + 'back' => array( + 'link' => site_url('system/infocenter/InfoCenter/index'), 'description' => 'Home', 'icon' => 'angle-left' ) diff --git a/application/controllers/jobs/Prestudentstatus.php b/application/controllers/jobs/Prestudentstatus.php index 7d9bb60b7..1cd659e79 100644 --- a/application/controllers/jobs/Prestudentstatus.php +++ b/application/controllers/jobs/Prestudentstatus.php @@ -39,7 +39,7 @@ class Prestudentstatus extends FHC_Controller public function index() { $result = "The following are the available command line interface commands\n\n"; - $result .= "php index.ci.php jobs/Prestudentstatus CorrectStudienplan"; + $result .= "php ".$this->config->item('index_page')." jobs/Prestudentstatus CorrectStudienplan"; echo $result.PHP_EOL; } diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index c2994f10f..4360494ea 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -12,12 +12,18 @@ class InfoCenter extends FHC_Controller const APP = 'infocenter'; const TAETIGKEIT = 'bewerbung'; - const URL_PREFIX = '/system/infocenter/InfoCenter'; // URL prefix for this controller + const INFOCENTER_URI = 'system/infocenter/InfoCenter'; // URL prefix for this controller + const INDEX_PAGE = 'index'; + const FREIGEGEBEN_PAGE = 'freigegeben'; + const SHOW_DETAILS_PAGE = 'showDetails'; + + const NAVIGATION_PAGE = 'navigation_page'; + const ORIGIN_PAGE = 'origin_page'; private $_uid; // contains the UID of the logged user // Used to log with PersonLogLib - private $logparams = array( + private $_logparams = array( 'saveformalgep' => array( 'logtype' => 'Action', 'name' => 'Document formally checked', @@ -100,29 +106,33 @@ class InfoCenter extends FHC_Controller // Public methods /** - * Default + * Main page of the InfoCenter tool */ public function index() { - $this->setNavigationMenuIndex(); // define the navigation menu for this page + $this->_setNavigationMenuIndex(); // define the navigation menu for this page $this->load->view('system/infocenter/infocenter.php'); } + /** + * Freigegeben page of the InfoCenter tool + */ public function freigegeben() { - $this->setNavigationMenuFreigegeben(); // define the navigation menu for this page + $this->_setNavigationMenuFreigegeben(); // define the navigation menu for this page $this->load->view('system/infocenter/infocenterFreigegeben.php'); } /** + * Personal details page of the InfoCenter tool * Initialization function, gets person and prestudent data and loads the view with the data * @param $person_id */ public function showDetails() { - $this->setNavigationMenuShowDetails(); + $this->_setNavigationMenuShowDetails(); $person_id = $this->input->get('person_id'); @@ -137,8 +147,8 @@ class InfoCenter extends FHC_Controller if (empty($personexists->retval)) show_error('person does not exist!'); - $origin_page = $this->input->get('origin_page'); - if ($origin_page == 'index') + $origin_page = $this->input->get(self::ORIGIN_PAGE); + if ($origin_page == self::INDEX_PAGE) { // mark person as locked for editing $result = $this->PersonLockModel->lockPerson($person_id, $this->_uid, self::APP); @@ -155,8 +165,8 @@ class InfoCenter extends FHC_Controller $prestudentdata ); - $data['fhc_controller_id'] = $this->getControllerId(); - $data['origin_page'] = $origin_page; + $data[self::FHC_CONTROLLER_ID] = $this->getControllerId(); + $data[self::ORIGIN_PAGE] = $origin_page; $this->load->view('system/infocenter/infocenterDetails.php', $data); } @@ -172,7 +182,7 @@ class InfoCenter extends FHC_Controller if (isError($result)) show_error($result->retval); - redirect(self::URL_PREFIX.'?fhc_controller_id='.$this->getControllerId()); + redirect('/'.self::INFOCENTER_URI.'?'.self::FHC_CONTROLLER_ID.'='.$this->getControllerId()); } /** @@ -211,9 +221,7 @@ class InfoCenter extends FHC_Controller } } - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($json)); + $this->output->set_content_type('application/json')->set_output(json_encode($json)); } /** @@ -224,9 +232,7 @@ class InfoCenter extends FHC_Controller { $prestudent = $this->PrestudentModel->getLastPrestudent($person_id, true); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($prestudent)); + $this->output->set_content_type('application/json')->set_output(json_encode($prestudent)); } /** @@ -305,9 +311,7 @@ class InfoCenter extends FHC_Controller $this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id)); } } - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $this->output->set_content_type('application/json')->set_output(json_encode($result)); } /** @@ -460,9 +464,7 @@ class InfoCenter extends FHC_Controller $this->_log($person_id, 'savenotiz', array($titel)); } - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $this->output->set_content_type('application/json')->set_output(json_encode($result)); } /** @@ -493,9 +495,7 @@ class InfoCenter extends FHC_Controller $this->_log($person_id, 'updatenotiz', array($titel)); } - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $this->output->set_content_type('application/json')->set_output(json_encode($result)); } /** @@ -562,9 +562,7 @@ class InfoCenter extends FHC_Controller { $result = $this->personloglib->getParkedDate($person_id); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $this->output->set_content_type('application/json')->set_output(json_encode($result)); } /** @@ -577,9 +575,7 @@ class InfoCenter extends FHC_Controller $result = $this->personloglib->park($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->_uid); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $this->output->set_content_type('application/json')->set_output(json_encode($result)); } /** @@ -591,9 +587,7 @@ class InfoCenter extends FHC_Controller $result = $this->personloglib->unPark($person_id); - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($result)); + $this->output->set_content_type('application/json')->set_output(json_encode($result)); } /** @@ -612,9 +606,26 @@ class InfoCenter extends FHC_Controller $json = $result->retval[0]->ende; } - $this->output - ->set_content_type('application/json') - ->set_output(json_encode($json)); + $this->output->set_content_type('application/json')->set_output(json_encode($json)); + } + + /** + * Wrapper for setNavigationMenu, returns JSON message + */ + public function setNavigationMenuArrayJson() + { + $navigation_page = $this->input->get(self::NAVIGATION_PAGE); + + if (strpos($navigation_page, self::INDEX_PAGE) !== false) + { + $this->_setNavigationMenuIndex(); + } + else + { + $this->_setNavigationMenuFreigegeben(); + } + + $this->outputJsonSuccess('success'); } // ----------------------------------------------------------------------------------------------------------------- @@ -633,9 +644,9 @@ class InfoCenter extends FHC_Controller /** * Define the navigation menu for the index page */ - public function setNavigationMenuIndex() + private function _setNavigationMenuIndex() { - $this->load->library('NavigationLib', array('navigation_page' => 'system/infocenter/InfoCenter/index')); + $this->load->library('NavigationLib', array(self::NAVIGATION_PAGE => self::INFOCENTER_URI.'/'.self::INDEX_PAGE)); $listFiltersSent = array(); $listFiltersNotSent = array(); @@ -724,16 +735,16 @@ class InfoCenter extends FHC_Controller /** * Define the navigation menu for the showDetails page */ - public function setNavigationMenuShowDetails() + private function _setNavigationMenuShowDetails() { - $this->load->library('NavigationLib', array('navigation_page' => 'system/infocenter/InfoCenter/showDetails')); + $this->load->library('NavigationLib', array(self::NAVIGATION_PAGE => self::INFOCENTER_URI.'/'.self::SHOW_DETAILS_PAGE)); - $origin_page = $this->input->get('origin_page'); + $origin_page = $this->input->get(self::ORIGIN_PAGE); - $link = base_url('index.ci.php/system/infocenter/InfoCenter/index'); - if ($origin_page == 'freigegeben') + $link = site_url(self::INFOCENTER_URI.'/'.self::INDEX_PAGE); + if ($origin_page == self::FREIGEGEBEN_PAGE) { - $link = base_url('index.ci.php/system/infocenter/InfoCenter/freigegeben'); + $link = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE); } $this->navigationlib->setSessionMenu( @@ -752,9 +763,9 @@ class InfoCenter extends FHC_Controller /** * Define the navigation menu for the freigegeben page */ - public function setNavigationMenuFreigegeben() + private function _setNavigationMenuFreigegeben() { - $this->load->library('NavigationLib', array('navigation_page' => 'system/infocenter/InfoCenter/freigegeben')); + $this->load->library('NavigationLib', array(self::NAVIGATION_PAGE => self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE)); $listFilters = array(); $listCustomFilters = array(); @@ -782,6 +793,7 @@ class InfoCenter extends FHC_Controller } $filtersArray = array(); + $filtersArray['children'] = array(); $this->_fillFiltersFreigegeben($listFilters, $filtersArray); @@ -812,24 +824,8 @@ class InfoCenter extends FHC_Controller } /** - * Wrapper for setNavigationMenu, returns JSON message + * Utility method used to fill elements of the InfoCenter left menu of the main InfoCenter page */ - public function setNavigationMenuArrayJson() - { - $navigation_page = $this->input->get('navigation_page'); - - if (strpos($navigation_page, 'index') !== false) - { - $this->setNavigationMenuIndex(); - } - else - { - $this->setNavigationMenuFreigegeben(); - } - - $this->outputJsonSuccess('success'); - } - private function _fillFilters($filters, &$tofill) { $toPrint = "%s?%s=%s&%s=%s"; @@ -839,7 +835,7 @@ class InfoCenter extends FHC_Controller $tofill['children'][] = array( 'link' => sprintf( $toPrint, - site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId, + site_url(self::INFOCENTER_URI), 'filter_id', $filterId, FHC_Controller::FHC_CONTROLLER_ID, $this->getControllerId() ), @@ -848,6 +844,9 @@ class InfoCenter extends FHC_Controller } } + /** + * Utility method used to fill elements of the InfoCenter left menu of the freigegeben InfoCenter page + */ private function _fillFiltersFreigegeben($filters, &$tofill) { $toPrint = "%s?%s=%s&%s=%s"; @@ -857,7 +856,7 @@ class InfoCenter extends FHC_Controller $tofill['children'][] = array( 'link' => sprintf( $toPrint, - site_url('system/infocenter/InfoCenter/freigegeben'), 'filter_id', $filterId, + site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE), 'filter_id', $filterId, FHC_Controller::FHC_CONTROLLER_ID, $this->getControllerId() ), @@ -866,6 +865,10 @@ class InfoCenter extends FHC_Controller } } + /** + * Utility method used to fill elements of the InfoCenter left menu + * with the list of the custom filter of the authenticated user + */ private function _fillCustomFilters($filters, &$tofill) { $toPrint = "%s?%s=%s&%s=%s"; @@ -875,7 +878,7 @@ class InfoCenter extends FHC_Controller $tofill['children'][] = array( 'link' => sprintf( $toPrint, - site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId, + site_url(self::INFOCENTER_URI), 'filter_id', $filterId, FHC_Controller::FHC_CONTROLLER_ID, $this->getControllerId() ), @@ -1069,7 +1072,18 @@ class InfoCenter extends FHC_Controller $this->PrestudentModel->addSelect('person_id'); $person_id = $this->PrestudentModel->load($prestudent_id)->retval[0]->person_id; - redirect(self::URL_PREFIX.'/showDetails?person_id='.$person_id.'&fhc_controller_id='.$this->getControllerId().'#'.$section); + redirect( + sprintf( + '/%s/%s?%s=%s&%s=%s#%s', + self::INFOCENTER_URI, + self::SHOW_DETAILS_PAGE, + 'person_id', + $person_id, + self::FHC_CONTROLLER_ID, + $this->getControllerId(), + $section + ) + ); } /** @@ -1101,7 +1115,7 @@ class InfoCenter extends FHC_Controller */ private function _log($person_id, $logname, $messageparams) { - $logdata = $this->logparams[$logname]; + $logdata = $this->_logparams[$logname]; $datatolog = array( 'name' => $logdata['name'] diff --git a/application/views/crm/statusgrundEdit.php b/application/views/crm/statusgrundEdit.php index d37eafe8f..ddbd1ff0a 100644 --- a/application/views/crm/statusgrundEdit.php +++ b/application/views/crm/statusgrundEdit.php @@ -7,7 +7,7 @@

Statusgrund: status_kurzbz; ?>

-
"> + ">
@@ -104,4 +104,4 @@ } ?> - \ No newline at end of file + diff --git a/application/views/crm/statusgrundNew.php b/application/views/crm/statusgrundNew.php index 9d9a2e9a1..bd2ebe7d7 100644 --- a/application/views/crm/statusgrundNew.php +++ b/application/views/crm/statusgrundNew.php @@ -5,7 +5,7 @@

Neuer Statusgrund

- "> + ">
diff --git a/application/views/organisation/studienjahrEdit.php b/application/views/organisation/studienjahrEdit.php index b8e3817d0..4a23217b1 100644 --- a/application/views/organisation/studienjahrEdit.php +++ b/application/views/organisation/studienjahrEdit.php @@ -7,7 +7,7 @@ $this->load->view('templates/header', array('title' => 'StudienjahrEdit', 'jquer

Studienjahr bearbeiten: studienjahr_kurzbz; ?>

- "> + "> @@ -17,4 +17,4 @@ $this->load->view('templates/header', array('title' => 'StudienjahrEdit', 'jquer - \ No newline at end of file + diff --git a/application/views/organisation/studienjahrNew.php b/application/views/organisation/studienjahrNew.php index 31fe78630..95b5bd897 100644 --- a/application/views/organisation/studienjahrNew.php +++ b/application/views/organisation/studienjahrNew.php @@ -8,7 +8,7 @@ $this->load->view('templates/header', array('title' => 'StudienjahrNew', 'jquery

Neues Studienjahr anlegen

" + action="" id="newStudienjahrForm">
diff --git a/application/views/organisation/studiensemesterEdit.php b/application/views/organisation/studiensemesterEdit.php index 5bb574c23..9f0abc0cb 100644 --- a/application/views/organisation/studiensemesterEdit.php +++ b/application/views/organisation/studiensemesterEdit.php @@ -8,7 +8,7 @@ $this->load->view('templates/header', array('title' => 'StudiensemesterEdit', 'd

Studiensemester bearbeiten: studiensemester_kurzbz; ?>

"> + action="">
diff --git a/application/views/organisation/studiensemesterNew.php b/application/views/organisation/studiensemesterNew.php index 76da57afb..525769bc6 100644 --- a/application/views/organisation/studiensemesterNew.php +++ b/application/views/organisation/studiensemesterNew.php @@ -7,9 +7,7 @@ $this->load->view('templates/header', array('title' => 'StudiensemesterNew', 'jq

Neues Studiensemester anlegen

- " - id="newSemesterForm"> + " id="newSemesterForm">
diff --git a/application/views/system/messageList.php b/application/views/system/messageList.php index 7a28478d8..11f83bc9c 100644 --- a/application/views/system/messageList.php +++ b/application/views/system/messageList.php @@ -84,7 +84,7 @@ $widthColumn = $msgExists === true ? 8 : 12; $.ajax( { dataType: "json", - url: "" + msgid + "/" + recid, + url: "" + msgid + "/" + recid, success: function (data, textStatus, jqXHR) { $("#msgsubject").text(data[0].subject); @@ -97,4 +97,4 @@ $widthColumn = $msgExists === true ? 8 : 12; } ) } - \ No newline at end of file + diff --git a/application/views/system/udf.php b/application/views/system/udf.php index 426c09f24..b2facc38c 100644 --- a/application/views/system/udf.php +++ b/application/views/system/udf.php @@ -47,7 +47,7 @@ } } ?> - +
diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index 81cbc9dcd..78b5692cc 100755 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -2,8 +2,9 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); -// Retrives the URL path of the called controller + called controller method +// Retrives the name of the index page, the URL path of the called controller and the called controller // NOTE: placed here because it doesn't work inside functions +$indexPage = $this->config->item('index_page'); $calledPath = $this->router->directory.$this->router->class; $calledMethod = $this->router->method; @@ -67,14 +68,14 @@ function _generateCSSsInclude($CSSs) /** * Generates global JS-Object to pass parms to other javascripts */ -function _generateJSDataStorageObject($calledPath, $calledMethod) +function _generateJSDataStorageObject($indexPage, $calledPath, $calledMethod) { $toPrint = "\n"; $toPrint .= '