diff --git a/.gitignore b/.gitignore index 247c57d2e..de95987a8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ application/models/extensions/ application/views/extensions/ application/widgets/extensions/ application/logs/ +public/extensions/ tests/codeception/_output/* !/tests/codeception/_output/.placeholder tests/codeception/codeception.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 265334eda..08402fd64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,10 @@ - **[CORE]** Update campus.tbl_templates (contentmittitel and contentohnetitel) with system/templates/contentmittitel_xslt_xhtml.xslt andsystem/templates/contentohnetitel_xslt_xhtml.xslt - **[CORE]** Neue Style Anweisungen (div.header_logo, td.headerbar, div.cis_logo) müssen in Custom Stylesheet hinzugefügt werden +### Removed + **[CORE]** Removed Support for XSLFO2PDF Documents - use unoconv instead + **[CORE]** Removed Support for FOP Documents - use unoconv instead + ### Deprecated - **[CORE]** Die folgenden Datenbank Tabellen und Spalten wurden als DEPRECATED markiert und werden mit der nächsten Version entfernt: public.tbl_aufnahmeschluessel, public.tbl_aufnahmetermin, public.tbl_aufnahmetermintyp, public.tbl_preinteressent, diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php index 15c5d8be0..dfb690278 100644 --- a/application/config/fhcomplete.php +++ b/application/config/fhcomplete.php @@ -236,6 +236,13 @@ $config['fhc_acl'] = array 'wawi.tbl_rechnungstyp' => 'basis/rechnungstyp', 'wawi.tbl_zahlungstyp' => 'basis/zahlungstyp', + // Temporary + 'extension.tbl_budgetantrag' => 'basis/kostenstelle', + 'extension.tbl_budgetposition' => 'basis/kostenstelle', + 'extension.tbl_budgetstatus' => 'basis/kostenstelle', + 'extension.tbl_budgetantrag_status' => 'basis/kostenstelle', + 'extension.tbl_dsms_anonymisierung' => 'dsms/export', + DMS_PATH => 'fs/dms', 'PhrasesLib.getPhrase' => 'system/PhrasesLib' diff --git a/application/config/navigation.php b/application/config/navigation.php index 6e1c711ed..6ef2fb803 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -1,17 +1,12 @@ array( - 'FH-Complete' => base_url('index.ci.php/'), + '*' => array( + 'FH-Complete' => site_url(''), 'Vilesci' => base_url('/vilesci'), 'CIS' => CIS_ROOT ), - 'system/infocenter/InfoCenter/index' => array( - 'FH-Complete' => base_url('index.ci.php/'), - 'Vilesci' => base_url('/vilesci'), - 'CIS' => CIS_ROOT - ), - 'system/infocenter/InfoCenter/showDetails' => array( + 'system/infocenter/InfoCenter/infocenterFreigegeben' => array( 'FH-Complete' => base_url('index.ci.php/'), 'Vilesci' => base_url('/vilesci'), 'CIS' => CIS_ROOT @@ -39,7 +34,7 @@ $config['navigation_menu']['Vilesci/index'] = array( 'expand' => true ), 'Infocenter' => array( - 'link' => base_url('index.ci.php/system/infocenter/InfoCenter'), + 'link' => site_url('/system/infocenter/InfoCenter'), 'icon' => 'info', 'description' => 'Infocenter', 'expand' => true @@ -59,17 +54,35 @@ $config['navigation_menu']['Vilesci/index'] = array( 'expand' => true ), 'Extensions' => array( - 'link' => base_url('index.ci.php/system/extensions/Manager'), + 'link' => site_url('/system/extensions/Manager'), 'icon' => 'cubes', 'description' => 'Extensions Manager', 'expand' => true - ), - 'Datenschutz' => array( - 'link' => base_url('index.ci.php/extensions/FHC-Core-DSMS/export'), - 'description' => 'Datenschutz', - 'icon' => 'legal', - 'expand' => true ) ) ) ); + +//HIDDEN as long as filter is revised +//$config['navigation_menu']['system/infocenter/InfoCenter/index'] = array( +// 'Freigegeben' => array( +// 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/infocenterFreigegeben'), +// 'description' => 'Freigegeben', +// 'icon' => 'thumbs-up' +// )); + +$config['navigation_menu']['system/infocenter/InfoCenter/showDetails'] = array( + 'Freigegeben' => array( + 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/infocenterFreigegeben'), + 'description' => 'Freigegeben', + 'icon' => 'thumbs-up' + )); + +$config['navigation_menu']['system/infocenter/InfoCenter/infocenterFreigegeben'] = array( + 'Zurück' => array( + 'link' => base_url('index.ci.php/system/infocenter/InfoCenter/index'), + 'description' => 'Zurück', + 'icon' => 'angle-left' + )); + + diff --git a/application/controllers/api/v1/system/Phrase.php b/application/controllers/api/v1/system/Phrase.php index 31decf540..457f75521 100644 --- a/application/controllers/api/v1/system/Phrase.php +++ b/application/controllers/api/v1/system/Phrase.php @@ -22,20 +22,22 @@ class Phrase extends APIv1_Controller public function __construct() { parent::__construct(); + + // Loads the phrases library $this->load->library('PhrasesLib'); } /** - * @return void + * */ public function getPhrase() { $phrase_id = $this->get('phrase_id'); - + if (isset($phrase_id)) { $result = $this->phraseslib->getPhrase($phrase_id); - + $this->response($result, REST_Controller::HTTP_OK); } else @@ -43,9 +45,9 @@ class Phrase extends APIv1_Controller $this->response(); } } - + /** - * @return void + * */ public function getPhrases() { @@ -55,11 +57,11 @@ class Phrase extends APIv1_Controller $orgeinheit_kurzbz = $this->get('orgeinheit_kurzbz'); $orgform_kurzbz = $this->get('orgform_kurzbz'); $blockTags = $this->get('blockTags'); - + if (isset($app) && isset($sprache)) { $result = $this->phraseslib->getPhrases($app, $sprache, $phrase, $orgeinheit_kurzbz, $orgform_kurzbz, $blockTags); - + $this->response($result, REST_Controller::HTTP_OK); } else @@ -69,7 +71,7 @@ class Phrase extends APIv1_Controller } /** - * @return void + * */ public function postPhrase() { @@ -83,7 +85,7 @@ class Phrase extends APIv1_Controller { $result = $this->PhraseModel->insert($this->post()); } - + $this->response($result, REST_Controller::HTTP_OK); } else @@ -91,9 +93,12 @@ class Phrase extends APIv1_Controller $this->response(); } } - + + /** + * + */ private function _validate($phrase = null) { return false; } -} \ No newline at end of file +} diff --git a/application/controllers/system/Navigation.php b/application/controllers/system/Navigation.php index 037a7d0f4..65f311c66 100644 --- a/application/controllers/system/Navigation.php +++ b/application/controllers/system/Navigation.php @@ -10,20 +10,23 @@ class Navigation extends VileSci_Controller const SESSION_NAME = 'NAVIGATION_MENU'; /** - * + * Constructor */ public function __construct() - { - parent::__construct(); + { + parent::__construct(); $this->config->load('navigation'); - // Load session library - $this->load->library('session'); - } + // Load session library + $this->load->library('session'); + $this->load->library('ExtensionsLib'); + } /** - * + * This function creates the left Menu for each Page + * @param navigation_widget_called GET Parameter witch holds the currently called Page + * @return JSON object with the Menu Entries */ public function menu() { @@ -32,16 +35,33 @@ class Navigation extends VileSci_Controller if (isset($navigation_widget_called)) { + // Get Menu Entries of the Core $navigationMenuArray = $this->config->item('navigation_menu'); + $json = $this->wildcardsearch($navigationMenuArray, $navigation_widget_called); - if (isset($navigationMenuArray) && is_array($navigationMenuArray)) + // Load Menu Entries of Extensions + $extensions = $this->extensionslib->getInstalledExtensions(); + if(hasData($extensions)) { - if (isset($navigationMenuArray[$navigation_widget_called])) + $json_extension = array(); + foreach($extensions->retval as $ext) { - $json = $navigationMenuArray[$navigation_widget_called]; + $filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/navigation.php'; + if (file_exists($filename)) + { + unset($config); + include($filename); + if(isset($config['navigation_menu']) && is_array($config['navigation_menu'])) + { + $json_extension = array_merge_recursive($json_extension, $this->wildcardsearch($config['navigation_menu'], $navigation_widget_called)); + } + } } + // Merge Extension Menuentries with the Core Entries + $json = array_merge_recursive($json, $json_extension); } + // Load dynamic Menu Entries from Session if (isset($_SESSION['navigation_menu'])) { $navigationMenuSessionArray = $_SESSION['navigation_menu']; @@ -50,7 +70,7 @@ class Navigation extends VileSci_Controller { if (isset($navigationMenuSessionArray[$navigation_widget_called])) { - $json = array_merge($json, $navigationMenuSessionArray[$navigation_widget_called]); + $json = array_merge_recursive($json, $navigationMenuSessionArray[$navigation_widget_called]); } } } @@ -60,7 +80,9 @@ class Navigation extends VileSci_Controller } /** - * + * This function creates the Top Menu for each Page + * @param navigation_widget_called GET Parameter witch holds the currently called Page + * @return JSON object with the Menu Entries */ public function header() { @@ -69,16 +91,32 @@ class Navigation extends VileSci_Controller if (isset($navigation_widget_called)) { + // Load Header Entries of Core $navigationHeaderArray = $this->config->item('navigation_header'); + $json = $this->wildcardsearch($navigationHeaderArray, $navigation_widget_called); - if (isset($navigationHeaderArray) && is_array($navigationHeaderArray)) + // Load Header Entries of Extensions + $extensions = $this->extensionslib->getInstalledExtensions(); + if(hasData($extensions)) { - if (isset($navigationHeaderArray[$navigation_widget_called])) + $json_extension = array(); + foreach($extensions->retval as $ext) { - $json = $navigationHeaderArray[$navigation_widget_called]; + $filename = APPPATH.'config/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$ext->name.'/navigation.php'; + if (file_exists($filename)) + { + unset($config); + include($filename); + if(isset($config['navigation_header']) && is_array($config['navigation_header'])) + { + $json_extension = array_merge_recursive($json_extension, $this->wildcardsearch($config['navigation_header'], $navigation_widget_called)); + } + } } + $json = array_merge_recursive($json, $json_extension); } + // Load dynamic Header Entries from Session if (isset($_SESSION['navigation_header'])) { $navigationHeaderSessionArray = $_SESSION['navigation_header']; @@ -87,7 +125,8 @@ class Navigation extends VileSci_Controller { if (isset($navigationHeaderSessionArray[$navigation_widget_called])) { - $json = array_merge($json, $navigationHeaderSessionArray[$navigation_widget_called]); + $jsontmp = $this->wildcardsearch($navigationHeaderSessionArray, $navigation_widget_called); + $json = array_merge_recursive($json, $jsontmp); } } } @@ -95,4 +134,47 @@ class Navigation extends VileSci_Controller $this->output->set_content_type('application/json')->set_output(json_encode($json)); } + + /** + * Searches a Menuentry. If there is no exact entry it searches for Wildcard Entries with a Star + * Example: + * Searching for /system/foo/index will Match the following Menuentries: + * /system/foo/index + * /system/foo/* + * /system/* + * * + * + * @param $navigationArray Array to Search in. + * @param $navigation_widget_called Navigation to search for. + * @return Navigation Array if found, empty array otherwise + */ + private function wildcardsearch($navigationArray, $navigation_widget_called) + { + // Sort Navigation to have them in correct order + krsort($navigationArray); + + // 100% match found + if(isset($navigationArray[$navigation_widget_called])) + { + return $navigationArray[$navigation_widget_called]; + } + else + { + foreach($navigationArray as $key=>$row) + { + // Search for * Entries + if(mb_strpos($key, '*') === 0 || mb_strpos($key, '*') === mb_strlen($key) - 1) + { + // Take * Entry if Matches + $search = mb_substr($key, 0, -1); + if($search == '' || mb_strpos($navigation_widget_called, $search) === 0) + { + return $row; + } + } + } + } + + return array(); + } } diff --git a/application/controllers/system/Phrases.php b/application/controllers/system/Phrases.php index 7c85de9bf..d1f4ce98a 100644 --- a/application/controllers/system/Phrases.php +++ b/application/controllers/system/Phrases.php @@ -1,145 +1,174 @@ load->library('PhrasesLib'); - + // Loads the widget library $this->load->library('WidgetLib'); - + // Loads helper message to manage returning messages $this->load->helper('message'); } + /** + * + */ public function index() { - $this->load->view('system/phrases.php'); + $this->load->view('system/phrases/phrases.php'); } + /** + * + */ public function table() { $phrases = $this->phraseslib->getPhraseByApp('aufnahme'); if ($phrases->error) show_error($phrases->retval); - //var_dump($vorlage); - $data = array - ( + $data = array( 'app' => 'aufnahme', 'phrases' => $phrases->retval ); - $v = $this->load->view('system/phrasesList.php', $data); + + $this->load->view('system/phrases/phrasesList.php', $data); } - public function view($phrase_id = null) + /** + * + */ + public function view($phrase_id) { if (empty($phrase_id)) - exit; - $phrase_inhalt = $this->phraseslib->getPhraseInhalt($phrase_id); + show_error('Invalid phrase_id parameter'); + $phrase = $this->phraseslib->getPhrase($phrase_id); + + $phrase_inhalt = $this->phraseslib->getPhraseInhalt($phrase_id); if ($phrase_inhalt->error) show_error($phrase_inhalt->retval); - //var_dump($vorlage); - $data = array - ( + $data = array( 'phrase_id' => $phrase_id, 'phrase' => $phrase->retval[0]->phrase, 'phrase_inhalt' => $phrase_inhalt->retval ); - $v = $this->load->view('system/phrasesinhaltList.php', $data); + + $this->load->view('system/phrases/phrasesinhaltList.php', $data); } - public function deltext($phrasentext_id=null, $phrase_id = null) + /** + * + */ + public function deltext($phrasentext_id, $phrase_id) { - if (empty($phrase_id) or empty($phrasentext_id)) - exit; + if (empty($phrasentext_id) || empty($phrase_id)) + show_error('Invalid phrasentext_id or phrase_id parameter'); + $phrase_inhalt = $this->phraseslib->delPhrasentext($phrasentext_id); if ($phrase_inhalt->error) show_error($phrase_inhalt->retval); - //var_dump($vorlage); redirect('/system/Phrases/view/'.$phrase_id); } + /** + * + */ public function edit($phrase_id = null) { - if (empty($phrase_id)) - exit; + if (empty($phrase_id)) return; + $phrase = $this->phraseslib->getPhrase($phrase_id); - //var_dump($vorlage); if ($phrase->error) show_error($phrase->retval); + if (count($phrase->retval) != 1) show_error('Phrase nicht vorhanden! ID: '.$phrase_id); - $data = array - ( + $data = array( 'phrase' => $phrase->retval[0] ); - //var_dump($data['message']); - $v = $this->load->view('system/phrasesEdit', $data); + + $this->load->view('system/phrases/phrasesEdit', $data); } - public function write($vorlage_kurzbz = null) + /** + * + */ + public function write() { - $data = array - ( + $data = array( 'subject' => 'TestSubject', 'body' => 'TestDevelopmentBodyText' ); - $v = $this->load->view('system/messageWrite', $data); + + $this->load->view('system/messageWrite', $data); } + /** + * + */ public function save() { $phrase_id = $this->input->post('phrase_id'); - $data['phrase'] = $this->input->post('phrase'); + $data = array('phrase' => $this->input->post('phrase')); + $phrase = $this->phraseslib->savePhrase($phrase_id, $data); if ($phrase->error) show_error($phrase->retval); + $phrase_id = $phrase->retval; redirect('/system/Phrases/edit/'.$phrase_id); } + /** + * + */ public function newText() { $phrase_id = $this->input->post('phrase_id'); - + $this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); + $this->OrganisationseinheitModel->addLimit(1); $this->OrganisationseinheitModel->addOrder('oe_kurzbz'); + $resultOE = $this->OrganisationseinheitModel->loadWhere(array('aktiv' => true, 'oe_parent_kurzbz' => null)); - if ($resultOE->error) show_error($resultOE->retval); - + if (hasData($resultOE)) { $orgeinheit_kurzbz = $resultOE->retval[0]->oe_kurzbz; - - $data = array ( + + $data = array( 'phrase_id' => $phrase_id, 'sprache' => 'German', 'text' => '', 'description' => '', 'orgeinheit_kurzbz' => $orgeinheit_kurzbz ); - + $phrase_inhalt = $this->phraseslib->insertPhraseinhalt($data); if ($phrase_inhalt->error) show_error($phrase_inhalt->retval); - + $phrase_inhalt_id = $phrase_inhalt->retval; - + redirect('/system/Phrases/editText/'.$phrase_inhalt_id); } else @@ -148,30 +177,40 @@ class Phrases extends FHC_Controller } } + /** + * + */ public function editText($phrasentext_id) { $phrase_inhalt = $this->phraseslib->getPhrasentextById($phrasentext_id); if ($phrase_inhalt->error) show_error($phrase_inhalt->retval); + $data = $phrase_inhalt->retval[0]; - $this->load->view('system/phraseinhaltEdit', $data); + $this->load->view('system/phrases/phraseinhaltEdit', $data); } + /** + * + */ public function saveText() { $phrase_inhalt_id = $this->input->post('phrase_inhalt_id'); - $data['orgeinheit_kurzbz'] = $this->input->post('oe_kurzbz'); - $data['orgform_kurzbz'] = $this->input->post('orgform_kurzbz'); - $data['text'] = $this->input->post('text'); - $data['description'] = $this->input->post('description'); - $data['sprache'] = $this->input->post('sprache'); + + $data = array( + 'orgeinheit_kurzbz' => $this->input->post('oe_kurzbz'), + 'orgform_kurzbz' => $this->input->post('orgform_kurzbz'), + 'text' => $this->input->post('text'), + 'description' => $this->input->post('description'), + 'sprache' => $this->input->post('sprache') + ); + $phrase_inhalt = $this->phraseslib->updatePhraseInhalt($phrase_inhalt_id, $data); if ($phrase_inhalt->error) show_error($phrase_inhalt->retval); - $data['phrase_inhalt_id'] = $phrase_inhalt_id; - redirect('/system/Phrases/editText/'.$phrase_inhalt_id); - //$this->load->view('system/templatetextEdit', $data); - } -} \ No newline at end of file + + redirect('/system/Phrases/editText/'.$phrase_inhalt_id); + } +} diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index cbb9e9b8c..86b5d1e8b 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -42,6 +42,11 @@ class InfoCenter extends VileSci_Controller 'logtype' => 'Action', 'name' => 'Note added', 'message' => 'Note with title %s was added' + ), + 'updatenotiz' => array( + 'logtype' => 'Action', + 'name' => 'Note updated', + 'message' => 'Note with title %s was updated' ) ); private $uid; // contains the UID of the logged user @@ -88,7 +93,12 @@ class InfoCenter extends VileSci_Controller { $this->load->view('system/infocenter/infocenter.php'); } - + + public function infocenterFreigegeben() + { + $this->load->view('system/infocenter/infocenterFreigegeben.php'); + } + /** * Initialization function, gets person and prestudent data and loads the view with the data * @param $person_id @@ -122,7 +132,7 @@ class InfoCenter extends VileSci_Controller ) ); } - + /** * unlocks page from edit by a person, redirects to overview filter page * @param $person_id @@ -352,7 +362,7 @@ class InfoCenter extends VileSci_Controller $this->_redirectToStart($prestudent_id, 'ZgvPruef'); } - + /** * Saves a new Notiz for a person * @param $person_id @@ -376,6 +386,44 @@ class InfoCenter extends VileSci_Controller ->set_content_type('application/json') ->set_output(json_encode($result->retval)); } + + /** + * Updates a new Notiz for a person + * @param int $notiz_id + * @param int $person_id + * @return bool true if success + */ + public function updateNotiz($notiz_id, $person_id) + { + $titel = $this->input->post('notiztitel'); + $text = $this->input->post('notiz'); + + $result = $this->NotizModel->update( + $notiz_id, + array( + 'titel' => $titel, + 'text' => $text, + 'verfasser_uid' => $this->uid, + "updateamum" => 'NOW()', + "updatevon" => $this->uid + ) + ); + + + $json = FALSE; + + if (isSuccess($result)) + { + $json = TRUE; + + //set log "Notiz updated" + $this->_log($person_id, 'updatenotiz', array($titel)); + } + + $this->output + ->set_content_type('application/json') + ->set_output(json_encode($json)); + } /** * Loads Notizen view for a person, helper for reloading after ajax request @@ -499,7 +547,7 @@ class InfoCenter extends VileSci_Controller 'children' => array() ) ); - + $this->_fillFilters($listFiltersSent, $filtersarray['abgeschickt']); $this->_fillFilters($listFiltersNotSent, $filtersarray['nichtabgeschickt']); @@ -547,7 +595,7 @@ class InfoCenter extends VileSci_Controller { $toPrint = "%s=%s"; $tofill['children'][] = array( - 'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId), + 'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter?filter_id'), $filterId), 'description' => $description ); } @@ -559,13 +607,8 @@ class InfoCenter extends VileSci_Controller { $toPrint = "%s=%s"; - if ($this->router->method != 'index') - { - - } - $tofill['children'][] = array( - 'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId), + 'link' => sprintf($toPrint, site_url('system/infocenter/InfoCenter?filter_id'), $filterId), 'description' => $description, 'subscriptDescription' => 'Remove', 'subscriptLinkClass' => 'remove-filter', diff --git a/application/core/FHC_Controller.php b/application/core/FHC_Controller.php index 5e252998e..f6f138441 100644 --- a/application/core/FHC_Controller.php +++ b/application/core/FHC_Controller.php @@ -10,7 +10,17 @@ class FHC_Controller extends CI_Controller public function __construct() { parent::__construct(); - + $this->load->helper('fhcauth'); } + + /** + * Wrapper to load phrases using the PhrasesLib + * NOTE: The library is loaded with the alias 'p', so must me used with this alias in the rest of the code. + * EX: $this->p->t(, ) + */ + public function loadPhrases($categories, $language = null) + { + $this->load->library('PhrasesLib', array($categories, $language), 'p'); + } } diff --git a/application/libraries/ExtensionsLib.php b/application/libraries/ExtensionsLib.php index 25e9c666a..70edb106b 100644 --- a/application/libraries/ExtensionsLib.php +++ b/application/libraries/ExtensionsLib.php @@ -15,12 +15,17 @@ class ExtensionsLib const EXTENSION_JSON_NAME = 'extension.json'; // file that contains extension data const EXTENSIONS_DIR_NAME = 'extensions'; // name of the directories where will be created the symlinks + private $_ci; + private $ARCHIVE_EXTENSIONS = array('.tgz', '.tbz2'); // accepted file extensions for an uploaded extension private $UPLOAD_PATH; // temporary directory to store the upload file and checks the archive private $EXTENSIONS_PATH; // directory where all the extensions are // Directories that are part of the extension archive - private $SOFTLINK_TARGET_DIRECTORIES = array('config', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets'); + private $SOFTLINK_TARGET_DIRECTORIES = array( + APPPATH => array('config', 'controllers', 'helpers', 'hooks', 'libraries', 'models', 'views', 'widgets'), + DOC_ROOT => array('public') + ); private $_errorOccurred; // boolean, true if an error occurred while installing an extension private $_currentInstalledExtensionVersion; // contains the version of the current installation of an extension @@ -33,16 +38,16 @@ class ExtensionsLib $this->UPLOAD_PATH = APPPATH.'tmp/'; $this->EXTENSIONS_PATH = APPPATH.'extensions/'; // Get code igniter instance - $this->ci =& get_instance(); + $this->_ci =& get_instance(); // Loads message configurationx - $this->ci->config->load('message'); + $this->_ci->config->load('message'); // Loads EPrintfLib - $this->ci->load->library('EPrintfLib'); + $this->_ci->load->library('EPrintfLib'); // Loading models - $this->ci->load->model('system/Extensions_model', 'ExtensionsModel'); + $this->_ci->load->model('system/Extensions_model', 'ExtensionsModel'); // Set default values fot class properties $this->_errorOccurred = false; @@ -153,7 +158,7 @@ class ExtensionsLib $delExtension = false; // Loads data about this extension from the DB - $result = $this->ci->ExtensionsModel->load($extensionId); + $result = $this->_ci->ExtensionsModel->load($extensionId); if (hasData($result)) // if something was found { $extensionName = $result->retval[0]->name; // extension name @@ -162,15 +167,15 @@ class ExtensionsLib $delExtension = $this->_rrm($this->EXTENSIONS_PATH.$extensionName); // Select all the version of this extension - $this->ci->ExtensionsModel->addSelect('extension_id'); - $result = $this->ci->ExtensionsModel->loadWhere(array('name' => $extensionName)); + $this->_ci->ExtensionsModel->addSelect('extension_id'); + $result = $this->_ci->ExtensionsModel->loadWhere(array('name' => $extensionName)); if (hasData($result)) // if something was found { $extsArray = array(); foreach ($result->retval as $key => $extension) // loops on them { // Remove them all - $result = $this->ci->ExtensionsModel->delete($extension->extension_id); + $result = $this->_ci->ExtensionsModel->delete($extension->extension_id); if (isSuccess($result)) { $delExtension = true; @@ -187,7 +192,7 @@ class ExtensionsLib */ public function getInstalledExtensions() { - return $this->ci->ExtensionsModel->getInstalledExtensions(); + return $this->_ci->ExtensionsModel->getInstalledExtensions(); } /** @@ -214,7 +219,7 @@ class ExtensionsLib */ private function _loadUploadLibrary() { - $this->ci->load->library( + $this->_ci->load->library( 'upload', array( 'upload_path' => $this->UPLOAD_PATH, @@ -234,9 +239,9 @@ class ExtensionsLib $this->_printStart('Uploading extension'); // If the upload was a success - if ($this->ci->upload->do_upload(ExtensionsLib::FILE_INPUT_NAME)) + if ($this->_ci->upload->do_upload(ExtensionsLib::FILE_INPUT_NAME)) { - $uploadData = $this->ci->upload->data(); // retrives data about the uploaded file + $uploadData = $this->_ci->upload->data(); // retrives data about the uploaded file // Checks the file extension $uploadedFileExtension = '.'.pathinfo($uploadData['full_path'], PATHINFO_EXTENSION); if (!in_array($uploadedFileExtension, $this->ARCHIVE_EXTENSIONS)) @@ -259,7 +264,7 @@ class ExtensionsLib } else { - $this->_printFailure($this->ci->upload->display_errors('', '')); + $this->_printFailure($this->_ci->upload->display_errors('', '')); } $this->_printSuccess($_uploadExtension != null); @@ -309,9 +314,9 @@ class ExtensionsLib $this->_printStart('Loads any previous installation data'); // Loads the last version of the previous installation of this extension - $this->ci->ExtensionsModel->addOrder('version', 'DESC'); - $this->ci->ExtensionsModel->addLimit(1); - $result = $this->ci->ExtensionsModel->loadWhere(array('name' => $extensionName)); + $this->_ci->ExtensionsModel->addOrder('version', 'DESC'); + $this->_ci->ExtensionsModel->addLimit(1); + $result = $this->_ci->ExtensionsModel->loadWhere(array('name' => $extensionName)); if (isError($result)) { $this->_errorOccurred = true; @@ -428,7 +433,7 @@ class ExtensionsLib && count($extensionJson->dependencies) > 0) { // Gets the required dependencies - $result = $this->ci->ExtensionsModel->getDependencies($extensionJson->dependencies); + $result = $this->_ci->ExtensionsModel->getDependencies($extensionJson->dependencies); // If they are matcheds if (hasData($result) && count($result->retval) == count($extensionJson->dependencies)) { @@ -525,7 +530,7 @@ class ExtensionsLib { $this->_printStart('Adding new entry in the DB'); - $result = $this->ci->ExtensionsModel->insert( + $result = $this->_ci->ExtensionsModel->insert( array( 'name' => $extensionJson->name, 'description' => isset($extensionJson->description) ? $extensionJson->description : null, @@ -581,7 +586,7 @@ class ExtensionsLib $this->_printMessage($sql); // Try to execute that - if (!isSuccess($result = @$this->ci->ExtensionsModel->executeQuery($sql))) + if (!isSuccess($result = @$this->_ci->ExtensionsModel->executeQuery($sql))) { $this->_errorOccurred = true; $this->_printFailure(' error occurred while executing the query'); @@ -592,7 +597,7 @@ class ExtensionsLib { $this->_printMessage('Query result:'); var_dump($result->retval); // KEEP IT!!! - $this->ci->eprintflib->printEOL(); + $this->_ci->eprintflib->printEOL(); } } } @@ -654,11 +659,14 @@ class ExtensionsLib { $_delSoftLinks = false; - foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $key => $targetDirectory) + foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories) { - if (file_exists(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) + foreach ($targetDirectories as $key => $targetDirectory) { - $_delSoftLinks = unlink(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName); + if (file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) + { + $_delSoftLinks = unlink($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName); + } } } @@ -705,25 +713,29 @@ class ExtensionsLib $extensionPath = $this->EXTENSIONS_PATH.$extensionName.'/'; // For every target directory - foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $key => $targetDirectory) + foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $rootPath => $targetDirectories) { - // If destination of the symlink does not exist - if (!file_exists(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) + foreach ($targetDirectories as $key => $targetDirectory) { - // If the target directory does not exist than creates that - if (!is_dir($extensionPath.$targetDirectory)) + // If destination of the symlink does not exist + if (!file_exists($rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) { - mkdir($extensionPath.$targetDirectory); - } + // If the target directory does not exist than creates that + if (!is_dir($extensionPath.$targetDirectory)) + { + mkdir($extensionPath.$targetDirectory); + } - // Create the symlink - $_addSoftLinks = symlink( - $extensionPath.$targetDirectory, - APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName - ); - if (!$_addSoftLinks) - { - break; + // Create the symlink + $_addSoftLinks = symlink( + $extensionPath.$targetDirectory, + $rootPath.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName + ); + if (!$_addSoftLinks) + { + log_message('error','Failed to create Symlink to '.$extensionPath.$targetDirectory); + break; + } } } } @@ -757,13 +769,13 @@ class ExtensionsLib if ($uploadData != null && isset($uploadData->extensionName) && $extensionDB == null) { // Loads all the previous installations of this extension - $this->ci->ExtensionsModel->addOrder('version', 'DESC'); - $this->ci->ExtensionsModel->addLimit(1); - $result = $this->ci->ExtensionsModel->loadWhere(array('name' => $uploadData->extensionName)); + $this->_ci->ExtensionsModel->addOrder('version', 'DESC'); + $this->_ci->ExtensionsModel->addLimit(1); + $result = $this->_ci->ExtensionsModel->loadWhere(array('name' => $uploadData->extensionName)); if (hasData($result)) // if found { // Remove them all from file system and DB - $this->_printMessage('Removing entries in the DB related to this extension'); + $this->_printMessage('Removing entries in the DB related to this extension and from extensions directory'); $this->delExtension($result->retval[0]->extension_id); } } @@ -772,7 +784,7 @@ class ExtensionsLib // Remove them all only from DB if ($extensionJson != null && isset($extensionJson->extension_id)) { - $this->ci->ExtensionsModel->delete($extensionJson->extension_id); + $this->_ci->ExtensionsModel->delete($extensionJson->extension_id); } } @@ -789,7 +801,7 @@ class ExtensionsLib $_toggleExtension = false; // Loads data from DB about the given extension - $result = $this->ci->ExtensionsModel->load($extensionId); + $result = $this->_ci->ExtensionsModel->load($extensionId); if (hasData($result)) { $extensionName = $result->retval[0]->name; // extension name @@ -809,7 +821,7 @@ class ExtensionsLib if ($_toggleExtension) // if is a success { // Updates DB - $result = $this->ci->ExtensionsModel->update($extensionId, array('enabled' => $enabled)); + $result = $this->_ci->ExtensionsModel->update($extensionId, array('enabled' => $enabled)); if (isSuccess($result)) { $_toggleExtension = true; @@ -829,7 +841,7 @@ class ExtensionsLib */ private function _printError($error) { - $this->ci->eprintflib->printError($error); + $this->_ci->eprintflib->printError($error); } /** @@ -845,7 +857,7 @@ class ExtensionsLib */ private function _printMessage($message) { - $this->ci->eprintflib->printMessage($message); + $this->_ci->eprintflib->printMessage($message); } /** @@ -864,7 +876,7 @@ class ExtensionsLib */ private function _printInfo($info) { - $this->ci->eprintflib->printInfo($info); + $this->_ci->eprintflib->printInfo($info); } /** diff --git a/application/libraries/PhrasesLib.php b/application/libraries/PhrasesLib.php index 873da85c1..99b73732b 100644 --- a/application/libraries/PhrasesLib.php +++ b/application/libraries/PhrasesLib.php @@ -4,38 +4,40 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); class PhrasesLib { + private $_ci; // Code igniter instance + private $_phrases; // Contains the retrived phrases + /** * Loads parser library */ public function __construct() { - //require_once APPPATH.'config/message.php'; + $this->_ci =& get_instance(); - $this->ci =& get_instance(); + // CI parser + $this->_ci->load->library('parser'); - // Loads message configuration - $this->ci->config->load('message'); - - $this->ci->load->library('parser'); - - $this->ci->load->model('system/Phrase_model', 'PhraseModel'); - $this->ci->load->model('system/Phrasentext_model', 'PhrasentextModel'); + $this->_ci->load->model('system/Phrase_model', 'PhraseModel'); + $this->_ci->load->model('system/Phrasentext_model', 'PhrasentextModel'); - $this->ci->load->helper('language'); // Loads helper message to manage returning messages - $this->ci->load->helper('message'); + $this->_ci->load->helper('message'); + + // Workaround to use more parameters in the construct since PHP doesn't support many constructors + $this->_extend_construct(func_get_args()); } + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + /** - * getPhrase() - will load a spezific Phrase + * getPhrase() - loads a specific Phrase */ public function getPhrase($phrase_id) { - if (empty($phrase_id)) - return error(MSG_ERR_INVALID_MSG_ID); + if (empty($phrase_id)) return error(MSG_ERR_INVALID_MSG_ID); - $phrase = $this->ci->PhraseModel->load($phrase_id); - return $phrase; + return $this->_ci->PhraseModel->load($phrase_id); } /** @@ -43,8 +45,7 @@ class PhrasesLib */ public function getPhraseByApp($app = null) { - $phrases = $this->ci->PhraseModel->loadWhere(array('app' => $app)); - return $phrases; + return $this->_ci->PhraseModel->loadWhere(array('app' => $app)); } /** @@ -52,11 +53,9 @@ class PhrasesLib */ public function getPhraseInhalt($phrase_id) { - if (empty($phrase_id)) - return error(MSG_ERR_INVALID_MSG_ID); + if (empty($phrase_id)) return error(MSG_ERR_INVALID_MSG_ID); - $phrasentext = $this->ci->PhrasentextModel->loadWhere(array('phrase_id' => $phrase_id)); - return $phrasentext; + return $this->_ci->PhrasentextModel->loadWhere(array('phrase_id' => $phrase_id)); } /** @@ -64,11 +63,9 @@ class PhrasesLib */ public function delPhrasentext($phrasentext_id) { - if (empty($phrasentext_id)) - return error(MSG_ERR_INVALID_MSG_ID); + if (empty($phrasentext_id)) return error(MSG_ERR_INVALID_MSG_ID); - $phrasentext = $this->ci->PhrasentextModel->delete(array('phrasentext_id' => $phrasentext_id)); - return $phrasentext; + return $this->_ci->PhrasentextModel->delete(array('phrasentext_id' => $phrasentext_id)); } /** @@ -76,11 +73,9 @@ class PhrasesLib */ public function savePhrase($phrase_id, $data) { - if (empty($data)) - return error(MSG_ERR_INVALID_MSG_ID); + if (empty($data)) return error(MSG_ERR_INVALID_MSG_ID); - $phrase = $this->ci->PhraseModel->update($phrase_id, $data); - return $phrase; + return $this->_ci->PhraseModel->update($phrase_id, $data); } @@ -90,32 +85,33 @@ class PhrasesLib public function getPhrasentextById($phrasentext_id) { if (empty($phrasentext_id)) - return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); + return error($this->_ci->lang->line('fhc_'.FHC_INVALIDID, false)); - $phrasentext = $this->ci->PhrasentextModel->load($phrasentext_id); - return $phrasentext; + return $this->_ci->PhrasentextModel->load($phrasentext_id); } /** - * getPhrases() + * getPhrases() - Retrives phrases from the DB + * The given parameter are the same needed to read from the table system.tb_phrase */ public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null, $blockTags = null) { if (isset($app) && isset($sprache)) { - $result = $this->ci->PhraseModel->getPhrases($app, $sprache, $phrase, $orgeinheit_kurzbz, $orgform_kurzbz); - + $result = $this->_ci->PhraseModel->getPhrases($app, $sprache, $phrase, $orgeinheit_kurzbz, $orgform_kurzbz); + if (hasData($result)) { - $parser = new \Netcarver\Textile\Parser(); - + // Textile parser + $textileParser = new \Netcarver\Textile\Parser(); + for ($i = 0; $i < count($result->retval); $i++) { // If no

tags required if ($blockTags == 'no') { - $tmpText = $parser->textileThis($result->retval[$i]->text); // Parse - + $tmpText = $textileParser->textileThis($result->retval[$i]->text); // Parse + // Removes tags

and

from the beginning and from the end of the string if they are present // NOTE: Those tags are usually, but not always, added by the textile parser if (strlen($tmpText) >= 7) @@ -129,12 +125,12 @@ class PhrasesLib $tmpText = substr($tmpText, 0, strlen($tmpText) - 4); } } - + $result->retval[$i]->text = $tmpText; } else { - $result->retval[$i]->text = $parser->textileThis($result->retval[$i]->text); + $result->retval[$i]->text = $textileParser->textileThis($result->retval[$i]->text); } } } @@ -152,8 +148,7 @@ class PhrasesLib */ public function insertPhraseinhalt($data) { - $phrasentext = $this->ci->PhrasentextModel->insert($data); - return $phrasentext; + return $this->_ci->PhrasentextModel->insert($data); } /** @@ -161,8 +156,7 @@ class PhrasesLib */ public function getVorlagetextById($vorlagestudiengang_id) { - $vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id); - return $vorlagetext; + return $this->_ci->VorlageStudiengangModel->load($vorlagestudiengang_id); } /** @@ -170,8 +164,7 @@ class PhrasesLib */ public function updatePhraseInhalt($phrasentext_id, $data) { - $phrasentext = $this->ci->PhrasentextModel->update($phrasentext_id, $data); - return $phrasentext; + return $this->_ci->PhrasentextModel->update($phrasentext_id, $data); } /** @@ -180,8 +173,84 @@ class PhrasesLib public function parseVorlagetext($text, $data = array()) { if (empty($text)) - return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); - $text = $this->ci->parser->parse_string($text, $data, true); - return $text; + return error($this->_ci->lang->line('fhc_'.FHC_INVALIDID, false)); + + return $this->_ci->parser->parse_string($text, $data, true); } + + /** + * + */ + public function t($category, $phrase, $parameters = array(), $orgeinheit_kurzbz = null, $orgform_kurzbz = null) + { + if (isset($this->_phrases) && is_array($this->_phrases)) + { + for ($i = 0; $i < count($this->_phrases); $i++) + { + $_phrase = $this->_phrases[$i]; + + if ($_phrase->category == $category + && $_phrase->phrase == $phrase + && $_phrase->orgeinheit_kurzbz == $orgeinheit_kurzbz + && $_phrase->orgform_kurzbz== $orgform_kurzbz) + { + if ($parameters == null) $parameters = array(); + + echo $this->_ci->parser->parse_string($_phrase->text, $parameters, true)."\n"; + break; + } + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + + /** + * Extends the functionalities of the constructor of this class + * This is a workaround to use more parameters in the construct since PHP doesn't support many constructors + * The new accepted parameters are: + * - categories: could be a string or an array of strings. These are the categories used to load phrases + * - language: optional parameter must be a string. It's used to load phrases + */ + private function _extend_construct($params) + { + // Checks if the $params is an array with at least one element + if (is_array($params) && count($params) > 0) + { + $parameters = $params[0]; // temporary variable + + // If there are parameters + if (is_array($parameters) && count($parameters) > 0) + { + $categories = $parameters[0]; // categories is always the first parameter + if (!is_array($categories)) // if it is not an array, then convert into one + { + $categories = array($categories); + } + + // Use the given language if present, otherwise retrives the language for the logged user + $language = DEFAULT_LANGUAGE; + if (count($parameters) == 2 && !empty($parameters[1]) && is_string($parameters[1])) + { + $language = $parameters[1]; + } + else + { + $this->_ci->load->model('person/Person_model', 'PersonModel'); + + $language = $this->_ci->PersonModel->getLanguage(getAuthUID()); + } + + // Loads phrases + $phrases = $this->_ci->PhraseModel->getPhrasesByCategoryAndLanguage($categories, $language); + + // If there are phrases loaded then store them in the property _phrases + if (hasData($phrases)) + { + $this->_phrases = $phrases->retval; + } + } + } + } } diff --git a/application/models/accounting/Konto_model.php b/application/models/accounting/Konto_model.php index d041909cd..d76b2bd46 100644 --- a/application/models/accounting/Konto_model.php +++ b/application/models/accounting/Konto_model.php @@ -11,4 +11,20 @@ class Konto_model extends DB_Model $this->dbTable = 'wawi.tbl_konto'; $this->pk = 'konto_id'; } + + /** + * Gets all Konten connected for a Kostenstelle + * @param $kostenstelle_id + * @return array + */ + public function getKontenForKostenstelle($kostenstelle_id) + { + $this->addJoin('wawi.tbl_konto_kostenstelle', 'konto_id'); + $konten = $this->loadWhere(array('kostenstelle_id' => $kostenstelle_id)); + + if ($konten->error) + return error($konten->retval); + + return $konten; + } } diff --git a/application/models/accounting/Kostenstelle_model.php b/application/models/accounting/Kostenstelle_model.php index 489286306..4342327f7 100644 --- a/application/models/accounting/Kostenstelle_model.php +++ b/application/models/accounting/Kostenstelle_model.php @@ -11,4 +11,52 @@ class Kostenstelle_model extends DB_Model $this->dbTable = 'wawi.tbl_kostenstelle'; $this->pk = 'kostenstelle_id'; } + + /** + * Gets all active Kostenstellen for a geschaeftsjahr, as determined by the geschaeftsjahrvon and bis fields + * Gets Kostenstellen of current Geschaeftsjahr if Geschaeftsjahr not specified + * Only the Kostenstellen for which a permission exists are returned! + * @param $geschaeftsjahr + * @return array|null + */ + public function getActiveKostenstellenForGeschaeftsjahr($geschaeftsjahr = null) + { + $this->load->model('organisation/geschaeftsjahr_model', 'GeschaeftsjahrModel'); + + if ($geschaeftsjahr === null) + { + $lgj = $this->GeschaeftsjahrModel->getCurrGeschaeftsjahr(); + + if ($lgj->error) + return error($lgj->retval); + + if (count($lgj->retval) < 1) + return success(array()); + + $geschaeftsjahr = $lgj->retval[0]->geschaeftsjahr_kurzbz; + } + + $this->GeschaeftsjahrModel->addSelect('start, ende'); + $gj = $this->GeschaeftsjahrModel->load($geschaeftsjahr); + + if ($gj->error) + return error($gj->retval); + + if (count($gj->retval) < 1) + return success(array()); + + $gjstart = $gj->retval[0]->start; + + $query = 'SELECT kostenstelle_id, kurzbz, wawi.tbl_kostenstelle.bezeichnung, wawi.tbl_kostenstelle.aktiv + FROM wawi.tbl_kostenstelle + LEFT JOIN public.tbl_geschaeftsjahr kgjvon on wawi.tbl_kostenstelle.geschaeftsjahrvon = kgjvon.geschaeftsjahr_kurzbz + LEFT JOIN public.tbl_geschaeftsjahr kgjbis on wawi.tbl_kostenstelle.geschaeftsjahrbis = kgjbis.geschaeftsjahr_kurzbz + WHERE + (DATE ? >= kgjvon.start OR wawi.tbl_kostenstelle.geschaeftsjahrvon IS NULL) + AND + (DATE ? < kgjbis.ende OR wawi.tbl_kostenstelle.geschaeftsjahrbis IS NULL) + ORDER BY wawi.tbl_kostenstelle.bezeichnung'; + + return $this->execQuery($query, array($gjstart, $gjstart)); + } } diff --git a/application/models/organisation/Geschaeftsjahr_model.php b/application/models/organisation/Geschaeftsjahr_model.php index e3c0e9fb2..e806058ae 100644 --- a/application/models/organisation/Geschaeftsjahr_model.php +++ b/application/models/organisation/Geschaeftsjahr_model.php @@ -11,4 +11,33 @@ class Geschaeftsjahr_model extends DB_Model $this->dbTable = 'public.tbl_geschaeftsjahr'; $this->pk = 'geschaeftsjahr_kurzbz'; } + + /** + * Gets current Geschaeftsjahr, as determined by its start date + * @return array|null + */ + public function getCurrGeschaeftsjahr() + { + $query = 'SELECT * + FROM public.tbl_geschaeftsjahr + WHERE start <= now() + AND ende >= now()'; + + return $this->execQuery($query); + } + + /** + * Gets next Geschaeftsjahr, as determined by its start date + * @return array|null + */ + public function getNextGeschaeftsjahr() + { + $query = 'SELECT * + FROM public.tbl_geschaeftsjahr + WHERE start > now() + ORDER BY start + LIMIT 1'; + + return $this->execQuery($query); + } } diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 0c7c169bb..2647d6105 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -111,10 +111,13 @@ class Person_model extends DB_Model $this->addJoin('public.tbl_prestudent', 'person_id'); + $this->addJoin('public.tbl_benutzer', 'person_id'); + $result = $this->loadTree( 'public.tbl_person', array( - 'public.tbl_prestudent' + 'public.tbl_prestudent', + 'public.tbl_benutzer' ), 'EXISTS ( SELECT @@ -129,7 +132,8 @@ class Person_model extends DB_Model AND datum <= '.$this->escape($bis).' )', array( - 'prestudenten' + 'prestudenten', + 'benutzer' ) ); @@ -209,4 +213,37 @@ class Person_model extends DB_Model return $this->loadWhere(array('uid' => $uid)); } + + /** + * Retrives the language of the user by the UID + * Gets all the persons related to the given UID and starting from the most recent person in DB + * tries to find a valid language (!= null), if found is returned, otherwise is returned the + * default global language of the system + */ + public function getLanguage($uid) + { + $language = DEFAULT_LANGUAGE; + + $this->addJoin('public.tbl_benutzer', 'person_id'); + $this->addOrder('public.tbl_person.updateamum', 'DESC'); + $this->addOrder('public.tbl_person.insertvon', 'DESC'); + + $persons = $this->loadWhere(array('uid' => $uid)); + + if (hasData($persons)) + { + for ($i = 0; $i < count($persons->retval); $i++) + { + $person = $persons->retval[$i]; + + if (!empty($person->sprache)) + { + $language = $person->sprache; + break; + } + } + } + + return $language; + } } diff --git a/application/models/system/Phrase_model.php b/application/models/system/Phrase_model.php index 775940a0c..a0363eb5a 100644 --- a/application/models/system/Phrase_model.php +++ b/application/models/system/Phrase_model.php @@ -22,7 +22,7 @@ class Phrase_model extends DB_Model return $ent; if (isError($ent = $this->isEntitled('system.tbl_phrasentext', PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; - + $parametersArray = array('app' => $app, 'sprache' => $sprache); $query = 'SELECT phrase, @@ -36,7 +36,7 @@ class Phrase_model extends DB_Model if (isset($phrase)) { $parametersArray['phrase'] = $phrase; - + if (is_array($phrase)) { $query .= ' AND phrase IN ?'; @@ -57,7 +57,24 @@ class Phrase_model extends DB_Model $parametersArray['orgform_kurzbz'] = $orgform_kurzbz; $query .= ' AND orgform_kurzbz = ?'; } - + return $this->execQuery($query, $parametersArray); } + + /** + * Loads phrases using category(s) and language as keys + * The retrived fields are category, phrase, orgeinheit_kurzbz, orgform_kurzbz and text + * They are ordered by p.category, p.phrase, pt.orgeinheit_kurzbz DESC and pt.orgform_kurzbz DESC' + */ + public function getPhrasesByCategoryAndLanguage($categories, $language) + { + $query = 'SELECT p.category, p.phrase, pt.orgeinheit_kurzbz, pt.orgform_kurzbz, pt.text + FROM system.tbl_phrase p + INNER JOIN system.tbl_phrasentext pt USING(phrase_id) + WHERE p.category IN ? + AND pt.sprache = ? + ORDER BY p.category, p.phrase, pt.orgeinheit_kurzbz DESC, pt.orgform_kurzbz DESC'; + + return $this->execQuery($query, array($categories, $language)); + } } diff --git a/application/views/system/infocenter/addNotiz.php b/application/views/system/infocenter/addNotiz.php index 8773b7cad..a8396fe40 100644 --- a/application/views/system/infocenter/addNotiz.php +++ b/application/views/system/infocenter/addNotiz.php @@ -1,4 +1,5 @@
+
@@ -19,6 +20,8 @@
+ +
diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 4a30c137b..311dd647b 100755 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -82,15 +82,17 @@ FROM public.tbl_studiensemester WHERE ende >= NOW() ) + AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\') LIMIT 1 ) AS "AnzahlAbgeschickt", array_to_string( ( - SELECT array_agg(distinct UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz)) + SELECT array_agg(distinct UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz) || \':\' || tbl_studienplan.orgform_kurzbz) FROM public.tbl_prestudentstatus pss INNER JOIN public.tbl_prestudent ps USING(prestudent_id) JOIN public.tbl_studiengang USING(studiengang_kz) + JOIN lehre.tbl_studienplan using (studienplan_id) WHERE pss.status_kurzbz = \'Interessent\' AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') AND pss.bestaetigtam IS NULL @@ -101,9 +103,53 @@ FROM public.tbl_studiensemester WHERE ende >= NOW() ) + AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\') LIMIT 1 ),\', \' ) AS "StgAbgeschickt", + array_to_string( + ( + SELECT array_agg(distinct UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz) || \':\' || tbl_studienplan.orgform_kurzbz) + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + JOIN lehre.tbl_studienplan using (studienplan_id) + WHERE pss.status_kurzbz = \'Interessent\' + AND (pss.bewerbung_abgeschicktamum IS NULL) + AND pss.bestaetigtam IS NULL + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\') + LIMIT 1 + ),\', \' + ) AS "StgNichtAbgeschickt", + array_to_string( + ( + SELECT array_agg(distinct UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz) || \':\' || tbl_studienplan.orgform_kurzbz) + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + JOIN lehre.tbl_studienplan using (studienplan_id) + WHERE pss.status_kurzbz in (\'Wartender\', \'Bewerber\', \'Aufgenommener\', \'Student\') + AND (pss.bewerbung_abgeschicktamum IS NULL) + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE start >= NOW() + ) + AND not exists (select 1 from tbl_prestudentstatus psss where psss.prestudent_id = pss.prestudent_id and psss.status_kurzbz = \'Abgewiesener\') + LIMIT 1 + ),\', \' + ) AS "StgAktiv", pl.zeitpunkt AS "LockDate", pl.lockuser as "LockUser" FROM public.tbl_person p @@ -140,17 +186,15 @@ ) ORDER BY "LastAction" ASC ', - 'hideHeader' => false, - 'hideSave' => false, 'checkboxes' => 'PersonId', 'additionalColumns' => array('Details'), - 'columnsAliases' => array('PersonID','Vorname','Nachname','GebDatum','Nation','Letzte Aktion','Letzter Bearbeiter', - 'StSem','GesendetAm','NumAbgeschickt','Studiengänge','Sperrdatum','GesperrtVon'), + 'columnsAliases' => array('PersonID','Vorname','Nachname','GebDatum','Nation', 'Letzte Aktion','Letzter Bearbeiter', + 'StSem','GesendetAm','NumAbgeschickt','StgSent','StgNotSent','StgAktiv', 'Sperrdatum','GesperrtVon'), 'formatRaw' => function($datasetRaw) { $datasetRaw->{'Details'} = sprintf( 'Details', - base_url('index.ci.php/system/infocenter/InfoCenter/showDetails/'), + site_url('system/infocenter/InfoCenter/showDetails/'), $datasetRaw->{'PersonId'} ); @@ -189,9 +233,16 @@ if ($datasetRaw->{'StgAbgeschickt'} == null) { - $datasetRaw->{'StgAbgeschickt'} = 'N/A'; + $datasetRaw->{'StgAbgeschickt'} = '-'; + } + if ($datasetRaw->{'StgNichtAbgeschickt'} == null) + { + $datasetRaw->{'StgNichtAbgeschickt'} = '-'; + } + if ($datasetRaw->{'StgAktiv'} == null) + { + $datasetRaw->{'StgAktiv'} = '-'; } - if ($datasetRaw->{'Nation'} == null) { $datasetRaw->{'Nation'} = '-'; diff --git a/application/views/system/infocenter/infocenterFreigegeben.php b/application/views/system/infocenter/infocenterFreigegeben.php new file mode 100644 index 000000000..bc9d9f305 --- /dev/null +++ b/application/views/system/infocenter/infocenterFreigegeben.php @@ -0,0 +1,264 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Info Center', + 'jquery' => true, + 'jqueryui' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'sbadmintemplate' => true, + 'tablesorter' => true, + 'customCSSs' => 'skin/tablesort_bootstrap.css', + 'customJSs' => array('include/js/bootstrapper.js', 'include/js/infocenter/infocenterPersonDataset.js') + ) + ); +?> + + +
+ + widgetlib->widget('NavigationWidget'); ?> + +
+
+
+
+ +
+
+
+ ' + SELECT + p.person_id AS "PersonId", + p.vorname AS "Vorname", + p.nachname AS "Nachname", + p.gebdatum AS "Gebdatum", + p.staatsbuergerschaft AS "Nation", + ( + SELECT zeitpunkt + FROM system.tbl_log + WHERE taetigkeit_kurzbz IN(\'bewerbung\',\'kommunikation\') + AND logdata->>\'name\' NOT IN (\'Login with code\', \'New application\') + AND person_id = p.person_id + ORDER BY zeitpunkt DESC + LIMIT 1 + ) AS "LastAction", + ( + SELECT insertvon + FROM system.tbl_log + WHERE taetigkeit_kurzbz IN(\'bewerbung\',\'kommunikation\') + AND logdata->>\'name\' NOT IN (\'Login with code\', \'New application\') + AND person_id = p.person_id + ORDER BY zeitpunkt DESC + LIMIT 1 + ) AS "User/Operator", + ( + SELECT + pss.studiensemester_kurzbz + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND pss.bestaetigtam IS NULL + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC + LIMIT 1 + ) AS "Studiensemester", + ( + SELECT pss.bewerbung_abgeschicktamum + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') + AND pss.bestaetigtam IS NULL + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC + LIMIT 1 + ) AS "SendDate", + ( + SELECT count(*) + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') + AND pss.bestaetigtam IS NULL + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + LIMIT 1 + ) AS "AnzahlAbgeschickt", + array_to_string( + ( + SELECT array_agg(distinct UPPER(tbl_studiengang.typ || tbl_studiengang.kurzbz)) + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE pss.status_kurzbz = \'Interessent\' + AND (pss.bewerbung_abgeschicktamum IS NOT NULL AND pss.bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\') + AND pss.bestaetigtam IS NULL + AND ps.person_id = p.person_id + AND tbl_studiengang.typ in(\'b\') + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + LIMIT 1 + ),\', \' + ) AS "StgAbgeschickt", + pl.zeitpunkt AS "LockDate", + pl.lockuser as "LockUser" + FROM public.tbl_person p + LEFT JOIN (SELECT person_id, zeitpunkt, uid as lockuser FROM system.tbl_person_lock WHERE app = \''.$APP.'\') pl USING(person_id) + WHERE + EXISTS( + SELECT 1 + FROM + public.tbl_prestudent + JOIN public.tbl_studiengang USING(studiengang_kz) + WHERE + person_id=p.person_id + AND tbl_studiengang.typ in(\'b\') + AND \'Interessent\' = (SELECT status_kurzbz FROM public.tbl_prestudentstatus + WHERE prestudent_id=tbl_prestudent.prestudent_id + ORDER BY datum DESC, insertamum DESC, ext_id DESC + LIMIT 1 + ) + AND EXISTS ( + SELECT + 1 + FROM + public.tbl_prestudentstatus + WHERE + prestudent_id = tbl_prestudent.prestudent_id + AND status_kurzbz = \'Interessent\' + AND (bestaetigtam IS NOT NULL AND (bewerbung_abgeschicktamum is null OR bewerbung_abgeschicktamum>=\''.$NOTBEFORE.'\')) + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE ende >= NOW() + ) + ) + ) + ORDER BY "LastAction" ASC + ', + 'hideHeader' => false, + 'hideSave' => false, + 'checkboxes' => 'PersonId', + 'additionalColumns' => array('Details'), + 'columnsAliases' => array('PersonID','Vorname','Nachname','GebDatum','Nation','Letzte Aktion','Letzter Bearbeiter', + 'StSem','GesendetAm','NumAbgeschickt','Studiengänge','Sperrdatum','GesperrtVon'), + 'formatRaw' => function($datasetRaw) { + + $datasetRaw->{'Details'} = sprintf( + 'Details', + base_url('index.ci.php/system/infocenter/InfoCenter/showDetails/'), + $datasetRaw->{'PersonId'} + ); + + if ($datasetRaw->{'SendDate'} == null) + { + $datasetRaw->{'SendDate'} = 'Not sent'; + } + else + { + $datasetRaw->{'SendDate'} = date_format(date_create($datasetRaw->{'SendDate'}),'Y-m-d H:i'); + } + + if ($datasetRaw->{'LastAction'} == null) + { + $datasetRaw->{'LastAction'} = '-'; + } + else + { + $datasetRaw->{'LastAction'} = date_format(date_create($datasetRaw->{'LastAction'}),'Y-m-d H:i'); + } + + if ($datasetRaw->{'User/Operator'} == '') + { + $datasetRaw->{'User/Operator'} = 'NA'; + } + + if ($datasetRaw->{'LockDate'} == null) + { + $datasetRaw->{'LockDate'} = '-'; + } + + if ($datasetRaw->{'LockUser'} == null) + { + $datasetRaw->{'LockUser'} = '-'; + } + + if ($datasetRaw->{'StgAbgeschickt'} == null) + { + $datasetRaw->{'StgAbgeschickt'} = 'N/A'; + } + + if ($datasetRaw->{'Nation'} == null) + { + $datasetRaw->{'Nation'} = '-'; + } + + return $datasetRaw; + }, + 'markRow' => function($datasetRaw) { + + if ($datasetRaw->LockDate != null) + { + return FilterWidget::DEFAULT_MARK_ROW_CLASS; + } + } + ); + + + $filterId = isset($_GET[InfoCenter::FILTER_ID]) ? $_GET[InfoCenter::FILTER_ID] : null; + + if (isset($filterId) && is_numeric($filterId)) + { + $filterWidgetArray[InfoCenter::FILTER_ID] = $filterId; + } + else + { + $filterWidgetArray['app'] = $APP; + $filterWidgetArray['datasetName'] = 'PersonActions'; + $filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll'; + } + + echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); + ?> + +
+
+
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/infocenter/notizen.php b/application/views/system/infocenter/notizen.php index 23a0e6ef4..683a9b3d9 100644 --- a/application/views/system/infocenter/notizen.php +++ b/application/views/system/infocenter/notizen.php @@ -1,19 +1,20 @@ - - - - - - - - - - - - - - - - - +
DatumNotizUser
insertamum), 'd.m.Y H:i:s') ?>titel) ?>verfasser_uid ?>
+ + + + + + + + + + + + + + + + +
DatumNotizUser
insertamum), 'd.m.Y H:i:s') ?>titel) ?>verfasser_uid ?>notiz_id ?>
\ No newline at end of file diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index ef0102a50..2e98005b8 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -287,10 +287,25 @@
+ prestudentstatus->bewerbung_abgeschicktamum)) + { + $disabled = 'disabled'; + $disabledTxt = 'Die Bewerbung muss erst abgeschickt worden sein.'; + } + + if ($zgvpruefung->studiengangtyp !== 'b') + { + $disabled = 'disabled'; + $disabledTxt = 'Nur Bachelorstudiengänge können freigegeben werden.';; + } + ?>
-
diff --git a/application/views/system/phraseinhaltEdit.php b/application/views/system/phrases/phraseinhaltEdit.php similarity index 69% rename from application/views/system/phraseinhaltEdit.php rename to application/views/system/phrases/phraseinhaltEdit.php index a0dd11eaa..594e8d9dd 100644 --- a/application/views/system/phraseinhaltEdit.php +++ b/application/views/system/phrases/phraseinhaltEdit.php @@ -65,10 +65,6 @@
Textile CheatSheet - widgetlib->widget("tinymce_widget", array('name' => 'text', 'text' => $text)); - ?> @@ -77,34 +73,29 @@
- - - - - + diff --git a/application/views/system/phrases.php b/application/views/system/phrases/phrases.php similarity index 100% rename from application/views/system/phrases.php rename to application/views/system/phrases/phrases.php diff --git a/application/views/system/phrasesEdit.php b/application/views/system/phrases/phrasesEdit.php similarity index 100% rename from application/views/system/phrasesEdit.php rename to application/views/system/phrases/phrasesEdit.php diff --git a/application/views/system/phrasesList.php b/application/views/system/phrases/phrasesList.php similarity index 75% rename from application/views/system/phrasesList.php rename to application/views/system/phrases/phrasesList.php index ed12f1926..5baff50f7 100644 --- a/application/views/system/phrasesList.php +++ b/application/views/system/phrases/phrasesList.php @@ -4,16 +4,6 @@

Phrasen

- diff --git a/application/views/system/phrasesinhaltList.php b/application/views/system/phrases/phrasesinhaltList.php similarity index 100% rename from application/views/system/phrasesinhaltList.php rename to application/views/system/phrases/phrasesinhaltList.php diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php index b309f4a22..52ed50dbd 100755 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -2,6 +2,11 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); +// Retrives the URL path of the called controller + controller method +// NOTE: placed here because it doesn't work inside functions +$calledPath = $this->router->directory.$this->router->class; +$calledMethod = $this->router->method; + // By default set the parameters to null $title = isset($title) ? $title : null; $customCSSs = isset($customCSSs) ? $customCSSs : null; @@ -55,6 +60,27 @@ function _generateCSSsInclude($CSSs) } } +/** + * Generates global JS-Object to pass parms to other javascripts + */ +function _generateJSDataStorageObject($calledPath, $calledMethod) +{ + $toPrint = "\n"; + $toPrint .= ''; + $toPrint .= "\n\n"; + + echo $toPrint; +} + /** * Generates tags for the javascripts you want to include, the parameter could by a string or an array of strings */ @@ -78,13 +104,25 @@ function _generateJSsInclude($JSs) } /** - * Generates global JS-Object to pass parms to addon-js-functions + * Generates all the includes needed by the Addons */ -function _generateAddonDataStorageObject() +function _generateAddonsJSsInclude($calledFrom) { - echo '\n"; + $aktive_addons = array_filter(explode(";", ACTIVE_ADDONS)); + + foreach ($aktive_addons as $addon) + { + $hookfile = DOC_ROOT.'addons/'.$addon.'/hooks.config.inc.php'; + if (file_exists($hookfile)) + { + include($hookfile); + if (key_exists($calledFrom, $js_hooks)) + { + foreach ($js_hooks[$calledFrom] as $js_file) + _generateJSsInclude('addons/'.$addon.'/'.$js_file); + } + } + } } ?> @@ -102,16 +140,20 @@ function _generateAddonDataStorageObject() // jQuery UI CSS if ($jqueryui === true) _generateCSSsInclude('vendor/components/jqueryui/themes/base/jquery-ui.min.css'); + // bootstrap CSS if ($bootstrap === true) _generateCSSsInclude('vendor/twbs/bootstrap/dist/css/bootstrap.min.css'); + // font awesome CSS if ($fontawesome === true) _generateCSSsInclude('vendor/components/font-awesome/css/font-awesome.min.css'); + // Table sorter CSS if ($tablesorter === true) { _generateCSSsInclude('vendor/mottie/tablesorter/dist/css/theme.default.min.css'); _generateCSSsInclude('vendor/mottie/tablesorter/dist/css/jquery.tablesorter.pager.min.css'); } + // sb admin template CSS if ($sbadmintemplate === true) { @@ -125,8 +167,13 @@ function _generateAddonDataStorageObject() // -------------------------------------------------------------------------------------------------------- // Javascripts + // Generates the global object to pass useful parms to the other javascripts + // NOTE: must be called before any other JS include + _generateJSDataStorageObject($calledPath, $calledMethod); + // JQuery V3 if ($jquery === true) _generateJSsInclude('vendor/components/jquery/jquery.min.js'); + // JQuery UI if ($jqueryui === true) { @@ -134,8 +181,10 @@ function _generateAddonDataStorageObject() //datepicker german language file _generateJSsInclude('vendor/components/jqueryui/ui/i18n/datepicker-de.js'); } + // bootstrap JS if ($bootstrap === true) _generateJSsInclude('vendor/twbs/bootstrap/dist/js/bootstrap.min.js'); + // Table sorter JS if ($tablesorter === true) { @@ -143,6 +192,7 @@ function _generateAddonDataStorageObject() _generateJSsInclude('vendor/mottie/tablesorter/dist/js/jquery.tablesorter.widgets.min.js'); _generateJSsInclude('vendor/mottie/tablesorter/dist/js/extras/jquery.tablesorter.pager.min.js'); } + //tinymce JS if($tinymce === true) _generateJSsInclude('vendor/tinymce/tinymce/tinymce.min.js') ; @@ -153,27 +203,8 @@ function _generateAddonDataStorageObject() _generateJSsInclude('vendor/BlackrockDigital/startbootstrap-sb-admin-2/dist/js/sb-admin-2.min.js'); } - // load addon hooks JS - if ($addons === true) - { - _generateAddonDataStorageObject(); - - $aktive_addons = array_filter(explode(";", ACTIVE_ADDONS)); - $called_from = $this->router->directory.$this->router->class.'/'.$this->router->method; - foreach ($aktive_addons as $addon) - { - $hookfile = DOC_ROOT.'addons/'.$addon.'/hooks.config.inc.php'; - if (file_exists($hookfile)) - { - include($hookfile); - if (key_exists($called_from, $js_hooks)) - { - foreach ($js_hooks[$called_from] as $js_file) - _generateJSsInclude('addons/'.$addon.'/'.$js_file); - } - } - } - } + // Load addon hooks JS + if ($addons === true) _generateAddonsJSsInclude($calledPath.'/'.$calledMethod); // Eventually required JS _generateJSsInclude($customJSs); diff --git a/application/views/widgets/filter/filter.php b/application/views/widgets/filter/filter.php index 606d19b60..d368cc6e1 100644 --- a/application/views/widgets/filter/filter.php +++ b/application/views/widgets/filter/filter.php @@ -1,5 +1,11 @@ +
+
+ + Filter description: + - Filter description: +
+ +
diff --git a/application/views/widgets/filter/selectFields.php b/application/views/widgets/filter/selectFields.php index 57edda25e..7613639ff 100644 --- a/application/views/widgets/filter/selectFields.php +++ b/application/views/widgets/filter/selectFields.php @@ -74,7 +74,7 @@ }); $.ajax({ - url: "", + url: "", method: "POST", data: { selectedFieldsLst: arrayDndId @@ -106,7 +106,7 @@ $("#addField").change(function(event) { $.ajax({ - url: "", + url: "", method: "POST", data: { fieldName: $(this).val() @@ -128,7 +128,7 @@ $(".remove-field").click(function(event) { $.ajax({ - url: "", + url: "", method: "POST", data: { fieldName: $(this).attr('fieldToRemove') @@ -151,7 +151,7 @@ function renderSelectedFields() { $.ajax({ - url: "", + url: "", method: "GET", data: {}, dataType: "json" @@ -232,7 +232,7 @@
- + Add field: diff --git a/application/views/widgets/filter/selectFilters.php b/application/views/widgets/filter/selectFilters.php index eb14f41ae..bca975b13 100644 --- a/application/views/widgets/filter/selectFilters.php +++ b/application/views/widgets/filter/selectFilters.php @@ -10,7 +10,7 @@ $("#addFilter").change(function(event) { $.ajax({ - url: "", + url: "", method: "POST", data: { fieldName: $(this).val() @@ -70,7 +70,7 @@ }); $.ajax({ - url: "", + url: "", method: "POST", data: { filterNames: selectFilterName, @@ -94,6 +94,23 @@ }); }); + + $(".remove-selected-filter").click(function(event) { + $.ajax({ + url: "", + method: "POST", + data: { + fieldName: $(this).attr('filterToRemove') + } + }) + .done(function(data, textStatus, jqXHR) { + resetSelectedFilters(); + renderSelectedFilters(); + }).fail(function(jqXHR, textStatus, errorThrown) { + alert(textStatus); + }); + }); + } function renderSelectedFilterFields(metaData, activeFilters, activeFiltersOperation, activeFiltersOption) @@ -103,7 +120,7 @@ if (metaData.type.toLowerCase().indexOf("int") >= 0) { html = ''; - html += ' '; html += ' '; html += ' '; html += ' '; @@ -111,37 +128,37 @@ html += ' '; html += ''; html += ''; - html += ' '; + html += ' '; html += ''; } - if (metaData.type.toLowerCase().indexOf('varchar') >= 0) + if (metaData.type.toLowerCase().indexOf('varchar') >= 0 || metaData.type.toLowerCase() == 'text') { html = ''; - html += ' '; html += ' '; html += ' '; html += ' '; html += ''; html += ''; - html += ' '; + html += ' '; html += ''; } if (metaData.type.toLowerCase().indexOf('bool') >= 0) { html = ''; - html += ' '; html += ' '; html += ' '; html += ' '; html += ''; html += ''; - html += ' '; + html += ' '; html += ''; } if (metaData.type.toLowerCase().indexOf('timestamp') >= 0 || metaData.type.toLowerCase().indexOf('date') >= 0) { - var classOperation = 'select-filter-operation-value form-control'; - var classOption = 'select-filter-option form-control'; + var classOperation = 'form-control select-filter-operation-value'; + var classOption = 'form-control select-filter-option'; var disabled = ""; if (activeFiltersOperation == "set" || activeFiltersOperation == "nset") @@ -152,7 +169,7 @@ } html = ''; - html += ' '; html += ' '; html += ' '; html += ' '; @@ -180,7 +197,7 @@ function renderSelectedFilters() { $.ajax({ - url: "", + url: "", method: "GET", data: {}, dataType: "json" @@ -198,7 +215,7 @@ { var selectedFilters = '
'; - selectedFilters += ''; + selectedFilters += ''; selectedFilters += data.selectedFiltersAliases[i]; selectedFilters += ''; @@ -210,7 +227,7 @@ ); selectedFilters += ''; - selectedFilters += ''; + selectedFilters += ''; selectedFilters += ''; selectedFilters += '
'; @@ -255,10 +272,12 @@ +
+
- + Add filter: @@ -267,6 +286,6 @@ - +
diff --git a/application/views/widgets/filter/tableDataset.php b/application/views/widgets/filter/tableDataset.php index 0074d0eff..f0a3efa27 100644 --- a/application/views/widgets/filter/tableDataset.php +++ b/application/views/widgets/filter/tableDataset.php @@ -19,7 +19,7 @@ function renderTableDataset() { $.ajax({ - url: "", + url: "", method: "GET", data: {}, dataType: "json" diff --git a/application/views/widgets/navigationHeader.php b/application/views/widgets/navigationHeader.php index 6c2ca8cdc..0d050df2a 100644 --- a/application/views/widgets/navigationHeader.php +++ b/application/views/widgets/navigationHeader.php @@ -3,7 +3,7 @@ $(document).ready(function() { $.ajax({ - url: "", + url: "", method: "GET", data: { navigation_widget_called: "router->directory.$this->router->class.'/'.$this->router->method; ?>" diff --git a/application/views/widgets/navigationMenu.php b/application/views/widgets/navigationMenu.php index 427fecf2e..9ef727083 100644 --- a/application/views/widgets/navigationMenu.php +++ b/application/views/widgets/navigationMenu.php @@ -102,7 +102,7 @@ function renderSideMenu() { $.ajax({ - url: "", + url: "", method: "GET", data: { navigation_widget_called: "router->directory.$this->router->class.'/'.$this->router->method; ?>" @@ -120,7 +120,7 @@ strMenu += printNavItem(e); }); - $("#side-menu").append(strMenu); + $("#side-menu").html(strMenu); $("#side-menu").metisMenu(); } @@ -138,17 +138,20 @@ function printCollapseIcon() { // Hiding/showing navigation menu - works only with sb admin 2 template!! + if(!$("#collapseicon").length) + $("#side-menu").parent().append('
'); - $("#side-menu").html('
  • '); $("#collapseicon").click(function() { $("#page-wrapper").css('margin-left', '0px'); $("#side-menu").hide(); + $("#collapseicon").hide(); $("#collapseinicon").show(); }); $("#collapseinicon").click(function() { $("#page-wrapper").css('margin-left', '250px'); $("#side-menu").show(); + $("#collapseicon").show(); $("#collapseinicon").hide(); }); } @@ -165,5 +168,5 @@ - +
    diff --git a/cis/private/lehre/anwesenheitsliste_bilder.pdf.php b/cis/private/lehre/anwesenheitsliste_bilder.pdf.php deleted file mode 100644 index 6a44d8daf..000000000 --- a/cis/private/lehre/anwesenheitsliste_bilder.pdf.php +++ /dev/null @@ -1,107 +0,0 @@ -, - * Andreas Oesterreicher and - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > - */ - /** - * anwesenheitsliste.pdf.php - * - * Erstellt eine Anwesenheitsliste im PDF-Format - * - */ - - require_once('../../../config/cis.config.inc.php'); -// ------------------------------------------------------------------------------------------ -// Datenbankanbindung -// ------------------------------------------------------------------------------------------ - require_once('../../../include/basis_db.class.php'); - if (!$db = new basis_db()) - die('Fehler beim Herstellen der Datenbankverbindung'); - - // Pfad zu fpdf - define('FPDF_FONTPATH','../../../include/pdf/font/'); - // library einbinden - require_once('../../../include/pdf/fpdf.php'); - - require_once('../../../include/person.class.php'); - require_once('../../../include/studiengang.class.php'); - require_once('../../../include/studiensemester.class.php'); - require_once('../../../include/lehrveranstaltung.class.php'); - require_once('../../../include/pdf.inc.php'); - - //Uebergabeparameter abpruefen - if(isset($_GET['stg'])) //Studiengang - { - if(is_numeric($_GET['stg'])) - $stg=$_GET['stg']; - else - die('Fehler bei der Parameteruebergabe'); - } - else - $stg=''; - if(isset($_GET['sem'])) //Semester - { - if(is_numeric($_GET['sem'])) - $sem=$_GET['sem']; - else - die('Fehler bei der Parameteruebergabe'); - } - else - $sem=''; - - if(isset($_GET['verband'])) //Verband - $verband=$_GET['verband']; - else - $verband=''; - if(isset($_GET['gruppe'])) //Gruppe - $gruppe=$_GET['gruppe']; - else - $gruppe=''; - if(isset($_GET['gruppe_kurzbz'])) //Einheit - $gruppe_kurzbz = $_GET['gruppe_kurzbz']; - else - $gruppe_kurzbz=''; - - if(isset($_GET['lvid']) && is_numeric($_GET['lvid'])) - $lvid = $_GET['lvid']; - else - die('Fehler bei der Parameteruebergabe'); - - if(isset($_GET['stsem'])) - $stsem = $_GET['stsem']; - else - die('Studiensemester wurde nicht uebergeben'); - - $lehreinheit_id = (isset($_GET['lehreinheit_id'])?$_GET['lehreinheit_id']:''); -/** - * liefert den groesseren der beiden werte - * - */ -function getmax($val1,$val2) -{ - return ($val1>$val2)?$val1:$val2; - -} -if (file_exists('../../../addons/sfu-milano/include/'.EXT_FKT_PATH.'/anwesenheitsliste_bilder.inc.php')) - require_once('../../../addons/sfu-milano/include/'.EXT_FKT_PATH.'/anwesenheitsliste_bilder.inc.php'); -else - require_once('../../../include/'.EXT_FKT_PATH.'/anwesenheitsliste_bilder.inc.php'); - -?> diff --git a/cis/private/pdfExport.php b/cis/private/pdfExport.php index d791768da..851c0c6c8 100644 --- a/cis/private/pdfExport.php +++ b/cis/private/pdfExport.php @@ -16,19 +16,18 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Authors: Christian Paminger , - * Andreas Oesterreicher and - * Rudolf Hangl . + * Andreas Oesterreicher and + * Rudolf Hangl . */ /* Erstellt einen Lehrauftrag im PDF Format * * Erstellt ein XML File Transformiert dieses mit * Hilfe der XSL-FO Vorlage aus der DB und generiert - * daraus ein PDF (xslfo2pdf) + * daraus ein PDF */ require_once('../../config/cis.config.inc.php'); require_once('../../include/functions.inc.php'); require_once('../../include/benutzerberechtigung.class.php'); -require_once('../../include/xslfo2pdf/xslfo2pdf.php'); require_once('../../include/akte.class.php'); require_once('../../include/konto.class.php'); require_once('../../include/benutzer.class.php'); @@ -37,6 +36,7 @@ require_once('../../include/addon.class.php'); require_once('../../include/studiengang.class.php'); require_once('../../include/student.class.php'); require_once('../../include/prestudent.class.php'); +require_once('../../include/dokument_export.class.php'); if (!$db = new basis_db()) die('Fehler beim Oeffnen der Datenbankverbindung'); @@ -48,112 +48,113 @@ $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); //Parameter holen -if(isset($_GET['xml'])) - $xml=$_GET['xml']; +if (isset($_GET['xml'])) + $xml = $_GET['xml']; else die('Fehlerhafte Parameteruebergabe'); -if(isset($_GET['xsl'])) - $xsl=$_GET['xsl']; +if (isset($_GET['xsl'])) + $xsl = $_GET['xsl']; else die('Fehlerhafte Parameteruebergabe'); // Studiengang ermitteln dessen Vorlage verwendet werden soll -$xsl_stg_kz=0; +$xsl_stg_kz = 0; + +$sign = false; + // Direkte uebergabe des Studienganges dessen Vorlage verwendet werden soll -if(isset($_GET['xsl_stg_kz'])) - $xsl_stg_kz=$_GET['xsl_stg_kz']; +if (isset($_GET['xsl_stg_kz'])) + $xsl_stg_kz = $_GET['xsl_stg_kz']; else { // Wenn eine Studiengangskennzahl uebergeben wird, wird die Vorlage dieses Studiengangs verwendet - if(isset($_GET['stg_kz'])) - $xsl_stg_kz=$_GET['stg_kz']; + if (isset($_GET['stg_kz'])) + $xsl_stg_kz = $_GET['stg_kz']; else { // Werden UIDs oder Prestudent_IDs uebergeben, wird die Vorlage des Studiengangs genommen // in dem der 1. Studierende in der Liste ist - if(isset($_GET['uid']) && $_GET['uid']!='') + if (isset($_GET['uid']) && $_GET['uid'] != '') { - if(strstr($_GET['uid'],';')) + if (strstr($_GET['uid'],';')) $uids = explode(';',$_GET['uid']); else $uids[1] = $_GET['uid']; $student_obj = new student(); - if($student_obj->load($uids[1])) + if ($student_obj->load($uids[1])) { - $xsl_stg_kz=$student_obj->studiengang_kz; + $xsl_stg_kz = $student_obj->studiengang_kz; } } - elseif(isset($_GET['prestudent_id']) && $_GET['prestudent_id']!='') + elseif (isset($_GET['prestudent_id']) && $_GET['prestudent_id'] != '') { - if(strstr($_GET['prestudent_id'],';')) + if (strstr($_GET['prestudent_id'],';')) $prestudent_ids = explode(';',$_GET['prestudent_id']); else $prestudent_ids[1] = $_GET['prestudent_id']; $prestudent_obj = new prestudent(); - if($prestudent_obj->load($prestudent_ids[1])) + if ($prestudent_obj->load($prestudent_ids[1])) { - $xsl_stg_kz=$prestudent_obj->studiengang_kz; + $xsl_stg_kz = $prestudent_obj->studiengang_kz; } } } } -if(isset($_GET['version']) && is_numeric($_GET['version'])) +if (isset($_GET['version']) && is_numeric($_GET['version'])) $version = $_GET['version']; else - $version =''; + $version = null; -if(isset($_GET['xsl_oe_kurzbz'])) - $xsl_oe_kurzbz=$_GET['xsl_oe_kurzbz']; +if (isset($_GET['xsl_oe_kurzbz'])) + $xsl_oe_kurzbz = $_GET['xsl_oe_kurzbz']; else - $xsl_oe_kurzbz=''; + $xsl_oe_kurzbz = ''; //Parameter setzen -$params='?xmlformat=xml'; -//if(isset($_GET['uid'])) -// $params.='&uid='.$_GET['uid']; +$params = 'xmlformat=xml'; //Admins duerfen Dokumente anderer Personen drucken -if($rechte->isBerechtigt('admin')) +if ($rechte->isBerechtigt('admin')) $user = $_GET['uid']; -$params.='&uid='.$user; -if(isset($_GET['person_id'])) - $params.='&person_id='.$_GET['person_id']; -if(isset($_GET['buchungsnummern'])) - $params.='&buchungsnummern='.$_GET['buchungsnummern']; -if(isset($_GET['stg_kz'])) - $params.='&stg_kz='.$_GET['stg_kz']; -if(isset($_GET['ss'])) - $params.='&ss='.$_GET['ss']; -if(isset($_GET['abschlusspruefung_id'])) - $params.='&abschlusspruefung_id='.$_GET['abschlusspruefung_id']; -if(isset($_GET['typ'])) - $params.='&typ='.$_GET['typ']; -if(isset($_GET['all'])) - $params.='&all=1'; +$params .= '&uid='.$user; +if (isset($_GET['person_id'])) + $params .= '&person_id='.$_GET['person_id']; +if (isset($_GET['buchungsnummern'])) + $params .= '&buchungsnummern='.$_GET['buchungsnummern']; +if (isset($_GET['stg_kz'])) + $params .= '&stg_kz='.$_GET['stg_kz']; +if (isset($_GET['ss'])) + $params .= '&ss='.$_GET['ss']; +if (isset($_GET['abschlusspruefung_id'])) + $params .= '&abschlusspruefung_id='.$_GET['abschlusspruefung_id']; +if (isset($_GET['typ'])) + $params .= '&typ='.$_GET['typ']; +if (isset($_GET['all'])) + $params .= '&all=1'; //OE fuer Output ermitteln -if ($xsl_oe_kurzbz!='') +if ($xsl_oe_kurzbz != '') { $oe_kurzbz = $xsl_oe_kurzbz; } else { - if($xsl_stg_kz=='') - $xsl_stg_kz='0'; + if ($xsl_stg_kz == '') + $xsl_stg_kz = '0'; $oe = new studiengang(); $oe->load($xsl_stg_kz); $oe_kurzbz = $oe->oe_kurzbz; } //Darf der User Dokumente in einem NICHT-PDF-Format exportieren? -if (isset($_GET['output']) && $_GET['output']!='pdf') +if (isset($_GET['output']) && $_GET['output'] != 'pdf') { - if (!$rechte->isBerechtigt('system/change_outputformat',$oe_kurzbz)) + if (!$rechte->isBerechtigt('system/change_outputformat', $oe_kurzbz)) { $output = 'pdf'; } @@ -167,283 +168,96 @@ else $konto = new konto(); if (($user == $_GET["uid"]) || $rechte->isBerechtigt('admin')) { - $buchungstypen = array(); - if(defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN")) - { - $buchungstypen = unserialize (CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN); - } - - if(isset($_GET['ss'])) - $stsem_zahlung = $konto->getLastStSemBuchungstypen($user, $buchungstypen, $_GET['ss']); - - if((($xsl=='Inskription') || ($xsl == 'Studienblatt')) && ($_GET["ss"] != $stsem_zahlung)) + $buchungstypen = array(); + if (defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN")) { - die('Der Studienbeitrag wurde noch nicht bezahlt'); + $buchungstypen = unserialize (CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN); } - if(isset($_GET['buchungsnummern'])) + + if (isset($_GET['ss'])) + $stsem_zahlung = $konto->getLastStSemBuchungstypen($user, $buchungstypen, $_GET['ss']); + + if ((($xsl=='Inskription') || ($xsl == 'Studienblatt')) && ($_GET["ss"] != $stsem_zahlung)) { - //Beim Drucken von Buchungsbestaetigungen pruefen ob diese Buchungen auch zu diesem Benutzer gehoeren - $buchungsnr = explode(';',$_GET['buchungsnummern']); - $user_obj = new benutzer(); - $user_obj->load($user); - foreach($buchungsnr as $bnr) - { - if($bnr!='') + die('Der Studienbeitrag wurde noch nicht bezahlt'); + } + if (isset($_GET['buchungsnummern'])) + { + //Beim Drucken von Buchungsbestaetigungen pruefen ob diese Buchungen auch zu diesem Benutzer gehoeren + $buchungsnr = explode(';',$_GET['buchungsnummern']); + $user_obj = new benutzer(); + $user_obj->load($user); + foreach($buchungsnr as $bnr) { - $konto->load($bnr); - if($konto->person_id!=$user_obj->person_id) - die('Sie haben keine Berechtigung fuer diese Buchung'); - if($konto->getDifferenz($bnr)>0) - die('Diese Zahlung wurde noch nicht beglichen'); + if ($bnr != '') + { + $konto->load($bnr); + if ($konto->person_id!=$user_obj->person_id) + die('Sie haben keine Berechtigung fuer diese Buchung'); + if ($konto->getDifferenz($bnr)>0) + die('Diese Zahlung wurde noch nicht beglichen'); + } } - } } - $xml_url=XML_ROOT.$xml.$params; - //echo $xml_url; - // Load the XML source - $xml_doc = new DOMDocument; + $xml_url = XML_ROOT.$xml.$params; - if(!$xml_doc->load($xml_url)) - die('unable to load xml'); - //echo ':'.$xml_doc->saveXML().':'; - - //XSL aus der DB holen - $vorlage = new vorlage(); - if($xsl_oe_kurzbz!='') + if ($xsl_oe_kurzbz == '') { - $vorlage->getAktuelleVorlage($xsl_oe_kurzbz, $xsl, $version); + if ($xsl_stg_kz == '') + $xsl_stg_kz = '0'; + $stg_obj = new studiengang(); + if (!$stg_obj->load($xsl_stg_kz)) + die($stg_obj->errormsg); + $xsl_oe_kurzbz = $stg_obj->oe_kurzbz; + } + + $dokument = new dokument_export($xsl, $xsl_oe_kurzbz, $version); + $dokument->addDataURL($xml, $params); + + switch($xsl) + { + case 'LV_Informationen': + $studiengang = new studiengang($_GET['stg_kz']); + $studiensemester = new studiensemester($_GET['ss']); + $filename = $filename.'_'.$studiengang->kurzbzlang.'_'.$studiensemester->studiensemester_kurzbz; + break; + case 'Honorarvertrag': + $filename = $filename.'_'.$benutzer_obj->nachname.'_'.$benutzer_obj->vorname; + break; + case 'Studienordnung': + $studienordnung = new studienordnung(); + $studienordnung->loadStudienordnung($_GET['studienordnung_id']); + $filename = 'Studienordnung-Studienplan-'. + $filename .= sprintf("%'.04d",$studienordnung->studiengang_kz). + $filename .= '-'.$studienordnung->studiengangkurzbzlang; + break; + default: + $filename = $xsl; + } + + $dokument->setFilename($filename); + + if (!$dokument->create($output)) + die($dokument->errormsg); + + if ($sign === true) + { + if ($dokument->sign($user)) + { + $dokument->output(); + } + else + { + echo $dokument->errormsg; + } } else - { - if($xsl_stg_kz=='') - $xsl_stg_kz='0'; - - $vorlage->getAktuelleVorlage($xsl_stg_kz, $xsl, $version); - } - - if(mb_strstr($vorlage->mimetype, 'application/vnd.oasis.opendocument')) - { - switch($vorlage->mimetype) - { - case 'application/vnd.oasis.opendocument.text': - $endung = 'odt'; - break; - case 'application/vnd.oasis.opendocument.spreadsheet': - $endung = 'ods'; - break; - default: - $endung = 'pdf'; - } - - // Load the XSL source - $xsl_doc = new DOMDocument; - - if(!$xsl_doc->loadXML($vorlage->text)) - die('unable to load xsl'); - - // Configure the transformer - $proc = new XSLTProcessor; - $proc->importStyleSheet($xsl_doc); // attach the xsl rules - - $buffer = $proc->transformToXml($xml_doc); - //echo $buffer; - //exit; - $tmp = sys_get_temp_dir(); - $tempfolder = $tmp.'/FHC'.uniqid(); - mkdir($tempfolder); - chdir($tempfolder); - file_put_contents('content.xml', $buffer); - - // Wenn ein Style XSL uebergeben wurde wird ein zweites XML File erstellt mit den - // Styleanweisungen und ebenfalls zum Zip hinzugefuegt - if(isset($_GET['style_xsl']) || $vorlage->style!='') - { - //Wenn die Spalte style in der DB befuellt ist, wird dieses verwendet - if($vorlage->style!='') - { - $style_xsl_doc = new DOMDocument; - if(!$style_xsl_doc->loadXML($vorlage->style)) - die('unable to load xsl from tbl_vorlagestudiengang'); - } - else - { - $style_xsl=$_GET['style_xsl']; - $style_vorlage = new vorlage(); - $style_vorlage->getAktuelleVorlage($xsl_stg_kz, $style_xsl, $version); - $style_xsl_doc = new DOMDocument; - if(!$style_xsl_doc->loadXML($style_vorlage->text)) - die('unable to load xsl'); - } - - // Configure the transformer - $style_proc = new XSLTProcessor; - $style_proc->importStyleSheet($style_xsl_doc); // attach the xsl rules - - $stylebuffer = $style_proc->transformToXml($xml_doc); - - file_put_contents('styles.xml', $stylebuffer); - } - - $vorlage_found=false; - $addons = new addon(); - - foreach($addons->aktive_addons as $addon) - { - $zipfile = DOC_ROOT.'addons/'.$addon.'/system/vorlage_zip/'.$vorlage->vorlage_kurzbz.'.'.$endung; - - if(file_exists($zipfile)) - { - $vorlage_found=true; - break; - } - } - if(!$vorlage_found) - $zipfile = DOC_ROOT.'system/vorlage_zip/'.$vorlage->vorlage_kurzbz.'.'.$endung; - - - $tempname_zip = 'out.zip'; - if(copy($zipfile, $tempname_zip)) - { - exec("zip $tempname_zip content.xml"); - if(isset($_GET['style_xsl']) || $vorlage->style!='') - exec("zip $tempname_zip styles.xml"); - - clearstatcache(); - if($vorlage->bezeichnung!='') - $filename = $vorlage->bezeichnung; - else - $filename = $vorlage->vorlage_kurzbz; - if($output == 'pdf') - { - if($xsl == 'LV_Informationen') - { - $studiengang = new studiengang($_GET['stg_kz']); - $studiensemester = new studiensemester($_GET['ss']); - $tempPdfName = $vorlage->vorlage_kurzbz.'_'.$studiengang->kurzbzlang.'_'.$studiensemester->studiensemester_kurzbz.'.pdf'; - $filename = $filename.'_'.$studiengang->kurzbzlang.'_'.$studiensemester->studiensemester_kurzbz.'.pdf'; - } - elseif($xsl == "Honorarvertrag") - { - $tempPdfName = $vorlage->vorlage_kurzbz.'_'.$benutzer_obj->nachname.'_'.$benutzer_obj->vorname.'.pdf'; - $filename = $filename.'_'.$benutzer_obj->nachname.'_'.$benutzer_obj->vorname.'.pdf'; - } - elseif($xsl == "Studienordnung") - { - $studienordnung = new studienordnung(); - $studienordnung->loadStudienordnung($_GET['studienordnung_id']); - $filename = $filename.'_'.$studienordnung->studiengangkurzbzlang.'.pdf'; - $tempPdfName = $vorlage->vorlage_kurzbz.'.pdf'; - } - else - { - $tempPdfName = $vorlage->vorlage_kurzbz.'.pdf'; - $filename = $filename.'.pdf'; - } - exec("unoconv -e IsSkipEmptyPages=false --stdout -f pdf $tempname_zip > $tempPdfName"); - - $fsize = filesize($tempPdfName); - $handle = fopen($tempPdfName,'r'); - header('Content-type: application/pdf'); - header('Content-Disposition: attachment; filename="'.$filename.'"'); - header('Content-Length: '.$fsize); - } - else if($output =='odt') - { - if($xsl == "Studienordnung") - { - $studienordnung = new studienordnung(); - $studienordnung->loadStudienordnung($_GET['studienordnung_id']); - $filename = $filename.'_'.$studienordnung->studiengangkurzbzlang; - } - $fsize = filesize($tempname_zip); - $handle = fopen($tempname_zip,'r'); - header('Content-type: '.$vorlage->mimetype); - header('Content-Disposition: attachment; filename="'.$filename.'.'.$endung.'"'); - header('Content-Length: '.$fsize); - } - else if($output =='doc') - { - $tempPdfName = $vorlage->vorlage_kurzbz.'.doc'; - if($xsl == "Studienordnung") - { - $studienordnung = new studienordnung(); - $studienordnung->loadStudienordnung($_GET['studienordnung_id']); - $filename = $filename.'_'.$studienordnung->studiengangkurzbzlang.'.doc'; - } - else - { - $filename = $filename.'.doc'; - } - exec("unoconv -e IsSkipEmptyPages=false --stdout -f doc $tempname_zip > $tempPdfName"); - - $fsize = filesize($tempPdfName); - $handle = fopen($tempPdfName,'r'); - header('Content-type: application/vnd.ms-word'); - header('Content-Disposition: attachment; filename="'.$filename.'"'); - header('Content-Length: '.$fsize); - } - while (!feof($handle)) - { - echo fread($handle, 8192); - } - fclose($handle); - - unlink('content.xml'); - if(file_exists('styles.xml')) - unlink('styles.xml'); - unlink($tempname_zip); - if($output=='pdf' || $output=='doc') - unlink($tempPdfName); - rmdir($tempfolder); - } - } - else - { - // Load the XSL source - $xsl_doc = new DOMDocument; - - if(!$xsl_doc->loadXML($vorlage->text)) - die('unable to load xsl'); - - // Configure the transformer - $proc = new XSLTProcessor; - $proc->importStyleSheet($xsl_doc); // attach the xsl rules - - $buffer = $proc->transformToXml($xml_doc); - //in $buffer steht nun das xsl-fo file mit den daten - $buffer = ''.substr($buffer, strpos($buffer,"\n"),strlen($buffer)); - - //Pdf erstellen - $fo2pdf = new XslFo2Pdf(); - - //wenn uid gefunden wird, dann den Nachnamen zum Dateinamen dazuhaengen - $nachname=''; - - - if(isset($_GET['uid']) && $_GET['uid']!='') - { - $uid = str_replace(';','',$_GET['uid']); - $qry = "SELECT nachname FROM campus.vw_benutzer WHERE uid=".$db->db_add_param($uid); - - if($result = $db->db_query($qry)) - { - if($row = $db->db_fetch_object($result)) - { - $nachname = '_'.$row->nachname; - } - } - } - $filename=$xsl.$nachname; - - if (!$fo2pdf->generatePdf($buffer, $filename, "D")) - { - echo('Failed to generate PDF'); - } - } + $dokument->output(); + $dokument->close(); } else { - // kein berechtigung + // keine berechtigung echo "

    Sie haben keine Berechtigung zum Anzeigen dieser Seite

    "; } ?> diff --git a/cis/private/profile/dokumente.php b/cis/private/profile/dokumente.php index 7a5c16f73..b1f6f9442 100644 --- a/cis/private/profile/dokumente.php +++ b/cis/private/profile/dokumente.php @@ -25,7 +25,10 @@ require_once('../../../include/functions.inc.php'); require_once('../../../include/studiensemester.class.php'); require_once('../../../include/konto.class.php'); require_once('../../../include/phrasen.class.php'); +require_once('../../../include/prestudent.class.php'); require_once('../../../include/student.class.php'); +require_once('../../../include/akte.class.php'); +require_once('../../../include/datum.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); $sprache = getSprache(); @@ -49,12 +52,12 @@ if(isset($_GET['uid'])) $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($uid); if($rechte->isBerechtigt('admin')) - { + { $uid = $_GET['uid']; - $getParam = "&uid=" . $uid; - } - else - $getParam = ""; + $getParam = "&uid=" . $uid; + } + else + $getParam = ""; } else $getParam=''; @@ -65,135 +68,186 @@ $xsl_stg_kz = $student_studiengang->studiengang_kz; $stg = ''; -if(!($erg=$db->db_query("SELECT * FROM campus.vw_benutzer WHERE uid='".addslashes($uid)."'"))) - die($db->db_last_error()); -$num_rows=$db->db_num_rows($erg); -if ($num_rows==1) +if(isset($_GET['action']) && $_GET['action']=='download') { - $vorname=$db->db_result($erg,0,"vorname"); - $vornamen=$db->db_result($erg,0,"vornamen"); - $nachname=$db->db_result($erg,0,"nachname"); - $gebdatum=$db->db_result($erg,0,"gebdatum"); - $gebort=$db->db_result($erg,0,"gebort"); - $titelpre=$db->db_result($erg,0,"titelpre"); - $titelpost=$db->db_result($erg,0,"titelpost"); - $email=$db->db_result($erg,0,"uid").'@'.DOMAIN; - $email_alias=$db->db_result($erg,0,"alias"); - $hp=$db->db_result($erg,0,"homepage"); + if(isset($_GET['id']) && is_numeric($_GET['id'])) + { + $id = $_GET['id']; + $akte = new akte(); + $akte->load($id); + if ($akte->person_id == $student_studiengang->person_id + && $akte->signiert + && $akte->stud_selfservice) + { + if($akte->inhalt!='') + { + //Header fuer Datei schicken + header("Content-type: $akte->mimetype"); + header('Content-Disposition: attachment; filename="'.$akte->titel.'"'); + echo base64_decode($akte->inhalt); + exit; + } + else + { + die('Id ist ungueltig'); + } + } + else + { + die('Id ist ungueltig'); + } + } + else + { + die('Id ist ungueltig'); + } } -if(!($erg_stud=$db->db_query("SELECT studiengang_kz, semester, verband, gruppe, matrikelnr, typ::varchar(1) || kurzbz AS stgkz, tbl_studiengang.bezeichnung AS stgbz FROM public.tbl_student JOIN public.tbl_studiengang USING(studiengang_kz) WHERE student_uid='".addslashes($uid)."'"))) - die($db->db_last_error()); -$stud_num_rows=$db->db_num_rows($erg_stud); - -if ($stud_num_rows==1) -{ - $stg=$db->db_result($erg_stud,0,"studiengang_kz"); - $stgbez=$db->db_result($erg_stud,0,"stgbz"); - $stgkz=$db->db_result($erg_stud,0,"stgkz"); - $semester=$db->db_result($erg_stud,0,"semester"); - $verband=$db->db_result($erg_stud,0,"verband"); - $gruppe=$db->db_result($erg_stud,0,"gruppe"); - $matrikelnr=$db->db_result($erg_stud,0,"matrikelnr"); -} -if(!($erg_lekt=$db->db_query("SELECT * FROM public.tbl_mitarbeiter WHERE mitarbeiter_uid='".addslashes($uid)."'"))) - die($db->db_last_error()); -$lekt_num_rows=$db->db_num_rows($erg_lekt); -if ($lekt_num_rows==1) -{ - $row=$db->db_fetch_object($erg_lekt,0); - $kurzbz=$row->kurzbz; - $tel=$row->telefonklappe; -} - -// Mail-Groups -if(!($erg_mg=$db->db_query("SELECT gruppe_kurzbz, beschreibung FROM campus.vw_persongruppe WHERE mailgrp AND uid='".addslashes($uid)."' ORDER BY gruppe_kurzbz"))) - die($db->db_last_error()); -$nr_mg=$db->db_num_rows($erg_mg); - -echo ' - +echo ' -'.$p->t('tools/dokumente').' - - - + $(document).ready(function() + { + $("#t1").tablesorter( + { + sortList: [[0,1]], + widgets: ["zebra"] + }); + }); + + function changeSemester(obj) + { + self.location = obj.options[obj.selectedIndex].value + "'.$getParam.'"; + } + - -

    '.$p->t('tools/dokumente').'

    '; +

    '.$p->t('tools/dokumente').'

    +

    Bestätigungen

    '; -//Aktuelles Studiensemester oder gewaehltes Studiensemester +$prestudent = new prestudent(); +$prestudent->getPrestudentRolle($student_studiengang->prestudent_id); + +$stsem_arr = array(); +$laststsem = ''; +foreach($prestudent->result as $row) +{ + $stsem_arr[] = $row->studiensemester_kurzbz; + $laststsem = $row->studiensemester_kurzbz; +} +$stsem_arr = array_unique($stsem_arr); +if($stsem == '') + $stsem = $laststsem; + +/*//Aktuelles Studiensemester oder gewaehltes Studiensemester $stsem_obj = new studiensemester(); - if($stsem=='') - $stsem = $stsem_obj->getaktorNext(); +if($stsem == '') + $stsem = $stsem_obj->getaktorNext(); $stsem_obj->getAll(); +*/ +echo $p->t('global/studiensemester'); +echo ' "; - foreach ($stsem_obj->studiensemester as $semrow) +foreach ($stsem_arr as $semrow) +{ + if ($stsem == $semrow) { - if($stsem == $semrow->studiensemester_kurzbz) - echo ""; - else - echo ""; + echo ''; } - echo "
    "; + else + { + echo ''; + } +} +echo '

    '; $konto = new konto(); $buchungstypen = array(); -if(defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN")) +if (defined("CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN")) { - $buchungstypen = unserialize (CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN); + $buchungstypen = unserialize (CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN); } $stsem_zahlung = $konto->getLastStSemBuchungstypen($uid, $buchungstypen, $stsem); if ($stsem_zahlung != FALSE && $stsem == $stsem_zahlung) { - echo "".$p->t('tools/inskriptionsbestaetigung').""; + $path = "../pdfExport.php?xsl=Inskription&xml=student.rdf.php&ss=".$stsem."&uid=".$uid."&xsl_stg_kz=".$xsl_stg_kz; + echo ''.$p->t('tools/inskriptionsbestaetigung').''; echo ' - '.$p->t('tools/studienbeitragFuerSSBezahlt',array($stsem)); + echo '

    '; } else - echo $p->t('tools/inskriptionsbestaetigung')." - ".$p->t('tools/studienbeitragFuerSSNochNichtBezahlt',array($stsem)); - -echo "
    "; - -if(defined('CIS_DOKUMENTE_STUDIENBUCHLBATT_DRUCKEN') && CIS_DOKUMENTE_STUDIENBUCHLBATT_DRUCKEN) { - if ($stsem_zahlung != FALSE && $stsem == $stsem_zahlung) - { - echo "".$p->t('tools/studienbuchblatt').""; - echo ' - '.$p->t('tools/studienbeitragFuerSSBezahlt',array($stsem)); - } - else - echo $p->t('tools/studienbuchblatt')." - ".$p->t('tools/studienbeitragFuerSSNochNichtBezahlt',array($stsem)); - - echo "
    "; + echo $p->t('tools/inskriptionsbestaetigung'); + echo ' - '.$p->t('tools/studienbeitragFuerSSNochNichtBezahlt',array($stsem)); + echo '

    '; } -if(defined('CIS_DOKUMENTE_STUDIENERFOLGSBESTAETIGUNG_DRUCKEN') && CIS_DOKUMENTE_STUDIENERFOLGSBESTAETIGUNG_DRUCKEN) +if (defined('CIS_DOKUMENTE_STUDIENBUCHLBATT_DRUCKEN') && CIS_DOKUMENTE_STUDIENBUCHLBATT_DRUCKEN) +{ + if ($stsem_zahlung != FALSE && $stsem == $stsem_zahlung) + { + $pfad = "../pdfExport.php?xsl=Studienblatt&xml=studienblatt.xml.php&ss=".$stsem."&uid=".$uid; + echo ''.$p->t('tools/studienbuchblatt').''; + echo ' - '.$p->t('tools/studienbeitragFuerSSBezahlt',array($stsem)); + } + else + echo $p->t('tools/studienbuchblatt')." - ".$p->t('tools/studienbeitragFuerSSNochNichtBezahlt',array($stsem)); + + echo '

    '; +} + +if (defined('CIS_DOKUMENTE_STUDIENERFOLGSBESTAETIGUNG_DRUCKEN') && CIS_DOKUMENTE_STUDIENERFOLGSBESTAETIGUNG_DRUCKEN) { echo "".$p->t('tools/studienerfolgsbestaetigung')." Deutsch
    "; echo "".$p->t('tools/studienerfolgsbestaetigung')." Englisch"; - echo "
    "; + echo "
    "; } -echo "
    "; +echo "
    "; +$akte = new akte(); +if($akte->getArchiv($student_studiengang->person_id, true, true) && count($akte->result)>0) +{ + echo ' +

    Abschlussdokumente

    +
    ID
    + + + + + + + + '; + + $datum_obj = new datum(); + + foreach($akte->result as $row) + { + $pfad = 'dokumente.php?action=download&id='.$row->akte_id.'&uid='.$uid; + echo ''; + echo ''; + echo ''; + echo ''; + } + + echo '
    ErstelldatumDokument
    '.$datum_obj->formatDatum($row->erstelltam,'d.m.Y').' '.$row->bezeichnung.'
    '; +} echo ' '; -?> \ No newline at end of file +?> diff --git a/cis/private/profile/index.php b/cis/private/profile/index.php index 6961ddf11..40cefd67b 100644 --- a/cis/private/profile/index.php +++ b/cis/private/profile/index.php @@ -47,7 +47,7 @@ $p=new phrasen($sprache); if (!$db = new basis_db()) die($p->t('global/fehlerBeimOeffnenDerDatenbankverbindung')); -$uid=get_uid(); +$uid = get_uid(); $datum_obj = new datum(); @@ -129,11 +129,11 @@ echo ' - - - - - + + + + + <?php echo $p->t('tools/ampelsystem') ?> @@ -346,7 +342,7 @@ $(document).ready(function(){ ' . $p->t('tools/ampelsystem') . ''; + echo '

    ' . $p->t('tools/ampelsystem') . '

    '; //title in popup for mandatory ampeln if ($is_popup) @@ -402,10 +398,33 @@ $(document).ready(function(){ $cnt = 1; //counter to set iterative id's $cnt_inactive = 1; //counter to set only one heading line for inactive ampeln + $cnt_active = 0; + + //show panel "no actual ampeln" if there are no active ampeln + foreach ($user_ampel_arr as $user_ampel) + { + if ($user_ampel['active'] == true) + $cnt_active++; + } + + if ($cnt_active == 0) + { + echo ' +
    +
    + +
    +
    '; + + } //fill panel with ampeln foreach ($user_ampel_arr as $user_ampel) { + //use only ampeln that are not overdue if ($user_ampel['show_ampel'] == true) { @@ -416,7 +435,7 @@ $(document).ready(function(){
    @@ -428,12 +447,12 @@ $(document).ready(function(){