diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b28531f8..05c155569 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - **[CORE]** Berechtigungsprüfung wurde angepasst damit deaktivierte Benutzer keine Berechtigungen mehr haben - **[FAS]** Mitarbeiterexport exportiert jetzt nur noch die markierten Personen - **[CORE]** Has many as possible javascripts and css present in the repository were removed. Their lack is overcome by the packages in the composer. In the meanwhile also the versions were updated +- **[CIS]** Die Fotoliste wird jetzt mit unoconv erstellt. Die bestehende Vorlage für den Dokumentenexport muss hier angepasst werden ### Updateinfo - **[CORE]** Infoscreen wurde umbenannt (informationsbildschirm.php) diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php index b1fd96f0f..786937dd7 100644 --- a/application/config/fhcomplete.php +++ b/application/config/fhcomplete.php @@ -198,6 +198,7 @@ $config['fhc_acl'] = array 'system.tbl_appdaten' => 'system/appdaten', 'system.tbl_benutzerrolle' => 'basis/benutzerrolle', 'system.tbl_berechtigung' => 'basis/berechtigung', + 'system.tbl_filters' => 'system/filters', 'system.tbl_cronjob' => 'basis/cronjob', 'system.tbl_phrase' => 'system/phrase', 'system.tbl_phrasentext' => 'system/phrase', @@ -209,6 +210,7 @@ $config['fhc_acl'] = array 'system.tbl_webservicetyp' => 'basis/webservicetyp', 'system.tbl_udf' => 'system/udf', 'system.tbl_extensions' => 'system/extensions', + 'system.tbl_log' => 'basis/log', 'testtool.tbl_ablauf' => 'basis/ablauf', 'testtool.tbl_antwort' => 'basis/antwort', 'testtool.tbl_frage' => 'basis/frage', diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php new file mode 100644 index 000000000..17e7dcc03 --- /dev/null +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -0,0 +1,39 @@ +load->library('WidgetLib'); + } + + /** + * + */ + public function index() + { + $listFiltersSent = array( + 'Sent 1' => 100, + 'Sent 2' => 200, + 'Sent 3' => 300 + ); + + $listFiltersNotSent = array( + 'Not Sent 1' => 400, + 'Not Sent 2' => 500, + 'Not Sent 3' => 600 + ); + + $this->load->view( + 'system/infocenter/infocenter.php', + array( + 'listFiltersSent' => $listFiltersSent, + 'listFiltersNotSent' => $listFiltersNotSent + ) + ); + } +} diff --git a/application/controllers/system/infocenter/InfocenterDetails.php b/application/controllers/system/infocenter/InfocenterDetails.php new file mode 100644 index 000000000..f65efea77 --- /dev/null +++ b/application/controllers/system/infocenter/InfocenterDetails.php @@ -0,0 +1,456 @@ +load->model('person/person_model', 'PersonModel'); + $this->load->model('person/kontakt_model', 'KontaktModel'); + $this->load->model('person/adresse_model', 'AdresseModel'); + $this->load->model('person/notiz_model', 'NotizModel'); + $this->load->model('person/notizzuordnung_model', 'NotizzuordnungModel'); + $this->load->model('crm/prestudent_model', 'PrestudentModel'); + $this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel'); + $this->load->model('crm/akte_model', 'AkteModel'); + $this->load->model('crm/statusgrund_model', 'StatusgrundModel'); + $this->load->model('codex/nation_model', 'NationModel'); + $this->load->model('codex/zgv_model', 'ZgvModel'); + $this->load->model('codex/zgvmaster_model', 'ZgvmasterModel'); + $this->load->model('organisation/studiengang_model', 'StudiengangModel'); + + $this->load->library('DmsLib'); + $this->load->library('WidgetLib'); + $this->load->library('PersonLogLib'); + + $this->load->helper('fhcauth'); + $this->load->helper('url'); + + $this->app = 'aufnahme'; + $this->uid = getAuthUID(); + if(!$this->uid) + show_error('user authentification failed'); + } + + public function index() + { + //TODO error page + } + + private function __loadPersonData($person_id) + { + $person = $this->PersonModel->load($person_id); + + if ($person->error) + { + show_error($person->retval); + } + + $staatsbuergerschaft = $this->NationModel->load($person->retval[0]->staatsbuergerschaft); + if ($staatsbuergerschaft->error) + { + show_error($staatsbuergerschaft->retval); + } + + $geburtsnation = $this->NationModel->load($person->retval[0]->geburtsnation); + if ($geburtsnation->error) + { + show_error($geburtsnation->retval); + } + + $this->KontaktModel->addDistinct(); + $this->KontaktModel->addSelect('kontakttyp, kontakt'); + $kontakte = $this->KontaktModel->loadWhere(array('person_id' => $person_id)); + + if ($kontakte->error) + { + show_error($kontakte->retval); + } + + $adresse = $this->AdresseModel->loadWhere(array('person_id' => $person_id)); + + if ($adresse->error) + { + show_error($adresse->retval); + } + + $dokumente = $this->AkteModel->loadWhere(array('person_id' => $person_id)); + + if ($dokumente->error) + { + show_error($dokumente->retval); + } + + $logs = $this->personloglib->getLogs($person_id, $this->app); + + foreach($logs as $log) + $log->logdata = json_decode($log->logdata); + + $this->NotizzuordnungModel->addSelect('notiz_id'); + $notizzuordnung = $this->NotizzuordnungModel->loadWhere(array('person_id' => $person_id)); + + if ($notizzuordnung->error) + { + show_error($notizzuordnung->retval); + } + + $notizen = array(); + + foreach ($notizzuordnung->retval as $notiz_id) + { + $notiz = $this->NotizModel->load($notiz_id->notiz_id); + $notizen[] = $notiz->retval[0]; + } + + $data = array ( + 'person' => $person->retval[0], + 'staatsbuergerschaft' => $staatsbuergerschaft->retval[0], + 'geburtsnation' => $geburtsnation->retval[0], + 'kontakte' => $kontakte->retval, + 'adresse' => isset($adresse->retval[0]) ? $adresse->retval[0] : null, + 'dokumente' => $dokumente->retval, + 'logs' => $logs, + 'notizen' => $notizen + ); + + return $data; + } + + private function __loadPrestudentData($person_id) + { + $zgvpruefungen = []; + + $prestudenten = $this->PrestudentModel->loadWhere(array('person_id' => $person_id)); + + if ($prestudenten->error) + { + show_error($prestudenten->retval); + } + + foreach ($prestudenten->retval as $prestudent) + { + $zgvpruefung = new stdClass(); + $zgvpruefung->prestudent_id = $prestudent->prestudent_id; + + //Prestudentstatus + $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent->prestudent_id); + + if ($lastStatus->error) + { + show_error($lastStatus->retval); + } + + $zgvpruefung->prestudentstatus = $lastStatus->retval[0]; + + // Studiengang + $this->StudiengangModel->addSelect('kurzbzlang, bezeichnung, typ');//TODO need bezeichnung? + $studiengang = $this->StudiengangModel->load($prestudent->studiengang_kz); + + if ($studiengang->error) + { + show_error($studiengang->retval); + } + + $zgvpruefung->studiengang = $studiengang->retval[0]->kurzbzlang; + $zgvpruefung->studiengangtyp = $studiengang->retval[0]->typ; + + // Zgv + if (isset($prestudent->zgv_code)) + { + $this->ZgvModel->addSelect('zgv_code, zgv_bez'); + $zgv = $this->ZgvModel->load($prestudent->zgv_code); + + if ($zgv->error) + { + show_error($zgv->retval); + } + + $zgvpruefung->zgv_code = $zgv->retval[0]->zgv_code; + $zgvpruefung->zgv_bez = $zgv->retval[0]->zgv_bez; + } + else + { + $zgvpruefung->zgv_code = null; + $zgvpruefung->zgv_bez = null; + } + $zgvpruefung->zgvort = $prestudent->zgvort; + $zgvpruefung->zgvdatum = $prestudent->zgvdatum; + + // Zgv Nation + if (isset($prestudent->zgvnation)) + { + $this->NationModel->addSelect('nation_code, kurztext'); + $zgvnation = $this->NationModel->load($prestudent->zgvnation); + + if ($zgvnation->error) + { + show_error($zgvnation->retval); + } + + $zgvpruefung->zgvnation_code = $zgvnation->retval[0]->nation_code; + $zgvpruefung->zgvnation_bez = $zgvnation->retval[0]->kurztext; + } + else + { + $zgvnation = null; + $zgvpruefung->zgvnation_code = null; + $zgvpruefung->zgvnation_bez = null; + } + + // Zgv Master + if (isset($prestudent->zgvmas_code)) + { + $this->ZgvmasterModel->addSelect('zgvmas_code, zgvmas_bez'); + $zgvmas = $this->ZgvmasterModel->load($prestudent->zgvmas_code); + + if ($zgvmas->error) + { + show_error($zgvmas->retval); + } + $zgvpruefung->zgvmas_code = $zgvmas->retval[0]->zgvmas_code; + $zgvpruefung->zgvmas_bez = $zgvmas->retval[0]->zgvmas_bez; + } + else + { + $zgvpruefung->zgvmas_code = null; + $zgvpruefung->zgvmas_bez = null; + } + $zgvpruefung->zgvmaort = $prestudent->zgvmaort; + $zgvpruefung->zgvmadatum = $prestudent->zgvmadatum; + + // Zgv Master Nation + if (isset($prestudent->zgvmanation)) + { + $this->NationModel->addSelect('nation_code, kurztext'); + $zgvmanation = $this->NationModel->load($prestudent->zgvmanation); + + if ($zgvmanation->error) + { + show_error($zgvmanation->retval); + } + + $zgvpruefung->zgvmanation_code = $zgvmanation->retval[0]->nation_code; + $zgvpruefung->zgvmanation_bez = $zgvmanation->retval[0]->kurztext; + } + else + { + $zgvmanation = null; + $zgvpruefung->zgvmanation_code = null; + $zgvpruefung->zgvmanation_bez = null; + } + + $zgvpruefungen[] = $zgvpruefung; + } + + //TODO replace with widget + $statusgruende = $this->StatusgrundModel->load()->retval; + + $data = array ( + 'zgvpruefungen' => $zgvpruefungen, + 'statusgruende' => $statusgruende + ); + + return $data; + } + + public function showDetails($person_id) + { + $persondata = $this->__loadPersonData($person_id); + $prestudentdata = $this->__loadPrestudentData($person_id); + $this->load->view('system/infocenter/infocenterDetails.php', array_merge($persondata, $prestudentdata)); + } + + public function saveFormalGeprueft() + { + $akte_id = $this->input->get('akte_id'); + $formalgeprueft = $this->input->get('formal_geprueft'); + $person_id = $this->input->get('person_id'); + + $akte = $this->AkteModel->load($akte_id); + + if ($akte->error) + { + show_error($akte->retval); + } + + $timestamp = (isset($formalgeprueft) && $formalgeprueft === 'true')? date('Y-m-d H:i:s') : null; + $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp)); + + //write person log + $this->personloglib->log($person_id, 'Action', array('name' => 'Dokument formal geprüft', 'message' => 'Dokument'.$akte->titel.' formal geprüft, gesetzt auf '.(is_null($timestamp) ? 'NULL' : $timestamp), 'success' => 'true'), $this->app, null, $this->uid); + + redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id); + } + + public function saveZgvPruefung($prestudent_id) + { + // prestudentdata + $studiensemester = $this->input->post('studiensemester') === 'null' ? null : $this->input->post('studiensemester'); + $ausbildungssemester = $this->input->post('ausbildungssemester'); + + // zgvdata + $zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv'); + $zgvort = $this->input->post('zgvort'); + $zgvdatum = $this->input->post('zgvdatum'); + $zgvdatum = empty($zgvdatum) ? null : date_format(date_create($zgvdatum), 'Y-m-d'); + $zgvnation_code = $this->input->post('zgvnation') === 'null' ? null : $this->input->post('zgvnation'); + + //zgvmasterdata + $zgvmas_code = $this->input->post('zgvmas') === 'null' ? null : $this->input->post('zgvmas'); + $zgvmaort = $this->input->post('zgvmaort'); + $zgvmadatum = $this->input->post('zgvmadatum'); + $zgvmadatum = empty($zgvmadatum) ? null : date_format(date_create($zgvmadatum), 'Y-m-d'); + $zgvmanation_code = $this->input->post('zgvmanation') === 'null' ? null : $this->input->post('zgvmanation'); + + $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id); + + if ($lastStatus->error) + { + show_error($lastStatus->retval); + } + + $result = $this->PrestudentstatusModel->update(array('prestudent_id' => $prestudent_id, 'studiensemester_kurzbz' => $lastStatus->retval[0]->studiensemester_kurzbz, 'ausbildungssemester' => $lastStatus->retval[0]->ausbildungssemester), array('studiensemester_kurzbz' => $studiensemester, 'ausbildungssemester' => $ausbildungssemester)); + + if ($result->error) + { + show_error($result->retval); + } + + $result = $this->PrestudentModel->update($prestudent_id, array('zgv_code' => $zgv_code, 'zgvort' => $zgvort, 'zgvdatum' => $zgvdatum, 'zgvnation' => $zgvnation_code, + 'zgvmas_code' => $zgvmas_code, 'zgvmaort' => $zgvmaort, 'zgvmadatum' => $zgvmadatum, 'zgvmanation' => $zgvmanation_code)); + + if ($result->error) + { + show_error($result->retval); + } + + $logdata = $this->__getPersonAndStudiengangFromPrestudent($prestudent_id); + + $this->personloglib->log($logdata['person_id'], 'Action', array('name' => 'Zgv gespeichert', 'message' => 'Zgv für Studiengang '.$logdata['studiengang_kurzbz'].' wurde gespeichert ', 'success' => 'true'), $this->app, null, $this->uid); + + $this->__redirectToStart($prestudent_id); + } + + public function saveAbsage($prestudent_id) + { + $statusgrund = $this->input->post('statusgrund'); + + $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id); + + if ($lastStatus->error) + { + show_error($lastStatus->retval); + } + + $result = $this->PrestudentstatusModel->insert(array('prestudent_id' => $prestudent_id, 'studiensemester_kurzbz' => $lastStatus->retval[0]->studiensemester_kurzbz, 'ausbildungssemester' => $lastStatus->retval[0]->ausbildungssemester, 'datum' => date('Y-m-d'), 'orgform_kurzbz' => $lastStatus->retval[0]->orgform_kurzbz, 'studienplan_id' => $lastStatus->retval[0]->studienplan_id, 'status_kurzbz' => 'Abgewiesener', 'statusgrund_id' => $statusgrund, 'insertvon' => $this->uid, 'insertamum' => date('Y-m-d H:i:s'))); + + if ($result->error) + { + show_error($result->retval); + } + + $logdata = $this->__getPersonAndStudiengangFromPrestudent($prestudent_id); + + $this->personloglib->log($logdata['person_id'], 'Processstate', array('name' => 'Interessent abgewiesen', 'message' => 'Interessent wurde für Studiengang '.$logdata['studiengang_kurzbz'].' abgewiesen', 'success' => 'true'), $this->app, null, $this->uid); + + $this->__redirectToStart($prestudent_id); + } + + public function saveFreigabe($prestudent_id) + { + $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id); + + if (count($lastStatus->retval) > 0) + { + $lastStatus = $lastStatus->retval[0]; + + $result = $this->PrestudentstatusModel->update(array('prestudent_id' => $prestudent_id, 'status_kurzbz' => $lastStatus->status_kurzbz, 'studiensemester_kurzbz' => $lastStatus->studiensemester_kurzbz, 'ausbildungssemester' => $lastStatus->ausbildungssemester), + array('bestaetigtvon' => $this->uid, 'bestaetigtam' => date('Y-m-d'), 'updatevon' => $this->uid, 'updateamum' => date('Y-m-d H:i:s'))); + + if ($result->error) + { + show_error($result->retval); + } + } + + $logdata = $this->__getPersonAndStudiengangFromPrestudent($prestudent_id); + + $this->personloglib->log($logdata['person_id'], 'Processstate', array('name' => 'Interessent freigegeben', 'message' => 'Interessent wurde für Studiengang '.$logdata['studiengang_kurzbz'].' freigegeben', 'success' => 'true'), $this->app, null, $this->uid); + + $this->__redirectToStart($prestudent_id); + } + + public function saveNotiz($person_id) + { + $titel = $this->input->post('notiztitel'); + $text = $this->input->post('notiz'); + $erledigt = false; + + $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->uid); + + $this->personloglib->log($person_id, 'Action', array('name' => 'Notiz hinzugefügt', 'message' => 'Notiz mit Titel '.$titel.' wurde hinzugefügt', 'success' => 'true'), $this->app, null, $this->uid); + + redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id); + } + + public function outputAkteContent($akte_id) + { + $akte = $this->AkteModel->load($akte_id); + + if ($akte->error) + { + show_error($akte->retval); + } + + $aktecontent = $this->dmslib->getAkteContent($akte_id); + + if($aktecontent->error) + { + show_error($aktecontent->retval); + } + + header("Content-type: ".$akte->retval[0]->mimetype); + header('Content-Disposition: attachment; filename="'.$akte->retval[0]->titel.'"'); + echo $aktecontent->retval; + } + + private function __redirectToStart($prestudent_id) + { + $this->PrestudentModel->addSelect('person_id'); + $person_id = $this->PrestudentModel->load($prestudent_id)->retval[0]->person_id; + redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id); + } + + private function __getPersonAndStudiengangFromPrestudent($prestudent_id) + { + $this->PrestudentModel->addSelect('person_id, studiengang_kz'); + $prestudent = $this->PrestudentModel->load($prestudent_id); + + if ($prestudent->error) + { + show_error($prestudent->retval); + } + + $person_id = $prestudent->retval[0]->person_id; + + $this->StudiengangModel->addSelect('kurzbzlang');//TODO need bezeichnung? + $studiengang = $this->StudiengangModel->load($prestudent->retval[0]->studiengang_kz); + + if ($studiengang->error) + { + show_error($studiengang->retval); + } + + $studiengang_kurzbz = $studiengang->retval[0]->kurzbzlang; + + return array('person_id' => $person_id, 'studiengang_kurzbz' => $studiengang_kurzbz); + } + +} \ No newline at end of file diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index ab5ab2768..3dc5e85ac 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -23,6 +23,9 @@ class DB_Model extends FHC_Model protected $hasSequence; // False if this table has a composite primary key that is not using a sequence // True if this table has a primary key that uses a sequence + private $executedQueryMetaData; + private $executedQueryListFields; + /** * Constructor */ @@ -670,6 +673,48 @@ class DB_Model extends FHC_Model return $this->fieldExists(UDFLib::COLUMN_NAME); } + /** + * Get the list of the fields after having executed a query + */ + public function getExecutedQueryListFields() + { + return $this->executedQueryListFields; + } + + /** + * Get meda data info about the retrived fields after having executed a query + */ + public function getExecutedQueryMetaData() + { + return $this->executedQueryMetaData; + } + + /** + * Like execQuery, but it allows only to perform queries to read data + */ + public function execReadOnlyQuery($query, $parametersArray = null) + { + $result = error('You are allowed to run only query for reading data'); // + $cleanedQuery = trim(preg_replace('/\t|\n|\r|;/', '', $query)); // + + // + if (stripos($cleanedQuery, 'SELECT') == 0 + && (stripos($cleanedQuery, 'INSERT') > 0 || stripos($cleanedQuery, 'INSERT') == false) + && (stripos($cleanedQuery, 'UPDATE') > 0 || stripos($cleanedQuery, 'UPDATE') == false) + && (stripos($cleanedQuery, 'CREATE') > 0 || stripos($cleanedQuery, 'CREATE') == false) + && (stripos($cleanedQuery, 'DELETE') > 0 || stripos($cleanedQuery, 'DELETE') == false) + && (stripos($cleanedQuery, 'ALTER') > 0 || stripos($cleanedQuery, 'ALTER') == false) + && (stripos($cleanedQuery, 'GRANT') > 0 || stripos($cleanedQuery, 'GRANT') == false) + && (stripos($cleanedQuery, 'DROP') > 0 || stripos($cleanedQuery, 'DROP') == false)) + { + $queryToExec = str_replace(';', '', $query); // + + $result = $this->execQuery($queryToExec, $parametersArray); + } + + return $result; + } + // ------------------------------------------------------------------------------------------ // Protected methods @@ -809,20 +854,23 @@ class DB_Model extends FHC_Model if (is_object($result)) { $toBeConverterdArray = array(); // Fields to be converted - $metaDataArray = $result->field_data(); // Fields information - for ($i = 0; $i < count($metaDataArray); $i++) // Looking for booleans and arrays + + $this->executedQueryMetaData = $result->field_data(); // Fields information + $this->executedQueryListFields = $result->list_fields(); // List of the retrived fields + + for ($i = 0; $i < count($this->executedQueryMetaData); $i++) // Looking for booleans and arrays { // If array type, boolean type OR a UDF - if (strpos($metaDataArray[$i]->type, DB_Model::PGSQL_ARRAY_TYPE) !== false - || $metaDataArray[$i]->type == DB_Model::PGSQL_BOOLEAN_TYPE - || $this->udflib->isUDFColumn($metaDataArray[$i]->name, $metaDataArray[$i]->type)) + if (strpos($this->executedQueryMetaData[$i]->type, DB_Model::PGSQL_ARRAY_TYPE) !== false + || $this->executedQueryMetaData[$i]->type == DB_Model::PGSQL_BOOLEAN_TYPE + || $this->udflib->isUDFColumn($this->executedQueryMetaData[$i]->name, $this->executedQueryMetaData[$i]->type)) { // Name and type of the field to be converted $toBeConverted = new stdClass(); // Set the type of the field to be converted - $toBeConverted->type = $metaDataArray[$i]->type; + $toBeConverted->type = $this->executedQueryMetaData[$i]->type; // Set the name of the field to be converted - $toBeConverted->name = $metaDataArray[$i]->name; + $toBeConverted->name = $this->executedQueryMetaData[$i]->name; // Add the field to be converted to $toBeConverterdArray array_push($toBeConverterdArray, $toBeConverted); } diff --git a/application/libraries/CallerLib.php b/application/libraries/CallerLib.php index 856f0855a..d2387a723 100644 --- a/application/libraries/CallerLib.php +++ b/application/libraries/CallerLib.php @@ -14,16 +14,17 @@ class CallerLib const LIB_FILE_EXTENSION = '.php'; const LIBS_PATH = 'libraries'; const MODEL_PREFIX = '_model'; - + // Black list of resources that are no allowed to be used private static $RESOURCES_BLACK_LIST = array( 'CallerLib', // disabled self loading 'LogLib', // hardly usefull and virtually dangerous 'MigrationLib', // virtually dangerous, DB manipulation 'FilesystemLib', // virtually dangerous, direct access to file system - 'PermissionLib' // usefull? + 'PermissionLib', // usefull? + 'PersonLogLib' ); - + /** * Object initialization */ @@ -31,14 +32,14 @@ class CallerLib { // Gets CI instance $this->ci =& get_instance(); - + // Loads helper message to manage returning messages $this->ci->load->helper('Message'); - + // Loads permission library $this->ci->load->library('PermissionLib'); } - + /** * Wrapper method for _call */ @@ -46,7 +47,7 @@ class CallerLib { return $this->_call($callParameters, $permissionType); } - + /** * Wrapper method for _call */ @@ -54,7 +55,7 @@ class CallerLib { return $this->_call($callParameters, $permissionType); } - + /** * Everything starts here... */ @@ -63,7 +64,7 @@ class CallerLib $result = null; $parameters = $this->_getParameters($callParameters); $validation = $this->_validateCall($parameters); - + // If the validation was passed if (isSuccess($validation)) { @@ -119,7 +120,7 @@ class CallerLib { $result = error('Neither a lib nor model: '.$parameters->resourcePath.$parameters->resourceName); } - + // If the resource was found and loaded if (!is_null($loaded)) { @@ -134,10 +135,10 @@ class CallerLib { $result = $validation; } - + return $result; } - + /** * Gets the parameters from the http call * Search for parameters and @@ -181,7 +182,7 @@ class CallerLib return $parameters; } - + /** * Validate the given parameters */ @@ -224,7 +225,7 @@ class CallerLib { $loaded = null; $result = null; - + try { $loaded = $this->ci->load->model($resourcePath.$resourceName); @@ -234,15 +235,15 @@ class CallerLib // Errors while loading the model $result = error('Errors while loading the model: '.$e->getMessage()); } - + if (!is_null($loaded)) { $result = success($loaded); } - + return $result; } - + /** * Search for a valid permission for this library that should be present with this format: * '..' => '' @@ -251,14 +252,14 @@ class CallerLib { $result = null; $permissionPath = ''; - + if ($resourcePath != '') { $permissionPath = $resourcePath; } - + $permissionPath .= $resourceName.'.'.$function; - + if ($this->ci->permissionlib->isEntitled($permissionPath, $permissionType) === false) { $result = error(FHC_NORIGHT, FHC_NORIGHT); @@ -267,10 +268,10 @@ class CallerLib { $result = success('Has permission'); } - + return $result; } - + /** * Loads a library using the given path and name * @@ -286,7 +287,7 @@ class CallerLib private function _loadLibrary($resourcePath, $resourceName) { $loaded = null; - + try { // Gets all the configured resources paths @@ -328,15 +329,15 @@ class CallerLib // Errors while loading the library $result = error('Errors while loading the library: '.$e->getMessage()); } - + if (!is_null($loaded)) { $result = success($loaded); } - + return $result; } - + /** * Calls a method of a class with the given parameters and returns its result * @@ -347,7 +348,7 @@ class CallerLib private function _callThis($resourceName, $function, $parameters) { $result = null; - + try { // Get informations about the function @@ -402,7 +403,7 @@ class CallerLib { $result = error($e->getMessage()); } - + return $result; } } diff --git a/application/libraries/DmsLib.php b/application/libraries/DmsLib.php index 7ee160f85..7b5eeb62e 100644 --- a/application/libraries/DmsLib.php +++ b/application/libraries/DmsLib.php @@ -12,18 +12,21 @@ class DmsLib public function __construct() { $this->ci =& get_instance(); - + $this->ci->load->model('crm/Akte_model', 'AkteModel'); $this->ci->load->model('content/Dms_model', 'DmsModel'); $this->ci->load->model('content/DmsVersion_model', 'DmsVersionModel'); $this->ci->load->model('content/DmsFS_model', 'DmsFSModel'); - + // Loads helper message to manage returning messages $this->ci->load->helper('message'); } /** - * read + * Read a DMS Document from the Filesystem + * @param int $dms_id ID of the Document. + * @param int $version The version of the Document (latest if null). + * @return object success or error */ public function read($dms_id, $version = null) { @@ -44,7 +47,7 @@ class DmsLib $result = $this->ci->DmsModel->loadWhere(array('dms_id' => $dms_id, 'version' => $version)); } } - + if (hasData($result)) { $resultFS = $this->ci->DmsFSModel->read($result->retval[0]->filename); @@ -57,20 +60,26 @@ class DmsLib $result = $resultFS; } } - + return $result; } - + /** - * getAktenAcceptedDms + * Get all accepted Documents of a Person + * + * @param int $person_id ID of the person. + * @param string $dokument_kurzbz Type of document. + * @param bool $no_file If null then loads also the content. + * @return object success or error */ public function getAktenAcceptedDms($person_id, $dokument_kurzbz = null, $no_file = null) { $result = $this->ci->AkteModel->getAktenAcceptedDms($person_id, $dokument_kurzbz); - + if (hasData($result) && $no_file == null) { - for ($i = 0; $i < count($result->retval); $i++) + $cnt = count($result->retval); + for ($i = 0; $i < $cnt; $i++) { $resultFS = $this->ci->DmsFSModel->read($result->retval[$i]->filename); if (isSuccess($resultFS)) @@ -83,12 +92,14 @@ class DmsLib } } } - + return $result; } /** - * save + * Saves a Document + * @param object $dms DMS Object ot be saved. + * @return object */ public function save($dms) { @@ -142,30 +153,34 @@ class DmsLib return $result; } - + /** - * delete + * Deletes a Akte of a Person + * @param int $person_id ID of the person. + * @param int $dms_id Id of the Document. + * @return object */ public function delete($person_id, $dms_id) { $result = null; - + // If the parameters are valid if (is_numeric($person_id) && is_numeric($dms_id)) { // Start DB transaction $this->ci->db->trans_start(false); - + // Get akte_id from table tbl_akte $result = $this->ci->AkteModel->loadWhere(array('person_id' => $person_id, 'dms_id' => $dms_id)); if (isSuccess($result)) { // Delete all entries in tbl_akte - for ($i = 0; $i < count($result->retval); $i++) + $cnt = count($result->retval); + for ($i = 0; $i < $cnt; $i++) { $this->ci->AkteModel->delete($result->retval[$i]->akte_id); } - + // Get all filenames related to this dms $resultFileNames = $this->ci->DmsVersionModel->loadWhere(array('dms_id' => $dms_id)); if (isSuccess($resultFileNames)) @@ -179,10 +194,10 @@ class DmsLib } } } - + // Transaction complete! $this->ci->db->trans_complete(); - + // Check if everything went ok during the transaction if ($this->ci->db->trans_status() === false || isError($result)) { @@ -194,12 +209,13 @@ class DmsLib $this->ci->db->trans_commit(); $result = success('Dms successfully removed from DB'); } - + // If everything is ok if (isSuccess($result)) { + $cnt = count($resultFileNames->retval); // Remove all files related to this person and dms - for ($i = 0; $i < count($resultFileNames->retval); $i++) + for ($i = 0; $i < $cnt; $i++) { $this->ci->DmsFSModel->remove($resultFileNames->retval[$i]->filename); } @@ -209,17 +225,56 @@ class DmsLib { $result = error('Invalid parameters'); } - + return $result; } - + /** - * _saveFileOnInsert + * Loads the Content of an akte + * @param int $akte_id Id of the akte. + * @return object with document content or error + */ + public function getAkteContent($akte_id) + { + $akte = $this->ci->AkteModel->load($akte_id); + if (hasData($akte)) + { + if ($akte->retval[0]->inhalt != '') + { + return success(base64_decode($akte->retval[0]->inhalt)); + } + elseif ($akte->retval[0]->dms_id != '') + { + $dmscontent = $this->read($akte->retval[0]->dms_id); + if (isSuccess($dmscontent)) + { + return success(base64_decode($dmscontent->retval[0]->file_content)); + } + else + { + return error($dmscontent->retval); + } + } + else + { + return error('No Content available'); + } + } + else + { + return error($akte->retval); + } + } + + /** + * Saves the Content of a DMS in the Filesystem + * @param object $dms DMS object to be saved. + * @return object */ private function _saveFileOnInsert($dms) { $filename = uniqid().'.'.pathinfo($dms['name'], PATHINFO_EXTENSION); - + $result = $this->ci->DmsFSModel->write($filename, $dms['file_content']); if (isSuccess($result)) { @@ -230,7 +285,9 @@ class DmsLib } /** - * _saveFileOnUpdate + * Updates the File in the Filesystem + * @param object $dms DMS object to update. + * @return object */ private function _saveFileOnUpdate($dms) { diff --git a/application/libraries/DocumentLib.php b/application/libraries/DocumentLib.php new file mode 100644 index 000000000..ba76eca6c --- /dev/null +++ b/application/libraries/DocumentLib.php @@ -0,0 +1,182 @@ +ci =& get_instance(); + + exec('unoconv --version', $ret_arr); + if(isset($ret_arr[0])) + $this->unoconv_version = explode(' ', $ret_arr[0])[1]; + else + show_error('Unoconv not found - Please install Unoconv'); + } + + /** + * Converts a File to PDF + * @param string $filename Full path to the file. + * @return success or error object + */ + public function convertToPDF($filename) + { + if (!file_exists($filename)) + return error('Unable to Convert to PDF. File not found:'.$filename); + + $mimetype = mime_content_type($filename); + $outFile = sys_get_temp_dir().'/FHC_'.uniqid().'.pdf'; + + switch ($mimetype) + { + case 'image/jpeg': + case 'image/jpg': + case 'image/pjpeg': + $this->_jpegtopdf($filename, $outFile); + return success($outFile); + case 'application/vnd.oasis.opendocument.spreadsheet': + case 'application/msword': + case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': + case 'application/haansoftdocx': + case 'application/vnd.ms-word': + case 'application/vnd.oasis.opendocument.text': + case 'text/plain': + $this->convert($filename, $outFile, 'pdf'); + return success($outFile); + case 'application/pdf': + return success($filename); + default: + return error('Unknown Mimetype:'.$mimetype); + } + } + + /** + * Combines multiple single PDFs to one PDF + * + * @param array $files Array of Files to merge (full path to file). + * @param string $outFile Path to the Output File. + * @return success or error object + */ + public function mergePDF($files, $outFile) + { + $cmd = "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outFile "; + $finfo = finfo_open(FILEINFO_MIME_TYPE); + + // add all pdf files to the command + foreach ($files as $f) + { + $cmd .= $f." "; + if (!file_exists($f)) + { + return error("File not found: '$f'"); + } + if (finfo_file($finfo, $f) != "application/pdf") + { + return error("Wrong format(".finfo_file($finfo, $f)."): '$f'"); + } + } + + finfo_close($finfo); + + exec($cmd, $out, $ret); + if ($ret != 0) + { + return error('PDF-zusammenfuegung ist derzeit nicht möglich. Bitte informieren Sie den Administrator'); + } + return success(true); + } + + /** + * Converts a Document to another format with unoconv + * + * @param string $inFile File that should be convertet. + * @param string $outFile Name of the Output File. + * @param string $format Outputformat (PDF, DOC, ...). + * @return success or error Object + */ + public function convert($inFile, $outFile, $format) + { + if ($this->unoconv_version == '0.6') + $command = 'unoconv -f %1$s %3$s > %2$s'; + else + $command = 'unoconv -f %s --output %s %s 2>&1'; + $command = sprintf($command, $format, $outFile, $inFile); + + exec($command, $out, $ret); + + if ($ret != 0) + { + return error('Dokumentenkonvertierung ist derzeit nicht möglich. Bitte informieren Sie den Administrator'); + } + + return success(true); + } + + /** + * Converts a JPG to PDF + * + * @param string $filename Path to JPG. + * @param string $outfile Path to Output (pdf) File. + * @return success or error object + */ + private function _jpegtopdf($filename, $outfile) + { + if (!file_exists($filename)) + return error('File does not exists'); + + $size = getimagesize($filename); + + $margin_left_right = 18; + $margin_bottom = 18; + + /* + * längere Seite ermitteln + * Hochformat wenn die Seiten gleich lang sind oder das Bild schmäler ist als die Seitenbreite + */ + if ($size[0] > $size[1] && $size[0] > 595) + { + $page_height = 595; + $page_width = 842; + //Wenn Bild kleiner oder gleich Seitenbreite, dann margin erhoehen + if ($size[0] <= $page_width) + { + $margin_left_right = ($page_width - $size[0]) / 2; + $margin_bottom = ($page_height - $size[1]); + } + } + else + { + $page_height = 842; + $page_width = 595; + //Wenn Bild kleiner oder gleich Seitenbreite, dann margin erhoehen + if ($size[0] <= $page_width) + { + $margin_left_right = ($page_width - $size[0]) / 2; + $margin_bottom = ($page_height - $size[1]); + } + } + + // -r300 = 300 ppi + $cmd = 'gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -r100 '; + $cmd .= '-o '.$outfile.' viewjpeg.ps -c "('.$filename.') '; + $cmd .= '<< /PageSize ['.$page_width.' '.$page_height.'] '; + $cmd .= '/.HWMargins ['.$margin_left_right.' '.$margin_bottom.' '.$margin_left_right.' 18] '; + $cmd .= '/countspaces { [ exch { dup 32 ne { pop } if } forall ] length } bind def >> '; + $cmd .= 'setpagedevice viewJPEG"'; + + exec($cmd, $out, $ret); + if ($ret != 0) + { + $this->errormsg = 'jpegToPdf ist derzeit nicht möglich. Bitte informieren Sie den Administrator'; + return false; + } + return true; + } +} diff --git a/application/libraries/ExtensionsLib.php b/application/libraries/ExtensionsLib.php index 4fa0778e9..0008ba087 100644 --- a/application/libraries/ExtensionsLib.php +++ b/application/libraries/ExtensionsLib.php @@ -313,7 +313,7 @@ class ExtensionsLib if (isError($result)) { $this->_errorOccurred = true; - $this->_printFailure('data base error'); + $this->_printFailure('data base error: '.$result->retval); } else { diff --git a/application/libraries/PermissionLib.php b/application/libraries/PermissionLib.php index 075203c96..3000aceea 100644 --- a/application/libraries/PermissionLib.php +++ b/application/libraries/PermissionLib.php @@ -75,7 +75,7 @@ class PermissionLib if (isset($this->acl[$sourceName])) { // Checks permission - $isEntitled = $this->_isBerechtigt($this->acl[$sourceName], $permissionType); + $isEntitled = $this->isBerechtigt($this->acl[$sourceName], $permissionType); } } else @@ -104,7 +104,7 @@ class PermissionLib /** * Checks user's (API caller) rights */ - private function _isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null) + public function isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null) { $isBerechtigt = false; diff --git a/application/libraries/PersonLogLib.php b/application/libraries/PersonLogLib.php new file mode 100644 index 000000000..34bde6145 --- /dev/null +++ b/application/libraries/PersonLogLib.php @@ -0,0 +1,63 @@ +ci =& get_instance(); + $this->ci->load->model('system/PersonLog_model', 'PersonLogModel'); + } + + /** + * Writes a Log for a Person + * @param int $person_id ID of the Person. + * @param string $logtype_kurzbz Type of Log. + * @param array $logdata Array of the JSON Data to save. + * @param string $app Application that log belongs to. + * @param string $oe_kurzbz Organisation Unit the Log belongs to. + * @param string $user User who created the log. + * @return boolean true if success + */ + public function log($person_id, $logtype_kurzbz, $logdata, $app = 'core', $oe_kurzbz = null, $user = null) + { + $data = array( + 'person_id' => $person_id, + 'zeitpunkt' => date('Y-m-d H:i:s'), + 'app' => $app, + 'oe_kurzbz' => $oe_kurzbz, + 'logtype_kurzbz' => $logtype_kurzbz, + 'logdata' => json_encode($logdata), + 'insertvon' => $user + ); + + $result = $this->ci->PersonLogModel->insert($data); + if (isSuccess($result)) + return true; + else + show_error($result->retval); + } + + /** + * Gets Logs for a Person, filtered by Parameters + * @param int $person_id ID of the Person. + * @param string $app Name of the App. + * @param string $oe_kurzbz Organisations Unit. + * @return object $result + */ + public function getLogs($person_id, $app = null, $oe_kurzbz = null) + { + $result = $this->ci->PersonLogModel->filterLog($person_id, $app, $oe_kurzbz); + if (isSuccess($result)) + return $result->retval; + else + show_error($result->retval); + } +} diff --git a/application/libraries/UDFLib.php b/application/libraries/UDFLib.php index 1e16c11ac..2d453f068 100644 --- a/application/libraries/UDFLib.php +++ b/application/libraries/UDFLib.php @@ -625,7 +625,7 @@ class UDFLib elseif (isset($jsonSchema->{UDFLib::LIST_VALUES}->sql)) { // UDFModel is loaded in method _loadUDF that is called before the current method - $queryResult = $this->_ci->UDFModel->execQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql); + $queryResult = $this->_ci->UDFModel->execReadOnlyQuery($jsonSchema->{UDFLib::LIST_VALUES}->sql); if (hasData($queryResult)) { $parameters = $queryResult->retval; diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index fc41c9e40..37581def1 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -94,5 +94,42 @@ class Notiz_model extends DB_Model return $result; } + + /** + * Add a Notiz for a given person + */ + public function addNotizForPerson($person_id, $titel, $text, $erledigt, $verfasser_uid) + { + // Loads model Notizzuordnung_model + $this->load->model('person/Notizzuordnung_model', 'NotizzuordnungModel'); + + // Start DB transaction + $this->db->trans_start(false); + + $result = $this->insert(array('titel' => $titel, 'text' => $text, 'erledigt' => $erledigt, 'verfasser_uid' => $verfasser_uid, + "insertvon" => $verfasser_uid)); + $notiz_id = $result->retval; + if (isSuccess($result)) + { + $result = $this->NotizzuordnungModel->insert(array('notiz_id' => $notiz_id, 'person_id' => $person_id)); + } + + // Transaction complete! + $this->db->trans_complete(); + + // Check if everything went ok during the transaction + if ($this->db->trans_status() === false || isError($result)) + { + $this->db->trans_rollback(); + $result = error($result->msg, EXIT_ERROR); + } + else + { + $this->db->trans_commit(); + $result = success($notiz_id); + } + + return $result; + } // ------------------------------------------------------------------------------------------------------ } \ No newline at end of file diff --git a/application/models/system/Filters_model.php b/application/models/system/Filters_model.php new file mode 100644 index 000000000..546e2a5fd --- /dev/null +++ b/application/models/system/Filters_model.php @@ -0,0 +1,14 @@ +dbTable = 'system.tbl_filters'; + $this->pk = 'filter_id'; + } +} diff --git a/application/models/system/PersonLog_model.php b/application/models/system/PersonLog_model.php new file mode 100644 index 000000000..4725815f3 --- /dev/null +++ b/application/models/system/PersonLog_model.php @@ -0,0 +1,87 @@ +load->database(); + + $this->dbTable = 'system.tbl_log'; + } + + /** + * Inserts a Log for a Person + * @param array $data Data of Log Entry to save. + * @return success object if true + */ + public function insert($data) + { + $result = $this->db->insert($this->dbTable, $data); + if ($result) + return success($this->db->insert_id()); + else + return error(); + } + + /** + * Loads the last Log Entry of a Person + * @param int $person_id ID of the Person. + * @param string $app Name of the App. + * @param string $oe_kurzbz Organisations Unit. + * @return object $result + */ + public function getLastLog($person_id, $app = null, $oe_kurzbz = null) + { + // Check Permissions + $this->load->library('PermissionLib'); + if(!$this->permissionlib->isEntitled('system.tbl_log',PermissionLib::SELECT_RIGHT)) + show_error('Permission denied - You need Access to system.tbl_log'); + + $this->db->order_by('zeitpunkt', 'DESC'); + $this->db->order_by('log_id', 'DESC'); + $this->db->limit(1); + if (!is_null($app)) + $this->db->where('app='.$this->db->escape($app)); + if (!is_null($oe_kurzbz)) + $this->db->where('oe_kurzbz='.$this->db->escape($oe_kurzbz)); + + $result = $this->db->get_where($this->dbTable, "person_id=".$this->db->escape($person_id)); + + return success($result->result()); + } + + /** + * Load logs for a person, filtered by parameters + * @param int $person_id ID of the Person. + * @param string $app Name of the App. + * @param string $oe_kurzbz Organisations Unit. + * @return object $result + */ + public function filterLog($person_id, $app = null, $oe_kurzbz = null) + { + // Check Permissions + $this->load->library('PermissionLib'); + if(!$this->permissionlib->isEntitled('system.tbl_log',PermissionLib::SELECT_RIGHT)) + show_error('Permission denied - You need Access to system.tbl_log'); + + $this->db->order_by('zeitpunkt', 'DESC'); + $this->db->order_by('log_id', 'DESC'); + if (!is_null($app)) + $this->db->where('app='.$this->db->escape($app)); + if (!is_null($oe_kurzbz)) + $this->db->where('oe_kurzbz='.$this->db->escape($oe_kurzbz)); + + $result = $this->db->get_where($this->dbTable, "person_id=".$this->db->escape($person_id)); + + return success($result->result()); + } +} diff --git a/application/models/system/UDF_model.php b/application/models/system/UDF_model.php index e9bef54f6..ae9a91a69 100644 --- a/application/models/system/UDF_model.php +++ b/application/models/system/UDF_model.php @@ -6,10 +6,10 @@ class UDF_model extends DB_Model const STRING_NULL = 'null'; const STRING_TRUE = 'true'; const STRING_FALSE = 'false'; - + const UDF_DROPDOWN_TYPE = 'dropdown'; const UDF_MULTIPLEDROPDOWN_TYPE = 'multipledropdown'; - + /** * Constructor */ @@ -20,41 +20,14 @@ class UDF_model extends DB_Model $this->pk = array('schema', 'table'); $this->hasSequence = false; } - - /** - * Override DB_Model method execQuery to allow only to perform queries to read data - */ - public function execQuery($query, $parametersArray = null) - { - // - if ( - ( - substr($query, 0, 6) == 'SELECT' - || substr($query, 0, 4) == 'WITH' - ) - && - ( - !stripos($query, 'INSERT') - && !stripos($query, 'UPDATE') - && !stripos($query, 'DELETE') - ) - ) - { - return parent::execQuery($query, $parametersArray); - } - else - { - return error('You are allowed to run only query for reading data'); - } - } - + /** * Returns all the UDF for this table */ public function getUDFsDefinitions($schemaAndTable) { $st = $this->getSchemaAndTable($schemaAndTable); - + $this->addSelect(UDFLib::COLUMN_JSON_DESCRIPTION); $udfResults = $this->loadWhere( array( @@ -62,13 +35,13 @@ class UDF_model extends DB_Model 'table' => $st->table ) ); - + return $udfResults; } // ------------------------------------------------------------------------------------ // These methods work only with the this version of FAS, not with the future versions - + /** * Methods to save data from FAS */ @@ -77,53 +50,53 @@ class UDF_model extends DB_Model $result = error('No way man!'); $resultPerson = success('person'); $resultPrestudent = success('prestudent'); - + $person_id = $udfs['person_id']; unset($udfs['person_id']); - + $prestudent_id = $udfs['prestudent_id']; unset($udfs['prestudent_id']); - + $jsons = array(); - - // + + // if (isset($person_id)) { // Load model Person_model $this->load->model('person/Person_model', 'PersonModel'); - + $result = $this->load(array('public', 'tbl_person')); if (isSuccess($result) && count($result->retval) == 1) { $jsons = json_decode($result->retval[0]->jsons); } - + $udfs = $this->_fillMissingTextUDF($udfs, $jsons); $udfs = $this->_fillMissingChkboxUDF($udfs, $jsons); $udfs = $this->_fillMissingDropdownUDF($udfs, $jsons); - + $resultPerson = $this->PersonModel->update($person_id, $udfs); } - - // + + // if (isset($prestudent_id)) { // Load model Prestudent_model $this->load->model('crm/Prestudent_model', 'PrestudentModel'); - + $result = $this->load(array('public', 'tbl_prestudent')); if (isSuccess($result) && count($result->retval) == 1) { $jsons = json_decode($result->retval[0]->jsons); } - + $udfs = $this->_fillMissingTextUDF($udfs, $jsons); $udfs = $this->_fillMissingChkboxUDF($udfs, $jsons); $udfs = $this->_fillMissingDropdownUDF($udfs, $jsons); - + $resultPrestudent = $this->PrestudentModel->update($prestudent_id, $udfs); } - + if (isSuccess($resultPerson) && isSuccess($resultPrestudent)) { $result = success(array($resultPerson->retval, $resultPrestudent->retval)); @@ -136,17 +109,17 @@ class UDF_model extends DB_Model { $result = $resultPrestudent; } - + return $result; } - + /** - * + * */ private function _fillMissingChkboxUDF($udfs, $jsons) { $_fillMissingChkboxUDF = $udfs; - + foreach($jsons as $udfDescription) { if ($udfDescription->{UDFLib::TYPE} == UDFLib::CHKBOX_TYPE) @@ -168,17 +141,17 @@ class UDF_model extends DB_Model } } } - + return $_fillMissingChkboxUDF; } - + /** - * + * */ private function _fillMissingDropdownUDF($udfs, $jsons) { $_fillMissingDropdownUDF = $udfs; - + foreach($jsons as $udfDescription) { if ($udfDescription->{UDFLib::TYPE} == UDF_model::UDF_DROPDOWN_TYPE @@ -194,17 +167,17 @@ class UDF_model extends DB_Model } } } - + return $_fillMissingDropdownUDF; } - + /** - * + * */ private function _fillMissingTextUDF($udfs, $jsons) { $_fillMissingTextUDF = $udfs; - + foreach($jsons as $udfDescription) { if ($udfDescription->{UDFLib::TYPE} == 'textarea' @@ -220,7 +193,7 @@ class UDF_model extends DB_Model } } } - + return $_fillMissingTextUDF; } -} \ No newline at end of file +} diff --git a/application/views/system/infocenter/infocenter.php b/application/views/system/infocenter/infocenter.php new file mode 100644 index 000000000..f5969b7dd --- /dev/null +++ b/application/views/system/infocenter/infocenter.php @@ -0,0 +1,27 @@ +load->view('templates/FHC-Header', array('title' => 'Info Center', 'jquery3' => true, 'tablesorter' => true)); +?> + + + + + load->view( + 'system/infocenter/infocenterFilters.php', + array( + 'listFiltersSent' => $listFiltersSent, + 'listFiltersNotSent' => $listFiltersNotSent + ) + ); + ?> + + + + load->view('system/infocenter/infocenterData.php'); + ?> + + + + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php new file mode 100644 index 000000000..0c7b6bdba --- /dev/null +++ b/application/views/system/infocenter/infocenterData.php @@ -0,0 +1,50 @@ + ' + SELECT p.person_id AS "PersonId", + p.nachname AS "Nachname", + p.vorname AS "Vorname", + k.kontakt AS "Email", + p.aktiv AS "Aktiv", + k.updateamum AS "UpdateDate" + FROM public.tbl_person p INNER JOIN public.tbl_kontakt k USING(person_id) + WHERE p.aktiv = TRUE + AND p.person_id = k.person_id + AND k.kontakttyp = \'email\' + AND p.person_id < 1000 + ', + 'hideHeader' => true, + 'hideSave' => true, + 'additionalColumns' => array('Details'), + 'formatRaw' => function($fieldName, $fieldValue, $datasetRaw) { + + $link = 'Details'; + + if ($fieldName == 'Details') + { + $datasetRaw->{$fieldName} = sprintf( + $link, + base_url('index.ci.php/system/infocenter/infocenterDetails/showDetails/'), + $datasetRaw->PersonId + ); + } + + return $datasetRaw; + } + ); + + $filterId = isset($_GET['filterId']) ? $_GET['filterId'] : null; + + if (isset($filterId) && is_numeric($filterId)) + { + $filterWidgetArray['filterId'] = $filterId; + } + else + { + $filterWidgetArray['app'] = 'core'; + $filterWidgetArray['datasetName'] = 'kontakts'; + $filterWidgetArray['filterKurzbz'] = 'This filter filters'; + } + + echo $this->widgetlib->widget('FilterWidget', $filterWidgetArray); +?> diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php new file mode 100644 index 000000000..b663094c7 --- /dev/null +++ b/application/views/system/infocenter/infocenterDetails.php @@ -0,0 +1,269 @@ +load->view('templates/header', array('title' => 'InfocenterDetails', 'datepicker' => true, 'datepickerclass' => 'dateinput'/*, 'tablesort' => true, 'tableid' => 't1'*/)); +?> + +

Infocenter - Person Details

+ +
+ Stammdaten + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Vorname: vorname ?>
Nachname: nachname ?>
Geburtsdatum: gebdatum), 'd.m.Y') ?>
Sozialversicherungsnr: svnr ?>
Staatsbürgerschaft: kurztext ?>
Geschlecht: geschlecht ?>
Geburtsnation: kurztext ?>
Geburtsort: gebort ?>
Kontaktdaten
kontakttyp).': '; + if ($kontakt->kontakttyp == 'email'): + ?> + + kontakt; + if ($kontakt->kontakttyp == 'email'): + ?> + + +
+ Adresse: strasse.", ".$adresse->plz." ".$adresse->ort : "" ?> +
+
+
+ Dokumentenprüfung + + + + + + + + + formal_geprueft_amum)) ? "checked" : ""; + ?> + + + + + + + + +
NameTypUploaddatumformal geprüft
titel ?> + dokument_kurzbz ?>erstelltam), 'd.m.Y') ?> + + onclick="onFormalGeprueftChange(this.checked, akte_id ?>, person_id ?>)"/> + formal_geprueft_amum; + ?> +
+
+ +
+
+ ZGV Prüfung - Studiengang studiengang ?> + + + + + + + + + + + + + + studiengangtyp === 'm') :?> + + + + + + + + + + + + + + + + +
+ + prestudentstatus->status_kurzbz?> + + + prestudentstatus->bestaetigtam) ? "ja" : "nein" ?> + + + widgetlib->widget( + 'Studiensemester_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->prestudentstatus->studiensemester_kurzbz), + array('name' => 'studiensemester', 'id' => 'studiensemester') + ); ?> + + + prestudentstatus->ausbildungssemester ?> +
+ + widgetlib->widget( + 'Zgv_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgv_code), + array('name' => 'zgv', 'id' => 'zgv') + ); ?> + + + + + + zgvdatum), 'd.m.Y') ?>" + name="zgvdatum"> + + + widgetlib->widget( + 'Nation_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvnation_code), + array('name' => 'zgvnation', 'id' => 'zgvnation') + ); ?> +
+ + widgetlib->widget( + 'Zgvmaster_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvmas_code), + array('name' => 'zgvmas', 'id' => 'zgvmas') + ); ?> + + + + + + zgvmadatum), 'd.m.Y') ?>" + name="zgvmadatum"> + + + widgetlib->widget( + 'Nation_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvmanation_code), + array('name' => 'zgvmanation', 'id' => 'zgvmanation') + ); ?> +
+ +
+
+
+ + widgetlib->widget( + 'Statusgrund_widget', + array(), + array('name' => 'absage', 'id' => 'absage') + ); */ + //Prestudenten cannot be abgewiesen or freigegeben if already done + if(!isset($zgvpruefung->prestudentstatus->bestaetigtam) && $zgvpruefung->prestudentstatus->status_kurzbz != 'Abgewiesener') : + ?> +
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
DatumAktivitätUser
zeitpunkt), 'd.m.Y H:i:s') ?>logdata->name ?>insertvon ?>
+ + + + + + + + + + + + + + + + + +
DatumNotizUser
insertamum), 'd.m.Y H:i:s') ?>titel ?>verfasser_uid ?>
+
+ +
+ Titel: +
+ Text: + +
+ + + diff --git a/application/views/system/infocenter/infocenterFilters.php b/application/views/system/infocenter/infocenterFilters.php new file mode 100644 index 000000000..f15b24fbb --- /dev/null +++ b/application/views/system/infocenter/infocenterFilters.php @@ -0,0 +1,30 @@ + $filterId) + { + $toPrint = ''; + + echo sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filterId'), $filterId, $name).PHP_EOL; + } + } + +// HTML + // body + // span +?> +
+ +
+ Abgeschickt: +
+ + + +
+ Nicht abgeschickt: +
+ + + +
diff --git a/application/views/templates/FHC-Footer.php b/application/views/templates/FHC-Footer.php new file mode 100644 index 000000000..9be2faef3 --- /dev/null +++ b/application/views/templates/FHC-Footer.php @@ -0,0 +1,3 @@ + + + diff --git a/application/views/templates/FHC-Header.php b/application/views/templates/FHC-Header.php new file mode 100644 index 000000000..4b4dcc511 --- /dev/null +++ b/application/views/templates/FHC-Header.php @@ -0,0 +1,109 @@ +'; + + if (isset($CSSs)) + { + $tmpCSSs = is_array($CSSs) ? $CSSs : array($CSSs); + + for ($tmpCSSsCounter = 0; $tmpCSSsCounter < count($tmpCSSs); $tmpCSSsCounter++) + { + $toPrint = sprintf($cssLink, base_url($tmpCSSs[$tmpCSSsCounter])).PHP_EOL; + + if ($tmpCSSsCounter > 0) $toPrint = "\t\t".$toPrint; + + echo $toPrint; + } + } +} + +/** + * Generates tags for the javascripts you want to include, the parameter could by a string or an array of strings + */ +function _generateJSsInclude($JSs) +{ + $jsInclude = ''; + + if (isset($JSs)) + { + $tmpJSs = is_array($JSs) ? $JSs : array($JSs); + + for ($tmpJSsCounter = 0; $tmpJSsCounter < count($tmpJSs); $tmpJSsCounter++) + { + $toPrint = sprintf($jsInclude, base_url($tmpJSs[$tmpJSsCounter])).PHP_EOL; + + if ($tmpJSsCounter > 0) $toPrint = "\t\t".$toPrint; + + echo $toPrint; + } + } +} + +?> + + + + + <?php _printTitle($title); ?> + + + + + + + + + + diff --git a/application/views/templates/header.php b/application/views/templates/header.php index e995fb7f3..883e7cc32 100644 --- a/application/views/templates/header.php +++ b/application/views/templates/header.php @@ -69,12 +69,17 @@ if($jqueryV1 && $jqueryCurrent) @@ -108,4 +113,5 @@ if($jqueryV1 && $jqueryCurrent) + diff --git a/application/views/widgets/filter/filter.php b/application/views/widgets/filter/filter.php new file mode 100644 index 000000000..a5723f4aa --- /dev/null +++ b/application/views/widgets/filter/filter.php @@ -0,0 +1,78 @@ + +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
diff --git a/application/views/widgets/filter/saveFilter.php b/application/views/widgets/filter/saveFilter.php new file mode 100644 index 000000000..e9e0217e6 --- /dev/null +++ b/application/views/widgets/filter/saveFilter.php @@ -0,0 +1,7 @@ +
+ Filter short description: +
+
+ + +
diff --git a/application/views/widgets/filter/selectFields.php b/application/views/widgets/filter/selectFields.php new file mode 100644 index 000000000..8bc988125 --- /dev/null +++ b/application/views/widgets/filter/selectFields.php @@ -0,0 +1,33 @@ +
+ + + + +
+
+ + Add field: + + + + +
diff --git a/application/views/widgets/filter/selectFilters.php b/application/views/widgets/filter/selectFilters.php new file mode 100644 index 000000000..9a4aa0ffd --- /dev/null +++ b/application/views/widgets/filter/selectFilters.php @@ -0,0 +1,47 @@ +
+ +
+ + + name; ?> + + + + + + + + +
+ + +
+
+ + Add filter: + + + + +
diff --git a/application/views/widgets/filter/tableDataset.php b/application/views/widgets/filter/tableDataset.php new file mode 100644 index 000000000..160345692 --- /dev/null +++ b/application/views/widgets/filter/tableDataset.php @@ -0,0 +1,92 @@ +retval; + + $selectedFields = FilterWidget::getSelectedFields(); + $additionalColumns = FilterWidget::getAdditionalColumns(); + $checkboxes = FilterWidget::getCheckboxes(); +?> + +
+ + + + + + + + + + + + + + + + + + + {$selectedField}, $result); + ?> + + + + + + + +
Select
+ + + {$selectedField}; + ?> + + {$additionalColumn}; + ?> +
+
diff --git a/application/widgets/FilterWidget.php b/application/widgets/FilterWidget.php new file mode 100644 index 000000000..988032c0a --- /dev/null +++ b/application/widgets/FilterWidget.php @@ -0,0 +1,1084 @@ +_initFilterWidget($args); // + + $this->_initSession(); // + + // + $this->load->model('system/Filters_model', 'FiltersModel'); + $this->load->model('person/Benutzer_model', 'BenutzerModel'); + + self::$FilterWidgetInstance = $this; + } + + /** + * + */ + public function display($widgetData) + { + // + $this->_loadFilter(); + + // + $this->_setSessionFilterData(); + + // + $this->_saveFilter(); + + // + $this->FiltersModel->resetQuery(); + + // + $this->dataset = @$this->FiltersModel->execReadOnlyQuery($this->_generateQuery()); + + // + $this->listFields = $this->FiltersModel->getExecutedQueryListFields(); + + $filterSessionArray = $this->session->userdata(self::SESSION_NAME); + if (isset($filterSessionArray[self::SELECTED_FIELDS])) + { + $selectedFields = $filterSessionArray[self::SELECTED_FIELDS]; + } + + if (count($selectedFields) == 0) + { + $filterSessionArray[self::SELECTED_FIELDS] = $this->listFields; + $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); + } + + // + $this->metaData = $this->FiltersModel->getExecutedQueryMetaData(); + + // + $this->loadViewFilters(); + } + + /** + * + */ + public static function getSelectedFields() + { + return self::_getFromSession(self::SELECTED_FIELDS); + } + + /** + * + */ + public static function getSelectedFilters() + { + return self::_getFromSession(self::SELECTED_FILTERS); + } + + /** + * + */ + public static function getAdditionalColumns() + { + return self::_getFromSession(self::ADDITIONAL_COLUMNS); + } + + /** + * + */ + public static function loadViewSelectFields() + { + if (self::$FilterWidgetInstance->hideHeader != true) + { + self::_loadView(self::WIDGET_URL_SELECT_FIELDS, array(self::LIST_FIELDS_PARAMETER => self::$FilterWidgetInstance->listFields)); + } + } + + /** + * + */ + public static function loadViewSelectFilters() + { + if (self::$FilterWidgetInstance->hideHeader != true) + { + self::_loadView(self::WIDGET_URL_SELECT_FILTERS, array(self::METADATA_PARAMETER => self::$FilterWidgetInstance->metaData)); + } + } + + /** + * + */ + public static function loadViewSaveFilter() + { + if (self::$FilterWidgetInstance->hideSave != true) + { + self::_loadView(self::WIDGET_URL_SAVE_FILTER); + } + } + + /** + * + */ + public static function loadViewTableDataset() + { + self::_loadView(self::WIDGET_URL_TABLE_DATASET, array(self::DATASET_PARAMETER => self::$FilterWidgetInstance->dataset)); + } + + /** + * + */ + public static function getFilterMetaData($filter, $metaData) + { + $md = null; + + for ($metaDataCounter = 0; $metaDataCounter < count($metaData); $metaDataCounter++) + { + if ($metaData[$metaDataCounter]->name == $filter) + { + $md = $metaData[$metaDataCounter]; + break; + } + } + + return $md; + } + + /** + * + */ + public static function renderFilterType($filterMetaData) + { + $html = ''; + $activeFilterValue = self::_getActiveFilterValue($filterMetaData->name); + $activeFilterOperationValue = self::_getActiveFilterOperationValue($filterMetaData->name); + $activeFilterOptionValue = self::_getActiveFilterOptionValue($filterMetaData->name); + + if ($filterMetaData->type == 'int4') + { + $html = ' + + + + + + + '; + } + elseif ($filterMetaData->type == 'varchar') + { + $html = ' + + + + + + + '; + } + elseif ($filterMetaData->type == 'bool') + { + $html = ' + + + + + + + '; + } + elseif ($filterMetaData->type == 'timestamp') + { + $html = ' + + + + + + + + '; + } + + return sprintf($html, $filterMetaData->name.'-operation', $filterMetaData->name, $activeFilterValue, $filterMetaData->name.'-option'); + } + + /** + * + */ + public static function formatRaw($fieldName, $fieldValue, $datasetRaw) + { + $tmpDatasetRaw = null; + + if (is_object($datasetRaw)) + { + $tmpDatasetRaw = clone $datasetRaw; + $tmpMetaData = self::getFilterMetaData($fieldName, self::$FilterWidgetInstance->metaData); + + if (is_bool($fieldValue)) + { + $tmpDatasetRaw->{$fieldName} = $fieldValue === true ? 'true' : 'false'; + } + elseif ($tmpMetaData != null && $tmpMetaData->type == 'timestamp') + { + $tmpDatasetRaw->{$fieldName} = date(self::DEFAULT_DATE_FORMAT, strtotime($fieldValue)); + } + + $formatRaw = self::$FilterWidgetInstance->getFormatRaw(); + + if ($formatRaw != null) + { + $tmpDatasetRaw = $formatRaw($fieldName, $fieldValue, $tmpDatasetRaw); + } + } + + return $tmpDatasetRaw; + } + + /** + * + */ + public static function getCheckboxes() + { + return self::$FilterWidgetInstance->_getCheckboxes(); + } + + //------------------------------------------------------------------------------------------------------------------ + // Protected + + /** + * + */ + protected function loadViewFilters() + { + // Loads views + $this->view(self::WIDGET_URL_FILTER, + array( + self::DATASET_PARAMETER => $this->dataset, + self::METADATA_PARAMETER => $this->metaData, + self::LIST_FIELDS_PARAMETER => $this->listFields + ) + ); + } + + /** + * + */ + protected function getFormatRaw() + { + return $this->formatRaw; + } + + /** + * + */ + protected function _getCheckboxes() + { + return $this->checkboxes; + } + + //------------------------------------------------------------------------------------------------------------------ + // Private + + /** + * + */ + private static function _getFromSession($key) + { + $_getFromSession = null; + $ci =& get_instance(); + $filterSessionArray = $ci->session->userdata(self::SESSION_NAME); + + if (isset($filterSessionArray[$key])) + { + $_getFromSession = $filterSessionArray[$key]; + } + + return $_getFromSession; + } + + /** + * + */ + private static function _getActiveFilterValue($filterName) + { + $getActiveFilterValue = ''; + + $activeFields = self::_getFromSession(self::ACTIVE_FILTERS); + + if (isset($activeFields[$filterName])) + { + $getActiveFilterValue = $activeFields[$filterName]; + } + + return $getActiveFilterValue; + } + + /** + * + */ + private static function _getActiveFilterOperationValue($filterName) + { + $getActiveFilterOperationValue = ''; + + $activeFieldsOperation = self::_getFromSession(self::ACTIVE_FILTERS_OPERATION); + + if (isset($activeFieldsOperation[$filterName])) + { + $getActiveFilterOperationValue = $activeFieldsOperation[$filterName]; + } + + return $getActiveFilterOperationValue; + } + + /** + * + */ + private static function _getActiveFilterOptionValue($filterName) + { + $getActiveFilterOptionValue = ''; + + $activeFieldsOption = self::_getFromSession(self::ACTIVE_FILTERS_OPTION); + + if (isset($activeFieldsOption[$filterName])) + { + $getActiveFilterOptionValue = $activeFieldsOption[$filterName]; + } + + return $getActiveFilterOptionValue; + } + + /** + * + */ + private static function _loadView($viewName, $parameters = null) + { + $ci =& get_instance(); + $ci->load->view($viewName, $parameters); + } + + /** + * + */ + private function _initSession() + { + $filterSessionArray = array(); + + if (isset($_SESSION[self::SESSION_NAME])) + { + $filterSessionArray = $_SESSION[self::SESSION_NAME]; + } + + if (!isset($filterSessionArray[self::SELECTED_FIELDS])) + { + $filterSessionArray[self::SELECTED_FIELDS] = array(); + } + + if (!isset($filterSessionArray[self::SELECTED_FILTERS])) + { + $filterSessionArray[self::SELECTED_FILTERS] = array(); + } + + if (!isset($filterSessionArray[self::ACTIVE_FILTERS])) + { + $filterSessionArray[self::ACTIVE_FILTERS] = array(); + } + + if (!isset($filterSessionArray[self::ACTIVE_FILTERS_OPERATION])) + { + $filterSessionArray[self::ACTIVE_FILTERS_OPERATION] = array(); + } + + if (!isset($filterSessionArray[self::ACTIVE_FILTERS_OPTION])) + { + $filterSessionArray[self::ACTIVE_FILTERS_OPTION] = array(); + } + + if (!isset($filterSessionArray[self::ADDITIONAL_COLUMNS])) + { + $filterSessionArray[self::ADDITIONAL_COLUMNS] = array(); + } + + $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); + } + + /** + * + */ + private function _initFilterWidget($args) + { + $this->app = null; + $this->query = null; + $this->datasetName = null; + $this->filterKurzbz = null; + $this->filterId = null; + $this->additionalColumns = null; + $this->formatRaw = null; + $this->checkboxes = null; + $this->hideHeader = false; + $this->hideSave = false; + + if (!is_array($args) || (is_array($args) && count($args) == 0)) + { + show_error('Second parameter must be a not empty associative array'); + } + else + { + if (( + !isset($args[self::APP_PARAMETER]) + && !isset($args[self::DATASET_NAME_PARAMETER]) + && !isset($args[self::FILTER_KURZBZ]) + ) + && !isset($args[self::FILTER_ID])) + { + show_error('At least one parameters must be specified 1'); + } + else + { + if (!isset($args[self::QUERY_PARAMETER]) && !isset($args[self::DB_RESULT])) + { + show_error('At least one parameters must be specified 2'); + } + else + { + if (isset($args[self::APP_PARAMETER]) + && isset($args[self::DATASET_NAME_PARAMETER]) + && isset($args[self::FILTER_KURZBZ])) + { + $this->app = $args[self::APP_PARAMETER]; + $this->datasetName = $args[self::DATASET_NAME_PARAMETER]; + $this->filterKurzbz = $args[self::FILTER_KURZBZ]; + } + else + { + $this->filterId = $args[self::FILTER_ID]; + } + + if (isset($args[self::QUERY_PARAMETER])) + { + $this->query = $args[self::QUERY_PARAMETER]; + } + elseif (isset($args[self::DB_RESULT])) + { + $this->query = $args[self::DB_RESULT]; + } + } + } + + if (isset($args[self::ADDITIONAL_COLUMNS]) + && is_array($args[self::ADDITIONAL_COLUMNS]) + && count($args[self::ADDITIONAL_COLUMNS]) > 0) + { + $this->additionalColumns = $args[self::ADDITIONAL_COLUMNS]; + } + + if (isset($args[self::FORMAT_RAW]) && is_callable($args[self::FORMAT_RAW])) + { + $this->formatRaw = $args[self::FORMAT_RAW]; + } + + if (isset($args[self::CHECKBOXES]) + && is_array($args[self::CHECKBOXES]) + && count($args[self::CHECKBOXES]) > 0) + { + $this->checkboxes = $args[self::CHECKBOXES]; + } + + if (isset($args[self::HIDE_HEADER]) && is_bool($args[self::HIDE_HEADER])) + { + $this->hideHeader = $args[self::HIDE_HEADER]; + } + + if (isset($args[self::HIDE_SAVE]) && is_bool($args[self::HIDE_SAVE])) + { + $this->hideSave = $args[self::HIDE_SAVE]; + } + } + } + + /** + * + */ + private function _loadFilter() + { + // + $this->FiltersModel->resetQuery(); + + // + $this->FiltersModel->addJoin('public.tbl_benutzer', 'person_id', 'LEFT'); + + // + $this->FiltersModel->addSelect('system.tbl_filters.*'); + + // + $this->FiltersModel->addOrder('sort', 'ASC'); + + // + $this->FiltersModel->addLimit(1); + + $whereParameters = null; + + if ($this->filterId == null) + { + $whereParameters = array( + 'app' => $this->app, + 'dataset_name' => $this->datasetName, + 'filter_kurzbz' => $this->filterKurzbz, + 'uid' => getAuthUID(), + 'default_filter' => true + ); + } + else + { + $whereParameters = array( + 'filter_id' => $this->filterId + ); + } + + // + $filter = $this->FiltersModel->loadWhere($whereParameters); + + $jsonEncodedFilter = null; + + if (hasData($filter)) + { + if (isset($filter->retval[0]->filter) && trim($filter->retval[0]->filter) != '') + { + $jsonEncodedFilter = json_decode($filter->retval[0]->filter); + } + } + + if ($jsonEncodedFilter != null) + { + $selectedFields = array(); + $selectedFilters = array(); + $activeFilters = array(); + $activeFiltersOperation = array(); + $activeFiltersOption = array(); + + if (isset($jsonEncodedFilter->columns)) + { + $columns = $jsonEncodedFilter->columns; + + for($columnsCounter = 0; $columnsCounter < count($columns); $columnsCounter++) + { + if (isset($columns[$columnsCounter]->name)) + { + $selectedFields[] = $columns[$columnsCounter]->name; + } + } + } + + if (isset($jsonEncodedFilter->filters)) + { + $filters = $jsonEncodedFilter->filters; + + for($filtersCounter = 0; $filtersCounter < count($filters); $filtersCounter++) + { + if (isset($filters[$filtersCounter]->name)) + { + $selectedFilters[] = $filters[$filtersCounter]->name; + $activeFilters[$filters[$filtersCounter]->name] = $filters[$filtersCounter]->condition; + $activeFiltersOperation[$filters[$filtersCounter]->name] = $filters[$filtersCounter]->operation; + if (isset($filters[$filtersCounter]->option)) + { + $activeFiltersOption[$filters[$filtersCounter]->name] = $filters[$filtersCounter]->option; + } + } + } + } + + $filterSessionArray = array( + self::SELECTED_FIELDS => $selectedFields, + self::SELECTED_FILTERS => $selectedFilters, + self::ACTIVE_FILTERS => $activeFilters, + self::ACTIVE_FILTERS_OPERATION => $activeFiltersOperation, + self::ACTIVE_FILTERS_OPTION => $activeFiltersOption + ); + + $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); + } + else + { + $filterSessionArray = array( + self::SELECTED_FIELDS => array(), + self::SELECTED_FILTERS => array(), + self::ACTIVE_FILTERS => array(), + self::ACTIVE_FILTERS_OPERATION => array(), + self::ACTIVE_FILTERS_OPTION => array() + ); + + $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); + } + } + + /** + * + */ + private function _saveFilter() + { + if (isset($_POST['saveCustomFilter']) && $_POST['saveCustomFilter'] == 'true') + { + $objToBeSaved = new stdClass(); + + $filterSessionArray = $this->session->userdata(self::SESSION_NAME); + + if (isset($filterSessionArray[self::SELECTED_FIELDS])) + { + $selectedFields = $filterSessionArray[self::SELECTED_FIELDS]; + $objToBeSaved->columns = array(); + + for ($selectedFieldsCounter = 0; $selectedFieldsCounter < count($selectedFields); $selectedFieldsCounter++) + { + $objToBeSaved->columns[$selectedFieldsCounter] = new stdClass(); + $objToBeSaved->columns[$selectedFieldsCounter]->name = $selectedFields[$selectedFieldsCounter]; + } + } + + if (isset($filterSessionArray[self::SELECTED_FILTERS])) + { + $selectedFilters = $filterSessionArray[self::SELECTED_FILTERS]; + $objToBeSaved->filters = array(); + + for ($selectedFiltersCounter = 0; $selectedFiltersCounter < count($selectedFilters); $selectedFiltersCounter++) + { + $objToBeSaved->filters[$selectedFiltersCounter] = new stdClass(); + $objToBeSaved->filters[$selectedFiltersCounter]->name = $selectedFilters[$selectedFiltersCounter]; + + if (isset($filterSessionArray[self::ACTIVE_FILTERS]) + && isset($filterSessionArray[self::ACTIVE_FILTERS][$selectedFilters[$selectedFiltersCounter]])) + { + $objToBeSaved->filters[$selectedFiltersCounter]->condition = $filterSessionArray[self::ACTIVE_FILTERS][$selectedFilters[$selectedFiltersCounter]]; + } + + if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPERATION]) + && isset($filterSessionArray[self::ACTIVE_FILTERS_OPERATION][$selectedFilters[$selectedFiltersCounter]])) + { + $objToBeSaved->filters[$selectedFiltersCounter]->operation = $filterSessionArray[self::ACTIVE_FILTERS_OPERATION][$selectedFilters[$selectedFiltersCounter]]; + } + + if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPTION]) + && isset($filterSessionArray[self::ACTIVE_FILTERS_OPTION][$selectedFilters[$selectedFiltersCounter]])) + { + $objToBeSaved->filters[$selectedFiltersCounter]->option = $filterSessionArray[self::ACTIVE_FILTERS_OPTION][$selectedFilters[$selectedFiltersCounter]]; + } + } + } + + $result = $this->FiltersModel->loadWhere(array( + 'app' => $this->app, + 'dataset_name' => $this->datasetName, + 'filter_kurzbz' => $_POST['customFilterKurzbz'] + )); + + if (hasData($result)) + { + $this->FiltersModel->update( + array( + 'app' => $this->app, + 'dataset_name' => $this->datasetName, + 'filter_kurzbz' => $_POST['customFilterKurzbz'] + ), + array( + 'description' => '{}', + 'sort' => null, + 'default_filter' => false, + 'filter' => json_encode($objToBeSaved), + 'oe_kurzbz' => null + ) + ); + } + else + { + $result = $this->BenutzerModel->load(getAuthUID()); + + if (hasData($result)) + { + $this->FiltersModel->insert(array( + 'app' => $this->app, + 'dataset_name' => $this->datasetName, + 'filter_kurzbz' => $_POST['customFilterKurzbz'], + 'person_id' => $result->retval[0]->person_id, + 'description' => '{}', + 'sort' => null, + 'default_filter' => false, + 'filter' => json_encode($objToBeSaved), + 'oe_kurzbz' => null + )); + } + } + } + } + + /** + * + */ + private function _getSelectedFieldsFromPost() + { + // Selected fields + $selectedFields = array(); + + $filterSessionArray = $this->session->userdata(self::SESSION_NAME); + if (isset($filterSessionArray[self::SELECTED_FIELDS])) + { + $selectedFields = $filterSessionArray[self::SELECTED_FIELDS]; + } + + if (is_array($_POST)) + { + if (array_key_exists(self::CMD_ADD_FIELD, $_POST) && trim($_POST[self::CMD_ADD_FIELD]) != '') + { + if (!in_array($_POST[self::CMD_ADD_FIELD], $selectedFields)) + { + $selectedFields[] = $_POST[self::CMD_ADD_FIELD]; + } + } + + if (array_key_exists(self::CMD_REMOVE_FIELD, $_POST) && trim($_POST[self::CMD_REMOVE_FIELD]) != '') + { + $selectedFields = $this->_removeElementFromArray($selectedFields, $_POST[self::CMD_REMOVE_FIELD]); + } + } + + return $selectedFields; + } + + /** + * + */ + private function _getSelectedFiltersFromPost() + { + // Selected filters + $selectedFilters = array(); + + $filterSessionArray = $this->session->userdata(self::SESSION_NAME); + if (isset($filterSessionArray[self::SELECTED_FILTERS])) + { + $selectedFilters = $filterSessionArray[self::SELECTED_FILTERS]; + } + + if (is_array($_POST)) + { + if (array_key_exists(self::CMD_ADD_FILTER, $_POST) && trim($_POST[self::CMD_ADD_FILTER]) != '') + { + if (!in_array($_POST[self::CMD_ADD_FILTER], $selectedFilters)) + { + $selectedFilters[] = $_POST[self::CMD_ADD_FILTER]; + } + } + + if (array_key_exists(self::CMD_REMOVE_FILTER, $_POST) && trim($_POST[self::CMD_REMOVE_FILTER]) != '') + { + $selectedFilters = $this->_removeElementFromArray($selectedFilters, $_POST[self::CMD_REMOVE_FILTER]); + } + } + + return $selectedFilters; + } + + /** + * + */ + private function _setActiveFiltersFromPost(&$activeFilters, &$activeFiltersOperation, &$activeFiltersOption) + { + $selectedFilters = array(); + $filterSessionArray = $this->session->userdata(self::SESSION_NAME); + + if (isset($filterSessionArray[self::ACTIVE_FILTERS])) + { + $activeFilters = $filterSessionArray[self::ACTIVE_FILTERS]; + } + + if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPERATION])) + { + $activeFiltersOperation = $filterSessionArray[self::ACTIVE_FILTERS_OPERATION]; + } + + if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPTION])) + { + $activeFiltersOption = $filterSessionArray[self::ACTIVE_FILTERS_OPTION]; + } + + if (isset($filterSessionArray[self::SELECTED_FILTERS])) + { + $selectedFilters = $filterSessionArray[self::SELECTED_FILTERS]; + } + + if (is_array($_POST)) + { + if (array_key_exists(self::CMD_REMOVE_FILTER, $_POST) && trim($_POST[self::CMD_REMOVE_FILTER]) != '') + { + if (isset($activeFilters[$_POST[self::CMD_REMOVE_FILTER]])) + { + unset($activeFilters[$_POST[self::CMD_REMOVE_FILTER]]); + } + + if (isset($activeFiltersOperation[$_POST[self::CMD_REMOVE_FILTER]])) + { + unset($activeFiltersOperation[$_POST[self::CMD_REMOVE_FILTER]]); + } + + if (isset($activeFiltersOption[$_POST[self::CMD_REMOVE_FILTER]])) + { + unset($activeFiltersOption[$_POST[self::CMD_REMOVE_FILTER]]); + } + } + else + { + for ($selectedFiltersCounter = 0; $selectedFiltersCounter < count($selectedFilters); $selectedFiltersCounter++) + { + $selectedFilter = $selectedFilters[$selectedFiltersCounter]; + + if (isset($_POST[$selectedFilter])) + { + $activeFilters[$selectedFilter] = $_POST[$selectedFilter]; + } + + if (isset($_POST[$selectedFilter.self::ACTIVE_FILTER_OPERATION_POSTFIX])) + { + $activeFiltersOperation[$selectedFilter] = $_POST[$selectedFilter.self::ACTIVE_FILTER_OPERATION_POSTFIX]; + } + + if (isset($_POST[$selectedFilter.self::ACTIVE_FILTER_OPTION_POSTFIX])) + { + $activeFiltersOption[$selectedFilter] = $_POST[$selectedFilter.self::ACTIVE_FILTER_OPTION_POSTFIX]; + } + } + } + } + } + + /** + * + */ + private function _setSessionFilterData() + { + $filterSessionArray = array( + self::SELECTED_FIELDS => $this->_getSelectedFieldsFromPost(), + self::SELECTED_FILTERS => $this->_getSelectedFiltersFromPost(), + self::ADDITIONAL_COLUMNS => $this->additionalColumns + ); + + $filterSessionArray[self::ACTIVE_FILTERS] = array(); + $filterSessionArray[self::ACTIVE_FILTERS_OPERATION] = array(); + $filterSessionArray[self::ACTIVE_FILTERS_OPTION] = array(); + + $this->_setActiveFiltersFromPost( + $filterSessionArray[self::ACTIVE_FILTERS], + $filterSessionArray[self::ACTIVE_FILTERS_OPERATION], + $filterSessionArray[self::ACTIVE_FILTERS_OPTION] + ); + + $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); + } + + /** + * + */ + private function _generateQuery() + { + $query = $this->query; + + $activeFilters = array(); + $activeFiltersOperation = array(); + $activeFiltersOption = array(); + + $filterSessionArray = $this->session->userdata(self::SESSION_NAME); + + if (isset($filterSessionArray[self::ACTIVE_FILTERS])) + { + $activeFilters = $filterSessionArray[self::ACTIVE_FILTERS]; + } + + if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPERATION])) + { + $activeFiltersOperation = $filterSessionArray[self::ACTIVE_FILTERS_OPERATION]; + } + + if (isset($filterSessionArray[self::ACTIVE_FILTERS_OPTION])) + { + $activeFiltersOption = $filterSessionArray[self::ACTIVE_FILTERS_OPTION]; + } + + // + if (count($activeFilters) > 0) + { + $where = ''; + $first = true; + + foreach ($activeFilters as $field => $activeFilterValue) + { + if (trim($activeFilterValue) != '') + { + if ($first) + { + $first = false; + } + else + { + $where .= ' AND '; + } + + if (isset($activeFiltersOperation[$field])) + { + $where .= '"'.$field.'"'; + $condition = ''; + + switch ($activeFiltersOperation[$field]) + { + case self::OP_EQUAL: + $condition = ' = '.$activeFilterValue; + break; + case self::OP_NOT_EQUAL: + $condition = ' != '.$activeFilterValue; + break; + case self::OP_GREATER_THAN: + $condition = ' > '.$activeFilterValue; + break; + case self::OP_LESS_THAN: + if (isset($activeFiltersOption[$field]) + && ($activeFiltersOption[$field] == self::OPT_DAYS + || $activeFiltersOption[$field] == self::OPT_MONTHS)) + { + $condition = ' < (NOW() - \''.$activeFilterValue.' '.$activeFiltersOption[$field].'\'::interval)'; + } + else + { + $condition = ' < '.$activeFilterValue; + } + break; + case self::OP_CONTAINS: + $condition = ' ILIKE \'%'.$activeFilterValue.'%\''; + break; + case self::OP_NOT_CONTAINS: + $condition = ' NOT ILIKE \'%'.$activeFilterValue.'%\''; + break; + case self::OP_IS_TRUE: + $condition = ' IS TRUE'; + break; + case self::OP_IS_FALSE: + $condition = ' IS FALSE'; + break; + } + + $where .= $condition; + } + } + } + + if ($where != '') + { + $query = 'SELECT * FROM ('.$this->query.') tableFilters WHERE '.$where; + } + } + + return $query; + } + + /** + * + */ + private function _removeElementFromArray($array, $element) + { + $_removeElementFromArray = array(); + + for ($arrayCounter = 0; $arrayCounter < count($array); $arrayCounter++) + { + $arrayElement = $array[$arrayCounter]; + if ($arrayElement != $element) + { + $_removeElementFromArray[] = $arrayElement; + } + } + + return $_removeElementFromArray; + } +} diff --git a/application/widgets/Nation_widget.php b/application/widgets/Nation_widget.php new file mode 100644 index 000000000..2c20b8691 --- /dev/null +++ b/application/widgets/Nation_widget.php @@ -0,0 +1,22 @@ +load->model('codex/nation_model', 'NationModel'); + $this->NationModel->addOrder('nation_code'); + + $this->addSelectToModel($this->NationModel, 'nation_code', 'kurztext'); + + $this->setElementsArray( + $this->NationModel->load(), + true, + 'Select a nation...', + 'No nation found' + ); + + $this->loadDropDownView($widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Statusgrund_widget.php b/application/widgets/Statusgrund_widget.php new file mode 100644 index 000000000..d0f9d2f58 --- /dev/null +++ b/application/widgets/Statusgrund_widget.php @@ -0,0 +1,22 @@ +load->model('crm/statusgrund_model', 'StatusgrundModel'); + $this->StatusgrundModel->addOrder('statusgrund_id'); + + $this->addSelectToModel($this->StatusgrundModel, 'statusgrund_id', 'bezeichnung_mehrsprachig[1]'); + + $this->setElementsArray( + $this->StatusgrundModel->load(), + true, + 'Select a Statusgrund...', + 'No Statusgrund found' + ); + + $this->loadDropDownView($widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Zgv_widget.php b/application/widgets/Zgv_widget.php new file mode 100644 index 000000000..8858d3206 --- /dev/null +++ b/application/widgets/Zgv_widget.php @@ -0,0 +1,22 @@ +load->model('codex/zgv_model', 'ZgvModel'); + $this->ZgvModel->addOrder('zgv_bez'); + + $this->addSelectToModel($this->ZgvModel, 'zgv_code', 'zgv_bez'); + + $this->setElementsArray( + $this->ZgvModel->load(), + true, + 'Select a zgv...', + 'No zgv found' + ); + + $this->loadDropDownView($widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Zgvmaster_widget.php b/application/widgets/Zgvmaster_widget.php new file mode 100644 index 000000000..8ac331109 --- /dev/null +++ b/application/widgets/Zgvmaster_widget.php @@ -0,0 +1,22 @@ +load->model('codex/zgvmaster_model', 'ZgvmasterModel'); + $this->ZgvmasterModel->addOrder('zgvmas_bez'); + + $this->addSelectToModel($this->ZgvmasterModel, 'zgvmas_code', 'zgvmas_bez'); + + $this->setElementsArray( + $this->ZgvmasterModel->load(), + true, + 'Select a zgv...', + 'No zgv found' + ); + + $this->loadDropDownView($widgetData); + } +} \ No newline at end of file diff --git a/ci_loader.php b/ci_loader.php new file mode 100644 index 000000000..7466739a9 --- /dev/null +++ b/ci_loader.php @@ -0,0 +1,11 @@ +load->library('xxx'); + */ +ob_start(); +require_once('index.ci.php'); +ob_get_clean(); +return $CI; diff --git a/cis/private/info/service_uebersicht.php b/cis/private/info/service_uebersicht.php old mode 100644 new mode 100755 index 5d5d5a01b..60a751927 --- a/cis/private/info/service_uebersicht.php +++ b/cis/private/info/service_uebersicht.php @@ -26,12 +26,12 @@ require_once('../../../include/phrasen.class.php'); require_once('../../../include/person.class.php'); $user = get_uid(); -$sprache = getSprache(); +$sprache = getSprache(); $p=new phrasen($sprache); //$rechte = new benutzerberechtigung(); //$rechte->getBerechtigungen($user); - + //if(!$rechte->isBerechtigt('basis/service')) // die('Sie haben keine Berechtigung fuer diese Seite'); @@ -42,7 +42,7 @@ echo ' '.$p->t("services/service").' - + @@ -50,20 +50,36 @@ echo ' - +'; + +// Load Addons to get Moodle_Path +$addon_obj = new addon(); +if ($addon_obj->loadAddons()) +{ + if (count($addon_obj->result) > 0) + { + foreach ($addon_obj->result as $row) + { + if (file_exists('../../../addons/'.$row->kurzbz.'/config.inc.php')) + include_once('../../../addons/'.$row->kurzbz.'/config.inc.php'); + } + } +} + +echo ' '; } } - + if ($work=='del') { if(!$veranstaltung=$Jahresplan->deleteVeranstaltung($veranstaltung_id)) - { + { $error=$p->t("global/fehlerBeimLoeschenDesEintrags").$Jahresplan->errormsg; } else @@ -137,34 +137,34 @@ if (window.opener && !window.opener.closed) { if (confirm("'.$p->t("eventkalender/sollDieHauptseiteNeuAufgebautWerden").'?")) { window.opener.location.reload(); - } + } this.close(); } --> - - '; + + '; } } } // ------------------------------------------------------------------------------------------ -// Kategorie - Daten lesen fuer Kategorieselect +// Kategorie - Daten lesen fuer Kategorieselect // Veranstaltungskategorien ohne Selektionsbedingung // ------------------------------------------------------------------------------------------ $Jahresplan->InitVeranstaltungskategorie(); - // Nur Berechtigte duerfen auch noch nicht freigegebene Sehen + // Nur Berechtigte duerfen auch noch nicht freigegebene Sehen $Jahresplan->show_only_public_kategorie=($is_mitarbeiter?false:true); if (!$veranstaltungskategorie=$Jahresplan->loadVeranstaltungskategorie()) die($Jahresplan->errormsg); - + // ------------------------------------------------------------------------------------------ // Daten lesen fuer Anzeige der // Veranstaltungen mit Selektionsbedingung // ------------------------------------------------------------------------------------------ if (!empty($veranstaltung_id)) { - $Jahresplan->InitVeranstaltung(); - // Nur Berechtigte duerfen auch noch nicht freigegebene Sehen + $Jahresplan->InitVeranstaltung(); + // Nur Berechtigte duerfen auch noch nicht freigegebene Sehen $Jahresplan->show_only_public_kategorie=($is_mitarbeiter?false:true); $Jahresplan->freigabe=($is_wartungsberechtigt?false:true); @@ -175,7 +175,7 @@ if ($veranstaltungen=$Jahresplan->loadVeranstaltung()) { $veranstaltungen=jahresplan_funk_veranstaltung_extend($veranstaltungen); - while (list($key, $value) = each($veranstaltungen)) + while (list($key, $value) = each($veranstaltungen)) { $veranstaltung[$key]=$value; } @@ -187,16 +187,16 @@ die($Jahresplan->errormsg); } // Plausib - if (!is_array($veranstaltung) || count($veranstaltung)<1 || !isset($veranstaltung["veranstaltung_id"])) + if (!is_array($veranstaltung) || count($veranstaltung)<1 || !isset($veranstaltung["veranstaltung_id"])) { $work='new'; - } + } } else // Reload ohne Datenverarbeitung , die Aufrufparameter in die Datentabelle uebertragen fuer Value der Inputfelder { $veranstaltung=$_REQUEST; } -?> +?> @@ -208,11 +208,11 @@ - + + -" method="post" enctype="multipart/form-data"> - + - + - + @@ -482,18 +482,30 @@  t("eventkalender/ganztaegigeVeranstaltung")?>   type="checkbox" value="1" onclick="if (this.checked!=false) {window.document.selVeranstaltung.Zeit1.options.selectedIndex=0;window.document.selVeranstaltung.Zeit2.options.selectedIndex=(window.document.selVeranstaltung.Zeit2.options.length - 1); }; var time_stamp=TimestampDatumZeit(window.document.selVeranstaltung.Datum1.value,window.document.selVeranstaltung.Zeit1.value); if (time_stamp) {window.document.selVeranstaltung.start.value=time_stamp; }; time_stamp=TimestampDatumZeit(window.document.selVeranstaltung.Datum2.value,window.document.selVeranstaltung.Zeit2.value); if (time_stamp) {window.document.selVeranstaltung.ende.value=time_stamp; };" name="tmpGanztag" > - - + + - - - + + + - - + + - + + + + + + + + "; + } + else + { + echo ' + + + '; + } + echo '
@@ -408,9 +408,9 @@ " class="cursor_hand" onclick="self.location.href='';" >t("eventkalender/neuanlage")?> Neuanlage
+ + +
+ + +
@@ -521,7 +533,7 @@
@@ -548,12 +560,12 @@ '.$error.'

'; - + $veranstaltung_id=(isset($veranstaltung['veranstaltung_id'])?$veranstaltung['veranstaltung_id']:$veranstaltung_id); if (!empty($veranstaltung_id)) { echo '
'.jahresplan_veranstaltung_detail_user($veranstaltung,$is_wartungsberechtigt); - echo ''.$p->t("eventkalender/reservierungenInEinemNeuenFensterAnzeigen").'.'; + echo ''.$p->t("eventkalender/reservierungenInEinemNeuenFensterAnzeigen").'.'; echo ''; } else @@ -562,4 +574,4 @@ } ?> - + diff --git a/cis/private/lehre/fotoliste.pdf.php b/cis/private/lehre/fotoliste.pdf.php index 475df926e..3390b27d1 100644 --- a/cis/private/lehre/fotoliste.pdf.php +++ b/cis/private/lehre/fotoliste.pdf.php @@ -17,12 +17,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Authors: Cristina Hainberger - * + * * Description: This file creates a studentlist with students' profile fotos * by a given studiengangs- and lehrveranstaltungs ID (and eventually a given lehreinheit ID). * If fotos are locked by student, a dummy picture is inserted instead of the students foto. * EXCEPTION: if user has admins or assitents rights, ALL students' fotos are iserted (even locked ones) - * + * */ require_once('../../../config/cis.config.inc.php'); @@ -60,7 +60,7 @@ $lv->load($lvid); $berechtigung = new benutzerberechtigung(); $berechtigung->getBerechtigungen($user); - + if (!$berechtigung->isBerechtigt('admin') && !$berechtigung->isBerechtigt('assistenz') && !$berechtigung->isBerechtigt('lehre', $lv->oe_kurzbz, 's') && !check_lektor_lehrveranstaltung($user, $lvid, $studiensemester)) die('Sie muessen LektorIn der LV sein oder das Recht "ADMIN", "ASSISTENZ" oder "LEHRE" haben, um diese Seite aufrufen zu koennen'); @@ -85,11 +85,11 @@ $qry = "SELECT DISTINCT ON gruppe, gruppe_kurzbz, stg_typ - FROM + FROM campus.vw_lehreinheit - WHERE + WHERE lehrveranstaltung_id=" . $db->db_add_param($lvid, FHC_INTEGER) . " - AND + AND studiensemester_kurzbz=" . $db->db_add_param($studiensemester); if ($lehreinheit != '') $qry .= " AND lehreinheit_id=" . $db->db_add_param($lehreinheit, FHC_INTEGER); @@ -111,8 +111,8 @@ if ($result = $db->db_query($qry)) { if ($row->gruppe_kurzbz == '') $gruppen_string = trim($row->kuerzel . '-' . $row->semester); else - $gruppen_string = $row->gruppe_kurzbz; - + $gruppen_string = $row->gruppe_kurzbz; + $gruppen_string_arr[] = $gruppen_string; } } @@ -122,10 +122,10 @@ $studiengruppe = implode(", ", array_unique($gruppen_string_arr)); //get studiengangstyp-bezeichnung $qry = "SELECT - bezeichnung - FROM - public.tbl_studiengangstyp - WHERE + bezeichnung + FROM + public.tbl_studiengangstyp + WHERE typ =" . $db->db_add_param($stg_typ); if ($result = $db->db_query($qry)) { @@ -148,43 +148,43 @@ $data = array( //**************************** students data ******************************* //load students-data $qry = 'SELECT DISTINCT ON - (nachname, vorname, person_id) - vorname, - nachname, + (nachname, vorname, person_id) + vorname, + nachname, matrikelnr, - tbl_studentlehrverband.semester, - tbl_studentlehrverband.verband, + tbl_studentlehrverband.semester, + tbl_studentlehrverband.verband, tbl_studentlehrverband.gruppe, - (SELECT - status_kurzbz - FROM - public.tbl_prestudentstatus - WHERE - prestudent_id=tbl_student.prestudent_id - ORDER BY + (SELECT + status_kurzbz + FROM + public.tbl_prestudentstatus + WHERE + prestudent_id=tbl_student.prestudent_id + ORDER BY datum DESC, insertamum DESC, ext_id DESC LIMIT 1) as status, tbl_studiengang.kurzbz, tbl_studiengang.typ, - tbl_bisio.bisio_id, - tbl_bisio.von, - tbl_bisio.bis, + tbl_bisio.bisio_id, + tbl_bisio.von, + tbl_bisio.bis, tbl_student.studiengang_kz AS stg_kz_student, - tbl_zeugnisnote.note, - tbl_mitarbeiter.mitarbeiter_uid, - tbl_person.matr_nr, - tbl_person.geschlecht, - tbl_person.foto, + tbl_zeugnisnote.note, + tbl_mitarbeiter.mitarbeiter_uid, + tbl_person.matr_nr, + tbl_person.geschlecht, + tbl_person.foto, tbl_person.foto_sperre FROM - campus.vw_student_lehrveranstaltung + campus.vw_student_lehrveranstaltung JOIN public.tbl_benutzer USING(uid) - JOIN public.tbl_person USING(person_id) + JOIN public.tbl_person USING(person_id) LEFT JOIN public.tbl_student ON(uid=student_uid) LEFT JOIN public.tbl_studiengang ON(tbl_studiengang.studiengang_kz=tbl_student.studiengang_kz) LEFT JOIN public.tbl_mitarbeiter ON(uid=mitarbeiter_uid) LEFT JOIN public.tbl_studentlehrverband USING(student_uid,studiensemester_kurzbz) - LEFT JOIN lehre.tbl_zeugnisnote ON(vw_student_lehrveranstaltung.lehrveranstaltung_id=tbl_zeugnisnote.lehrveranstaltung_id - AND tbl_zeugnisnote.student_uid=tbl_student.student_uid + LEFT JOIN lehre.tbl_zeugnisnote ON(vw_student_lehrveranstaltung.lehrveranstaltung_id=tbl_zeugnisnote.lehrveranstaltung_id + AND tbl_zeugnisnote.student_uid=tbl_student.student_uid AND tbl_zeugnisnote.studiensemester_kurzbz=tbl_studentlehrverband.studiensemester_kurzbz) LEFT JOIN bis.tbl_bisio ON(uid=tbl_bisio.student_uid) WHERE @@ -214,7 +214,7 @@ if ($result = $db->db_query($qry)) { while ($row = $db->db_fetch_object($result)) { if ($row->status != 'Abbrecher' && $row->status != 'Unterbrecher') { $anzahl_studierende++; - + if ($row->status == 'Incoming') //Incoming $zusatz = '(i)'; else @@ -231,9 +231,9 @@ if ($result = $db->db_query($qry)) { if ($row->stg_kz_student == $a_o_kz) //Außerordentliche Studierende $zusatz .= '(a.o.)'; - + //allow admin and assistenz to see ALL fotos (even if locked by user) - if ($show_all_fotos) + if ($show_all_fotos) $row->foto_sperre = 'f'; //create foto (if not locked by student OR if fotolist is created by admin or assistenz) @@ -241,7 +241,7 @@ if ($result = $db->db_query($qry)) { $foto_src = $row->foto; $foto_url = sys_get_temp_dir() . '/foto' . trim($row->matrikelnr) . '.jpg'; $foto_url_arr[] = $foto_url; - + //create writeable file if (!$foto = fopen($foto_url, 'w')) die("Das Bild konnte nicht erstellt werden"); @@ -250,15 +250,19 @@ if ($result = $db->db_query($qry)) { { die("Das Bild konnte nicht erstellt werden"); } - + //add foto to document $doc->addImage($foto_url, trim($row->matrikelnr) . '.jpg', 'image/jpg'); } elseif ($row->foto == '') - { + { $foto_url = ''; - } - + } + else + { + $foto_url = ''; + } + //create studiengruppe $student_studiengruppe = strtoupper($row->typ.$row->kurzbz.'-'.$row->semester); @@ -268,7 +272,7 @@ if ($result = $db->db_query($qry)) { 'nachname' => mb_strtoupper($row->nachname, 'UTF-8'), 'personenkennzeichen' => trim($row->matrikelnr), 'geschlecht' => $row->geschlecht, - 'foto_gesperrt' => $row->foto_sperre, // f/t + 'foto_gesperrt' => $row->foto_sperre, // f/t 'foto_url' => $foto_url, 'studiengruppe' => $student_studiengruppe, 'verband' => trim($row->verband), @@ -289,7 +293,7 @@ $doc->addDataArray($data, 'fotoliste'); //set doc name $doc->setFilename('Fotoliste_'.$stg_bezeichnung.'_'.$studiensemester.'_'.$lv_bezeichnung); -//create doc in format required +//create doc in format required if (!$doc->create($output)) die($doc->errormsg); @@ -301,4 +305,4 @@ $doc->close(); //unlink fotos from tmp-folder foreach ($foto_url_arr as $foto_url) - unlink($foto_url); \ No newline at end of file + unlink($foto_url); diff --git a/cis/private/open_grp.php b/cis/private/open_grp.php index 9b9bd2038..2973ac7cd 100644 --- a/cis/private/open_grp.php +++ b/cis/private/open_grp.php @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Authors: Christian Paminger , - * Andreas Oesterreicher and - * Karl Burkhart . + * Andreas Oesterreicher and + * Karl Burkhart . */ require_once('../../config/cis.config.inc.php'); require_once('../../include/functions.inc.php'); @@ -29,20 +29,20 @@ $sprache = getSprache(); $p = new phrasen($sprache); $uid = get_uid(); $db = new basis_db(); -if(!isset($_REQUEST['grp'])) +if (!isset($_REQUEST['grp'])) die('Falsche Parameter'); - -if(mb_strlen($_REQUEST['grp'])>32) + +if (mb_strlen($_REQUEST['grp'])>32) die('Grp ungueltig'); - + //Pruefen ob es eine gueltige Gruppe ist $gruppe = new gruppe(); -if(!$gruppe->exists($_REQUEST['grp'])) +if (!$gruppe->exists($_REQUEST['grp'])) { //Wenn es keine Gruppe in der DB ist, kann es //noch ein Studierendenverteiler sein //bif_std - if(!preg_match('/^\D\D\D_std$/', $_REQUEST['grp'])) + if (!preg_match('/^\D\D\D_std$/', $_REQUEST['grp'])) { die('Ungueltige Gruppe'); } @@ -52,38 +52,35 @@ function mail_id_generator() mt_srand((double)microtime()*1000000); /* Laenge des Passwortes dem Zufall ueberlassen */ - $length = 6; //mt_rand(6, 6); + $length = 6; $fix_similar = ''; $valid_charset = ""; - /* Stelle ein Charset zusammen */ - if (!$valid_charset) - { - // deactivated, regarding an case sensitive issue - //$valid_charset .= 'ABCDEFGHIJKLMNOPQRSTUVXYZ'; - $valid_charset .= 'abcdefghijklmnopqrstuvxyz'; - $valid_charset .= '0123456789'; - //$valid_charset .= '!@_-'; - } - - $charset_length = mb_strlen($valid_charset); - - if ($charset_length == 0) return false; - - /* Initialisieren - Auswahl von chars bis definierte Anzahl erreicht */ - $mail_id = ""; - while(strlen($mail_id) < $length) - { - /* Waehle einen zufaelligen char aus */ - $char = $valid_charset[mt_rand(0, ($charset_length-1))]; - - /* Abgleich von gleich aussehenden chars */ - if (($fix_similar && !strpos('O01lI5S', $char)) || !$fix_similar) $mail_id .= $char; + /* Stelle ein Charset zusammen */ + if (!$valid_charset) + { + $valid_charset .= 'abcdefghijklmnopqrstuvxyz'; + $valid_charset .= '0123456789'; } - return $mail_id; + + $charset_length = mb_strlen($valid_charset); + + if ($charset_length == 0) return false; + + /* Initialisieren - Auswahl von chars bis definierte Anzahl erreicht */ + $mail_id = ''; + while (strlen($mail_id) < $length) + { + /* Waehle einen zufaelligen char aus */ + $char = $valid_charset[mt_rand(0, ($charset_length-1))]; + + /* Abgleich von gleich aussehenden chars */ + if (($fix_similar && !strpos('O01lI5S', $char)) || !$fix_similar) $mail_id .= $char; + } + return $mail_id; } -echo ' +echo ' @@ -92,48 +89,61 @@ echo ' '; -if(isset($_REQUEST['token']) && isset($_REQUEST['grp'])) +if (isset($_REQUEST['token']) && isset($_REQUEST['grp'])) { echo ' - - - - '; - + + + + '; + /* Generate an random String */ - $mail_id=mail_id_generator(); + $mail_id = mail_id_generator(); - /* call the shellpart at polyxena */ - $command = "ssh -p 22022 root@polyxena sudo /root/bin/mlistin.sh " . $_REQUEST['grp'] . " " . $mail_id . " 2>&1"; - exec($command); + /* Command to unlock Mailgroup */ + $command = "ssh -i /etc/apache2/id_mail_provisioning mailadmins@bifrost2 ".$_REQUEST['grp'] . " " . $mail_id; - /* ffe, 20051020 - do a little logging */ - $message= date("F j G:i:s") . " mailgroup: [" . $_REQUEST['grp'] . "] (using " . $mail_id . ") requested by [" . $uid . "]\n"; + $output = array(); + exec($command, $output, $retval); - $filet = fopen(LOG_PATH.'.htmlistopen.log', "a"); - fwrite($filet, $message, mb_strlen($message)); - fclose($filet); + if ($retval === 0) + { + // Add Log Message + $message= date("F j G:i:s") . " mailgroup: [" . $_REQUEST['grp'] . "] (using " . $mail_id . ") requested by [" . $uid . "]\n"; - // for the users - echo " - - - - - - - -
'.$p->t('mailverteiler/mailverteiler').''.$p->t('mailverteiler/status').'
'.$p->t('mailverteiler/mailverteiler').''.$p->t('mailverteiler/status').'
".$db->convert_html_chars($_REQUEST['desc'])."".$p->t('mailverteiler/geoeffnet')." (Code: ".$mail_id.")
-

".$p->t('mailverteiler/klickenZumSchicken')."

+ $filet = fopen(LOG_PATH.'.htmlistopen.log', "a"); + fwrite($filet, $message, mb_strlen($message)); + fclose($filet); -

".$p->t('mailverteiler/infoBenutzung',array($_REQUEST['grp'].$mail_id."@".DOMAIN))."

-
- "; + echo " +
".$db->convert_html_chars($_REQUEST['desc'])."".$p->t('mailverteiler/geoeffnet')." (Code: ".$mail_id.")
+

".$p->t('mailverteiler/klickenZumSchicken')."

+ +

".$p->t('mailverteiler/infoBenutzung',array($_REQUEST['grp'].$mail_id."@".DOMAIN))."

+
+ '.$p->t('mailverteiler/oeffnenFehlgeschlagen').' +
'; } else { - if($_REQUEST['grp']=="") + if ($_REQUEST['grp'] == '') { exit(); } @@ -142,7 +152,7 @@ else echo $p->t('mailverteiler/bestaetigeOeffnen',array($_REQUEST['grp']))." : convert_html_chars($_REQUEST['desc'])."&token=1\">".$p->t('mailverteiler/bestaetige').""; } } - + echo ' '; ?> diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index eb14c2744..8b145092e 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -19,8 +19,9 @@ * Andreas Oesterreicher and * Rudolf Hangl * Karl Burkhart - * Manfred Kindl . + * Manfred Kindl * Gerald Raab + * Alexei Karpenko */ require_once('../../../config/cis.config.inc.php'); require_once('../../../include/functions.inc.php'); @@ -648,7 +649,6 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $service_id = ''; $kunde_uid = ''; } - } } @@ -719,13 +719,15 @@ if($projekt->getProjekteMitarbeiter($user, true)) $anzprojekte = count($projekt->result); echo " - + CSV Export"; + if($anzprojekte > 0) + echo " | Projektexport"; + echo "
- ".$p->t("zeitaufzeichnung/neu")." -   - CSV Import  + + ".$p->t("zeitaufzeichnung/neu")." | + + CSV Import | - CSV Export -
"; + echo ' + + '; @@ -283,7 +271,7 @@ if(count($prestudent->result)>0) { $uid='ACHTUNG: Es gibt mehrere Studenteneinträge die auf diesen Prestudenten zeigen!'; } - else + else { if($row_std = $db->db_fetch_object($result)) { @@ -295,7 +283,7 @@ if(count($prestudent->result)>0) echo ""; echo ""; $prestudent1 = new prestudent(); - $prestudent1->getLastStatus($row->prestudent_id); + $prestudent1->getLastStatus($row->prestudent_id); echo ""; echo ''; } @@ -307,7 +295,7 @@ if($result = $db->db_query($qry)) { if($db->db_num_rows($result)>0) { - echo '

Mitarbeiter

'; + echo '

Mitarbeiter

'; echo '
'; + echo ''; + if (isset($_GET['projektexport'])) + { + $projektexpurl = dirname($_SERVER["PHP_SELF"]) .'/zeitaufzeichnung_projektliste.php'; + $aktjahr = intval(date("Y")); + $aktmonat = intval(date("m")) - 1; + $jahreanz = 3; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } //Formular echo '
'; - echo '

ProjektexportMonat: Jahr:

+/* echo '
'; @@ -998,20 +1046,6 @@ if($projekt->getProjekteMitarbeiter($user, true)) echo ''; echo '
'; - echo ''; + echo '
';*/ + if (isset($_GET['csvimport'])) + { + echo ''; + echo ''; + echo ''; + echo ''; + } + else + echo ''; + + if (isset($_GET['csvexport'])) + { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + //Projekte werden nicht angezeigt wenn es keine gibt if($anzprojekte > 0) { @@ -948,14 +1004,6 @@ if($projekt->getProjekteMitarbeiter($user, true)) echo '  '; echo ''; } - if (isset($_GET['csvimport'])) - { - echo ''; - echo ''; - echo ''; - } - else - echo ''; echo '

CSV-Import
Informationen zum Format der CSV-Datei s. Leitfaden Arbeitszeitaufzeichnung


CSV-ExportStartdatum: Enddatum:


CSV-Import
Informationen zum Format der CSV-Datei s. Leitfaden Arbeitszeitaufzeichnung
'; echo '


'; echo ''; - if (isset($_GET['csvexport'])) - { - echo '
'; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo '

CSV-ExportStartdatum:  Enddatum:
'; - echo '
'; - } echo '
'; echo '

'.($alle===true?$p->t('zeitaufzeichnung/alleEintraege'):$p->t('zeitaufzeichnung/xTageAnsicht', array($angezeigte_tage))).'

'; if ($alle===true) diff --git a/cis/private/tools/zeitaufzeichnung_projektliste.php b/cis/private/tools/zeitaufzeichnung_projektliste.php new file mode 100644 index 000000000..130dde64a --- /dev/null +++ b/cis/private/tools/zeitaufzeichnung_projektliste.php @@ -0,0 +1,544 @@ + + */ +/** + * Creates a project list from the zeitaufzeichnung for a given user, month and year + * Shows total worktime (IST-Arbeitszeit without breaks or externe Lehre) for each workday + * together with sums of worktime and work package descriptions for each project. + */ + +require_once('../../../config/cis.config.inc.php'); +require_once('../../../include/globals.inc.php'); +require_once('../../../include/phrasen.class.php'); +require_once('../../../include/datum.class.php'); +require_once('../../../include/Excel/excel.php'); +require_once('../../../include/benutzer.class.php'); +require_once('../../../include/mitarbeiter.class.php'); +require_once('../../../include/zeitaufzeichnung.class.php'); +require_once('../../../include/projekt.class.php'); + +if (!isset($_GET['projexpmonat'])) + die("Parameter monat fehlt"); +if (!isset($_GET['projexpjahr'])) + die("Parameter jahr fehlt"); + +$uid = get_uid(); +$benutzer = new benutzer(); +if (!$benutzer->load($uid)) + die($p->t("zeitaufzeichnung/benutzerWurdeNichtGefunden", array($uid))); + +$month = $_GET['projexpmonat']; +$year = $_GET['projexpjahr']; + +$monthtext = $monatsname[1][$month - 1]; +$username = $benutzer->vorname." ".$benutzer->nachname; +$mitarbeiter = new mitarbeiter(); +$mitarbeiter->load($uid); +$persnr = $mitarbeiter->personalnummer; +$daysinmonth = cal_days_in_month(CAL_GREGORIAN, $month, $year); + +$date = new datum(); +$ztauf = new zeitaufzeichnung(); + +$ztauf->getListeUserFromTo($uid, $year.'-'.$month.'-01', $year.'-'.$month.'-'.$daysinmonth); + +//objects for one projectline of list (corresponds to one day) +$projectlines = []; +$dayStart = $dayEnd = ''; +$projectnames = $tosubtract = $allpauseranges = []; +$toignore = ['Pause', 'LehreExtern']; +$ztaufdata = $ztauf->result; +$monthsums = [0 => 0.00]; + +//sprt list by startdate ascending (if not already done in zeitaufzeichnung class) +usort($ztaufdata, function ($ztaufa, $ztaufb) +{ + $date = new datum(); + return $date->mktime_fromtimestamp($ztaufa->start) - $date->mktime_fromtimestamp($ztaufb->start); +} +); + +//fill projectlines with data +for ($i = 0; $i < sizeof($ztaufdata); $i++) +{ + $ztaufrow = $ztaufdata[$i]; + $day = intval($date->formatDatum($ztaufrow->ende, 'd')); + //first entry for a day + $isFirstEntry = !isset($projectlines[$day]); + + //last entry for a day (next entry is different day) + $isLastEntry = !array_key_exists($i + 1, $ztaufdata) || intval($date->formatDatum($ztaufdata[$i + 1]->ende, 'd')) != $day; + + if (in_array($ztaufrow->aktivitaet_kurzbz, $toignore)) + { + $subtraction = new stdClass(); + $subtraction->start = $ztaufrow->start; + $subtraction->ende = $ztaufrow->ende; + $subtraction->diff = $date->convertTimeStringToHours($ztaufrow->diff); + $subtraction->typ = $ztaufrow->aktivitaet_kurzbz; + $tosubtract[] = $subtraction; + + //save all pause ranges + if($ztaufrow->aktivitaet_kurzbz == $toignore[0]) + { + $prevpause = null; + if(sizeof($allpauseranges)>0) + { + $prevpause = $allpauseranges[sizeof($allpauseranges) - 1]; + } + + //first pause or no overlap to previous pause - add pauserange + if( is_null($prevpause ) || $prevpause->ende <= $ztaufrow->start ) + { + $pauserange = new stdClass(); + $pauserange->start = $ztaufrow->start; + $pauserange->ende = $ztaufrow->ende; + $allpauseranges[] = $pauserange; + } + //pause overlap - change pause ende + elseif($prevpause->ende > $ztaufrow->start ) + { + $allpauseranges[sizeof($allpauseranges) - 1]->ende = $ztaufrow->ende; + } + } + } + + if (($dayStart == '' || $date->mktime_fromtimestamp($date->formatDatum($dayStart, $format = 'Y-m-d H:i:s')) > $date->mktime_fromtimestamp($date->formatDatum($ztaufrow->start, $format = 'Y-m-d H:i:s'))) && $ztaufrow->aktivitaet_kurzbz != $toignore[1]) + $dayStart = $ztaufrow->start; + if (($dayEnd == '' || $date->mktime_fromtimestamp($date->formatDatum($dayEnd, $format = 'Y-m-d H:i:s')) < $date->mktime_fromtimestamp($date->formatDatum($ztaufrow->ende, $format = 'Y-m-d H:i:s'))) && $ztaufrow->aktivitaet_kurzbz != $toignore[1]) + $dayEnd = $ztaufrow->ende; + + if ($isFirstEntry) + { + $projectlines[$day] = new stdClass(); + $projectlines[$day]->arbeitszeit = ''; + $projectlines[$day]->projekte = []; + } + + if (isset($ztaufrow->projekt_kurzbz)) + { + //Project already in projectline - add to worktime and description + if (array_key_exists($ztaufrow->projekt_kurzbz, $projectlines[$day]->projekte)) + { + $laststart =& $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->laststart; + $lastende =& $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->lastende; + + $toadd = 0.00; + //case 1: there is no overlap, just add project time difference + if ($date->mktime_fromtimestamp($ztaufrow->start) > $date->mktime_fromtimestamp($lastende)) + { + $toadd = $date->convertTimeStringToHours($ztaufrow->diff); + $laststart = $ztaufrow->start; + $lastende = $ztaufrow->ende; + $newprojecttime = new stdClass(); + $newprojecttime->start = $ztaufrow->start; + $newprojecttime->ende = $ztaufrow->ende; + $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->alleZeiten[] = $newprojecttime; + } + //case 2: overlap - add only part of the time + elseif ($date->mktime_fromtimestamp($ztaufrow->start) < $date->mktime_fromtimestamp($lastende) && $date->mktime_fromtimestamp($ztaufrow->ende) > $date->mktime_fromtimestamp($lastende)) + { + $toadd = ($date->mktime_fromtimestamp($ztaufrow->ende) - $date->mktime_fromtimestamp($lastende)) / 3600; + $lastende = $ztaufrow->ende; + $alleZeiten =& $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->alleZeiten; + $index = count($alleZeiten); + $alleZeiten[$index-1]->ende = $ztaufrow->ende; + } + $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->stunden += $toadd; + + //concatenate descriptions "working packages" for each project + if (!empty($ztaufrow->beschreibung)) + { + $packagecounter = ++$projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->arbeitspakete; + if ($packagecounter == 1) + $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->beschreibung = $ztaufrow->beschreibung; + else + $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz]->beschreibung .= " | ".str_replace(array("\r\n", "\r", "\n"), " ", $ztaufrow->beschreibung); + } + } + else + { + //add new project to projectline + $newproject = new stdClass(); + $newproject->laststart = $ztaufrow->start; + $newproject->lastende = $ztaufrow->ende; + $newprojecttime = new stdClass(); + $newprojecttime->start = $ztaufrow->start; + $newprojecttime->ende = $ztaufrow->ende; + $newproject->alleZeiten = []; + $newproject->alleZeiten[] = $newprojecttime; + $newproject->stunden = $date->convertTimeStringToHours($ztaufrow->diff); + $newproject->arbeitspakete = 0;//counter for tracking number of descriptions (work packages) + $newproject->beschreibung = ''; + if (!empty($ztaufrow->beschreibung)) + { + $newproject->beschreibung = str_replace(array("\r\n", "\r", "\n"), " ", $ztaufrow->beschreibung); + $newproject->arbeitspakete++; + } + $projectlines[$day]->projekte[$ztaufrow->projekt_kurzbz] = $newproject; + + //add new project to array with unique project names + if (!in_array($ztaufrow->projekt_kurzbz, $projectnames)) + $projectnames[] = $ztaufrow->projekt_kurzbz; + } + } + + if ($isLastEntry) + { + $worktime_unix = $date->mktime_fromtimestamp($date->formatDatum($dayEnd, $format = 'Y-m-d H:i:s')) - $date->mktime_fromtimestamp($date->formatDatum($dayStart, $format = 'Y-m-d H:i:s')); + $worktimehours = $worktime_unix / 3600; + + $projectlines[$day]->arbeitszeit = $worktimehours; + $pauseSubtracted = 0.00; + $lehreExternExists = false; + + //subtract Pauses and LehreExtern + foreach ($tosubtract as $subtraction) + { + if ($subtraction->typ == $toignore[0]) + { + $projectlines[$day]->arbeitszeit -= $subtraction->diff; + $pauseSubtracted += $subtraction->diff; + } + elseif ($subtraction->typ == $toignore[1] && $subtraction->start >= $dayStart && $subtraction->ende <= $dayEnd) + { + $projectlines[$day]->arbeitszeit -= $subtraction->diff; + $lehreExternExists = true; + } + } + + //subtract pauses from Project worktimes + foreach($allpauseranges as $pauserange) + { + foreach($projectlines[$day]->projekte as $name => $project) + { + foreach($projectlines[$day]->projekte[$name]->alleZeiten as $zeit) + { + if($pauserange->start >= $zeit->start && $pauserange->ende <= $zeit->ende) + { + $projectlines[$day]->projekte[$name]->stunden -= ($date->mktime_fromtimestamp($pauserange->ende) - $date->mktime_fromtimestamp($pauserange->start)) / 3600; + break; + } + elseif($pauserange->start < $zeit->ende && $pauserange->start > $zeit->start) + { + $projectlines[$day]->projekte[$name]->stunden -= ($date->mktime_fromtimestamp($zeit->ende) - $date->mktime_fromtimestamp($pauserange->start)) / 3600; + //break; + } + elseif($pauserange->ende > $zeit->start && $pauserange->ende< $zeit->ende) + { + $projectlines[$day]->projekte[$name]->stunden -= ($date->mktime_fromtimestamp($pauserange->ende) - $date->mktime_fromtimestamp($zeit->start)) / 3600; + //break; + } + } + } + } + + //worktime with no break greater 6 -> compulsory break of half an hour + if ($pauseSubtracted < 0.5 && !$lehreExternExists) + { + if ($projectlines[$day]->arbeitszeit >= 6.5) + $projectlines[$day]->arbeitszeit -= 0.5; + + //ensure that no worktime gets smaller than 6 hours because of compulsory break + elseif ($projectlines[$day]->arbeitszeit > 6) + $projectlines[$day]->arbeitszeit -= $projectlines[$day]->arbeitszeit - 6; + } + + $projectlines[$day]->arbeitszeit = floor($projectlines[$day]->arbeitszeit * 100) / 100; + + foreach($projectlines[$day]->projekte as $name => $project) + { + $projecthours =& $projectlines[$day]->projekte[$name]->stunden; + $projecthours = floor($projecthours * 100) / 100; + if (array_key_exists($name, $monthsums)) + $monthsums[$name] += $projecthours; + else + $monthsums[$name] = $projecthours; + } + + $dayStart = $dayEnd = ''; + $tosubtract = $allpauseranges = []; + $monthsums[0] += $projectlines[$day]->arbeitszeit; + } +} + +// Creating a workbook +$workbook = new Spreadsheet_Excel_Writer(); +$workbook->setVersion(8); + +// sending HTTP headers +$workbook->send("Projektliste_".$month."_".$year.".xls"); + +// Creating a worksheet +$worksheet =& $workbook->addWorksheet("Projektliste"); +$worksheet->setInputEncoding('utf-8'); + +// Define formats +$format_heading_left =& $workbook->addFormat(); +$format_heading_left->setBold(); +$format_heading_left->setAlign('center'); +$format_heading_left->setAlign('vcenter'); +$format_heading_left->setBottom(2); +$format_heading_left->setLeft(2); +$format_heading_left->setTop(2); + +$format_heading_right =& $workbook->addFormat(); +$format_heading_right->setBold(); +$format_heading_right->setAlign('right'); +$format_heading_right->setRight(2); +$format_heading_right->setTop(2); + +$format_heading_right_bottomline =& $workbook->addFormat(); +$format_heading_right_bottomline->setAlign('right'); +$format_heading_right_bottomline->setRight(2); +$format_heading_right_bottomline->setBottom(2); + +$format_bold_centered_toprightline =& $workbook->addFormat(); +$format_bold_centered_toprightline->setBorder(1); +$format_bold_centered_toprightline->setBold(); +$format_bold_centered_toprightline->setAlign('center'); +$format_bold_centered_toprightline->setVAlign('vcenter'); +$format_bold_centered_toprightline->setTop(2); +$format_bold_centered_toprightline->setRight(2); + +$format_bold_centered_bottomline =& $workbook->addFormat(); +$format_bold_centered_bottomline->setBorder(1); +$format_bold_centered_bottomline->setBold(); +$format_bold_centered_bottomline->setAlign('center'); +$format_bold_centered_bottomline->setVAlign('vcenter'); +$format_bold_centered_bottomline->setBottom(2); + +$format_bold_centered_bottomrightline =& $workbook->addFormat(); +$format_bold_centered_bottomrightline->setBorder(1); +$format_bold_centered_bottomrightline->setBold(); +$format_bold_centered_bottomrightline->setAlign('center'); +$format_bold_centered_bottomrightline->setVAlign('vcenter'); +$format_bold_centered_bottomrightline->setBottom(2); +$format_bold_centered_bottomrightline->setRight(2); + +$format_bold_centered_alllines =& $workbook->addFormat(); +$format_bold_centered_alllines->setBorder(2); +$format_bold_centered_alllines->setBold(); +$format_bold_centered_alllines->setAlign('center'); +$format_bold_centered_alllines->setVAlign('vcenter'); + +$format_cell_rightline =& $workbook->addFormat(); +$format_cell_rightline->setBorder(1); +$format_cell_rightline->setVAlign('vcenter'); +$format_cell_rightline->setRight(2); + +$format_cell_centered =& $workbook->addFormat(); +$format_cell_centered->setBorder(1); +$format_cell_centered->setAlign('center'); +$format_cell_centered->setVAlign('vcenter'); + +$format_cell_centered_leftline =& $workbook->addFormat(); +$format_cell_centered_leftline->setBorder(1); +$format_cell_centered_leftline->setAlign('center'); +$format_cell_centered_leftline->setVAlign('vcenter'); +$format_cell_centered_leftline->setLeft(2); + +$format_cell_centered_rightline =& $workbook->addFormat(); +$format_cell_centered_rightline->setBorder(1); +$format_cell_centered_rightline->setAlign('center'); +$format_cell_centered_rightline->setVAlign('vcenter'); +$format_cell_centered_rightline->setRight(2); + +$format_cell_centered_topbottomleftline =& $workbook->addFormat(); +$format_cell_centered_topbottomleftline->setBorder(1); +$format_cell_centered_topbottomleftline->setAlign('center'); +$format_cell_centered_topbottomleftline->setVAlign('vcenter'); +$format_cell_centered_topbottomleftline->setLeft(2); +$format_cell_centered_topbottomleftline->setBottom(2); +$format_cell_centered_topbottomleftline->setTop(2); + +$format_cell_centered_topbottomrightline =& $workbook->addFormat(); +$format_cell_centered_topbottomrightline->setBorder(1); +$format_cell_centered_topbottomrightline->setAlign('center'); +$format_cell_centered_topbottomrightline->setVAlign('vcenter'); +$format_cell_centered_topbottomrightline->setRight(2); +$format_cell_centered_topbottomrightline->setBottom(2); +$format_cell_centered_topbottomrightline->setTop(2); + +$format_cell_centered_alllines =& $workbook->addFormat(); +$format_cell_centered_alllines->setBorder(2); +$format_cell_centered_alllines->setAlign('center'); +$format_cell_centered_alllines->setVAlign('vcenter'); + +//define column widths +$nrProjects = sizeof($projectnames); +$daywidth = 4; +$totalworktimewidth = 10; +$worktimewidth = 8; +$worksheet->setColumn(0, 1, $daywidth); +$worksheet->setColumn(2, 2, $totalworktimewidth); + +//calculate max width for project descriptions +$maxwidthprojects = $totalworktimewidth * (12 - $nrProjects); +$projectcolumnwidths = array_fill_keys($projectnames, $worktimewidth); + +//set project column width depending on project description widths +foreach ($projectlines as $line) +{ + foreach ($line->projekte as $key => $project) + { + if ($projectcolumnwidths[$key] < strlen($project->beschreibung)) + $projectcolumnwidths[$key] = strlen($project->beschreibung); + } +} + +//distribute width remainder evenly among projects +if ($nrProjects != 0) + $remwidth = ($maxwidthprojects - array_sum($projectcolumnwidths)) / $nrProjects; + +foreach ($projectcolumnwidths as $projectname => $width) + $projectcolumnwidths[$projectname] += $remwidth; + +//calculating spaces for centering global header texts +$numberspaces = ($maxwidthprojects - 10 - strlen($username)); +$spacesstringFirst = ""; + +while ($numberspaces > 0) +{ + $spacesstringFirst .= " "; + $numberspaces--; +} + +$numberspaces = ($maxwidthprojects - 14 - strlen($persnr)); +$spacesstringSecond = ""; +while ($numberspaces > 0) +{ + $spacesstringSecond .= " "; + $numberspaces--; +} + +$spalte = $zeile = 0; + +//write global header +$lastspalte = ($nrProjects > 0) ? 2 + sizeof($projectnames) * 2 : 14; +$worksheet->setMerge($zeile, $spalte, $zeile + 1, $spalte + 2); +$worksheet->write($zeile, $spalte, $monthtext." ".$year, $format_heading_left); +$worksheet->write($zeile + 1, $spalte, "", $format_heading_left); + +$worksheet->setMerge($zeile, $spalte + 3, $zeile, $lastspalte); +$worksheet->setMerge($zeile + 1, $spalte + 3, $zeile + 1, $lastspalte); +$worksheet->write($zeile, $spalte + 3, "Projektliste gedruckt am:".$spacesstringFirst.$username, $format_heading_right); +$worksheet->write($zeile, $lastspalte, '', $format_heading_right); +$worksheet->write($zeile + 1, $spalte + 3, date('d.m.Y H:i').$spacesstringSecond.'Personal-Nr.:'.$persnr, $format_heading_right_bottomline); +$worksheet->write($zeile + 1, $lastspalte, '', $format_heading_right_bottomline); +$zeile += 3; + +//general options +$worksheet->setLandscape(); +$worksheet->hideGridlines(); +$worksheet->hideScreenGridlines(); + +//write table header +$worksheet->setMerge($zeile, $spalte, $zeile + 1, $spalte + 1); +$worksheet->write($zeile, $spalte, "Tag", $format_bold_centered_alllines); +$worksheet->write($zeile + 1, $spalte++, "", $format_bold_centered_alllines); +$worksheet->setMerge($zeile, ++$spalte, $zeile + 1, $spalte); +$worksheet->write($zeile, $spalte, "Arbeitszeit", $format_bold_centered_alllines); +$worksheet->write($zeile + 1, $spalte, "", $format_bold_centered_alllines); +$spalte++; + +foreach ($projectnames as $project) +{ + $worksheet->setMerge($zeile, $spalte, $zeile, $spalte + 1); + $worksheet->write($zeile, $spalte, $project, $format_bold_centered_toprightline); + $worksheet->write($zeile, $spalte + 1, "", $format_bold_centered_toprightline); + $worksheet->write($zeile + 1, $spalte, "Stunden", $format_bold_centered_bottomline); + $worksheet->write($zeile + 1, $spalte + 1, "Tätigkeit", $format_bold_centered_bottomrightline); + $spalte += 2; +} +$zeile += 2; + +//write table body +for ($daysnmbr = 1; $daysnmbr <= $daysinmonth; $daysnmbr++) +{ + //write day and weekday + $spalte = 0; + $monthstr = ($month < 10) ? '0'.$month : $month; + $daystr = ($daysnmbr < 10) ? '0'.$daysnmbr : $daysnmbr; + $datestring = $year.'-'.$monthstr.'-'.$daystr; + $weekday = substr($tagbez[1][$date->formatDatum($datestring, 'N')], 0, 2); + $worksheet->write($zeile, $spalte++, $weekday, $format_cell_centered_leftline); + $worksheet->write($zeile, $spalte++, $daysnmbr, $format_cell_centered_rightline); + + if (array_key_exists($daysnmbr, $projectlines)) + { + //write worktime + $worksheet->write($zeile, $spalte++, number_format($projectlines[$daysnmbr]->arbeitszeit, 2, ",", "."), $format_cell_centered_rightline); + $spaltetemp = $spalte; + //write projects + foreach ($projectnames as $project) + { + if (array_key_exists($project, $projectlines[$daysnmbr]->projekte)) + { + $worksheet->setColumn($spalte, $spalte, $worktimewidth); + $worksheet->write($zeile, $spalte++, number_format($projectlines[$daysnmbr]->projekte[$project]->stunden, 2, ",", "."), $format_cell_centered_leftline); + $worksheet->setColumn($spalte, $spalte, $projectcolumnwidths[$project]); + $worksheet->write($zeile, $spalte++, $projectlines[$daysnmbr]->projekte[$project]->beschreibung, $format_cell_rightline); + } + else + { + $worksheet->write($zeile, $spalte++, '', $format_cell_centered_leftline); + $worksheet->write($zeile, $spalte++, '', $format_cell_rightline); + } + } + } + else + { + //write empty cells + $worksheet->write($zeile, $spalte, '0,00', $format_cell_centered_rightline); + $toskip = sizeof($projectnames) * 2; + for ($i = 0; $i <= $toskip; $i++) + { + if ($i % 2 == 0) + $worksheet->write($zeile, $spalte++, '', $format_cell_centered_rightline); + else + $worksheet->write($zeile, $spalte++, '', $format_cell_centered); + } + } + $zeile++; +} + +if ($nrProjects < 1) + //no projects - merge all cells and write notice +{ + $worksheet->setMerge(3, 3, 4 + $daysinmonth, $lastspalte); + $worksheet->write(3, 3, "keine Projekte vorhanden", $format_bold_centered_alllines); + $worksheet->write(3, $lastspalte, "", $format_bold_centered_alllines); +} + +//write monthly sums +$spalte = 0; +$worksheet->setMerge($zeile, $spalte, $zeile, $spalte + 1); +$worksheet->write($zeile, $spalte, 'Summe:', $format_bold_centered_alllines); +$spalte += 2; +$worksheet->write($zeile, $spalte++, number_format($monthsums[0], 2, ",", "."), $format_cell_centered_alllines); +foreach ($projectnames as $project) +{ + $worksheet->write($zeile, $spalte++, number_format($monthsums[$project], 2, ",", "."), $format_cell_centered_topbottomleftline); + $worksheet->write($zeile, $spalte++, "", $format_cell_centered_topbottomrightline); +} + +$worksheet->fitToPages(1, 1); +$workbook->close(); + diff --git a/config/cis.config-default.inc.php b/config/cis.config-default.inc.php index 49af7cdd6..063518284 100644 --- a/config/cis.config-default.inc.php +++ b/config/cis.config-default.inc.php @@ -232,4 +232,7 @@ define('CIS_DOKUMENTE_STUDIENBEITRAG_TYPEN', serialize(array("Studiengebuehr"))) //Gibt an bei welcher Länge die LV-Bezeichnungen im Menü abgeschnitten werden. Default: 21 define('CIS_LVMENUE_CUTLENGTH', 21); + +// Gibt an, auf welche Seite TicketIds ala #1234 im Jahresplan verlinkt werden zB zur Verlinkung in Bugtracker +define('JAHRESPLAN_TICKET_LINK','https://bug.technikum-wien.at/otrs/index.pl?Action=AgentTicketZoom;TicketID='); ?> diff --git a/content/fas.xul.php b/content/fas.xul.php index 282a6580a..fd1eb09e9 100644 --- a/content/fas.xul.php +++ b/content/fas.xul.php @@ -109,6 +109,7 @@ foreach($addon_obj->result as $addon) + @@ -357,6 +358,12 @@ foreach($addon_obj->result as $addon) label = "&menu-statistic-notenspiegel-excel.label;" command = "menu-statistic-notenspiegel-excel:command" accesskey = "&menu-statistic-notenspiegel-excel.accesskey;"/> + content/statistik/notenspiegel.php?studiengang_kz='+studiengang_kz+'&semester='+semester+'&typ='+typ+'&orgform='+orgform,'Notenspiegel'); } +// **** +// * Liefert eine HTML Liste mit Uebersicht ueber die eingetragenen Noten +// * Studiengang und optional Semester muss gewaehlt sein. +// **** +function StatistikPrintNotenspiegelErweitert(typ) +{ + tree = document.getElementById('tree-verband'); + + if(tree.currentIndex==-1) + { + alert('Bitte zuerst einen Studiengang auswaehlen'); + return; + } + + //Studiengang und Semester holen + var col; + col = tree.columns ? tree.columns["stg_kz"] : "stg_kz"; + var studiengang_kz=tree.view.getCellText(tree.currentIndex,col); + col = tree.columns ? tree.columns["sem"] : "sem"; + var semester=tree.view.getCellText(tree.currentIndex,col); + col = tree.columns ? tree.columns["tree-verband-col-orgform"] : "tree-verband-col-orgform"; + var orgform=tree.view.getCellText(tree.currentIndex,col); + + window.open('content/statistik/notenspiegel_erweitert.php?studiengang_kz='+studiengang_kz+'&semester='+semester+'&typ='+typ+'&orgform='+orgform,'Notenspiegel'); +} + // **** // * Liefert eine statistik ueber die Anzahl der Interessenten/Bewerber Studenten // **** diff --git a/content/statistik/notenspiegel_erweitert.php b/content/statistik/notenspiegel_erweitert.php new file mode 100644 index 000000000..5975a89ea --- /dev/null +++ b/content/statistik/notenspiegel_erweitert.php @@ -0,0 +1,661 @@ +, + * Andreas Oesterreicher , + * Rudolf Hangl and + * Alexei Karpenko + */ +/** + * Erstellt einen Notenspiegel + * + * Parameter: studiengang_kz ... Studiengang der angezeigt werden soll + * semester ... Semester das angezeigt werden soll + * orgform ... Filter für Organisationsform (VZ | BB | FST | etc) + * typ ... Output format (xls | html) + * + * Listet alle Noten der Studierenden des Studiengangs/Semester im eingestellten Studiensemester + * und berechnet den Notendurchschnitt und gewichteten Notendurchschnitt. + * + * Gewichteter Notendurchschnitt = (Note der LV) * (ECTS der LV) / (Summe aller ECTS) + */ +require_once('../../config/vilesci.config.inc.php'); +require_once('../../include/functions.inc.php'); +require_once('../../include/studiengang.class.php'); +require_once('../../include/person.class.php'); +require_once('../../include/benutzer.class.php'); +require_once('../../include/student.class.php'); +require_once('../../include/prestudent.class.php'); +require_once('../../include/note.class.php'); +require_once('../../include/lehrveranstaltung.class.php'); +require_once('../../include/pruefungstermin.class.php'); +require_once('../../include/benutzerberechtigung.class.php'); +require_once('../../include/Excel/excel.php'); + +$db = new basis_db(); +$user = get_uid(); +loadVariables($user); + +$rechte = new benutzerberechtigung(); +$rechte->getBerechtigungen($user); + +if (!isset($_GET['studiengang_kz'])) + die('Falsche Parameteruebergabe'); +else + $studiengang_kz = $_GET['studiengang_kz']; + +if (!$rechte->isBerechtigt('student/noten', $studiengang_kz, 's')) + die('Sie haben keine Berechtigung fuer diese Seite'); + +$semester = isset($_GET['semester']) ? $_GET['semester'] : ''; +$typ = isset($_GET['typ']) ? $_GET['typ'] : ''; + +if ($semester == '') + die('Bitte ein Semester auswaehlen'); + +$orgform = isset($_GET['orgform']) ? $_GET['orgform'] : ''; + +$stg = new studiengang(); +$stg_arr = array(); +$stg->getAll(false); +foreach ($stg->result as $studiengang) + $stg_arr[$studiengang->studiengang_kz] = $studiengang->kuerzel; + +$stg = new studiengang(); +$stg->load($studiengang_kz); + +$student = new student(); +$result_student = $student->getStudents($studiengang_kz, $semester, null, null, null, $semester_aktuell); +$uids = ''; +foreach ($result_student as $row) +{ + if ($uids != '') + $uids .= ','; + $uids .= $db->db_add_param($row->uid); +} +if ($uids == '') + die('Es befinden sich keine Studierende in diesem Semester'); + +$qry = "SELECT + lehrveranstaltung_id, bezeichnung, studiengang_kz, semester, ects + FROM + lehre.tbl_lehrveranstaltung + WHERE + lehrveranstaltung_id IN + ( + SELECT + distinct lehrveranstaltung_id + FROM + campus.vw_student_lehrveranstaltung, public.tbl_studentlehrverband + WHERE + tbl_studentlehrverband.studiengang_kz=".$db->db_add_param($studiengang_kz, FHC_INTEGER)." AND + tbl_studentlehrverband.semester=".$db->db_add_param($semester, FHC_INTEGER)." AND + vw_student_lehrveranstaltung.studiensemester_kurzbz=".$db->db_add_param($semester_aktuell)." AND + uid=student_uid AND + vw_student_lehrveranstaltung.studiensemester_kurzbz=tbl_studentlehrverband.studiensemester_kurzbz + ) + AND studiengang_kz<>0 + UNION + SELECT + lehrveranstaltung_id, bezeichnung, studiengang_kz, semester, ects + FROM + lehre.tbl_lehrveranstaltung JOIN lehre.tbl_zeugnisnote USING(lehrveranstaltung_id) + WHERE + tbl_lehrveranstaltung.studiengang_kz=".$db->db_add_param($studiengang_kz, FHC_INTEGER)." AND + tbl_zeugnisnote.student_uid in($uids) AND + tbl_zeugnisnote.studiensemester_kurzbz=".$db->db_add_param($semester_aktuell)." + ORDER BY bezeichnung"; + +if (!$result_lva = $db->db_query($qry)) + die('Fehler beim Ermitteln der Lehrveranstaltungen'); + +$noten = new note(); +$noten->getActive(); +$noten_arr = $noten_bezeichnungen = $noten_farben = $noten_positiv = array(); + +$pruefungstermin = new pruefungstermin(); + +$termine = $pruefungstermin->getAllPruefungstypen(false, true); + +$terminbez = 'Termin'; +$kommPruef = 'kommPruef'; +$zusKommPruef = 'zusKommPruef'; + +//null Werte und undefiniert rausfiltern +$termine = array_filter($termine, function ($termin) +{ + return !(is_null($termin->beschreibung) || $termin->pruefungstyp_kurzbz == 'undefiniert'); +}); + +$termineWithSort = array_filter($termine, function ($termin) +{ + return is_numeric($termin->sort); +}); + +$nulltermine = array_filter($termine, function ($termin) +{ + return is_null($termin->sort); +}); + +//keine Werte in sort Spalte - es wird versucht, Reihenfolge aufgrund Strings zu bestimmen +//zuerst Termine 1 - n, dann kommissionelle und zusätzliche kommissionelle +$max = 0; +foreach ($nulltermine as $termin) +{ + if (preg_match('/^'.$terminbez.'\d+$/', $termin->pruefungstyp_kurzbz)) + { + if (preg_match_all('/\d+/', $termin->pruefungstyp_kurzbz, $numbers)) + { + $number = intval(end($numbers[0])); + $termin->sort = $number; + if ($number > $max) + $max = $number; + } + } +} + +foreach ($nulltermine as $termin) +{ + if ($termin->pruefungstyp_kurzbz == $kommPruef || $termin->pruefungstyp_kurzbz == $zusKommPruef) + { + $termin->sort = ++$max; + } +} + +usort($nulltermine, function ($termina, $terminb) +{ + return is_null($termina->sort) ? 1 : (is_null($terminb->sort) ? -1 : $termina->sort - $terminb->sort); +}); + +$termine = array_merge($termineWithSort, $nulltermine); + +//Farben für Prüfungsantritte (1. Termin, 2., kommissionelle...) +$colors = array('ffff00', 'fa9200', 'ff1500', '9400D3', '0000FF', '800000', '305041', '00fff2', '00ff2b'); +$colorsForPositiv = array('ffffff', 'ffdfb3', 'ffb9b3', 'ddb3ff', '7366ff', 'ff9494', '80b39b', 'b3fffb', 'b3ffbf'); + +$counter = 0; +foreach ($termine as $termin) +{ + $terminkurzbz = $termin->pruefungstyp_kurzbz; + $pruefungsart_farben[$terminkurzbz] = $colors[$counter]; + $pruefungsart_farben[$terminkurzbz.'Pos'] = $colorsForPositiv[$counter]; + $counter++; +} + +foreach ($noten->result as $row) +{ + $noten_arr[$row->note] = $row->anmerkung; + $noten_wert[$row->note] = $row->notenwert; + $noten_bezeichnungen[$row->note] = $row->bezeichnung; + $noten_farben[$row->note] = $row->farbe; + $noten_positiv[$row->note] = $row->positiv; +} + +if ($typ == 'xls') +{ + // Creating a workbook + $workbook = new Spreadsheet_Excel_Writer(); + $workbook->setVersion(8); + // sending HTTP headers + $workbook->send("Notenliste_".$semester_aktuell."_".$stg->kuerzel.($semester != '' ? '_'.$semester : '').".xls"); + + // Creating a worksheet + $worksheet =& $workbook->addWorksheet("Notenliste"); + $worksheet->setInputEncoding('utf-8'); + + //Formate Definieren + $format_bold =& $workbook->addFormat(); + $format_bold->setBold(); + $format_bold->setBorder(1); + + $format_bold_wrap =& $workbook->addFormat(); + $format_bold_wrap->setBold(); + $format_bold_wrap->setBorder(1); + $format_bold_wrap->setTextWrap(); + + $format_rotate =& $workbook->addFormat(); + $format_rotate->setTextRotation(270); + $format_rotate->setAlign('center'); + $format_rotate->setBorder(1); + + $format_bold_center =& $workbook->addFormat(); + $format_bold_center->setBold(); + $format_bold_center->setAlign('center'); + $format_bold_center->setBorder(1); + + $format_bold_noborder =& $workbook->addFormat(); + $format_bold_noborder->setBold(); + + $format_number =& $workbook->addFormat(); + $format_number->setNumFormat('0.00'); + $format_number->setBorder(1); + + //Farben ueberschreiben + foreach ($noten_farben as $note => $farbe) + { + if ($farbe != '') + { + $workbook->setCustomColor( + $note + 10, + hexdec(substr($farbe, 0, 2)), + hexdec(substr($farbe, 2, 2)), + hexdec(substr($farbe, 4, 2)) + ); + } + else + { + $workbook->setCustomColor($note + 10, 255, 255, 255); + } + + $format_colored[$note] =& $workbook->addFormat(); + $format_colored[$note]->setFgColor($note + 10); + $format_colored[$note]->setBorder(1); + $format_colored[$note]->setAlign('center'); + } + + $counter = 1; + + foreach ($pruefungsart_farben as $art => $farbe) + { + //eigene Farben für Indizes 40 + definieren + $colornumber = 40 + $counter; + $workbook->setCustomColor( + $colornumber, + hexdec(substr($farbe, 0, 2)), + hexdec(substr($farbe, 2, 2)), + hexdec(substr($farbe, 4, 2)) + ); + $format_colored[$art] =& $workbook->addFormat(); + $format_colored[$art]->setFgColor($colornumber); + $format_colored[$art]->setBorder(1); + $format_colored[$art]->setAlign('center'); + $counter++; + } + + //30 = Grau = Nicht teilgenommen + $workbook->setCustomColor(30, 90, 90, 90); + + $format_colored_nichtzugeteilt =& $workbook->addFormat(); + $format_colored_nichtzugeteilt->setFgColor(30); + $format_colored_nichtzugeteilt->setBorder(1); + $format_colored_nichtzugeteilt->setAlign('center'); + + $format_colored_nichteingetragen =& $workbook->addFormat(); + $format_colored_nichteingetragen->setFgColor(19); + $format_colored_nichteingetragen->setBorder(1); + $format_colored_nichteingetragen->setAlign('center'); + + $spalte = 0; + $zeile = 1; + + $worksheet->write($zeile, $spalte, 'Nachname', $format_bold); + $maxlength[$spalte] = 10; + $worksheet->write($zeile, ++$spalte, 'Vorname', $format_bold); + $maxlength[$spalte] = 10; + $worksheet->write($zeile, ++$spalte, 'Personenkennzeichen', $format_bold); + $maxlength[$spalte] = 32; + $maxheaderheight = 20; + + while ($row_lva = $db->db_fetch_object($result_lva)) + { + $value = $stg_arr[$row_lva->studiengang_kz].$row_lva->semester.' '.$row_lva->bezeichnung.' ('.$row_lva->ects.' ECTS)'; + $worksheet->write($zeile, ++$spalte, $value, $format_rotate); + $maxlength[$spalte] = 3; + + if (mb_strlen($value) > $maxheaderheight) + $maxheaderheight = mb_strlen($value); + } + $anzahl_lvspalten = $spalte - 2; + + $worksheet->write($zeile, ++$spalte, 'Notendurchschnitt', $format_bold); + $maxlength[$spalte] = 15; + $worksheet->write($zeile, ++$spalte, "Gewichteter\nNotendurchschnitt", $format_bold_wrap); + $maxlength[$spalte] = 15; + + $anzahl_lv = array(); + $summe_lv = array(); + $summegewichtet = 0; + $anzahlgewichtet = 0; + foreach ($result_student as $row_student) + { + if ($orgform != '') + { + //Wenn der Student nicht die passende orgform hat (VZ,BB,FST, etc) + //dann nicht anzeigen + $prestudent = new prestudent(); + $prestudent->getLastStatus($row_student->prestudent_id); + + if ($prestudent->orgform_kurzbz != $orgform) + continue; + } + $zeile++; + $spalte = 0; + + $worksheet->write($zeile, $spalte, $row_student->nachname, $format_bold); + if ($maxlength[$spalte] < strlen($row_student->nachname)) + $maxlength[$spalte] = strlen($row_student->nachname); + $worksheet->write($zeile, ++$spalte, $row_student->vorname, $format_bold); + if ($maxlength[$spalte] < strlen($row_student->vorname)) + $maxlength[$spalte] = strlen($row_student->vorname); + $worksheet->write($zeile, ++$spalte, $row_student->matrikelnr, $format_bold); + + //Alle Zeugnisnoten des Studierenden holen + $noten = array(); + $qry = "SELECT * FROM lehre.tbl_zeugnisnote WHERE student_uid=".$db->db_add_param($row_student->uid)." AND studiensemester_kurzbz=".$db->db_add_param($semester_aktuell); + if ($result = $db->db_query($qry)) + while ($row = $db->db_fetch_object($result)) + $noten[$row->lehrveranstaltung_id] = $row->note; + + //Zu jeder Lehrveranstaltungsnote Prüfungstyp (Anzahl der Antritte) holen + $pruefungstypen = array(); + $qry = "SELECT tbl_lehrveranstaltung.lehrveranstaltung_id, pruefungstyp_kurzbz, sort, datum + FROM + lehre.tbl_pruefung + JOIN + lehre.tbl_lehreinheit using(lehreinheit_id) + JOIN + lehre.tbl_lehrveranstaltung using(lehrveranstaltung_id) + WHERE + student_uid=".$db->db_add_param($row_student->uid)." AND studiensemester_kurzbz=".$db->db_add_param($semester_aktuell)." + ORDER BY lehrveranstaltung_id, sort, datum"; + if ($result = $db->db_query($qry)) + { + while ($row = $db->db_fetch_object($result)) + { + $pruefungstypen[$row->lehrveranstaltung_id] = $row->pruefungstyp_kurzbz; + } + } + + //Alle LVs holen zu denen der Studierende zugeteilt ist + $zugeteilte_lvs = array(); + $qry = "SELECT distinct lehrveranstaltung_id + FROM + campus.vw_student_lehrveranstaltung + WHERE + uid=".$db->db_add_param($row_student->uid)." AND + studiensemester_kurzbz=".$db->db_add_param($semester_aktuell); + + if ($result = $db->db_query($qry)) + while ($row = $db->db_fetch_object($result)) + $zugeteilte_lvs[] = $row->lehrveranstaltung_id; + + $anzahl = 0; + $summe = 0; + $rowcount = 0; + $summeects = 0; + $gewichtetenote = 0; + + while ($rowcount < $db->db_num_rows($result_lva)) + { + $row_lva = $db->db_fetch_object($result_lva, $rowcount); + $rowcount++; + //wenn es eine Note gibt + if (isset($noten[$row_lva->lehrveranstaltung_id])) + { + $note = $noten[$row_lva->lehrveranstaltung_id]; + $format = 0; + + //wenn für die LV der Studierende eine Nachprüfung hat (z.B. 2 Termin, kommissionelle...) + if (isset($pruefungstypen[$row_lva->lehrveranstaltung_id])) + { + $pruefungstyp = $pruefungstypen[$row_lva->lehrveranstaltung_id]; + if (isset($format_colored[$pruefungstyp])) + { + //wenn es eine Farbe für die Art der Nachprüfung gibt, diese verwenden (positiv oder negativ) + $format = ($noten_positiv[$note]) ? $format_colored[$pruefungstyp."Pos"] : $format_colored[$pruefungstyp]; + } + } + //keine Nachprüfung aber negativ - 1. Antritt Farbe wenn es eine Notenanmerkung gibt + elseif (!$noten_positiv[$note] && $noten_arr[$note] != '' && isset($noten_arr[$note])) + { + reset($pruefungsart_farben); + $format = $format_colored[key($pruefungsart_farben)]; + } + elseif (isset($format_colored[$note])) + $format = $format_colored[$note]; + + $worksheet->write($zeile, ++$spalte, $noten_arr[$note], $format); + + if ($noten_wert[$noten[$row_lva->lehrveranstaltung_id]] != '') + { + if (!isset($summe_lv[$row_lva->lehrveranstaltung_id])) + { + $summe_lv[$row_lva->lehrveranstaltung_id] = 0; + $anzahl_lv[$row_lva->lehrveranstaltung_id] = 0; + } + $summe_lv[$row_lva->lehrveranstaltung_id] += $noten_wert[$noten[$row_lva->lehrveranstaltung_id]]; + $anzahl_lv[$row_lva->lehrveranstaltung_id]++; + $summe += $noten_wert[$noten[$row_lva->lehrveranstaltung_id]]; + if (is_numeric($row_lva->ects)) + { + $gewichtetenote += $noten_wert[$noten[$row_lva->lehrveranstaltung_id]] * $row_lva->ects; + $summeects += $row_lva->ects; + } + $anzahl++; + } + } + else + { + //Keine Note fuer diese LV vorhanden + if (in_array($row_lva->lehrveranstaltung_id, $zugeteilte_lvs)) + { + $worksheet->write($zeile, ++$spalte, '', $format_colored_nichteingetragen); + } + else + { + $worksheet->write($zeile, ++$spalte, '', $format_colored_nichtzugeteilt); + } + } + } + + if ($anzahl != 0) + $schnitt = $summe / $anzahl; + else + $schnitt = 0; + + if ($summeects != 0) + $gewichtetenote /= $summeects; + + $worksheet->write($zeile, ++$spalte, sprintf("%.2f", $schnitt), $format_number); + $worksheet->write($zeile, ++$spalte, sprintf("%.2f", $gewichtetenote), $format_number); + if ($gewichtetenote != 0) + { + $summegewichtet += $gewichtetenote; + $anzahlgewichtet++; + } + } + $zeile++; + $spalte = 2; + $worksheet->write($zeile, $spalte, 'Notendurchschnitt', $format_bold); + + $summe_schnitt = 0; + $anzahl_schnitt = 0; + $rowcount = 0; + while ($rowcount < $db->db_num_rows($result_lva)) + { + $row_lva = $db->db_fetch_object($result_lva, $rowcount); + $rowcount++; + if (isset($summe_lv[$row_lva->lehrveranstaltung_id])) + { + if ($anzahl_lv[$row_lva->lehrveranstaltung_id] != 0) + $schnitt = $summe_lv[$row_lva->lehrveranstaltung_id] / $anzahl_lv[$row_lva->lehrveranstaltung_id]; + else + $schnitt = 0; + } + else + $schnitt = 0; + if ($schnitt != 0) + { + $summe_schnitt += $schnitt; + $anzahl_schnitt++; + } + $worksheet->write($zeile, ++$spalte, sprintf("%.2f", $schnitt), $format_number); + } + + if ($anzahl_schnitt != 0) + $schnitt = $summe_schnitt / $anzahl_schnitt; + else + $schnitt = 0; + $worksheet->write($zeile, ++$spalte, sprintf("%.2f", $schnitt), $format_number); + if ($anzahlgewichtet != 0) + $summegewichtet = $summegewichtet / $anzahlgewichtet; + $worksheet->write($zeile, ++$spalte, sprintf("%.2f", $summegewichtet), $format_number); + + $zeile += 5; + $legendzeile = $zeile; + $startcolumn = 2; + + //Farblegende + $bezeichnungen = array(); + foreach ($termine as $termin) + $bezeichnungen[$termin->pruefungstyp_kurzbz] = $termin->beschreibung; + + $totalmergefarb = 4; + + $worksheet->write($legendzeile, $startcolumn, "Farblegende Prüfungsantritte", $format_bold_center); + $worksheet->setMerge($legendzeile, $startcolumn, $legendzeile, $startcolumn + $totalmergefarb); + //In manchen Excelversionen wird border nicht dargestellt -> alle verbundenen zellen nachformatieren + for($i = 1; $i <= $totalmergefarb; $i++) + $worksheet->write($legendzeile, $startcolumn + $i, "", $format_bold_center); + $legendzeile++; + $worksheet->write($legendzeile, $startcolumn, "Termin", $format_bold_center); + $worksheet->setMerge($legendzeile, $startcolumn + 1, $legendzeile, $startcolumn + 2); + $worksheet->write($legendzeile, $startcolumn + 1, "positiv", $format_bold_center); + $worksheet->write($legendzeile, $startcolumn + 2, "", $format_bold_center); + $worksheet->setMerge($legendzeile, $startcolumn + 3, $legendzeile, $startcolumn + 4); + $worksheet->write($legendzeile, $startcolumn + 3, "negativ", $format_bold_center); + $worksheet->write($legendzeile, $startcolumn + 4, "", $format_bold_center); + $legendzeile++; + foreach ($bezeichnungen as $name => $bezeichnung) + { + if (strstr($bezeichnung, PHP_EOL)) + $worksheet->setRow($legendzeile, 25); + $worksheet->write($legendzeile, $startcolumn, $bezeichnung, $format_bold); + $worksheet->setMerge($legendzeile, $startcolumn + 1, $legendzeile, $startcolumn + 2); + $worksheet->write($legendzeile, $startcolumn + 1, "", $format_colored[$name.'Pos']); + $worksheet->write($legendzeile, $startcolumn + 2, "", $format_colored[$name.'Pos']); + $worksheet->setMerge($legendzeile, $startcolumn + 3, $legendzeile, $startcolumn + 4); + $worksheet->write($legendzeile, $startcolumn + 3, "", $format_colored[$name]); + $worksheet->write($legendzeile, $startcolumn + 4, "", $format_colored[$name]); + $legendzeile++; + } + $worksheet->write($legendzeile, $startcolumn, "nicht eingetragen", $format_bold); + $worksheet->setMerge($legendzeile, $startcolumn + 1, $legendzeile, $startcolumn + 4); + for($i = 1; $i <= $totalmergefarb; $i++) + $worksheet->write($legendzeile, $startcolumn + $i, "", $format_colored_nichteingetragen); + $legendzeile++; + $worksheet->write($legendzeile, $startcolumn, "nicht zugeteilt", $format_bold); + $worksheet->setMerge($legendzeile, $startcolumn + 1, $legendzeile, $startcolumn + 4); + for($i = 1; $i <= $totalmergefarb; $i++) + $worksheet->write($legendzeile, $startcolumn + $i, "", $format_colored_nichtzugeteilt); + + $startcolumn = $currentcolumn = 9; + + //Notenlegende + //optimale Länge in kleinsten Einheiten - Notenspalten + $optimalLengthBeschr = 6; + $groesse = $toMerge = 0; + $beschrColumnMerges = array(0, 0); + $index = 0; + + foreach ($beschrColumnMerges as $toMerge) + { + $groesse = 0; + while ($groesse < $optimalLengthBeschr) + { + if ($currentcolumn < 3 + $anzahl_lvspalten) + { + $groesse++; + } + elseif ($currentcolumn < 3 + $anzahl_lvspalten + 2) + { + $groesse += 4; + } + else + { + $groesse += 2; + } + $currentcolumn++; + $beschrColumnMerges[$index]++; + } + $currentcolumn++; + $index++; + } + + // all merges for 4 columns of Notenlegende + $allmerges = array($beschrColumnMerges[0], 1, $beschrColumnMerges[1], 1); + $headingmerge = array_sum($allmerges) - 1; + $positivmerge = $allmerges[0] + $allmerges[1] - 1; + $negativmerge = $allmerges[1] + $allmerges[2] - 1; + + $worksheet->setMerge($zeile, $startcolumn, $zeile, $startcolumn + $headingmerge); + $worksheet->write($zeile, $startcolumn, "Notenlegende", $format_bold_center); + for($i = 1; $i < $headingmerge; $i++) + $worksheet->write($zeile, $startcolumn + $i, "", $format_bold_center); + $worksheet->write($zeile++, $startcolumn + $headingmerge, "", $format_bold_center); + $worksheet->setMerge($zeile, $startcolumn, $zeile, $startcolumn + $positivmerge); + $worksheet->write($zeile, $startcolumn, "positiv", $format_bold_center); + for($i = 1; $i <= $positivmerge; $i++) + $worksheet->write($zeile, $startcolumn + $i, "", $format_bold_center); + $worksheet->setMerge($zeile, $startcolumn + $positivmerge + 1, $zeile, $startcolumn + $headingmerge); + $worksheet->write($zeile, $startcolumn + $positivmerge + 1, "negativ", $format_bold_center); + for($i = 1; $i <= $negativmerge; $i++) + $worksheet->write($zeile, $startcolumn + $positivmerge + $i + 1, "", $format_bold_center); + $worksheet->write($zeile++, $startcolumn + $headingmerge, "", $format_bold_center); + $tempzeile = $zeile; + foreach ($noten_arr as $note => $anmerkung) + { + if (is_null($noten_bezeichnungen[$note]) || $noten_bezeichnungen[$note] == "" || is_null($anmerkung) || $anmerkung == "") + continue; + if ($noten_positiv[$note]) + { + $worksheet->setMerge($zeile, $startcolumn, $zeile, $startcolumn + $positivmerge - 1); + $worksheet->write($zeile, $startcolumn, $noten_bezeichnungen[$note], $format_bold); + for($i = 1; $i <= $positivmerge; $i++) + $worksheet->write($zeile, $startcolumn + $i, "", $format_bold_center); + $worksheet->write($zeile++, $startcolumn + $positivmerge, $anmerkung, $format_bold_center); + } + else + { + $worksheet->setMerge($tempzeile, $startcolumn + $positivmerge + 1, $tempzeile, $startcolumn + $headingmerge - 1); + $worksheet->write($tempzeile, $startcolumn + $positivmerge + 1, $noten_bezeichnungen[$note], $format_bold); + for($i = 1; $i <= $negativmerge; $i++) + $worksheet->write($tempzeile, $startcolumn + $positivmerge + $i + 1, "", $format_bold_center); + $worksheet->write($tempzeile++, $startcolumn + $headingmerge, $anmerkung, $format_bold_center); + } + } + + //Die Breite der Spalten setzen + foreach ($maxlength as $i => $breite) + $worksheet->setColumn($i, $i, $breite + 2); + + $worksheet->write(0, 0, $semester_aktuell." ".$stg->kuerzel.($semester != '' ? ' '.$semester.'. Semester' : '').' Stand: '.date('d.m.Y'), $format_bold_center); + //Zellen der 1. Zeile verbinden + $worksheet->setMerge(0, 0, 0, $spalte); + + //Alle verbundenen Zellen formatieren - in best. Excelversionen border sonst falsch + for($i = 1; $i <= $spalte; $i++) + $worksheet->write(0, $i, "", $format_bold_center); + + //Hoehe der 2. Zeile anpassen damit die LVs alle sichtbar sind + $worksheet->setRow(1, $maxheaderheight * 5); + + //Ausdruck auf 1 Seite anpassen + $worksheet->fitToPages(1, 1); + $workbook->close(); +} + diff --git a/include/cronjob.class.php b/include/cronjob.class.php index 7848e07dd..e892e55a0 100644 --- a/include/cronjob.class.php +++ b/include/cronjob.class.php @@ -364,6 +364,11 @@ class cronjob extends basis_db public function execute() { $return = true; + if($this->running) + { + $this->errormsg = 'Job kann nicht ausgefuehrt werden, da er bereits laeuft'; + return false; + } if($this->standalone && $this->isJobRunning()) { $this->errormsg = 'Job kann nicht ausgefuehrt werden, da noch ein anderer Job laeuft'; diff --git a/include/datum.class.php b/include/datum.class.php index 7440e9960..1206ae6f0 100644 --- a/include/datum.class.php +++ b/include/datum.class.php @@ -240,26 +240,31 @@ class datum /** * Subtrahiert 2 Zeiten ($zeit1-$zeit2) Stunde:Minute * Es liefert keine Uhrzeit zurueck sondern Stunden und Minuten - * zB 12:10 + 23:15 = 35:25 + * zB 23:15 - 12:10 = 11:05 * * @param $zeit1 * @param $zeit2 - * @return subtraktion der beiden zeiten im Format Stunden:Minuten + * @return subtraktion der beiden zeiten im Format Stunden:Minuten, null wenn zeit 1 kleiner als zeit2 ist */ public function subZeit($zeit1, $zeit2) { list($h1, $m1) = explode(':', $zeit1); list($h2, $m2) = explode(':', $zeit2); + if($h1<$h2) + return null; + else if($h1 == $h2 && $m1<$m2) + return null; + $m1 -=$m2; //echo $h1.','.$m1.','.$h2.','.$m2; - if($m1>=60) + if($m1<0) { - $uebertrag = (int)($m1/60); - $h1+= $uebertrag; + $m1 = $m1 + 60; + $h1 = (int)$h1-1; } $m1=$m1%60; - $h1+=-$h2; + $h1-=$h2; if($m1<10) $m1='0'.$m1; if($h1<10) @@ -381,5 +386,15 @@ class datum return false; } + /** + * konvertiert Zeit in format stunden:minuten in Stunden als Dezimalahl + * @param $timestring in Form stunden:minuten + * @return int Stundenzahl als Dezimalzahl + */ + public function convertTimeStringToHours($timestring) + { + return intval(substr($timestring, 0, 2)) + intval(substr($timestring, 3, 2)) / 60; + } + } ?> diff --git a/include/dokument.class.php b/include/dokument.class.php index 04c6e2189..1b8514c9e 100644 --- a/include/dokument.class.php +++ b/include/dokument.class.php @@ -670,7 +670,7 @@ class dokument extends basis_db $bezeichnung_mehrsprachig = $sprache->getSprachQuery('bezeichnung_mehrsprachig'); $dokumentbeschreibung_mehrsprachig = $sprache->getSprachQuery('dokumentbeschreibung_mehrsprachig'); $beschreibung_mehrsprachig = $sprache->getSprachQuery('beschreibung_mehrsprachig'); - $qry = "SELECT distinct on (dokument_kurzbz) dokument_kurzbz, bezeichnung, pflicht, nachreichbar, ausstellungsdetails, + $qry = "SELECT distinct on (dokument_kurzbz) dokument_kurzbz, bezeichnung, pflicht, nachreichbar, ausstellungsdetails, $bezeichnung_mehrsprachig, $dokumentbeschreibung_mehrsprachig, $beschreibung_mehrsprachig FROM public.tbl_dokumentstudiengang JOIN public.tbl_prestudent using (studiengang_kz) @@ -722,7 +722,7 @@ class dokument extends basis_db $dokumentbeschreibung_mehrsprachig = $sprache->getSprachQuery('dokumentbeschreibung_mehrsprachig'); $beschreibung_mehrsprachig = $sprache->getSprachQuery('beschreibung_mehrsprachig'); - $qry = " SELECT DISTINCT dokument_kurzbz, studiengang_kz, ausstellungsdetails, + $qry = " SELECT DISTINCT dokument_kurzbz, studiengang_kz, ausstellungsdetails, $dokumentbeschreibung_mehrsprachig, $beschreibung_mehrsprachig FROM public.tbl_dokumentstudiengang JOIN public.tbl_dokument using (dokument_kurzbz) diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 624866ad0..3b5b76b21 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -48,7 +48,13 @@ class dokument_export exec('unoconv --version',$ret_arr); if(isset($ret_arr[0])) - $this->unoconv_version = explode(' ',$ret_arr[0])[1]; + { + $hlp = explode(' ',$ret_arr[0]); + if(isset($hlp[1])) + $this->unoconv_version = $hlp[1]; + else + die('Could not get Unoconv Version'); + } else die('Unoconv not found'); @@ -411,7 +417,11 @@ class dokument_export } } else + { + // Remove UTF8 Control Characters (breaking XML) + $value = preg_replace('/[\x00-\x1F\x7F]/u', '', $value); $_xml_data->addChild("$key",htmlspecialchars("$value")); + } } return $_xml_data->asXML(); } diff --git a/include/functions.inc.php b/include/functions.inc.php index d63aa8f5f..ed3175b5a 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -320,7 +320,10 @@ function loadVariables($user) if (!isset($emailadressentrennzeichen)) { global $emailadressentrennzeichen; - $emailadressentrennzeichen=','; + if(defined('DEFAULT_EMAILADRESSENTRENNZEICHEN')) + $emailadressentrennzeichen = DEFAULT_EMAILADRESSENTRENNZEICHEN; + else + $emailadressentrennzeichen=','; } if(!isset($alle_unr_mitladen)) @@ -1066,7 +1069,7 @@ function cutString($string, $limit, $placeholderSign = '', $keepFilextension = f { return '$placeholderSign must not be shorter than $limit'; } - + if(strlen($string) > ($limit - $offset)) { return substr($string, 0, ($limit - $offset)).$placeholderSign.$extension; @@ -1076,4 +1079,10 @@ function cutString($string, $limit, $placeholderSign = '', $keepFilextension = f return $string; } } + +function PersonLog($ci, $person_id, $logtype_kurzbz, $logdata, $app, $oe_kurzbz = null, $user=null) +{ + $ci->load->library('PersonLogLib'); + $ci->personloglib->log($person_id, $logtype_kurzbz, $logdata, $app, $oe_kurzbz, $user); +} ?> diff --git a/include/note.class.php b/include/note.class.php index 6c119cae9..b10753beb 100644 --- a/include/note.class.php +++ b/include/note.class.php @@ -36,9 +36,9 @@ class note extends basis_db public $bezeichnung; // varchar(32) public $anmerkung; // varchar(256) public $farbe; // varchar(6) - public $positiv=true; // boolean - public $notenwert; // boolean - public $aktiv; // boolean + public $positiv=true; // boolean + public $notenwert; // boolean + public $aktiv; // boolean public $lehre; // boolean /** @@ -75,10 +75,10 @@ class note extends basis_db $this->note = $row->note; $this->bezeichnung = $row->bezeichnung; $this->anmerkung = $row->anmerkung; - $this->farbe = $row->farbe; + $this->farbe = $row->farbe; $this->notenwert = $row->notenwert; - $this->positiv = $this->db_parse_bool($row->positiv); - $this->lehre = $this->db_parse_bool($row->lehre); + $this->positiv = $this->db_parse_bool($row->positiv); + $this->lehre = $this->db_parse_bool($row->lehre); $this->aktiv = $this->db_parse_bool($row->aktiv); return true; } @@ -130,10 +130,10 @@ class note extends basis_db $this->db_add_param($this->note).', '. $this->db_add_param($this->bezeichnung).', '. $this->db_add_param($this->anmerkung).', '. - $this->db_add_param($this->positiv, FHC_BOOLEAN).','. - $this->db_add_param($this->notenwert).','. - $this->db_add_parma($this->aktiv, FHC_BOOLEAN).','. - $this->db_add_param($htis->lehre, FHC_BOOLEAN).');'; + $this->db_add_param($this->positiv, FHC_BOOLEAN).','. + $this->db_add_param($this->notenwert).','. + $this->db_add_param($this->aktiv, FHC_BOOLEAN).','. + $this->db_add_param($this->lehre, FHC_BOOLEAN).');'; } else { @@ -141,9 +141,9 @@ class note extends basis_db 'note='.$this->db_add_param($this->note).', '. 'bezeichnung='.$this->db_add_param($this->bezeichnung).', '. 'anmerkung='.$this->db_add_param($this->anmerkung).', '. - 'positiv='.$this->db_add_param($this->positiv, FHC_BOOLEAN).', '. - 'notenwert='.$this->db_add_param($this->notenwert).', '. - 'aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).', '. + 'positiv='.$this->db_add_param($this->positiv, FHC_BOOLEAN).', '. + 'notenwert='.$this->db_add_param($this->notenwert).', '. + 'aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).', '. 'lehre='.$this->db_add_param($this->lehre, FHC_BOOLEAN).' '. 'WHERE note='.$this->db_add_param($this->note).';'; } @@ -158,15 +158,21 @@ class note extends basis_db return false; } } - + /** - * Laedt alle Noten + * Laedt alle Noten, inklusive inaktiven Noten + * @param null $offiziell wenn true, werden nur Noten, die auf offiziellen Dokumenten gedruckt weden können, geladen * @return true wenn ok, false wenn Fehler - */ - public function getAll() + */ + public function getAll($offiziell = null) { - $qry = "SELECT * FROM lehre.tbl_note ORDER BY note"; - + $qry = "SELECT * FROM lehre.tbl_note"; + + if(is_bool($offiziell)) + $qry .= " WHERE offiziell = ".$this->db_add_param($offiziell, FHC_BOOLEAN); + + $qry .= " ORDER BY note"; + if($this->db_query($qry)) { while($row = $this->db_fetch_object()) @@ -177,9 +183,50 @@ class note extends basis_db $n->bezeichnung = $row->bezeichnung; $n->anmerkung = $row->anmerkung; $n->farbe = $row->farbe; - $n->positiv = $this->db_parse_bool($row->positiv); - $n->notenwert = $row->notenwert; - $n->aktiv = $this->db_parse_bool($row->aktiv); + $n->positiv = $this->db_parse_bool($row->positiv); + $n->notenwert = $row->notenwert; + $n->aktiv = $this->db_parse_bool($row->aktiv); + $n->lehre = $this->db_parse_bool($row->lehre); + + $this->result[] = $n; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + + /** + * Laedt alle aktive Noten + * @param null $offiziell wenn true, werden nur Noten, die auf offiziellen Dokumenten gedruckt weden können, geladen + * @return true wenn ok, false wenn Fehler + */ + public function getActive($offiziell = null) + { + $qry = "SELECT * FROM lehre.tbl_note WHERE aktiv = TRUE"; + + + if(is_bool($offiziell)) + $qry .= " AND offiziell = ".$this->db_add_param($offiziell, FHC_BOOLEAN); + + $qry .= " ORDER BY note"; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $n = new note(); + + $n->note = $row->note; + $n->bezeichnung = $row->bezeichnung; + $n->anmerkung = $row->anmerkung; + $n->farbe = $row->farbe; + $n->positiv = $this->db_parse_bool($row->positiv); + $n->notenwert = $row->notenwert; + $n->aktiv = $this->db_parse_bool($row->aktiv); $n->lehre = $this->db_parse_bool($row->lehre); $this->result[] = $n; diff --git a/include/pruefungstermin.class.php b/include/pruefungstermin.class.php index c3ff1badb..74222cceb 100644 --- a/include/pruefungstermin.class.php +++ b/include/pruefungstermin.class.php @@ -104,19 +104,22 @@ class pruefungstermin extends basis_db{ } } - - /** - * Lädt alle Prüfungstypen aus der Datenbank - * @return Array/Boolean Ein Array mit den Daten, wenn ok; ansonsten false - */ - public function getAllPruefungstypen($abschluss = null) + + /** + * Lädt alle Prüfungstypen aus der Datenbank + * @param null $abschluss gibt an, ob Abschlussprüfungen ausgegeben werden sollen. default: Abschlussprüfungen und andere Prüfungen + * @return array /Boolean Ein Array mit den Daten, wenn ok; ansonsten false + */ + public function getAllPruefungstypen($abschluss = null, $sort = false) { $qry = 'SELECT * FROM lehre.tbl_pruefungstyp'; - if(!is_null($abschluss)) + if(is_bool($abschluss)) { - $qry .= ' WHERE abschluss='.$this->db_add_param($abschluss); + $qry .= ' WHERE abschluss='.$this->db_add_param($abschluss, FHC_BOOLEAN); } + if($sort) + $qry .= ' ORDER BY (sort IS NULL), sort, pruefungstyp_kurzbz'; $qry .=';'; if($this->db_query($qry)) @@ -128,6 +131,7 @@ class pruefungstermin extends basis_db{ $obj->pruefungstyp_kurzbz = $row->pruefungstyp_kurzbz; $obj->beschreibung = $row->beschreibung; $obj->abschluss = $row->abschluss; + $obj->sort = $row->sort; array_push($result, $obj); } } @@ -137,7 +141,6 @@ class pruefungstermin extends basis_db{ return false; } return $result; - } /** diff --git a/include/service.class.php b/include/service.class.php old mode 100644 new mode 100755 index 3a080026d..0caaf64f6 --- a/include/service.class.php +++ b/include/service.class.php @@ -200,11 +200,11 @@ class service extends basis_db WHERE tbl_zeitaufzeichnung.uid=".$this->db_add_param($user)." $zeit GROUP BY tbl_service.service_id HAVING COUNT(*) > $anzahl_ereignisse - + UNION SELECT tbl_service.*, '0' AS anzahl FROM public.tbl_service - + ORDER BY count DESC,bezeichnung,oe_kurzbz"; if($result = $this->db_query($qry)) @@ -254,7 +254,7 @@ class service extends basis_db if (!is_null($content_id) && is_numeric($content_id)) $qry.= ' AND content_id='.$this->db_add_param($content_id); elseif ($content_id==true) - $qry.= ' AND content_id IS NOT NULL'; + $qry.= ' AND (content_id IS NOT NULL OR ext_id IS NOT NULL)'; else $qry.= ''; @@ -363,12 +363,13 @@ class service extends basis_db if($new) { - $qry = "BEGIN;INSERT INTO public.tbl_service (bezeichnung, beschreibung, oe_kurzbz, content_id, design_uid, betrieb_uid, operativ_uid) + $qry = "BEGIN;INSERT INTO public.tbl_service (bezeichnung, beschreibung, oe_kurzbz, content_id, ext_id, design_uid, betrieb_uid, operativ_uid) VALUES(". $this->db_add_param($this->bezeichnung).','. $this->db_add_param($this->beschreibung).','. $this->db_add_param($this->oe_kurzbz).','. $this->db_add_param($this->content_id).','. + $this->db_add_param($this->ext_id).','. $this->db_add_param($this->design_uid).','. $this->db_add_param($this->betrieb_uid).','. $this->db_add_param($this->operativ_uid).');'; @@ -380,6 +381,7 @@ class service extends basis_db ' beschreibung = '.$this->db_add_param($this->beschreibung).','. ' oe_kurzbz = '.$this->db_add_param($this->oe_kurzbz).','. ' content_id = '.$this->db_add_param($this->content_id).','. + ' ext_id = '.$this->db_add_param($this->ext_id).','. ' design_uid = '.$this->db_add_param($this->design_uid).','. ' betrieb_uid = '.$this->db_add_param($this->betrieb_uid).','. ' operativ_uid = '.$this->db_add_param($this->operativ_uid). diff --git a/include/studienplan.class.php b/include/studienplan.class.php index d7833837a..1988edddd 100644 --- a/include/studienplan.class.php +++ b/include/studienplan.class.php @@ -538,9 +538,9 @@ class studienplan extends basis_db $this->db_add_param($this->studienplan_lehrveranstaltung_id_parent, FHC_INTEGER) . ', ' . $this->db_add_param($this->pflicht, FHC_BOOLEAN) . ', ' . $this->db_add_param($this->koordinator) . ', ' . - $this->db_add_param($this->curriculum) . ', ' . - $this->db_add_param($this->export) . ', ' . - $this->db_add_param($this->genehmigung) . ', ' . + $this->db_add_param($this->curriculum, FHC_BOOLEAN) . ', ' . + $this->db_add_param($this->export, FHC_BOOLEAN) . ', ' . + $this->db_add_param($this->genehmigung, FHC_BOOLEAN) . ', ' . 'now(), ' . $this->db_add_param($this->insertvon) . ');'; } diff --git a/index.ci.php b/index.ci.php index f6905f940..043acb111 100644 --- a/index.ci.php +++ b/index.ci.php @@ -54,7 +54,7 @@ * NOTE: If you change these, also change the error_reporting() code below * */ - + define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); /* @@ -102,7 +102,7 @@ switch (ENVIRONMENT) * as this file. * */ - $system_path = 'vendor/codeigniter/framework/system'; + $system_path = dirname(__FILE__).'/vendor/codeigniter/framework/system'; /* *--------------------------------------------------------------- @@ -118,7 +118,7 @@ switch (ENVIRONMENT) * NO TRAILING SLASH! * */ - $application_folder = 'application'; + $application_folder = dirname(__FILE__).'/application'; /* *--------------------------------------------------------------- @@ -308,4 +308,3 @@ include_once 'vendor/autoload.php'; // Now the bootstrap file require_once BASEPATH.'core/CodeIgniter.php'; - diff --git a/locale/de-AT/fas.dtd b/locale/de-AT/fas.dtd index 03b9966f4..11c8dd171 100644 --- a/locale/de-AT/fas.dtd +++ b/locale/de-AT/fas.dtd @@ -106,6 +106,10 @@ + + + + diff --git a/locale/de-AT/mailverteiler.php b/locale/de-AT/mailverteiler.php index e45e6cb85..73ebfc052 100644 --- a/locale/de-AT/mailverteiler.php +++ b/locale/de-AT/mailverteiler.php @@ -19,9 +19,10 @@ $this->phrasen['mailverteiler/mailverteiler']='Mailverteiler'; $this->phrasen['mailverteiler/oeffnenEinesVerteilers']='Öffnen eines Mailverteilers'; $this->phrasen['mailverteiler/status']='Status'; $this->phrasen['mailverteiler/geoeffnet']='Geöffnet'; -$this->phrasen['mailverteiler/klickenZumSchicken']='Um ein Mail an den Verteiler zu senden klicken Sie bitte auf den obigen Link. Ihr Mailprogramm öffnet automatisch eine Vorlage für ein neues Mail, welche bereits die korrekte Adresse enthält.'; +$this->phrasen['mailverteiler/klickenZumSchicken']='Um ein Mail an den Verteiler zu senden klicken Sie bitte auf den angezeigten Link. Ihr Mailprogramm öffnet automatisch eine Vorlage für ein neues Mail, welche bereits die korrekte Adresse enthält.'; $this->phrasen['mailverteiler/infoBenutzung']='Das Senden ist für den Zeitraum von 2 Stunden bzw. für die einmalige Benutzung unter der Adresse %1$s möglich.'; $this->phrasen['mailverteiler/bestaetigeOeffnen']='Bitte bestätigen Sie das Öffnen des Verteilers %1$s'; $this->phrasen['mailverteiler/bestaetige']='Bestätige'; $this->phrasen['mailverteiler/personenImVerteiler']='Personen im Mailverteiler'; +$this->phrasen['mailverteiler/oeffnenFehlgeschlagen']='Beim Freischalten des Verteilers ist ein Fehler aufgetreten.
Bitte Informieren Sie den Administrator'; ?> diff --git a/locale/de-AT/services.php b/locale/de-AT/services.php old mode 100644 new mode 100755 index bf77adbfd..1b03bc956 --- a/locale/de-AT/services.php +++ b/locale/de-AT/services.php @@ -4,7 +4,7 @@ $this->phrasen['services/uebersichtUeberServicesOrganisationseinheiten']='Übers $this->phrasen['services/details']='Details'; $this->phrasen['services/filtern']='Filtern'; $this->phrasen['services/leistung']='Leistung'; -$this->phrasen['services/design']='Design'; +$this->phrasen['services/design']='Verantwortlich'; $this->phrasen['services/betrieb']='Betrieb'; $this->phrasen['services/operativ']='Operativ'; -?> \ No newline at end of file +?> diff --git a/locale/de-SFU/fas.dtd b/locale/de-SFU/fas.dtd index df67cfe7f..3742f1a4b 100644 --- a/locale/de-SFU/fas.dtd +++ b/locale/de-SFU/fas.dtd @@ -102,6 +102,10 @@ + + + + diff --git a/locale/en-US/mailverteiler.php b/locale/en-US/mailverteiler.php index 7c625116a..502846583 100644 --- a/locale/en-US/mailverteiler.php +++ b/locale/en-US/mailverteiler.php @@ -24,4 +24,5 @@ $this->phrasen['mailverteiler/infoBenutzung']='You can use the Mailinglist durin $this->phrasen['mailverteiler/bestaetigeOeffnen']='Please confirm to unlock the Mailing list %1$s'; $this->phrasen['mailverteiler/bestaetige']='Confirm'; $this->phrasen['mailverteiler/personenImVerteiler']='People in this mailing list'; +$this->phrasen['mailverteiler/oeffnenFehlgeschlagen']='Failed to open mailing list. Please inform your administrator.'; ?> diff --git a/rdf/diplomasupplement.xml.php b/rdf/diplomasupplement.xml.php index 5899a5151..d50cf1df9 100644 --- a/rdf/diplomasupplement.xml.php +++ b/rdf/diplomasupplement.xml.php @@ -622,7 +622,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") tbl_lehrveranstaltung.bezeichnung, COALESCE(tbl_lehrveranstaltung.bezeichnung_english, tbl_lehrveranstaltung.bezeichnung) as bezeichnung_english, tbl_lehrveranstaltung.semester, tbl_lehrveranstaltung.semesterstunden, tbl_lehrveranstaltung.ects, zeugnis.studiensemester_kurzbz, - zeugnis.note, note.bezeichnung note_bezeichnung, note.anmerkung, sort, tbl_lehrveranstaltung.sws + zeugnis.note, note.bezeichnung note_bezeichnung, note.anmerkung, note.offiziell, sort, tbl_lehrveranstaltung.sws FROM lehre.tbl_zeugnisnote zeugnis JOIN lehre.tbl_note note USING(note) @@ -654,7 +654,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['ects'] = $row_stud->ects; $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['sws_lv'] = $row_stud->sws; $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['studiensemester_kurzbz'] = $row_stud->studiensemester_kurzbz; - $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['note'] = $row_stud->anmerkung; + $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['note'] = $db->db_parse_bool($row_stud->offiziell) ? $row_stud->anmerkung : ""; $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['sort'] = $row_stud->sort; $ects_total += $row_stud->ects; $semester_ects +=$row_stud->ects; @@ -677,7 +677,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['ects'] = $row_stud->ects; $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['sws_lv'] = $row_stud->sws; $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['studiensemester_kurzbz'] = $row_stud->studiensemester_kurzbz; - $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['note'] = $row_stud->anmerkung; + $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['note'] = $db->db_parse_bool($row_stud->offiziell) ? $row_stud->anmerkung : ""; $arrayLvAusbildungssemester[$row_stud->lehrveranstaltung_id]['sort'] = $row_stud->sort; } } @@ -857,7 +857,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $qry_outgoing_note = " SELECT - anmerkung, benotungsdatum, lehrform_kurzbz + anmerkung, offiziell, benotungsdatum, lehrform_kurzbz FROM lehre.tbl_zeugnisnote JOIN tbl_lehrveranstaltung using(lehrveranstaltung_id) @@ -870,7 +870,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") { if($row_outgoing_note = $db->db_fetch_object($result_outgoing_note)) { - $note_outgoing = $row_outgoing_note->anmerkung; + $note_outgoing = $db->db_parse_bool($row_outgoing_note->offiziell) ? $row_outgoing_note->anmerkung : ""; $benotungsdatum_outgoing = $datum->formatDatum($row_outgoing_note->benotungsdatum,'d/m/Y'); $lehrform_kurzbz_outgoing = $row_outgoing_note->lehrform_kurzbz; } diff --git a/rdf/lehrveranstaltungszeugnis.rdf.php b/rdf/lehrveranstaltungszeugnis.rdf.php index 11c8f9545..64e6e93af 100644 --- a/rdf/lehrveranstaltungszeugnis.rdf.php +++ b/rdf/lehrveranstaltungszeugnis.rdf.php @@ -77,7 +77,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $note_arr = array(); $note = new note(); - $note->getAll(); + $note->getAll($offiziell = true); foreach ($note->result as $n){ $note_arr[$n->note] = $n->anmerkung; $note_bezeichnung_arr[$n->note] = $n->bezeichnung; @@ -236,7 +236,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $obj = new zeugnisnote(); $obj->load($lehrveranstaltung_id, $uid_arr[$i], $studiensemester_kurzbz); - if ($obj->note) + if ($obj->note && isset($note_arr[$obj->note])) { $note = $note_arr[$obj->note]; $note_bezeichnung = $note_bezeichnung_arr[$obj->note]; diff --git a/rdf/lehrveranstaltungszeugnis_ktu.rdf.php b/rdf/lehrveranstaltungszeugnis_ktu.rdf.php index d560bbf27..23f379984 100644 --- a/rdf/lehrveranstaltungszeugnis_ktu.rdf.php +++ b/rdf/lehrveranstaltungszeugnis_ktu.rdf.php @@ -85,7 +85,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $note_arr = array(); $note = new note(); - $note->getAll(); + $note->getAll($offiziell = true); foreach ($note->result as $n){ $note_arr[$n->note] = $n->anmerkung; $note_bezeichnung_arr[$n->note] = $n->bezeichnung; @@ -283,7 +283,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $obj = new zeugnisnote(); $obj->load($lehrveranstaltung_id, $uid_arr[$i], $studiensemester_kurzbz); - if ($obj->note) + if ($obj->note && isset($note_arr[$obj->note])) { $note = $note_arr[$obj->note]; $note_bezeichnung = $note_bezeichnung_arr[$obj->note]; diff --git a/rdf/studienerfolg.rdf.php b/rdf/studienerfolg.rdf.php index 934bc54d0..9799e65e6 100644 --- a/rdf/studienerfolg.rdf.php +++ b/rdf/studienerfolg.rdf.php @@ -218,7 +218,7 @@ function draw_studienerfolg($uid, $studiensemester_kurzbz) { if($row->zeugnis) { - if (trim($row->note)!=='') + if (trim($row->note)!=='' && isset($note_arr[$row->note])) $note = $note_arr[$row->note]; else $note = ""; @@ -297,7 +297,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $note_arr = array(); $note_wert = array(); $note = new note(); - $note->getAll(); + $note->getAll($offiziell = true); foreach ($note->result as $n) { $note_arr[$n->note] = $n->anmerkung; diff --git a/rdf/zertifikat.rdf.php b/rdf/zertifikat.rdf.php index da1437279..be0923294 100644 --- a/rdf/zertifikat.rdf.php +++ b/rdf/zertifikat.rdf.php @@ -77,11 +77,10 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $note_arr = array(); $note = new note(); - $note->getAll(); + $note->getAll($offiziell = true); foreach ($note->result as $n){ $note_arr[$n->note] = $n->anmerkung; $note_bezeichnung_arr[$n->note] = $n->bezeichnung; - } if(isset($_GET['ss'])) $studiensemester_kurzbz = $_GET['ss']; @@ -221,7 +220,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $obj = new zeugnisnote(); $obj->load($lehrveranstaltung_id, $uid_arr[$i], $studiensemester_kurzbz); - if ($obj->note) + if ($obj->note && isset($note_arr[$obj->note])) { $note = $note_arr[$obj->note]; $note_bezeichnung = $note_bezeichnung_arr[$obj->note]; diff --git a/rdf/zeugnis.rdf.php b/rdf/zeugnis.rdf.php index 32620914f..6458e2964 100644 --- a/rdf/zeugnis.rdf.php +++ b/rdf/zeugnis.rdf.php @@ -81,7 +81,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $note_arr = array(); $note = new note(); - $note->getAll(); + $note->getAll($offiziell = true); foreach ($note->result as $n) $note_arr[$n->note] = $n->anmerkung; @@ -257,7 +257,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") { if($row->zeugnis) { - if (trim($row->note)!=='') + if (trim($row->note)!=='' && isset($note_arr[$row->note])) $note = $note_arr[$row->note]; else $note = ""; @@ -323,7 +323,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") //$note = $note_arr[$projektarbeit[$row->lehrveranstaltung_id]['note']]; $note = $projektarbeit[$row->lehrveranstaltung_id]['note']; //$nl = str_repeat('\n',($anzahl_nl)); - $xml_fussnote .=' '.(isset($note_arr[$note])?$note_arr[$note]:$note).$nl.''; + $xml_fussnote .=' '.(isset($note_arr[$note])?$note_arr[$note]:"").$nl.''; $xml_fussnote .=' '.$nl.''; $xml_fussnote .=' '.$nl.''; $xml_fussnote .=' '.$nl.''; diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index bea94d3e1..450c5f7bb 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -358,8 +358,8 @@ if(!$result = @$db->db_query("SELECT mailversand FROM campus.tbl_coodle LIMIT 1; if(!$db->db_query($qry)) echo 'campus.tbl_coodle: '.$db->db_last_error().'
'; - else - echo '
campus.tbl_coodle: Spalten mailversand, teilnehmer_anonym und termine_anonym hinzugefuegt!
'; + else + echo '
campus.tbl_coodle: Spalten mailversand, teilnehmer_anonym und termine_anonym hinzugefuegt!
'; } // Spalte onlinebewerbung_studienplan in lehre.tbl_studienplan @@ -369,8 +369,99 @@ if(!$result = @$db->db_query("SELECT onlinebewerbung_studienplan FROM lehre.tbl_ if(!$db->db_query($qry)) echo 'lehre.tbl_studienplan: '.$db->db_last_error().'
'; + else + echo '
lehre.tbl_studienplan: Spalte onlinebewerbung_studienplan hinzugefuegt!
'; +} + +// Spalte sort in lehre.tbl_pruefungstyp (gibt Reihenfolge der Prüfungsantritte an) +if(!$result = @$db->db_query("SELECT sort FROM lehre.tbl_pruefungstyp LIMIT 1;")) +{ + $qry = "ALTER TABLE lehre.tbl_pruefungstyp ADD COLUMN sort smallint;"; + + if(!$db->db_query($qry)) + echo 'lehre.tbl_pruefungstyp: '.$db->db_last_error().'
'; + else + echo '
lehre.tbl_pruefungstyp: Spalte sort hinzugefuegt!
'; +} + +// zusätzliche kommissionelle Prüfung (4.Termin) als Zeile hinzufügen +if($result = @$db->db_query("SELECT 1 FROM lehre.tbl_pruefungstyp WHERE pruefungstyp_kurzbz= 'zusKommPruef';")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO lehre.tbl_pruefungstyp(pruefungstyp_kurzbz, beschreibung, abschluss) VALUES ('zusKommPruef', 'zusätzliche kommissionelle Prüfung', FALSE);"; + + if(!$db->db_query($qry)) + echo 'lehre.tbl_pruefungstyp: '.$db->db_last_error().'
'; else - echo '
lehre.tbl_studienplan: Spalte onlinebewerbung_studienplan hinzugefuegt!
'; + echo '
lehre.tbl_pruefungstyp: Zeile zusKommPruef hinzugefuegt!
'; + } +} + +// Note "entschuldigt" hinzufügen +if($result = @$db->db_query("SELECT 1 FROM lehre.tbl_note WHERE anmerkung = 'en' AND (bezeichnung = 'entschuldigt' OR bezeichnung = 'Entschuldigt');")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO lehre.tbl_note(note, bezeichnung, anmerkung, farbe, positiv, notenwert, aktiv, lehre) VALUES((SELECT max(note)+1 FROM lehre.tbl_note),'entschuldigt', 'en', NULL, TRUE, NULL, TRUE, TRUE);"; + + if(!$db->db_query($qry)) + echo 'lehre.tbl_note: '.$db->db_last_error().'
'; + else + echo '
lehre.tbl_note: Zeile entschuldigt hinzugefuegt!
'; + } +} + +// Note "unentschuldigt" hinzufügen +if($result = @$db->db_query("SELECT 1 FROM lehre.tbl_note WHERE anmerkung = 'ue' AND (bezeichnung = 'unentschuldigt' OR bezeichnung = 'Unentschuldigt');")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO lehre.tbl_note(note, bezeichnung, anmerkung, farbe, positiv, notenwert, aktiv, lehre) VALUES((SELECT max(note)+1 FROM lehre.tbl_note),'unentschuldigt', 'ue', NULL, FALSE, NULL, TRUE, TRUE);"; + + if(!$db->db_query($qry)) + echo 'lehre.tbl_note: '.$db->db_last_error().'
'; + else + echo '
lehre.tbl_note: Zeile unentschuldigt hinzugefuegt!
'; + } +} + +// Spalte offiziell in lehre.tbl_note +if(!$result = @$db->db_query("SELECT offiziell FROM lehre.tbl_note LIMIT 1;")) +{ + $qry = "ALTER TABLE lehre.tbl_note ADD COLUMN offiziell boolean NOT NULL DEFAULT true;"; + + if(!$db->db_query($qry)) + echo 'lehre.tbl_note: '.$db->db_last_error().'
'; + else + echo '
lehre.tbl_note: Spalte offiziell hinzugefuegt!
'; +} + +// Spalte bezeichnung_mehrsprachig in lehre.tbl_note +if(!$result = @$db->db_query("SELECT bezeichnung_mehrsprachig FROM lehre.tbl_note LIMIT 1")) +{ + $qry = "ALTER TABLE lehre.tbl_note ADD COLUMN bezeichnung_mehrsprachig varchar(64)[];"; + + if(!$db->db_query($qry)) + echo 'lehre.tbl_note '.$db->db_last_error().'
'; + else + echo 'lehre.tbl_note: Spalte bezeichnung_mehrsprachig hinzugefuegt!
'; + + // Bezeichnung_mehrsprachig aus existierender Bezeichnung vorausfuellen. Ein Eintrag fuer jede Sprache mit Content aktiv. + $qry_help = "SELECT index FROM public.tbl_sprache WHERE content=TRUE;"; + if(!$result = $db->db_query($qry_help)) + echo 'tbl_note bezeichnung_mehrsprachig: Fehler beim ermitteln der Sprachen: '.$db->db_last_error().''; + else + { + $qry=''; + while($row = $db->db_fetch_object($result)) + $qry.= "UPDATE lehre.tbl_note set bezeichnung_mehrsprachig[".$row->index."] = bezeichnung;"; + + if(!$db->db_query($qry)) + echo 'Setzen der bezeichnung_mehrsprachig fehlgeschlagen: '.$db->db_last_error().'
'; + else + echo 'lehre.tbl_note: bezeichnung_mehrprachig automatisch aus existierender Bezeichnung uebernommen
'; + } } // Column design_uid, betrieb_uid and operativ_uid to tbl_service @@ -385,8 +476,8 @@ if(!$result = @$db->db_query("SELECT design_uid FROM public.tbl_service LIMIT 1; if(!$db->db_query($qry)) echo 'public.tbl_service: '.$db->db_last_error().'
'; - else - echo '
public.tbl_service: Spalten design_uid,betrieb_uid,operativ_uid hinzugefuegt!
'; + else + echo '
public.tbl_service: Spalten design_uid,betrieb_uid,operativ_uid hinzugefuegt!
'; } // FOREIGN KEY tbl_phrasentext_sprache_fkey: system.tbl_phrasentext.sprache references public.tbl_sprache.sprache @@ -525,9 +616,9 @@ if(!@$db->db_query("SELECT campus.get_highest_content_version(0)")) RETURN rec.version; END; $_$; - + ALTER FUNCTION campus.get_highest_content_version(bigint) OWNER TO fhcomplete;'; - + if(!$db->db_query($qry)) echo 'campus.get_highest_content_version(content_id): '.$db->db_last_error().'
'; else @@ -543,7 +634,7 @@ if(!@$db->db_query("SELECT ausstellungsnation FROM public.tbl_akte LIMIT 1")) COMMENT ON COLUMN public.tbl_akte.ausstellungsnation IS 'Nation-Code des Landes, in dem das Dokument ausgestellt wurde'; COMMENT ON COLUMN public.tbl_akte.formal_geprueft_amum IS 'Bestaetigungsdatum, an dem das Dokument inhaltlich auf Formalkriterien (Leserlichkeit, Vollständigkeit, etc) geprueft wurde'; "; - + if(!$db->db_query($qry)) echo 'public.tbl_rt_person '.$db->db_last_error().'
'; else @@ -556,7 +647,7 @@ if(!@$db->db_query("SELECT ausstellungsdetails FROM public.tbl_dokument LIMIT 1" $qry = "ALTER TABLE public.tbl_dokument ADD COLUMN ausstellungsdetails boolean NOT NULL DEFAULT false; COMMENT ON COLUMN public.tbl_dokument.ausstellungsdetails IS 'Sollen beim Dokument weitere Felder (zB Ausstellungsnation) angezeigt werden?'; "; - + if(!$db->db_query($qry)) echo 'public.tbl_dokument '.$db->db_last_error().'
'; else @@ -700,6 +791,274 @@ if ($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berech // End extensions //--------------------------------------------------------------------------------------------------------------------- +if (!$result = @$db->db_query("SELECT 1 FROM system.tbl_log LIMIT 1")) +{ + $qry = "CREATE TABLE system.tbl_log + ( + log_id bigint NOT NULL, + person_id integer, + zeitpunkt timestamp NOT NULL DEFAULT now(), + app varchar(32) NOT NULL, + oe_kurzbz varchar(32), + logtype_kurzbz varchar(32) NOT NULL, + logdata jsonb NOT NULL, + insertvon varchar(32) + ); + ALTER TABLE system.tbl_log ADD CONSTRAINT pk_log PRIMARY KEY (log_id); + + CREATE SEQUENCE system.tbl_log_log_id_seq + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + ALTER TABLE system.tbl_log ALTER COLUMN log_id SET DEFAULT nextval('system.tbl_log_log_id_seq'); + + GRANT SELECT, INSERT ON system.tbl_log TO vilesci; + GRANT SELECT, INSERT ON system.tbl_log TO web; + GRANT SELECT, UPDATE ON system.tbl_log_log_id_seq TO vilesci; + GRANT SELECT, UPDATE ON system.tbl_log_log_id_seq TO web; + + CREATE TABLE system.tbl_logtype + ( + logtype_kurzbz varchar(32), + data_schema jsonb NOT NULL + ); + ALTER TABLE system.tbl_logtype ADD CONSTRAINT pk_logtype PRIMARY KEY (logtype_kurzbz); + GRANT SELECT ON system.tbl_logtype TO vilesci; + GRANT SELECT ON system.tbl_logtype TO web; + + ALTER TABLE system.tbl_log ADD CONSTRAINT fk_log_person_id FOREIGN KEY (person_id) REFERENCES public.tbl_person(person_id) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_log ADD CONSTRAINT fk_log_app FOREIGN KEY (app) REFERENCES system.tbl_app(app) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_log ADD CONSTRAINT fk_log_oe_kurzbz FOREIGN KEY (oe_kurzbz) REFERENCES public.tbl_organisationseinheit(oe_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + ALTER TABLE system.tbl_log ADD CONSTRAINT fk_log_logtype_kurzbz FOREIGN KEY (logtype_kurzbz) REFERENCES system.tbl_logtype(logtype_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT; + + INSERT INTO system.tbl_logtype VALUES ('Action', '{\"type\": \"object\", \"title\": \"Action\", \"required\": [\"name\", \"success\", \"message\"], \"properties\": {\"name\": {\"type\": \"string\"}, \"message\": {\"type\": \"string\"}, \"success\": {\"type\": \"string\"}}}'); + INSERT INTO system.tbl_logtype VALUES ('Processstate', '{\"type\": \"object\", \"title\": \"Processstate\", \"required\": [\"name\"], \"properties\": {\"name\": {\"type\": \"string\"}}}'); + "; + if (!$db->db_query($qry)) + echo 'system.tbl_log '.$db->db_last_error().'
'; + else + echo ' system.tbl_log hinzugefügt
'; +} + +//--------------------------------------------------------------------------------------------------------------------- +// Start filters + +// SEQUENCE tbl_filters_id_seq +if ($result = $db->db_query("SELECT 0 FROM pg_class WHERE relname = 'tbl_filters_id_seq'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = ' + CREATE SEQUENCE system.tbl_filters_id_seq + START WITH 1 + INCREMENT BY 1 + NO MAXVALUE + NO MINVALUE + CACHE 1; + '; + if(!$db->db_query($qry)) + echo 'system.tbl_filters_id_seq '.$db->db_last_error().'
'; + else + echo '
Created sequence: system.tbl_filters_id_seq'; + + // GRANT SELECT, UPDATE ON SEQUENCE system.tbl_filters_id_seq TO vilesci; + $qry = 'GRANT SELECT, UPDATE ON SEQUENCE system.tbl_filters_id_seq TO vilesci;'; + if (!$db->db_query($qry)) + echo 'system.tbl_filters_id_seq '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_filters_id_seq'; + + // GRANT SELECT, UPDATE ON SEQUENCE system.tbl_filters_id_seq TO fhcomplete; + $qry = 'GRANT SELECT, UPDATE ON SEQUENCE system.tbl_filters_id_seq TO fhcomplete;'; + if (!$db->db_query($qry)) + echo 'system.tbl_filters_id_seq '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_filters_id_seq'; + } +} + +// TABLE system.tbl_filters +if (!@$db->db_query("SELECT 0 FROM system.tbl_filters WHERE 0 = 1")) +{ + $qry = ' + CREATE TABLE system.tbl_filters ( + filter_id integer NOT NULL DEFAULT nextval(\'system.tbl_filters_id_seq\'::regclass), + app character varying(32) NOT NULL, + dataset_name character varying(128) NOT NULL, + filter_kurzbz character varying(64) NOT NULL, + person_id integer, + description character varying(128)[] NOT NULL, + sort integer, + default_filter boolean DEFAULT FALSE, + filter jsonb NOT NULL, + oe_kurzbz character varying(16) + );'; + if (!$db->db_query($qry)) + echo 'system.tbl_filters '.$db->db_last_error().'
'; + else + echo '
Created table system.tbl_filters'; + + // GRANT SELECT ON TABLE system.tbl_filters TO web; + $qry = 'GRANT SELECT ON TABLE system.tbl_filters TO web;'; + if (!$db->db_query($qry)) + echo 'system.tbl_filters '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on system.tbl_filters'; + + // GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_filters TO vilesci; + $qry = 'GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE system.tbl_filters TO vilesci;'; + if (!$db->db_query($qry)) + echo 'system.tbl_filters '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on system.tbl_filters'; + + // COMMENT ON TABLE system.tbl_filters + $qry = 'COMMENT ON TABLE system.tbl_filters IS \'Table to manage filters\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters'; + + // COMMENT ON TABLE system.tbl_filters.app + $qry = 'COMMENT ON COLUMN system.tbl_filters.app IS \'Application which this filter belongs to\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.app: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.app'; + + // COMMENT ON TABLE system.tbl_filters.dataset_name + $qry = 'COMMENT ON COLUMN system.tbl_filters.dataset_name IS \'Name that identifies the data set to be filtered\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.dataset_name: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.dataset_name'; + + // COMMENT ON TABLE system.tbl_filters.filter_kurzbz + $qry = 'COMMENT ON COLUMN system.tbl_filters.filter_kurzbz IS \'Short description of the filter, unique for this application and this data set\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.filter_kurzbz: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.filter_kurzbz'; + + // COMMENT ON TABLE system.tbl_filters.person_id + $qry = 'COMMENT ON COLUMN system.tbl_filters.person_id IS \'Person identifier which this filter belongs to. If null it is global\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.person_id: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.person_id'; + + // COMMENT ON TABLE system.tbl_filters.description + $qry = 'COMMENT ON COLUMN system.tbl_filters.description IS \'Long description for this filter\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.description: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.description'; + + // COMMENT ON TABLE system.tbl_filters.sort + $qry = 'COMMENT ON COLUMN system.tbl_filters.sort IS \'Indicates the order in which the filters appear in a list\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.sort: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.sort'; + + // COMMENT ON TABLE system.tbl_filters.default_filter + $qry = 'COMMENT ON COLUMN system.tbl_filters.default_filter IS \'If it is the default filter for that data set\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.default_filter: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.default_filter'; + + // COMMENT ON TABLE system.tbl_filters.filter + $qry = 'COMMENT ON COLUMN system.tbl_filters.filter IS \'Cointains json that define the filter\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.filter: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.filter'; + + // COMMENT ON TABLE system.tbl_filters.oe_kurzbz + $qry = 'COMMENT ON COLUMN system.tbl_filters.oe_kurzbz IS \'Organisation unit which this filter belongs to. If null it is for all the organisation units\';'; + if (!$db->db_query($qry)) + echo 'Adding comment to system.tbl_filters.oe_kurzbz: '.$db->db_last_error().'
'; + else + echo '
Added comment to system.tbl_filters.oe_kurzbz'; + + // ALTER SEQUENCE system.tbl_filters_id_seq OWNED BY system.tbl_filters.filter_id; + $qry = 'ALTER SEQUENCE system.tbl_filters_id_seq OWNED BY system.tbl_filters.filter_id;'; + if (!$db->db_query($qry)) + echo 'system.tbl_filters_id_seq '.$db->db_last_error().'
'; + else + echo '
Altered sequence system.tbl_filters_id_seq'; +} + +// UNIQUE INDEX uidx_filters_app_dataset_name_filter_kurzbz +if ($result = $db->db_query("SELECT 0 FROM pg_class WHERE relname = 'uidx_filters_app_dataset_name_filter_kurzbz'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = 'CREATE UNIQUE INDEX uidx_filters_app_dataset_name_filter_kurzbz ON system.tbl_filters USING btree (app, dataset_name, filter_kurzbz);'; + if (!$db->db_query($qry)) + echo 'uidx_filters_app_dataset_name_filter_kurzbz '.$db->db_last_error().'
'; + else + echo '
Created unique uidx_filters_app_dataset_name_filter_kurzbz'; + } +} + +// Add permission for filters +if ($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berechtigung_kurzbz = 'system/filters';")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO system.tbl_berechtigung (berechtigung_kurzbz, beschreibung) VALUES('system/filters', 'To manage core filters');"; + if (!$db->db_query($qry)) + echo 'system.tbl_berechtigung '.$db->db_last_error().'
'; + else + echo ' system.tbl_berechtigung: Added permission for filters
'; + } +} + +// FOREIGN KEY tbl_filters_app_fkey +if ($result = $db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'tbl_filters_app_fkey'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = 'ALTER TABLE system.tbl_filters ADD CONSTRAINT tbl_filters_app_fkey FOREIGN KEY (app) REFERENCES system.tbl_app(app) ON UPDATE CASCADE ON DELETE RESTRICT;'; + if (!$db->db_query($qry)) + echo 'tbl_filters_app_fkey '.$db->db_last_error().'
'; + else + echo '
Created foreign key tbl_filters_app_fkey'; + } +} + +// FOREIGN KEY tbl_filters_person_id_fkey +if ($result = $db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'tbl_filters_person_id_fkey'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = 'ALTER TABLE system.tbl_filters ADD CONSTRAINT tbl_filters_person_id_fkey FOREIGN KEY (person_id) REFERENCES public.tbl_person(person_id) ON UPDATE CASCADE ON DELETE RESTRICT;'; + if (!$db->db_query($qry)) + echo 'tbl_filters_person_id_fkey '.$db->db_last_error().'
'; + else + echo '
Created foreign key tbl_filters_person_id_fkey'; + } +} + +// FOREIGN KEY tbl_filters_oe_kurzbz_fkey +if ($result = $db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'tbl_filters_oe_kurzbz_fkey'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = 'ALTER TABLE system.tbl_filters ADD CONSTRAINT tbl_filters_oe_kurzbz_fkey FOREIGN KEY (oe_kurzbz) REFERENCES public.tbl_organisationseinheit(oe_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT;'; + if (!$db->db_query($qry)) + echo 'tbl_filters_oe_kurzbz_fkey '.$db->db_last_error().'
'; + else + echo '
Created foreign key tbl_filters_oe_kurzbz_fkey'; + } +} + +// End filters +//--------------------------------------------------------------------------------------------------------------------- + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -823,12 +1182,12 @@ $tabellen=array( "lehre.tbl_notenschluessel" => array("notenschluessel_kurzbz","bezeichnung"), "lehre.tbl_notenschluesselaufteilung" => array("notenschluesselaufteilung_id","notenschluessel_kurzbz","note","punkte"), "lehre.tbl_notenschluesselzuordnung" => array("notenschluesselzuordnung_id","notenschluessel_kurzbz","lehrveranstaltung_id","studienplan_id","oe_kurzbz","studiensemester_kurzbz"), - "lehre.tbl_note" => array("note","bezeichnung","anmerkung","farbe","positiv","notenwert","aktiv","lehre"), + "lehre.tbl_note" => array("note","bezeichnung","anmerkung","farbe","positiv","notenwert","aktiv","lehre","offiziell","bezeichnung_mehrsprachig"), "lehre.tbl_projektarbeit" => array("projektarbeit_id","projekttyp_kurzbz","titel","lehreinheit_id","student_uid","firma_id","note","punkte","beginn","ende","faktor","freigegeben","gesperrtbis","stundensatz","gesamtstunden","themenbereich","anmerkung","updateamum","updatevon","insertamum","insertvon","ext_id","titel_english","seitenanzahl","abgabedatum","kontrollschlagwoerter","schlagwoerter","schlagwoerter_en","abstract", "abstract_en", "sprache","final"), "lehre.tbl_projektbetreuer" => array("person_id","projektarbeit_id","betreuerart_kurzbz","note","faktor","name","punkte","stunden","stundensatz","updateamum","updatevon","insertamum","insertvon","ext_id","vertrag_id"), "lehre.tbl_projekttyp" => array("projekttyp_kurzbz","bezeichnung"), "lehre.tbl_pruefung" => array("pruefung_id","lehreinheit_id","student_uid","mitarbeiter_uid","note","pruefungstyp_kurzbz","datum","anmerkung","insertamum","insertvon","updateamum","updatevon","ext_id","pruefungsanmeldung_id","vertrag_id", "punkte"), - "lehre.tbl_pruefungstyp" => array("pruefungstyp_kurzbz","beschreibung","abschluss"), + "lehre.tbl_pruefungstyp" => array("pruefungstyp_kurzbz","beschreibung","abschluss","sort"), "lehre.tbl_studienordnung" => array("studienordnung_id","studiengang_kz","version","gueltigvon","gueltigbis","bezeichnung","ects","studiengangbezeichnung","studiengangbezeichnung_englisch","studiengangkurzbzlang","akadgrad_id","insertamum","insertvon","updateamum","updatevon","ext_id", "status_kurzbz", "standort_id"), "lehre.tbl_studienordnungstatus" => array("status_kurzbz","bezeichnung","reihenfolge"), "lehre.tbl_studienordnung_semester" => array("studienordnung_semester_id","studienordnung_id","studiensemester_kurzbz","semester"), @@ -849,7 +1208,7 @@ $tabellen=array( "lehre.tbl_zeugnisnote" => array("lehrveranstaltung_id","student_uid","studiensemester_kurzbz","note","uebernahmedatum","benotungsdatum","bemerkung","updateamum","updatevon","insertamum","insertvon","ext_id","punkte"), "public.ci_apikey" => array("apikey_id","key","level","ignore_limits","date_created"), "public.tbl_adresse" => array("adresse_id","person_id","name","strasse","plz","ort","gemeinde","nation","typ","heimatadresse","zustelladresse","firma_id","updateamum","updatevon","insertamum","insertvon","ext_id","rechnungsadresse","anmerkung"), - "public.tbl_akte" => array("akte_id","person_id","dokument_kurzbz","uid","inhalt","mimetype","erstelltam","gedruckt","titel","bezeichnung","updateamum","updatevon","insertamum","insertvon","ext_id","dms_id","nachgereicht","anmerkung","titel_intern","anmerkung_intern","nachgereicht_am"), + "public.tbl_akte" => array("akte_id","person_id","dokument_kurzbz","uid","inhalt","mimetype","erstelltam","gedruckt","titel","bezeichnung","updateamum","updatevon","insertamum","insertvon","ext_id","dms_id","nachgereicht","anmerkung","titel_intern","anmerkung_intern","nachgereicht_am","ausstellungsnation","formal_geprueft_amum"), "public.tbl_ampel" => array("ampel_id","kurzbz","beschreibung","benutzer_select","deadline","vorlaufzeit","verfallszeit","insertamum","insertvon","updateamum","updatevon","email","verpflichtend","buttontext"), "public.tbl_ampel_benutzer_bestaetigt" => array("ampel_benutzer_bestaetigt_id","ampel_id","uid","insertamum","insertvon"), "public.tbl_aufmerksamdurch" => array("aufmerksamdurch_kurzbz","beschreibung","ext_id","bezeichnung", "aktiv"), @@ -862,7 +1221,7 @@ $tabellen=array( "public.tbl_benutzergruppe" => array("uid","gruppe_kurzbz","studiensemester_kurzbz","updateamum","updatevon","insertamum","insertvon","ext_id"), "public.tbl_bewerbungstermine" => array("bewerbungstermin_id","studiengang_kz","studiensemester_kurzbz","beginn","ende","nachfrist","nachfrist_ende","anmerkung", "insertamum", "insertvon", "updateamum", "updatevon","studienplan_id"), "public.tbl_buchungstyp" => array("buchungstyp_kurzbz","beschreibung","standardbetrag","standardtext","aktiv","credit_points"), - "public.tbl_dokument" => array("dokument_kurzbz","bezeichnung","ext_id","bezeichnung_mehrsprachig","dokumentbeschreibung_mehrsprachig"), + "public.tbl_dokument" => array("dokument_kurzbz","bezeichnung","ext_id","bezeichnung_mehrsprachig","dokumentbeschreibung_mehrsprachig","ausstellungsdetails"), "public.tbl_dokumentprestudent" => array("dokument_kurzbz","prestudent_id","mitarbeiter_uid","datum","updateamum","updatevon","insertamum","insertvon","ext_id"), "public.tbl_dokumentstudiengang" => array("dokument_kurzbz","studiengang_kz","ext_id", "onlinebewerbung", "pflicht","beschreibung_mehrsprachig","nachreichbar"), "public.tbl_erhalter" => array("erhalter_kz","kurzbz","bezeichnung","dvr","logo","zvr"), @@ -950,6 +1309,9 @@ $tabellen=array( "system.tbl_benutzerrolle" => array("benutzerberechtigung_id","rolle_kurzbz","berechtigung_kurzbz","uid","funktion_kurzbz","oe_kurzbz","art","studiensemester_kurzbz","start","ende","negativ","updateamum", "updatevon","insertamum","insertvon","kostenstelle_id","anmerkung"), "system.tbl_berechtigung" => array("berechtigung_kurzbz","beschreibung"), "system.tbl_extensions" => array("extension_id","name","version","description","license","url","core_version","dependencies","enabled"), + "system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon"), + "system.tbl_logtype" => array("logtype_kurzbz", "data_schema"), + "system.tbl_filters" => array("filter_id","app","dataset_name","filter_kurzbz","person_id","description","sort","default_filter","filter","oe_kurzbz"), "system.tbl_phrase" => array("phrase_id","app","phrase","insertamum","insertvon"), "system.tbl_phrasentext" => array("phrasentext_id","phrase_id","sprache","orgeinheit_kurzbz","orgform_kurzbz","text","description","insertamum","insertvon"), "system.tbl_rolle" => array("rolle_kurzbz","beschreibung"), @@ -965,15 +1327,14 @@ $tabellen=array( "wawi.tbl_betriebsmittelstatus" => array("betriebsmittelstatus_kurzbz","beschreibung"), "wawi.tbl_betriebsmitteltyp" => array("betriebsmitteltyp","beschreibung","anzahl","kaution","typ_code","mastershapename"), "wawi.tbl_budget" => array("geschaeftsjahr_kurzbz","kostenstelle_id","budget"), - "wawi.tbl_zahlungstyp" => array("zahlungstyp_kurzbz","bezeichnung","reihenfolge"), - "wawi.tbl_konto" => array("konto_id","kontonr","beschreibung","kurzbz","aktiv","person_id","insertamum","insertvon","updateamum","updatevon","ext_id","person_id","hilfe"), + "wawi.tbl_zahlungstyp" => array("zahlungstyp_kurzbz","bezeichnung"), + "wawi.tbl_konto" => array("konto_id","kontonr","beschreibung","kurzbz","aktiv","person_id","insertamum","insertvon","updateamum","updatevon","ext_id","person_id"), "wawi.tbl_konto_kostenstelle" => array("konto_id","kostenstelle_id","insertamum","insertvon"), "wawi.tbl_kostenstelle" => array("kostenstelle_id","oe_kurzbz","bezeichnung","kurzbz","aktiv","insertamum","insertvon","updateamum","updatevon","ext_id","kostenstelle_nr","deaktiviertvon","deaktiviertamum"), "wawi.tbl_bestellungtag" => array("tag","bestellung_id","insertamum","insertvon"), "wawi.tbl_bestelldetailtag" => array("tag","bestelldetail_id","insertamum","insertvon"), "wawi.tbl_projekt_bestellung" => array("projekt_kurzbz","bestellung_id","anteil"), "wawi.tbl_bestellung" => array("bestellung_id","besteller_uid","kostenstelle_id","konto_id","firma_id","lieferadresse","rechnungsadresse","freigegeben","bestell_nr","titel","bemerkung","liefertermin","updateamum","updatevon","insertamum","insertvon","ext_id","zahlungstyp_kurzbz","zuordnung_uid","zuordnung_raum","zuordnung","auftragsbestaetigung","auslagenersatz","iban","wird_geleast","nicht_bestellen","empfehlung_leasing"), - "wawi.tbl_bestellung_angebot" => array("angebot_id","bestellung_id","dms_id"), "wawi.tbl_bestelldetail" => array("bestelldetail_id","bestellung_id","position","menge","verpackungseinheit","beschreibung","artikelnummer","preisprove","mwst","erhalten","sort","text","updateamum","updatevon","insertamum","insertvon"), "wawi.tbl_bestellung_bestellstatus" => array("bestellung_bestellstatus_id","bestellung_id","bestellstatus_kurzbz","uid","oe_kurzbz","datum","insertamum","insertvon","updateamum","updatevon"), "wawi.tbl_bestellstatus" => array("bestellstatus_kurzbz","beschreibung"), diff --git a/system/mlists/mlists_generate.php b/system/mlists/mlists_generate.php index b1e024ac9..55454c322 100644 --- a/system/mlists/mlists_generate.php +++ b/system/mlists/mlists_generate.php @@ -134,7 +134,8 @@ $error_msg=''; FROM public.tbl_mitarbeiter JOIN public.tbl_benutzer ON (mitarbeiter_uid=uid) WHERE lektor - AND aktiv"; + AND aktiv + AND personalnummer >=0"; //MitarbeiterInnen mit gueltiger Funktion "ass" (assistenz) $verteilerArray['tw_sek']['bezeichnung'] = 'Alle Sekretariate'; $verteilerArray['tw_sek']['beschreibung'] = 'Alle Sekretariate an der FH Technikum Wien'; diff --git a/vilesci/bis/personalmeldung.php b/vilesci/bis/personalmeldung.php index ae1a65741..5ca6e8b52 100644 --- a/vilesci/bis/personalmeldung.php +++ b/vilesci/bis/personalmeldung.php @@ -345,7 +345,7 @@ if($result = $db->db_query($qry)) $person_content.=" ".sprintf("%04s",$row_fkt['stgkz'])." - ".number_format($row_fkt['sws']).""; + ".number_format($row_fkt['sws'],2).""; if($row_fkt['hauptberuflich']=='t') { $person_content.=" diff --git a/vilesci/cronjobs/cronjob.php b/vilesci/cronjobs/cronjob.php index ccfeda4ce..a952bc965 100644 --- a/vilesci/cronjobs/cronjob.php +++ b/vilesci/cronjobs/cronjob.php @@ -40,15 +40,19 @@ foreach ($cj->result as $cronjob) $timestamp = $cronjob->getNextExecutionTime(); if($timestamp && time()>=$timestamp) { - //Starten des Jobs - if($cronjob->execute()) + if(!$cronjob->running) { - echo "\n".date('d.m.Y H:i:s').' '.$cronjob->titel.'('.$cronjob->cronjob_id.') executed
'."\n"; - echo implode($cronjob->output,"\n"); - } - else - { - echo "\n".date('d.m.Y H:i:s').' '.$cronjob->titel.'('.$cronjob->cronjob_id.') failed
'."\n"; + echo "\n".date('d.m.Y H:i:s').' '.$cronjob->titel.'('.$cronjob->cronjob_id.') execute...
'."\n"; + //Starten des Jobs + if($cronjob->execute()) + { + echo "\n".date('d.m.Y H:i:s').' '.$cronjob->titel.'('.$cronjob->cronjob_id.') executed
'."\n"; + echo implode($cronjob->output,"\n"); + } + else + { + echo "\n".date('d.m.Y H:i:s').' '.$cronjob->titel.'('.$cronjob->cronjob_id.') failed:'.$cronjob->errormsg.'
'."\n"; + } } } } diff --git a/vilesci/personen/personendetails.php b/vilesci/personen/personendetails.php index 172bf7051..784b49229 100644 --- a/vilesci/personen/personendetails.php +++ b/vilesci/personen/personendetails.php @@ -20,7 +20,7 @@ * Rudolf Hangl < rudolf.hangl@technikum-wien.at > * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > */ -require_once('../../config/vilesci.config.inc.php'); +require_once('../../config/vilesci.config.inc.php'); require_once('../../include/functions.inc.php'); require_once('../../include/benutzerberechtigung.class.php'); require_once('../../include/studiengang.class.php'); @@ -38,7 +38,7 @@ $user = get_uid(); if (!$db = new basis_db()) die('Es konnte keine Verbindung zum Server aufgebaut werden.'); - + $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); @@ -58,21 +58,21 @@ echo ' '; -if(!$rechte->isBerechtigt('admin') && +if(!$rechte->isBerechtigt('admin') && !$rechte->isBerechtigt('preinteressent') && !$rechte->isBerechtigt('assistenz')) die('Sie haben keine Berechtigung fuer diese Seite'); if(isset($_GET['id']) && is_numeric($_GET['id'])) $id = $_GET['id']; -else +else die('der Parameter id mit der Person_id muss uebergeben werden'); $person = new person(); if(!$person->load($id)) die('Person wurde nicht gefunden'); - + //PERSON echo '

Person

'; echo ''; @@ -117,7 +117,7 @@ $nation->getAll(); $nation_arr['']=''; foreach($nation->nation as $row) $nation_arr[$row->code]=$row->kurztext; - + $adresstyp_arr = array(''=>'','h'=>'Hauptwohnsitz','n'=>'Nebenwohnsitz','f'=>'Firma'); // *** ADRESSEN *** @@ -144,18 +144,6 @@ foreach ($adresse_obj->result as $row) echo ""; } echo '
".$firma->name."
'; -//PREINTERESSENT -function CutString($strVal, $limit) -{ - if(strlen($strVal) > $limit+3) - { - return substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } -} $preinteressent = new preinteressent(); $preinteressent->getPreinteressenten($person->person_id); @@ -188,7 +176,7 @@ if(count($preinteressent->result)>0) echo '
'; $preinteressent1 = new preinteressent(); $preinteressent1->loadZuordnungen($row->preinteressent_id); - + $stgs=''; foreach ($preinteressent1->result as $row_zuordnung) { @@ -210,12 +198,12 @@ if(count($preinteressent->result)>0) $plz = $adresse->result[0]->plz; $ort = $adresse->result[0]->ort; } - else + else { $plz=''; $ort=''; } - + echo $plz.' '.$ort.' '.$firma->name." ($firma->firmentyp_kurzbz)"; } echo '$uid$gruppe$prestudent1->status_kurzbz ".($prestudent1->ausbildungssemester!=''?"($prestudent1->ausbildungssemester. Semester)":'')."
@@ -333,4 +321,4 @@ if($result = $db->db_query($qry)) } echo ''; echo ''; -?> \ No newline at end of file +?> diff --git a/vilesci/stammdaten/service_uebersicht.php b/vilesci/stammdaten/service_uebersicht.php old mode 100644 new mode 100755 index f7058255b..f1b286862 --- a/vilesci/stammdaten/service_uebersicht.php +++ b/vilesci/stammdaten/service_uebersicht.php @@ -26,7 +26,7 @@ $user = get_uid(); $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($user); - + if(!$rechte->isBerechtigt('basis/service')) die('Sie haben keine Berechtigung fuer diese Seite'); @@ -37,27 +37,27 @@ echo 'Service - + '; - + include('../../include/meta/jquery.php'); include('../../include/meta/jquery-tablesorter.php'); - + echo' - - - - -