diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 6e08c1b57..85b9641fb 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -11,9 +11,10 @@ class InfoCenter extends VileSci_Controller // App and Verarbeitungstaetigkeit name for logging const APP = 'infocenter'; const TAETIGKEIT = 'bewerbung'; + const FILTER_ID = 'filter_id'; // URL prefix for this controller - const URL_PREFIX = '/system/infocenter/InfoCenter/'; + const URL_PREFIX = '/system/infocenter/InfoCenter'; // Used to log with PersonLogLib private $logparams = array( @@ -165,7 +166,7 @@ class InfoCenter extends VileSci_Controller ) ); - redirect(self::URL_PREFIX.'showDetails/'.$person_id.'#DokPruef'); + redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'#DokPruef'); } /** @@ -337,7 +338,7 @@ class InfoCenter extends VileSci_Controller $this->_log($person_id, 'savenotiz', array($titel)); - redirect(self::URL_PREFIX.'showDetails/'.$person_id.'#NotizAkt'); + redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'#NotizAkt'); } /** @@ -368,6 +369,21 @@ class InfoCenter extends VileSci_Controller ->_display(); } + /** + * + */ + public function deleteCustomFilter() + { + $filter_id = $this->input->get('filter_id'); + + if (is_numeric($filter_id)) + { + $this->FiltersModel->deleteCustomFilter($filter_id); + + redirect(self::URL_PREFIX); + } + } + // ----------------------------------------------------------------------------------------------------------------- // Private methods @@ -446,7 +462,7 @@ class InfoCenter extends VileSci_Controller 'children' => array() ); - $this->_fillFilters($listCustomFilters, $filtersarray['personal']); + $this->_fillCustomFilters($listCustomFilters, $filtersarray['personal']); } $this->navigationMenuArray = array( @@ -471,12 +487,26 @@ class InfoCenter extends VileSci_Controller { $toPrint = "%s=%s"; $tofill['children'][] = array( - 'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filterId'), $filterId), + 'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId), 'description' => $description ); } } + private function _fillCustomFilters($filters, &$tofill) + { + foreach ($filters as $filterId => $description) + { + $toPrint = "%s=%s"; + $tofill['children'][] = array( + 'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId), + 'description' => $description, + 'subscriptLink' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter/deleteCustomFilter?filter_id'), $filterId), + 'subscriptDescription' => 'Remove' + ); + } + } + /** * Loads all necessary Person data: Stammdaten (name, svnr, contact, ...), Dokumente, Logs and Notizen * @param $person_id @@ -627,7 +657,7 @@ class InfoCenter extends VileSci_Controller $this->PrestudentModel->addSelect('person_id'); $person_id = $this->PrestudentModel->load($prestudent_id)->retval[0]->person_id; - redirect(self::URL_PREFIX.'showDetails/'.$person_id.'#'.$section); + redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'#'.$section); } /** diff --git a/application/helpers/fhc_helper.php b/application/helpers/fhc_helper.php index a7b5b2a29..7fb6d9f91 100644 --- a/application/helpers/fhc_helper.php +++ b/application/helpers/fhc_helper.php @@ -9,7 +9,7 @@ * @license GPLv3 * @since Version 1.0.0 */ - + /** * FHC Helper * @@ -33,7 +33,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); function generateToken($length = 64) { // For PHP 7 you can use random_bytes() - if(function_exists('random_bytes')) + if(function_exists('random_bytes')) { $token = base64_encode(random_bytes($length)); //base64 is about 33% longer, so we need to truncate the result @@ -41,7 +41,7 @@ function generateToken($length = 64) } // for PHP >=5.3 and <7 - if(function_exists('openssl_random_pseudo_bytes')) + if(function_exists('openssl_random_pseudo_bytes')) { $token = base64_encode(openssl_random_pseudo_bytes($length, $strong)); // is the token strong enough? @@ -51,7 +51,7 @@ function generateToken($length = 64) //fallback to mt_rand if php < 5.3 or no openssl available $characters = '0123456789'; - $characters .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/+'; + $characters .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/+'; $charactersLength = strlen($characters)-1; $token = ''; //select some random characters @@ -96,7 +96,7 @@ function loadResource($path, $resources = null, $subdir = false) { $path .= '/'; } - + // Loads in $tmpResources all the given resources $tmpResources = $resources; if ($resources == null) @@ -107,7 +107,7 @@ function loadResource($path, $resources = null, $subdir = false) { $tmpResources = array($resources); } - + // Loads in $tmpPaths path and eventually the subdirectories $tmpPaths = array($path); // NOTE: Used @ to prevent ugly error messages @@ -133,7 +133,7 @@ function loadResource($path, $resources = null, $subdir = false) } closedir($dirHandler); } - + // Loops through the resources foreach($tmpResources as $tmpResource) { @@ -147,4 +147,4 @@ function loadResource($path, $resources = null, $subdir = false) } } } -} \ No newline at end of file +} diff --git a/application/models/system/Filters_model.php b/application/models/system/Filters_model.php index 7ce07de09..d84cddf80 100644 --- a/application/models/system/Filters_model.php +++ b/application/models/system/Filters_model.php @@ -29,7 +29,7 @@ class Filters_model extends DB_Model 'filter_kurzbz ILIKE' => $filter_kurzbz ); - return $this->FiltersModel->loadWhere($filterParametersArray); + return $this->loadWhere($filterParametersArray); } /** @@ -49,6 +49,14 @@ class Filters_model extends DB_Model 'uid' => $uid ); - return $this->FiltersModel->loadWhere($filterParametersArray); + return $this->loadWhere($filterParametersArray); + } + + /** + * + */ + public function deleteCustomFilter($filter_id) + { + return $this->delete($filter_id); } } diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 53e274866..28b2d018e 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -94,8 +94,8 @@ ) ORDER BY "LastAction" DESC ', - 'hideHeader' => true, - 'hideSave' => true, + 'hideHeader' => false, + 'hideSave' => false, 'checkboxes' => array('PersonId'), 'additionalColumns' => array('Details'), 'formatRaw' => function($fieldName, $fieldValue, $datasetRaw) { @@ -139,11 +139,11 @@ } ); - $filterId = isset($_GET['filterId']) ? $_GET['filterId'] : null; + $filterId = isset($_GET[InfoCenter::FILTER_ID]) ? $_GET[InfoCenter::FILTER_ID] : null; if (isset($filterId) && is_numeric($filterId)) { - $filterWidgetArray['filterId'] = $filterId; + $filterWidgetArray[InfoCenter::FILTER_ID] = $filterId; } else { diff --git a/application/views/widgets/navigationMenu.php b/application/views/widgets/navigationMenu.php index c67f90a55..46905204f 100644 --- a/application/views/widgets/navigationMenu.php +++ b/application/views/widgets/navigationMenu.php @@ -1,8 +1,8 @@