mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- Added session_start() to hlp_session_helper to start a PHP standard session (NOT CI session)
- Added functions cleanSession and cleanSessionElement to hlp_session_helper - Renamed setElementSession to setSessionElement in hlp_session_helper - Renamed getElementSession to getSessionElement in hlp_session_helper - Adapted the code that were using this helper - Autoload does NOT load anymore helper hlp_session_helper - Controller controllers/system/Filters now loads the AuthLib - Removed var_dump from controllers/jobs/ReihungstestJob
This commit is contained in:
@@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
||||
|
|
||||
| $autoload['libraries'] = array('user_agent' => 'ua');
|
||||
*/
|
||||
$autoload['libraries'] = array('Session');
|
||||
$autoload['libraries'] = array();
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
@@ -84,7 +84,7 @@ $autoload['drivers'] = array();
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
//$autoload['helper'] = array();
|
||||
$autoload['helper'] = array('url', 'language');
|
||||
$autoload['helper'] = array('url', 'language', 'hlp_session');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
|
||||
@@ -18,7 +18,7 @@ if (! defined('BASEPATH'))
|
||||
class ReihungstestJob extends FHC_Controller
|
||||
{
|
||||
private $VILESCI_RT_VERWALTUNGS_URL;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -37,9 +37,9 @@ class ReihungstestJob extends FHC_Controller
|
||||
echo "Jobs must be run from the CLI";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$this->VILESCI_RT_VERWALTUNGS_URL = site_url(). "/organisation/Reihungstest";
|
||||
|
||||
|
||||
// Load models
|
||||
$this->load->model('crm/Reihungstest_model', 'ReihungstestModel');
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
@@ -60,7 +60,7 @@ class ReihungstestJob extends FHC_Controller
|
||||
|
||||
echo $result. PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
public function runReihungstestJob()
|
||||
{
|
||||
// Get study plans that have no assigned placement tests yet
|
||||
@@ -75,10 +75,10 @@ class ReihungstestJob extends FHC_Controller
|
||||
{
|
||||
show_error($result->error);
|
||||
}
|
||||
|
||||
|
||||
// Get free places
|
||||
$result = $this->ReihungstestModel->getFreePlaces();
|
||||
|
||||
|
||||
$free_places_arr = array();
|
||||
if (hasData($result))
|
||||
{
|
||||
@@ -88,10 +88,10 @@ class ReihungstestJob extends FHC_Controller
|
||||
{
|
||||
show_error($result->error);
|
||||
}
|
||||
|
||||
|
||||
// Prepare data for mail template 'ReihungstestJob'
|
||||
$content_data_arr = $this->_getContentData($missing_rt_arr, $free_places_arr);
|
||||
|
||||
|
||||
// Send email in Sancho design
|
||||
if (!empty($missing_rt_arr) || !empty($free_places_arr))
|
||||
{
|
||||
@@ -102,12 +102,12 @@ class ReihungstestJob extends FHC_Controller
|
||||
'Support für die Reihungstest-Verwaltung');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function runZentraleReihungstestAnmeldefristAssistenzJob()
|
||||
{
|
||||
// Get placement tests where registration date was yesterday
|
||||
$result = $this->ReihungstestModel->checkReachedRegistrationDate(11000);
|
||||
|
||||
|
||||
$reachedRegistration_rt_arr = array();
|
||||
|
||||
if (hasData($result))
|
||||
@@ -162,7 +162,7 @@ class ReihungstestJob extends FHC_Controller
|
||||
{
|
||||
$mailReceipients .= $applicant->email. ';';
|
||||
$applicantCounter ++;
|
||||
$applicants_list .= '
|
||||
$applicants_list .= '
|
||||
<tr '.$rowstyle.'>
|
||||
<td>'. $applicant->orgform_kurzbz. '</td>
|
||||
<td>'. $applicant->ausbildungssemester. '</td>
|
||||
@@ -204,13 +204,13 @@ class ReihungstestJob extends FHC_Controller
|
||||
$mailcontent .= $applicants_list;
|
||||
$mailcontent .= '
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
';
|
||||
$mailcontent .= '<p style="font-family: verdana, sans-serif;"><a href="mailto:?bcc=' . $mailReceipients . '">Mail an alle schicken</a></p>';
|
||||
}
|
||||
$mailcontent_data_arr['table'] = $mailcontent;
|
||||
//$mailcontent_data_arr['link'] = $this->VILESCI_RT_VERWALTUNGS_URL;
|
||||
//var_dump($mailcontent_data_arr);
|
||||
|
||||
// Send email in Sancho design
|
||||
if (!isEmptyString($mailcontent))
|
||||
{
|
||||
@@ -296,7 +296,7 @@ class ReihungstestJob extends FHC_Controller
|
||||
|
||||
$studiengang = $applicant->studiengang_kz;
|
||||
$mailReceipients .= $applicant->email . ';';
|
||||
$applicants_list .= '
|
||||
$applicants_list .= '
|
||||
<tr ' . $rowstyle . '>
|
||||
<td>' . date_format(date_create($applicant->datum), 'd.m.Y') . '</td>
|
||||
<td>' . $applicant->uhrzeit . '</td>
|
||||
@@ -400,20 +400,20 @@ class ReihungstestJob extends FHC_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Private methods
|
||||
/**
|
||||
* Returns associative array with data as needed in the reihungstest job template.
|
||||
* @param array $missing_rt_arr Array with studienpläne, which have no assigned placement tests.
|
||||
* @param array $free_places_arr Array with info and amount of free placement test places.
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
private function _getContentData($missing_rt_arr, $free_places_arr)
|
||||
{
|
||||
$style_tbl1 = ' cellpadding="0" cellspacing="10" width="100%" style="font-family: courier, verdana, sans-serif; font-size: 0.95em; border: 1px solid #000000;" ';
|
||||
$style_tbl2 = ' cellpadding="0" cellspacing="20" width="100%" style="font-family: courier, verdana, sans-serif; font-size: 0.95em; border: 1px solid #000000;" ';
|
||||
|
||||
|
||||
// Prepare HTML table with study plans that have no placement tests yet
|
||||
if (!empty($missing_rt_arr))
|
||||
{
|
||||
@@ -421,27 +421,27 @@ class ReihungstestJob extends FHC_Controller
|
||||
= '
|
||||
<table'. $style_tbl2.'>
|
||||
';
|
||||
|
||||
|
||||
foreach ($missing_rt_arr as $rt)
|
||||
{
|
||||
$studienplan_list .= '
|
||||
$studienplan_list .= '
|
||||
<tr><td>'. $rt->bezeichnung. '</td></tr>
|
||||
';
|
||||
}
|
||||
|
||||
$studienplan_list .= '
|
||||
|
||||
$studienplan_list .= '
|
||||
</table>
|
||||
';
|
||||
}
|
||||
else
|
||||
{
|
||||
$studienplan_list = '
|
||||
<table'. $style_tbl1.'>
|
||||
<table'. $style_tbl1.'>
|
||||
<tr><td>Alles okay! Alle Studienpläne haben zumindest einen Reihungstest.</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
// Prepare HTML table with information and amount of free places
|
||||
if (!empty($free_places_arr))
|
||||
{
|
||||
@@ -453,21 +453,21 @@ class ReihungstestJob extends FHC_Controller
|
||||
<th>Freie Plätze</th>
|
||||
</tr>
|
||||
';
|
||||
|
||||
|
||||
foreach ($free_places_arr as $free_place)
|
||||
{
|
||||
$datum = new DateTime($free_place->datum);
|
||||
$style_alarm = ($free_place->freie_plaetze <= 5) ? ' style=" color: red; font-weight: bold" ' : ''; // mark if <=5 free places
|
||||
|
||||
|
||||
$freie_plaetze_list .= '
|
||||
<tr>
|
||||
<td width="350">'. $free_place->fakultaet. '</td>
|
||||
<td align="center">'. $datum->format('d.m.Y'). '</td>
|
||||
<td align="center"'. $style_alarm.'>'. $free_place->freie_plaetze. '</td>
|
||||
</tr>
|
||||
';
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
$freie_plaetze_list .= '
|
||||
</table>
|
||||
';
|
||||
@@ -475,12 +475,12 @@ class ReihungstestJob extends FHC_Controller
|
||||
else
|
||||
{
|
||||
$freie_plaetze_list = '
|
||||
<table'. $style_tbl1.'>
|
||||
<table'. $style_tbl1.'>
|
||||
<tr><td>Es gibt heute keine Ergebnisse zu freien Reihungstestplätze.</td></tr>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
// Set associative array with the prepared HTML tables and URL be used by the template's variables
|
||||
$content_data_arr['studienplan_list'] = $studienplan_list;
|
||||
$content_data_arr['freie_plaetze_list'] = $freie_plaetze_list;
|
||||
@@ -490,4 +490,3 @@ class ReihungstestJob extends FHC_Controller
|
||||
return $content_data_arr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads authentication library and starts authentication
|
||||
$this->load->library('AuthLib');
|
||||
|
||||
// Loads the FiltersLib with HTTP GET/POST parameters
|
||||
$this->_loadFiltersLib();
|
||||
|
||||
@@ -45,7 +48,7 @@ class Filters extends FHC_Controller
|
||||
public function rowNumber()
|
||||
{
|
||||
$rowNumber = 0;
|
||||
$dataset = $this->filterslib->getElementSession(FiltersLib::SESSION_DATASET);
|
||||
$dataset = $this->filterslib->getSessionElement(FiltersLib::SESSION_DATASET);
|
||||
|
||||
if (isset($dataset) && is_array($dataset))
|
||||
{
|
||||
|
||||
@@ -991,7 +991,7 @@ class InfoCenter extends Auth_Controller
|
||||
$homeLink .= '?'.self::FILTER_ID.'='.$prevFilterId;
|
||||
}
|
||||
|
||||
$this->navigationlib->setElementSessionMenu(
|
||||
$this->navigationlib->setSessionElementMenu(
|
||||
'uebersicht',
|
||||
$this->navigationlib->oneLevel(
|
||||
'Infocenter Übersicht', // description
|
||||
@@ -1009,7 +1009,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if($page == self::REIHUNGSTESTABSOLVIERT_PAGE)
|
||||
{
|
||||
$this->navigationlib->setElementSessionMenu(
|
||||
$this->navigationlib->setSessionElementMenu(
|
||||
'freigegeben',
|
||||
$this->navigationlib->oneLevel(
|
||||
'zum RT freigegeben', // description
|
||||
@@ -1027,7 +1027,7 @@ class InfoCenter extends Auth_Controller
|
||||
}
|
||||
if($page == self::FREIGEGEBEN_PAGE)
|
||||
{
|
||||
$this->navigationlib->setElementSessionMenu(
|
||||
$this->navigationlib->setSessionElementMenu(
|
||||
'reihungstestAbsolviert',
|
||||
$this->navigationlib->oneLevel(
|
||||
'Reihungstest absolviert', // description
|
||||
|
||||
@@ -263,4 +263,4 @@ function getWorkingDays($startDate, $endDate, $dynamic_holidays = array())
|
||||
}
|
||||
|
||||
return $workingDays;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-Helper
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016 fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @since Version 1.0.0
|
||||
*/
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// Collection of functions to handle comfortably the php session.
|
||||
// It works keeping a different session name for each functionality (ex. FilterWidget and NavigationWidget)
|
||||
// It also starts the PHP session
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
session_start(); // starts the session (old good PHP session!)
|
||||
|
||||
/**
|
||||
* Returns the whole session by its name given as parameter
|
||||
* If it's not present the a null value is returned
|
||||
@@ -25,7 +18,7 @@ function getSession($sessionName)
|
||||
{
|
||||
$session = null;
|
||||
|
||||
// If it is present a session for this filter
|
||||
// If it is present a session with the given name
|
||||
if (isset($_SESSION[$sessionName]))
|
||||
{
|
||||
$session = $_SESSION[$sessionName];
|
||||
@@ -35,16 +28,16 @@ function getSession($sessionName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one element specified by the paraemter name, from the session specified by the parameters sessionName
|
||||
* Returns one element specified by the paraemter $elementName, from the session specified by the parameters sessionName
|
||||
* If it's not present the a null value is returned
|
||||
*/
|
||||
function getElementSession($sessionName, $name)
|
||||
function getSessionElement($sessionName, $elementName)
|
||||
{
|
||||
$session = getSession($sessionName); // get the whole session for this filter
|
||||
$session = getSession($sessionName); // get the whole session with the given name
|
||||
|
||||
if (isset($session[$name]))
|
||||
if (isset($session[$elementName]))
|
||||
{
|
||||
return $session[$name];
|
||||
return $session[$elementName];
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -66,9 +59,9 @@ function setSession($sessionName, $data)
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets one element of the session specified by the parameters sessionName
|
||||
* Sets one element ($elementName) of the session specified by the parameters sessionName
|
||||
*/
|
||||
function setElementSession($sessionName, $name, $value)
|
||||
function setSessionElement($sessionName, $elementName, $value)
|
||||
{
|
||||
// If is NOT already present into the session
|
||||
if (!isset($_SESSION[$sessionName])
|
||||
@@ -77,5 +70,30 @@ function setElementSession($sessionName, $name, $value)
|
||||
$_SESSION[$sessionName] = array(); // then create it
|
||||
}
|
||||
|
||||
$_SESSION[$sessionName][$name] = $value; // stores the single value
|
||||
$_SESSION[$sessionName][$elementName] = $value; // stores the single value
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean the whole session specified by the parameters sessionName
|
||||
*/
|
||||
function cleanSession($sessionName)
|
||||
{
|
||||
// If it is present a session with the given name
|
||||
if (isset($_SESSION[$sessionName]))
|
||||
{
|
||||
unset($_SESSION[$sessionName]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean one element ($elementName) of the session specified by the parameters sessionName
|
||||
*/
|
||||
function cleanSessionElement($sessionName, $elementName)
|
||||
{
|
||||
$session = getSession($sessionName); // get the whole session with the given name
|
||||
|
||||
if (isset($session[$elementName]))
|
||||
{
|
||||
unset($session[$elementName]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class FiltersLib
|
||||
|
||||
// Gets the required permissions from the session if they are not provided as parameter
|
||||
$rq = $requiredPermissions;
|
||||
if ($rq == null) $rq = $this->getElementSession(self::REQUIRED_PERMISSIONS_PARAMETER);
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS_PARAMETER);
|
||||
|
||||
return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_FILTER_METHOD, self::PERMISSION_TYPE);
|
||||
}
|
||||
@@ -139,15 +139,15 @@ class FiltersLib
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
return getElementSession(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
return getSessionElement(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrive one element from the session of this filter
|
||||
*/
|
||||
public function getElementSession($name)
|
||||
public function getSessionElement($name)
|
||||
{
|
||||
$session = getElementSession(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
|
||||
if (isset($session[$name]))
|
||||
{
|
||||
@@ -162,19 +162,19 @@ class FiltersLib
|
||||
*/
|
||||
public function setSession($data)
|
||||
{
|
||||
setElementSession(self::SESSION_NAME, $this->_filterUniqueId, $data);
|
||||
setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set one element in the session for this filter
|
||||
*/
|
||||
public function setElementSession($name, $value)
|
||||
public function setSessionElement($name, $value)
|
||||
{
|
||||
$session = getElementSession(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId);
|
||||
|
||||
$session[$name] = $value;
|
||||
|
||||
setElementSession(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value
|
||||
setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,12 +368,12 @@ class FiltersLib
|
||||
if (isset($selectedFields) && is_array($selectedFields) && count($selectedFields) > 0)
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
$fields = $this->getSessionElement(self::SESSION_FIELDS);
|
||||
|
||||
// Checks that the given selected fields are present in all the used fields by the current filter
|
||||
if (!array_diff($selectedFields, $fields))
|
||||
{
|
||||
$this->setElementSession(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
$this->setSessionElement(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
|
||||
$sortSelectedFields = true;
|
||||
}
|
||||
@@ -393,9 +393,9 @@ class FiltersLib
|
||||
if (!isEmptyString($selectedField))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
$fields = $this->getSessionElement(self::SESSION_FIELDS);
|
||||
// Retrives the selected fields by the current filter
|
||||
$selectedFields = $this->getElementSession(self::SESSION_SELECTED_FIELDS);
|
||||
$selectedFields = $this->getSessionElement(self::SESSION_SELECTED_FIELDS);
|
||||
|
||||
// Checks that the given selected field is present in the list of all the used fields by the current filter
|
||||
if (in_array($selectedField, $fields))
|
||||
@@ -407,7 +407,7 @@ class FiltersLib
|
||||
array_splice($selectedFields, $pos, 1);
|
||||
}
|
||||
|
||||
$this->setElementSession(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
$this->setSessionElement(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
|
||||
$removeSelectedField = true;
|
||||
}
|
||||
@@ -427,16 +427,16 @@ class FiltersLib
|
||||
if (!isEmptyString($selectedField))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
$fields = $this->getSessionElement(self::SESSION_FIELDS);
|
||||
// Retrives the selected fields by the current filter
|
||||
$selectedFields = $this->getElementSession(self::SESSION_SELECTED_FIELDS);
|
||||
$selectedFields = $this->getSessionElement(self::SESSION_SELECTED_FIELDS);
|
||||
|
||||
// Checks that the given selected field is present in the list of all the used fields by the current filter
|
||||
if (in_array($selectedField, $fields))
|
||||
{
|
||||
array_push($selectedFields, $selectedField); // place the new filed at the end of the selected fields list
|
||||
|
||||
$this->setElementSession(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
$this->setSessionElement(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
|
||||
|
||||
$removeSelectedField = true;
|
||||
}
|
||||
@@ -456,9 +456,9 @@ class FiltersLib
|
||||
if (!isEmptyString($appliedFilter))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
$fields = $this->getSessionElement(self::SESSION_FIELDS);
|
||||
// Retrives the applied filters by the current filter
|
||||
$filters = $this->getElementSession(self::SESSION_FILTERS);
|
||||
$filters = $this->getSessionElement(self::SESSION_FILTERS);
|
||||
|
||||
// Checks that the given applied filter is present in the list of all the used fields by the current filter
|
||||
if (in_array($appliedFilter, $fields))
|
||||
@@ -471,8 +471,8 @@ class FiltersLib
|
||||
}
|
||||
|
||||
// Write changes into the session
|
||||
$this->setElementSession(self::SESSION_FILTERS, $filters);
|
||||
$this->setElementSession(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
$this->setSessionElement(self::SESSION_FILTERS, $filters);
|
||||
$this->setSessionElement(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
|
||||
$removeAppliedFilter = true;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ class FiltersLib
|
||||
if (isset($appliedFilters) && is_array($appliedFilters)
|
||||
&& isset($appliedFiltersOperations) && is_array($appliedFiltersOperations))
|
||||
{
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS); // Retrives all the used fields by the current filter
|
||||
$fields = $this->getSessionElement(self::SESSION_FIELDS); // Retrives all the used fields by the current filter
|
||||
|
||||
// Checks that the given applied filters are present in all the used fields by the current filter
|
||||
if (!array_diff($appliedFilters, $fields))
|
||||
@@ -523,8 +523,8 @@ class FiltersLib
|
||||
}
|
||||
|
||||
// Write changes into the session
|
||||
$this->setElementSession(self::SESSION_FILTERS, $filters);
|
||||
$this->setElementSession(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
$this->setSessionElement(self::SESSION_FILTERS, $filters);
|
||||
$this->setSessionElement(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
|
||||
$applyFilters = true;
|
||||
}
|
||||
@@ -544,9 +544,9 @@ class FiltersLib
|
||||
if (!isEmptyString($filter))
|
||||
{
|
||||
// Retrives all the used fields by the current filter
|
||||
$fields = $this->getElementSession(self::SESSION_FIELDS);
|
||||
$fields = $this->getSessionElement(self::SESSION_FIELDS);
|
||||
// Retrives the applied filters by the current filter
|
||||
$filters = $this->getElementSession(self::SESSION_FILTERS);
|
||||
$filters = $this->getSessionElement(self::SESSION_FILTERS);
|
||||
|
||||
// Checks that the given applied filter is present in the list of all the used fields by the current filter
|
||||
if (in_array($filter, $fields))
|
||||
@@ -567,7 +567,7 @@ class FiltersLib
|
||||
array_push($filters, $filterDefinition);
|
||||
}
|
||||
|
||||
$this->setElementSession(self::SESSION_FILTERS, $filters); // write changes into the session
|
||||
$this->setSessionElement(self::SESSION_FILTERS, $filters); // write changes into the session
|
||||
|
||||
$addFilter = true;
|
||||
}
|
||||
@@ -606,8 +606,8 @@ class FiltersLib
|
||||
|
||||
// Loads the definition to check if is already present in the DB
|
||||
$definition = $this->_ci->FiltersModel->loadWhere(array(
|
||||
'app' => $this->getElementSession(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getElementSession(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId
|
||||
));
|
||||
@@ -618,7 +618,7 @@ class FiltersLib
|
||||
|
||||
// Generates the "column" property
|
||||
$jsonDeifinition->columns = array();
|
||||
$selectedFields = $this->getElementSession(self::SESSION_SELECTED_FIELDS); // retrived the selected fields
|
||||
$selectedFields = $this->getSessionElement(self::SESSION_SELECTED_FIELDS); // retrived the selected fields
|
||||
for ($i = 0; $i < count($selectedFields); $i++)
|
||||
{
|
||||
// Each element is an object with a property called "name"
|
||||
@@ -627,7 +627,7 @@ class FiltersLib
|
||||
}
|
||||
|
||||
// List of applied filters
|
||||
$jsonDeifinition->filters = $this->getElementSession(self::SESSION_FILTERS);
|
||||
$jsonDeifinition->filters = $this->getSessionElement(self::SESSION_FILTERS);
|
||||
|
||||
// If it is already present
|
||||
if (hasData($definition))
|
||||
@@ -635,8 +635,8 @@ class FiltersLib
|
||||
// update it
|
||||
$this->_ci->FiltersModel->update(
|
||||
array(
|
||||
'app' => $this->getElementSession(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getElementSession(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId
|
||||
),
|
||||
@@ -651,8 +651,8 @@ class FiltersLib
|
||||
{
|
||||
$this->_ci->FiltersModel->insert(
|
||||
array(
|
||||
'app' => $this->getElementSession(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getElementSession(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'filter_kurzbz' => uniqid($authPersonId, true),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId,
|
||||
@@ -779,7 +779,7 @@ class FiltersLib
|
||||
);
|
||||
|
||||
// Sets in the session only the element related to the filters menu
|
||||
$this->_ci->navigationlib->setElementSessionMenu(FiltersLib::NAV_MENU_FILTER_KEY, $filterMenu);
|
||||
$this->_ci->navigationlib->setSessionElementMenu(FiltersLib::NAV_MENU_FILTER_KEY, $filterMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class NavigationLib
|
||||
*/
|
||||
public function getSessionMenu()
|
||||
{
|
||||
$session = getElementSession(self::SESSION_NAME, self::SESSION_MENU_NAME);
|
||||
$session = getSessionElement(self::SESSION_NAME, self::SESSION_MENU_NAME);
|
||||
|
||||
if (isset($session[$this->_navigationPage]))
|
||||
{
|
||||
@@ -107,7 +107,7 @@ class NavigationLib
|
||||
*/
|
||||
public function getSessionHeader()
|
||||
{
|
||||
$session = getElementSession(self::SESSION_NAME, self::SESSION_HEADER_NAME);
|
||||
$session = getSessionElement(self::SESSION_NAME, self::SESSION_HEADER_NAME);
|
||||
|
||||
if (isset($session[$this->_navigationPage]))
|
||||
{
|
||||
@@ -120,7 +120,7 @@ class NavigationLib
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrive one element from the session of this navigation widget
|
||||
*/
|
||||
public function getElementSessionMenu($name)
|
||||
public function getSessionElementMenu($name)
|
||||
{
|
||||
$session = $this->getSessionMenu();
|
||||
|
||||
@@ -135,7 +135,7 @@ class NavigationLib
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrive one element from the session of this navigation widget
|
||||
*/
|
||||
public function getElementSessionHeader($name)
|
||||
public function getSessionElementHeader($name)
|
||||
{
|
||||
$session = $this->getSessionHeader();
|
||||
|
||||
@@ -152,7 +152,7 @@ class NavigationLib
|
||||
*/
|
||||
public function setSessionMenu($data)
|
||||
{
|
||||
setElementSession(self::SESSION_NAME, self::SESSION_MENU_NAME, array($this->_navigationPage => $data));
|
||||
setSessionElement(self::SESSION_NAME, self::SESSION_MENU_NAME, array($this->_navigationPage => $data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,13 +160,13 @@ class NavigationLib
|
||||
*/
|
||||
public function setSessionHeader($data)
|
||||
{
|
||||
setElementSession(self::SESSION_NAME, self::SESSION_HEADER_NAME, array($this->_navigationPage => $data));
|
||||
setSessionElement(self::SESSION_NAME, self::SESSION_HEADER_NAME, array($this->_navigationPage => $data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set one element in the session for this navigation widget
|
||||
*/
|
||||
public function setElementSessionMenu($name, $value)
|
||||
public function setSessionElementMenu($name, $value)
|
||||
{
|
||||
$session = $this->getSessionMenu();
|
||||
|
||||
@@ -174,13 +174,13 @@ class NavigationLib
|
||||
|
||||
$session[$name] = $value;
|
||||
|
||||
setElementSession(self::SESSION_NAME, self::SESSION_MENU_NAME, array($this->_navigationPage => $session)); // stores the single value
|
||||
setSessionElement(self::SESSION_NAME, self::SESSION_MENU_NAME, array($this->_navigationPage => $session)); // stores the single value
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set one element in the session for this navigation widget
|
||||
*/
|
||||
public function setElementSessionHeader($name, $value)
|
||||
public function setSessionElementHeader($name, $value)
|
||||
{
|
||||
$session = $this->getSessionHeader();
|
||||
|
||||
@@ -188,7 +188,7 @@ class NavigationLib
|
||||
|
||||
$session[$name] = $value;
|
||||
|
||||
setElementSession(self::SESSION_NAME, self::SESSION_HEADER_NAME, array($this->_navigationPage => $session)); // stores the single value
|
||||
setSessionElement(self::SESSION_NAME, self::SESSION_HEADER_NAME, array($this->_navigationPage => $session)); // stores the single value
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -323,7 +323,7 @@ class FilterWidget extends Widget
|
||||
if ($session != null)
|
||||
{
|
||||
// Retrive the filterId stored in the session
|
||||
$sessionFilterId = $this->filterslib->getElementSession(FiltersLib::FILTER_ID);
|
||||
$sessionFilterId = $this->filterslib->getSessionElement(FiltersLib::FILTER_ID);
|
||||
|
||||
// If the filter loaded in session is NOT the same that is being requested then empty the session
|
||||
if ($this->_filterId != $sessionFilterId)
|
||||
@@ -334,16 +334,16 @@ class FilterWidget extends Widget
|
||||
else // else if the filter loaded in session is the same that is being requested
|
||||
{
|
||||
// Get SESSION_RELOAD_DATASET from the session
|
||||
$reloadDataset = $this->filterslib->getElementSession(FiltersLib::SESSION_RELOAD_DATASET);
|
||||
$reloadDataset = $this->filterslib->getSessionElement(FiltersLib::SESSION_RELOAD_DATASET);
|
||||
if ($reloadDataset === true) // if it's value is very true then reload the dataset
|
||||
{
|
||||
// Set as false to stop changing the dataset
|
||||
$this->filterslib->setElementSession(FiltersLib::SESSION_RELOAD_DATASET, false);
|
||||
$this->filterslib->setSessionElement(FiltersLib::SESSION_RELOAD_DATASET, false);
|
||||
|
||||
// Generate dataset query using filters from the session
|
||||
$datasetQuery = $this->filterslib->generateDatasetQuery(
|
||||
$this->_query,
|
||||
$this->filterslib->getElementSession(FiltersLib::SESSION_FILTERS)
|
||||
$this->filterslib->getSessionElement(FiltersLib::SESSION_FILTERS)
|
||||
);
|
||||
|
||||
// Then retrive dataset from DB
|
||||
@@ -357,9 +357,9 @@ class FilterWidget extends Widget
|
||||
$this->load->model('system/Filters_model', 'FiltersModel');
|
||||
|
||||
// Set the new dataset and its attributes in the session
|
||||
$this->filterslib->setElementSession(FiltersLib::SESSION_METADATA, $this->FiltersModel->getExecutedQueryMetaData());
|
||||
$this->filterslib->setElementSession(FiltersLib::SESSION_ROW_NUMBER, count($dataset->retval));
|
||||
$this->filterslib->setElementSession(FiltersLib::SESSION_DATASET, $dataset->retval);
|
||||
$this->filterslib->setSessionElement(FiltersLib::SESSION_METADATA, $this->FiltersModel->getExecutedQueryMetaData());
|
||||
$this->filterslib->setSessionElement(FiltersLib::SESSION_ROW_NUMBER, count($dataset->retval));
|
||||
$this->filterslib->setSessionElement(FiltersLib::SESSION_DATASET, $dataset->retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,7 +423,7 @@ class FilterWidget extends Widget
|
||||
|
||||
// To be always stored in the session, otherwise is not possible to load data from Filters controller
|
||||
// NOTE: must the latest operation to be performed in the session to be shure that is always present
|
||||
$this->filterslib->setElementSession(FiltersLib::REQUIRED_PERMISSIONS_PARAMETER, $this->_requiredPermissions);
|
||||
$this->filterslib->setSessionElement(FiltersLib::REQUIRED_PERMISSIONS_PARAMETER, $this->_requiredPermissions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user