mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Merge branch 'master' into feature-3716/Messaging_inbox_outbox_user
This commit is contained in:
+1
-1
@@ -119,7 +119,7 @@
|
||||
- **[DEPRECATED]** Spalte ort_kurzbz in tbl_reihungstest wird nicht mehr verwendet und in zukünftigen Versionen entfernt
|
||||
|
||||
Zum Update auf diese Version folgen Sie den Anweisungen auf folgender Seite:
|
||||
http://fhcomplete.technikum-wien.at/dokuwiki/doku.php?id=fh-complete:codeigniter
|
||||
https://wiki.fhcomplete.org/doku.php?id=fh-complete:codeigniter
|
||||
|
||||
## [3.1.0] - 2015-11-12
|
||||
### Added
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# FH-Complete
|
||||
|
||||
* [FH-Complete Homepage](http://www.fhcomplete.org)
|
||||
* [Wiki](http://fhcomplete.technikum-wien.at/dokuwiki/)
|
||||
* [FH-Complete Homepage](https://www.fhcomplete.org)
|
||||
* [Wiki](https://wiki.fhcomplete.org/)
|
||||
* [Changelog](CHANGELOG.md)
|
||||
|
||||
@@ -503,3 +503,15 @@ $config['rewrite_short_tags'] = FALSE;
|
||||
| Array: array('10.0.1.200', '192.168.5.0/24')
|
||||
*/
|
||||
$config['proxy_ips'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FHComplete Build Version
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Version Number of the Current Build
|
||||
| This is used to invalidate Cache for JS and CSS Files
|
||||
|
|
||||
| Example: 2019102901
|
||||
*/
|
||||
$config['fhcomplete_build_version'] = '2019102903';
|
||||
|
||||
@@ -14,6 +14,7 @@ $config['navigation_header'] = array(
|
||||
'icon' => 'sitemap',
|
||||
'description' => 'Organisation',
|
||||
'sort' => 20,
|
||||
'requiredPermissions' => 'basis/vilesci:r',
|
||||
'children'=> array(
|
||||
'vilesci' => array(
|
||||
'link' => base_url('vilesci'),
|
||||
@@ -30,6 +31,7 @@ $config['navigation_header'] = array(
|
||||
'icon' => 'graduation-cap',
|
||||
'description' => 'Lehre',
|
||||
'sort' => 30,
|
||||
'requiredPermissions' => 'basis/vilesci:r',
|
||||
'children'=> array(
|
||||
'cis' => array(
|
||||
'link' => CIS_ROOT,
|
||||
@@ -51,6 +53,16 @@ $config['navigation_header'] = array(
|
||||
'sort' => 30,
|
||||
'requiredPermissions' => 'infocenter:r'
|
||||
),
|
||||
'lehrauftrag' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
|
||||
'description' => 'Lehrauftrag',
|
||||
'expand' => true,
|
||||
'sort' => 40,
|
||||
'requiredPermissions' => array(
|
||||
'lehre/lehrauftrag_bestellen:r',
|
||||
'lehre/lehrauftrag_erteilen:r'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'Personen' => array(
|
||||
@@ -58,6 +70,7 @@ $config['navigation_header'] = array(
|
||||
'icon' => 'user',
|
||||
'description' => 'Personen',
|
||||
'sort' => 40,
|
||||
'requiredPermissions' => 'basis/vilesci:r',
|
||||
'children'=> array(
|
||||
'bpk' => array(
|
||||
'link' => site_url('person/BPKWartung'),
|
||||
@@ -82,6 +95,13 @@ $config['navigation_header'] = array(
|
||||
'expand' => true,
|
||||
'sort' => 10,
|
||||
'requiredPermissions' => 'admin:r'
|
||||
),
|
||||
'logsviewer' => array(
|
||||
'link' => site_url('system/LogsViewer'),
|
||||
'description' => 'Logs',
|
||||
'expand' => true,
|
||||
'sort' => 20,
|
||||
'requiredPermissions' => 'system/developer:r'
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -118,3 +138,62 @@ $config['navigation_menu']['organisation/Reihungstest/index'] = array(
|
||||
'target' => '_blank'
|
||||
)
|
||||
);
|
||||
|
||||
$config['navigation_menu']['lehre/lehrauftrag/Lehrauftrag/*'] = array(
|
||||
'lehrauftragDashboard' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
|
||||
'description' => 'Dashboard',
|
||||
'icon' => 'dashboard',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r')
|
||||
),'lehrauftragBestellen' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag'),
|
||||
'description' => 'Lehrauftrag bestellen',
|
||||
'icon' => '',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_bestellen:r'
|
||||
),
|
||||
'lehrauftragErteilen' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/LehrauftragErteilen'),
|
||||
'description' => 'Lehrauftrag erteilen',
|
||||
'icon' => '',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_erteilen:r'
|
||||
),
|
||||
'lehrauftragLehrendeÜbersicht' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/LehrendeUebersicht'),
|
||||
'description' => 'Lehrendenübersicht',
|
||||
'icon' => '',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r')
|
||||
)
|
||||
);
|
||||
$config['navigation_menu']['lehre/lehrauftrag/LehrauftragErteilen/*'] = array(
|
||||
'lehrauftragDashboard' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/Dashboard'),
|
||||
'description' => 'Dashboard',
|
||||
'icon' => 'dashboard',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => array('lehre/lehrauftrag_bestellen:r','lehre/lehrauftrag_erteilen:r')
|
||||
),'lehrauftragBestellen' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag'),
|
||||
'description' => 'Lehrauftrag bestellen',
|
||||
'icon' => '',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_bestellen:r'
|
||||
),
|
||||
'lehrauftragErteilen' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/LehrauftragErteilen'),
|
||||
'description' => 'Lehrauftrag erteilen',
|
||||
'icon' => '',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_erteilen:r'
|
||||
),
|
||||
'lehrauftragLehrendeÜbersicht' => array(
|
||||
'link' => site_url('lehre/lehrauftrag/Lehrauftrag/LehrendeUebersicht'),
|
||||
'description' => 'Lehrendenübersicht',
|
||||
'icon' => '',
|
||||
'sort' => 1,
|
||||
'requiredPermissions' => array('lehre/lehrauftrag_erteilen:r')
|
||||
)
|
||||
);
|
||||
|
||||
+19
-372
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -10,79 +10,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
| Set to force the use of HTTPS for REST API calls
|
||||
|
|
||||
*/
|
||||
$config['force_https'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Output Format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default format of the response
|
||||
|
|
||||
| 'array': Array data structure
|
||||
| 'csv': Comma separated file
|
||||
| 'json': Uses json_encode(). Note: If a GET query string
|
||||
| called 'callback' is passed, then jsonp will be returned
|
||||
| 'html' HTML using the table library in CodeIgniter
|
||||
| 'php': Uses var_export()
|
||||
| 'serialized': Uses serialize()
|
||||
| 'xml': Uses simplexml_load_string()
|
||||
|
|
||||
*/
|
||||
$config['rest_default_format'] = 'json';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Supported Output Formats
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following setting contains a list of the supported/allowed formats.
|
||||
| You may remove those formats that you don't want to use.
|
||||
| If the default format $config['rest_default_format'] is missing within
|
||||
| $config['rest_supported_formats'], it will be added silently during
|
||||
| REST_Controller initialization.
|
||||
|
|
||||
*/
|
||||
$config['rest_supported_formats'] = [
|
||||
'json',
|
||||
'array',
|
||||
'csv',
|
||||
'html',
|
||||
'jsonp',
|
||||
'php',
|
||||
'serialized',
|
||||
'xml',
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Status Field Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The field name for the status inside the response
|
||||
|
|
||||
*/
|
||||
$config['rest_status_field_name'] = 'status';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Message Field Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The field name for the message inside the response
|
||||
|
|
||||
*/
|
||||
$config['rest_message_field_name'] = 'error';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable Emulate Request
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Should we enable emulation of the request (e.g. used in Mootools request)
|
||||
|
|
||||
*/
|
||||
$config['enable_emulate_request'] = TRUE;
|
||||
$config['force_https'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -104,8 +32,8 @@ $config['rest_realm'] = 'FHC REST API';
|
||||
| Set to specify the REST API requires to be logged in
|
||||
|
|
||||
| FALSE No login required
|
||||
| 'basic' Unsecure login
|
||||
| 'digest' More secure login
|
||||
| 'basic' Unsecured login
|
||||
| 'digest' More secured login
|
||||
| 'session' Check for a PHP session variable. See 'auth_source' to set the
|
||||
| authorization key
|
||||
|
|
||||
@@ -119,8 +47,7 @@ $config['rest_auth'] = 'basic';
|
||||
|
|
||||
| Is login required and if so, the user store to use
|
||||
|
|
||||
| '' Use config based users or wildcard testing, only for testing purpose
|
||||
| it would be very unsecure to let unset in a production environment
|
||||
| '' Use config based users or wildcard testing
|
||||
| 'ldap' Use LDAP authentication
|
||||
| 'library' Use a authentication library
|
||||
|
|
||||
@@ -140,94 +67,34 @@ $config['auth_source'] = 'library';
|
||||
| In other cases override the function _perform_library_auth in your controller
|
||||
|
|
||||
| For digest authentication the library function should return already a stored
|
||||
| password for that username, even if it is hashed
|
||||
| md5(username:restrealm:password) for that username
|
||||
|
|
||||
| e.g: md5('admin:REST API:1234') = '1e957ebc35631ab22d5bd6526bd14ea2'
|
||||
|
|
||||
*/
|
||||
$config['auth_library_class'] = 'AuthLib';
|
||||
|
||||
// rest_auth is basic
|
||||
$config['auth_library_function'] = 'basicAuthentication';
|
||||
|
||||
// rest_auth is digest
|
||||
//$config['auth_library_function'] = 'digestAuthentication';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Override auth types for specific class/method
|
||||
| Global IP White-listing
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set specific authentication types for methods within a class (controller)
|
||||
|
|
||||
| Set as many config entries as needed. Any methods not set will use the default 'rest_auth' config value.
|
||||
|
|
||||
| e.g:
|
||||
|
|
||||
| $config['auth_override_class_method']['deals']['view'] = 'none';
|
||||
| $config['auth_override_class_method']['deals']['insert'] = 'digest';
|
||||
| $config['auth_override_class_method']['accounts']['user'] = 'basic';
|
||||
| $config['auth_override_class_method']['dashboard']['*'] = 'none|digest|basic';
|
||||
|
|
||||
| Here 'deals', 'accounts' and 'dashboard' are controller names, 'view', 'insert' and 'user' are methods within.
|
||||
* An asterisk may also be used to specify an authentication method for an entire classes methods.
|
||||
* Ex: $config['auth_override_class_method']['dashboard']['*'] = 'basic'; (NOTE: leave off the '_get' or '_post' from the end
|
||||
* of the method name)
|
||||
| Acceptable values are; 'none', 'digest' and 'basic'.
|
||||
|
|
||||
*/
|
||||
// $config['auth_override_class_method']['deals']['view'] = 'none';
|
||||
// $config['auth_override_class_method']['deals']['insert'] = 'digest';
|
||||
// $config['auth_override_class_method']['accounts']['user'] = 'basic';
|
||||
// $config['auth_override_class_method']['dashboard']['*'] = 'basic';
|
||||
|
||||
|
||||
// ---Uncomment list line for the wildard unit test
|
||||
// $config['auth_override_class_method']['wildcard_test_cases']['*'] = 'basic';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Override auth types for specfic 'class/method/HTTP method'
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| example:
|
||||
|
|
||||
| $config['auth_override_class_method_http']['deals']['view']['get'] = 'none';
|
||||
| $config['auth_override_class_method_http']['deals']['insert']['post'] = 'none';
|
||||
| $config['auth_override_class_method_http']['deals']['*']['options'] = 'none';
|
||||
*/
|
||||
|
||||
// ---Uncomment list line for the wildard unit test
|
||||
// $config['auth_override_class_method_http']['wildcard_test_cases']['*']['options'] = 'basic';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Login Usernames
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Array of usernames and passwords for login, if ldap (even library) is configured this is ignored
|
||||
|
|
||||
*/
|
||||
//$config['rest_valid_logins'] = ['admin' => '1234', 'test' => 'test'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global IP Whitelisting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Limit connections to your REST server to whitelisted IP addresses
|
||||
| Limit connections to your REST server to White-listed IP addresses
|
||||
|
|
||||
| Usage:
|
||||
| 1. Set to TRUE and select an auth option for extreme security (client's IP
|
||||
| address must be in whitelist and they must also log in)
|
||||
| 2. Set to TRUE with auth set to FALSE to allow whitelisted IPs access with no login
|
||||
| 3. Set to FALSE but set 'auth_override_class_method' to 'whitelist' to
|
||||
| restrict certain methods to IPs in your whitelist
|
||||
| address must be in white-list and they must also log in)
|
||||
| 2. Set to TRUE with auth set to FALSE to allow White-listed IPs access with no login
|
||||
| 3. Set to FALSE but set 'auth_override_class_method' to 'white-list' to
|
||||
| restrict certain methods to IPs in your white-list
|
||||
|
|
||||
*/
|
||||
$config['rest_ip_whitelist_enabled'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST IP Whitelist
|
||||
| REST IP White-list
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Limit connections to your REST server with a comma separated
|
||||
@@ -240,42 +107,6 @@ $config['rest_ip_whitelist_enabled'] = TRUE;
|
||||
*/
|
||||
$config['rest_ip_whitelist'] = '127.0.0.1';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global IP Blacklisting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Prevent connections to the REST server from blacklisted IP addresses
|
||||
|
|
||||
| Usage:
|
||||
| 1. Set to TRUE and add any IP address to 'rest_ip_blacklist'
|
||||
|
|
||||
*/
|
||||
$config['rest_ip_blacklist_enabled'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST IP Blacklist
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Prevent connections from the following IP addresses
|
||||
|
|
||||
| e.g: '123.456.789.0, 987.654.32.1'
|
||||
|
|
||||
*/
|
||||
$config['rest_ip_blacklist'] = '';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Database Group
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Connect to a database group for keys, logging, etc. It will only connect
|
||||
| if you have any of these features enabled
|
||||
|
|
||||
*/
|
||||
$config['rest_database_group'] = 'default';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Keys Table Name
|
||||
@@ -298,6 +129,7 @@ $config['rest_keys_table'] = 'ci_apikey';
|
||||
| Default table schema:
|
||||
| CREATE TABLE `keys` (
|
||||
| `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
| `user_id` INT(11) NOT NULL,
|
||||
| `key` VARCHAR(40) NOT NULL,
|
||||
| `level` INT(2) NOT NULL,
|
||||
| `ignore_limits` TINYINT(1) NOT NULL DEFAULT '0',
|
||||
@@ -310,45 +142,6 @@ $config['rest_keys_table'] = 'ci_apikey';
|
||||
*/
|
||||
$config['rest_enable_keys'] = TRUE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Table Key Column Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_keys', specify the
|
||||
| column name to match e.g. my_key
|
||||
|
|
||||
*/
|
||||
$config['rest_key_column'] = 'key';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Limits method
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the method used to limit the API calls
|
||||
|
|
||||
| Available methods are :
|
||||
| $config['rest_limits_method'] = 'API_KEY'; // Put a limit per api key
|
||||
| $config['rest_limits_method'] = 'METHOD_NAME'; // Put a limit on method calls
|
||||
| $config['rest_limits_method'] = 'ROUTED_URL'; // Put a limit on the routed URL
|
||||
|
|
||||
*/
|
||||
$config['rest_limits_method'] = 'ROUTED_URL';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Key Length
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Length of the created keys. Check your default database schema on the
|
||||
| maximum length allowed
|
||||
|
|
||||
| Note: The maximum length is 40
|
||||
|
|
||||
*/
|
||||
$config['rest_key_length'] = 40;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Key Variable
|
||||
@@ -364,156 +157,10 @@ $config['rest_key_name'] = 'FHC-API-KEY';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Logging
|
||||
| REST Methods name format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to TRUE, the REST API will log actions based on the column names 'key', 'date',
|
||||
| 'time' and 'ip_address'. This is a general rule that can be overridden in the
|
||||
| $this->method array for each controller
|
||||
|
|
||||
| Default table schema:
|
||||
| CREATE TABLE `logs` (
|
||||
| `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
| `uri` VARCHAR(255) NOT NULL,
|
||||
| `method` VARCHAR(6) NOT NULL,
|
||||
| `params` TEXT DEFAULT NULL,
|
||||
| `api_key` VARCHAR(40) NOT NULL,
|
||||
| `ip_address` VARCHAR(45) NOT NULL,
|
||||
| `time` INT(11) NOT NULL,
|
||||
| `rtime` FLOAT DEFAULT NULL,
|
||||
| `authorized` VARCHAR(1) NOT NULL,
|
||||
| `response_code` smallint(3) DEFAULT '0',
|
||||
| PRIMARY KEY (`id`)
|
||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
| REST Controllers methods name format
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_logging'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Logs Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_logging', specify the
|
||||
| table name to match e.g. my_logs
|
||||
|
|
||||
*/
|
||||
$config['rest_logs_table'] = 'logs';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Method Access Control
|
||||
|--------------------------------------------------------------------------
|
||||
| When set to TRUE, the REST API will check the access table to see if
|
||||
| the API key can access that controller. 'rest_enable_keys' must be enabled
|
||||
| to use this
|
||||
|
|
||||
| Default table schema:
|
||||
| CREATE TABLE `access` (
|
||||
| `id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
| `key` VARCHAR(40) NOT NULL DEFAULT '',
|
||||
| `controller` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
| `date_created` DATETIME DEFAULT NULL,
|
||||
| `date_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
| PRIMARY KEY (`id`)
|
||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
||||
*/
|
||||
$config['rest_enable_access'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Access Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_access', specify the
|
||||
| table name to match e.g. my_access
|
||||
|
|
||||
*/
|
||||
$config['rest_access_table'] = 'access';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Param Log Format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to TRUE, the REST API log parameters will be stored in the database as JSON
|
||||
| Set to FALSE to log as serialized PHP
|
||||
|
|
||||
*/
|
||||
$config['rest_logs_json_params'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Enable Limits
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to TRUE, the REST API will count the number of uses of each method
|
||||
| by an API key each hour. This is a general rule that can be overridden in the
|
||||
| $this->method array in each controller
|
||||
|
|
||||
| Default table schema:
|
||||
| CREATE TABLE `limits` (
|
||||
| `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
| `uri` VARCHAR(255) NOT NULL,
|
||||
| `count` INT(10) NOT NULL,
|
||||
| `hour_started` INT(11) NOT NULL,
|
||||
| `api_key` VARCHAR(40) NOT NULL,
|
||||
| PRIMARY KEY (`id`)
|
||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
||||
| To specify the limits within the controller's __construct() method, add per-method
|
||||
| limits with:
|
||||
|
|
||||
| $this->method['METHOD_NAME']['limit'] = [NUM_REQUESTS_PER_HOUR];
|
||||
|
|
||||
| See application/controllers/api/example.php for examples
|
||||
*/
|
||||
$config['rest_enable_limits'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST API Limits Table Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If not using the default table schema in 'rest_enable_limits', specify the
|
||||
| table name to match e.g. my_limits
|
||||
|
|
||||
*/
|
||||
$config['rest_limits_table'] = 'limits';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Ignore HTTP Accept
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to TRUE to ignore the HTTP Accept and speed up each request a little.
|
||||
| Only do this if you are using the $this->rest_format or /format/xml in URLs
|
||||
|
|
||||
*/
|
||||
$config['rest_ignore_http_accept'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST AJAX Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Set to TRUE to allow AJAX requests only. Set to FALSE to accept HTTP requests
|
||||
|
|
||||
| Note: If set to TRUE and the request is not AJAX, a 505 response with the
|
||||
| error message 'Only AJAX requests are accepted.' will be returned.
|
||||
|
|
||||
| Hint: This is good for production environments
|
||||
|
|
||||
*/
|
||||
$config['rest_ajax_only'] = FALSE;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REST Language File
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Language file to load from the language directory
|
||||
|
|
||||
*/
|
||||
$config['rest_language'] = 'english';
|
||||
$config['rest_methods_name_format'] = '%2$s%1$s';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
@@ -11,7 +12,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
| and its corresponding controller class/method. The segments in a
|
||||
| URL normally follow this pattern:
|
||||
|
|
||||
| example.com/class/method/id/
|
||||
| example.com/class/method/id/
|
||||
|
|
||||
| In some instances, however, you may want to remap this relationship
|
||||
| so that a different class/function is called than the one
|
||||
@@ -19,7 +20,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
|
||||
| Please see the user guide for complete details:
|
||||
|
|
||||
| http://codeigniter.com/user_guide/general/routing.html
|
||||
| https://codeigniter.com/user_guide/general/routing.html
|
||||
|
|
||||
| -------------------------------------------------------------------------
|
||||
| RESERVED ROUTES
|
||||
@@ -27,18 +28,18 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
|
||||
| There are three reserved routes:
|
||||
|
|
||||
| $route['default_controller'] = 'welcome';
|
||||
| $route['default_controller'] = 'welcome';
|
||||
|
|
||||
| This route indicates which controller class should be loaded if the
|
||||
| URI contains no data. In the above example, the "welcome" class
|
||||
| would be loaded.
|
||||
|
|
||||
| $route['404_override'] = 'errors/page_missing';
|
||||
| $route['404_override'] = 'errors/page_missing';
|
||||
|
|
||||
| This route will tell the Router which controller/method to use if those
|
||||
| provided in the URL cannot be matched to a valid route.
|
||||
|
|
||||
| $route['translate_uri_dashes'] = FALSE;
|
||||
| $route['translate_uri_dashes'] = FALSE;
|
||||
|
|
||||
| This is not exactly a route, but allows you to automatically route
|
||||
| controller and method names that contain dashes. '-' isn't a valid
|
||||
@@ -46,11 +47,10 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
| When you set this option to TRUE, it will replace ALL dashes in the
|
||||
| controller and method URI segments.
|
||||
|
|
||||
| Examples: my-controller/index -> my_controller/index
|
||||
| my-controller/my-method -> my_controller/my_method
|
||||
| Examples: my-controller/index -> my_controller/index
|
||||
| my-controller/my-method -> my_controller/my_method
|
||||
*/
|
||||
$route['default_controller'] = 'Vilesci';
|
||||
$route['404_override'] = '';
|
||||
$route['translate_uri_dashes'] = FALSE;
|
||||
|
||||
// Class name conflicts
|
||||
@@ -59,4 +59,4 @@ $route['api/v1/organisation/[F|f]achbereich/(:any)'] = 'api/v1/organisation/fach
|
||||
$route['api/v1/organisation/[G|g]eschaeftsjahr/(:any)'] = 'api/v1/organisation/geschaeftsjahr2/$1';
|
||||
$route['api/v1/organisation/[O|o]rganisationseinheit/(:any)'] = 'api/v1/organisation/organisationseinheit2/$1';
|
||||
$route['api/v1/ressource/[B|b]etriebsmittelperson/(:any)'] = 'api/v1/ressource/betriebsmittelperson2/$1';
|
||||
$route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1';
|
||||
$route['api/v1/system/[S|s]prache/(:any)'] = 'api/v1/system/sprache2/$1';
|
||||
|
||||
@@ -37,12 +37,13 @@ class Redirect extends FHC_Controller
|
||||
public function redirectByToken($token)
|
||||
{
|
||||
$msg = $this->MessageTokenModel->getMessageByToken($token);
|
||||
if ($msg->error)
|
||||
if (isError($msg))
|
||||
{
|
||||
show_error($msg->retval);
|
||||
show_error(getError($msg));
|
||||
}
|
||||
|
||||
$oe_kurzbz = $msg->retval[0]->oe_kurzbz;
|
||||
$oe_kurzbz = null;
|
||||
if (hasData($msg)) $oe_kurzbz = getData($msg)[0]->oe_kurzbz;
|
||||
|
||||
if ($oe_kurzbz != null && $oe_kurzbz != '')
|
||||
{
|
||||
@@ -51,7 +52,7 @@ class Redirect extends FHC_Controller
|
||||
$getOERoot = $this->MessageTokenModel->getOERoot($oe_kurzbz);
|
||||
if (isSuccess($getOERoot)) // If no errors occurred
|
||||
{
|
||||
$organisationRoot = $getOERoot->retval;
|
||||
$organisationRoot = getData($getOERoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CheckUserAuth extends REST_Controller
|
||||
class CheckUserAuth extends RESTFul_Controller
|
||||
{
|
||||
/**
|
||||
* Course API constructor.
|
||||
|
||||
@@ -5,7 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* Testing class for REST calls and authentication
|
||||
*/
|
||||
class Test extends REST_Controller
|
||||
class Test extends RESTFul_Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ class Benutzer extends APIv1_Controller
|
||||
|
||||
if (isset($uid))
|
||||
{
|
||||
$result = $this->BenutzerModel->load($uid);
|
||||
$result = $this->BenutzerModel->load(array('uid' => $uid));
|
||||
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-API
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016, fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @link http://fhcomplete.org
|
||||
* @since Version 1.0
|
||||
* @filesource
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CallerLibrary extends APIv1_Controller
|
||||
{
|
||||
/**
|
||||
* API constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array('Call' => 'admin:rw'));
|
||||
|
||||
// Loads the CallerLib
|
||||
$this->load->library('CallerLib');
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages a HTTP get call
|
||||
*/
|
||||
public function getCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callLibrary($this->get());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function postCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callLibrary($this->post());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function putCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callLibrary($this->put());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function deleteCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callLibrary($this->delete());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-API
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016, fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @link http://fhcomplete.org
|
||||
* @since Version 1.0
|
||||
* @filesource
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CallerModel extends APIv1_Controller
|
||||
{
|
||||
/**
|
||||
* API constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array('Call' => 'admin:rw'));
|
||||
|
||||
// Loads the CallerLib
|
||||
$this->load->library('CallerLib');
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages a HTTP get call
|
||||
*/
|
||||
public function getCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callModel($this->get());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function postCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callModel($this->post());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function putCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callModel($this->put());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function deleteCall()
|
||||
{
|
||||
// Start me up!
|
||||
$result = $this->callerlib->callModel($this->delete());
|
||||
|
||||
// Print the result
|
||||
$this->response($result, REST_Controller::HTTP_OK);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class Statusgrund extends Auth_Controller
|
||||
$status = $this->StatusModel->load();
|
||||
if ($status->error)
|
||||
{
|
||||
show_error($status->retval);
|
||||
show_error(getError($status));
|
||||
}
|
||||
|
||||
$data = array (
|
||||
@@ -50,7 +50,7 @@ class Statusgrund extends Auth_Controller
|
||||
$statusGrund = $this->StatusgrundModel->loadWhere(array("status_kurzbz" => $status_kurzbz));
|
||||
if ($statusGrund->error)
|
||||
{
|
||||
show_error($statusGrund->retval);
|
||||
show_error(getError($statusGrund));
|
||||
}
|
||||
|
||||
$data = array (
|
||||
@@ -66,13 +66,13 @@ class Statusgrund extends Auth_Controller
|
||||
$statusGrund = $this->StatusgrundModel->load($statusgrund_id);
|
||||
if ($statusGrund->error)
|
||||
{
|
||||
show_error($statusGrund->retval);
|
||||
show_error(getError($statusGrund));
|
||||
}
|
||||
|
||||
$sprache = $this->SpracheModel->loadWhere(array('content' => true));
|
||||
if ($sprache->error)
|
||||
{
|
||||
show_error($sprache->retval);
|
||||
show_error(getError($sprache));
|
||||
}
|
||||
|
||||
$data = array (
|
||||
@@ -89,13 +89,13 @@ class Statusgrund extends Auth_Controller
|
||||
$status = $this->StatusModel->load($status_id);
|
||||
if ($status->error)
|
||||
{
|
||||
show_error($status->retval);
|
||||
show_error(getError($status));
|
||||
}
|
||||
|
||||
$sprache = $this->SpracheModel->loadWhere(array('content' => true));
|
||||
if ($sprache->error)
|
||||
{
|
||||
show_error($sprache->retval);
|
||||
show_error(getError($sprache));
|
||||
}
|
||||
|
||||
$data = array (
|
||||
@@ -112,7 +112,7 @@ class Statusgrund extends Auth_Controller
|
||||
$sprache = $this->SpracheModel->loadWhere(array('content' => true));
|
||||
if ($sprache->error)
|
||||
{
|
||||
show_error($sprache->retval);
|
||||
show_error(getError($sprache));
|
||||
}
|
||||
|
||||
$data = array (
|
||||
@@ -184,7 +184,7 @@ class Statusgrund extends Auth_Controller
|
||||
|
||||
if ($statusgrund->error)
|
||||
{
|
||||
show_error($statusgrund->retval);
|
||||
show_error(getError($statusgrund));
|
||||
}
|
||||
|
||||
redirect("/crm/Statusgrund/editGrund/" . $statusgrund_id . "/" . true);
|
||||
@@ -252,7 +252,7 @@ class Statusgrund extends Auth_Controller
|
||||
|
||||
if ($statusgrund->error)
|
||||
{
|
||||
show_error($statusgrund->retval);
|
||||
show_error(getError($statusgrund));
|
||||
}
|
||||
|
||||
redirect("/crm/Statusgrund/editGrund/" . $statusgrund->retval . "/" . true);
|
||||
@@ -297,7 +297,7 @@ class Statusgrund extends Auth_Controller
|
||||
|
||||
if ($status->error)
|
||||
{
|
||||
show_error($status->retval);
|
||||
show_error(getError($status));
|
||||
}
|
||||
|
||||
redirect("/crm/Statusgrund/editStatus/" . $status_kurzbz . "/" . true);
|
||||
|
||||
@@ -121,13 +121,13 @@ class AmpelMail extends CLI_Controller
|
||||
}
|
||||
elseif (isError($result_ampel_user))
|
||||
{
|
||||
show_error($result_ampel_user->error);
|
||||
show_error(getError($result_ampel_user));
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isError($result_active_ampeln))
|
||||
{
|
||||
show_error($result_active_ampeln->error);
|
||||
show_error(getError($result_active_ampeln));
|
||||
}
|
||||
|
||||
// Send mails for new ampeln merged by user
|
||||
|
||||
@@ -0,0 +1,536 @@
|
||||
<?php
|
||||
/**
|
||||
* FH-Complete
|
||||
*
|
||||
* @package FHC-API
|
||||
* @author FHC-Team
|
||||
* @copyright Copyright (c) 2016, fhcomplete.org
|
||||
* @license GPLv3
|
||||
* @link http://fhcomplete.org
|
||||
* @since Version 1.0
|
||||
* @filesource
|
||||
*
|
||||
* Cronjobs to be run for sending emails informing about status of Lehrauftraege.
|
||||
*/
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class LehrauftragJob extends JOB_Controller
|
||||
{
|
||||
const BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN = 'lehre/lehrauftrag_erteilen';
|
||||
const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
|
||||
|
||||
const LEHRAUFTRAG_ERTEILEN_URI = 'lehre/lehrauftrag/LehrauftragErteilen';
|
||||
const LEHRAUFTRAG_AKZEPTIEREN_URI = '/lehre/lehrauftrag/LehrauftragAkzeptieren';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Load models
|
||||
$this->load->model('accounting/Vertrag_model', 'VertragModel');
|
||||
$this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
|
||||
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||
$this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel');
|
||||
$this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel');
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('PermissionLib');
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('hlp_sancho_helper');
|
||||
}
|
||||
|
||||
/**
|
||||
* This daily job sends information about all lehr-/projektauftraege ordered (and not approved) the day bofore.
|
||||
* Receivers: Department-/Kompetenzfeldleiter
|
||||
**/
|
||||
public function mailLehrauftraegeToApprove()
|
||||
{
|
||||
// Get vertrag_ids of lehrauftraege that had been ordered and had NOT been approved or cancelled YESTERDAY
|
||||
$this->VertragvertragsstatusModel->addSelect('vertrag_id');
|
||||
$result = $this->VertragvertragsstatusModel->getOrdered_fromDate('YESTERDAY');
|
||||
|
||||
// Get lehrveranstaltung_ids and studiensemester of the lehr-/or projektauftrag contracts
|
||||
$lehreinheit_data_arr = array();
|
||||
if ($vertrag_arr = getData($result))
|
||||
{
|
||||
foreach ($vertrag_arr as $vertrag)
|
||||
{
|
||||
$result = $this->VertragModel->getLehreinheitData($vertrag->vertrag_id, 'lehrveranstaltung_id, studiensemester_kurzbz');
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$obj = new StdClass();
|
||||
$obj->lehrveranstaltung_id = $result->retval[0]->lehrveranstaltung_id;
|
||||
$obj->studiensemester_kurzbz = $result->retval[0]->studiensemester_kurzbz;
|
||||
$lehreinheit_data_arr []= $obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the data array to be used in the email. Data array is clustered as follows:
|
||||
* Array
|
||||
* [studiensemester_kurzbz] // studiensemester of lehreinheit
|
||||
* Array
|
||||
* [oe_kurzbz] // oe of lehreinheits lehrveranstaltung
|
||||
* [oe_bezeichnung]
|
||||
* Array
|
||||
* [stg_kz] // stg of lehreinheits lehrveranstaltung
|
||||
* [stg_kurzbz]
|
||||
* [stg_bezeichnung]
|
||||
* [amount] // amount of new ordered lehrauftraege of that stg
|
||||
*/
|
||||
$data_arr = array();
|
||||
foreach ($lehreinheit_data_arr as $lehreinheit_data)
|
||||
{
|
||||
$result = $this->_getLVData($lehreinheit_data->lehrveranstaltung_id);
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
// Search if studiensemester exists in data_arr
|
||||
$ss_index = array_search($lehreinheit_data->studiensemester_kurzbz, array_column($data_arr, 'studiensemester_kurzbz'));
|
||||
|
||||
// If studiensemester is new, add studienesemester, oe and stg
|
||||
if ($ss_index === false)
|
||||
{
|
||||
$data = array(
|
||||
'studiensemester_kurzbz' => $lehreinheit_data->studiensemester_kurzbz
|
||||
);
|
||||
|
||||
$data []= array(
|
||||
'oe_kurzbz' => $result->retval[0]->oe_kurzbz,
|
||||
'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung
|
||||
);
|
||||
|
||||
// Add stg data to oe, start amount with 1
|
||||
$data[0][] = array(
|
||||
'stg_kz' => $result->retval[0]->studiengang_kz,
|
||||
'stg_kurzbz' => strtoupper($result->retval[0]->stg_typ. $result->retval[0]->stg_kurzbz),
|
||||
'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung,
|
||||
'amount' => 1
|
||||
);
|
||||
|
||||
// Push to final data_arr
|
||||
$data_arr []= $data;
|
||||
}
|
||||
// Else if studiensemester exists
|
||||
else
|
||||
{
|
||||
// Search if oe exists inside existing studiensemester of data_arr
|
||||
$oe_index = array_search($result->retval[0]->oe_kurzbz, array_column($data_arr[$ss_index], 'oe_kurzbz'));
|
||||
|
||||
// If oe is new, add oe and stg to studiensemester
|
||||
if ($oe_index === false)
|
||||
{
|
||||
// Add oe data
|
||||
$data_arr[$ss_index][] = array(
|
||||
'oe_kurzbz' => $result->retval[0]->oe_kurzbz,
|
||||
'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung,
|
||||
|
||||
// Add stg data to oe, start amount with 1
|
||||
array(
|
||||
'stg_kz' => $result->retval[0]->studiengang_kz,
|
||||
'stg_kurzbz' => strtoupper($result->retval[0]->stg_typ. $result->retval[0]->stg_kurzbz),
|
||||
'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung,
|
||||
'amount' => 1
|
||||
)
|
||||
);
|
||||
}
|
||||
// Else if oe exists
|
||||
else
|
||||
{
|
||||
// Search if stg exists inside existing oe of data_arr
|
||||
$stg_index = array_search($result->retval[0]->studiengang_kz, array_column($data_arr[$ss_index][$oe_index], 'stg_kz'));
|
||||
|
||||
// If stg is new, add stg to oe, start amount with 1
|
||||
if ($stg_index === false)
|
||||
{
|
||||
$data_arr[$ss_index][$oe_index][] = array(
|
||||
'stg_kz' => $result->retval[0]->studiengang_kz,
|
||||
'stg_kurzbz' => strtoupper($result->retval[0]->stg_typ. $result->retval[0]->stg_kurzbz),
|
||||
'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung,
|
||||
'amount' => 1
|
||||
);
|
||||
}
|
||||
// Else if stg exists
|
||||
else
|
||||
{
|
||||
// Increase amount +1
|
||||
$data_arr[$ss_index][$oe_index][$stg_index]['amount']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cluster data by uid of entitled mail receivers.
|
||||
* Returning array is clustered as follows:
|
||||
* Array
|
||||
* [uid]
|
||||
* Array
|
||||
* [studiensemester_kurzbz] // studiensemester of lehreinheit
|
||||
* Array
|
||||
* [oe_kurzbz] // oe of lehreinheits lehrveranstaltung
|
||||
* [oe_bezeichnung]
|
||||
* Array
|
||||
* [stg_kz] // stg of lehreinheits lehrveranstaltung
|
||||
* [stg_kurzbz]
|
||||
* [stg_bezeichnung]
|
||||
* [amount] // amount of new ordered lehrauftraege of that stg
|
||||
*/
|
||||
$data_arr = $this->_clusterData_byReceiver($data_arr);
|
||||
|
||||
// Send email
|
||||
if(!$this->_sendMail_toApprove($data_arr))
|
||||
{
|
||||
$this->logInfo('SUCCEDED: Sending emails about yesterdays ordered lehrauftraege succeded.');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->logError('Error when sending emails in job MailLehrauftragToApprove');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This daily job sends information about all lehr-/projektauftraege approved the day bofore.
|
||||
* Receivers: lectors
|
||||
**/
|
||||
public function mailLehrauftraegeToAccept()
|
||||
{
|
||||
// Get vertrag_id and uid of lehrauftraege that had been approved and had NOT been accepted or cancelled YESTERDAY
|
||||
$this->VertragvertragsstatusModel->addSelect('vertrag_id, uid');
|
||||
$this->VertragvertragsstatusModel->addOrder('uid');
|
||||
$result = $this->VertragvertragsstatusModel->getApproved_fromDate('YESTERDAY');
|
||||
|
||||
/**
|
||||
* Build the data array to be used in the email. Data array is clustered as follows:
|
||||
* Array
|
||||
* [uid] // lectors uid (mail receiver)
|
||||
* [studiensemester] // studiensemester of the lehrauftraege (can be more, e.g. 'WS2019 and SS2020')
|
||||
* [amount] // amount of new approved lehrauftraege
|
||||
**/
|
||||
$data_arr = array();
|
||||
if ($vertrag_arr = getData($result))
|
||||
{
|
||||
foreach ($vertrag_arr as $vertrag)
|
||||
{
|
||||
// Get studiensemester of the lehrauftrag
|
||||
$this->VertragModel->addSelect('vertragsstunden_studiensemester_kurzbz');
|
||||
$result = $this->VertragModel->load($vertrag->vertrag_id);
|
||||
if ($studiensemester = getData($result))
|
||||
{
|
||||
$studiensemester = $studiensemester[0]->vertragsstunden_studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
// Search if uid exists in data_arr
|
||||
$uid_index = array_search($vertrag->uid, array_column($data_arr, 'uid'));
|
||||
|
||||
// If uid is new, add uid, studiensemester and start amount with 1
|
||||
if ($uid_index === false)
|
||||
{
|
||||
$data = array();
|
||||
$data['uid'] = $vertrag->uid;
|
||||
$data['studiensemester'] = $studiensemester;
|
||||
$data['amount']= 1;
|
||||
$data_arr []= $data;
|
||||
}
|
||||
// Else if uid exists
|
||||
else
|
||||
{
|
||||
// If studiensemester is new, add to studiensemester-string
|
||||
if (strpos($data_arr[$uid_index]['studiensemester'], $studiensemester) === false)
|
||||
{
|
||||
$data_arr[$uid_index]['studiensemester'] .= ' und '. $studiensemester;
|
||||
}
|
||||
|
||||
// Increase amount +1
|
||||
$data_arr[$uid_index]['amount']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send email
|
||||
if ($this->_sendMail_toAccept($data_arr))
|
||||
{
|
||||
$this->logInfo('SUCCEDED: Sending emails about yesterdays approved lehrauftraege succeded.');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->logError('Error when sending emails in job MailLehrauftragToAccept');
|
||||
}
|
||||
}
|
||||
|
||||
//******************************************************************************************************************
|
||||
// PRIVATE FUNCTIONS
|
||||
//******************************************************************************************************************
|
||||
|
||||
/**
|
||||
* Get data of given lehrveranstaltung.
|
||||
* @param $lehrveranstaltung_id
|
||||
* @return mixed
|
||||
*/
|
||||
private function _getLVData($lehrveranstaltung_id)
|
||||
{
|
||||
$this->LehrveranstaltungModel->addSelect('
|
||||
tbl_lehrveranstaltung.oe_kurzbz,
|
||||
oe.bezeichnung AS "lv_oe_bezeichnung",
|
||||
tbl_lehrveranstaltung.studiengang_kz,
|
||||
stg.bezeichnung AS "lv_stg_bezeichnung",
|
||||
stg.typ AS "stg_typ",
|
||||
stg.kurzbz AS "stg_kurzbz"
|
||||
');
|
||||
|
||||
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan_lehrveranstaltung stpllv', 'lehrveranstaltung_id');
|
||||
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan stpl', 'studienplan_id');
|
||||
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienordnung sto', 'studienordnung_id');
|
||||
$this->LehrveranstaltungModel->addJoin('public.tbl_studiengang stg', 'ON stg.studiengang_kz = tbl_lehrveranstaltung.studiengang_kz');
|
||||
$this->LehrveranstaltungModel->addJoin('public.tbl_organisationseinheit oe', 'ON oe.oe_kurzbz = tbl_lehrveranstaltung.oe_kurzbz');
|
||||
$this->LehrveranstaltungModel->addOrder('stpllv.insertamum', 'DESC');
|
||||
$this->LehrveranstaltungModel->addLimit(1);
|
||||
|
||||
return $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Sancho eMail about ordered Lehrauftraege.
|
||||
* @param $data_arr
|
||||
*/
|
||||
private function _sendMail_toApprove($data_arr)
|
||||
{
|
||||
// Loop through 'container' of mail recipients
|
||||
foreach($data_arr as $data)
|
||||
{
|
||||
// Set mail recipients (department assistance/leader)
|
||||
$to = $data['uid']. '@'. DOMAIN;
|
||||
$html_table = $this->_renderData_LehrauftraegeToApprove($data);
|
||||
|
||||
// Prepare mail content
|
||||
$content_data_arr = array(
|
||||
'table' => $html_table
|
||||
);
|
||||
|
||||
sendSanchoMail(
|
||||
'LehrauftragNeueBestellungen',
|
||||
$content_data_arr,
|
||||
$to,
|
||||
'Bestellung neuer Lehraufträge',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cluster the data array by entitled mail receiver.
|
||||
* Returning array is clustered as follows:
|
||||
* Array
|
||||
* [uid]
|
||||
* Array
|
||||
* [studiensemester_kurzbz] // studiensemester of lehreinheit
|
||||
* Array
|
||||
* [oe_kurzbz] // oe of lehreinheits lehrveranstaltung
|
||||
* [oe_bezeichnung]
|
||||
* Array
|
||||
* [stg_kz] // stg of lehreinheits lehrveranstaltung
|
||||
* [stg_kurzbz]
|
||||
* [stg_bezeichnung]
|
||||
* [amount] // amount of new ordered lehrauftraege of that stg
|
||||
* @param $data_arr
|
||||
* @return array
|
||||
*
|
||||
*/
|
||||
private function _clusterData_byReceiver($data_arr)
|
||||
{
|
||||
$mail_data_arr = array(); // final array with all data clustered by mail receiver
|
||||
|
||||
// Loop through 'container' of studiensemester
|
||||
foreach ($data_arr as $data)
|
||||
{
|
||||
$data_len = count($data) - 1;
|
||||
|
||||
// Loop through 'container' of organisational units
|
||||
for ($i = 0; $i < $data_len; $i++)
|
||||
{
|
||||
// Get all users entitled by organisational unit
|
||||
$result = $this->BenutzerrolleModel->getBenutzerByBerechtigung(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, $data[$i]['oe_kurzbz']);
|
||||
|
||||
if ($berechtigung_arr = getData($result))
|
||||
{
|
||||
// Loop through entitled users
|
||||
foreach ($berechtigung_arr as $berechtigung)
|
||||
{
|
||||
// Search if UID exists inside mail_data_arr
|
||||
$uid_index = array_search($berechtigung->uid, array_column($mail_data_arr, 'uid'));
|
||||
|
||||
// If UID is new, add UID to final array
|
||||
if ($uid_index === false)
|
||||
{
|
||||
// add UID with corresponding data
|
||||
$mail_data_arr [] = array(
|
||||
'uid' => $berechtigung->uid,
|
||||
array(
|
||||
'studiensemester_kurzbz' => $data['studiensemester_kurzbz'],
|
||||
$data[$i]
|
||||
)
|
||||
);
|
||||
} // Else if UID exists
|
||||
else
|
||||
{
|
||||
// Search if studiensemester exists
|
||||
$ss_index = array_search($data['studiensemester_kurzbz'], array_column($mail_data_arr, 'studiensemester_kurzbz'));
|
||||
|
||||
// If studiensemester is new, add studiensemester to existing UID
|
||||
if ($ss_index === false)
|
||||
{
|
||||
$mail_data_arr[$uid_index] []= array(
|
||||
'studiensemester_kurzbz' => $data['studiensemester_kurzbz'],
|
||||
$data[$i]
|
||||
);
|
||||
}
|
||||
// Else if studiensemester exists
|
||||
else
|
||||
{
|
||||
// Add corresponding data to existing studiensemester of UID
|
||||
$mail_data_arr[$uid_index]['studiensemester_kurbz'][] = $data[$i];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mail_data_arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the data array for the mail template returing a HTML table.
|
||||
* @param $data_arr Data to be used in HTML table
|
||||
* @return string HTML table to be embedded in eMail
|
||||
*/
|
||||
private function _renderData_LehrauftraegeToApprove($data_arr)
|
||||
{
|
||||
$html = '';
|
||||
foreach ($data_arr as $studiensemester_container)
|
||||
{
|
||||
if (is_array($studiensemester_container)) // is_array 'trims' the outer associative key [uid]
|
||||
{
|
||||
if (isset($studiensemester_container['studiensemester_kurzbz']))
|
||||
{
|
||||
$studiensemester = $studiensemester_container['studiensemester_kurzbz'];
|
||||
|
||||
// Link to LehrauftragErteilen
|
||||
$url = site_url(self::LEHRAUFTRAG_ERTEILEN_URI).'?studiensemester='. $studiensemester;
|
||||
}
|
||||
|
||||
// HTML table header
|
||||
$html .= '
|
||||
<br>
|
||||
<span style="font-size: small;"><b>Studiensemester: '. $studiensemester. '</b></span>
|
||||
<br><br>
|
||||
<table style="width: 100%; border-collapse: collapse;" border="1" cellpadding="5">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 30%; font-size: 12px;"><span>LV-Organisationseinheit</span></th>
|
||||
<th style="width: 40%; font-size: 12px;"><span>Studiengang</span></th>
|
||||
<th style="width: 15%; font-size: 12px;"><span>STG-Kurzbezeichnung</span></th>
|
||||
<th style="width: 15%; font-size: 12px;"><span><strong>Anzahl neu bestellter Lehraufträge</strong></span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>'
|
||||
;
|
||||
|
||||
// HTML table body
|
||||
foreach ($studiensemester_container as $oe_container)
|
||||
{
|
||||
if (is_array($oe_container)) // is_array 'trims' the outer associative key [studiensemester_kurzbz]
|
||||
{
|
||||
if (isset($oe_container['oe_bezeichnung']))
|
||||
{
|
||||
$oe_bezeichnung = $oe_container['oe_bezeichnung'];
|
||||
}
|
||||
|
||||
foreach ($oe_container as $stg_data)
|
||||
{
|
||||
if (is_array($stg_data)) // is_array 'trims' the outer associative keys [oe_kurzbz] and [oe_bezeichnung]
|
||||
{
|
||||
$html .= '
|
||||
<tr>
|
||||
<td><span style="font-size: small;">'. $oe_bezeichnung. '</span></td>
|
||||
<td><span style="font-size: small;">'. $stg_data['stg_bezeichnung']. '</span></td>
|
||||
<td align="center"><span style="font-size: small;">'. $stg_data['stg_kurzbz']. '</span></td>
|
||||
<td align="center"><span style="font-size: small;"><strong>'. $stg_data['amount']. '</strong></span></td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HTML table body end and link
|
||||
$html .= '
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<span style="font-size: small;">'. anchor($url, 'Lehraufträge Übersicht '. $studiensemester). '</span>
|
||||
<br><br>
|
||||
';
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Sancho eMail about ordered Lehrauftraege.
|
||||
* @param $data_arr
|
||||
*/
|
||||
private function _sendMail_toAccept($data_arr)
|
||||
{
|
||||
// Loop through 'container' of mail recipients
|
||||
foreach($data_arr as $data)
|
||||
{
|
||||
// Set mail recipient (lector)
|
||||
$to = $data['uid']. '@'. DOMAIN;
|
||||
|
||||
// Link to LehrauftragAkzeptieren
|
||||
$url = CIS_ROOT. 'cis/index.php?menu='.
|
||||
CIS_ROOT. 'cis/menu.php?content_id=&content='.
|
||||
CIS_ROOT. index_page(). self::LEHRAUFTRAG_AKZEPTIEREN_URI;
|
||||
|
||||
// Get first name
|
||||
$first_name = '';
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
$this->BenutzerModel->addSelect('vorname');
|
||||
$this->BenutzerModel->addJoin('public.tbl_person', 'person_id');
|
||||
$result = $this->BenutzerModel->loadWhere(array('uid' => $data['uid']));
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$first_name = $result->retval[0]->vorname;
|
||||
}
|
||||
|
||||
// Prepare mail content
|
||||
$content_data_arr = array(
|
||||
'vorname' => $first_name,
|
||||
'studiensemester' => $data['studiensemester'],
|
||||
'anzahl' => $data['amount'],
|
||||
'link' => anchor($url, 'Lehraufträge Übersicht')
|
||||
);
|
||||
|
||||
sendSanchoMail(
|
||||
'LehrauftragNeueErteilte',
|
||||
$content_data_arr,
|
||||
$to,
|
||||
'Neu erteilte Lehraufträge zum Annehmen bereit'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,8 @@ class Prestudentstatus extends CLI_Controller
|
||||
tbl_prestudent.studiengang_kz,
|
||||
tbl_prestudentstatus.studienplan_id,
|
||||
tbl_studienplan.orgform_kurzbz,
|
||||
tbl_prestudent.person_id');
|
||||
tbl_prestudent.person_id,
|
||||
tbl_studienplan.sprache');
|
||||
$this->PrestudentstatusModel->addJoin('public.tbl_prestudent', 'prestudent_id');
|
||||
$this->PrestudentstatusModel->addJoin('lehre.tbl_studienplan', 'studienplan_id','LEFT');
|
||||
$this->PrestudentstatusModel->addJoin('lehre.tbl_studienordnung', 'studienordnung_id','LEFT');
|
||||
@@ -64,7 +65,8 @@ class Prestudentstatus extends CLI_Controller
|
||||
$row_status->studiengang_kz,
|
||||
$row_status->studiensemester_kurzbz,
|
||||
$row_status->ausbildungssemester,
|
||||
$row_status->orgform_kurzbz);
|
||||
$row_status->orgform_kurzbz,
|
||||
$row_status->sprache);
|
||||
|
||||
if(isSuccess($studienplan) && count($studienplan->retval) == 1)
|
||||
{
|
||||
@@ -107,7 +109,7 @@ class Prestudentstatus extends CLI_Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
show_error($status->retval);
|
||||
show_error(getError($status));
|
||||
}
|
||||
echo "Corrected:".$sum_corrected."\n";
|
||||
echo "Not Corrected:".$sum_notcorrected."\n";
|
||||
|
||||
@@ -35,7 +35,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($result))
|
||||
{
|
||||
show_error($result->error);
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
// Get free places
|
||||
@@ -48,7 +48,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($result))
|
||||
{
|
||||
show_error($result->error);
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
// Prepare data for mail template 'ReihungstestJob'
|
||||
@@ -103,7 +103,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($result))
|
||||
{
|
||||
show_error($result->error);
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$applicants_arr = array();
|
||||
@@ -118,7 +118,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($applicants))
|
||||
{
|
||||
show_error($applicants->error);
|
||||
show_error(getError($applicants));
|
||||
}
|
||||
|
||||
// Get all Bachelor-Degree-Programs with Mailadress
|
||||
@@ -131,7 +131,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($bachelorStudiengeange))
|
||||
{
|
||||
show_error($bachelorStudiengeange->error);
|
||||
show_error(getError($bachelorStudiengeange));
|
||||
}
|
||||
|
||||
// If a person ist an applicant of this degree-program send mail with application data
|
||||
@@ -222,7 +222,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($result))
|
||||
{
|
||||
show_error($result->error);
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
$studiengang = '';
|
||||
@@ -382,7 +382,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($resultTestsOnDate))
|
||||
{
|
||||
show_error($resultTestsOnDate->error);
|
||||
show_error(getError($resultTestsOnDate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($applicants))
|
||||
{
|
||||
show_error($applicants->error);
|
||||
show_error(getError($applicants));
|
||||
}
|
||||
|
||||
foreach ($applicants_arr as $applicant)
|
||||
@@ -479,7 +479,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
elseif (isError($yesterdays_applicants_arr))
|
||||
{
|
||||
show_error($yesterdays_applicants_arr->error);
|
||||
show_error(getError($yesterdays_applicants_arr));
|
||||
}
|
||||
|
||||
// Get all other prestudenten of the given persons.
|
||||
@@ -503,7 +503,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
// Store them, if they have already absolved a placement test in the same study term they have applied for.
|
||||
$placement_absolvents_arr = $this->PrestudentModel->loadWhere('
|
||||
person_id IN (' . implode(', ', $person_id_arr) . ') AND
|
||||
typ = \'b\' AND
|
||||
typ = \'b\' AND
|
||||
teilgenommen = \'t\' AND
|
||||
tbl_reihungstest.studiensemester_kurzbz IN (
|
||||
SELECT
|
||||
@@ -548,7 +548,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
$to = ''; // mail recipient (stg assistance)
|
||||
$content_arr = array(); // url paths to the new applicants
|
||||
$base_link = base_url('vilesci/stammdaten/auswertung_fhtw.php');
|
||||
|
||||
|
||||
$i = 0; // loop counter
|
||||
$len = count($result_arr);
|
||||
|
||||
@@ -569,7 +569,7 @@ class ReihungstestJob extends CLI_Controller
|
||||
{
|
||||
// Prepare content for mail template
|
||||
$content_data_arr = $this->_getContentDataNewApplicant($content_arr);
|
||||
|
||||
|
||||
// Send mail
|
||||
sendSanchoMail(
|
||||
'BewerberNachReihungstest',
|
||||
@@ -786,4 +786,3 @@ class ReihungstestJob extends CLI_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* The controller Lehrauftrag displays all Lehrauftraege within a study semester.
|
||||
* Heads of degree programs can order Lehrauftraege, which subsequently will generate the corresponding contracts
|
||||
* automatically.
|
||||
* Department leaders can approve the ordered Lehrauftraege.
|
||||
*/
|
||||
class Lehrauftrag extends Auth_Controller
|
||||
{
|
||||
const APP = 'lehrauftrag';
|
||||
const LEHRAUFTRAG_URI = 'lehre/lehrauftrag/Lehrauftrag'; // URL prefix for this controller
|
||||
const BERECHTIGUNG_LEHRAUFTRAG_BESTELLEN = 'lehre/lehrauftrag_bestellen';
|
||||
|
||||
private $_uid; // uid of the logged user
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'lehre/lehrauftrag_bestellen:r',
|
||||
'orderLehrauftrag' => 'lehre/lehrauftrag_bestellen:rw',
|
||||
'Dashboard' => array('lehre/lehrauftrag_bestellen:r', 'lehre/lehrauftrag_erteilen:rw'),
|
||||
'LehrendeUebersicht' => array('lehre/lehrauftrag_erteilen:r')
|
||||
)
|
||||
);
|
||||
|
||||
// Load models
|
||||
$this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel');
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$this->load->model('accounting/Vertrag_model', 'VertragModel');
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('WidgetLib');
|
||||
$this->load->library('PermissionLib');
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('array');
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('hlp_sancho_helper');
|
||||
|
||||
// Load language phrases
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'lehre'
|
||||
)
|
||||
);
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
|
||||
$this->setControllerId(); // sets the controller id
|
||||
}
|
||||
|
||||
/**
|
||||
* Display of Custom Dashboard for Lehraufträge App
|
||||
* Charts are hooked from Reporting Addon
|
||||
*/
|
||||
public function Dashboard()
|
||||
{
|
||||
$this->load->view('lehre/lehrauftrag/Dashboard.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display of Lehrauftragsübersicht report
|
||||
*/
|
||||
public function LehrendeUebersicht()
|
||||
{
|
||||
$this->load->view('lehre/lehrauftrag/LehrendeUebersicht.php');
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
/**
|
||||
* Main page of Lehrauftrag
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// Set studiengang selected for studiengang dropdown
|
||||
$studiengang_kz = $this->input->get('studiengang'); // if provided by selected studiengang
|
||||
$studiengang_kz = ($studiengang_kz == 'null' ? null : $studiengang_kz);
|
||||
|
||||
// Retrieve studiengaenge the user is entitled for to populate studiengang dropdown
|
||||
if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_LEHRAUFTRAG_BESTELLEN)) {
|
||||
show_error('Fehler bei Berechtigungsprüfung');
|
||||
}
|
||||
|
||||
// If studiengang_kz get param was set, check against entitled stg
|
||||
if (!is_null($studiengang_kz))
|
||||
{
|
||||
if (!in_array($studiengang_kz, $studiengang_kz_arr))
|
||||
{
|
||||
show_error('Keine Berechtigung für diesen Studiengang');
|
||||
}
|
||||
}
|
||||
|
||||
// Set studiensemester selected for studiengang dropdown
|
||||
$studiensemester_kurzbz = $this->input->get('studiensemester'); // if provided by selected studiensemester
|
||||
if (is_null($studiensemester_kurzbz)) // else set next studiensemester as default value
|
||||
{
|
||||
$studiensemester = $this->StudiensemesterModel->getNext();
|
||||
if (hasData($studiensemester))
|
||||
{
|
||||
$studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
|
||||
}
|
||||
elseif (isError($studiensemester))
|
||||
{
|
||||
show_error(getError($studiensemester));
|
||||
}
|
||||
}
|
||||
|
||||
// Set ausbildungssemester selected for ausbildungssemester dropdown
|
||||
$ausbildungssemester = $this->input->get('ausbildungssemester'); // if provided by selected ausbildungssemester
|
||||
$ausbildungssemester = ($ausbildungssemester == 'null' ? null : $ausbildungssemester);
|
||||
|
||||
$view_data = array(
|
||||
'studiengang_selected' => $studiengang_kz,
|
||||
'studiengang' => $studiengang_kz_arr,
|
||||
'studiensemester_selected' => $studiensemester_kurzbz,
|
||||
'ausbildungssemester_selected' => $ausbildungssemester,
|
||||
);
|
||||
|
||||
$this->load->view('lehre/lehrauftrag/orderLehrauftrag.php', $view_data);
|
||||
}
|
||||
|
||||
public function orderLehrauftrag()
|
||||
{
|
||||
$new_lehrvertrag_data_arr = array(); // information of new lehrvertraege to be used in mail
|
||||
$lehrauftrag_arr = json_decode($this->input->post('selected_data'));
|
||||
|
||||
// Loop through lehraufträge
|
||||
if(is_array($lehrauftrag_arr))
|
||||
{
|
||||
foreach($lehrauftrag_arr as $lehrauftrag)
|
||||
{
|
||||
$lehreinheit_id = (isset($lehrauftrag->lehreinheit_id)) ? $lehrauftrag->lehreinheit_id : null;
|
||||
$lehrveranstaltung_id = (isset($lehrauftrag->lehrveranstaltung_id)) ? $lehrauftrag->lehrveranstaltung_id : null;
|
||||
$person_id = (isset($lehrauftrag->person_id)) ? $lehrauftrag->person_id : null;
|
||||
$mitarbeiter_uid = (isset($lehrauftrag->mitarbeiter_uid)) ? $lehrauftrag->mitarbeiter_uid : null;
|
||||
$vertrag_id = (isset($lehrauftrag->vertrag_id)) ? $lehrauftrag->vertrag_id : null;
|
||||
$projektarbeit_id = (isset($lehrauftrag->projektarbeit_id)) ? $lehrauftrag->projektarbeit_id : null;
|
||||
$stunden = (isset($lehrauftrag->stunden)) ? $lehrauftrag->stunden : 0;
|
||||
$betrag = (isset($lehrauftrag->betrag)) ? $lehrauftrag->betrag : 0;
|
||||
$studiensemester_kurzbz = (isset($lehrauftrag->studiensemester_kurzbz)) ? $lehrauftrag->studiensemester_kurzbz : null;
|
||||
$studiengang_kz = (isset($lehrauftrag->studiengang_kz)) ? $lehrauftrag->studiengang_kz : null;
|
||||
|
||||
// Check if user is entitled to order this Lehrauftrag
|
||||
if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_LEHRAUFTRAG_BESTELLEN, 'suid', $studiengang_kz))
|
||||
{
|
||||
return $this->outputJsonError('Sie haben keine Bestellberechtigung für diesen Studiengang: '. $studiengang_kz);
|
||||
}
|
||||
|
||||
// update contract if contract exists and the betrag was changed
|
||||
if (!is_null($vertrag_id))
|
||||
{
|
||||
$this->VertragModel->addSelect('vertragsstunden, betrag');
|
||||
|
||||
if($result = getData($this->VertragModel->load($vertrag_id)))
|
||||
{
|
||||
$vertrag_betrag = $result[0]->betrag;
|
||||
$vertrag_stunden = $result[0]->vertragsstunden;
|
||||
}
|
||||
elseif (isError($result))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Laden des Vertrags');
|
||||
}
|
||||
|
||||
$hasChanged = ($betrag != floatval($vertrag_betrag) || $stunden != $vertrag_stunden) ? true : false;
|
||||
|
||||
if ($hasChanged)
|
||||
{
|
||||
$result = $this->VertragModel->updateVertrag(
|
||||
$vertrag_id,
|
||||
$stunden,
|
||||
$betrag,
|
||||
$mitarbeiter_uid
|
||||
);
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$json []= array(
|
||||
'row_index' => $lehrauftrag->row_index,
|
||||
'bestellt' => date('Y-m-d'),
|
||||
'vertrag_betrag' => $betrag,
|
||||
'vertrag_stunden' => $stunden,
|
||||
'erteilt' => null
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Vertragsupdate');
|
||||
}
|
||||
}
|
||||
}
|
||||
// else save new contract
|
||||
else
|
||||
{
|
||||
$result = $this->VertragModel->save(
|
||||
$person_id,
|
||||
$mitarbeiter_uid,
|
||||
$lehrveranstaltung_id,
|
||||
$lehreinheit_id,
|
||||
$projektarbeit_id,
|
||||
$stunden,
|
||||
$betrag,
|
||||
$studiensemester_kurzbz
|
||||
);
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$json []= array(
|
||||
'row_index' => $lehrauftrag->row_index,
|
||||
'bestellt' => date('Y-m-d'),
|
||||
'vertrag_betrag' => $betrag,
|
||||
'vertrag_stunden' => $stunden
|
||||
);
|
||||
}
|
||||
elseif (isError($result) && $result->retval)
|
||||
{
|
||||
return $this->outputJsonError($result->retval);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Speichern des Vertrags');
|
||||
}
|
||||
|
||||
$new_lehrvertrag_data_arr[] = array(
|
||||
'studiensemester_kurzbz' => $lehrauftrag->studiensemester_kurzbz,
|
||||
'studiengang_kz' => $lehrauftrag->studiengang_kz,
|
||||
'lv_oe_kurzbz' => $lehrauftrag->lv_oe_kurzbz
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
|
||||
if (isset($json) && !isEmptyArray($json))
|
||||
{
|
||||
$this->outputJsonSuccess($json);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Retrieve the UID of the logged user and checks if it is valid
|
||||
*/
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
|
||||
private function _sendMail($lehrvertrag_data_arr)
|
||||
{
|
||||
// Cluster data of new lehrvertraege as needed to send mail
|
||||
$lehrvertrag_data_arr = $this->_cluster_newVertragData($lehrvertrag_data_arr);
|
||||
|
||||
foreach ($lehrvertrag_data_arr as $lehrvertrag_data)
|
||||
{
|
||||
// Get mail recipients
|
||||
$result = $this->BenutzerrolleModel->getBenutzerByBerechtigung('lehre/lehrauftrag_erteilen', $lehrvertrag_data['lv_oe_kurzbz']);
|
||||
|
||||
// If given lv organisational unit has no authorized user, check if is a Kompetenzfeld.
|
||||
// If so, look up for authorized user on Department level.
|
||||
if (!hasData($result)) {
|
||||
$result = $this->OrganisationseinheitModel->getParent($lehrvertrag_data['lv_oe_kurzbz']);
|
||||
|
||||
if (hasData($result)) {
|
||||
if ($result->retval[0]->organisationseinheittyp_kurzbz === 'Department') {
|
||||
$result = $this->BenutzerrolleModel->getBenutzerByBerechtigung('lehre/lehrauftrag_erteilen', $result->retval[0]->oe_kurzbz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set mail recipients (department assistance/leader)
|
||||
$to = '';
|
||||
$to_arr = array();
|
||||
foreach ($result->retval as $berechtigung) {
|
||||
$to_arr []= $berechtigung->uid . '@' . DOMAIN; // TODO: als array, dann splitten mit ;? oder als array lassen?
|
||||
}
|
||||
$to = implode(', ', $to_arr);
|
||||
|
||||
// Set link to lehrauftrag-site with preselected studiengang and studiensemester of new lehrauftraege
|
||||
$url = site_url(self::LEHRAUFTRAG_URI).'?studiensemester='. $lehrvertrag_data['studiensemester_kurzbz']. '&studiengang='. $lehrvertrag_data['studiengang_kz'];
|
||||
|
||||
// Prepare mail content
|
||||
$content_data_arr = array(
|
||||
'anzahl' => $lehrvertrag_data['amount_new_lehrvertraege'],
|
||||
'studiengang' => $lehrvertrag_data['studiengang_kz'],
|
||||
'studiensemester' => $lehrvertrag_data['studiensemester_kurzbz'],
|
||||
'link' => anchor($url, 'Lehrverträge Übersicht')
|
||||
);
|
||||
|
||||
// Send mail
|
||||
sendSanchoMail(
|
||||
'LehrauftragBestellMail',
|
||||
$content_data_arr,
|
||||
$to,
|
||||
'Bestellung neuer Lehraufträge',
|
||||
'sancho_header_min_bw.jpg',
|
||||
'sancho_footer_min_bw.jpg'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clusters data as needed for _sendMail.
|
||||
* Makes array of new lehrvertraege unique (by studiensemester, studiengang and lv_oe_kurzbz)
|
||||
* Adds the amount of lehrvertraege of each unique array element.
|
||||
* @param $new_lehrvertrag_data_arr
|
||||
* @return array
|
||||
*/
|
||||
private function _cluster_newVertragData($new_lehrvertrag_data_arr)
|
||||
{
|
||||
$unique_new_lehrvertrag_data_arr = array_unique($new_lehrvertrag_data_arr, SORT_REGULAR);
|
||||
foreach ($unique_new_lehrvertrag_data_arr as &$new_lehrvertrag)
|
||||
{
|
||||
$cnt = 1;
|
||||
foreach ($new_lehrvertrag_data_arr as $item)
|
||||
{
|
||||
if ($new_lehrvertrag['studiensemester_kurzbz'] === $item['studiensemester_kurzbz'] &&
|
||||
$new_lehrvertrag['studiengang_kz'] === $item['studiengang_kz'] &&
|
||||
$new_lehrvertrag['lv_oe_kurzbz'] === $item['lv_oe_kurzbz'])
|
||||
{
|
||||
$new_lehrvertrag['amount_new_lehrvertraege'] = $cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $unique_new_lehrvertrag_data_arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* The controller LehrauftragAkzeptieren displays all Lehrauftraege of the logged in lector.
|
||||
* Lehrauftraege can be accepted by selecting them, entering the password and submitting them.
|
||||
*/
|
||||
class LehrauftragAkzeptieren extends Auth_Controller
|
||||
{
|
||||
const APP = 'lehrauftrag';
|
||||
const LEHRAUFTRAG_URI = 'lehre/lehrauftrag/LehrauftragAkzeptieren'; // URL prefix for this controller
|
||||
const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren';
|
||||
|
||||
private $_uid; // uid of the logged user
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'lehre/lehrauftrag_akzeptieren:r',
|
||||
'acceptLehrauftrag' => 'lehre/lehrauftrag_akzeptieren:rw',
|
||||
'checkInkludierteLehre' => 'lehre/lehrauftrag_akzeptieren:rw'
|
||||
)
|
||||
);
|
||||
|
||||
// Load models
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$this->load->model('accounting/Vertrag_model', 'VertragModel');
|
||||
$this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
|
||||
$this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel');
|
||||
$this->load->model('codex/Bisverwendung_model', 'BisverwendungModel');
|
||||
$this->load->model('person/Benutzer_model', 'BenutzerModel');
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('WidgetLib');
|
||||
$this->load->library('PermissionLib');
|
||||
$this->load->library('AuthLib');
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('array');
|
||||
$this->load->helper('url');
|
||||
|
||||
// Load language phrases
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'lehre'
|
||||
)
|
||||
);
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
|
||||
$this->setControllerId(); // sets the controller id
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Main page of Lehrauftrag
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// Set studiensemester selected for studiengang dropdown
|
||||
$studiensemester_kurzbz = $this->input->get('studiensemester'); // if provided by selected studiensemester
|
||||
if (is_null($studiensemester_kurzbz)) // else set next studiensemester as default value
|
||||
{
|
||||
$studiensemester = $this->StudiensemesterModel->getNext();
|
||||
if (hasData($studiensemester))
|
||||
{
|
||||
$studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
|
||||
}
|
||||
elseif (isError($studiensemester))
|
||||
{
|
||||
show_error(getError($studiensemester));
|
||||
}
|
||||
}
|
||||
|
||||
$view_data = array(
|
||||
'studiensemester_selected' => $studiensemester_kurzbz
|
||||
);
|
||||
|
||||
$this->load->view('lehre/lehrauftrag/acceptLehrauftrag.php', $view_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the contract status of Lehrauftrag to 'akzeptiert'.
|
||||
* Performed on ajax call.
|
||||
*/
|
||||
public function acceptLehrauftrag()
|
||||
{
|
||||
// Verify password
|
||||
$password = $this->input->post('password');
|
||||
if (!isEmptyString($password))
|
||||
{
|
||||
$result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->outputJsonError('Passwort ist inkorrekt'); // exit if password is incorrect
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Passwort fehlt');
|
||||
}
|
||||
|
||||
// Loop through lehraufträge
|
||||
$lehrauftrag_arr = $this->input->post('selected_data');
|
||||
|
||||
if(is_array($lehrauftrag_arr))
|
||||
{
|
||||
foreach($lehrauftrag_arr as $lehrauftrag)
|
||||
{
|
||||
$vertrag_id = (!is_null($lehrauftrag['vertrag_id'])) ? $lehrauftrag['vertrag_id'] : null;
|
||||
|
||||
// Check if user is entitled to accept this Lehrauftrag
|
||||
// * first retrieve person_id of the contract
|
||||
$this->VertragModel->addSelect('person_id');
|
||||
|
||||
if ($result = getData($this->VertragModel->load($vertrag_id)))
|
||||
{
|
||||
// * then find the uid of that contracts person_id
|
||||
$this->BenutzerModel->addSelect('uid');
|
||||
|
||||
if ($result = getData($this->BenutzerModel->getFromPersonId($result[0]->person_id)))
|
||||
{
|
||||
// * finally check uid of contract against the logged in user
|
||||
$account_found = false;
|
||||
foreach($result as $row_accounts)
|
||||
{
|
||||
if($row_accounts->uid == $this->_uid)
|
||||
{
|
||||
$account_found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$account_found)
|
||||
{
|
||||
return $this->outputJsonError('Sie haben keine Berechtigung für einen Vertrag');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Laden der Benutzerdaten');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Laden des Vertrags');
|
||||
}
|
||||
|
||||
// Set status to accepted
|
||||
$result = $this->VertragvertragsstatusModel->setStatus($vertrag_id, $this->_uid, 'akzeptiert');
|
||||
|
||||
if ($result->retval)
|
||||
{
|
||||
$json []= array(
|
||||
'row_index' => $lehrauftrag['row_index'],
|
||||
'akzeptiert' => date('Y-m-d')
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError($result->retval);
|
||||
}
|
||||
}
|
||||
|
||||
// Output json to ajax
|
||||
if (isset($json) && !isEmptyArray($json))
|
||||
{
|
||||
$this->outputJsonSuccess($json);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if lectors latest active Verwendung has inkludierte Lehre
|
||||
* - inkludierte_lehre is null OR 0: freelancer lector -> has NO inkludierte Lehre
|
||||
* - inkludierte_lehre -1: fix employed lector -> has inkludierte Lehre (all inclusive)
|
||||
* - inkludierte_lehre > 0: fix employed lector -> has inkludierte Lehre (value is amount of hours included)
|
||||
*/
|
||||
public function checkInkludierteLehre()
|
||||
{
|
||||
$result = $this->BisverwendungModel->getLast($this->_uid);
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$this->outputJsonSuccess(!is_null($result->retval[0]->inkludierte_lehre) && $result->retval[0]->inkludierte_lehre != 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->outputJsonError(getError($result));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Retrieve the UID of the logged user and checks if it is valid
|
||||
*/
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* The controller Lehrauftrag displays all Lehrauftraege within a study semester.
|
||||
* Heads of degree programs can order Lehrauftraege, which subsequently will generate the corresponding contracts
|
||||
* automatically.
|
||||
* Department leaders can approve the ordered Lehrauftraege.
|
||||
*/
|
||||
class LehrauftragErteilen extends Auth_Controller
|
||||
{
|
||||
const APP = 'lehrauftrag';
|
||||
const LEHRAUFTRAG_URI = 'lehre/lehrauftrag/LehrauftragErteilen'; // URL prefix for this controller
|
||||
const BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN = 'lehre/lehrauftrag_erteilen';
|
||||
|
||||
private $_uid; // uid of the logged user
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Set required permissions
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'lehre/lehrauftrag_erteilen:r',
|
||||
'approveLehrauftrag' => 'lehre/lehrauftrag_erteilen:rw'
|
||||
)
|
||||
);
|
||||
|
||||
// Load models
|
||||
$this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel');
|
||||
$this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel');
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$this->load->model('accounting/Vertrag_model', 'VertragModel');
|
||||
$this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('WidgetLib');
|
||||
$this->load->library('PermissionLib');
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('array');
|
||||
$this->load->helper('url');
|
||||
|
||||
// Load language phrases
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'lehre'
|
||||
)
|
||||
);
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
|
||||
$this->setControllerId(); // sets the controller id
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Main page of Lehrauftrag
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// Set studiengang to be selected in studiengang dropdown
|
||||
$oe_kurzbz = $this->input->get('organisationseinheit'); // if provided by selected studiengang
|
||||
$oe_kurzbz = ($oe_kurzbz == 'null' ? null : $oe_kurzbz);
|
||||
|
||||
// Retrieve studiengaenge the user is entitled for to populate studiengang dropdown
|
||||
if (!$oe_kurzbz_arr = $this->permissionlib->getOE_isEntitledFor(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN))
|
||||
{
|
||||
show_error('Fehler bei Berechtigungsprüfung');
|
||||
}
|
||||
|
||||
// If oe_kurzbz get param was set, check against entitled stg
|
||||
if (!is_null($oe_kurzbz))
|
||||
{
|
||||
if (!in_array($oe_kurzbz, $oe_kurzbz_arr))
|
||||
{
|
||||
show_error('Keine Berechtigung für diese Organisationseinheit');
|
||||
}
|
||||
}
|
||||
|
||||
// Set studiensemester selected for studiengang dropdown
|
||||
$studiensemester_kurzbz = $this->input->get('studiensemester'); // if provided by selected studiensemester
|
||||
if (is_null($studiensemester_kurzbz)) // else set next studiensemester as default value
|
||||
{
|
||||
$studiensemester = $this->StudiensemesterModel->getNext();
|
||||
if (hasData($studiensemester))
|
||||
{
|
||||
$studiensemester_kurzbz = $studiensemester->retval[0]->studiensemester_kurzbz;
|
||||
}
|
||||
elseif (isError($studiensemester))
|
||||
{
|
||||
show_error(getError($studiensemester));
|
||||
}
|
||||
}
|
||||
|
||||
// Set ausbildungssemester selected for ausbildungssemester dropdown
|
||||
$ausbildungssemester = $this->input->get('ausbildungssemester'); // if provided by selected ausbildungssemester
|
||||
$ausbildungssemester = ($ausbildungssemester == 'null' ? null : $ausbildungssemester);
|
||||
|
||||
$view_data = array(
|
||||
'organisationseinheit_selected' => $oe_kurzbz,
|
||||
'organisationseinheit' => $oe_kurzbz_arr,
|
||||
'studiensemester_selected' => $studiensemester_kurzbz,
|
||||
'ausbildungssemester_selected' => $ausbildungssemester,
|
||||
);
|
||||
|
||||
$this->load->view('lehre/lehrauftrag/approveLehrauftrag.php', $view_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the contract status of Lehrauftrag to 'erteilt'.
|
||||
* Performed on ajax call.
|
||||
*/
|
||||
public function approveLehrauftrag()
|
||||
{
|
||||
$lehrauftrag_arr = json_decode($this->input->post('selected_data'));
|
||||
|
||||
if (is_array($lehrauftrag_arr))
|
||||
{
|
||||
foreach ($lehrauftrag_arr as $lehrauftrag)
|
||||
{
|
||||
$mitarbeiter_uid = (isset($lehrauftrag->mitarbeiter_uid)) ? $lehrauftrag->mitarbeiter_uid : null;
|
||||
$vertrag_id = (isset($lehrauftrag->vertrag_id)) ? $lehrauftrag->vertrag_id : null;
|
||||
|
||||
$lv_oe_kurzbz = null;
|
||||
|
||||
// Retrieve organisational unit to which the lehrveranstaltung of the contract belongs to
|
||||
// * first get lehrveranstaltung
|
||||
$result = $this->VertragModel->getLehreinheitData($vertrag_id, 'lehrveranstaltung_id');
|
||||
if (hasData($result))
|
||||
{
|
||||
// * then get corresponding organisational unit
|
||||
$this->load->model('education/Lehrveranstaltung_model', 'Lehrveranstaltung_model');
|
||||
$result = $this->LehrveranstaltungModel->load($result->retval[0]->lehrveranstaltung_id);
|
||||
if (hasData($result))
|
||||
{
|
||||
$lv_oe_kurzbz = $result->retval[0]->oe_kurzbz;
|
||||
}
|
||||
elseif (isError(($result)))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Laden einer Lehrveranstaltung.');
|
||||
}
|
||||
}
|
||||
elseif (isError($result))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Laden von Lehreinheitdaten.');
|
||||
}
|
||||
|
||||
// Check if user is entitled to approve this lehrauftrag (by permission and organisational unit)
|
||||
if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN, 'suid', $lv_oe_kurzbz))
|
||||
{
|
||||
return $this->outputJsonError('Sie haben keine Erteilberechtigung für diese Organisationseinheit: '. $lv_oe_kurzbz);
|
||||
}
|
||||
|
||||
// Approve lehrauftrag by setting vertragsstatus to 'erteilt'
|
||||
$result = $this->VertragvertragsstatusModel->setStatus($vertrag_id, $mitarbeiter_uid, 'erteilt');
|
||||
|
||||
if (!isError($result))
|
||||
{
|
||||
$json [] = array(
|
||||
'row_index' => $lehrauftrag->row_index,
|
||||
'erteilt' => date('Y-m-d')
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError($result->retval);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
|
||||
// output success json to ajax
|
||||
if (isset($json) && !isEmptyArray($json))
|
||||
{
|
||||
$this->outputJsonSuccess($json);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Retrieve the UID of the logged user and checks if it is valid
|
||||
*/
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ class Studienjahr extends Auth_Controller
|
||||
'editStudienjahr' => 'basis/studiensemester:rw',
|
||||
'newStudienjahr' => 'basis/studiensemester:rw',
|
||||
'insStudienjahr' => 'basis/studiensemester:rw',
|
||||
'saveStudienjahr' => 'basis/studiensemester:rw',
|
||||
'updateStudienjahr' => 'basis/studiensemester:rw',
|
||||
'deleteStudienjahr' => 'basis/studiensemester:rw'
|
||||
)
|
||||
);
|
||||
@@ -44,7 +44,7 @@ class Studienjahr extends Auth_Controller
|
||||
$studienjahr = $this->StudienjahrModel->load();
|
||||
if ($studienjahr->error)
|
||||
{
|
||||
show_error($studienjahr->retval);
|
||||
show_error(getError($studienjahr));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
@@ -66,7 +66,7 @@ class Studienjahr extends Auth_Controller
|
||||
$studienjahr = $this->StudienjahrModel->load($studienjahr_kurzbez);
|
||||
if ($studienjahr->error)
|
||||
{
|
||||
show_error($studienjahr->retval);
|
||||
show_error(getError($studienjahr));
|
||||
}
|
||||
$data = array(
|
||||
"studienjahr" => $studienjahr->retval
|
||||
@@ -86,7 +86,7 @@ class Studienjahr extends Auth_Controller
|
||||
$allstudienjahrkurzbz = $this->StudienjahrModel->load();
|
||||
if ($allstudienjahrkurzbz->error)
|
||||
{
|
||||
show_error($allstudienjahrkurzbz->retval);
|
||||
show_error(getError($allstudienjahrkurzbz));
|
||||
}
|
||||
$studienjahrkurzbz = $allstudienjahrkurzbz->retval[0]->studienjahr_kurzbz;
|
||||
$years = $this->__getYearsFromStudienjahr($studienjahrkurzbz);
|
||||
@@ -117,11 +117,15 @@ class Studienjahr extends Auth_Controller
|
||||
public function insStudienjahr()
|
||||
{
|
||||
$data = $this->__retrieveStudienjahrData();
|
||||
$studienjahr_exists = $this->StudienjahrModel->load($data['studienjahr_kurzbz']);
|
||||
if (hasData($studienjahr_exists))
|
||||
show_error("Studienjahr existiert bereits");
|
||||
|
||||
$studienjahr = $this->StudienjahrModel->insert($data);
|
||||
|
||||
if ($studienjahr->error)
|
||||
{
|
||||
show_error($studienjahr->retval);
|
||||
show_error(getError($studienjahr));
|
||||
}
|
||||
|
||||
redirect("/organisation/studienjahr/editStudienjahr/".str_replace("/", "_", $data['studienjahr_kurzbz']."?saved=true"));
|
||||
@@ -149,7 +153,7 @@ class Studienjahr extends Auth_Controller
|
||||
return $data;
|
||||
} else
|
||||
{
|
||||
show_error($validation->retval);
|
||||
show_error(getError($validation));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,14 +181,14 @@ class Studienjahr extends Auth_Controller
|
||||
* replaces slash in Kurzbezeichnung with underscore
|
||||
* saved=true is a GET parameter passed for showing save message
|
||||
*/
|
||||
public function saveStudienjahr()
|
||||
public function updateStudienjahr()
|
||||
{
|
||||
$data = $this->__retrieveStudienjahrData();
|
||||
$studienjahr = $this->StudienjahrModel->update($data['studienjahr_kurzbz'], $data);
|
||||
|
||||
if ($studienjahr->error)
|
||||
{
|
||||
show_error($studienjahr->retval);
|
||||
show_error(getError($studienjahr));
|
||||
}
|
||||
|
||||
redirect("/organisation/studienjahr/editStudienjahr/".str_replace("/", "_", $data['studienjahr_kurzbz']."?saved=true"));
|
||||
@@ -203,7 +207,7 @@ class Studienjahr extends Auth_Controller
|
||||
|
||||
if ($studienjahr->error)
|
||||
{
|
||||
show_error($studienjahr->retval);
|
||||
show_error(getError($studienjahr));
|
||||
}
|
||||
|
||||
redirect("/organisation/studienjahr/listStudienjahr");
|
||||
|
||||
@@ -20,7 +20,7 @@ class Studiensemester extends Auth_Controller
|
||||
'editStudiensemester' => 'basis/studiensemester:rw',
|
||||
'newStudiensemester' => 'basis/studiensemester:rw',
|
||||
'insStudiensemester' => 'basis/studiensemester:rw',
|
||||
'saveStudiensemester' => 'basis/studiensemester:rw',
|
||||
'updateStudiensemester' => 'basis/studiensemester:rw',
|
||||
'deleteStudiensemester' => 'basis/studiensemester:rw'
|
||||
)
|
||||
);
|
||||
@@ -45,7 +45,7 @@ class Studiensemester extends Auth_Controller
|
||||
$semester = $this->StudiensemesterModel->load();
|
||||
if ($semester->error)
|
||||
{
|
||||
show_error($semester->retval);
|
||||
show_error(getError($semester));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
@@ -64,13 +64,13 @@ class Studiensemester extends Auth_Controller
|
||||
$semester = $this->StudiensemesterModel->load($semester_kurzbez);
|
||||
if ($semester->error)
|
||||
{
|
||||
show_error($semester->retval);
|
||||
show_error(getError($semester));
|
||||
}
|
||||
$this->StudienjahrModel->addOrder('studienjahr_kurzbz', "DESC");
|
||||
$allstudienjahre = $this->StudienjahrModel->load();
|
||||
if ($allstudienjahre->error)
|
||||
{
|
||||
show_error($allstudienjahre->retval);
|
||||
show_error(getError($allstudienjahre));
|
||||
}
|
||||
$data = array(
|
||||
"semester" => $semester->retval,
|
||||
@@ -90,7 +90,7 @@ class Studiensemester extends Auth_Controller
|
||||
$allstudienjahre = $this->StudienjahrModel->load();
|
||||
if ($allstudienjahre->error)
|
||||
{
|
||||
show_error($allstudienjahre->retval);
|
||||
show_error(getError($allstudienjahre));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
@@ -108,11 +108,16 @@ class Studiensemester extends Auth_Controller
|
||||
public function insStudiensemester()
|
||||
{
|
||||
$data = $this->__retrieveStudiensemesterData();
|
||||
|
||||
$studiensemester_exists = $this->StudiensemesterModel->load($data['studiensemester_kurzbz']);
|
||||
if (hasData($studiensemester_exists))
|
||||
show_error("Studiensemester existiert bereits");
|
||||
|
||||
$semester = $this->StudiensemesterModel->insert($data);
|
||||
|
||||
if ($semester->error)
|
||||
{
|
||||
show_error($semester->retval);
|
||||
show_error(getError($semester));
|
||||
}
|
||||
|
||||
redirect("/organisation/studiensemester/editStudiensemester/".$data['studiensemester_kurzbz']."?saved=true");
|
||||
@@ -156,7 +161,7 @@ class Studiensemester extends Auth_Controller
|
||||
return $data;
|
||||
} else
|
||||
{
|
||||
show_error($validation->retval);
|
||||
show_error(getError($validation));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,14 +190,14 @@ class Studiensemester extends Auth_Controller
|
||||
* redirects to edit page after inserting
|
||||
* saved=true is a GET parameter passed for showing save message
|
||||
*/
|
||||
public function saveStudiensemester()
|
||||
public function updateStudiensemester()
|
||||
{
|
||||
$data = $this->__retrieveStudiensemesterData();
|
||||
$semester = $this->StudiensemesterModel->update($data['studiensemester_kurzbz'], $data);
|
||||
|
||||
if ($semester->error)
|
||||
{
|
||||
show_error($semester->retval);
|
||||
show_error(getError($semester));
|
||||
}
|
||||
|
||||
redirect("/organisation/studiensemester/editStudiensemester/".$data['studiensemester_kurzbz']."?saved=true");
|
||||
@@ -209,10 +214,9 @@ class Studiensemester extends Auth_Controller
|
||||
|
||||
if ($semester->error)
|
||||
{
|
||||
show_error($semester->retval);
|
||||
show_error(getError($semester));
|
||||
}
|
||||
|
||||
redirect("/organisation/studiensemester/listStudiensemester");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class BPKWartung extends Auth_Controller
|
||||
$personexists = $this->PersonModel->load($person_id);
|
||||
|
||||
if (isError($personexists))
|
||||
show_error($personexists->retval);
|
||||
show_error(getError($personexists));
|
||||
|
||||
if (!hasData($personexists))
|
||||
show_error('Person does not exist!');
|
||||
@@ -122,7 +122,7 @@ class BPKWartung extends Auth_Controller
|
||||
|
||||
if (isError($stammdaten))
|
||||
{
|
||||
show_error($stammdaten->retval);
|
||||
show_error(getError($stammdaten));
|
||||
}
|
||||
|
||||
if (!isset($stammdaten->retval))
|
||||
@@ -132,7 +132,7 @@ class BPKWartung extends Auth_Controller
|
||||
|
||||
if (isError($adresse))
|
||||
{
|
||||
show_error($adresse->retval);
|
||||
show_error(getError($adresse));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
|
||||
@@ -46,6 +46,9 @@ class Gradelist extends Auth_Controller
|
||||
$this->_grades[$row->note]['anmerkung'] = $row->anmerkung;
|
||||
$this->_grades[$row->note]['notenwert'] = $row->notenwert;
|
||||
}
|
||||
$this->_grades['']['positiv'] = false;
|
||||
$this->_grades['']['anmerkung'] = '';
|
||||
$this->_grades['']['notenwert'] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -386,6 +389,15 @@ class Gradelist extends Auth_Controller
|
||||
'sws' => $row['sws']
|
||||
);
|
||||
}
|
||||
elseif (isset($row['zugeordnet']) && $row['zugeordnet'] == true && $row['lehrtyp_kurzbz']=='lv')
|
||||
{
|
||||
// ECTS und SWS mitzaehlen wenn die Person zugeordnet ist auch wenn noch keine Noten vorhanden ist.
|
||||
$grades[] = array(
|
||||
'note' => '',
|
||||
'ects' => $row['ects'],
|
||||
'sws' => $row['sws']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($row['childs']))
|
||||
{
|
||||
|
||||
+22
-15
@@ -2,8 +2,10 @@
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class UDF extends Auth_Controller
|
||||
class FAS_UDF extends Auth_Controller
|
||||
{
|
||||
const FAS_UDF_SESSION_NAME = 'fasUdfSessionName';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
@@ -22,31 +24,33 @@ class UDF extends Auth_Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$fasUdfSession = getSession(self::FAS_UDF_SESSION_NAME);
|
||||
|
||||
$person_id = $this->input->get('person_id');
|
||||
if (isset($this->session->person_id))
|
||||
if (isset($fasUdfSession['person_id']))
|
||||
{
|
||||
if (!isset($person_id))
|
||||
{
|
||||
$person_id = $this->session->person_id;
|
||||
$person_id = $fasUdfSession['person_id'];
|
||||
}
|
||||
unset($this->session->person_id);
|
||||
unset($fasUdfSession['person_id']);
|
||||
}
|
||||
|
||||
$prestudent_id = $this->input->get('prestudent_id');
|
||||
if (isset($this->session->prestudent_id))
|
||||
if (isset($fasUdfSession['prestudent_id']))
|
||||
{
|
||||
if (!isset($prestudent_id))
|
||||
{
|
||||
$prestudent_id = $this->session->prestudent_id;
|
||||
$prestudent_id = $fasUdfSession['prestudent_id'];
|
||||
}
|
||||
unset($this->session->prestudent_id);
|
||||
unset($fasUdfSession['prestudent_id']);
|
||||
}
|
||||
|
||||
$result = null;
|
||||
if (isset($this->session->result))
|
||||
if (isset($fasUdfSession['result']))
|
||||
{
|
||||
$result = clone $this->session->result;
|
||||
$this->session->set_userdata('result', null);
|
||||
$result = clone $fasUdfSession['result'];
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', null);
|
||||
}
|
||||
|
||||
$data = array('result' => $result);
|
||||
@@ -71,7 +75,7 @@ class UDF extends Auth_Controller
|
||||
}
|
||||
}
|
||||
|
||||
$this->load->view('system/udf', $data);
|
||||
$this->load->view('system/fas_udf', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,9 +94,9 @@ class UDF extends Auth_Controller
|
||||
if (isSuccess($validation))
|
||||
{
|
||||
// Load model UDF_model
|
||||
$this->load->model('system/UDF_model', 'UDFModel');
|
||||
$this->load->model('system/FAS_UDF_model', 'FASUDFModel');
|
||||
|
||||
$result = $this->UDFModel->saveUDFs($udfs);
|
||||
$result = $this->FASUDFModel->saveUDFs($udfs);
|
||||
|
||||
$userdata['result'] = $result;
|
||||
}
|
||||
@@ -101,8 +105,11 @@ class UDF extends Auth_Controller
|
||||
$userdata['result'] = $validation;
|
||||
}
|
||||
|
||||
$this->session->set_userdata($userdata);
|
||||
redirect('system/UDF');
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'person_id', $userdata['person_id']);
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'prestudent_id', $userdata['prestudent_id']);
|
||||
setSessionElement(self::FAS_UDF_SESSION_NAME, 'result', $userdata['result']);
|
||||
|
||||
redirect('system/FAS_UDF');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Overview on cronjob logs
|
||||
*/
|
||||
class LogsViewer extends Auth_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'system/developer:r'
|
||||
)
|
||||
);
|
||||
|
||||
// Loads WidgetLib
|
||||
$this->load->library('WidgetLib');
|
||||
|
||||
// Loads phrases system
|
||||
$this->loadPhrases(
|
||||
array(
|
||||
'global',
|
||||
'ui',
|
||||
'filter'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Main page of the InfoCenter tool
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('system/logs/logsViewer.php');
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
* Provides data to the ajax get calls about the filter
|
||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||
*/
|
||||
class Navigation extends Auth_Controller
|
||||
class Navigation extends FHC_Controller
|
||||
{
|
||||
const NAVIGATION_PAGE_PARAM = 'navigation_page'; // Navigation page parameter name
|
||||
|
||||
@@ -16,12 +16,9 @@ class Navigation extends Auth_Controller
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'menu' => 'basis/vilesci:r',
|
||||
'header' => 'basis/vilesci:r'
|
||||
)
|
||||
);
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('AuthLib');
|
||||
|
||||
$this->_loadNavigationLib(); // Loads the NavigationLib with parameters
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class Phrases extends Auth_Controller
|
||||
{
|
||||
$phrases = $this->phraseslib->getPhraseByApp('aufnahme');
|
||||
if ($phrases->error)
|
||||
show_error($phrases->retval);
|
||||
show_error(getError($phrases));
|
||||
|
||||
$data = array(
|
||||
'app' => 'aufnahme',
|
||||
@@ -67,7 +67,7 @@ class Phrases extends Auth_Controller
|
||||
|
||||
$phrase_inhalt = $this->phraseslib->getPhraseInhalt($phrase_id);
|
||||
if ($phrase_inhalt->error)
|
||||
show_error($phrase_inhalt->retval);
|
||||
show_error(getError($phrase_inhalt));
|
||||
|
||||
$data = array(
|
||||
'phrase_id' => $phrase_id,
|
||||
@@ -88,7 +88,7 @@ class Phrases extends Auth_Controller
|
||||
|
||||
$phrase_inhalt = $this->phraseslib->delPhrasentext($phrasentext_id);
|
||||
if ($phrase_inhalt->error)
|
||||
show_error($phrase_inhalt->retval);
|
||||
show_error(getError($phrase_inhalt));
|
||||
|
||||
redirect('/system/Phrases/view/'.$phrase_id);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class Phrases extends Auth_Controller
|
||||
|
||||
$phrase = $this->phraseslib->getPhrase($phrase_id);
|
||||
if ($phrase->error)
|
||||
show_error($phrase->retval);
|
||||
show_error(getError($phrase));
|
||||
|
||||
if (count($phrase->retval) != 1)
|
||||
show_error('Phrase nicht vorhanden! ID: '.$phrase_id);
|
||||
@@ -124,7 +124,7 @@ class Phrases extends Auth_Controller
|
||||
|
||||
$phrase = $this->phraseslib->savePhrase($phrase_id, $data);
|
||||
if ($phrase->error)
|
||||
show_error($phrase->retval);
|
||||
show_error(getError($phrase));
|
||||
|
||||
$phrase_id = $phrase->retval;
|
||||
|
||||
@@ -145,7 +145,7 @@ class Phrases extends Auth_Controller
|
||||
|
||||
$resultOE = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true, 'oe_parent_kurzbz' => null));
|
||||
if ($resultOE->error)
|
||||
show_error($resultOE->retval);
|
||||
show_error(getError($resultOE));
|
||||
|
||||
if (hasData($resultOE))
|
||||
{
|
||||
@@ -161,7 +161,7 @@ class Phrases extends Auth_Controller
|
||||
|
||||
$phrase_inhalt = $this->phraseslib->insertPhraseinhalt($data);
|
||||
if ($phrase_inhalt->error)
|
||||
show_error($phrase_inhalt->retval);
|
||||
show_error(getError($phrase_inhalt);
|
||||
|
||||
$phrase_inhalt_id = $phrase_inhalt->retval;
|
||||
|
||||
@@ -180,7 +180,7 @@ class Phrases extends Auth_Controller
|
||||
{
|
||||
$phrase_inhalt = $this->phraseslib->getPhrasentextById($phrasentext_id);
|
||||
if ($phrase_inhalt->error)
|
||||
show_error($phrase_inhalt->retval);
|
||||
show_error(getError($phrase_inhalt));
|
||||
|
||||
$data = $phrase_inhalt->retval[0];
|
||||
|
||||
@@ -204,7 +204,7 @@ class Phrases extends Auth_Controller
|
||||
|
||||
$phrase_inhalt = $this->phraseslib->updatePhraseInhalt($phrase_inhalt_id, $data);
|
||||
if ($phrase_inhalt->error)
|
||||
show_error($phrase_inhalt->retval);
|
||||
show_error(getError($phrase_inhalt));
|
||||
|
||||
|
||||
redirect('/system/Phrases/editText/'.$phrase_inhalt_id);
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Class Variables
|
||||
* Provides interface for managing user variables.
|
||||
*/
|
||||
class Variables extends Auth_Controller
|
||||
{
|
||||
private $_uid;
|
||||
|
||||
/**
|
||||
* Variables constructor.
|
||||
* Sets logged in user, loads models and libraries.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
array(
|
||||
'setVar' => 'basis/variable:rw',
|
||||
'getVar' => 'basis/variable:rw',
|
||||
'changeStudiensemesterVar' => 'basis/variable:rw'
|
||||
)
|
||||
);
|
||||
|
||||
$this->load->model('system/variable_model', 'VariableModel');
|
||||
|
||||
$this->_setAuthUID();
|
||||
|
||||
$this->load->library('VariableLib', array('uid' => $this->_uid));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a user variable based on received post parameters, outputs JSON response.
|
||||
*/
|
||||
public function setVar()
|
||||
{
|
||||
$name = $this->input->post('name');
|
||||
$wert = $this->input->post('wert');
|
||||
|
||||
$result = $this->VariableModel->setVariable($this->_uid, $name, $wert);
|
||||
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a user variable based on received post parameter, outputs JSON response.
|
||||
*/
|
||||
public function getVar()
|
||||
{
|
||||
$name = $this->input->get('name');
|
||||
$this->outputJson($this->VariableModel->getVariables($this->_uid, array($name)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes a user variable containing a Studiensemester based on received post parameters, outputs JSON response.
|
||||
*/
|
||||
public function changeStudiensemesterVar()
|
||||
{
|
||||
$name = $this->input->post('name');
|
||||
$change = $this->input->post('change');
|
||||
|
||||
$result = $this->variablelib->changeStudiensemesterVar($this->_uid, $name, $change);
|
||||
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the UID of the logged user and checks if it is valid
|
||||
*/
|
||||
private function _setAuthUID()
|
||||
{
|
||||
$this->_uid = getAuthUID();
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlage = $this->vorlagelib->getVorlageByMimetype($mimetype);
|
||||
|
||||
if ($vorlage->error)
|
||||
show_error($vorlage->retval);
|
||||
show_error(getError($vorlage));
|
||||
|
||||
$data = array (
|
||||
'mimetype' => $mimetype,
|
||||
@@ -66,7 +66,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlagentext = $this->vorlagelib->getVorlagetextByVorlage($vorlage_kurzbz);
|
||||
|
||||
if ($vorlagentext->error)
|
||||
show_error($vorlagentext->retval);
|
||||
show_error(getError($vorlagentext));
|
||||
|
||||
$data = array (
|
||||
'vorlage_kurzbz' => $vorlage_kurzbz,
|
||||
@@ -83,7 +83,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlage = $this->vorlagelib->getVorlage($vorlage_kurzbz);
|
||||
|
||||
if ($vorlage->error)
|
||||
show_error($vorlage->retval);
|
||||
show_error(getError($vorlage));
|
||||
|
||||
if (count($vorlage->retval) != 1)
|
||||
show_error('Nachricht nicht vorhanden! ID: '.$vorlage_kurzbz);
|
||||
@@ -119,7 +119,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlage = $this->vorlagelib->saveVorlage($vorlage_kurzbz, $data);
|
||||
|
||||
if ($vorlage->error)
|
||||
show_error($vorlage->retval);
|
||||
show_error(getError($vorlage));
|
||||
|
||||
$vorlage_kurzbz = $vorlage->retval;
|
||||
|
||||
@@ -137,7 +137,7 @@ class Vorlage extends Auth_Controller
|
||||
$resultOE = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true, 'oe_parent_kurzbz' => null));
|
||||
|
||||
if ($resultOE->error)
|
||||
show_error($resultOE->retval);
|
||||
show_error(getError($resultOE));
|
||||
|
||||
if (hasData($resultOE))
|
||||
{
|
||||
@@ -153,7 +153,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlagetext = $this->vorlagelib->insertVorlagetext($data);
|
||||
|
||||
if ($vorlagetext->error)
|
||||
show_error($vorlagetext->retval);
|
||||
show_error(getError($vorlagetext));
|
||||
|
||||
$vorlagestudiengang_id = $vorlagetext->retval;
|
||||
|
||||
@@ -170,7 +170,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlagetext = $this->vorlagelib->getVorlagetextById($vorlagestudiengang_id);
|
||||
|
||||
if ($vorlagetext->error)
|
||||
show_error($vorlagetext->retval);
|
||||
show_error(getError($vorlagetext));
|
||||
|
||||
$data = $vorlagetext->retval[0];
|
||||
|
||||
@@ -254,7 +254,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlagetext = $this->vorlagelib->updateVorlagetext($data['vorlagestudiengang_id'], $data);
|
||||
|
||||
if ($vorlagetext->error)
|
||||
show_error($vorlagetext->retval);
|
||||
show_error(getError($vorlagetext));
|
||||
|
||||
redirect('/system/vorlage/editText/'.$data['vorlagestudiengang_id']);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ class Vorlage extends Auth_Controller
|
||||
$vorlagetext = $this->vorlagelib->getVorlagetextById($vorlagestudiengang_id);
|
||||
|
||||
if ($vorlagetext->error)
|
||||
show_error($vorlagetext->retval);
|
||||
show_error(getError($vorlagetext));
|
||||
|
||||
$data = array(
|
||||
'text' => parseText($vorlagetext->retval[0]->text, $jsonDecodedForm)
|
||||
|
||||
@@ -61,7 +61,7 @@ class PrestudentMultiAssign extends Auth_Controller
|
||||
}
|
||||
else if (isError($returnUsers))
|
||||
{
|
||||
show_error($returnUsers->retval);
|
||||
show_error(getError($returnUsers));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
const FILTER_ID = 'filter_id';
|
||||
const PREV_FILTER_ID = 'prev_filter_id';
|
||||
const KEEP_TABLESORTER_FILTER = 'keepTsFilter';
|
||||
|
||||
private $_uid; // contains the UID of the logged user
|
||||
|
||||
@@ -100,9 +101,11 @@ class InfoCenter extends Auth_Controller
|
||||
'reloadNotizen' => 'infocenter:r',
|
||||
'reloadLogs' => 'infocenter:r',
|
||||
'outputAkteContent' => 'infocenter:r',
|
||||
'getParkedDate' => 'infocenter:r',
|
||||
'getPostponeDate' => 'infocenter:r',
|
||||
'park' => 'infocenter:rw',
|
||||
'unpark' => 'infocenter:rw',
|
||||
'setOnHold' => 'infocenter:rw',
|
||||
'removeOnHold' => 'infocenter:rw',
|
||||
'getStudienjahrEnd' => 'infocenter:r',
|
||||
'setNavigationMenuArrayJson' => 'infocenter:r'
|
||||
)
|
||||
@@ -136,6 +139,8 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
$this->_setAuthUID(); // sets property uid
|
||||
|
||||
$this->load->library('VariableLib', array('uid' => $this->_uid));
|
||||
|
||||
$this->setControllerId(); // sets the controller id
|
||||
}
|
||||
|
||||
@@ -188,7 +193,7 @@ class InfoCenter extends Auth_Controller
|
||||
$personexists = $this->PersonModel->load($person_id);
|
||||
|
||||
if (isError($personexists))
|
||||
show_error($personexists->retval);
|
||||
show_error(getError($personexists));
|
||||
|
||||
if (!hasData($personexists))
|
||||
show_error('Person does not exist!');
|
||||
@@ -199,8 +204,7 @@ class InfoCenter extends Auth_Controller
|
||||
// mark person as locked for editing
|
||||
$result = $this->PersonLockModel->lockPerson($person_id, $this->_uid, self::APP);
|
||||
|
||||
if (isError($result))
|
||||
show_error($result->retval);
|
||||
if (isError($result)) show_error(getError($result));
|
||||
}
|
||||
|
||||
$persondata = $this->_loadPersonData($person_id);
|
||||
@@ -226,13 +230,12 @@ class InfoCenter extends Auth_Controller
|
||||
{
|
||||
$result = $this->PersonLockModel->unlockPerson($person_id, self::APP);
|
||||
|
||||
if (isError($result))
|
||||
show_error($result->retval);
|
||||
if (isError($result)) show_error(getError($result));
|
||||
|
||||
$redirectLink = '/'.self::INFOCENTER_URI.'?'.self::FHC_CONTROLLER_ID.'='.$this->getControllerId();
|
||||
|
||||
// Force reload of Dataset after Unlock
|
||||
$redirectLink .= '&reloadDataset=true';
|
||||
$redirectLink .= '&'.self::KEEP_TABLESORTER_FILTER.'=true';
|
||||
|
||||
$currentFilterId = $this->input->get(self::FILTER_ID);
|
||||
if (isset($currentFilterId))
|
||||
@@ -659,7 +662,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($notizen))
|
||||
{
|
||||
show_error($notizen->retval);
|
||||
show_error(getError($notizen));
|
||||
}
|
||||
|
||||
$this->load->view('system/infocenter/notizen.php', array('notizen' => $notizen->retval));
|
||||
@@ -687,14 +690,14 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($akte))
|
||||
{
|
||||
show_error($akte->retval);
|
||||
show_error(getError($akte));
|
||||
}
|
||||
|
||||
$aktecontent = $this->dmslib->getAkteContent($akte_id);
|
||||
|
||||
if (isError($aktecontent))
|
||||
{
|
||||
show_error($aktecontent->retval);
|
||||
show_error(getError($aktecontent));
|
||||
}
|
||||
|
||||
$this->output
|
||||
@@ -709,11 +712,32 @@ class InfoCenter extends Auth_Controller
|
||||
* Gets the date until which a person is parked
|
||||
* @param $person_id
|
||||
*/
|
||||
public function getParkedDate($person_id)
|
||||
public function getPostponeDate($person_id)
|
||||
{
|
||||
$result = array(
|
||||
'type' => null,
|
||||
'date' => null
|
||||
);
|
||||
|
||||
$parkedDate = $this->personloglib->getParkedDate($person_id);
|
||||
|
||||
$this->outputJsonSuccess(array($parkedDate));
|
||||
if (isset($parkedDate))
|
||||
{
|
||||
$result['type'] = 'parked';
|
||||
$result['date'] = $parkedDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
$onholdDate = $this->personloglib->getOnHoldDate($person_id);
|
||||
|
||||
if (isset($onholdDate))
|
||||
{
|
||||
$result['type'] = 'onhold';
|
||||
$result['date'] = $onholdDate;
|
||||
}
|
||||
}
|
||||
|
||||
$this->outputJsonSuccess($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -741,6 +765,31 @@ class InfoCenter extends Auth_Controller
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a person on hold ("zurückstellen")
|
||||
*/
|
||||
public function setOnHold()
|
||||
{
|
||||
$person_id = $this->input->post('person_id');
|
||||
$date = $this->input->post('onholddate');
|
||||
|
||||
$result = $this->personloglib->setOnHold($person_id, date_format(date_create($date), 'Y-m-d'), self::TAETIGKEIT, self::APP, null, $this->_uid);
|
||||
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removed on hold status of a person
|
||||
*/
|
||||
public function removeOnHold()
|
||||
{
|
||||
$person_id = $this->input->post('person_id');
|
||||
|
||||
$result = $this->personloglib->removeOnHold($person_id);
|
||||
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the End date of the current Studienjahr
|
||||
*/
|
||||
@@ -891,6 +940,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
$freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE);
|
||||
$reihungstestAbsolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE);
|
||||
|
||||
$currentFilterId = $this->input->get(self::FILTER_ID);
|
||||
if (isset($currentFilterId))
|
||||
{
|
||||
@@ -948,7 +998,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
$origin_page = $this->input->get(self::ORIGIN_PAGE);
|
||||
|
||||
$link = site_url(self::INFOCENTER_URI.'/'.self::INDEX_PAGE);
|
||||
$link = site_url(self::INFOCENTER_URI);
|
||||
if ($origin_page == self::FREIGEGEBEN_PAGE)
|
||||
{
|
||||
$link = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE);
|
||||
@@ -961,7 +1011,7 @@ class InfoCenter extends Auth_Controller
|
||||
$prevFilterId = $this->input->get(self::PREV_FILTER_ID);
|
||||
if (isset($prevFilterId))
|
||||
{
|
||||
$link .= '?'.self::FILTER_ID.'='.$prevFilterId;
|
||||
$link .= '?'.self::FILTER_ID.'='.$prevFilterId.'&'.self::KEEP_TABLESORTER_FILTER.'=true';
|
||||
}
|
||||
|
||||
$this->navigationlib->setSessionMenu(
|
||||
@@ -997,7 +1047,7 @@ class InfoCenter extends Auth_Controller
|
||||
$prevFilterId = $this->input->get(self::PREV_FILTER_ID);
|
||||
if (isset($prevFilterId))
|
||||
{
|
||||
$homeLink .= '?'.self::FILTER_ID.'='.$prevFilterId;
|
||||
$homeLink .= '&'.self::FILTER_ID.'='.$prevFilterId;
|
||||
}
|
||||
|
||||
$this->navigationlib->setSessionElementMenu(
|
||||
@@ -1112,7 +1162,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($locked))
|
||||
{
|
||||
show_error($locked->retval);
|
||||
show_error(getError($locked));
|
||||
}
|
||||
|
||||
$lockedby = null;
|
||||
@@ -1131,7 +1181,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($stammdaten))
|
||||
{
|
||||
show_error($stammdaten->retval);
|
||||
show_error(getError($stammdaten));
|
||||
}
|
||||
|
||||
if (!isset($stammdaten->retval))
|
||||
@@ -1141,21 +1191,21 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($dokumente))
|
||||
{
|
||||
show_error($dokumente->retval);
|
||||
show_error(getError($dokumente));
|
||||
}
|
||||
|
||||
$dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true);
|
||||
|
||||
if (isError($dokumente_nachgereicht))
|
||||
{
|
||||
show_error($dokumente_nachgereicht->retval);
|
||||
show_error(getError($dokumente_nachgereicht));
|
||||
}
|
||||
|
||||
$messages = $this->MessageModel->getMessagesOfPerson($person_id, 1);
|
||||
|
||||
if (isError($messages))
|
||||
{
|
||||
show_error($messages->retval);
|
||||
show_error(getError($messages));
|
||||
}
|
||||
|
||||
$logs = $this->personloglib->getLogs($person_id);
|
||||
@@ -1164,21 +1214,21 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($notizen))
|
||||
{
|
||||
show_error($notizen->retval);
|
||||
show_error(getError($notizen));
|
||||
}
|
||||
|
||||
$notizen_bewerbung = $this->NotizModel->getNotizByTitel($person_id, 'Anmerkung zur Bewerbung%');
|
||||
|
||||
if (isError($notizen_bewerbung))
|
||||
{
|
||||
show_error($notizen_bewerbung->retval);
|
||||
show_error(getError($notizen_bewerbung));
|
||||
}
|
||||
|
||||
$user_person = $this->PersonModel->getByUid($this->_uid);
|
||||
|
||||
if (isError($user_person))
|
||||
{
|
||||
show_error($user_person->retval);
|
||||
show_error(getError($user_person));
|
||||
}
|
||||
|
||||
$data = array (
|
||||
@@ -1209,7 +1259,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($prestudenten))
|
||||
{
|
||||
show_error($prestudenten->retval);
|
||||
show_error(getError($prestudenten));
|
||||
}
|
||||
|
||||
foreach ($prestudenten->retval as $prestudent)
|
||||
@@ -1218,7 +1268,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($prestudentWithZgv))
|
||||
{
|
||||
show_error($prestudentWithZgv->retval);
|
||||
show_error(getError($prestudentWithZgv));
|
||||
}
|
||||
|
||||
$zgvpruefung = $prestudentWithZgv->retval[0];
|
||||
@@ -1326,13 +1376,13 @@ class InfoCenter extends Auth_Controller
|
||||
$starta = $this->StudiensemesterModel->load($a->prestudentstatus->studiensemester_kurzbz);
|
||||
if (!hasData($starta))
|
||||
{
|
||||
show_error($starta->retval);
|
||||
show_error(getError($starta));
|
||||
}
|
||||
|
||||
$startb = $this->StudiensemesterModel->load($b->prestudentstatus->studiensemester_kurzbz);
|
||||
if (!hasData($startb))
|
||||
{
|
||||
show_error($startb->retval);
|
||||
show_error(getError($startb));
|
||||
}
|
||||
|
||||
$starta = date_format(date_create($starta->retval[0]->start), 'Y-m-d');
|
||||
@@ -1404,7 +1454,7 @@ class InfoCenter extends Auth_Controller
|
||||
|
||||
if (isError($prestudent))
|
||||
{
|
||||
show_error($prestudent->retval);
|
||||
show_error(getError($prestudent));
|
||||
}
|
||||
|
||||
$person_id = $prestudent->retval[0]->person_id;
|
||||
|
||||
+41
-29
@@ -3,7 +3,7 @@
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the FiltersLib (back-end)
|
||||
* This controller operates between (interface) the JS (GUI) and the FilterWidgetLib (back-end)
|
||||
* Provides data to the ajax get calls about the filter
|
||||
* Accepts ajax post calls to change the filter data
|
||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||
@@ -12,10 +12,10 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
*/
|
||||
class Filters extends FHC_Controller
|
||||
{
|
||||
const FILTER_PAGE_PARAM = 'filter_page';
|
||||
const FILTER_UNIQUE_ID = 'filterUniqueId';
|
||||
|
||||
/**
|
||||
* Calls the parent's constructor and loads the FiltersLib
|
||||
* Calls the parent's constructor and loads the FilterWidgetLib
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -24,8 +24,8 @@ class Filters extends FHC_Controller
|
||||
// Loads authentication library and starts authentication
|
||||
$this->load->library('AuthLib');
|
||||
|
||||
// Loads the FiltersLib with HTTP GET/POST parameters
|
||||
$this->_loadFiltersLib();
|
||||
// Loads the FilterWidgetLib with HTTP GET/POST parameters
|
||||
$this->_loadFilterWidgetLib();
|
||||
|
||||
// Checks if the caller is allow to read this data
|
||||
$this->_isAllowed();
|
||||
@@ -39,7 +39,7 @@ class Filters extends FHC_Controller
|
||||
*/
|
||||
public function getFilter()
|
||||
{
|
||||
$this->outputJsonSuccess($this->filterslib->getSession());
|
||||
$this->outputJsonSuccess($this->filterwidgetlib->getSession());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ class Filters extends FHC_Controller
|
||||
public function rowNumber()
|
||||
{
|
||||
$rowNumber = 0;
|
||||
$dataset = $this->filterslib->getSessionElement(FiltersLib::SESSION_DATASET);
|
||||
$dataset = $this->filterwidgetlib->getSessionElement(FilterWidgetLib::SESSION_DATASET);
|
||||
|
||||
if (isset($dataset) && is_array($dataset))
|
||||
{
|
||||
@@ -66,7 +66,7 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
$selectedFields = $this->input->post('selectedFields');
|
||||
|
||||
if ($this->filterslib->sortSelectedFields($selectedFields) == true)
|
||||
if ($this->filterwidgetlib->sortSelectedFields($selectedFields) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
@@ -84,7 +84,7 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
$selectedField = $this->input->post('selectedField');
|
||||
|
||||
if ($this->filterslib->removeSelectedField($selectedField) == true)
|
||||
if ($this->filterwidgetlib->removeSelectedField($selectedField) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
$selectedField = $this->input->post('selectedField');
|
||||
|
||||
if ($this->filterslib->addSelectedField($selectedField) == true)
|
||||
if ($this->filterwidgetlib->addSelectedField($selectedField) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
@@ -118,7 +118,7 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
$appliedFilter = $this->input->post('appliedFilter');
|
||||
|
||||
if ($this->filterslib->removeAppliedFilter($appliedFilter) == true)
|
||||
if ($this->filterwidgetlib->removeAppliedFilter($appliedFilter) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Removed');
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class Filters extends FHC_Controller
|
||||
$appliedFiltersConditions = $this->input->post('appliedFiltersConditions');
|
||||
$appliedFiltersOptions = $this->input->post('appliedFiltersOptions');
|
||||
|
||||
if ($this->filterslib->applyFilters(
|
||||
if ($this->filterwidgetlib->applyFilters(
|
||||
$appliedFilters,
|
||||
$appliedFiltersOperations,
|
||||
$appliedFiltersConditions,
|
||||
@@ -160,7 +160,7 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
$filter = $this->input->post('filter');
|
||||
|
||||
if ($this->filterslib->addFilter($filter) == true)
|
||||
if ($this->filterwidgetlib->addFilter($filter) == true)
|
||||
{
|
||||
$this->getFilter();
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
$customFilterDescription = $this->input->post('customFilterDescription');
|
||||
|
||||
if ($this->filterslib->saveCustomFilter($customFilterDescription) == true)
|
||||
if ($this->filterwidgetlib->saveCustomFilter($customFilterDescription) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Saved');
|
||||
}
|
||||
@@ -194,7 +194,7 @@ class Filters extends FHC_Controller
|
||||
{
|
||||
$filter_id = $this->input->post('filter_id');
|
||||
|
||||
if ($this->filterslib->removeCustomFilter($filter_id) == true)
|
||||
if ($this->filterwidgetlib->removeCustomFilter($filter_id) == true)
|
||||
{
|
||||
$this->outputJsonSuccess('Removed');
|
||||
}
|
||||
@@ -211,7 +211,17 @@ class Filters extends FHC_Controller
|
||||
public function setNavigationMenu()
|
||||
{
|
||||
// Generates the filters structure array
|
||||
$filterMenu = $this->filterslib->generateFilterMenu($this->input->get(FiltersLib::NAVIGATION_PAGE));
|
||||
$filterMenu = $this->filterwidgetlib->generateFilterMenu($this->input->get(FilterWidgetLib::NAVIGATION_PAGE));
|
||||
|
||||
$this->outputJsonSuccess('Success');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the dataset
|
||||
*/
|
||||
public function reloadDataset()
|
||||
{
|
||||
$this->filterwidgetlib->reloadDataset();
|
||||
|
||||
$this->outputJsonSuccess('Success');
|
||||
}
|
||||
@@ -224,38 +234,40 @@ class Filters extends FHC_Controller
|
||||
*/
|
||||
private function _isAllowed()
|
||||
{
|
||||
if (!$this->filterslib->isAllowed())
|
||||
if (!$this->filterwidgetlib->isAllowed())
|
||||
{
|
||||
$this->terminateWithJsonError('You are not allowed to access to this content');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the FiltersLib with the FILTER_PAGE_PARAM parameter
|
||||
* If the parameter FILTER_PAGE_PARAM is not given then the execution of the controller is terminated and
|
||||
* Loads the FilterWidgetLib with the FILTER_UNIQUE_ID parameter
|
||||
* If the parameter FILTER_UNIQUE_ID is not given then the execution of the controller is terminated and
|
||||
* an error message is printed
|
||||
*/
|
||||
private function _loadFiltersLib()
|
||||
private function _loadFilterWidgetLib()
|
||||
{
|
||||
// If the parameter FILTER_PAGE_PARAM is present in the HTTP GET or POST
|
||||
if (isset($_GET[self::FILTER_PAGE_PARAM]) || isset($_POST[self::FILTER_PAGE_PARAM]))
|
||||
// If the parameter FILTER_UNIQUE_ID is present in the HTTP GET or POST
|
||||
if (isset($_GET[self::FILTER_UNIQUE_ID]) || isset($_POST[self::FILTER_UNIQUE_ID]))
|
||||
{
|
||||
// If it is present in the HTTP GET
|
||||
if (isset($_GET[self::FILTER_PAGE_PARAM]))
|
||||
if (isset($_GET[self::FILTER_UNIQUE_ID]))
|
||||
{
|
||||
$filterPage = $this->input->get(self::FILTER_PAGE_PARAM); // is retrieved from the HTTP GET
|
||||
$filterUniqueId = $this->input->get(self::FILTER_UNIQUE_ID); // is retrieved from the HTTP GET
|
||||
}
|
||||
elseif (isset($_POST[self::FILTER_PAGE_PARAM])) // Else if it is present in the HTTP POST
|
||||
elseif (isset($_POST[self::FILTER_UNIQUE_ID])) // Else if it is present in the HTTP POST
|
||||
{
|
||||
$filterPage = $this->input->post(self::FILTER_PAGE_PARAM); // is retrieved from the HTTP POST
|
||||
$filterUniqueId = $this->input->post(self::FILTER_UNIQUE_ID); // is retrieved from the HTTP POST
|
||||
}
|
||||
|
||||
// Loads the FiltersLib that contains all the used logic
|
||||
$this->load->library('FiltersLib', array(self::FILTER_PAGE_PARAM => $filterPage));
|
||||
// Loads the FilterWidgetLib that contains all the used logic
|
||||
$this->load->library('FilterWidgetLib');
|
||||
|
||||
$this->filterwidgetlib->setFilterUniqueId($filterUniqueId);
|
||||
}
|
||||
else // Otherwise an error will be written in the output
|
||||
{
|
||||
$this->terminateWithJsonError('Parameter "'.self::FILTER_PAGE_PARAM.'" not provided!');
|
||||
$this->terminateWithJsonError('Parameter "'.self::FILTER_UNIQUE_ID.'" not provided!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* This controller operates between (interface) the JS (GUI) and the tablewidgetlib (back-end)
|
||||
* Provides data to the ajax get calls about the filter
|
||||
* Accepts ajax post calls to change the filter data
|
||||
* This controller works with JSON calls on the HTTP GET or POST and the output is always JSON
|
||||
* NOTE: extends the FHC_Controller instead of the Auth_Controller because the TableWidget has its
|
||||
* own permissions check
|
||||
*/
|
||||
class Tables extends FHC_Controller
|
||||
{
|
||||
const TABLE_UNIQUE_ID = 'tableUniqueId';
|
||||
|
||||
/**
|
||||
* Calls the parent's constructor and loads the tablewidgetlib
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads authentication library and starts authentication
|
||||
$this->load->library('AuthLib');
|
||||
|
||||
// Loads the tablewidgetlib with HTTP GET/POST parameters
|
||||
$this->_loadTableWidgetLib();
|
||||
|
||||
// Checks if the caller is allow to read this data
|
||||
$this->_isAllowed();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Retrieves data about the current filter from the session and will be written on the output in JSON format
|
||||
*/
|
||||
public function getTable()
|
||||
{
|
||||
$this->outputJsonSuccess($this->tablewidgetlib->getSession());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the number of records present in the current dataset and will be written on the output in JSON format
|
||||
*/
|
||||
public function rowNumber()
|
||||
{
|
||||
$rowNumber = 0;
|
||||
$dataset = $this->tablewidgetlib->getSessionElement(TableWidgetLib::SESSION_DATASET);
|
||||
|
||||
if (isset($dataset) && is_array($dataset))
|
||||
{
|
||||
$rowNumber = count($dataset);
|
||||
}
|
||||
|
||||
$this->outputJsonSuccess($rowNumber);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Checks if the user is allowed to use this filter
|
||||
*/
|
||||
private function _isAllowed()
|
||||
{
|
||||
if (!$this->tablewidgetlib->isAllowed())
|
||||
{
|
||||
$this->terminateWithJsonError('You are not allowed to access to this content');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the tablewidgetlib with the TABLE_UNIQUE_ID parameter
|
||||
* If the parameter TABLE_UNIQUE_ID is not given then the execution of the controller is terminated and
|
||||
* an error message is printed
|
||||
*/
|
||||
private function _loadTableWidgetLib()
|
||||
{
|
||||
// If the parameter TABLE_UNIQUE_ID is present in the HTTP GET or POST
|
||||
if (isset($_GET[self::TABLE_UNIQUE_ID]) || isset($_POST[self::TABLE_UNIQUE_ID]))
|
||||
{
|
||||
// If it is present in the HTTP GET
|
||||
if (isset($_GET[self::TABLE_UNIQUE_ID]))
|
||||
{
|
||||
$tableUniqueId = $this->input->get(self::TABLE_UNIQUE_ID); // is retrieved from the HTTP GET
|
||||
}
|
||||
elseif (isset($_POST[self::TABLE_UNIQUE_ID])) // Else if it is present in the HTTP POST
|
||||
{
|
||||
$tableUniqueId = $this->input->post(self::TABLE_UNIQUE_ID); // is retrieved from the HTTP POST
|
||||
}
|
||||
|
||||
// Loads the tablewidgetlib that contains all the used logic
|
||||
$this->load->library('TableWidgetLib');
|
||||
|
||||
$this->tablewidgetlib->setTableUniqueId($tableUniqueId);
|
||||
}
|
||||
else // Otherwise an error will be written in the output
|
||||
{
|
||||
$this->terminateWithJsonError('Parameter "'.self::TABLE_UNIQUE_ID.'" not provided!');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* REST_Controller takes care about authentication and it loads the AuthLib
|
||||
*
|
||||
*/
|
||||
class APIv1_Controller extends REST_Controller
|
||||
abstract class APIv1_Controller extends RESTFul_Controller
|
||||
{
|
||||
private $_requiredPermissions;
|
||||
|
||||
@@ -21,13 +23,14 @@ class APIv1_Controller extends REST_Controller
|
||||
|
||||
/**
|
||||
* This method is automatically called by CodeIgniter after the execution of the constructor is completed
|
||||
* - Cheks if the AuthLib was loaded, if not it means that the authentication failed
|
||||
* - Cheks if the Authlib was loaded, if not it means that the authentication failed
|
||||
* - Loads the permsission lib and calls permissionlib->isEntitled
|
||||
* - Checks if the caller is allowed to access to this content with the given permissions
|
||||
* if it is not allowed will set the HTTP header with code 401
|
||||
* - Calls the parent (REST_Controller) _remap method to performs other checks
|
||||
* NOTE: this methods override the parent method!!!
|
||||
*/
|
||||
public function _remap($object_called, $arguments)
|
||||
public function _remap($object_called, $arguments = [])
|
||||
{
|
||||
if (isset($this->authlib)) // if set then the authentication is ok
|
||||
{
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Auth_Controller extends FHC_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Auth_Controller extends FHC_Controller
|
||||
{
|
||||
/**
|
||||
* Extends this controller if authentication is required
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class CLI_Controller extends FHC_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class CLI_Controller extends FHC_Controller
|
||||
{
|
||||
const INFO_FORMAT = '%s %s %s %s'; // Info message format
|
||||
const REQUIRED_PARAM_FORMAT = ' %s'; // Info message required method parameter format
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DB_Model extends CI_Model
|
||||
{
|
||||
// Default schema used by the models
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class FHC_Controller extends CI_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class FHC_Controller extends CI_Controller
|
||||
{
|
||||
const FHC_CONTROLLER_ID = 'fhc_controller_id'; // name of the parameter used to identify uniquely a call to a controller
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<?php
|
||||
|
||||
class FS_Model extends CI_Model
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class FS_Model extends CI_Model
|
||||
{
|
||||
protected $filepath; // Path of the file
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class JOB_Controller extends CLI_Controller
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads LogLib with different debug trace levels to get data of the job that extends this class
|
||||
// It also specify parameters to set database fields
|
||||
$this->load->library('LogLib', array(
|
||||
'classIndex' => 5,
|
||||
'functionIndex' => 5,
|
||||
'lineIndex' => 4,
|
||||
'dbLogType' => 'job', // required
|
||||
'dbExecuteUser' => 'Cronjob system'
|
||||
));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Protected methods
|
||||
|
||||
/**
|
||||
* Writes a cronjob info log
|
||||
*/
|
||||
protected function logInfo($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::INFO, 'Cronjob info', $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a cronjob debug log
|
||||
*/
|
||||
protected function logDebug($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::DEBUG, 'Cronjob debug', $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a cronjob warning log
|
||||
*/
|
||||
protected function logWarning($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::WARNING, 'Cronjob warning', $response, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a cronjob error log
|
||||
*/
|
||||
protected function logError($response, $parameters = null)
|
||||
{
|
||||
$this->_log(LogLib::ERROR, 'Cronjob error', $response, $parameters);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Writes a log to database
|
||||
*/
|
||||
private function _log($level, $requestId, $response, $parameters)
|
||||
{
|
||||
$data = new stdClass();
|
||||
|
||||
$data->response = $response;
|
||||
if ($parameters != null) $data->parameters = $parameters;
|
||||
|
||||
switch($level)
|
||||
{
|
||||
case LogLib::INFO:
|
||||
$this->loglib->logInfoDB($requestId, json_encode(success($data, LogLib::INFO)));
|
||||
break;
|
||||
case LogLib::DEBUG:
|
||||
$this->loglib->logDebugDB($requestId, json_encode(success($data, LogLib::DEBUG)));
|
||||
break;
|
||||
case LogLib::WARNING:
|
||||
$this->loglib->logWarningDB($requestId, json_encode(error($data, LogLib::WARNING)));
|
||||
break;
|
||||
case LogLib::ERROR:
|
||||
$this->loglib->logErrorDB($requestId, json_encode(error($data, LogLib::ERROR)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* NOTE: this class overrides parent's methods and properties
|
||||
*/
|
||||
class RESTFul_Controller extends REST_Controller
|
||||
{
|
||||
protected $is_valid_request = TRUE; // Change the accessibility of this property
|
||||
|
||||
/**
|
||||
* Totally overriden
|
||||
*/
|
||||
protected function early_checks()
|
||||
{
|
||||
// Loads helper message to manage returning messages
|
||||
$this->load->helper('hlp_return_object');
|
||||
|
||||
// Loads helper session to manage the php session
|
||||
$this->load->helper('hlp_session');
|
||||
|
||||
// Loads helper with generic utility function
|
||||
$this->load->helper('hlp_common');
|
||||
}
|
||||
|
||||
/**
|
||||
* Totally overrode parent's _perform_library_auth method to keep file and class name
|
||||
* for AuthLib and to call AuthLib with the extra parameter
|
||||
*/
|
||||
protected function _perform_library_auth($username = '', $password = NULL)
|
||||
{
|
||||
if (empty($username))
|
||||
{
|
||||
log_message('error', 'Library Auth: Failure, empty username');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$auth_library_class = $this->config->item('auth_library_class');
|
||||
$auth_library_function = $this->config->item('auth_library_function');
|
||||
|
||||
if (empty($auth_library_class))
|
||||
{
|
||||
log_message('debug', 'Library Auth: Failure, empty auth_library_class');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (empty($auth_library_function))
|
||||
{
|
||||
log_message('debug', 'Library Auth: Failure, empty auth_library_function');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (is_callable([$auth_library_class, $auth_library_function]) === FALSE)
|
||||
{
|
||||
$this->load->library($auth_library_class, array(false));
|
||||
}
|
||||
|
||||
return $this->{strtolower($auth_library_class)}->$auth_library_function($username, $password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Totally overrode parent's _remap method to change the naming convention of controllers methods
|
||||
*/
|
||||
public function _remap($object_called, $arguments = [])
|
||||
{
|
||||
// Should we answer if not over SSL?
|
||||
if ($this->config->item('force_https') && $this->request->ssl === FALSE)
|
||||
{
|
||||
$this->response([
|
||||
$this->config->item('rest_status_field_name') => FALSE,
|
||||
$this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unsupported')
|
||||
], self::HTTP_FORBIDDEN);
|
||||
|
||||
$this->is_valid_request = false;
|
||||
}
|
||||
|
||||
// Remove the supported format from the function name e.g. index.json => index
|
||||
$object_called = preg_replace('/^(.*)\.(?:'.implode('|', array_keys($this->_supported_formats)).')$/', '$1', $object_called);
|
||||
|
||||
// NOTE: START changes
|
||||
$controller_method = $object_called.'_'.$this->request->method; // Method name fallback
|
||||
// If the config entry rest_methods_name_format is provided and is not empty then use it to produce the method name
|
||||
if (!empty($this->config->item('rest_methods_name_format')))
|
||||
{
|
||||
$controller_method = sprintf($this->config->item('rest_methods_name_format'), $object_called, $this->request->method);
|
||||
}
|
||||
// END changes
|
||||
|
||||
// Does this method exist? If not, try executing an index method
|
||||
if (!method_exists($this, $controller_method)) {
|
||||
$controller_method = "index_" . $this->request->method;
|
||||
array_unshift($arguments, $object_called);
|
||||
}
|
||||
|
||||
// Do we want to log this method (if allowed by config)?
|
||||
$log_method = ! (isset($this->methods[$controller_method]['log']) && $this->methods[$controller_method]['log'] === FALSE);
|
||||
|
||||
// Use keys for this method?
|
||||
$use_key = ! (isset($this->methods[$controller_method]['key']) && $this->methods[$controller_method]['key'] === FALSE);
|
||||
|
||||
// They provided a key, but it wasn't valid, so get them out of here
|
||||
if ($this->config->item('rest_enable_keys') && $use_key && $this->_allow === FALSE)
|
||||
{
|
||||
if ($this->config->item('rest_enable_logging') && $log_method)
|
||||
{
|
||||
$this->_log_request();
|
||||
}
|
||||
|
||||
// fix cross site to option request error
|
||||
if($this->request->method == 'options') {
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->response([
|
||||
$this->config->item('rest_status_field_name') => FALSE,
|
||||
$this->config->item('rest_message_field_name') => sprintf($this->lang->line('text_rest_invalid_api_key'), $this->rest->key)
|
||||
], self::HTTP_FORBIDDEN);
|
||||
|
||||
$this->is_valid_request = false;
|
||||
}
|
||||
|
||||
// Check to see if this key has access to the requested controller
|
||||
if ($this->config->item('rest_enable_keys') && $use_key && empty($this->rest->key) === FALSE && $this->_check_access() === FALSE)
|
||||
{
|
||||
if ($this->config->item('rest_enable_logging') && $log_method)
|
||||
{
|
||||
$this->_log_request();
|
||||
}
|
||||
|
||||
$this->response([
|
||||
$this->config->item('rest_status_field_name') => FALSE,
|
||||
$this->config->item('rest_message_field_name') => $this->lang->line('text_rest_api_key_unauthorized')
|
||||
], self::HTTP_UNAUTHORIZED);
|
||||
|
||||
$this->is_valid_request = false;
|
||||
}
|
||||
|
||||
// Sure it exists, but can they do anything with it?
|
||||
if (! method_exists($this, $controller_method))
|
||||
{
|
||||
$this->response([
|
||||
$this->config->item('rest_status_field_name') => FALSE,
|
||||
$this->config->item('rest_message_field_name') => $this->lang->line('text_rest_unknown_method')
|
||||
], self::HTTP_METHOD_NOT_ALLOWED);
|
||||
|
||||
$this->is_valid_request = false;
|
||||
}
|
||||
|
||||
// Doing key related stuff? Can only do it if they have a key right?
|
||||
if ($this->config->item('rest_enable_keys') && empty($this->rest->key) === FALSE)
|
||||
{
|
||||
// Check the limit
|
||||
if ($this->config->item('rest_enable_limits') && $this->_check_limit($controller_method) === FALSE)
|
||||
{
|
||||
$response = [$this->config->item('rest_status_field_name') => FALSE, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_api_key_time_limit')];
|
||||
$this->response($response, self::HTTP_UNAUTHORIZED);
|
||||
|
||||
$this->is_valid_request = false;
|
||||
}
|
||||
|
||||
// If no level is set use 0, they probably aren't using permissions
|
||||
$level = isset($this->methods[$controller_method]['level']) ? $this->methods[$controller_method]['level'] : 0;
|
||||
|
||||
// If no level is set, or it is lower than/equal to the key's level
|
||||
$authorized = $level <= $this->rest->level;
|
||||
// IM TELLIN!
|
||||
if ($this->config->item('rest_enable_logging') && $log_method)
|
||||
{
|
||||
$this->_log_request($authorized);
|
||||
}
|
||||
if($authorized === FALSE)
|
||||
{
|
||||
// They don't have good enough perms
|
||||
$response = [$this->config->item('rest_status_field_name') => FALSE, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_api_key_permissions')];
|
||||
$this->response($response, self::HTTP_UNAUTHORIZED);
|
||||
|
||||
$this->is_valid_request = false;
|
||||
}
|
||||
}
|
||||
|
||||
//check request limit by ip without login
|
||||
elseif ($this->config->item('rest_limits_method') == "IP_ADDRESS" && $this->config->item('rest_enable_limits') && $this->_check_limit($controller_method) === FALSE)
|
||||
{
|
||||
$response = [$this->config->item('rest_status_field_name') => FALSE, $this->config->item('rest_message_field_name') => $this->lang->line('text_rest_ip_address_time_limit')];
|
||||
$this->response($response, self::HTTP_UNAUTHORIZED);
|
||||
|
||||
$this->is_valid_request = false;
|
||||
}
|
||||
|
||||
// No key stuff, but record that stuff is happening
|
||||
elseif ($this->config->item('rest_enable_logging') && $log_method)
|
||||
{
|
||||
$this->_log_request($authorized = TRUE);
|
||||
}
|
||||
|
||||
// Call the controller method and passed arguments
|
||||
try
|
||||
{
|
||||
if ($this->is_valid_request) {
|
||||
call_user_func_array([$this, $controller_method], $arguments);
|
||||
}
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
if ($this->config->item('rest_handle_exceptions') === FALSE) {
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
// If the method doesn't exist, then the error will be caught and an error response shown
|
||||
$_error = &load_class('Exceptions', 'core');
|
||||
$_error->show_exception($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,13 +46,16 @@ function generateCSSsInclude($CSSs)
|
||||
{
|
||||
$cssLink = '<link rel="stylesheet" type="text/css" href="%s" />';
|
||||
|
||||
$ci =& get_instance();
|
||||
$cachetoken = '?'.$ci->config->item('fhcomplete_build_version');
|
||||
|
||||
if (isset($CSSs))
|
||||
{
|
||||
$tmpCSSs = is_array($CSSs) ? $CSSs : array($CSSs);
|
||||
|
||||
for ($tmpCSSsCounter = 0; $tmpCSSsCounter < count($tmpCSSs); $tmpCSSsCounter++)
|
||||
{
|
||||
$toPrint = sprintf($cssLink, base_url($tmpCSSs[$tmpCSSsCounter])).PHP_EOL;
|
||||
$toPrint = sprintf($cssLink, base_url($tmpCSSs[$tmpCSSsCounter]).$cachetoken).PHP_EOL;
|
||||
|
||||
if ($tmpCSSsCounter > 0) $toPrint = "\t\t".$toPrint;
|
||||
|
||||
@@ -108,13 +111,16 @@ function generateJSsInclude($JSs)
|
||||
{
|
||||
$jsInclude = '<script type="text/javascript" src="%s"></script>';
|
||||
|
||||
$ci =& get_instance();
|
||||
$cachetoken = '?'.$ci->config->item('fhcomplete_build_version');
|
||||
|
||||
if (isset($JSs))
|
||||
{
|
||||
$tmpJSs = is_array($JSs) ? $JSs : array($JSs);
|
||||
|
||||
for ($tmpJSsCounter = 0; $tmpJSsCounter < count($tmpJSs); $tmpJSsCounter++)
|
||||
{
|
||||
$toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter])).PHP_EOL;
|
||||
$toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter].$cachetoken)).PHP_EOL;
|
||||
|
||||
if ($tmpJSsCounter > 0) $toPrint = "\t\t".$toPrint;
|
||||
|
||||
|
||||
@@ -125,3 +125,18 @@ function getCode($result)
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the property retval if present, otherwise null
|
||||
*/
|
||||
function getError($result)
|
||||
{
|
||||
$error = null;
|
||||
|
||||
if (isset($result->retval))
|
||||
{
|
||||
$error = $result->retval;
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* English language
|
||||
*/
|
||||
|
||||
$lang['text_rest_invalid_api_key'] = 'Invalid API key %s'; // %s is the REST API key
|
||||
$lang['text_rest_invalid_credentials'] = 'Invalid credentials';
|
||||
$lang['text_rest_ip_denied'] = 'IP denied';
|
||||
$lang['text_rest_ip_unauthorized'] = 'IP unauthorized';
|
||||
$lang['text_rest_unauthorized'] = 'Unauthorized';
|
||||
$lang['text_rest_ajax_only'] = 'Only AJAX requests are allowed';
|
||||
$lang['text_rest_api_key_unauthorized'] = 'This API key does not have access to the requested controller';
|
||||
$lang['text_rest_api_key_permissions'] = 'This API key does not have enough permissions';
|
||||
$lang['text_rest_api_key_time_limit'] = 'This API key has reached the time limit for this method';
|
||||
$lang['text_rest_unknown_method'] = 'Unknown method';
|
||||
$lang['text_rest_unsupported'] = 'Unsupported protocol';
|
||||
@@ -378,7 +378,8 @@ class AuthLib
|
||||
}
|
||||
else // otherwise
|
||||
{
|
||||
$hta = $this->_createAuthObjByPerson(array('uid' => $_SERVER['PHP_AUTH_USER']));
|
||||
// NOTE: Username needs to be trimmed and lowered because htaccess is allowing login
|
||||
$hta = $this->_createAuthObjByPerson(array('uid' => mb_strtolower(trim($_SERVER['PHP_AUTH_USER']))));
|
||||
}
|
||||
|
||||
// Invalid credentials
|
||||
@@ -390,7 +391,7 @@ class AuthLib
|
||||
}
|
||||
elseif (isError($hta)) // display error and stop execution
|
||||
{
|
||||
$this->_showError(getData($hta));
|
||||
$this->_showError(getError($hta));
|
||||
}
|
||||
|
||||
return $hta; // if success then is returned!
|
||||
@@ -550,7 +551,7 @@ class AuthLib
|
||||
}
|
||||
elseif (isError($auth)) // blocking error
|
||||
{
|
||||
$this->_showError(getData($auth)); // display a generic error message and logs the occurred error
|
||||
$this->_showError(getError($auth)); // display a generic error message and logs the occurred error
|
||||
}
|
||||
}
|
||||
// else the user is already logged, then loads authentication helper and continue with the execution
|
||||
@@ -574,10 +575,11 @@ class AuthLib
|
||||
|
||||
// Needed information
|
||||
$this->_ci->PersonModel->addSelect('person_id, vorname, nachname, uid');
|
||||
// Retrieves the uid if it is possible
|
||||
$this->_ci->PersonModel->addJoin('public.tbl_benutzer', 'person_id', 'LEFT');
|
||||
|
||||
$queryParamsArray['tbl_person.aktiv'] = true; // only active users!
|
||||
// Retrieves the uid if it is possible for active users
|
||||
$this->_ci->PersonModel->addJoin(
|
||||
'(SELECT uid, person_id FROM public.tbl_benutzer WHERE aktiv = TRUE) tb', 'person_id',
|
||||
'LEFT'
|
||||
);
|
||||
|
||||
// Execute query with where clause
|
||||
$personResult = $this->_ci->PersonModel->loadWhere($queryParamsArray);
|
||||
|
||||
@@ -1,361 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Library used to call a method of a model or a library
|
||||
*/
|
||||
class CallerLib
|
||||
{
|
||||
const RESOURCE_PARAMETER = 'resource';
|
||||
const FUNCTION_PARAMETER = 'function';
|
||||
const REG_SPLIT_EXPR = '/\//';
|
||||
const LIB_PREFIX = 'Lib';
|
||||
const LIB_FILE_EXTENSION = '.php';
|
||||
const LIBS_PATH = 'libraries';
|
||||
const MODEL_PREFIX = '_model';
|
||||
|
||||
// Black list of resources that are no allowed to be used
|
||||
private static $RESOURCES_BLACK_LIST = array(
|
||||
'CallerLib', // disabled self loading
|
||||
'LogLib', // hardly usefull and virtually dangerous
|
||||
'MigrationLib', // virtually dangerous, DB manipulation
|
||||
'FilesystemLib', // virtually dangerous, direct access to file system
|
||||
'PermissionLib', // usefull?
|
||||
'PersonLogLib'
|
||||
);
|
||||
|
||||
private $_ci; // CI instance
|
||||
|
||||
/**
|
||||
* Library initialization
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_ci =& get_instance(); // Gets CI instance
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method for _call
|
||||
*/
|
||||
public function callLibrary($callParameters)
|
||||
{
|
||||
return $this->_call($callParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method for _call
|
||||
*/
|
||||
public function callModel($callParameters)
|
||||
{
|
||||
return $this->_call($callParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Everything starts here...
|
||||
*/
|
||||
private function _call($callParameters)
|
||||
{
|
||||
$result = null;
|
||||
$parameters = $this->_getParameters($callParameters);
|
||||
$validation = $this->_validateCall($parameters);
|
||||
|
||||
// If the validation was passed
|
||||
if (isSuccess($validation))
|
||||
{
|
||||
$loaded = null;
|
||||
// If the given resource is a model
|
||||
if (strpos($parameters->resourceName, CallerLib::MODEL_PREFIX) !== false)
|
||||
{
|
||||
// Try to load the model
|
||||
$result = $this->_loadModel($parameters->resourcePath, $parameters->resourceName);
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$loaded = $result->retval;
|
||||
}
|
||||
}
|
||||
// If the given resource is a library
|
||||
elseif (strpos($parameters->resourceName, CallerLib::LIB_PREFIX) !== false)
|
||||
{
|
||||
// Check if the resource is already loaded, it works only with libraries and drivers
|
||||
$isLoaded = $this->_ci->load->is_loaded($parameters->resourceName);
|
||||
// If not loaded then load it
|
||||
if ($isLoaded === false)
|
||||
{
|
||||
// Try to load the library
|
||||
$result = $this->_loadLibrary($parameters->resourcePath, $parameters->resourceName);
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$loaded = $result->retval;
|
||||
}
|
||||
}
|
||||
// If it is already loaded $isLoaded contains the instance of the library
|
||||
else
|
||||
{
|
||||
$loaded = $isLoaded;
|
||||
}
|
||||
}
|
||||
// Wrong selection!
|
||||
else
|
||||
{
|
||||
$result = error('Neither a lib nor model: '.$parameters->resourcePath.$parameters->resourceName);
|
||||
}
|
||||
|
||||
// If the resource was found and loaded
|
||||
if (!is_null($loaded))
|
||||
{
|
||||
$result = $this->_callThis($parameters->resourceName, $parameters->function, $parameters->parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Resource not loaded
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $validation;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parameters from the http call
|
||||
* Search for parameters <RESOURCE_PARAMETER> and <FUNCTION_PARAMETER>
|
||||
* <RESOURCE_PARAMETER> is the name of the model or of the library
|
||||
* <FUNCTION_PARAMETER> is the name of the method present in the model/library
|
||||
* All the others parameters will be given to the method in the same order that
|
||||
* they are present in the HTTP call
|
||||
* EX:
|
||||
* URL: ../system/CallerLibrary/Call?resource=<resource>&function=<method>&<par1>=<val1>&<par2>=<val2>&<par3>=<val3>
|
||||
* will call <resource>.<method>(par1, par2, par3)
|
||||
*/
|
||||
private function _getParameters($parametersArray)
|
||||
{
|
||||
$parameters = new stdClass();
|
||||
$parameters->parameters = array();
|
||||
$count = 0;
|
||||
|
||||
foreach ($parametersArray as $parameterName => $parameterValue)
|
||||
{
|
||||
// The name of the resource, path included
|
||||
if ($parameterName == CallerLib::RESOURCE_PARAMETER)
|
||||
{
|
||||
// Separates the resource path from the resource name
|
||||
$splittedResource = preg_split(CallerLib::REG_SPLIT_EXPR, $parameterValue);
|
||||
$parameters->resourceName = $splittedResource[count($splittedResource) - 1];
|
||||
$parameters->resourcePath = str_replace($parameters->resourceName, '', $parameterValue);
|
||||
}
|
||||
// The name of the function
|
||||
elseif ($parameterName == CallerLib::FUNCTION_PARAMETER)
|
||||
{
|
||||
$parameters->function = $parameterValue;
|
||||
}
|
||||
// It is assumed that all other parameters are the parameters to be passed to the function
|
||||
// They will be passed to the function in the same order in which they are passed to
|
||||
// this controller
|
||||
else
|
||||
{
|
||||
$parameters->parameters[$count++] = $parameterValue;
|
||||
}
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the given parameters
|
||||
*/
|
||||
private function _validateCall($parameters)
|
||||
{
|
||||
if (!is_object($parameters))
|
||||
{
|
||||
return error('Parameter is not an object');
|
||||
}
|
||||
if (!isset($parameters->resourcePath))
|
||||
{
|
||||
return error('Resource path is not specified');
|
||||
}
|
||||
if (!isset($parameters->resourceName))
|
||||
{
|
||||
return error('Resource name is not specified');
|
||||
}
|
||||
if (!isset($parameters->function))
|
||||
{
|
||||
return error('Function is not specified');
|
||||
}
|
||||
if (!is_array($parameters->parameters))
|
||||
{
|
||||
return error('Parameters are not specified');
|
||||
}
|
||||
if (in_array($parameters->resourceName, CallerLib::$RESOURCES_BLACK_LIST))
|
||||
{
|
||||
return error('You are trying to access to unauthorized resources');
|
||||
}
|
||||
|
||||
return success('Input data are valid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a model using the given path and name
|
||||
*
|
||||
* NOTE: the models automatically handle the permissions
|
||||
*/
|
||||
private function _loadModel($resourcePath, $resourceName)
|
||||
{
|
||||
$loaded = null;
|
||||
$result = null;
|
||||
|
||||
try
|
||||
{
|
||||
$loaded = $this->_ci->load->model($resourcePath.$resourceName);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
// Errors while loading the model
|
||||
$result = error('Errors while loading the model: '.$e->getMessage());
|
||||
}
|
||||
|
||||
if (!is_null($loaded))
|
||||
{
|
||||
$result = success($loaded);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a library using the given path and name
|
||||
*
|
||||
* The method 'library' of the class CI_Loader provided by CI has some limitations,
|
||||
* so to be able to check errors was used a workaround.
|
||||
* It consists in:
|
||||
* - Checking if the file (identified by parameters $resourcePath and $resourceName) exists
|
||||
* - If exists it will be loaded using the method 'file' from CI_Loader
|
||||
* - Checks if the loaded file contains a class identified by parameter $resourceName
|
||||
*
|
||||
* If one of the previous tests fails, it will be returned a null value
|
||||
*/
|
||||
private function _loadLibrary($resourcePath, $resourceName)
|
||||
{
|
||||
$loaded = null;
|
||||
|
||||
try
|
||||
{
|
||||
// Gets all the configured resources paths
|
||||
$packagePaths = $this->_ci->load->get_package_paths();
|
||||
// Looking for a file in every paths with the same name of the resource
|
||||
$found = null;
|
||||
for ($i = 0; $i < count($packagePaths) && is_null($found); $i++)
|
||||
{
|
||||
$file = $packagePaths[$i].CallerLib::LIBS_PATH.DIRECTORY_SEPARATOR.
|
||||
$resourcePath.$resourceName.CallerLib::LIB_FILE_EXTENSION;
|
||||
if (file_exists($file))
|
||||
{
|
||||
$found = $file;
|
||||
}
|
||||
}
|
||||
|
||||
// If the file was found
|
||||
if (!is_null($found))
|
||||
{
|
||||
// Load the file
|
||||
$loaded = $this->_ci->load->file($found);
|
||||
// If the resource is not present inside the file
|
||||
if (!class_exists($resourceName))
|
||||
{
|
||||
$loaded = null;
|
||||
// Same phrase error as load->model() provided by CI
|
||||
$result = error($found.' exists, but doesn\'t declare class '.$resourceName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$loaded = null;
|
||||
// Same phrase error as load->model() provided by CI
|
||||
$result = error('Unable to load the requested class: '.$resourceName);
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
// Errors while loading the library
|
||||
$result = error('Errors while loading the library: '.$e->getMessage());
|
||||
}
|
||||
|
||||
if (!is_null($loaded))
|
||||
{
|
||||
$result = success($loaded);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a method of a class with the given parameters and returns its result
|
||||
*
|
||||
* @param string $resourceName identifies the class name
|
||||
* @param string $function identifies the method name
|
||||
* @param array $parameters contains the parameters to be passed to the method
|
||||
*/
|
||||
private function _callThis($resourceName, $function, $parameters)
|
||||
{
|
||||
$result = null;
|
||||
|
||||
try
|
||||
{
|
||||
// Get informations about the function
|
||||
$reflectionMethod = new ReflectionMethod($resourceName, $function);
|
||||
// If the number of given parameters is greater or equal to the number of
|
||||
// parameters required by the function
|
||||
if (count($parameters) >= $reflectionMethod->getNumberOfRequiredParameters())
|
||||
{
|
||||
// If the function is static
|
||||
if ($reflectionMethod->isStatic() === true)
|
||||
{
|
||||
$classMethod = $resourceName.'::'.$function;
|
||||
}
|
||||
// If the function is not static
|
||||
else
|
||||
{
|
||||
$classMethod = array(new $resourceName(), $function);
|
||||
}
|
||||
|
||||
// If the resource's function is callable
|
||||
if (is_callable($classMethod))
|
||||
{
|
||||
// Call resource->function()
|
||||
// @ was applied to prevent really ugly and unmanageable errors
|
||||
$resultCall = @call_user_func_array($classMethod, $parameters);
|
||||
// If errors occurred while running it
|
||||
// NOTE: if the called function via call_user_func_array returns a boolean set as false,
|
||||
// it will be recognized like a running error. A little bit tricky ;)
|
||||
if ($resultCall === false)
|
||||
{
|
||||
$result = error('Error running '.$resourceName.'->'.$function.'()');
|
||||
}
|
||||
// Returns the result of resource->function()
|
||||
else
|
||||
{
|
||||
$result = success($resultCall);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = error($resourceName.'->'.$function.'() is not callable!');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = error(
|
||||
'Number of required parameters: '.$reflectionMethod->getNumberOfRequiredParameters().'. Given: '.count($parameters)
|
||||
);
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$result = error($e->getMessage());
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class DmsLib
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($dmscontent->retval);
|
||||
return error(getError($dmscontent));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -259,7 +259,7 @@ class DmsLib
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($akte->retval);
|
||||
return error(getError($akte));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class DocumentLib
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($ret->retval);
|
||||
return error(getError($ret));
|
||||
}
|
||||
case 'application/pdf':
|
||||
return success($filename);
|
||||
|
||||
@@ -5,10 +5,12 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
/**
|
||||
* FilterWidget logic
|
||||
*/
|
||||
class FiltersLib
|
||||
class FilterWidgetLib
|
||||
{
|
||||
// Session parameters names
|
||||
const SESSION_NAME = 'FHC_FILTER_WIDGET'; // Filter session name
|
||||
// FilterWidget session name
|
||||
const SESSION_NAME = 'FHC_FILTER_WIDGET';
|
||||
|
||||
// Session elements
|
||||
const SESSION_FILTER_NAME = 'filterName';
|
||||
const SESSION_FIELDS = 'fields';
|
||||
const SESSION_SELECTED_FIELDS = 'selectedFields';
|
||||
@@ -17,11 +19,18 @@ class FiltersLib
|
||||
const SESSION_CHECKBOXES = 'checkboxes';
|
||||
const SESSION_FILTERS = 'filters';
|
||||
const SESSION_METADATA = 'datasetMetadata';
|
||||
const SESSION_DATASET = 'dataset';
|
||||
const SESSION_ROW_NUMBER = 'rowNumber';
|
||||
const SESSION_RELOAD_DATASET = 'reloadDataset';
|
||||
const SESSION_TIMEOUT = 'sessionTimeout';
|
||||
|
||||
// Session dataset elements
|
||||
const SESSION_DATASET = 'dataset';
|
||||
const SESSION_DATASET_RELOAD = 'reloadDataset';
|
||||
const SESSION_DATASET_REPRESENTATION = 'datasetRepresentation';
|
||||
const SESSION_DATASET_REP_OPTIONS = 'datasetRepresentationOptions';
|
||||
const SESSION_DATASET_REP_FIELDS_DEFS = 'datasetRepresentationFieldsDefinitions';
|
||||
|
||||
// Default session timeout
|
||||
const SESSION_DEFAULT_TIMEOUT = 30;
|
||||
|
||||
// Alias for the dynamic table used to retrieve the dataset
|
||||
const DATASET_TABLE_ALIAS = 'datasetFilterTable';
|
||||
@@ -32,16 +41,16 @@ class FiltersLib
|
||||
|
||||
// ...to identify a single filter widget in the DB
|
||||
const FILTER_ID = 'filter_id';
|
||||
const APP_PARAMETER = 'app';
|
||||
const DATASET_NAME_PARAMETER = 'datasetName';
|
||||
const FILTER_KURZBZ_PARAMETER = 'filterKurzbz';
|
||||
const DATASET_RELOAD_PARAMETER = 'reloadDataset';
|
||||
const APP = 'app';
|
||||
const DATASET_NAME = 'datasetName';
|
||||
const FILTER_KURZBZ = 'filterKurzbz';
|
||||
const DATASET_RELOAD = 'reloadDataset';
|
||||
|
||||
// ...to specify permissions that are needed to use this FilterWidget
|
||||
const REQUIRED_PERMISSIONS_PARAMETER = 'requiredPermissions';
|
||||
const REQUIRED_PERMISSIONS = 'requiredPermissions';
|
||||
|
||||
// ...stament to retrieve the dataset
|
||||
const QUERY_PARAMETER = 'query';
|
||||
const QUERY = 'query';
|
||||
|
||||
// ...to specify more columns or aliases for them
|
||||
const ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
@@ -53,18 +62,23 @@ class FiltersLib
|
||||
const MARK_ROW = 'markRow';
|
||||
|
||||
// ...to hide the options for a filter
|
||||
const HIDE_HEADER = 'hideHeader';
|
||||
const HIDE_OPTIONS = 'hideOptions';
|
||||
const HIDE_SELECT_FIELDS = 'hideSelectFields';
|
||||
const HIDE_SELECT_FILTERS = 'hideSelectFilters';
|
||||
const HIDE_SAVE = 'hideSave';
|
||||
|
||||
const CUSTOM_MENU = 'customMenu'; // ...to specify if the menu for this filter is custom (true) or not (false)
|
||||
const HIDE_MENU = 'hideMenu'; // ...to specify if the menu should be shown or not
|
||||
|
||||
// ...to specify how to represent the dataset (ex: tablesorter, pivotUI, ...)
|
||||
const DATASET_REPRESENTATION = 'datasetRepresentation';
|
||||
const DATASET_REP_OPTIONS = 'datasetRepOptions';
|
||||
const DATASET_REP_FIELDS_DEFS = 'datasetRepFieldsDefs';
|
||||
|
||||
// Different dataset representations
|
||||
const DATASET_REP_TABLESORTER = 'tablesorter';
|
||||
const DATASET_REP_PIVOTUI = 'pivotUI';
|
||||
const DATASET_REP_TABULATOR = 'tabulator';
|
||||
|
||||
// Filter operations values
|
||||
const OP_EQUAL = 'equal';
|
||||
@@ -84,7 +98,7 @@ class FiltersLib
|
||||
|
||||
const FILTER_PHRASES_CATEGORY = 'FilterWidget'; // The category used to store phrases for the FilterWidget
|
||||
|
||||
const FILTER_PAGE_PARAM = 'filter_page'; // Filter page parameter name
|
||||
const FILTER_UNIQUE_ID = 'filterUniqueId'; // Filter page parameter name
|
||||
|
||||
const PERMISSION_FILTER_METHOD = 'FilterWidget'; // Name for fake method to be checked by the PermissionLib
|
||||
const PERMISSION_TYPE = 'rw';
|
||||
@@ -107,8 +121,6 @@ class FiltersLib
|
||||
public function __construct($params = null)
|
||||
{
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
|
||||
$this->_filterUniqueId = $this->_getFilterUniqueId($params); // sets the id for the related filter widget
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
@@ -127,7 +139,7 @@ class FiltersLib
|
||||
|
||||
// Gets the required permissions from the session if they are not provided as parameter
|
||||
$rq = $requiredPermissions;
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS_PARAMETER);
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS);
|
||||
|
||||
return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_FILTER_METHOD, self::PERMISSION_TYPE);
|
||||
}
|
||||
@@ -175,6 +187,29 @@ class FiltersLib
|
||||
setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function dropExpiredFilterWidgets()
|
||||
{
|
||||
// Loads the session for all the filter widgets
|
||||
$filterWidgetsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($filterWidgetsSession != null)
|
||||
{
|
||||
// Loops in the session for all the filter widgets
|
||||
foreach ($filterWidgetsSession as $filterWidget => $filterWidgetData)
|
||||
{
|
||||
// If this filter widget is not the currrent used filter widget and the it is expired...
|
||||
if ($this->_filterUniqueId != $filterWidget && $filterWidgetData[self::SESSION_TIMEOUT] <= time())
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $filterWidget); // ...remove it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the definition data from DB for a filter widget
|
||||
*/
|
||||
@@ -467,7 +502,7 @@ class FiltersLib
|
||||
|
||||
// Write changes into the session
|
||||
$this->setSessionElement(self::SESSION_FILTERS, $filters);
|
||||
$this->setSessionElement(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
$this->setSessionElement(self::SESSION_DATASET_RELOAD, true); // the dataset must be reloaded
|
||||
|
||||
$removeAppliedFilter = true;
|
||||
}
|
||||
@@ -519,7 +554,7 @@ class FiltersLib
|
||||
|
||||
// Write changes into the session
|
||||
$this->setSessionElement(self::SESSION_FILTERS, $filters);
|
||||
$this->setSessionElement(self::SESSION_RELOAD_DATASET, true); // the dataset must be reloaded
|
||||
$this->setSessionElement(self::SESSION_DATASET_RELOAD, true); // the dataset must be reloaded
|
||||
|
||||
$applyFilters = true;
|
||||
}
|
||||
@@ -528,6 +563,14 @@ class FiltersLib
|
||||
return $applyFilters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads dataset by setting session variable to true
|
||||
*/
|
||||
public function reloadDataset()
|
||||
{
|
||||
$this->setSessionElement(self::SESSION_DATASET_RELOAD, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a filter (SQL where clause) to be applied to the current filter
|
||||
*/
|
||||
@@ -591,8 +634,8 @@ class FiltersLib
|
||||
|
||||
// Loads the definition to check if is already present in the DB
|
||||
$definition = $this->_ci->FiltersModel->loadWhere(array(
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId
|
||||
));
|
||||
@@ -620,8 +663,8 @@ class FiltersLib
|
||||
// update it
|
||||
$this->_ci->FiltersModel->update(
|
||||
array(
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId
|
||||
),
|
||||
@@ -636,8 +679,8 @@ class FiltersLib
|
||||
{
|
||||
$this->_ci->FiltersModel->insert(
|
||||
array(
|
||||
'app' => $this->getSessionElement(self::APP_PARAMETER),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME_PARAMETER),
|
||||
'app' => $this->getSessionElement(self::APP),
|
||||
'dataset_name' => $this->getSessionElement(self::DATASET_NAME),
|
||||
'filter_kurzbz' => uniqid($authPersonId, true),
|
||||
'description' => $descPGArray,
|
||||
'person_id' => $authPersonId,
|
||||
@@ -681,7 +724,7 @@ class FiltersLib
|
||||
public function generateFilterMenu($navigationPage)
|
||||
{
|
||||
// Loads the NavigationLib for the current page (given as parameter)
|
||||
$this->_ci->load->library('NavigationLib', array(FiltersLib::NAVIGATION_PAGE => $navigationPage));
|
||||
$this->_ci->load->library('NavigationLib', array(self::NAVIGATION_PAGE => $navigationPage));
|
||||
|
||||
$filterMenu = null;
|
||||
$currentMenu = $this->_ci->navigationlib->getSessionMenu(); // The navigation menu currently stored in session
|
||||
@@ -694,7 +737,7 @@ class FiltersLib
|
||||
|
||||
// Loads all the filters related to this page (same dataset_name and same app name)
|
||||
$filters = $this->_ci->FiltersModel->getFiltersByAppDatasetName(
|
||||
$session[self::APP_PARAMETER], $session[self::DATASET_NAME_PARAMETER]
|
||||
$session[self::APP], $session[self::DATASET_NAME]
|
||||
);
|
||||
|
||||
// If filters were loaded
|
||||
@@ -763,7 +806,7 @@ class FiltersLib
|
||||
);
|
||||
|
||||
// Sets in the session only the element related to the filters menu
|
||||
$this->_ci->navigationlib->setSessionElementMenu(FiltersLib::NAV_MENU_FILTER_KEY, $filterMenu);
|
||||
$this->_ci->navigationlib->setSessionElementMenu(self::NAV_MENU_FILTER_KEY, $filterMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -776,14 +819,14 @@ class FiltersLib
|
||||
* NOTE: The default value is the URI where the FilterWidget is called
|
||||
* If the fhc_controller_id is present then is also used
|
||||
*/
|
||||
private function _getFilterUniqueId($params)
|
||||
public function setFilterUniqueIdByParams($params)
|
||||
{
|
||||
if ($params != null
|
||||
&& is_array($params)
|
||||
&& isset($params[self::FILTER_PAGE_PARAM])
|
||||
&& !isEmptyString($params[self::FILTER_PAGE_PARAM]))
|
||||
&& isset($params[self::FILTER_UNIQUE_ID])
|
||||
&& !isEmptyString($params[self::FILTER_UNIQUE_ID]))
|
||||
{
|
||||
$filterUniqueId = $params[self::FILTER_PAGE_PARAM];
|
||||
$filterUniqueId = $params[self::FILTER_UNIQUE_ID];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -791,6 +834,14 @@ class FiltersLib
|
||||
$filterUniqueId = $this->_ci->router->directory.$this->_ci->router->class.'/'.$this->_ci->router->method;
|
||||
}
|
||||
|
||||
$this->setFilterUniqueId($filterUniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function setFilterUniqueId($filterUniqueId)
|
||||
{
|
||||
// If the FHC_CONTROLLER_ID parameter is present in the HTTP GET
|
||||
if (isset($_GET[self::FHC_CONTROLLER_ID]))
|
||||
{
|
||||
@@ -801,7 +852,7 @@ class FiltersLib
|
||||
$filterUniqueId .= '/'.$this->_ci->input->post(self::FHC_CONTROLLER_ID); // then use it
|
||||
}
|
||||
|
||||
return $filterUniqueId;
|
||||
$this->_filterUniqueId = $filterUniqueId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,531 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Format class
|
||||
* Help convert between various formats such as XML, JSON, CSV, etc.
|
||||
*
|
||||
* @author Phil Sturgeon, Chris Kacerguis, @softwarespot
|
||||
* @license http://www.dbad-license.org/
|
||||
*/
|
||||
class Format {
|
||||
|
||||
/**
|
||||
* Array output format
|
||||
*/
|
||||
const ARRAY_FORMAT = 'array';
|
||||
|
||||
/**
|
||||
* Comma Separated Value (CSV) output format
|
||||
*/
|
||||
const CSV_FORMAT = 'csv';
|
||||
|
||||
/**
|
||||
* Json output format
|
||||
*/
|
||||
const JSON_FORMAT = 'json';
|
||||
|
||||
/**
|
||||
* HTML output format
|
||||
*/
|
||||
const HTML_FORMAT = 'html';
|
||||
|
||||
/**
|
||||
* PHP output format
|
||||
*/
|
||||
const PHP_FORMAT = 'php';
|
||||
|
||||
/**
|
||||
* Serialized output format
|
||||
*/
|
||||
const SERIALIZED_FORMAT = 'serialized';
|
||||
|
||||
/**
|
||||
* XML output format
|
||||
*/
|
||||
const XML_FORMAT = 'xml';
|
||||
|
||||
/**
|
||||
* Default format of this class
|
||||
*/
|
||||
const DEFAULT_FORMAT = self::JSON_FORMAT; // Couldn't be DEFAULT, as this is a keyword
|
||||
|
||||
/**
|
||||
* CodeIgniter instance
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private $_CI;
|
||||
|
||||
/**
|
||||
* Data to parse
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_data = [];
|
||||
|
||||
/**
|
||||
* Type to convert from
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_from_type = NULL;
|
||||
|
||||
/**
|
||||
* DO NOT CALL THIS DIRECTLY, USE factory()
|
||||
*
|
||||
* @param NULL $data
|
||||
* @param NULL $from_type
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
public function __construct($data = NULL, $from_type = NULL)
|
||||
{
|
||||
// Get the CodeIgniter reference
|
||||
$this->_CI = &get_instance();
|
||||
|
||||
// Load the inflector helper
|
||||
$this->_CI->load->helper('inflector');
|
||||
|
||||
// If the provided data is already formatted we should probably convert it to an array
|
||||
if ($from_type !== NULL)
|
||||
{
|
||||
if (method_exists($this, '_from_' . $from_type))
|
||||
{
|
||||
$data = call_user_func([$this, '_from_' . $from_type], $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception('Format class does not support conversion from "' . $from_type . '".');
|
||||
}
|
||||
}
|
||||
|
||||
// Set the member variable to the data passed
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the format class
|
||||
* e.g: echo $this->format->factory(['foo' => 'bar'])->to_csv();
|
||||
*
|
||||
* @param mixed $data Data to convert/parse
|
||||
* @param string $from_type Type to convert from e.g. json, csv, html
|
||||
*
|
||||
* @return object Instance of the format class
|
||||
*/
|
||||
public function factory($data, $from_type = NULL)
|
||||
{
|
||||
// $class = __CLASS__;
|
||||
// return new $class();
|
||||
|
||||
return new static($data, $from_type);
|
||||
}
|
||||
|
||||
// FORMATTING OUTPUT ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Format data as an array
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @return array Data parsed as an array; otherwise, an empty array
|
||||
*/
|
||||
public function to_array($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// Cast as an array if not already
|
||||
if (is_array($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
$array = [];
|
||||
foreach ((array) $data as $key => $value)
|
||||
{
|
||||
if (is_object($value) === TRUE || is_array($value) === TRUE)
|
||||
{
|
||||
$array[$key] = $this->to_array($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$array[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format data as XML
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @param NULL $structure
|
||||
* @param string $basenode
|
||||
* @return mixed
|
||||
*/
|
||||
public function to_xml($data = NULL, $structure = NULL, $basenode = 'xml')
|
||||
{
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// turn off compatibility mode as simple xml throws a wobbly if you don't.
|
||||
if (ini_get('zend.ze1_compatibility_mode') == 1)
|
||||
{
|
||||
ini_set('zend.ze1_compatibility_mode', 0);
|
||||
}
|
||||
|
||||
if ($structure === NULL)
|
||||
{
|
||||
$structure = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$basenode />");
|
||||
}
|
||||
|
||||
// Force it to be something useful
|
||||
if (is_array($data) === FALSE && is_object($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
foreach ($data as $key => $value)
|
||||
{
|
||||
|
||||
//change false/true to 0/1
|
||||
if (is_bool($value))
|
||||
{
|
||||
$value = (int) $value;
|
||||
}
|
||||
|
||||
// no numeric keys in our xml please!
|
||||
if (is_numeric($key))
|
||||
{
|
||||
// make string key...
|
||||
$key = (singular($basenode) != $basenode) ? singular($basenode) : 'item';
|
||||
}
|
||||
|
||||
// replace anything not alpha numeric
|
||||
$key = preg_replace('/[^a-z_\-0-9]/i', '', $key);
|
||||
|
||||
if ($key === '_attributes' && (is_array($value) || is_object($value)))
|
||||
{
|
||||
$attributes = $value;
|
||||
if (is_object($attributes))
|
||||
{
|
||||
$attributes = get_object_vars($attributes);
|
||||
}
|
||||
|
||||
foreach ($attributes as $attribute_name => $attribute_value)
|
||||
{
|
||||
$structure->addAttribute($attribute_name, $attribute_value);
|
||||
}
|
||||
}
|
||||
// if there is another array found recursively call this function
|
||||
elseif (is_array($value) || is_object($value))
|
||||
{
|
||||
$node = $structure->addChild($key);
|
||||
|
||||
// recursive call.
|
||||
$this->to_xml($value, $node, $key);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add single node.
|
||||
$value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8');
|
||||
|
||||
$structure->addChild($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $structure->asXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format data as HTML
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @return mixed
|
||||
*/
|
||||
public function to_html($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// Cast as an array if not already
|
||||
if (is_array($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
// Check if it's a multi-dimensional array
|
||||
if (isset($data[0]) && count($data) !== count($data, COUNT_RECURSIVE))
|
||||
{
|
||||
// Multi-dimensional array
|
||||
$headings = array_keys($data[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Single array
|
||||
$headings = array_keys($data);
|
||||
$data = [$data];
|
||||
}
|
||||
|
||||
// Load the table library
|
||||
$this->_CI->load->library('table');
|
||||
|
||||
$this->_CI->table->set_heading($headings);
|
||||
|
||||
foreach ($data as $row)
|
||||
{
|
||||
// Suppressing the "array to string conversion" notice
|
||||
// Keep the "evil" @ here
|
||||
$row = @array_map('strval', $row);
|
||||
|
||||
$this->_CI->table->add_row($row);
|
||||
}
|
||||
|
||||
return $this->_CI->table->generate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @link http://www.metashock.de/2014/02/create-csv-file-in-memory-php/
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @param string $delimiter The optional delimiter parameter sets the field
|
||||
* delimiter (one character only). NULL will use the default value (,)
|
||||
* @param string $enclosure The optional enclosure parameter sets the field
|
||||
* enclosure (one character only). NULL will use the default value (")
|
||||
* @return string A csv string
|
||||
*/
|
||||
public function to_csv($data = NULL, $delimiter = ',', $enclosure = '"')
|
||||
{
|
||||
// Use a threshold of 1 MB (1024 * 1024)
|
||||
$handle = fopen('php://temp/maxmemory:1048576', 'w');
|
||||
if ($handle === FALSE)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// If NULL, then set as the default delimiter
|
||||
if ($delimiter === NULL)
|
||||
{
|
||||
$delimiter = ',';
|
||||
}
|
||||
|
||||
// If NULL, then set as the default enclosure
|
||||
if ($enclosure === NULL)
|
||||
{
|
||||
$enclosure = '"';
|
||||
}
|
||||
|
||||
// Cast as an array if not already
|
||||
if (is_array($data) === FALSE)
|
||||
{
|
||||
$data = (array) $data;
|
||||
}
|
||||
|
||||
// Check if it's a multi-dimensional array
|
||||
if (isset($data[0]) && count($data) !== count($data, COUNT_RECURSIVE))
|
||||
{
|
||||
// Multi-dimensional array
|
||||
$headings = array_keys($data[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Single array
|
||||
$headings = array_keys($data);
|
||||
$data = [$data];
|
||||
}
|
||||
|
||||
// Apply the headings
|
||||
fputcsv($handle, $headings, $delimiter, $enclosure);
|
||||
|
||||
foreach ($data as $record)
|
||||
{
|
||||
// If the record is not an array, then break. This is because the 2nd param of
|
||||
// fputcsv() should be an array
|
||||
if (is_array($record) === FALSE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Suppressing the "array to string conversion" notice.
|
||||
// Keep the "evil" @ here.
|
||||
$record = @ array_map('strval', $record);
|
||||
|
||||
// Returns the length of the string written or FALSE
|
||||
fputcsv($handle, $record, $delimiter, $enclosure);
|
||||
}
|
||||
|
||||
// Reset the file pointer
|
||||
rewind($handle);
|
||||
|
||||
// Retrieve the csv contents
|
||||
$csv = stream_get_contents($handle);
|
||||
|
||||
// Close the handle
|
||||
fclose($handle);
|
||||
|
||||
return $csv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode data as json
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @return string Json representation of a value
|
||||
*/
|
||||
public function to_json($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
// Get the callback parameter (if set)
|
||||
$callback = $this->_CI->input->get('callback');
|
||||
|
||||
if (empty($callback) === TRUE)
|
||||
{
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
// We only honour a jsonp callback which are valid javascript identifiers
|
||||
elseif (preg_match('/^[a-z_\$][a-z0-9\$_]*(\.[a-z_\$][a-z0-9\$_]*)*$/i', $callback))
|
||||
{
|
||||
// Return the data as encoded json with a callback
|
||||
return $callback . '(' . json_encode($data) . ');';
|
||||
}
|
||||
|
||||
// An invalid jsonp callback function provided.
|
||||
// Though I don't believe this should be hardcoded here
|
||||
$data['warning'] = 'INVALID JSONP CALLBACK: ' . $callback;
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode data as a serialized array
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @return string Serialized data
|
||||
*/
|
||||
public function to_serialized($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
return serialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format data using a PHP structure
|
||||
*
|
||||
* @param mixed|NULL $data Optional data to pass, so as to override the data passed
|
||||
* to the constructor
|
||||
* @return mixed String representation of a variable
|
||||
*/
|
||||
public function to_php($data = NULL)
|
||||
{
|
||||
// If no data is passed as a parameter, then use the data passed
|
||||
// via the constructor
|
||||
if ($data === NULL && func_num_args() === 0)
|
||||
{
|
||||
$data = $this->_data;
|
||||
}
|
||||
|
||||
return var_export($data, TRUE);
|
||||
}
|
||||
|
||||
// INTERNAL FUNCTIONS
|
||||
|
||||
/**
|
||||
* @param $data XML string
|
||||
* @return SimpleXMLElement XML element object; otherwise, empty array
|
||||
*/
|
||||
protected function _from_xml($data)
|
||||
{
|
||||
return $data ? (array) simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data CSV string
|
||||
* @param string $delimiter The optional delimiter parameter sets the field
|
||||
* delimiter (one character only). NULL will use the default value (,)
|
||||
* @param string $enclosure The optional enclosure parameter sets the field
|
||||
* enclosure (one character only). NULL will use the default value (")
|
||||
* @return array A multi-dimensional array with the outer array being the number of rows
|
||||
* and the inner arrays the individual fields
|
||||
*/
|
||||
protected function _from_csv($data, $delimiter = ',', $enclosure = '"')
|
||||
{
|
||||
// If NULL, then set as the default delimiter
|
||||
if ($delimiter === NULL)
|
||||
{
|
||||
$delimiter = ',';
|
||||
}
|
||||
|
||||
// If NULL, then set as the default enclosure
|
||||
if ($enclosure === NULL)
|
||||
{
|
||||
$enclosure = '"';
|
||||
}
|
||||
|
||||
return str_getcsv($data, $delimiter, $enclosure);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data Encoded json string
|
||||
* @return mixed Decoded json string with leading and trailing whitespace removed
|
||||
*/
|
||||
protected function _from_json($data)
|
||||
{
|
||||
return json_decode(trim($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string Data to unserialized
|
||||
* @return mixed Unserialized data
|
||||
*/
|
||||
protected function _from_serialize($data)
|
||||
{
|
||||
return unserialize(trim($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data Data to trim leading and trailing whitespace
|
||||
* @return string Data with leading and trailing whitespace removed
|
||||
*/
|
||||
protected function _from_php($data)
|
||||
{
|
||||
return trim($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,102 +1,252 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Library usefull for logging!
|
||||
* This library can log using CodeIgniter log system (file system) or to database
|
||||
*/
|
||||
class LogLib
|
||||
{
|
||||
const DEBUG = 'debug';
|
||||
const ERROR = 'error';
|
||||
// Log levels
|
||||
const INFO = 'info';
|
||||
const DEBUG = 'debug';
|
||||
const WARNING = 'warning';
|
||||
const ERROR = 'error';
|
||||
|
||||
// Default debug trace levels
|
||||
const CLASS_INDEX = 3;
|
||||
const FUNCTION_INDEX = 3;
|
||||
const LINE_INDEX = 2;
|
||||
|
||||
const DB_EXECUTE_USER = 'LogLib'; // Default execute user
|
||||
|
||||
// Caller data names
|
||||
const CLASS_NAME = 'className';
|
||||
const FUNCTION_NAME = 'functionName';
|
||||
const CODE_LINE = 'codeLine';
|
||||
|
||||
// To format the log message prefix when logging to file system
|
||||
const CALLER_PREFIX = '[';
|
||||
const CALLER_POSTFIX = ']';
|
||||
const CLASS_POSTFIX = '->';
|
||||
const LINE_SEPARATOR = ':';
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
// CodeIgniter configuration log entry name and log debug value
|
||||
const CI_LOG_THRESHOLD_NAME = 'log_threshold';
|
||||
const CI_LOG_THRESHOLD_DEBUG = 2;
|
||||
|
||||
// LogLib parameters names
|
||||
const P_NAME_CLASS_INDEX = 'classIndex';
|
||||
const P_NAME_FUNCTION_INDEX = 'functionIndex';
|
||||
const P_NAME_LINE_INDEX = 'lineIndex';
|
||||
const P_NAME_DB_LOG_TYPE = 'dbLogType';
|
||||
const P_NAME_DB_EXECUTE_USER = 'dbExecuteUser';
|
||||
|
||||
// Properties used to retrieve caller data
|
||||
private $_classIndex;
|
||||
private $_functionIndex;
|
||||
private $_lineIndex;
|
||||
|
||||
// Properties used when logging to database
|
||||
private $_dbLogType;
|
||||
private $_dbExecuteUser;
|
||||
|
||||
/**
|
||||
* logDebug
|
||||
* Set properties to a default value or overwrites them with the given parameters
|
||||
*/
|
||||
public function __construct($params = null)
|
||||
{
|
||||
// Properties default values
|
||||
$this->_classIndex = self::CLASS_INDEX;
|
||||
$this->_functionIndex = self::FUNCTION_INDEX;
|
||||
$this->_lineIndex = self::LINE_INDEX;
|
||||
$this->_dbLogType = null;
|
||||
$this->_dbExecuteUser = self::DB_EXECUTE_USER;
|
||||
|
||||
// If parameters are given then overwrite the default values
|
||||
if (!isEmptyArray($params))
|
||||
{
|
||||
if (isset($params[self::P_NAME_CLASS_INDEX])) $this->_classIndex = $params[self::P_NAME_CLASS_INDEX];
|
||||
if (isset($params[self::P_NAME_FUNCTION_INDEX])) $this->_functionIndex = $params[self::P_NAME_FUNCTION_INDEX];
|
||||
if (isset($params[self::P_NAME_LINE_INDEX])) $this->_lineIndex = $params[self::P_NAME_LINE_INDEX];
|
||||
if (isset($params[self::P_NAME_DB_LOG_TYPE])) $this->_dbLogType = $params[self::P_NAME_DB_LOG_TYPE];
|
||||
if (isset($params[self::P_NAME_DB_EXECUTE_USER])) $this->_dbExecuteUser = $params[self::P_NAME_DB_EXECUTE_USER];
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
// Public methods based on CodeIgniter log system
|
||||
|
||||
/**
|
||||
* Writes a debug log to CodeIgniter log
|
||||
*/
|
||||
public function logDebug($message)
|
||||
{
|
||||
$this->_log(LogLib::DEBUG, $message);
|
||||
$this->_log(self::DEBUG, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* logInfo
|
||||
* Writes an info log to CodeIgniter log
|
||||
*/
|
||||
public function logInfo($message)
|
||||
{
|
||||
$this->_log(LogLib::INFO, $message);
|
||||
$this->_log(self::INFO, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* logError
|
||||
* Writes an error log to CodeIgniter log
|
||||
*/
|
||||
public function logError($message)
|
||||
{
|
||||
$this->_log(LogLib::ERROR, $message);
|
||||
$this->_log(self::ERROR, $message);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
// Public methods based on database
|
||||
|
||||
/**
|
||||
* Writes an info log to database
|
||||
*/
|
||||
public function logInfoDB($requestId, $data)
|
||||
{
|
||||
$this->_logDB(self::INFO, $requestId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a debug log to database
|
||||
*/
|
||||
public function logDebugDB($requestId, $data)
|
||||
{
|
||||
$this->_logDB(self::DEBUG, $requestId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an warning log to database
|
||||
*/
|
||||
public function logWarningDB($requestId, $data)
|
||||
{
|
||||
$this->_logDB(self::WARNING, $requestId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an error log to database
|
||||
*/
|
||||
public function logErrorDB($requestId, $data)
|
||||
{
|
||||
$this->_logDB(self::ERROR, $requestId, $data);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* log
|
||||
* Writes using CodeIgniter log system (file system)
|
||||
*/
|
||||
private function _log($level, $message)
|
||||
{
|
||||
log_message($level, $this->_getCaller().$message);
|
||||
log_message($level, $this->_getPrefix($this->_getCaller()).$message);
|
||||
}
|
||||
|
||||
/**
|
||||
* _getCaller
|
||||
* Writes logs to database
|
||||
*/
|
||||
private function _logDB($level, $requestId, $data)
|
||||
{
|
||||
// If the _dbLogType parameter was not given when this library was loaded
|
||||
// NOTE: this message will be displayed only to the developer AND stops the execution
|
||||
if ($this->_dbLogType == null)
|
||||
{
|
||||
show_error('To log to database you need to specify the "'.self::P_NAME_DB_LOG_TYPE.'" parameter when the LogLib is loaded');
|
||||
}
|
||||
|
||||
$ci =& get_instance(); // get code igniter instance
|
||||
|
||||
// If only debug log is enabed then is possible to write a debug log, otherwise...
|
||||
if ($level == self::DEBUG && $ci->config->item(self::CI_LOG_THRESHOLD_NAME) != self::CI_LOG_THRESHOLD_DEBUG)
|
||||
{
|
||||
// ...do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
// Loads WebservicelogModel
|
||||
$ci->load->model('system/Webservicelog_model', 'WebservicelogModel');
|
||||
|
||||
// Get caller data
|
||||
$callerData = $this->_getCaller();
|
||||
|
||||
// Writes a log to database
|
||||
$ci->WebservicelogModel->insert(array(
|
||||
'webservicetyp_kurzbz' => $this->_dbLogType,
|
||||
'request_id' => $requestId,
|
||||
'beschreibung' => $this->_getDatabaseDescription($callerData),
|
||||
'request_data' => $data,
|
||||
'execute_user' => $this->_dbExecuteUser,
|
||||
'execute_time' => 'NOW()' // current time
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves caller's data
|
||||
*/
|
||||
private function _getCaller()
|
||||
{
|
||||
$classIndex = 3;
|
||||
$functionIndex = 3;
|
||||
$lineIndex = 2;
|
||||
$class = '';
|
||||
$function = '';
|
||||
$line = '';
|
||||
$backtrace_arr = debug_backtrace();
|
||||
if (isset($backtrace_arr[$classIndex]['class']) && $backtrace_arr[$classIndex]['class'] != '')
|
||||
|
||||
if (isset($backtrace_arr[$this->_classIndex]['class']) && $backtrace_arr[$this->_classIndex]['class'] != '')
|
||||
{
|
||||
$class = $backtrace_arr[$classIndex]['class'];
|
||||
$class = $backtrace_arr[$this->_classIndex]['class'];
|
||||
}
|
||||
|
||||
if (isset($backtrace_arr[$functionIndex]['function']) && $backtrace_arr[$functionIndex]['function'] != '')
|
||||
if (isset($backtrace_arr[$this->_functionIndex]['function']) && $backtrace_arr[$this->_functionIndex]['function'] != '')
|
||||
{
|
||||
$function = $backtrace_arr[$functionIndex]['function'];
|
||||
$function = $backtrace_arr[$this->_functionIndex]['function'];
|
||||
}
|
||||
|
||||
if (isset($backtrace_arr[$lineIndex]['line']) && $backtrace_arr[$lineIndex]['line'] != '')
|
||||
if (isset($backtrace_arr[$this->_lineIndex]['line']) && $backtrace_arr[$this->_lineIndex]['line'] != '')
|
||||
{
|
||||
$line = $backtrace_arr[$lineIndex]['line'];
|
||||
$line = $backtrace_arr[$this->_lineIndex]['line'];
|
||||
}
|
||||
|
||||
return $this->_format($class, $function, $line);
|
||||
return array(
|
||||
self::CLASS_NAME => $class,
|
||||
self::FUNCTION_NAME => $function,
|
||||
self::CODE_LINE => $line
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* format
|
||||
* Formats the log message prefix (file system based)
|
||||
*/
|
||||
private function _format($class, $function, $line)
|
||||
private function _getPrefix($callerData)
|
||||
{
|
||||
$formatted = LogLib::CALLER_PREFIX;
|
||||
$formatted = self::CALLER_PREFIX;
|
||||
|
||||
if (!is_null($class) && $class != '')
|
||||
if (!isEmptyString($callerData[self::CLASS_NAME]))
|
||||
{
|
||||
$formatted .= $class.LogLib::CLASS_POSTFIX;
|
||||
$formatted .= $callerData[self::CLASS_NAME].self::CLASS_POSTFIX;
|
||||
}
|
||||
|
||||
$formatted .= $function.LogLib::LINE_SEPARATOR.$line.LogLib::CALLER_POSTFIX.' ';
|
||||
$formatted .= $callerData[self::FUNCTION_NAME].self::LINE_SEPARATOR.$callerData[self::CODE_LINE].self::CALLER_POSTFIX.' ';
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the database description for a log
|
||||
*/
|
||||
private function _getDatabaseDescription($callerData)
|
||||
{
|
||||
$formatted = $callerData[self::FUNCTION_NAME].self::LINE_SEPARATOR.$callerData[self::CODE_LINE];
|
||||
|
||||
if (!isEmptyString($callerData[self::CLASS_NAME]))
|
||||
{
|
||||
$formatted = $callerData[self::CLASS_NAME].self::CLASS_POSTFIX.$formatted;
|
||||
}
|
||||
|
||||
return $formatted;
|
||||
}
|
||||
|
||||
@@ -1,466 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (! defined("BASEPATH")) exit("No direct script access allowed");
|
||||
|
||||
/**
|
||||
* Utility class to be used in the database migration process
|
||||
*/
|
||||
class MigrationLib extends CI_Migration
|
||||
{
|
||||
/**
|
||||
* Object initialization
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Loads EPrintfLib
|
||||
$this->load->library('EPrintfLib');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a column exists in a table and schema
|
||||
*/
|
||||
private function columnExists($name, $schema, $table)
|
||||
{
|
||||
$query = sprintf("SELECT %s FROM %s.%s LIMIT 1", $name, $schema, $table);
|
||||
|
||||
if (@$this->db->simple_query($query))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an info about the starting of method up
|
||||
*/
|
||||
protected function startUP()
|
||||
{
|
||||
$this->eprintflib->printInfo(
|
||||
sprintf("%s Start method up of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an info about the ending of method up
|
||||
*/
|
||||
protected function endUP()
|
||||
{
|
||||
$this->eprintflib->printInfo(
|
||||
sprintf("%s End method up of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an info about the starting of method down
|
||||
*/
|
||||
protected function startDown()
|
||||
{
|
||||
$this->eprintflib->printInfo(
|
||||
sprintf("%s Start method down of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an info about the ending of method down
|
||||
*/
|
||||
protected function endDown()
|
||||
{
|
||||
$this->eprintflib->printInfo(
|
||||
sprintf("%s End method down of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a column, with attributes, to a table and schema
|
||||
*/
|
||||
protected function addColumn($schema, $table, $fields)
|
||||
{
|
||||
foreach ($fields as $name => $definition)
|
||||
{
|
||||
if (!$this->columnExists($name, $schema, $table))
|
||||
{
|
||||
if ($this->dbforge->add_column($schema.'.'.$table, array($name => $definition)))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"]));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Error while adding column %s.%s.%s of type %s", $schema, $table, $name, $definition["type"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printInfo(sprintf("Column %s.%s.%s already exists", $schema, $table, $name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies a column, and its attributes, of a table and schema
|
||||
*/
|
||||
protected function modifyColumn($schema, $table, $fields)
|
||||
{
|
||||
foreach ($fields as $name => $definition)
|
||||
{
|
||||
if ($this->columnExists($name, $schema, $table))
|
||||
{
|
||||
if ($this->dbforge->modify_column($schema.'.'.$table, array($name => $definition)))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Error while modifying column %s.%s.%s", $schema, $table, $name));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops a column from a table and schema
|
||||
*/
|
||||
protected function dropColumn($schema, $table, $field)
|
||||
{
|
||||
if ($this->columnExists($field, $schema, $table))
|
||||
{
|
||||
if ($this->dbforge->drop_column($schema.'.'.$table, $field))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Error while dropping column %s.%s.%s", $schema, $table, $field));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $field));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a column as primary key of a table and schema
|
||||
*/
|
||||
protected function addPrimaryKey($schema, $table, $name, $fields)
|
||||
{
|
||||
$stringFields = null;
|
||||
|
||||
if (is_array($fields))
|
||||
{
|
||||
if (count($fields) > 0)
|
||||
{
|
||||
$stringFields = "";
|
||||
for ($i = 0; $i < count($fields); $i++)
|
||||
{
|
||||
$stringFields .= $fields[$i];
|
||||
if ($i != count($fields) - 1)
|
||||
{
|
||||
$stringFields .= ", ";
|
||||
}
|
||||
}
|
||||
$query = sprintf("ALTER TABLE %s.%s ADD CONSTRAINT %s PRIMARY KEY (%s)", $schema, $table, $name, $stringFields);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = sprintf("ALTER TABLE %s.%s ADD CONSTRAINT %s PRIMARY KEY (%s)", $schema, $table, $name, $fields);
|
||||
}
|
||||
|
||||
if (@$this->db->simple_query($query))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Added primary key %s on table %s.%s", $name, $schema, $table));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Adding primary key %s on table %s.%s", $name, $schema, $table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a column as foreign key of a table and schema
|
||||
*/
|
||||
protected function addForeingKey($schema, $table, $name, $field, $schemaDest, $tableDest, $fieldDest, $attributes)
|
||||
{
|
||||
$query = sprintf(
|
||||
"ALTER TABLE %s.%s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s.%s (%s) %s",
|
||||
$schema,
|
||||
$table,
|
||||
$name,
|
||||
$field,
|
||||
$schemaDest,
|
||||
$tableDest,
|
||||
$fieldDest,
|
||||
$attributes
|
||||
);
|
||||
|
||||
if (@$this->db->simple_query($query))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Added foreign key %s on table %s.%s", $name, $schema, $table));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Adding foreign key %s on table %s.%s", $name, $schema, $table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a column as unique key of a table and schema
|
||||
*/
|
||||
protected function addUniqueKey($schema, $table, $name, $fields)
|
||||
{
|
||||
$stringFields = null;
|
||||
|
||||
if (is_array($fields))
|
||||
{
|
||||
if (count($fields) > 0)
|
||||
{
|
||||
$stringFields = "";
|
||||
for ($i = 0; $i < count($fields); $i++)
|
||||
{
|
||||
$stringFields .= $fields[$i];
|
||||
if ($i != count($fields) - 1)
|
||||
{
|
||||
$stringFields .= ", ";
|
||||
}
|
||||
}
|
||||
$query = sprintf("CREATE UNIQUE INDEX %s ON %s.%s (%s)", $name, $schema, $table, $stringFields);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = sprintf("CREATE UNIQUE INDEX %s ON %s.%s (%s)", $name, $schema, $table, $fields);
|
||||
}
|
||||
|
||||
if (@$this->db->simple_query($query))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Added unique key %s on table %s.%s", $name, $schema, $table));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Adding unique key %s on table %s.%s", $name, $schema, $table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants permissions to a user on a table and schema
|
||||
*/
|
||||
protected function grantTable($permissions, $schema, $table, $user)
|
||||
{
|
||||
$stringPermission = null;
|
||||
|
||||
if (is_array($permissions))
|
||||
{
|
||||
if (count($permissions) > 0)
|
||||
{
|
||||
$stringPermission = "";
|
||||
for ($i = 0; $i < count($permissions); $i++)
|
||||
{
|
||||
$stringPermission .= $permissions[$i];
|
||||
if ($i != count($permissions) - 1)
|
||||
{
|
||||
$stringPermission .= ", ";
|
||||
}
|
||||
}
|
||||
$query = sprintf("GRANT %s ON TABLE %s.%s TO %s", $stringPermission, $schema, $table, $user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = sprintf("GRANT %s ON TABLE %s.%s TO %s", $permissions, $schema, $table, $user);
|
||||
}
|
||||
|
||||
if (@$this->db->simple_query($query))
|
||||
{
|
||||
$this->eprintflib->printMessage(
|
||||
sprintf(
|
||||
"Granted permissions %s on table %s.%s to user %s",
|
||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||
$schema,
|
||||
$table,
|
||||
$user
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(
|
||||
sprintf(
|
||||
"Granting permissions %s on table %s.%s to user %s",
|
||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||
$schema,
|
||||
$table,
|
||||
$user
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a table in a schema with columns
|
||||
*/
|
||||
protected function createTable($schema, $table, $fields)
|
||||
{
|
||||
$this->dbforge->add_field($fields);
|
||||
|
||||
if ($this->dbforge->create_table($schema.'.'.$table, true))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Table %s.%s created or existing", $schema, $table));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Creating table %s.%s", $schema, $table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops a table from a schema
|
||||
*/
|
||||
protected function dropTable($schema, $table)
|
||||
{
|
||||
if ($this->dbforge->drop_table($schema.".".$table))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Dropping table %s.%s", $schema, $table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a sequence with the max value of a column
|
||||
*/
|
||||
protected function initializeSequence($schemaSrc, $sequence, $schemaDst, $table, $field)
|
||||
{
|
||||
$query = sprintf("SELECT SETVAL('%s.%s', (SELECT MAX(%s) FROM %s.%s))", $schemaSrc, $sequence, $field, $schemaDst, $table);
|
||||
|
||||
if (@$this->db->simple_query($query))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Sequence %s.%s has been initialized", $schemaSrc, $sequence));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Initializing sequence %s.%s", $schemaSrc, $sequence));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add comment to a column
|
||||
*/
|
||||
protected function addCommentToColumn($schema, $table, $field, $comment)
|
||||
{
|
||||
$query = sprintf("COMMENT ON COLUMN %s.%s.%s IS ?", $schema, $table, $field);
|
||||
|
||||
if (@$this->db->query($query, array($comment)))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Comment added to %s.%s.%s", $schema, $table, $field));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Error while adding comment to %s.%s.%s", $schema, $table, $field));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add comment to a table
|
||||
*/
|
||||
protected function addCommentToTable($schema, $table, $comment)
|
||||
{
|
||||
$query = sprintf("COMMENT ON TABLE %s.%s IS ?", $schema, $table, $field);
|
||||
|
||||
if (@$this->db->query($query, array($comment)))
|
||||
{
|
||||
$this->eprintflib->printMessage(sprintf("Comment added to %s.%s", $schema, $table));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(sprintf("Error while adding comment to %s.%s", $schema, $table));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Grants permissions to a user on a sequence
|
||||
*/
|
||||
protected function grantSequence($permissions, $schema, $sequence, $user)
|
||||
{
|
||||
$stringPermission = null;
|
||||
|
||||
if (is_array($permissions))
|
||||
{
|
||||
if (count($permissions) > 0)
|
||||
{
|
||||
$stringPermission = "";
|
||||
for ($i = 0; $i < count($permissions); $i++)
|
||||
{
|
||||
$stringPermission .= $permissions[$i];
|
||||
if ($i != count($permissions) - 1)
|
||||
{
|
||||
$stringPermission .= ", ";
|
||||
}
|
||||
}
|
||||
$query = sprintf("GRANT %s ON SEQUENCE %s.%s TO %s", $stringPermission, $schema, $sequence, $user);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = sprintf("GRANT %s ON SEQUENCE %s.%s TO %s", $permissions, $schema, $sequence, $user);
|
||||
}
|
||||
|
||||
if (@$this->db->simple_query($query))
|
||||
{
|
||||
$this->eprintflib->printMessage(
|
||||
sprintf(
|
||||
"Granted permissions %s on sequence %s.%s to user %s",
|
||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||
$schema,
|
||||
$sequence,
|
||||
$user
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError(
|
||||
sprintf(
|
||||
"Granting permissions %s on sequence %s.%s to user %s",
|
||||
is_null($stringPermission) ? $permissions : $stringPermission,
|
||||
$schema,
|
||||
$sequence,
|
||||
$user
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the given query
|
||||
*/
|
||||
protected function execQuery($query)
|
||||
{
|
||||
if (! @$this->db->simple_query($query))
|
||||
{
|
||||
$error = $this->db->error();
|
||||
|
||||
if (is_array($error) && isset($error["message"]))
|
||||
{
|
||||
$this->eprintflib->printError($error["message"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->eprintflib->printError("Error while executing a query");
|
||||
}
|
||||
}
|
||||
|
||||
$this->eprintflib->printInfo(
|
||||
"Query correctly executed: ".
|
||||
substr(preg_replace("/\s+/", " ", trim($query)), 0, EPrintfLib::PRINT_QUERY_LEN).
|
||||
(strlen($query) > EPrintfLib::PRINT_QUERY_LEN ? "..." : "")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -254,6 +254,45 @@ class PermissionLib
|
||||
return !$this->_inLAPersonIdsBlacklist($person_id) && $this->_hasLAPermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the study programs the person is entitled for.
|
||||
* @param null $berechtigung_kurzbz If given, only study programs are retrieved according to organisational units
|
||||
* assigned to that permission.
|
||||
* @return array|bool array of studiengang_kz the person is entitled for. False on error.
|
||||
*/
|
||||
public function getSTG_isEntitledFor($berechtigung_kurzbz = null)
|
||||
{
|
||||
$studiengang_kz_arr = array();
|
||||
|
||||
if (self::$bb->getStgKz($berechtigung_kurzbz))
|
||||
{
|
||||
return $studiengang_kz_arr = self::$bb->getStgKz($berechtigung_kurzbz);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the organisational units the person is entitled for.
|
||||
* @param null $berechtigung_kurzbz
|
||||
* @return array|bool array of oe_kurzbz the person is entitled for. False on error.
|
||||
*/
|
||||
public function getOE_isEntitledFor($berechtigung_kurzbz = null)
|
||||
{
|
||||
$oe_kurzbz_arr = array();
|
||||
|
||||
if (self::$bb->getOEkurzbz($berechtigung_kurzbz))
|
||||
{
|
||||
return $oe_kurzbz_arr = self::$bb->getOEkurzbz($berechtigung_kurzbz);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class PersonLogLib
|
||||
{
|
||||
const PARKED_LOGNAME = 'Parked';
|
||||
const ONHOLD_LOGNAME = 'Onhold';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -75,7 +76,7 @@ class PersonLogLib
|
||||
return $decoded_logs;
|
||||
}
|
||||
else
|
||||
show_error($result->retval);
|
||||
show_error(getError($result));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,26 +92,20 @@ class PersonLogLib
|
||||
*/
|
||||
public function park($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null)
|
||||
{
|
||||
$logdata = array(
|
||||
$onhold = $this->getOnHoldDate($person_id);
|
||||
|
||||
if (hasData($onhold))
|
||||
return error("Person already on hold");
|
||||
|
||||
$logjson = array(
|
||||
'name' => self::PARKED_LOGNAME
|
||||
);
|
||||
|
||||
$data = array(
|
||||
'person_id' => $person_id,
|
||||
'zeitpunkt' => $date,
|
||||
'taetigkeit_kurzbz' => $taetigkeit_kurzbz,
|
||||
'app' => $app,
|
||||
'oe_kurzbz' => $oe_kurzbz,
|
||||
'logtype_kurzbz' => 'Processstate',
|
||||
'logdata' => json_encode($logdata),
|
||||
'insertvon' => $user
|
||||
);
|
||||
|
||||
return $this->ci->PersonLogModel->insert($data);
|
||||
return $this->_savePsLog($person_id, $date, $taetigkeit_kurzbz, $logjson, $app, $oe_kurzbz, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unparks a person, i.e. removes all log entries in the future
|
||||
* Unparks a person, i.e. removes all log entries in the future with logname for parking
|
||||
* @param $person_id
|
||||
* @return array with deleted logids
|
||||
*/
|
||||
@@ -131,17 +126,9 @@ class PersonLogLib
|
||||
{
|
||||
$deleted[] = $log->log_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $delresult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
|
||||
return success($deleted);
|
||||
}
|
||||
@@ -172,4 +159,111 @@ class PersonLogLib
|
||||
|
||||
return $parkeddate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets person on hold, i.e. marks a person so no actions are expected for the person (e.g. as a prestudent).
|
||||
* Done by adding a logentry with a special name. can be undone only manually by clicking button.
|
||||
* @param $person_id
|
||||
* @param $date
|
||||
* @param $taetigkeit_kurzbz
|
||||
* @param string $app
|
||||
* @param null $oe_kurzbz
|
||||
* @param null $user
|
||||
* @return array
|
||||
*/
|
||||
public function setOnHold($person_id, $date, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null)
|
||||
{
|
||||
$parked = $this->getParkedDate($person_id);
|
||||
|
||||
if (hasData($parked))
|
||||
return error("Person already parked");
|
||||
|
||||
$logjson = array(
|
||||
'name' => self::ONHOLD_LOGNAME
|
||||
);
|
||||
|
||||
return $this->_savePsLog($person_id, $date, $taetigkeit_kurzbz, $logjson, $app, $oe_kurzbz, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes on hold status, i.e. removes all log entries with logname for on hold
|
||||
* @param $person_id
|
||||
* @return array
|
||||
*/
|
||||
public function removeOnHold($person_id)
|
||||
{
|
||||
$deleted = array();
|
||||
|
||||
$result = $this->ci->PersonLogModel->filterLog($person_id);
|
||||
if (hasData($result))
|
||||
{
|
||||
foreach ($result->retval as $log)
|
||||
{
|
||||
$logdata = json_decode($log->logdata);
|
||||
if (isset($logdata->name) && $logdata->name === self::ONHOLD_LOGNAME)
|
||||
{
|
||||
$delresult = $this->ci->PersonLogModel->deleteLog($log->log_id);
|
||||
if (isSuccess($delresult))
|
||||
{
|
||||
$deleted[] = $log->log_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return success($deleted);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets date until which a person is on hold
|
||||
* @param $person_id
|
||||
* @return the date if person is on hold, null otherwise
|
||||
*/
|
||||
public function getOnHoldDate($person_id)
|
||||
{
|
||||
$result = $this->ci->PersonLogModel->filterLog($person_id);
|
||||
|
||||
$onholddate = null;
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
foreach ($result->retval as $log)
|
||||
{
|
||||
$logdata = json_decode($log->logdata);
|
||||
if (isset($logdata->name) && $logdata->name === self::ONHOLD_LOGNAME)
|
||||
{
|
||||
$onholddate = $log->zeitpunkt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $onholddate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a processstate log with specified parameters, including a specified log date.
|
||||
* @param $person_id
|
||||
* @param $date
|
||||
* @param $taetigkeit_kurzbz
|
||||
* @param $logjson
|
||||
* @param string $app
|
||||
* @param null $oe_kurzbz
|
||||
* @param null $user
|
||||
* @return mixed
|
||||
*/
|
||||
private function _savePsLog($person_id, $date, $taetigkeit_kurzbz, $logjson, $app = 'core', $oe_kurzbz = null, $user = null)
|
||||
{
|
||||
$data = array(
|
||||
'person_id' => $person_id,
|
||||
'zeitpunkt' => $date,
|
||||
'taetigkeit_kurzbz' => $taetigkeit_kurzbz,
|
||||
'app' => $app,
|
||||
'oe_kurzbz' => $oe_kurzbz,
|
||||
'logtype_kurzbz' => 'Processstate',
|
||||
'logdata' => json_encode($logjson),
|
||||
'insertvon' => $user
|
||||
);
|
||||
|
||||
return $this->ci->PersonLogModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* TableWidget logic
|
||||
*/
|
||||
class TableWidgetLib
|
||||
{
|
||||
const TABLE_UNIQUE_ID = 'tableUniqueId'; // TableWidget unique id
|
||||
|
||||
// TableWidget session name
|
||||
const SESSION_NAME = 'FHC_TABLE_WIDGET';
|
||||
|
||||
// Session elements
|
||||
const SESSION_FIELDS = 'fields';
|
||||
const SESSION_COLUMNS_ALIASES = 'columnsAliases';
|
||||
const SESSION_ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
const SESSION_CHECKBOXES = 'checkboxes';
|
||||
const SESSION_METADATA = 'datasetMetadata';
|
||||
const SESSION_ROW_NUMBER = 'rowNumber';
|
||||
const SESSION_TIMEOUT = 'sessionTimeout';
|
||||
|
||||
// Session dataset elements
|
||||
const SESSION_DATASET = 'dataset';
|
||||
const SESSION_DATASET_RELOAD = 'reloadDataset';
|
||||
const SESSION_DATASET_REPRESENTATION = 'datasetRepresentation';
|
||||
const SESSION_DATASET_REP_OPTIONS = 'datasetRepresentationOptions';
|
||||
const SESSION_DATASET_REP_FIELDS_DEFS = 'datasetRepresentationFieldsDefinitions';
|
||||
|
||||
// Default session timeout
|
||||
const SESSION_DEFAULT_TIMEOUT = 30;
|
||||
|
||||
// Alias for the dynamic table used to retrieve the dataset
|
||||
const DATASET_TABLE_ALIAS = 'datasetTableWidget';
|
||||
|
||||
// Parameters names...
|
||||
|
||||
// ...to reload the dataset
|
||||
const DATASET_RELOAD = 'reloadDataset';
|
||||
|
||||
// ...to specify permissions that are needed to use this TableWidget
|
||||
const REQUIRED_PERMISSIONS = 'requiredPermissions';
|
||||
|
||||
// ...stament to retrieve the dataset
|
||||
const QUERY = 'query';
|
||||
|
||||
// ...to specify more columns or aliases for them
|
||||
const ADDITIONAL_COLUMNS = 'additionalColumns';
|
||||
const CHECKBOXES = 'checkboxes';
|
||||
const COLUMNS_ALIASES = 'columnsAliases';
|
||||
|
||||
// ...to format/mark records of a dataset
|
||||
const FORMAT_ROW = 'formatRow';
|
||||
const MARK_ROW = 'markRow';
|
||||
|
||||
// ...to specify how to represent the dataset (ex: tablesorter, pivotUI, ...)
|
||||
const DATASET_REPRESENTATION = 'datasetRepresentation';
|
||||
const DATASET_REP_OPTIONS = 'datasetRepOptions';
|
||||
const DATASET_REP_FIELDS_DEFS = 'datasetRepFieldsDefs';
|
||||
const DATASET_TIMEOUT = 'datasetTimeout'; // ...and its expiring time
|
||||
|
||||
// Different dataset representations
|
||||
const DATASET_REP_TABLESORTER = 'tablesorter';
|
||||
const DATASET_REP_PIVOTUI = 'pivotUI';
|
||||
const DATASET_REP_TABULATOR = 'tabulator';
|
||||
|
||||
const PERMISSION_TABLE_METHOD = 'TableWidget'; // Name for fake method to be checked by the PermissionLib
|
||||
const PERMISSION_TYPE = 'rw';
|
||||
|
||||
private $_ci; // Code igniter instance
|
||||
private $_tableUniqueId; // unique id for this table widget
|
||||
|
||||
/**
|
||||
* Gets the CI instance and loads message helper
|
||||
*/
|
||||
public function __construct($params = null)
|
||||
{
|
||||
$this->_ci =& get_instance(); // get code igniter instance
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Checks if at least one of the permissions given as parameter (requiredPermissions) belongs
|
||||
* to the authenticated user, if confirmed then is allowed to use this FilterWidget.
|
||||
* If the parameter requiredPermissions is NOT given or is not present in the session,
|
||||
* then NO one is allow to use this FilterWidget
|
||||
* Wrapper method to permissionlib->hasAtLeastOne
|
||||
*/
|
||||
public function isAllowed($requiredPermissions = null)
|
||||
{
|
||||
$this->_ci->load->library('PermissionLib'); // Load permission library
|
||||
|
||||
// Gets the required permissions from the session if they are not provided as parameter
|
||||
$rq = $requiredPermissions;
|
||||
if ($rq == null) $rq = $this->getSessionElement(self::REQUIRED_PERMISSIONS);
|
||||
|
||||
return $this->_ci->permissionlib->hasAtLeastOne($rq, self::PERMISSION_TABLE_METHOD, self::PERMISSION_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrieve the whole session for this table widget
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
return getSessionElement(self::SESSION_NAME, $this->_tableUniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to retrieve one element from the session of this table widget
|
||||
*/
|
||||
public function getSessionElement($name)
|
||||
{
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_tableUniqueId);
|
||||
|
||||
if (isset($session[$name]))
|
||||
{
|
||||
return $session[$name];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set the whole session for this table widget
|
||||
*/
|
||||
public function setSession($data)
|
||||
{
|
||||
setSessionElement(self::SESSION_NAME, $this->_tableUniqueId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to the session helper funtions to set one element in the session for this table widget
|
||||
*/
|
||||
public function setSessionElement($name, $value)
|
||||
{
|
||||
$session = getSessionElement(self::SESSION_NAME, $this->_tableUniqueId);
|
||||
|
||||
$session[$name] = $value;
|
||||
|
||||
setSessionElement(self::SESSION_NAME, $this->_tableUniqueId, $session); // stores the single value
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function dropExpiredTableWidgets()
|
||||
{
|
||||
// Loads the session for all the table widgets
|
||||
$tableWidgetsSession = getSession(self::SESSION_NAME);
|
||||
|
||||
// If something is present in session
|
||||
if ($tableWidgetsSession != null)
|
||||
{
|
||||
// Loops in the session for all the table widgets
|
||||
foreach ($tableWidgetsSession as $tableWidget => $tableWidgetData)
|
||||
{
|
||||
// If this table widget is not the currrent used table widget and the it is expired...
|
||||
if ($this->_tableUniqueId != $tableWidget && $tableWidgetData[self::SESSION_TIMEOUT] <= time())
|
||||
{
|
||||
cleanSessionElement(self::SESSION_NAME, $tableWidget); // ...remove it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the query to retrieve the dataset for a table widget
|
||||
*/
|
||||
public function generateDatasetQuery($query)
|
||||
{
|
||||
return 'SELECT * FROM ('.$query.') '.self::DATASET_TABLE_ALIAS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the dataset from the DB
|
||||
*/
|
||||
public function getDataset($datasetQuery)
|
||||
{
|
||||
$dataset = null;
|
||||
|
||||
if ($datasetQuery != null)
|
||||
{
|
||||
$this->_ci->load->model('system/Filters_model', 'FiltersModel');
|
||||
|
||||
// Execute the given SQL statement suppressing error messages
|
||||
$dataset = @$this->_ci->FiltersModel->execReadOnlyQuery($datasetQuery);
|
||||
}
|
||||
|
||||
return $dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves metadata from the last executed query
|
||||
*/
|
||||
public function getExecutedQueryMetaData()
|
||||
{
|
||||
return $this->_ci->FiltersModel->getExecutedQueryMetaData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of fields from the last executed query
|
||||
*/
|
||||
public function getExecutedQueryListFields()
|
||||
{
|
||||
return $this->_ci->FiltersModel->getExecutedQueryListFields();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an unique string that identify this table widget
|
||||
* NOTE: The default value is the URI where the FilterWidget is called
|
||||
* If the fhc_controller_id is present then is also used
|
||||
*/
|
||||
public function setTableUniqueIdByParams($params)
|
||||
{
|
||||
if ($params != null
|
||||
&& is_array($params)
|
||||
&& isset($params[self::TABLE_UNIQUE_ID])
|
||||
&& !isEmptyString($params[self::TABLE_UNIQUE_ID]))
|
||||
{
|
||||
$tableUniqueId = $this->_ci->router->directory.$this->_ci->router->class.'/'.
|
||||
$this->_ci->router->method.'/'.
|
||||
$params[self::TABLE_UNIQUE_ID];
|
||||
|
||||
$this->setTableUniqueId($tableUniqueId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the _tableUniqueId property
|
||||
*/
|
||||
public function setTableUniqueId($tableUniqueId)
|
||||
{
|
||||
$this->_tableUniqueId = $tableUniqueId;
|
||||
}
|
||||
}
|
||||
@@ -540,7 +540,7 @@ class UDFLib
|
||||
{
|
||||
if (is_object($udfResults) && isset($udfResults->retval))
|
||||
{
|
||||
show_error($udfResults->retval);
|
||||
show_error(getError($udfResults));
|
||||
}
|
||||
elseif (is_string($udfResults))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Class VariableLib
|
||||
* Provides functionality for managing uservariables for currently logged in user.
|
||||
* Preloads variables for a user, so variables can be retrieved from views without getting uid again.
|
||||
*/
|
||||
class VariableLib
|
||||
{
|
||||
private $_variables; // Contains the retrieved variables
|
||||
|
||||
/**
|
||||
* VariableLib constructor.
|
||||
* Loads variable of logged in user.
|
||||
* @param $loggeduid
|
||||
*/
|
||||
public function __construct($loggeduid)
|
||||
{
|
||||
$this->_ci =& get_instance();
|
||||
|
||||
$this->_variables = null;
|
||||
|
||||
$this->_ci->load->model('system/Variable_model', 'VariableModel');
|
||||
$this->_ci->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
if (isset($loggeduid['uid']) && !isEmptyString($loggeduid['uid']))
|
||||
$this->_setVariables($loggeduid['uid']);
|
||||
else
|
||||
{
|
||||
show_error('uid of logged user not passed!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an already loaded user variable by variable name.
|
||||
* @param $name
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getVar($name)
|
||||
{
|
||||
return isset($this->_variables[$name]) ? $this->_variables[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes variables having Studiensemester as value. Sets variable value to next or previous Semester.
|
||||
* @param $uid variable is set for this user
|
||||
* @param $name variable name
|
||||
* @param $change if positive, variable value is set to next semester, negative - previous semester
|
||||
* @return array if change was successfull, uid and variable name. Infotext otherwise.
|
||||
*/
|
||||
public function changeStudiensemesterVar($uid, $name, $change)
|
||||
{
|
||||
$result = error('error when setting variable!');
|
||||
$notchangedtext = "Studiensemester variable not changed.";
|
||||
|
||||
if (!isEmptyString($uid) && !isEmptyString($name) && is_numeric($change))
|
||||
{
|
||||
$change = (int) $change;
|
||||
$varres = $this->_ci->VariableModel->getVariables($uid, array($name));
|
||||
|
||||
if (isSuccess($varres))
|
||||
{
|
||||
if (hasData($varres))
|
||||
{
|
||||
$currStudiensemester = getData($varres);
|
||||
|
||||
if ($change === 0)
|
||||
{
|
||||
$result = success($notchangedtext);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($change > 0)
|
||||
{
|
||||
$changedsem = $this->_ci->StudiensemesterModel->getNextFrom($currStudiensemester[$name]);
|
||||
}
|
||||
elseif ($change < 0)
|
||||
{
|
||||
$changedsem = $this->_ci->StudiensemesterModel->getPreviousFrom($currStudiensemester[$name]);
|
||||
}
|
||||
|
||||
if (hasData($changedsem))
|
||||
{
|
||||
$changedsem = getData($changedsem);
|
||||
|
||||
$result = $this->_ci->VariableModel->setVariable($uid, $name, $changedsem[0]->studiensemester_kurzbz);
|
||||
//update property
|
||||
$this->_setVariable($uid, $name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = success($notchangedtext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Refreshes" variable value with given name by retrieving current value from db and saving it.
|
||||
* @param $uid
|
||||
* @param $name
|
||||
*/
|
||||
private function _setVariable($uid, $name)
|
||||
{
|
||||
$variable = $this->_ci->VariableModel->getVariables($uid, array($name));
|
||||
|
||||
if (hasData($variable))
|
||||
{
|
||||
$variable = getData($variable);
|
||||
$this->_variables[$name] = $variable[$name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* "Refreshes" all variable values by retrieving current values from db and saving them.
|
||||
* @param $uid
|
||||
*/
|
||||
private function _setVariables($uid)
|
||||
{
|
||||
$variables = $this->_ci->VariableModel->getVariables($uid);
|
||||
if (hasData($variables))
|
||||
{
|
||||
$this->_variables = getData($variables);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,7 @@ class Konto_model extends DB_Model
|
||||
$this->addJoin('wawi.tbl_konto_kostenstelle', 'konto_id');
|
||||
$konten = $this->loadWhere(array('kostenstelle_id' => $kostenstelle_id));
|
||||
|
||||
if ($konten->error)
|
||||
return error($konten->retval);
|
||||
if ($konten->error) return $konten;
|
||||
|
||||
return $konten;
|
||||
}
|
||||
|
||||
@@ -10,5 +10,324 @@ class Vertrag_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_vertrag';
|
||||
$this->pk = 'vertrag_id';
|
||||
|
||||
$this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel');
|
||||
$this->load->model('education/Lehreinheitmitarbeiter_model', 'LehreinheitmitarbeiterModel');
|
||||
$this->load->model('education/Projektbetreuer_model', 'ProjektbetreuerModel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves Vertrag for a Lehrauftrag and sets Vertragsstatus to 'bestellt'.
|
||||
* Also updates vertrag_id in tbl_lehreinheitmitarbeiter or tbl_projektbetreuer.
|
||||
* @param $person_id
|
||||
* @param $lehrveranstaltung_id
|
||||
* @param $lehreinheit_id
|
||||
* @param $projektarbeit_id
|
||||
* @param $betrag Monetary amount of that Lehreinheit / Projektbetreuung.
|
||||
* @param $vertragsstunden Working hours of that Lehreinheit / Projektbetreuung.
|
||||
* @param $studiensemester_kurzbz
|
||||
* @param $vertragstyp_kurzbz
|
||||
* @return array|null On success object. On failure null.
|
||||
*/
|
||||
public function save($person_id, $mitarbeiter_uid, $lehrveranstaltung_id, $lehreinheit_id, $projektarbeit_id = null, $vertragsstunden, $betrag, $studiensemester_kurzbz)
|
||||
{
|
||||
$person_id = (isset($person_id) && is_numeric($person_id))
|
||||
? $person_id
|
||||
: show_error('peron_id must be set and numeric.');
|
||||
$lehreinheit_id = (isset($lehreinheit_id) && is_numeric($lehreinheit_id))
|
||||
? $lehreinheit_id
|
||||
: show_error('lehreinheit_id must be set and numeric.');
|
||||
$lehrveranstaltung_id = (isset($lehrveranstaltung_id) && is_numeric($lehrveranstaltung_id))
|
||||
? $lehrveranstaltung_id
|
||||
: show_error('lehrveranstaltung_id must be set and numeric.');
|
||||
$projektarbeit_id = (isset($projektarbeit_id) && is_numeric($projektarbeit_id))
|
||||
? $projektarbeit_id
|
||||
: null;
|
||||
$vertragsstunden = (isset($vertragsstunden) && is_numeric($vertragsstunden))
|
||||
? $vertragsstunden
|
||||
: 0;
|
||||
$betrag = (isset($betrag) && is_numeric($betrag))
|
||||
? $betrag
|
||||
: 0;
|
||||
$mitarbeiter_uid = (isset($mitarbeiter_uid) && is_string($mitarbeiter_uid))
|
||||
? $mitarbeiter_uid
|
||||
: show_error('mitarbeiter_uid must be set and a string value.');;
|
||||
|
||||
$vertragstyp_kurzbz = (is_null($projektarbeit_id)) ? 'Lehrauftrag' : 'Betreuung';
|
||||
|
||||
// First check if Vertrag already exists for that Lehrauftrag or for that Projektbetreuerauftrag
|
||||
if ($vertragstyp_kurzbz == 'Lehrauftrag')
|
||||
{
|
||||
if ($this->LehreinheitmitarbeiterModel->hasVertrag($mitarbeiter_uid, $lehreinheit_id))
|
||||
{
|
||||
return error('Lehrauftrag existiert bereits'); // Exit if Lehrauftrag already has Vertrag
|
||||
}
|
||||
}
|
||||
elseif ($vertragstyp_kurzbz == 'Betreuung')
|
||||
{
|
||||
if ($this->ProjektbetreuerModel->hasVertrag($person_id, $projektarbeit_id))
|
||||
{
|
||||
return error('Lehrauftrag existiert bereits'); // Exit if Projektbetreuung already has Vertrag
|
||||
}
|
||||
}
|
||||
|
||||
// If Vertrag does not exist, create now
|
||||
// Vertragsbezeichnung
|
||||
$bezeichnung = $this->_writeVertragsbezeichung($lehrveranstaltung_id, $studiensemester_kurzbz);
|
||||
|
||||
// Start DB transaction
|
||||
$this->db->trans_start(false);
|
||||
|
||||
// Insert Vertragsdata
|
||||
$result = $this->insert(
|
||||
array(
|
||||
'person_id' => $person_id,
|
||||
'lehrveranstaltung_id' => $lehrveranstaltung_id,
|
||||
'vertragstyp_kurzbz' => $vertragstyp_kurzbz,
|
||||
'bezeichnung' => $bezeichnung,
|
||||
'betrag' => $betrag,
|
||||
'insertamum' => 'NOW()',
|
||||
'insertvon' => getAuthUID(),
|
||||
'vertragsdatum' => 'NOW()',
|
||||
'vertragsstunden' => $vertragsstunden,
|
||||
'vertragsstunden_studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
)
|
||||
);
|
||||
|
||||
// Retrieve primary key
|
||||
$vertrag_id = $result->retval;
|
||||
|
||||
// If Vertrag was created successfully, update vertrag_id
|
||||
if (isSuccess($result))
|
||||
{
|
||||
// if Lehrtätigkeit, update vertrag_id in tbl_lehreinheitmitarbeiter
|
||||
if ($vertragstyp_kurzbz == 'Lehrauftrag')
|
||||
{
|
||||
$this->load->model('education/Lehreinheitmitarbeiter_model', 'LehreinheitmitarbeiterModel');
|
||||
$result = $this->LehreinheitmitarbeiterModel->update(
|
||||
array(
|
||||
'lehreinheit_id' => $lehreinheit_id,
|
||||
'mitarbeiter_uid' =>$mitarbeiter_uid
|
||||
),
|
||||
array(
|
||||
'vertrag_id' => $vertrag_id
|
||||
)
|
||||
);
|
||||
}
|
||||
// if (Projekt-)Betreuung, update vertrag_id in tbl_projektbetreuer
|
||||
elseif ($vertragstyp_kurzbz == 'Betreuung')
|
||||
{
|
||||
$this->load->model('education/Projektbetreuer_model', 'ProjektbetreuerModel');
|
||||
$result = $this->ProjektbetreuerModel->update(
|
||||
array(
|
||||
'person_id' => $person_id,
|
||||
'projektarbeit_id' => $projektarbeit_id
|
||||
),
|
||||
array(
|
||||
'vertrag_id' => $vertrag_id
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// If updating vertrag_id was successfully, set Status to 'bestellt'
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$result = $this->VertragvertragsstatusModel->setStatus($vertrag_id, $mitarbeiter_uid, 'bestellt');
|
||||
}
|
||||
|
||||
// Transaction complete!
|
||||
$this->db->trans_complete();
|
||||
|
||||
// Check if everything went ok during the transaction
|
||||
if ($this->db->trans_status() === false || isError($result))
|
||||
{
|
||||
$this->db->trans_rollback();
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->trans_commit();
|
||||
return success($vertrag_id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates Vertrag and, if resets vertragsstatus as follows:
|
||||
* - if vertragsstatus 'erteilt': delete status 'erteilt' and update date of status 'bestellt'
|
||||
* - if vertragsstatus 'bestellt': update date of status 'bestellt'
|
||||
* @param $vertrag_obj Object with vertrag properties vertrag_id, vertragsstunden, betrag.
|
||||
* @param $mitarbeiter_uid
|
||||
*/
|
||||
public function updateVertrag($vertrag_id, $vertragsstunden, $betrag, $mitarbeiter_uid)
|
||||
{
|
||||
$vertrag_id = (isset($vertrag_id) && is_numeric($vertrag_id))
|
||||
? $vertrag_id
|
||||
: show_error('vertrag_id must be set and numeric.');
|
||||
$vertragsstunden = (isset($vertragsstunden) && is_numeric($vertragsstunden))
|
||||
? $vertragsstunden
|
||||
: 0;
|
||||
$betrag = (isset($betrag) && is_numeric($betrag))
|
||||
? $betrag
|
||||
: 0;
|
||||
$mitarbeiter_uid = (isset($mitarbeiter_uid) && is_string($mitarbeiter_uid))
|
||||
? $mitarbeiter_uid
|
||||
: show_error('mitarbeiter_uid must be set and a string value.');
|
||||
|
||||
// Start DB transaction
|
||||
$this->db->trans_start(false);
|
||||
|
||||
// Update contract
|
||||
$result = $this->update(
|
||||
$vertrag_id,
|
||||
array(
|
||||
'vertragsstunden' => $vertragsstunden,
|
||||
'betrag' => $betrag,
|
||||
'updateamum' => $this->escape('NOW()'),
|
||||
'updatevon' => getAuthUID()
|
||||
)
|
||||
);
|
||||
|
||||
// If last vertragsstatus is 'erteilt', delete the status
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$result = $this->VertragvertragsstatusModel->getLastStatus($vertrag_id, $mitarbeiter_uid);
|
||||
|
||||
$lastStatus = getData($result)[0]->vertragsstatus_kurzbz;
|
||||
|
||||
if ($lastStatus == 'erteilt')
|
||||
{
|
||||
$result = $this->VertragvertragsstatusModel->deleteStatus($vertrag_id, 'erteilt');
|
||||
}
|
||||
}
|
||||
|
||||
// Update date of status 'bestellt'
|
||||
if (isSuccess($result))
|
||||
{
|
||||
$result = $this->VertragvertragsstatusModel->updateStatus($vertrag_id, 'bestellt');
|
||||
}
|
||||
|
||||
// Transaction complete!
|
||||
$this->db->trans_complete();
|
||||
|
||||
// Check if everything went ok during the transaction
|
||||
if ($this->db->trans_status() === false || isError($result))
|
||||
{
|
||||
$this->db->trans_rollback();
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->trans_commit();
|
||||
return success('Contract successfully updated.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Lehreinheit ID corresponding to the contract.
|
||||
* @param $vertrag_id
|
||||
* @return array
|
||||
*/
|
||||
public function getLehreinheitID($vertrag_id)
|
||||
{
|
||||
$vertragstyp_kurzbz = null;
|
||||
|
||||
$this->addSelect('vertragstyp_kurzbz');
|
||||
if ($result = getData($this->load($vertrag_id)))
|
||||
{
|
||||
$vertragstyp_kurzbz = $result[0]->vertragstyp_kurzbz;
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Fehler beim Laden des Vertrags.');
|
||||
}
|
||||
|
||||
if ($vertragstyp_kurzbz == 'Lehrauftrag')
|
||||
{
|
||||
$this->LehreinheitmitarbeiterModel->addSelect('lehreinheit_id');
|
||||
if ($result = $this->LehreinheitmitarbeiterModel->loadWhere(array('vertrag_id' => $vertrag_id)))
|
||||
{
|
||||
return success($result->retval);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Fehler beim Ermitteln der Lehreinheit ID');
|
||||
}
|
||||
|
||||
}
|
||||
elseif ($vertragstyp_kurzbz == 'Betreuung')
|
||||
{
|
||||
$this->addSelect('lehreinheit_id');
|
||||
$this->addJoin('lehre.tbl_projektbetreuer', 'vertrag_id');
|
||||
$this->addJoin('lehre.tbl_projektarbeit', 'projektarbeit_id');
|
||||
if ($result = $this->loadWhere(array('vertrag_id' => $vertrag_id)))
|
||||
{
|
||||
return success($result->retval);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Fehler beim Ermitteln der Lehreinheit ID');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets (table) data of lehreinheit_id corresponding to the contract.
|
||||
* @param integer $vertrag_id
|
||||
* @param string $select To restrict fields, pass select string. e.g. 'lehrveranstaltung_id'.
|
||||
* @return array
|
||||
*/
|
||||
public function getLehreinheitData($vertrag_id, $select = '*')
|
||||
{
|
||||
if ($result = getData($this->getLehreinheitID($vertrag_id)))
|
||||
{
|
||||
$this->load->model('education/Lehreinheit_model', 'LehreinheitModel');
|
||||
$this->LehreinheitModel->addSelect($select);
|
||||
|
||||
if($result = $this->LehreinheitModel->load($result[0]->lehreinheit_id))
|
||||
{
|
||||
return success($result->retval);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Fehler beim Laden der Lehreinheit');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return error('Fehler beim Ermitteln der Lehreinheit ID');
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
/**
|
||||
* Generate contract description.
|
||||
* Example: WS2017-BEE3-LIA-LAB
|
||||
* @param $lehrveranstaltung_id
|
||||
* @param $studiensemester_kurzbz Studiensemester of Lehrauftrag (= when the lector will teach the lehrveranstaltung)
|
||||
* @return string Returns e.g. WS2017-BBE5-GAP-LAB
|
||||
*/
|
||||
private function _writeVertragsbezeichung($lehrveranstaltung_id, $studiensemester_kurzbz)
|
||||
{
|
||||
$bezeichnung = '';
|
||||
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
|
||||
$this->LehrveranstaltungModel->addSelect('tbl_lehrveranstaltung.semester, tbl_lehrveranstaltung.kurzbz AS "lv_kurzbz", lehrform_kurzbz, public.tbl_studiengang.typ, public.tbl_studiengang.kurzbz');
|
||||
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan_lehrveranstaltung', 'lehrveranstaltung_id');
|
||||
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan', 'studienplan_id');
|
||||
$this->LehrveranstaltungModel->addJoin('lehre.tbl_studienordnung', 'studienordnung_id');
|
||||
$this->LehrveranstaltungModel->addJoin('public.tbl_studiengang', 'public.tbl_studiengang.studiengang_kz = lehre.tbl_studienordnung.studiengang_kz');
|
||||
$result = $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$bezeichnung = $studiensemester_kurzbz. '-';
|
||||
$bezeichnung.= strtoupper($result->retval[0]->typ. $result->retval[0]->kurzbz). $result->retval[0]->semester. '-';
|
||||
$bezeichnung.= $result->retval[0]->lv_kurzbz. '-';
|
||||
$bezeichnung.= $result->retval[0]->lehrform_kurzbz;
|
||||
}
|
||||
|
||||
return $bezeichnung;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
class Vertragvertragsstatus_model extends DB_Model
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_vertrag_vertragsstatus';
|
||||
$this->pk = array('vertragsstatus_kurzbz', 'vertrag_id');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Vertrag has the given Vertragsstatus.
|
||||
* @param integer $vertrag_id
|
||||
* @param string $mitarbeiter_uid
|
||||
* @param string $vertragsstatus_kurzbz
|
||||
* @return array
|
||||
*/
|
||||
public function hasStatus($vertrag_id, $mitarbeiter_uid, $vertragsstatus_kurzbz)
|
||||
{
|
||||
$this->addSelect('1');
|
||||
$this->addLimit(1);
|
||||
|
||||
return $this->loadWhere(array(
|
||||
'vertrag_id' => $vertrag_id,
|
||||
'uid' => $mitarbeiter_uid,
|
||||
'vertragsstatus_kurzbz' => $vertragsstatus_kurzbz
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest Vertragsstatus for the given Vertrag and Mitarbeiter
|
||||
* @param integer $vertrag_id
|
||||
* @param string $mitarbeiter_uid
|
||||
* @return array
|
||||
*/
|
||||
public function getLastStatus($vertrag_id, $mitarbeiter_uid)
|
||||
{
|
||||
$this->addSelect('vertragsstatus_kurzbz');
|
||||
$this->addOrder('datum', 'DESC');
|
||||
$this->addLimit(1);
|
||||
return $this->loadWhere(
|
||||
array(
|
||||
'vertrag_id' => $vertrag_id,
|
||||
'uid' => $mitarbeiter_uid
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Vertragsstatus for the given Vertrag and Mitarbeiter.
|
||||
* @param integer $vertrag_id
|
||||
* @param string $mitarbeiter_uid
|
||||
* @param string $vertragsstatus_kurzbz
|
||||
* @return object On success, return success object.
|
||||
* If status already exists or earlier status is missing, return error object.
|
||||
*/
|
||||
public function setStatus($vertrag_id, $mitarbeiter_uid, $vertragsstatus_kurzbz){
|
||||
|
||||
// Check if vertrag has already this status
|
||||
$result = $this->hasStatus($vertrag_id, $mitarbeiter_uid, $vertragsstatus_kurzbz);
|
||||
|
||||
// If status is already set, return error message
|
||||
if (hasData($result))
|
||||
{
|
||||
return error('Fehler: Status bereits vorhanden.');
|
||||
}
|
||||
|
||||
// If new status should be 'akzeptiert', the latest status has to be 'erteilt'
|
||||
if ($vertragsstatus_kurzbz == 'akzeptiert')
|
||||
{
|
||||
$result = $this->getLastStatus($vertrag_id, $mitarbeiter_uid);
|
||||
$last_status = getData($result)[0]->vertragsstatus_kurzbz;
|
||||
|
||||
// If latest status is not 'erteilt', return error message
|
||||
if ($last_status != 'erteilt')
|
||||
{
|
||||
return error('Fehler: Vor Status \'angenommen\' muss erst Status \'erteilt\' gesetzt sein.');
|
||||
}
|
||||
}
|
||||
|
||||
// Set new status if passed all checks
|
||||
return $this->insert(
|
||||
array(
|
||||
'vertrag_id' => $vertrag_id,
|
||||
'vertragsstatus_kurzbz' => $vertragsstatus_kurzbz,
|
||||
'uid' => $mitarbeiter_uid,
|
||||
'datum' => $this->escape('NOW()'),
|
||||
'insertvon' => getAuthUID(),
|
||||
'insertamum' => $this->escape('NOW()')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the date of the given vertragsstatus.
|
||||
* @param $vertrag_id
|
||||
* @param $vertragsstatus_kurzbz
|
||||
* @return array
|
||||
*/
|
||||
public function updateStatus($vertrag_id, $vertragsstatus_kurzbz)
|
||||
{
|
||||
$user = getAuthUID();
|
||||
return $this->update(
|
||||
array(
|
||||
'vertrag_id' => $vertrag_id,
|
||||
'vertragsstatus_kurzbz' => $vertragsstatus_kurzbz
|
||||
),
|
||||
array(
|
||||
'datum' => $this->escape('NOW()'),
|
||||
'updateamum' => $this->escape('NOW()'),
|
||||
'updatevon' => $user,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the given vertragsstatus of the contract.
|
||||
* @param $vertrag_id
|
||||
* @param $vertragsstatus_kurbz
|
||||
* @return array
|
||||
*/
|
||||
public function deleteStatus($vertrag_id, $vertragsstatus_kurzbz)
|
||||
{
|
||||
return $this->delete(
|
||||
array(
|
||||
'vertrag_id' => $vertrag_id,
|
||||
'vertragsstatus_kurzbz' => $vertragsstatus_kurzbz
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all contracts, where the status had been set to 'bestellt' on given date
|
||||
* @param string $string_date e.g. '01.11.2019' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW'
|
||||
* @param bool $further_processed If true, ALL ordered contracts of that day are retrieved, even if they were
|
||||
* were ALSO approved/accepted/cancelled (further processed) on that same day.
|
||||
* @return array
|
||||
*/
|
||||
public function getOrdered_fromDate($string_date = 'TODAY', $further_processed = false)
|
||||
{
|
||||
$condition = '
|
||||
vertragsstatus_kurzbz = \'bestellt\' AND
|
||||
(datum)::date = date \''. $string_date .'\'
|
||||
';
|
||||
|
||||
if (!$further_processed)
|
||||
{
|
||||
$condition .= '
|
||||
AND
|
||||
vertrag_id NOT IN (
|
||||
SELECT vertrag_id
|
||||
FROM lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE vertragsstatus_kurzbz IN (\'erteilt\', \'akzeptiert\', \'storno\')
|
||||
)
|
||||
';
|
||||
}
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all contracts, where the status had been set to 'erteilt' on given date
|
||||
* @param string $string_date e.g. '01.11.2019' or special Date/Time inputs like 'YESTERDAY', 'TODAY', 'NOW'
|
||||
* @param bool $further_processed If true, ALL contracts approved on that day are retrieved, even if they were
|
||||
* were ALSO accepted/cancelled (further processed) on that same day.
|
||||
* @return array
|
||||
*/
|
||||
public function getApproved_fromDate($string_date = 'TODAY', $further_processed = false)
|
||||
{
|
||||
$condition = '
|
||||
vertragsstatus_kurzbz = \'erteilt\' AND
|
||||
(datum)::date = date \''. $string_date .'\'
|
||||
';
|
||||
|
||||
if (!$further_processed)
|
||||
{
|
||||
$condition .= '
|
||||
AND
|
||||
vertrag_id NOT IN (
|
||||
SELECT vertrag_id
|
||||
FROM lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE vertragsstatus_kurzbz IN (\'akzeptiert\', \'storno\')
|
||||
)
|
||||
';
|
||||
}
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
class Bisiozweck_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'bis.tbl_bisio_zweck';
|
||||
$this->pk = array('bisio_id', 'zweck_code');
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
}
|
||||
@@ -11,4 +11,34 @@ class Bisverwendung_model extends DB_Model
|
||||
$this->dbTable = 'bis.tbl_bisverwendung';
|
||||
$this->pk = 'bisverwendung_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get latest (active) Verwendung of the user.
|
||||
* @param string $uid
|
||||
* @param bool $active If false, returns latest Verwendung no matter if actual or not (ignores ending/beginning date).
|
||||
* @return array
|
||||
*/
|
||||
public function getLast($uid, $active = true)
|
||||
{
|
||||
$this->addLimit(1);
|
||||
|
||||
if ($active)
|
||||
{
|
||||
$condition = '
|
||||
mitarbeiter_uid = '. $this->escape($uid). '
|
||||
AND ( beginn <= NOW() OR beginn IS NULL )
|
||||
AND ( ende >= NOW() OR ende IS NULL )
|
||||
ORDER BY ende DESC NULLS LAST, beginn DESC NULLS LAST
|
||||
';
|
||||
}
|
||||
else
|
||||
{
|
||||
$condition = '
|
||||
mitarbeiter_uid = '. $this->escape($uid). '
|
||||
ORDER BY ende DESC NULLS LAST, beginn DESC NULLS LAST
|
||||
';
|
||||
}
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,8 +186,7 @@ class Akte_model extends DB_Model
|
||||
|
||||
$dokumente = $this->loadWhere($where);
|
||||
|
||||
if($dokumente->error)
|
||||
return error($dokumente->retval);
|
||||
if($dokumente->error) return $dokumente;
|
||||
|
||||
return success($dokumente->retval);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ class Prestudent_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_prestudent';
|
||||
$this->pk = 'prestudent_id';
|
||||
|
||||
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,12 +210,11 @@ class Prestudent_model extends DB_Model
|
||||
return error('prestudent could not be loaded');
|
||||
|
||||
//Prestudentstatus
|
||||
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
|
||||
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
|
||||
if ($lastStatus->error)
|
||||
{
|
||||
return error($lastStatus->retval);
|
||||
return $lastStatus;
|
||||
}
|
||||
|
||||
if (count($lastStatus->retval) > 0)
|
||||
@@ -221,7 +222,7 @@ class Prestudent_model extends DB_Model
|
||||
//get Studiengangname from Studienplan and -ordnung
|
||||
$studienordnung = $this->PrestudentstatusModel->getStudienordnungFromPrestudent($prestudent_id);
|
||||
if ($studienordnung->error)
|
||||
return error($studienordnung->retval);
|
||||
return $studienordnung;
|
||||
|
||||
if (count($studienordnung->retval) > 0)
|
||||
{
|
||||
@@ -238,7 +239,7 @@ class Prestudent_model extends DB_Model
|
||||
$language = $this->SpracheModel->load($lastStatus->retval[0]->sprache);
|
||||
|
||||
if ($language->error)
|
||||
return error($language->retval);
|
||||
return $language;
|
||||
|
||||
if (count($language->retval) > 0)
|
||||
$lastStatus->retval[0]->sprachedetails = $language->retval[0];
|
||||
@@ -256,7 +257,7 @@ class Prestudent_model extends DB_Model
|
||||
)
|
||||
);
|
||||
if ($bewerbungstermin->error)
|
||||
return error($bewerbungstermin->retval);
|
||||
return $bewerbungstermin;
|
||||
|
||||
if (count($bewerbungstermin->retval) > 0)
|
||||
{
|
||||
@@ -310,8 +311,6 @@ class Prestudent_model extends DB_Model
|
||||
if (!hasData($prestudents))
|
||||
return $bewerbungen;
|
||||
|
||||
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
foreach ($prestudents->retval as $prestudent)
|
||||
{
|
||||
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent->prestudent_id, $studiensemester_kurzbz);
|
||||
@@ -424,7 +423,6 @@ class Prestudent_model extends DB_Model
|
||||
if (!hasData($prestudent))
|
||||
return false;
|
||||
|
||||
$this->load->model('prestudentstatus_model', 'PrestudentstatusModel');
|
||||
$lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id, null, 'Interessent');
|
||||
|
||||
if (!hasData($lastStatus))
|
||||
|
||||
@@ -123,7 +123,7 @@ class Prestudentstatus_model extends DB_Model
|
||||
|
||||
if ($lastStatus->error)
|
||||
{
|
||||
return error($lastStatus->retval);
|
||||
return $lastStatus;
|
||||
}
|
||||
|
||||
if (count($lastStatus->retval) > 0)
|
||||
@@ -158,7 +158,7 @@ class Prestudentstatus_model extends DB_Model
|
||||
|
||||
if ($lastStatus->error)
|
||||
{
|
||||
return error($lastStatus->retval);
|
||||
return $lastStatus;
|
||||
}
|
||||
|
||||
if (count($lastStatus->retval) > 0)
|
||||
|
||||
@@ -28,6 +28,7 @@ class Lehreinheit_model extends DB_Model
|
||||
{
|
||||
$lehreinheiten = array();
|
||||
|
||||
$this->addOrder('lehreinheit_id');
|
||||
$les = $this->loadWhere(
|
||||
array('lehrveranstaltung_id' => $lehrveranstaltung_id,
|
||||
'studiensemester_kurzbz' => $studiensemester)
|
||||
@@ -62,17 +63,17 @@ class Lehreinheit_model extends DB_Model
|
||||
if (hasData($studiengangresponse))
|
||||
{
|
||||
$studiengang = $studiengangresponse->retval[0];
|
||||
$stgkuerzel = mb_strtoupper($studiengang->typ . $studiengang->kurzbz);
|
||||
$stgkuerzel = mb_strtoupper($studiengang->typ.$studiengang->kurzbz);
|
||||
|
||||
$letoadd->lehreinheitgruppen[] = array(
|
||||
'semester' => $lehreinheitgruppe->semester,
|
||||
'verband' => $lehreinheitgruppe->verband,
|
||||
'gruppe' => $lehreinheitgruppe->gruppe,
|
||||
'gruppe_kurzbz' => $lehreinheitgruppe->gruppe_kurzbz,
|
||||
'direktinskription' => $lehreinheitgruppe->direktinskription,
|
||||
'studiengang_kz' => $lehreinheitgruppe->studiengang_kz,
|
||||
'studiengang_kuerzel' => $stgkuerzel
|
||||
);
|
||||
$letoadd->lehreinheitgruppen[] = array(
|
||||
'semester' => $lehreinheitgruppe->semester,
|
||||
'verband' => $lehreinheitgruppe->verband,
|
||||
'gruppe' => $lehreinheitgruppe->gruppe,
|
||||
'gruppe_kurzbz' => $lehreinheitgruppe->gruppe_kurzbz,
|
||||
'direktinskription' => $lehreinheitgruppe->direktinskription,
|
||||
'studiengang_kz' => $lehreinheitgruppe->studiengang_kz,
|
||||
'studiengang_kuerzel' => $stgkuerzel
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ class Lehreinheitgruppe_model extends DB_Model
|
||||
'semester' => $lvadata->semester,
|
||||
'bezeichnung' => $bezeichnung,
|
||||
'aktiv' => true,
|
||||
'mailgrp' => false,
|
||||
'sichtbar' => true,
|
||||
'mailgrp' => true,
|
||||
'sichtbar' => false,
|
||||
'generiert' => false,
|
||||
'insertamum' => date('Y-m-d H:i:s'),
|
||||
'insertvon' => $loggedInUser,
|
||||
|
||||
@@ -11,4 +11,34 @@ class Lehreinheitmitarbeiter_model extends DB_Model
|
||||
$this->dbTable = 'lehre.tbl_lehreinheitmitarbeiter';
|
||||
$this->pk = array('mitarbeiter_uid', 'lehreinheit_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Lehrauftrag has a contract.
|
||||
* @param $mitarbeiter_uid
|
||||
* @param $lehreinheit_id
|
||||
* @return array|bool|int Returns vertrag_id if contract exists. False if doesnt exist. On error array.
|
||||
*/
|
||||
public function hasVertrag($mitarbeiter_uid, $lehreinheit_id)
|
||||
{
|
||||
if(is_string($mitarbeiter_uid) && is_numeric($lehreinheit_id))
|
||||
{
|
||||
$result = $this->load(array(
|
||||
'mitarbeiter_uid' => $mitarbeiter_uid,
|
||||
'lehreinheit_id' => $lehreinheit_id
|
||||
));
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
return (is_null($result->retval[0]->vertrag_id)) ? false : intval($result->retval[0]->vertrag_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return error ('Incorrect parameter type');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'lehre.tbl_lehrveranstaltung';
|
||||
$this->pk = 'lehrveranstaltung_id';
|
||||
|
||||
$this->load->model('organisation/studiengang_model', 'StudiengangModel');
|
||||
$this->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,8 +25,6 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
*/
|
||||
public function getLehrveranstaltungGroupNames($studiensemester_kurzbz, $ausbildungssemester = null, $studiengang_kz = null, $lehrveranstaltung_ids = null)
|
||||
{
|
||||
$this->load->model('organisation/studiengang_model', 'StudiengangModel');
|
||||
|
||||
$studiengang_kz_arr = array();
|
||||
$ausbildungssemester_arr = array();
|
||||
$lehrveranstaltung_id_arr = array();
|
||||
@@ -59,13 +60,12 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
foreach ($studiengang_kz_arr as $studiengang_kz_item)
|
||||
{
|
||||
$result = $this->StudiensemesterModel->getAusbildungssemesterByStudiensemesterAndStudiengang($studiensemester_kurzbz, $studiengang_kz_item);
|
||||
|
||||
if (isError($result))
|
||||
return error($result->retval);
|
||||
return error(getError($result));
|
||||
|
||||
foreach ($result->retval as $semester)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
|
||||
if (count($studiengang_kz_arr) > 0)
|
||||
$query .= " AND tbl_lehrveranstaltung.studiengang_kz IN (". implode(", ", $studiengang_kz_arr).")";
|
||||
|
||||
|
||||
if (count($lehrveranstaltung_id_arr) > 0)
|
||||
{
|
||||
$query .= " AND tbl_lehrveranstaltung.lehrveranstaltung_id IN (". implode(', ', $lehrveranstaltung_id_arr).")";
|
||||
@@ -144,7 +144,7 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
WHERE
|
||||
vw_student_lehrveranstaltung.studiensemester_kurzbz=?
|
||||
AND
|
||||
vw_student_lehrveranstaltung.lehrveranstaltung_id=?
|
||||
vw_student_lehrveranstaltung.lehrveranstaltung_id=?
|
||||
ORDER BY nachname, vorname, person_id, tbl_bisio.bis DESC";
|
||||
|
||||
return $this->execQuery($query, array($studiensemester_kurzbz, $lehrveranstaltung_id));
|
||||
@@ -214,8 +214,6 @@ class Lehrveranstaltung_model extends DB_Model
|
||||
*/
|
||||
public function getLvsWithIncomingPlaces($studiensemester_kurzbz)
|
||||
{
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
$studsemres = $this->StudiensemesterModel->load($studiensemester_kurzbz);
|
||||
|
||||
if (!hasData($studsemres))
|
||||
|
||||
@@ -11,4 +11,34 @@ class Projektbetreuer_model extends DB_Model
|
||||
$this->dbTable = 'lehre.tbl_projektbetreuer';
|
||||
$this->pk = array('betreuerart_kurzbz', 'projektarbeit_id', 'person_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Projektauftrag has a contract.
|
||||
* @param $person_id
|
||||
* @param $projektarbeit_id
|
||||
* @return array|bool|int Returns vertrag_id if contract exists. False if doesnt exist. On error array.
|
||||
*/
|
||||
public function hasVertrag($person_id, $projektarbeit_id)
|
||||
{
|
||||
if (is_numeric($person_id) && is_numeric($projektarbeit_id))
|
||||
{
|
||||
$result = $this->load(array(
|
||||
'person_id' => $person_id,
|
||||
'projektarbeit_id' => $projektarbeit_id
|
||||
));
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
return (is_null($result->retval[0]->vertrag_id)) ? false : intval($result->retval[0]->vertrag_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($result->msg, EXIT_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return error ('Incorrect parameter type');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,4 +165,27 @@ class Organisationseinheit_model extends DB_Model
|
||||
return $this->execQuery(sprintf($query, $aktivstring, $aktivstring), array($oe_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one parent only.
|
||||
* Easily retrieve department of a studiengang or fakultät of department etc.
|
||||
* @param $oe_kurzbz
|
||||
* @return array|null
|
||||
*/
|
||||
public function getParent($oe_kurzbz)
|
||||
{
|
||||
if (is_string($oe_kurzbz))
|
||||
{
|
||||
$condition = '
|
||||
oe_kurzbz = (
|
||||
SELECT
|
||||
oe_parent_kurzbz
|
||||
FROM
|
||||
public.tbl_organisationseinheit
|
||||
WHERE
|
||||
oe_kurzbz = \''. $oe_kurzbz. '\'
|
||||
)
|
||||
';
|
||||
}
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class Studienplan_model extends DB_Model
|
||||
return $this->loadWhere(array("studiengang_kz" => $studiengang_kz));
|
||||
}
|
||||
|
||||
public function getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester = null, $orgform_kurzbz = null)
|
||||
public function getStudienplaeneBySemester($studiengang_kz, $studiensemester_kurzbz, $ausbildungssemester = null, $orgform_kurzbz = null, $sprache = null)
|
||||
{
|
||||
$this->addJoin("lehre.tbl_studienordnung", "studienordnung_id");
|
||||
$this->addJoin("lehre.tbl_studienplan_semester", "studienplan_id");
|
||||
@@ -40,6 +40,11 @@ class Studienplan_model extends DB_Model
|
||||
$whereArray["orgform_kurzbz"] = $orgform_kurzbz;
|
||||
}
|
||||
|
||||
if(!is_null($sprache))
|
||||
{
|
||||
$whereArray["tbl_studienplan.sprache"] = $sprache;
|
||||
}
|
||||
|
||||
return $this->StudienplanModel->loadWhere($whereArray);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,22 @@ class Studiensemester_model extends DB_Model
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
// Get next study semester
|
||||
public function getNext()
|
||||
{
|
||||
$query = '
|
||||
SELECT *
|
||||
FROM
|
||||
public.tbl_studiensemester
|
||||
WHERE
|
||||
start > now()
|
||||
ORDER BY start
|
||||
LIMIT 1;
|
||||
';
|
||||
|
||||
return $this->execQuery($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* getLastOrAktSemester
|
||||
*/
|
||||
@@ -61,7 +77,7 @@ class Studiensemester_model extends DB_Model
|
||||
start,
|
||||
ende
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE start > (
|
||||
WHERE start >= (
|
||||
SELECT ende
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE studiensemester_kurzbz = ?
|
||||
@@ -72,6 +88,26 @@ class Studiensemester_model extends DB_Model
|
||||
return $this->execQuery($query, array($studiensemester_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* getPreviousFrom
|
||||
*/
|
||||
public function getPreviousFrom($studiensemester_kurzbz)
|
||||
{
|
||||
$query = 'SELECT studiensemester_kurzbz,
|
||||
start,
|
||||
ende
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE ende <= (
|
||||
SELECT start
|
||||
FROM public.tbl_studiensemester
|
||||
WHERE studiensemester_kurzbz = ?
|
||||
)
|
||||
ORDER BY start DESC
|
||||
LIMIT 1';
|
||||
|
||||
return $this->execQuery($query, array($studiensemester_kurzbz));
|
||||
}
|
||||
|
||||
/**
|
||||
* getNearest
|
||||
*/
|
||||
|
||||
@@ -15,8 +15,7 @@ class Benutzer_model extends DB_Model
|
||||
|
||||
public function getFromPersonId($person_id)
|
||||
{
|
||||
/*$this->addSelect('uid, aktiv, alias');*/
|
||||
$this->loadWhere(array('person_id' => $person_id));
|
||||
return $this->loadWhere(array('person_id' => $person_id, 'aktiv' => true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class Benutzerfunktion_model extends DB_Model
|
||||
|
||||
if (is_string($funktion_kurzbz))
|
||||
{
|
||||
$query .= " AND funktion_kurzbz = ".$funktion_kurzbz.")";
|
||||
$query .= " AND funktion_kurzbz = '".$funktion_kurzbz."'";
|
||||
}
|
||||
elseif (is_array($funktion_kurzbz) && count($funktion_kurzbz) > 0)
|
||||
{
|
||||
@@ -104,4 +104,38 @@ class Benutzerfunktion_model extends DB_Model
|
||||
|
||||
return $this->execQuery($query, $parametersArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active Studiengangsleitung(en) of the user by UID.
|
||||
* @param $uid
|
||||
*/
|
||||
public function getSTGLByUID($uid)
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
uid,
|
||||
oe_kurzbz,
|
||||
studiengang_kz,
|
||||
typ,
|
||||
tbl_studiengang.bezeichnung
|
||||
FROM
|
||||
public.tbl_benutzerfunktion
|
||||
JOIN public.tbl_studiengang USING (oe_kurzbz)
|
||||
WHERE
|
||||
funktion_kurzbz = \'Leitung\'
|
||||
AND (datum_von IS NULL OR datum_von <= now())
|
||||
AND (datum_bis IS NULL OR datum_bis >= now())
|
||||
AND uid = ?
|
||||
ORDER BY
|
||||
oe_kurzbz
|
||||
';
|
||||
|
||||
$parameters_array = array();
|
||||
if (is_string($uid))
|
||||
{
|
||||
$parameters_array[] = $uid;
|
||||
}
|
||||
|
||||
return $this->execQuery($query, $parameters_array);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ class Person_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_person';
|
||||
$this->pk = 'person_id';
|
||||
|
||||
$this->load->model('person/kontakt_model', 'KontaktModel');
|
||||
$this->load->model('person/adresse_model', 'AdresseModel');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,29 +158,24 @@ class Person_model extends DB_Model
|
||||
|
||||
$person = $this->load($person_id);
|
||||
|
||||
if($person->error)
|
||||
return error($person->retval);
|
||||
if($person->error) return $person;
|
||||
|
||||
//return null if not found
|
||||
if(count($person->retval) < 1)
|
||||
return success(null);
|
||||
|
||||
$this->load->model('person/kontakt_model', 'KontaktModel');
|
||||
$this->load->model('person/adresse_model', 'AdresseModel');
|
||||
|
||||
$this->KontaktModel->addDistinct();
|
||||
$this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung');
|
||||
$this->KontaktModel->addOrder('kontakttyp');
|
||||
$where = $zustellung_only === true ? array('person_id' => $person_id, 'zustellung' => true) : array('person_id' => $person_id);
|
||||
$kontakte = $this->KontaktModel->loadWhere($where);
|
||||
if($kontakte->error)
|
||||
return error($kontakte->retval);
|
||||
if($kontakte->error) return $kontakte;
|
||||
|
||||
$where = $zustellung_only === true ? array('person_id' => $person_id, 'zustelladresse' => true) : array('person_id' => $person_id);
|
||||
$this->AdresseModel->addSelect('public.tbl_adresse.*, bis.tbl_nation.kurztext AS nationkurztext');
|
||||
$this->AdresseModel->addJoin('bis.tbl_nation', 'tbl_adresse.nation = tbl_nation.nation_code', 'LEFT');
|
||||
$adressen = $this->AdresseModel->loadWhere($where);
|
||||
if($adressen->error)
|
||||
return error($adressen->retval);
|
||||
if($adressen->error) return $adressen;
|
||||
|
||||
$stammdaten = $person->retval[0];
|
||||
$stammdaten->kontakte = $kontakte->retval;
|
||||
|
||||
@@ -11,4 +11,33 @@ class Mitarbeiter_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_mitarbeiter';
|
||||
$this->pk = 'mitarbeiter_uid';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is a Mitarbeiter.
|
||||
* @param string $uid
|
||||
* @param boolean null $fixangestellt
|
||||
* @return array
|
||||
*/
|
||||
public function isMitarbeiter($uid, $fixangestellt = null)
|
||||
{
|
||||
$this->addSelect('1');
|
||||
|
||||
if (is_bool($fixangestellt))
|
||||
{
|
||||
$result = $this->loadWhere(array('mitarbeiter_uid' => $uid, 'fixangestellt' => $fixangestellt));
|
||||
}
|
||||
else // default
|
||||
{
|
||||
$result = $this->loadWhere(array('mitarbeiter_uid' => $uid));
|
||||
}
|
||||
|
||||
if(hasData($result))
|
||||
{
|
||||
return success(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return success(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class Benutzerrolle_model extends DB_Model
|
||||
$this->dbTable = 'system.tbl_benutzerrolle';
|
||||
$this->pk = 'benutzerberechtigung_id';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the given user is an admin
|
||||
*/
|
||||
@@ -19,9 +19,9 @@ class Benutzerrolle_model extends DB_Model
|
||||
{
|
||||
// Join with the table tbl_benutzer
|
||||
$this->addJoin('public.tbl_benutzer', 'uid');
|
||||
|
||||
|
||||
$result = $this->loadWhere(array('person_id' => $person_id, 'rolle_kurzbz' => 'admin'));
|
||||
|
||||
|
||||
if (!isError($result))
|
||||
{
|
||||
if (hasData($result))
|
||||
@@ -33,7 +33,35 @@ class Benutzerrolle_model extends DB_Model
|
||||
$result = success(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user who are authorized with berechtigung and, if given, authorized for the specific organisational unit.
|
||||
* @param $berechtigung_kurzbz
|
||||
* @param null $oe_kurzbz
|
||||
* @return array
|
||||
*/
|
||||
public function getBenutzerByBerechtigung($berechtigung_kurzbz, $oe_kurzbz = null)
|
||||
{
|
||||
$params = array();
|
||||
$query = '
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
system.vw_berechtigung_nichtrekursiv
|
||||
WHERE
|
||||
berechtigung_kurzbz = ?';
|
||||
|
||||
$params[] = $berechtigung_kurzbz;
|
||||
|
||||
if (!is_null($oe_kurzbz))
|
||||
{
|
||||
$query .= ' AND oe_kurzbz = ?';
|
||||
$params[] = $oe_kurzbz;
|
||||
}
|
||||
|
||||
return $this->execQuery($query, $params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
class FAS_UDF_model extends DB_Model
|
||||
{
|
||||
// String values of booleans
|
||||
const STRING_NULL = 'null';
|
||||
const STRING_TRUE = 'true';
|
||||
const STRING_FALSE = 'false';
|
||||
|
||||
const UDF_DROPDOWN_TYPE = 'dropdown';
|
||||
const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown';
|
||||
|
||||
/**
|
||||
* Methods to save data from FAS
|
||||
*/
|
||||
public function saveUDFs($udfs)
|
||||
{
|
||||
$result = error('No way man!');
|
||||
$resultPerson = success('person');
|
||||
$resultPrestudent = success('prestudent');
|
||||
|
||||
$person_id = null;
|
||||
if (isset($udfs['person_id'])) $person_id = $udfs['person_id'];
|
||||
unset($udfs['person_id']);
|
||||
|
||||
$prestudent_id = null;
|
||||
if (isset($udfs['prestudent_id'])) $prestudent_id = $udfs['prestudent_id'];
|
||||
unset($udfs['prestudent_id']);
|
||||
|
||||
$jsons = array();
|
||||
|
||||
//
|
||||
if (isset($person_id))
|
||||
{
|
||||
// Load model Person_model
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$result = $this->load(array('public', 'tbl_person'));
|
||||
if (isSuccess($result) && count($result->retval) == 1)
|
||||
{
|
||||
$jsons = json_decode($result->retval[0]->jsons);
|
||||
}
|
||||
|
||||
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
|
||||
|
||||
$resultPerson = $this->PersonModel->update($person_id, $udfs);
|
||||
}
|
||||
|
||||
//
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
// Load model Prestudent_model
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$result = $this->load(array('public', 'tbl_prestudent'));
|
||||
if (isSuccess($result) && count($result->retval) == 1)
|
||||
{
|
||||
$jsons = json_decode($result->retval[0]->jsons);
|
||||
}
|
||||
|
||||
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
|
||||
|
||||
$resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs);
|
||||
}
|
||||
|
||||
if (isSuccess($resultPerson) && isSuccess($resultPrestudent))
|
||||
{
|
||||
$result = success(array($resultPerson->retval, $resultPrestudent->retval));
|
||||
}
|
||||
else if(isError($resultPerson))
|
||||
{
|
||||
$result = $resultPerson;
|
||||
}
|
||||
else if(isError($resultPrestudent))
|
||||
{
|
||||
$result = $resultPrestudent;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingChkboxUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingChkboxUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE)
|
||||
{
|
||||
if (!isset($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_FALSE)
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
|
||||
}
|
||||
else if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_TRUE)
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingChkboxUDF;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingDropdownUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingDropdownUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == UDF_model::UDF_DROPDOWN_TYPE
|
||||
|| $udfDescription->{UDFLib::TYPE} == UDF_model::UDF_MULTIPLEDROPDOWN_TYPE)
|
||||
{
|
||||
if (!isset($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
else if($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_NULL)
|
||||
{
|
||||
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingDropdownUDF;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingTextUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingTextUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == 'textarea'
|
||||
|| $udfDescription->{UDFLib::TYPE} == 'textfield')
|
||||
{
|
||||
if (!isset($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
else if(trim($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]) == '')
|
||||
{
|
||||
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingTextUDF;
|
||||
}
|
||||
}
|
||||
@@ -37,17 +37,7 @@ class MessageToken_model extends DB_Model
|
||||
WHERE r.token = ?
|
||||
LIMIT 1';
|
||||
|
||||
$result = $this->db->query($sql, array(MSG_STATUS_DELETED, $token));
|
||||
|
||||
// If no errors occurred
|
||||
if ($result)
|
||||
{
|
||||
return success($result->result());
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($this->db->error());
|
||||
}
|
||||
return $this->execQuery($sql, array(MSG_STATUS_DELETED, $token));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,25 +64,24 @@ class MessageToken_model extends DB_Model
|
||||
WHERE r.token = ?
|
||||
LIMIT 1';
|
||||
|
||||
$msgs = $this->db->query($sql, array(MSG_STATUS_ARCHIVED, $token));
|
||||
$msgsResult = $this->execQuery($sql, array(MSG_STATUS_ARCHIVED, $token));
|
||||
|
||||
// If no errors occurred
|
||||
if ($msgs)
|
||||
if (isSuccess($msgsResult))
|
||||
{
|
||||
$msgs_result = $msgs->result();
|
||||
// If at least a record is present
|
||||
if (count($msgs_result) > 0)
|
||||
if (hasData($msgsResult))
|
||||
{
|
||||
$msg = $msgs_result[0];
|
||||
$msg = getData($msgsResult)[0];
|
||||
$msgStatusResult = error();
|
||||
|
||||
$msgStatusResult = false; // pessimistic expectation
|
||||
$this->load->model('system/MsgStatus_model', 'MsgStatusModel');
|
||||
|
||||
// If the status of the message is unread
|
||||
if ($msg->status == MSG_STATUS_UNREAD)
|
||||
{
|
||||
// Insert the read status
|
||||
$msgStatusResult = $this->db->insert(
|
||||
'public.tbl_msg_status',
|
||||
$msgStatusResult = $this->MsgStatusModel->insert(
|
||||
array(
|
||||
'message_id' => $msg->message_id,
|
||||
'person_id' => $msg->receiver_id,
|
||||
@@ -108,31 +97,23 @@ class MessageToken_model extends DB_Model
|
||||
// If the status of the message is read
|
||||
else if ($msg->status == MSG_STATUS_READ)
|
||||
{
|
||||
// Update updateamum to current date
|
||||
$this->db->set('updateamum', 'NOW()');
|
||||
|
||||
$this->db->where('message_id', $msg->message_id);
|
||||
$this->db->where('person_id', $msg->receiver_id);
|
||||
$this->db->where('status', MSG_STATUS_READ);
|
||||
|
||||
$msgStatusResult = $this->db->update('public.tbl_msg_status');
|
||||
$msgStatusResult = $this->MsgStatusModel->update(
|
||||
array(
|
||||
'message_id' => $msg->message_id,
|
||||
'person_id' => $msg->receiver_id,
|
||||
'status' => MSG_STATUS_READ
|
||||
),
|
||||
array('updateamum' => 'NOW()')
|
||||
);
|
||||
}
|
||||
|
||||
// If some of the previous DB manipulation (update or insert) has failed
|
||||
if (!$msgStatusResult)
|
||||
{
|
||||
return error($this->db->error());
|
||||
}
|
||||
return $msgStatusResult;
|
||||
}
|
||||
|
||||
return success($msgs_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($this->db->error());
|
||||
return $msgsResult;
|
||||
}
|
||||
|
||||
return success($result->result());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,8 +143,8 @@ class MessageToken_model extends DB_Model
|
||||
{
|
||||
$sql = 'SELECT m.mitarbeiter_uid
|
||||
FROM public.tbl_person p
|
||||
LEFT JOIN public.tbl_benutzer b USING(person_id)
|
||||
LEFT JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
|
||||
JOIN public.tbl_benutzer b USING(person_id)
|
||||
JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid)
|
||||
WHERE p.person_id = ?
|
||||
AND b.aktiv = TRUE';
|
||||
|
||||
@@ -193,28 +174,6 @@ class MessageToken_model extends DB_Model
|
||||
LIMIT 1
|
||||
';
|
||||
|
||||
$result = $this->db->query($sql, array($oe_kurzbz));
|
||||
if ($result) // If no errors occurred
|
||||
{
|
||||
$result_arr = $result->result();
|
||||
// If data are present
|
||||
if (is_array($result_arr)
|
||||
&& count($result_arr) > 0
|
||||
&& is_object($result_arr[0])
|
||||
&& isset($result_arr[0]->oe_kurzbz))
|
||||
{
|
||||
return success($result_arr[0]->oe_kurzbz);
|
||||
}
|
||||
else
|
||||
{
|
||||
return error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return error($this->db->error());
|
||||
}
|
||||
|
||||
return $result;
|
||||
return $this->execQuery($sql, array($oe_kurzbz));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ class PersonLock_model extends DB_Model
|
||||
|
||||
$result = $this->loadWhere($lockdata);
|
||||
|
||||
if ($result->error)
|
||||
return error($result->retval);
|
||||
if ($result->error) return $result;
|
||||
|
||||
if (count($result->retval) > 0)
|
||||
return success($result->retval);
|
||||
@@ -49,8 +48,7 @@ class PersonLock_model extends DB_Model
|
||||
{
|
||||
$locked = $this->checkIfLocked($person_id, $app);
|
||||
|
||||
if ($locked->error)
|
||||
return error($locked->retval);
|
||||
if ($locked->error) return $locked;
|
||||
|
||||
//insert only if not already locked
|
||||
if ($locked->retval === null)
|
||||
@@ -77,8 +75,7 @@ class PersonLock_model extends DB_Model
|
||||
foreach ($locks->retval as $lock)
|
||||
{
|
||||
$result = $this->delete($lock->lock_id);
|
||||
if ($result->error)
|
||||
return error($result->retval);
|
||||
if ($result->error) return $result;
|
||||
|
||||
$deleted[] = $lock;
|
||||
}
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
class UDF_model extends DB_Model
|
||||
{
|
||||
// String values of booleans
|
||||
const STRING_NULL = 'null';
|
||||
const STRING_TRUE = 'true';
|
||||
const STRING_FALSE = 'false';
|
||||
|
||||
const UDF_DROPDOWN_TYPE = 'dropdown';
|
||||
const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -38,164 +30,4 @@ class UDF_model extends DB_Model
|
||||
|
||||
return $udfResults;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
// These methods work only with the this version of FAS, not with the future versions
|
||||
|
||||
/**
|
||||
* Methods to save data from FAS
|
||||
*/
|
||||
public function saveUDFs($udfs)
|
||||
{
|
||||
$result = error('No way man!');
|
||||
$resultPerson = success('person');
|
||||
$resultPrestudent = success('prestudent');
|
||||
|
||||
$person_id = null;
|
||||
if (isset($udfs['person_id'])) $person_id = $udfs['person_id'];
|
||||
unset($udfs['person_id']);
|
||||
|
||||
$prestudent_id = null;
|
||||
if (isset($udfs['prestudent_id'])) $prestudent_id = $udfs['prestudent_id'];
|
||||
unset($udfs['prestudent_id']);
|
||||
|
||||
$jsons = array();
|
||||
|
||||
//
|
||||
if (isset($person_id))
|
||||
{
|
||||
// Load model Person_model
|
||||
$this->load->model('person/Person_model', 'PersonModel');
|
||||
|
||||
$result = $this->load(array('public', 'tbl_person'));
|
||||
if (isSuccess($result) && count($result->retval) == 1)
|
||||
{
|
||||
$jsons = json_decode($result->retval[0]->jsons);
|
||||
}
|
||||
|
||||
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
|
||||
|
||||
$resultPerson = $this->PersonModel->update($person_id, $udfs);
|
||||
}
|
||||
|
||||
//
|
||||
if (isset($prestudent_id))
|
||||
{
|
||||
// Load model Prestudent_model
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
|
||||
$result = $this->load(array('public', 'tbl_prestudent'));
|
||||
if (isSuccess($result) && count($result->retval) == 1)
|
||||
{
|
||||
$jsons = json_decode($result->retval[0]->jsons);
|
||||
}
|
||||
|
||||
$udfs = $this->_fillMissingTextUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingChkboxUDF($udfs, $jsons);
|
||||
$udfs = $this->_fillMissingDropdownUDF($udfs, $jsons);
|
||||
|
||||
$resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs);
|
||||
}
|
||||
|
||||
if (isSuccess($resultPerson) && isSuccess($resultPrestudent))
|
||||
{
|
||||
$result = success(array($resultPerson->retval, $resultPrestudent->retval));
|
||||
}
|
||||
else if(isError($resultPerson))
|
||||
{
|
||||
$result = $resultPerson;
|
||||
}
|
||||
else if(isError($resultPrestudent))
|
||||
{
|
||||
$result = $resultPrestudent;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingChkboxUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingChkboxUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE)
|
||||
{
|
||||
if (!isset($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_FALSE)
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = false;
|
||||
}
|
||||
else if ($_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_TRUE)
|
||||
{
|
||||
$_fillMissingChkboxUDF[$udfDescription->{UDFLib::NAME}] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingChkboxUDF;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingDropdownUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingDropdownUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == UDF_model::UDF_DROPDOWN_TYPE
|
||||
|| $udfDescription->{UDFLib::TYPE} == UDF_model::UDF_MULTIPLEDROPDOWN_TYPE)
|
||||
{
|
||||
if (!isset($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
else if($_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] == UDF_model::STRING_NULL)
|
||||
{
|
||||
$_fillMissingDropdownUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingDropdownUDF;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _fillMissingTextUDF($udfs, $jsons)
|
||||
{
|
||||
$_fillMissingTextUDF = $udfs;
|
||||
|
||||
foreach($jsons as $udfDescription)
|
||||
{
|
||||
if ($udfDescription->{UDFLib::TYPE} == 'textarea'
|
||||
|| $udfDescription->{UDFLib::TYPE} == 'textfield')
|
||||
{
|
||||
if (!isset($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]))
|
||||
{
|
||||
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
else if(trim($_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}]) == '')
|
||||
{
|
||||
$_fillMissingTextUDF[$udfDescription->{UDFLib::NAME}] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_fillMissingTextUDF;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,92 @@ class Variable_model extends DB_Model
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_variable';
|
||||
$this->pk = array('uid', 'name');
|
||||
$this->hasSequence = false;
|
||||
|
||||
$this->load->model('system/Variablenname_model', 'VariablennameModel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user variables and values for a uid.
|
||||
* If no value found in tbl_variable, default as defined in variablename_model is retrieved.
|
||||
* @param $uid
|
||||
* @param null $names optionally get only certain variables
|
||||
* @return array
|
||||
*/
|
||||
public function getVariables($uid, $names = null)
|
||||
{
|
||||
if (isEmptyString($uid) || (isset($names) && !is_array($names)))
|
||||
$result = error('wrong parameters passed');
|
||||
else
|
||||
{
|
||||
$vardata = array();
|
||||
|
||||
$qry = "SELECT name, wert FROM public.tbl_variable WHERE uid = ?";
|
||||
|
||||
if (isset($names))
|
||||
{
|
||||
$qry .= " AND name IN ('".implode(',', $names)."')";
|
||||
}
|
||||
$qry .= ";";
|
||||
|
||||
$varresults = $this->execQuery($qry, array($uid));
|
||||
|
||||
if (hasData($varresults))
|
||||
{
|
||||
$varresults = getData($varresults);
|
||||
foreach ($varresults as $varresult)
|
||||
{
|
||||
if (isset($varresult->wert))
|
||||
$vardata[$varresult->name] = $varresult->wert;
|
||||
}
|
||||
}
|
||||
|
||||
$vardefaults = $this->VariablennameModel->getDefaults($names);
|
||||
|
||||
if (hasData($vardefaults))
|
||||
{
|
||||
$vardefaults = getData($vardefaults);
|
||||
|
||||
|
||||
foreach ($vardefaults as $vardefault)
|
||||
{
|
||||
if (!isset($vardata[$vardefault->name]) && isset($vardefault->defaultwert))
|
||||
{
|
||||
$vardata[$vardefault->name] = $vardefault->defaultwert;
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = success($vardata);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a variable value for a uid. Adds new entry if not present, updates entry otherwise.
|
||||
* @param $uid
|
||||
* @param $name
|
||||
* @param $wert
|
||||
* @return array
|
||||
*/
|
||||
public function setVariable($uid, $name, $wert)
|
||||
{
|
||||
$result = error('error when setting variable!');
|
||||
if (!isEmptyString($uid) && !isEmptyString($name) && !isEmptyString($wert))
|
||||
{
|
||||
$varres = $this->loadWhere(array('uid' => $uid, 'name' => $name));
|
||||
|
||||
if (isSuccess($varres))
|
||||
{
|
||||
if (hasData($varres))
|
||||
{
|
||||
$result = $this->VariableModel->update(array('uid' => $uid, 'name' => $name), array('wert' => $wert));
|
||||
}
|
||||
else
|
||||
$result = $this->VariableModel->insert(array('uid' => $uid, 'name' => $name, 'wert' => $wert));
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
class Variablenname_model extends DB_Model
|
||||
{
|
||||
// Contains SQL queries retrieving default variable values if no default is set.
|
||||
private $_dynamic_defaults = array(
|
||||
'semester_aktuell' => 'SELECT studiensemester_kurzbz FROM public.tbl_studiensemester WHERE ende>now() ORDER BY start LIMIT 1',
|
||||
'infocenter_studiensemester' => 'SELECT studiensemester_kurzbz FROM (
|
||||
SELECT DISTINCT ON (studienjahr_kurzbz) start, studiensemester_kurzbz
|
||||
FROM public.tbl_studiensemester
|
||||
ORDER BY studienjahr_kurzbz, start
|
||||
) sem
|
||||
WHERE start > now()
|
||||
LIMIT 1;'
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->dbTable = 'public.tbl_variablenname';
|
||||
$this->pk ='name';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets defaults for user variables.
|
||||
* If no default value present in table, SQL can be executed for retrieving the value.
|
||||
* @param $names optionally get only defaults for certain variables
|
||||
* @return array
|
||||
*/
|
||||
public function getDefaults($names = null)
|
||||
{
|
||||
$defaults = array();
|
||||
|
||||
$qry = "SELECT name, defaultwert FROM public.tbl_variablenname";
|
||||
|
||||
if (!isEmptyArray($names))
|
||||
{
|
||||
$qry .= " WHERE name IN ?";
|
||||
}
|
||||
$qry .= ";";
|
||||
|
||||
$defaultsres = $this->execQuery($qry, array('name' => $names));
|
||||
|
||||
if (hasData($defaultsres))
|
||||
{
|
||||
$defaults = getData($defaultsres);
|
||||
|
||||
foreach ($defaults as $default)
|
||||
{
|
||||
if (!isset($default->defaultwert))
|
||||
{
|
||||
if (isset($this->_dynamic_defaults[$default->name]))
|
||||
{
|
||||
$dyndefault = $this->execQuery($this->_dynamic_defaults[$default->name]);
|
||||
if (hasData($dyndefault))
|
||||
{
|
||||
$dyndefault = getData($dyndefault);
|
||||
|
||||
if (count($dyndefault) === 1)
|
||||
{
|
||||
foreach ($dyndefault[0] as $value)
|
||||
{
|
||||
$default->defaultwert = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return success($defaults);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
class Webservicelog_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->dbTable = 'system.tbl_webservicelog';
|
||||
$this->pk = 'webservicelog_id';
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ $this->load->view('templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'FH-Complete',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Lehrauftrag bestellen',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'navigationwidget' => true,
|
||||
'addons' => true,
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="page-header">
|
||||
Lehrauftrag
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dashboard"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Lehrauftrag bestellen',
|
||||
'jquery' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'ajaxlib' => true,
|
||||
'navigationwidget' => true,
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3 class="page-header">
|
||||
Lehraufträge - Lehrendenübersicht
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<iframe src="<?php echo base_url() . '/addons/reports/cis/vorschau.php?statistik_kurzbz=LehrauftraegeOeUebersicht'; ?>"
|
||||
style="height: 950px; width: 100%; border: none">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Lehrauftrag annehmen',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'jquerycheckboxes' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => false,
|
||||
'tabulator' => true,
|
||||
'momentjs' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'tablewidget' => true,
|
||||
'phrases' => array(
|
||||
'global' => array('lehrauftraegeAnnehmen'),
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/lehrauftrag/acceptLehrauftrag.js')
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- title & helper link -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<a class="pull-right" data-toggle="collapse" href="#collapseHelp" aria-expanded="false" aria-controls="collapseExample">
|
||||
Hilfe zu dieser Seite
|
||||
</a>
|
||||
<h3>
|
||||
<?php echo ucfirst($this->p->t('global', 'lehrauftraegeAnnehmen')); ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- helper collapse module -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 collapse" id="collapseHelp">
|
||||
<div class="well">
|
||||
<h4>Wie nehme ich Lehraufträge an?</h4>
|
||||
<div class="panel panel-body">
|
||||
Sobald Ihnen ein oder mehrere Lehraufträge erteilt wurden, können Sie diese annehmen.
|
||||
<ol>
|
||||
<li>Klicken Sie unten auf das Status-Icon 'Nur erteilte anzeigen' oder 'Alle anzeigen'</li>
|
||||
<li>Wählen Sie die Lehraufträge, die Sie annehmen möchten, selbst oder alle über den Button 'Alle auswählen'.</li>
|
||||
<li>Geben Sie Ihr CIS-Passwort ein und klicken auf Lehrauftrag annehmen.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Warum kann ich manche Lehraufträge nicht auswählen?</h4>
|
||||
<div class="panel panel-body">
|
||||
Nur Lehraufträge mit dem Status 'erteilt' können gewählt werden.<br>
|
||||
Angenommene Lehraufträge oder Lehraufträge in Bearbeitung werden nur zu Ihrer Information angezeigt.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Filter</h4>
|
||||
<div class="panel panel-body">
|
||||
<div class="col-xs-12 col-md-8 col-lg-6">
|
||||
<table class="table table-bordered">
|
||||
<tr class="text-center">
|
||||
<td class="col-xs-1"><i class='fa fa-users'></i></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-tag.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-check.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><i class='fa fa-handshake-o'></i></td>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td><b>Alle</b><br>Alle Lehraufträge mit jedem Status</td>
|
||||
<td><b>Bestellt</b><br>Nur bestellte UND bestellte Lehraufträge, die in Bearbeitung sind</td>
|
||||
<td><b>Erteilt</b><br>Nur erteilte UND geänderte Lehraufträge, die in Bearbeitung sind</td>
|
||||
<td><b>Angenommen</b><br>Nur von Ihnen angenommene Lehraufträge</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Auswahl</h4>
|
||||
<div class="panel panel-body">
|
||||
<ul>
|
||||
<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>
|
||||
<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>
|
||||
<li>Alle auswählen: Button 'Alle auswählen'</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Ansicht</h4>
|
||||
<div class="panel panel-body">
|
||||
<b>Spaltenbreite verändern</b>
|
||||
<p>
|
||||
Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam mit dem Mauszeiger auf
|
||||
den rechten Rand der entprechenden Spalte. <br>
|
||||
Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und
|
||||
mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.
|
||||
</p>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- dropdown widgets -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formLehrauftrag" class="form-inline" action="" method="get">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiensemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiensemester_selected
|
||||
),
|
||||
array(
|
||||
'name' => 'studiensemester',
|
||||
'id' => 'studiensemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<button type="submit" name="submit" value="anzeigen" class="btn btn-default form-group">Anzeigen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- tabulator data table 'Lehrauftraege annehmen'-->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php $this->load->view('lehre/lehrauftrag/acceptLehrauftragData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- filter buttons & password field & akzeptieren-button -->
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="show-all" class="btn btn-default btn-lehrauftrag active focus" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Alle anzeigen"><i class='fa fa-users'></i>
|
||||
</button>
|
||||
<button id="show-ordered" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Nur bestellte anzeigen">
|
||||
</button><!-- png img set in javascript -->
|
||||
<button id="show-approved" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Nur erteilte anzeigen">
|
||||
</button><!-- png img set in javascript -->
|
||||
<button id="show-accepted" class="btn btn-default btn-lehrauftrag" type="button"
|
||||
data-toggle="tooltip" data-placement="left" title="Nur angenommene anzeigen"><i class='fa fa-handshake-o'></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button id="show-cancelled" class="btn btn-default btn-lehrauftrag" type="button" style="margin-left: 20px;"
|
||||
data-toggle="collapse" data-placement="left" title="Stornierte anzeigen"
|
||||
data-target ="#collapseCancelledLehrauftraege" aria-expanded="false" aria-controls="collapseExample">
|
||||
</button><!-- png img set in javascript -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-offset-2 col-md-4 col-xs-6">
|
||||
<div class="input-group">
|
||||
<input id="password" type="password" class="form-control" placeholder="CIS-Passwort">
|
||||
<span class="input-group-btn">
|
||||
<button id="accept-lehrauftraege" class="btn btn-primary pull-right">Lehrauftrag annehmen</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<!-- collapse module with data table 'Stornierte Lehrauftraege' (collapsed by default until opened on buttonclick)-->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 collapse" id="collapseCancelledLehrauftraege">
|
||||
<h4>
|
||||
<?php echo ucfirst($this->p->t('global', 'stornierteLehrauftraege')); ?>:
|
||||
<small>
|
||||
<abbr title="Anderes Studiensemester? Bitte oben im Dropdown wählen." >
|
||||
<?php echo $studiensemester_selected ?>
|
||||
</abbr>
|
||||
</small>
|
||||
</h4>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php $this->load->view('lehre/lehrauftrag/cancelledLehrauftragData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end container -->
|
||||
</div><!-- end page-wrapper -->
|
||||
<br>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,398 @@
|
||||
<?php
|
||||
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$UID = getAuthUID();
|
||||
$PERSON_ID = getAuthPersonId();
|
||||
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
/* provide extra row index for tabulator, because no other column has unique ids */
|
||||
ROW_NUMBER() OVER () AS "row_index",
|
||||
lehreinheit_id,
|
||||
lehrveranstaltung_id,
|
||||
projektarbeit_id,
|
||||
studiensemester_kurzbz,
|
||||
studiengang_kz,
|
||||
stg_typ_kurzbz,
|
||||
semester,
|
||||
orgform_kurzbz,
|
||||
person_id,
|
||||
typ,
|
||||
auftrag,
|
||||
lv_oe_kurzbz,
|
||||
gruppe,
|
||||
stunden,
|
||||
betrag,
|
||||
vertrag_id,
|
||||
vertrag_stunden,
|
||||
vertrag_betrag,
|
||||
mitarbeiter_uid,
|
||||
bestellt,
|
||||
erteilt,
|
||||
akzeptiert,
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "bestellt_von",
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "erteilt_von",
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "akzeptiert_von"
|
||||
FROM
|
||||
(
|
||||
/* Lehraufträge and -vertragsstati */
|
||||
SELECT *,
|
||||
/* concatinated and aggregated gruppen */
|
||||
(SELECT
|
||||
string_agg(
|
||||
CASE WHEN gruppe_kurzbz is null THEN
|
||||
concat(upper(grpstg.typ || grpstg.kurzbz), \'-\', semester, verband, gruppe)
|
||||
ELSE
|
||||
gruppe_kurzbz
|
||||
END
|
||||
, \', \')
|
||||
FROM
|
||||
lehre.tbl_lehreinheitgruppe
|
||||
JOIN public.tbl_studiengang grpstg USING(studiengang_kz)
|
||||
WHERE
|
||||
lehreinheit_id = tmp_lehrauftraege.lehreinheit_id
|
||||
) AS "gruppe",
|
||||
/* existing contracts with status bestellt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "bestellt",
|
||||
/* existing contracts with status erteilt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "erteilt",
|
||||
/* existing contracts with status akzeptiert */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "akzeptiert"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
lema.lehreinheit_id,
|
||||
lv.lehrveranstaltung_id,
|
||||
NULL AS "projektarbeit_id",
|
||||
le.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
upper(stg.typ || stg.kurzbz) AS "stg_typ_kurzbz",
|
||||
lv.orgform_kurzbz,
|
||||
person.person_id,
|
||||
upper(lv.lehrtyp_kurzbz) AS "typ",
|
||||
(lv.bezeichnung || \' [\' || le.lehrform_kurzbz ||
|
||||
\']\') AS "auftrag",
|
||||
lv.semester,
|
||||
CASE
|
||||
WHEN oe.organisationseinheittyp_kurzbz = \'Kompetenzfeld\' THEN (\'KF \' || oe.bezeichnung)
|
||||
WHEN oe.organisationseinheittyp_kurzbz = \'Department\' THEN (\'DEP \' || oe.bezeichnung)
|
||||
ELSE (oe.organisationseinheittyp_kurzbz || \' \' || oe.bezeichnung)
|
||||
END AS "lv_oe_kurzbz",
|
||||
TRUNC(lema.semesterstunden, 1) AS "stunden",
|
||||
TRUNC((lema.semesterstunden * lema.stundensatz), 2) AS "betrag",
|
||||
vertrag_id,
|
||||
vertragsstunden AS "vertrag_stunden",
|
||||
vertrag.betrag AS "vertrag_betrag",
|
||||
mitarbeiter_uid
|
||||
FROM
|
||||
lehre.tbl_lehreinheitmitarbeiter lema
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN PUBLIC.tbl_organisationseinheit oe USING (oe_kurzbz)
|
||||
JOIN PUBLIC.tbl_mitarbeiter ma USING (mitarbeiter_uid)
|
||||
JOIN PUBLIC.tbl_benutzer benutzer
|
||||
ON ma.mitarbeiter_uid = benutzer.uid
|
||||
JOIN PUBLIC.tbl_person person USING (person_id)
|
||||
LEFT JOIN lehre.tbl_vertrag vertrag USING (vertrag_id)
|
||||
LEFT JOIN lehre.tbl_vertrag_vertragsstatus vvs USING (vertrag_id)
|
||||
JOIN PUBLIC.tbl_studiengang stg ON stg.studiengang_kz = lv.studiengang_kz
|
||||
WHERE
|
||||
/* filter lector */
|
||||
mitarbeiter_uid = \'' . $UID . '\'
|
||||
/* filter studiensemester */
|
||||
AND le.studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
|
||||
/* filter active lehrveranstaltungen */
|
||||
AND lv.aktiv = TRUE
|
||||
/* filter active organisationseinheiten */
|
||||
AND oe.aktiv = TRUE
|
||||
/* filter vertragsstatus to avoid showing before status is bestellt */
|
||||
AND vvs.vertragsstatus_kurzbz IN (\'bestellt\', \'erteilt\', \'akzeptiert\')
|
||||
) tmp_lehrauftraege
|
||||
|
||||
UNION
|
||||
|
||||
/* Projektbetreuungsaufträge and -vertragsstati */
|
||||
SELECT *,
|
||||
/* mitarbeiter uid retrieved by person_id */
|
||||
/* NOTE: mitarbeiter MUST come after Select * to ensure correct order with select for tmp_lehrauftraege*/
|
||||
(SELECT
|
||||
uid
|
||||
FROM
|
||||
public.tbl_benutzer
|
||||
WHERE
|
||||
person_id = tmp_projektbetreuung.person_id
|
||||
ORDER BY aktiv DESC, updateaktivam DESC -- accept inactive as some person_ids have no active, but order them last
|
||||
LIMIT 1) AS "mitarbeiter_uid",
|
||||
/* concatinated and aggregated gruppen */
|
||||
(SELECT
|
||||
string_agg(
|
||||
CASE WHEN gruppe_kurzbz is null THEN
|
||||
concat(upper(grpstg.typ || grpstg.kurzbz), \'-\', semester, verband, gruppe)
|
||||
ELSE
|
||||
gruppe_kurzbz
|
||||
END
|
||||
, \', \')
|
||||
FROM
|
||||
lehre.tbl_lehreinheitgruppe
|
||||
JOIN public.tbl_studiengang grpstg USING(studiengang_kz)
|
||||
WHERE
|
||||
lehreinheit_id = tmp_projektbetreuung.lehreinheit_id
|
||||
) AS "gruppe",
|
||||
/* existing contracts with status bestellt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "bestellt",
|
||||
/* existing contracts with status erteilt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "erteilt",
|
||||
/* existing contracts with status akzeptiert */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "akzeptiert"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
pa.lehreinheit_id,
|
||||
lv.lehrveranstaltung_id,
|
||||
pa.projektarbeit_id AS "projektarbeit_id",
|
||||
le.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
upper(stg.typ || stg.kurzbz) AS "stg_typ_kurzbz",
|
||||
lv.orgform_kurzbz,
|
||||
person.person_id,
|
||||
\'Betreuung\' AS "typ",
|
||||
(betreuerart_kurzbz || \' \' ||
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
PUBLIC.tbl_person
|
||||
JOIN PUBLIC.tbl_benutzer USING (person_id)
|
||||
WHERE
|
||||
uid = pa.student_uid
|
||||
)
|
||||
|| \' [\' || projekttyp_kurzbz || \'arbeit]\') AS "auftrag",
|
||||
lv.semester,
|
||||
CASE
|
||||
WHEN oe.organisationseinheittyp_kurzbz =
|
||||
\'Kompetenzfeld\' THEN (
|
||||
\'KF \' || oe.bezeichnung)
|
||||
WHEN oe.organisationseinheittyp_kurzbz =
|
||||
\'Department\' THEN (
|
||||
\'DEP \' || oe.bezeichnung)
|
||||
ELSE (oe.organisationseinheittyp_kurzbz ||
|
||||
\' \' || oe.bezeichnung)
|
||||
END AS "lv_oe_kurzbz",
|
||||
TRUNC(pb.stunden, 1) AS "stunden",
|
||||
TRUNC((pb.stunden * pb.stundensatz), 2) AS "betrag",
|
||||
vertrag_id,
|
||||
vertragsstunden AS "vertrag_stunden",
|
||||
vertrag.betrag AS "vertrag_betrag"
|
||||
FROM
|
||||
lehre.tbl_projektbetreuer pb
|
||||
JOIN lehre.tbl_projektarbeit pa USING (projektarbeit_id)
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN PUBLIC.tbl_organisationseinheit oe USING (oe_kurzbz)
|
||||
JOIN PUBLIC.tbl_person person USING (person_id)
|
||||
LEFT JOIN lehre.tbl_vertrag vertrag USING (vertrag_id)
|
||||
LEFT JOIN lehre.tbl_vertrag_vertragsstatus vvs USING (vertrag_id)
|
||||
JOIN PUBLIC.tbl_studiengang stg
|
||||
ON stg.studiengang_kz = lv.studiengang_kz
|
||||
WHERE
|
||||
/* filter projektbetreuuer */
|
||||
pb.person_id = \'' . $PERSON_ID . '\'
|
||||
/* filter studiensemester */
|
||||
AND le.studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
|
||||
/* filter active lehrveranstaltungen */
|
||||
AND lv.aktiv = TRUE
|
||||
/* filter active organisationseinheiten */
|
||||
AND oe.aktiv = TRUE
|
||||
/* filter vertragsstatus to avoid showing before status is bestellt */
|
||||
AND vvs.vertragsstatus_kurzbz IN (\'bestellt\', \'erteilt\', \'akzeptiert\')
|
||||
) tmp_projektbetreuung
|
||||
) auftraege
|
||||
ORDER BY "akzeptiert" NULLS FIRST, "erteilt" NULLS LAST, "bestellt"
|
||||
';
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'tableUniqueId' => 'acceptLehrauftrag',
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_akzeptieren',
|
||||
'datasetRepresentation' => 'tabulator',
|
||||
'columnsAliases' => array( // TODO: use phrasen
|
||||
'Status', // alias for row_index, because row_index is formatted to display the status icons
|
||||
'LV-Teil',
|
||||
'LV-ID',
|
||||
'PA-ID',
|
||||
'Studiensemester',
|
||||
'Studiengang-KZ',
|
||||
'Studiengang',
|
||||
'Semester',
|
||||
'OrgForm',
|
||||
'Person-ID',
|
||||
'Typ',
|
||||
'LV- / Projektbezeichnung',
|
||||
'Organisationseinheit',
|
||||
'Gruppe',
|
||||
'Stunden',
|
||||
'Betrag',
|
||||
'Vertrag-ID',
|
||||
'Vertrag-Stunden',
|
||||
'Vertrag-Betrag',
|
||||
'UID',
|
||||
'Bestellt',
|
||||
'Erteilt',
|
||||
'Angenommen',
|
||||
'Bestellt von',
|
||||
'Erteilt von',
|
||||
'Angenommen von'
|
||||
),
|
||||
'datasetRepOptions' => '{
|
||||
height: 550,
|
||||
layout: "fitColumns", // fit columns to width of table
|
||||
responsiveLayout: "hide", // hide columns that dont fit on the table
|
||||
movableColumns: true, // allows changing column
|
||||
placeholder: func_placeholder(),
|
||||
headerFilterPlaceholder: " ",
|
||||
index: "row_index", // assign specific column as unique id (important for row indexing)
|
||||
selectable: true, // allow row selection
|
||||
selectableRangeMode: "click", // allow range selection using shift end click on end of range
|
||||
selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
|
||||
selectableCheck: function(row){
|
||||
return func_selectableCheck(row);
|
||||
},
|
||||
footerElement: func_footerElement(),
|
||||
rowUpdated:function(row){
|
||||
func_rowUpdated(row);
|
||||
},
|
||||
rowSelectionChanged:function(data, rows){
|
||||
func_rowSelectionChanged(data, rows);
|
||||
},
|
||||
rowFormatter:function(row){
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
tableBuilt: function(){
|
||||
func_tableBuilt(this);
|
||||
},
|
||||
renderComplete:function(){
|
||||
func_renderComplete(this);
|
||||
},
|
||||
renderStarted:function(){
|
||||
func_renderStarted(this);
|
||||
}
|
||||
}', // tabulator properties
|
||||
'datasetRepFieldsDefs' => '{
|
||||
row_index: {visible:false}, // necessary for row indexing
|
||||
lehreinheit_id: {headerFilter:"input", bottomCalc:"count", bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}, width: "7%"},
|
||||
lehrveranstaltung_id: {headerFilter:"input", width: "5%"},
|
||||
projektarbeit_id: {visible: false},
|
||||
studiensemester_kurzbz: {visible: false},
|
||||
studiengang_kz: {visible: false},
|
||||
stg_typ_kurzbz: {headerFilter:"input", width: "5%"},
|
||||
semester: {headerFilter:"input"},
|
||||
orgform_kurzbz: {headerFilter:"input"},
|
||||
person_id: {visible: false},
|
||||
typ: {headerFilter:"input", width: "7%"},
|
||||
auftrag: {headerFilter:"input", width: "15%"},
|
||||
lv_oe_kurzbz: {headerFilter:"input", width: "8%"},
|
||||
gruppe: {headerFilter:"input", width: "5%"},
|
||||
stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
|
||||
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:1}, width: "5%"},
|
||||
betrag: {align:"right", width: "6%", formatter: form_formatNulltoStringNumber,
|
||||
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"},
|
||||
width: "8%"},
|
||||
vertrag_id: {visible: false},
|
||||
vertrag_stunden: {visible: false},
|
||||
vertrag_betrag: {visible: false},
|
||||
mitarbeiter_uid: {visible: false},
|
||||
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"},
|
||||
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"},
|
||||
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"},
|
||||
bestellt_von: {visible: false},
|
||||
erteilt_von: {visible: false},
|
||||
akzeptiert_von: {visible: false}
|
||||
}', // col properties
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('TableWidget', $filterWidgetArray);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Lehrauftrag erteilen',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'jquerycheckboxes' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'tabulator' => true,
|
||||
'momentjs' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'tablewidget' => true,
|
||||
'navigationwidget' => true,
|
||||
'phrases' => array(
|
||||
'global' => array('lehrauftraegeErteilen'),
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/lehrauftrag/approveLehrauftrag.js'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<body>
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- title & helper link -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<a class="pull-right" data-toggle="collapse" href="#collapseHelp" aria-expanded="false" aria-controls="collapseExample">
|
||||
Hilfe zu dieser Seite
|
||||
</a>
|
||||
<h3>
|
||||
<?php echo ucfirst($this->p->t('global', 'lehrauftraegeErteilen')); ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- helper collapse module -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 collapse" id="collapseHelp">
|
||||
<div class="well">
|
||||
|
||||
<h4>Lehrauftrag Standard-Bestellprozess</h4>
|
||||
<div class="panel panel-body">
|
||||
<table>
|
||||
<tr class="text-center">
|
||||
<td><img src="../../../public/images/icons/fa-user-tag.png" style="height: 60px; width: 60px;"></td>
|
||||
<td><i class='fa fa-2x fa-long-arrow-right'></i></td>
|
||||
<td><img src="../../../public/images/icons/fa-user-check.png" style="height: 60px; width: 60px;"></td>
|
||||
<td><i class='fa fa-2x fa-long-arrow-right'></i></td>
|
||||
<td><i class='fa fa-2x fa-handshake-o'></i></td>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td class="text-muted">BESTELLEN<br>(Studiengangsleitung)</td>
|
||||
<td></td>
|
||||
<td><b>ERTEILEN<br>(Department-/Kompetenzfeldleitung)</b></td>
|
||||
<td></td>
|
||||
<td class="text-muted">ANNEHMEN<br>(LektorIn)</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Lehraufträge erteilen</h4>
|
||||
<div class="panel panel-body">
|
||||
Sobald Lehraufträge bestellt wurden, können Sie diese hier erteilen.<br>
|
||||
Erteilte Lehraufträge können von den Lehrenden angenommen werden.<br>
|
||||
<ol>
|
||||
<li>Klicken Sie unten auf das Status-Icon 'Nur bestellte anzeigen' oder 'Alle anzeigen'</li>
|
||||
<li>Wählen Sie die zu erteilenden Lehraufträge selbst oder alle über den Button 'Alle auswählen'.</li>
|
||||
<li>Klicken Sie auf Lehrauftrag erteilen.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Geänderte Lehraufträge</h4>
|
||||
<div class="panel panel-body">
|
||||
Im FAS können Änderungen an Stunden/Stundensatz eines Lehrauftrags durchgeführt werden, solange dieser nicht vom Lehrenden angenommen wurde.<br>
|
||||
Wenn Änderungen an bereits bestellten oder erteilten Lehraufträgen vorgenommen wurden, müssen diese vom Studiengang erneut bestellt werden.<br>
|
||||
Bei bereits erteilten Lehraufträgen wird zusätzlich der Status 'erteilt' zurückgesetzt.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Warum kann ich manche Lehraufträge nicht auswählen?</h4>
|
||||
<div class="panel panel-body">
|
||||
Nur Lehraufträge mit dem Status 'bestellt' können gewählt werden.<br>
|
||||
Neue, Bestellte, Akzeptierte oder geänderte Lehraufträge werden nur zu Ihrer Information angezeigt und sind daher NICHT wählbar.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Filter</h4>
|
||||
<div class="panel panel-body">
|
||||
<table class="table table-bordered">
|
||||
<tr class="text-center">
|
||||
<td class="col-xs-1"><i class='fa fa-users'></i></td>
|
||||
<td class="col-xs-1"><i class='fa fa-user-plus'></i></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-tag.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-check.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><i class='fa fa-handshake-o'></i></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-edit.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><i class='fa fa-user-secret'></i></td>
|
||||
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td><b>Alle</b><br>Alle Lehraufträge mit jedem Status, auch geänderte und Dummy-Aufträge</td>
|
||||
<td><b>Neu</b><br>Nur Lehraufträge, die im FAS über die Zuteilung eines Lehrenden zu einer Lehreinheit/einem Projekt angelegt und noch nicht bestellt worden sind</td>
|
||||
<td><b>Bestellt</b><br>Nur bestellte UND geänderte bestellte Lehraufträge</td>
|
||||
<td><b>Erteilt</b><br>Nur erteilte UND geänderte erteilte Lehraufträge</td>
|
||||
<td><b>Angenommen</b><br>Nur vom Lehrenden angenommene Lehraufträge</td>
|
||||
<td><b>Geändert</b><br>Nur Lehraufträge, die geändert wurden, nachdem sie bereits bestellt oder erteilt worden sind</td>
|
||||
<td><b>Dummies</b><br>Nur Lehraufträge, die mit einem Dummylektor angelegt sind</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Auswahl</h4>
|
||||
<div class="panel panel-body">
|
||||
<ul>
|
||||
<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>
|
||||
<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>
|
||||
<li>Alle auswählen: Button 'Alle auswählen'</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Ansicht</h4>
|
||||
<div class="panel panel-body">
|
||||
<b>Spaltenbreite verändern</b>
|
||||
<p>
|
||||
Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam mit dem Mauszeiger auf
|
||||
den rechten Rand der entprechenden Spalte. <br>
|
||||
Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und
|
||||
mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.
|
||||
</p>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- dropdown widgets -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formLehrauftrag" class="form-inline" action="" method="get">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiensemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiensemester_selected
|
||||
),
|
||||
array(
|
||||
'name' => 'studiensemester',
|
||||
'id' => 'studiensemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Organisationseinheit_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $organisationseinheit_selected,
|
||||
'organisationseinheit' => $organisationseinheit
|
||||
),
|
||||
array(
|
||||
'name' => 'organisationseinheit',
|
||||
'id' => 'organisationseinheit'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Ausbildungssemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $ausbildungssemester_selected,
|
||||
'number_semester' => 6
|
||||
),
|
||||
array(
|
||||
'name' => 'ausbildungssemester',
|
||||
'id' => 'ausbildungssemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<button type="submit" name="submit" value="anzeigen" class="btn btn-default form-group">Anzeigen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- tabulator data table -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php $this->load->view('lehre/lehrauftrag/approveLehrauftragData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- filter buttons & erteil-button -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<button id="approve-lehrauftraege" class="btn btn-primary pull-right">Lehrauftrag erteilen</button>
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="show-all" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Alle anzeigen"><i class='fa fa-users'></i></button>
|
||||
<button id="show-new" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur neue anzeigen"><i class='fa fa-user-plus'></i></button>
|
||||
<button id="show-ordered" class="btn btn-default btn-lehrauftrag active focus" type="button" data-toggle="tooltip" data-placement="left" title="Nur bestellte anzeigen"></button><!-- png img set in javascript -->
|
||||
<button id="show-approved" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur erteilte anzeigen"></button><!-- png img set in javascript -->
|
||||
<button id="show-accepted" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur angenommene anzeigen"><i class='fa fa-handshake-o'></i></button>
|
||||
</div>
|
||||
<div class="btn-group" role="group" style="margin-left: 20px;">
|
||||
<button id="show-changed" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur geänderte anzeigen"></button><!-- png img set in javascript -->
|
||||
</div>
|
||||
<div class="btn-group" role="group" style="margin-left: 20px;">
|
||||
<button id="show-dummies" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur verplante ohne Lektor anzeigen (Dummies)"><i class='fa fa-user-secret'></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- end container -->
|
||||
</div><!-- end page-wrapper -->
|
||||
<br>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,418 @@
|
||||
<?php
|
||||
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$ORGANISATIONSEINHEIT = (isset($organisationseinheit_selected) && !is_null($organisationseinheit_selected)) ? array($organisationseinheit_selected) : $organisationseinheit;
|
||||
$AUSBILDUNGSSEMESTER = (isset($ausbildungssemester_selected) && !is_null($ausbildungssemester_selected)) ? $ausbildungssemester_selected : '1,2,3,4,5,6,7,8';
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
/* provide extra row index for tabulator, because no other column has unique ids */
|
||||
ROW_NUMBER() OVER () AS "row_index",
|
||||
personalnummer,
|
||||
lehreinheit_id,
|
||||
lehrveranstaltung_id,
|
||||
lv_bezeichnung,
|
||||
projektarbeit_id,
|
||||
studiensemester_kurzbz,
|
||||
studiengang_kz,
|
||||
stg_typ_kurzbz,
|
||||
semester,
|
||||
orgform_kurzbz,
|
||||
person_id,
|
||||
typ,
|
||||
auftrag,
|
||||
lv_oe_kurzbz,
|
||||
gruppe,
|
||||
lektor,
|
||||
stunden,
|
||||
betrag,
|
||||
vertrag_id,
|
||||
vertrag_stunden,
|
||||
vertrag_betrag,
|
||||
mitarbeiter_uid,
|
||||
bestellt,
|
||||
erteilt,
|
||||
akzeptiert,
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "bestellt_von",
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "erteilt_von",
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "akzeptiert_von"
|
||||
FROM
|
||||
(
|
||||
/* Lehraufträge and -vertragsstati */
|
||||
SELECT *,
|
||||
/* concatinated and aggregated gruppen */
|
||||
(SELECT
|
||||
string_agg(
|
||||
CASE WHEN gruppe_kurzbz is null THEN
|
||||
concat(upper(grpstg.typ || grpstg.kurzbz), \'-\', semester, verband, gruppe)
|
||||
ELSE
|
||||
gruppe_kurzbz
|
||||
END
|
||||
, \', \')
|
||||
FROM
|
||||
lehre.tbl_lehreinheitgruppe
|
||||
JOIN public.tbl_studiengang grpstg USING(studiengang_kz)
|
||||
WHERE
|
||||
lehreinheit_id = tmp_lehrauftraege.lehreinheit_id
|
||||
) AS "gruppe",
|
||||
/* existing contracts with status bestellt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "bestellt",
|
||||
/* existing contracts with status erteilt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "erteilt",
|
||||
/* existing contracts with status akzeptiert */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "akzeptiert"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
/* lehrauftraege also planned with dummies, therefore personalnummer is needed */
|
||||
ma.personalnummer,
|
||||
lema.lehreinheit_id,
|
||||
lv.lehrveranstaltung_id,
|
||||
lv.bezeichnung AS "lv_bezeichnung",
|
||||
NULL AS "projektarbeit_id",
|
||||
le.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
upper(stg.typ || stg.kurzbz) AS "stg_typ_kurzbz",
|
||||
lv.orgform_kurzbz,
|
||||
person.person_id,
|
||||
upper(lv.lehrtyp_kurzbz) AS "typ",
|
||||
(lv.bezeichnung || \' [\' || le.lehrform_kurzbz ||
|
||||
\']\') AS "auftrag",
|
||||
lv.semester,
|
||||
CASE
|
||||
WHEN oe.organisationseinheittyp_kurzbz = \'Kompetenzfeld\' THEN (\'KF \' || oe.bezeichnung)
|
||||
WHEN oe.organisationseinheittyp_kurzbz = \'Department\' THEN (\'DEP \' || oe.bezeichnung)
|
||||
ELSE (oe.organisationseinheittyp_kurzbz || \' \' || oe.bezeichnung)
|
||||
END AS "lv_oe_kurzbz",
|
||||
(person.nachname || \' \' || person.vorname) AS "lektor",
|
||||
TRUNC(lema.semesterstunden, 1) AS "stunden",
|
||||
TRUNC((lema.semesterstunden * lema.stundensatz), 2) AS "betrag",
|
||||
vertrag_id,
|
||||
vertragsstunden AS "vertrag_stunden",
|
||||
vertrag.betrag AS "vertrag_betrag",
|
||||
mitarbeiter_uid
|
||||
FROM
|
||||
lehre.tbl_lehreinheitmitarbeiter lema
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN PUBLIC.tbl_organisationseinheit oe USING (oe_kurzbz)
|
||||
JOIN PUBLIC.tbl_mitarbeiter ma USING (mitarbeiter_uid)
|
||||
JOIN PUBLIC.tbl_benutzer benutzer
|
||||
ON ma.mitarbeiter_uid = benutzer.uid
|
||||
JOIN PUBLIC.tbl_person person USING (person_id)
|
||||
LEFT JOIN lehre.tbl_vertrag vertrag USING (vertrag_id)
|
||||
JOIN PUBLIC.tbl_studiengang stg ON stg.studiengang_kz = lv.studiengang_kz
|
||||
WHERE
|
||||
/* filter organisationseinheit */
|
||||
lv.oe_kurzbz IN (\'' . implode('\',\'', $ORGANISATIONSEINHEIT) . '\')
|
||||
/* filter studiensemester */
|
||||
AND le.studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
|
||||
/* filter active lehrveranstaltungen */
|
||||
AND lv.aktiv = TRUE
|
||||
/* filter active organisationseinheiten */
|
||||
AND oe.aktiv = TRUE
|
||||
/* filter ausbildungssemester */
|
||||
AND lv.semester IN ('. $AUSBILDUNGSSEMESTER . ')
|
||||
) tmp_lehrauftraege
|
||||
|
||||
UNION
|
||||
|
||||
/* Projektbetreuungsaufträge and -vertragsstati */
|
||||
SELECT *,
|
||||
/* mitarbeiter uid retrieved by person_id */
|
||||
/* NOTE: mitarbeiter MUST come after Select * to ensure correct order with select for tmp_lehrauftraege*/
|
||||
(SELECT
|
||||
uid
|
||||
FROM
|
||||
public.tbl_benutzer
|
||||
WHERE
|
||||
person_id = tmp_projektbetreuung.person_id
|
||||
ORDER BY aktiv DESC, updateaktivam DESC -- accept inactive as some person_ids have no active, but order them last
|
||||
LIMIT 1) AS "mitarbeiter_uid",
|
||||
/* concatinated and aggregated gruppen */
|
||||
(SELECT
|
||||
string_agg(
|
||||
CASE WHEN gruppe_kurzbz is null THEN
|
||||
concat(upper(grpstg.typ || grpstg.kurzbz), \'-\', semester, verband, gruppe)
|
||||
ELSE
|
||||
gruppe_kurzbz
|
||||
END
|
||||
, \', \')
|
||||
FROM
|
||||
lehre.tbl_lehreinheitgruppe
|
||||
JOIN public.tbl_studiengang grpstg USING(studiengang_kz)
|
||||
WHERE
|
||||
lehreinheit_id = tmp_projektbetreuung.lehreinheit_id
|
||||
) AS "gruppe",
|
||||
/* existing contracts with status bestellt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "bestellt",
|
||||
/* existing contracts with status erteilt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "erteilt",
|
||||
/* existing contracts with status akzeptiert */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "akzeptiert"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
/* projektbetreuung does not plan with dummies, therefore no need to retrieve personalnummer */
|
||||
NULL AS personalnummer,
|
||||
pa.lehreinheit_id,
|
||||
lv.lehrveranstaltung_id,
|
||||
lv.bezeichnung AS "lv_bezeichnung",
|
||||
pa.projektarbeit_id AS "projektarbeit_id",
|
||||
le.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
upper(stg.typ || stg.kurzbz) AS "stg_typ_kurzbz",
|
||||
lv.orgform_kurzbz,
|
||||
person.person_id,
|
||||
\'Betreuung\' AS "typ",
|
||||
(betreuerart_kurzbz || \' \' ||
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
PUBLIC.tbl_person
|
||||
JOIN PUBLIC.tbl_benutzer USING (person_id)
|
||||
WHERE
|
||||
uid = pa.student_uid
|
||||
)
|
||||
|| \' [\' || projekttyp_kurzbz || \'arbeit]\') AS "auftrag",
|
||||
lv.semester,
|
||||
CASE
|
||||
WHEN oe.organisationseinheittyp_kurzbz =
|
||||
\'Kompetenzfeld\' THEN (
|
||||
\'KF \' || oe.bezeichnung)
|
||||
WHEN oe.organisationseinheittyp_kurzbz =
|
||||
\'Department\' THEN (
|
||||
\'DEP \' || oe.bezeichnung)
|
||||
ELSE (oe.organisationseinheittyp_kurzbz ||
|
||||
\' \' || oe.bezeichnung)
|
||||
END AS "lv_oe_kurzbz",
|
||||
(nachname || \' \' || vorname) AS "lektor",
|
||||
TRUNC(pb.stunden, 1) AS "stunden",
|
||||
TRUNC((pb.stunden * pb.stundensatz), 2) AS "betrag",
|
||||
vertrag_id,
|
||||
vertragsstunden AS "vertrag_stunden",
|
||||
vertrag.betrag AS "vertrag_betrag"
|
||||
FROM
|
||||
lehre.tbl_projektbetreuer pb
|
||||
JOIN lehre.tbl_projektarbeit pa USING (projektarbeit_id)
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN PUBLIC.tbl_organisationseinheit oe USING (oe_kurzbz)
|
||||
JOIN PUBLIC.tbl_person person USING (person_id)
|
||||
LEFT JOIN lehre.tbl_vertrag vertrag USING (vertrag_id)
|
||||
JOIN PUBLIC.tbl_studiengang stg
|
||||
ON stg.studiengang_kz = lv.studiengang_kz
|
||||
WHERE
|
||||
/* filter organisationseinheit */
|
||||
lv.oe_kurzbz IN (\'' . implode('\',\'', $ORGANISATIONSEINHEIT) . '\')
|
||||
/* filter studiensemester */
|
||||
AND le.studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
|
||||
/* filter active lehrveranstaltungen */
|
||||
AND lv.aktiv = TRUE
|
||||
/* filter active organisationseinheiten */
|
||||
AND oe.aktiv = TRUE
|
||||
/* filter ausbildungssemester */
|
||||
AND lv.semester IN ('. $AUSBILDUNGSSEMESTER . ')
|
||||
) tmp_projektbetreuung
|
||||
) auftraege
|
||||
ORDER BY "typ" DESC, "auftrag", "personalnummer" DESC, "lektor", "bestellt", "erteilt"
|
||||
';
|
||||
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'tableUniqueId' => 'approveLehrauftrag',
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_erteilen',
|
||||
'datasetRepresentation' => 'tabulator',
|
||||
'columnsAliases' => array( // TODO: use phrasen
|
||||
'Status', // alias for row_index, because row_index is formatted to display the status icons
|
||||
'Personalnummer',
|
||||
'LV-Teil',
|
||||
'LV-ID',
|
||||
'LV',
|
||||
'PA-ID',
|
||||
'Studiensemester',
|
||||
'Studiengang-KZ',
|
||||
'Studiengang',
|
||||
'Semester',
|
||||
'OrgForm',
|
||||
'Person-ID',
|
||||
'Typ',
|
||||
'LV- / Projektbezeichnung',
|
||||
'Organisationseinheit',
|
||||
'Gruppe',
|
||||
'Lektor',
|
||||
'Stunden',
|
||||
'Betrag',
|
||||
'Vertrag-ID',
|
||||
'Vertrag-Stunden',
|
||||
'Vertrag-Betrag',
|
||||
'UID',
|
||||
'Bestellt',
|
||||
'Erteilt',
|
||||
'Angenommen',
|
||||
'Bestellt von',
|
||||
'Erteilt von',
|
||||
'Angenommen von'
|
||||
),
|
||||
'datasetRepOptions' => '{
|
||||
height: 700,
|
||||
layout: "fitColumns", // fit columns to width of table
|
||||
responsiveLayout: "hide", // hide columns that dont fit on the table
|
||||
movableColumns: true, // allows changing column
|
||||
placeholder: func_placeholder(),
|
||||
headerFilterPlaceholder: " ",
|
||||
groupBy:"lehrveranstaltung_id",
|
||||
groupToggleElement:"header", //toggle group on click anywhere in the group header
|
||||
groupHeader: function(value, count, data, group){
|
||||
return func_groupHeader(data);
|
||||
},
|
||||
columnCalcs:"both", // show column calculations at top and bottom of table and in groups
|
||||
index: "row_index", // assign specific column as unique id (important for row indexing)
|
||||
selectable: true, // allow row selection
|
||||
selectableRangeMode: "click", // allow range selection using shift end click on end of range
|
||||
selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
|
||||
selectableCheck: function(row){
|
||||
return func_selectableCheck(row);
|
||||
},
|
||||
initialFilter: func_initialFilter(),
|
||||
footerElement: func_footerElement(),
|
||||
rowUpdated:function(row){
|
||||
func_rowUpdated(row);
|
||||
},
|
||||
rowSelectionChanged:function(data, rows){
|
||||
func_rowSelectionChanged(data, rows);
|
||||
},
|
||||
rowFormatter:function(row)
|
||||
{
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
renderStarted:function(){
|
||||
func_renderStarted(this);
|
||||
},
|
||||
tableBuilt: function(){
|
||||
func_tableBuilt(this);
|
||||
}
|
||||
}', // tabulator properties
|
||||
'datasetRepFieldsDefs' => '{
|
||||
// column status is built dynamically in funcTableBuilt(),
|
||||
row_index: {visible:false}, // necessary for row indexing
|
||||
personalnummer: {visible: false},
|
||||
lehreinheit_id: {headerFilter:"input", bottomCalc:"count", width: "7%",
|
||||
bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();},},
|
||||
lehrveranstaltung_id: {headerFilter:"input"},
|
||||
lv_bezeichnung: {visible: false},
|
||||
projektarbeit_id: {visible: false},
|
||||
studiensemester_kurzbz: {headerFilter:"input"},
|
||||
studiengang_kz: {visible: false},
|
||||
stg_typ_kurzbz: {headerFilter:"input", width: "5%"},
|
||||
semester: {headerFilter:"input"},
|
||||
orgform_kurzbz: {headerFilter:"input"},
|
||||
person_id: {visible: false},
|
||||
typ: {headerFilter:"input"},
|
||||
auftrag: {headerFilter:"input", width:"20%"},
|
||||
lv_oe_kurzbz: {headerFilter:"input"},
|
||||
gruppe: {headerFilter:"input"},
|
||||
lektor: {headerFilter:"input", widthGrow: 3},
|
||||
stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
|
||||
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:1}},
|
||||
betrag: {align:"right", width: "8%", formatter: form_formatNulltoStringNumber,
|
||||
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}},
|
||||
vertrag_id: {visible: false},
|
||||
vertrag_stunden: {visible: false},
|
||||
vertrag_betrag: {visible: false},
|
||||
mitarbeiter_uid: {visible: false},
|
||||
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"},
|
||||
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"},
|
||||
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"},
|
||||
bestellt_von: {visible: false},
|
||||
erteilt_von: {visible: false},
|
||||
akzeptiert_von: {visible: false},
|
||||
}', // col properties
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('TableWidget', $filterWidgetArray);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$UID = getAuthUID();
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
vertrag_id,
|
||||
vertragsstunden_studiensemester_kurzbz,
|
||||
vertragstyp_kurzbz,
|
||||
bezeichnung,
|
||||
vertragsstunden,
|
||||
betrag,
|
||||
datum AS "storniert",
|
||||
(
|
||||
SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE vertragsstatus_kurzbz = \'storno\'
|
||||
AND vertrag_id = vvs.vertrag_id
|
||||
)
|
||||
) AS "storniert_von",
|
||||
(
|
||||
SELECT
|
||||
vertragsstatus_kurzbz
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE vertrag_id = vvs.vertrag_id
|
||||
AND vertragsstatus_kurzbz != \'storno\'
|
||||
ORDER BY datum DESC
|
||||
LIMIT 1
|
||||
) AS "letzterStatus_vorStorniert"
|
||||
FROM lehre.tbl_vertrag_vertragsstatus vvs
|
||||
JOIN lehre.tbl_vertrag USING (vertrag_id)
|
||||
WHERE
|
||||
/* filter lector */
|
||||
uid = \'' . $UID . '\'
|
||||
/* filter studiensemester */
|
||||
AND vertragsstunden_studiensemester_kurzbz = \'' . $STUDIENSEMESTER . '\'
|
||||
/* filter cancelled only */
|
||||
AND vertragsstatus_kurzbz = \'storno\'
|
||||
';
|
||||
|
||||
$tableWidgetArray = array(
|
||||
'query' => $query,
|
||||
'tableUniqueId' => 'cancelledLehrauftrag',
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_akzeptieren',
|
||||
'datasetRepresentation' => 'tabulator',
|
||||
'columnsAliases' => array( // TODO: use phrasen
|
||||
'Status',
|
||||
'Studiensemester',
|
||||
'Typ',
|
||||
'LV- / Projektbezeichnung',
|
||||
'Stunden',
|
||||
'Betrag',
|
||||
'Storniert am'
|
||||
),
|
||||
'datasetRepOptions' => '{
|
||||
layout: "fitColumns", // fit columns to width of table
|
||||
responsiveLayout: "hide", // hide columns that dont fit on the table
|
||||
movableColumns: true, // allows changing column
|
||||
placeholder: func_placeholder(),
|
||||
rowFormatter:function(row){
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
selectableCheck: function(row){
|
||||
return func_selectableCheck(row);
|
||||
},
|
||||
renderComplete:function(){
|
||||
func_renderComplete(this);
|
||||
},
|
||||
tableBuilt: function(){
|
||||
func_tableBuilt(this);
|
||||
}
|
||||
}', // tabulator properties
|
||||
'datasetRepFieldsDefs' => '{
|
||||
vertrag_id: {visible: false},
|
||||
vertragsstunden_studiensemester_kurzbz: {visible: false},
|
||||
vertragstyp_kurzbz: {widthGrow: 2},
|
||||
bezeichnung: {widthGrow: 2},
|
||||
vertragsstunden: {
|
||||
align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:1}
|
||||
},
|
||||
betrag: {
|
||||
align:"right", formatter: form_formatNulltoStringNumber,
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money", bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}
|
||||
},
|
||||
storniert: {align:"center", mutator: mut_formatStringDate, tooltip: storniert_tooltip},
|
||||
storniert_von: {visible: false},
|
||||
letzterStatus_vorStorniert: {visible: false}
|
||||
}', // col properties
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('TableWidget', $tableWidgetArray);
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
// TODO: phrasen anpassen
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'Lehrauftrag bestellen',
|
||||
'jquery' => true,
|
||||
'jqueryui' => true,
|
||||
'jquerycheckboxes' => true,
|
||||
'bootstrap' => true,
|
||||
'fontawesome' => true,
|
||||
'sbadmintemplate' => true,
|
||||
'tabulator' => true,
|
||||
'momentjs' => true,
|
||||
'ajaxlib' => true,
|
||||
'dialoglib' => true,
|
||||
'tablewidget' => true,
|
||||
'navigationwidget' => true,
|
||||
'phrases' => array(
|
||||
'global' => array('lehrauftraegeBestellen'),
|
||||
),
|
||||
'customJSs' => array(
|
||||
'public/js/bootstrapper.js',
|
||||
'public/js/lehre/lehrauftrag/orderLehrauftrag.js'
|
||||
)
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<body>
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- title & helper link -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 page-header">
|
||||
<a class="pull-right" data-toggle="collapse" href="#collapseHelp" aria-expanded="false" aria-controls="collapseExample">
|
||||
Hilfe zu dieser Seite
|
||||
</a>
|
||||
<h3>
|
||||
<?php echo ucfirst($this->p->t('global', 'lehrauftraegeBestellen')); ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- helper collapse module -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12 collapse" id="collapseHelp">
|
||||
<div class="well">
|
||||
|
||||
<h4>Lehrauftrag Standard-Bestellprozess</h4>
|
||||
<div class="panel panel-body">
|
||||
<table>
|
||||
<tr class="text-center">
|
||||
<td><img src="../../../public/images/icons/fa-user-tag.png" style="height: 60px; width: 60px;"></td>
|
||||
<td><i class='fa fa-2x fa-long-arrow-right'></i></td>
|
||||
<td><img src="../../../public/images/icons/fa-user-check.png" style="height: 60px; width: 60px;"></td>
|
||||
<td><i class='fa fa-2x fa-long-arrow-right'></i></td>
|
||||
<td><i class='fa fa-2x fa-handshake-o'></i></td>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td><b>BESTELLEN<br>(Studiengangsleitung)</b></td>
|
||||
<td></td>
|
||||
<td class="text-muted">ERTEILEN<br>(Department-/Kompetenzfeldleitung)</td>
|
||||
<td></td>
|
||||
<td class="text-muted">ANNEHMEN<br>(LektorIn)</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Lehraufträge bestellen</h4>
|
||||
<div class="panel panel-body">
|
||||
Sobald im FAS ein Lehrauftrag/eine Projektbetreuung angelegt wurde, können Sie diese hier bestellen.<br>
|
||||
Bestellte Lehraufträge sind zur Erteilung freigegeben.<br>
|
||||
<ol>
|
||||
<li>Klicken Sie unten auf das Status-Icon 'Nur neue anzeigen', 'Nur geänderte anzeigen' oder 'Alle anzeigen'</li>
|
||||
<li>Wählen Sie die zu bestellenden Lehraufträge selbst oder über den Button 'Alle auswählen'.</li>
|
||||
<li>Klicken Sie auf Lehrauftrag bestellen.</li>
|
||||
</ol>
|
||||
Für jeden bestellten Lehrauftrag legt das System einen Vertrag an.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Geänderte Lehraufträge</h4>
|
||||
<div class="panel panel-body">
|
||||
Im FAS können Änderungen an Stunden/Stundensatz eines Lehrauftrags durchgeführt werden, solange dieser nicht vom Lehrenden angenommen wurde.<br>
|
||||
Diese müssen dann erneut bestellt werden.<br><br>
|
||||
Wenn Änderungen an bereits bestellten oder erteilten Lehraufträgen vorgenommen wurden, werden diese in einem tooltip angezeigt.<br>
|
||||
Fahren Sie dazu mit der Maus über dem Status-Icon am Beginn der Zeile.<br>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Warum kann ich manche Lehraufträge nicht auswählen?</h4>
|
||||
<div class="panel panel-body">
|
||||
Nur Lehraufträge mit dem Status 'neu' und 'geändert' können bestellt werden.<br>
|
||||
Erteilte oder akzeptierte Lehraufträge werden nur zu Ihrer Information angezeigt und sind daher NICHT wählbar.
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Filter</h4>
|
||||
<div class="panel panel-body">
|
||||
<table class="table table-bordered">
|
||||
<tr class="text-center">
|
||||
<td class="col-xs-1"><i class='fa fa-users'></i></td>
|
||||
<td class="col-xs-1"><i class='fa fa-user-plus'></i></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-tag.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-check.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><i class='fa fa-handshake-o'></i></td>
|
||||
<td class="col-xs-1"><img src="../../../public/images/icons/fa-user-edit.png" style="height: 30px; width: 30px;"></td>
|
||||
<td class="col-xs-1"><i class='fa fa-user-secret'></i></td>
|
||||
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<td><b>Alle</b><br>Alle Lehraufträge mit jedem Status, auch geänderte und Dummy-Aufträge</td>
|
||||
<td><b>Neu</b><br>Nur Lehraufträge, die im FAS über die Zuteilung eines Lehrenden zu einer Lehreinheit/einem Projekt angelegt und noch nicht bestellt worden sind</td>
|
||||
<td><b>Bestellt</b><br>Nur bestellte UND geänderte bestellte Lehraufträge</td>
|
||||
<td><b>Erteilt</b><br>Nur erteilte UND geänderte erteilte Lehraufträge</td>
|
||||
<td><b>Angenommen</b><br>Nur vom Lehrenden angenommene Lehraufträge</td>
|
||||
<td><b>Geändert</b><br>Nur Lehraufträge, die geändert wurden, nachdem sie bereits bestellt oder erteilt worden sind</td>
|
||||
<td><b>Dummies</b><br>Nur Lehraufträge, die mit einem Dummylektor angelegt sind</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Auswahl</h4>
|
||||
<div class="panel panel-body">
|
||||
<ul>
|
||||
<li>Einzeln auswählen: <kbd>Strg</kbd> + Klick auf einzelne Zeile(n)</li>
|
||||
<li>Bereich auswählen: <kbd>Shift</kbd> + Klick auf Anfangs- und Endzeile</li>
|
||||
<li>Alle auswählen: Button 'Alle auswählen'</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<h4>Ansicht</h4>
|
||||
<div class="panel panel-body">
|
||||
<b>Spaltenbreite verändern</b>
|
||||
<p>
|
||||
Um die Spaltenbreite zu verändern, fährt man im Spaltenkopf langsam mit dem Mauszeiger auf
|
||||
den rechten Rand der entprechenden Spalte. <br>
|
||||
Sobald sich der Mauszeiger in einen Doppelpfeil verwandelt, wird die Maustaste geklickt und
|
||||
mit gedrückter Maustaste die Spalte nach rechts erweitert oder nach links verkleinert.
|
||||
</p>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- dropdown widgets -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<form id="formLehrauftrag" class="form-inline" action="" method="get">
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiensemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiensemester_selected
|
||||
),
|
||||
array(
|
||||
'name' => 'studiensemester',
|
||||
'id' => 'studiensemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Studiengang_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $studiengang_selected,
|
||||
'studiengang' => $studiengang
|
||||
),
|
||||
array(
|
||||
'name' => 'studiengang',
|
||||
'id' => 'studiengang'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'Ausbildungssemester_widget',
|
||||
array(
|
||||
DropdownWidget::SELECTED_ELEMENT => $ausbildungssemester_selected,
|
||||
'number_semester' => 6
|
||||
),
|
||||
array(
|
||||
'name' => 'ausbildungssemester',
|
||||
'id' => 'ausbildungssemester'
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<button type="submit" name="submit" value="anzeigen" class="btn btn-default form-group">Anzeigen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- tabulator data table -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<?php $this->load->view('lehre/lehrauftrag/orderLehrauftragData.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- filter buttons & bestell-button -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<button id="order-lehrauftraege" class="btn btn-primary pull-right" data-toggle="tooltip" data-placement="left" title="">Lehrauftrag bestellen</button>
|
||||
<div class="btn-toolbar" role="toolbar">
|
||||
<div class="btn-group" role="group">
|
||||
<button id="show-all" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Alle anzeigen"><i class='fa fa-users'></i></button>
|
||||
<button id="show-new" class="btn btn-default btn-lehrauftrag active focus" type="button" data-toggle="tooltip" data-placement="left" title="Nur neue anzeigen"><i class='fa fa-user-plus'></i></button>
|
||||
<button id="show-ordered" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur bestellte anzeigen"></button><!-- png img set in javascript -->
|
||||
<button id="show-approved" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur erteilte anzeigen"></button><!-- png img set in javascript -->
|
||||
<button id="show-accepted" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur angenommene anzeigen"><i class='fa fa-handshake-o'></i></button>
|
||||
</div>
|
||||
<div class="btn-group" role="group" style="margin-left: 20px;">
|
||||
<button id="show-changed" class="btn btn-default btn-lehrauftrag active focus" type="button" data-toggle="tooltip" data-placement="left" title="Nur geänderte anzeigen"></button><!-- png img set in javascript -->
|
||||
</div>
|
||||
<div class="btn-group" role="group" style="margin-left: 20px;">
|
||||
<button id="show-dummies" class="btn btn-default btn-lehrauftrag" type="button" data-toggle="tooltip" data-placement="left" title="Nur verplante ohne Lektor anzeigen (Dummies)"><i class='fa fa-user-secret'></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- end container -->
|
||||
</div><!-- end page-wrapper -->
|
||||
<br>
|
||||
</body>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
|
||||
$STUDIENSEMESTER = $studiensemester_selected;
|
||||
$STUDIENGANG = (isset($studiengang_selected) && !is_null($studiengang_selected)) ? array($studiengang_selected) : $studiengang;
|
||||
$AUSBILDUNGSSEMESTER = (isset($ausbildungssemester_selected) && !is_null($ausbildungssemester_selected)) ? $ausbildungssemester_selected : '1,2,3,4,5,6,7,8';
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
/* provide extra row index for tabulator, because no other column has unique ids */
|
||||
ROW_NUMBER() OVER () AS "row_index",
|
||||
personalnummer,
|
||||
lehreinheit_id,
|
||||
lehrveranstaltung_id,
|
||||
lv_bezeichnung,
|
||||
projektarbeit_id,
|
||||
studiensemester_kurzbz,
|
||||
studiengang_kz,
|
||||
stg_typ_kurzbz,
|
||||
semester,
|
||||
/* get valid STPL(s), to which the lehrveranstaltung is assigned to (can be more) */
|
||||
/* therefore join over lv, studiensemester and semester */
|
||||
(
|
||||
SELECT
|
||||
string_agg(bezeichnung, \', \')
|
||||
FROM (
|
||||
SELECT stpl.bezeichnung
|
||||
FROM lehre.tbl_studienplan stpl
|
||||
JOIN lehre.tbl_studienplan_semester stplsem USING (studienplan_id)
|
||||
JOIN lehre.tbl_studienplan_lehrveranstaltung stpllv USING (studienplan_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehrveranstaltung_id)
|
||||
WHERE
|
||||
/* join over lv of the le */
|
||||
le.lehreinheit_id = auftraege.lehreinheit_id
|
||||
AND stpl.aktiv
|
||||
/* then restrict on stpl of les studiensemester */
|
||||
AND stplsem.studiensemester_kurzbz = le.studiensemester_kurzbz
|
||||
/* then restrict on stpl of lvs semester*/
|
||||
AND stplsem.semester = stpllv.semester
|
||||
/* then restrict on most recent inserted studienplan of the lv */
|
||||
AND studienplan_id = (
|
||||
SELECT stpllv.studienplan_id
|
||||
FROM lehre.tbl_studienplan_lehrveranstaltung
|
||||
WHERE lehrveranstaltung_id = lv.lehrveranstaltung_id
|
||||
ORDER BY insertamum DESC
|
||||
LIMIT 1
|
||||
)
|
||||
) AS tmp_stpl
|
||||
) AS "studienplan_bezeichnung",
|
||||
orgform_kurzbz,
|
||||
person_id,
|
||||
typ,
|
||||
auftrag,
|
||||
lv_oe_kurzbz,
|
||||
gruppe,
|
||||
lektor,
|
||||
stunden,
|
||||
stundensatz,
|
||||
betrag,
|
||||
vertrag_id,
|
||||
vertrag_stunden,
|
||||
vertrag_betrag,
|
||||
mitarbeiter_uid,
|
||||
bestellt,
|
||||
erteilt,
|
||||
akzeptiert,
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "bestellt_von",
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "erteilt_von",
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
public.tbl_person
|
||||
JOIN public.tbl_benutzer benutzer USING (person_id)
|
||||
WHERE
|
||||
benutzer.uid = (
|
||||
SELECT
|
||||
insertvon
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus vvs
|
||||
WHERE
|
||||
vvs.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vvs.vertrag_id = auftraege.vertrag_id
|
||||
)
|
||||
) AS "akzeptiert_von"
|
||||
FROM
|
||||
(
|
||||
/* Lehraufträge and -vertragsstati */
|
||||
SELECT *,
|
||||
/* concatinated and aggregated gruppen */
|
||||
(SELECT
|
||||
string_agg(
|
||||
CASE WHEN gruppe_kurzbz is null THEN
|
||||
concat(upper(grpstg.typ || grpstg.kurzbz), \'-\', semester, verband, gruppe)
|
||||
ELSE
|
||||
gruppe_kurzbz
|
||||
END
|
||||
, \', \')
|
||||
FROM
|
||||
lehre.tbl_lehreinheitgruppe
|
||||
JOIN public.tbl_studiengang grpstg USING(studiengang_kz)
|
||||
WHERE
|
||||
lehreinheit_id = tmp_lehrauftraege.lehreinheit_id
|
||||
) AS "gruppe",
|
||||
/* existing contracts with status bestellt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "bestellt",
|
||||
/* existing contracts with status erteilt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "erteilt",
|
||||
/* existing contracts with status akzeptiert */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vertrag_id = tmp_lehrauftraege.vertrag_id) AS "akzeptiert"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
/* lehrauftraege also planned with dummies, therefore personalnummer is needed */
|
||||
ma.personalnummer,
|
||||
lema.lehreinheit_id,
|
||||
lv.lehrveranstaltung_id,
|
||||
lv.bezeichnung AS "lv_bezeichnung",
|
||||
NULL AS "projektarbeit_id",
|
||||
le.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
upper(stg.typ || stg.kurzbz) AS "stg_typ_kurzbz",
|
||||
lv.orgform_kurzbz,
|
||||
person.person_id,
|
||||
upper(lv.lehrtyp_kurzbz) AS "typ",
|
||||
(lv.bezeichnung || \' [\' || le.lehrform_kurzbz ||
|
||||
\']\') AS "auftrag",
|
||||
lv.semester,
|
||||
CASE
|
||||
WHEN oe.organisationseinheittyp_kurzbz = \'Kompetenzfeld\' THEN (\'KF \' || oe.bezeichnung)
|
||||
WHEN oe.organisationseinheittyp_kurzbz = \'Department\' THEN (\'DEP \' || oe.bezeichnung)
|
||||
ELSE (oe.organisationseinheittyp_kurzbz || \' \' || oe.bezeichnung)
|
||||
END AS "lv_oe_kurzbz",
|
||||
(person.nachname || \' \' || person.vorname) AS "lektor",
|
||||
TRUNC(lema.semesterstunden, 1) AS "stunden",
|
||||
lema.stundensatz,
|
||||
TRUNC((lema.semesterstunden * lema.stundensatz), 2) AS "betrag",
|
||||
vertrag_id,
|
||||
vertragsstunden AS "vertrag_stunden",
|
||||
vertrag.betrag AS "vertrag_betrag",
|
||||
mitarbeiter_uid
|
||||
FROM
|
||||
lehre.tbl_lehreinheitmitarbeiter lema
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN PUBLIC.tbl_organisationseinheit oe USING (oe_kurzbz)
|
||||
JOIN PUBLIC.tbl_mitarbeiter ma USING (mitarbeiter_uid)
|
||||
JOIN PUBLIC.tbl_benutzer benutzer
|
||||
ON ma.mitarbeiter_uid = benutzer.uid
|
||||
JOIN PUBLIC.tbl_person person USING (person_id)
|
||||
LEFT JOIN lehre.tbl_vertrag vertrag USING (vertrag_id)
|
||||
JOIN PUBLIC.tbl_studiengang stg ON stg.studiengang_kz = lv.studiengang_kz
|
||||
WHERE
|
||||
/* filter studiengang */
|
||||
lv.studiengang_kz IN ('. implode(',', $STUDIENGANG) . ')
|
||||
/* filter studiensemester */
|
||||
AND le.studiensemester_kurzbz = \''. $STUDIENSEMESTER. '\'
|
||||
/* filter active lehrveranstaltungen */
|
||||
AND lv.aktiv = TRUE
|
||||
/* filter active organisationseinheiten */
|
||||
AND oe.aktiv = TRUE
|
||||
/* filter ausbildungssemester */
|
||||
AND lv.semester IN ('. $AUSBILDUNGSSEMESTER . ')
|
||||
) tmp_lehrauftraege
|
||||
|
||||
UNION
|
||||
|
||||
/* Projektbetreuungsaufträge and -vertragsstati */
|
||||
SELECT *,
|
||||
/* mitarbeiter uid retrieved by person_id */
|
||||
/* NOTE: mitarbeiter MUST come after Select * to ensure correct order with select for tmp_lehrauftraege*/
|
||||
(SELECT
|
||||
uid
|
||||
FROM
|
||||
public.tbl_benutzer
|
||||
WHERE
|
||||
person_id = tmp_projektbetreuung.person_id
|
||||
ORDER BY aktiv DESC, updateaktivam DESC -- accept inactive as some person_ids have no active, but order them last
|
||||
LIMIT 1) AS "mitarbeiter_uid",
|
||||
/* concatinated and aggregated gruppen */
|
||||
(SELECT
|
||||
string_agg(
|
||||
CASE WHEN gruppe_kurzbz is null THEN
|
||||
concat(upper(grpstg.typ || grpstg.kurzbz), \'-\', semester, verband, gruppe)
|
||||
ELSE
|
||||
gruppe_kurzbz
|
||||
END
|
||||
, \', \')
|
||||
FROM
|
||||
lehre.tbl_lehreinheitgruppe
|
||||
JOIN public.tbl_studiengang grpstg USING(studiengang_kz)
|
||||
WHERE
|
||||
lehreinheit_id = tmp_projektbetreuung.lehreinheit_id
|
||||
) AS "gruppe",
|
||||
/* existing contracts with status bestellt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'bestellt\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "bestellt",
|
||||
/* existing contracts with status erteilt */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'erteilt\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "erteilt",
|
||||
/* existing contracts with status akzeptiert */
|
||||
(SELECT
|
||||
datum
|
||||
FROM
|
||||
lehre.tbl_vertrag_vertragsstatus
|
||||
WHERE
|
||||
tbl_vertrag_vertragsstatus.vertragsstatus_kurzbz = \'akzeptiert\'
|
||||
AND vertrag_id = tmp_projektbetreuung.vertrag_id) AS "akzeptiert"
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
/* projektbetreuung does not plan with dummies, therefore no need to retrieve personalnummer */
|
||||
NULL AS personalnummer,
|
||||
pa.lehreinheit_id,
|
||||
lv.lehrveranstaltung_id,
|
||||
lv.bezeichnung AS "lv_bezeichnung",
|
||||
pa.projektarbeit_id AS "projektarbeit_id",
|
||||
le.studiensemester_kurzbz,
|
||||
stg.studiengang_kz,
|
||||
upper(stg.typ || stg.kurzbz) AS "stg_typ_kurzbz",
|
||||
lv.orgform_kurzbz,
|
||||
person.person_id,
|
||||
\'Betreuung\' AS "typ",
|
||||
(betreuerart_kurzbz || \' \' ||
|
||||
(SELECT
|
||||
vorname || \' \' || nachname
|
||||
FROM
|
||||
PUBLIC.tbl_person
|
||||
JOIN PUBLIC.tbl_benutzer USING (person_id)
|
||||
WHERE
|
||||
uid = pa.student_uid
|
||||
)
|
||||
|| \' [\' || projekttyp_kurzbz || \'arbeit]\') AS "auftrag",
|
||||
lv.semester,
|
||||
CASE
|
||||
WHEN oe.organisationseinheittyp_kurzbz =
|
||||
\'Kompetenzfeld\' THEN (
|
||||
\'KF \' || oe.bezeichnung)
|
||||
WHEN oe.organisationseinheittyp_kurzbz =
|
||||
\'Department\' THEN (
|
||||
\'DEP \' || oe.bezeichnung)
|
||||
ELSE (oe.organisationseinheittyp_kurzbz ||
|
||||
\' \' || oe.bezeichnung)
|
||||
END AS "lv_oe_kurzbz",
|
||||
(nachname || \' \' || vorname) AS "lektor",
|
||||
TRUNC(pb.stunden, 1) AS "stunden",
|
||||
pb.stundensatz,
|
||||
TRUNC((pb.stunden * pb.stundensatz), 2) AS "betrag",
|
||||
vertrag_id,
|
||||
vertragsstunden AS "vertrag_stunden",
|
||||
vertrag.betrag AS "vertrag_betrag"
|
||||
FROM
|
||||
lehre.tbl_projektbetreuer pb
|
||||
JOIN lehre.tbl_projektarbeit pa USING (projektarbeit_id)
|
||||
JOIN lehre.tbl_lehreinheit le USING (lehreinheit_id)
|
||||
JOIN lehre.tbl_lehrveranstaltung lv USING (lehrveranstaltung_id)
|
||||
JOIN PUBLIC.tbl_organisationseinheit oe USING (oe_kurzbz)
|
||||
JOIN PUBLIC.tbl_person person USING (person_id)
|
||||
LEFT JOIN lehre.tbl_vertrag vertrag USING (vertrag_id)
|
||||
JOIN PUBLIC.tbl_studiengang stg
|
||||
ON stg.studiengang_kz = lv.studiengang_kz
|
||||
WHERE
|
||||
/* filter studiengang */
|
||||
lv.studiengang_kz IN ('. implode(',', $STUDIENGANG) . ')
|
||||
/* filter studiensemester */
|
||||
AND le.studiensemester_kurzbz = \''. $STUDIENSEMESTER. '\'
|
||||
/* filter active lehrveranstaltungen */
|
||||
AND lv.aktiv = TRUE
|
||||
/* filter ausbildungssemester */
|
||||
AND lv.semester IN ('. $AUSBILDUNGSSEMESTER . ')
|
||||
/* filter active organisationseinheiten */
|
||||
AND oe.aktiv = TRUE
|
||||
) tmp_projektbetreuung
|
||||
) auftraege
|
||||
ORDER BY "typ" DESC, "auftrag", "personalnummer" DESC, "lektor", "bestellt"
|
||||
';
|
||||
$filterWidgetArray = array(
|
||||
'query' => $query,
|
||||
'tableUniqueId' => 'orderLehrauftrag',
|
||||
'requiredPermissions' => 'lehre/lehrauftrag_bestellen',
|
||||
'datasetRepresentation' => 'tabulator',
|
||||
'columnsAliases' => array( // TODO: use phrasen
|
||||
'Status', // alias for row_index, because row_index is formatted to display the status icons
|
||||
'Personalnummer',
|
||||
'LV-Teil',
|
||||
'LV-ID',
|
||||
'LV',
|
||||
'PA-ID',
|
||||
'Studiensemester',
|
||||
'Studiengang-KZ',
|
||||
'Studiengang',
|
||||
'Semester',
|
||||
'Studienplan',
|
||||
'OrgForm',
|
||||
'Person-ID',
|
||||
'Typ',
|
||||
'LV- / Projektbezeichnung',
|
||||
'Organisationseinheit',
|
||||
'Gruppe',
|
||||
'Lektor',
|
||||
'Stunden',
|
||||
'Stundensatz',
|
||||
'Betrag',
|
||||
'Vertrag-ID',
|
||||
'Vertrag-Stunden',
|
||||
'Vertrag-Betrag',
|
||||
'UID',
|
||||
'Bestellt',
|
||||
'Erteilt',
|
||||
'Angenommen',
|
||||
'Bestellt von',
|
||||
'Erteilt von',
|
||||
'Angenommen von'
|
||||
),
|
||||
'datasetRepOptions' => '{
|
||||
height: 700,
|
||||
layout:"fitColumns", // fit columns to width of table
|
||||
responsiveLayout:"hide", // hide columns that dont fit on the table
|
||||
movableColumns: true, // allows changing column
|
||||
placeholder: func_placeholder(),
|
||||
headerFilterPlaceholder: " ",
|
||||
groupBy:"lehrveranstaltung_id",
|
||||
groupToggleElement:"header", //toggle group on click anywhere in the group header
|
||||
groupHeader: function(value, count, data, group){
|
||||
return func_groupHeader(data);
|
||||
},
|
||||
footerElement: func_footerElement(),
|
||||
columnCalcs:"both", // show column calculations at top and bottom of table and in groups
|
||||
index: "row_index", // assign specific column as unique id (important for row indexing)
|
||||
selectable: true, // allows row selection
|
||||
selectableRangeMode: "click", // allows range selection using shift end click on end of range
|
||||
selectablePersistence:false, // deselect previously selected rows when table is filtered, sorted or paginated
|
||||
selectableCheck: function(row){
|
||||
return func_selectableCheck(row);
|
||||
},
|
||||
rowUpdated:function(row){
|
||||
func_rowUpdated(row);
|
||||
},
|
||||
rowSelectionChanged:function(data, rows){
|
||||
func_rowSelectionChanged(data, rows);
|
||||
},
|
||||
rowFormatter:function(row){
|
||||
func_rowFormatter(row);
|
||||
},
|
||||
renderStarted:function(){
|
||||
func_renderStarted(this);
|
||||
},
|
||||
tableBuilt: function(){
|
||||
func_tableBuilt(this);
|
||||
},
|
||||
dataLoaded: function(data){
|
||||
func_dataLoaded(data, this);
|
||||
},
|
||||
}', // tabulator properties
|
||||
'datasetRepFieldsDefs' => '{
|
||||
// column status is built dynamically in funcTableBuilt()
|
||||
row_index: {visible: false},
|
||||
personalnummer: {visible: false},
|
||||
lehreinheit_id: {headerFilter:"input", bottomCalc:"count", width: "7%",
|
||||
bottomCalcFormatter:function(cell){return "Anzahl: " + cell.getValue();}},
|
||||
lehrveranstaltung_id: {headerFilter:"input"},
|
||||
lv_bezeichnung: {visible: false},
|
||||
projektarbeit_id: {visible: false},
|
||||
studiensemester_kurzbz: {headerFilter:"input"},
|
||||
studiengang_kz: {visible: false},
|
||||
stg_typ_kurzbz: {headerFilter:"input", width: "5%"},
|
||||
semester: {headerFilter:"input"},
|
||||
studienplan_bezeichnung: {headerFilter:"input", width: "7%"},
|
||||
orgform_kurzbz: {headerFilter:"input"},
|
||||
person_id: {visible: false},
|
||||
typ: {headerFilter:"input"},
|
||||
auftrag: {headerFilter:"input", width:"15%"},
|
||||
lv_oe_kurzbz: {headerFilter:"input"},
|
||||
gruppe: {headerFilter:"input"},
|
||||
lektor: {headerFilter:"input", widthGrow: 3},
|
||||
stunden: {align:"right", formatter: form_formatNulltoStringNumber, formatterParams:{precision:1},
|
||||
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:1}},
|
||||
stundensatz: {visible: false},
|
||||
betrag: {align:"right", width: "8%", formatter: form_formatNulltoStringNumber,
|
||||
headerFilter:"input", headerFilterFunc: hf_filterStringnumberWithOperator,
|
||||
bottomCalc:"sum", bottomCalcParams:{precision:2}, bottomCalcFormatter:"money",
|
||||
bottomCalcFormatterParams:{decimal: ",", thousand: ".", symbol:"€"}},
|
||||
vertrag_id: {visible: false},
|
||||
vertrag_stunden: {visible: false},
|
||||
vertrag_betrag: {visible: false},
|
||||
mitarbeiter_uid: {visible: false},
|
||||
bestellt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: bestellt_tooltip, width: "8%"},
|
||||
erteilt: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: erteilt_tooltip, width: "8%"},
|
||||
akzeptiert: {align:"center", headerFilter:"input", mutator: mut_formatStringDate, tooltip: akzeptiert_tooltip, width: "8%"},
|
||||
bestellt_von: {visible: false},
|
||||
erteilt_von: {visible: false},
|
||||
akzeptiert_von: {visible: false}
|
||||
}', // col properties
|
||||
);
|
||||
|
||||
echo $this->widgetlib->widget('TableWidget', $filterWidgetArray);
|
||||
|
||||
?>
|
||||
@@ -7,7 +7,7 @@ $this->load->view('templates/header', array('title' => 'StudienjahrEdit', 'jquer
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<h2>Studienjahr bearbeiten: <?php echo $jahr->studienjahr_kurzbz; ?></h2>
|
||||
<form method="post" action="<?php echo site_url("organisation/studienjahr/saveStudienjahr"); ?>">
|
||||
<form method="post" action="<?php echo site_url("organisation/studienjahr/updateStudienjahr"); ?>">
|
||||
|
||||
<table>
|
||||
<?php include('studienjahrForm.php'); ?>
|
||||
|
||||
@@ -8,7 +8,7 @@ $this->load->view('templates/header', array('title' => 'StudiensemesterEdit', 'd
|
||||
<div class="span4">
|
||||
<h2>Studiensemester bearbeiten: <?php echo $sem->studiensemester_kurzbz; ?></h2>
|
||||
<form method="post"
|
||||
action="<?php echo site_url("organisation/studiensemester/saveStudiensemester") ?>">
|
||||
action="<?php echo site_url("organisation/studiensemester/updateStudiensemester") ?>">
|
||||
<table>
|
||||
<?php include('studiensemesterForm.php'); ?>
|
||||
<input type="hidden" name="semkurzbz" value="<?php echo $sem->studiensemester_kurzbz; ?>"/>
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
<b><?php echo $this->p->t('lehre', 'gewichteternotendurchschnitt'); ?>
|
||||
<img src="../../../../skin/images/information.png" title="<?php echo htmlentities($this->p->t('lehre', 'info_notendurchschnitt_gewichtet')); ?>" />:</b>
|
||||
<?php echo $courses['overall']['notendurchschnittgewichtet'] ?><br>
|
||||
<b><?php echo $this->p->t('lehre', 'ects'); ?>:</b>
|
||||
<b><?php echo $this->p->t('lehre', 'ects'); ?>
|
||||
<img src="../../../../skin/images/information.png" title="Summe der positiv absolvierten ECTS" />:</b>
|
||||
<?php echo $courses['overall']['ectssumme_positiv'] ?><br>
|
||||
<br>
|
||||
<?php
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user