diff --git a/application/config/navigation.php b/application/config/navigation.php index abb5338b6..6ef2fb803 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -5,6 +5,11 @@ $config['navigation_header'] = array( 'FH-Complete' => site_url(''), 'Vilesci' => base_url('/vilesci'), 'CIS' => CIS_ROOT + ), + 'system/infocenter/InfoCenter/infocenterFreigegeben' => array( + 'FH-Complete' => base_url('index.ci.php/'), + 'Vilesci' => base_url('/vilesci'), + 'CIS' => CIS_ROOT ) ); @@ -57,3 +62,27 @@ $config['navigation_menu']['Vilesci/index'] = array( ) ) ); + +//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/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 23b4972c2..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 ); } @@ -560,7 +608,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, '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 26f1c5247..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,26 +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) - { - log_message('error','Failed to create Symlink to '.$extensionPath.$targetDirectory); - 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; + } } } } @@ -758,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); } } @@ -773,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); } } @@ -790,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 @@ -810,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; @@ -830,7 +841,7 @@ class ExtensionsLib */ private function _printError($error) { - $this->ci->eprintflib->printError($error); + $this->_ci->eprintflib->printError($error); } /** @@ -846,7 +857,7 @@ class ExtensionsLib */ private function _printMessage($message) { - $this->ci->eprintflib->printMessage($message); + $this->_ci->eprintflib->printMessage($message); } /** @@ -865,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/Kostenstelle_model.php b/application/models/accounting/Kostenstelle_model.php index fd064125c..1164bc969 100644 --- a/application/models/accounting/Kostenstelle_model.php +++ b/application/models/accounting/Kostenstelle_model.php @@ -14,6 +14,8 @@ class Kostenstelle_model extends DB_Model /** * 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 */ @@ -23,7 +25,7 @@ class Kostenstelle_model extends DB_Model if ($geschaeftsjahr === null) { - $lgj = $this->GeschaeftsjahrModel->getLastGeschaeftsjahr(); + $lgj = $this->GeschaeftsjahrModel->getCurrGeschaeftsjahr(); if ($lgj->error) return error($lgj->retval); @@ -45,18 +47,34 @@ class Kostenstelle_model extends DB_Model $gjstart = $gj->retval[0]->start; - $query = 'SELECT kostenstelle_id, kostenstelle_nr, kurzbz, wawi.tbl_kostenstelle.bezeichnung, kgjvon.start, kgjbis.ende + $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 - (wawi.tbl_kostenstelle.geschaeftsjahrbis IS NULL AND wawi.tbl_kostenstelle.geschaeftsjahrvon IS NULL) - OR - (DATE ? >= kgjvon.start AND (DATE ? < kgjbis.ende OR wawi.tbl_kostenstelle.geschaeftsjahrbis IS NULL)) - OR - (DATE ? < kgjbis.ende AND (DATE ? >= kgjvon.start OR wawi.tbl_kostenstelle.geschaeftsjahrvon IS NULL)) + (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, $gjstart, $gjstart)); + $kostenstellen = $this->execQuery($query, array($gjstart, $gjstart)); + + if ($kostenstellen->error) + return error($kostenstellen->retval); + + $this->load->library('PermissionLib'); + + $kostenstellenresult = array(); + + //filter kostenstellen, only kostenstellen for which berechtigt + foreach ($kostenstellen->retval as $kostenstelle) + { + if ($this->permissionlib->isBerechtigt('extension/budget_verwaltung', 'suid', null, $kostenstelle->kostenstelle_id) === true) + { + $kostenstellenresult[] = $kostenstelle; + } + } + + return success($kostenstellenresult); } } diff --git a/application/models/organisation/Geschaeftsjahr_model.php b/application/models/organisation/Geschaeftsjahr_model.php index d475b8142..e806058ae 100644 --- a/application/models/organisation/Geschaeftsjahr_model.php +++ b/application/models/organisation/Geschaeftsjahr_model.php @@ -13,17 +13,30 @@ class Geschaeftsjahr_model extends DB_Model } /** - * Gets latest Geschaeftsjahr, as determined by its start date + * Gets current Geschaeftsjahr, as determined by its start date * @return array|null */ - public function getLastGeschaeftsjahr() + public function getCurrGeschaeftsjahr() { - $query = 'SELECT * + $query = 'SELECT * FROM public.tbl_geschaeftsjahr - WHERE start = ( - SELECT max(start) - 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 790f1b4db..2647d6105 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -213,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 8360867b6..311dd647b 100755 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -194,7 +194,7 @@ $datasetRaw->{'Details'} = sprintf( 'Details', - base_url('index.ci.php/system/infocenter/InfoCenter/showDetails/'), + site_url('system/infocenter/InfoCenter/showDetails/'), $datasetRaw->{'PersonId'} ); 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..04b938086 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 cbf20b0ec..52ed50dbd 100755 --- a/application/views/templates/FHC-Header.php +++ b/application/views/templates/FHC-Header.php @@ -4,7 +4,8 @@ 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 -$calledFrom = $this->router->directory.$this->router->class.'/'.$this->router->method; +$calledPath = $this->router->directory.$this->router->class; +$calledMethod = $this->router->method; // By default set the parameters to null $title = isset($title) ? $title : null; @@ -62,7 +63,7 @@ function _generateCSSsInclude($CSSs) /** * Generates global JS-Object to pass parms to other javascripts */ -function _generateJSDataStorageObject($calledFrom) +function _generateJSDataStorageObject($calledPath, $calledMethod) { $toPrint = "\n"; $toPrint .= ''; @@ -167,7 +169,7 @@ function _generateAddonsJSsInclude($calledFrom) // Generates the global object to pass useful parms to the other javascripts // NOTE: must be called before any other JS include - _generateJSDataStorageObject($calledFrom); + _generateJSDataStorageObject($calledPath, $calledMethod); // JQuery V3 if ($jquery === true) _generateJSsInclude('vendor/components/jquery/jquery.min.js'); @@ -202,7 +204,7 @@ function _generateAddonsJSsInclude($calledFrom) } // Load addon hooks JS - if ($addons === true) _generateAddonsJSsInclude($calledFrom); + 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 669fb914d..c2a205dc1 100644 --- a/application/views/widgets/filter/filter.php +++ b/application/views/widgets/filter/filter.php @@ -114,7 +114,7 @@ function refreshSideMenu() { $.ajax({ - url: "", + url: "", method: "GET", data: {} }) @@ -132,7 +132,7 @@ $(".remove-filter").click(function() { $.ajax({ - url: "", + url: "", method: "POST", data: { filter_id: $(this).attr('value') diff --git a/application/views/widgets/filter/saveFilter.php b/application/views/widgets/filter/saveFilter.php index 99f5f5d9d..f6b7dc529 100644 --- a/application/views/widgets/filter/saveFilter.php +++ b/application/views/widgets/filter/saveFilter.php @@ -6,7 +6,7 @@ if ($("#customFilterDescription").val() != '') { $.ajax({ - url: "", + url: "", method: "POST", data: { customFilterDescription: $("#customFilterDescription").val() diff --git a/application/views/widgets/filter/selectFields.php b/application/views/widgets/filter/selectFields.php index 18d5cac02..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" diff --git a/application/views/widgets/filter/selectFilters.php b/application/views/widgets/filter/selectFilters.php index 9f775a826..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, @@ -97,7 +97,7 @@ $(".remove-selected-filter").click(function(event) { $.ajax({ - url: "", + url: "", method: "POST", data: { fieldName: $(this).attr('filterToRemove') @@ -197,7 +197,7 @@ function renderSelectedFilters() { $.ajax({ - url: "", + url: "", method: "GET", data: {}, dataType: "json" 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/include/js/infocenter/infocenterDetails.js b/include/js/infocenter/infocenterDetails.js index 47812323d..0d409fe13 100644 --- a/include/js/infocenter/infocenterDetails.js +++ b/include/js/infocenter/infocenterDetails.js @@ -96,11 +96,45 @@ $(document).ready( $("#notizform").on("submit", function (e) { e.preventDefault(); - var personid = $("#hiddenpersonid").val(); + var personId = $("#hiddenpersonid").val(); + var notizId = $("#notizform :input[name='hiddenNotizId']").val(); var data = $(this).serializeArray(); - saveNotiz(personid, data); + + if (notizId !== '') + { + updateNotiz(notizId, personId, data); + } + else + { + saveNotiz(personId, data); + } } - ) + ); + + + //update notiz - autofill notizform + $(document).on("click", "#notiztable tbody tr", function () + { + var notizId = $(this).find("td:eq(3)").html(); + var notizTitle = $(this).find("td:eq(1)").text(); + var notizContent = this.title; + + $("#notizform label:first").text("Notiz ändern").css("color", "red"); + $("#notizform :input[type='reset']").css("display", "inline-block"); + + $("#notizform :input[name='hiddenNotizId']").val(notizId); + $("#notizform :input[name='notiztitel']").val(notizTitle); + $("#notizform :input[name='notiz']").val(notizContent); + } + ); + + //update notiz - abbrechen-button: reset styles + $("#notizform :input[type='reset']").click(function () + { + resetNotizFields(); + } + ); + }); // ----------------------------------------------------------------------------------------------------------------- @@ -220,6 +254,29 @@ function saveNotiz(personid, data) }); } +function updateNotiz(notizId, personId, data) +{ + $.ajax({ + type: "POST", + dataType: "json", + data: data, + url: "../updateNotiz/" + notizId + "/" + personId, + success: function (data, textStatus, jqXHR) + { + if (data) + { + refreshNotizen(); + refreshLog(); + resetNotizFields(); + } + }, + error: function (jqXHR, textStatus, errorThrown) + { + alert(textStatus + " - " + errorThrown + " - " + jqXHR.responseText); + } + }); +} + // ----------------------------------------------------------------------------------------------------------------- // methods executed after ajax (refreshers) @@ -252,7 +309,7 @@ function refreshNotizen() //readd tablesorter formatNotizTable() } - ); + ); } function formatNotizTable() @@ -261,3 +318,10 @@ function formatNotizTable() tablesortAddPager("notiztable", "notizpager", 10); $("#notiztable").addClass("table-condensed"); } + +function resetNotizFields() +{ + $("#notizform :input[name='hiddenNotizId']").val(""); + $("#notizform label:first").text("Notiz hinzufügen").css("color", "black"); + $("#notizform :input[type='reset']").css("display", "none"); +} diff --git a/soap/stip.class.php b/soap/stip.class.php index d5ec5fa51..adabc8582 100644 --- a/soap/stip.class.php +++ b/soap/stip.class.php @@ -1,526 +1,528 @@ -. - */ - -require_once('../config/vilesci.config.inc.php'); -require_once('../include/basis_db.class.php'); -require_once('../include/studiensemester.class.php'); -require_once('../include/zeugnisnote.class.php'); -require_once('../include/prestudent.class.php'); - -class stip extends basis_db -{ - public $Semester; - public $Studienjahr; - public $PersKz; - public $SVNR; - public $Familienname; - public $Vorname; - public $Typ; - public $PersKz_Antwort; - public $SVNR_Antwort; - public $Familienname_Antwort; - public $Vorname_Antwort; - public $Ausbildungssemester; - public $StudStatusCode; - public $BeendigungsDatum; - public $VonNachPersKz; - public $Studienbeitrag; - public $Inskribiert; - public $Erfolg; - public $OrgFormTeilCode; - public $AntwortStatusCode; - - - /** - * - * Überprüft die Daten - * @param $ErhKz - * @param $Anfragedaten - * @param $Bezieher - */ - function validateStipDaten($ErhKz, $Anfragedaten, $Bezieher) - { - if(mb_strlen($ErhKz)!=3 || !is_numeric($ErhKz)) - { - $this->errormsg = "Kein gültiger Wert für ErhKz"; - return false; - } - - if(mb_strlen($Bezieher->Semester)!=2 || ($Bezieher->Semester != "ws" && $Bezieher->Semester != "ss" && $Bezieher->Semester != "WS" && $Bezieher->Semester != "SS")) - { - $this->errormsg = "Kein gültiger Wert für Semester"; - return false; - } - - if(mb_strlen($Bezieher->Studienjahr) != 7) - { - $this->errormsg = "Kein gültiger Wert für Studienjahr"; - return false; - } - - // kein Mussfeld - if($Bezieher->PersKz != null && strlen($Bezieher->PersKz) != 10) - { - $this->errormsg = "Kein gültiger Wert für PersKz"; - //return false; - } - - if(mb_strlen($Bezieher->SVNR) != 10 || !is_numeric($Bezieher->SVNR)) - { - $this->errormsg = "Kein gültiger Wert für SVNR"; - // return false; - } - - // preg_match funktioniert noch nicht || preg_match_all('[^0-9]*',$Bezieher->Familienname)>0 - if(mb_strlen($Bezieher->Familienname) > 255 || $Bezieher->Familienname == null || mb_strlen($Bezieher->Familienname)<2) - { - $this->errormsg = "Kein gültiger Wert für Familienname"; - //return false; - } - - if(mb_strlen($Bezieher->Vorname) > 255 || $Bezieher->Vorname == null || mb_strlen($Bezieher->Vorname) <2) - { - $this->errormsg = "Kein gültiger Wert für Vorname"; - // return false; - } - - if(mb_strlen($Bezieher->Typ) != 2 || ($Bezieher->Typ != "ag" && $Bezieher->Typ != "as" && $Bezieher->Typ != "AG" && $Bezieher->Typ != "AS")) - { - $this->errormsg = "Kein gültiger Wert für Typ"; - return false; - } - - return true; - } - - - /** - * - * Suche Studenten anhand PersonKz - * @param $PersonKz - */ - function searchPersonKz($PersonKz) - { - $qry = "SELECT - prestudent_id, vorname, nachname, svnr, matrikelnr - FROM - public.tbl_student student - JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid) - JOIN public.tbl_person person using(person_id) - WHERE student.matrikelnr = ".$this->db_add_param($PersonKz).";"; - - if($this->db_query($qry)) - { - if($row = $this->db_fetch_object()) - { - $this->Vorname_Antwort = $row->vorname; - $this->Familienname_Antwort = $row->nachname; - $this->SVNR_Antwort = $row->svnr; - $this->PersKz_Antwort = trim($row->matrikelnr); - $this->AntwortStatusCode = 1; - return $row->prestudent_id; - } - else - { - $this->AntwortStatusCode =2; - return false; - } - } - else - { - return false; - } - - } - /** - * - * Suche Studenten anhand Sozialversicherungsnummer - * @param $Svnr - */ - function searchSvnr($Svnr) - { - $qry = "SELECT - prestudent_id, vorname, nachname, svnr, matrikelnr - FROM - public.tbl_student student - JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid) - JOIN public.tbl_person person using(person_id) - WHERE person.svnr = ".$this->db_add_param($Svnr).";"; - - if($this->db_query($qry)) - { - // wenn mehr als 1 Datensatz gefunden wird --> Fehler - if($this->db_num_rows() == 1 ) - { - if($row = $this->db_fetch_object()) - { - $this->Vorname_Antwort = $row->vorname; - $this->Familienname_Antwort = $row->nachname; - $this->SVNR_Antwort = $row->svnr; - $this->PersKz_Antwort = trim($row->matrikelnr); - $this->AntwortStatusCode = 1; - return $row->prestudent_id; - } - else - { - $this->AntwortStatusCode =2; - return false; - } - } - else - { - $this->AntwortStatusCode = 2; - return false; - } - } - else - { - return false; - } - return true; - - } - - /** - * - * Suche Studenten anhand Vor- und Nachname - * @param $Svnr - */ - function searchVorNachname($Vorname, $Nachname) - { - $qry = "SELECT - prestudent_id, vorname, nachname, svnr, matrikelnr - FROM - public.tbl_student student - JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid) - JOIN public.tbl_person person using(person_id) - WHERE - person.vorname = ".$this->db_add_param($Vorname)." - AND person.nachname = ".$this->db_add_param($Nachname).";"; - - if($this->db_query($qry)) - { - // wenn mehr als 1 Datensatz gefunden wird --> Fehler - if($this->db_num_rows() == 1 ) - { - if($row = $this->db_fetch_object()) - { - $this->Vorname_Antwort = $row->vorname; - $this->Familienname_Antwort = $row->nachname; - $this->SVNR_Antwort = $row->svnr; - $this->PersKz_Antwort = trim($row->matrikelnr); - $this->AntwortStatusCode = 1; - return $row->prestudent_id; - } - else - { - $this->AntwortStatusCode =2; - return false; - } - } - else - { - $this->AntwortStatusCode = 2; - return false; - } - - } - else - { - return false; - } - return true; - - } - - /** - * - * Gibt den orgform_code zurück für übergebene StudentUID und Semester - * z.B. 1 für Vollzeit - * z.B. 2 für Berufsbegleitend - * @param $studentUID - * @param $studSemester - */ - function getOrgFormTeilCode($studentUID, $studSemester, $prestudentID) - { - - // hole mischform von studenten - $qry_mischform = " - SELECT - studiengang.mischform - FROM - public.tbl_studiengang studiengang - JOIN public.tbl_student student using(studiengang_kz) - JOIN public.tbl_prestudent prestudent using(prestudent_id) - WHERE student_uid=".$this->db_add_param($studentUID); - - if($this->db_query($qry_mischform)) - { - if($row= $this->db_fetch_object()) - { - $mischform = $this->db_parse_bool($row->mischform); - - } - } - - // hole OrgFormTeilCode aus studiengang - if($mischform == false) - { - - $qry = " - SELECT - orgform.code, studiengang.orgform_kurzbz as studorgkz, student.student_uid, student.studiengang_kz studiengang - FROM - public.tbl_studiengang studiengang - JOIN public.tbl_student student using(studiengang_kz) - JOIN public.tbl_prestudent prestudent using(prestudent_id) - JOIN public.tbl_prestudentstatus status using(prestudent_id) - JOIN bis.tbl_orgform orgform on(orgform.orgform_kurzbz = studiengang.orgform_kurzbz) - WHERE - student_uid=".$this->db_add_param($studentUID)." - AND status.studiensemester_kurzbz =".$this->db_add_param($studSemester); - - // Wenn kein Status gefunden wurde -> null - if($this->db_query($qry)) - { - if($row = $this->db_fetch_object()) - { - $this->OrgFormTeilCode = $row->code; - return true; - } - $this->OrgFormTeilCode = null; - return false; - } - else - return false; - } - else // hole OrgFormTeilCode aus letztem Status - { - - $prestudentStatus = new prestudent(); - // wenn status vorhanden übernehme OrgForm - if($prestudentStatus->getLastStatus($prestudentID,$studSemester)) - { - $statusOrgForm = $prestudentStatus->orgform_kurzbz; - $this->OrgFormTeilCode = $this->getOrgFormCodeFromKurzbz($statusOrgForm); - return true; - } - else - $this->OrgFormTeilCode = null; - - - } - $this->OrgFormTeilCode = null; - } - - - /** - * - * Gibt den orgform_code zurück für übergebene orgform_kurzbz - * @param orgform_kurzbz - */ - function getOrgFormCodeFromKurzbz($orgform_kurzbz) - { - $qry = "SELECT code FROM bis.tbl_orgform WHERE orgform_kurzbz = ".$this->db_add_param($orgform_kurzbz).";"; - - if($this->db_query($qry)) - { - if($row = $this->db_fetch_object()) - { - return $row->code; - } - return false; - } - else - return false; - } - - /** - * - * Ermittelt den StutStatusCode - * Stati Aktiver Student[Code 1], Unterbrecher[2], Absolvent[3] und Ausgeschieden ohne Abschluss[4] - * Stati Übertritt[5] kommt nicht vor - */ - public function getStudStatusCode($prestudent_id, $studiensemester_kurzbz, $bisdatum=null) - { - $qrystatus=" - SELECT - * - FROM - public.tbl_prestudentstatus - WHERE - prestudent_id=".$this->db_add_param($prestudent_id)." - AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz); - if(!is_null($bisdatum)) - $qrystatus.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).")"; - - $qrystatus.=" ORDER BY datum desc, insertamum desc, ext_id desc;"; - - if($resultstatus = $this->db_query($qrystatus)) - { - if($this->db_num_rows($resultstatus)==0) - { - $stsem = new studiensemester(); - $psem = $stsem->getPreviousFrom($studiensemester_kurzbz); - - $qrystatus=" - SELECT * - FROM - public.tbl_prestudentstatus - WHERE - prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER)." - AND studiensemester_kurzbz=".$this->db_add_param($psem)."'"; - if(!is_null($bisdatum)) - $qrystatus.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).") "; - $qrystatus.=" ORDER BY datum desc, insertamum desc, ext_id desc;"; - - if(!$resultstatus = $this->db_query($qrystatus)) - { - $this->errormsg='Fehler beim Laden der Daten'; - return false; - } - } - } - if($rowstatus = $this->db_fetch_object($resultstatus)) - { - switch($rowstatus->status_kurzbz) - { - case 'Student': - case 'Incoming': - case 'Outgoing': - case 'Praktikant': - case 'Diplomand': - $status=1; - break; - case 'Unterbrecher': - $status=2; - break; - case 'Absolvent': - $status=3; - break; - case 'Abbrecher': - $status=4; - break; - default: - $this->errormsg='Fehlerhafter Status'; - break; - } - } - - return $status; - } - /** - * - * Ermittelt den SemesterCode - */ - public function getSemester($prestudent_id, $studiensemester_kurzbz, $bisdatum=null) - { - $qrystatus=" - SELECT - * - FROM - public.tbl_prestudentstatus - WHERE - prestudent_id=".$this->db_add_param($prestudent_id)." - AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz); - if(!is_null($bisdatum)) - $qrystatus.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).")"; - - $qrystatus.=" ORDER BY datum desc, insertamum desc, ext_id desc;"; - - if($resultstatus = $this->db_query($qrystatus)) - { - - if($rowstatus = $this->db_fetch_object($resultstatus)) - { - $qry1=" - SELECT count(*) AS dipl FROM public.tbl_prestudentstatus - WHERE - prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER)." - AND status_kurzbz='Diplomand'"; - if(!is_null($bisdatum)) - $qry1.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).") "; - - if($result1 = $this->db_query($qry1)) - { - if($row1 = $this->db_fetch_object($result1)) - { - $sem=$rowstatus->ausbildungssemester; - - if($row1->dipl>1) - { - $sem=50; - } - if($row1->dipl>3) - { - $sem=60; - } - } - } - } - } - return $sem; - } - - /** - * Liefert die ECTS Punkte aller LVs die besucht wurden - * - * @param $prestudent_id - * @param $studiensemester_kurzbz - */ - public function getErfolg($prestudent_id, $studiensemester_kurzbz) - { - $student = new student(); - $uid = $student->getUid($prestudent_id); - - $noten = new note(); - $noten->getAll(); - - $noten_arr = array(); - foreach($noten->result as $row_noten) - $noten_arr[$row_noten->note]['positiv']=$row_noten->positiv; - - $obj = new zeugnisnote(); - $ects=0; - if(!$obj->getZeugnisnoten($lehrveranstaltung_id=null, $uid, $studiensemester_kurzbz=null)) - die('Fehler beim Laden der Noten:'.$obj->errormsg); - foreach($obj->result as $row) - { - //Note darf nicht negativ oder angerechnet(6) sein - if($row->zeugnis && $row->note!=6 && isset($noten_arr[$row->note]) && $noten_arr[$row->note]['positiv']) - { - $ects += $row->ects; - } - } - return number_format($ects,2,',',''); - } -} - -class error -{ - public $ErrorNumbe; - public $KeyAttribute; - public $KeyValues; - public $CheckAttribute; - public $CheckValue; - public $ErrorText; -} - -?> +. + */ + +require_once('../config/vilesci.config.inc.php'); +require_once('../include/basis_db.class.php'); +require_once('../include/studiensemester.class.php'); +require_once('../include/zeugnisnote.class.php'); +require_once('../include/prestudent.class.php'); + +class stip extends basis_db +{ + public $Semester; + public $Studienjahr; + public $PersKz; + public $SVNR; + public $Familienname; + public $Vorname; + public $Typ; + public $PersKz_Antwort; + public $SVNR_Antwort; + public $Familienname_Antwort; + public $Vorname_Antwort; + public $Ausbildungssemester; + public $StudStatusCode; + public $BeendigungsDatum; + public $VonNachPersKz; + public $Studienbeitrag; + public $Inskribiert; + public $Erfolg; + public $OrgFormTeilCode; + public $AntwortStatusCode; + + + /** + * + * Überprüft die Daten + * @param $ErhKz + * @param $Anfragedaten + * @param $Bezieher + */ + function validateStipDaten($ErhKz, $Anfragedaten, $Bezieher) + { + if(mb_strlen($ErhKz)!=3 || !is_numeric($ErhKz)) + { + $this->errormsg = "Kein gültiger Wert für ErhKz"; + return false; + } + + if(mb_strlen($Bezieher->Semester)!=2 || ($Bezieher->Semester != "ws" && $Bezieher->Semester != "ss" && $Bezieher->Semester != "WS" && $Bezieher->Semester != "SS")) + { + $this->errormsg = "Kein gültiger Wert für Semester"; + return false; + } + + if(mb_strlen($Bezieher->Studienjahr) != 7) + { + $this->errormsg = "Kein gültiger Wert für Studienjahr"; + return false; + } + + // kein Mussfeld + if($Bezieher->PersKz != null && strlen($Bezieher->PersKz) != 10) + { + $this->errormsg = "Kein gültiger Wert für PersKz"; + //return false; + } + + if(mb_strlen($Bezieher->SVNR) != 10 || !is_numeric($Bezieher->SVNR)) + { + $this->errormsg = "Kein gültiger Wert für SVNR"; + // return false; + } + + // preg_match funktioniert noch nicht || preg_match_all('[^0-9]*',$Bezieher->Familienname)>0 + if(mb_strlen($Bezieher->Familienname) > 255 || $Bezieher->Familienname == null || mb_strlen($Bezieher->Familienname)<2) + { + $this->errormsg = "Kein gültiger Wert für Familienname"; + //return false; + } + + if(mb_strlen($Bezieher->Vorname) > 255 || $Bezieher->Vorname == null || mb_strlen($Bezieher->Vorname) <2) + { + $this->errormsg = "Kein gültiger Wert für Vorname"; + // return false; + } + + if(mb_strlen($Bezieher->Typ) != 2 || ($Bezieher->Typ != "ag" && $Bezieher->Typ != "as" && $Bezieher->Typ != "AG" && $Bezieher->Typ != "AS")) + { + $this->errormsg = "Kein gültiger Wert für Typ"; + return false; + } + + return true; + } + + + /** + * + * Suche Studenten anhand PersonKz + * @param $PersonKz + */ + function searchPersonKz($PersonKz) + { + $qry = "SELECT + prestudent_id, vorname, nachname, svnr, matrikelnr + FROM + public.tbl_student student + JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid) + JOIN public.tbl_person person using(person_id) + WHERE student.matrikelnr = ".$this->db_add_param($PersonKz).";"; + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->Vorname_Antwort = $row->vorname; + $this->Familienname_Antwort = $row->nachname; + $this->SVNR_Antwort = $row->svnr; + $this->PersKz_Antwort = trim($row->matrikelnr); + $this->AntwortStatusCode = 1; + return $row->prestudent_id; + } + else + { + $this->AntwortStatusCode =2; + return false; + } + } + else + { + return false; + } + + } + /** + * + * Suche Studenten anhand Sozialversicherungsnummer + * @param $Svnr + */ + function searchSvnr($Svnr) + { + $qry = "SELECT + prestudent_id, vorname, nachname, svnr, matrikelnr + FROM + public.tbl_student student + JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid) + JOIN public.tbl_person person using(person_id) + WHERE person.svnr = ".$this->db_add_param($Svnr).";"; + + if($this->db_query($qry)) + { + // wenn mehr als 1 Datensatz gefunden wird --> Fehler + if($this->db_num_rows() == 1 ) + { + if($row = $this->db_fetch_object()) + { + $this->Vorname_Antwort = $row->vorname; + $this->Familienname_Antwort = $row->nachname; + $this->SVNR_Antwort = $row->svnr; + $this->PersKz_Antwort = trim($row->matrikelnr); + $this->AntwortStatusCode = 1; + return $row->prestudent_id; + } + else + { + $this->AntwortStatusCode =2; + return false; + } + } + else + { + $this->AntwortStatusCode = 2; + return false; + } + } + else + { + return false; + } + return true; + + } + + /** + * + * Suche Studenten anhand Vor- und Nachname + * @param $Svnr + */ + function searchVorNachname($Vorname, $Nachname) + { + $qry = "SELECT + prestudent_id, vorname, nachname, svnr, matrikelnr + FROM + public.tbl_student student + JOIN public.tbl_benutzer benutzer on(benutzer.uid=student.student_uid) + JOIN public.tbl_person person using(person_id) + WHERE + person.vorname = ".$this->db_add_param($Vorname)." + AND person.nachname = ".$this->db_add_param($Nachname).";"; + + if($this->db_query($qry)) + { + // wenn mehr als 1 Datensatz gefunden wird --> Fehler + if($this->db_num_rows() == 1 ) + { + if($row = $this->db_fetch_object()) + { + $this->Vorname_Antwort = $row->vorname; + $this->Familienname_Antwort = $row->nachname; + $this->SVNR_Antwort = $row->svnr; + $this->PersKz_Antwort = trim($row->matrikelnr); + $this->AntwortStatusCode = 1; + return $row->prestudent_id; + } + else + { + $this->AntwortStatusCode =2; + return false; + } + } + else + { + $this->AntwortStatusCode = 2; + return false; + } + + } + else + { + return false; + } + return true; + + } + + /** + * + * Gibt den orgform_code zurück für übergebene StudentUID und Semester + * z.B. 1 für Vollzeit + * z.B. 2 für Berufsbegleitend + * @param $studentUID + * @param $studSemester + */ + function getOrgFormTeilCode($studentUID, $studSemester, $prestudentID) + { + + // hole mischform von studenten + $qry_mischform = " + SELECT + studiengang.mischform + FROM + public.tbl_studiengang studiengang + JOIN public.tbl_student student using(studiengang_kz) + JOIN public.tbl_prestudent prestudent using(prestudent_id) + WHERE student_uid=".$this->db_add_param($studentUID); + + if($this->db_query($qry_mischform)) + { + if($row= $this->db_fetch_object()) + { + $mischform = $this->db_parse_bool($row->mischform); + + } + } + + // hole OrgFormTeilCode aus studiengang + if($mischform == false) + { + + $qry = " + SELECT + orgform.code, studiengang.orgform_kurzbz as studorgkz, student.student_uid, student.studiengang_kz studiengang + FROM + public.tbl_studiengang studiengang + JOIN public.tbl_student student using(studiengang_kz) + JOIN public.tbl_prestudent prestudent using(prestudent_id) + JOIN public.tbl_prestudentstatus status using(prestudent_id) + JOIN bis.tbl_orgform orgform on(orgform.orgform_kurzbz = studiengang.orgform_kurzbz) + WHERE + student_uid=".$this->db_add_param($studentUID)." + AND status.studiensemester_kurzbz =".$this->db_add_param($studSemester); + + // Wenn kein Status gefunden wurde -> null + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $this->OrgFormTeilCode = $row->code; + return true; + } + $this->OrgFormTeilCode = null; + return false; + } + else + return false; + } + else // hole OrgFormTeilCode aus letztem Status + { + + $prestudentStatus = new prestudent(); + // wenn status vorhanden übernehme OrgForm + if($prestudentStatus->getLastStatus($prestudentID,$studSemester)) + { + $statusOrgForm = null; + if($prestudentStatus->orgform_kurzbz != '') + $statusOrgForm = $prestudentStatus->orgform_kurzbz; + elseif($prestudentStatus->studienplan_id!='') + { + $qry = "SELECT orgform_kurzbz FROM lehre.tbl_studienplan WHERE studienplan_id=".$this->db_add_param($prestudentStatus->studienplan_id); + if($result = $this->db_query($qry)) + { + if($row = $this->db_fetch_object($result)) + { + $statusOrgForm = $row->orgform_kurzbz; + } + } + } + $this->OrgFormTeilCode = $this->getOrgFormCodeFromKurzbz($statusOrgForm); + return true; + } + else + $this->OrgFormTeilCode = null; + + + } + $this->OrgFormTeilCode = null; + } + + + /** + * + * Gibt den orgform_code zurück für übergebene orgform_kurzbz + * @param orgform_kurzbz + */ + function getOrgFormCodeFromKurzbz($orgform_kurzbz) + { + $qry = "SELECT code FROM bis.tbl_orgform WHERE orgform_kurzbz = ".$this->db_add_param($orgform_kurzbz).";"; + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + return $row->code; + } + return false; + } + else + return false; + } + + /** + * + * Ermittelt den StutStatusCode + * Stati Aktiver Student[Code 1], Unterbrecher[2], Absolvent[3] und Ausgeschieden ohne Abschluss[4] + * Stati Übertritt[5] kommt nicht vor + */ + public function getStudStatusCode($prestudent_id, $studiensemester_kurzbz, $bisdatum=null) + { + $qrystatus=" + SELECT + * + FROM + public.tbl_prestudentstatus + WHERE + prestudent_id=".$this->db_add_param($prestudent_id)." + AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz); + if(!is_null($bisdatum)) + $qrystatus.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).")"; + + $qrystatus.=" ORDER BY datum desc, insertamum desc, ext_id desc;"; + + if($resultstatus = $this->db_query($qrystatus)) + { + if($this->db_num_rows($resultstatus)==0) + { + $stsem = new studiensemester(); + $psem = $stsem->getPreviousFrom($studiensemester_kurzbz); + + $qrystatus=" + SELECT * + FROM + public.tbl_prestudentstatus + WHERE + prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER)." + AND studiensemester_kurzbz=".$this->db_add_param($psem)."'"; + if(!is_null($bisdatum)) + $qrystatus.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).") "; + $qrystatus.=" ORDER BY datum desc, insertamum desc, ext_id desc;"; + + if(!$resultstatus = $this->db_query($qrystatus)) + { + $this->errormsg='Fehler beim Laden der Daten'; + return false; + } + } + } + if($rowstatus = $this->db_fetch_object($resultstatus)) + { + switch($rowstatus->status_kurzbz) + { + case 'Student': + case 'Incoming': + case 'Outgoing': + case 'Praktikant': + case 'Diplomand': + $status=1; + break; + case 'Unterbrecher': + $status=2; + break; + case 'Absolvent': + $status=3; + break; + case 'Abbrecher': + $status=4; + break; + default: + $this->errormsg='Fehlerhafter Status'; + break; + } + } + + return $status; + } + /** + * + * Ermittelt den SemesterCode + */ + public function getSemester($prestudent_id, $studiensemester_kurzbz, $bisdatum=null) + { + $qrystatus=" + SELECT + * + FROM + public.tbl_prestudentstatus + WHERE + prestudent_id=".$this->db_add_param($prestudent_id)." + AND studiensemester_kurzbz=".$this->db_add_param($studiensemester_kurzbz); + if(!is_null($bisdatum)) + $qrystatus.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).")"; + + $qrystatus.=" ORDER BY datum desc, insertamum desc, ext_id desc;"; + + if($resultstatus = $this->db_query($qrystatus)) + { + + if($rowstatus = $this->db_fetch_object($resultstatus)) + { + $qry1=" + SELECT count(*) AS dipl FROM public.tbl_prestudentstatus + WHERE + prestudent_id=".$this->db_add_param($prestudent_id, FHC_INTEGER)." + AND status_kurzbz='Diplomand'"; + if(!is_null($bisdatum)) + $qry1.=" AND (tbl_prestudentstatus.datum<".$this->db_add_param($bisdatum).") "; + + if($result1 = $this->db_query($qry1)) + { + if($row1 = $this->db_fetch_object($result1)) + { + $sem=$rowstatus->ausbildungssemester; + + if($row1->dipl>1) + { + $sem=50; + } + if($row1->dipl>3) + { + $sem=60; + } + } + } + } + } + return $sem; + } + + /** + * Liefert die ECTS Punkte aller LVs die besucht wurden + * + * @param $prestudent_id + * @param $studiensemester_kurzbz + */ + public function getErfolg($prestudent_id, $studiensemester_kurzbz) + { + $student = new student(); + $uid = $student->getUid($prestudent_id); + + $noten = new note(); + $noten->getAll(); + + $noten_arr = array(); + foreach($noten->result as $row_noten) + $noten_arr[$row_noten->note]['positiv']=$row_noten->positiv; + + $obj = new zeugnisnote(); + $ects=0; + if(!$obj->getZeugnisnoten($lehrveranstaltung_id=null, $uid, $studiensemester_kurzbz=null)) + die('Fehler beim Laden der Noten:'.$obj->errormsg); + foreach($obj->result as $row) + { + //Note darf nicht negativ oder angerechnet(6) sein + if($row->zeugnis && $row->note!=6 && isset($noten_arr[$row->note]) && $noten_arr[$row->note]['positiv']) + { + $ects += $row->ects; + } + } + return number_format($ects,2,',',''); + } +} +?> diff --git a/system/checksystem.php b/system/checksystem.php index 6bdd83f54..719d0e9c4 100644 --- a/system/checksystem.php +++ b/system/checksystem.php @@ -113,6 +113,8 @@ $berechtigungen = array( array('inout/incoming','Incomingverwaltung'), array('inout/outgoing','Outgoingverwaltung'), array('inout/uebersicht','Verbandsanzeige fuer Incoming/Outgoing im FAS'), + array('extension/budget_genehmigung','Genehmigen und Ablehnen von Budgetanträgen'), + array('extension/budget_verwaltung','Verwaltung von Budgetanträgen'), array('lehre','Berechtigung fuer CIS-Seite'), array('lehre/abgabetool','Projektabgabetool, Studentenansicht'), array('lehre/abgabetool:download','Download von Projektarbeitsabgaben'), diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index a274eb654..5b5cfe5cb 100755 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -1089,6 +1089,20 @@ if (!@$db->db_query("SELECT 0 FROM system.tbl_filters WHERE 0 = 1")) echo '
    Altered sequence system.tbl_filters_id_seq'; } +// Add missing primary Key to system.tbl_filters.filter_id +if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'pk_filters_filter_id'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = "ALTER TABLE system.tbl_filters ADD CONSTRAINT pk_filters_filter_id PRIMARY KEY (filter_id);"; + + if (!$db->db_query($qry)) + echo 'system.tbl_filters '.$db->db_last_error().'
    '; + else + echo '
    system.tbl_filters: added primary key on column filter_id'; + } +} + // UNIQUE INDEX uidx_filters_app_dataset_name_filter_kurzbz if ($result = $db->db_query("SELECT 0 FROM pg_class WHERE relname = 'uidx_filters_app_dataset_name_filter_kurzbz'")) { @@ -1205,20 +1219,6 @@ if (!$result = @$db->db_query("SELECT taetigkeit_kurzbz FROM system.tbl_log")) echo '
    Added Column taetigkeit_kurzbz to system.tbl_log'; } -// Add missing primary Key to system.tbl_filters.filter_id -if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'pk_filters_filter_id'")) -{ - if ($db->db_num_rows($result) == 0) - { - $qry = "ALTER TABLE system.tbl_filters ADD CONSTRAINT pk_filters_filter_id PRIMARY KEY (filter_id);"; - - if (!$db->db_query($qry)) - echo 'system.tbl_filters '.$db->db_last_error().'
    '; - else - echo '
    system.tbl_filters: added primary key on column filter_id'; - } -} - // Add index to tbl_akte if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_akte_dokument_kurzbz'")) { @@ -1279,6 +1279,7 @@ if($result = $db->db_query("SELECT 1 FROM system.tbl_app WHERE app='infocenter'" echo '
    Neue App infocenter in system.tbl_app hinzugefügt'; } } + // App 'bewerbung' hinzufügen if($result = $db->db_query("SELECT 1 FROM system.tbl_app WHERE app='bewerbung'")) { @@ -2029,6 +2030,55 @@ if(!@$db->db_query("SELECT cis_suche FROM campus.tbl_dms_version LIMIT 1"))
    Bei allen DMS-Einträge mit befülltem Beschreibungstext, wurde dieser in die Spalte schlagworte übernommen'; } +//--------------------------------------------------------------------------------------------------------------------- +// Start changes to Phrases + +// ADD COLUMN category to system.tbl_phrase +if (!$result = @$db->db_query("SELECT category FROM system.tbl_phrase LIMIT 1")) +{ + $qry = 'ALTER TABLE system.tbl_phrase ADD COLUMN category character varying(64);'; + if (!$db->db_query($qry)) + echo 'system.tbl_phrase: '.$db->db_last_error().'
    '; + else + echo '
    Added column category to table system.tbl_phrase'; + + // COMMENT ON TABLE system.tbl_phrase + $qry = 'COMMENT ON COLUMN system.tbl_phrase.category IS \'To divide the phrases into categories\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_phrase.category: '.$db->db_last_error().'
    '; + else + echo '
    Added comment to system.tbl_phrase.category'; +} + +// UNIQUE INDEX uidx_phrase_category_phrase +if ($result = $db->db_query("SELECT 0 FROM pg_class WHERE relname = 'uidx_phrase_category_phrase'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = 'CREATE UNIQUE INDEX uidx_phrase_category_phrase ON system.tbl_phrase USING btree (category, phrase);'; + if (!$db->db_query($qry)) + echo 'uidx_phrase_category_phrase '.$db->db_last_error().'
    '; + else + echo '
    Created unique uidx_phrase_category_phrase'; + } +} + +// UNIQUE INDEX uidx_phrasestext_phrase_id_sprache_orgeinheit_kurzbz_orgform_kurzbz +if ($result = $db->db_query("SELECT 0 FROM pg_class WHERE relname = 'uidx_phrasestext_phrase_id_sprache_orgeinheit_kurzbz_orgform_kurzbz'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = 'CREATE UNIQUE INDEX uidx_phrasestext_phrase_id_sprache_orgeinheit_kurzbz_orgform_kurzbz ON system.tbl_phrasentext USING btree (phrase_id, sprache, orgeinheit_kurzbz, orgform_kurzbz);'; + if (!$db->db_query($qry)) + echo 'uidx_phrasestext_phrase_id_sprache_orgeinheit_kurzbz_orgform_kurzbz '.$db->db_last_error().'
    '; + else + echo '
    Created unique uidx_phrasestext_phrase_id_sprache_orgeinheit_kurzbz_orgform_kurzbz'; + } +} + +// End changes to Phrases +// --------------------------------------------------------------------------------------------------------------------- + // Remove NOT NULL constraint on matrikelnr on public.tbl_student if($result = @$db->db_query("SELECT is_nullable FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'tbl_student' AND COLUMN_NAME = 'matrikelnr' AND is_nullable = 'NO'")) { @@ -2043,6 +2093,131 @@ if($result = @$db->db_query("SELECT is_nullable FROM INFORMATION_SCHEMA.COLUMNS } } +// public.vw_prestudentstatus Datum zur Reihungstestanmeldung aus tbl_rt_person +if($result = $db->db_query("SELECT view_definition FROM information_schema.views WHERE table_schema='public' AND table_name='vw_prestudentstatus'")) +{ + if($row = $db->db_fetch_object($result)) + { + if(!mb_stristr($row->view_definition, 'tbl_rt_person')) + { + $qry = " + CREATE OR REPLACE VIEW public.vw_prestudentstatus AS + SELECT tbl_prestudent.prestudent_id, + tbl_person.person_id, + tbl_person.staatsbuergerschaft, + tbl_person.geburtsnation, + tbl_person.sprache, + tbl_person.anrede, + tbl_person.titelpost, + tbl_person.titelpre, + tbl_person.nachname, + tbl_person.vorname, + tbl_person.vornamen, + tbl_person.gebdatum, + tbl_person.gebort, + tbl_person.gebzeit, + tbl_person.foto, + tbl_person.homepage, + tbl_person.svnr, + tbl_person.ersatzkennzeichen, + tbl_person.familienstand, + tbl_person.geschlecht, + tbl_person.anzahlkinder, + tbl_person.aktiv, + tbl_person.bundesland_code, + tbl_person.kompetenzen, + tbl_person.kurzbeschreibung, + tbl_person.zugangscode, + tbl_person.foto_sperre, + tbl_person.matr_nr, + tbl_prestudent.aufmerksamdurch_kurzbz, + tbl_prestudent.studiengang_kz, + tbl_prestudent.berufstaetigkeit_code, + tbl_prestudent.ausbildungcode, + tbl_prestudent.zgv_code, + tbl_prestudent.zgvort, + tbl_prestudent.zgvdatum, + tbl_prestudent.zgvmas_code, + tbl_prestudent.zgvmaort, + tbl_prestudent.zgvmadatum, + tbl_prestudent.aufnahmeschluessel, + tbl_prestudent.facheinschlberuf, + tbl_prestudent.reihungstest_id, + (SELECT + COALESCE(anmeldedatum, tbl_rt_person.insertamum::date) + FROM + public.tbl_rt_person + JOIN public.tbl_reihungstest ON(rt_id=reihungstest_id) + JOIN lehre.tbl_studienplan USING(studienplan_id) + JOIN lehre.tbl_studienordnung USING(studienordnung_id) + WHERE + person_id=tbl_prestudent.person_id + AND tbl_reihungstest.studiensemester_kurzbz=prestudentstatus.studiensemester_kurzbz + AND tbl_studienordnung.studiengang_kz=tbl_prestudent.studiengang_kz + ORDER BY anmeldedatum DESC, tbl_rt_person.insertamum DESC limit 1 + ) as anmeldungreihungstest, + tbl_prestudent.reihungstestangetreten, + tbl_prestudent.rt_gesamtpunkte, + tbl_prestudent.bismelden, + tbl_prestudent.anmerkung, + tbl_prestudent.dual, + tbl_prestudent.rt_punkte1, + tbl_prestudent.rt_punkte2, + tbl_prestudent.ausstellungsstaat, + tbl_prestudent.rt_punkte3, + tbl_prestudent.zgvdoktor_code, + tbl_prestudent.zgvdoktorort, + tbl_prestudent.zgvdoktordatum, + tbl_prestudent.mentor, + prestudentstatus.status_kurzbz, + prestudentstatus.studiensemester_kurzbz, + prestudentstatus.ausbildungssemester, + prestudentstatus.datum, + prestudentstatus.insertamum, + prestudentstatus.insertvon, + prestudentstatus.updateamum, + prestudentstatus.updatevon, + COALESCE(prestudentstatus.orgform_kurzbz, tbl_studiengang.orgform_kurzbz) AS orgform_kurzbz, + prestudentstatus.studienplan_id, + prestudentstatus.bestaetigtam, + prestudentstatus.bestaetigtvon, + prestudentstatus.fgm, + prestudentstatus.faktiv, + tbl_studiengang.kurzbz, + tbl_studiengang.kurzbzlang, + tbl_studiengang.typ, + tbl_studiensemester.start, + tbl_studiensemester.ende, + tbl_studiensemester.studienjahr_kurzbz, + substr(tbl_studiensemester.studiensemester_kurzbz::text, 3) || lower(substr(tbl_studiensemester.studiensemester_kurzbz::text, 1, 1)) AS studiensemester, + CASE + WHEN tbl_studiengang.typ = 'b'::bpchar AND tbl_prestudent.zgv_code IS NOT NULL OR tbl_studiengang.typ = 'm'::bpchar AND tbl_prestudent.zgvmas_code IS NOT NULL OR tbl_studiengang.typ = 'd'::bpchar AND tbl_prestudent.zgvdoktor_code IS NOT NULL THEN true + ELSE false + END AS zgv, + CASE + WHEN tbl_prestudentstatus.prestudent_id IS NULL THEN false + ELSE true + END AS student, + date_part('week'::text, prestudentstatus.datum) AS kw + FROM public.tbl_person + JOIN public.tbl_prestudent USING (person_id) + JOIN public.tbl_prestudentstatus prestudentstatus USING (prestudent_id) + JOIN public.tbl_studiengang USING (studiengang_kz) + JOIN public.tbl_studiensemester USING (studiensemester_kurzbz) + LEFT JOIN public.tbl_prestudentstatus ON tbl_prestudentstatus.prestudent_id = prestudentstatus.prestudent_id AND tbl_prestudentstatus.studiensemester_kurzbz::text = prestudentstatus.studiensemester_kurzbz::text AND tbl_prestudentstatus.status_kurzbz::text = 'Student'::text; + + GRANT SELECT ON public.vw_prestudentstatus TO vilesci; + GRANT SELECT ON public.vw_prestudentstatus TO web; + "; + + if(!$db->db_query($qry)) + echo 'public.vw_prestudentstatus:'.$db->db_last_error().'
    '; + else + echo '
    public.vw_prestudentstatus angepasst damit anmeldungzumreihungstest aus tbl_rt_person kommt'; + } + } +} + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

    Pruefe Tabellen und Attribute!

    '; @@ -2294,7 +2469,7 @@ $tabellen=array( "system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"), "system.tbl_logtype" => array("logtype_kurzbz", "data_schema"), "system.tbl_filters" => array("filter_id","app","dataset_name","filter_kurzbz","person_id","description","sort","default_filter","filter","oe_kurzbz"), - "system.tbl_phrase" => array("phrase_id","app","phrase","insertamum","insertvon"), + "system.tbl_phrase" => array("phrase_id","app","phrase","insertamum","insertvon","category"), "system.tbl_phrasentext" => array("phrasentext_id","phrase_id","sprache","orgeinheit_kurzbz","orgform_kurzbz","text","description","insertamum","insertvon"), "system.tbl_rolle" => array("rolle_kurzbz","beschreibung"), "system.tbl_rolleberechtigung" => array("berechtigung_kurzbz","rolle_kurzbz","art"),
    ID