@@ -6,40 +7,7 @@
-
-
-
-
+
diff --git a/application/views/widgets/filter/filterOptions.php b/application/views/widgets/filter/filterOptions.php
new file mode 100644
index 000000000..6f1dd3885
--- /dev/null
+++ b/application/views/widgets/filter/filterOptions.php
@@ -0,0 +1,35 @@
+
+
+
+
+
diff --git a/application/views/widgets/filter/tableDataset.php b/application/views/widgets/filter/tableDataset.php
index ca917503a..2f1b94e61 100644
--- a/application/views/widgets/filter/tableDataset.php
+++ b/application/views/widgets/filter/tableDataset.php
@@ -1,8 +1,7 @@
-
diff --git a/application/views/widgets/filter/tabulatorDataset.php b/application/views/widgets/filter/tabulatorDataset.php
new file mode 100644
index 000000000..f5efc50b3
--- /dev/null
+++ b/application/views/widgets/filter/tabulatorDataset.php
@@ -0,0 +1 @@
+
diff --git a/application/views/widgets/table/pivotUIDataset.php b/application/views/widgets/table/pivotUIDataset.php
new file mode 100644
index 000000000..0b43fcdac
--- /dev/null
+++ b/application/views/widgets/table/pivotUIDataset.php
@@ -0,0 +1 @@
+
diff --git a/application/views/widgets/table/table.php b/application/views/widgets/table/table.php
new file mode 100644
index 000000000..e73aec335
--- /dev/null
+++ b/application/views/widgets/table/table.php
@@ -0,0 +1,17 @@
+
+
diff --git a/application/views/widgets/table/tableDataset.php b/application/views/widgets/table/tableDataset.php
new file mode 100644
index 000000000..7c2f26ea5
--- /dev/null
+++ b/application/views/widgets/table/tableDataset.php
@@ -0,0 +1,7 @@
+
+
diff --git a/application/views/widgets/table/tabulatorDataset.php b/application/views/widgets/table/tabulatorDataset.php
new file mode 100644
index 000000000..4984284bc
--- /dev/null
+++ b/application/views/widgets/table/tabulatorDataset.php
@@ -0,0 +1 @@
+
diff --git a/application/widgets/Ausbildungssemester_widget.php b/application/widgets/Ausbildungssemester_widget.php
new file mode 100644
index 000000000..8200d8a63
--- /dev/null
+++ b/application/widgets/Ausbildungssemester_widget.php
@@ -0,0 +1,43 @@
+id = $i;
+ $ausbildungssemester_obj->description = $i;
+
+ $ausbildungssemester_arr []= $ausbildungssemester_obj;
+ }
+
+ $this->setElementsArray(
+ success($ausbildungssemester_arr),
+ true,
+ $this->p->t('lehre', 'ausbildungssemester'),
+ 'No Ausbildungssemester found'
+ );
+
+ $this->loadDropDownView($widgetData);
+ }
+}
\ No newline at end of file
diff --git a/application/widgets/FilterWidget.php b/application/widgets/FilterWidget.php
index 84a4d138b..1cef91c15 100644
--- a/application/widgets/FilterWidget.php
+++ b/application/widgets/FilterWidget.php
@@ -7,9 +7,11 @@ class FilterWidget extends Widget
{
// Paths of the views
const WIDGET_URL_FILTER = 'widgets/filter/filter';
+ const WIDGET_URL_FILTER_OPTIONS = 'widgets/filter/filterOptions';
const WIDGET_URL_SELECT_FIELDS = 'widgets/filter/selectFields';
const WIDGET_URL_DATASET_TABLESORTER = 'widgets/filter/tableDataset';
const WIDGET_URL_DATASET_PIVOTUI = 'widgets/filter/pivotUIDataset';
+ const WIDGET_URL_DATASET_TABULATOR = 'widgets/filter/tabulatorDataset';
const WIDGET_URL_SELECT_FILTERS = 'widgets/filter/selectFilters';
const WIDGET_URL_SAVE_FILTER = 'widgets/filter/saveFilter';
@@ -40,16 +42,23 @@ class FilterWidget extends Widget
// To have a column in the GUI with checkboxes to select rows in the table
private $_checkboxes;
- // To hide the GUI to operate or save the filter widget
- private $_hideHeader;
- private $_hideSave;
+ // To hide the GUI to operate with the filter widget or to save a custom filter
+ private $_hideOptions; // if true hides all the options
+ private $_hideSelectFields; // if true hides the fields selection
+ private $_hideSelectFilters; // if true hides the filters selections
+ private $_hideSave; // if true hides the GUI to save a custom filter
+ private $_hideMenu; // if true then the menu is not shown
private $_customMenu; // if true then method _setFilterMenu is NOT called
private $_datasetRepresentation; // dataset representation (ex: tablesorter, pivotUI, ...)
private $_datasetRepresentationOptions; // dataset representation options for tablesorter, pivotUI, ...
+ private $_datasetRepFieldsDefs; // dataset representation attributes for each record field
+
private $_reloadDataset; // Force Reload of Dataset
+ private $_sessionTimeout; // session expiring time
+
private static $_FilterWidgetInstance; // static property that contains the instance of itself
/**
@@ -61,18 +70,20 @@ class FilterWidget extends Widget
self::$_FilterWidgetInstance = $this; // set static property $_FilterWidgetInstance with this instance
- $this->load->library('FiltersLib'); // Loads the FiltersLib that contains all the used logic
+ $this->load->library('FilterWidgetLib'); // Loads the FilterWidgetLib that contains all the used logic
$this->_initFilterWidget($args); // checks parameters and initialize properties
+ $this->filterwidgetlib->setFilterUniqueIdByParams($args);
+
// Let's start if it's allowed
// NOTE: If it is NOT allowed then no data are loaded
- if ($this->filterslib->isAllowed($this->_requiredPermissions))
+ if ($this->filterwidgetlib->isAllowed($this->_requiredPermissions))
{
$this->_startFilterWidget();
// If a custom menu is not used, then default menu is used
- if ($this->_customMenu != true) $this->_setFilterMenu();
+ if ($this->_hideMenu != true && $this->_customMenu != true) $this->_setFilterMenu();
}
}
@@ -84,18 +95,33 @@ class FilterWidget extends Widget
*/
public function display($widgetData)
{
- $this->view(self::WIDGET_URL_FILTER); // GUI starts here
+ $this->view(self::WIDGET_URL_FILTER, array(
+ 'app' => $this->_app,
+ 'dataset' => $this->_datasetName,
+ 'filterid' => $this->_filterId
+ )); // GUI starts here
}
//------------------------------------------------------------------------------------------------------------------
// Public static methods used to load views and to access statically to some properies of the FilterWidget
+ /**
+ * Loads the view related to the filter options
+ */
+ public static function loadViewFilterOptions()
+ {
+ if (self::$_FilterWidgetInstance->_hideOptions != true)
+ {
+ self::_loadView(self::WIDGET_URL_FILTER_OPTIONS);
+ }
+ }
+
/**
* Loads the view related to the selected fields
*/
public static function loadViewSelectFields()
{
- if (self::$_FilterWidgetInstance->_hideHeader != true)
+ if (self::$_FilterWidgetInstance->_hideSelectFields != true)
{
self::_loadView(self::WIDGET_URL_SELECT_FIELDS);
}
@@ -106,7 +132,7 @@ class FilterWidget extends Widget
*/
public static function loadViewSelectFilters()
{
- if (self::$_FilterWidgetInstance->_hideHeader != true)
+ if (self::$_FilterWidgetInstance->_hideSelectFilters != true)
{
self::_loadView(self::WIDGET_URL_SELECT_FILTERS);
}
@@ -128,15 +154,20 @@ class FilterWidget extends Widget
*/
public static function loadViewDataset()
{
- if (self::$_FilterWidgetInstance->_datasetRepresentation == FiltersLib::DATASET_REP_TABLESORTER)
+ if (self::$_FilterWidgetInstance->_datasetRepresentation == FilterWidgetLib::DATASET_REP_TABLESORTER)
{
self::_loadView(self::WIDGET_URL_DATASET_TABLESORTER);
}
- if (self::$_FilterWidgetInstance->_datasetRepresentation == FiltersLib::DATASET_REP_PIVOTUI)
+ if (self::$_FilterWidgetInstance->_datasetRepresentation == FilterWidgetLib::DATASET_REP_PIVOTUI)
{
self::_loadView(self::WIDGET_URL_DATASET_PIVOTUI);
}
+
+ if (self::$_FilterWidgetInstance->_datasetRepresentation == FilterWidgetLib::DATASET_REP_TABULATOR)
+ {
+ self::_loadView(self::WIDGET_URL_DATASET_TABULATOR);
+ }
}
//------------------------------------------------------------------------------------------------------------------
@@ -157,122 +188,158 @@ class FilterWidget extends Widget
$this->_datasetName = null;
$this->_filterKurzbz = null;
$this->_filterId = null;
- $this->_reloadDataset = null;
+ $this->_reloadDataset = true; // by default the dataset is NOT cached in session
$this->_query = null;
$this->_additionalColumns = null;
$this->_columnsAliases = null;
$this->_formatRow = null;
$this->_markRow = null;
$this->_checkboxes = null;
- $this->_hideHeader = null;
+ $this->_hideOptions = null;
+ $this->_hideSelectFields = null;
+ $this->_hideSelectFilters = null;
$this->_hideSave = null;
+ $this->_hideMenu = null;
$this->_customMenu = null;
$this->_datasetRepresentation = null;
$this->_datasetRepresentationOptions = null;
+ $this->_datasetRepFieldsDefs = null;
+ $this->_sessionTimeout = FilterWidgetLib::SESSION_DEFAULT_TIMEOUT;
// Retrieved the required permissions parameter if present
- if (isset($args[FiltersLib::REQUIRED_PERMISSIONS_PARAMETER]))
+ if (isset($args[FilterWidgetLib::REQUIRED_PERMISSIONS]))
{
- $this->_requiredPermissions = $args[FiltersLib::REQUIRED_PERMISSIONS_PARAMETER];
+ $this->_requiredPermissions = $args[FilterWidgetLib::REQUIRED_PERMISSIONS];
}
// Parameters needed to retrieve univocally a filter from DB
- if (isset($args[FiltersLib::APP_PARAMETER]))
+ if (isset($args[FilterWidgetLib::APP]))
{
- $this->_app = $args[FiltersLib::APP_PARAMETER];
+ $this->_app = $args[FilterWidgetLib::APP];
}
- if (isset($args[FiltersLib::DATASET_NAME_PARAMETER]))
+ if (isset($args[FilterWidgetLib::DATASET_NAME]))
{
- $this->_datasetName = $args[FiltersLib::DATASET_NAME_PARAMETER];
+ $this->_datasetName = $args[FilterWidgetLib::DATASET_NAME];
}
- if (isset($args[FiltersLib::FILTER_KURZBZ_PARAMETER]))
+ if (isset($args[FilterWidgetLib::FILTER_KURZBZ]))
{
- $this->_filterKurzbz = $args[FiltersLib::FILTER_KURZBZ_PARAMETER];
+ $this->_filterKurzbz = $args[FilterWidgetLib::FILTER_KURZBZ];
}
- if (isset($args[FiltersLib::FILTER_ID]))
+ if (isset($args[FilterWidgetLib::FILTER_ID]))
{
- $this->_filterId = $args[FiltersLib::FILTER_ID];
+ $this->_filterId = $args[FilterWidgetLib::FILTER_ID];
}
// How to retrieve data for the filter: SQL statement or a result from DB
- if (isset($args[FiltersLib::QUERY_PARAMETER]))
+ if (isset($args[FilterWidgetLib::QUERY]))
{
- $this->_query = $args[FiltersLib::QUERY_PARAMETER];
+ $this->_query = $args[FilterWidgetLib::QUERY];
}
- if (isset($args[FiltersLib::DATASET_RELOAD_PARAMETER]))
+ if (isset($args[FilterWidgetLib::DATASET_RELOAD]))
{
- $this->_reloadDataset = $args[FiltersLib::DATASET_RELOAD_PARAMETER];
+ $this->_reloadDataset = $args[FilterWidgetLib::DATASET_RELOAD];
}
// Parameter is used to add extra columns to the dataset
- if (isset($args[FiltersLib::ADDITIONAL_COLUMNS])
- && is_array($args[FiltersLib::ADDITIONAL_COLUMNS])
- && count($args[FiltersLib::ADDITIONAL_COLUMNS]) > 0)
+ if (isset($args[FilterWidgetLib::ADDITIONAL_COLUMNS])
+ && is_array($args[FilterWidgetLib::ADDITIONAL_COLUMNS])
+ && count($args[FilterWidgetLib::ADDITIONAL_COLUMNS]) > 0)
{
- $this->_additionalColumns = $args[FiltersLib::ADDITIONAL_COLUMNS];
+ $this->_additionalColumns = $args[FilterWidgetLib::ADDITIONAL_COLUMNS];
}
// Parameter is used to add use aliases for the columns fo the dataset
- if (isset($args[FiltersLib::COLUMNS_ALIASES])
- && is_array($args[FiltersLib::COLUMNS_ALIASES])
- && count($args[FiltersLib::COLUMNS_ALIASES]) > 0)
+ if (isset($args[FilterWidgetLib::COLUMNS_ALIASES])
+ && is_array($args[FilterWidgetLib::COLUMNS_ALIASES])
+ && count($args[FilterWidgetLib::COLUMNS_ALIASES]) > 0)
{
- $this->_columnsAliases = $args[FiltersLib::COLUMNS_ALIASES];
+ $this->_columnsAliases = $args[FilterWidgetLib::COLUMNS_ALIASES];
}
// Parameter that contains a function to format the rows of the dataset
- if (isset($args[FiltersLib::FORMAT_ROW]) && is_callable($args[FiltersLib::FORMAT_ROW]))
+ if (isset($args[FilterWidgetLib::FORMAT_ROW]) && is_callable($args[FilterWidgetLib::FORMAT_ROW]))
{
- $this->_formatRow = $args[FiltersLib::FORMAT_ROW];
+ $this->_formatRow = $args[FilterWidgetLib::FORMAT_ROW];
}
// Parameter that contains a function to mark in the GUI the rows of the dataset
- if (isset($args[FiltersLib::MARK_ROW]) && is_callable($args[FiltersLib::MARK_ROW]))
+ if (isset($args[FilterWidgetLib::MARK_ROW]) && is_callable($args[FilterWidgetLib::MARK_ROW]))
{
- $this->_markRow = $args[FiltersLib::MARK_ROW];
+ $this->_markRow = $args[FilterWidgetLib::MARK_ROW];
}
// Parameter used to specify the column of the dataset that will be used
// as id of the checkboxes column in the GUI
- if (isset($args[FiltersLib::CHECKBOXES]))
+ if (isset($args[FilterWidgetLib::CHECKBOXES]))
{
- $this->_checkboxes = $args[FiltersLib::CHECKBOXES];
+ $this->_checkboxes = $args[FilterWidgetLib::CHECKBOXES];
}
- // To specify if the header to operate with the FilterWidget is shown or not
- if (isset($args[FiltersLib::HIDE_HEADER]) && is_bool($args[FiltersLib::HIDE_HEADER]))
+ // To specify if the filter options are shown ot not
+ if (isset($args[FilterWidgetLib::HIDE_OPTIONS]) && is_bool($args[FilterWidgetLib::HIDE_OPTIONS]))
{
- $this->_hideHeader = $args[FiltersLib::HIDE_HEADER];
+ $this->_hideOptions = $args[FilterWidgetLib::HIDE_OPTIONS];
+ }
+
+ // To specify if the form to select fields is shown or not
+ if (isset($args[FilterWidgetLib::HIDE_SELECT_FIELDS]) && is_bool($args[FilterWidgetLib::HIDE_SELECT_FIELDS]))
+ {
+ $this->_hideSelectFields = $args[FilterWidgetLib::HIDE_SELECT_FIELDS];
+ }
+
+ // To specify if the form to select filters is shown or not
+ if (isset($args[FilterWidgetLib::HIDE_SELECT_FILTERS]) && is_bool($args[FilterWidgetLib::HIDE_SELECT_FILTERS]))
+ {
+ $this->_hideSelectFilters = $args[FilterWidgetLib::HIDE_SELECT_FILTERS];
}
// To specify if the form to save a custom FilterWidget is shown or not
- if (isset($args[FiltersLib::HIDE_SAVE]) && is_bool($args[FiltersLib::HIDE_SAVE]))
+ if (isset($args[FilterWidgetLib::HIDE_SAVE]) && is_bool($args[FilterWidgetLib::HIDE_SAVE]))
{
- $this->_hideSave = $args[FiltersLib::HIDE_SAVE];
+ $this->_hideSave = $args[FilterWidgetLib::HIDE_SAVE];
+ }
+
+ // If the menu should be shown or not
+ if (isset($args[FilterWidgetLib::HIDE_MENU]) && is_bool($args[FilterWidgetLib::HIDE_MENU]))
+ {
+ $this->_hideMenu = $args[FilterWidgetLib::HIDE_MENU];
}
// If a custom menu is set
- if (isset($args[FiltersLib::CUSTOM_MENU]) && is_bool($args[FiltersLib::CUSTOM_MENU]))
+ if (isset($args[FilterWidgetLib::CUSTOM_MENU]) && is_bool($args[FilterWidgetLib::CUSTOM_MENU]))
{
- $this->_customMenu = $args[FiltersLib::CUSTOM_MENU];
+ $this->_customMenu = $args[FilterWidgetLib::CUSTOM_MENU];
}
// To specify how to represent the dataset (ex: tablesorter, pivotUI, ...)
- if (isset($args[FiltersLib::DATASET_REPRESENTATION])
- && ($args[FiltersLib::DATASET_REPRESENTATION] == FiltersLib::DATASET_REP_TABLESORTER
- || $args[FiltersLib::DATASET_REPRESENTATION] == FiltersLib::DATASET_REP_PIVOTUI))
+ if (isset($args[FilterWidgetLib::DATASET_REPRESENTATION])
+ && ($args[FilterWidgetLib::DATASET_REPRESENTATION] == FilterWidgetLib::DATASET_REP_TABLESORTER
+ || $args[FilterWidgetLib::DATASET_REPRESENTATION] == FilterWidgetLib::DATASET_REP_PIVOTUI
+ || $args[FilterWidgetLib::DATASET_REPRESENTATION] == FilterWidgetLib::DATASET_REP_TABULATOR))
{
- $this->_datasetRepresentation = $args[FiltersLib::DATASET_REPRESENTATION];
+ $this->_datasetRepresentation = $args[FilterWidgetLib::DATASET_REPRESENTATION];
}
// To specify options for the dataset representation (ex: tablesorter, pivotUI, ...)
- if (isset($args[FiltersLib::DATASET_REP_OPTIONS]) && !isEmptyString($args[FiltersLib::DATASET_REP_OPTIONS]))
+ if (isset($args[FilterWidgetLib::DATASET_REP_OPTIONS]) && !isEmptyString($args[FilterWidgetLib::DATASET_REP_OPTIONS]))
{
- $this->_datasetRepresentationOptions = $args[FiltersLib::DATASET_REP_OPTIONS];
+ $this->_datasetRepresentationOptions = $args[FilterWidgetLib::DATASET_REP_OPTIONS];
+ }
+
+ // To specify how to represent each record field
+ if (isset($args[FilterWidgetLib::DATASET_REP_FIELDS_DEFS]) && !isEmptyString($args[FilterWidgetLib::DATASET_REP_FIELDS_DEFS]))
+ {
+ $this->_datasetRepFieldsDefs = $args[FilterWidgetLib::DATASET_REP_FIELDS_DEFS];
+ }
+
+ // To specify the expiring session time
+ if (isset($args[FilterWidgetLib::SESSION_TIMEOUT]) && is_numeric($args[FilterWidgetLib::SESSION_TIMEOUT]))
+ {
+ $this->_sessionTimeout = $args[FilterWidgetLib::SESSION_TIMEOUT];
}
}
@@ -281,40 +348,55 @@ class FilterWidget extends Widget
*/
private function _checkParameters($args)
{
+ // If no options are given to this widget...
if (!is_array($args) || (is_array($args) && count($args) == 0))
{
show_error('Second parameter of the widget call must be a NOT empty associative array');
}
- else
+ else // ...otherwise
{
- if ((!isset($args[FiltersLib::APP_PARAMETER]) && !isset($args[FiltersLib::DATASET_NAME_PARAMETER]))
- && !isset($args[FiltersLib::FILTER_ID]))
+ // Parameters (app AND dataset name) OR filter id are mandatory
+ if ((!isset($args[FilterWidgetLib::APP]) && !isset($args[FilterWidgetLib::DATASET_NAME]))
+ && !isset($args[FilterWidgetLib::FILTER_ID]))
{
show_error(
- 'The parameters ("'.FiltersLib::APP_PARAMETER.'" and "'.FiltersLib::DATASET_NAME_PARAMETER.') OR "'.
- FiltersLib::FILTER_ID.'" must be specified'
+ 'The parameters ("'.FilterWidgetLib::APP.'" AND "'.FilterWidgetLib::DATASET_NAME.') OR "'.
+ FilterWidgetLib::FILTER_ID.'" must be specified'
);
}
- if (!isset($args[FiltersLib::QUERY_PARAMETER]))
+ // The query parameter is mandatory
+ if (!isset($args[FilterWidgetLib::QUERY]))
{
- show_error('The parameters "'.FiltersLib::QUERY_PARAMETER.'" must be specified');
+ show_error('The parameter "'.FilterWidgetLib::QUERY.'" must be specified');
}
- if (!isset($args[FiltersLib::DATASET_REPRESENTATION]))
+ // The dataset representation parameter is mandatory
+ if (!isset($args[FilterWidgetLib::DATASET_REPRESENTATION]))
{
- show_error('The parameter "'.FiltersLib::DATASET_REPRESENTATION.'" must be specified');
+ show_error('The parameter "'.FilterWidgetLib::DATASET_REPRESENTATION.'" must be specified');
}
- if (isset($args[FiltersLib::DATASET_REPRESENTATION])
- && $args[FiltersLib::DATASET_REPRESENTATION] != FiltersLib::DATASET_REP_TABLESORTER
- && $args[FiltersLib::DATASET_REPRESENTATION] != FiltersLib::DATASET_REP_PIVOTUI)
+ // Checks if the dataset representation parameter is valid
+ if (isset($args[FilterWidgetLib::DATASET_REPRESENTATION])
+ && $args[FilterWidgetLib::DATASET_REPRESENTATION] != FilterWidgetLib::DATASET_REP_TABLESORTER
+ && $args[FilterWidgetLib::DATASET_REPRESENTATION] != FilterWidgetLib::DATASET_REP_PIVOTUI
+ && $args[FilterWidgetLib::DATASET_REPRESENTATION] != FilterWidgetLib::DATASET_REP_TABULATOR)
{
show_error(
- 'The parameter "'.FiltersLib::DATASET_REPRESENTATION.
- '" must be IN ("'.FiltersLib::DATASET_REP_TABLESORTER.'", "'.FiltersLib::DATASET_REP_PIVOTUI.'")'
+ 'The parameter "'.FilterWidgetLib::DATASET_REPRESENTATION.
+ '" must be IN ("'
+ .FilterWidgetLib::DATASET_REP_TABLESORTER.'", "'
+ .FilterWidgetLib::DATASET_REP_PIVOTUI.'", "'
+ .FilterWidgetLib::DATASET_REP_TABULATOR.'")'
);
}
+
+ // If given the session timeout parameter must be a number
+ if (isset($args[FilterWidgetLib::SESSION_TIMEOUT]) && !is_numeric($args[FilterWidgetLib::SESSION_TIMEOUT]))
+ {
+ show_error('The parameter "'.FilterWidgetLib::SESSION_TIMEOUT.'" must be a number');
+ }
}
}
@@ -323,52 +405,53 @@ class FilterWidget extends Widget
*/
private function _startFilterWidget()
{
+ // Looks for expired filter widgets in session and drops them
+ $this->filterwidgetlib->dropExpiredFilterWidgets();
+
// Read the all session for this filter widget
- $session = $this->filterslib->getSession();
+ $session = $this->filterwidgetlib->getSession();
// If session is NOT empty -> a filter was already loaded
if ($session != null)
{
// Retrieve the filterId stored in the session
- $sessionFilterId = $this->filterslib->getSessionElement(FiltersLib::FILTER_ID);
+ $sessionFilterId = $this->filterwidgetlib->getSessionElement(FilterWidgetLib::FILTER_ID);
// If the filter loaded in session is NOT the same that is being requested then empty the session
if ($this->_filterId != $sessionFilterId)
{
- $this->filterslib->setSession(null);
+ $this->filterwidgetlib->setSession(null);
$session = null;
}
else // else if the filter loaded in session is the same that is being requested
{
- // Get SESSION_RELOAD_DATASET from the session
- $sessionReloadDataset = $this->filterslib->getSessionElement(FiltersLib::SESSION_RELOAD_DATASET);
+ // Get SESSION_DATASET_RELOAD from the session
+ $sessionReloadDataset = $this->filterwidgetlib->getSessionElement(FilterWidgetLib::SESSION_DATASET_RELOAD);
// if Filter changed or reload is forced by parameter then reload the Dataset
if ($this->_reloadDataset === true || $sessionReloadDataset === true)
{
// Set as false to stop changing the dataset
- $this->filterslib->setSessionElement(FiltersLib::SESSION_RELOAD_DATASET, false);
+ $this->filterwidgetlib->setSessionElement(FilterWidgetLib::SESSION_DATASET_RELOAD, false);
// Generate dataset query using filters from the session
- $datasetQuery = $this->filterslib->generateDatasetQuery(
+ $datasetQuery = $this->filterwidgetlib->generateDatasetQuery(
$this->_query,
- $this->filterslib->getSessionElement(FiltersLib::SESSION_FILTERS)
+ $this->filterwidgetlib->getSessionElement(FilterWidgetLib::SESSION_FILTERS)
);
// Then retrieve dataset from DB
- $dataset = $this->filterslib->getDataset($datasetQuery);
+ $dataset = $this->filterwidgetlib->getDataset($datasetQuery);
// Save changes into session if data are valid
if (!isError($dataset))
{
$this->_formatDataset($dataset); // marks rows using markRow and format rowns using formatRow
- $this->load->model('system/Filters_model', 'FiltersModel');
-
// Set the new dataset and its attributes in the session
- $this->filterslib->setSessionElement(FiltersLib::SESSION_METADATA, $this->FiltersModel->getExecutedQueryMetaData());
- $this->filterslib->setSessionElement(FiltersLib::SESSION_ROW_NUMBER, count($dataset->retval));
- $this->filterslib->setSessionElement(FiltersLib::SESSION_DATASET, $dataset->retval);
+ $this->filterwidgetlib->setSessionElement(FilterWidgetLib::SESSION_METADATA, $this->FiltersModel->getExecutedQueryMetaData());
+ $this->filterwidgetlib->setSessionElement(FilterWidgetLib::SESSION_ROW_NUMBER, count($dataset->retval));
+ $this->filterwidgetlib->setSessionElement(FilterWidgetLib::SESSION_DATASET, $dataset->retval);
}
}
}
@@ -378,7 +461,7 @@ class FilterWidget extends Widget
if ($session == null)
{
// Load filter definition data from DB
- $definition = $this->filterslib->loadDefinition(
+ $definition = $this->filterwidgetlib->loadDefinition(
$this->_filterId,
$this->_app,
$this->_datasetName,
@@ -386,53 +469,54 @@ class FilterWidget extends Widget
);
// Checks and parse json present into the definition
- $parsedFilterJson = $this->filterslib->parseFilterJson($definition);
+ $parsedFilterJson = $this->filterwidgetlib->parseFilterJson($definition);
if ($parsedFilterJson != null) // if the json is valid
{
// Generate dataset query
- $datasetQuery = $this->filterslib->generateDatasetQuery($this->_query, $parsedFilterJson->filters);
+ $datasetQuery = $this->filterwidgetlib->generateDatasetQuery($this->_query, $parsedFilterJson->filters);
// Then retrieve dataset from DB
- $dataset = $this->filterslib->getDataset($datasetQuery);
+ $dataset = $this->filterwidgetlib->getDataset($datasetQuery);
// Try to load the name of the filter using the PhrasesLib
- $filterName = $this->filterslib->getFilterName($parsedFilterJson);
+ $filterName = $this->filterwidgetlib->getFilterName($parsedFilterJson);
// Save changes into session if data are valid
if (!isError($dataset))
{
$this->_formatDataset($dataset); // marks rows using markRow and format rowns using formatRow
- $this->load->model('system/Filters_model', 'FiltersModel');
-
// Stores an array that contains all the data useful for
- $this->filterslib->setSession(
+ $this->filterwidgetlib->setSession(
array(
- FiltersLib::FILTER_ID => $this->_filterId, // the current filter id
- FiltersLib::APP_PARAMETER => $this->_app, // the current app parameter
- FiltersLib::DATASET_NAME_PARAMETER => $this->_datasetName, // the carrent dataset name
- FiltersLib::SESSION_FILTER_NAME => $filterName, // the current filter name
- FiltersLib::SESSION_FIELDS => $this->FiltersModel->getExecutedQueryListFields(), // all the fields of the dataset
- FiltersLib::SESSION_SELECTED_FIELDS => $this->_getColumnsNames($parsedFilterJson->columns), // all the selected fields
- FiltersLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
- FiltersLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
- FiltersLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
- FiltersLib::SESSION_FILTERS => $parsedFilterJson->filters, // all the filters used to filter the dataset
- FiltersLib::SESSION_METADATA => $this->FiltersModel->getExecutedQueryMetaData(), // the metadata of the dataset
- FiltersLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this filter
- FiltersLib::SESSION_DATASET => $dataset->retval, // the entire dataset
- FiltersLib::SESSION_RELOAD_DATASET => false, // if the dataset must be reloaded, not needed the first time
- FiltersLib::SESSION_DATASET_REPRESENTATION => $this->_datasetRepresentation, // the choosen dataset representation
- FiltersLib::SESSION_DATASET_REP_OPTIONS => $this->_datasetRepresentationOptions // the choosen dataset representation options
+ FilterWidgetLib::FILTER_ID => $this->_filterId, // the current filter id
+ FilterWidgetLib::APP => $this->_app, // the current app parameter
+ FilterWidgetLib::DATASET_NAME => $this->_datasetName, // the carrent dataset name
+ FilterWidgetLib::SESSION_FILTER_NAME => $filterName, // the current filter name
+ FilterWidgetLib::SESSION_FIELDS => $this->FiltersModel->getExecutedQueryListFields(), // all the fields of the dataset
+ FilterWidgetLib::SESSION_SELECTED_FIELDS => $this->_getColumnsNames($parsedFilterJson->columns), // all the selected fields
+ FilterWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
+ FilterWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
+ FilterWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
+ FilterWidgetLib::SESSION_FILTERS => $parsedFilterJson->filters, // all the filters used to filter the dataset
+ FilterWidgetLib::SESSION_METADATA => $this->FiltersModel->getExecutedQueryMetaData(), // the metadata of the dataset
+ FilterWidgetLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this filter
+ FilterWidgetLib::SESSION_DATASET => $dataset->retval, // the entire dataset
+ FilterWidgetLib::SESSION_DATASET_RELOAD => false, // if the dataset must be reloaded, not needed the first time
+ FilterWidgetLib::SESSION_DATASET_REPRESENTATION => $this->_datasetRepresentation, // the choosen dataset representation
+ FilterWidgetLib::SESSION_DATASET_REP_OPTIONS => $this->_datasetRepresentationOptions, // the choosen dataset representation options
+ FilterWidgetLib::SESSION_DATASET_REP_FIELDS_DEFS => $this->_datasetRepFieldsDefs // the choosen dataset representation record fields definition
)
);
}
}
}
+ // NOTE: latest operations to be performed in the session to be shure that they are always present
// To be always stored in the session, otherwise is not possible to load data from Filters controller
- // NOTE: must the latest operation to be performed in the session to be shure that is always present
- $this->filterslib->setSessionElement(FiltersLib::REQUIRED_PERMISSIONS_PARAMETER, $this->_requiredPermissions);
+ $this->filterwidgetlib->setSessionElement(FilterWidgetLib::REQUIRED_PERMISSIONS, $this->_requiredPermissions);
+ // Renew or set the session expiring time
+ $this->filterwidgetlib->setSessionElement(FilterWidgetLib::SESSION_TIMEOUT, strtotime('+'.$this->_sessionTimeout.' minutes', time()));
}
/**
@@ -441,7 +525,7 @@ class FilterWidget extends Widget
private function _setFilterMenu()
{
// Generates the filters structure array
- $filterMenu = $this->filterslib->generateFilterMenu(
+ $filterMenu = $this->filterwidgetlib->generateFilterMenu(
$this->router->directory.$this->router->class.'/'.$this->router->method
);
}
diff --git a/application/widgets/Organisationseinheit_widget.php b/application/widgets/Organisationseinheit_widget.php
index 67d1598b0..e4fbfe2ba 100644
--- a/application/widgets/Organisationseinheit_widget.php
+++ b/application/widgets/Organisationseinheit_widget.php
@@ -5,16 +5,34 @@ class Organisationseinheit_widget extends DropdownWidget
public function display($widgetData)
{
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
-
+
if (isset($widgetData['typ']))
- $typ = $widgetData['typ'];
+ {
+ $this->setElementsArray($this->OrganisationseinheitModel->getRecursiveList($widgetData['typ']));
+ }
+ // If 'organisationseinheit' (array of specific oe_kurzbz) is given, retrieve these organisational units only
+ elseif (isset($widgetData['organisationseinheit']) && !empty($widgetData['organisationseinheit']))
+ {
+ $condition = '
+ oe_kurzbz IN (\''. implode('\',\'', $widgetData['organisationseinheit']) . '\') AND
+ aktiv = TRUE
+ ';
+ $this->addSelectToModel($this->OrganisationseinheitModel, 'oe_kurzbz', 'organisationseinheittyp_kurzbz || \' \' || bezeichnung');
+ $this->OrganisationseinheitModel->addOrder('organisationseinheittyp_kurzbz', 'ASC');
+ $this->setElementsArray(
+ $this->OrganisationseinheitModel->loadWhere($condition),
+ true,
+ $this->p->t('lehre', 'organisationseinheit'),
+ 'No organisational units found'
+ );
+ }
+ // Default: retrieve tree of all organisational units
else
- $typ = null;
-
- // NOTE: no need to call addSelectToModel because getRecursiveList already returns
- // the correct names of the fields
-
- $this->setElementsArray($this->OrganisationseinheitModel->getRecursiveList($typ));
+ {
+ // NOTE: no need to call addSelectToModel because getRecursiveList already returns
+ // the correct names of the fields
+ $this->setElementsArray($this->OrganisationseinheitModel->getRecursiveList());
+ }
$this->loadDropDownView($widgetData);
}
diff --git a/application/widgets/Studiengang_widget.php b/application/widgets/Studiengang_widget.php
index a09c865f5..250f2a9bc 100644
--- a/application/widgets/Studiengang_widget.php
+++ b/application/widgets/Studiengang_widget.php
@@ -8,15 +8,29 @@ class Studiengang_widget extends DropdownWidget
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$this->StudiengangModel->addOrder('kurzbzlang');
- $this->addSelectToModel($this->StudiengangModel, 'studiengang_kz', '\'(\' || kurzbzlang || \') \' || bezeichnung');
-
- $this->setElementsArray(
- $this->StudiengangModel->loadWhere(array('aktiv' => true)),
- true,
- 'Select a studiengang...',
- 'No studiengaenge found'
- );
-
+ $this->addSelectToModel($this->StudiengangModel, 'studiengang_kz', '\'(\' || upper(typ||kurzbz) || \') \' || tbl_studiengang.bezeichnung');
+
+ // If 'studiengang' (array of specific studiengaenge) is given, retrieve these studiengaenge only
+ if (isset($widgetData['studiengang']) && !empty($widgetData['studiengang']))
+ {
+ $condition = '
+ studiengang_kz IN ('. implode(',', $widgetData['studiengang']) . ') AND
+ aktiv = true
+ ';
+ }
+ // Default: retrieve all studiengaenge
+ else
+ {
+ $condition = array('aktiv' => true);
+ }
+
+ $this->setElementsArray(
+ $this->StudiengangModel->loadWhere($condition),
+ true,
+ $this->p->t('lehre', 'studiengang'),
+ 'No studiengaenge found'
+ );
+
$this->loadDropDownView();
}
}
\ No newline at end of file
diff --git a/application/widgets/Studiensemester_widget.php b/application/widgets/Studiensemester_widget.php
index bc1c0a201..dc6e28d38 100644
--- a/application/widgets/Studiensemester_widget.php
+++ b/application/widgets/Studiensemester_widget.php
@@ -6,14 +6,14 @@ class Studiensemester_widget extends DropdownWidget
{
// Studiensemester
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
- $this->StudiensemesterModel->addOrder('studiensemester_kurzbz', 'DESC');
+ $this->StudiensemesterModel->addOrder('start', 'DESC');
$this->addSelectToModel($this->StudiensemesterModel, 'studiensemester_kurzbz', 'studiensemester_kurzbz');
$this->setElementsArray(
$this->StudiensemesterModel->load(),
true,
- 'Select a studiensemester...',
+ $this->p->t('lehre', 'studiensemester'),
'No studiensemester found'
);
diff --git a/application/widgets/TableWidget.php b/application/widgets/TableWidget.php
new file mode 100644
index 000000000..5a000601f
--- /dev/null
+++ b/application/widgets/TableWidget.php
@@ -0,0 +1,440 @@
+load->library('TableWidgetLib'); // Loads the TableWidgetLib that contains all the used logic
+
+ $this->_initTableWidget($args); // checks parameters and initialize properties
+
+ $this->tablewidgetlib->setTableUniqueIdByParams($args);
+
+ // Let's start if it's allowed
+ // NOTE: If it is NOT allowed then no data are loaded
+ if ($this->tablewidgetlib->isAllowed($this->_requiredPermissions))
+ {
+ $this->_startTableWidget($args[TableWidgetLib::TABLE_UNIQUE_ID]);
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public methods
+
+ /**
+ * Called when echoing the table widget call
+ */
+ public function display($widgetData)
+ {
+ $this->view(self::WIDGET_URL_TABLE, array(
+ 'tableUniqueId' => $widgetData[TableWidgetLib::TABLE_UNIQUE_ID]
+ )); // GUI starts here
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Public static methods used to load views and to access statically to some properies of the TableWidget
+
+ /**
+ * Loads the view related to the dataset, here is decided how to represent the dataset (ex: tablesorter, pivotUI, ...)
+ */
+ public static function loadViewDataset()
+ {
+ if (self::$_TableWidgetInstance->_datasetRepresentation == TableWidgetLib::DATASET_REP_TABLESORTER)
+ {
+ self::_loadView(self::WIDGET_URL_DATASET_TABLESORTER);
+ }
+
+ if (self::$_TableWidgetInstance->_datasetRepresentation == TableWidgetLib::DATASET_REP_PIVOTUI)
+ {
+ self::_loadView(self::WIDGET_URL_DATASET_PIVOTUI);
+ }
+
+ if (self::$_TableWidgetInstance->_datasetRepresentation == TableWidgetLib::DATASET_REP_TABULATOR)
+ {
+ self::_loadView(self::WIDGET_URL_DATASET_TABULATOR);
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ // Private methods
+
+ /**
+ * Checks parameters and initialize all the properties of this TableWidget
+ */
+ private function _initTableWidget($args)
+ {
+ $this->_checkParameters($args);
+
+ // If here then everything is ok
+
+ // Initialize class properties
+ $this->_requiredPermissions = null;
+ $this->_reloadDataset = true; // by default the dataset is NOT cached in session
+ $this->_query = null;
+ $this->_additionalColumns = null;
+ $this->_columnsAliases = null;
+ $this->_formatRow = null;
+ $this->_markRow = null;
+ $this->_checkboxes = null;
+ $this->_datasetRepresentation = null;
+ $this->_datasetRepresentationOptions = null;
+ $this->_datasetRepFieldsDefs = null;
+ $this->_sessionTimeout = TableWidgetLib::SESSION_DEFAULT_TIMEOUT;
+
+ // Retrieved the required permissions parameter if present
+ if (isset($args[TableWidgetLib::REQUIRED_PERMISSIONS]))
+ {
+ $this->_requiredPermissions = $args[TableWidgetLib::REQUIRED_PERMISSIONS];
+ }
+
+ // How to retrieve data for the table: SQL statement or a result from DB
+ if (isset($args[TableWidgetLib::QUERY]))
+ {
+ $this->_query = $args[TableWidgetLib::QUERY];
+ }
+
+ if (isset($args[TableWidgetLib::DATASET_RELOAD]))
+ {
+ $this->_reloadDataset = $args[TableWidgetLib::DATASET_RELOAD];
+ }
+
+ // Parameter is used to add extra columns to the dataset
+ if (isset($args[TableWidgetLib::ADDITIONAL_COLUMNS])
+ && is_array($args[TableWidgetLib::ADDITIONAL_COLUMNS])
+ && count($args[TableWidgetLib::ADDITIONAL_COLUMNS]) > 0)
+ {
+ $this->_additionalColumns = $args[TableWidgetLib::ADDITIONAL_COLUMNS];
+ }
+
+ // Parameter is used to add use aliases for the columns fo the dataset
+ if (isset($args[TableWidgetLib::COLUMNS_ALIASES])
+ && is_array($args[TableWidgetLib::COLUMNS_ALIASES])
+ && count($args[TableWidgetLib::COLUMNS_ALIASES]) > 0)
+ {
+ $this->_columnsAliases = $args[TableWidgetLib::COLUMNS_ALIASES];
+ }
+
+ // Parameter that contains a function to format the rows of the dataset
+ if (isset($args[TableWidgetLib::FORMAT_ROW]) && is_callable($args[TableWidgetLib::FORMAT_ROW]))
+ {
+ $this->_formatRow = $args[TableWidgetLib::FORMAT_ROW];
+ }
+
+ // Parameter that contains a function to mark in the GUI the rows of the dataset
+ if (isset($args[TableWidgetLib::MARK_ROW]) && is_callable($args[TableWidgetLib::MARK_ROW]))
+ {
+ $this->_markRow = $args[TableWidgetLib::MARK_ROW];
+ }
+
+ // Parameter used to specify the column of the dataset that will be used
+ // as id of the checkboxes column in the GUI
+ if (isset($args[TableWidgetLib::CHECKBOXES]))
+ {
+ $this->_checkboxes = $args[TableWidgetLib::CHECKBOXES];
+ }
+
+ // To specify how to represent the dataset (ex: tablesorter, pivotUI, ...)
+ if (isset($args[TableWidgetLib::DATASET_REPRESENTATION])
+ && ($args[TableWidgetLib::DATASET_REPRESENTATION] == TableWidgetLib::DATASET_REP_TABLESORTER
+ || $args[TableWidgetLib::DATASET_REPRESENTATION] == TableWidgetLib::DATASET_REP_PIVOTUI
+ || $args[TableWidgetLib::DATASET_REPRESENTATION] == TableWidgetLib::DATASET_REP_TABULATOR))
+ {
+ $this->_datasetRepresentation = $args[TableWidgetLib::DATASET_REPRESENTATION];
+ }
+
+ // To specify options for the dataset representation (ex: tablesorter, pivotUI, ...)
+ if (isset($args[TableWidgetLib::DATASET_REP_OPTIONS]) && !isEmptyString($args[TableWidgetLib::DATASET_REP_OPTIONS]))
+ {
+ $this->_datasetRepresentationOptions = $args[TableWidgetLib::DATASET_REP_OPTIONS];
+ }
+
+ // To specify how to represent each record field
+ if (isset($args[TableWidgetLib::DATASET_REP_FIELDS_DEFS]) && !isEmptyString($args[TableWidgetLib::DATASET_REP_FIELDS_DEFS]))
+ {
+ $this->_datasetRepFieldsDefs = $args[TableWidgetLib::DATASET_REP_FIELDS_DEFS];
+ }
+
+ // To specify the expiring session time
+ if (isset($args[TableWidgetLib::SESSION_TIMEOUT]) && is_numeric($args[TableWidgetLib::SESSION_TIMEOUT]))
+ {
+ $this->_sessionTimeout = $args[TableWidgetLib::SESSION_TIMEOUT];
+ }
+ }
+
+ /**
+ * Checks the required parameters used to call this TableWidget
+ */
+ private function _checkParameters($args)
+ {
+ // If no options are given to this widget...
+ if (!is_array($args) || (is_array($args) && count($args) == 0))
+ {
+ show_error('Second parameter of the widget call must be a NOT empty associative array');
+ }
+ else // ...otherwise
+ {
+ // The unique id parameter is mandatory
+ if (!isset($args[TableWidgetLib::TABLE_UNIQUE_ID]))
+ {
+ show_error('The parameter "'.TableWidgetLib::TABLE_UNIQUE_ID.'" must be specified');
+ }
+
+ // The query parameter is mandatory
+ if (!isset($args[TableWidgetLib::QUERY]))
+ {
+ show_error('The parameter "'.TableWidgetLib::QUERY.'" must be specified');
+ }
+
+ // The dataset representation parameter is mandatory
+ if (!isset($args[TableWidgetLib::DATASET_REPRESENTATION]))
+ {
+ show_error('The parameter "'.TableWidgetLib::DATASET_REPRESENTATION.'" must be specified');
+ }
+
+ // Checks if the dataset representation parameter is valid
+ if (isset($args[TableWidgetLib::DATASET_REPRESENTATION])
+ && $args[TableWidgetLib::DATASET_REPRESENTATION] != TableWidgetLib::DATASET_REP_TABLESORTER
+ && $args[TableWidgetLib::DATASET_REPRESENTATION] != TableWidgetLib::DATASET_REP_PIVOTUI
+ && $args[TableWidgetLib::DATASET_REPRESENTATION] != TableWidgetLib::DATASET_REP_TABULATOR)
+ {
+ show_error(
+ 'The parameter "'.TableWidgetLib::DATASET_REPRESENTATION.
+ '" must be IN ("'
+ .TableWidgetLib::DATASET_REP_TABLESORTER.'", "'
+ .TableWidgetLib::DATASET_REP_PIVOTUI.'", "'
+ .TableWidgetLib::DATASET_REP_TABULATOR.'")'
+ );
+ }
+
+ // If given the session timeout parameter must be a number
+ if (isset($args[TableWidgetLib::SESSION_TIMEOUT]) && !is_numeric($args[TableWidgetLib::SESSION_TIMEOUT]))
+ {
+ show_error('The parameter "'.TableWidgetLib::SESSION_TIMEOUT.'" must be a number');
+ }
+ }
+ }
+
+ /**
+ * Contains all the logic used to load all the data needed to the TableWidget
+ */
+ private function _startTableWidget($tableUniqueId)
+ {
+ // Looks for expired table widgets in session and drops them
+ $this->tablewidgetlib->dropExpiredTableWidgets();
+
+ // Read the all session for this table widget
+ $session = $this->tablewidgetlib->getSession();
+
+ // If session is NOT empty -> a table was already loaded
+ if ($session != null)
+ {
+ // Get SESSION_DATASET_RELOAD from the session
+ $sessionReloadDataset = $this->tablewidgetlib->getSessionElement(TableWidgetLib::SESSION_DATASET_RELOAD);
+
+ // if Filter changed or reload is forced by parameter then reload the Dataset
+ if ($this->_reloadDataset === true || $sessionReloadDataset === true)
+ {
+ // Set as false to stop changing the dataset
+ $this->tablewidgetlib->setSessionElement(TableWidgetLib::SESSION_DATASET_RELOAD, false);
+
+ // Generate dataset query using tables from the session
+ $datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
+
+ // Then retrieve dataset from DB
+ $dataset = $this->tablewidgetlib->getDataset($datasetQuery);
+
+ // Save changes into session if data are valid
+ if (!isError($dataset))
+ {
+ $this->_formatDataset($dataset); // marks rows using markRow and format rowns using formatRow
+
+ // Set the new dataset and its attributes in the session
+ $this->tablewidgetlib->setSessionElement(TableWidgetLib::SESSION_METADATA, $this->tablewidgetlib->getExecutedQueryMetaData());
+ $this->tablewidgetlib->setSessionElement(TableWidgetLib::SESSION_ROW_NUMBER, count($dataset->retval));
+ $this->tablewidgetlib->setSessionElement(TableWidgetLib::SESSION_DATASET, $dataset->retval);
+ }
+ }
+ }
+
+ // If the session is empty -> first time that this table is loaded
+ if ($session == null)
+ {
+ // Generate dataset query
+ $datasetQuery = $this->tablewidgetlib->generateDatasetQuery($this->_query);
+
+ // Then retrieve dataset from DB
+ $dataset = $this->tablewidgetlib->getDataset($datasetQuery);
+
+ // Save changes into session if data are valid
+ if (!isError($dataset))
+ {
+ $this->_formatDataset($dataset); // marks rows using markRow and format rowns using formatRow
+
+ // Stores an array that contains all the data useful for
+ $this->tablewidgetlib->setSession(
+ array(
+ TableWidgetLib::TABLE_UNIQUE_ID => $tableUniqueId, // table unique id
+ TableWidgetLib::SESSION_FIELDS => $this->tablewidgetlib->getExecutedQueryListFields(), // all the fields of the dataset
+ TableWidgetLib::SESSION_COLUMNS_ALIASES => $this->_columnsAliases, // all the fields aliases
+ TableWidgetLib::SESSION_ADDITIONAL_COLUMNS => $this->_additionalColumns, // additional columns
+ TableWidgetLib::SESSION_CHECKBOXES => $this->_checkboxes, // the name of the field used to build the checkboxes column
+ TableWidgetLib::SESSION_METADATA => $this->tablewidgetlib->getExecutedQueryMetaData(), // the metadata of the dataset
+ TableWidgetLib::SESSION_ROW_NUMBER => count($dataset->retval), // the number of loaded rows by this table
+ TableWidgetLib::SESSION_DATASET => $dataset->retval, // the entire dataset
+ TableWidgetLib::SESSION_DATASET_RELOAD => false, // if the dataset must be reloaded, not needed the first time
+ TableWidgetLib::SESSION_DATASET_REPRESENTATION => $this->_datasetRepresentation, // the choosen dataset representation
+ TableWidgetLib::SESSION_DATASET_REP_OPTIONS => $this->_datasetRepresentationOptions, // the choosen dataset representation options
+ TableWidgetLib::SESSION_DATASET_REP_FIELDS_DEFS => $this->_datasetRepFieldsDefs // the choosen dataset representation record fields definition
+ )
+ );
+ }
+ }
+
+ // NOTE: must the latest operation to be performed in the session to be shure that is always present
+ // To be always stored in the session, otherwise is not possible to load data from Filters controller
+ $this->tablewidgetlib->setSessionElement(TableWidgetLib::REQUIRED_PERMISSIONS, $this->_requiredPermissions);
+ // Renew or set the session expiring time
+ $this->tablewidgetlib->setSessionElement(TableWidgetLib::SESSION_TIMEOUT, strtotime('+'.$this->_sessionTimeout.' minutes', time()));
+ }
+
+ /**
+ * Calls the method _markRow and _formatRow to marks rows using markRow and format rowns using formatRow
+ * NOTE: this method operates directly on the retrieved dataset: parameter passed by reference
+ */
+ private function _formatDataset(&$rawDataset)
+ {
+ if (hasData($rawDataset) && is_array($rawDataset->retval))
+ {
+ // For each row of the data set
+ for ($rowCounter = 0; $rowCounter < count($rawDataset->retval); $rowCounter++)
+ {
+ // Calls the methods to mark and to format a row
+ // NOTE: keep this order! the markRow function given as parameter is supposing to work
+ // on a raw dataset, NOT on a formatted one
+ $rawDataset->retval[$rowCounter]->MARK_ROW_CLASS = $this->_markRow($rawDataset->retval[$rowCounter]);
+ $this->_formatRow($rawDataset->retval[$rowCounter]);
+ }
+ }
+ }
+
+ /**
+ * Formats the columns of all the rows of the entire dataset
+ * - converts booleans into strings "true" and "false"
+ * - format dates using the format string defined in DEFAULT_DATE_FORMAT
+ * Calls the parameter formatRow if it was given and if it is a valid funtion
+ * NOTE: this method operates directly on the retrieved dataset: parameter passed by reference
+ */
+ private function _formatRow(&$rawDatasetRow)
+ {
+ // For each column of the row
+ foreach ($rawDatasetRow as $columnName => $columnValue)
+ {
+ // Basic conversions
+ if (is_bool($columnValue))
+ {
+ $rawDatasetRow->{$columnName} = ($columnValue === true ? 'true' : 'false');
+ }
+ elseif (DateTime::createFromFormat('Y-m-d H:i:s', $columnValue) !== false)
+ {
+ $rawDatasetRow->{$columnName} = date(self::DEFAULT_DATE_FORMAT, strtotime($columnValue));
+ }
+ }
+
+ // If a valid function call the given formatRow
+ if ($this->_formatRow != null && is_callable($this->_formatRow))
+ {
+ $formatRowFunction = $this->_formatRow;
+ $rawDatasetRow = $formatRowFunction($rawDatasetRow);
+ }
+ }
+
+ /**
+ * Returns a string that contains a class name used to mark rows in the dataset table
+ * Calls the parameter markRow if it was given and if it is a valid funtion
+ */
+ private function _markRow($rawDatasetRow)
+ {
+ // If a valid function call the given markRow
+ if ($this->_markRow != null && is_callable($this->_markRow))
+ {
+ $markRowFunction = $this->_markRow;
+ $class = $markRowFunction($rawDatasetRow);
+ }
+
+ return !isset($class) ? '' : $class;
+ }
+
+ /**
+ * Utility method that retrieves the name of the columns present in a table JSON definition
+ */
+ private function _getColumnsNames($columns)
+ {
+ $columnsNames = array();
+
+ foreach ($columns as $key => $obj)
+ {
+ if (isset($obj->name))
+ {
+ $columnsNames[] = $obj->name;
+ }
+ }
+
+ return $columnsNames;
+ }
+
+ /**
+ * Loads a view using the given viewName and eventually other parameters
+ */
+ private static function _loadView($viewName, $parameters = null)
+ {
+ $ci =& get_instance();
+ $ci->load->view($viewName, $parameters);
+ }
+}
diff --git a/application/widgets/html/DropdownWidget.php b/application/widgets/html/DropdownWidget.php
index ca3e30163..eba79900d 100644
--- a/application/widgets/html/DropdownWidget.php
+++ b/application/widgets/html/DropdownWidget.php
@@ -17,32 +17,32 @@ class DropdownWidget extends HTMLWidget
const SELECTED_ELEMENT = 'selectedElement';
// Default HTML value
const HTML_DEFAULT_VALUE = 'null';
-
+
const SIZE = 'size'; // size of the dropdown
const MULTIPLE = 'multiple'; // multiple attribute
-
+
// Alias of $this->_args[HTMLWidget::HTML_ARG_NAME] for a better code readability
protected $htmlParameters;
-
+
/**
- *
+ *
*/
public function __construct($name, $args = array(), $htmlArgs = array())
{
parent::__construct($name, $args, $htmlArgs);
-
+
// If the selectd element is not set then set it to HTML_DEFAULT_VALUE
if (!isset($this->_args[DropdownWidget::SELECTED_ELEMENT]))
{
$this->_args[DropdownWidget::SELECTED_ELEMENT] = DropdownWidget::HTML_DEFAULT_VALUE;
}
-
+
$this->htmlParameters =& $this->_args[HTMLWidget::HTML_ARG_NAME]; // Reference for a better code readability
-
+
// By default is not a multiple dropdown
unset($this->htmlParameters[DropdownWidget::MULTIPLE]);
}
-
+
/**
* Set this dropdown as multiple:
* - Setting the multiple attribute
@@ -53,23 +53,23 @@ class DropdownWidget extends HTMLWidget
$this->htmlParameters[DropdownWidget::MULTIPLE] = DropdownWidget::MULTIPLE;
$this->htmlParameters[HTMLWidget::HTML_NAME] .= '[]';
}
-
+
/**
* Checks if this object is a multiple dropdown
*/
public function isMultipleDropdown()
{
$isMultipleDropdown = false;
-
+
if (isset($this->htmlParameters[DropdownWidget::MULTIPLE])
&& $this->htmlParameters[DropdownWidget::MULTIPLE] == DropdownWidget::MULTIPLE)
{
$isMultipleDropdown = true;
}
-
+
return $isMultipleDropdown;
}
-
+
/**
* Add the correct select to the model used to load a list of elemets for this dropdown
* @param model $model the model used to load elements
@@ -88,7 +88,7 @@ class DropdownWidget extends HTMLWidget
)
);
}
-
+
/**
* Set the array used to populate the dropdown
* @param array $elements list used to populate this dropdown
@@ -102,12 +102,12 @@ class DropdownWidget extends HTMLWidget
)
{
$tmpElements = array();
-
+
if (isError($elements))
{
if (is_object($elements) && isset($elements->retval))
{
- show_error($elements->retval);
+ show_error(getError($elements));
}
else if (is_string($elements))
{
@@ -133,11 +133,11 @@ class DropdownWidget extends HTMLWidget
{
$tmpElements = $elements->retval;
}
-
+
$this->_args[DropdownWidget::WIDGET_DATA_ELEMENTS_ARRAY_NAME] = $tmpElements;
}
}
-
+
/**
* Adds an element to the beginning of the array
*/
@@ -146,17 +146,17 @@ class DropdownWidget extends HTMLWidget
$element = new stdClass();
$element->{DropdownWidget::ID_FIELD} = $id;
$element->{DropdownWidget::DESCRIPTION_FIELD} = $stdDescription;
-
+
if (!hasData($elements))
{
$element->{DropdownWidget::DESCRIPTION_FIELD} = $noDataDescription;
}
-
+
array_unshift($elements->retval, $element);
-
+
return $elements->retval;
}
-
+
/**
* Loads the dropdown view with all the elements to be displayed
*/
@@ -164,4 +164,4 @@ class DropdownWidget extends HTMLWidget
{
$this->view('widgets/dropdown', $this->_args);
}
-}
\ No newline at end of file
+}
diff --git a/cis/private/lehre/benotungstool/nachpruefungeintragen.php b/cis/private/lehre/benotungstool/nachpruefungeintragen.php
index f1afe0420..0ad985e76 100644
--- a/cis/private/lehre/benotungstool/nachpruefungeintragen.php
+++ b/cis/private/lehre/benotungstool/nachpruefungeintragen.php
@@ -170,7 +170,9 @@ if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') )
if($pr->getPruefungen($student_uid, "Termin1", $lvid, $stsem))
{
if ($pr->result)
+ {
$termin1 = 1;
+ }
else
{
$lvnote = new lvgesamtnote();
@@ -183,6 +185,7 @@ if (isset($_REQUEST["submit"]) && ($_REQUEST["student_uid"] != '') )
else
{
$pr_note = 9;
+ $pr_punkte = '';
$benotungsdatum = $jetzt;
}
diff --git a/cis/private/lehre/fotoliste.pdf.php b/cis/private/lehre/fotoliste.pdf.php
index 8565470c6..3fc04355f 100644
--- a/cis/private/lehre/fotoliste.pdf.php
+++ b/cis/private/lehre/fotoliste.pdf.php
@@ -1,308 +1,310 @@
-
- *
- * Description: This file creates a studentlist with students' profile fotos
- * by a given studiengangs- and lehrveranstaltungs ID (and eventually a given lehreinheit ID).
- * If fotos are locked by student, a dummy picture is inserted instead of the students foto.
- * EXCEPTION: if user has admins or assitents rights, ALL students' fotos are iserted (even locked ones)
- *
- */
-
-require_once('../../../config/cis.config.inc.php');
-require_once('../../../include/dokument_export.class.php');
-require_once('../../../include/lehrveranstaltung.class.php');
-require_once('../../../include/lehreinheit.class.php');
-require_once('../../../include/benutzerberechtigung.class.php');
-require_once('../../../include/studiensemester.class.php');
-require_once('../../../include/studiengang.class.php');
-require_once('../../../include/functions.inc.php');
-require_once('../../../include/erhalter.class.php');
-require_once('../../../include/datum.class.php');
-
-
-$doc = new dokument_export('fotoliste');
-$output = 'pdf';
-$show_all_fotos = false;
-
-
-//check user access & $_GET vars
-if (!$db = new basis_db())
- die('Es konnte keine Verbindung zum Server aufgebaut werden.');
-
-$user = get_uid();
-
-
-if (isset($_GET['lvid']) && is_numeric($_GET['lvid']))
- $lvid = $_GET['lvid'];
-else
- die('Eine gueltige LvID muss uebergeben werden');
-
-isset($_GET['stsem']) ? $studiensemester = $_GET['stsem'] : die('Ein Studiensemester muss uebergeben werden');
-
-$lv = new lehrveranstaltung();
-$lv->load($lvid);
-
-$stg = new studiengang();
-$stg->load($lv->studiengang_kz);
-
-$berechtigung = new benutzerberechtigung();
-$berechtigung->getBerechtigungen($user);
-
-if (!$berechtigung->isBerechtigt('admin') && !$berechtigung->isBerechtigt('assistenz') && !$berechtigung->isBerechtigt('lehre', $lv->oe_kurzbz, 's') && !check_lektor_lehrveranstaltung($user, $lvid, $studiensemester))
- die('Sie muessen LektorIn der LV sein oder das Recht "ADMIN", "ASSISTENZ" oder "LEHRE" haben, um diese Seite aufrufen zu koennen');
-
-if ($berechtigung->isBerechtigt('admin') || $berechtigung->isBerechtigt('assistenz'))
- $show_all_fotos = true;
-
-if (isset($_GET['output']) && ($output = 'odt' || $output = 'doc'))
- $output = $_GET['output'];
-isset($_GET['stg_kz']) ? $studiengang = $_GET['stg_kz'] : $studiengang = NULL;
-isset($_GET['lehreinheit_id']) ? $lehreinheit = $_GET['lehreinheit_id'] : $lehreinheit = NULL;
-
-
-//**************************** overall lehrveranstaltungs data *******************************
-//load overall lehrveranstaltungs-data
-$qry = "SELECT DISTINCT ON
- (kuerzel, semester, verband, gruppe, gruppe_kurzbz)
- UPPER(stg_typ || stg_kurzbz) as kuerzel,
- lv_bezeichnung,
- stg_bez,
- semester,
- verband,
- gruppe,
- gruppe_kurzbz,
- stg_typ
- FROM
- campus.vw_lehreinheit
- WHERE
- lehrveranstaltung_id=" . $db->db_add_param($lvid, FHC_INTEGER) . "
- AND
- studiensemester_kurzbz=" . $db->db_add_param($studiensemester);
-if ($lehreinheit != '')
- $qry .= " AND lehreinheit_id=" . $db->db_add_param($lehreinheit, FHC_INTEGER);
-
-$gruppen_string = '';
-$gruppen_string_arr = array();
-$stg_typ = $stg->typ;
-$stg_bezeichnung = $stg->bezeichnung;
-
-//structure overall lehrveranstaltungs data
-if ($result = $db->db_query($qry)) {
- while ($row = $db->db_fetch_object($result)) {
- //lehrveranstaltung
- $lv_bezeichnung = $row->lv_bezeichnung;
-
- //collect all gruppenkürzel
- if ($row->gruppe_kurzbz == '')
- $gruppen_string = trim($row->kuerzel . '-' . $row->semester . $row->verband . $row->gruppe);
- else
- $gruppen_string = $row->gruppe_kurzbz;
-
- $gruppen_string_arr[] = $gruppen_string;
- }
-}
-
-//concatinate distinct gruppenkürzel
-$studiengruppe = implode(", ", array_unique($gruppen_string_arr));
-
-//get studiengangstyp-bezeichnung
-$qry = "SELECT
- bezeichnung
- FROM
- public.tbl_studiengangstyp
- WHERE
- typ =" . $db->db_add_param($stg_typ);
-
-if ($result = $db->db_query($qry)) {
- $row = $db->db_fetch_object($result);
- $stg_typ_bezeichnung = $row->bezeichnung;
-}
-
-
-//add overall lehrveranstaltungs-data for XML
-$data = array(
- 'lehrveranstaltung' => $lv_bezeichnung,
- 'studiengang' => $stg_bezeichnung,
- 'studiengangs_typ' => $stg_typ_bezeichnung,
- 'studiensemester' => $studiensemester,
- 'studiengruppe' => $studiengruppe
-);
-
-
-
-//**************************** students data *******************************
-//load students-data
-$qry = 'SELECT DISTINCT ON
- (nachname, vorname, person_id)
- vorname,
- nachname,
- matrikelnr,
- tbl_studentlehrverband.semester,
- tbl_studentlehrverband.verband,
- tbl_studentlehrverband.gruppe,
- (SELECT
- status_kurzbz
- FROM
- public.tbl_prestudentstatus
- WHERE
- prestudent_id=tbl_student.prestudent_id
- ORDER BY
- datum DESC, insertamum DESC, ext_id DESC LIMIT 1) as status,
- tbl_studiengang.kurzbz,
- tbl_studiengang.typ,
- tbl_bisio.bisio_id,
- tbl_bisio.von,
- tbl_bisio.bis,
- tbl_student.studiengang_kz AS stg_kz_student,
- tbl_zeugnisnote.note,
- tbl_mitarbeiter.mitarbeiter_uid,
- tbl_person.matr_nr,
- tbl_person.geschlecht,
- tbl_person.foto,
- tbl_person.foto_sperre
- FROM
- campus.vw_student_lehrveranstaltung
- JOIN public.tbl_benutzer USING(uid)
- JOIN public.tbl_person USING(person_id)
- LEFT JOIN public.tbl_student ON(uid=student_uid)
- LEFT JOIN public.tbl_studiengang ON(tbl_studiengang.studiengang_kz=tbl_student.studiengang_kz)
- LEFT JOIN public.tbl_mitarbeiter ON(uid=mitarbeiter_uid)
- LEFT JOIN public.tbl_studentlehrverband USING(student_uid,studiensemester_kurzbz)
- LEFT JOIN lehre.tbl_zeugnisnote ON(vw_student_lehrveranstaltung.lehrveranstaltung_id=tbl_zeugnisnote.lehrveranstaltung_id
- AND tbl_zeugnisnote.student_uid=tbl_student.student_uid
- AND tbl_zeugnisnote.studiensemester_kurzbz=tbl_studentlehrverband.studiensemester_kurzbz)
- LEFT JOIN bis.tbl_bisio ON(uid=tbl_bisio.student_uid)
- WHERE
- vw_student_lehrveranstaltung.lehrveranstaltung_id=' . $db->db_add_param($lvid, FHC_INTEGER) . ' AND
- vw_student_lehrveranstaltung.studiensemester_kurzbz=' . $db->db_add_param($studiensemester);
-
-if ($lehreinheit != '')
- $qry .= ' AND vw_student_lehrveranstaltung.lehreinheit_id=' . $db->db_add_param($lehreinheit, FHC_INTEGER);
-
-$qry .= ' ORDER BY nachname, vorname, person_id, tbl_bisio.bis DESC';
-
-$stsem_obj = new studiensemester();
-$stsem_obj->load($studiensemester);
-$stsemdatumvon = $stsem_obj->start;
-$stsemdatumbis = $stsem_obj->ende;
-
-$erhalter = new erhalter();
-$erhalter->getAll();
-
-$a_o_kz = '9' . sprintf("%03s", $erhalter->result[0]->erhalter_kz); //Stg_Kz AO-Studierende auslesen (9005 fuer FHTW)
-$anzahl_studierende = 0;
-$datum = new datum();
-$zusatz = '';
-
-//structure students data
-if ($result = $db->db_query($qry)) {
- while ($row = $db->db_fetch_object($result)) {
- if ($row->status != 'Abbrecher' && $row->status != 'Unterbrecher') {
- $anzahl_studierende++;
-
- if ($row->status == 'Incoming') //Incoming
- $zusatz = '(i)';
- else
- $zusatz = '';
-
- if ($row->bisio_id != '' && $row->status != 'Incoming' && ($row->bis > $stsemdatumvon || $row->bis == '') && $row->von < $stsemdatumbis) //Outgoing
- $zusatz .= '(o)(ab ' . $datum->formatDatum($row->von, 'd.m.Y') . ')';
-
- if ($row->note == 6) //angerechnet
- $zusatz .= '(ar)';
-
- if ($row->mitarbeiter_uid != '') //mitarbeiter
- $zusatz .= '(ma)';
-
- if ($row->stg_kz_student == $a_o_kz) //Außerordentliche Studierende
- $zusatz .= '(a.o.)';
-
- //allow admin and assistenz to see ALL fotos (even if locked by user)
- if ($show_all_fotos)
- $row->foto_sperre = 'f';
-
- //create foto (if not locked by student OR if fotolist is created by admin or assistenz)
- $foto_url = '';
-
- if ($row->foto_sperre == 'f' && $row->foto != '') {
- $foto_src = $row->foto;
- $foto_url = sys_get_temp_dir() . '/foto' . trim($row->matrikelnr) . '.jpg';
- $foto_url_arr[] = $foto_url;
-
- //create writeable file
- if (!$foto = fopen($foto_url, 'w'))
- die("Das Bild konnte nicht erstellt werden");
- //add foto base64-code
- if (!fwrite($foto, base64_decode($foto_src)))
- {
- die("Das Bild konnte nicht erstellt werden");
- }
-
- //add foto to document
- $doc->addImage($foto_url, trim($row->matrikelnr) . '.jpg', 'image/jpg');
- }
- elseif ($row->foto_sperre == 't')
- {
- $foto_url = 'gesperrt';
- }
-
- //create studiengruppe
- $student_studiengruppe = strtoupper($row->typ.$row->kurzbz.'-'.$row->semester);
-
- //add studierenden data for XML
- $data[] = array('studierende' => array(
- 'vorname' => $row->vorname,
- 'nachname' => mb_strtoupper($row->nachname, 'UTF-8'),
- 'personenkennzeichen' => trim($row->matrikelnr),
- 'geschlecht' => $row->geschlecht,
- 'foto_gesperrt' => $row->foto_sperre, // f/t
- 'foto_url' => $foto_url,
- 'studiengruppe' => $student_studiengruppe,
- 'verband' => trim($row->verband),
- 'gruppe' => trim($row->gruppe),
- 'zusatz' => $zusatz
- ));
- }
- }
- //Anzahl Studierende in Array $data (an erster Stelle) einfuegen
- $data = array_reverse($data, true);
- $data['anzahl_studierende'] = $anzahl_studierende;
- $data = array_reverse($data, true);
-}
-
-//add data to fotoliste.xsl
-$doc->addDataArray($data, 'fotoliste');
-
-//set doc name
-$doc->setFilename('Fotoliste_'.$stg_bezeichnung.'_'.$studiensemester.'_'.$lv_bezeichnung);
-
-//create doc in format required
-if (!$doc->create($output))
- die($doc->errormsg);
-
-//download doc
-$doc->output();
-
-//unlink doc from tmp-folder
-$doc->close();
-
-//unlink fotos from tmp-folder
-foreach ($foto_url_arr as $foto_url)
- unlink($foto_url);
+
+ *
+ * Description: This file creates a studentlist with students' profile fotos
+ * by a given studiengangs- and lehrveranstaltungs ID (and eventually a given lehreinheit ID).
+ * If fotos are locked by student, a dummy picture is inserted instead of the students foto.
+ * EXCEPTION: if user has admins or assitents rights, ALL students' fotos are iserted (even locked ones)
+ *
+ */
+
+require_once('../../../config/cis.config.inc.php');
+require_once('../../../include/dokument_export.class.php');
+require_once('../../../include/lehrveranstaltung.class.php');
+require_once('../../../include/lehreinheit.class.php');
+require_once('../../../include/benutzerberechtigung.class.php');
+require_once('../../../include/studiensemester.class.php');
+require_once('../../../include/studiengang.class.php');
+require_once('../../../include/functions.inc.php');
+require_once('../../../include/erhalter.class.php');
+require_once('../../../include/datum.class.php');
+
+
+$doc = new dokument_export('fotoliste');
+$output = 'pdf';
+$show_all_fotos = false;
+
+
+//check user access & $_GET vars
+if (!$db = new basis_db())
+ die('Es konnte keine Verbindung zum Server aufgebaut werden.');
+
+$user = get_uid();
+
+
+if (isset($_GET['lvid']) && is_numeric($_GET['lvid']))
+ $lvid = $_GET['lvid'];
+else
+ die('Eine gueltige LvID muss uebergeben werden');
+
+isset($_GET['stsem']) ? $studiensemester = $_GET['stsem'] : die('Ein Studiensemester muss uebergeben werden');
+
+$lv = new lehrveranstaltung();
+$lv->load($lvid);
+
+$stg = new studiengang();
+$stg->load($lv->studiengang_kz);
+
+$berechtigung = new benutzerberechtigung();
+$berechtigung->getBerechtigungen($user);
+
+if (!$berechtigung->isBerechtigt('admin') && !$berechtigung->isBerechtigt('assistenz') && !$berechtigung->isBerechtigt('lehre', $lv->oe_kurzbz, 's') && !check_lektor_lehrveranstaltung($user, $lvid, $studiensemester))
+ die('Sie muessen LektorIn der LV sein oder das Recht "ADMIN", "ASSISTENZ" oder "LEHRE" haben, um diese Seite aufrufen zu koennen');
+
+if ($berechtigung->isBerechtigt('admin') || $berechtigung->isBerechtigt('assistenz'))
+ $show_all_fotos = true;
+
+if (isset($_GET['output']) && ($output = 'odt' || $output = 'doc'))
+ $output = $_GET['output'];
+isset($_GET['stg_kz']) ? $studiengang = $_GET['stg_kz'] : $studiengang = NULL;
+isset($_GET['lehreinheit_id']) ? $lehreinheit = $_GET['lehreinheit_id'] : $lehreinheit = NULL;
+
+
+//**************************** overall lehrveranstaltungs data *******************************
+//load overall lehrveranstaltungs-data
+$qry = "SELECT DISTINCT ON
+ (kuerzel, semester, verband, gruppe, gruppe_kurzbz)
+ UPPER(stg_typ || stg_kurzbz) as kuerzel,
+ lv_bezeichnung,
+ stg_bez,
+ semester,
+ verband,
+ gruppe,
+ gruppe_kurzbz,
+ stg_typ
+ FROM
+ campus.vw_lehreinheit
+ WHERE
+ lehrveranstaltung_id=" . $db->db_add_param($lvid, FHC_INTEGER) . "
+ AND
+ studiensemester_kurzbz=" . $db->db_add_param($studiensemester);
+if ($lehreinheit != '')
+ $qry .= " AND lehreinheit_id=" . $db->db_add_param($lehreinheit, FHC_INTEGER);
+
+$gruppen_string = '';
+$gruppen_string_arr = array();
+$stg_typ = $stg->typ;
+$stg_bezeichnung = $stg->bezeichnung;
+
+//structure overall lehrveranstaltungs data
+if ($result = $db->db_query($qry)) {
+ while ($row = $db->db_fetch_object($result)) {
+ //lehrveranstaltung
+ $lv_bezeichnung = $row->lv_bezeichnung;
+
+ //collect all gruppenkürzel
+ if ($row->gruppe_kurzbz == '')
+ $gruppen_string = trim($row->kuerzel . '-' . $row->semester . $row->verband . $row->gruppe);
+ else
+ $gruppen_string = $row->gruppe_kurzbz;
+
+ $gruppen_string_arr[] = $gruppen_string;
+ }
+}
+
+//concatinate distinct gruppenkürzel
+$studiengruppe = implode(", ", array_unique($gruppen_string_arr));
+
+//get studiengangstyp-bezeichnung
+$qry = "SELECT
+ bezeichnung
+ FROM
+ public.tbl_studiengangstyp
+ WHERE
+ typ =" . $db->db_add_param($stg_typ);
+
+if ($result = $db->db_query($qry)) {
+ $row = $db->db_fetch_object($result);
+ $stg_typ_bezeichnung = $row->bezeichnung;
+}
+
+
+//add overall lehrveranstaltungs-data for XML
+$data = array(
+ 'lehrveranstaltung' => $lv_bezeichnung,
+ 'studiengang' => $stg_bezeichnung,
+ 'studiengangs_typ' => $stg_typ_bezeichnung,
+ 'studiensemester' => $studiensemester,
+ 'studiengruppe' => $studiengruppe
+);
+
+
+
+//**************************** students data *******************************
+//load students-data
+$qry = 'SELECT DISTINCT ON
+ (nachname, vorname, person_id)
+ vorname,
+ nachname,
+ matrikelnr,
+ tbl_studentlehrverband.semester,
+ tbl_studentlehrverband.verband,
+ tbl_studentlehrverband.gruppe,
+ (SELECT
+ status_kurzbz
+ FROM
+ public.tbl_prestudentstatus
+ WHERE
+ prestudent_id=tbl_student.prestudent_id
+ ORDER BY
+ datum DESC, insertamum DESC, ext_id DESC LIMIT 1) as status,
+ tbl_studiengang.kurzbz,
+ tbl_studiengang.typ,
+ tbl_bisio.bisio_id,
+ tbl_bisio.von,
+ tbl_bisio.bis,
+ tbl_student.studiengang_kz AS stg_kz_student,
+ tbl_zeugnisnote.note,
+ tbl_mitarbeiter.mitarbeiter_uid,
+ tbl_person.person_id,
+ tbl_person.matr_nr,
+ tbl_person.geschlecht,
+ tbl_person.foto,
+ tbl_person.foto_sperre
+ FROM
+ campus.vw_student_lehrveranstaltung
+ JOIN public.tbl_benutzer USING(uid)
+ JOIN public.tbl_person USING(person_id)
+ LEFT JOIN public.tbl_student ON(uid=student_uid)
+ LEFT JOIN public.tbl_studiengang ON(tbl_studiengang.studiengang_kz=tbl_student.studiengang_kz)
+ LEFT JOIN public.tbl_mitarbeiter ON(uid=mitarbeiter_uid)
+ LEFT JOIN public.tbl_studentlehrverband USING(student_uid,studiensemester_kurzbz)
+ LEFT JOIN lehre.tbl_zeugnisnote ON(vw_student_lehrveranstaltung.lehrveranstaltung_id=tbl_zeugnisnote.lehrveranstaltung_id
+ AND tbl_zeugnisnote.student_uid=tbl_student.student_uid
+ AND tbl_zeugnisnote.studiensemester_kurzbz=tbl_studentlehrverband.studiensemester_kurzbz)
+ LEFT JOIN bis.tbl_bisio ON(uid=tbl_bisio.student_uid)
+ WHERE
+ vw_student_lehrveranstaltung.lehrveranstaltung_id=' . $db->db_add_param($lvid, FHC_INTEGER) . ' AND
+ vw_student_lehrveranstaltung.studiensemester_kurzbz=' . $db->db_add_param($studiensemester);
+
+if ($lehreinheit != '')
+ $qry .= ' AND vw_student_lehrveranstaltung.lehreinheit_id=' . $db->db_add_param($lehreinheit, FHC_INTEGER);
+
+$qry .= ' ORDER BY nachname, vorname, person_id, tbl_bisio.bis DESC';
+
+$stsem_obj = new studiensemester();
+$stsem_obj->load($studiensemester);
+$stsemdatumvon = $stsem_obj->start;
+$stsemdatumbis = $stsem_obj->ende;
+
+$erhalter = new erhalter();
+$erhalter->getAll();
+
+$a_o_kz = '9' . sprintf("%03s", $erhalter->result[0]->erhalter_kz); //Stg_Kz AO-Studierende auslesen (9005 fuer FHTW)
+$anzahl_studierende = 0;
+$datum = new datum();
+$zusatz = '';
+$foto_url_arr = array();
+
+//structure students data
+if ($result = $db->db_query($qry)) {
+ while ($row = $db->db_fetch_object($result)) {
+ if ($row->status != 'Abbrecher' && $row->status != 'Unterbrecher') {
+ $anzahl_studierende++;
+
+ if ($row->status == 'Incoming') //Incoming
+ $zusatz = '(i)';
+ else
+ $zusatz = '';
+
+ if ($row->bisio_id != '' && $row->status != 'Incoming' && ($row->bis > $stsemdatumvon || $row->bis == '') && $row->von < $stsemdatumbis) //Outgoing
+ $zusatz .= '(o)(ab ' . $datum->formatDatum($row->von, 'd.m.Y') . ')';
+
+ if ($row->note == 6) //angerechnet
+ $zusatz .= '(ar)';
+
+ if ($row->mitarbeiter_uid != '') //mitarbeiter
+ $zusatz .= '(ma)';
+
+ if ($row->stg_kz_student == $a_o_kz) //Außerordentliche Studierende
+ $zusatz .= '(a.o.)';
+
+ //allow admin and assistenz to see ALL fotos (even if locked by user)
+ if ($show_all_fotos)
+ $row->foto_sperre = 'f';
+
+ //create foto (if not locked by student OR if fotolist is created by admin or assistenz)
+ $foto_url = '';
+
+ if ($row->foto_sperre == 'f' && $row->foto != '') {
+ $foto_src = $row->foto;
+ $foto_url = sys_get_temp_dir() . '/foto' . trim($row->person_id) . '.jpg';
+ $foto_url_arr[] = $foto_url;
+
+ //create writeable file
+ if (!$foto = fopen($foto_url, 'w'))
+ die("Das Bild konnte nicht erstellt werden");
+ //add foto base64-code
+ if (!fwrite($foto, base64_decode($foto_src)))
+ {
+ die("Das Bild konnte nicht erstellt werden");
+ }
+
+ //add foto to document
+ $doc->addImage($foto_url, trim($row->person_id) . '.jpg', 'image/jpg');
+ }
+ elseif ($row->foto_sperre == 't')
+ {
+ $foto_url = 'gesperrt';
+ }
+
+ //create studiengruppe
+ $student_studiengruppe = strtoupper($row->typ.$row->kurzbz.'-'.$row->semester);
+
+ //add studierenden data for XML
+ $data[] = array('studierende' => array(
+ 'vorname' => $row->vorname,
+ 'nachname' => mb_strtoupper($row->nachname, 'UTF-8'),
+ 'personenkennzeichen' => trim($row->matrikelnr),
+ 'geschlecht' => $row->geschlecht,
+ 'foto_gesperrt' => $row->foto_sperre, // f/t
+ 'foto_url' => $foto_url,
+ 'studiengruppe' => $student_studiengruppe,
+ 'verband' => trim($row->verband),
+ 'gruppe' => trim($row->gruppe),
+ 'zusatz' => $zusatz
+ ));
+ }
+ }
+ //Anzahl Studierende in Array $data (an erster Stelle) einfuegen
+ $data = array_reverse($data, true);
+ $data['anzahl_studierende'] = $anzahl_studierende;
+ $data = array_reverse($data, true);
+}
+
+//add data to fotoliste.xsl
+$doc->addDataArray($data, 'fotoliste');
+
+//set doc name
+$doc->setFilename('Fotoliste_'.$stg_bezeichnung.'_'.$studiensemester.'_'.$lv_bezeichnung);
+
+//create doc in format required
+if (!$doc->create($output))
+ die($doc->errormsg);
+
+//download doc
+$doc->output();
+
+//unlink doc from tmp-folder
+$doc->close();
+
+//unlink fotos from tmp-folder
+foreach ($foto_url_arr as $foto_url)
+ unlink($foto_url);
diff --git a/cis/private/lehre/pruefung/pruefung.js.php b/cis/private/lehre/pruefung/pruefung.js.php
index 9ef84e889..b207c94e5 100644
--- a/cis/private/lehre/pruefung/pruefung.js.php
+++ b/cis/private/lehre/pruefung/pruefung.js.php
@@ -575,8 +575,8 @@ function saveAnmeldung(lehrveranstaltung_id, termin_id)
studienverpflichtung_id = $("#studienverpflichtung option:selected").val();
var studiengang_kz = null;
- if($('#select_studiengang').length)
- studiengang_kz = $('#select_studiengang option:selected').val();
+ if($('#prestudent_studiengang').length)
+ studiengang_kz = $('#prestudent_studiengang option:selected').val();
$.ajax({
dataType: 'json',
@@ -758,9 +758,10 @@ function convertDateTime(string, type)
* Lädt die Anmeldungen zu einer Prüfung
* @param {type} pruefungstermin_id ID des Prüfungstermins
* @param {type} lehrveranstaltung_id ID der Lehrveranstaltung
+ * @param saveReihungAfterShow speichert Reihung neu wenn true
* @returns {undefined}
*/
-function showAnmeldungen(pruefungstermin_id, lehrveranstaltung_id)
+function showAnmeldungen(pruefungstermin_id, lehrveranstaltung_id, saveReihungAfterShow = false)
{
$("#kommentar").empty();
$("#kommentarSpeichernButton").empty();
@@ -778,6 +779,9 @@ function showAnmeldungen(pruefungstermin_id, lehrveranstaltung_id)
writeAnmeldungen(data);
$("#sortable").sortable();
$("#sortable").disableSelection();
+
+ if(saveReihungAfterShow)
+ saveReihung(pruefungstermin_id, lehrveranstaltung_id);
}
});
}
@@ -806,7 +810,8 @@ function writeAnmeldungen(data)
{
case 'angemeldet':
liste += "
"+vorname+" "+nachname+" ";
- liste += ""+count+"
' onclick='anmeldungBestaetigen(\""+d.pruefungsanmeldung_id+"\", \""+terminId+"\", \""+lehrveranstaltung_id+"\");'>
";
+ liste += ""+count+"
' onclick='anmeldungBestaetigen(\""+d.pruefungsanmeldung_id+"\", \""+terminId+"\", \""+lehrveranstaltung_id+"\");'>";
+ liste += "
";
if(d.wuensche !== null)
{
liste += "";
@@ -887,28 +892,31 @@ function saveReihung(terminId, lehrveranstaltung_id)
anmeldung.uid = v.id;
reihung.push(anmeldung);
});
- $.ajax({
- dataType: 'json',
- url: "./pruefungsanmeldung.json.php",
- type: "POST",
- data: {
- method: "saveReihung",
- reihung: reihung
- },
- error: loadError,
- success: function(data){
- if(data.error === 'false' && data.result === true)
- {
- messageBox("message", "t('pruefung/reihunghErfolgreichGeaendert'); ?>", "green", "highlight", 1000);
- }
- else
- {
- messageBox("message", data.errormsg, "red", "highlight", 1000);
- }
- showAnmeldungen(terminId, lehrveranstaltung_id);
- }
- });
+ if (reihung.length > 0) {
+ $.ajax({
+ dataType: 'json',
+ url: "./pruefungsanmeldung.json.php",
+ type: "POST",
+ data: {
+ method: "saveReihung",
+ reihung: reihung
+ },
+ error: loadError,
+ success: function(data){
+ if(data.error === 'false' && data.result === true)
+ {
+ messageBox("message", "t('pruefung/reihunghErfolgreichGeaendert'); ?>", "green", "highlight", 1000);
+ }
+ else
+ {
+ messageBox("message", data.errormsg, "red", "highlight", 1000);
+ }
+
+ showAnmeldungen(terminId, lehrveranstaltung_id);
+ }
+ });
+ }
}
/**
@@ -945,6 +953,43 @@ function anmeldungBestaetigen(pruefungsanmeldung_id, termin_id, lehrveranstaltun
});
}
+/**
+ * Löscht eine Prüfungsanmeldung
+ * @param {type} pruefungsanmeldung_id ID der Prüfungsanmeldung
+ * @param {type} termin_id ID des Prüfungstermines
+ * @param {type} lehrveranstaltung_id ID der Lehrveranstaltung
+ * @returns {undefined}
+ */
+function anmeldungLoeschen(pruefungsanmeldung_id, termin_id, lehrveranstaltung_id)
+{
+ if (!confirm("Möchten Sie die Anmeldung wirklich löschen?"))
+ return undefined;
+
+ $.ajax({
+ dataType: 'json',
+ url: "./pruefungsanmeldung.json.php",
+ type: "POST",
+ data: {
+ method: "anmeldungLoeschen",
+ pruefungsanmeldung_id: pruefungsanmeldung_id
+ },
+ error: loadError,
+ success: function(data){
+ if(data.error === 'false' && data.result === true)
+ {
+ if(termin_id !== 'undefined' && lehrveranstaltung_id !== 'undefined')
+ {
+ showAnmeldungen(termin_id, lehrveranstaltung_id, true);
+ }
+ }
+ else
+ {
+ messageBox("message", data.errormsg, "red", "highlight", 1000);
+ }
+ }
+ });
+}
+
/**
* Ändert den Status aller Anmeldungen eines Termins auf "bestätigt"
* @param {type} termin_id ID des Prüfungstermines
@@ -1174,7 +1219,8 @@ function loadStudiensemester()
url: "./pruefungstermin.json.php",
type: "POST",
data: {
- method: "loadStudiensemester"
+ method: "loadStudiensemester",
+ prevSemester: 5
},
error: loadError,
success: function(data){
diff --git a/cis/private/lehre/pruefung/pruefungsanmeldung.json.php b/cis/private/lehre/pruefung/pruefungsanmeldung.json.php
index b4eba2f6d..ce7479cf0 100644
--- a/cis/private/lehre/pruefung/pruefungsanmeldung.json.php
+++ b/cis/private/lehre/pruefung/pruefungsanmeldung.json.php
@@ -97,6 +97,9 @@ switch($method)
case 'anmeldungBestaetigen':
$data = anmeldungBestaetigen($uid);
break;
+ case 'anmeldungLoeschen':
+ $data = anmeldungLoeschen();
+ break;
case 'alleBestaetigen':
$data = alleBestaetigen($uid);
break;
@@ -629,24 +632,11 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null)
{
foreach ($prestudenten as $ps)
{
- if($ps->studiengang_kz === $studiengang_kz)
+ if ($ps->getLaststatus($ps->prestudent_id, $stdsem))
{
- if ($ps->getLaststatus($ps->prestudent_id, $stdsem))
+ if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher"))
{
- if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher"))
- {
- $prestudent_id = $ps->prestudent_id;
- }
- else
- {
- if ($ps->getLaststatus($ps->prestudent_id, $stdsem_lv_besuch))
- {
- if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher"))
- {
- $prestudent_id = $ps->prestudent_id;
- }
- }
- }
+ $prestudent_id = $ps->prestudent_id;
}
else
{
@@ -659,6 +649,16 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null)
}
}
}
+ else
+ {
+ if ($ps->getLaststatus($ps->prestudent_id, $stdsem_lv_besuch))
+ {
+ if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher"))
+ {
+ $prestudent_id = $ps->prestudent_id;
+ }
+ }
+ }
}
}
else
@@ -1066,6 +1066,30 @@ function anmeldungBestaetigen($uid)
return $data;
}
+/**
+ * Löscht eine Prüfungsanmeldung
+ * @return Array
+ */
+function anmeldungLoeschen()
+{
+ $pruefungsanmeldung_id = $_REQUEST["pruefungsanmeldung_id"];
+ $anmeldung = new pruefungsanmeldung();
+
+ if($anmeldung->delete($pruefungsanmeldung_id))
+ {
+ $data['result']=true;
+ $data['error']='false';
+ $data['errormsg']='';
+ }
+ else
+ {
+ $data['error']='true';
+ $data['errormsg']=$anmeldung->errormsg;
+ }
+
+ return $data;
+}
+
/**
* Lädt alle Studiengänge
* @return Array
@@ -1177,7 +1201,12 @@ function getAllFreieRaeume($terminId)
$teilnehmer = $teilnehmer !== false ? $teilnehmer : 0;
$pruefungstermin->getAll($pruefungstermin->von, $pruefungstermin->bis, TRUE);
- if($ort->search($datum_von[0], $datum_von[1], $datum_bis[1], null, $teilnehmer, true))
+ if(defined('CIS_PRUEFUNGSANMELDUNG_ERLAUBE_TERMINKOLLISION') && CIS_PRUEFUNGSANMELDUNG_ERLAUBE_TERMINKOLLISION)
+ $ortSuccess = $ort->getOrte(true, null, true);
+ else
+ $ortSuccess = $ort->search($datum_von[0], $datum_von[1], $datum_bis[1], null, $teilnehmer, true);
+
+ if($ortSuccess)
{
foreach($pruefungstermin->result as $termin)
{
diff --git a/cis/private/lehre/pruefung/pruefungsanmeldungen_verwalten.php b/cis/private/lehre/pruefung/pruefungsanmeldungen_verwalten.php
index 21de64fcc..22bca21cc 100644
--- a/cis/private/lehre/pruefung/pruefungsanmeldungen_verwalten.php
+++ b/cis/private/lehre/pruefung/pruefungsanmeldungen_verwalten.php
@@ -252,7 +252,7 @@ if (empty($pruefung->result) && !$rechte->isBerechtigt('lehre/pruefungsanmeldung
';
$aktuellesSemester = $studiensemester->getaktorNext();
- $studiensemester->getAll();
+ $studiensemester->getPlusMinus(null, 5);
foreach($studiensemester->studiensemester as $sem)
{
/*@var $sem studiensemester */
diff --git a/cis/private/lehre/pruefung/pruefungstermin.json.php b/cis/private/lehre/pruefung/pruefungstermin.json.php
index 36ca332bd..978c3e69e 100644
--- a/cis/private/lehre/pruefung/pruefungstermin.json.php
+++ b/cis/private/lehre/pruefung/pruefungstermin.json.php
@@ -61,7 +61,8 @@ switch($method)
case 'loadStudiensemester':
$studiensemester = new studiensemester();
$aktStudiensemester = $studiensemester->getaktorNext();
- $data = loadStudiensemester($aktStudiensemester);
+ $prevSemester = empty($_POST["prevSemester"]) ? 0 : $_POST["prevSemester"];
+ $data = loadStudiensemester($aktStudiensemester, $prevSemester);
break;
case 'getPruefungsfensterByStudiensemester':
$studiensemester = new studiensemester();
@@ -223,12 +224,15 @@ function loadPruefungstypen($abschluss)
/**
* Lädt alle Studiensemester aus der Datenbank
* @param String $aktStudiensemester das Aktuelle Studiensemester
+ * @param int $prevSemester wie viele vergangene Semester sollen geladen werden
* @return Array
*/
-function loadStudiensemester($aktStudiensemester = null)
+function loadStudiensemester($aktStudiensemester = null, $prevSemester = 0)
{
$studiensemester = new studiensemester();
- if($studiensemester->getAll())
+ $prevSemester == 0 ? $studiensemester->getAll() : $studiensemester->getPlusMinus(null, $prevSemester);
+
+ if(!empty($studiensemester->studiensemester))
{
$data['result']=$studiensemester->studiensemester;
if(!is_null($aktStudiensemester))
diff --git a/cis/private/lvplan/stpl_detail.php b/cis/private/lvplan/stpl_detail.php
index 3612a15db..87d4a70ff 100644
--- a/cis/private/lvplan/stpl_detail.php
+++ b/cis/private/lvplan/stpl_detail.php
@@ -156,9 +156,12 @@ $num_rows_stpl = $db->db_num_rows($erg_stpl);
$sql_query="
SELECT
vw_reservierung.*, vw_mitarbeiter.titelpre, vw_mitarbeiter.titelpost,
- vw_mitarbeiter.vorname,vw_mitarbeiter.nachname
+ vw_mitarbeiter.vorname, vw_mitarbeiter.nachname, reserviert_von.titelpre AS titelpre_reserviertvon, reserviert_von.titelpost AS titelpost_reserviertvon,
+ reserviert_von.vorname AS vorname_reserviertvon, reserviert_von.nachname AS nachname_reserviertvon
FROM
- campus.vw_reservierung, campus.vw_mitarbeiter
+ campus.vw_reservierung
+ JOIN campus.vw_mitarbeiter ON vw_reservierung.uid=vw_mitarbeiter.uid
+ LEFT JOIN campus.vw_mitarbeiter reserviert_von ON vw_reservierung.insertvon=reserviert_von.uid
WHERE
datum=".$db->db_add_param($datum)."
AND stunde=".$db->db_add_param($stunde);
@@ -167,7 +170,6 @@ if (isset($ort_kurzbz) && $type=='ort')
$sql_query.=" AND vw_reservierung.ort_kurzbz=".$db->db_add_param($ort_kurzbz);
if ($type=='lektor')
$sql_query.=" AND vw_reservierung.uid=".$db->db_add_param($pers_uid);
-$sql_query.=" AND vw_reservierung.uid=vw_mitarbeiter.uid";
if ($type=='verband' || $type=='student')
{
$sql_query.=" AND studiengang_kz=".$db->db_add_param($stg_kz)."
@@ -271,7 +273,7 @@ if ($num_rows_repl>0)
{
echo ''.$p->t('lvplan/reservierungen').' ';
echo '';
- echo ''.$p->t('global/titel').' '.$p->t('lvplan/ort').' '.$p->t('global/person').' '.$p->t('global/beschreibung').' ';
+ echo ''.$p->t('global/titel').' '.$p->t('lvplan/ort').' '.$p->t('global/person').' '.$p->t('global/beschreibung').' '.$p->t('lvplan/reserviertVon').' ';
$i=0;
$ort = new ort();
while($row = $db->db_fetch_object($erg_repl))
@@ -285,13 +287,20 @@ if ($num_rows_repl>0)
$pers_nachname=$row->nachname;
$pers_email=$row->uid.'@'.DOMAIN;
$beschreibung=$row->beschreibung;
+ $reserviertvon=$row->insertvon;
+ $titelpre_reserviertvon=$row->titelpre_reserviertvon;
+ $titelpost_reserviertvon=$row->titelpost_reserviertvon;
+ $pers_vorname_reserviertvon=$row->vorname_reserviertvon;
+ $pers_nachname_reserviertvon=$row->nachname_reserviertvon;
+
$ort->load($ortkurzbz);
echo '';
- echo ''.$db->convert_html_chars($titel).' ';
+ echo ''.$db->convert_html_chars($titel).' ';
echo ''.(!empty($ortkurzbz)?($ort->content_id!=''?''.$db->convert_html_chars($ortkurzbz).' ':$db->convert_html_chars($ortkurzbz)):$db->convert_html_chars($ortkurzbz)).' ';
- echo ''.$db->convert_html_chars($titelpre.' '.$pers_vorname.' '.$pers_nachname.' '.$titelpost).' ';
- echo ''.$db->convert_html_chars($beschreibung).' ';
+ echo ''.$db->convert_html_chars($titelpre.' '.$pers_vorname.' '.$pers_nachname.' '.$titelpost).' ';
+ echo ''.$db->convert_html_chars($beschreibung).' ';
+ echo ''.$db->convert_html_chars($titelpre_reserviertvon.' '.$pers_vorname_reserviertvon.' '.$pers_nachname_reserviertvon.' '.$titelpost_reserviertvon).' ';
}
echo '
';
}
diff --git a/cis/private/lvplan/stpl_reserve_list.php b/cis/private/lvplan/stpl_reserve_list.php
index 5e6e1fa85..21328050b 100644
--- a/cis/private/lvplan/stpl_reserve_list.php
+++ b/cis/private/lvplan/stpl_reserve_list.php
@@ -88,9 +88,15 @@ if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 'suid'))
$datum = date("Y-m-d",$datum);
//EIGENE
- $sql_query="SELECT * FROM campus.vw_reservierung
+ $sql_query="SELECT vw_reservierung.*, vw_mitarbeiter.titelpre, vw_mitarbeiter.titelpost,
+ vw_mitarbeiter.vorname, vw_mitarbeiter.nachname, reserviert_von.titelpre AS titelpre_reserviertvon,
+ reserviert_von.titelpost AS titelpost_reserviertvon, reserviert_von.vorname AS vorname_reserviertvon,
+ reserviert_von.nachname AS nachname_reserviertvon
+ FROM campus.vw_reservierung
+ JOIN campus.vw_mitarbeiter ON vw_reservierung.uid=vw_mitarbeiter.uid
+ LEFT JOIN campus.vw_mitarbeiter reserviert_von ON vw_reservierung.insertvon=reserviert_von.uid
WHERE datum>=".$db->db_add_param($datum)."
- AND (uid=".$db->db_add_param($uid)." OR insertvon=".$db->db_add_param($uid).")
+ AND (vw_reservierung.uid=".$db->db_add_param($uid)." OR vw_reservierung.insertvon=".$db->db_add_param($uid).")
ORDER BY datum, titel, ort_kurzbz, stunde";
if (!$erg_res=$db->db_query($sql_query))
@@ -108,8 +114,9 @@ if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 'suid'))
'.$p->t('global/titel').'
'.$p->t('global/stunde').'
'.$p->t('lvplan/raum').'
- '.$p->t('global/uid').'
+ '.$p->t('global/person').'
'.$p->t('global/beschreibung').'
+ '.$p->t('lvplan/reserviertVon').'
'.$p->t('global/aktion').'
';
for ($i=0; $i<$num_rows_res; $i++)
@@ -124,6 +131,14 @@ if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 'suid'))
$beschreibung=$db->db_result($erg_res,$i,"beschreibung");
$insertamum=$db->db_result($erg_res,$i,"insertamum");
$insertvon=$db->db_result($erg_res,$i,"insertvon");
+ $titelpre=$db->db_result($erg_res,$i,"titelpre");
+ $titelpost=$db->db_result($erg_res,$i,"titelpost");
+ $pers_vorname=$db->db_result($erg_res,$i,"vorname");
+ $pers_nachname=$db->db_result($erg_res,$i,"nachname");
+ $titelpre_reserviertvon=$db->db_result($erg_res,$i,"titelpre_reserviertvon");
+ $titelpost_reserviertvon=$db->db_result($erg_res,$i,"titelpost_reserviertvon");
+ $pers_vorname_reserviertvon=$db->db_result($erg_res,$i,"vorname_reserviertvon");
+ $pers_nachname_reserviertvon=$db->db_result($erg_res,$i,"nachname_reserviertvon");
$datum1 = $datum_obj->formatDatum($datum1, 'd.m.Y');
if($insertamum!='')
$insertamum = $datum_obj->formatDatum($insertamum, 'd.m.Y H:i:s');
@@ -132,8 +147,9 @@ if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 'suid'))
echo ''.$db->convert_html_chars($titel).' ';
echo ''.$db->convert_html_chars($stunde).' ';
echo ''.$db->convert_html_chars($ort_kurzbz).' ';
- echo ''.$db->convert_html_chars($pers_uid).' ';
+ echo ''.$db->convert_html_chars($titelpre.' '.$pers_vorname.' '.$pers_nachname.' '.$titelpost).' ';
echo ''.$db->convert_html_chars($beschreibung).' ';
+ echo ''.$db->convert_html_chars($titelpre_reserviertvon.' '.$pers_vorname_reserviertvon.' '.$pers_nachname_reserviertvon.' '.$titelpost_reserviertvon).' ';
$z=$i-1;
if (($pers_uid==$uid || $insertvon==$uid) && $rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 'suid'))
echo 'Delete ';
diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php
index cd40391e1..2d96380f6 100644
--- a/cis/private/tools/zeitaufzeichnung.php
+++ b/cis/private/tools/zeitaufzeichnung.php
@@ -55,6 +55,7 @@ if (!$db = new basis_db())
$user = get_uid();
+$passuid = false;
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
@@ -67,6 +68,7 @@ if(isset($_GET['uid']))
$user = $_GET['uid'];
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
+ $passuid = true;
}
else
{
@@ -1021,7 +1023,7 @@ if($projekt->getProjekteMitarbeiter($user, true))
CSV Export ";
if($anzprojekte > 0)
- echo " | ".$p->t("zeitaufzeichnung/projektexport")." ";
+ echo " | ".$p->t("zeitaufzeichnung/projektexport")." ";
echo "
';
echo ''.$p->t('zeitaufzeichnung/projektexport').' ';
echo ''.$p->t('zeitaufzeichnung/monat').' ';
- for($i=1;$i<13;$i++)
+ for ($i=1;$i<13;$i++)
{
$selected = ($i == $aktmonat)?'selected = "selected"':'';
echo ''.$monatsname[$sprache_index][$i - 1].' ';
}
echo ' ';
echo ''.$p->t('zeitaufzeichnung/jahr').' ';
- for(;$jahreanz>0;$jahreanz--)
+ for (;$jahreanz>0;$jahreanz--)
{
echo ''.$aktjahr.' ';
$aktjahr--;
}
echo ' ';
+ if ($passuid)
+ echo ' ';
echo ' ';
echo ' ';
echo '';
@@ -1490,16 +1494,19 @@ if($projekt->getProjekteMitarbeiter($user, true))
}
list($h2, $m2) = explode(':', $elsumme);
$elsumme = $h2*3600+$m2*60;
- if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0)
+ if ($datum->formatDatum($tag, 'Y-m-d') >= '2019-11-06')
{
- //$pausesumme = $tagessaldo-18000;
$pausesumme = $pausesumme;
}
+ else if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0)
+ {
+ $pausesumme = $tagessaldo-18000;
+ }
else if ($tagessaldo>18000 && $pflichtpause==false && $elsumme == 0)
{
- //$pausesumme = $pausesumme+1800;
- $pausesumme = $pausesumme;
+ $pausesumme = $pausesumme+1800;
}
+
if ($elsumme > 0){
$pausesumme = $pausesumme + $elsumme;
$pflichtpause = true;
diff --git a/cis/private/tools/zeitaufzeichnung_projektliste.php b/cis/private/tools/zeitaufzeichnung_projektliste.php
index b8b19a0a9..c578ccb88 100644
--- a/cis/private/tools/zeitaufzeichnung_projektliste.php
+++ b/cis/private/tools/zeitaufzeichnung_projektliste.php
@@ -29,6 +29,7 @@ require_once('../../../include/phrasen.class.php');
require_once('../../../include/datum.class.php');
require_once('../../../include/Excel/excel.php');
require_once('../../../include/benutzer.class.php');
+require_once('../../../include/benutzerberechtigung.class.php');
require_once('../../../include/mitarbeiter.class.php');
require_once('../../../include/zeitaufzeichnung.class.php');
require_once('../../../include/projekt.class.php');
@@ -46,6 +47,24 @@ $sprache_obj->load($sprache);
$sprache_index = $sprache_obj->index;
$uid = get_uid();
+
+//Wenn User Administrator ist und UID uebergeben wurde, dann die Zeitaufzeichnung
+//des uebergebenen Users anzeigen
+if (isset($_GET['uid']))
+{
+ $rechte = new benutzerberechtigung();
+ $rechte->getBerechtigungen($uid);
+
+ if ($rechte->isBerechtigt('admin'))
+ {
+ $uid = $_GET['uid'];
+ }
+ else
+ {
+ die($p->t('global/FuerDieseAktionBenoetigenSieAdministrationsrechte'));
+ }
+}
+
$benutzer = new benutzer();
if (!$benutzer->load($uid))
die($p->t("zeitaufzeichnung/benutzerWurdeNichtGefunden", array($uid)));
@@ -602,12 +621,12 @@ foreach ($projektnames as $projektname)
$lastspalte = 4 + $nrPhases;
//calculating spaces for centering global header texts
- $usernamelength = strlen($username) * 1.77;
+/* $usernamelength = strlen($username) * 1.77;
$numberspacesfirstrow = $totalwidth - $daywidth * 2 - $worktimewidth - $usernamelength;
$numberspacessecondrow = $numberspacesfirstrow + $usernamelength - strlen($p->t('zeitaufzeichnung/personalnr').$persnr) - 4;
$spacesstringfirstrow = str_repeat(' ', $numberspacesfirstrow);
- $spacesstringsecondrow = str_repeat(' ', $numberspacessecondrow);
+ $spacesstringsecondrow = str_repeat(' ', $numberspacessecondrow);*/
$spalte = $zeile = 0;
@@ -626,14 +645,14 @@ foreach ($projektnames as $projektname)
}
$worksheet->setMerge($zeile, $spalte + 3, $zeile, $lastspalte);
$worksheet->setMerge($zeile + 1, $spalte + 3, $zeile + 1, $lastspalte);
- $worksheet->write($zeile, $spalte + 3, $p->t('zeitaufzeichnung/projektlistegedruckt').$spacesstringfirstrow.$username, $format_heading_right);
+ $worksheet->write($zeile, $spalte + 3, /*$p->t('zeitaufzeichnung/projektlistegedruckt').$spacesstringfirstrow.*/$username, $format_heading_right);
for ($i = 4; $i < $lastspalte; $i++)
{
$worksheet->write($zeile, $i, '', $format_heading_topline);
$worksheet->write($zeile + 1, $i, '', $format_heading_bottomline);
}
$worksheet->write($zeile, $lastspalte, '', $format_heading_right);
- $worksheet->write($zeile + 1, $spalte + 3, date('d.m.Y H:i').$spacesstringsecondrow.$p->t('zeitaufzeichnung/personalnr').$persnr, $format_heading_right_bottomline);
+ $worksheet->write($zeile + 1, $spalte + 3, /*date('d.m.Y H:i').$spacesstringsecondrow.*/$p->t('zeitaufzeichnung/personalnr').$persnr, $format_heading_right_bottomline);
$worksheet->write($zeile + 1, $lastspalte, '', $format_heading_right_bottomline);
$zeile += 3;
diff --git a/cis/public/coodle.php b/cis/public/coodle.php
index da557217b..48c585d6b 100644
--- a/cis/public/coodle.php
+++ b/cis/public/coodle.php
@@ -158,7 +158,9 @@ if (isset($_POST['auswahl_termin']))
';
}
else
+ {
$saveOk = true;
+ }
$coodle_status = new coodle();
$coodle_status->load($coodle_id);
@@ -283,6 +285,7 @@ if (isset($_GET['resend']))
$(this).remove();
});
}, 1500);
+
+
+
+
+';
+
+$stg_kz = (isset($_GET['stg_kz'])?$_GET['stg_kz']:'-1');
+$gebietToCopy = (isset($_POST['gebietToCopy'])?$_POST['gebietToCopy']:(isset($_GET['gebietToCopy'])?$_GET['gebietToCopy']:''));
+$gebiet = new gebiet();
+
+echo '
Kopiert ein Gebiet mit allen Fragen und Antworten aber ohne Zuordnungen zu Studiengängen und dgl.
';
+
+if(!$rechte->isBerechtigt('basis/testtool'))
+ die($rechte->errormsg);
+
+$returnmsg = '';
+//Speichern der Daten
+if (isset($_POST['copyGebiet']) && $_POST['copyGebiet'] == 'copyGebiet')
+{
+ if (!$rechte->isBerechtigt('basis/testtool', null, 'suid'))
+ die($rechte->errormsg);
+
+ if (isset($_POST['kurzbz']) && $_POST['kurzbz'] != '')
+ {
+ //Test, ob kurzbz schon vorhanden
+ if ($result = $db->db_query('SELECT kurzbz FROM testtool.tbl_gebiet WHERE kurzbz = '.$db->db_add_param($_POST['kurzbz']).' LIMIT 1;'))
+ {
+ if ($db->db_num_rows($result) == 0)
+ {
+ $gebietToCopy = $_POST['gebietToCopy'];
+
+ // Zu kopierendes Gebiet laden
+ $gebiet = new gebiet($gebietToCopy);
+
+ $bezeichnung_mehrsprachig = array();
+ foreach ($sprache->result as $row_sprache)
+ {
+ $bezeichnung_mehrsprachig[$row_sprache->sprache] = $_POST['bezeichnung_mehrsprachig_'.$row_sprache->sprache];
+ }
+ $gebiet->bezeichnung_mehrsprachig = $bezeichnung_mehrsprachig;
+
+ $gebiet->kurzbz = $_POST['kurzbz'];
+ $gebiet->bezeichnung = $_POST['bezeichnung_intern'];
+ $gebiet->beschreibung = $_POST['beschreibung'];
+ $gebiet->insertamum = date('Y-m-d H:i:s');
+ $gebiet->insertvon = $user;
+
+ // Neues Gebiet speichern
+ if ($gebiet->save(true))
+ {
+ $returnmsg .= '
';
+
+ // Array mit allen Fragen und Antworten anlegen
+ $frageAntwortArray = array();
+
+ // Fragen laden
+ $fragenToCopy = new frage();
+ $fragenToCopy->getFragenGebiet($gebietToCopy);
+ // Sprachen laden und für jede Sprache die Fragen und Antworten laden
+ foreach ($sprache->result as $row_sprache)
+ {
+ $fragenSpracheToCopy = new frage();
+ $indexFrageSprache = 0;
+ foreach ($fragenToCopy->result AS $copyFrage)
+ {
+ if ($fragenSpracheToCopy->getFrageSprache($copyFrage->frage_id, $row_sprache->sprache, true))
+ {
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['nummer'] = $fragenSpracheToCopy->nummer;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['demo'] = $fragenSpracheToCopy->demo;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['kategorie_kurzbz'] = $fragenSpracheToCopy->kategorie_kurzbz;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['level'] = $fragenSpracheToCopy->level;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['aktiv'] = $fragenSpracheToCopy->aktiv;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['text'] = $fragenSpracheToCopy->text;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['bild'] = $fragenSpracheToCopy->bild;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['audio'] = $fragenSpracheToCopy->audio;
+
+ // Vorschläge laden
+ $vorschlagSprachenToCopy = new vorschlag();
+ $vorschlagSprachenToCopy->getVorschlag($copyFrage->frage_id, $row_sprache->sprache, false);
+
+ $indexVorschlagSprache = 0;
+ foreach ($vorschlagSprachenToCopy->result AS $vorschlagSprache)
+ {
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['vorschlaege'][$indexVorschlagSprache]['nummer'] = $vorschlagSprache->nummer;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['vorschlaege'][$indexVorschlagSprache]['punkte'] = $vorschlagSprache->punkte;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['vorschlaege'][$indexVorschlagSprache]['text'] = $vorschlagSprache->text;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['vorschlaege'][$indexVorschlagSprache]['bild'] = $vorschlagSprache->bild;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['vorschlaege'][$indexVorschlagSprache]['audio'] = $vorschlagSprache->audio;
+ $frageAntwortArray[$row_sprache->sprache][$indexFrageSprache]['vorschlaege'][$indexVorschlagSprache]['aktiv'] = $vorschlagSprache->aktiv;
+ $indexVorschlagSprache++;
+ }
+ }
+ $indexFrageSprache++;
+ }
+ }
+
+ // Einfügen der Fragen und Antworten aus dem Array in das neue Gebiet
+ $anzahlFragenKopiert = 0;
+
+ foreach ($frageAntwortArray AS $fragesprache => $index)
+ {
+ foreach ($index AS $frage => $value)
+ {
+ $newfragen = new frage();
+ $newfragen->new = true;
+
+ $newfragen->kategorie_kurzbz = $value["kategorie_kurzbz"];
+ $newfragen->gebiet_id = $gebiet->gebiet_id;
+ $newfragen->level = $value["level"];
+ $newfragen->nummer = $value["nummer"];
+ $newfragen->demo = $value["demo"];
+ $newfragen->insertamum = date('Y-m-d H:i:s');
+ $newfragen->insertvon = $user;
+ $newfragen->aktiv = $value["aktiv"];
+
+ if ($newfragen->save())
+ {
+ $newfragen->sprache = $fragesprache;
+ $newfragen->text = $value["text"];
+ $newfragen->bild = $value["bild"];
+ $newfragen->audio = $value["audio"];
+ $newfragen->insertamum = date('Y-m-d H:i:s');
+ $newfragen->insertvon = $user;
+
+ if ($newfragen->save_fragesprache())
+ {
+ if (isset($value["vorschlaege"]))
+ {
+ foreach ($value["vorschlaege"] AS $vorschlag => $content)
+ {
+ // Vorschläge speichern
+ $newvorschlaege = new vorschlag();
+ $newvorschlaege->new = true;
+
+ $newvorschlaege->frage_id = $newfragen->frage_id;
+ $newvorschlaege->nummer = $content["nummer"];
+ $newvorschlaege->punkte = $content["punkte"];
+ $newvorschlaege->aktiv = $content["aktiv"];
+ $newvorschlaege->insertamum = date('Y-m-d H:i:s');
+ $newvorschlaege->insertvon = $user;
+
+ if ($newvorschlaege->save())
+ {
+ $newvorschlaege->sprache = $fragesprache;
+ $newvorschlaege->text = $content["text"];
+ $newvorschlaege->bild = $content["bild"];
+ $newvorschlaege->audio = $content["audio"];
+ $newvorschlaege->insertamum = date('Y-m-d H:i:s');
+ $newvorschlaege->insertvon = $user;
+
+ if ($newvorschlaege->save_vorschlagsprache())
+ {
+ $anzahlFragenKopiert++;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ $returnmsg .= '
Fehler beim Speichern der Fragesprache '.$fragesprache.' bei Frage: '.$newfragen->frage_id.'
';
+ }
+}
+
+
+$studiengang = new studiengang();
+$studiengang->getAll('typ, kurzbz', false);
+
+echo '