diff --git a/application/config/constants.php b/application/config/constants.php index ef4cdaf2c..f21b6c962 100644 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -31,6 +31,13 @@ define('EXIT_VALIDATION_UDF_NOT_VALID_VAL', 17); // UDF validation has been fail define('EXIT_AUTO_MIN', 1000); // lowest automatically-assigned error code define('EXIT_AUTO_MAX', 2000); // highest automatically-assigned error code +/* +|-------------------------------------------------------------------------- +| General purpose +|-------------------------------------------------------------------------- +*/ +define('BEGINNING_OF_TIME', '1970-01-01'); + /* |-------------------------------------------------------------------------- | Authentication constants diff --git a/application/config/jqm.php b/application/config/jqm.php new file mode 100644 index 000000000..43cc1c038 --- /dev/null +++ b/application/config/jqm.php @@ -0,0 +1,14 @@ + array( + 'admin:rw', + 'developer:rw' + ), + 'OEHPayment' => 'developer:rw', + 'SAPPayment' => 'developer:rw' +); + diff --git a/application/config/navigation.php b/application/config/navigation.php index a89c259ee..84004b58e 100644 --- a/application/config/navigation.php +++ b/application/config/navigation.php @@ -109,6 +109,13 @@ $config['navigation_header'] = array( 'expand' => true, 'sort' => 20, 'requiredPermissions' => 'system/developer:r' + ), + 'jobsqueueviewer' => array( + 'link' => site_url('system/jq/JobsQueueViewer'), + 'description' => 'Jobs Queue Viewer', + 'expand' => true, + 'sort' => 20, + 'requiredPermissions' => 'system/developer:r' ) ) ) diff --git a/application/controllers/jobs/LehrauftragJob.php b/application/controllers/jobs/LehrauftragJob.php index 2f6b928c7..4ba327a2f 100644 --- a/application/controllers/jobs/LehrauftragJob.php +++ b/application/controllers/jobs/LehrauftragJob.php @@ -20,31 +20,31 @@ class LehrauftragJob extends JOB_Controller { const BERECHTIGUNG_LEHRAUFTRAG_ERTEILEN = 'lehre/lehrauftrag_erteilen'; const BERECHTIGUNG_LEHRAUFTRAG_AKZEPTIEREN = 'lehre/lehrauftrag_akzeptieren'; - + const LEHRAUFTRAG_ERTEILEN_URI = 'lehre/lehrauftrag/LehrauftragErteilen'; const LEHRAUFTRAG_AKZEPTIEREN_URI = '/lehre/lehrauftrag/LehrauftragAkzeptieren'; - + /** * Constructor */ public function __construct() { parent::__construct(); - + // Load models $this->load->model('accounting/Vertrag_model', 'VertragModel'); $this->load->model('accounting/Vertragvertragsstatus_model', 'VertragvertragsstatusModel'); $this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel'); $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); $this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel'); - + // Load libraries $this->load->library('PermissionLib'); - + // Load helpers $this->load->helper('hlp_sancho_helper'); } - + /** * This daily job sends information about all lehr-/projektauftraege ordered (and not approved) the day bofore. * Receivers: Department-/Kompetenzfeldleiter @@ -62,7 +62,7 @@ class LehrauftragJob extends JOB_Controller foreach ($vertrag_arr as $vertrag) { $result = $this->VertragModel->getLehreinheitData($vertrag->vertrag_id, 'lehrveranstaltung_id, studiensemester_kurzbz'); - + if (hasData($result)) { $obj = new StdClass(); @@ -72,7 +72,7 @@ class LehrauftragJob extends JOB_Controller } } } - + /** * Build the data array to be used in the email. Data array is clustered as follows: * Array @@ -90,7 +90,7 @@ class LehrauftragJob extends JOB_Controller foreach ($lehreinheit_data_arr as $lehreinheit_data) { $result = $this->_getLVData($lehreinheit_data->lehrveranstaltung_id); - + if (hasData($result)) { // Search if studiensemester exists in data_arr @@ -102,12 +102,12 @@ class LehrauftragJob extends JOB_Controller $data = array( 'studiensemester_kurzbz' => $lehreinheit_data->studiensemester_kurzbz ); - + $data []= array( 'oe_kurzbz' => $result->retval[0]->oe_kurzbz, 'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung ); - + // Add stg data to oe, start amount with 1 $data[0][] = array( 'stg_kz' => $result->retval[0]->studiengang_kz, @@ -115,7 +115,7 @@ class LehrauftragJob extends JOB_Controller 'stg_bezeichnung' => $result->retval[0]->lv_stg_bezeichnung, 'amount' => 1 ); - + // Push to final data_arr $data_arr []= $data; } @@ -124,7 +124,7 @@ class LehrauftragJob extends JOB_Controller { // Search if oe exists inside existing studiensemester of data_arr $oe_index = array_search($result->retval[0]->oe_kurzbz, array_column($data_arr[$ss_index], 'oe_kurzbz')); - + // If oe is new, add oe and stg to studiensemester if ($oe_index === false) { @@ -132,7 +132,7 @@ class LehrauftragJob extends JOB_Controller $data_arr[$ss_index][] = array( 'oe_kurzbz' => $result->retval[0]->oe_kurzbz, 'oe_bezeichnung' => $result->retval[0]->lv_oe_bezeichnung, - + // Add stg data to oe, start amount with 1 array( 'stg_kz' => $result->retval[0]->studiengang_kz, @@ -147,7 +147,7 @@ class LehrauftragJob extends JOB_Controller { // Search if stg exists inside existing oe of data_arr $stg_index = array_search($result->retval[0]->studiengang_kz, array_column($data_arr[$ss_index][$oe_index], 'stg_kz')); - + // If stg is new, add stg to oe, start amount with 1 if ($stg_index === false) { @@ -168,7 +168,7 @@ class LehrauftragJob extends JOB_Controller } } } - + /** * Cluster data by uid of entitled mail receivers. * Returning array is clustered as follows: @@ -186,7 +186,7 @@ class LehrauftragJob extends JOB_Controller * [amount] // amount of new ordered lehrauftraege of that stg */ $data_arr = $this->_clusterData_byReceiver($data_arr); - + // Send email if(!$this->_sendMail_toApprove($data_arr)) { @@ -197,7 +197,7 @@ class LehrauftragJob extends JOB_Controller $this->logError('Error when sending emails in job MailLehrauftragToApprove'); } } - + /** * This daily job sends information about all lehr-/projektauftraege approved the day bofore. * Receivers: lectors @@ -208,7 +208,7 @@ class LehrauftragJob extends JOB_Controller $this->VertragvertragsstatusModel->addSelect('vertrag_id, uid'); $this->VertragvertragsstatusModel->addOrder('uid'); $result = $this->VertragvertragsstatusModel->getApproved_fromDate('YESTERDAY'); - + /** * Build the data array to be used in the email. Data array is clustered as follows: * Array @@ -228,10 +228,10 @@ class LehrauftragJob extends JOB_Controller { $studiensemester = $studiensemester[0]->vertragsstunden_studiensemester_kurzbz; } - + // Search if uid exists in data_arr $uid_index = array_search($vertrag->uid, array_column($data_arr, 'uid')); - + // If uid is new, add uid, studiensemester and start amount with 1 if ($uid_index === false) { @@ -249,7 +249,7 @@ class LehrauftragJob extends JOB_Controller { $data_arr[$uid_index]['studiensemester'] .= ' und '. $studiensemester; } - + // Increase amount +1 $data_arr[$uid_index]['amount']++; } @@ -266,11 +266,11 @@ class LehrauftragJob extends JOB_Controller $this->logError('Error when sending emails in job MailLehrauftragToAccept'); } } - + //****************************************************************************************************************** // PRIVATE FUNCTIONS //****************************************************************************************************************** - + /** * Get data of given lehrveranstaltung. * @param $lehrveranstaltung_id @@ -286,7 +286,7 @@ class LehrauftragJob extends JOB_Controller stg.typ AS "stg_typ", stg.kurzbz AS "stg_kurzbz" '); - + $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan_lehrveranstaltung stpllv', 'lehrveranstaltung_id'); $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienplan stpl', 'studienplan_id'); $this->LehrveranstaltungModel->addJoin('lehre.tbl_studienordnung sto', 'studienordnung_id'); @@ -294,10 +294,10 @@ class LehrauftragJob extends JOB_Controller $this->LehrveranstaltungModel->addJoin('public.tbl_organisationseinheit oe', 'ON oe.oe_kurzbz = tbl_lehrveranstaltung.oe_kurzbz'); $this->LehrveranstaltungModel->addOrder('stpllv.insertamum', 'DESC'); $this->LehrveranstaltungModel->addLimit(1); - + return $this->LehrveranstaltungModel->load($lehrveranstaltung_id); } - + /** * Send Sancho eMail about ordered Lehrauftraege. * @param $data_arr @@ -310,12 +310,12 @@ class LehrauftragJob extends JOB_Controller // Set mail recipients (department assistance/leader) $to = $data['uid']. '@'. DOMAIN; $html_table = $this->_renderData_LehrauftraegeToApprove($data); - + // Prepare mail content $content_data_arr = array( 'table' => $html_table ); - + sendSanchoMail( 'LehrauftragNeueBestellungen', $content_data_arr, @@ -326,7 +326,7 @@ class LehrauftragJob extends JOB_Controller ); } } - + /** * Cluster the data array by entitled mail receiver. * Returning array is clustered as follows: @@ -409,7 +409,7 @@ class LehrauftragJob extends JOB_Controller return $mail_data_arr; } - + /** * Render the data array for the mail template returing a HTML table. * @param $data_arr Data to be used in HTML table @@ -425,11 +425,11 @@ class LehrauftragJob extends JOB_Controller if (isset($studiensemester_container['studiensemester_kurzbz'])) { $studiensemester = $studiensemester_container['studiensemester_kurzbz']; - + // Link to LehrauftragErteilen $url = site_url(self::LEHRAUFTRAG_ERTEILEN_URI).'?studiensemester='. $studiensemester; } - + // HTML table header $html .= '
@@ -446,7 +446,7 @@ class LehrauftragJob extends JOB_Controller ' ; - + // HTML table body foreach ($studiensemester_container as $oe_container) { @@ -456,7 +456,7 @@ class LehrauftragJob extends JOB_Controller { $oe_bezeichnung = $oe_container['oe_bezeichnung']; } - + foreach ($oe_container as $stg_data) { if (is_array($stg_data)) // is_array 'trims' the outer associative keys [oe_kurzbz] and [oe_bezeichnung] @@ -473,7 +473,7 @@ class LehrauftragJob extends JOB_Controller } } } - + // HTML table body end and link $html .= ' @@ -484,10 +484,10 @@ class LehrauftragJob extends JOB_Controller '; } } - + return $html; } - + /** * Send Sancho eMail about ordered Lehrauftraege. * @param $data_arr @@ -499,24 +499,24 @@ class LehrauftragJob extends JOB_Controller { // Set mail recipient (lector) $to = $data['uid']. '@'. DOMAIN; - + // Link to LehrauftragAkzeptieren $url = CIS_ROOT. 'cis/index.php?menu='. CIS_ROOT. 'cis/menu.php?content_id=&content='. CIS_ROOT. index_page(). self::LEHRAUFTRAG_AKZEPTIEREN_URI; - + // Get first name $first_name = ''; $this->load->model('person/Benutzer_model', 'BenutzerModel'); $this->BenutzerModel->addSelect('vorname'); $this->BenutzerModel->addJoin('public.tbl_person', 'person_id'); $result = $this->BenutzerModel->loadWhere(array('uid' => $data['uid'])); - + if (hasData($result)) { $first_name = $result->retval[0]->vorname; } - + // Prepare mail content $content_data_arr = array( 'vorname' => $first_name, @@ -524,7 +524,7 @@ class LehrauftragJob extends JOB_Controller 'anzahl' => $data['amount'], 'link' => anchor($url, 'Lehraufträge Übersicht') ); - + sendSanchoMail( 'LehrauftragNeueErteilte', $content_data_arr, @@ -532,5 +532,6 @@ class LehrauftragJob extends JOB_Controller 'Neu erteilte Lehraufträge zum Annehmen bereit' ); } + return true; } } diff --git a/application/controllers/jobs/OneTimeMessages.php b/application/controllers/jobs/OneTimeMessages.php index 39e0a946c..58bc1fb7c 100644 --- a/application/controllers/jobs/OneTimeMessages.php +++ b/application/controllers/jobs/OneTimeMessages.php @@ -27,11 +27,11 @@ class OneTimeMessages extends JOB_Controller * - Status set as "Wartender" * - The given study course type (b = bachelor, m = master) * - The given semester (ex WS2020) - * - How long since applicant (months) + * - How long since applicant (days) * - The given template id to be used as message subject and body (vorlage_kurzbz) * The sender of all the messages is specified by the parameter senderId (sender person_id) */ - public function sendMessageToApplicantsStillWaiting($senderId, $studyCourseType, $semester, $months, $messageTemplate) + public function sendMessageToApplicantsStillWaiting($senderId, $studyCourseType, $semester, $days, $messageTemplate) { $this->logInfo('Send message to applicants still waiting start'); @@ -47,13 +47,13 @@ class OneTimeMessages extends JOB_Controller $dbModel = new DB_Model(); $dbPrestudents = $dbModel->execReadOnlyQuery( - 'SELECT p.prestudent_id + 'SELECT distinct on(person_id) p.prestudent_id FROM public.tbl_prestudent p JOIN public.tbl_prestudentstatus ps USING (prestudent_id) JOIN public.tbl_studiengang s USING (studiengang_kz) WHERE ps.status_kurzbz = \'Wartender\' AND ps.studiensemester_kurzbz = ? - AND ps.datum <= NOW() - \''.$months.' months\'::interval + AND ps.datum <= NOW() - \''.$days.' days\'::interval AND s.typ = ? AND NOT EXISTS ( SELECT pp.person_id diff --git a/application/controllers/lehre/Pruefungsprotokoll.php b/application/controllers/lehre/Pruefungsprotokoll.php new file mode 100644 index 000000000..467a7dc71 --- /dev/null +++ b/application/controllers/lehre/Pruefungsprotokoll.php @@ -0,0 +1,232 @@ + 'lehre/pruefungsbeurteilung:r', + 'Protokoll' => 'lehre/pruefungsbeurteilung:r', + 'saveProtokoll' => 'lehre/pruefungsbeurteilung:rw', + ) + ); + + // Load models + $this->load->model('education/Abschlusspruefung_model', 'AbschlusspruefungModel'); + $this->load->model('education/Abschlussbeurteilung_model', 'AbschlussbeurteilungModel'); + + $this->load->library('PermissionLib'); + $this->load->library('AuthLib'); + + // Load language phrases + $this->loadPhrases( + array( + 'ui', + 'global', + 'person', + 'abschlusspruefung', + 'password', + 'lehre' + ) + ); + + $this->_setAuthUID(); // sets property uid + + $this->setControllerId(); // sets the controller id + } + + // ----------------------------------------------------------------------------------------------------------------- + // Public methods + public function index() + { + $this->load->library('WidgetLib'); + + // Protokolle anzeigen seit heute / letzte Woche / alle + $period = $this->input->post('period'); + $period = (!is_null($period)) ? $period : 'today'; + + $data = array('period' => $period); + + $this->load->view('lehre/pruefungsprotokollUebersicht.php', $data); + } + + /** + * Show Pruefungsprotokoll. + */ + public function Protokoll() + { + $abschlusspruefung_id = $this->input->get('abschlusspruefung_id'); + + if (!is_numeric($abschlusspruefung_id)) + show_error('invalid abschlusspruefung'); + + $abschlusspruefung_saved = false; + $abschlusspruefung = $this->_getAbschlusspruefungBerechtigt($abschlusspruefung_id); + + if (isError($abschlusspruefung)) + show_error(getError($abschlusspruefung)); + else + { + $abschlusspruefung = getData($abschlusspruefung); + $abschlusspruefung_saved = isset($abschlusspruefung->protokoll) && isset($abschlusspruefung->abschlussbeurteilung_kurzbz); + } + + $this->AbschlussbeurteilungModel->addOrder("sort", "ASC"); + $this->AbschlussbeurteilungModel->addOrder("(CASE WHEN abschlussbeurteilung_kurzbz = 'ausgezeichnet' THEN 1 + WHEN abschlussbeurteilung_kurzbz = 'gut' THEN 2 + WHEN abschlussbeurteilung_kurzbz = 'bestanden' THEN 3 + WHEN abschlussbeurteilung_kurzbz = 'angerechnet' THEN 4 + ELSE 5 + END + )"); + $abschlussbeurteilung = $this->AbschlussbeurteilungModel->load(); + + if (isError($abschlussbeurteilung)) + show_error(getError($abschlussbeurteilung)); + else + $abschlussbeurteilung = getData($abschlussbeurteilung); + + $language = getUserLanguage(); + + $data = array( + 'abschlusspruefung' => $abschlusspruefung, + 'abschlussbeurteilung' => $abschlussbeurteilung, + 'abschlusspruefung_saved' => $abschlusspruefung_saved, + 'language' => $language + ); + + $this->load->view('lehre/pruefungsprotokoll.php', $data); + } + + /** + * Save Pruefungsprotokoll (including possible Freigabe) + */ + public function saveProtokoll() + { + $abschlusspruefung_id = $this->input->post('abschlusspruefung_id'); + $freigebendata = $this->input->post('freigebendata'); + $protocoldata = $this->input->post('protocoldata'); + + if (isset($abschlusspruefung_id) && is_numeric($abschlusspruefung_id) + && isset($freigebendata['freigeben']) && isset($protocoldata)) + { + // check permission + $berechtigt = $this->_getAbschlusspruefungBerechtigt($abschlusspruefung_id); + if (isError($berechtigt)) + $this->outputJsonError(getError($berechtigt)); + else + { + $freigabe = $freigebendata['freigeben'] === 'true'; + + if ($freigabe) + { + // Verify password + if (isset($freigebendata['password']) && !isEmptyString($freigebendata['password'])) + { + $password = $freigebendata['password']; + $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password); + if (isError($result)) + { + return $this->outputJsonError($this->p->t('password', 'wrongPassword')); // exit if password is incorrect + } + } + else + { + return $this->outputJsonError($this->p->t('password', 'passwordMissing')); + } + } + + $data = $this->_prepareAbschlusspruefungDataForSave($protocoldata, $freigabe); + + $result = $this->AbschlusspruefungModel->update($abschlusspruefung_id, $data); + + if (hasData($result)) + { + $abschlusspruefung_id = getData($result); + $updateresult = array('abschlusspruefung_id' => $abschlusspruefung_id); + if ($freigabe) + $updateresult['freigabedatum'] = date_format(date_create($data['freigabedatum']), 'd.m.Y'); + + $this->outputJsonSuccess($updateresult); + } + else + $this->outputJsonError('Fehler beim Speichern des Prüfungsprotokolls'); + } + } + else + $this->outputJsonError($this->p->t('ui', 'ungueltigeParameter')); + } + + // ----------------------------------------------------------------------------------------------------------------- + // Private methods + + /** + * Retrieve the UID of the logged user and checks if it is valid + */ + private function _setAuthUID() + { + $this->_uid = getAuthUID(); + + if (!$this->_uid) show_error('User authentification failed'); + } + + /** + * Retrieves an Abschlussprüfung, with permission check + * permission: admin, assistance of study programe or Vorsitz of the Prüfung + * @param $abschlusspruefung_id + * @return object success or error + */ + private function _getAbschlusspruefungBerechtigt($abschlusspruefung_id) + { + $result = error('Error when getting Abschlusspruefung'); + + if (isset($this->_uid)) + { + $abschlusspruefung = $this->AbschlusspruefungModel->getAbschlusspruefung($abschlusspruefung_id); + + if (hasData($abschlusspruefung)) + { + $abschlusspruefung_data = getData($abschlusspruefung); + if ($this->permissionlib->isBerechtigt('admin') || + (isset($abschlusspruefung_data->studiengang_kz) && $this->permissionlib->isBerechtigt('assistenz', 'suid', $abschlusspruefung_data->studiengang_kz)) + || $this->_uid === $abschlusspruefung_data->uid_vorsitz) + $result = $abschlusspruefung; + else + $result = error('Permission denied'); + } + } + + return $result; + } + + /** + * Prepares Abschlussprüfung for save in database, replaces '' with null, sets Freigabedatum + * @param $data + * @return array + */ + private function _prepareAbschlusspruefungDataForSave($data, $freigabe) + { + $nullfields = array('uhrzeit', 'endezeit', 'abschlussbeurteilung_kurzbz', 'protokoll'); + foreach ($data as $idx => $item) + { + if (in_array($idx, $nullfields) & $item === '') + $data[$idx] = null; + } + + if ($freigabe === true) + $data['freigabedatum'] = date('Y-m-d'); + + return $data; + } +} diff --git a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php index b7140c7c3..8a096338e 100644 --- a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php +++ b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php @@ -92,7 +92,8 @@ class Lehrauftrag extends Auth_Controller // Retrieve studiengaenge the user is entitled for to populate studiengang dropdown if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_LEHRAUFTRAG_BESTELLEN)) { - show_error('Fehler bei Berechtigungsprüfung'); + show_error('Keine Studiengänge gefunden.
+ Es muss eine passende Organisationseinheit hinterlegt werden.
'); } // If studiengang_kz get param was set, check against entitled stg diff --git a/application/controllers/system/LogsViewer.php b/application/controllers/system/LogsViewer.php index 8caf9f3a7..4e39db5e3 100644 --- a/application/controllers/system/LogsViewer.php +++ b/application/controllers/system/LogsViewer.php @@ -35,7 +35,7 @@ class LogsViewer extends Auth_Controller // Public methods /** - * Main page of the InfoCenter tool + * Everything has a beginning */ public function index() { diff --git a/application/controllers/system/jq/JobsQueueManager.php b/application/controllers/system/jq/JobsQueueManager.php new file mode 100644 index 000000000..e72607675 --- /dev/null +++ b/application/controllers/system/jq/JobsQueueManager.php @@ -0,0 +1,130 @@ + 'admin:r', + 'addNewJobsToQueue' => 'admin:rw', + 'updateJobsQueue' => 'admin:rw' + ) + ); + + // Loading config file jqm + $this->config->load('jqm'); + + // Loads JobsQueueLib + $this->load->library('JobsQueueLib'); + // Loads permission lib + $this->load->library('PermissionLib'); + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * To get all the most recently added jobs using the given job type + */ + public function getLastJobs() + { + $type = $this->input->get(JobsQueueLib::PROPERTY_TYPE); + + $this->_checkPermissions($type); + + $this->outputJson($this->jobsqueuelib->getLastJobs($type)); + } + + /** + * Add new jobs in the jobs queue with the given type + * jobs is an array of job objects + */ + public function addNewJobsToQueue() + { + $type = $this->input->post(JobsQueueLib::PROPERTY_TYPE); + $jobs = $this->input->post(self::PARAM_JOBS); + + $this->_checkPermissions($type); + + // Otherwise convert jobs from json to php and call JobsQueueLib library + $this->outputJson($this->jobsqueuelib->addNewJobsToQueue($type, $this->_convertJobs($jobs))); + } + + /** + * Add new jobs in the jobs queue with the given type + * jobs is an array of job objects + */ + public function updateJobsQueue() + { + $type = $this->input->post(JobsQueueLib::PROPERTY_TYPE); + $jobs = $this->input->post(self::PARAM_JOBS); + + $this->_checkPermissions($type); + + // Otherwise convert jobs from json to php and call JobsQueueLib library + $this->outputJson($this->jobsqueuelib->updateJobsQueue($type, $this->_convertJobs($jobs))); + } + + //------------------------------------------------------------------------------------------------------------------ + // Private methods + + /** + * + */ + private function _checkPermissions($type) + { + // Checks if the caller has the permissions to add new jobs with the given type in the queue + if (!$this->permissionlib->isEntitled($this->config->item(self::JOB_TYPE_PERMISSIONS_WHITE_LIST), $type)) + { + // Permissions NOT valid + $this->terminateWithJsonError('You are not allowed to access to this content'); + } + } + + /** + * + */ + private function _convertJobs($jobs) + { + if (isEmptyArray($jobs)) return null; // if not a valid array then return null + + $convertedJobsArray = array(); // returned values + + // Loops through all the provided jobs + foreach ($jobs as $job) + { + $tmpObj = json_decode($job); // Try to decode json to php + + // If decode was a success + if ($tmpObj != null) + { + $convertedJobsArray[] = $tmpObj; // then store the decoded object in the result array + } + else // otherwise + { + // Create a new object and store the error message in it + $tmpObj = new stdClass(); + $tmpObj->{JobsQueueLib::PROPERTY_ERROR} = 'A not valid json was provided'; + + $convertedJobsArray[] = $tmpObj; // store this object into the result array + } + } + + return $convertedJobsArray; + } +} diff --git a/application/controllers/system/jq/JobsQueueViewer.php b/application/controllers/system/jq/JobsQueueViewer.php new file mode 100644 index 000000000..2698d79d1 --- /dev/null +++ b/application/controllers/system/jq/JobsQueueViewer.php @@ -0,0 +1,51 @@ + 'system/developer:r' + ) + ); + + // Loads WidgetLib + $this->load->library('WidgetLib'); + + // Loads JobsQueueLib + $this->load->library('JobsQueueLib'); + + // Loads phrases system + $this->loadPhrases( + array( + 'global', + 'ui', + 'filter' + ) + ); + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * Everything has a beginning + */ + public function index() + { + $this->load->view('system/jq/jobsQueueViewer.php'); + } +} diff --git a/application/core/CLI_Controller.php b/application/core/CLI_Controller.php index 79e2a1283..7e1e2a1ab 100644 --- a/application/core/CLI_Controller.php +++ b/application/core/CLI_Controller.php @@ -3,7 +3,8 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); /** - * + * This is the super class for all those controllers that can only be called from command line + * It provides also an helper to display the possible calls */ abstract class CLI_Controller extends FHC_Controller { @@ -15,9 +16,9 @@ abstract class CLI_Controller extends FHC_Controller /** * Constructor */ - public function __construct() + public function __construct() { - parent::__construct(); + parent::__construct(); // Checks if the controller is called from command line $this->_isAllowed(); @@ -103,3 +104,4 @@ abstract class CLI_Controller extends FHC_Controller } } } + diff --git a/application/core/JOB_Controller.php b/application/core/JOB_Controller.php index ea779b169..8b32ba0f5 100644 --- a/application/core/JOB_Controller.php +++ b/application/core/JOB_Controller.php @@ -3,26 +3,36 @@ if (!defined('BASEPATH')) exit('No direct script access allowed'); /** - * + * This is the super class for a job. + * All the controllers that extends this class can only be called from command line. + * Provides utility methods to log into database */ abstract class JOB_Controller extends CLI_Controller { /** * Constructor */ - public function __construct() + public function __construct() { - parent::__construct(); + parent::__construct(); // Loads LogLib with different debug trace levels to get data of the job that extends this class // It also specify parameters to set database fields - $this->load->library('LogLib', array( - 'classIndex' => 5, - 'functionIndex' => 5, - 'lineIndex' => 4, - 'dbLogType' => 'job', // required - 'dbExecuteUser' => 'Cronjob system' - )); + $this->load->library( + 'LogLib', + array( + 'classIndex' => 5, + 'functionIndex' => 5, + 'lineIndex' => 4, + 'dbLogType' => 'job', // required + 'dbExecuteUser' => 'Cronjob system', + 'requestId' => 'JOB', + 'requestDataFormatter' => function($data) { + return json_encode($data); + } + ), + 'LogLibJob' // library alias case sensitive + ); } //------------------------------------------------------------------------------------------------------------------ @@ -33,7 +43,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logInfo($response, $parameters = null) { - $this->_log(LogLib::INFO, 'Cronjob info', $response, $parameters); + $this->_log(LogLib::INFO, $response, $parameters); } /** @@ -41,7 +51,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logDebug($response, $parameters = null) { - $this->_log(LogLib::DEBUG, 'Cronjob debug', $response, $parameters); + $this->_log(LogLib::DEBUG, $response, $parameters); } /** @@ -49,7 +59,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logWarning($response, $parameters = null) { - $this->_log(LogLib::WARNING, 'Cronjob warning', $response, $parameters); + $this->_log(LogLib::WARNING, $response, $parameters); } /** @@ -57,7 +67,7 @@ abstract class JOB_Controller extends CLI_Controller */ protected function logError($response, $parameters = null) { - $this->_log(LogLib::ERROR, 'Cronjob error', $response, $parameters); + $this->_log(LogLib::ERROR, $response, $parameters); } //------------------------------------------------------------------------------------------------------------------ @@ -66,7 +76,7 @@ abstract class JOB_Controller extends CLI_Controller /** * Writes a log to database */ - private function _log($level, $requestId, $response, $parameters) + private function _log($level, $response, $parameters) { $data = new stdClass(); @@ -76,17 +86,18 @@ abstract class JOB_Controller extends CLI_Controller switch($level) { case LogLib::INFO: - $this->loglib->logInfoDB($requestId, json_encode(success($data, LogLib::INFO))); + $this->LogLibJob->logInfoDB($data); break; case LogLib::DEBUG: - $this->loglib->logDebugDB($requestId, json_encode(success($data, LogLib::DEBUG))); + $this->LogLibJob->logDebugDB($data); break; case LogLib::WARNING: - $this->loglib->logWarningDB($requestId, json_encode(error($data, LogLib::WARNING))); + $this->LogLibJob->logWarningDB($data); break; case LogLib::ERROR: - $this->loglib->logErrorDB($requestId, json_encode(error($data, LogLib::ERROR))); + $this->LogLibJob->logErrorDB($data); break; } } } + diff --git a/application/core/JQW_Controller.php b/application/core/JQW_Controller.php new file mode 100644 index 000000000..72a2a972b --- /dev/null +++ b/application/core/JQW_Controller.php @@ -0,0 +1,129 @@ +LogLibJob->setConfigs( + array( + 'dbExecuteUser' => 'Jobs queue system', + 'requestId' => 'JQW' + ) + ); + + // Loads JobsQueueLib library + $this->load->library('JobsQueueLib'); + } + + //------------------------------------------------------------------------------------------------------------------ + // Protected methods + + /** + * To get all the most recently added jobs using the given job type + */ + protected function getLastJobs($type) + { + $jobs = $this->jobsqueuelib->getLastJobs($type); + + // If an error occurred then log it in database + if (isError($jobs)) $this->logError(getError($jobs), $type); + + return $jobs; + } + + /** + * To get all the jobs specified by the given parameters + */ + protected function getJobsByTypeStatusInput($type, $status, $input) + { + $jobs = $this->jobsqueuelib->getJobsByTypeStatusInput($type, $status, $input); + + // If an error occurred then log it in database + if (isError($jobs)) $this->logError(getError($jobs), array($type, $status, $input)); + + return $jobs; + } + + /** + * Add new jobs in the jobs queue with the given type + * jobs is an array of job objects + */ + protected function addNewJobsToQueue($type, $jobs) + { + $result = $this->jobsqueuelib->addNewJobsToQueue($type, $jobs); + + // If an error occurred then log it in database + if (isError($result)) $this->logError(getError($result), $type); + + return $result; + } + + /** + * Updates jobs already present in the jobs queue + * jobs is an array of job objects + */ + protected function updateJobsQueue($type, $jobs) + { + $result = $this->jobsqueuelib->updateJobsQueue($type, $jobs); + + // If an error occurred then log it in database + if (isError($result)) $this->logError(getError($result), $type); + + return $result; + } + + /** + * Utility method to update the specified properties of the given jobs with the given values + */ + protected function updateJobs($jobs, $properties, $values) + { + // If not valid arrays of properties and values arrays are not of the same size then exit + if (isEmptyArray($jobs) || isEmptyArray($properties) || isEmptyArray($values)) return; + if (count($properties) != count($values)) return; + + // For each job + foreach ($jobs as $job) + { + // For each propery of the job + for ($pI = 0; $pI < count($properties); $pI++) + { + // If this property is present in the job object + if (property_exists($job, $properties[$pI])) + { + $job->{$properties[$pI]} = $values[$pI]; // set a new value + } + } + } + } + + /** + * Utility method to generate a job with the given parameters and return it inside an array + * ready to be used by addNewJobsToQueue and updateJobsQueue + */ + protected function generateJobs($status, $input) + { + $job = new stdClass(); + + $job->{JobsQueueLib::PROPERTY_STATUS} = $status; + $job->{JobsQueueLib::PROPERTY_INPUT} = $input; + + return array($job); + } +} + diff --git a/application/helpers/hlp_common_helper.php b/application/helpers/hlp_common_helper.php index 6a2675a04..a7eda8827 100644 --- a/application/helpers/hlp_common_helper.php +++ b/application/helpers/hlp_common_helper.php @@ -301,3 +301,45 @@ function isLogged() return isset($ci->authlib) && $ci->authlib->getAuthObj() != null; } + +/** + * Konvertiert Problematische Sonderzeichen in Strings fuer + * Accountnamen und EMail-Aliase + * + * @param $str + * @return bereinigter String + */ +function sanitizeProblemChars($str) +{ + $enc = 'UTF-8'; + + $acentos = array( + 'A' => '/À|Á|Â|Ã|Å/', + 'Ae' => '/Ä/', + 'a' => '/à|á|â|ã|å/', + 'ae'=> '/ä/', + 'C' => '/Ç/', + 'c' => '/ç/', + 'E' => '/È|É|Ê|Ë/', + 'e' => '/è|é|ê|ë/', + 'I' => '/Ì|Í|Î|Ï/', + 'i' => '/ì|í|î|ï/', + 'N' => '/Ñ/', + 'n' => '/ñ/', + 'O' => '/Ò|Ó|Ô|Õ/', + 'Oe' => '/Ö/', + 'o' => '/ò|ó|ô|õ/', + 'oe' => '/ö/', + 'U' => '/Ù|Ú|Û/', + 'Ue' => '/Ü/', + 'u' => '/ù|ú|û/', + 'ue' => '/ü/', + 'Y' => '/Ý/', + 'y' => '/ý|ÿ/', + 'a.' => '/ª/', + 'o.' => '/º/', + 'ss' => '/ß/' + ); + + return preg_replace($acentos, array_keys($acentos), htmlentities($str,ENT_NOQUOTES, $enc)); +} diff --git a/application/libraries/FilterWidgetLib.php b/application/libraries/FilterWidgetLib.php index 6e87833bd..0a4526680 100644 --- a/application/libraries/FilterWidgetLib.php +++ b/application/libraries/FilterWidgetLib.php @@ -93,6 +93,8 @@ class FilterWidgetLib const OP_NOT_SET = 'nset'; // Filter options values + const OPT_MINUTES = 'minutes'; + const OPT_HOURS = 'hours'; const OPT_DAYS = 'days'; const OPT_MONTHS = 'months'; @@ -884,8 +886,10 @@ class FilterWidgetLib // It it's a date type if (is_numeric($filterDefinition->condition) && isset($filterDefinition->option) - && ($filterDefinition->option == self::OPT_DAYS - || $filterDefinition->option == self::OPT_MONTHS)) + && ($filterDefinition->option == self::OPT_HOURS + || $filterDefinition->option == self::OPT_DAYS + || $filterDefinition->option == self::OPT_MONTHS + || $filterDefinition->option == self::OPT_MINUTES)) { $condition = '< (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)'; } @@ -899,8 +903,10 @@ class FilterWidgetLib // It it's a date type if (is_numeric($filterDefinition->condition) && isset($filterDefinition->option) - && ($filterDefinition->option == self::OPT_DAYS - || $filterDefinition->option == self::OPT_MONTHS)) + && ($filterDefinition->option == self::OPT_HOURS + || $filterDefinition->option == self::OPT_DAYS + || $filterDefinition->option == self::OPT_MONTHS + || $filterDefinition->option == self::OPT_MINUTES)) { $condition = '> (NOW() - \''.$filterDefinition->condition.' '.$filterDefinition->option.'\'::interval)'; } diff --git a/application/libraries/JobsQueueLib.php b/application/libraries/JobsQueueLib.php new file mode 100644 index 000000000..0eb7c9b72 --- /dev/null +++ b/application/libraries/JobsQueueLib.php @@ -0,0 +1,370 @@ +_ci =& get_instance(); + + // Loads all needed models + $this->_ci->load->model('system/JobsQueue_model', 'JobsQueueModel'); + $this->_ci->load->model('system/JobTypes_model', 'JobTypesModel'); + $this->_ci->load->model('system/JobStatuses_model', 'JobStatusesModel'); + $this->_ci->load->model('system/JobTriggers_model', 'JobTriggersModel'); + } + + //------------------------------------------------------------------------------------------------------------------ + // Public methods + + /** + * To get all the most recently added jobs using the given job type + */ + public function getLastJobs($type) + { + $this->_ci->JobsQueueModel->resetQuery(); + + $this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC'); + + return $this->_ci->JobsQueueModel->loadWhere(array('status' => self::STATUS_NEW, 'type' => $type)); + } + + /** + * To get all the jobs specified by the given parameters + */ + public function getJobsByTypeStatusInput($type, $status, $input) + { + $this->_ci->JobsQueueModel->resetQuery(); + + $this->_ci->JobsQueueModel->addOrder('creationtime', 'DESC'); + + return $this->_ci->JobsQueueModel->loadWhere(array('status' => $status, 'type' => $type, 'input' => $input)); + } + + /** + * Add new jobs in the jobs queue with the given type + * jobs is an array of job objects + */ + public function addNewJobsToQueue($type, $jobs) + { + // Checks parameters + if (isEmptyString($type)) return error('The provided type parameter is not a valid string'); + if (isEmptyArray($jobs)) return error('The provided jobs parameter is not a valid array'); + + // Get all the job types + $dbResult = $this->_ci->JobTypesModel->load(); + if (isError($dbResult)) return $dbResult; + $types = getData($dbResult); + + // If the given type is not present in database + if (!$this->_checkJobType($type, $types)) return error('The provided type parameter is not valid'); + + $results = $jobs; // returned values + $errorOccurred = false; // very optimistic + + // Get all the job statuses + $dbResult = $this->_ci->JobStatusesModel->load(); + if (isError($dbResult)) return $dbResult; + $statuses = getData($dbResult); + + // Loops through all the provided jobs + foreach ($results as $job) + { + // If the structure of the job object is valid AND the type is valid AND the status is valid + if ($this->_checkNewJobStructure($job) && $this->_checkJobStatus($job, $statuses)) + { + $this->_dropNotAllowedPropertiesNewJob($job); // remove the black listed properties from this object + + $job->{self::PROPERTY_TYPE} = $type; // What you asked is what you get! + + // Try to insert the single job into database + $dbNewJobResult = $this->_ci->JobsQueueModel->insert($job); + + // If an error occurred during while inserting in database + if (isError($dbNewJobResult)) + { + $job->{self::PROPERTY_ERROR} = getError($dbNewJobResult); // retrieve the cause and store it in job object + $errorOccurred = true; // set error occurred flag + } + else // otherwise + { + $job->{self::PROPERTY_JOBID} = getData($dbNewJobResult); // get the jobid and store it in job object + + $dbNewTriggeredJobResult = $this->_addNewTriggeredJobToQueue($type, $job, array(self::STATUS_NEW)); + // If an error occurred during while inserting in database + if (isError($dbNewTriggeredJobResult)) return $dbNewTriggeredJobResult; + } + } + else // otherwise + { + $errorOccurred = true; // set error occurred flag + } + } + + // If an error occurred then returns the results in an error object + if ($errorOccurred) return error($results); + + return success($results); // otherwise return results in a success object + } + + /** + * Updates jobs already present in the jobs queue + * jobs is an array of job objects + */ + public function updateJobsQueue($type, $jobs) + { + // Checks parameters + if (isEmptyArray($jobs)) return error('The provided jobs parameter is not a valid array'); + + $results = $jobs; // returned values + $errorOccurred = false; // very optimistic + + // Get all the job statuses + $dbResultStatuses = $this->_ci->JobStatusesModel->load(); + if (isError($dbResultStatuses)) return $dbResultStatuses; + $statuses = getData($dbResultStatuses); + + // Loops through all the provided jobs + foreach ($results as $job) + { + // Check if the required job is present in the database + $dbResultJobs = $this->_ci->JobsQueueModel->load($job->{self::PROPERTY_JOBID}); + if (isError($dbResultJobs)) + { + $job->{self::PROPERTY_ERROR} = getError($dbResultJobs); // retrieve the cause and store it in job object + $errorOccurred = true; // set error occurred flag + } + elseif (!hasData($dbResultJobs)) // if no jobs were found + { + $job->{self::PROPERTY_ERROR} = 'The required job is not present'; + $errorOccurred = true; // set error occurred flag + } + else // if a job was found then it could be updated + { + // If the structure of the job object is valid + if ($this->_checkUpdateJobStructure($job) && $this->_checkJobStatus($job, $statuses)) + { + $this->_dropNotAllowedPropertiesUpdateJob($job); // remove the black listed properties from this object + + $job->{self::PROPERTY_TYPE} = $type; // What you asked is what you get! + + // Try to update the single job into database + $dbResult = $this->_ci->JobsQueueModel->update($job->{self::PROPERTY_JOBID}, (array)$job); + + // If an error occurred during while updating in database + if (isError($dbResult)) + { + $job->{self::PROPERTY_ERROR} = getError($dbResult); // retrieve the cause and store it in job object + $errorOccurred = true; // set error occurred flag + } + else // otherwise + { + $dbNewTriggeredJobResult = $this->_addNewTriggeredJobToQueue( + $type, + $job, + array($job->status) + ); + // If an error occurred during while inserting in database + if (isError($dbNewTriggeredJobResult)) return $dbNewTriggeredJobResult; + } + } + else // otherwise + { + $errorOccurred = true; // set error occurred flag + } + } + } + + // If an error occurred then returns the results in an error object + if ($errorOccurred) return error($results); + + return success($results); // otherwise return results in a success object + } + + //------------------------------------------------------------------------------------------------------------------ + // Private methods + + /** + * Checks the job object structure when needed for insert + */ + private function _checkNewJobStructure(&$job) + { + // If job is a valid object and contains the required properties AND does NOT already contain the property error + if (is_object($job) + && property_exists($job, self::PROPERTY_STATUS) + && !property_exists($job, self::PROPERTY_ERROR)) + { + return true; // it is valid! + } + + // If not object then object it! + if (!is_object($job)) $job = new stdClass(); + + // If an error property was not already previously stored then store an error message in job object + if (!property_exists($job, self::PROPERTY_ERROR)) + { + $job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid'; + } + + return false; // better sorry than wrong + } + + /** + * Checks the job object structure when needed for update + */ + private function _checkUpdateJobStructure(&$job) + { + // If job is a valid object + if (is_object($job) && property_exists($job, self::PROPERTY_JOBID)) return true; // it is valid! + + // If not object then object it! + if (!is_object($job)) $job = new stdClass(); + + // If an error property was not already previously stored then store an error message in job object + if (!property_exists($job, self::PROPERTY_ERROR)) + { + $job->{self::PROPERTY_ERROR} = 'The structure of the provided job is not valid'; + } + + return false; // better sorry than wrong + } + + /** + * Checks if the given job contains a valid type + */ + private function _checkJobType($type, $types) + { + return $this->_inArray($type, $types, self::PROPERTY_TYPE); + } + + /** + * Checks if the given job contains a valid status + */ + private function _checkJobStatus(&$job, $statuses) + { + // If the given job doesn't have the property status then it is not valid + if (!isset($job->{self::PROPERTY_STATUS})) + { + $found = false; + } + else // otherwise test if it valid + { + $found = $this->_inArray($job->{self::PROPERTY_STATUS}, $statuses, self::PROPERTY_STATUS); + } + + // No status was found and does NOT already contain the property error + if (!$found && !property_exists($job, self::PROPERTY_ERROR)) + { + $job->{self::PROPERTY_ERROR} = 'The provided status of this job is not valid'; // store the error message in the object + } + + return $found; + } + + /** + * Search in an array the given value + * The elements of the given array are objects + * The given value is compared with the property specified by the $propertyName parameter of each object of the given array + */ + private function _inArray($value, $array, $propertyName) + { + $found = false; + + foreach ($array as $element) + { + if ($value == $element->{$propertyName}) + { + $found = true; + break; + } + } + + return $found; + } + + /** + * Drop not allowed properties from the given job + */ + private function _dropNotAllowedPropertiesNewJob(&$job) + { + unset($job->{self::PROPERTY_JOBID}); + unset($job->{self::PROPERTY_CREATIONTIME}); + unset($job->{self::PROPERTY_TYPE}); + } + + /** + * Drop not allowed properties from the given job + */ + private function _dropNotAllowedPropertiesUpdateJob(&$job) + { + unset($job->{self::PROPERTY_CREATIONTIME}); + unset($job->{self::PROPERTY_TYPE}); + } + + /** + * Add e new triggered job to the jobs queue + * NOTE: + * - In this method there are less checks compared to addNewJobsToQueue method because + * the new jobs that will be added are generate in this method + * - Job ids in this case are not returned, therefore the caller is not going to be informed about these new jobs + */ + private function _addNewTriggeredJobToQueue($type, $job, $triggeredStatuses) + { + // Get all the job trigggers for the given type and for the given statuses + $dbTriggersResult = $this->_ci->JobTriggersModel->getJobtriggersByTypeStatuses($type, $triggeredStatuses); + + // If an error occurred while getting job triggers from database then return it + if (isError($dbTriggersResult)) return $dbTriggersResult; + if (hasData($dbTriggersResult)) // If triggers were retrieved + { + // The output of the trigging job is the input of the trigged job + $triggeredJobInput = null; + if (isset($job->{self::PROPERTY_OUTPUT})) $triggeredJobInput = $job->{self::PROPERTY_OUTPUT}; + + // For each trigger + foreach (getData($dbTriggersResult) as $trigger) + { + $triggeredJob = array( + self::PROPERTY_TYPE => $trigger->following_type, // the new type is the one defined in tbl_jobtriggers + self::PROPERTY_STATUS => self::STATUS_NEW, // new job status is new + self::PROPERTY_INPUT => $triggeredJobInput // new job input + ); + + // Try to insert the single job into database + $dbNewJob = $this->_ci->JobsQueueModel->insert($triggeredJob); + // If an error occurred during while inserting in database + if (isError($dbNewJob)) return $dbNewJob; + } + } + + return success(); // if here then it was a success! + } +} + diff --git a/application/libraries/LogLib.php b/application/libraries/LogLib.php index b98575150..ffdec5f03 100644 --- a/application/libraries/LogLib.php +++ b/application/libraries/LogLib.php @@ -42,6 +42,8 @@ class LogLib const P_NAME_LINE_INDEX = 'lineIndex'; const P_NAME_DB_LOG_TYPE = 'dbLogType'; const P_NAME_DB_EXECUTE_USER = 'dbExecuteUser'; + const P_NAME_REQUEST_ID = 'requestId'; + const P_NAME_REQUEST_DATA_FORMATTER = 'requestDataFormatter'; // Properties used to retrieve caller data private $_classIndex; @@ -52,6 +54,9 @@ class LogLib private $_dbLogType; private $_dbExecuteUser; + private $_requestId; // is it possible to specify a request id when loading this library + private $_requestDataFormatter; // is possible to provide a function to format request data + /** * Set properties to a default value or overwrites them with the given parameters */ @@ -63,7 +68,18 @@ class LogLib $this->_lineIndex = self::LINE_INDEX; $this->_dbLogType = null; $this->_dbExecuteUser = self::DB_EXECUTE_USER; + $this->_requestId = null; + $this->_requestDataFormatter = null; + // If parameters are given then overwrite the default values + if (!isEmptyArray($params)) $this->setConfigs($params); + } + + /** + * Store configuration parameters for this lib + */ + public function setConfigs($params) + { // If parameters are given then overwrite the default values if (!isEmptyArray($params)) { @@ -72,6 +88,8 @@ class LogLib if (isset($params[self::P_NAME_LINE_INDEX])) $this->_lineIndex = $params[self::P_NAME_LINE_INDEX]; if (isset($params[self::P_NAME_DB_LOG_TYPE])) $this->_dbLogType = $params[self::P_NAME_DB_LOG_TYPE]; if (isset($params[self::P_NAME_DB_EXECUTE_USER])) $this->_dbExecuteUser = $params[self::P_NAME_DB_EXECUTE_USER]; + if (isset($params[self::P_NAME_REQUEST_ID])) $this->_requestId = $params[self::P_NAME_REQUEST_ID]; + if (isset($params[self::P_NAME_REQUEST_DATA_FORMATTER])) $this->_requestDataFormatter = $params[self::P_NAME_REQUEST_DATA_FORMATTER]; } } @@ -108,33 +126,33 @@ class LogLib /** * Writes an info log to database */ - public function logInfoDB($requestId, $data) + public function logInfoDB($data, $requestId = null) { - $this->_logDB(self::INFO, $requestId, $data); + $this->_logDB(self::INFO, $data, $requestId); } /** * Writes a debug log to database */ - public function logDebugDB($requestId, $data) + public function logDebugDB($data, $requestId = null) { - $this->_logDB(self::DEBUG, $requestId, $data); + $this->_logDB(self::DEBUG, $data, $requestId); } /** * Writes an warning log to database */ - public function logWarningDB($requestId, $data) + public function logWarningDB($data, $requestId = null) { - $this->_logDB(self::WARNING, $requestId, $data); + $this->_logDB(self::WARNING, $data, $requestId); } /** * Writes an error log to database */ - public function logErrorDB($requestId, $data) + public function logErrorDB($data, $requestId = null) { - $this->_logDB(self::ERROR, $requestId, $data); + $this->_logDB(self::ERROR, $data, $requestId); } // -------------------------------------------------------------------------------------------------------------- @@ -151,8 +169,15 @@ class LogLib /** * Writes logs to database */ - private function _logDB($level, $requestId, $data) + private function _logDB($level, $data, $requestId, $executionTime = null) { + // If there isn't a valid request id provided during the loading of this library or when any log to db method is called + // NOTE: this message will be displayed only to the developer AND stops the execution + if (isEmptyString($this->_requestId) && isEmptyString($requestId)) + { + show_error('To log to database you need to specify or give the "'.self::P_NAME_REQUEST_ID.'" parameter when the LogLib is loaded or when log'.ucfirst($level).'DB is called'); + } + // If the _dbLogType parameter was not given when this library was loaded // NOTE: this message will be displayed only to the developer AND stops the execution if ($this->_dbLogType == null) @@ -175,14 +200,21 @@ class LogLib // Get caller data $callerData = $this->_getCaller(); + // If a request data formatter was defined then use it + $request_data = $data; + if ($this->_requestDataFormatter != null && is_callable($this->_requestDataFormatter)) + { + $request_data = call_user_func_array($this->_requestDataFormatter, array($data)); + } + // Writes a log to database $ci->WebservicelogModel->insert(array( 'webservicetyp_kurzbz' => $this->_dbLogType, - 'request_id' => $requestId, + 'request_id' => (!isEmptyString($requestId) ? $requestId : $this->_requestId).' - '.$level, 'beschreibung' => $this->_getDatabaseDescription($callerData), - 'request_data' => $data, + 'request_data' => $request_data, 'execute_user' => $this->_dbExecuteUser, - 'execute_time' => 'NOW()' // current time + 'execute_time' => $executionTime == null ? 'NOW()' : $executionTime // default current time, if not otherwise specified )); } } @@ -251,3 +283,4 @@ class LogLib return $formatted; } } + diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index e0622e664..be496fe4a 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -620,11 +620,24 @@ class MessageLib $this->_ci->load->model('person/Benutzer_model', 'BenutzerModel'); // And the receiver has an active account for the given organisation unit - $benutzerResult = $this->_ci->BenutzerModel->getActiveUserByPersonIdAndOrganisationUnit($message->receiver_id, $message->sender_ou); + $benutzerResult = $this->_ci->BenutzerModel->getActiveUserByPersonIdAndOrganisationUnit( + $message->receiver_id, + $message->sender_ou + ); + if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it - // Use the uid + domain email - if (hasData($benutzerResult)) $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + // If an active user for the given organization unit was found + if (hasData($benutzerResult)) + { + // Checks if the user was NOT created in the last 24 hours + if (getData($benutzerResult)[0]->insertamum < date('Y-m-d H:i:s', strtotime('-1 day'))) + { + // Use the uid + domain email + $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + } + // otherwise do NOT use the internal email account + } } // Otherwise try with the private email @@ -669,7 +682,7 @@ class MessageLib // If there are presetudent if (hasData($prestudentResults)) { - $inArray = true; + $privateOnly = false; $organisationUnits = getData($prestudentResults); // Look if any of the organization units of this prestudent are in the list of the @@ -677,16 +690,21 @@ class MessageLib foreach ($organisationUnits as $organisationUnit) { // If the recipient organisation unit is NOT in the list of organisation units that sent only to private emails + // NOTE: done in this way because it is easyer to check the result of array_search if (array_search($organisationUnit, $this->_ci->config->item(self::CFG_OU_RECEIVERS_PRIVATE)) === false) { - $inArray = false; + // NOP + } + else // otherwise If the recipient organisation unit is the list of organisation units that sent only to private emails + { + $privateOnly = true; break; } } // If the recipient prestudent organization unit is not in in the list of the // organization units that will not send the notice email to the internal account - if (!$inArray) + if ($privateOnly) { // Then use the private email $privateEmailResult = $this->_getPrivateEmail($message->receiver_id); @@ -701,10 +719,37 @@ class MessageLib $this->_ci->BenutzerModel->addOrder('updateamum', 'DESC'); $this->_ci->BenutzerModel->addOrder('insertamum', 'DESC'); - $benutzerResult = $this->_ci->BenutzerModel->loadWhere(array('person_id' => $message->receiver_id)); + $benutzerResult = $this->_ci->BenutzerModel->loadWhere( + array( + 'person_id' => $message->receiver_id + ) + ); if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it - $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; // Use the uid + domain email + // If an active user for the given organization unit was found + if (hasData($benutzerResult)) + { + // For each benutzer found for this person + foreach (getData($benutzerResult) as $benutzer) + { + // Checks if the user was NOT created in the last 24 hours + if (getData($benutzerResult)[0]->insertamum < date('Y-m-d H:i:s', strtotime('-1 day'))) + { + // Use the uid + domain as email address + $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + } + } + } + + // Otherwise try with the private email + if (isEmptyString($message->receiverContact)) + { + // Then use the private email + $privateEmailResult = $this->_getPrivateEmail($message->receiver_id); + if (isError($privateEmailResult)) return $privateEmailResult; // if an error occured then return it + + if (hasData($privateEmailResult)) $message->receiverContact = getData($privateEmailResult); + } } } } diff --git a/application/libraries/PermissionLib.php b/application/libraries/PermissionLib.php index 348c8b87b..09f89abee 100644 --- a/application/libraries/PermissionLib.php +++ b/application/libraries/PermissionLib.php @@ -147,7 +147,7 @@ class PermissionLib $accessType = ''; - // Checks if the required access type is compliant with the HTTP method (GET => r, POST => w) + // Set the access type if (strpos($requiredAccessType, PermissionLib::READ_RIGHT) !== false) { $accessType = PermissionLib::SELECT_RIGHT; // S @@ -184,12 +184,12 @@ class PermissionLib } else { - show_error('The given permission array does not contain the called method or is not correctly set'); + show_error('The given permission array does not contain the given method or is not correctly set'); } } else { - show_error('You must give the permissions array as parameter to the constructor of the controller'); + show_error('The given permissions is not a valid array or it is an empty one'); } return $checkPermissions; diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index f24e16086..9ffd12cf6 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -287,9 +287,11 @@ class Messages_model extends CI_Model $sender = getData($senderResult)[0]; // Found sender data - // If the sender is not the system sender and are present configurations to reply + // If the sender is not the system sender and the receiver is not the system sender + // and are present configurations to reply $hrefReply = ''; if ($message->sender_id != $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID) + && $message->receiver_id != $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID) && !isEmptyString($this->config->item(MessageLib::CFG_REDIRECT_VIEW_MESSAGE_URL))) { $hrefReply = $this->config->item(MessageLib::CFG_MESSAGE_SERVER). @@ -297,6 +299,13 @@ class Messages_model extends CI_Model $token; } + // If the receiver is the system sender (the message was sent to an organization unit) + // redirect the reply to an authenticated controller to reply + if ($message->receiver_id == $this->config->item(MessageLib::CFG_SYSTEM_PERSON_ID)) + { + $hrefReply = site_url('system/messages/MessageClient/writeReply?token='.$token); + } + return array ( 'sender' => $sender, 'message' => $message, @@ -417,23 +426,20 @@ class Messages_model extends CI_Model $message = $this->messagelib->sendMessageUser( $msgVarsDataArray['person_id'], // receiverPersonId - $parsedSubject, // subject - $parsedBody, // body - $sender_id, // sender_id - $senderOU, // senderOU - $relationmessage_id, // relationmessage_id - MSG_PRIORITY_NORMAL // priority + $parsedSubject, // subject + $parsedBody, // body + $sender_id, // sender_id + $senderOU, // senderOU + $relationmessage_id, // relationmessage_id + MSG_PRIORITY_NORMAL // priority ); if (isError($message)) return $message; if (!hasData($message)) return error('No messages were saved in database'); - // Write log entry only if persons were given - if ($type == self::TYPE_PERSONS) - { - $personLog = $this->_personLog($sender_id, $msgVarsDataArray['person_id'], getData($message)[0]); - if (isError($personLog)) return $personLog; - } + // Write log entry only + $personLog = $this->_personLog($sender_id, $msgVarsDataArray['person_id'], getData($message)[0]); + if (isError($personLog)) return $personLog; $receiversCounter++; // increment the counter } diff --git a/application/models/codex/Bisverwendung_model.php b/application/models/codex/Bisverwendung_model.php index 707e8af36..7f101bd4c 100644 --- a/application/models/codex/Bisverwendung_model.php +++ b/application/models/codex/Bisverwendung_model.php @@ -41,4 +41,35 @@ class Bisverwendung_model extends DB_Model return $this->loadWhere($condition); } + + /** + * Gets Verwendungen of the user, optionally in a time span. + * @param string $uid + * @param string $beginn + * @param string $ende + * @return array + */ + public function getVerwendungen($uid, $beginn = null, $ende = null) + { + $params = array($uid); + + $qry = 'SELECT * FROM bis.tbl_bisverwendung + WHERE mitarbeiter_uid = ?'; + + if (isset($beginn)) + { + $qry .= ' AND ( ende >= ? OR ende IS NULL )'; + $params[] = $beginn; + } + + if (isset($ende)) + { + $qry .= ' AND ( beginn <= ? OR beginn IS NULL )'; + $params[] = $ende; + } + + $qry .= ' ORDER BY beginn, ende'; + + return $this->execQuery($qry, $params); + } } diff --git a/application/models/crm/Konto_model.php b/application/models/crm/Konto_model.php index 286d3189e..a3b5cdbb6 100644 --- a/application/models/crm/Konto_model.php +++ b/application/models/crm/Konto_model.php @@ -11,4 +11,61 @@ class Konto_model extends DB_Model $this->dbTable = 'public.tbl_konto'; $this->pk = 'buchungsnr'; } + + /** + * Sets a Payment as paid + */ + public function setPaid($buchungsnr) + { + // get payment + $buchungResult = $this->loadWhere(array('buchungsnr' => $buchungsnr)); + + if(isSuccess($buchungResult) && hasData($buchungResult)) + { + // get already paid amount + $this->addSelect('sum(betrag) as bezahlt'); + $this->addGroupBy('buchungsnr_verweis'); + $buchungVerweisResult = $this->loadWhere(array('buchungsnr_verweis' => $buchungsnr)); + + if(isSuccess($buchungVerweisResult)) + { + if(hasData($buchungVerweisResult)) + { + $betragBezahltResult = getData($buchungVerweisResult); + $betragBezahlt = $betragBezahltResult->bezahlt; + } + else + $betragBezahlt = 0; + + $buchung = getData($buchungResult); + $buchung = $buchung[0]; + + // calculate open amount + $betragOffen = $betragBezahlt - $buchung->betrag*(-1); + + $data = array( + 'person_id' => $buchung->person_id, + 'studiengang_kz' => $buchung->studiengang_kz, + 'studiensemester_kurzbz' => $buchung->studiensemester_kurzbz, + 'buchungsnr_verweis' => $buchungsnr, + 'betrag' => str_replace(',','.',$betragOffen*(-1)), + 'buchungsdatum' => date('Y-m-d'), + 'buchungstext' => $buchung->buchungstext, + 'insertamum' => date('Y-m-d H:i:s'), + 'insertvon' => '', + 'buchungstyp_kurzbz' => $buchung->buchungstyp_kurzbz, + ); + + return $this->insert($data); + } + else + { + return error('Failed to load Payment'); + } + } + else + { + return error('Failed to load Payment'); + } + } } diff --git a/application/models/crm/Prestudentstatus_model.php b/application/models/crm/Prestudentstatus_model.php index d579037e1..3335de021 100644 --- a/application/models/crm/Prestudentstatus_model.php +++ b/application/models/crm/Prestudentstatus_model.php @@ -182,4 +182,30 @@ class Prestudentstatus_model extends DB_Model return success(array()); } } + + /** + * getLastStatuses + */ + public function getLastStatusPerson($person_id, $studiensemester_kurzbz = null) + { + $query = 'SELECT * + FROM public.tbl_prestudent p + JOIN ( + SELECT DISTINCT ON(prestudent_id) * + FROM public.tbl_prestudentstatus + WHERE prestudent_id IN (SELECT prestudent_id FROM public.tbl_prestudent WHERE person_id = ?) + ORDER BY prestudent_id, datum desc, insertamum desc + ) ps USING(prestudent_id) + JOIN public.tbl_status USING(status_kurzbz)'; + + $parametersArray = array($person_id); + + if ($studiensemester_kurzbz != '') + { + array_push($parametersArray, $studiensemester_kurzbz); + $query .= ' AND ps.studiensemester_kurzbz = ?'; + } + + return $this->execQuery($query, $parametersArray); + } } diff --git a/application/models/education/Abschlusspruefung_model.php b/application/models/education/Abschlusspruefung_model.php index aef5f67c3..268e786cb 100644 --- a/application/models/education/Abschlusspruefung_model.php +++ b/application/models/education/Abschlusspruefung_model.php @@ -11,4 +11,106 @@ class Abschlusspruefung_model extends DB_Model $this->dbTable = 'lehre.tbl_abschlusspruefung'; $this->pk = 'abschlusspruefung_id'; } + + /** + * Gets data of an Abschlusspruefung, including Abschlussarbeit. + * @param $abschlusspruefung_id + * @return object + */ + public function getAbschlusspruefung($abschlusspruefung_id) + { + $this->load->model('crm/Student_model', 'StudentModel'); + $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); + $this->load->model('organisation/Studiengang_model', 'StudiengangModel'); + + $abschlusspruefungdata = array(); + + $this->addSelect('tbl_abschlusspruefung.abschlusspruefung_id, tbl_abschlusspruefung.datum, tbl_abschlusspruefung.pruefungstyp_kurzbz AS studiengangstyp, tbl_abschlusspruefung.abschlussbeurteilung_kurzbz, tbl_abschlusspruefung.uhrzeit AS pruefungsbeginn, tbl_abschlusspruefung.endezeit AS pruefungsende, + tbl_abschlusspruefung.freigabedatum, tbl_abschlusspruefung_antritt.bezeichnung AS pruefungsantritt_bezeichnung, tbl_abschlusspruefung_antritt.bezeichnung_english AS pruefungsantritt_bezeichnung_english, tbl_abschlusspruefung.protokoll, + studentpers.vorname AS vorname_student, studentpers.nachname AS nachname_student, studentpers.titelpre AS titelpre_student, studentpers.titelpost AS titelpost_student, studentben.uid AS uid_student, matrikelnr, + vorsitzenderben.uid AS uid_vorsitz, vorsitzenderpers.vorname AS vorname_vorsitz, vorsitzenderpers.nachname AS nachname_vorsitz, vorsitzenderpers.titelpre AS titelpre_vorsitz, vorsitzenderpers.titelpost AS titelpost_vorsitz, + erstprueferpers.vorname AS vorname_erstpruefer, erstprueferpers.nachname AS nachname_erstpruefer, erstprueferpers.titelpre AS titelpre_erstpruefer, erstprueferpers.titelpost AS titelpost_erstpruefer, + zweitprueferpers.vorname AS vorname_zweitpruefer, zweitprueferpers.nachname AS nachname_zweitpruefer, zweitprueferpers.titelpre AS titelpre_zweitpruefer, zweitprueferpers.titelpost AS titelpost_zweitpruefer + '); + $this->addJoin('lehre.tbl_abschlusspruefung_antritt', 'pruefungsantritt_kurzbz', 'LEFT'); + $this->addJoin('public.tbl_benutzer studentben', 'tbl_abschlusspruefung.student_uid = studentben.uid'); + $this->addJoin('public.tbl_person studentpers', 'studentben.person_id = studentpers.person_id'); + $this->addJoin('public.tbl_student', 'studentben.uid = tbl_student.student_uid'); + $this->addJoin('public.tbl_benutzer vorsitzenderben', 'vorsitz = vorsitzenderben.uid', 'LEFT'); + $this->addJoin('public.tbl_person vorsitzenderpers', 'vorsitzenderben.person_id = vorsitzenderpers.person_id', 'LEFT'); + $this->addJoin('public.tbl_person erstprueferpers', 'pruefer1 = erstprueferpers.person_id', 'LEFT'); + $this->addJoin('public.tbl_person zweitprueferpers', 'pruefer2 = zweitprueferpers.person_id', 'LEFT'); + + $abschlusspruefung = $this->load($abschlusspruefung_id); + + if (isError($abschlusspruefung)) + return $abschlusspruefung; + elseif (hasData($abschlusspruefung)) + { + $abschlusspruefungdata = getData($abschlusspruefung)[0]; + + // get Studiengang of Student + $student_uid = $abschlusspruefungdata->uid_student; + $this->StudentModel->addSelect('prestudent_id'); + $prestudent_id = $this->StudentModel->load(array('student_uid' => $student_uid)); + + if (isError($prestudent_id)) + return $prestudent_id; + elseif (hasData($prestudent_id)) + { + //get Studiengangname from Studienplan and -ordnung + $studienordnung = $this->PrestudentstatusModel->getStudienordnungFromPrestudent(getData($prestudent_id)[0]->prestudent_id); + + if (isError($studienordnung)) + return $studienordnung; + elseif (hasData($studienordnung)) + { + $studienordnungdata = getData($studienordnung)[0]; + + $abschlusspruefungdata->studiengang_kz = $studienordnungdata->studiengang_kz; + $abschlusspruefungdata->studiengangbezeichnung = $studienordnungdata->studiengangbezeichnung; + $abschlusspruefungdata->studiengangbezeichnung_englisch = $studienordnungdata->studiengangbezeichnung_englisch; + } + // if no Studienordnung available (e.g. Incomings), use Studiengangname provided by table student + elseif (!hasData($studienordnung)) + { + $this->resetQuery(); + + $this->load->model('crm/Student_model', 'StudentModel'); + $this->addSelect('studiengang_kz, bezeichnung, english'); + $this->addJoin('public.tbl_studiengang', 'studiengang_kz'); + $result = $this->StudentModel->load(array( + 'student_uid' => $student_uid) + ); + + if ($result = getData($result)[0]) + { + $abschlusspruefungdata->studiengang_kz = $result->studiengang_kz; + $abschlusspruefungdata->studiengangbezeichnung = $result->bezeichnung; + $abschlusspruefungdata->studiengangbezeichnung_englisch = $result->english; + } + } + + // get Abschlussarbeit + if (isset($abschlusspruefungdata->studiengang_kz) && !empty($abschlusspruefungdata->studiengang_kz)) + { + $projekttyp = array('Bachelor','Diplom','Master','Dissertation','Lizenziat','Magister'); + $abschlussarbeit = $this->ProjektarbeitModel->getProjektarbeit($student_uid, $abschlusspruefungdata->studiengang_kz, null, $projekttyp, true); + + if (isError($abschlussarbeit)) + return $abschlussarbeit; + if (hasData($abschlussarbeit)) + { + $abschlussarbeit = getData($abschlussarbeit)[0]; + $abschlusspruefungdata->projektarbeit_studiengangstyp_name = $abschlussarbeit->projekttyp_kurzbz; + $abschlusspruefungdata->abschlussarbeit_titel = $abschlussarbeit->titel; + $abschlusspruefungdata->abschlussarbeit_note = $abschlussarbeit->note; + } + } + } + } + + return success($abschlusspruefungdata); + } } diff --git a/application/models/education/Lehrveranstaltung_model.php b/application/models/education/Lehrveranstaltung_model.php index 4941ba9bd..d80d02b41 100644 --- a/application/models/education/Lehrveranstaltung_model.php +++ b/application/models/education/Lehrveranstaltung_model.php @@ -119,9 +119,10 @@ class Lehrveranstaltung_model extends DB_Model * Gets all students of a Lehrveranstaltung * @param $studiensemester_kurzbz * @param $lehrveranstaltung_id + * @param $active optional, if true, only active students retrieved, false - only inactive, all students otherwise * @return array|null */ - public function getStudentsByLv($studiensemester_kurzbz, $lehrveranstaltung_id) + public function getStudentsByLv($studiensemester_kurzbz, $lehrveranstaltung_id, $active = null) { $query = "SELECT distinct on(nachname, vorname, person_id) vorname, nachname, matrikelnr, @@ -144,8 +145,18 @@ class Lehrveranstaltung_model extends DB_Model WHERE vw_student_lehrveranstaltung.studiensemester_kurzbz=? AND - vw_student_lehrveranstaltung.lehrveranstaltung_id=? - ORDER BY nachname, vorname, person_id, tbl_bisio.bis DESC"; + vw_student_lehrveranstaltung.lehrveranstaltung_id=?"; + + if (isset($active)) + { + if ($active === true) + $query .= " AND tbl_benutzer.aktiv"; + elseif ($active === false) + $query .= " AND tbl_benutzer.aktiv = false"; + } + + $query .= + " ORDER BY nachname, vorname, person_id, tbl_bisio.bis DESC"; return $this->execQuery($query, array($studiensemester_kurzbz, $lehrveranstaltung_id)); } diff --git a/application/models/education/Projektarbeit_model.php b/application/models/education/Projektarbeit_model.php index e5652d6ff..109e23373 100644 --- a/application/models/education/Projektarbeit_model.php +++ b/application/models/education/Projektarbeit_model.php @@ -11,4 +11,62 @@ class Projektarbeit_model extends DB_Model $this->dbTable = 'lehre.tbl_projektarbeit'; $this->pk = 'projektarbeit_id'; } + + /** + * Gets Projektarbeit(en) of a student for a Studiengang, Semester, Projekttyp, final. + * @param $student_uid + * @param $studiengang_kz + * @param $studiensemester_kurzbz + * @param $projekttyp + * @param $final + * @return object + */ + public function getProjektarbeit($student_uid, $studiengang_kz = null, $studiensemester_kurzbz = null, $projekttyp = null, $final = null) + { + $qry = "SELECT + tbl_projektarbeit.* , tbl_projekttyp.bezeichnung + FROM + lehre.tbl_projektarbeit + JOIN + lehre.tbl_projekttyp USING (projekttyp_kurzbz), lehre.tbl_lehreinheit, lehre.tbl_lehrveranstaltung + + WHERE + tbl_projektarbeit.lehreinheit_id=tbl_lehreinheit.lehreinheit_id AND + tbl_lehreinheit.lehrveranstaltung_id = tbl_lehrveranstaltung.lehrveranstaltung_id AND + tbl_projektarbeit.student_uid = ?"; + + $params = array($student_uid); + + if (isset($studiengang_kz)) + { + $qry .= ' AND tbl_lehrveranstaltung.studiengang_kz=?'; + $params[] = $studiengang_kz; + } + + if (isset($studiensemester_kurzbz)) + { + $qry .= ' AND tbl_lehreinheit.studiensemester_kurzbz=?'; + $params[] = $studiensemester_kurzbz; + } + + if (isset($projekttyp)) + { + if (is_array($projekttyp)) + $qry .= ' AND tbl_projektarbeit.projekttyp_kurzbz IN ?'; + else + $qry .= ' AND tbl_projektarbeit.projekttyp_kurzbz=?'; + + $params[] = $projekttyp; + } + + if (isset($final)) + { + $qry .= ' AND tbl_projektarbeit.final=?'; + $params[] = $final; + } + + $qry .= ' ORDER BY beginn DESC, projektarbeit_id DESC'; + + return $this->execQuery($qry, $params); + } } diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php index 6439bc8d6..bec4aee47 100644 --- a/application/models/organisation/Organisationseinheit_model.php +++ b/application/models/organisation/Organisationseinheit_model.php @@ -33,7 +33,7 @@ class Organisationseinheit_model extends DB_Model FROM tree JOIN tbl_organisationseinheit oe ON (tree.oe_kurzbz = oe.oe_parent_kurzbz) ) SELECT oe_kurzbz AS id, - SUBSTRING(REGEXP_REPLACE(path, '[A-z]+\|', '-', 'g') || bezeichnung, 2) AS description + SUBSTRING(REGEXP_REPLACE(path, '[A-z0-9]+\|', '-', 'g') || bezeichnung, 2) AS description FROM tree"; $parametersArray = array(); diff --git a/application/models/organisation/Studiensemester_model.php b/application/models/organisation/Studiensemester_model.php index 9cdde7a52..41baf2489 100644 --- a/application/models/organisation/Studiensemester_model.php +++ b/application/models/organisation/Studiensemester_model.php @@ -39,7 +39,7 @@ class Studiensemester_model extends DB_Model $days = 60; } - $query = 'SELECT studiensemester_kurzbz + $query = 'SELECT studiensemester_kurzbz, start, ende FROM public.tbl_studiensemester WHERE start < NOW() - \'' . $days . ' DAYS\'::INTERVAL ORDER BY start DESC @@ -59,7 +59,7 @@ class Studiensemester_model extends DB_Model $days = 62; } - $query = 'SELECT studiensemester_kurzbz + $query = 'SELECT studiensemester_kurzbz, start, ende FROM public.tbl_studiensemester WHERE start < NOW() + \'' . $days . ' DAYS\':: INTERVAL ORDER BY start DESC diff --git a/application/models/person/Adresse_model.php b/application/models/person/Adresse_model.php index e049f5ad6..fb5112a8d 100644 --- a/application/models/person/Adresse_model.php +++ b/application/models/person/Adresse_model.php @@ -14,12 +14,14 @@ class Adresse_model extends DB_Model /** - * gets person data from uid - * @param $uid + * Get Zustelladress of given person. + * @param string $person_id + * @param string $select * @return array */ - public function getZustellAdresse($person_id) + public function getZustellAdresse($person_id, $select = '*') { + $this->addSelect($select); return $this->loadWhere(array('person_id' => $person_id, 'zustelladresse'=> true)); } } diff --git a/application/models/person/Benutzer_model.php b/application/models/person/Benutzer_model.php index a21811bb4..c1e76ce38 100644 --- a/application/models/person/Benutzer_model.php +++ b/application/models/person/Benutzer_model.php @@ -23,14 +23,81 @@ class Benutzer_model extends DB_Model */ public function getActiveUserByPersonIdAndOrganisationUnit($person_id, $oe_kurzbz) { - $sql = 'SELECT b.uid - FROM public.tbl_benutzer b - JOIN public.tbl_prestudent ps USING (person_id) - JOIN public.tbl_studiengang sg USING (studiengang_kz) - WHERE ps.person_id = ? - AND sg.oe_kurzbz = ? - AND b.aktiv = TRUE'; + $sql = 'SELECT + b.uid, + b.insertamum + FROM + public.tbl_prestudent ps + JOIN public.tbl_studiengang sg USING (studiengang_kz) + JOIN public.tbl_student USING(prestudent_id) + JOIN public.tbl_benutzer b ON(uid = student_uid) + WHERE ps.person_id = ? + AND sg.oe_kurzbz = ? + AND b.aktiv = TRUE'; return $this->execQuery($sql, array($person_id, $oe_kurzbz)); } + + /** + * Checks if alias exists + * @param $alias + */ + public function aliasExists($alias) + { + $this->addSelect('1'); + $result = $this->loadWhere(array('alias' => $alias)); + + if (isSuccess($result)) + { + if (hasData($result)) + { + $result = success(array(true)); + } + else + { + $result = success(array(false)); + } + } + + return $result; + } + + /** + * Generates alias for a uid. + * @param $uid + * @return array the alias if newly generated + */ + public function generateAlias($uid) + { + $aliasres = ''; + $this->addLimit(1); + $this->addSelect('vorname, nachname'); + $this->addJoin('public.tbl_person', 'person_id'); + $nameresult = $this->loadWhere(array('uid' => $uid)); + + if (hasData($nameresult)) + { + $aliasdata = getData($nameresult); + $alias = $this->_sanitizeAliasName($aliasdata[0]->vorname).'.'.$this->_sanitizeAliasName($aliasdata[0]->nachname); + $aliasexists = $this->aliasExists($alias); + + if (hasData($aliasexists) && !getData($aliasexists)[0]) + $aliasres = $alias; + } + return success($aliasres); + } + + // -------------------------------------------------------------------------------------------- + // Private methods + + /** + * Sanitizes a string used for alias. Replaces special characters, spaces, sets lower case. + * @param string $str + * @return string + */ + private function _sanitizeAliasName($str) + { + $str = sanitizeProblemChars($str); + return mb_strtolower(str_replace(' ','_', $str)); + } } diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php index fb9b51c1a..27f9b6184 100644 --- a/application/models/person/Benutzerfunktion_model.php +++ b/application/models/person/Benutzerfunktion_model.php @@ -12,6 +12,44 @@ class Benutzerfunktion_model extends DB_Model $this->pk = 'benutzerfunktion_id'; } + /** + * Lädt alle Benutzerfunktionen zu einer UID + * @param type $uid UID des Mitarbeiters + * @param type $funktion_kurzbz OPTIONAL Kurzbezeichnung der Funktion + * @param type $startZeitraum OPTIONAL Start Zeitraum in dem die Funktion aktiv ist + * @param type $endeZeitraum OPTIONAL Ende Zeitraum in dem die Funktion aktiv ist + * @return boolean + */ + public function getBenutzerFunktionByUid($uid, $funktion_kurzbz=null, $startZeitraum=null, $endeZeitraum=null) + { + $params = array($uid); + + $qry = "SELECT tbl_benutzerfunktion.*, tbl_organisationseinheit.bezeichnung as organisationseinheit_bezeichnung, + tbl_organisationseinheit.organisationseinheittyp_kurzbz + FROM public.tbl_benutzerfunktion + LEFT JOIN public.tbl_organisationseinheit USING(oe_kurzbz) + WHERE uid=?"; + if(!is_null($funktion_kurzbz)) + { + $qry .= ' AND funktion_kurzbz = ?'; + $params[] = $funktion_kurzbz; + } + if(!is_null($startZeitraum)) + { + $qry .=' AND (datum_bis IS NULL OR datum_bis >= ?)'; + $params[] = $startZeitraum; + } + if(!is_null($endeZeitraum)) + { + $qry .=' AND (datum_von IS NULL OR datum_von <= ?)'; + $params[] = $endeZeitraum; + } + + $qry .= "ORDER BY datum_bis NULLS LAST, datum_von NULLS LAST;"; + + return $this->execQuery($qry, $params); + } + /** * Get the Benutzerfunktion using the person_id */ diff --git a/application/models/person/Kontakt_model.php b/application/models/person/Kontakt_model.php index 3f27604e8..c35794fc8 100644 --- a/application/models/person/Kontakt_model.php +++ b/application/models/person/Kontakt_model.php @@ -10,6 +10,7 @@ class Kontakt_model extends DB_Model parent::__construct(); $this->dbTable = 'public.tbl_kontakt'; $this->pk = 'kontakt_id'; + $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); } public function getWholeKontakt($kontakt_id, $person_id = null, $kontakttyp = null) @@ -59,4 +60,142 @@ class Kontakt_model extends DB_Model return $this->execQuery($sql, array($person_id, $kontakttyp)); } + + /** + * Laedt einen Kontakt eines Standortes + * Es wird nur der erste Eintrag zurueckgeliefert! + * @param $standort_id + * @param $kontakttyp + */ + public function getFirmaKontakttyp($standort_id, $kontakttyp) + { + if (!is_numeric($standort_id)) + { + return error('StandortID ist ungueltig'); + } + + $qry = "SELECT kontakt, kontakt_id FROM public.tbl_kontakt WHERE standort_id=? AND kontakttyp=? ORDER BY kontakt_id LIMIT 1;"; + + return $this->execQuery($qry, array('standort_id' => $standort_id, 'kontakttyp' => $kontakttyp)); + } + + /** + * Gets Firmentelefon for a uid, can be Vorwahl with Telefonklappe or Firmenhandy + * @param $uid + */ + public function getFirmentelefon($uid) + { + $firmentelefon = success(array()); + + $this->MitarbeiterModel->addSelect('standort_id, telefonklappe, person_id'); + $this->MitarbeiterModel->addJoin('public.tbl_benutzer', 'tbl_mitarbeiter.mitarbeiter_uid = tbl_benutzer.uid'); + $mitarbeiter = $this->MitarbeiterModel->load(array('uid' => $uid)); + + if (hasData($mitarbeiter)) + { + $mitarbeiter = getData($mitarbeiter); + if (isEmptyString($mitarbeiter[0]->telefonklappe)) + { + $this->addSelect('kontakt'); + $this->addOrder('updateamum, insertamum', 'DESC'); + $this->addLimit(1); + $firmenhandy = $this->loadWhere(array('person_id' => $mitarbeiter[0]->person_id, 'kontakttyp' => 'firmenhandy')); + if (hasData($firmenhandy)) + { + $firmenhandy = getData($firmenhandy); + $firmentelefon = success(array('kontakt' => $firmenhandy[0]->kontakt, 'telefonklappe' => '')); + } + } + else + { + $firmaKontakttyp = $this->getFirmaKontakttyp($mitarbeiter[0]->standort_id, 'telefon'); + if (hasData($firmaKontakttyp)) + { + $vorwahl = getData($firmaKontakttyp); + $vorwahl = $vorwahl[0]->kontakt; + $firmentelefon = success(array('kontakt' => $vorwahl, 'telefonklappe' => $mitarbeiter[0]->telefonklappe)); + } + } + } + return $firmentelefon; + } + + /** + * Get all latest contact data of person, where Zustellung is true + * @param $person_id + * @return array + */ + public function getAll_byPersonID($person_id) + { + $this->addSelect('DISTINCT ON (kontakttyp) kontakttyp, kontakt'); + $this->addJoin('public.tbl_standort', 'standort_id', 'LEFT'); + $this->addJoin('public.tbl_firma', 'firma_id', 'LEFT'); + $this->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum'); + + return $this->loadWhere(array( + 'zustellung' => TRUE, + 'person_id' => $person_id + )); + } + + /** + * Get all latest phones of person where zustellung is true. Ordered by + * telefon > mobil > firmenhandy > else. + * @param string person_id + */ + public function getPhones_byPerson($person_id) + { + $qry = ' + WITH latest_phones AS( + SELECT DISTINCT ON (kontakttyp) kontakttyp, kontakt + FROM public.tbl_kontakt kontakt + LEFT JOIN public.tbl_standort USING (standort_id) + LEFT JOIN public.tbl_firma USING (firma_id) + WHERE person_id = ? + AND zustellung + AND kontakttyp IN (\'telefon\', \'mobil\', \'firmenhandy\') + ORDER BY kontakttyp, kontakt, kontakt.updateamum + ) + + SELECT * FROM latest_phones + ORDER BY + CASE + WHEN kontakttyp = \'telefon\' THEN 0 + WHEN kontakttyp = \'mobil\' THEN 1 + WHEN kontakttyp = \'firmenhandy\' THEN 2 + ELSE 3 + END + '; + + return $this->execQuery($qry, array($person_id)); + } + + /** + * Loads main contact, i.e. most recent Zustellkontakt with the given kontakttypes. + * @param $person_id + * @param $kontakttypen array of kontakttypen, one chronologically last Zustellkontakt for all given types + * @return object + */ + public function getZustellKontakt($person_id, $kontakttypen) + { + if (is_string($kontakttypen)) + $kontakttypen = array($kontakttypen); + + if (!isEmptyArray($kontakttypen)) + { + $qry = " + SELECT + kontakt + FROM + public.tbl_kontakt + WHERE person_id = ? + AND kontakttyp IN ? + ORDER BY zustellung DESC NULLS LAST, updateamum DESC, insertamum DESC + LIMIT 1"; + + return $this->execQuery($qry, array($person_id, $kontakttypen)); + } + else + return success(array()); + } } diff --git a/application/models/ressource/Betriebsmittelperson_model.php b/application/models/ressource/Betriebsmittelperson_model.php index 924f670e0..87915cfa8 100644 --- a/application/models/ressource/Betriebsmittelperson_model.php +++ b/application/models/ressource/Betriebsmittelperson_model.php @@ -1,7 +1,6 @@ dbTable = 'wawi.tbl_betriebsmittelperson'; $this->pk = 'betriebsmittelperson_id'; } + + /** + * Get Betriebsmittel by person. + * @param string $person_id + * @param string $betriebsmitteltyp + * @param bool $isRetourniert False to retrieve only active Betriebsmittel. + * @return array|bool + */ + public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null) + { + if (!is_numeric($person_id)) + { + $this->errormsg = 'Person_id type is not valid.'; + return false; + } + + $this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id'); + + $condition = ' + person_id = '. $this->escape($person_id). ' + '; + + if (is_string($betriebsmitteltyp)) { + $condition .= ' + AND betriebsmitteltyp = ' . $this->escape($betriebsmitteltyp); + } + + if ($isRetourniert === true) { + $condition .= ' + AND retouram IS NOT NULL'; // return date is given + } + elseif ($isRetourniert === false) + { + $condition .= ' + AND retouram IS NULL'; // default + } + + $this->addOrder('ausgegebenam', 'DESC'); // default + + return $this->loadWhere($condition); + } } diff --git a/application/models/ressource/Mitarbeiter_model.php b/application/models/ressource/Mitarbeiter_model.php index ccaeacd0d..90c30927f 100644 --- a/application/models/ressource/Mitarbeiter_model.php +++ b/application/models/ressource/Mitarbeiter_model.php @@ -40,4 +40,166 @@ class Mitarbeiter_model extends DB_Model return success(false); } } + + /** + * Laedt das Personal + * + * @param $aktiv wenn true werden nur aktive geladen, wenn false dann nur inaktve, wenn null dann alle + * @param $fix wenn true werden nur fixangestellte geladen + * @param $verwendung wenn true werden alle geladen die eine BIS-Verwendung eingetragen haben + * @param $personaccount wenn true werden alle geladen die personalnr >= 0 haben, also "echte" Personaccounts + * @return array + */ + public function getPersonal($aktiv, $fix, $verwendung, $personaccount = null, $uids = null) + { + $qry = "SELECT DISTINCT ON(mitarbeiter_uid) staatsbuergerschaft, geburtsnation, sprache, anrede, titelpost, titelpre, + nachname, vorname, vornamen, gebdatum, gebort, gebzeit, tbl_person.anmerkung AS person_anmerkung, homepage, svnr, ersatzkennzeichen, familienstand, + geschlecht, anzahlkinder, tbl_person.insertamum AS person_insertamum, tbl_person.updateamum as person_updateamum, + tbl_person.updatevon AS person_updatevon, kompetenzen, kurzbeschreibung, zugangscode, zugangscode_timestamp, bpk, + tbl_benutzer.*, tbl_mitarbeiter.*, akt_funk.oe_kurzbz AS funktionale_zuordnung, akt_funk.wochenstunden + FROM ((public.tbl_mitarbeiter JOIN public.tbl_benutzer ON(mitarbeiter_uid=uid)) + JOIN public.tbl_person USING(person_id)) + LEFT JOIN public.tbl_benutzerfunktion USING(uid) + LEFT JOIN public.tbl_benutzerfunktion akt_funk ON tbl_mitarbeiter.mitarbeiter_uid = akt_funk.uid AND akt_funk.funktion_kurzbz = 'fachzuordnung' + AND (akt_funk.datum_von IS NULL OR akt_funk.datum_von <= now()) AND (akt_funk.datum_bis IS NULL OR akt_funk.datum_bis >= now()) + WHERE true"; + + if ($fix === true) + $qry .= " AND fixangestellt=true"; + elseif ($fix === false) + $qry .= " AND fixangestellt=false"; + + if ($aktiv === true) + $qry .= " AND tbl_benutzer.aktiv=true"; + elseif ($aktiv === false) + $qry .= " AND tbl_benutzer.aktiv=false"; + + if ($verwendung === true) + { + $qry.=" AND EXISTS(SELECT * FROM bis.tbl_bisverwendung WHERE (ende>now() or ende is null) AND tbl_bisverwendung.mitarbeiter_uid=tbl_mitarbeiter.mitarbeiter_uid)"; + } + elseif ($verwendung === false) + { + $qry.=" AND NOT EXISTS(SELECT * FROM bis.tbl_bisverwendung WHERE (ende>now() or ende is null) AND tbl_bisverwendung.mitarbeiter_uid=tbl_mitarbeiter.mitarbeiter_uid)"; + } + + if ($personaccount === true) + $qry .= " AND tbl_mitarbeiter.personalnummer >= 0"; + elseif ($personaccount === false) + $qry .= " AND tbl_mitarbeiter.personalnummer < 0"; + + $params = array(); + if (!isEmptyArray($uids)) + { + $qry .= " AND tbl_mitarbeiter.mitarbeiter_uid IN ?"; + $params[] = $uids; + } + + return $this->execQuery($qry, $params); + } + + /** + * Gibt ein Array mit den UIDs der Vorgesetzten zurück + * @return object + */ + public function getVorgesetzte($uid, $datum_von = null, $datum_bis = null) + { + $datum_von_var = isset($datum_von) ? '?' : 'now()'; + $datum_bis_var = isset($datum_bis) ? '?' : 'now()'; + $qry = "SELECT + DISTINCT uid as vorgesetzter + FROM + public.tbl_benutzerfunktion + WHERE + funktion_kurzbz='Leitung' AND + (datum_von is null OR datum_von<=%s) AND + (datum_bis is null OR datum_bis>=%s) AND + oe_kurzbz in (SELECT oe_kurzbz + FROM public.tbl_benutzerfunktion + WHERE + funktion_kurzbz='oezuordnung' AND uid=? AND + (datum_von is null OR datum_von<=%s) AND + (datum_bis is null OR datum_bis>=%s) + );"; + + $qry = sprintf($qry, $datum_von_var, $datum_bis_var, $datum_von_var, $datum_bis_var); + + $params = array(); + if (isset($datum_von)) + $params[] = $datum_von; + if (isset($datum_bis)) + $params[] = $datum_bis; + + $params[] = $uid; + + if (isset($datum_von)) + $params[] = $datum_von; + if (isset($datum_bis)) + $params[] = $datum_bis; + + return $this->execQuery($qry, $params); + } + + /** + * Checks if alias exists + * @param $kurzbz + */ + public function kurzbzExists($kurzbz) + { + $this->addSelect('1'); + $result = $this->loadWhere(array('kurzbz' => $kurzbz)); + + if (isSuccess($result)) + { + if (hasData($result)) + { + $result = success(array(true)); + } + else + { + $result = success(array(false)); + } + } + + return $result; + } + + /** + * Generates alias for a uid. + * @param $uid + * @return array the alias if newly generated + */ + public function generateKurzbz($uid) + { + $kurzbz = ''; + $this->addLimit(1); + $this->addSelect('vorname, nachname'); + $this->addJoin('public.tbl_benutzer', 'tbl_mitarbeiter.mitarbeiter_uid = tbl_benutzer.uid'); + $this->addJoin('public.tbl_person', 'person_id'); + $nameresult = $this->loadWhere(array('uid' => $uid)); + + if (hasData($nameresult)) + { + $kurzbzdata = getData($nameresult); + $nachname_clean = sanitizeProblemChars($kurzbzdata[0]->nachname); + $vorname_clean = sanitizeProblemChars($kurzbzdata[0]->vorname); + + for ($nn = 6, $vn = 2; $nn != 0; $nn--, $vn++) + { + $kurzbz = mb_substr($nachname_clean, 0, $nn); + $kurzbz .= mb_substr($vorname_clean, 0, $vn); + + $kurzbzexists = $this->kurzbzExists($kurzbz); + + if (hasData($kurzbzexists) && !getData($kurzbzexists)[0]) + break; + } + + $kurzbzexists = $this->kurzbzExists($kurzbz); + + if (hasData($kurzbzexists) && getData($kurzbzexists)[0]) + return error('No Kurzbezeichnung could be generated'); + } + return success($kurzbz); + } } diff --git a/application/models/ressource/Zeitaufzeichnung_model.php b/application/models/ressource/Zeitaufzeichnung_model.php index f887a20a0..b44861d13 100644 --- a/application/models/ressource/Zeitaufzeichnung_model.php +++ b/application/models/ressource/Zeitaufzeichnung_model.php @@ -11,4 +11,14 @@ class Zeitaufzeichnung_model extends DB_Model $this->dbTable = 'campus.tbl_zeitaufzeichnung'; $this->pk = 'zeitaufzeichnung_id'; } + + public function deleteEntriesForCurrentDay() + { + $today = date('Y-m-d'); + $qry = "DELETE FROM " . $this->dbTable . " + WHERE start >= '" . $today . " 00:00:00' + AND start <= '" . $today . " 23:59:59';"; + + return $this->execQuery($qry); + } } diff --git a/application/models/ressource/Zeitsperre_model.php b/application/models/ressource/Zeitsperre_model.php index 07889e349..350a7be58 100644 --- a/application/models/ressource/Zeitsperre_model.php +++ b/application/models/ressource/Zeitsperre_model.php @@ -11,4 +11,13 @@ class Zeitsperre_model extends DB_Model $this->dbTable = 'campus.tbl_zeitsperre'; $this->pk = 'zeitsperre_id'; } + + public function deleteEntriesForCurrentDay() + { + $today = date('Y-m-d'); + $qry = "DELETE FROM " . $this->dbTable . " + WHERE vondatum = '" . $today . "';"; + + return $this->execQuery($qry); + } } diff --git a/application/models/system/JobStatuses_model.php b/application/models/system/JobStatuses_model.php new file mode 100644 index 000000000..82d1ee31b --- /dev/null +++ b/application/models/system/JobStatuses_model.php @@ -0,0 +1,16 @@ +dbTable = 'system.tbl_jobstatuses'; + $this->pk = 'status'; + $this->hasSequence = false; + } +} diff --git a/application/models/system/JobTriggers_model.php b/application/models/system/JobTriggers_model.php new file mode 100644 index 000000000..176b4f5b1 --- /dev/null +++ b/application/models/system/JobTriggers_model.php @@ -0,0 +1,32 @@ +dbTable = 'system.tbl_jobtriggers'; + $this->pk = array('type', 'status', 'followingType'); + $this->hasSequence = false; + } + + /** + * + */ + public function getJobtriggersByTypeStatuses($type, $triggeredStatuses) + { + $query = 'SELECT jt.type, + jt.status, + jt.following_type + FROM system.tbl_jobtriggers jt + WHERE jt.type = ? + AND jt.status IN ? + ORDER BY jt.type, jt.status'; + + return $this->execQuery($query, array($type, $triggeredStatuses)); + } +} diff --git a/application/models/system/JobTypes_model.php b/application/models/system/JobTypes_model.php new file mode 100644 index 000000000..1d578bcab --- /dev/null +++ b/application/models/system/JobTypes_model.php @@ -0,0 +1,16 @@ +dbTable = 'system.tbl_jobtypes'; + $this->pk = 'type'; + $this->hasSequence = false; + } +} diff --git a/application/models/system/JobsQueue_model.php b/application/models/system/JobsQueue_model.php new file mode 100644 index 000000000..e35b45cb3 --- /dev/null +++ b/application/models/system/JobsQueue_model.php @@ -0,0 +1,15 @@ +dbTable = 'system.tbl_jobsqueue'; + $this->pk = 'jobid'; + } +} diff --git a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php index 385845026..e87f0945c 100644 --- a/application/views/lehre/lehrauftrag/acceptLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/acceptLehrauftrag.php @@ -189,7 +189,7 @@ $this->load->view(
- + diff --git a/application/views/lehre/pruefungsprotokoll.php b/application/views/lehre/pruefungsprotokoll.php new file mode 100644 index 000000000..6e0404e1e --- /dev/null +++ b/application/views/lehre/pruefungsprotokoll.php @@ -0,0 +1,232 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Pruefungsprotokoll', + 'jquery' => true, + 'jqueryui' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'dialoglib' => true, + 'ajaxlib' => true, + 'sbadmintemplate' => true, + 'phrases' => array( + 'abschlusspruefung' => array( + 'freigegebenAm', + 'pruefungGespeichert', + 'pruefungSpeichernFehler', + 'abschlussbeurteilungLeer', + 'beginnzeitLeer', + 'beginnzeitFormatError', + 'endezeitLeer', + 'endezeitFormatError', + 'endezeitBeforeError', + 'verfNotice' + ), + 'ui' => array( + 'stunde', + 'minute' + ) + ), + 'customCSSs' => array( + 'public/css/sbadmin2/admintemplate_contentonly.css', + 'vendor/fgelinas/timepicker/jquery.ui.timepicker.css', + 'public/css/lehre/pruefungsprotokoll.css' + ), + 'customJSs' => array( + 'vendor/fgelinas/timepicker/jquery.ui.timepicker.js', + 'public/js/lehre/pruefungsprotokoll.js' + ) + ) +); +?> + +
+
+
+ studiengangstyp == 'Bachelor' ? 'Bachelor' : 'Master'; + $pruefung_name = $abschlusspruefung->studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'pruefungBachelor') : $this->p->t('abschlusspruefung', 'pruefungMaster'); + $arbeit_name = $abschlusspruefung->studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'arbeitBachelor') : $this->p->t('abschlusspruefung', 'arbeitMaster'); + $protokolltextvorlage = $abschlusspruefung->studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'pruefungsnotizenBachelor') : $this->p->t('abschlusspruefung', 'pruefungsnotizenMaster'); + $protokolltext = isset($abschlusspruefung->protokoll) ? $abschlusspruefung->protokoll : $protokolltextvorlage; + ?> +
+
+ +

+ studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'abgehaltenAmBachelor') : $this->p->t('abschlusspruefung', 'abgehaltenAmMaster'); ?> + studiengangbezeichnung : $abschlusspruefung->studiengangbezeichnung_englisch ?>, p->t('abschlusspruefung', 'studiengangskennzahl') ?>  + studiengang_kz ?> +

+
+
+
+
+

+ titelpre_student . ' ' . $abschlusspruefung->vorname_student . ' ' . $abschlusspruefung->nachname_student . ' ' . $abschlusspruefung->titelpost_student?> +

+

p->t('abschlusspruefung', 'personenkennzeichen') ?>: matrikelnr ?>

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + p->t('abschlusspruefung', 'pruefungssenat') ?> +
+ p->t('abschlusspruefung', 'vorsitz') ?> + + titelpre_vorsitz . ' ' . $abschlusspruefung->vorname_vorsitz . ' ' . $abschlusspruefung->nachname_vorsitz . ' ' . $abschlusspruefung->titelpost_vorsitz ?> +
+ p->t('abschlusspruefung', 'erstpruefer') ?> + + titelpre_erstpruefer . ' ' . $abschlusspruefung->vorname_erstpruefer . ' ' . $abschlusspruefung->nachname_erstpruefer . ' ' . $abschlusspruefung->titelpost_erstpruefer ?> +
+ p->t('abschlusspruefung', 'zweitpruefer') ?> + + titelpre_zweitpruefer . ' ' . $abschlusspruefung->vorname_zweitpruefer . ' ' . $abschlusspruefung->nachname_zweitpruefer . ' ' . $abschlusspruefung->titelpost_zweitpruefer ?> +
+ p->t('abschlusspruefung', 'pruefungsdatum') ?> + + datum), 'd.m.Y'); ?> + + p->t('abschlusspruefung', 'pruefungsbeginn') ?> + + + + p->t('abschlusspruefung', 'pruefungsende') ?> + + +
+ p->t('abschlusspruefung', 'pruefungsantritt') ?> + + pruefungsantritt_bezeichnung : $abschlusspruefung->pruefungsantritt_bezeichnung_english; ?> +
+ p->t('abschlusspruefung', 'einverstaendniserklaerungName') ?> + + + p->t('abschlusspruefung', 'einverstaendniserklaerungText') ?> +
+ p->t('abschlusspruefung', 'themaBeurteilung') ?>  + + abschlussarbeit_titel) ? $abschlusspruefung->abschlussarbeit_titel : '' ?> + + p->t('lehre', 'note') ?>: abschlussarbeit_note) ? $abschlusspruefung->abschlussarbeit_note : '' ?> +
+ p->t('abschlusspruefung', 'pruefungsgegenstand') ?> + + studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'pruefungsgegenstandBachelor') : $this->p->t('abschlusspruefung', 'pruefungsgegenstandMaster')) ?> +
+ p->t('global', 'notizen')); ?> +
+ + +
+ studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'beurteilungKriterienBachelor') : $this->p->t('abschlusspruefung', 'beurteilungKriterienMaster') ?> +
+ studiengangstyp == 'Bachelor' ? $this->p->t('abschlusspruefung', 'beurteilungBachelor') : $this->p->t('abschlusspruefung', 'beurteilungMaster') ?>: + + +
+
+
+
+
+
+
+

+ freigabedatum); ?> + +

+
+
+
+
+
+ + p->t('abschlusspruefung', 'freigegebenAm') . ' ' . date_format(date_create($abschlusspruefung->freigabedatum), 'd.m.Y') + ?> + +
+
+
+
+
+
+ + + + + +
+
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/application/views/lehre/pruefungsprotokollUebersicht.php b/application/views/lehre/pruefungsprotokollUebersicht.php new file mode 100644 index 000000000..35bea7963 --- /dev/null +++ b/application/views/lehre/pruefungsprotokollUebersicht.php @@ -0,0 +1,66 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Prüfungsprotokoll', + 'jquery' => true, + 'jqueryui' => true, + 'jquerycheckboxes' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'tablesorter' => true, + 'ajaxlib' => true, + 'dialoglib' => true, + 'tablewidget' => true, + 'phrases' => array( + 'ui' => array( + 'keineDatenVorhanden', + 'heute', + 'letzteWoche', + 'alle', + 'zeitraum' + ) + ), + 'customCSSs' => array('public/css/sbadmin2/tablesort_bootstrap.css'), + 'customJSs' => array('public/js/bootstrapper.js') + ) + ); +?> + + +
+
+
+
+ +
+
+ p->t('abschlusspruefung','einfuehrungstext'); ?> +

+
+
+
+ +
+ + + +
+
+
+
+
+
+ load->view('lehre/pruefungsprotokollUebersichtData.php'); ?> +
+
+
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/lehre/pruefungsprotokollUebersichtData.php b/application/views/lehre/pruefungsprotokollUebersichtData.php new file mode 100644 index 000000000..dd247c2eb --- /dev/null +++ b/application/views/lehre/pruefungsprotokollUebersichtData.php @@ -0,0 +1,72 @@ += '2020-05-27' + ) +ORDER BY datum, nachname, vorname +"; + +$filterWidgetArray = array( + 'query' => $query, + 'tableUniqueId' => 'pruefungsprotokoll', + 'requiredPermissions' => 'lehre/pruefungsbeurteilung', + 'datasetRepresentation' => 'tablesorter', + 'columnsAliases' => array( + ucfirst($this->p->t('global', 'details')), + ucfirst($this->p->t('global', 'name')), + ucfirst($this->p->t('lehre', 'studiengang')), + ucfirst($this->p->t('global', 'datum')), + ucfirst($this->p->t('global', 'status')), + ), + 'formatRow' => function($datasetRaw) { + + /* NOTE: Dont use $this here for PHP Version compatibility */ + $datasetRaw->{'abschlusspruefung_id'} = sprintf( + 'Protokoll ausfüllen', + site_url('lehre/Pruefungsprotokoll/Protokoll'), + $datasetRaw->{'abschlusspruefung_id'} + ); + + if ($datasetRaw->{'datum'} == null) + { + $datasetRaw->{'datum'} = '-'; + } + else + { + $datasetRaw->{'datum'} = date_format(date_create($datasetRaw->{'datum'}),'d.m.Y'); + } + if ($datasetRaw->{'freigabedatum'} == null) + { + $datasetRaw->{'freigabedatum'} = 'offen'; + } + else + { + $datasetRaw->{'freigabedatum'} = 'Freigegeben am: '.date_format(date_create($datasetRaw->{'freigabedatum'}),'d.m.Y'); + } + return $datasetRaw; + }, +); + +echo $this->widgetlib->widget('TableWidget', $filterWidgetArray); + +?> diff --git a/application/views/person/bpk/bpkData.php b/application/views/person/bpk/bpkData.php index 7e375030f..3580ed4bc 100644 --- a/application/views/person/bpk/bpkData.php +++ b/application/views/person/bpk/bpkData.php @@ -3,7 +3,7 @@ 'query' => ' SELECT person_id, vorname, nachname, geschlecht, svnr, ersatzkennzeichen, matr_nr, - staatsbuergerschaft, gebdatum + staatsbuergerschaft, gebdatum, false AS mitarbeiter FROM public.tbl_person WHERE @@ -11,6 +11,17 @@ AND bpk is null AND EXISTS(SELECT 1 FROM public.tbl_benutzer JOIN public.tbl_student ON(uid=student_uid) AND person_id=tbl_person.person_id AND tbl_benutzer.aktiv=true) + UNION + SELECT + person_id, vorname, nachname, geschlecht, svnr, ersatzkennzeichen, matr_nr, + staatsbuergerschaft, gebdatum, true AS mitarbeiter + FROM + public.tbl_person + JOIN public.tbl_benutzer USING(person_id) + JOIN public.tbl_mitarbeiter ON (mitarbeiter_uid=uid) + WHERE + bpk is null + AND tbl_benutzer.aktiv=true ', 'requiredPermissions' => 'admin', 'datasetRepresentation' => 'tablesorter', @@ -25,6 +36,7 @@ ucfirst($this->p->t('person', 'matrikelnummer')), ucfirst($this->p->t('person', 'staatsbuergerschaft')), ucfirst($this->p->t('person', 'geburtsdatum')), + 'Mitarbeiter' ), 'formatRow' => function($datasetRaw) { @@ -45,6 +57,11 @@ { $datasetRaw->{'svnr'} = '-'; } + if ($datasetRaw->{'matr_nr'} == null) + { + $datasetRaw->{'matr_nr'} = '-'; + } + $datasetRaw->{'mitarbeiter'} = $datasetRaw->{'mitarbeiter'} == 'true' ? 'ja' : 'nein'; return $datasetRaw; } diff --git a/application/views/system/jq/jobsQueueViewer.php b/application/views/system/jq/jobsQueueViewer.php new file mode 100644 index 000000000..6d92d610b --- /dev/null +++ b/application/views/system/jq/jobsQueueViewer.php @@ -0,0 +1,47 @@ +load->view( + 'templates/FHC-Header', + array( + 'title' => 'Jobs Queue Viewer', + 'jquery' => true, + 'jqueryui' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'sbadmintemplate' => true, + 'tablesorter' => true, + 'ajaxlib' => true, + 'filterwidget' => true, + 'navigationwidget' => true, + 'phrases' => array( + 'global' => array('mailAnXversandt'), + 'ui' => array('bitteEintragWaehlen') + ), + 'customCSSs' => 'public/css/sbadmin2/tablesort_bootstrap.css', + 'customJSs' => array('public/js/bootstrapper.js') + ) + ); +?> + + +
+ + widgetlib->widget('NavigationWidget'); ?> + +
+
+
+
+ +
+
+
+ load->view('system/jq/jobsQueueViewerData.php'); ?> +
+
+
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/jq/jobsQueueViewerData.php b/application/views/system/jq/jobsQueueViewerData.php new file mode 100644 index 000000000..023ec5406 --- /dev/null +++ b/application/views/system/jq/jobsQueueViewerData.php @@ -0,0 +1,67 @@ + ' + SELECT jq.jobid AS "JobId", + jq.creationtime AS "CreationTime", + jq.type AS "Type", + jq.status AS "Status", + jq.starttime AS "StartTime", + jq.endtime AS "EndTime", + jq.insertvon AS "UserService" + FROM system.tbl_jobsqueue jq + ORDER BY jq.creationtime DESC, jq.starttime DESC, jq.endtime DESC + ', + 'requiredPermissions' => 'admin', + 'datasetRepresentation' => 'tablesorter', + 'columnsAliases' => array( + 'Job id', + 'Creation time', + 'Type', + 'Status', + 'Start time', + 'End time', + 'User/Service' + ), + 'formatRow' => function($datasetRaw) { + + $datasetRaw->CreationTime = date_format(date_create($datasetRaw->CreationTime), 'd.m.Y H:i:s'); + $datasetRaw->StartTime = date_format(date_create($datasetRaw->StartTime), 'd.m.Y H:i:s'); + $datasetRaw->EndTime = date_format(date_create($datasetRaw->EndTime), 'd.m.Y H:i:s'); + + return $datasetRaw; + }, + 'markRow' => function($datasetRaw) { + + $mark = ''; + + if ($datasetRaw->Status == JobsQueueLib::STATUS_FAILED) + { + $mark = 'text-red'; + } + + if ($datasetRaw->Status == JobsQueueLib::STATUS_DONE) + { + $mark = 'text-green'; + } + + if ($datasetRaw->Status == JobsQueueLib::STATUS_RUNNING) + { + $mark = 'text-orange'; + } + + if ($datasetRaw->Status == JobsQueueLib::STATUS_NEW) + { + $mark = 'text-info'; + } + + return $mark; + } + ); + + $filterWidgetArray['app'] = 'core'; + $filterWidgetArray['datasetName'] = 'jq'; + $filterWidgetArray['filter_id'] = $this->input->get('filter_id'); + + echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); +?> diff --git a/application/views/system/logs/logsViewer.php b/application/views/system/logs/logsViewer.php index 96790b479..86423006b 100644 --- a/application/views/system/logs/logsViewer.php +++ b/application/views/system/logs/logsViewer.php @@ -2,7 +2,7 @@ $this->load->view( 'templates/FHC-Header', array( - 'title' => 'Logs viewer', + 'title' => 'Logs Viewer', 'jquery' => true, 'jqueryui' => true, 'bootstrap' => true, @@ -32,7 +32,7 @@
diff --git a/application/views/system/logs/logsViewerData.php b/application/views/system/logs/logsViewerData.php index 13a4207ab..f8476df6a 100644 --- a/application/views/system/logs/logsViewerData.php +++ b/application/views/system/logs/logsViewerData.php @@ -25,7 +25,7 @@ ), 'formatRow' => function($datasetRaw) { - $datasetRaw->ExecutionTime = date_format(date_create($datasetRaw->ExecutionTime), 'd.m.Y H:i:s'); + $datasetRaw->ExecutionTime = date_format(date_create($datasetRaw->ExecutionTime), 'd.m.Y H:i:s:u'); return $datasetRaw; }, @@ -33,22 +33,22 @@ $mark = ''; - if ($datasetRaw->RequestId == 'Cronjob error') + if (strpos($datasetRaw->RequestId, 'error') != false) { $mark = 'text-red'; } - if ($datasetRaw->RequestId == 'Cronjob info') + if (strpos($datasetRaw->RequestId, 'info') != false) { $mark = 'text-green'; } - if ($datasetRaw->RequestId == 'Cronjob warning') + if (strpos($datasetRaw->RequestId, 'warning') != false) { $mark = 'text-orange'; } - if ($datasetRaw->RequestId == 'Cronjob debug') + if (strpos($datasetRaw->RequestId, 'debug') != false) { $mark = 'text-info'; } @@ -63,3 +63,4 @@ echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); ?> + diff --git a/application/widgets/Organisationseinheit_widget.php b/application/widgets/Organisationseinheit_widget.php index e4fbfe2ba..8aba73acc 100644 --- a/application/widgets/Organisationseinheit_widget.php +++ b/application/widgets/Organisationseinheit_widget.php @@ -31,7 +31,10 @@ class Organisationseinheit_widget extends DropdownWidget { // NOTE: no need to call addSelectToModel because getRecursiveList already returns // the correct names of the fields - $this->setElementsArray($this->OrganisationseinheitModel->getRecursiveList()); + $this->setElementsArray($this->OrganisationseinheitModel->getRecursiveList(), + true, + $this->p->t('lehre', 'organisationseinheit'), + 'No organisational unit found'); } $this->loadDropDownView($widgetData); diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php index cc551b600..713b93dc5 100644 --- a/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php +++ b/cis/private/lehre/benotungstool/lvgesamtnoteverwalten.php @@ -812,6 +812,7 @@ if (isset($_REQUEST["freigabe"]) && ($_REQUEST["freigabe"] == 1)) { $studlist .= " " . $p->t('global/personenkz') . " + " . $p->t('global/studiengang') . " " . $p->t('global/nachname') . " " . $p->t('global/vorname') . " "; @@ -834,10 +835,11 @@ if (isset($_REQUEST["freigabe"]) && ($_REQUEST["freigabe"] == 1)) // studentenquery $qry_stud = "SELECT - DISTINCT uid, vorname, nachname, matrikelnr + DISTINCT uid, vorname, nachname, matrikelnr, kurzbzlang FROM campus.vw_student_lehrveranstaltung JOIN campus.vw_student USING(uid) + JOIN public.tbl_studiengang ON campus.vw_student.studiengang_kz = public.tbl_studiengang.studiengang_kz WHERE studiensemester_kurzbz = " . $db->db_add_param($stsem) . " AND lehrveranstaltung_id = " . $db->db_add_param($lvid, FHC_INTEGER) . " @@ -859,6 +861,7 @@ if (isset($_REQUEST["freigabe"]) && ($_REQUEST["freigabe"] == 1)) if (defined('CIS_GESAMTNOTE_FREIGABEMAIL_NOTE') && CIS_GESAMTNOTE_FREIGABEMAIL_NOTE) { $studlist .= "" . trim($row_stud->matrikelnr) . ""; + $studlist .= "" . trim($row_stud->kurzbzlang) . ""; $studlist .= "" . trim($row_stud->nachname) . ""; $studlist .= "" . trim($row_stud->vorname) . ""; diff --git a/cis/private/lehre/pruefung/pruefung.js.php b/cis/private/lehre/pruefung/pruefung.js.php index 247ee950e..5376dd5f7 100644 --- a/cis/private/lehre/pruefung/pruefung.js.php +++ b/cis/private/lehre/pruefung/pruefung.js.php @@ -178,7 +178,7 @@ function loadPruefungsfenster() success: function(data){ if(data.result.length === 0) { - messageBox("message", "t('pruefung/keinFensterVorhanden'); ?>", "red", "highlight", 1000); + messageBox("message", "t('pruefung/keinFensterVorhanden'); ?>", "red", "highlight", 10000); $("#pruefungsfenster").html(""); } else @@ -617,7 +617,7 @@ function saveAnmeldung(lehrveranstaltung_id, termin_id) else { //Wenn Anmeldung durch Lektor - showAnmeldungen(termin_id, lehrveranstaltung_id); + showAnmeldungen(termin_id, lehrveranstaltung_id, false, false); } } }); @@ -725,6 +725,11 @@ function refresh() loadPruefungen(); loadPruefungenOfStudiengang(); loadPruefungenGesamt(); + + if ($("#filter_studiensemester").val() == "0") + $("#additional-exams").hide(); + else + $("#additional-exams").show(); } /** @@ -763,9 +768,10 @@ function convertDateTime(string, type) * @param {type} pruefungstermin_id ID des Prüfungstermins * @param {type} lehrveranstaltung_id ID der Lehrveranstaltung * @param saveReihungAfterShow speichert Reihung neu wenn true + * @param showMessage steuert ob Meldung angzeigt werden soll * @returns {undefined} */ -function showAnmeldungen(pruefungstermin_id, lehrveranstaltung_id, saveReihungAfterShow = false) +function showAnmeldungen(pruefungstermin_id, lehrveranstaltung_id, saveReihungAfterShow = false, showMessage = true) { $("#kommentar").empty(); $("#kommentarSpeichernButton").empty(); @@ -780,7 +786,7 @@ function showAnmeldungen(pruefungstermin_id, lehrveranstaltung_id, saveReihungAf }, error: loadError, success: function(data){ - writeAnmeldungen(data); + writeAnmeldungen(data, showMessage); $("#sortable").sortable(); $("#sortable").disableSelection(); @@ -790,7 +796,7 @@ function showAnmeldungen(pruefungstermin_id, lehrveranstaltung_id, saveReihungAf }); } -function writeAnmeldungen(data) +function writeAnmeldungen(data, showMessage = true) { if(data.error === 'false') { @@ -862,7 +868,10 @@ function writeAnmeldungen(data) $("#kommentarSpeichernButton").empty(); $("#raumLink").empty(); $("#listeDrucken").empty(); - messageBox("message", data.errormsg, "red", "highlight", 1000); + + if (showMessage) + messageBox("message", data.errormsg, "red", "highlight", 10000); + if (data.lv_bezeichnung) { $("#lvdaten").html(data.lv_bezeichnung+" ("+data.termin_datum+")"); @@ -910,11 +919,11 @@ function saveReihung(terminId, lehrveranstaltung_id) success: function(data){ if(data.error === 'false' && data.result === true) { - messageBox("message", "t('pruefung/reihunghErfolgreichGeaendert'); ?>", "green", "highlight", 1000); + messageBox("message", "t('pruefung/reihunghErfolgreichGeaendert'); ?>", "green", "highlight", 10000); } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } showAnmeldungen(terminId, lehrveranstaltung_id); @@ -951,7 +960,7 @@ function anmeldungBestaetigen(pruefungsanmeldung_id, termin_id, lehrveranstaltun } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } } }); @@ -988,7 +997,7 @@ function anmeldungLoeschen(pruefungsanmeldung_id, termin_id, lehrveranstaltung_i } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } } }); @@ -1022,7 +1031,7 @@ function alleBestaetigen(termin_id, lehrveranstaltung_id) } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } } }); @@ -1074,7 +1083,7 @@ function loadStudiengaenge() } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } } }); @@ -1133,7 +1142,7 @@ function loadPruefungStudiengang(studiengang_kz, studiensemester) } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } } }); @@ -1178,7 +1187,7 @@ function saveKommentar(pruefungsanmeldung_id, termin_id, lehrveranstaltung_id) }, error: loadError, success: function(data){ - messageBox("message", "t('pruefung/kommentarErfolgreichGespeichert'); ?>", "green", "highlight", 1000); + messageBox("message", "t('pruefung/kommentarErfolgreichGespeichert'); ?>", "green", "highlight", 10000); showAnmeldungen(termin_id, lehrveranstaltung_id); } }); @@ -1396,7 +1405,7 @@ function savePruefungstermin() if(error) { - messageBox("message", "t('pruefung/formulardatenNichtKorrekt'); ?>", "red", "highlight", 3000); + messageBox("message", "t('pruefung/formulardatenNichtKorrekt'); ?>", "red", "highlight", 10000); } else { @@ -1422,12 +1431,12 @@ function savePruefungstermin() unmarkMissingFormEntry(); if(data.error === "false") { - messageBox("message", "t('pruefung/pruefungErfolgreichGespeichert'); ?>", "green", "highlight", 1000); + messageBox("message", "t('pruefung/pruefungErfolgreichGespeichert'); ?>", "green", "highlight", 10000); resetPruefungsverwaltung(); } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } } }); @@ -1530,7 +1539,7 @@ function loadPruefungsDetails(prfId) }).done(function(data){ if(data.result.length === 0) { - messageBox("message", "t('pruefung/keinePruefungsfensterGespeichert'); ?>", "red", "highlight", 1000); + messageBox("message", "t('pruefung/keinePruefungsfensterGespeichert'); ?>", "red", "highlight", 10000); $("#pruefungsfenster").html(""); } else @@ -1823,7 +1832,7 @@ function updatePruefung(prfId) if(error) { - messageBox("message", "t('pruefung/formulardatenNichtKorrekt'); ?>", "red", "highlight", 3000); + messageBox("message", "t('pruefung/formulardatenNichtKorrekt'); ?>", "red", "highlight", 10000); } else { @@ -1851,12 +1860,12 @@ function updatePruefung(prfId) unmarkMissingFormEntry(); if(data.error === "false") { - messageBox("message", "t('pruefung/pruefungErfolgreichGespeichert'); ?>", "green", "highlight", 1000); + messageBox("message", "t('pruefung/pruefungErfolgreichGespeichert'); ?>", "green", "highlight", 10000); resetPruefungsverwaltung(); } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } }).always(function(){ loadAllPruefungen(); @@ -1886,11 +1895,11 @@ function deleteLehrveranstaltungFromPruefung(lvId, pruefung_id) }).done(function(data){ if(data.error === "false") { - messageBox("message", "t('pruefung/lvErfolgreichEntfernt'); ?>", "green", "highlight", 1000); + messageBox("message", "t('pruefung/lvErfolgreichEntfernt'); ?>", "green", "highlight", 10000); } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } }).always(function(){ loadPruefungsDetails(pruefung_id); @@ -1917,11 +1926,11 @@ function stornoPruefung(pruefung_id) }).done(function(data){ if(data.error === "false") { - messageBox("message", "t('pruefung/pruefungStorniert'); ?>", "green", "highlight", 1000); + messageBox("message", "t('pruefung/pruefungStorniert'); ?>", "green", "highlight", 10000); } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } }).always(function(){ loadAllPruefungen(); @@ -1950,11 +1959,11 @@ function terminLoeschen(pruefung_id, pruefungstermin_id) }).done(function(data){ if(data.error === "false") { - messageBox("message", "t('pruefung/terminGeloescht'); ?>", "green", "highlight", 1000); + messageBox("message", "t('pruefung/terminGeloescht'); ?>", "green", "highlight", 10000); } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } }).always(function(){ loadPruefungsDetails(pruefung_id); @@ -2009,7 +2018,7 @@ function loadAllPruefungen() } else { - messageBox("message", data.errormsg, "red", "highlight", 1000); + messageBox("message", data.errormsg, "red", "highlight", 10000); } }).always(function(event, xhr, settings){ if($("#prfTable")[0].hasInitialized !== true) diff --git a/cis/private/lehre/pruefung/pruefungsanmeldung.json.php b/cis/private/lehre/pruefung/pruefungsanmeldung.json.php index ce7479cf0..e201fbe30 100644 --- a/cis/private/lehre/pruefung/pruefungsanmeldung.json.php +++ b/cis/private/lehre/pruefung/pruefungsanmeldung.json.php @@ -53,7 +53,7 @@ $method = isset($_REQUEST['method'])?$_REQUEST['method']:''; switch($method) { case 'getPruefungByLv': - $studiensemester = isset($_REQUEST['studiensemester']) ? $_REQUEST['studiensemester'] : NULL; + $studiensemester = isset($_REQUEST['studiensemester']) && $_REQUEST['studiensemester'] != '0' ? $_REQUEST['studiensemester'] : NULL; $data = getPruefungByLv($studiensemester, $uid); break; case 'getPruefungByLvFromStudiengang': @@ -156,7 +156,7 @@ function getPruefungByLv($aktStudiensemester = null, $uid = null) } $lehrveranstaltungen=$lvIds; $pruefung = new pruefungCis(); - if($pruefung->getPruefungByLv($lehrveranstaltungen)) + if($pruefung->getPruefungByLv($lehrveranstaltungen, $uid)) { $pruefungen = array(); foreach($pruefung->lehrveranstaltungen as $key=>$lv) @@ -164,7 +164,10 @@ function getPruefungByLv($aktStudiensemester = null, $uid = null) $lehrveranstaltung = new lehrveranstaltung($lv->lehrveranstaltung_id); $lehrveranstaltung = $lehrveranstaltung->cleanResult(); $lehreinheit = new lehreinheit(); - $lehreinheit->load_lehreinheiten($lehrveranstaltung[0]->lehrveranstaltung_id, $aktStudiensemester); + if ($aktStudiensemester == null) + $lehreinheit->load_all_lehreinheiten($lehrveranstaltung[0]->lehrveranstaltung_id); + else + $lehreinheit->load_lehreinheiten($lehrveranstaltung[0]->lehrveranstaltung_id, $aktStudiensemester); $lehreinheiten = $lehreinheit->lehreinheiten; $prf = new stdClass(); $temp = new pruefungCis($lv->pruefung_id); @@ -612,13 +615,14 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null) $stdsem = $aktStudiensemester; $prestudenten = array(); + $gueltigerStatus = array("Student", "Unterbrecher", "Absolvent"); foreach ($prestudent->result as $ps) { // prüfen ob Student zum Zeitpunkt der LV oder zumindest irgendwann Student im Studiengang war/ist if ($ps->getLaststatus($ps->prestudent_id, $stdsem_lv_besuch) || $ps->studiengang_kz == $studiengang_kz) { - if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher") || ($ps->status_kurzbz == "")) + if (in_array($ps->status_kurzbz, $gueltigerStatus) || ($ps->status_kurzbz == "")) { array_push($prestudenten, $ps); } @@ -634,7 +638,7 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null) { if ($ps->getLaststatus($ps->prestudent_id, $stdsem)) { - if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher")) + if (in_array($ps->status_kurzbz, $gueltigerStatus)) { $prestudent_id = $ps->prestudent_id; } @@ -642,7 +646,7 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null) { if ($ps->getLaststatus($ps->prestudent_id, $stdsem_lv_besuch)) { - if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher")) + if (in_array($ps->status_kurzbz, $gueltigerStatus)) { $prestudent_id = $ps->prestudent_id; } @@ -653,7 +657,7 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null) { if ($ps->getLaststatus($ps->prestudent_id, $stdsem_lv_besuch)) { - if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher")) + if (in_array($ps->status_kurzbz, $gueltigerStatus)) { $prestudent_id = $ps->prestudent_id; } @@ -667,7 +671,7 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null) { if ($ps->getLaststatus($ps->prestudent_id, $stdsem)) { - if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher")) + if (in_array($ps->status_kurzbz, $gueltigerStatus)) { $prestudent_id = $ps->prestudent_id; } @@ -675,7 +679,7 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null) { if ($ps->getLaststatus($ps->prestudent_id, $stdsem_lv_besuch)) { - if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher")) + if (in_array($ps->status_kurzbz, $gueltigerStatus)) { $prestudent_id = $ps->prestudent_id; } @@ -686,7 +690,7 @@ function saveAnmeldung($aktStudiensemester = null, $uid = null) { if ($ps->getLaststatus($ps->prestudent_id, $stdsem_lv_besuch)) { - if (($ps->status_kurzbz == "Student") || ($ps->status_kurzbz == "Unterbrecher")) + if (in_array($ps->status_kurzbz, $gueltigerStatus)) { $prestudent_id = $ps->prestudent_id; } diff --git a/cis/private/lehre/pruefung/pruefungsanmeldung.php b/cis/private/lehre/pruefung/pruefungsanmeldung.php index f32c508e7..c969c51aa 100644 --- a/cis/private/lehre/pruefung/pruefungsanmeldung.php +++ b/cis/private/lehre/pruefung/pruefungsanmeldung.php @@ -187,21 +187,15 @@ $studiensemester->getAll(); ".$p->t('pruefung/anmeldungFuer')." ".$benutzer->vorname." ".$benutzer->nachname." (".$uid.")"; - echo '

'.$p->t('pruefung/filter').'

'; - echo '

'.$p->t('global/studiensemester').': '; + echo '

'.$p->t('pruefung/filter').'

'; + echo '

'.$p->t('global/studiensemester').': '; echo '

'; ?>
@@ -240,43 +234,45 @@ $studiensemester->getAll();
- -

t('pruefung/lvVonStudiengang'); ?>

-
- - - - - - - - - - - -
t('global/institut'); ?>t('global/lehrveranstaltung'); ?>t('pruefung/pruefungTermin'); ?>t('pruefung/freiePlaetze'); ?>
-
- + +
diff --git a/cis/private/lehre/swd.php b/cis/private/lehre/swd.php index dfdebfcdb..b7fa82ac5 100644 --- a/cis/private/lehre/swd.php +++ b/cis/private/lehre/swd.php @@ -1,5 +1,5 @@ , - * Andreas Oesterreicher , - * Rudolf Hangl and - * Gerald Simane-Sequens . - */ - require_once('../../../config/cis.config.inc.php'); - require_once('../../../include/functions.inc.php'); - require_once('../../../include/datum.class.php'); - require_once('../../../include/benutzer.class.php'); - require_once('../../../include/student.class.php'); - require_once('../../../include/studiengang.class.php'); - require_once('../../../include/benutzerberechtigung.class.php'); - require_once('../../../include/studiensemester.class.php'); - - if (!$db = new basis_db()) - die('Fehler beim Oeffnen der Datenbankverbindung'); - $uid=isset($_GET['uid'])?$_GET['uid']:(isset($_POST['uid'])?$_POST['uid']:get_uid()); - $uid=trim($uid); - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($uid); - - if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 's') || !$rechte->isBerechtigt('admin')) - die($rechte->errormsg); - unset($rechte); - - header('Content-Type: text/html;charset=UTF-8'); -?> - - - - - Anzahl Studenten Lehrveranstaltungsplan FH Technikum-Wien - +, + * Andreas Oesterreicher , + * Rudolf Hangl and + * Gerald Simane-Sequens . + */ + require_once('../../../config/cis.config.inc.php'); + require_once('../../../include/functions.inc.php'); + require_once('../../../include/datum.class.php'); + require_once('../../../include/benutzer.class.php'); + require_once('../../../include/student.class.php'); + require_once('../../../include/studiengang.class.php'); + require_once('../../../include/benutzerberechtigung.class.php'); + require_once('../../../include/studiensemester.class.php'); + + if (!$db = new basis_db()) + die('Fehler beim Oeffnen der Datenbankverbindung'); + $uid=isset($_GET['uid'])?$_GET['uid']:(isset($_POST['uid'])?$_POST['uid']:get_uid()); + $uid=trim($uid); + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($uid); + + if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 's') && !$rechte->isBerechtigt('admin')) + die($rechte->errormsg); + unset($rechte); + + header('Content-Type: text/html;charset=UTF-8'); +?> + + + + + Anzahl Studenten Lehrveranstaltungsplan FH Technikum-Wien + - - - - - - - -
-
-
-
-
-
- - - -
-
drucken
- -
-
schliessen  
- -
-
-
-
-
-
-getaktorNext(); - $objSS->load($ss); - $datum_obj = new datum(); - $ss_begin=$datum_obj->mktime_fromdate($objSS->start); - $ss_ende=$datum_obj->mktime_fromdate($objSS->ende); - - - $sql_query=' select tbl_adresse.plz,tbl_adresse.name, sum(tbl_ort.max_person) as summe '; - $sql_query.=' from public.tbl_ort,public.tbl_standort, public.tbl_adresse '; - $sql_query.=" where tbl_standort.standort_id=tbl_ort.standort_id "; - $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; - $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; - $sql_query.=" and tbl_ort.aktiv and tbl_ort.lehre "; - $sql_query.=" group by tbl_adresse.plz,tbl_adresse.name "; - // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag - if(!$results_anzahl=$db->db_query($sql_query)) - die($db->db_last_error()); - $raum_max_anz=0; - $fh_name='FH lese fehler'; - if ($num_rows_anzahl=$db->db_num_rows($results_anzahl)) - { - $fh_name = $db->db_result($results_anzahl,0,"name").', '.$db->db_result($results_anzahl,0,"plz"); - $raum_max_anz = $db->db_result($results_anzahl,0,"summe"); - } - - $stg=array(); - echo '

-  Lehrveranstaltungsplan >> Wochenplan - Anzahl Studenten -    << - Wochenplan  Kw '.$kw.' -  >> -    Heute -

'; - - // Stundentafel abfragen - $sql_query="SELECT stunde, beginn, ende FROM lehre.tbl_stunde ORDER BY stunde"; - if(!$results=$db->db_query($sql_query)) - die($db->db_last_error()); - - - echo ''; - echo ''; - echo ''; - echo ''; - for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.date('d M',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; - } - echo ''; - - $max_person_array=array(); - $num_rows_stunde=$db->db_num_rows($results); - echo ''; - for ($k=0; $k<$num_rows_stunde; $k++) - { - $row = $db->db_fetch_object($results, $k); - $row->show_beginn=substr($row->beginn,0,5); - $row->show_ende=substr($row->ende,0,5); - $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); - $row->check_ende=str_replace(':','',substr($row->ende,0,5)); - - echo ''; - $lehreinheiten=array(); - - for ($i=0; $i= $row->check_beginn && date('Hi')<=$row->check_ende ) - $aktiv=true; - - echo ''; - else - $tooltip.=''; - $tooltip.=''; - $gefunden_anz+=$row_anz->anz; - } - - if (!empty($gefunden_anz)) - { - $tooltip.=''; - - echo '
Gesamt: '.$gefunden_anz; - echo ''; - } - echo ''; - - - if (!isset($max_person_array[$i]['tag'])) - $max_person_array[$i]['tag']=0; - $max_person_array[$i]['tag']=$max_person_array[$i]['tag']+$gefunden_anz; - if (!isset($max_person_array[$i]['tag_max'])) - $max_person_array[$i]['tag_max']=0; - $max_person_array[$i]['tag_max']=$max_person_array[$i]['tag_max']+$max_person; - - if (!isset($max_person_array[$k]['stunde'])) - $max_person_array[$k]['stunde']=0; - $max_person_array[$k]['stunde']=$max_person_array[$k]['stunde']+$gefunden_anz; - if (!isset($max_person_array[$k]['stunde_max'])) - $max_person_array[$k]['stunde_max']=0; - $max_person_array[$k]['stunde_max']=$max_person_array[$k]['stunde_max']+$max_person; - - if (!isset($max_person_array[$i][$k]['tag_stunde'])) - $max_person_array[$i][$k]['tag_stunde']=0; - $max_person_array[$i][$k]['tag_stunde']=$max_person_array[$i][$k]['tag_stunde']+$gefunden_anz; - if (!isset($max_person_array[$i][$k]['tag_stunde_max'])) - $max_person_array[$i][$k]['tag_stunde_max']=0; - $max_person_array[$i][$k]['tag_stunde_max']=$max_person_array[$i][$k]['tag_stunde_max']+$max_person; - - } - echo ''; - - } - echo '
'. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
Stunde
'.$row->show_beginn.'
'.$row->show_ende.'
'; - - $sql_query=' select distinct vw_'.$stpl_table.'.stg_bezeichnung as bezeichnung,vw_'.$stpl_table.'.stg_kurzbzlang as kurzbzlang,vw_'.$stpl_table.'.stg_kurzbz as kurzbz, vw_'.$stpl_table.'.'.$stpl_table.'_id,vw_'.$stpl_table.'.lehrform, vw_'.$stpl_table.'.gruppe, vw_'.$stpl_table.'.gruppe_kurzbz, vw_'.$stpl_table.'.unr,vw_'.$stpl_table.'.verband,vw_'.$stpl_table.'.ort_kurzbz,vw_'.$stpl_table.'.lehreinheit_id,vw_'.$stpl_table.'.studiengang_kz,vw_'.$stpl_table.'.semester,tbl_ort.max_person,tbl_standort.adresse_id,tbl_adresse.plz,tbl_adresse.name '; - $sql_query.=' from lehre.vw_'.$stpl_table.', public.tbl_ort,public.tbl_standort, public.tbl_adresse '; - $sql_query.=" where vw_".$stpl_table.".datum=".$db->db_add_param(date('Y-m-d',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))))." "; - $sql_query.=" and vw_".$stpl_table.".stunde=".$db->db_add_param($row->stunde, FHC_INTEGER)." "; - $sql_query.=" and tbl_ort.ort_kurzbz=vw_".$stpl_table.".ort_kurzbz "; - $sql_query.=" and tbl_standort.standort_id=tbl_ort.standort_id "; - $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; - $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; - $sql_query.=" order by tbl_adresse.plz,vw_".$stpl_table.".ort_kurzbz "; - - // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag - if(!$results_anzahl=$db->db_query($sql_query)) - die($db->db_last_error()); - $num_rows_anzahl=$db->db_num_rows($results_anzahl); - - $gefunden_anz=0; - $tooltip=''; - for ($k_anz=0; $k_anz<$num_rows_anzahl; $k_anz++) - { - $row_anz = $db->db_fetch_object($results_anzahl, $k_anz); - // Lehreinheit wird aufgeteilt in zwei Raeume - nicht verarbeiten , das sind die selben Personen - if (isset($lehreinheiten[trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz)])) - continue; - $lehreinheiten[$row_anz->lehreinheit_id]=trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz); - - $max_person=$row_anz->max_person+$max_person; - $row_anz->verband=trim($row_anz->verband); - $row_anz->gruppe=trim($row_anz->gruppe); - $row_anz->gruppe_kurzbz=trim($row_anz->gruppe_kurzbz); - - $stsem=$ss; - - $gruppe=($row_anz->gruppe_kurzbz?$row_anz->gruppe_kurzbz:null); - $student=new student(); - - $row_anz->anz=0; - if ($result=$student->getStudents($row_anz->studiengang_kz,$row_anz->semester,$row_anz->verband,$row_anz->gruppe,$gruppe, $stsem)) - $row_anz->anz=count($result); - - - if (empty($row_anz->anz)) - $fehler=true; - - $lvb=$row_anz->kurzbzlang.'-'.$row_anz->semester; - if (!is_null($row_anz->verband) && !empty($row_anz->verband)) - { - $lvb.=$row_anz->verband; - if (!is_null($row_anz->gruppe) && !empty($row_anz->gruppe) ) - $lvb.=$row_anz->gruppe; - } - if (!empty($k_anz)) - $tooltip.='
'. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.$row->show_beginn.' - '.$row->show_ende.'Anzahl
stundenplan_id:$row_anz->stundenplandev_id).'\'>'.trim($row_anz->ort_kurzbz).' ort_kurzbz).'\' target=\'_blank\' titel=\'Studiengang Kz '.$row_anz->studiengang_kz.'\'>'.$lvb.' '.$row_anz->gruppe_kurzbz.' '.(!$row_anz->anz?'':'').$row_anz->bezeichnung.(!$row_anz->anz?'':'').' '.$row_anz->anz.'
max.Personen:'.$max_person.' Belegung:'. number_format($gefunden_anz / $max_person,2)*100 .'% Ges.:'.$gefunden_anz.'
'; - - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($uid); - if($rechte->isBerechtigt('admin')) - { - echo ''; - echo ''; - - echo ''; - echo ''; - for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; - } - echo ''; - $stunde_proz=0; - $stunde=0; - $stunde_max=0; - for ($k=0; $k<$num_rows_stunde; $k++) - { - $row = $db->db_fetch_object($results, $k); - $row->show_beginn=substr($row->beginn,0,5); - $row->show_ende=substr($row->ende,0,5); - $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); - $row->check_ende=str_replace(':','',substr($row->ende,0,5)); - echo ''; - echo ''; - echo ''; - - $stunde=$stunde+$max_person_array[$k]['stunde']; - $stunde_max=$stunde_max+$max_person_array[$k]['stunde_max']; - - for ($i=0; $i'; - echo 'anz.:'.$max_person_array[$i][$k]['tag_stunde']; - echo '
'; - echo 'FH   max.:'. $raum_max_anz; - echo '
'; - echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $raum_max_anz,2)*100:0).'%'; - echo '
'; - echo 'Raum max.:'. $max_person_array[$i][$k]['tag_stunde_max']; - echo '
'; - echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $max_person_array[$i][$k]['tag_stunde_max'],2)*100:0).'%'; - echo ''; - } - echo '
'; - } - - - echo ''; - echo ''; - - echo ''; - - - for ($i=0; $i'; - echo 'FH      Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / ($raum_max_anz *$num_rows_stunde),2)*100:0).'%'; - echo '
'; - echo 'Raum Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / $max_person_array[$i]['tag_max'],2)*100:0).'%'; - echo ''; - } - - echo '
'; - - - echo '
'. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
Zeit / Datum – 
'.$row->show_beginn.'
'.$row->show_ende.'
'; - echo 'anz.:'.$max_person_array[$k]['stunde']; - echo '
'; - echo 'FH   '.($raum_max_anz*TAGE_PRO_WOCHE); - echo '
'; - echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde'])/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; - echo '
'; - echo 'Raum '.$max_person_array[$k]['stunde_max']; - echo '
'; - echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde']/TAGE_PRO_WOCHE) / ($max_person_array[$k]['stunde_max']/TAGE_PRO_WOCHE),2)*100:0).'%'; - echo '
Ø'; - echo 'FH      Ø '.($stunde?number_format(($stunde)/$num_rows_stunde/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; - echo '
'; - echo 'Raum Ø '.($stunde_max?number_format(($stunde/$num_rows_stunde/TAGE_PRO_WOCHE) / ($stunde_max/$num_rows_stunde/TAGE_PRO_WOCHE),2)*100:0).'%'; - echo '
'; - } -?> - - + + + + + + + +
+
+
+
+
+
+ + + +
+
drucken
+ +
+
schliessen  
+ +
+
+
+
+
+
+getaktorNext(); + $objSS->load($ss); + $datum_obj = new datum(); + $ss_begin=$datum_obj->mktime_fromdate($objSS->start); + $ss_ende=$datum_obj->mktime_fromdate($objSS->ende); + + + $sql_query=' select tbl_adresse.plz,tbl_adresse.name, sum(tbl_ort.max_person) as summe '; + $sql_query.=' from public.tbl_ort,public.tbl_standort, public.tbl_adresse '; + $sql_query.=" where tbl_standort.standort_id=tbl_ort.standort_id "; + $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; + $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; + $sql_query.=" and tbl_ort.aktiv and tbl_ort.lehre "; + $sql_query.=" group by tbl_adresse.plz,tbl_adresse.name "; + // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag + if(!$results_anzahl=$db->db_query($sql_query)) + die($db->db_last_error()); + $raum_max_anz=0; + $fh_name='FH lese fehler'; + if ($num_rows_anzahl=$db->db_num_rows($results_anzahl)) + { + $fh_name = $db->db_result($results_anzahl,0,"name").', '.$db->db_result($results_anzahl,0,"plz"); + $raum_max_anz = $db->db_result($results_anzahl,0,"summe"); + } + + $stg=array(); + echo '

+  Lehrveranstaltungsplan >> Wochenplan - Anzahl Studenten +    << + Wochenplan  Kw '.$kw.' +  >> +    Heute +

'; + + // Stundentafel abfragen + $sql_query="SELECT stunde, beginn, ende FROM lehre.tbl_stunde ORDER BY stunde"; + if(!$results=$db->db_query($sql_query)) + die($db->db_last_error()); + + + echo ''; + echo ''; + echo ''; + echo ''; + for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.date('d M',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; + } + echo ''; + + $max_person_array=array(); + $num_rows_stunde=$db->db_num_rows($results); + echo ''; + for ($k=0; $k<$num_rows_stunde; $k++) + { + $row = $db->db_fetch_object($results, $k); + $row->show_beginn=substr($row->beginn,0,5); + $row->show_ende=substr($row->ende,0,5); + $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); + $row->check_ende=str_replace(':','',substr($row->ende,0,5)); + + echo ''; + $lehreinheiten=array(); + + for ($i=0; $i= $row->check_beginn && date('Hi')<=$row->check_ende ) + $aktiv=true; + + echo ''; + else + $tooltip.=''; + $tooltip.=''; + $gefunden_anz+=$row_anz->anz; + } + + if (!empty($gefunden_anz)) + { + $tooltip.=''; + + echo '
Gesamt: '.$gefunden_anz; + echo ''; + } + echo ''; + + + if (!isset($max_person_array[$i]['tag'])) + $max_person_array[$i]['tag']=0; + $max_person_array[$i]['tag']=$max_person_array[$i]['tag']+$gefunden_anz; + if (!isset($max_person_array[$i]['tag_max'])) + $max_person_array[$i]['tag_max']=0; + $max_person_array[$i]['tag_max']=$max_person_array[$i]['tag_max']+$max_person; + + if (!isset($max_person_array[$k]['stunde'])) + $max_person_array[$k]['stunde']=0; + $max_person_array[$k]['stunde']=$max_person_array[$k]['stunde']+$gefunden_anz; + if (!isset($max_person_array[$k]['stunde_max'])) + $max_person_array[$k]['stunde_max']=0; + $max_person_array[$k]['stunde_max']=$max_person_array[$k]['stunde_max']+$max_person; + + if (!isset($max_person_array[$i][$k]['tag_stunde'])) + $max_person_array[$i][$k]['tag_stunde']=0; + $max_person_array[$i][$k]['tag_stunde']=$max_person_array[$i][$k]['tag_stunde']+$gefunden_anz; + if (!isset($max_person_array[$i][$k]['tag_stunde_max'])) + $max_person_array[$i][$k]['tag_stunde_max']=0; + $max_person_array[$i][$k]['tag_stunde_max']=$max_person_array[$i][$k]['tag_stunde_max']+$max_person; + + } + echo ''; + + } + echo '
'. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
Stunde
'.$row->show_beginn.'
'.$row->show_ende.'
'; + + $sql_query=' select distinct vw_'.$stpl_table.'.stg_bezeichnung as bezeichnung,vw_'.$stpl_table.'.stg_kurzbzlang as kurzbzlang,vw_'.$stpl_table.'.stg_kurzbz as kurzbz, vw_'.$stpl_table.'.'.$stpl_table.'_id,vw_'.$stpl_table.'.lehrform, vw_'.$stpl_table.'.gruppe, vw_'.$stpl_table.'.gruppe_kurzbz, vw_'.$stpl_table.'.unr,vw_'.$stpl_table.'.verband,vw_'.$stpl_table.'.ort_kurzbz,vw_'.$stpl_table.'.lehreinheit_id,vw_'.$stpl_table.'.studiengang_kz,vw_'.$stpl_table.'.semester,tbl_ort.max_person,tbl_standort.adresse_id,tbl_adresse.plz,tbl_adresse.name '; + $sql_query.=' from lehre.vw_'.$stpl_table.', public.tbl_ort,public.tbl_standort, public.tbl_adresse '; + $sql_query.=" where vw_".$stpl_table.".datum=".$db->db_add_param(date('Y-m-d',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))))." "; + $sql_query.=" and vw_".$stpl_table.".stunde=".$db->db_add_param($row->stunde, FHC_INTEGER)." "; + $sql_query.=" and tbl_ort.ort_kurzbz=vw_".$stpl_table.".ort_kurzbz "; + $sql_query.=" and tbl_standort.standort_id=tbl_ort.standort_id "; + $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; + $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; + $sql_query.=" order by tbl_adresse.plz,vw_".$stpl_table.".ort_kurzbz "; + + // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag + if(!$results_anzahl=$db->db_query($sql_query)) + die($db->db_last_error()); + $num_rows_anzahl=$db->db_num_rows($results_anzahl); + + $gefunden_anz=0; + $tooltip=''; + for ($k_anz=0; $k_anz<$num_rows_anzahl; $k_anz++) + { + $row_anz = $db->db_fetch_object($results_anzahl, $k_anz); + // Lehreinheit wird aufgeteilt in zwei Raeume - nicht verarbeiten , das sind die selben Personen + if (isset($lehreinheiten[trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz)])) + continue; + $lehreinheiten[$row_anz->lehreinheit_id]=trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz); + + $max_person=$row_anz->max_person+$max_person; + $row_anz->verband=trim($row_anz->verband); + $row_anz->gruppe=trim($row_anz->gruppe); + $row_anz->gruppe_kurzbz=trim($row_anz->gruppe_kurzbz); + + $stsem=$ss; + + $gruppe=($row_anz->gruppe_kurzbz?$row_anz->gruppe_kurzbz:null); + $student=new student(); + + $row_anz->anz=0; + if ($result=$student->getStudents($row_anz->studiengang_kz,$row_anz->semester,$row_anz->verband,$row_anz->gruppe,$gruppe, $stsem)) + $row_anz->anz=count($result); + + + if (empty($row_anz->anz)) + $fehler=true; + + $lvb=$row_anz->kurzbzlang.'-'.$row_anz->semester; + if (!is_null($row_anz->verband) && !empty($row_anz->verband)) + { + $lvb.=$row_anz->verband; + if (!is_null($row_anz->gruppe) && !empty($row_anz->gruppe) ) + $lvb.=$row_anz->gruppe; + } + if (!empty($k_anz)) + $tooltip.='
'. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.$row->show_beginn.' - '.$row->show_ende.'Anzahl
stundenplan_id:$row_anz->stundenplandev_id).'\'>'.trim($row_anz->ort_kurzbz).' ort_kurzbz).'\' target=\'_blank\' titel=\'Studiengang Kz '.$row_anz->studiengang_kz.'\'>'.$lvb.' '.$row_anz->gruppe_kurzbz.' '.(!$row_anz->anz?'':'').$row_anz->bezeichnung.(!$row_anz->anz?'':'').' '.$row_anz->anz.'
max.Personen:'.$max_person.' Belegung:'. number_format($gefunden_anz / $max_person,2)*100 .'% Ges.:'.$gefunden_anz.'
'; + + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($uid); + if($rechte->isBerechtigt('admin')) + { + echo ''; + echo ''; + + echo ''; + echo ''; + for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; + } + echo ''; + $stunde_proz=0; + $stunde=0; + $stunde_max=0; + for ($k=0; $k<$num_rows_stunde; $k++) + { + $row = $db->db_fetch_object($results, $k); + $row->show_beginn=substr($row->beginn,0,5); + $row->show_ende=substr($row->ende,0,5); + $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); + $row->check_ende=str_replace(':','',substr($row->ende,0,5)); + echo ''; + echo ''; + echo ''; + + $stunde=$stunde+$max_person_array[$k]['stunde']; + $stunde_max=$stunde_max+$max_person_array[$k]['stunde_max']; + + for ($i=0; $i'; + echo 'anz.:'.$max_person_array[$i][$k]['tag_stunde']; + echo '
'; + echo 'FH   max.:'. $raum_max_anz; + echo '
'; + echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $raum_max_anz,2)*100:0).'%'; + echo '
'; + echo 'Raum max.:'. $max_person_array[$i][$k]['tag_stunde_max']; + echo '
'; + echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $max_person_array[$i][$k]['tag_stunde_max'],2)*100:0).'%'; + echo ''; + } + echo '
'; + } + + + echo ''; + echo ''; + + echo ''; + + + for ($i=0; $i'; + echo 'FH      Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / ($raum_max_anz *$num_rows_stunde),2)*100:0).'%'; + echo '
'; + echo 'Raum Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / $max_person_array[$i]['tag_max'],2)*100:0).'%'; + echo ''; + } + + echo '
'; + + + echo '
'. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
Zeit / Datum – 
'.$row->show_beginn.'
'.$row->show_ende.'
'; + echo 'anz.:'.$max_person_array[$k]['stunde']; + echo '
'; + echo 'FH   '.($raum_max_anz*TAGE_PRO_WOCHE); + echo '
'; + echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde'])/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; + echo '
'; + echo 'Raum '.$max_person_array[$k]['stunde_max']; + echo '
'; + echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde']/TAGE_PRO_WOCHE) / ($max_person_array[$k]['stunde_max']/TAGE_PRO_WOCHE),2)*100:0).'%'; + echo '
Ø'; + echo 'FH      Ø '.($stunde?number_format(($stunde)/$num_rows_stunde/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; + echo '
'; + echo 'Raum Ø '.($stunde_max?number_format(($stunde/$num_rows_stunde/TAGE_PRO_WOCHE) / ($stunde_max/$num_rows_stunde/TAGE_PRO_WOCHE),2)*100:0).'%'; + echo '
'; + } +?> + + diff --git a/cis/private/pdfExport.php b/cis/private/pdfExport.php index f5322d1ff..ea1fbab66 100644 --- a/cis/private/pdfExport.php +++ b/cis/private/pdfExport.php @@ -38,6 +38,7 @@ require_once('../../include/student.class.php'); require_once('../../include/prestudent.class.php'); require_once('../../include/dokument_export.class.php'); require_once('../../include/person.class.php'); +require_once('../../include/webservicelog.class.php'); if (!$db = new basis_db()) die('Fehler beim Oeffnen der Datenbankverbindung'); @@ -139,6 +140,21 @@ if (isset($_GET['all'])) if (isset($_GET['xsl_oe_kurzbz'])) $params .= '&xsl_oe_kurzbz='. $_GET['xsl_oe_kurzbz']; +// Logeintrag bei Download von Zahlungsbestaetigungen +if (isset($_GET['xsl']) && $_GET['xsl'] == 'Zahlung') +{ + $requestdata = $_SERVER['QUERY_STRING']; + + $log = new Webservicelog(); + $log->webservicetyp_kurzbz = 'content'; + $log->request_id = isset($_GET['buchungsnummern']) && !empty($_GET['buchungsnummern']) ? $_GET['buchungsnummern'] : NULL; + $log->beschreibung = 'Zahlungsbestaetigungsdownload'; + $log->request_data = $requestdata; + $log->execute_user = $user; + + $log->save(true); +} + //OE fuer Output ermitteln if ($xsl_oe_kurzbz != '') diff --git a/cis/private/profile/dokumente.php b/cis/private/profile/dokumente.php index ee31824af..298383f90 100644 --- a/cis/private/profile/dokumente.php +++ b/cis/private/profile/dokumente.php @@ -76,7 +76,6 @@ if(isset($_GET['action']) && $_GET['action']=='download') $akte = new akte(); $akte->load($id); if ($akte->person_id == $student_studiengang->person_id - && $akte->signiert && $akte->stud_selfservice) { if($akte->inhalt!='') @@ -89,12 +88,12 @@ if(isset($_GET['action']) && $_GET['action']=='download') } else { - die('Id ist ungueltig'); + die('Akte hat keinen Inhalt.'); } } else { - die('Id ist ungueltig'); + die('Nicht zum selbständigen Download bestimmt oder falsche PersonID.'); } } else @@ -123,7 +122,6 @@ echo ' }); $(".tablesorter2").tablesorter( { - sortList: [[1,1]], headers: { 0: { sorter: false }}, widgets: ["zebra"] }); diff --git a/cis/private/profile/index.php b/cis/private/profile/index.php index 5b3a645da..dd39cf301 100644 --- a/cis/private/profile/index.php +++ b/cis/private/profile/index.php @@ -56,6 +56,12 @@ $uid = get_uid(); $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($uid); +$is_employee = false; +if (check_lektor($uid)) +{ + $is_employee = true; +} + $datum_obj = new datum(); // Wenn ein anderer User sich das Profil ansieht (Bei Personensuche) sollen bestimmte persönliche Daten nicht angezeigt werden @@ -346,7 +352,7 @@ if ($type == 'mitarbeiter') $kontakt->load_pers($user->person_id); foreach($kontakt->result as $k) { - if ($k->kontakttyp == 'firmenhandy') + if ($k->kontakttyp == 'firmenhandy' && $is_employee) echo 'Firmenhandy: '.$k->kontakt.'
'; } diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php index 9d33b25ae..11620a99a 100644 --- a/cis/private/profile/urlaubstool.php +++ b/cis/private/profile/urlaubstool.php @@ -163,6 +163,68 @@ if (isset($_GET['rechts_x']) || isset($_POST['rechts_x'])) $wjahr=$wjahr; } } + +//Bereits freigegebenen Eintrag löschen +//Eintragung löschen +if((isset($_GET['delete']) && isset($_GET['informSupervisor'])) || (isset($_POST['delete']) && isset($_POST['informSupervisor']))) +{ + $zeitsperre = new zeitsperre(); + $zeitsperre->load($_GET['delete']); + + $vondatum = $zeitsperre->getVonDatum(); + $bisdatum = $zeitsperre->getBisDatum(); + + if(!$zeitsperre->delete($_GET['delete'])) + echo $zeitsperre->errormsg; + + //Mail an Vorgesetzten + $prsn = new person(); + + $vorgesetzter = $ma->getVorgesetzte($uid); + if($vorgesetzter) + { + $to=''; + $fullName =''; + foreach($ma->vorgesetzte as $vg) + { + if($to!='') + { + $to.=', '.$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=', '.$name; + } + else + { + $to.=$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=$name; + } + } + + $benutzer = new benutzer(); + $benutzer->load($uid); + $message = $p->t('urlaubstool/diesIstEineAutomatischeMail')."\n". + $p->t('urlaubstool/xHatUrlaubGeloescht',array($benutzer->nachname,$benutzer->vorname)).":\n"; + $message.= $p->t('urlaubstool/von')." ".date("d.m.Y", strtotime($vondatum))." ".$p->t('urlaubstool/bis')." ".date("d.m.Y", strtotime($bisdatum))."\n"; + + + $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigegebenerUrlaubGeloescht'), $message); + if($mail->send()) + { + $vgmail="".$p->t('urlaubstool/VorgesetzteInformiert',array($fullName)).""; + } + else + { + $vgmail="
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($fullName))."!"; + } + } + else + { + $vgmail="
".$p->t('urlaubstool/konnteKeinFreigabemailVersendetWerden').""; + } +} + + //Eintragung löschen if((isset($_GET['delete']) || isset($_POST['delete']))) { @@ -257,19 +319,26 @@ if(isset($_GET['speichern']) && isset($_GET['wtag'])) if(!$error) { //Mail an Vorgesetzten + $prsn = new person(); + $vorgesetzter = $ma->getVorgesetzte($uid); if($vorgesetzter) { $to=''; + $fullName =''; foreach($ma->vorgesetzte as $vg) { if($to!='') { $to.=', '.$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=', '.$name; } else { $to.=$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=$name; } } @@ -295,7 +364,7 @@ if(isset($_GET['speichern']) && isset($_GET['wtag'])) $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigabeansuchenUrlaub'), $message); if($mail->send()) { - $vgmail="".$p->t('urlaubstool/freigabemailWurdeVersandt',array($to)).""; + $vgmail="".$p->t('urlaubstool/freigabemailWurdeVersandt',array($fullName)).""; } else { @@ -373,10 +442,14 @@ if ((isset($wmonat) || isset($wmonat))&&(isset($wjahr) || isset($wjahr))) if(date("Y-m-d",mktime(0, 0, 0, ($wmonat+1) , $i-$wotag+1, $jahre[$wjahr]))>=$row->vondatum && date("Y-m-d",mktime(0, 0, 0, ($wmonat+1) , $i-$wotag+1, $jahre[$wjahr]))<=$row->bisdatum) { - if($row->freigabevon!='' || $row->bisdatumfreigabevon!='' && $row->vondatum<=date("Y-m-d",time())) { $hgfarbe[$i]='#bbb'; } + elseif ($row->freigabevon!='' && $row->vondatum>date("Y-m-d",time())) + { + $hgfarbe[$i]='#CDDDEE'; + } else { $hgfarbe[$i]='#FFFC7F'; @@ -389,7 +462,7 @@ if ((isset($wmonat) || isset($wmonat))&&(isset($wjahr) || isset($wjahr))) } else { - if($hgfarbe[$i]!='#FFFC7F' && $hgfarbe[$i]!='#bbb') + if($hgfarbe[$i]!='#FFFC7F' && $hgfarbe[$i]!='#bbb' && $hgfarbe[$i]!='#CDDDEE') { $hgfarbe[$i]='#E9ECEE'; @@ -696,7 +769,7 @@ for ($i=0;$i<6;$i++) } if($tage[$j+7*$i]!='') { - if($hgfarbe[$j+7*$i]=='#FFFC7F') + if($hgfarbe[$j+7*$i]=='#FFFC7F' )//|| $hgfarbe[$j+7*$i]=='#CDDDEE') { echo 't('urlaubstool/erreichbar').': '.$erreichbarkeit_kurzbz[$j+7*$i].'">'.$tage[$j+7*$i].'
';; $k=$j+7*$i; @@ -724,7 +797,13 @@ for ($i=0;$i<6;$i++) } elseif(isset($freigabeamum[$j+7*$i])) { - echo 'freigegeben'; + echo 'freigegeben '; + if($hgfarbe[$j+7*$i]=='#CDDDEE') + { + $k=$j+7*$i; + echo ""; + echo 'loeschen'; + } } else { diff --git a/cis/private/profile/zahlungen.php b/cis/private/profile/zahlungen.php index ea2c70c79..e255e805b 100644 --- a/cis/private/profile/zahlungen.php +++ b/cis/private/profile/zahlungen.php @@ -1,277 +1,299 @@ -, - * Andreas Oesterreicher and - * Rudolf Hangl . - */ - - require_once('../../../config/cis.config.inc.php'); - require_once('../../../include/functions.inc.php'); - require_once('../../../include/studiensemester.class.php'); - require_once('../../../include/konto.class.php'); - require_once('../../../include/person.class.php'); - require_once('../../../include/benutzer.class.php'); - require_once('../../../include/datum.class.php'); - require_once('../../../include/studiengang.class.php'); - require_once('../../../include/phrasen.class.php'); - require_once('../../../include/benutzerberechtigung.class.php'); - - $sprache = getSprache(); - $p = new phrasen($sprache); - $uid=get_uid(); - - if(isset($_GET['uid'])) - { - // Administratoren duerfen die UID als Parameter uebergeben um die Zahlungen - // von anderen Personen anzuzeigen - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($uid); - if($rechte->isBerechtigt('admin')) - { - $uid = $_GET['uid']; - $getParam = "&uid=" . $uid; - } - else - $getParam = ""; - } - else - $getParam=''; - - $datum_obj = new datum(); - - echo ' - - - - '.$p->t('tools/zahlungen').' - - '; - - include('../../../include/meta/jquery.php'); - include('../../../include/meta/jquery-tablesorter.php'); - -echo ' - - - - - - '; - - $studiengang = new studiengang(); - $studiengang->getAll(null,null); - - $stg_arr = array(); - foreach ($studiengang->result as $row) - $stg_arr[$row->studiengang_kz]=$row->kuerzel; - - $benutzer = new benutzer(); - if(!$benutzer->load($uid)) - die('Benutzer wurde nicht gefunden'); - - echo '

'.$p->t('tools/zahlungen').' - '.$benutzer->vorname.' '.$benutzer->nachname.'

'; - - $konto = new konto(); - $konto->getBuchungstyp(); - $buchungstyp = array(); - - foreach ($konto->result as $row) - $buchungstyp[$row->buchungstyp_kurzbz]=$row->beschreibung; - - $konto = new konto(); - $konto->getBuchungen($benutzer->person_id); - if(count($konto->result)>0) - { - echo '

'; - echo ''; - echo ' - - - - - - - '; - echo ''; - - foreach ($konto->result as $row) - { - $i=0; //Zaehler fuer Anzahl Gegenbuchungen - $buchungsnummern=''; - - if(!isset($row['parent'])) - continue; - $betrag = $row['parent']->betrag; - - - if(isset($row['childs'])) - { - foreach ($row['childs'] as $key => $row_child) - { - $betrag += $row_child->betrag; - $betrag = round($betrag, 2); - $buchungsnummern .= ';'.$row['childs'][$key]->buchungsnr; - $i = $key; //Zaehler auf letzten Gegenbuchungseintrag setzen - } - } - else - $buchungsnummern = $row['parent']->buchungsnr; - - if($betrag<0) - $style='style="background-color: #FF8888;"'; - elseif($betrag>0) - $style='style="background-color: #88DD88;"'; - else - $style=''; - - echo ""; - echo ''; - echo ''; - echo ''; - echo ''; - - echo ''; - echo ''; - echo ''; - } - echo ''; - } - echo '
'.$p->t('global/datum').''.$p->t('tools/zahlungstyp').''.$p->t('lvplan/stg').''.$p->t('global/studiensemester').''.$p->t('tools/buchungstext').''.$p->t('tools/betrag').''.$p->t('tools/zahlungsbestaetigung').'
'.date('d.m.Y',$datum_obj->mktime_fromdate(isset($row['childs'][$i])?$row['childs'][$i]->buchungsdatum:$row['parent']->buchungsdatum)).''.$buchungstyp[$row['parent']->buchungstyp_kurzbz].''.$stg_arr[$row['parent']->studiengang_kz].''.$row['parent']->studiensemester_kurzbz.''.$row['parent']->buchungstext.'€ '.($betrag<0?'-':($betrag>0?'+':'')).sprintf('%.2f',abs($row['parent']->betrag)).''; - if($betrag>=0 && $row['parent']->betrag<=0) - { - echo ''.$p->t('tools/bestaetigungDrucken').''; - } - elseif($row['parent']->betrag>0) - { - //Auszahlung - } - else - { - echo ''.$p->t('tools/offen').'(€ '.sprintf('%.2f',$betrag*-1).')'; - - echo '
'; - } - else - { - echo $p->t('tools/keineZahlungenVorhanden'); - } - echo ''; -?> +, + * Andreas Oesterreicher and + * Rudolf Hangl . + */ + + require_once('../../../config/cis.config.inc.php'); + require_once('../../../config/global.config.inc.php'); + require_once('../../../include/functions.inc.php'); + require_once('../../../include/studiensemester.class.php'); + require_once('../../../include/konto.class.php'); + require_once('../../../include/person.class.php'); + require_once('../../../include/benutzer.class.php'); + require_once('../../../include/datum.class.php'); + require_once('../../../include/studiengang.class.php'); + require_once('../../../include/phrasen.class.php'); + require_once('../../../include/benutzerberechtigung.class.php'); + + $sprache = getSprache(); + $p = new phrasen($sprache); + $uid=get_uid(); + + if(isset($_GET['uid'])) + { + // Administratoren duerfen die UID als Parameter uebergeben um die Zahlungen + // von anderen Personen anzuzeigen + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($uid); + if($rechte->isBerechtigt('admin')) + { + $uid = $_GET['uid']; + $getParam = "&uid=" . $uid; + } + else + $getParam = ""; + } + else + $getParam=''; + + if (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN') && !ZAHLUNGSBESTAETIGUNG_ANZEIGEN) + { + die('Um diese Seite anzuzeigen, ist ein entsprechender Eintrag in der Konfigurationsdatei nötig.'); + } + + $datum_obj = new datum(); + + echo ' + + + + '.$p->t('tools/zahlungen').' + + '; + + include('../../../include/meta/jquery.php'); + include('../../../include/meta/jquery-tablesorter.php'); + +echo ' + + + + + + '; + + $studiengang = new studiengang(); + $studiengang->getAll(null,null); + + $stg_arr = array(); + foreach ($studiengang->result as $row) + $stg_arr[$row->studiengang_kz]=$row->kuerzel; + + $benutzer = new benutzer(); + if(!$benutzer->load($uid)) + die('Benutzer wurde nicht gefunden'); + + echo '

'.$p->t('tools/zahlungen').' - '.$benutzer->vorname.' '.$benutzer->nachname.'

'; + + $konto = new konto(); + $konto->getBuchungstyp(); + $buchungstyp = array(); + + foreach ($konto->result as $row) + $buchungstyp[$row->buchungstyp_kurzbz]=$row->beschreibung; + + $konto = new konto(); + $konto->getBuchungen($benutzer->person_id); + if(count($konto->result)>0) + { + echo '

'; + echo ''; + echo ' + + + + + + + '; + echo ''; + + foreach ($konto->result as $row) + { + $i=0; //Zaehler fuer Anzahl Gegenbuchungen + $count_studiengangszahlung = 0; + $buchungsnummern=''; + + // Für die FHTW sollen nur Zahlungsbestaetigungen von FHTW-Studien angezeigt werden. (Nicht von Lehrgaengen) + if (defined('ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE') && !ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE) + { + $is_lehrgang = $row['parent']->studiengang_kz < 0 ? true : false; + if ($is_lehrgang) continue; + } + + if(!isset($row['parent'])) + continue; + $betrag = $row['parent']->betrag; + $count_studiengangszahlung ++; + + if(isset($row['childs'])) + { + foreach ($row['childs'] as $key => $row_child) + { + $betrag += $row_child->betrag; + $betrag = round($betrag, 2); + $buchungsnummern = !empty($buchungsnummern) ? ';' : ''; + $buchungsnummern .= $row['childs'][$key]->buchungsnr; + $i = $key; //Zaehler auf letzten Gegenbuchungseintrag setzen + } + } + else + $buchungsnummern = $row['parent']->buchungsnr; + + if($betrag<0) + $style='style="background-color: #FF8888;"'; + elseif($betrag>0) + $style='style="background-color: #88DD88;"'; + else + $style=''; + + echo ""; + echo ''; + echo ''; + echo ''; + echo ''; + + echo ''; + echo ''; + echo ''; + } + echo ''; + } + + // Wenn die Tabelle keine Eintraege hat, wird eine Tabellenzeile mit entsprechender Information angezeigt. + if ($count_studiengangszahlung == 0) + { + echo ""; + } + + echo '
'.$p->t('global/datum').''.$p->t('tools/zahlungstyp').''.$p->t('lvplan/stg').''.$p->t('global/studiensemester').''.$p->t('tools/buchungstext').''.$p->t('tools/betrag').''.$p->t('tools/zahlungsbestaetigung').'
'.date('d.m.Y',$datum_obj->mktime_fromdate(isset($row['childs'][$i])?$row['childs'][$i]->buchungsdatum:$row['parent']->buchungsdatum)).''.$buchungstyp[$row['parent']->buchungstyp_kurzbz].''.$stg_arr[$row['parent']->studiengang_kz].''.$row['parent']->studiensemester_kurzbz.''.$row['parent']->buchungstext.'€ '.($betrag<0?'-':($betrag>0?'+':'')).sprintf('%.2f',abs($row['parent']->betrag)).''; + if($betrag>=0 && $row['parent']->betrag<=0) + { + echo ''.$p->t('tools/bestaetigungDrucken').''; + } + elseif($row['parent']->betrag>0) + { + //Auszahlung + } + else + { + echo ''.$p->t('tools/offen').'(€ '.sprintf('%.2f',$betrag*-1).')'; + + echo '
" .$p->t('tools/keineZahlungenVorhanden'). "
'; + } + else + { + echo $p->t('tools/keineZahlungenVorhanden'); + } + echo ''; +?> diff --git a/cis/private/profile/zahlungen_details.php b/cis/private/profile/zahlungen_details.php index 650ee81c0..5b56bea8c 100644 --- a/cis/private/profile/zahlungen_details.php +++ b/cis/private/profile/zahlungen_details.php @@ -15,9 +15,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * Authors: Martin Tatzber , + * Authors: Martin Tatzber , */ require_once('../../../config/cis.config.inc.php'); +require_once('../../../config/global.config.inc.php'); require_once('../../../include/functions.inc.php'); require_once('../../../include/konto.class.php'); require_once('../../../include/bankverbindung.class.php'); @@ -28,7 +29,7 @@ require_once('../../../include/benutzer.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); require_once('../../../include/student.class.php'); require_once('../../../include/prestudent.class.php'); - + $uid = get_uid(); if(isset($_GET['uid'])) @@ -48,7 +49,7 @@ if(isset($_GET['uid'])) } else $getParam=''; - + $benutzer = new benutzer(); if(!$benutzer->load($uid)) die('Benutzer nicht gefunden'); @@ -88,7 +89,7 @@ $oe=new organisationseinheit(); $oe->load($studiengang->oe_kurzbz); $konto->getBuchungstyp(); -$buchungstyp = array(); +$buchungstyp = array(); foreach ($konto->result as $row) $buchungstyp[$row->buchungstyp_kurzbz]=$row->beschreibung; @@ -153,7 +154,13 @@ if($bic!='') '.$bic.' '; } -if($konto->zahlungsreferenz!='') +if ($konto->zahlungsreferenz != '' + && + ( + !defined('ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN') + || ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN == true + ) +) { echo ' @@ -189,7 +196,7 @@ foreach($addon->result as $a) '; } - + } echo ''; diff --git a/cis/private/profile/zeitsperre_resturlaub.php b/cis/private/profile/zeitsperre_resturlaub.php index b7654310e..c6dca2adb 100644 --- a/cis/private/profile/zeitsperre_resturlaub.php +++ b/cis/private/profile/zeitsperre_resturlaub.php @@ -413,15 +413,23 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ if($zeitsperre->new && $zeitsperre->zeitsperretyp_kurzbz=='Urlaub') { //Beim Anlegen von neuen Urlauben wird ein Mail an den Vorgesetzten versendet um diesen Freizugeben - $vorgesetzter = $ma->getVorgesetzte($uid); + $prsn = new person(); + + $vorgesetzter = $ma->getVorgesetzte($uid); if($vorgesetzter) { $to=''; + $fullName=''; foreach($ma->vorgesetzte as $vg) { if (!empty($to)) + { $to.=','; + $fullName.=','; + } $to.=trim($vg.'@'.DOMAIN); + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=$name; } $benutzer = new benutzer(); @@ -440,11 +448,11 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ $mail = new mail($to, $from, 'Freigabeansuchen', $message); if($mail->send()) { - echo "
".$p->t('urlaubstool/freigabemailWurdeVersandt',array($to)).""; + echo "
".$p->t('urlaubstool/freigabemailWurdeVersandt',array($fullName)).""; } else { - echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($to)).""; + echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($fullName)).""; } } else @@ -461,8 +469,69 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ echo "$error_msg"; } +//loeschen eines bereits freigegebenen Urlaubs +if((isset($_GET['type']) && $_GET['type']=='delete_sperre' && isset($_GET['informSupervisor']))) +{ + $zeitsperre = new zeitsperre(); + $zeitsperre->load($_GET['id']); + + $vondatum = $zeitsperre->getVonDatum(); + $bisdatum = $zeitsperre->getBisDatum(); + + if(!$zeitsperre->delete($_GET['id'])) + echo $zeitsperre->errormsg; + + //Mail an Vorgesetzten + $prsn = new person(); + + $vorgesetzter = $ma->getVorgesetzte($uid); + if($vorgesetzter) + { + $to=''; + $fullName =''; + foreach($ma->vorgesetzte as $vg) + { + if($to!='') + { + $to.=', '.$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=', '.$name; + } + else + { + $to.=$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=$name; + } + } + + $benutzer = new benutzer(); + $benutzer->load($uid); + $message = $p->t('urlaubstool/diesIstEineAutomatischeMail')."\n". + $p->t('urlaubstool/xHatUrlaubGeloescht',array($benutzer->nachname,$benutzer->vorname)).":\n"; + + + $message.= $p->t('urlaubstool/von')." ".date("d.m.Y", strtotime($vondatum))." ".$p->t('urlaubstool/bis')." ".date("d.m.Y", strtotime($bisdatum))."\n"; + + + $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigegebenerUrlaubGeloescht'), $message); + if($mail->send()) + { + echo "
".$p->t('urlaubstool/VorgesetzteInformiert',array($fullName)).""; + } + else + { + echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($fullName))."!"; + } + } + else + { + $vgmail="
".$p->t('urlaubstool/konnteKeinFreigabemailVersendetWerden').""; + } +} + //loeschen einer zeitsperre -if(isset($_GET['type']) && $_GET['type']=='delete_sperre') +if(isset($_GET['type']) && $_GET['type']=='delete_sperre' && !isset($_GET['informSupervisor']) ) { $zeit = new zeitsperre(); $zeit->load($_GET['id']); @@ -518,7 +587,7 @@ if(count($zeit->result)>0) $row_vertretung = $db->db_fetch_object($result_vertretung); $content_table.= " $row->bezeichnung - $row->zeitsperretyp_kurzbz + $row->zeitsperretyp_beschreibung ".$datum_obj->convertISODate($row->vondatum)." ".($row->vonstunde!=''?'('.$row->vonstunde.')':'')." ".$datum_obj->convertISODate($row->bisdatum)." ".($row->bisstunde!=''?'('.$row->bisstunde.')':'')." ".(isset($row_vertretung->kurzbz)?$row_vertretung->kurzbz:'')." @@ -532,10 +601,14 @@ if(count($zeit->result)>0) $content_table.="".$p->t('zeitsperre/edit').""; if ($row->vondatum < $gesperrt_bis AND in_array($row->zeitsperretyp_kurzbz,$typen_arr)) $content_table .= ' '; - else if($row->freigabeamum=='' || $row->zeitsperretyp_kurzbz!='Urlaub') + else if($row->vondatum>=date("Y-m-d",time()) && $row->zeitsperretyp_kurzbz=='Urlaub') { - $content_table.="\n".$p->t('zeitsperre/loeschen').""; + $content_table.="\n".$p->t('zeitsperre/loeschen').""; } + elseif($row->zeitsperretyp_kurzbz!='Urlaub') + { + $content_table.="\n".$p->t('zeitsperre/loeschen').""; + } else $content_table .= ' '; $content_table.=""; @@ -587,15 +660,15 @@ $content_form.= 't('zeitsperre/grund').''; diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 2d96380f6..71fdda2bb 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1039,9 +1039,10 @@ if($projekt->getProjekteMitarbeiter($user, true)) echo '

'.$p->t("zeitaufzeichnung/fiktiveNormalarbeitszeit").'

'; } echo '

'.$p->t("urlaubstool/meineZeitsperren").'

'; - echo " + echo $p->t("zeitaufzeichnung/supportAnfragen"); + echo ' - "; + '; echo ''; $start=0; +$color = 'black'; foreach($studiensemester->studiensemester as $row_stsem) { @@ -141,7 +143,12 @@ foreach($studiensemester->studiensemester as $row_stsem) foreach($gueltigkeit[$row_stsem->studiensemester_kurzbz][$i] as $row_studienplan) { $start=true; - $row .= $row_studienplan.'
'; + // Die Farbe des Studienplans ist immer gleich bleibend nach der Bezeichnung des Studienplans + if ($farbe == true) + { + $color = 'hsl('.abs((crc32($row_studienplan))*2 % 360).', 90%, 40%)'; + } + $row .= ''.$row_studienplan.'
'; } } $row .= '';
'; diff --git a/cis/public/ical_coodle.php b/cis/public/ical_coodle.php index a4be8b52f..fd9d408b5 100644 --- a/cis/public/ical_coodle.php +++ b/cis/public/ical_coodle.php @@ -62,11 +62,15 @@ TZOFFSETTO:+0100 END:STANDARD END:VTIMEZONE\n"; //echo 'URL:',APP_ROOT,'cis/public/ical_coodle.php/',$uid,"\n"; -echo "BEGIN:VEVENT"; + // Alle Umfragen holen an denen der User beteiligt ist $umfragen = new coodle(); $umfragen->getCoodleFromUser($uid); $i = 0; +if (count($umfragen->result) > 0) +{ + //echo "BEGIN:VEVENT"; +} foreach($umfragen->result as $umfrage) { if($umfrage->coodle_status_kurzbz=='laufend') @@ -88,10 +92,7 @@ foreach($umfragen->result as $umfrage) $uhrzeit_ende = $date->format('H:i:s'); $dtende = $date->format('Ymd\THis'); - if ($i > 0) - { - echo "\nBEGIN:VEVENT"; - } + echo "\nBEGIN:VEVENT"; echo "\nUID:Coodle_Terminoption".$dtstart."_".$dtende.""; echo "\nSUMMARY:Coodle Terminoption"; echo "\nDTSTART;TZID=Europe/Vienna:$dtstart"; diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index e377f0424..320f7adb3 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -294,4 +294,16 @@ define('STUDIENGANG_KZ_QUALIFIKATIONKURSE', null); // Gibt an ob der Login ins Testtool ueber das Bewerbungstool stattfindet oder nicht define('TESTTOOL_LOGIN_BEWERBUNGSTOOL', false); + +// Prueft ob Buchungen bereits ins SAP uebertragen wurden und sperrt ggf die Bearbeitung +define('BUCHUNGEN_CHECK_SAP', true); + +// Gibt an, ob im FAS die Zahlungsbestaetigungen zum Download / im CIS generell die Zahlungen angezeigt werden +define ('ZAHLUNGSBESTAETIGUNG_ANZEIGEN', true); + +// Gibt an, ob im CIS die Zahlungsbestaetigungen fuer Lehrgaenge zum Download angezeigt werden +define ('ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE', true); + +// Gibt an, ob im CIS die Zahlungsreferenz angezeigt wird +define ('ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN', false); ?> diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index 1647cb59a..cd45e6979 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -249,4 +249,9 @@ define('BIS_FUNKTIONSCODE_6_ARR', array( 'Team' )); +// Standortcode fuer Lehrgaenge +define('BIS_STANDORTCODE_LEHRGAENGE', '0'); + +// bPk Abfrage +define('BPK_FUER_ALLE_BENUTZER_ABFRAGEN', false); ?> diff --git a/content/adressedialog.js.php b/content/adressedialog.js.php index 6f4eaf5fe..210b208b0 100644 --- a/content/adressedialog.js.php +++ b/content/adressedialog.js.php @@ -1,204 +1,207 @@ -, - * Andreas Oesterreicher and - * Rudolf Hangl . - */ - -require_once('../config/vilesci.config.inc.php'); -require_once('../include/functions.inc.php'); - -$user = get_uid(); -loadVariables($user); -?> - -// **** -// * Laedt die zu bearbeitenden Daten -// **** -function AdresseInit(adresse_id, person_id) -{ - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - - if(adresse_id!='') - { - //Daten holen - var url = 'rdf/adresse.rdf.php?adresse_id='+adresse_id+'&'+gettimestamp(); - - var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"]. - getService(Components.interfaces.nsIRDFService); - - var dsource = rdfService.GetDataSourceBlocking(url); - - var subject = rdfService.GetResource("http://www.technikum-wien.at/adresse/" + adresse_id); - - var predicateNS = "http://www.technikum-wien.at/adresse/rdf"; - - //RDF parsen - - person_id = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#person_id" )); - name = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#name" )); - strasse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#strasse" )); - plz = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#plz" )); - ort = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#ort" )); - gemeinde = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#gemeinde" )); - nation = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#nation" )); - typ = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#typ" )); - heimatadresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#heimatadresse" )); - zustelladresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#zustelladresse" )); - firma_id = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#firma_id" )); - rechnungsadresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#rechnungsadresse" )); - anmerkung = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#anmerkung" )); - neu = false; - } - else - { - //Defaultwerte bei Neuem Datensatz - neu = true; - name=''; - strasse=''; - plz=''; - ort=''; - gemeinde='' - nation='A'; - typ='h'; - heimatadresse='Ja'; - zustelladresse='Ja'; - firma_id=''; - rechnungsadresse='Nein'; - anmerkung=''; - } - - document.getElementById('adresse-checkbox-neu').checked=neu; - document.getElementById('adresse-textbox-person_id').value=person_id; - document.getElementById('adresse-textbox-adresse_id').value=adresse_id; - document.getElementById('adresse-textbox-name').value=name; - document.getElementById('adresse-textbox-strasse').value=strasse; - document.getElementById('adresse-textbox-plz').value=plz; - AdresseLoadGemeinde(true); - document.getElementById('adresse-textbox-gemeinde').value=gemeinde; - AdresseLoadOrtschaft(true); - document.getElementById('adresse-textbox-ort').value=ort; - document.getElementById('adresse-menulist-nation').value=nation; - document.getElementById('adresse-menulist-typ').value=typ; - if(heimatadresse=='Ja') - document.getElementById('adresse-checkbox-heimatadresse').checked=true; - else - document.getElementById('adresse-checkbox-heimatadresse').checked=false; - - if(zustelladresse=='Ja') - document.getElementById('adresse-checkbox-zustelladresse').checked=true; - else - document.getElementById('adresse-checkbox-zustelladresse').checked=false; - document.getElementById('adresse-menulist-firma').value=firma_id; - document.getElementById('adresse-textbox-anmerkung').value=anmerkung; - if(rechnungsadresse=='Ja') - document.getElementById('adresse-checkbox-rechnungsadresse').checked=true; - else - document.getElementById('adresse-checkbox-rechnungsadresse').checked=false; -} - -// **** -// * Speichern der Daten -// **** -function AdresseSpeichern() -{ - if(window.opener.KontaktAdresseSpeichern(document)) - window.close(); - else - this.focus(); -} - -// **** -// * Laedt die Gemeinden zur eingegebenen Postleitzahl -// **** -function AdresseLoadGemeinde(blocking) -{ - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - - menulist_gemeinde = document.getElementById('adresse-textbox-gemeinde'); - if(document.getElementById('adresse-menulist-nation').value=='A') - { - menulist_gemeinde.value=''; - document.getElementById('adresse-textbox-ort').value=''; - } - plz = document.getElementById('adresse-textbox-plz').value; - - if(plz.length>3) - { - var url = 'rdf/gemeinde.rdf.php?plz='+plz+'&'+gettimestamp(); - - var oldDatasources = menulist_gemeinde.database.GetDataSources(); - while(oldDatasources.hasMoreElements()) - { - menulist_gemeinde.database.RemoveDataSource(oldDatasources.getNext()); - } - //Refresh damit die entfernten DS auch wirklich entfernt werden - menulist_gemeinde.builder.rebuild(); - - var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); - if(blocking) - var datasource = rdfService.GetDataSourceBlocking(url); - else - var datasource = rdfService.GetDataSource(url); - datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); - datasource.QueryInterface(Components.interfaces.nsIRDFXMLSink); - menulist_gemeinde.database.AddDataSource(datasource); - - menulist_gemeinde.builder.rebuild(); - } -} - -// **** -// * Laedt die Ortschaften zu Plz und Gemeinde -// **** -function AdresseLoadOrtschaft(blocking) -{ - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - - gemeinde = document.getElementById('adresse-textbox-gemeinde').value; - menulist_ort = document.getElementById('adresse-textbox-ort'); - if(document.getElementById('adresse-menulist-nation').value=='A') - { - menulist_ort.value=''; - } - plz = document.getElementById('adresse-textbox-plz').value; - - if(plz.length>3 && gemeinde!='') - { - var url = 'rdf/gemeinde.rdf.php?plz='+plz+'&gemeinde='+encodeURIComponent(gemeinde)+'&'+gettimestamp(); - - var oldDatasources = menulist_ort.database.GetDataSources(); - while(oldDatasources.hasMoreElements()) - { - menulist_ort.database.RemoveDataSource(oldDatasources.getNext()); - } - //Refresh damit die entfernten DS auch wirklich entfernt werden - menulist_ort.builder.rebuild(); - - var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); - if(blocking) - var datasource1 = rdfService.GetDataSourceBlocking(url); - else - var datasource1 = rdfService.GetDataSource(url); - datasource1.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); - datasource1.QueryInterface(Components.interfaces.nsIRDFXMLSink); - menulist_ort.database.AddDataSource(datasource1); - - menulist_ort.builder.rebuild(); - } +, + * Andreas Oesterreicher and + * Rudolf Hangl . + */ + +require_once('../config/vilesci.config.inc.php'); +require_once('../include/functions.inc.php'); + +$user = get_uid(); +loadVariables($user); +?> + +// **** +// * Laedt die zu bearbeitenden Daten +// **** +function AdresseInit(adresse_id, person_id) +{ + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + if(adresse_id!='') + { + //Daten holen + var url = 'rdf/adresse.rdf.php?adresse_id='+adresse_id+'&'+gettimestamp(); + + var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"]. + getService(Components.interfaces.nsIRDFService); + + var dsource = rdfService.GetDataSourceBlocking(url); + + var subject = rdfService.GetResource("http://www.technikum-wien.at/adresse/" + adresse_id); + + var predicateNS = "http://www.technikum-wien.at/adresse/rdf"; + + //RDF parsen + + person_id = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#person_id" )); + name = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#name" )); + strasse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#strasse" )); + plz = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#plz" )); + ort = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#ort" )); + gemeinde = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#gemeinde" )); + nation = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#nation" )); + typ = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#typ" )); + heimatadresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#heimatadresse" )); + zustelladresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#zustelladresse" )); + co_name = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#co_name" )); + firma_id = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#firma_id" )); + rechnungsadresse = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#rechnungsadresse" )); + anmerkung = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#anmerkung" )); + neu = false; + } + else + { + //Defaultwerte bei Neuem Datensatz + neu = true; + name=''; + strasse=''; + plz=''; + ort=''; + gemeinde='' + nation='A'; + typ='h'; + heimatadresse='Ja'; + zustelladresse='Ja'; + co_name = ''; + firma_id=''; + rechnungsadresse='Nein'; + anmerkung=''; + } + + document.getElementById('adresse-checkbox-neu').checked=neu; + document.getElementById('adresse-textbox-person_id').value=person_id; + document.getElementById('adresse-textbox-adresse_id').value=adresse_id; + document.getElementById('adresse-textbox-name').value=name; + document.getElementById('adresse-textbox-strasse').value=strasse; + document.getElementById('adresse-textbox-plz').value=plz; + AdresseLoadGemeinde(true); + document.getElementById('adresse-textbox-gemeinde').value=gemeinde; + AdresseLoadOrtschaft(true); + document.getElementById('adresse-textbox-ort').value=ort; + document.getElementById('adresse-menulist-nation').value=nation; + document.getElementById('adresse-menulist-typ').value=typ; + if(heimatadresse=='Ja') + document.getElementById('adresse-checkbox-heimatadresse').checked=true; + else + document.getElementById('adresse-checkbox-heimatadresse').checked=false; + + if(zustelladresse=='Ja') + document.getElementById('adresse-checkbox-zustelladresse').checked=true; + else + document.getElementById('adresse-checkbox-zustelladresse').checked=false; + document.getElementById('adresse-textbox-co_name').value = co_name; + document.getElementById('adresse-menulist-firma').value=firma_id; + document.getElementById('adresse-textbox-anmerkung').value=anmerkung; + if(rechnungsadresse=='Ja') + document.getElementById('adresse-checkbox-rechnungsadresse').checked=true; + else + document.getElementById('adresse-checkbox-rechnungsadresse').checked=false; +} + +// **** +// * Speichern der Daten +// **** +function AdresseSpeichern() +{ + if(window.opener.KontaktAdresseSpeichern(document)) + window.close(); + else + this.focus(); +} + +// **** +// * Laedt die Gemeinden zur eingegebenen Postleitzahl +// **** +function AdresseLoadGemeinde(blocking) +{ + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + menulist_gemeinde = document.getElementById('adresse-textbox-gemeinde'); + if(document.getElementById('adresse-menulist-nation').value=='A') + { + menulist_gemeinde.value=''; + document.getElementById('adresse-textbox-ort').value=''; + } + plz = document.getElementById('adresse-textbox-plz').value; + + if(plz.length>3) + { + var url = 'rdf/gemeinde.rdf.php?plz='+plz+'&'+gettimestamp(); + + var oldDatasources = menulist_gemeinde.database.GetDataSources(); + while(oldDatasources.hasMoreElements()) + { + menulist_gemeinde.database.RemoveDataSource(oldDatasources.getNext()); + } + //Refresh damit die entfernten DS auch wirklich entfernt werden + menulist_gemeinde.builder.rebuild(); + + var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); + if(blocking) + var datasource = rdfService.GetDataSourceBlocking(url); + else + var datasource = rdfService.GetDataSource(url); + datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); + datasource.QueryInterface(Components.interfaces.nsIRDFXMLSink); + menulist_gemeinde.database.AddDataSource(datasource); + + menulist_gemeinde.builder.rebuild(); + } +} + +// **** +// * Laedt die Ortschaften zu Plz und Gemeinde +// **** +function AdresseLoadOrtschaft(blocking) +{ + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + + gemeinde = document.getElementById('adresse-textbox-gemeinde').value; + menulist_ort = document.getElementById('adresse-textbox-ort'); + if(document.getElementById('adresse-menulist-nation').value=='A') + { + menulist_ort.value=''; + } + plz = document.getElementById('adresse-textbox-plz').value; + + if(plz.length>3 && gemeinde!='') + { + var url = 'rdf/gemeinde.rdf.php?plz='+plz+'&gemeinde='+encodeURIComponent(gemeinde)+'&'+gettimestamp(); + + var oldDatasources = menulist_ort.database.GetDataSources(); + while(oldDatasources.hasMoreElements()) + { + menulist_ort.database.RemoveDataSource(oldDatasources.getNext()); + } + //Refresh damit die entfernten DS auch wirklich entfernt werden + menulist_ort.builder.rebuild(); + + var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService); + if(blocking) + var datasource1 = rdfService.GetDataSourceBlocking(url); + else + var datasource1 = rdfService.GetDataSource(url); + datasource1.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource); + datasource1.QueryInterface(Components.interfaces.nsIRDFXMLSink); + menulist_ort.database.AddDataSource(datasource1); + + menulist_ort.builder.rebuild(); + } } \ No newline at end of file diff --git a/content/adressedialog.xul.php b/content/adressedialog.xul.php index 9cac357de..f4f530bf0 100644 --- a/content/adressedialog.xul.php +++ b/content/adressedialog.xul.php @@ -1,199 +1,206 @@ -, - * Andreas Oesterreicher and - * Rudolf Hangl . - */ - -header("Cache-Control: no-cache"); -header("Cache-Control: post-check=0, pre-check=0",false); -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Pragma: no-cache"); -header("Content-type: application/vnd.mozilla.xul+xml"); - -include('../config/vilesci.config.inc.php'); -echo ''."\n"; - -echo ''; -echo ''; - -if(isset($_GET['adresse_id']) && is_numeric($_GET['adresse_id'])) - $adresse_id=$_GET['adresse_id']; -else - $adresse_id=''; - -if(isset($_GET['person_id']) && is_numeric($_GET['person_id'])) - $person_id=$_GET['person_id']; -else - $person_id=''; -?> - -)" - > - - - @@ -1007,7 +1007,10 @@ function output_inventar($debug=false,$resultBetriebsmittel=null,$resultBetriebs $htmlstring.=''; // mit Berechtigung ist der Status zum bearbeiten - $betriebsmittelstatus_kurzbz_select=trim($resultBetriebsmittel[$pos]->betriebsmittelstatus_kurzbz); + $betriebsmittel_betriebsmittelstatus = new betriebsmittel_betriebsmittelstatus(); + $status = $betriebsmittel_betriebsmittelstatus->load_last_status_by_betriebsmittel_id($resultBetriebsmittel[$pos]->betriebsmittel_id); + $betriebsmittelstatus_kurzbz_select = trim($status); + //$resultBetriebsmittel[$pos]->betriebsmittelstatus_kurzbz; if (!$schreib_recht) $htmlstring.=$betriebsmittelstatus_kurzbz_select; else diff --git a/vilesci/lehre/studienplan_gueltigkeit.php b/vilesci/lehre/studienplan_gueltigkeit.php index 0b27a5e02..dea6d4ba0 100644 --- a/vilesci/lehre/studienplan_gueltigkeit.php +++ b/vilesci/lehre/studienplan_gueltigkeit.php @@ -34,6 +34,7 @@ if(!$rechte->isBerechtigt('lehre/studienordnung', null, 's')) $studiengang_kz = isset($_GET['studiengang_kz'])?$_GET['studiengang_kz']:''; $orgform_kurzbz = isset($_GET['orgform_kurzbz'])?$_GET['orgform_kurzbz']:''; +$farbe = isset($_GET['farbe'])?true:false; $db = new basis_db(); echo ' @@ -51,7 +52,7 @@ echo ' { $("#t1").tablesorter( { - widgets: ["zebra"] + /*widgets: ["zebra"]*/ }); }); @@ -95,7 +96,7 @@ foreach ($orgform->result as $of) echo ''; } -echo ' +echo 'Unterschiede farblich hervorheben '; @@ -127,6 +128,7 @@ echo '