mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 00:24:35 +00:00
Merge branch 'master' into permissions
- Added new core controller called Auth_Controller that extends FHC_Controller and manage the authentication - All the controllers that were extending the CI_Controller now they extend the FHC_Controller - All the controllers that were extending the FHC_Controller now they extend the Auth_Controller - Added the method isAllowed to the FiltersLib to check if the authenticated user has the required permissions - FilterWidget and controller Filters are using the method isAllowed from the FiltersLib
This commit is contained in:
@@ -8,7 +8,7 @@ if (! defined('BASEPATH'))
|
||||
*
|
||||
*/
|
||||
|
||||
class DBTools extends FHC_Controller
|
||||
class DBTools extends Auth_Controller
|
||||
{
|
||||
private $cli = false;
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class MailJob extends FHC_Controller
|
||||
class MailJob extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
* API constructor
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Redirect extends CI_Controller
|
||||
class Redirect extends FHC_Controller
|
||||
{
|
||||
/**
|
||||
* API constructor
|
||||
|
||||
@@ -19,7 +19,7 @@ if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
* NOTE: in this controller is not possible to include/call everything
|
||||
* that automatically call the authentication system, like the most of models or libraries
|
||||
*/
|
||||
class ViewMessage extends CI_Controller
|
||||
class ViewMessage extends FHC_Controller
|
||||
{
|
||||
/**
|
||||
* API constructor
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Vilesci extends FHC_Controller
|
||||
class Vilesci extends Auth_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
class Statusgrund extends FHC_Controller
|
||||
class Statusgrund extends Auth_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ if (! defined('BASEPATH'))
|
||||
*
|
||||
*/
|
||||
|
||||
class Prestudentstatus extends FHC_Controller
|
||||
class Prestudentstatus extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
* Initialize Prestudentstatus Class
|
||||
|
||||
@@ -5,7 +5,7 @@ if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
/**
|
||||
* Studienjahr controller for listing, editing and removing a Studienjahr
|
||||
*/
|
||||
class Studienjahr extends FHC_Controller
|
||||
class Studienjahr extends Auth_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ if (!defined("BASEPATH")) exit("No direct script access allowed");
|
||||
/**
|
||||
* Studiensemester controller for listing, editing and removing a Studiensemester
|
||||
*/
|
||||
class Studiensemester extends FHC_Controller
|
||||
class Studiensemester extends Auth_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,572 +3,253 @@
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
* This controller operates between (interface) the JS (GUI) and the FiltersLib (back-end)
|
||||
* Provides data to the ajax get calls about the filter
|
||||
* Accepts ajax post calls to change the filter data
|
||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||
*/
|
||||
class Filters extends CI_Controller
|
||||
class Filters extends FHC_Controller
|
||||
{
|
||||
const SESSION_NAME = 'FHC_FILTER_WIDGET';
|
||||
|
||||
const SELECTED_FIELDS = 'selectedFields';
|
||||
const SELECTED_FILTERS = 'selectedFilters';
|
||||
const ACTIVE_FILTERS = 'activeFilters';
|
||||
const ACTIVE_FILTERS_OPTION = 'activeFiltersOption';
|
||||
const ACTIVE_FILTERS_OPERATION = 'activeFiltersOperation';
|
||||
const FILTER_NAME = 'filterName';
|
||||
const FILTER_PAGE_PARAM = 'filter_page';
|
||||
|
||||
/**
|
||||
*
|
||||
* Calls the parent's constructor and loads the FiltersLib
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load session library
|
||||
$this->load->library('session');
|
||||
// Load permission library
|
||||
$this->load->library('PermissionLib');
|
||||
|
||||
$this->load->model('system/Filters_model', 'FiltersModel');
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
// Loads the FiltersLib with HTTP GET/POST parameters
|
||||
$this->_loadFiltersLib();
|
||||
|
||||
// Checks if the caller is allow to read this data
|
||||
$this->_isAllowed();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
*
|
||||
* Retrives data about the current filter from the session and will be written on the output in JSON format
|
||||
*/
|
||||
public function tableDataset()
|
||||
public function getFilter()
|
||||
{
|
||||
$json = new stdClass();
|
||||
|
||||
$session = $this->_readSession($this->input->get('fhc_controller_id'));
|
||||
|
||||
$json->selectedFields = $session['selectedFields'];
|
||||
$json->columnsAliases = $session['columnsAliases'];
|
||||
$json->additionalColumns = $session['additionalColumns'];
|
||||
$json->checkboxes = $session['checkboxes'];
|
||||
$json->dataset = $session['dataset'];
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
$this->outputJsonSuccess($this->filterslib->getSession());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function selectFields()
|
||||
{
|
||||
$json = new stdClass();
|
||||
|
||||
$session = $this->_readSession($this->input->get('fhc_controller_id'));
|
||||
|
||||
$json->allSelectedFields = $session['allSelectedFields'];
|
||||
$json->allColumnsAliases = $session['allColumnsAliases'];
|
||||
|
||||
$json->selectedFields = $session['selectedFields'];
|
||||
$json->columnsAliases = $session['columnsAliases'];
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function sortSelectedFields()
|
||||
{
|
||||
$selectedFieldsLst = $this->input->post('selectedFieldsLst');
|
||||
$fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
$json = new stdClass();
|
||||
|
||||
$session = $this->_readSession($fhc_controller_id);
|
||||
|
||||
$allSelectedFields = $session['allSelectedFields'];
|
||||
$allColumnsAliases = $session['allColumnsAliases'];
|
||||
|
||||
$json->selectedFields = $session['selectedFields'];
|
||||
$json->columnsAliases = $session['columnsAliases'];
|
||||
|
||||
if (isset($selectedFieldsLst) && is_array($selectedFieldsLst))
|
||||
{
|
||||
$json->selectedFields = $selectedFieldsLst;
|
||||
$json->columnsAliases = array();
|
||||
|
||||
for ($i = 0; $i < count($json->selectedFields); $i++)
|
||||
{
|
||||
$pos = array_search($json->selectedFields[$i], $allSelectedFields);
|
||||
|
||||
$json->columnsAliases[$i] = $json->selectedFields[$i];
|
||||
|
||||
if ($pos !== false)
|
||||
{
|
||||
if ($allColumnsAliases != null && is_array($allColumnsAliases))
|
||||
{
|
||||
$json->columnsAliases[$i] = $allColumnsAliases[$pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['selectedFields'] = $json->selectedFields;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['columnsAliases'] = $json->columnsAliases;
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function selectFilters()
|
||||
{
|
||||
$json = new stdClass();
|
||||
|
||||
$session = $this->_readSession($this->input->get('fhc_controller_id'));
|
||||
|
||||
$json->allSelectedFields = $session['allSelectedFields'];
|
||||
$json->allColumnsAliases = $session['allColumnsAliases'];
|
||||
|
||||
$json->selectedFilters = $session['selectedFilters'];
|
||||
$json->selectedFiltersAliases = array();
|
||||
$json->selectedFiltersMetaData = array();
|
||||
|
||||
$json->selectedFiltersActiveFilters = array();
|
||||
$json->selectedFiltersActiveFiltersOperation = array();
|
||||
$json->selectedFiltersActiveFiltersOption = array();
|
||||
|
||||
$metaData = $session['metaData'];
|
||||
$activeFilters = $session['activeFilters'];
|
||||
$activeFiltersOperation = $session['activeFiltersOperation'];
|
||||
$activeFiltersOption = $session['activeFiltersOption'];
|
||||
|
||||
for ($i = 0; $i < count($json->selectedFilters); $i++)
|
||||
{
|
||||
$pos = array_search($json->selectedFilters[$i], $json->allSelectedFields);
|
||||
|
||||
if ($pos !== false)
|
||||
{
|
||||
$json->selectedFiltersAliases[$i] = $json->selectedFilters[$i];
|
||||
if ($json->allColumnsAliases != null && is_array($json->allColumnsAliases))
|
||||
{
|
||||
$json->selectedFiltersAliases[$i] = $json->allColumnsAliases[$pos];
|
||||
}
|
||||
|
||||
$json->selectedFiltersMetaData[] = $metaData[$pos];
|
||||
|
||||
if (isset($activeFilters[$json->selectedFilters[$i]]))
|
||||
{
|
||||
$json->selectedFiltersActiveFilters[] = $activeFilters[$json->selectedFilters[$i]];
|
||||
}
|
||||
|
||||
if (isset($activeFiltersOperation[$json->selectedFilters[$i]]))
|
||||
{
|
||||
$json->selectedFiltersActiveFiltersOperation[] = $activeFiltersOperation[$json->selectedFilters[$i]];
|
||||
}
|
||||
|
||||
if (isset($activeFiltersOption[$json->selectedFilters[$i]]))
|
||||
{
|
||||
$json->selectedFiltersActiveFiltersOption[] = $activeFiltersOption[$json->selectedFilters[$i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function saveFilter()
|
||||
{
|
||||
$this->_saveFilter($this->input->post("customFilterDescription"), $this->input->post("fhc_controller_id"));
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode('Tutto bene!!!'));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _saveFilter($customFilterDescription, $fhc_controller_id)
|
||||
{
|
||||
$objToBeSaved = new stdClass();
|
||||
|
||||
$filterSessionArray = $this->_readSession($fhc_controller_id);
|
||||
|
||||
$objToBeSaved->name = $customFilterDescription;
|
||||
|
||||
if (isset($filterSessionArray[self::SELECTED_FIELDS]))
|
||||
{
|
||||
$selectedFields = $filterSessionArray[self::SELECTED_FIELDS];
|
||||
$objToBeSaved->columns = array();
|
||||
|
||||
for ($selectedFieldsCounter = 0; $selectedFieldsCounter < count($selectedFields); $selectedFieldsCounter++)
|
||||
{
|
||||
$objToBeSaved->columns[$selectedFieldsCounter] = new stdClass();
|
||||
$objToBeSaved->columns[$selectedFieldsCounter]->name = $selectedFields[$selectedFieldsCounter];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($filterSessionArray[self::SELECTED_FILTERS]))
|
||||
{
|
||||
$selectedFilters = $filterSessionArray[self::SELECTED_FILTERS];
|
||||
$objToBeSaved->filters = array();
|
||||
|
||||
for ($selectedFiltersCounter = 0; $selectedFiltersCounter < count($selectedFilters); $selectedFiltersCounter++)
|
||||
{
|
||||
$objToBeSaved->filters[$selectedFiltersCounter] = new stdClass();
|
||||
$objToBeSaved->filters[$selectedFiltersCounter]->name = $selectedFilters[$selectedFiltersCounter];
|
||||
|
||||
if (isset($filterSessionArray[self::ACTIVE_FILTERS])
|
||||
&& isset($filterSessionArray[self::ACTIVE_FILTERS][$selectedFilters[$selectedFiltersCounter]]))
|
||||
{
|
||||
$objToBeSaved->filters[$selectedFiltersCounter]->condition = $filterSessionArray[self::ACTIVE_FILTERS][$selectedFilters[$selectedFiltersCounter]];
|
||||
}
|
||||
|
||||
if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPERATION])
|
||||
&& isset($filterSessionArray[self::ACTIVE_FILTERS_OPERATION][$selectedFilters[$selectedFiltersCounter]]))
|
||||
{
|
||||
$objToBeSaved->filters[$selectedFiltersCounter]->operation = $filterSessionArray[self::ACTIVE_FILTERS_OPERATION][$selectedFilters[$selectedFiltersCounter]];
|
||||
}
|
||||
|
||||
if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPTION])
|
||||
&& isset($filterSessionArray[self::ACTIVE_FILTERS_OPTION][$selectedFilters[$selectedFiltersCounter]]))
|
||||
{
|
||||
$objToBeSaved->filters[$selectedFiltersCounter]->option = $filterSessionArray[self::ACTIVE_FILTERS_OPTION][$selectedFilters[$selectedFiltersCounter]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$desc = $customFilterDescription;
|
||||
$descPGArray = '{"'.$desc.'", "'.$desc.'", "'.$desc.'", "'.$desc.'"}';
|
||||
|
||||
$resultBenutzer = $this->BenutzerModel->load(getAuthUID());
|
||||
$personId = $resultBenutzer->retval[0]->person_id;
|
||||
|
||||
$result = $this->FiltersModel->loadWhere(array(
|
||||
'app' => $_SESSION[self::SESSION_NAME][$fhc_controller_id]['app'],
|
||||
'dataset_name' => $_SESSION[self::SESSION_NAME][$fhc_controller_id]['datasetName'],
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $personId
|
||||
));
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$this->FiltersModel->update(
|
||||
array(
|
||||
'app' => $_SESSION[self::SESSION_NAME][$fhc_controller_id]['app'],
|
||||
'dataset_name' => $_SESSION[self::SESSION_NAME][$fhc_controller_id]['datasetName'],
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $personId
|
||||
),
|
||||
array(
|
||||
'filter' => json_encode($objToBeSaved)
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->FiltersModel->insert(array(
|
||||
'app' => $_SESSION[self::SESSION_NAME][$fhc_controller_id]['app'],
|
||||
'dataset_name' => $_SESSION[self::SESSION_NAME][$fhc_controller_id]['datasetName'],
|
||||
'filter_kurzbz' => uniqid($personId, true),
|
||||
'person_id' => $personId,
|
||||
'description' => $descPGArray,
|
||||
'sort' => null,
|
||||
'default_filter' => false,
|
||||
'filter' => json_encode($objToBeSaved),
|
||||
'oe_kurzbz' => null
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function deleteCustomFilter()
|
||||
{
|
||||
$filter_id = $this->input->post('filter_id');
|
||||
$fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
if (is_numeric($filter_id))
|
||||
{
|
||||
$this->FiltersModel->deleteCustomFilter($filter_id);
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode('Removed'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function removeSelectedFields()
|
||||
{
|
||||
$fieldName = $this->input->post('fieldName');
|
||||
$fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
$session = $this->_readSession($fhc_controller_id);
|
||||
|
||||
$allSelectedFields = $session['allSelectedFields'];
|
||||
$allColumnsAliases = $session['allColumnsAliases'];
|
||||
|
||||
$selectedFields = $session['selectedFields'];
|
||||
$columnsAliases = $session['columnsAliases'];
|
||||
|
||||
if (($pos = array_search($fieldName, $selectedFields)) !== false)
|
||||
{
|
||||
array_splice($selectedFields, $pos, 1);
|
||||
|
||||
if ($columnsAliases != null && is_array($columnsAliases))
|
||||
{
|
||||
array_splice($columnsAliases, $pos, 1);
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['selectedFields'] = $selectedFields;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['columnsAliases'] = $columnsAliases;
|
||||
|
||||
$json = new stdClass();
|
||||
|
||||
$json->allSelectedFields = $allSelectedFields;
|
||||
$json->allColumnsAliases = $allColumnsAliases;
|
||||
$json->selectedFields = $selectedFields;
|
||||
$json->columnsAliases = $columnsAliases;
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function removeSelectedFilters()
|
||||
{
|
||||
$fieldName = $this->input->post('fieldName');
|
||||
$fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
$session = $this->_readSession($fhc_controller_id);
|
||||
|
||||
$selectedFilters = $session['selectedFilters'];
|
||||
$selectedFiltersActiveFilters = $session['activeFilters'];
|
||||
$selectedFiltersActiveFiltersOperation = $session['activeFiltersOperation'];
|
||||
$selectedFiltersActiveFiltersOption = $session['activeFiltersOption'];
|
||||
|
||||
if (($pos = array_search($fieldName, $selectedFilters)) !== false)
|
||||
{
|
||||
array_splice($selectedFilters, $pos, 1);
|
||||
array_splice($selectedFiltersActiveFilters, $pos, 1);
|
||||
array_splice($selectedFiltersActiveFiltersOperation, $pos, 1);
|
||||
array_splice($selectedFiltersActiveFiltersOption, $pos, 1);
|
||||
}
|
||||
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['selectedFilters'] = $selectedFilters;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFilters'] = $selectedFiltersActiveFilters;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFiltersOperation'] = $selectedFiltersActiveFiltersOperation;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFiltersOption'] = $selectedFiltersActiveFiltersOption;
|
||||
|
||||
$json = new stdClass();
|
||||
|
||||
$json->selectedFilters = $selectedFilters;
|
||||
$json->selectedFiltersActiveFilters = $selectedFiltersActiveFilters;
|
||||
$json->selectedFiltersActiveFiltersOperation = $selectedFiltersActiveFiltersOperation;
|
||||
$json->selectedFiltersActiveFiltersOption = $selectedFiltersActiveFiltersOption;
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function addSelectedFields()
|
||||
{
|
||||
$fieldName = $this->input->post('fieldName');
|
||||
$fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
$session = $this->_readSession($fhc_controller_id);
|
||||
|
||||
$allSelectedFields = $session['allSelectedFields'];
|
||||
$allColumnsAliases = $session['allColumnsAliases'];
|
||||
|
||||
$selectedFields = $session['selectedFields'];
|
||||
$columnsAliases = $session['columnsAliases'];
|
||||
|
||||
if (($pos = array_search($fieldName, $allSelectedFields)) !== false
|
||||
&& array_search($fieldName, $selectedFields) === false)
|
||||
{
|
||||
array_push($selectedFields, $fieldName);
|
||||
|
||||
if ($columnsAliases != null && is_array($columnsAliases))
|
||||
{
|
||||
array_push($columnsAliases, $allColumnsAliases[$pos]);
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['selectedFields'] = $selectedFields;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['columnsAliases'] = $columnsAliases;
|
||||
|
||||
$json = new stdClass();
|
||||
|
||||
$json->allSelectedFields = $allSelectedFields;
|
||||
$json->allColumnsAliases = $allColumnsAliases;
|
||||
$json->selectedFields = $selectedFields;
|
||||
$json->columnsAliases = $columnsAliases;
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function addSelectedFilters()
|
||||
{
|
||||
$fieldName = $this->input->post('fieldName');
|
||||
$fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
$session = $this->_readSession($fhc_controller_id);
|
||||
|
||||
$selectedFilters = $session['selectedFilters'];
|
||||
$selectedFiltersActiveFilters = $session['activeFilters'];
|
||||
$selectedFiltersActiveFiltersOperation = $session['activeFiltersOperation'];
|
||||
$selectedFiltersActiveFiltersOption = $session['activeFiltersOption'];
|
||||
|
||||
if (!in_array($fieldName, $selectedFilters))
|
||||
{
|
||||
array_push($selectedFilters, $fieldName);
|
||||
$selectedFiltersActiveFilters[$fieldName] = "";
|
||||
$selectedFiltersActiveFiltersOperation[$fieldName] = "";
|
||||
$selectedFiltersActiveFiltersOption[$fieldName] = "";
|
||||
}
|
||||
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['selectedFilters'] = $selectedFilters;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFilters'] = $selectedFiltersActiveFilters;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFiltersOperation'] = $selectedFiltersActiveFiltersOperation;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFiltersOption'] = $selectedFiltersActiveFiltersOption;
|
||||
|
||||
$json = new stdClass();
|
||||
|
||||
$json->selectedFilters = $selectedFilters;
|
||||
$json->selectedFiltersActiveFilters = $selectedFiltersActiveFilters;
|
||||
$json->selectedFiltersActiveFiltersOperation = $selectedFiltersActiveFiltersOperation;
|
||||
$json->selectedFiltersActiveFiltersOption = $selectedFiltersActiveFiltersOption;
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function applyFilter()
|
||||
{
|
||||
$fieldNames = $this->input->post('filterNames');
|
||||
$filterOperations = $this->input->post('filterOperations');
|
||||
$filterOperationValues = $this->input->post('filterOperationValues');
|
||||
$filterOptions = $this->input->post('filterOptions');
|
||||
$fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
$session = $this->_readSession($fhc_controller_id);
|
||||
|
||||
if ($fieldNames == null) $fieldNames = array();
|
||||
if ($filterOperationValues == null) $filterOperationValues = array();
|
||||
if ($filterOperations == null) $filterOperations = array();
|
||||
if ($filterOptions == null) $filterOptions = array();
|
||||
|
||||
$activeFilters = array_combine($fieldNames, $filterOperationValues);
|
||||
$activeFiltersOperation = array_combine($fieldNames, $filterOperations);
|
||||
$activeFiltersOption = array_combine($fieldNames, $filterOptions);
|
||||
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFilters'] = $activeFilters;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFiltersOperation'] = $activeFiltersOperation;
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id]['activeFiltersOption'] = $activeFiltersOption;
|
||||
|
||||
$json = new stdClass();
|
||||
|
||||
$json->fieldNames = $fieldNames;
|
||||
$json->activeFilters = $activeFilters;
|
||||
$json->activeFiltersOperation = $activeFiltersOperation;
|
||||
$json->activeFiltersOption = $activeFiltersOption;
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Retrives the number of records present in the current dataset and will be written on the output in JSON format
|
||||
*/
|
||||
public function rowNumber()
|
||||
{
|
||||
$json = new stdClass();
|
||||
$rowNumber = 0;
|
||||
$dataset = $this->filterslib->getElementSession(FiltersLib::SESSION_DATASET);
|
||||
|
||||
$session = $this->_readSession($this->input->get('fhc_controller_id'));
|
||||
|
||||
$dataset = $session['dataset'];
|
||||
|
||||
if (is_array($dataset))
|
||||
if (isset($dataset) && is_array($dataset))
|
||||
{
|
||||
$json->rowNumber = count($dataset);
|
||||
$rowNumber = count($dataset);
|
||||
}
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
$this->outputJsonSuccess($rowNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the sort of the selected fields of the current filter and
|
||||
* its data will be written on the output in JSON format
|
||||
*/
|
||||
public function sortSelectedFields()
|
||||
{
|
||||
$selectedFields = $this->input->post('selectedFields');
|
||||
|
||||
if ($this->filterslib->sortSelectedFields($selectedFields) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a selected field from the current filter and
|
||||
* its data will be written on the output in JSON format
|
||||
*/
|
||||
public function removeSelectedField()
|
||||
{
|
||||
$selectedField = $this->input->post('selectedField');
|
||||
|
||||
if ($this->filterslib->removeSelectedField($selectedField) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a field to the current filter and its data will be written on the output in JSON format
|
||||
*/
|
||||
public function addSelectedField()
|
||||
{
|
||||
$selectedField = $this->input->post('selectedField');
|
||||
|
||||
if ($this->filterslib->addSelectedField($selectedField) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an applied filter (SQL where condition) from the current filter
|
||||
*/
|
||||
public function removeAppliedFilter()
|
||||
{
|
||||
$appliedFilter = $this->input->post('appliedFilter');
|
||||
|
||||
if ($this->filterslib->removeAppliedFilter($appliedFilter) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Removed');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply all the applied filters (SQL where conditions) to the current filter
|
||||
*/
|
||||
public function applyFilters()
|
||||
{
|
||||
$appliedFilters = $this->input->post('appliedFilters');
|
||||
$appliedFiltersOperations = $this->input->post('appliedFiltersOperations');
|
||||
$appliedFiltersConditions = $this->input->post('appliedFiltersConditions');
|
||||
$appliedFiltersOptions = $this->input->post('appliedFiltersOptions');
|
||||
|
||||
if ($this->filterslib->applyFilters(
|
||||
$appliedFilters,
|
||||
$appliedFiltersOperations,
|
||||
$appliedFiltersConditions,
|
||||
$appliedFiltersOptions
|
||||
) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Applied');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a filter (SQL where clause) to be applied to the current filter
|
||||
*/
|
||||
public function addFilter()
|
||||
{
|
||||
$filter = $this->input->post('filter');
|
||||
|
||||
if ($this->filterslib->addFilter($filter) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the current filter as a custom filter for this user with the given description
|
||||
*/
|
||||
public function saveCustomFilter()
|
||||
{
|
||||
$customFilterDescription = $this->input->post('customFilterDescription');
|
||||
|
||||
if ($this->filterslib->saveCustomFilter($customFilterDescription) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Saved');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a custom filter by its filter_id
|
||||
*/
|
||||
public function removeCustomFilter()
|
||||
{
|
||||
$filter_id = $this->input->post('filter_id');
|
||||
|
||||
if ($this->filterslib->removeCustomFilter($filter_id) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Removed');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError('Wrong parameter');
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Checks if the user is allowed to use this filter
|
||||
*/
|
||||
private function _isAllowed()
|
||||
{
|
||||
$isAllowed = false;
|
||||
|
||||
$session = $this->_readSession($this->input->get('fhc_controller_id'));
|
||||
|
||||
if (isset($session['requiredPermissions']))
|
||||
if (!$this->filterslib->isAllowed())
|
||||
{
|
||||
$tmpRequiredPermissions = $session['requiredPermissions'];
|
||||
if (!is_array($tmpRequiredPermissions))
|
||||
{
|
||||
$tmpRequiredPermissions = array($session['requiredPermissions']);
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($tmpRequiredPermissions); $i++)
|
||||
{
|
||||
$requiredPermissions = array(
|
||||
'filters' => $tmpRequiredPermissions[$i].':rw'
|
||||
);
|
||||
|
||||
if ($this->permissionlib->isEntitled($requiredPermissions, 'filters'))
|
||||
{
|
||||
$isAllowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$isAllowed)
|
||||
{
|
||||
header('Content-Type: application/json');
|
||||
|
||||
echo json_encode('You are not allowed to access to this content');
|
||||
|
||||
exit(1);
|
||||
$this->_terminateWithJsonError('You are not allowed to access to this content');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Loads the FiltersLib with the FILTER_PAGE_PARAM parameter
|
||||
* If the parameter FILTER_PAGE_PARAM is not given then the execution of the controller is terminated and
|
||||
* an error message is printed
|
||||
*/
|
||||
private function _readSession($fhc_controller_id)
|
||||
private function _loadFiltersLib()
|
||||
{
|
||||
if (isset($_SESSION[self::SESSION_NAME]) && isset($_SESSION[self::SESSION_NAME][$fhc_controller_id]))
|
||||
return $_SESSION[self::SESSION_NAME][$fhc_controller_id];
|
||||
// If the parameter FILTER_PAGE_PARAM is present in the HTTP GET or POST
|
||||
if (isset($_GET[self::FILTER_PAGE_PARAM]) || isset($_POST[self::FILTER_PAGE_PARAM]))
|
||||
{
|
||||
// If it is present in the HTTP GET
|
||||
if (isset($_GET[self::FILTER_PAGE_PARAM]))
|
||||
{
|
||||
$filterPage = $this->input->get(self::FILTER_PAGE_PARAM); // is retrived from the HTTP GET
|
||||
}
|
||||
elseif (isset($_POST[self::FILTER_PAGE_PARAM])) // Else if it is present in the HTTP POST
|
||||
{
|
||||
$filterPage = $this->input->post(self::FILTER_PAGE_PARAM); // is retrived from the HTTP POST
|
||||
}
|
||||
|
||||
return array();
|
||||
// Loads the FiltersLib that contains all the used logic
|
||||
$this->load->library('FiltersLib', array(self::FILTER_PAGE_PARAM => $filterPage));
|
||||
}
|
||||
else // Otherwise an error will be written in the output
|
||||
{
|
||||
$this->_terminateWithJsonError('Parameter "'.self::FILTER_PAGE_PARAM.'" not provided!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Terminate the execution of the page after have printed a message encoded to JSON.
|
||||
* Used directly header and echo to speed up the output before the exit command stops the execution.
|
||||
*/
|
||||
private function _writeSession($data, $fhc_controller_id)
|
||||
private function _terminateWithJsonError($message)
|
||||
{
|
||||
if (!isset($_SESSION[self::SESSION_NAME])
|
||||
|| (isset($_SESSION[self::SESSION_NAME]) && !is_array($_SESSION[self::SESSION_NAME])))
|
||||
{
|
||||
$_SESSION[self::SESSION_NAME] = array();
|
||||
}
|
||||
|
||||
$_SESSION[self::SESSION_NAME][$fhc_controller_id] = $data;
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(error($message));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Messages extends FHC_Controller
|
||||
class Messages extends Auth_Controller
|
||||
{
|
||||
private $uid; // contains the UID of the logged user
|
||||
|
||||
@@ -29,6 +29,13 @@ class Messages extends FHC_Controller
|
||||
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$this->loadPhrases(array(
|
||||
'global',
|
||||
'person',
|
||||
'lehre',
|
||||
'ui',
|
||||
'infocenter'));
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Navigation extends FHC_Controller
|
||||
class Navigation extends Auth_Controller
|
||||
{
|
||||
const SESSION_NAME = 'NAVIGATION_MENU';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Phrases extends FHC_Controller
|
||||
class Phrases extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class UDF extends FHC_Controller
|
||||
class UDF extends Auth_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Vorlage extends FHC_Controller
|
||||
class Vorlage extends Auth_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class PrestudentMultiAssign extends FHC_Controller
|
||||
class PrestudentMultiAssign extends Auth_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Manager extends FHC_Controller
|
||||
class Manager extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -6,7 +6,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
* Also shows infocenter-related data for a person and its prestudents, enables document and zgv checks,
|
||||
* displays and saves Notizen for a person, logs infocenter-related actions for a person
|
||||
*/
|
||||
class InfoCenter extends FHC_Controller
|
||||
class InfoCenter extends Auth_Controller
|
||||
{
|
||||
// App and Verarbeitungstaetigkeit name for logging
|
||||
const APP = 'infocenter';
|
||||
@@ -21,12 +21,14 @@ class InfoCenter extends FHC_Controller
|
||||
'saveformalgep' => array(
|
||||
'logtype' => 'Action',
|
||||
'name' => 'Document formally checked',
|
||||
'message' => 'Document %s formally checked, set to %s'
|
||||
'message' => 'Document %s formally checked, set to %s',
|
||||
'success' => null
|
||||
),
|
||||
'savezgv' => array(
|
||||
'logtype' => 'Action',
|
||||
'name' => 'ZGV saved',
|
||||
'message' => 'ZGV saved for degree program %s, prestudentid %s'
|
||||
'message' => 'ZGV saved for degree program %s, prestudentid %s',
|
||||
'success' => null
|
||||
),
|
||||
'abgewiesen' => array(
|
||||
'logtype' => 'Processstate',
|
||||
@@ -41,12 +43,14 @@ class InfoCenter extends FHC_Controller
|
||||
'savenotiz' => array(
|
||||
'logtype' => 'Action',
|
||||
'name' => 'Note added',
|
||||
'message' => 'Note with title %s was added'
|
||||
'message' => 'Note with title %s was added',
|
||||
'success' => null
|
||||
),
|
||||
'updatenotiz' => array(
|
||||
'logtype' => 'Action',
|
||||
'name' => 'Note updated',
|
||||
'message' => 'Note with title %s was updated'
|
||||
'message' => 'Note with title %s was updated',
|
||||
'success' => null
|
||||
)
|
||||
);
|
||||
private $uid; // contains the UID of the logged user
|
||||
@@ -59,6 +63,7 @@ class InfoCenter extends FHC_Controller
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'infocenter:r',
|
||||
'infocenterFreigegeben' => 'infocenter:r',
|
||||
'showDetails' => 'infocenter:r',
|
||||
'unlockPerson' => 'infocenter:rw',
|
||||
'saveFormalGeprueft' => 'infocenter:rw',
|
||||
@@ -89,13 +94,26 @@ class InfoCenter extends FHC_Controller
|
||||
$this->load->library('PersonLogLib');
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'person',
|
||||
'lehre',
|
||||
'ui',
|
||||
'infocenter',
|
||||
'filter'
|
||||
)
|
||||
);
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
|
||||
$this->load->library('PermissionLib');
|
||||
if(!$this->permissionlib->isBerechtigt('basis/person'))
|
||||
show_error('You have no Permission! You need Infocenter Role');
|
||||
|
||||
$this->_setControllerId(); // sets the controller id
|
||||
$this->setControllerId(); // sets the controller id
|
||||
|
||||
$this->fhc_controller_id = $this->getControllerId();
|
||||
|
||||
$this->setNavigationMenuArray(); // sets property navigationMenuArray
|
||||
}
|
||||
@@ -127,46 +145,54 @@ class InfoCenter extends FHC_Controller
|
||||
|
||||
$personexists = $this->PersonModel->load($person_id);
|
||||
|
||||
if(isError($personexists))
|
||||
if (isError($personexists))
|
||||
show_error($personexists->retval);
|
||||
|
||||
if (empty($personexists->retval))
|
||||
show_error('person does not exist!');
|
||||
|
||||
//mark person as locked for editing
|
||||
$result = $this->PersonLockModel->lockPerson($person_id, $this->uid, self::APP);
|
||||
$show_lock_link_get = $this->input->get('show_lock_link');
|
||||
$show_lock_link = !isset($show_lock_link_get) || $show_lock_link_get === '1';
|
||||
|
||||
if(isError($result))
|
||||
show_error($result->retval);
|
||||
if ($show_lock_link)
|
||||
{
|
||||
//mark person as locked for editing
|
||||
$result = $this->PersonLockModel->lockPerson($person_id, $this->uid, self::APP);
|
||||
|
||||
if (isError($result))
|
||||
show_error($result->retval);
|
||||
}
|
||||
|
||||
$persondata = $this->_loadPersonData($person_id);
|
||||
$prestudentdata = $this->_loadPrestudentData($person_id);
|
||||
|
||||
$this->load->view(
|
||||
'system/infocenter/infocenterDetails.php',
|
||||
array_merge(
|
||||
$persondata,
|
||||
$prestudentdata
|
||||
)
|
||||
$data = array_merge(
|
||||
$persondata,
|
||||
$prestudentdata,
|
||||
array('show_lock_link' => $show_lock_link)
|
||||
);
|
||||
|
||||
$data['fhc_controller_id'] = $this->fhc_controller_id;
|
||||
|
||||
$this->load->view('system/infocenter/infocenterDetails.php', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* unlocks page from edit by a person, redirects to overview filter page
|
||||
* Unlocks page from edit by a person, redirects to overview filter page
|
||||
* @param $person_id
|
||||
*/
|
||||
public function unlockPerson($person_id)
|
||||
{
|
||||
$result = $this->PersonLockModel->unlockPerson($person_id, self::APP);
|
||||
|
||||
if(isError($result))
|
||||
if (isError($result))
|
||||
show_error($result->retval);
|
||||
|
||||
redirect(self::URL_PREFIX);
|
||||
redirect(self::URL_PREFIX.'?fhc_controller_id='.$this->fhc_controller_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves if a document has been formal geprueft. saves current timestamp if checked as geprueft, or null if not.
|
||||
* Saves if a document has been formal geprueft. Saves current timestamp if checked as geprueft, or null if not.
|
||||
* @param $person_id
|
||||
*/
|
||||
public function saveFormalGeprueft($person_id)
|
||||
@@ -174,37 +200,36 @@ class InfoCenter extends FHC_Controller
|
||||
$akte_id = $this->input->post('akte_id');
|
||||
$formalgeprueft = $this->input->post('formal_geprueft');
|
||||
|
||||
if (!isset($akte_id) || !isset($formalgeprueft) || !isset($person_id))
|
||||
show_error('Parameters not set!');
|
||||
$json = false;
|
||||
|
||||
$akte = $this->AkteModel->load($akte_id);
|
||||
|
||||
if (isError($akte))
|
||||
if (isset($akte_id) && isset($formalgeprueft) && isset($person_id))
|
||||
{
|
||||
show_error($akte->retval);
|
||||
$akte = $this->AkteModel->load($akte_id);
|
||||
|
||||
if (hasData($akte))
|
||||
{
|
||||
$timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null;
|
||||
$result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp));
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$json = $timestamp;
|
||||
|
||||
$this->_log(
|
||||
$person_id,
|
||||
'saveformalgep',
|
||||
array(
|
||||
empty($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
|
||||
is_null($timestamp) ? 'NULL' : $timestamp
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null;
|
||||
$result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error($result->retval);
|
||||
}
|
||||
|
||||
//write person log
|
||||
$this->_log(
|
||||
$person_id,
|
||||
'saveformalgep',
|
||||
array(
|
||||
empty($akte->retval[0]->titel) ? $akte->retval[0]->bezeichnung : $akte->retval[0]->titel,
|
||||
is_null($timestamp) ? 'NULL' : $timestamp
|
||||
)
|
||||
);
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($timestamp));
|
||||
->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,20 +240,13 @@ class InfoCenter extends FHC_Controller
|
||||
{
|
||||
$prestudent = $this->PrestudentModel->getLastPrestudent($person_id, true);
|
||||
|
||||
if (isError($prestudent))
|
||||
{
|
||||
show_error($prestudent->retval);
|
||||
}
|
||||
|
||||
$jsonoutput = count($prestudent->retval) > 0 ? $prestudent->retval[0] : null;
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($jsonoutput));
|
||||
->set_output(json_encode($prestudent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Zugangsvoraussetzungen for a prestudents as a description text
|
||||
* Gets Zugangsvoraussetzungen for a prestudent as a description text and shows them in a view
|
||||
* @param $prestudent_id
|
||||
*/
|
||||
public function getZgvInfoForPrestudent($prestudent_id)
|
||||
@@ -239,67 +257,73 @@ class InfoCenter extends FHC_Controller
|
||||
$studiengangkurzbz = $prestudentdata['studiengang_kurzbz'];
|
||||
$studiengangbezeichnung = $prestudentdata['studiengang_bezeichnung'];
|
||||
|
||||
$data = array('studiengang_bezeichnung' => $studiengangbezeichnung, 'studiengang_kurzbz' => $studiengangkurzbz, 'data' => null);
|
||||
$data = array(
|
||||
'studiengang_bezeichnung' => $studiengangbezeichnung,
|
||||
'studiengang_kurzbz' => $studiengangkurzbz,
|
||||
'data' => null
|
||||
);
|
||||
|
||||
if (hasData($studienordnung))
|
||||
{
|
||||
$data['data'] = $studienordnung->retval[0]->data;
|
||||
}
|
||||
|
||||
$this->load->view('system/infocenter/studiengangZgvInfo.php',
|
||||
$data
|
||||
);
|
||||
$this->load->view('system/infocenter/studiengangZgvInfo.php', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a zgv for a prestudent. includes Ort, Datum, Nation for bachelor and master.
|
||||
* Saves a ZGV for a prestudent, includes Ort, Datum, Nation for bachelor and master
|
||||
* @param $prestudent_id
|
||||
*/
|
||||
public function saveZgvPruefung($prestudent_id)
|
||||
public function saveZgvPruefung()
|
||||
{
|
||||
// zgvdata
|
||||
// Check for string null, in case dropdown changed to default value
|
||||
$zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');
|
||||
$zgvort = $this->input->post('zgvort');
|
||||
$zgvdatum = $this->input->post('zgvdatum');
|
||||
$zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
|
||||
$zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
|
||||
$prestudent_id = $this->input->post('prestudentid');
|
||||
|
||||
//zgvmasterdata
|
||||
$zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
|
||||
$zgvmaort = $this->input->post('zgvmaort');
|
||||
$zgvmadatum = $this->input->post('zgvmadatum');
|
||||
$zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
|
||||
$zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
|
||||
|
||||
$result = $this->PrestudentModel->update(
|
||||
$prestudent_id,
|
||||
array(
|
||||
'zgv_code' => $zgv_code,
|
||||
'zgvort' => $zgvort,
|
||||
'zgvdatum' => $zgvdatum,
|
||||
'zgvnation' => $zgvnation_code,
|
||||
'zgvmas_code' => $zgvmas_code,
|
||||
'zgvmaort' => $zgvmaort,
|
||||
'zgvmadatum' => $zgvmadatum,
|
||||
'zgvmanation' => $zgvmanation_code,
|
||||
'updateamum' => date('Y-m-d H:i:s')
|
||||
)
|
||||
);
|
||||
|
||||
if (isError($result))
|
||||
if (empty($prestudent_id))
|
||||
$result = error('Prestudentid missing');
|
||||
else
|
||||
{
|
||||
show_error($result->retval);
|
||||
// zgvdata
|
||||
// Check for string null, in case dropdown changed to default value
|
||||
$zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');
|
||||
$zgvort = $this->input->post('zgvort');
|
||||
$zgvdatum = $this->input->post('zgvdatum');
|
||||
$zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d');
|
||||
$zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation');
|
||||
|
||||
//zgvmasterdata
|
||||
$zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas');
|
||||
$zgvmaort = $this->input->post('zgvmaort');
|
||||
$zgvmadatum = $this->input->post('zgvmadatum');
|
||||
$zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d');
|
||||
$zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation');
|
||||
|
||||
$result = $this->PrestudentModel->update(
|
||||
$prestudent_id,
|
||||
array(
|
||||
'zgv_code' => $zgv_code,
|
||||
'zgvort' => $zgvort,
|
||||
'zgvdatum' => $zgvdatum,
|
||||
'zgvnation' => $zgvnation_code,
|
||||
'zgvmas_code' => $zgvmas_code,
|
||||
'zgvmaort' => $zgvmaort,
|
||||
'zgvmadatum' => $zgvmadatum,
|
||||
'zgvmanation' => $zgvmanation_code,
|
||||
'updateamum' => date('Y-m-d H:i:s')
|
||||
)
|
||||
);
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
//get extended Prestudent data for logging
|
||||
$logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
|
||||
|
||||
$this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id));
|
||||
}
|
||||
}
|
||||
|
||||
//get extended Prestudent data for logging
|
||||
$logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id);
|
||||
|
||||
$this->_log($logdata['person_id'], 'savezgv', array($logdata['studiengang_kurzbz'], $prestudent_id));
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($result->retval));
|
||||
->set_output(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,6 +334,7 @@ class InfoCenter extends FHC_Controller
|
||||
public function saveAbsage($prestudent_id)
|
||||
{
|
||||
$statusgrund = $this->input->post('statusgrund');
|
||||
$this->fhc_controller_id = $this->input->post('fhc_controller_id');
|
||||
|
||||
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
|
||||
@@ -420,7 +445,8 @@ class InfoCenter extends FHC_Controller
|
||||
|
||||
$result = $this->DokumentprestudentModel->setAcceptedDocuments($prestudent_id, $dokument_kurzbzs);
|
||||
|
||||
if (isError($result))
|
||||
//returns null if no documents to accept
|
||||
if ($result !== null && isError($result))
|
||||
{
|
||||
show_error($result->retval);
|
||||
}
|
||||
@@ -446,16 +472,14 @@ class InfoCenter extends FHC_Controller
|
||||
|
||||
$result = $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->uid);
|
||||
|
||||
if (isError($result))
|
||||
if (isSuccess($result))
|
||||
{
|
||||
show_error($result->retval);
|
||||
$this->_log($person_id, 'savenotiz', array($titel));
|
||||
}
|
||||
|
||||
$this->_log($person_id, 'savenotiz', array($titel));
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($result->retval));
|
||||
->set_output(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,20 +504,15 @@ class InfoCenter extends FHC_Controller
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$json = FALSE;
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$json = TRUE;
|
||||
|
||||
//set log "Notiz updated"
|
||||
$this->_log($person_id, 'updatenotiz', array($titel));
|
||||
}
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($json));
|
||||
->set_output(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -550,6 +569,69 @@ class InfoCenter extends FHC_Controller
|
||||
->_display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the date until which a person is parked
|
||||
* @param $person_id
|
||||
*/
|
||||
public function getParkedDate($person_id)
|
||||
{
|
||||
$result = $this->personloglib->getParkedDate($person_id);
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes parking of a person, i.e. a person is not expected to do any actions while parked
|
||||
*/
|
||||
public function park()
|
||||
{
|
||||
$person_id = $this->input->post('person_id');
|
||||
$date = $this->input->post('parkdate');
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes parking of a person
|
||||
*/
|
||||
public function unPark()
|
||||
{
|
||||
$person_id = $this->input->post('person_id');
|
||||
|
||||
$result = $this->personloglib->unPark($person_id);
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the End date of the current Studienjahr
|
||||
*/
|
||||
public function getStudienjahrEnd()
|
||||
{
|
||||
$this->load->model('organisation/studienjahr_model', 'StudienjahrModel');
|
||||
|
||||
$result = $this->StudienjahrModel->getCurrStudienjahr();
|
||||
|
||||
$json = false;
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$json = $result->retval[0]->ende;
|
||||
}
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
@@ -607,13 +689,13 @@ class InfoCenter extends FHC_Controller
|
||||
$filtersarray = array(
|
||||
'abgeschickt' => array(
|
||||
'link' => '#',
|
||||
'description' => 'Abgeschickt',
|
||||
'description' => ucfirst($this->p->t('global', 'abgeschickt')),
|
||||
'expand' => true,
|
||||
'children' => array()
|
||||
),
|
||||
'nichtabgeschickt' => array(
|
||||
'link' => '#',
|
||||
'description' => 'Nicht abgeschickt',
|
||||
'description' => ucfirst($this->p->t('global', 'nichtAbgeschickt')),
|
||||
'expand' => true,
|
||||
'children' => array()
|
||||
)
|
||||
@@ -660,14 +742,26 @@ class InfoCenter extends FHC_Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for setNavigationMenu, returns JSON message
|
||||
*/
|
||||
public function setNavigationMenuArrayJson()
|
||||
{
|
||||
$this->setNavigationMenuArray();
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
->set_output(json_encode(success('success')));
|
||||
}
|
||||
|
||||
private function _fillFilters($filters, &$tofill)
|
||||
{
|
||||
foreach ($filters as $filterId => $description)
|
||||
{
|
||||
$toPrint = "%s?%s=%s&%s=%s";
|
||||
$toPrint = "%s?%s=%s";
|
||||
|
||||
$tofill['children'][] = array(
|
||||
'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId, 'fhc_controller_id', $this->fhc_controller_id),
|
||||
'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId),
|
||||
'description' => $description
|
||||
);
|
||||
}
|
||||
@@ -677,13 +771,13 @@ class InfoCenter extends FHC_Controller
|
||||
{
|
||||
foreach ($filters as $filterId => $description)
|
||||
{
|
||||
$toPrint = "%s?%s=%s&%s=%s";
|
||||
$toPrint = "%s?%s=%s";
|
||||
|
||||
$tofill['children'][] = array(
|
||||
'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId, 'fhc_controller_id', $this->fhc_controller_id),
|
||||
'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter'), 'filter_id', $filterId),
|
||||
'description' => $description,
|
||||
'subscriptDescription' => 'Remove',
|
||||
'subscriptLinkClass' => 'remove-filter',
|
||||
'subscriptLinkClass' => 'remove-custom-filter',
|
||||
'subscriptLinkValue' => $filterId
|
||||
);
|
||||
}
|
||||
@@ -769,7 +863,7 @@ class InfoCenter extends FHC_Controller
|
||||
show_error($user_person->retval);
|
||||
}
|
||||
|
||||
$messagelink = base_url('/index.ci.php/system/Messages/write/'.$user_person->retval[0]->person_id);
|
||||
$messagelink = site_url('/system/Messages/write/'.$user_person->retval[0]->person_id);
|
||||
|
||||
$data = array (
|
||||
'lockedby' => $lockedby,
|
||||
@@ -871,7 +965,7 @@ 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.'#'.$section);
|
||||
redirect(self::URL_PREFIX.'/showDetails/'.$person_id.'?fhc_controller_id='.$this->fhc_controller_id.'#'.$section);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -905,15 +999,20 @@ class InfoCenter extends FHC_Controller
|
||||
{
|
||||
$logdata = $this->logparams[$logname];
|
||||
|
||||
$datatolog = array(
|
||||
'name' => $logdata['name']
|
||||
);
|
||||
|
||||
if (isset($logdata['message']))
|
||||
$datatolog['message'] = vsprintf($logdata['message'], $messageparams);
|
||||
|
||||
if (array_key_exists('success', $logdata))
|
||||
$datatolog['success'] = true;
|
||||
|
||||
$this->personloglib->log(
|
||||
$person_id,
|
||||
$logdata['logtype'],
|
||||
array(
|
||||
'name' => $logdata['name'],
|
||||
'message' => vsprintf($logdata['message'],
|
||||
$messageparams),
|
||||
'success' => 'true'
|
||||
),
|
||||
$datatolog,
|
||||
self::TAETIGKEIT,
|
||||
self::APP,
|
||||
null,
|
||||
@@ -1019,7 +1118,7 @@ class InfoCenter extends FHC_Controller
|
||||
if (!empty($receiver))
|
||||
{
|
||||
//Freigabeinformationmail sent from default system mail to studiengang mail(s)
|
||||
$sent = $this->maillib->send('', $receiver, $subject, $email);
|
||||
$sent = $this->maillib->send('', $receiver, $subject, $email, '', null, null, 'Bitte sehen Sie sich die Nachricht in HTML Sicht an, um den Inhalt vollständig darzustellen.');
|
||||
|
||||
if (!$sent)
|
||||
$this->loglib->logError('Error when sending Freigabe mail');
|
||||
@@ -1029,21 +1128,4 @@ class InfoCenter extends FHC_Controller
|
||||
$this->loglib->logError('Studiengang has no mail for sending Freigabe mail');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the unique id for the called controller
|
||||
*/
|
||||
private function _setControllerId()
|
||||
{
|
||||
$fhc_controller_id = $this->input->get('fhc_controller_id');
|
||||
|
||||
if (!isset($fhc_controller_id) || empty($fhc_controller_id))
|
||||
{
|
||||
$fhc_controller_id = uniqid();
|
||||
header('Location: '.$_SERVER['REQUEST_URI'].'?fhc_controller_id='.$fhc_controller_id);
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->fhc_controller_id = $fhc_controller_id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user