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:
Paolo
2018-06-08 17:53:12 +02:00
109 changed files with 9580 additions and 4707 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ if (! defined('BASEPATH'))
*
*/
class DBTools extends FHC_Controller
class DBTools extends Auth_Controller
{
private $cli = false;
/**
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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 -1
View File
@@ -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()
+1 -1
View File
@@ -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
{
/**
+202 -521
View File
@@ -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;
}
}
+8 -1
View File
@@ -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';
+1 -1
View File
@@ -2,7 +2,7 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Phrases extends FHC_Controller
class Phrases extends Auth_Controller
{
/**
*
+1 -1
View File
@@ -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()
{
+1 -1
View File
@@ -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;
}
}
+38
View File
@@ -0,0 +1,38 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class Auth_Controller extends FHC_Controller
{
/**
* Extends this controller if authentication is required
*/
public function __construct($requiredPermissions)
{
parent::__construct();
// Loads authentication helper
$this->load->helper('fhcauth');
// Checks if the caller is allowed to access to this content
$this->_isAllowed($requiredPermissions);
}
/**
* Checks if the caller is allowed to access to this content with the given permissions
* If it is not allowed will set the HTTP header with code 401
* Wrapper for _checkPermissions
*/
private function _isAllowed($requiredPermissions)
{
// Loads permission lib
$this->load->library('PermissionLib');
if (!$this->permissionlib->isEntitled($requiredPermissions, $this->router->method))
{
header('HTTP/1.0 401 Unauthorized');
echo 'You are not allowed to access to this content';
exit;
}
}
}
+81 -25
View File
@@ -4,45 +4,101 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
class FHC_Controller extends CI_Controller
{
const FHC_CONTROLLER_ID = 'fhc_controller_id'; // name of the parameter used to identify uniquely a call to a controller
private $_controllerId; // contains the unique identifier of a call to a controller
/**
* Standard construct for all the controllers, loads the authentication system
* Checks the caller permissions
* Standard construct for all the controllers
*/
public function __construct($requiredPermissions)
public function __construct()
{
parent::__construct();
// Loads authentication helper
$this->load->helper('fhcauth');
// Loads permission lib
$this->load->library('PermissionLib');
$this->_isAllowed($requiredPermissions);
// Set _controllerId as null by default
$this->_controllerId = null;
}
/**
* Checks if the caller is allowed to access to this content with the given permissions
* If it is not allowed will set the HTTP header with code 401
* Wrapper for _checkPermissions
*/
private function _isAllowed($requiredPermissions)
{
if (!$this->permissionlib->isEntitled($requiredPermissions, $this->router->method))
{
header('HTTP/1.0 401 Unauthorized');
echo 'You are not allowed to access to this content';
exit;
}
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Wrapper to load phrases using the PhrasesLib
* NOTE: The library is loaded with the alias 'p', so must me used with this alias in the rest of the code.
* EX: $this->p->t(<category>, <phrase name>)
*/
public function loadPhrases($categories, $language = null)
protected function loadPhrases($categories, $language = null)
{
$this->load->library('PhrasesLib', array($categories, $language), 'p');
}
//------------------------------------------------------------------------------------------------------------------
// Protected methods
/**
* Sets the unique id for the called controller
* NOTE: it is only working with HTTP GET request, not neeaded with POST
* because the first call to the controller is via HTTP GET,
* therefore a fhc_controller_id is already generated
*/
protected function setControllerId()
{
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
$this->_controllerId = $this->input->get(self::FHC_CONTROLLER_ID);
if (!isset($this->_controllerId) || empty($this->_controllerId))
{
$this->_controllerId = uniqid(); // generate a unique id
// Redirect to the same URL, but giving FHC_CONTROLLER_ID as HTTP GET parameter
header(
sprintf(
'Location: %s%s%s=%s',
$_SERVER['REQUEST_URI'],
strpos($_SERVER['REQUEST_URI'], '?') === false ? '?' : '&', // place the corret character to divide parameters
self::FHC_CONTROLLER_ID,
$this->_controllerId
)
);
exit; // terminate immediately the execution of this controller
}
}
}
/**
* Return the value of the property _controllerId
*/
protected function getControllerId()
{
return $this->_controllerId;
}
/**
* Utility method to output a success using JSON as content type
* Wraps the private method _outputJson
*/
protected function outputJsonSuccess($mixed)
{
$this->_outputJson(success($mixed));
}
/**
* Utility method to output an error using JSON as content type
* Wraps the private method _outputJson
*/
protected function outputJsonError($mixed)
{
$this->_outputJson(error($mixed));
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Utility method to output using JSON as content type
*/
private function _outputJson($mixed)
{
$this->output->set_content_type('application/json')->set_output(json_encode($mixed));
}
}
+13 -2
View File
@@ -57,8 +57,19 @@ class DocumentLib
case 'application/vnd.ms-word':
case 'application/vnd.oasis.opendocument.text':
case 'text/plain':
$this->convert($filename, $outFile, 'pdf');
return success($outFile);
// Unoconv Version 0.6 seems to fail on converting TXT Files
if ($this->unoconv_version == '0.6')
return error();
$ret = $this->convert($filename, $outFile, 'pdf');
if(isSuccess($ret))
{
return success($outFile);
}
else
{
return error($ret->retval);
}
case 'application/pdf':
return success($filename);
default:
+864
View File
@@ -0,0 +1,864 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* FilterWidget logic
*/
class FiltersLib
{
// Session parameters names
const SESSION_NAME = 'FHC_FILTER_WIDGET'; // Filter session name
const SESSION_FILTER_NAME = 'filterName';
const SESSION_FIELDS = 'fields';
const SESSION_SELECTED_FIELDS = 'selectedFields';
const SESSION_COLUMNS_ALIASES = 'columnsAliases';
const SESSION_ADDITIONAL_COLUMNS = 'additionalColumns';
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';
// Alias for the dynamic table used to retrive the dataset
const DATASET_TABLE_ALIAS = 'datasetFilterTable';
// Parameters names...
// ...to identify a single filter widget in the session
const FHC_CONTROLLER_ID = 'fhc_controller_id';
// ...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';
// ...to specify permissions that are needed to use this FilterWidget
const REQUIRED_PERMISSIONS_PARAMETER = 'requiredPermissions';
// ...stament to retrive the dataset
const QUERY_PARAMETER = 'query';
// ...to specify more columns or aliases for them
const ADDITIONAL_COLUMNS = 'additionalColumns';
const CHECKBOXES = 'checkboxes';
const COLUMNS_ALIASES = 'columnsAliases';
// ...to format/mark records of a dataset
const FORMAT_ROW = 'formatRow';
const MARK_ROW = 'markRow';
// ...to hide the options for a filter
const HIDE_HEADER = 'hideHeader';
const HIDE_SAVE = 'hideSave';
// Filter operations values
const OP_EQUAL = 'equal';
const OP_NOT_EQUAL = 'nequal';
const OP_GREATER_THAN = 'gt';
const OP_LESS_THAN = 'lt';
const OP_IS_TRUE = 'true';
const OP_IS_FALSE = 'false';
const OP_CONTAINS = 'contains';
const OP_NOT_CONTAINS = 'ncontains';
const OP_SET = 'set';
const OP_NOT_SET = 'nset';
// Filter options values
const OPT_DAYS = 'days';
const OPT_MONTHS = 'months';
const FILTER_PHRASES_CATEGORY = 'FilterWidget'; // The category used to store phrases for the FilterWidget
const FILTER_PAGE_PARAM = 'filter_page'; // Filter page parameter used to overwrite the page URI
const PERMISSION_FILTER_METHOD = 'FilterWidget'; // Name for fake method to be checked by the PermissionLib
const PERMISSION_TYPE = 'rw';
private $_ci; // Code igniter instance
private $_filterUniqueId; // unique id for this filter widget
/**
* Gets the CI instance and loads message helper
*/
public function __construct($params = null)
{
$this->_ci =& get_instance();
// Loads helper message to manage returning messages
$this->_ci->load->helper('message');
$this->_filterUniqueId = $this->_getFilterUniqueId($params); // sets the id for the related filter widget
}
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* Checks if at least one of the permissions given as parameter (requiredPermissions) belongs
* to the authenticated user, if confirmed then is allowed to use this FilterWidget.
* If the parameter requiredPermissions is NOT given, then no one is allow to use this FilterWidget
*/
public function isAllowed($requiredPermissions = null)
{
$this->_ci->load->library('PermissionLib'); // Load permission library
$isAllowed = false; // by default is not allowed
// 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 the parameter requiredPermissions is NOT given, then no one is allow to use this FilterWidget
if ($rq != null)
{
// If requiredPermissions is NOT an array then converts it to an array
if (!is_array($rq))
{
$rq = array($rq);
}
// Checks if at least one of the permissions given as parameter belongs to the authenticated user...
for ($p = 0; $p < count($rq); $p++)
{
$isAllowed = $this->_ci->permissionlib->isEntitled(
array(
self::PERMISSION_FILTER_METHOD => $rq[$p].':'.self::PERMISSION_TYPE
),
self::PERMISSION_FILTER_METHOD
);
if ($isAllowed) break; // ...if confirmed then is allowed to use this FilterWidget
}
}
return $isAllowed;
}
/**
* Returns the whole session for this filter widget if found, otherwise null
*/
public function getSession()
{
$session = null;
// If it is present a session for this filter
if (isset($_SESSION[self::SESSION_NAME]) && isset($_SESSION[self::SESSION_NAME][$this->_filterUniqueId]))
{
$session = $_SESSION[self::SESSION_NAME][$this->_filterUniqueId];
}
return $session;
}
/**
* Returns one element from the session of this filter widget, otherwise null
*/
public function getElementSession($name)
{
$session = $this->getSession(); // get the whole session for this filter
if (isset($session[$name]))
{
return $session[$name];
}
return null;
}
/**
* Sets the whole session for this filter widget
*/
public function setSession($data)
{
// If is NOT already present into the session
if (!isset($_SESSION[self::SESSION_NAME])
|| (isset($_SESSION[self::SESSION_NAME]) && !is_array($_SESSION[self::SESSION_NAME])))
{
$_SESSION[self::SESSION_NAME] = array(); // then create it
}
$_SESSION[self::SESSION_NAME][$this->_filterUniqueId] = $data; // stores data
}
/**
* Sets one element of the session of this filter widget
*/
public function setElementSession($name, $value)
{
// If is NOT already present into the session
if (!isset($_SESSION[self::SESSION_NAME])
|| (isset($_SESSION[self::SESSION_NAME]) && !is_array($_SESSION[self::SESSION_NAME])))
{
$_SESSION[self::SESSION_NAME] = array(); // then create it
}
// If the session for this filter is NOT already present into the session
if (!isset($_SESSION[self::SESSION_NAME][$this->_filterUniqueId])
|| (isset($_SESSION[self::SESSION_NAME][$this->_filterUniqueId])
&& !is_array($_SESSION[self::SESSION_NAME][$this->_filterUniqueId])))
{
$_SESSION[self::SESSION_NAME][$this->_filterUniqueId] = array(); // then create it
}
$_SESSION[self::SESSION_NAME][$this->_filterUniqueId][$name] = $value; // stores the single value
}
/**
* Loads the definition data from DB for a filter widget
*/
public function loadDefinition($filterId, $app, $datasetName, $filterKurzbz)
{
// Loads the needed models
$this->_ci->load->model('system/Filters_model', 'FiltersModel');
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel'); // to get the default custom filter
$this->_ci->FiltersModel->resetQuery(); // reset any previous built query
$this->_ci->FiltersModel->addJoin('public.tbl_benutzer', 'person_id', 'LEFT'); // left join with benutzer table
$this->_ci->FiltersModel->addSelect('system.tbl_filters.*'); // select only from table filters
$this->_ci->FiltersModel->addOrder('sort', 'ASC'); // sort on column sort
$this->_ci->FiltersModel->addLimit(1); // if more than one filter is set as default only one will be retrived
$definition = null;
$whereParameters = null; // where clause parameters
// If we have a good filterId then use it!
if ($filterId != null && is_numeric($filterId) && $filterId > 0)
{
$whereParameters = array(
'filter_id' => $filterId
);
}
else
{
// If we can univocally retrive a filter
if ($app != null && $datasetName != null && $filterKurzbz != null)
{
$whereParameters = array(
'app' => $app,
'dataset_name' => $datasetName,
'filter_kurzbz' => $filterKurzbz
);
}
// Else if we have only app and datasetName
elseif ($app != null && $datasetName != null && $filterKurzbz == null)
{
// Try to load the custom filter (person_id = logged user person_id) with the given "app" and "dataset_name"
// that is set as default filter (default_filter = true)
$whereParameters = array(
'app' => $app,
'dataset_name' => $datasetName,
'uid' => getAuthUID(),
'default_filter' => true
);
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
if (!hasData($definition)) // If a custom filter is NOT found
{
// Try to load the global filter (person_id = null) with the given "app" and "dataset_name" that is set as
// default filter (default_filter = true)
$whereParameters = array(
'app' => $app,
'dataset_name' => $datasetName,
'default_filter' => true
);
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
}
}
}
// If no definition where loaded and where parameters were set
if ($definition == null && $whereParameters != null)
{
$definition = $this->_ci->FiltersModel->loadWhere($whereParameters);
}
return $definition;
}
/**
* Checks if the json definition of this filter is valid
*/
public function parseFilterJson($definition)
{
$jsonEncodedFilter = null;
// If the definition contains data and they are valid
if (hasData($definition) && isset($definition->retval[0]->filter) && trim($definition->retval[0]->filter) != '')
{
// Get the json definition of the filter
$tmpJsonEncodedFilter = json_decode($definition->retval[0]->filter);
// Checks required filter's properies
if (isset($tmpJsonEncodedFilter->name)
&& isset($tmpJsonEncodedFilter->columns)
&& is_array($tmpJsonEncodedFilter->columns)
&& isset($tmpJsonEncodedFilter->filters)
&& is_array($tmpJsonEncodedFilter->filters))
{
$jsonEncodedFilter = $tmpJsonEncodedFilter;
}
}
return $jsonEncodedFilter;
}
/**
* Generate the query to retrive the dataset for a filter
*/
public function generateDatasetQuery($query, $filters)
{
$datasetQuery = null;
// If the given query is valid and the parameter filters is an array
if (!empty(trim($query)) && $filters != null && is_array($filters))
{
$where = ''; // starts building the SQL where clause
// Loops through the given applied filters
for ($filtersCounter = 0; $filtersCounter < count($filters); $filtersCounter++)
{
$filterDefinition = $filters[$filtersCounter]; // definition of one filter
if ($filtersCounter > 0) $where .= ' AND '; // if it's NOT the last one
if (!empty(trim($filterDefinition->name))) // if the name of the applied filter is valid
{
// ...build the condition
$where .= '"'.$filterDefinition->name.'"'.$this->_getDatasetQueryCondition($filterDefinition);
}
}
if ($where != '') // if the SQL where clause was built
{
$datasetQuery = 'SELECT * FROM ('.$query.') '.self::DATASET_TABLE_ALIAS.' WHERE '.$where;
}
}
return $datasetQuery;
}
/**
* Retrives the dataset from the DB
*/
public function getDataset($datasetQuery)
{
$dataset = null;
if ($datasetQuery != null)
{
// Execute the given SQL statement suppressing error messages
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery);
}
return $dataset;
}
/**
* Get the filter name, the default is the "name" property of the JSON definition
* If the property namePhrase is present into the JSON definition, then try to load that from the phrases system
* NOTE: filterJson should be already checked using the method parseFilterJson
*/
public function getFilterName($filterJson)
{
$filterName = $filterJson->name; // always present, used as default
// Filter name from phrases system
if (isset($filterJson->namePhrase) && !empty(trim($filterJson->namePhrase)))
{
// Loads the library to use the phrases system
$this->_ci->load->library('PhrasesLib', array(self::FILTER_PHRASES_CATEGORY));
$tmpFilterNamePhrase = $this->_ci->phraseslib->t(self::FILTER_PHRASES_CATEGORY, $filterJson->namePhrase);
if (isset($tmpFilterNamePhrase) && !empty(trim($tmpFilterNamePhrase))) // if is not null or an empty string
{
$filterName = $tmpFilterNamePhrase;
}
}
return $filterName;
}
/**
* Change the sort of the selected fields of the current filter
*/
public function sortSelectedFields($selectedFields)
{
$sortSelectedFields = false;
// Checks the parameter selectedFields
if (isset($selectedFields) && is_array($selectedFields) && count($selectedFields) > 0)
{
// Retrives all the used fields by the current filter
$fields = $this->getElementSession(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
$sortSelectedFields = true;
}
}
return $sortSelectedFields;
}
/**
* Remove a selected field from the current filter
*/
public function removeSelectedField($selectedField)
{
$removeSelectedField = false;
// Checks the parameter selectedField
if (isset($selectedField) && !empty(trim($selectedField)))
{
// Retrives all the used fields by the current filter
$fields = $this->getElementSession(self::SESSION_FIELDS);
// Retrives the selected fields by the current filter
$selectedFields = $this->getElementSession(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))
{
// If the selected field is present in the list of the selected fields by the current filter
if (($pos = array_search($selectedField, $selectedFields)) !== false)
{
// Then remove it and shift the rest of elements by one if needed
array_splice($selectedFields, $pos, 1);
}
$this->setElementSession(self::SESSION_SELECTED_FIELDS, $selectedFields); // write changes into the session
$removeSelectedField = true;
}
}
return $removeSelectedField;
}
/**
* Add a field to the current filter
*/
public function addSelectedField($selectedField)
{
$removeSelectedField = false;
// Checks the parameter selectedField
if (isset($selectedField) && !empty(trim($selectedField)))
{
// Retrives all the used fields by the current filter
$fields = $this->getElementSession(self::SESSION_FIELDS);
// Retrives the selected fields by the current filter
$selectedFields = $this->getElementSession(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
$removeSelectedField = true;
}
}
return $removeSelectedField;
}
/**
* Remove an applied filter (SQL where condition) from the current filter
*/
public function removeAppliedFilter($appliedFilter)
{
$removeAppliedFilter = false;
// Checks the parameter appliedFilter
if (isset($appliedFilter) && !empty(trim($appliedFilter)))
{
// Retrives all the used fields by the current filter
$fields = $this->getElementSession(self::SESSION_FIELDS);
// Retrives the applied filters by the current filter
$filters = $this->getElementSession(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))
{
// Search in what position the given applied filter is
$pos = $this->_searchFilterByName($filters, $appliedFilter);
if ($pos !== false) // If found
{
array_splice($filters, $pos, 1); // Then remove it and shift the rest of elements by one if needed
}
// Write changes into the session
$this->setElementSession(self::SESSION_FILTERS, $filters);
$this->setElementSession(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
$removeAppliedFilter = true;
}
}
return $removeAppliedFilter;
}
/**
* Apply all the applied filters (SQL where conditions) to the current filter
*/
public function applyFilters($appliedFilters, $appliedFiltersOperations, $appliedFiltersConditions, $appliedFiltersOptions)
{
$applyFilters = false;
// Checks the required parameters: appliedFilters and appliedFiltersOperations
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
// Checks that the given applied filters are present in all the used fields by the current filter
if (!array_diff($appliedFilters, $fields))
{
$filters = array(); // starts building the new applied filters list
for ($i = 0; $i < count($appliedFilters); $i++) // loops through the given applied filters
{
$filterDefinition = new stdClass(); // new applied filter definition
// Sets the filter definition required properties
$filterDefinition->name = $appliedFilters[$i];
$filterDefinition->operation = $appliedFiltersOperations[$i];
// Sets the filter definition optional properties
$filterDefinition->condition = null;
if (isset($appliedFiltersConditions) && isset($appliedFiltersConditions[$i]))
{
$filterDefinition->condition = $appliedFiltersConditions[$i];
}
$filterDefinition->option = null;
if (isset($appliedFiltersOptions) && isset($appliedFiltersOptions[$i]))
{
$filterDefinition->option = $appliedFiltersOptions[$i];
}
$filters[$i] = $filterDefinition; // adds the new definition to the list
}
// Write changes into the session
$this->setElementSession(self::SESSION_FILTERS, $filters);
$this->setElementSession(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
$applyFilters = true;
}
}
return $applyFilters;
}
/**
* Add a filter (SQL where clause) to be applied to the current filter
*/
public function addFilter($filter)
{
$addFilter = false;
// Checks the parameter filter
if (isset($filter) && !empty(trim($filter)))
{
// Retrives all the used fields by the current filter
$fields = $this->getElementSession(self::SESSION_FIELDS);
// Retrives the applied filters by the current filter
$filters = $this->getElementSession(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))
{
// Search in what position the given applied filter is
$pos = $this->_searchFilterByName($filters, $filter);
if ($pos === false) // If NOT found then add it
{
// New filter definition
$filterDefinition = new stdClass();
// Sets filter definition required properties
$filterDefinition->name = $filter;
// Sets filter definition optional properties
$filterDefinition->operation = null;
$filterDefinition->condition = null;
$filterDefinition->option = null;
// Place the new applied filter at the end of the applied filters list
array_push($filters, $filterDefinition);
}
$this->setElementSession(self::SESSION_FILTERS, $filters); // write changes into the session
$addFilter = true;
}
}
return $addFilter;
}
/**
* Save the current filter as a custom filter for this user with the given description
*/
public function saveCustomFilter($customFilterDescription)
{
$saveCustomFilter = false; // by default returns a failure
// Checks parameter customFilterDescription if not valid stop the execution
if (!isset($customFilterDescription) || empty(trim($customFilterDescription)))
{
return $saveCustomFilter;
}
$this->_ci->load->model('system/Filters_model', 'FiltersModel'); // to load the filter definitions
$this->_ci->load->model('person/Benutzer_model', 'BenutzerModel'); // to get the person_id of the authenticated user
$this->_ci->FiltersModel->resetQuery(); // reset any previous built query
$this->_ci->BenutzerModel->resetQuery(); // reset any previous built query
// Loads data for the authenticated user
$authBenutzer = $this->_ci->BenutzerModel->loadWhere(array('uid' => getAuthUID()));
if (hasData($authBenutzer)) // if data are found
{
// person_id of the authenticated user
$authPersonId = $authBenutzer->retval[0]->person_id;
// Postgres array for the description
$descPGArray = str_replace('%desc%', $customFilterDescription, '{"%desc%", "%desc%", "%desc%", "%desc%"}');
// 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),
'description' => $descPGArray,
'person_id' => $authPersonId
));
// New definition to be json encoded
$jsonDeifinition = new stdClass();
$jsonDeifinition->name = $customFilterDescription; // name of the filter
// Generates the "column" property
$jsonDeifinition->columns = array();
$selectedFields = $this->getElementSession(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"
$jsonDeifinition->columns[$i] = new stdClass();
$jsonDeifinition->columns[$i]->name = $selectedFields[$i];
}
// List of applied filters
$jsonDeifinition->filters = $this->getElementSession(self::SESSION_FILTERS);
// If it is already present
if (hasData($definition))
{
// update it
$this->_ci->FiltersModel->update(
array(
'app' => $this->getElementSession(self::APP_PARAMETER),
'dataset_name' => $this->getElementSession(self::DATASET_NAME_PARAMETER),
'description' => $descPGArray,
'person_id' => $authPersonId
),
array(
'filter' => json_encode($jsonDeifinition)
)
);
$saveCustomFilter = true;
}
else // otherwise insert a new one
{
$this->_ci->FiltersModel->insert(
array(
'app' => $this->getElementSession(self::APP_PARAMETER),
'dataset_name' => $this->getElementSession(self::DATASET_NAME_PARAMETER),
'filter_kurzbz' => uniqid($authPersonId, true),
'description' => $descPGArray,
'person_id' => $authPersonId,
'sort' => null,
'default_filter' => false,
'filter' => json_encode($jsonDeifinition),
'oe_kurzbz' => null
)
);
$saveCustomFilter = true;
}
}
return $saveCustomFilter;
}
/**
* Remove a custom filter by its filter_id
*/
public function removeCustomFilter($filterId)
{
$removeCustomFilter = false;
// Checks the parameter filterId
if (isset($filterId) && is_numeric($filterId) && $filterId > 0)
{
$this->_ci->load->model('system/Filters_model', 'FiltersModel'); // to remove the filter definitions from DB
// delete it!
$this->_ci->FiltersModel->delete(array('filter_id' => $filterId));
$removeCustomFilter = true;
}
return $removeCustomFilter;
}
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Return an unique string that identify this filter widget
* NOTE: The default value is the URI where the FilterWidget is called
* If the fhc_controller_id is present then is also used
*/
private function _getFilterUniqueId($params)
{
//
if ($params != null
&& is_array($params)
&& isset($params[self::FILTER_PAGE_PARAM])
&& !empty(trim($params[self::FILTER_PAGE_PARAM])))
{
$filterUniqueId = $params[self::FILTER_PAGE_PARAM];
}
else
{
// Gets the current page URI
$filterUniqueId = $this->_ci->router->directory.$this->_ci->router->class.'/'.$this->_ci->router->method;
}
// If the FHC_CONTROLLER_ID parameter is present in the HTTP GET
if (isset($_GET[self::FHC_CONTROLLER_ID]))
{
$filterUniqueId .= '/'.$this->_ci->input->get(self::FHC_CONTROLLER_ID); // then use it
}
elseif (isset($_POST[self::FHC_CONTROLLER_ID])) // else if the FHC_CONTROLLER_ID parameter is present in the HTTP POST
{
$filterUniqueId .= '/'.$this->_ci->input->post(self::FHC_CONTROLLER_ID); // then use it
}
return $filterUniqueId;
}
/**
* Generates a condition for a SQL where clause using the given applied filter definition.
* By default an empty string is returned.
*/
private function _getDatasetQueryCondition($filterDefinition)
{
$condition = ''; // starts building the condition
// "operation" is a required property for the applied filter definition
if (!empty(trim($filterDefinition->operation)))
{
// Checks what operation is required
switch ($filterDefinition->operation)
{
// comparison (==)
case self::OP_EQUAL:
if (is_numeric($filterDefinition->condition)) $condition = '= '.$filterDefinition->condition;
break;
// not equal (!=)
case self::OP_NOT_EQUAL:
if (is_numeric($filterDefinition->condition)) $condition = '!= '.$filterDefinition->condition;
break;
// greater than (>)
case self::OP_GREATER_THAN:
// It it's a date type
if (is_numeric($filterDefinition->condition)
&& isset($filterDefinition->option)
&& ($filterDefinition->option == self::OPT_DAYS
|| $filterDefinition->option == self::OPT_MONTHS))
{
$condition = '< (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)';
}
else // otherwise is a number
{
$condition = '> '.$filterDefinition->condition;
}
break;
// less than (<)
case self::OP_LESS_THAN:
// It it's a date type
if (is_numeric($filterDefinition->condition)
&& isset($filterDefinition->option)
&& ($filterDefinition->option == self::OPT_DAYS
|| $filterDefinition->option == self::OPT_MONTHS))
{
$condition = '> (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)';
}
else // otherwise is a number
{
$condition = '< '.$filterDefinition->condition;
}
break;
// contains (ILIKE)
case self::OP_CONTAINS:
$condition = 'ILIKE \'%'.$this->_ci->FiltersModel->escapeLike($filterDefinition->condition).'%\'';
break;
// not contains (NOT ILIKE)
case self::OP_NOT_CONTAINS:
$condition = 'NOT ILIKE \'%'.$this->_ci->FiltersModel->escapeLike($filterDefinition->condition).'%\'';
break;
// is true (=== true)
case self::OP_IS_TRUE:
$condition = 'IS TRUE';
break;
// is false (=== false)
case self::OP_IS_FALSE:
$condition = 'IS FALSE';
break;
// is set
case self::OP_SET:
$condition = 'IS NOT NULL';
break;
// is NOT set
case self::OP_NOT_SET:
$condition = 'IS NULL';
break;
// by default must not be null (!= null)
default:
$condition = 'IS NOT NULL';
break;
}
}
// if the condition is valid
if (!empty(trim($condition))) $condition = ' '.$condition; // add a white space before
return $condition;
}
/**
* Search for a filter inside a list of filters by the given filter name
* Returns false if NOT found, otherwise the position inside the list
*/
private function _searchFilterByName($filters, $filterName)
{
$pos = false;
for($i = 0; $i < count($filters); $i++)
{
if ($filters[$i]->name == $filterName)
{
$pos = $i;
break;
}
}
return $pos;
}
}
+88
View File
@@ -7,6 +7,8 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
*/
class PersonLogLib
{
const PARKED_LOGNAME = 'Parked';
/**
* Constructor
*/
@@ -79,4 +81,90 @@ class PersonLogLib
else
show_error($result->retval);
}
/**
* Parks a person, i.e. marks a person so no actions are expected for the person (e.g. as a prestudent)
* Done by adding a logentry in the future
* @param $person_id
* @param $date
* @param $taetigkeit_kurzbz
* @param string $app
* @param null $oe_kurzbz
* @param null $user
* @return insert object
*/
public function park($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null)
{
$logdata = array(
'name' => self::PARKED_LOGNAME
);
$data = array(
'person_id' => $person_id,
'zeitpunkt' => $date,
'taetigkeit_kurzbz' => $taetigkeit_kurzbz,
'app' => $app,
'oe_kurzbz' => $oe_kurzbz,
'logtype_kurzbz' => 'Processstate',
'logdata' => json_encode($logdata),
'insertvon' => $user
);
return $this->ci->PersonLogModel->insert($data);
}
/**
* Unparks a person, i.e. removes all log entries in the future
* @param $person_id
* @return array with deleted logids
*/
public function unPark($person_id)
{
$result = $this->ci->PersonLogModel->getLogsInFuture($person_id);
$deleted = array();
if (hasData($result))
{
foreach ($result->retval as $log)
{
$logdata = json_decode($log->logdata);
if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
$delresult = $this->ci->PersonLogModel->deleteLog($log->log_id);
if (isSuccess($delresult))
$deleted[] = $log->log_id;
}
}
}
return $deleted;
}
/**
* Gets date until which a person is parked
* @param $person_id
* @return the date if person is parked, null otherwise
*/
public function getParkedDate($person_id)
{
$result = $this->ci->PersonLogModel->getLogsInFuture($person_id);
$parkeddate = null;
if (hasData($result))
{
foreach ($result->retval as $log)
{
$logdata = json_decode($log->logdata);
if (isset($logdata->name) && $logdata->name === self::PARKED_LOGNAME)
{
$parkeddate = $log->zeitpunkt;
break;
}
}
}
return $parkeddate;
}
}
+121 -20
View File
@@ -14,6 +14,8 @@ class PhrasesLib
{
$this->_ci =& get_instance();
$this->_phrases = null; // set the property _phrases as null by default
// CI parser
$this->_ci->load->library('parser');
@@ -78,7 +80,6 @@ class PhrasesLib
return $this->_ci->PhraseModel->update($phrase_id, $data);
}
/**
* getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template.
*/
@@ -179,28 +180,39 @@ class PhrasesLib
}
/**
*
* Retrives a phrases from the the property _phrases with the given parameters
* It also replace parameters inside the phrase if they are provided
* @param string $category Category name which is used to categorize the phrase.
* @param string $phrase Phrase name.
* @param array $parameters Array of String var(s) to be set into phrases' placeholder values (order matters).
* @return string Phrase text
*/
public function t($category, $phrase, $parameters = array(), $orgeinheit_kurzbz = null, $orgform_kurzbz = null)
{
if (isset($this->_phrases) && is_array($this->_phrases))
// If the property _phrases is populated
if (is_array($this->_phrases))
{
// Loops through the _phrases property
for ($i = 0; $i < count($this->_phrases); $i++)
{
$_phrase = $this->_phrases[$i];
$_phrase = $this->_phrases[$i]; // single phrase
// If the single phrase match the given parameters and is not an empty string
if ($_phrase->category == $category
&& $_phrase->phrase == $phrase
&& $_phrase->orgeinheit_kurzbz == $orgeinheit_kurzbz
&& $_phrase->orgform_kurzbz== $orgform_kurzbz)
&& $_phrase->orgform_kurzbz == $orgform_kurzbz
&& (!empty(trim($_phrase->text))))
{
if ($parameters == null) $parameters = array();
if (!is_array($parameters)) $parameters = array(); // if params is not an array
echo $this->_ci->parser->parse_string($_phrase->text, $parameters, true)."\n";
break;
return $this->_ci->parser->parse_string($_phrase->text, $parameters, true); // parsing
}
}
}
// If a valid phrase is not found
return '<< PHRASE '.$phrase.' >>';
}
// -----------------------------------------------------------------------------------------------------------------
@@ -209,16 +221,19 @@ class PhrasesLib
/**
* Extends the functionalities of the constructor of this class
* This is a workaround to use more parameters in the construct since PHP doesn't support many constructors
* The new accepted parameters are:
* - categories: could be a string or an array of strings. These are the categories used to load phrases
* - language: optional parameter must be a string. It's used to load phrases
* @param (array) $params Array of categories and (optional) language.
* categories:
* - could be a string or an array of strings. These are the categories used to load phrases
* - could be an array of categories, and for each category there is an array of phrases
* language: optional parameter must be a string. It's used to load phrases
*/
private function _extend_construct($params)
{
// Checks if the $params is an array with at least one element
if (is_array($params) && count($params) > 0)
{
$parameters = $params[0]; // temporary variable
$parameters = $params[0]; // temporary variable
$isIndexArray = false; //flag for indexed array
// If there are parameters
if (is_array($parameters) && count($parameters) > 0)
@@ -242,15 +257,101 @@ class PhrasesLib
$language = $this->_ci->PersonModel->getLanguage(getAuthUID());
}
// Loads phrases
$phrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndLanguage($categories, $language);
// If there are phrases loaded then store them in the property _phrases
if (hasData($phrases))
{
$this->_phrases = $phrases->retval;
}
// If only categories is not an empty array then loads phrases
if (count($categories) > 0) $this->_setPhrases($categories, $language);
}
}
}
/**
* Retrieves phrases in the users language.
* If a phrase is not set in the users language it will be retrieved in the default language.
* Stores phrases-array in property $_phrases.
* @param array $categories Could be an:
* - indexed array: string or an array of strings. These are the categories used to load phrases.
* - associative array: of categories, and for each category there is an array of phrases.
* @param string User's language or default language.
*/
private function _setPhrases($categories, $language)
{
$phrases = null;
// Checks if categories is associative or indexed array
if (ctype_digit(implode('', array_keys($categories))))
{
// is indexed array -> Loads phrases
$isIndexArray = true;
$phrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndLanguage($categories, $language);
}
else
{
// is assoc array -> Loads specific phrasentexte by category and phrases
$isIndexArray = false;
$phrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndPhrasesAndLanguage($categories, $language);
}
// If language is not default language and phrasentext is null -> fallback to default language
if ($language != DEFAULT_LANGUAGE)
{
// get array with phrasentexte in the default language
$defaultPhrases = null;
if ($isIndexArray)
{
$defaultPhrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndLanguage($categories, DEFAULT_LANGUAGE);
}
else
{
$defaultPhrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndPhrasesAndLanguage($categories, DEFAULT_LANGUAGE);
}
// combine array with phrasentexte in users language and in default language
// (default used if phrasentext in users language is null or not set)
if (hasData($phrases) && hasData($defaultPhrases))
{
// loop through phrases in default language
foreach ($defaultPhrases->retval as $defaultPhrase)
{
$found = false; // flag for found phrase
// loop through phrases in users language
foreach ($phrases->retval as $phrase)
{
// if same phrase and category found and text is not null
// use phrase in users language
if ($phrase->phrase == $defaultPhrase->phrase
&& $phrase->category == $defaultPhrase->category
&& !is_null($phrase->text))
{
$found = true;
break;
}
}
// otherwise use phrase in default language
if (!$found)
{
array_push($phrases->retval, $defaultPhrase);
}
}
}
elseif (hasData($defaultPhrases))
{
$phrases = $defaultPhrases;
}
}
// If there are phrases loaded then store them in the property _phrases
if (hasData($phrases))
{
$this->_phrases = $phrases->retval;
}
}
/**
* Returns the property _phrases JSON encoded
* @return json encoded property _phrases
*/
public function getJSON()
{
return json_encode($this->_phrases);
}
}
@@ -21,7 +21,9 @@ class Geschaeftsjahr_model extends DB_Model
$query = 'SELECT *
FROM public.tbl_geschaeftsjahr
WHERE start <= now()
AND ende >= now()';
AND ende >= now()
ORDER BY start DESC
LIMIT 1';
return $this->execQuery($query);
}
@@ -12,4 +12,21 @@ class Studienjahr_model extends DB_Model
$this->pk = 'studienjahr_kurzbz';
$this->hasSequence = false;
}
/**
* Gets current Studienjahr, as determined by its start and enddate
* @return array|null
*/
public function getCurrStudienjahr()
{
$query = 'SELECT *
FROM public.tbl_studienjahr
JOIN public.tbl_studiensemester using(studienjahr_kurzbz)
WHERE start <= now()
AND ende >= now()
ORDER by start DESC
LIMIT 1';
return $this->execQuery($query);
}
}
@@ -44,7 +44,6 @@ class Filters_model extends DB_Model
$filterParametersArray = array(
'app' => $app,
'dataset_name' => $dataset_name,
'default_filter' => false,
'array_length(description, 1) >' => 0,
'uid' => $uid
);
@@ -80,4 +80,36 @@ class PersonLog_model extends CI_Model
return success($result->result());
}
/**
* Gets all logs with zeitpunkt > today
* @param $person_id
* @return array
*/
public function getLogsInFuture($person_id)
{
$this->db->order_by('zeitpunkt', 'DESC');
$this->db->order_by('log_id', 'DESC');
$where = "logtype_kurzbz = 'Processstate'
AND person_id=".$this->db->escape($person_id)."
AND zeitpunkt >= now()";
$result = $this->db->get_where($this->dbTable, $where);
return success($result->result());
}
/**
* Deletes a log
* @param $log_id
* @return array
*/
public function deleteLog($log_id)
{
$this->db->where('log_id', $log_id);
$result = $this->db->delete($this->dbTable);
return success($result);
}
}
@@ -71,4 +71,32 @@ class Phrase_model extends DB_Model
return $this->execQuery($query, array($categories, $language));
}
/**
* Loads phrases using category(s) and language as keys using associative category array
* that contains also phrases for each category
*/
public function getPhrasesByCategoryAndPhrasesAndLanguage($phrasesParams, $language)
{
$query = '
SELECT p.category, p.phrase, pt.orgeinheit_kurzbz, pt.orgform_kurzbz, pt.text
FROM system.tbl_phrase p
INNER JOIN system.tbl_phrasentext pt USING(phrase_id)
WHERE pt.sprache = ? AND ';
$parametersArray = array($language);
foreach ($phrasesParams as $category => $phrases)
{
$query .= '(category = ? AND phrase IN ?) OR ';
$parametersArray[] = $category;
$parametersArray[] = $phrases;
}
$query = rtrim($query, ' OR ');
$query .= ' ORDER BY p.category, p.phrase, pt.orgeinheit_kurzbz DESC, pt.orgform_kurzbz DESC';
return $this->execQuery($query, $parametersArray);
}
}
+3 -1
View File
@@ -5,7 +5,9 @@ $this->load->view('templates/FHC-Header',
'jquery' => true,
'bootstrap' => true,
'fontawesome' => true,
'sbadmintemplate' => true
'sbadmintemplate' => true,
'ajaxlib' => true,
'navigationwidget' => true
)
);
?>
@@ -2,11 +2,11 @@
<input type="hidden" name="hiddenNotizId" value="">
<div class="form-group">
<div class="text-center">
<label>Notiz hinzuf&uuml;gen</label>
<label><?php echo $this->p->t('infocenter', 'notizHinzufuegen') ?></label>
</div>
<div>
<div class="form-group">
<label>Titel: </label>
<label><?php echo ucfirst($this->p->t('global', 'titel')) . ': ' ?></label>
<div class="input-group">
<input id="inputNotizTitel" type="text" class="form-control" name="notiztitel"/>
<div class="input-group-addon" onclick="document.getElementById('inputNotizTitel').value='Anmerkung zur Bewerbung'">
@@ -21,8 +21,9 @@
</div>
<div class="text-right">
<!--abbrechen-button only shown when notice is clicked to be changed-->
<button type="reset" class="btn btn-default" style="display: none">Abbrechen</button>
<button type="submit" class="btn btn-default">Speichern</button>
<span class="text-danger" id="notizmsg"></span>
<button type="reset" class="btn btn-default" style="display: none"><?php echo $this->p->t('ui', 'abbrechen') ?></button>
<button type="submit" class="btn btn-default"><?php echo $this->p->t('ui', 'speichern') ?></button>
</div>
</div>
</form>
</form>
@@ -5,7 +5,7 @@
<table class="table-bordered" align="center" width="100%">
<thead>
<tr>
<th colspan="2" class="text-center">Anmerkungen zur Bewerbung</th>
<th colspan="2" class="text-center"><?php echo ucfirst($this->p->t('infocenter','anmerkungenZurBewerbung')) ?></th>
</tr>
</thead>
<tbody>
@@ -2,11 +2,11 @@
<table id="doctable" class="table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Typ</th>
<th>Uploaddatum</th>
<th>Ausstellungsnation</th>
<th>Formal gepr&uuml;ft</th>
<th><?php echo ucfirst($this->p->t('global','name')) ?></th>
<th><?php echo ucfirst($this->p->t('global','typ')) ?></th>
<th><?php echo ucfirst($this->p->t('global','uploaddatum')) ?></th>
<th><?php echo ucfirst($this->p->t('infocenter','ausstellungsnation')) ?></th>
<th><?php echo ucfirst($this->p->t('infocenter','formalGeprueft')) ?></th>
</tr>
</thead>
<tbody>
@@ -35,14 +35,14 @@
</div>
<?php if (count($dokumente_nachgereicht) > 0): ?>
<br/>
<p>Nachzureichende Dokumente:</p>
<p><?php echo ucfirst($this->p->t('infocenter','nachzureichendeDokumente')) ?></p>
<table id="nachgdoctable" class="table table-bordered">
<thead>
<tr>
<th>Typ</th>
<th>Nachzureichen am</th>
<th>Ausstellungsnation</th>
<th>Anmerkung</th>
<th><?php echo ucfirst($this->p->t('global','typ')) ?></th>
<th><?php echo ucfirst($this->p->t('infocenter','nachzureichenAm')) ?></th>
<th><?php echo ucfirst($this->p->t('infocenter','ausstellungsnation')) ?></th>
<th><?php echo ucfirst($this->p->t('global','anmerkung')) ?></th>
</tr>
</thead>
<tbody>
@@ -5,10 +5,18 @@
'title' => 'Info Center',
'jquery' => true,
'jqueryui' => true,
'ajaxlib' => true,
'bootstrap' => true,
'fontawesome' => true,
'sbadmintemplate' => true,
'tablesorter' => true,
'filterwidget' => true,
'phrases' => array(
'person' => array('vorname', 'nachname'),
'global' => array('mailAnXversandt'),
'ui' => array('bitteEintragWaehlen')
),
'navigationwidget' => true,
'customCSSs' => 'public/css/sbadmin2/tablesort_bootstrap.css',
'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js')
)
@@ -24,12 +32,17 @@
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">Infocenter &Uuml;bersicht</h3>
<h3 class="page-header">Infocenter
<?php echo ucfirst($this->p->t('global', 'uebersicht')); ?>
</h3>
</div>
</div>
<div>
<?php
$this->load->view('system/infocenter/infocenterData.php', array('fhc_controller_id' => $fhc_controller_id));
$this->load->view(
'system/infocenter/infocenterData.php',
array('fhc_controller_id' => $fhc_controller_id)
);
?>
</div>
</div>
@@ -82,7 +82,7 @@
FROM public.tbl_studiensemester
WHERE ende >= NOW()
)
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\')
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\' and psss.studiensemester_kurzbz = \'WS2018\')
LIMIT 1
) AS "AnzahlAbgeschickt",
array_to_string(
@@ -103,7 +103,7 @@
FROM public.tbl_studiensemester
WHERE ende >= NOW()
)
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\')
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\' and psss.studiensemester_kurzbz = \'WS2018\')
LIMIT 1
),\', \'
) AS "StgAbgeschickt",
@@ -125,7 +125,7 @@
FROM public.tbl_studiensemester
WHERE ende >= NOW()
)
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\')
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\' and psss.studiensemester_kurzbz = \'WS2018\')
LIMIT 1
),\', \'
) AS "StgNichtAbgeschickt",
@@ -146,14 +146,22 @@
FROM public.tbl_studiensemester
WHERE start >= NOW()
)
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\')
AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\' and psss.studiensemester_kurzbz = \'WS2018\')
LIMIT 1
),\', \'
) AS "StgAktiv",
pl.zeitpunkt AS "LockDate",
pl.lockuser as "LockUser"
pl.lockuser AS "LockUser",
pd.parkdate AS "ParkDate"
FROM public.tbl_person p
LEFT JOIN (SELECT person_id, zeitpunkt, uid as lockuser FROM system.tbl_person_lock WHERE app = \''.$APP.'\') pl USING(person_id)
LEFT JOIN (
SELECT person_id, zeitpunkt as parkdate
FROM system.tbl_log
WHERE logtype_kurzbz = \'Processstate\'
AND logdata->>\'name\' = \'Parked\'
AND zeitpunkt >= now()
) pd USING(person_id)
WHERE
EXISTS(
SELECT 1
@@ -187,22 +195,33 @@
ORDER BY "LastAction" ASC
',
'requiredPermissions' => 'infocenter',
'fhc_controller_id' => $fhc_controller_id,
'checkboxes' => 'PersonId',
'additionalColumns' => array('Details'),
'columnsAliases' => array(
'PersonID', 'Vorname', 'Nachname',
'GebDatum', 'Nation', 'Letzte Aktion',
'Letzter Bearbeiter', 'StSem', 'GesendetAm',
'NumAbgeschickt', 'StgSent', 'StgNotSent',
'StgAktiv', 'Sperrdatum', 'GesperrtVon'
'PersonID',
ucfirst($this->p->t('person', 'vorname')) ,
ucfirst($this->p->t('person', 'nachname')),
ucfirst($this->p->t('person', 'geburtsdatum')),
ucfirst($this->p->t('person', 'nation')),
ucfirst($this->p->t('global', 'letzteAktion')),
ucfirst($this->p->t('global', 'letzterBearbeiter')),
ucfirst($this->p->t('lehre', 'studiensemester')),
ucfirst($this->p->t('global', 'gesendetAm')),
ucfirst($this->p->t('global', 'abgeschickt')).' ('.$this->p->t('global', 'anzahl').')',
ucfirst($this->p->t('lehre', 'studiengang')).' ('.$this->p->t('global', 'gesendet').')',
ucfirst($this->p->t('lehre', 'studiengang')).' ('.$this->p->t('global', 'nichtGesendet').')',
ucfirst($this->p->t('lehre', 'studiengang')).' ('.$this->p->t('global', 'aktiv').')',
ucfirst($this->p->t('global', 'sperrdatum')),
ucfirst($this->p->t('global', 'gesperrtVon')),
ucfirst($this->p->t('global', 'parkdatum'))
),
'formatRaw' => function($datasetRaw) {
'formatRow' => function($datasetRaw) {
$datasetRaw->{'Details'} = sprintf(
'<a href="%s%s">Details</a>',
site_url('system/infocenter/InfoCenter/showDetails/'),
$datasetRaw->{'PersonId'}
'<a href="%s/%s?fhc_controller_id=%s">Details</a>',
site_url('system/infocenter/InfoCenter/showDetails'),
$datasetRaw->{'PersonId'},
(isset($_GET['fhc_controller_id'])?$_GET['fhc_controller_id']:'')
);
if ($datasetRaw->{'SendDate'} == null)
@@ -211,7 +230,7 @@
}
else
{
$datasetRaw->{'SendDate'} = date_format(date_create($datasetRaw->{'SendDate'}),'Y-m-d H:i');
$datasetRaw->{'SendDate'} = date_format(date_create($datasetRaw->{'SendDate'}), 'Y-m-d H:i');
}
if ($datasetRaw->{'LastAction'} == null)
@@ -220,7 +239,7 @@
}
else
{
$datasetRaw->{'LastAction'} = date_format(date_create($datasetRaw->{'LastAction'}),'Y-m-d H:i');
$datasetRaw->{'LastAction'} = date_format(date_create($datasetRaw->{'LastAction'}), 'Y-m-d H:i');
}
if ($datasetRaw->{'User/Operator'} == '')
@@ -238,6 +257,11 @@
$datasetRaw->{'LockUser'} = '-';
}
if ($datasetRaw->{'ParkDate'} == null)
{
$datasetRaw->{'ParkDate'} = '-';
}
if ($datasetRaw->{'StgAbgeschickt'} == null)
{
$datasetRaw->{'StgAbgeschickt'} = '-';
@@ -259,25 +283,26 @@
},
'markRow' => function($datasetRaw) {
$mark = '';
if ($datasetRaw->LockDate != null)
{
return FilterWidget::DEFAULT_MARK_ROW_CLASS;
$mark = FilterWidget::DEFAULT_MARK_ROW_CLASS;
}
if ($datasetRaw->ParkDate != null)
{
// Parking has priority over locking
$mark = "text-info";
}
return $mark;
}
);
$filterId = isset($_GET[InfoCenter::FILTER_ID]) ? $_GET[InfoCenter::FILTER_ID] : null;
if (isset($filterId) && is_numeric($filterId))
{
$filterWidgetArray[InfoCenter::FILTER_ID] = $filterId;
}
else
{
$filterWidgetArray['app'] = $APP;
$filterWidgetArray['datasetName'] = 'PersonActions';
$filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll';
}
$filterWidgetArray[InfoCenter::FILTER_ID] = $this->input->get(InfoCenter::FILTER_ID);
$filterWidgetArray['app'] = $APP;
$filterWidgetArray['datasetName'] = 'PersonActions';
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
?>
@@ -7,10 +7,12 @@
'bootstrap' => true,
'fontawesome' => true,
'jqueryui' => true,
'ajaxlib' => true,
'tablesorter' => true,
'tinymce' => true,
'sbadmintemplate' => true,
'addons' => true,
'navigationwidget' => true,
'customCSSs' =>
array(
'public/css/sbadmin2/admintemplate.css',
@@ -20,8 +22,33 @@
array(
'public/js/bootstrapper.js',
'public/js/tablesort/tablesort.js',
'public/js/infocenter/infocenterDetails.js')
'public/js/infocenter/infocenterDetails.js'
),
'phrases' =>
array(
'infocenter' =>
array(
'notizHinzufuegen',
'notizAendern',
'bewerberParken',
'bewerberAusparken',
'nichtsZumAusparken',
'fehlerBeimAusparken',
'fehlerBeimParken',
'bewerberGeparktBis'
),
'ui' =>
array(
'gespeichert',
'fehlerBeimSpeichern'
),
'global' =>
array(
'bis',
'zeilen'
)
)
)
);
?>
<body>
@@ -40,14 +67,16 @@
</div>
<div class="col-lg-4">
<div class="headerright text-right">
wird bearbeitet von:
<?php
if (isset($lockedby)):
echo $this->p->t('global', 'wirdBearbeitetVon') . ': ';
echo $lockedby;
?>
&nbsp;&nbsp;
<a href="../unlockPerson/<?php echo $stammdaten->person_id; ?>"><i
class="fa fa-sign-out"></i>&nbsp;Freigeben</a>
if (!isset($show_lock_link) || $show_lock_link === true): ?>
&nbsp;&nbsp;
<a href="../unlockPerson/<?php echo $stammdaten->person_id; ?>?fhc_controller_id=<?php echo $fhc_controller_id; ?>">
<i class="fa fa-sign-out"></i>&nbsp;<?php echo ucfirst($this->p->t('ui', 'freigeben')) ?>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
@@ -57,7 +86,9 @@
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading text-center"><h4>Stammdaten</h4></div>
<div class="panel-heading text-center">
<h4><?php echo ucfirst($this->p->t('global', 'stammdaten')) ?></h4>
</div>
<div class="panel-body">
<?php $this->load->view('system/infocenter/stammdaten.php'); ?>
<?php $this->load->view('system/infocenter/anmerkungenZurBewerbung.php'); ?>
@@ -71,7 +102,9 @@
<div class="col-lg-12">
<div class="panel panel-primary">
<a name="DokPruef"></a><!-- anchor for jumping to the section -->
<div class="panel-heading text-center"><h4>Dokumentenpr&uuml;fung</h4></div>
<div class="panel-heading text-center">
<h4><?php echo ucfirst($this->p->t('infocenter', 'dokumentenpruefung')) ?></h4>
</div>
<div class="panel-body">
<?php $this->load->view('system/infocenter/dokpruefung.php'); ?>
</div> <!-- ./panel-body -->
@@ -85,7 +118,8 @@
<div class="panel panel-primary">
<div class="panel-heading text-center">
<a name="ZgvPruef"></a>
<h4>ZGV-Pr&uuml;fung</h4>
<h4><?php echo $this->p->t('infocenter', 'zgv'). ' - '.
ucfirst($this->p->t('lehre', 'pruefung'))?></h4>
</div>
<div class="panel-body">
<?php $this->load->view('system/infocenter/zgvpruefungen.php'); ?><!-- /.panel-group -->
@@ -100,7 +134,7 @@
<div class="panel panel-primary">
<div class="panel-heading text-center">
<a name="Nachrichten"></a>
<h4 class="text-center">Nachrichten</h4>
<h4 class="text-center"><?php echo ucfirst($this->p->t('global', 'nachrichten')) ?></h4>
</div>
<div class="panel-body">
<div class="row">
@@ -119,7 +153,8 @@
<div class="panel panel-primary">
<div class="panel-heading text-center">
<a name="NotizAkt"></a>
<h4 class="text-center">Notizen &amp; Aktivit&auml;ten</h4>
<h4 class="text-center"><?php echo ucfirst($this->p->t('global', 'notizen')). ' & '.
ucfirst($this->p->t('global', 'aktivitaeten')) ?></h4>
</div>
<div class="panel-body">
<div class="row">
@@ -131,8 +166,11 @@
<?php $this->load->view('system/infocenter/notizen.php'); ?>
</div>
</div>
<div class="col-lg-6" id="logs">
<div class="col-lg-6">
<div id="parking"></div>
<div id="logs">
<?php $this->load->view('system/infocenter/logs.php'); ?>
</div>
</div> <!-- ./column -->
</div> <!-- ./row -->
</div> <!-- ./panel-body -->
+30 -31
View File
@@ -9,6 +9,9 @@
'fontawesome' => true,
'sbadmintemplate' => true,
'tablesorter' => true,
'ajaxlib' => true,
'filterwidget' => true,
'navigationwidget' => true,
'customCSSs' => 'public/css/sbadmin2/tablesort_bootstrap.css',
'customJSs' => array('public/js/bootstrapper.js', 'public/js/infocenter/infocenterPersonDataset.js')
)
@@ -66,7 +69,6 @@
INNER JOIN public.tbl_prestudent ps USING(prestudent_id)
JOIN public.tbl_studiengang USING(studiengang_kz)
WHERE pss.status_kurzbz = \'Interessent\'
AND pss.bestaetigtam IS NULL
AND ps.person_id = p.person_id
AND tbl_studiengang.typ in(\'b\')
AND studiensemester_kurzbz IN (
@@ -85,7 +87,6 @@
JOIN public.tbl_studiengang USING(studiengang_kz)
WHERE pss.status_kurzbz = \'Interessent\'
AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\')
AND pss.bestaetigtam IS NULL
AND ps.person_id = p.person_id
AND tbl_studiengang.typ in(\'b\')
AND studiensemester_kurzbz IN (
@@ -104,7 +105,6 @@
JOIN public.tbl_studiengang USING(studiengang_kz)
WHERE pss.status_kurzbz = \'Interessent\'
AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\')
AND pss.bestaetigtam IS NULL
AND ps.person_id = p.person_id
AND tbl_studiengang.typ in(\'b\')
AND studiensemester_kurzbz IN (
@@ -123,7 +123,6 @@
JOIN public.tbl_studiengang USING(studiengang_kz)
WHERE pss.status_kurzbz = \'Interessent\'
AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\')
AND pss.bestaetigtam IS NULL
AND ps.person_id = p.person_id
AND tbl_studiengang.typ in(\'b\')
AND studiensemester_kurzbz IN (
@@ -147,11 +146,7 @@
WHERE
person_id=p.person_id
AND tbl_studiengang.typ in(\'b\')
AND \'Interessent\' = (SELECT status_kurzbz FROM public.tbl_prestudentstatus
WHERE prestudent_id=tbl_prestudent.prestudent_id
ORDER BY datum DESC, insertamum DESC, ext_id DESC
LIMIT 1
)
AND EXISTS (
SELECT
1
@@ -160,7 +155,7 @@
WHERE
prestudent_id = tbl_prestudent.prestudent_id
AND status_kurzbz = \'Interessent\'
AND (bestaetigtam IS NOT NULL AND (bewerbung_abgeschicktamum is null OR bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\'))
AND (bestaetigtam IS NOT NULL AND bewerbung_abgeschicktamum >= \''.$NOTBEFORE.'\')
AND studiensemester_kurzbz IN (
SELECT studiensemester_kurzbz
FROM public.tbl_studiensemester
@@ -168,19 +163,33 @@
)
)
)
ORDER BY "LastAction" ASC
ORDER BY "LastAction" DESC
',
'fhc_controller_id' => $fhc_controller_id,
'requiredPermissions' => 'infocenter',
'checkboxes' => 'PersonId',
'additionalColumns' => array('Details'),
'columnsAliases' => array('PersonID','Vorname','Nachname','GebDatum','Nation','Letzte Aktion','Letzter Bearbeiter',
'StSem','GesendetAm','NumAbgeschickt','Studiengänge','Sperrdatum','GesperrtVon'),
'formatRaw' => function($datasetRaw) {
'columnsAliases' => array(
'PersonID',
'Vorname',
'Nachname',
'GebDatum',
'Nation',
'Letzte Aktion',
'Letzter Bearbeiter',
'StSem',
'GesendetAm',
'NumAbgeschickt',
'Studiengänge',
'Sperrdatum',
'GesperrtVon'
),
'formatRow' => function($datasetRaw) {
$datasetRaw->{'Details'} = sprintf(
'<a href="%s%s">Details</a>',
base_url('index.ci.php/system/infocenter/InfoCenter/showDetails/'),
$datasetRaw->{'PersonId'}
'<a href="%s/%s?show_lock_link=0&fhc_controller_id=%s">Details</a>',
site_url('system/infocenter/InfoCenter/showDetails'),
$datasetRaw->{'PersonId'},
(isset($_GET['fhc_controller_id'])?$_GET['fhc_controller_id']:'')
);
if ($datasetRaw->{'SendDate'} == null)
@@ -237,19 +246,9 @@
}
);
$filterId = isset($_GET[InfoCenter::FILTER_ID]) ? $_GET[InfoCenter::FILTER_ID] : null;
if (isset($filterId) && is_numeric($filterId))
{
$filterWidgetArray[InfoCenter::FILTER_ID] = $filterId;
}
else
{
$filterWidgetArray['app'] = $APP;
$filterWidgetArray['datasetName'] = 'PersonActions';
$filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll';
}
$filterWidgetArray[InfoCenter::FILTER_ID] = $this->input->get(InfoCenter::FILTER_ID);
$filterWidgetArray['app'] = $APP;
$filterWidgetArray['datasetName'] = 'PersonActions';
echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray);
?>
+18 -18
View File
@@ -1,19 +1,19 @@
<table id="logtable" class="table table-bordered table-hover">
<thead>
<tr>
<th>Datum</th>
<th>Aktivit&auml;t</th>
<th>User</th>
</tr>
</thead>
<tbody>
<?php foreach ($logs as $log): ?>
<tr data-toggle="tooltip"
title="<?php echo isset($log->logdata->message) ? $log->logdata->message : '' ?>">
<td><?php echo date_format(date_create($log->zeitpunkt), 'd.m.Y H:i:s') ?></td>
<td><?php echo isset($log->logdata->name) ? $log->logdata->name : '' ?></td>
<td><?php echo $log->insertvon ?></td>
</tr>
<?php endforeach ?>
</tbody>
<table id="logtable" class="table table-bordered table-hover">
<thead>
<tr>
<th><?php echo ucfirst($this->p->t('global', 'datum')) ?></th>
<th><?php echo ucfirst($this->p->t('global', 'aktivitaet')) ?></th>
<th>User</th>
</tr>
</thead>
<tbody>
<?php foreach ($logs as $log): ?>
<tr data-toggle="tooltip"
title="<?php echo isset($log->logdata->message) ? $log->logdata->message : '' ?>">
<td><?php echo date_format(date_create($log->zeitpunkt), 'd.m.Y H:i:s') ?></td>
<td><?php echo isset($log->logdata->name) ? $log->logdata->name : '' ?></td>
<td><?php echo $log->insertvon ?></td>
</tr>
<?php endforeach ?>
</tbody>
</table>
@@ -1,8 +1,8 @@
<table id="notiztable" class="table table-bordered table-hover">
<thead>
<tr>
<th>Datum</th>
<th>Notiz</th>
<th><?php echo ucfirst($this->p->t('global', 'datum')) ?></th>
<th><?php echo ucfirst($this->p->t('global', 'notiz')) ?></th>
<th>User</th>
</tr>
</thead>
@@ -2,41 +2,41 @@
<div class="col-lg-6 table-responsive">
<table class="table">
<tr>
<td><strong>Vorname</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','vorname')) ?></strong></td>
<td><?php echo $stammdaten->vorname ?></td>
</tr>
<tr>
<td><strong>Nachname</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','nachname')) ?></strong></td>
<td>
<?php echo $stammdaten->nachname ?></td>
</tr>
<tr>
<td><strong>Geburtsdatum</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','geburtsdatum')) ?></strong></td>
<td>
<?php echo date_format(date_create($stammdaten->gebdatum), 'd.m.Y') ?></td>
</tr>
<tr>
<td><strong>Sozialversicherungsnr</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','svnr')) ?></strong></td>
<td>
<?php echo $stammdaten->svnr ?></td>
</tr>
<tr>
<td><strong>Staatsb&uuml;rgerschaft</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','staatsbuergerschaft')) ?></strong></td>
<td>
<?php echo $stammdaten->staatsbuergerschaft ?></td>
</tr>
<tr>
<td><strong>Geschlecht</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','geschlecht')) ?></strong></td>
<td>
<?php echo $stammdaten->geschlecht ?></td>
</tr>
<tr>
<td><strong>Geburtsnation</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','geburtsnation')) ?></strong></td>
<td>
<?php echo $stammdaten->geburtsnation ?></td>
</tr>
<tr>
<td><strong>Geburtsort</strong></td>
<td><strong><?php echo ucfirst($this->p->t('person','geburtsort')) ?></strong></td>
<td><?php echo $stammdaten->gebort ?></td>
</tr>
</table>
@@ -45,18 +45,22 @@
<table class="table table-bordered">
<thead>
<tr>
<th colspan="4" class="text-center">Kontakte</th>
<th colspan="4" class="text-center"><?php echo ucfirst($this->p->t('global','kontakt')) ?></th>
</tr>
<tr>
<th class="text-center">Typ</th>
<th class="text-center">Kontakt</th>
<th class="text-center">Anmerkung</th>
<th class="text-center"><?php echo ucfirst($this->p->t('global','typ')) ?></th>
<th class="text-center"><?php echo ucfirst($this->p->t('global','kontakt')) ?></th>
<th class="text-center"><?php echo ucfirst($this->p->t('global','anmerkung')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($stammdaten->kontakte as $kontakt): ?>
<tr>
<td><?php echo ucfirst($kontakt->kontakttyp); ?></td>
<?php if ($kontakt->kontakttyp === 'email'): ?>
<td><?php echo ucfirst($this->p->t('person','email')) ?></td>
<?php elseif ($kontakt->kontakttyp === 'telefon'): ?>
<td><?php echo ucfirst($this->p->t('person','telefon')) ?></td>
<?php endif; ?>
<td>
<?php echo '<span class="'.$kontakt->kontakttyp.'">';?>
<?php if ($kontakt->kontakttyp === 'email'): ?>
@@ -76,7 +80,7 @@
<?php foreach ($stammdaten->adressen as $adresse): ?>
<tr>
<td>
Adresse
<?php echo ucfirst($this->p->t('person','adresse')) ?>
</td>
<td>
<?php echo isset($adresse) ? $adresse->strasse.', '.$adresse->plz.' '.$adresse->ort : '' ?>
@@ -97,13 +101,13 @@
<input type="hidden" name="person_id"
value="<?php echo $stammdaten->person_id ?>">
<a id="sendmsglink" href="javascript:void(0);"><i
class="fa fa-envelope"></i>&nbsp;Nachricht senden</a>
class="fa fa-envelope"></i>&nbsp;<?php echo $this->p->t('ui','nachrichtSenden') ?></a>
</form>
</div>
<?php if (isset($stammdaten->zugangscode)): ?>
<div class="col-xs-6 text-right">
<a href="<?php echo CIS_ROOT.'addons/bewerbung/cis/registration.php?code='.html_escape($stammdaten->zugangscode) ?>"
target='_blank'><i class="glyphicon glyphicon-new-window"></i>&nbsp;Zugang Bewerbung</a>
target='_blank'><i class="glyphicon glyphicon-new-window"></i>&nbsp;<?php echo $this->p->t('infocenter','zugangBewerbung') ?></a>
</div>
<?php endif; ?>
</div>
@@ -17,13 +17,13 @@ $this->load->view(
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">Zugangsvoraussetzungen <?php echo $studiengang_kurzbz; ?> - <?php echo $studiengang_bezeichnung; ?></h3>
<h3 class="page-header"><?php echo $this->p->t('infocenter', 'zugangsvoraussetzungen'); ?> <?php echo $studiengang_kurzbz; ?> - <?php echo $studiengang_bezeichnung; ?></h3>
</div>
</div>
<div id="data">
<?php if (empty($data)): ?>
Keine Zugangsvoraussetzungen für den Studiengang definiert
<?php
<?php echo $this->p->t('infocenter', 'keineZugangsvoraussetzungenTxt'); ?>
<?php
else:
echo json_decode($data);
endif;
@@ -27,14 +27,14 @@
<?php if (isset($zgvpruefung->prestudentstatus->bestaetigtam)): ?>
<div class="col-xs-<?php echo $headercolumns[1]; ?> text-right">
<i class="fa fa-check" style="color: green"></i>
An Studiengang freigegeben
<?php echo $this->p->t('global', 'anStudiengangFreigegeben') ?>
</div>
<?php endif; ?>
<?php else: ?>
<div class="col-xs-<?php echo $headercolumns[1]; ?> text-right">
<?php echo 'Bewerbung abgeschickt: '.(isset($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum) ? '<i class="fa fa-check" style="color:green"></i>' : '<i class="fa fa-times" style="color:red"></i>'); ?>
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungsnachfrist) ? ' | Nachfrist: '. date_format(date_create($zgvpruefung->prestudentstatus->bewerbungsnachfrist), 'd.m.Y') : ''); ?>
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungstermin) ? ' | Bewerbungsfrist: '. date_format(date_create($zgvpruefung->prestudentstatus->bewerbungstermin), 'd.m.Y') : ''); ?>
<?php echo ucfirst($this->p->t('infocenter','bewerbung')) . ' ' . $this->p->t('global','abgeschickt') . ': '.(isset($zgvpruefung->prestudentstatus->bewerbung_abgeschicktamum) ? '<i class="fa fa-check" style="color:green"></i>' : '<i class="fa fa-times" style="color:red"></i>'); ?>
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungsnachfrist) ? ' | ' . $this->p->t('infocenter', 'nachfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungsnachfrist), 'd.m.Y') : ''); ?>
<?php echo (isset($zgvpruefung->prestudentstatus->bewerbungstermin) ? ' | ' . $this->p->t('infocenter', 'bewerbungsfrist') . ': ' . date_format(date_create($zgvpruefung->prestudentstatus->bewerbungstermin), 'd.m.Y') : ''); ?>
</div>
<?php endif; ?>
<?php endif; ?>
@@ -49,7 +49,7 @@
<div class="row">
<div class="col-lg-<?php echo $columns[0] ?>">
<div class="form-group">
<label>Letzter Status: </label>
<label><?php echo ucfirst($this->p->t('global','letzterStatus')) . ':' ?></label>
<?php
if (isset($zgvpruefung->prestudentstatus->status_kurzbz))
{
@@ -60,7 +60,7 @@
</div>
<div class="col-lg-<?php echo $columns[1] ?>">
<div class="form-group">
<label>Studiensemester: </label>
<label><?php echo ucfirst($this->p->t('lehre','studiensemester')) . ':' ?></label>
<?php echo isset($zgvpruefung->prestudentstatus->studiensemester_kurzbz) ? $zgvpruefung->prestudentstatus->studiensemester_kurzbz : '' ?>
</div>
</div>
@@ -73,7 +73,7 @@
</div>
<div class="col-lg-<?php echo $columns[3] ?>">
<div class="form-group">
<label>Orgform: </label>
<label><?php echo ucfirst($this->p->t('lehre','organisationsform')) . ':' ?></label>
<span style="display: inline-block">
<?php
$separator = (isset($zgvpruefung->prestudentstatus->orgform)) ? ', ' : '';
@@ -90,18 +90,18 @@
<div class="row">
<?php if ($infoonly): ?>
<div class="col-xs-8">
<label>ZGV:</label>
<label><?php echo $this->p->t('infocenter', 'zgv') . ':' ?></label>
<?php echo $zgvpruefung->zgv_bez; ?>
</div>
<?php else: ?>
<div class="col-xs-3">
<label>ZGV:</label>
<label><?php echo $this->p->t('infocenter', 'zgv') . ':' ?></label>
</div>
<?php endif;
$zgvinfocolumns = $infoonly ? 4 : 9;
?>
<div class="col-xs-<?php echo $zgvinfocolumns; ?> text-right zgvinfo" id="zgvinfo_<?php echo $zgvpruefung->prestudent_id ?>">
<a href="javascript:void(0)"><i class="fa fa-info-circle"></i> ZGV <?php echo $zgvpruefung->studiengang; ?></a>
<a href="javascript:void(0)"><i class="fa fa-info-circle"></i> <?php echo $this->p->t('infocenter', 'zgv') ?> <?php echo $zgvpruefung->studiengang; ?></a>
</div>
</div>
<?php if (!$infoonly)
@@ -114,7 +114,7 @@
</div>
<div class="col-lg-<?php echo $columns[1] ?>">
<div class="form-group">
<label>ZGV Ort: </label>
<label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('person','ort') . ':'?></label>
<?php if ($infoonly):
echo html_escape($zgvpruefung->zgvort);
else:
@@ -127,7 +127,7 @@
</div>
<div class="col-lg-<?php echo $columns[2] ?>">
<div class="form-group">
<label>ZGV Datum: </label>
<label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('global','datum') . ':'?></label>
<?php
$zgvdatum = empty($zgvpruefung->zgvdatum) ? "" : date_format(date_create($zgvpruefung->zgvdatum), 'd.m.Y');
if ($infoonly):
@@ -143,7 +143,7 @@
</div>
<div class="col-lg-<?php echo $columns[3] ?>">
<div class="form-group">
<label>ZGV Nation: </label>
<label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('person','nation') . ':'?></label>
<?php if ($infoonly)
echo $zgvpruefung->zgvnation_bez;
else
@@ -159,7 +159,7 @@
<?php if ($zgvpruefung->studiengangtyp === 'm') : ?>
<div class="row">
<div class="col-lg-<?php echo $columns[0] ?>">
<div class="form-group"><label>ZGV Master: </label>
<div class="form-group"><label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('lehre','master') . ':'?></label>
<?php
if ($infoonly)
echo $zgvpruefung->zgvmas_bez;
@@ -173,7 +173,7 @@
</div>
<div class="col-lg-<?php echo $columns[1] ?>">
<div class="form-group">
<label>ZGV Master Ort: </label>
<label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('lehre','master') . ' ' . $this->p->t('person','ort') . ':'?></label>
<?php if ($infoonly):
echo $zgvpruefung->zgvmaort;
else:
@@ -186,7 +186,7 @@
</div>
<div class="col-lg-<?php echo $columns[2] ?>">
<div class="form-group">
<label>ZGV Master Datum: </label>
<label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('lehre','master') . ' ' . $this->p->t('global','datum') . ':'?></label>
<?php
$zgvmadatum = empty($zgvpruefung->zgvmadatum) ? "" : date_format(date_create($zgvpruefung->zgvmadatum), 'd.m.Y');
if ($infoonly):
@@ -201,8 +201,7 @@
</div>
</div>
<div class="col-lg-<?php echo $columns[3] ?>">
<div class="form-group"><label>ZGV Master
Nation: </label>
<div class="form-group"><label><?php echo $this->p->t('infocenter', 'zgv') . ' ' . $this->p->t('lehre','master') . ' ' . $this->p->t('person', 'nation') . ':'?></label>
<?php
if ($infoonly)
echo $zgvpruefung->zgvmanation_bez;
@@ -221,12 +220,12 @@
<div class="row">
<div class="col-xs-6 text-left">
<button type="button" class="btn btn-default zgvUebernehmen" id="zgvUebernehmen_<?php echo $zgvpruefung->prestudent_id ?>">
Letzte ZGV &uuml;bernehmen
<?php echo $this->p->t('infocenter', 'letzteZgvUebernehmen') ?>
</button>
</div>
<div class="col-xs-6 text-right">
<button type="submit" class="btn btn-default saveZgv" id="zgvSpeichern_<?php echo $zgvpruefung->prestudent_id ?>">
Speichern
<?php echo $this->p->t('ui', 'speichern') ?>
</button>
</div>
</div>
@@ -244,13 +243,13 @@
<div class="form-inline">
<form method="post"
action="../saveAbsage/<?php echo $zgvpruefung->prestudent_id ?>">
<input type="hidden" name="fhc_controller_id" value="<?php echo $fhc_controller_id; ?>">
<div class="input-group" id="statusgrselect_<?php echo $zgvpruefung->prestudent_id ?>">
<select name="statusgrund"
class="d-inline float-right"
required>
<option value="null"
selected="selected">Absagegrund
w&auml;hlen...
selected="selected"><?php echo ucfirst($this->p->t('infocenter', 'absagegrund')) . '...' ?>
</option>
<?php foreach ($statusgruende as $statusgrund): ?>
<option value="<?php echo $statusgrund->statusgrund_id ?>"><?php echo $statusgrund->bezeichnung_mehrsprachig[0] ?></option>
@@ -261,7 +260,7 @@
class="btn btn-default"
data-toggle="modal"
data-target="#absageModal_<?php echo $zgvpruefung->prestudent_id ?>">
Absage
<?php echo $this->p->t('ui', 'absagen') ?>
</button>
</span>
</div>
@@ -280,33 +279,20 @@
&times;
</button>
<h4 class="modal-title"
id="absageModalLabel">Absage
best&auml;tigen</h4>
id="absageModalLabel"><?php echo $this->p->t('infocenter', 'absageBestaetigen') ?></h4>
</div>
<div class="modal-body">
Bei Absage von InteressentInnen
erhalten
diese den Status "Abgewiesener"
und<br/>deren
Zgvdaten können
im Infocenter nicht mehr
bearbeitet
oder
freigegeben werden.
<br/>Alle nicht gespeicherten
Zgvdaten
gehen
verloren. Fortfahren?
<?php echo $this->p->t('infocenter', 'absageBestaetigenTxt') ?>
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">
Abbrechen
<?php echo $this->p->t('ui', 'abbrechen') ?>
</button>
<button type="submit"
class="btn btn-primary">
InteressentIn abweisen
<?php echo $this->p->t('infocenter', 'interessentAbweisen') ?>
</button>
</div>
</div>
@@ -337,7 +323,7 @@
data-toggle="modal"
data-target="#freigabeModal_<?php echo $zgvpruefung->prestudent_id ?>"
data-toggle="tooltip" title="<?php echo $disabledTxt ?>">
Freigabe an Studiengang
<?php echo $this->p->t('ui', 'freigabeAnStudiengang') ?>
</button>
</div>
</div>
@@ -354,29 +340,20 @@
</button>
<h4 class="modal-title"
id="freigabeModalLabel">
Freigabe
best&auml;tigen</h4>
<?php echo $this->p->t('infocenter', 'freigabeBestaetigen') ?></h4>
</div>
<div class="modal-body">
Bei Freigabe von InteressentInnen wird deren
Interessentenstatus bestätigt und<br/>deren
Zgvdaten
können im
Infocenter nicht mehr bearbeitet
werden.
<br/>Alle nicht gespeicherten Zgvdaten gehen
verloren.
Fortfahren?
<?php echo $this->p->t('infocenter', 'interessentFreigebenTxt') ?>
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">Abbrechen
data-dismiss="modal"><?php echo $this->p->t('ui', 'abbrechen') ?>
</button>
<a href="../saveFreigabe/<?php echo $zgvpruefung->prestudent_id ?>">
<a href="../saveFreigabe/<?php echo $zgvpruefung->prestudent_id ?>?fhc_controller_id=<?php echo $fhc_controller_id; ?>">
<button type="button"
class="btn btn-primary">
InteressentIn freigeben
<?php echo $this->p->t('infocenter', 'interessentFreigeben') ?>
</button>
</a>
</div>
@@ -390,7 +367,7 @@
<div class="row">
<div class="col-lg-12 text-left">
<?php echo isset($zgvpruefung->prestudentstatus->bestaetigtam) ? '<i class="fa fa-check" style="color: green"></i>' : '<i class="fa fa-check" style="color: red"></i>' ?>
<label>An Studiengang freigegeben</label>
<label><?php echo $this->p->t('global', 'anStudiengangFreigegeben') ?></label>
</div>
</div><!-- /.row -->
</div><!-- /.panel-footer -->
+99 -96
View File
@@ -1,97 +1,100 @@
<?php
$msgExists = count($messages) > 0;
$widthColumn = $msgExists === true ? 8 : 12;
?>
<div class="col-lg-<?php echo $widthColumn ?>">
<table id="msgtable" class="table table-bordered table-condensed tablesort-hover tablesort-active">
<thead>
<tr>
<th>Gesendet am</th>
<th>Sender</th>
<th>Empf&auml;nger</th>
<th>Betreff</th>
<th>Gelesen am</th>
</tr>
</thead>
<tbody>
<?php foreach ($messages as $message): ?>
<tr id="<?php echo $message->message_id.'_'.$message->repersonid ?>" style="cursor: pointer">
<td><?php echo isset($message->insertamum) ? date_format(date_create($message->insertamum), 'd.m.Y H:i:s') : '' ?></td>
<td><?php echo $message->sevorname.' '.$message->senachname ?></td>
<td><?php echo $message->revorname.' '.$message->renachname ?></td>
<td><?php echo $message->subject ?></td>
<td><?php echo isset($message->statusamum) ? date_format(date_create($message->statusamum), 'd.m.Y H:i:s') : '' ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if ($msgExists === true): ?>
<div class="col-lg-4">
<br>
<div class="text-center"><label for="msgbody" id="msgsubject"></label></div>
<div>
<textarea id="msgbody"></textarea>
</div>
</div>
<?php endif; ?>
<script>
tinymce.init({
menubar: false,
toolbar: false,
readonly: 1,
selector: "#msgbody",
statusbar: false,
plugins: "autoresize",
//callback to avoid conflict with ajax (for getting body of first message)
init_instance_callback: "initMsgBody"
});
function initMsgBody()
{
var tblrows = $("#msgtable tbody tr");
if (tblrows.length > 0)
{
//in the begging last sent message is shown
var firstelement = tblrows.first();
var id = firstelement.attr('id');
getMsgBody(id);
firstelement.find("td").addClass("tablesort-active");
//add click event on message table for message preview
tblrows.click(
function ()
{
$("#msgtable").find("td").removeClass("tablesort-active");
$(this).find("td").addClass("tablesort-active");
getMsgBody(this.id);
}
);
}
}
//retrieve message data from message and reiver id via AJAX
function getMsgBody(id)
{
var msgid = id.substr(0, id.indexOf('_'));
var recid = id.substr(id.indexOf('_') + 1);
$.ajax(
{
dataType: "json",
url: "<?php echo base_url("/index.ci.php/system/Messages/getMessageFromIds/") ?>" + msgid + "/" + recid,
success: function (data, textStatus, jqXHR)
{
$("#msgsubject").text(data[0].subject);
tinyMCE.get("msgbody").setContent(data[0].body);
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
}
}
)
}
<?php
$msgExists = count($messages) > 0;
$widthColumn = $msgExists === true ? 8 : 12;
?>
<div class="col-lg-<?php echo $widthColumn ?>">
<table id="msgtable" class="table table-bordered table-condensed tablesort-hover tablesort-active">
<thead>
<tr>
<th><?php echo ucfirst($this->p->t('global','gesendetAm')) ?></th>
<th><?php echo ucfirst($this->p->t('global','sender')) ?></th>
<th><?php echo ucfirst($this->p->t('global','empfaenger')) ?></th>
<th><?php echo ucfirst($this->p->t('global','betreff')) ?></th>
<th><?php echo ucfirst($this->p->t('global','gelesenAm')) ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($messages as $message): ?>
<tr id="<?php echo $message->message_id.'_'.$message->repersonid ?>" style="cursor: pointer">
<td><?php echo isset($message->insertamum) ? date_format(date_create($message->insertamum), 'd.m.Y H:i:s') : '' ?></td>
<td><?php echo $message->sevorname.' '.$message->senachname ?></td>
<td><?php echo $message->revorname.' '.$message->renachname ?></td>
<td><?php echo $message->subject ?></td>
<td><?php echo isset($message->statusamum) ? date_format(date_create($message->statusamum), 'd.m.Y H:i:s') : '' ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if ($msgExists === true): ?>
<div class="col-lg-4">
<br>
<div class="text-center"><label for="msgbody" id="msgsubject"></label></div>
<div>
<textarea id="msgbody"></textarea>
</div>
</div>
<?php endif; ?>
<script>
tinymce.init({
menubar: false,
toolbar: false,
readonly: 1,
selector: "#msgbody",
statusbar: false,
plugins: "autoresize",
autoresize_bottom_margin: 10,
autoresize_min_height: 140,
autoresize_max_height: 495,
//callback to avoid conflict with ajax (for getting body of first message)
init_instance_callback: "initMsgBody"
});
function initMsgBody()
{
var tblrows = $("#msgtable tbody tr");
if (tblrows.length > 0)
{
//in the begging last sent message is shown
var firstelement = tblrows.first();
var id = firstelement.attr('id');
getMsgBody(id);
firstelement.find("td").addClass("tablesort-active");
//add click event on message table for message preview
tblrows.click(
function ()
{
$("#msgtable").find("td").removeClass("tablesort-active");
$(this).find("td").addClass("tablesort-active");
getMsgBody(this.id);
}
);
}
}
//retrieve message data from message and reiver id via AJAX
function getMsgBody(id)
{
var msgid = id.substr(0, id.indexOf('_'));
var recid = id.substr(id.indexOf('_') + 1);
$.ajax(
{
dataType: "json",
url: "<?php echo base_url("/index.ci.php/system/Messages/getMessageFromIds/") ?>" + msgid + "/" + recid,
success: function (data, textStatus, jqXHR)
{
$("#msgsubject").text(data[0].subject);
tinyMCE.get("msgbody").setContent(data[0].body);
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText);
}
}
)
}
</script>
+79 -5
View File
@@ -22,11 +22,82 @@ $href = site_url().'/system/Messages/send/';
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">Send Message</h3>
<h3 class="page-header"><?php echo ucfirst($this->p->t('ui', 'nachrichtSenden')) ?></h3>
</div>
</div>
<form id="sendForm" method="post" action="<?php echo $href; ?>">
<?php $this->load->view('system/messageForm.php'); ?>
<div class="row">
<div class="form-group">
<div class="col-lg-1">
<label><?php echo ucfirst($this->p->t('global', 'empfaenger')) . ':'?></label>
</div>
<div class="col-lg-11">
<?php
for ($i = 0; $i < count($receivers); $i++)
{
$receiver = $receivers[$i];
// Every 10 recipients a new line
if ($i > 1 && $i % 10 == 0)
{
echo '<br>';
}
echo $receiver->Vorname." ".$receiver->Nachname."; ";
}
?>
</div>
</div>
</div>
<div class="row">
<div class="form-group form-inline">
<div class="col-lg-1 msgfield">
<label><?php echo ucfirst($this->p->t('global', 'betreff')) . ':'?></label>
</div>&nbsp;
<?php
$subject = '';
if (isset($message))
{
$subject = 'Re: '.$message->subject;
}
?>
<div class="col-lg-10">
<input id="subject" class="form-control" type="text" value="<?php echo $subject; ?>"
name="subject" size="70">
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-10">
<label><?php echo ucfirst($this->p->t('global', 'nachricht')) . ':'?></label>
<?php
$body = '';
if (isset($message))
{
$body = $message->body;
}
?>
<textarea id="bodyTextArea" name="body"><?php echo $body; ?></textarea>
</div>
<?php
if (isset($variables)):
?>
<div class="col-lg-2">
<div class="form-group">
<label><?php echo ucfirst($this->p->t('ui', 'felder')) . ':'?></label>
<select id="variables" class="form-control" size="14" multiple="multiple">
<?php
foreach ($variables as $key => $val)
{
?>
<option value="<?php echo $key; ?>"><?php echo $val; ?></option>
<?php
}
?>
</select>
</div>
</div>
<?php endif; ?>
</div>
<br>
<div class="row">
<div class="col-lg-3 text-right">
@@ -38,21 +109,24 @@ $href = site_url().'/system/Messages/send/';
);
?>
</div>
<div class="col-lg-offset-6 col-lg-1 text-right">
<button id="sendButton" class="btn btn-default" type="button"><?php echo $this->p->t('ui', 'senden')?></button>
</div>
</div>
<?php if (isset($receivers) && count($receivers) > 0): ?>
<hr>
<div class="row">
<div class="col-lg-12">
<label>Preview:</label>
<label><?php echo ucfirst($this->p->t('global', 'vorschau')) . ':'?></label>
</div>
</div>
<div class="well">
<div class="row">
<div class="col-lg-5">
<div class="form-grop form-inline">
<label>Recipient:</label>
<label><?php echo ucfirst($this->p->t('global', 'empfaenger')) . ': ' ?></label>
<select id="recipients">
<?php
<?php
if (count($receivers) > 1)
echo '<option value="-1">Select...</option>';
+59 -10
View File
@@ -2,7 +2,7 @@
if (! defined('BASEPATH')) exit('No direct script access allowed');
// Retrives the URL path of the called controller + controller method
// Retrives the URL path of the called controller + called controller method
// NOTE: placed here because it doesn't work inside functions
$calledPath = $this->router->directory.$this->router->class;
$calledMethod = $this->router->method;
@@ -11,16 +11,20 @@ $calledMethod = $this->router->method;
$title = isset($title) ? $title : null;
$customCSSs = isset($customCSSs) ? $customCSSs : null;
$customJSs = isset($customJSs) ? $customJSs : null;
$phrases = isset($phrases) ? $phrases : null;
// By default set the parameters to false
$jquery = isset($jquery) ? $jquery : false;
$jqueryui = isset($jqueryui) ? $jqueryui : false;
$ajaxlib = isset($ajaxlib) ? $ajaxlib : false;
$bootstrap = isset($bootstrap) ? $bootstrap : false;
$fontawesome = isset($fontawesome) ? $fontawesome : false;
$tablesorter = isset($tablesorter) ? $tablesorter : false;
$tinymce = isset($tinymce) ? $tinymce : false;
$sbadmintemplate = isset($sbadmintemplate) ? $sbadmintemplate : false;
$addons = isset($addons) ? $addons : false;
$filterwidget = isset($filterwidget) ? $filterwidget : false;
$navigationwidget = isset($navigationwidget) ? $navigationwidget : false;
/**
* Print the given title of the page
@@ -81,6 +85,25 @@ function _generateJSDataStorageObject($calledPath, $calledMethod)
echo $toPrint;
}
/**
* Generates global JS-Object to pass phrases to other javascripts
*/
function _generateJSPhrasesStorageObject($phrases)
{
$ci =& get_instance();
$ci->load->library('PhrasesLib', array($phrases), 'pj');
$toPrint = "\n";
$toPrint .= '<script type="text/javascript">';
$toPrint .= "\n";
$toPrint .= ' var FHC_JS_PHRASES_STORAGE_OBJECT = '.$ci->pj->getJSON().';';
$toPrint .= "\n";
$toPrint .= '</script>';
$toPrint .= "\n\n";
echo $toPrint;
}
/**
* Generates tags for the javascripts you want to include, the parameter could by a string or an array of strings
*/
@@ -141,12 +164,15 @@ function _generateAddonsJSsInclude($calledFrom)
// jQuery UI CSS
if ($jqueryui === true) _generateCSSsInclude('vendor/components/jqueryui/themes/base/jquery-ui.min.css');
// bootstrap CSS
// Bootstrap CSS
if ($bootstrap === true) _generateCSSsInclude('vendor/twbs/bootstrap/dist/css/bootstrap.min.css');
// font awesome CSS
// Font Awesome CSS
if ($fontawesome === true) _generateCSSsInclude('vendor/components/font-awesome/css/font-awesome.min.css');
// AjaxLib CSS
if ($ajaxlib === true) _generateCSSsInclude('public/css/AjaxLib.css');
// Table sorter CSS
if ($tablesorter === true)
{
@@ -154,23 +180,34 @@ function _generateAddonsJSsInclude($calledFrom)
_generateCSSsInclude('vendor/mottie/tablesorter/dist/css/jquery.tablesorter.pager.min.css');
}
// sb admin template CSS
// SB Admin 2 template CSS
if ($sbadmintemplate === true)
{
_generateCSSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/vendor/metisMenu/metisMenu.min.css');
_generateCSSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/dist/css/sb-admin-2.min.css');
}
// FilterWidget CSS
if ($filterwidget === true) _generateCSSsInclude('public/css/FilterWidget.css');
// NavigationWidget CSS
if ($navigationwidget === true) _generateCSSsInclude('public/css/NavigationWidget.css');
// Eventually required CSS
_generateCSSsInclude($customCSSs); // Eventually required CSS
// --------------------------------------------------------------------------------------------------------
// Javascripts
// Generates the global object to pass useful parms to the other javascripts
// Generates the global object to pass useful parameters to other javascripts
// NOTE: must be called before any other JS include
_generateJSDataStorageObject($calledPath, $calledMethod);
// Generates the global object to pass phrases to javascripts
// NOTE: must be called before including the PhrasesLib.js
_generateJSPhrasesStorageObject($phrases);
// JQuery V3
if ($jquery === true) _generateJSsInclude('vendor/components/jquery/jquery.min.js');
@@ -178,11 +215,10 @@ function _generateAddonsJSsInclude($calledFrom)
if ($jqueryui === true)
{
_generateJSsInclude('vendor/components/jqueryui/jquery-ui.min.js');
//datepicker german language file
_generateJSsInclude('vendor/components/jqueryui/ui/i18n/datepicker-de.js');
_generateJSsInclude('vendor/components/jqueryui/ui/i18n/datepicker-de.js'); // datepicker german language file
}
// bootstrap JS
// Bootstrap JS
if ($bootstrap === true) _generateJSsInclude('vendor/twbs/bootstrap/dist/js/bootstrap.min.js');
// Table sorter JS
@@ -193,16 +229,29 @@ function _generateAddonsJSsInclude($calledFrom)
_generateJSsInclude('vendor/mottie/tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js');
}
//tinymce JS
// Tinymce JS
if($tinymce === true) _generateJSsInclude('vendor/tinymce/tinymce/tinymce.min.js') ;
// sb admin template JS
// SB Admin 2 template JS
if ($sbadmintemplate === true)
{
_generateJSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/vendor/metisMenu/metisMenu.min.js');
_generateJSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/dist/js/sb-admin-2.min.js');
}
// AjaxLib JS
// NOTE: must be called before including others JS libraries that use it
if ($ajaxlib === true) _generateJSsInclude('public/js/AjaxLib.js');
// PhrasesLib JS
if ($phrases != null) _generateJSsInclude('public/js/PhrasesLib.js');
// FilterWidget JS
if($filterwidget === true) _generateJSsInclude('public/js/FilterWidget.js') ;
// NavigationWidget JS
if($navigationwidget === true) _generateJSsInclude('public/js/NavigationWidget.js') ;
// Load addon hooks JS
if ($addons === true) _generateAddonsJSsInclude($calledPath.'/'.$calledMethod);
+12 -163
View File
@@ -1,190 +1,36 @@
<style>
.filter-options-span {
display: inline-block;
width: 130px;
font-weight: bold;
}
.filter-name-title {
font-family: inherit;
font-size: 16px;
/*font-weight: bold;*/
line-height: 1.1;
color: black;
}
.filters-hidden-panel {
margin: 0 10px 10px 10px;
}
.hidden-control {
display: none !important;
}
.filter-select-fields-dnd-div {
height: 50px;
}
.filter-select-field-dnd-span {
border: 1px solid black;
border-radius: 7px;
margin-left: 3px;
margin-right: 3px;
padding: 10px;
top: 10px;
}
.filter-select-field-dnd-span:hover {
cursor: move;
}
.filter-select-field-dnd-span a {
cursor: pointer;
}
.selection-before::before {
content: "";
position: absolute;
top: 0;
right: 100%;
height: 100%;
margin-right: 3px;
border-left: 2px solid #428bca;
}
.selection-after::after {
content: "";
position: absolute;
top: 0;
left: 100%;
height: 100%;
margin-left: 3px;
border-right: 2px solid #428bca;
}
.select-filter-operation {
display: inline;
width: 130px;
}
.select-filter-operation-value {
display: inline;
width: 400px;
}
.select-filter-option {
display: inline;
width: 100px;
}
#addField, #customFilterDescription, #addFilter {
display: inline;
width: 535px;
}
#selectedFilters {
margin-bottom: 20px;
}
#applyFilter, #saveCustomFilterButton, .remove-selected-filter {
font-weight: bold;
}
#applyFilter, #saveCustomFilterButton {
width: 100px;
}
.remove-selected-filter {
padding-bottom: 3px;
}
.panel-title {
font-weight: bold;
padding-top: 3px;
}
.remove-field {
font-weight: bold;
}
</style>
<script language="Javascript" type="text/javascript">
function sideMenuHook()
{
$(".remove-filter").click(function() {
$.ajax({
url: "<?php echo site_url('system/Filters/deleteCustomFilter'); ?>",
method: "POST",
data: {
filter_id: $(this).attr('value'),
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
refreshSideMenu();
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
});
}
$(document).ready(function() {
$("[data-toggle='collapse']").click(function() {
var filterOptionsStatus = sessionStorage.getItem('filter-options-status');
if (filterOptionsStatus != null && filterOptionsStatus == 'closed')
{
sessionStorage.setItem('filter-options-status', 'open');
}
else
{
sessionStorage.setItem('filter-options-status', 'closed');
}
});
var filterOptionsStatus = sessionStorage.getItem('filter-options-status');
if (filterOptionsStatus != null && filterOptionsStatus == 'open')
{
$('.collapse').collapse("show");
}
});
</script>
<div class="row">
<div class="col-lg-12">
<?php FilterWidget::displayFilterName(); ?>
<!-- Filter name -->
<div class="filter-name-title"></div>
<br>
<!-- Filter options -->
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapseFilterHeader">Filter options</a>
<a data-toggle="collapse" href="#collapseFilterHeader"><?php echo ucfirst($this->p->t('filter', 'filterEinstellungen')) ?></a>
</h4>
</div>
<div id="collapseFilterHeader" class="panel-collapse collapse">
<div class="filters-hidden-panel">
<!-- Filter fields options -->
<div>
<?php FilterWidget::loadViewSelectFields(); ?>
</div>
<br>
<!-- Filter filters options -->
<div>
<?php FilterWidget::loadViewSelectFilters(); ?>
</div>
<br>
<!-- Filter save options -->
<div>
<?php FilterWidget::loadViewSaveFilter(); ?>
</div>
@@ -195,12 +41,15 @@
<br>
<!-- Filter info top -->
<div id="datasetActionsTop"></div>
<!-- Filter table -->
<div>
<?php FilterWidget::loadViewTableDataset(); ?>
</div>
<!-- Filter info bottom -->
<div id="datasetActionsBottom"></div>
</div>
@@ -1,48 +1,15 @@
<script language="Javascript" type="text/javascript">
$(document).ready(function() {
$("#saveCustomFilterButton").click(function() {
if ($("#customFilterDescription").val() != '')
{
$.ajax({
url: "<?php echo site_url('system/Filters/saveFilter'); ?>",
method: "POST",
data: {
customFilterDescription: $("#customFilterDescription").val(),
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
refreshSideMenu()
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
}
else
{
alert("Please fill te description of this filter");
}
});
});
</script>
<br>
<div>
<span class="filter-options-span">
Filter description:
<span class="filter-span-label">
<?php echo ucfirst($this->p->t('global', 'beschreibung')); ?>:
</span>
<span>
<input type="text" id="customFilterDescription" value="">
<input type="text" id="customFilterDescription" class="input-text-custom-filter" value="">
</span>
<span>
<input type="button" id="saveCustomFilterButton" value="Save filter">
<input type="button" id="saveCustomFilterButton" value="<?php echo ucfirst($this->p->t('ui', 'speichern')); ?>">
</span>
</div>
@@ -1,247 +1,11 @@
<script language="Javascript" type="text/javascript">
<div id="dragAndDropFieldsArea" class="drag-and-drop-fields-area"></div>
function dndSF()
{
$(".filter-select-field-dnd-span").draggable({
containment: "parent",
cursor: "move",
opacity: 0.4,
revert: "invalid",
revertDuration: 200,
drag: function(event, ui) {
<div>
<span class="filter-span-label">
<?php echo ucfirst($this->p->t('filter', 'feldHinzufuegen')); ?>:
</span>
var padding = 20;
var draggedElement = $(this);
$(".filter-select-field-dnd-span").each(function(i, e) {
if ($(this).attr('id') != draggedElement.attr('id'))
{
$(this).removeClass("selection-after");
$(this).removeClass("selection-before");
var elementCenter = $(this).offset().left + ((padding + $(this).width()) / 2);
if (event.pageX > ($(this).offset().left - (padding / 2))
&& event.pageX < ($(this).offset().left + $(this).width() + (padding / 2)))
{
if (event.pageX > elementCenter)
{
$(this).addClass("selection-after");
$(this).removeClass("selection-before");
}
else if (event.pageX < elementCenter)
{
$(this).addClass("selection-before");
$(this).removeClass("selection-after");
}
}
}
});
}
});
$(".filter-select-field-dnd-span").droppable({
accept: ".filter-select-field-dnd-span",
drop: function(event, ui) {
var padding = 20;
var elementCenter = $(this).offset().left + ((padding + $(this).width()) / 2);
var draggedElement = ui.helper;
if (event.pageX > elementCenter)
{
draggedElement.insertAfter($(this));
}
else if (event.pageX < elementCenter)
{
draggedElement.insertBefore($(this));
}
$(this).removeClass("selection-before");
$(this).removeClass("selection-after");
draggedElement.css({left: '0px', top: '10px'});
var arrayDndId = [];
$(".filter-select-field-dnd-span").each(function(i, e) {
arrayDndId[i] = $(this).attr('id').replace('dnd', '');
});
$.ajax({
url: "<?php echo site_url('system/Filters/sortSelectedFields'); ?>",
method: "POST",
data: {
selectedFieldsLst: arrayDndId,
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
resetSelectedFields();
renderSelectedFields();
renderTableDataset();
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
}
});
}
function resetEventsSF()
{
$("#addField").off('change');
$(".remove-field").off('click');
}
function addEventsSF()
{
$("#addField").change(function(event) {
$.ajax({
url: "<?php echo site_url('system/Filters/addSelectedFields'); ?>",
method: "POST",
data: {
fieldName: $(this).val(),
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
resetSelectedFields();
renderSelectedFields();
renderTableDataset();
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
});
$(".remove-field").click(function(event) {
$.ajax({
url: "<?php echo site_url('system/Filters/removeSelectedFields'); ?>",
method: "POST",
data: {
fieldName: $(this).attr('fieldToRemove'),
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
resetSelectedFields();
renderSelectedFields();
renderTableDataset();
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
});
}
function renderSelectedFields()
{
$.ajax({
url: "<?php echo site_url('system/Filters/selectFields'); ?>",
method: "GET",
data: {
fhc_controller_id: getUrlParameter("fhc_controller_id")
},
dataType: "json"
})
.done(function(data, textStatus, jqXHR) {
resetEventsSF();
if (data != null)
{
var arrayFieldsToDisplay = [];
if (data.columnsAliases != null && $.isArray(data.columnsAliases))
{
arrayFieldsToDisplay = data.columnsAliases;
}
else if (data.selectedFields != null && $.isArray(data.selectedFields))
{
arrayFieldsToDisplay = data.selectedFields;
}
for (var i = 0; i < arrayFieldsToDisplay.length; i++)
{
var fieldToDisplay = arrayFieldsToDisplay[i];
var fieldName = data.selectedFields[i];
var strHtml = '<span id="dnd' + fieldName + '" class="filter-select-field-dnd-span">';
strHtml += '<span>';
strHtml += fieldToDisplay;
strHtml += '</span>';
strHtml += '<span><a class="remove-field" fieldToRemove="' + fieldName + '"> X </a></span>';
strHtml += '</span>';
$("#filterSelectFieldsDnd").append(strHtml);
}
var strDropDown = '<option value="">Select a field to add...</option>';
$("#addField").append(strDropDown);
for (var i = 0; i < data.allSelectedFields.length; i++)
{
var fieldName = data.allSelectedFields[i];
var fieldToDisplay = data.allSelectedFields[i];
if (data.selectedFields.indexOf(fieldName) < 0)
{
if (data.allColumnsAliases != null && $.isArray(data.allColumnsAliases))
{
fieldToDisplay = data.allColumnsAliases[i];
}
strDropDown = '<option value="' + fieldName + '">' + fieldToDisplay + '</option>';
$("#addField").append(strDropDown);
}
}
}
dndSF();
addEventsSF();
})
.fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
}
function resetSelectedFields()
{
$("#filterSelectFieldsDnd").html("");
$("#addField").html("");
}
$(document).ready(function() {
renderSelectedFields();
});
</script>
<div id="filterSelectFieldsDnd" class="filter-select-fields-dnd-div"></div>
<div>
<span class="filter-options-span">
Add field:
</span>
<span>
<select id="addField"></select>
</span>
</div>
<span>
<select id="addField" class="drop-down-fields"></select>
</span>
</div>
@@ -1,296 +1,17 @@
<script language="Javascript" type="text/javascript">
function resetEventsSFilters()
{
$("#addFilter").off('change');
}
function addEventsSFilters()
{
$("#addFilter").change(function(event) {
$.ajax({
url: "<?php echo site_url('system/Filters/addSelectedFilters'); ?>",
method: "POST",
data: {
fieldName: $(this).val(),
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
resetSelectedFilters();
renderSelectedFilters();
renderTableDataset();
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
});
$(".select-filter-operation").change(function() {
if ($(this).val() == "set" || $(this).val() == "nset")
{
$(this).parent().parent().find(".select-filter-operation-value").addClass("hidden-control");
$(this).parent().parent().find(".select-filter-option").addClass("hidden-control");
$(this).parent().parent().find(".select-filter-operation-value").prop('disabled', true);
$(this).parent().parent().find(".select-filter-option").prop('disabled', true);
}
else
{
$(this).parent().parent().find(".select-filter-operation-value").removeClass("hidden-control");
$(this).parent().parent().find(".select-filter-option").removeClass("hidden-control");
$(this).parent().parent().find(".select-filter-operation-value").prop('disabled', false);
$(this).parent().parent().find(".select-filter-option").prop('disabled', false);
}
});
$("#applyFilter").click(function() {
var selectFilterName = [];
var selectFilterOperation = [];
var selectFilterOperationValue = [];
var selectFilterOption = [];
$("#selectedFilters > div").each(function(i, e) {
var tmpSelectFilterName = $(this).find('.hidden-field-name').val();
var tmpSelectFilterOperation = $(this).find('.select-filter-operation').val();
var tmpSelectFilterOperationValue = $(this).find('.select-filter-operation-value:enabled').val();
var tmpSelectFilterOption = $(this).find('.select-filter-option:enabled').val();
selectFilterName.push(tmpSelectFilterName);
selectFilterOperation.push(tmpSelectFilterOperation);
selectFilterOperationValue.push(tmpSelectFilterOperationValue != null ? tmpSelectFilterOperationValue : "");
selectFilterOption.push(tmpSelectFilterOption != null ? tmpSelectFilterOption : "");
});
$.ajax({
url: "<?php echo site_url('system/Filters/applyFilter'); ?>",
method: "POST",
data: {
filterNames: selectFilterName,
filterOperations: selectFilterOperation,
filterOperationValues: selectFilterOperationValue,
filterOptions: selectFilterOption,
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
// Success
}).fail(function(jqXHR, textStatus, errorThrown) {
// Error
}).always(function() {
location.reload();
});
});
$(".remove-selected-filter").click(function(event) {
$.ajax({
url: "<?php echo site_url('system/Filters/removeSelectedFilters'); ?>",
method: "POST",
data: {
fieldName: $(this).attr('filterToRemove'),
fhc_controller_id: getUrlParameter("fhc_controller_id")
}
})
.done(function(data, textStatus, jqXHR) {
resetSelectedFilters();
renderSelectedFilters();
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
});
}
function renderSelectedFilterFields(metaData, activeFilters, activeFiltersOperation, activeFiltersOption)
{
var html = '';
if (metaData.type.toLowerCase().indexOf("int") >= 0)
{
html = '<span>';
html += ' <select class="form-control select-filter-operation">';
html += ' <option value="equal" ' + (activeFiltersOperation == "equal" ? "selected" : "") + '>equal</option>';
html += ' <option value="nequal" ' + (activeFiltersOperation == "nqual" ? "selected" : "") + '>not equal</option>';
html += ' <option value="gt" ' + (activeFiltersOperation == "gt" ? "selected" : "") + '>greater than</option>';
html += ' <option value="lt" ' + (activeFiltersOperation == "lt" ? "selected" : "") + '>less than</option>';
html += ' </select>';
html += '</span>';
html += '<span>';
html += ' <input type="number" value="' + activeFilters + '" class="form-control select-filter-operation-value">';
html += '</span>';
}
if (metaData.type.toLowerCase().indexOf('varchar') >= 0 || metaData.type.toLowerCase() == 'text')
{
html = '<span>';
html += ' <select class="form-control select-filter-operation">';
html += ' <option value="contains" ' + (activeFiltersOperation == "contains" ? "selected" : "") + '>contains</option>';
html += ' <option value="ncontains" ' + (activeFiltersOperation == "ncontains" ? "selected" : "") + '>does not contain</option>';
html += ' </select>';
html += '</span>';
html += '<span>';
html += ' <input type="text" value="' + activeFilters + '" class="form-control select-filter-operation-value">';
html += '</span>';
}
if (metaData.type.toLowerCase().indexOf('bool') >= 0)
{
html = '<span>';
html += ' <select class="form-control select-filter-operation">';
html += ' <option value="true" ' + (activeFiltersOperation == "true" ? "selected" : "") + '>is true</option>';
html += ' <option value="false" ' + (activeFiltersOperation == "false" ? "selected" : "") + '>is false</option>';
html += ' </select>';
html += '</span>';
html += '<span>';
html += ' <input type="hidden" value="' + activeFilters + '" class="form-control select-filter-operation-value">';
html += '</span>';
}
if (metaData.type.toLowerCase().indexOf('timestamp') >= 0 || metaData.type.toLowerCase().indexOf('date') >= 0)
{
var classOperation = 'form-control select-filter-operation-value';
var classOption = 'form-control select-filter-option';
var disabled = "";
if (activeFiltersOperation == "set" || activeFiltersOperation == "nset")
{
classOperation += ' hidden-control';
classOption += ' hidden-control';
disabled = "disabled";
}
html = '<span>';
html += ' <select class="form-control select-filter-operation">';
html += ' <option value="lt" ' + (activeFiltersOperation == "lt" ? "selected" : "") + '>less than</option>';
html += ' <option value="gt" ' + (activeFiltersOperation == "gt" ? "selected" : "") + '>greater than</option>';
html += ' <option value="set" ' + (activeFiltersOperation == "set" ? "selected" : "") + '>is set</option>';
html += ' <option value="nset" ' + (activeFiltersOperation == "nset" ? "selected" : "") + '>is not set</option>';
html += ' </select>';
html += '</span>';
html += '<span>';
html += ' <input type="text" value="' + activeFilters + '" class="' + classOperation + '" ' + disabled + '>';
html += '</span>';
html += '<span>';
html += ' <select class="' + classOption + '" ' + disabled + '>';
html += ' <option value="days" ' + (activeFiltersOption == "days" ? "selected" : "") + '>Days</option>';
html += ' <option value="months" ' + (activeFiltersOption == "months" ? "selected" : "") + '>Months</option>';
html += ' </select>';
html += '</span>';
}
html += '<span>';
html += ' <input type="hidden" value="' + metaData.name + '" class="hidden-field-name">';
html += '</span>';
return html;
}
function renderSelectedFilters()
{
$.ajax({
url: "<?php echo site_url('system/Filters/selectFilters'); ?>",
method: "GET",
data: {
fhc_controller_id: getUrlParameter("fhc_controller_id")
},
dataType: "json"
})
.done(function(data, textStatus, jqXHR) {
resetEventsSFilters();
if (data != null)
{
var strDropDown = '<option value="">Select a filter to add...</option>';
$("#addFilter").append(strDropDown);
for (var i = 0; i < data.selectedFilters.length; i++)
{
var selectedFilters = '<div>';
selectedFilters += '<span class="filter-options-span">';
selectedFilters += data.selectedFiltersAliases[i];
selectedFilters += '</span>';
selectedFilters += renderSelectedFilterFields(
data.selectedFiltersMetaData[i],
data.selectedFiltersActiveFilters[i],
data.selectedFiltersActiveFiltersOperation[i],
data.selectedFiltersActiveFiltersOption[i]
);
selectedFilters += '<span>';
selectedFilters += '<input type="button" value="X" class="remove-selected-filter btn btn-default" filterToRemove="' + data.selectedFilters[i] + '">';
selectedFilters += '</span>';
selectedFilters += '</div>';
$("#selectedFilters").append(selectedFilters);
}
for (var i = 0; i < data.allSelectedFields.length; i++)
{
var fieldName = data.allSelectedFields[i];
var fieldToDisplay = data.allSelectedFields[i];
if (data.selectedFilters.indexOf(fieldName) < 0)
{
if (data.allColumnsAliases != null && $.isArray(data.allColumnsAliases))
{
fieldToDisplay = data.allColumnsAliases[i];
}
strDropDown = '<option value="' + fieldName + '">' + fieldToDisplay + '</option>';
$("#addFilter").append(strDropDown);
}
}
}
addEventsSFilters();
})
.fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
}
function resetSelectedFilters()
{
$("#addFilter").html("");
$("#selectedFilters").html("");
}
$(document).ready(function() {
renderSelectedFilters();
});
</script>
<br>
<div id="selectedFilters"></div>
<div id="appliedFilters"></div>
<div>
<span class="filter-options-span">
Add filter:
<span class="filter-span-label">
<?php echo ucfirst($this->p->t('filter', 'filterHinzufuegen')); ?>:
</span>
<span>
<select id="addFilter"></select>
<select id="addFilter" class="drop-down-filters"></select>
</span>
<span>
<input id="applyFilter" type="button" value="Apply filter">
<input id="applyFilter" type="button" value="<?php echo ucfirst($this->p->t('global', 'hinzufuegen')); ?>">
</span>
</div>
@@ -1,153 +1,3 @@
<script language="Javascript" type="text/javascript">
function callTableSorter()
{
// Checks if the table contains data (rows)
if ($('#filterTableDataset').find('tbody:empty').length == 0
&& $('#filterTableDataset').find('tr:empty').length == 0
&& $('#filterTableDataset').hasClass('table-condensed'))
{
$("#filterTableDataset").tablesorter({
widgets: ["zebra", "filter"]
});
var config = $('#filterTableDataset')[0].config;
$.tablesorter.updateAll(config, true, null);
}
}
function renderTableDataset()
{
$.ajax({
url: "<?php echo site_url('system/Filters/tableDataset'); ?>",
method: "GET",
data: {
fhc_controller_id: getUrlParameter("fhc_controller_id")
},
dataType: "json"
})
.done(function(data, textStatus, jqXHR) {
resetTableDataset();
if (data != null)
{
if (data.checkboxes != null)
{
$("#filterTableDataset > thead > tr").append("<th title=\"Select\">Select</th>");
}
var arrayFieldsToDisplay = [];
if (data.columnsAliases != null && $.isArray(data.columnsAliases) && data.columnsAliases.length > 0)
{
arrayFieldsToDisplay = data.columnsAliases;
}
else if (data.selectedFields != null && $.isArray(data.selectedFields))
{
arrayFieldsToDisplay = data.selectedFields;
}
/* ------------------------------------------------------------------------------------------------ */
if (data.checkboxes != null && data.checkboxes != "")
{
$("#filterTableDataset > thead > tr").html("<th title=\"Select\">Select</th>");
}
for (var i = 0; i < arrayFieldsToDisplay.length; i++)
{
var th = arrayFieldsToDisplay[i];
$("#filterTableDataset > thead > tr").append("<th title=\"" + th + "\">" + th + "</th>");
}
if (data.additionalColumns != null && $.isArray(data.additionalColumns))
{
for (var i = 0; i < data.additionalColumns.length; i++)
{
var th = data.additionalColumns[i];
$("#filterTableDataset > thead > tr").append("<th title=\"" + th + "\">" + th + "</th>");
}
}
/* ------------------------------------------------------------------------------------------------ */
if (arrayFieldsToDisplay.length > 0)
{
if (data.dataset != null && $.isArray(data.dataset))
{
for (var i = 0; i < data.dataset.length; i++)
{
var record = data.dataset[i];
var strHtml = '<tr class="' + record.FILTER_CLASS_MARK_ROW + '">';
if (data.checkboxes != null && data.checkboxes != "")
{
strHtml += '<td>';
strHtml += '<input type="checkbox" name="' + data.checkboxes + '[]" value="' + record[data.checkboxes] + '">';
strHtml += '</td>';
}
$.each(arrayFieldsToDisplay, function(i, fieldToDisplay) {
if (record.hasOwnProperty(data.selectedFields[i]))
{
strHtml += '<td>' + record[data.selectedFields[i]] + '</td>';
}
});
if (data.additionalColumns != null && $.isArray(data.additionalColumns))
{
$.each(data.additionalColumns, function(i, additionalColumn) {
if (record.hasOwnProperty(additionalColumn))
{
strHtml += '<td>' + record[additionalColumn] + '</td>';
}
});
}
strHtml += '</tr>';
$("#filterTableDataset > tbody").append(strHtml);
}
}
else
{
// console.log("No dataset!!!");
}
}
else
{
console.log("No fields to display!!!");
}
}
else
{
console.log("No data!!!");
}
callTableSorter();
})
.fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
}
function resetTableDataset()
{
$("#filterTableDataset > thead > tr").html("");
$("#filterTableDataset > tbody").html("");
}
$(document).ready(function() {
renderTableDataset();
});
</script>
<div>
<table class="tablesorter table-bordered table-responsive" id="filterTableDataset">
<thead>
+8 -8
View File
@@ -1,9 +1,9 @@
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<?php
// Header
echo $this->widgetlib->widget('NavigationHeaderWidget');
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<?php
// Header
echo $this->widgetlib->widget('NavigationHeaderWidget');
// Left menu
echo $this->widgetlib->widget('NavigationMenuWidget');
?>
</nav>
// Left menu
echo $this->widgetlib->widget('NavigationMenuWidget');
?>
</nav>
+11 -39
View File
@@ -1,39 +1,11 @@
<script language="Javascript" type="text/javascript">
$(document).ready(function() {
$.ajax({
url: "<?php echo site_url('system/Navigation/header'); ?>",
method: "GET",
data: {
navigation_widget_called: "<?php echo $this->router->directory.$this->router->class.'/'.$this->router->method; ?>"
}
})
.done(function(data, textStatus, jqXHR) {
if (data != null)
{
jQuery.each(data, function(i, e) {
$(".menu-header-items").append('<a class="navbar-brand" href="' + e + '">' + i + '</a>');
});
}
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
});
</script>
<div class="navbar-header">
<span>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Men&uuml; umschalten </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</span>
<span class="menu-header-items"></span>
</div>
<div class="navbar-header">
<span>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Men&uuml; umschalten </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</span>
<span class="menu-header-items"></span>
</div>
@@ -1,169 +1,3 @@
<style>
#collapseinicon {
display: none;
cursor: pointer;
color: #337ab7;
border-bottom: 1px solid #e7e7e7;
border-right: 1px solid #e7e7e7;
border-left: 1px solid #e7e7e7;
position: absolute;
width: 45px;
height: 20px;
background-color: #F8F8F8;
}
.nav > li > span > a:focus, .nav > li > span > a:hover {
text-decoration: none;
}
.nav > li > span {
position: relative;
display: inline-block;
padding-top: 15px;
padding-bottom: 15px;
}
.menuSubscriptLink {
font-size: 10px;
padding-left: 0px !important;
padding-right: 0px !important;
}
.sidebar ul li span a.active {
background-color: transparent;
font-weight: bold;
text-decoration: underline;
}
</style>
<script language="Javascript" type="text/javascript">
function printNavItem(item, depth = 1)
{
strMenu = "";
var expanded = typeof item['expand'] != 'undefined' && item['expand'] === true ? ' active' : '';
strMenu += '<li class="' + expanded + '">';
if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined')
{
strMenu += '<span>';
}
strMenu += '<a href="' + item['link'] + '"' + expanded + '>';
if (item['icon'] != 'undefined')
{
strMenu += '<i class="fa fa-' + item['icon'] + ' fa-fw"></i> ';
}
strMenu += item['description'];
if (typeof item['children'] != 'undefined' && Object.keys(item['children']).length > 0)
{
strMenu += '<span class="fa arrow"></span>';
}
strMenu += '</a>';
if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined')
{
strMenu += '<a class="' + item['subscriptLinkClass'] + ' menuSubscriptLink" value="' + item['subscriptLinkValue'] + '" href="#"> (' + item['subscriptDescription'] + ')</a>';
strMenu += '</span>';
}
if (typeof item['children'] != 'undefined' && Object.keys(item['children']).length > 0)
{
var level = '';
if (depth === 1)
{
level = 'second';
}
else if (depth > 1)
{
level = 'third';
}
strMenu += '<ul class="nav nav-' + level + '-level" ' + expanded + '>';
jQuery.each(item['children'], function(i, e) {
strMenu += printNavItem(e, ++depth);
});
strMenu += '</ul>';
}
strMenu += '</li>';
return strMenu;
}
function renderSideMenu()
{
$.ajax({
url: "<?php echo site_url('system/Navigation/menu'); ?>",
method: "GET",
data: {
navigation_widget_called: "<?php echo $this->router->directory.$this->router->class.'/'.$this->router->method; ?>"
}
})
.done(function(data, textStatus, jqXHR) {
if (data != null)
{
var strMenu = '';
printCollapseIcon();
jQuery.each(data, function(i, e) {
strMenu += printNavItem(e);
});
$("#side-menu").html(strMenu);
$("#side-menu").metisMenu();
}
if (typeof sideMenuHook == 'function')
{
sideMenuHook();
}
}).fail(function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
});
}
function printCollapseIcon()
{
// Hiding/showing navigation menu - works only with sb admin 2 template!!
if(!$("#collapseicon").length)
$("#side-menu").parent().append('<div id="collapseicon" title="hide Menu" class="text-right" style="cursor: pointer; color: #337ab7"><i class="fa fa-angle-double-left fa-fw"></i></div>');
$("#collapseicon").click(function() {
$("#page-wrapper").css('margin-left', '0px');
$("#side-menu").hide();
$("#collapseicon").hide();
$("#collapseinicon").show();
});
$("#collapseinicon").click(function() {
$("#page-wrapper").css('margin-left', '250px');
$("#side-menu").show();
$("#collapseicon").show();
$("#collapseinicon").hide();
});
}
$(document).ready(function() {
renderSideMenu();
});
</script>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu"></ul>
File diff suppressed because it is too large Load Diff
+20 -21
View File
@@ -1,22 +1,21 @@
<?php
class Nation_widget extends DropdownWidget
{
public function display($widgetData)
{
// Nation
$this->load->model('codex/nation_model', 'NationModel');
$this->NationModel->addOrder('nation_code');
$this->addSelectToModel($this->NationModel, 'nation_code', 'kurztext');
$this->setElementsArray(
$this->NationModel->load(),
true,
'Nation wählen...',
'keine Nation gefunden'
);
$this->loadDropDownView($widgetData);
}
<?php
class Nation_widget extends DropdownWidget
{
public function display($widgetData)
{
// Nation
$this->load->model('codex/nation_model', 'NationModel');
$this->NationModel->addOrder('nation_code');
$this->addSelectToModel($this->NationModel, 'nation_code', 'kurztext');
$this->setElementsArray(
$this->NationModel->load(),
true,
$this->p->t('ui', 'bitteEintragWaehlen')
);
$this->loadDropDownView($widgetData);
}
}
+1 -2
View File
@@ -27,8 +27,7 @@ class Vorlage_widget extends DropdownWidget
$this->setElementsArray(
$vorlage,
true,
'Select a vorlage...',
'No vorlage found'
$this->p->t('ui', 'vorlageWaehlen')
);
$this->loadDropDownView($widgetData);
+20 -21
View File
@@ -1,22 +1,21 @@
<?php
class Zgv_widget extends DropdownWidget
{
public function display($widgetData)
{
// Zgv
$this->load->model('codex/zgv_model', 'ZgvModel');
$this->ZgvModel->addOrder('zgv_bez');
$this->addSelectToModel($this->ZgvModel, 'zgv_code', 'zgv_bez');
$this->setElementsArray(
$this->ZgvModel->load(),
true,
'Zgv wählen...',
'keine Zgv gefunden'
);
$this->loadDropDownView($widgetData);
}
<?php
class Zgv_widget extends DropdownWidget
{
public function display($widgetData)
{
// Zgv
$this->load->model('codex/zgv_model', 'ZgvModel');
$this->ZgvModel->addOrder('zgv_bez');
$this->addSelectToModel($this->ZgvModel, 'zgv_code', 'zgv_bez');
$this->setElementsArray(
$this->ZgvModel->load(),
true,
$this->p->t('ui', 'bitteEintragWaehlen')
);
$this->loadDropDownView($widgetData);
}
}