mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-22 17:32:18 +00:00
Merge branch 'master' into feature-5491/UDFWidget_add_new_features
This commit is contained in:
@@ -378,7 +378,8 @@ class AuthLib
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
$hta = $this->_createAuthObjByPerson(array('uid' => $_SERVER['PHP_AUTH_USER']));
|
||||
// NOTE: Username needs to be trimmed and lowered because htaccess is allowing login
|
||||
$hta = $this->_createAuthObjByPerson(array('uid' => mb_strtolower(trim($_SERVER['PHP_AUTH_USER']))));
|
||||
}
|
||||
|
||||
// Invalid credentials
|
||||
@@ -390,7 +391,7 @@ class AuthLib
|
||||
}
|
||||
elseif (isError($hta)) // display error and stop execution
|
||||
{
|
||||
$this->_showError(getData($hta));
|
||||
$this->_showError(getError($hta));
|
||||
}
|
||||
|
||||
return $hta; // if success then is returned!
|
||||
@@ -550,7 +551,7 @@ class AuthLib
|
||||
}
|
||||
elseif (isError($auth)) // blocking error
|
||||
{
|
||||
$this->_showError(getData($auth)); // display a generic error message and logs the occurred error
|
||||
$this->_showError(getError($auth)); // display a generic error message and logs the occurred error
|
||||
}
|
||||
}
|
||||
// else the user is already logged, then loads authentication helper and continue with the execution
|
||||
@@ -574,10 +575,11 @@ class AuthLib
|
||||
|
||||
// Needed information
|
||||
$this->_ci->PersonModel->addSelect('person_id, vorname, nachname, uid');
|
||||
// Retrieves the uid if it is possible
|
||||
$this->_ci->PersonModel->addJoin('public.tbl_benutzer', 'person_id', 'LEFT');
|
||||
|
||||
$queryParamsArray['tbl_person.aktiv'] = true; // only active users!
|
||||
// Retrieves the uid if it is possible for active users
|
||||
$this->_ci->PersonModel->addJoin(
|
||||
'(SELECT uid, person_id FROM public.tbl_benutzer WHERE aktiv = TRUE) tb', 'person_id',
|
||||
'LEFT'
|
||||
);
|
||||
|
||||
// Execute query with where clause
|
||||
$personResult = $this->_ci->PersonModel->loadWhere($queryParamsArray);
|
||||
|
||||
@@ -249,7 +249,7 @@ class DmsLib
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($dmscontent->retval);
|
||||
return error(getError($dmscontent));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -259,7 +259,7 @@ class DmsLib
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($akte->retval);
|
||||
return error(getError($akte));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class DocumentLib
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($ret->retval);
|
||||
return error(getError($ret));
|
||||
}
|
||||
case 'application/pdf':
|
||||
return success($filename);
|
||||
|
||||
@@ -7,8 +7,10 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
*/
|
||||
class FilterWidgetLib
|
||||
{
|
||||
// Session parameters names
|
||||
const SESSION_NAME = 'FHC_FILTER_WIDGET'; // Filter session name
|
||||
// FilterWidget session name
|
||||
const SESSION_NAME = 'FHC_FILTER_WIDGET';
|
||||
|
||||
// Session elements
|
||||
const SESSION_FILTER_NAME = 'filterName';
|
||||
const SESSION_FIELDS = 'fields';
|
||||
const SESSION_SELECTED_FIELDS = 'selectedFields';
|
||||
@@ -17,13 +19,19 @@ class FilterWidgetLib
|
||||
const SESSION_CHECKBOXES = 'checkboxes';
|
||||
const SESSION_FILTERS = 'filters';
|
||||
const SESSION_METADATA = 'datasetMetadata';
|
||||
const SESSION_DATASET = 'dataset';
|
||||
const SESSION_ROW_NUMBER = 'rowNumber';
|
||||
const SESSION_RELOAD_DATASET = 'reloadDataset';
|
||||
const SESSION_TIMEOUT = 'sessionTimeout';
|
||||
|
||||
// Session dataset elements
|
||||
const SESSION_DATASET = 'dataset';
|
||||
const SESSION_DATASET_RELOAD = 'reloadDataset';
|
||||
const SESSION_DATASET_REPRESENTATION = 'datasetRepresentation';
|
||||
const SESSION_DATASET_REP_OPTIONS = 'datasetRepresentationOptions';
|
||||
const SESSION_DATASET_REP_FIELDS_DEFS = 'datasetRepresentationFieldsDefinitions';
|
||||
|
||||
// Default session timeout
|
||||
const SESSION_DEFAULT_TIMEOUT = 30;
|
||||
|
||||
// Alias for the dynamic table used to retrieve the dataset
|
||||
const DATASET_TABLE_ALIAS = 'datasetFilterTable';
|
||||
|
||||
@@ -33,16 +41,16 @@ class FilterWidgetLib
|
||||
|
||||
// ...to identify a single filter widget in the DB
|
||||
const FILTER_ID = 'filter_id';
|
||||
const APP_PARAMETER = 'app';
|
||||
const DATASET_NAME_PARAMETER = 'datasetName';
|
||||
const FILTER_KURZBZ_PARAMETER = 'filterKurzbz';
|
||||
const DATASET_RELOAD_PARAMETER = 'reloadDataset';
|
||||
const APP = 'app';
|
||||
const DATASET_NAME = 'datasetName';
|
||||
const FILTER_KURZBZ = 'filterKurzbz';
|
||||
const DATASET_RELOAD = 'reloadDataset';
|
||||
|
||||
// ...to specify permissions that are needed to use this FilterWidget
|
||||
const REQUIRED_PERMISSIONS_PARAMETER = 'requiredPermissions';
|
||||
const REQUIRED_PERMISSIONS = 'requiredPermissions';
|
||||
|
||||
// ...stament to retrieve the dataset
|
||||
const QUERY_PARAMETER = 'query';
|
||||
const QUERY = 'query';
|
||||
|
||||
// ...to specify more columns or aliases for them
|
||||
const ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
@@ -131,7 +139,7 @@ class FilterWidgetLib
|
||||
|
||||
// Gets the required permissions from the session if they are not provided as parameter
|
||||
$rq = $requiredPermissions;
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS_PARAMETER);
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS);
|
||||
|
||||
return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_FILTER_METHOD, self::PERMISSION_TYPE);
|
||||
}
|
||||
@@ -179,6 +187,29 @@ class FilterWidgetLib
|
||||
setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function dropExpiredFilterWidgets()
|
||||
{
|
||||
// Loads the session for all the filter widgets
|
||||
$filterWidgetsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($filterWidgetsSession != null)
|
||||
{
|
||||
// Loops in the session for all the filter widgets
|
||||
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
|
||||
{
|
||||
// If this filter widget is not the currrent used filter widget and the it is expired...
|
||||
if ($this->_filterUniqueId != $filterWidget && $filterWidgetData[self::SESSION_TIMEOUT] <= time())
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the definition data from DB for a filter widget
|
||||
*/
|
||||
@@ -471,7 +502,7 @@ class FilterWidgetLib
|
||||
|
||||
// Write changes into the session
|
||||
$this->setSessionElement(self::SESSION_FILTERS, $filters);
|
||||
$this->setSessionElement(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
$this->setSessionElement(self::SESSION_DATASET_RELOAD, true); // the dataset must be reloaded
|
||||
|
||||
$removeAppliedFilter = true;
|
||||
}
|
||||
@@ -523,7 +554,7 @@ class FilterWidgetLib
|
||||
|
||||
// Write changes into the session
|
||||
$this->setSessionElement(self::SESSION_FILTERS, $filters);
|
||||
$this->setSessionElement(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
$this->setSessionElement(self::SESSION_DATASET_RELOAD, true); // the dataset must be reloaded
|
||||
|
||||
$applyFilters = true;
|
||||
}
|
||||
@@ -537,7 +568,7 @@ class FilterWidgetLib
|
||||
*/
|
||||
public function reloadDataset()
|
||||
{
|
||||
$this->setSessionElement(self::SESSION_RELOAD_DATASET, true);
|
||||
$this->setSessionElement(self::SESSION_DATASET_RELOAD, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -603,8 +634,8 @@ class FilterWidgetLib
|
||||
|
||||
// Loads the definition to check if is already present in the DB
|
||||
$definition = $this->_ci->FiltersModel->loadWhere(array(
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId
|
||||
));
|
||||
@@ -632,8 +663,8 @@ class FilterWidgetLib
|
||||
// update it
|
||||
$this->_ci->FiltersModel->update(
|
||||
array(
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId
|
||||
),
|
||||
@@ -648,8 +679,8 @@ class FilterWidgetLib
|
||||
{
|
||||
$this->_ci->FiltersModel->insert(
|
||||
array(
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME),
|
||||
'filter_kurzbz' => uniqid($authPersonId, true),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId,
|
||||
@@ -693,7 +724,7 @@ class FilterWidgetLib
|
||||
public function generateFilterMenu($navigationPage)
|
||||
{
|
||||
// Loads the NavigationLib for the current page (given as parameter)
|
||||
$this->_ci->load->library('NavigationLib', array(FilterWidgetLib::NAVIGATION_PAGE => $navigationPage));
|
||||
$this->_ci->load->library('NavigationLib', array(self::NAVIGATION_PAGE => $navigationPage));
|
||||
|
||||
$filterMenu = null;
|
||||
$currentMenu = $this->_ci->navigationlib->getSessionMenu(); // The navigation menu currently stored in session
|
||||
@@ -706,7 +737,7 @@ class FilterWidgetLib
|
||||
|
||||
// Loads all the filters related to this page (same dataset_name and same app name)
|
||||
$filters = $this->_ci->FiltersModel->getFiltersByAppDatasetName(
|
||||
$session[self::APP_PARAMETER], $session[self::DATASET_NAME_PARAMETER]
|
||||
$session[self::APP], $session[self::DATASET_NAME]
|
||||
);
|
||||
|
||||
// If filters were loaded
|
||||
@@ -775,7 +806,7 @@ class FilterWidgetLib
|
||||
);
|
||||
|
||||
// Sets in the session only the element related to the filters menu
|
||||
$this->_ci->navigationlib->setSessionElementMenu(FilterWidgetLib::NAV_MENU_FILTER_KEY, $filterMenu);
|
||||
$this->_ci->navigationlib->setSessionElementMenu(self::NAV_MENU_FILTER_KEY, $filterMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class PersonLogLib
|
||||
return $decoded_logs;
|
||||
}
|
||||
else
|
||||
show_error($result->retval);
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,7 +107,7 @@ class PhrasesLib
|
||||
// If no <p> tags required
|
||||
if ($blockTags == 'no')
|
||||
{
|
||||
$tmpText = $textileParser->textileThis($result->retval[$i]->text); // Parse
|
||||
$tmpText = $textileParser->parse($result->retval[$i]->text); // Parse
|
||||
|
||||
// Removes tags <p> and </p> from the beginning and from the end of the string if they are present
|
||||
// NOTE: Those tags are usually, but not always, added by the textile parser
|
||||
@@ -127,7 +127,7 @@ class PhrasesLib
|
||||
}
|
||||
else
|
||||
{
|
||||
$result->retval[$i]->text = $textileParser->textileThis($result->retval[$i]->text);
|
||||
$result->retval[$i]->text = $textileParser->parse($result->retval[$i]->text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,33 +9,41 @@ class TableWidgetLib
|
||||
{
|
||||
const TABLE_UNIQUE_ID = 'tableUniqueId'; // TableWidget unique id
|
||||
|
||||
// Session parameters names
|
||||
const SESSION_NAME = 'FHC_TABLE_WIDGET'; // Table session name
|
||||
// TableWidget session name
|
||||
const SESSION_NAME = 'FHC_TABLE_WIDGET';
|
||||
|
||||
// Session elements
|
||||
const SESSION_FIELDS = 'fields';
|
||||
const SESSION_COLUMNS_ALIASES = 'columnsAliases';
|
||||
const SESSION_ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
const SESSION_CHECKBOXES = 'checkboxes';
|
||||
const SESSION_METADATA = 'datasetMetadata';
|
||||
const SESSION_DATASET = 'dataset';
|
||||
const SESSION_ROW_NUMBER = 'rowNumber';
|
||||
const SESSION_RELOAD_DATASET = 'reloadDataset';
|
||||
const SESSION_TIMEOUT = 'sessionTimeout';
|
||||
|
||||
// Session dataset elements
|
||||
const SESSION_DATASET = 'dataset';
|
||||
const SESSION_DATASET_RELOAD = 'reloadDataset';
|
||||
const SESSION_DATASET_REPRESENTATION = 'datasetRepresentation';
|
||||
const SESSION_DATASET_REP_OPTIONS = 'datasetRepresentationOptions';
|
||||
const SESSION_DATASET_REP_FIELDS_DEFS = 'datasetRepresentationFieldsDefinitions';
|
||||
|
||||
// Default session timeout
|
||||
const SESSION_DEFAULT_TIMEOUT = 30;
|
||||
|
||||
// Alias for the dynamic table used to retrieve the dataset
|
||||
const DATASET_TABLE_ALIAS = 'datasetTableWidget';
|
||||
|
||||
// Parameters names...
|
||||
|
||||
// ...to reload the dataset
|
||||
const DATASET_RELOAD_PARAMETER = 'reloadDataset';
|
||||
const DATASET_RELOAD = 'reloadDataset';
|
||||
|
||||
// ...to specify permissions that are needed to use this TableWidget
|
||||
const REQUIRED_PERMISSIONS_PARAMETER = 'requiredPermissions';
|
||||
const REQUIRED_PERMISSIONS = 'requiredPermissions';
|
||||
|
||||
// ...stament to retrieve the dataset
|
||||
const QUERY_PARAMETER = 'query';
|
||||
const QUERY = 'query';
|
||||
|
||||
// ...to specify more columns or aliases for them
|
||||
const ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
@@ -50,6 +58,7 @@ class TableWidgetLib
|
||||
const DATASET_REPRESENTATION = 'datasetRepresentation';
|
||||
const DATASET_REP_OPTIONS = 'datasetRepOptions';
|
||||
const DATASET_REP_FIELDS_DEFS = 'datasetRepFieldsDefs';
|
||||
const DATASET_TIMEOUT = 'datasetTimeout'; // ...and its expiring time
|
||||
|
||||
// Different dataset representations
|
||||
const DATASET_REP_TABLESORTER = 'tablesorter';
|
||||
@@ -86,13 +95,13 @@ class TableWidgetLib
|
||||
|
||||
// Gets the required permissions from the session if they are not provided as parameter
|
||||
$rq = $requiredPermissions;
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS_PARAMETER);
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS);
|
||||
|
||||
return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_TABLE_METHOD, self::PERMISSION_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrieve the whole session for this filter
|
||||
* Wrapper method to the session helper funtions to retrieve the whole session for this table widget
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
@@ -100,7 +109,7 @@ class TableWidgetLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrieve one element from the session of this filter
|
||||
* Wrapper method to the session helper funtions to retrieve one element from the session of this table widget
|
||||
*/
|
||||
public function getSessionElement($name)
|
||||
{
|
||||
@@ -115,7 +124,7 @@ class TableWidgetLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set the whole session for this filter
|
||||
* Wrapper method to the session helper funtions to set the whole session for this table widget
|
||||
*/
|
||||
public function setSession($data)
|
||||
{
|
||||
@@ -123,7 +132,7 @@ class TableWidgetLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set one element in the session for this filter
|
||||
* Wrapper method to the session helper funtions to set one element in the session for this table widget
|
||||
*/
|
||||
public function setSessionElement($name, $value)
|
||||
{
|
||||
@@ -135,7 +144,30 @@ class TableWidgetLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the query to retrieve the dataset for a filter
|
||||
*
|
||||
*/
|
||||
public function dropExpiredTableWidgets()
|
||||
{
|
||||
// Loads the session for all the table widgets
|
||||
$tableWidgetsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($tableWidgetsSession != null)
|
||||
{
|
||||
// Loops in the session for all the table widgets
|
||||
foreach ($tableWidgetsSession as $tableWidget => $tableWidgetData)
|
||||
{
|
||||
// If this table widget is not the currrent used table widget and the it is expired...
|
||||
if ($this->_tableUniqueId != $tableWidget && $tableWidgetData[self::SESSION_TIMEOUT] <= time())
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $tableWidget); // ...remove it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the query to retrieve the dataset for a table widget
|
||||
*/
|
||||
public function generateDatasetQuery($query)
|
||||
{
|
||||
@@ -177,7 +209,7 @@ class TableWidgetLib
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an unique string that identify this filter widget
|
||||
* Return an unique string that identify this table widget
|
||||
* NOTE: The default value is the URI where the FilterWidget is called
|
||||
* If the fhc_controller_id is present then is also used
|
||||
*/
|
||||
|
||||
@@ -705,7 +705,7 @@ class UDFLib
|
||||
{
|
||||
if (is_object($udfResults) && isset($udfResults->retval))
|
||||
{
|
||||
show_error($udfResults->retval);
|
||||
show_error(getError($udfResults));
|
||||
}
|
||||
elseif (is_string($udfResults))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user