diff --git a/.gitignore b/.gitignore index cf35d4eea..3eda1161d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,15 @@ documents/ .project .buildpath application/config/development/ +application/extensions/ +application/controllers/extensions/ +application/config/extensions/ +application/helpers/extensions/ +application/hooks/extensions/ +application/libraries/extensions/ +application/models/extensions/ +application/views/extensions/ +application/widgets/extensions/ tests/codeception/_output/* !/tests/codeception/_output/.placeholder tests/codeception/codeception.yml diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100755 new mode 100644 index 5b28531f8..05c155569 --- 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/cache/index.html b/application/cache/index.html old mode 100755 new mode 100644 diff --git a/application/config/autoload.php b/application/config/autoload.php old mode 100755 new mode 100644 diff --git a/application/config/config.php b/application/config/config.php old mode 100755 new mode 100644 diff --git a/application/config/constants.php b/application/config/constants.php old mode 100755 new mode 100644 diff --git a/application/config/database.php b/application/config/database.php old mode 100755 new mode 100644 diff --git a/application/config/doctypes.php b/application/config/doctypes.php old mode 100755 new mode 100644 diff --git a/application/config/extensions/.placeholder b/application/config/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/config/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php old mode 100755 new mode 100644 index 3c540ea65..786937dd7 --- 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', @@ -208,6 +209,8 @@ $config['fhc_acl'] = array 'system.tbl_webservicerecht' => 'basis/webservicerecht', '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/config/foreign_chars.php b/application/config/foreign_chars.php old mode 100755 new mode 100644 diff --git a/application/config/hooks.php b/application/config/hooks.php old mode 100755 new mode 100644 diff --git a/application/config/index.html b/application/config/index.html old mode 100755 new mode 100644 diff --git a/application/config/mail.php b/application/config/mail.php old mode 100755 new mode 100644 diff --git a/application/config/memcached.php b/application/config/memcached.php old mode 100755 new mode 100644 diff --git a/application/config/migration.php b/application/config/migration.php old mode 100755 new mode 100644 diff --git a/application/config/mimes.php b/application/config/mimes.php old mode 100755 new mode 100644 diff --git a/application/config/profiler.php b/application/config/profiler.php old mode 100755 new mode 100644 diff --git a/application/config/roles.php b/application/config/roles.php old mode 100755 new mode 100644 index be898ea8f..2851de48f --- a/application/config/roles.php +++ b/application/config/roles.php @@ -1,12 +1,12 @@ 'infocenter', + 'berechtigung' => array + ( + 'basis/adresse','basis/akte','basis/kontakt','basis/log','basis/nation','basis/notiz','basis/notizzuordnung', + 'basis/person','basis/prestudent','basis/prestudentstatus','basis/status','basis/zgv','basis/zgvmaster', + 'lehre/studienplan','system/filters' + ) ) ); diff --git a/application/config/routes.php b/application/config/routes.php old mode 100755 new mode 100644 diff --git a/application/config/smileys.php b/application/config/smileys.php old mode 100755 new mode 100644 diff --git a/application/config/user_agents.php b/application/config/user_agents.php old mode 100755 new mode 100644 diff --git a/application/controllers/DBTools.php b/application/controllers/DBTools.php index 4b2fa86b5..8590c2285 100644 --- a/application/controllers/DBTools.php +++ b/application/controllers/DBTools.php @@ -424,6 +424,31 @@ class DBTools extends FHC_Controller echo ' Roles!'; $this->config->load('roles'); foreach ($this->config->item('roles') as $role) + { + echo "\n\n".'Check role '.$role['rolle_kurzbz']; + $qry = "SELECT * FROM system.tbl_rolle + WHERE rolle_kurzbz='".$role['rolle_kurzbz']."';"; + + if($result = $this->db->query($qry)) + { + if($result->num_rows($result)==0) + { + // Nicht vorhanden -> anlegen + $qry_insert="INSERT INTO system.tbl_rolle(rolle_kurzbz, beschreibung) VALUES ('".$role['rolle_kurzbz']."','".$role['rolle_kurzbz']."');"; + + if($this->db->query($qry_insert)) + { + echo "\nRolle ".$role['rolle_kurzbz'].' hinzugefügt'; + $neue=true; + } + else + { + echo "\nFehler: ".$role['rolle_kurzbz'].' Rolle hinzufügen nicht möglich'; + continue; + } + } + } + foreach ($role['berechtigung'] as $b) { $qry = "SELECT * FROM system.tbl_rolleberechtigung @@ -439,16 +464,17 @@ class DBTools extends FHC_Controller if($this->db->query($qry_insert)) { - echo '
'.$role['rolle_kurzbz'].' -> '.$b.' hinzugefügt'; + echo "\n".$role['rolle_kurzbz'].' -> '.$b.' hinzugefügt'; $neue=true; } else - echo '
Fehler: '.$role['rolle_kurzbz'].' -> '.$b.' hinzufügen nicht möglich'; + echo "\nFehler: ".$role['rolle_kurzbz'].' -> '.$b.' hinzufügen nicht möglich'; } else - echo "- $b -"; + echo "\n- $b -"; } } + } break; // **** Default **** default: echo ' what? roles or permisssions?'; diff --git a/application/controllers/Redirect.php b/application/controllers/Redirect.php index 99d459771..660709b6f 100644 --- a/application/controllers/Redirect.php +++ b/application/controllers/Redirect.php @@ -31,9 +31,6 @@ class Redirect extends FHC_Controller // Loads model MessageTokenModel $this->load->model('system/MessageToken_model', 'MessageTokenModel'); - - // Loads library OrganisationseinheitLib - $this->load->library('OrganisationseinheitLib'); } /** @@ -55,10 +52,16 @@ class Redirect extends FHC_Controller if ($oe_kurzbz != null && $oe_kurzbz != '') { - $rootOE = $this->organisationseinheitlib->getRoot($oe_kurzbz); - if ($rootOE->error) + $organisationRoot = null; + + $getOERoot = $this->MessageTokenModel->getOERoot($oe_kurzbz); + if (isSuccess($getOERoot)) // If no errors occurred { - show_error($rootOE->retval); + $organisationRoot = $getOERoot->retval; + } + else + { + show_error('No organisation unit present in the message'); } $addonAufnahmeUrls = $this->config->item('addons_aufnahme_url'); @@ -66,10 +69,10 @@ class Redirect extends FHC_Controller if (isset($token) && hasData($msg) && is_array($addonAufnahmeUrls) - && hasData($rootOE) - && isset($addonAufnahmeUrls[$rootOE->retval[0]->oe_kurzbz])) + && $organisationRoot != null + && isset($addonAufnahmeUrls[$organisationRoot])) { - redirect($addonAufnahmeUrls[$rootOE->retval[0]->oe_kurzbz] . '?token=' . $token); + redirect($addonAufnahmeUrls[$organisationRoot] . '?token=' . $token); } } } diff --git a/application/controllers/ViewMessage.php b/application/controllers/ViewMessage.php old mode 100755 new mode 100644 diff --git a/application/controllers/Vilesci.php b/application/controllers/Vilesci.php old mode 100755 new mode 100644 diff --git a/application/controllers/extensions/.placeholder b/application/controllers/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/controllers/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/controllers/index.html b/application/controllers/index.html old mode 100755 new mode 100644 diff --git a/application/controllers/system/Login.php b/application/controllers/system/Login.php old mode 100755 new mode 100644 diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php old mode 100755 new mode 100644 diff --git a/application/controllers/system/Vorlage.php b/application/controllers/system/Vorlage.php old mode 100755 new mode 100644 diff --git a/application/controllers/system/extensions/Manager.php b/application/controllers/system/extensions/Manager.php new file mode 100644 index 000000000..db56b0d8b --- /dev/null +++ b/application/controllers/system/extensions/Manager.php @@ -0,0 +1,83 @@ +load->helper(array('form', 'url')); + + // Loads the extensions library + $this->load->library('ExtensionsLib'); + } + + /** + * + */ + public function index() + { + $viewData = array( + 'extensions' => $this->extensionslib->getInstalledExtensions() + ); + + $this->load->view('system/extensions/manager.php', $viewData); + } + + /** + * + */ + public function toggleExtension() + { + $toggleExtension = false; + + $extension_id = $this->input->post('extension_id'); + $enabled = $this->input->post('enabled'); + + if ($enabled === 'true') + { + $toggleExtension = $this->extensionslib->enableExtension($extension_id); + } + else + { + $toggleExtension = $this->extensionslib->disableExtension($extension_id); + } + + $this->output + ->set_content_type('application/json') + ->set_output(json_encode($toggleExtension)); + } + + /** + * + */ + public function delExtension() + { + $delExtension = false; + + $extension_id = $this->input->post('extension_id'); + + $delExtension = $this->extensionslib->delExtension($extension_id); + + $this->output + ->set_content_type('application/json') + ->set_output(json_encode($delExtension)); + } + + /** + * + */ + public function uploadExtension() + { + $this->extensionslib->installExtension(); + } +} diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php new file mode 100644 index 000000000..ac6cd2aa7 --- /dev/null +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -0,0 +1,72 @@ +load->model('system/Filters_model', 'FiltersModel'); + + // + $this->load->library('WidgetLib'); + } + + /** + * + */ + public function index() + { + $listFiltersSent = array(); + $listFiltersNotSent = array(); + + $listFiltersSent = $this->_getFilterList('%InfoCenterSentApplication%'); + + $listFiltersNotSent = $this->_getFilterList('%InfoCenterNotSentApplication%'); + + $this->load->view( + 'system/infocenter/infocenter.php', + array( + 'listFiltersSent' => $listFiltersSent, + 'listFiltersNotSent' => $listFiltersNotSent + ) + ); + } + + /** + * + */ + private function _getFilterList($filter_kurzbz) + { + $listFilters = array(); + + $personActionsArray = array( + 'app' => 'aufnahme', + 'dataset_name' => 'PersonActions', + 'person_id' => null, + 'default_filter' => false, + 'array_length(description, 1) >' => 0 + ); + + $this->FiltersModel->resetQuery(); + $this->FiltersModel->addSelect('filter_id, description'); + $this->FiltersModel->addOrder('sort', 'ASC'); + + $personActionsArray['filter_kurzbz ILIKE'] = $filter_kurzbz; + $filters = $this->FiltersModel->loadWhere($personActionsArray); + if (hasData($filters)) + { + for ($filtersCounter = 0; $filtersCounter < count($filters->retval); $filtersCounter++) + { + $filter = $filters->retval[$filtersCounter]; + + $listFilters[$filter->filter_id] = $filter->description[0]; + } + } + + return $listFilters; + } +} diff --git a/application/controllers/system/infocenter/InfocenterDetails.php b/application/controllers/system/infocenter/InfocenterDetails.php new file mode 100644 index 000000000..8c0c231a9 --- /dev/null +++ b/application/controllers/system/infocenter/InfocenterDetails.php @@ -0,0 +1,393 @@ +load->model('person/person_model', 'PersonModel'); + $this->load->model('person/notiz_model', 'NotizModel'); + $this->load->model('crm/prestudent_model', 'PrestudentModel'); + $this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel'); + $this->load->model('crm/statusgrund_model', 'StatusgrundModel'); + $this->load->model('crm/akte_model', 'AkteModel'); + + $this->load->library('DmsLib'); + $this->load->library('WidgetLib'); + $this->load->library('PersonLogLib'); + + $this->load->helper('fhcauth'); + $this->load->helper('url'); + + $this->uid = getAuthUID(); + if(!$this->uid) + show_error('user authentification failed'); + } + + /** + * loads all necessary Person data: Stammdaten (name, svnr, contact, ...), Dokumente, Logs and Notizen + * @param $person_id + * @return array + */ + private function __loadPersonData($person_id) + { + $stammdaten = $this->PersonModel->getPersonStammdaten($person_id); + + if ($stammdaten->error) + { + show_error($stammdaten->retval); + } + + if(!isset($stammdaten->retval)) + return null; + +/* $dokumente = $this->AkteModel->loadWhere(array('person_id' => $person_id)); + + if ($dokumente->error) + { + show_error($dokumente->retval); + } + + var_dump($dokumente->retval);*/ + + $dokumente = $this->AkteModel->getAktenWithDokInfo($person_id, null, false); + + if ($dokumente->error) + { + show_error($dokumente->retval); + } + + $dokumente_nachgereicht = $this->AkteModel->getAktenWithDokInfo($person_id, null, true); + + if ($dokumente_nachgereicht->error) + { + show_error($dokumente->retval); + } + + //var_dump($dokumente->retval);die(); + + $logs = $this->personloglib->getLogs($person_id, $this::APP); + + $notizen = $this->NotizModel->getNotiz($person_id); + + if ($notizen->error) + { + show_error($notizen->retval); + } + + $data = array ( + 'stammdaten' => $stammdaten->retval, + 'dokumente' => $dokumente->retval, + 'dokumente_nachgereicht' => $dokumente_nachgereicht->retval, + 'logs' => $logs, + 'notizen' => $notizen->retval + ); + + return $data; + } + + /** + * loads all necessary Prestudent data: Zgv data, Statusgruende + * @param $person_id + * @return array + */ + 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) + { + $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent->prestudent_id); + + if ($prestudent->error) + { + show_error($prestudent->retval); + } + + $zgvpruefung = $prestudent->retval[0]; + + //if prestudent is not interessent or is already bestaetigt, then show only as information, non-editable + $zgvpruefung->infoonly = !isset($zgvpruefung->prestudentstatus) || isset($zgvpruefung->prestudentstatus->bestaetigtam) || $zgvpruefung->prestudentstatus->status_kurzbz != 'Interessent'; + + $zgvpruefungen[] = $zgvpruefung; + } + + //Interessenten come first + usort($zgvpruefungen, function ($a, $b) + { + if(!isset($a->prestudentstatus->status_kurzbz) || !isset($b->prestudentstatus->status_kurzbz)) + return 0; + elseif($a->prestudentstatus->status_kurzbz === 'Interessent' && $b->prestudentstatus->status_kurzbz === 'Interessent') + { + //infoonly Interessenten are behind new Interessenten + if($a->infoonly) + return 1; + elseif($b->infoonly) + return -1; + } + elseif($a->prestudentstatus->status_kurzbz === 'Interessent') + return -1; + elseif($b->prestudentstatus->status_kurzbz === 'Interessent') + return 1; + else + return 0; + }); + + $statusgruende = $this->StatusgrundModel->loadWhere(array('status_kurzbz' => 'Abgewiesener'))->retval; + + $data = array ( + 'zgvpruefungen' => $zgvpruefungen, + 'statusgruende' => $statusgruende + ); + + return $data; + } + + /** + * initialization function, gets person and prestudent data and loads the view with the data + * @param $person_id + */ + public function showDetails($person_id) + { + if(!is_numeric($person_id)) + show_error('person id is not numeric!'); + $persondata = $this->__loadPersonData($person_id); + if(!isset($persondata)) + show_error('person does not exist!'); + $prestudentdata = $this->__loadPrestudentData($person_id); + $this->load->view('system/infocenter/infocenterDetails.php', array_merge($persondata, $prestudentdata)); + } + + /** + * saves if a document has been formal geprueft. saves current timestamp if checked as geprueft, or null if not. + */ + public function saveFormalGeprueft() + { + $akte_id = $this->input->get('akte_id'); + $formalgeprueft = $this->input->get('formal_geprueft'); + $person_id = $this->input->get('person_id'); + + if(!isset($akte_id) || !isset($formalgeprueft) || !isset($person_id)) + show_error('Parameters not set!'); + + $akte = $this->AkteModel->load($akte_id); + + if ($akte->error) + { + show_error($akte->retval); + } + + $timestamp = ($formalgeprueft === 'true') ? date('Y-m-d H:i:s') : null; + $result = $this->AkteModel->update($akte_id, array('formal_geprueft_amum' => $timestamp)); + + if ($result->error) + { + show_error($result->retval); + } + + //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 to start page + redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id.'#DokPruef'); + } + + /** + * saves a zgv for a prestudent. includes Ort, Datum, Nation for bachelor and master. + * @param $prestudent_id + */ + public function saveZgvPruefung($prestudent_id) + { + // zgvdata + $zgv_code = $this->input->post('zgv') === 'null' ? null : $this->input->post('zgv');//check for string null, in case dropdown changed to default value + $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'); + + $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); + } + + //get extended Prestudent data for logging + $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, 'ZgvPruef'); + } + + /** + * saves Absage for Prestudent including the reason for the Absage (statusgrund). + * inserts Studiensemester and Ausbildungssemester for the new Absage of (chronologically) last status. + * @param $prestudent_id + */ + public function saveAbsage($prestudent_id) + { + //TODO email messaging + $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, 'ZgvPruef'); + } + + /** + * saves Freigabe of a Prestudent to the Studiengang. + * updates bestaetigtam and bestaetigtvon fields of the last status + * @param $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, 'ZgvPruef'); + } + + /** + * saves a new Notiz for a person + * @param $person_id + */ + public function saveNotiz($person_id) + { + $titel = $this->input->post('notiztitel'); + $text = $this->input->post('notiz'); + $erledigt = false; + + $result = $this->NotizModel->addNotizForPerson($person_id, $titel, $text, $erledigt, $this->uid); + + if ($result->error) + { + show_error($result->retval); + } + + $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.'#NotizAkt'); + } + + /** + * Outputs content of an Akte, sends appropriate headers (so the document can be downloaded) + * @param $akte_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); + } + + $this->output + ->set_status_header(200) + ->set_content_type($akte->retval[0]->mimetype, 'utf-8') + ->set_header('Content-Disposition: attachment; filename="'.$akte->retval[0]->titel.'"') + ->set_output($aktecontent->retval) + ->_display(); + } + + /** + * helper function for redirecting to initial page for person from a prestudent-specific page + * @param $prestudent_id + * @param $section optional section of the page to go to + */ + private function __redirectToStart($prestudent_id, $section = '') + { + $this->PrestudentModel->addSelect('person_id'); + $person_id = $this->PrestudentModel->load($prestudent_id)->retval[0]->person_id; + redirect('/system/infocenter/InfocenterDetails/showDetails/'.$person_id.'#'.$section); + } + + /** + * helper function retrieves personid and studiengang kurzbz from a prestudent id + * @param $prestudent_id + * @return array + */ + private function __getPersonAndStudiengangFromPrestudent($prestudent_id) + { + $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id); + + if ($prestudent->error) + { + show_error($prestudent->retval); + } + + $person_id = $prestudent->retval[0]->person_id; + $studiengang_kurzbz = $prestudent->retval[0]->studiengang; + + 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/core/index.html b/application/core/index.html old mode 100755 new mode 100644 diff --git a/application/helpers/extensions/.placeholder b/application/helpers/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/helpers/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/helpers/index.html b/application/helpers/index.html old mode 100755 new mode 100644 diff --git a/application/hooks/extensions/.placeholder b/application/hooks/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/hooks/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/hooks/index.html b/application/hooks/index.html old mode 100755 new mode 100644 diff --git a/application/index.html b/application/index.html old mode 100755 new mode 100644 diff --git a/application/language/de-AT/index.html b/application/language/de-AT/index.html old mode 100755 new mode 100644 diff --git a/application/language/index.html b/application/language/index.html old mode 100755 new mode 100644 diff --git a/application/language/system/index.html b/application/language/system/index.html old mode 100755 new mode 100644 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..204b1d30f --- /dev/null +++ b/application/libraries/DocumentLib.php @@ -0,0 +1,191 @@ +ci =& get_instance(); + + exec('unoconv --version', $ret_arr); + + if(isset($ret_arr[0])) + { + $hlp = explode(' ', $ret_arr[0]); + if(isset($hlp[1])) + { + $this->unoconv_version = $hlp[1]; + } + else + show_error('Could not get Unoconv Version'); + } + 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/EPrintfLib.php b/application/libraries/EPrintfLib.php new file mode 100644 index 000000000..dbef1348c --- /dev/null +++ b/application/libraries/EPrintfLib.php @@ -0,0 +1,138 @@ + "red", 33 => "orange"); + // Used to set if the migration process is called via command line or via browser + private $cli; + + /** + * Object initialization + */ + public function __construct() + { + // Get code igniter instance + $this->ci =& get_instance(); + + $this->setCli(); + } + + // ------------------------------------------------------------------------------------------------- + // Public methods + + /** + * Prints a formatted message + */ + public function printMessage($message) + { + $this->_print(EPrintfLib::MSG_PREFIX, $message); + } + + /** + * Prints a formatted info + */ + public function printInfo($info) + { + $this->_print(EPrintfLib::INFO_PREFIX, $info, EPrintfLib::INFO_COLOR); + } + + /** + * Prints a formatted error + */ + public function printError($error) + { + $this->_print(EPrintfLib::ERROR_PREFIX, $error, EPrintfLib::ERROR_COLOR); + } + + /** + * Print only the end of line + */ + public function printEOL() + { + echo $this->getEOL(); + } + + // ------------------------------------------------------------------------------------------------- + // Private methods + + /** + * Set property cli to false if the migration process is called via command line + * otherwise to false if it's called via browser + */ + private function setCli() + { + if ($this->ci->input->is_cli_request()) + { + $this->cli = true; + } + else + { + $this->cli = false; + } + } + + /** + * Returns the character of end of line + * PHP_EOL platform dependent if cli is true + * Tag
if cli is false + */ + private function getEOL() + { + if ($this->cli === true) + { + return PHP_EOL; + } + else + { + return "
"; + } + } + + /** + * Returns the string needed to color the output + */ + private function getColored($color) + { + $colored = "%s"; + + if (!is_null($color)) + { + if ($this->cli === true) + { + $colored = "\033[".$color."m%s\033[37m"; + } + else + { + $colored = "HTML_COLORS[$color]."\">%s"; + } + } + + return $colored; + } + + /** + * Print a message, even colored if specified + */ + private function _print($prefix, $text, $color = null) + { + printf($this->getColored($color), sprintf("%s %s".$this->getEOL(), $prefix, $text)); + } +} diff --git a/application/libraries/ExtensionsLib.php b/application/libraries/ExtensionsLib.php new file mode 100644 index 000000000..25e9c666a --- /dev/null +++ b/application/libraries/ExtensionsLib.php @@ -0,0 +1,886 @@ +UPLOAD_PATH = APPPATH.'tmp/'; + $this->EXTENSIONS_PATH = APPPATH.'extensions/'; + // Get code igniter instance + $this->ci =& get_instance(); + + // Loads message configurationx + $this->ci->config->load('message'); + + // Loads EPrintfLib + $this->ci->load->library('EPrintfLib'); + + // Loading models + $this->ci->load->model('system/Extensions_model', 'ExtensionsModel'); + + // Set default values fot class properties + $this->_errorOccurred = false; + $this->_currentInstalledExtensionVersion = 0; + } + + // ------------------------------------------------------------------------------------------------- + // Public methods + + /** + * Main method to install an extension + */ + public function installExtension() + { + $extensionDB = null; // contains data from DB about an extension + $extensionJson = null; // contains the extension.json data + + $this->_printInfo('WARNING!!! Please do not change page or stop this procedure before it is finished'); + + $this->_loadUploadLibrary(); // loads CI upload library + + $uploadData = $this->_uploadExtension(); // perform the upload of the file and returns info about it + + if ($uploadData != null) // if no error occurred + { + $this->_extractExtension($uploadData->fullPath); // extract the archive of the uploaded extension + + if (!$this->_errorOccurred) // if no error occurred + { + // Retives data about any previous installation of this extension + $extensionDB = $this->_loadPreviousInstallation($uploadData->extensionName); + } + + if (!$this->_errorOccurred) // if no error occurred + { + // Checks the structure of the uploaded extension + $this->_chkFSStructure($uploadData->extensionName); + } + + if (!$this->_errorOccurred) // if no error occurred + { + // Checks file extension.json and returns its content + $extensionJson = $this->_chkExtensionJson($uploadData->extensionName, $extensionDB); + } + + if ($extensionJson != null) // if no error occurred + { + $this->_printStart('Proceding with the installation of the extension: '.$extensionJson->name); + $this->_printEnd(); + + $this->_cleanPreviousInstallation($extensionJson); // cleans any previous installation + + $this->_installExtension($extensionJson); // records extension data in DB + + if (!$this->_errorOccurred) // if no error occurred + { + // Loads and executes neede SQL scripts + $this->_loadSQLs( + $this->UPLOAD_PATH.$extensionJson->name.'/'.ExtensionsLib::SQL_DIRECTORY, + $extensionJson + ); + } + + if (!$this->_errorOccurred) // if no error occurred + { + // Move the extracted extension from the temporary directory to the extensions install directory + $this->_moveExtension($extensionJson->name); + } + + if (!$this->_errorOccurred) // if no error occurred + { + // Create the symlinks to the installed extension + $this->_createSymLinks($extensionJson->name); + } + } + else + { + $this->_errorOccurred = true; + } + } + else + { + $this->_errorOccurred = true; + } + + if ($this->_errorOccurred === false) // if no errors occurred + { + if (!$this->_rrm($uploadData->fullPath)) // removes uploaded file + { + $this->_printInfo('Error while cleaning upload directory. Not a blocking error'); + } + + $this->_printMessage('Extension correctly installed, you can safely close this page'); + } + else + { + $this->_printError('There was a blocking error while installing/updating an extension, rolling back'); + + $this->_rollback($uploadData, $extensionDB, $extensionJson); // rock & rollback! + } + } + + /** + * Delete an installed extension using the extension_id stored in the DB + */ + public function delExtension($extensionId) + { + $delExtension = false; + + // Loads data about this extension from the DB + $result = $this->ci->ExtensionsModel->load($extensionId); + if (hasData($result)) // if something was found + { + $extensionName = $result->retval[0]->name; // extension name + $this->_delSoftLinks($extensionName); // not to be checked, could fail if the extension is disabled + // remove the extension from the extensions installation directory + $delExtension = $this->_rrm($this->EXTENSIONS_PATH.$extensionName); + + // Select all the version of this extension + $this->ci->ExtensionsModel->addSelect('extension_id'); + $result = $this->ci->ExtensionsModel->loadWhere(array('name' => $extensionName)); + if (hasData($result)) // if something was found + { + $extsArray = array(); + foreach ($result->retval as $key => $extension) // loops on them + { + // Remove them all + $result = $this->ci->ExtensionsModel->delete($extension->extension_id); + if (isSuccess($result)) + { + $delExtension = true; + } + } + } + } + + return $delExtension; + } + + /** + * Retrive the list of all the installed extensions + */ + public function getInstalledExtensions() + { + return $this->ci->ExtensionsModel->getInstalledExtensions(); + } + + /** + * To enable an extension + */ + public function enableExtension($extensionId) + { + return $this->_toggleExtension($extensionId, true); + } + + /** + * To disable an extension + */ + public function disableExtension($extensionId) + { + return $this->_toggleExtension($extensionId, false); + } + + // ------------------------------------------------------------------------------------------------- + // Private methods + + /** + * Loads the upload library of CI + */ + private function _loadUploadLibrary() + { + $this->ci->load->library( + 'upload', + array( + 'upload_path' => $this->UPLOAD_PATH, + 'allowed_types' => '*', + 'overwrite' => true + ) + ); + } + + /** + * Perform the upload of an extension archive and returns its data + */ + private function _uploadExtension() + { + $_uploadExtension = null; + + $this->_printStart('Uploading extension'); + + // If the upload was a success + if ($this->ci->upload->do_upload(ExtensionsLib::FILE_INPUT_NAME)) + { + $uploadData = $this->ci->upload->data(); // retrives data about the uploaded file + // Checks the file extension + $uploadedFileExtension = '.'.pathinfo($uploadData['full_path'], PATHINFO_EXTENSION); + if (!in_array($uploadedFileExtension, $this->ARCHIVE_EXTENSIONS)) + { + $this->_printFailure('file extension must be tgz OR tbz2'); + + // Remove the uploaded file + if (isset($uploadData['full_path']) && file_exists($uploadData['full_path'])) + { + $this->_rrm($uploadData['full_path']); + } + } + else + { + // Returns the extension name and the full path of the uploaded file + $_uploadExtension = new stdClass(); + $_uploadExtension->extensionName = str_replace($this->ARCHIVE_EXTENSIONS, '', $uploadData['file_name']); + $_uploadExtension->fullPath = $uploadData['full_path']; + } + } + else + { + $this->_printFailure($this->ci->upload->display_errors('', '')); + } + + $this->_printSuccess($_uploadExtension != null); + + $this->_printEnd(); + + return $_uploadExtension; + } + + /** + * To extract the extension archive + */ + private function _extractExtension($uploadPath) + { + $this->_printStart('Extracting extension'); + + try + { + // Extracts the uploaded file + $pd = new PharData($uploadPath); + + $pd->extractTo($this->UPLOAD_PATH, null, true); + } + catch (UnexpectedValueException $uva) + { + $this->_errorOccurred = true; + $this->_printFailure('provided an invalid archive'); + } + catch (PharException $pe) + { + $this->_errorOccurred = true; + $this->_printFailure('generic error occurred, check logs'); + } + + $this->_printSuccess(!$this->_errorOccurred); + + $this->_printEnd(); + } + + /** + * Loads any previous installations of the given extension from DB + */ + private function _loadPreviousInstallation($extensionName) + { + $extensionDB = null; + + $this->_printStart('Loads any previous installation data'); + + // Loads the last version of the previous installation of this extension + $this->ci->ExtensionsModel->addOrder('version', 'DESC'); + $this->ci->ExtensionsModel->addLimit(1); + $result = $this->ci->ExtensionsModel->loadWhere(array('name' => $extensionName)); + if (isError($result)) + { + $this->_errorOccurred = true; + $this->_printFailure('data base error: '.$result->retval); + } + else + { + if (hasData($result)) // if found + { + $extensionDB = $result->retval[0]; // return it! + } + else + { + $this->_printMessage('not found'); + } + } + + $this->_printSuccess(!$this->_errorOccurred); + + $this->_printEnd(); + + return $extensionDB; + } + + /** + * Checks the structure of the extension archive + */ + private function _chkFSStructure($extensionName) + { + $this->_printStart('Checking extension file system structure'); + + // Checks if the root directory of this archive has the same name of the extension + if (is_dir($this->UPLOAD_PATH.$extensionName)) + { + // Checks if file extension.json exists inside the uploaded archive + if (!file_exists($this->UPLOAD_PATH.$extensionName.'/'.ExtensionsLib::EXTENSION_JSON_NAME)) + { + $this->_errorOccurred = true; + $this->_printFailure('missing extension.json'); + } + } + else + { + $this->_errorOccurred = true; + $this->_printFailure('the root directory of the archive must have the same extension name'); + } + + $this->_printSuccess(!$this->_errorOccurred); + + $this->_printEnd(); + } + + /** + * Checks if extension.json is correct + */ + private function _chkExtensionJson($extensionName, $extensionDB) + { + $this->_printStart('Parsing and checking extension.json'); + + // Decodes extension.json + $extensionJson = json_decode( + file_get_contents($this->UPLOAD_PATH.$extensionName.'/'.ExtensionsLib::EXTENSION_JSON_NAME) + ); + + // Checks if the parameter name of the extension.json has the same value of the extension name + if ($extensionJson != null && isset($extensionJson->name) && $extensionJson->name == $extensionName) + { + // Checks if the parameter version of the extension.json file exists + if (isset($extensionJson->version)) + { + $extensionJson->currentInstalledVersion = 0; // default current installed version of this extension + + if ($extensionDB != null) // if no previous installation was found in DB + { + $extensionJson->extension_id = $extensionDB->extension_id; // get the extension_id from DB + $extensionJson->currentInstalledVersion = $extensionDB->version; // get the current installed version from DB + + $this->_printMessage('Extension already installed!'); + $this->_printMessage('Current version: '.$extensionDB->version); + $this->_printMessage('Version of the uploaded extension: '.$extensionJson->version); + + if ($extensionJson->version == $extensionDB->version) + { + $this->_printMessage('Updating the same version!'); + } + elseif ($extensionJson->version > $extensionDB->version) + { + $this->_printMessage('Updating to a new version!'); + } + else // downgrade is not possible + { + $extensionJson = null; + $this->_printFailure('downgrade must be performed manually'); + } + } + else + { + $this->_printMessage('Version of the uploaded extension: '.$extensionJson->version); + } + + // If no errors occurred + if ($extensionJson != null) + { + require_once('version.php'); // get the core version + // Checks if the required core version of the extension is the same of this system + if (isset($extensionJson->core_version) && $extensionJson->core_version == $fhcomplete_version) + { + $this->_printMessage('Required core version: '.$extensionJson->core_version); + $this->_printMessage('Current core version: '.$fhcomplete_version); + + // Checks parameter dependencies of the extension.json + if (isset($extensionJson->dependencies) + && is_array($extensionJson->dependencies) + && count($extensionJson->dependencies) > 0) + { + // Gets the required dependencies + $result = $this->ci->ExtensionsModel->getDependencies($extensionJson->dependencies); + // If they are matcheds + if (hasData($result) && count($result->retval) == count($extensionJson->dependencies)) + { + if (isset($extensionJson->dependencies)) + { + $extensionJson->dependencies = str_replace('[', '{', json_encode($extensionJson->dependencies)); + $extensionJson->dependencies = str_replace(']', '}', $extensionJson->dependencies); + + $this->_printMessage('Required dependencies: '.$extensionJson->dependencies); + } + else + { + $extensionJson->dependencies = ''; + + $this->_printMessage('No dependencies are required'); + } + } + else // Otherwise not to be installed + { + $extensionJson = null; + $this->_printFailure('dependencies are missing, install them to proceed'); + } + } + // Malformed dependencies parameter + elseif (isset($extensionJson->dependencies) && !is_array($extensionJson->dependencies)) + { + $extensionJson = null; + $this->_printFailure('dependencies parameter must be an array'); + } + // No dependencies required + elseif (!isset($extensionJson->dependencies)) + { + $this->_printMessage('No dependencies are required'); + } + } + else + { + $extensionJson = null; + $this->_printFailure('core_version parameter is missing or it is not equal to the versione of the core'); + } + } + } + else + { + $extensionJson = null; + $this->_printFailure('version is missing'); + } + } + else + { + $extensionJson = null; + $this->_printFailure('name is missing or not equal to extension name'); + } + + $this->_printSuccess($extensionJson != null); + + $this->_printEnd(); + + return $extensionJson; + } + + /** + * Clean any previous installations of the given archive + */ + private function _cleanPreviousInstallation($extensionJson) + { + $this->_printStart('Cleaning any previous installations in DB and file system'); + + // If a previous installation of this extension was found + if (isset($extensionJson->extension_id)) + { + // Off with their heads! + if ($this->delExtension($extensionJson->extension_id)) + { + $this->_printSuccess(true); + } + else + { + $this->_printFailure('please check logs'); + } + } + else + { + $this->_printMessage('No need to clean, no previous installations found'); + } + + $this->_printEnd(); + } + + /** + * Insert extension's data into the DB + */ + private function _installExtension($extensionJson) + { + $this->_printStart('Adding new entry in the DB'); + + $result = $this->ci->ExtensionsModel->insert( + array( + 'name' => $extensionJson->name, + 'description' => isset($extensionJson->description) ? $extensionJson->description : null, + 'version' => $extensionJson->version, + 'license' => isset($extensionJson->license) ? $extensionJson->license : null, + 'url' => isset($extensionJson->url) ? $extensionJson->url : null, + 'core_version' => $extensionJson->core_version, + 'dependencies' => isset($extensionJson->dependencies) ? $extensionJson->dependencies : null + ) + ); + if (isSuccess($result)) + { + $this->_printSuccess(true); + } + else + { + $this->_errorOccurred = true; + $this->_printFailure('error while saving extension into DB'); + } + + $this->_printEnd(); + } + + /** + * Loads all the SQL scripts from the extension archive and executes them + */ + private function _loadSQLs($pkgSQLsPath, $extensionJson) + { + $this->_printStart('Loading and executing SQL files'); + $this->_printInfo('WARNING: if this step will fail, the database and all the directories'); + $this->_printInfo('have to be clean manually before install again this extension'); + + $startVersion = $extensionJson->currentInstalledVersion; // current installed version extension + + // If the current installed version extension is less then the uploaded extension + if ($extensionJson->currentInstalledVersion < $extensionJson->version) + { + $startVersion++; // +1 + } + + // Loops through the versions + for ($sqlDir = $startVersion; $sqlDir <= $extensionJson->version; $sqlDir++) + { + // If a directory with the same value of the version is present in the sql scripts directory + if (($files = glob($pkgSQLsPath.'/'.$sqlDir.'/*'.ExtensionsLib::SQL_FILE_EXTENSION)) != false) + { + // Loads every sql files + foreach ($files as $file) + { + $sql = file_get_contents($file); // gets the entire content of the file + + $this->_printMessage('Executing query:'); + $this->_printMessage($sql); + + // Try to execute that + if (!isSuccess($result = @$this->ci->ExtensionsModel->executeQuery($sql))) + { + $this->_errorOccurred = true; + $this->_printFailure(' error occurred while executing the query'); + $this->_printInfo('Is not possible to rollback the DB changes, must be done manually'); + break; + } + else + { + $this->_printMessage('Query result:'); + var_dump($result->retval); // KEEP IT!!! + $this->ci->eprintflib->printEOL(); + } + } + } + } + + $this->_printSuccess(!$this->_errorOccurred); + + $this->_printEnd(); + } + + /** + * Move the extension extracted archive from the temporary directory to the extensions install directory + */ + private function _moveExtension($extensionName) + { + $this->_printStart('Moving the upload extension from upload folder to extension folder'); + + $this->_printMessage('Current extension directory: '.$this->UPLOAD_PATH.$extensionName); + $this->_printMessage('Directory where it will be moved: '.$this->EXTENSIONS_PATH.$extensionName); + + if (rename($this->UPLOAD_PATH.$extensionName.'/', $this->EXTENSIONS_PATH.$extensionName)) + { + $this->_printSuccess(true); + } + else + { + $this->_errorOccurred = true; + $this->_printFailure('error while moving'); + } + + $this->_printEnd(); + } + + /** + * Creates the symlinks to the installed extension + * Wrapper method to check the result of the operation and to print out info + */ + private function _createSymLinks($extensionName) + { + $this->_printStart('Creating symlinks'); + + if ($this->_addSoftLinks($extensionName)) + { + $this->_printSuccess(true); + } + else + { + $this->_errorOccurred = true; + $this->_printFailure('error while creating sym links'); + } + + $this->_printEnd(); + } + + /** + * Remove all the symlinks to the installed extension + */ + private function _delSoftLinks($extensionName) + { + $_delSoftLinks = false; + + foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $key => $targetDirectory) + { + if (file_exists(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) + { + $_delSoftLinks = unlink(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName); + } + } + + return $_delSoftLinks; + } + + /** + * Recursive remove of a file or a directory + */ + private function _rrm($dir) + { + if (!file_exists($dir)) + { + return true; + } + + if (!is_dir($dir)) + { + return unlink($dir); + } + + foreach (scandir($dir) as $item) + { + if ($item == '.' || $item == '..') + { + continue; + } + + if (!$this->_rrm($dir.DIRECTORY_SEPARATOR.$item)) + { + return false; + } + } + + return rmdir($dir); + } + + /** + * Creates the symlinks to the installed extension + */ + private function _addSoftLinks($extensionName) + { + $_addSoftLinks = false; + $extensionPath = $this->EXTENSIONS_PATH.$extensionName.'/'; + + // For every target directory + foreach ($this->SOFTLINK_TARGET_DIRECTORIES as $key => $targetDirectory) + { + // If destination of the symlink does not exist + if (!file_exists(APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName)) + { + // If the target directory does not exist than creates that + if (!is_dir($extensionPath.$targetDirectory)) + { + mkdir($extensionPath.$targetDirectory); + } + + // Create the symlink + $_addSoftLinks = symlink( + $extensionPath.$targetDirectory, + APPPATH.$targetDirectory.'/'.ExtensionsLib::EXTENSIONS_DIR_NAME.'/'.$extensionName + ); + if (!$_addSoftLinks) + { + break; + } + } + } + + return $_addSoftLinks; + } + + /** + * To rollback an extension installation + * It will be removed all the information about the given extension from DB and file system + */ + private function _rollback($uploadData, $extensionDB, $extensionJson) + { + $this->_printStart('Rolling back the installation'); + + $this->_printMessage('Removing the uploaded file from upload directory'); + if ($uploadData != null && isset($uploadData->fullPath) && file_exists($uploadData->fullPath)) + { + $this->_rrm($uploadData->fullPath); + } + + $this->_printMessage('Removing the extracted data from the upload directory'); + if ($uploadData != null + && isset($uploadData->extensionName) + && file_exists($this->UPLOAD_PATH.$uploadData->extensionName)) + { + $this->_rrm($this->UPLOAD_PATH.$uploadData->extensionName); + } + + // If the upload of the file is a success and the extension name is present and no previous installation were found + if ($uploadData != null && isset($uploadData->extensionName) && $extensionDB == null) + { + // Loads all the previous installations of this extension + $this->ci->ExtensionsModel->addOrder('version', 'DESC'); + $this->ci->ExtensionsModel->addLimit(1); + $result = $this->ci->ExtensionsModel->loadWhere(array('name' => $uploadData->extensionName)); + if (hasData($result)) // if found + { + // Remove them all from file system and DB + $this->_printMessage('Removing entries in the DB related to this extension'); + $this->delExtension($result->retval[0]->extension_id); + } + } + else // otherwise + { + // Remove them all only from DB + if ($extensionJson != null && isset($extensionJson->extension_id)) + { + $this->ci->ExtensionsModel->delete($extensionJson->extension_id); + } + } + + $this->_printMessage('Rollback finished'); + + $this->_printEnd(); + } + + /** + * To enable/disable an extension + */ + private function _toggleExtension($extensionId, $enabled) + { + $_toggleExtension = false; + + // Loads data from DB about the given extension + $result = $this->ci->ExtensionsModel->load($extensionId); + if (hasData($result)) + { + $extensionName = $result->retval[0]->name; // extension name + + // If to be enabled + if ($enabled === true) + { + // Add the symlinks + $_toggleExtension = $this->_addSoftLinks($extensionName); + } + else // If to be disabled + { + // Remove all the symlinks + $_toggleExtension = $this->_delSoftLinks($extensionName); + } + + if ($_toggleExtension) // if is a success + { + // Updates DB + $result = $this->ci->ExtensionsModel->update($extensionId, array('enabled' => $enabled)); + if (isSuccess($result)) + { + $_toggleExtension = true; + } + else // if DB update fails remove symlinks from file system + { + $this->_delSoftLinks($extensionName); + } + } + } + + return $_toggleExtension; + } + + /** + * Wrapper method to print a generic error + */ + private function _printError($error) + { + $this->ci->eprintflib->printError($error); + } + + /** + * Wrapper method to print an error + */ + private function _printFailure($error) + { + $this->_printError('Failed: '.$error); + } + + /** + * Wrapper method to print a generic message + */ + private function _printMessage($message) + { + $this->ci->eprintflib->printMessage($message); + } + + /** + * Wrapper method to print a success + */ + private function _printSuccess($cond) + { + if ($cond === true) + { + $this->_printMessage('Success!!!'); + } + } + + /** + * Wrapper method to print info + */ + private function _printInfo($info) + { + $this->ci->eprintflib->printInfo($info); + } + + /** + * Wrapper method to print a start message + */ + private function _printStart($startMessage) + { + $this->_printInfo('------------------------------------------------------------------------------------------'); + $this->_printMessage($startMessage); + } + + /** + * Wrapper method to print an end message + */ + private function _printEnd() + { + $this->_printInfo('------------------------------------------------------------------------------------------'); + } +} diff --git a/application/libraries/LogLib.php b/application/libraries/LogLib.php index be401f208..222ed7cc7 100644 --- a/application/libraries/LogLib.php +++ b/application/libraries/LogLib.php @@ -10,29 +10,29 @@ class LogLib const DEBUG = 'debug'; const ERROR = 'error'; const INFO = 'info'; - + const CALLER_PREFIX = '['; const CALLER_POSTFIX = ']'; const CLASS_POSTFIX = '->'; const LINE_SEPARATOR = ':'; - + /** * format */ private function format($class, $function, $line) { $formatted = LogLib::CALLER_PREFIX; - + if (!is_null($class) && $class != '') { $formatted .= $class.LogLib::CLASS_POSTFIX; } - + $formatted .= $function.LogLib::LINE_SEPARATOR.$line.LogLib::CALLER_POSTFIX.' '; - + return $formatted; } - + /** * getCaller */ @@ -44,20 +44,20 @@ class LogLib $class = ''; $function = ''; $line = ''; - - if (isset(debug_backtrace()[$classIndex]['class']) && debug_backtrace()[$classIndex]['class'] != '') + $backtrace_arr = debug_backtrace(); + if (isset($backtrace_arr[$classIndex]['class']) && $backtrace_arr[$classIndex]['class'] != '') { - $class = debug_backtrace()[$classIndex]['class']; + $class = $backtrace_arr[$classIndex]['class']; } - if (isset(debug_backtrace()[$functionIndex]['function']) && debug_backtrace()[$functionIndex]['function'] != '') + if (isset($backtrace_arr[$functionIndex]['function']) && $backtrace_arr[$functionIndex]['function'] != '') { - $function = debug_backtrace()[$functionIndex]['function']; + $function = $backtrace_arr[$functionIndex]['function']; } - if (isset(debug_backtrace()[$lineIndex]['line']) && debug_backtrace()[$lineIndex]['line'] != '') + if (isset($backtrace_arr[$lineIndex]['line']) && $backgrace_arr[$lineIndex]['line'] != '') { - $line = debug_backtrace()[$lineIndex]['line']; + $line = $backtrace_arr[$lineIndex]['line']; } return $this->format($class, $function, $line); diff --git a/application/libraries/MailLib.php b/application/libraries/MailLib.php old mode 100755 new mode 100644 diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php old mode 100755 new mode 100644 diff --git a/application/libraries/MigrationLib.php b/application/libraries/MigrationLib.php index a35cafc65..a461d7a82 100644 --- a/application/libraries/MigrationLib.php +++ b/application/libraries/MigrationLib.php @@ -7,173 +7,72 @@ if (! defined("BASEPATH")) exit("No direct script access allowed"); */ class MigrationLib extends CI_Migration { - // Prefixes and separator for messages - const MSG_PREFIX = "[-]"; - const INFO_PREFIX = "[I]"; - const ERROR_PREFIX = "[E]"; - const SEPARATOR = "------------------------------"; - // Console colors codes - const ERROR_COLOR = 31; - const INFO_COLOR = 33; - - const PRINT_QUERY_LEN = 60; - - // HTML colors names - private $HTML_COLORS = array(31 => "red", 33 => "orange"); - // Used to set if the migration process is called via command line or via browser - private $cli; - /** * Object initialization */ public function __construct() { parent::__construct(); - $this->setCli(); + + // Loads EPrintfLib + $this->load->library('EPrintfLib'); } - - /** - * Set property cli to false if the migration process is called via command line - * otherwise to false if it's called via browser - */ - private function setCli() - { - if ($this->input->is_cli_request()) - { - $this->cli = true; - } - else - { - $this->cli = false; - } - } - - /** - * Returns the character of end of line - * PHP_EOL platform dependent if cli is true - * Tag
if cli is false - */ - private function getEOL() - { - if ($this->cli === true) - { - return PHP_EOL; - } - else - { - return "
"; - } - } - - /** - * Returns the string needed to color the output - */ - private function getColored($color) - { - $colored = "%s"; - - if (!is_null($color)) - { - if ($this->cli === true) - { - $colored = "\033[".$color."m%s\033[37m"; - } - else - { - $colored = "HTML_COLORS[$color]."\">%s"; - } - } - - return $colored; - } - - /** - * Print a message, even colored if specified - */ - private function _print($prefix, $text, $color = null) - { - printf($this->getColored($color), sprintf("%s %s".$this->getEOL(), $prefix, $text)); - } - - /** - * Prints a formatted message - */ - private function printMessage($message) - { - $this->_print(MigrationLib::MSG_PREFIX, $message); - } - - /** - * Prints a formatted info - */ - private function printInfo($info) - { - $this->_print(MigrationLib::INFO_PREFIX, $info, MigrationLib::INFO_COLOR); - } - - /** - * Prints a formatted error - */ - private function printError($error) - { - $this->_print(MigrationLib::ERROR_PREFIX, $error, MigrationLib::ERROR_COLOR); - } - + /** * Check if a column exists in a table and schema */ private function columnExists($name, $schema, $table) { $query = sprintf("SELECT %s FROM %s.%s LIMIT 1", $name, $schema, $table); - + if (@$this->db->simple_query($query)) { return true; } - + return false; } - + /** * Print an info about the starting of method up */ protected function startUP() { - $this->printInfo( - sprintf("%s Start method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->eprintflib->printInfo( + sprintf("%s Start method up of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR) ); } - + /** * Print an info about the ending of method up */ protected function endUP() { - $this->printInfo( - sprintf("%s End method up of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->eprintflib->printInfo( + sprintf("%s End method up of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR) ); } - + /** * Print an info about the starting of method down */ protected function startDown() { - $this->printInfo( - sprintf("%s Start method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->eprintflib->printInfo( + sprintf("%s Start method down of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR) ); } - + /** * Print an info about the ending of method down */ protected function endDown() { - $this->printInfo( - sprintf("%s End method down of class %s %s", MigrationLib::SEPARATOR, get_called_class(), MigrationLib::SEPARATOR) + $this->eprintflib->printInfo( + sprintf("%s End method down of class %s %s", EPrintfLib::SEPARATOR, get_called_class(), EPrintfLib::SEPARATOR) ); } - + /** * Adds a column, with attributes, to a table and schema */ @@ -185,20 +84,20 @@ class MigrationLib extends CI_Migration { if ($this->dbforge->add_column($schema.'.'.$table, array($name => $definition))) { - $this->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"])); + $this->eprintflib->printMessage(sprintf("Column %s.%s.%s of type %s added", $schema, $table, $name, $definition["type"])); } else { - $this->printError(sprintf("Error while adding column %s.%s.%s of type %s", $schema, $table, $name, $definition["type"])); + $this->eprintflib->printError(sprintf("Error while adding column %s.%s.%s of type %s", $schema, $table, $name, $definition["type"])); } } else { - $this->printInfo(sprintf("Column %s.%s.%s already exists", $schema, $table, $name)); + $this->eprintflib->printInfo(sprintf("Column %s.%s.%s already exists", $schema, $table, $name)); } } } - + /** * Modifies a column, and its attributes, of a table and schema */ @@ -210,20 +109,20 @@ class MigrationLib extends CI_Migration { if ($this->dbforge->modify_column($schema.'.'.$table, array($name => $definition))) { - $this->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name)); + $this->eprintflib->printMessage(sprintf("Column %s.%s.%s has been modified", $schema, $table, $name)); } else { - $this->printError(sprintf("Error while modifying column %s.%s.%s", $schema, $table, $name)); + $this->eprintflib->printError(sprintf("Error while modifying column %s.%s.%s", $schema, $table, $name)); } } else { - $this->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $name)); + $this->eprintflib->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $name)); } } } - + /** * Drops a column from a table and schema */ @@ -233,19 +132,19 @@ class MigrationLib extends CI_Migration { if ($this->dbforge->drop_column($schema.'.'.$table, $field)) { - $this->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field)); + $this->eprintflib->printMessage(sprintf("Column %s.%s.%s has been dropped", $schema, $table, $field)); } else { - $this->printError(sprintf("Error while dropping column %s.%s.%s", $schema, $table, $field)); + $this->eprintflib->printError(sprintf("Error while dropping column %s.%s.%s", $schema, $table, $field)); } } else { - $this->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $field)); + $this->eprintflib->printInfo(sprintf("Column %s.%s.%s doesn't exist", $schema, $table, $field)); } } - + /** * Sets a column as primary key of a table and schema */ @@ -273,17 +172,17 @@ class MigrationLib extends CI_Migration { $query = sprintf("ALTER TABLE %s.%s ADD CONSTRAINT %s PRIMARY KEY (%s)", $schema, $table, $name, $fields); } - + if (@$this->db->simple_query($query)) { - $this->printMessage(sprintf("Added primary key %s on table %s.%s", $name, $schema, $table)); + $this->eprintflib->printMessage(sprintf("Added primary key %s on table %s.%s", $name, $schema, $table)); } else { - $this->printError(sprintf("Adding primary key %s on table %s.%s", $name, $schema, $table)); + $this->eprintflib->printError(sprintf("Adding primary key %s on table %s.%s", $name, $schema, $table)); } } - + /** * Sets a column as foreign key of a table and schema */ @@ -300,17 +199,17 @@ class MigrationLib extends CI_Migration $fieldDest, $attributes ); - + if (@$this->db->simple_query($query)) { - $this->printMessage(sprintf("Added foreign key %s on table %s.%s", $name, $schema, $table)); + $this->eprintflib->printMessage(sprintf("Added foreign key %s on table %s.%s", $name, $schema, $table)); } else { - $this->printError(sprintf("Adding foreign key %s on table %s.%s", $name, $schema, $table)); + $this->eprintflib->printError(sprintf("Adding foreign key %s on table %s.%s", $name, $schema, $table)); } } - + /** * Sets a column as unique key of a table and schema */ @@ -338,17 +237,17 @@ class MigrationLib extends CI_Migration { $query = sprintf("CREATE UNIQUE INDEX %s ON %s.%s (%s)", $name, $schema, $table, $fields); } - + if (@$this->db->simple_query($query)) { - $this->printMessage(sprintf("Added unique key %s on table %s.%s", $name, $schema, $table)); + $this->eprintflib->printMessage(sprintf("Added unique key %s on table %s.%s", $name, $schema, $table)); } else { - $this->printError(sprintf("Adding unique key %s on table %s.%s", $name, $schema, $table)); + $this->eprintflib->printError(sprintf("Adding unique key %s on table %s.%s", $name, $schema, $table)); } } - + /** * Grants permissions to a user on a table and schema */ @@ -379,7 +278,7 @@ class MigrationLib extends CI_Migration if (@$this->db->simple_query($query)) { - $this->printMessage( + $this->eprintflib->printMessage( sprintf( "Granted permissions %s on table %s.%s to user %s", is_null($stringPermission) ? $permissions : $stringPermission, @@ -391,7 +290,7 @@ class MigrationLib extends CI_Migration } else { - $this->printError( + $this->eprintflib->printError( sprintf( "Granting permissions %s on table %s.%s to user %s", is_null($stringPermission) ? $permissions : $stringPermission, @@ -402,24 +301,24 @@ class MigrationLib extends CI_Migration ); } } - + /** * Creates a table in a schema with columns */ protected function createTable($schema, $table, $fields) { $this->dbforge->add_field($fields); - + if ($this->dbforge->create_table($schema.'.'.$table, true)) { - $this->printMessage(sprintf("Table %s.%s created or existing", $schema, $table)); + $this->eprintflib->printMessage(sprintf("Table %s.%s created or existing", $schema, $table)); } else { - $this->printError(sprintf("Creating table %s.%s", $schema, $table)); + $this->eprintflib->printError(sprintf("Creating table %s.%s", $schema, $table)); } } - + /** * Drops a table from a schema */ @@ -427,62 +326,62 @@ class MigrationLib extends CI_Migration { if ($this->dbforge->drop_table($schema.".".$table)) { - $this->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table)); + $this->eprintflib->printMessage(sprintf("Table %s.%s has been dropped", $schema, $table)); } else { - $this->printError(sprintf("Dropping table %s.%s", $schema, $table)); + $this->eprintflib->printError(sprintf("Dropping table %s.%s", $schema, $table)); } } - + /** * Initializes a sequence with the max value of a column */ protected function initializeSequence($schemaSrc, $sequence, $schemaDst, $table, $field) { $query = sprintf("SELECT SETVAL('%s.%s', (SELECT MAX(%s) FROM %s.%s))", $schemaSrc, $sequence, $field, $schemaDst, $table); - + if (@$this->db->simple_query($query)) { - $this->printMessage(sprintf("Sequence %s.%s has been initialized", $schemaSrc, $sequence)); + $this->eprintflib->printMessage(sprintf("Sequence %s.%s has been initialized", $schemaSrc, $sequence)); } else { - $this->printError(sprintf("Initializing sequence %s.%s", $schemaSrc, $sequence)); + $this->eprintflib->printError(sprintf("Initializing sequence %s.%s", $schemaSrc, $sequence)); } } - + /** * Add comment to a column */ protected function addCommentToColumn($schema, $table, $field, $comment) { $query = sprintf("COMMENT ON COLUMN %s.%s.%s IS ?", $schema, $table, $field); - + if (@$this->db->query($query, array($comment))) { - $this->printMessage(sprintf("Comment added to %s.%s.%s", $schema, $table, $field)); + $this->eprintflib->printMessage(sprintf("Comment added to %s.%s.%s", $schema, $table, $field)); } else { - $this->printError(sprintf("Error while adding comment to %s.%s.%s", $schema, $table, $field)); + $this->eprintflib->printError(sprintf("Error while adding comment to %s.%s.%s", $schema, $table, $field)); } } - + /** * Add comment to a table */ protected function addCommentToTable($schema, $table, $comment) { $query = sprintf("COMMENT ON TABLE %s.%s IS ?", $schema, $table, $field); - + if (@$this->db->query($query, array($comment))) { - $this->printMessage(sprintf("Comment added to %s.%s", $schema, $table)); + $this->eprintflib->printMessage(sprintf("Comment added to %s.%s", $schema, $table)); } else { - $this->printError(sprintf("Error while adding comment to %s.%s", $schema, $table)); + $this->eprintflib->printError(sprintf("Error while adding comment to %s.%s", $schema, $table)); } } /** @@ -515,7 +414,7 @@ class MigrationLib extends CI_Migration if (@$this->db->simple_query($query)) { - $this->printMessage( + $this->eprintflib->printMessage( sprintf( "Granted permissions %s on sequence %s.%s to user %s", is_null($stringPermission) ? $permissions : $stringPermission, @@ -527,7 +426,7 @@ class MigrationLib extends CI_Migration } else { - $this->printError( + $this->eprintflib->printError( sprintf( "Granting permissions %s on sequence %s.%s to user %s", is_null($stringPermission) ? $permissions : $stringPermission, @@ -538,7 +437,7 @@ class MigrationLib extends CI_Migration ); } } - + /** * Executes the given query */ @@ -547,21 +446,21 @@ class MigrationLib extends CI_Migration if (! @$this->db->simple_query($query)) { $error = $this->db->error(); - + if (is_array($error) && isset($error["message"])) { - $this->printError($error["message"]); + $this->eprintflib->printError($error["message"]); } else { - $this->printError("Error while executing a query"); + $this->eprintflib->printError("Error while executing a query"); } } - - $this->printInfo( + + $this->eprintflib->printInfo( "Query correctly executed: ". - substr(preg_replace("/\s+/", " ", trim($query)), 0, MigrationLib::PRINT_QUERY_LEN). - (strlen($query) > MigrationLib::PRINT_QUERY_LEN ? "..." : "") + substr(preg_replace("/\s+/", " ", trim($query)), 0, EPrintfLib::PRINT_QUERY_LEN). + (strlen($query) > EPrintfLib::PRINT_QUERY_LEN ? "..." : "") ); } } 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..6b63ba472 --- /dev/null +++ b/application/libraries/PersonLogLib.php @@ -0,0 +1,79 @@ +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. + * Requirements for retrieving log: name is set + * @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)) + { + $decoded_logs = array(); + //decode logs + foreach ($result->retval as $log) + { + $log->logdata = json_decode($log->logdata); + //requirement - logname not null + if (isset($log->logdata->name)) + { + $decoded_logs[] = $log; + } + } + + return $decoded_logs; + } + else + show_error($result->retval); + } +} diff --git a/application/libraries/REST_Controller.php b/application/libraries/REST_Controller.php index d1bd334c6..e32cf75f7 100644 --- a/application/libraries/REST_Controller.php +++ b/application/libraries/REST_Controller.php @@ -351,7 +351,7 @@ abstract class REST_Controller extends CI_Controller { self::HTTP_INTERNAL_SERVER_ERROR => 'INTERNAL SERVER ERROR', self::HTTP_NOT_IMPLEMENTED => 'NOT IMPLEMENTED' ]; - + /** * Extend this function to apply additional checking early on in the process * @@ -361,7 +361,7 @@ abstract class REST_Controller extends CI_Controller { protected function early_checks() { } - + /** * Constructor for the REST API * @@ -385,7 +385,8 @@ abstract class REST_Controller extends CI_Controller { } // Check to see if this is CI 3.x - if (explode('.', CI_VERSION, 2)[0] < 3) + $ci_version_number = explode('.', CI_VERSION, 2); + if ($ci_version_number[0] < 3) { throw new Exception('REST Server requires CodeIgniter 3.x'); } @@ -528,7 +529,7 @@ abstract class REST_Controller extends CI_Controller { { $this->_allow = $this->_detect_api_key(); } - + // Only allow ajax requests if ($this->input->is_ajax_request() === FALSE && $this->config->item('rest_ajax_only')) { @@ -607,7 +608,7 @@ abstract class REST_Controller extends CI_Controller { //$controller_method = $object_called . '_' . $this->request->method; // CamelCase compliant $controller_method = $this->request->method.ucfirst($object_called); - + // Do we want to log this method (if allowed by config)? $log_method = !(isset($this->methods[$controller_method]['log']) && $this->methods[$controller_method]['log'] === FALSE); @@ -737,7 +738,7 @@ abstract class REST_Controller extends CI_Controller { // Set the format header $this->output->set_content_type($this->_supported_formats[$this->response->format], strtolower($this->config->item('charset'))); $output = $this->format->factory($data)->{'to_' . $this->response->format}(); - + // An array must be parsed as a string, so as not to cause an array to string error // Json is the most appropriate form for such a datatype if ($this->response->format === 'array') @@ -967,7 +968,7 @@ abstract class REST_Controller extends CI_Controller { $this->rest->level = NULL; $this->rest->user_id = NULL; $this->rest->ignore_limits = FALSE; - + // Find the key from server or arguments if (($key = isset($this->_args[$api_key_variable]) ? $this->_args[$api_key_variable] : $this->input->server($key_name))) { @@ -1899,7 +1900,7 @@ abstract class REST_Controller extends CI_Controller { ], self::HTTP_UNAUTHORIZED); } } - + /** * Prepares for basic authentication * @@ -1977,7 +1978,7 @@ abstract class REST_Controller extends CI_Controller { preg_match_all('@(username|nonce|uri|nc|cnonce|qop|response)=[\'"]?([^\'",]+)@', $digest_string, $matches); $digest = (empty($matches[1]) || empty($matches[2])) ? [] : array_combine($matches[1], $matches[2]); - // For digest authentication the library function should return + // For digest authentication the library function should return // already stored password for that username, even if it is hashed $username = $this->_check_login($digest['username'], TRUE); // If there no password @@ -2154,4 +2155,4 @@ abstract class REST_Controller extends CI_Controller { ->get($this->config->item('rest_access_table')) ->num_rows() > 0; } -} \ No newline at end of file +} 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/libraries/extensions/.placeholder b/application/libraries/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/libraries/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/libraries/index.html b/application/libraries/index.html old mode 100755 new mode 100644 diff --git a/application/logs/index.html b/application/logs/index.html old mode 100755 new mode 100644 diff --git a/application/models/crm/Akte_model.php b/application/models/crm/Akte_model.php index 4301af240..8eba43521 100644 --- a/application/models/crm/Akte_model.php +++ b/application/models/crm/Akte_model.php @@ -70,7 +70,7 @@ class Akte_model extends DB_Model return $this->execQuery($query, $parametersArray); } - + /** * getAktenAccepted */ @@ -116,7 +116,7 @@ class Akte_model extends DB_Model return $this->execQuery($query, $parametersArray); } - + /** * getAktenAcceptedDms */ @@ -173,4 +173,35 @@ class Akte_model extends DB_Model return $this->execQuery($query, $parametersArray); } + + /** + * gets Akten together with documenttype info, mainly bezeichnung fields + * @param $person_id + * @param null $dokument_kurzbz + * @param bool $nachgereicht if true, retrieves only nachgereichte Dokumente. if false, only not nachgereichte. default: null, all Dokumente + * @return array + */ + public function getAktenWithDokInfo($person_id, $dokument_kurzbz = null, $nachgereicht = null) + { + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + + $this->addSelect('public.tbl_akte.*, bezeichnung_mehrsprachig, dokumentbeschreibung_mehrsprachig, public.tbl_dokument.bezeichnung as dokument_bezeichnung, bis.tbl_nation.*, ausstellungsdetails'); + $this->addJoin('public.tbl_dokument', 'dokument_kurzbz'); + $this->addJoin('bis.tbl_nation', 'ausstellungsnation = nation_code', 'LEFT'); + + $where = array(); + $where['person_id'] = $person_id; + if(isset($dokument_kurzbz)) + $where['dokument_kurzbz'] = $dokument_kurzbz; + if(is_bool($nachgereicht)) + $where['nachgereicht'] = $nachgereicht; + + $dokumente = $this->loadWhere($where); + + if($dokumente->error) + return error($dokumente->retval); + + return success($dokumente->retval); + } + } diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 2919036e9..ff4dd95a4 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -192,4 +192,41 @@ class Prestudent_model extends DB_Model return $this->execQuery(sprintf($query, is_array($prestudent_id) ? 'IN' : '='), array($prestudent_id)); } + + + /** + * gets extended zgv data (with zgv bezeichnung) for a prestudent + * includes last status, Studiengang, zgv, zgv master + * @param $prestudent_id + */ + public function getPrestudentWithZgv($prestudent_id) + { + $this->addSelect('tbl_prestudent.*, tbl_studiengang.kurzbzlang as studiengang, tbl_studiengang.typ as studiengangtyp, tbl_zgv.zgv_code, tbl_zgv.zgv_bez, + tbl_prestudent.zgvort, tbl_prestudent.zgvdatum, tbl_prestudent.zgvnation as zgvnation_code, zgvnat.kurztext as zgvnation_kurzbez, zgvnat.langtext as zgvnation_bez, zgvnat.engltext as zgvnation_englbez, + tbl_zgvmaster.zgvmas_code, tbl_zgvmaster.zgvmas_bez, tbl_prestudent.zgvmaort, tbl_prestudent.zgvmadatum, tbl_prestudent.zgvmanation as zgvmanation_code, zgvmanat.kurztext as zgvmanation_kurzbez, zgvmanat.langtext as zgvmanation_bez, zgvmanat.engltext as zgvmanation_englbez'); + $this->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT'); + $this->addJoin('bis.tbl_zgv', 'zgv_code', 'LEFT'); + $this->addJoin('bis.tbl_zgvmaster', 'zgvmas_code', 'LEFT'); + $this->addJoin('bis.tbl_nation zgvnat', 'zgvnation = zgvnat.nation_code', 'LEFT'); + $this->addJoin('bis.tbl_nation zgvmanat', 'zgvmanation = zgvmanat.nation_code', 'LEFT'); + + $prestudent = $this->load($prestudent_id); + if($prestudent->error) + return error($prestudent->retval); + + //Prestudentstatus + $this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel'); + $lastStatus = $this->PrestudentstatusModel->getLastStatus($prestudent_id); + + if ($lastStatus->error) + { + return error($lastStatus->retval); + } + + if(count($lastStatus->retval) > 0) + $prestudent->retval[0]->prestudentstatus = $lastStatus->retval[0]; + + return success($prestudent->retval); + } + } diff --git a/application/models/extensions/.placeholder b/application/models/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/models/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/models/index.html b/application/models/index.html old mode 100755 new mode 100644 diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php old mode 100755 new mode 100644 diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index fc41c9e40..61f935d19 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -94,5 +94,56 @@ 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)); + + if (isSuccess($result)) + { + $notiz_id = $result->retval; + $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; + } + + /** + * gets all Notizen for a person + * @param $person_id + */ + public function getNotiz($person_id) + { + // Join with the table public.tbl_notizzuordnung using notiz_id + $this->addJoin('public.tbl_notizzuordnung', 'notiz_id'); + + return $this->loadWhere(array('person_id' => $person_id)); + } // ------------------------------------------------------------------------------------------------------ -} \ No newline at end of file + +} diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 2ea9d4d25..caf746b94 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -18,7 +18,7 @@ class Person_model extends DB_Model public function getPersonKontaktByZugangscode($zugangscode, $email) { $this->addJoin('public.tbl_kontakt', 'person_id'); - + return $this->loadWhere(array('zugangscode' => $zugangscode, 'kontakt' => $email)); } @@ -135,4 +135,63 @@ class Person_model extends DB_Model return $result; } + + /** + * Searches a Person + * @param $filter Term to search for. + * @return DB-result + */ + public function searchPerson($filter) + { + $this->addSelect('vorname, nachname, gebdatum, person_id'); + $result = $this->loadWhere( + 'lower(nachname) like '.$this->db->escape('%'.$filter.'%')." + OR lower(vorname) like ".$this->db->escape('%'.$filter.'%')." + OR lower(nachname || ' ' || vorname) like ".$this->db->escape('%'.$filter.'%')." + OR lower(vorname || ' ' || nachname) like ".$this->db->escape('%'.$filter.'%')); + + return $result; + } + + /** + * gets Stammdaten for a person, including contactdata in textform from other tables + * nation, kontakt, adresse + * @param $person_id + * @return array + */ + public function getPersonStammdaten($person_id) + { + $this->addSelect('tbl_person.*, s.kurztext as staatsbuergerschaft, g.kurztext as geburtsnation'); + $this->addJoin('bis.tbl_nation s', 'tbl_person.staatsbuergerschaft = s.nation_code', 'LEFT'); + $this->addJoin('bis.tbl_nation g', 'tbl_person.geburtsnation = g.nation_code', 'LEFT'); + + $person = $this->load($person_id); + + if($person->error) + return error($person->retval); + + //return null if not found + if(count($person->retval) < 1) + return success(null); + + $this->load->model('person/kontakt_model', 'KontaktModel'); + $this->load->model('person/adresse_model', 'AdresseModel'); + + $this->KontaktModel->addDistinct(); + $this->KontaktModel->addSelect('kontakttyp, anmerkung, kontakt, zustellung'); + $this->KontaktModel->addOrder('kontakttyp'); + $kontakte = $this->KontaktModel->loadWhere(array('person_id' => $person_id)); + if($kontakte->error) + return error($kontakte->retval); + + $adressen = $this->AdresseModel->loadWhere(array('person_id' => $person_id)); + if($adressen->error) + return error($adressen->retval); + + $stammdaten = $person->retval[0]; + $stammdaten->kontakte = $kontakte->retval; + $stammdaten->adressen = $adressen->retval; + + return success($stammdaten); + } } diff --git a/application/models/system/Extensions_model.php b/application/models/system/Extensions_model.php new file mode 100644 index 000000000..c93817040 --- /dev/null +++ b/application/models/system/Extensions_model.php @@ -0,0 +1,56 @@ +dbTable = 'system.tbl_extensions'; + $this->pk = 'extension_id'; + } + + /** + * getDependencies + */ + public function getDependencies($dependencies) + { + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + + return $this->execQuery( + 'SELECT * + FROM '.$this->dbTable.' + WHERE enabled = TRUE + AND name IN ?', + array('name' => $dependencies) + ); + } + + /** + * + */ + public function getInstalledExtensions() + { + $query = 'SELECT extension_id, e1.name, e1.version, description, license, url, core_version, dependencies, enabled + FROM system.tbl_extensions e1 + INNER JOIN ( + SELECT name, MAX(version) AS version + FROM system.tbl_extensions + GROUP BY name) e2 + ON (e1.name = e2.name AND e1.version = e2.version)'; + + return $this->execQuery($query); + } + + /** + * + */ + public function executeQuery($sql) + { + if (isError($ent = $this->isEntitled($this->dbTable, PermissionLib::SELECT_RIGHT, FHC_NORIGHT, FHC_MODEL_ERROR))) return $ent; + + return $this->execQuery($sql); + } +} 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/MessageToken_model.php b/application/models/system/MessageToken_model.php old mode 100755 new mode 100644 index 6d808e792..fb7f81a0a --- a/application/models/system/MessageToken_model.php +++ b/application/models/system/MessageToken_model.php @@ -47,7 +47,7 @@ class MessageToken_model extends CI_Model LIMIT 1'; $result = $this->db->query($sql, array(MSG_STATUS_DELETED, $token)); - + // If no errors occurred if ($result) { @@ -58,7 +58,7 @@ class MessageToken_model extends CI_Model return error($this->db->error()); } } - + /** * Set the status of a message to read. If the status of the message * is already read then update updateamum @@ -82,19 +82,20 @@ class MessageToken_model extends CI_Model ) s ON (r.message_id = s.message_id AND r.person_id = s.person_id) WHERE r.token = ? LIMIT 1'; - + $msgs = $this->db->query($sql, array(MSG_STATUS_ARCHIVED, $token)); - + // If no errors occurred if ($msgs) { + $msgs_result = $msgs->result(); // If at least a record is present - if (count($msgs->result()) > 0) + if (count($msgs_result) > 0) { - $msg = $msgs->result()[0]; - + $msg = $msgs_result[0]; + $msgStatusResult = false; // pessimistic expectation - + // If the status of the message is unread if ($msg->status == MSG_STATUS_UNREAD) { @@ -118,31 +119,31 @@ class MessageToken_model extends CI_Model { // Update updateamum to current date $this->db->set('updateamum', 'NOW()'); - + $this->db->where('message_id', $msg->message_id); $this->db->where('person_id', $msg->receiver_id); $this->db->where('status', MSG_STATUS_READ); - + $msgStatusResult = $this->db->update('public.tbl_msg_status'); } - + // If some of the previous DB manipulation (update or insert) has failed if (!$msgStatusResult) { return error($this->db->error()); } } - - return success($msgs->result()); + + return success($msgs_result); } else { return error($this->db->error()); } - + return success($result->result()); } - + /** * Get data of the message sender */ @@ -159,9 +160,9 @@ class MessageToken_model extends CI_Model LEFT JOIN public.tbl_benutzer b USING(person_id) LEFT JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid) WHERE p.person_id = ?'; - + $result = $this->db->query($sql, array($person_id)); - + // If no errors occurred if ($result) { @@ -172,9 +173,9 @@ class MessageToken_model extends CI_Model return error($this->db->error()); } } - + /** - * + * */ public function isEmployee($person_id) { @@ -184,24 +185,25 @@ class MessageToken_model extends CI_Model LEFT JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid) WHERE p.person_id = ? AND b.aktiv = TRUE'; - + $result = $this->db->query($sql, array($person_id)); - + // If no errors occurred if ($result) { // If data are present if (is_array($result->result()) && count($result->result()) > 0) { - $person = $result->result()[0]; - + $personresults = $result->result(); + $person = $personresults[0]; + // If it is an employee if ($person->mitarbeiter_uid != null) { return true; } } - + return false; } else @@ -209,4 +211,52 @@ class MessageToken_model extends CI_Model return error($this->db->error()); } } -} \ No newline at end of file + + /** + * getRoot - Get the root of the organisation unit tree which belongs the given organisation unit parameter + */ + public function getOERoot($oe_kurzbz) + { + $sql = ' + WITH RECURSIVE organizations(rid, oe_kurzbz, oe_parent_kurzbz) AS + ( + SELECT 1 AS rid, o.oe_kurzbz, o.oe_parent_kurzbz + FROM public.tbl_organisationseinheit o + WHERE o.oe_kurzbz = ? + UNION ALL + SELECT rid + 1 AS rid, oe.oe_kurzbz, oe.oe_parent_kurzbz + FROM organizations org, public.tbl_organisationseinheit oe + WHERE oe.oe_kurzbz = org.oe_parent_kurzbz + AND oe.aktiv = TRUE + ) + SELECT oe_kurzbz + FROM organizations orgs + ORDER BY rid DESC + LIMIT 1 + '; + + $result = $this->db->query($sql, array($oe_kurzbz)); + if ($result) // If no errors occurred + { + $result_arr = $result->result(); + // If data are present + if (is_array($result_arr) + && count($result_arr) > 0 + && is_object($result_arr[0]) + && isset($result_arr[0]->oe_kurzbz)) + { + return success($result_arr[0]->oe_kurzbz); + } + else + { + return error(); + } + } + else + { + return error($this->db->error()); + } + + return $result; + } +} 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/third_party/index.html b/application/third_party/index.html old mode 100755 new mode 100644 diff --git a/application/tmp/.placeholder b/application/tmp/.placeholder new file mode 100644 index 000000000..e69de29bb diff --git a/application/views/errors/cli/error_404.php b/application/views/errors/cli/error_404.php old mode 100755 new mode 100644 diff --git a/application/views/errors/cli/error_db.php b/application/views/errors/cli/error_db.php old mode 100755 new mode 100644 diff --git a/application/views/errors/cli/error_exception.php b/application/views/errors/cli/error_exception.php old mode 100755 new mode 100644 diff --git a/application/views/errors/cli/error_general.php b/application/views/errors/cli/error_general.php old mode 100755 new mode 100644 diff --git a/application/views/errors/cli/error_php.php b/application/views/errors/cli/error_php.php old mode 100755 new mode 100644 diff --git a/application/views/errors/cli/index.html b/application/views/errors/cli/index.html old mode 100755 new mode 100644 diff --git a/application/views/errors/html/error_404.php b/application/views/errors/html/error_404.php old mode 100755 new mode 100644 diff --git a/application/views/errors/html/error_db.php b/application/views/errors/html/error_db.php old mode 100755 new mode 100644 diff --git a/application/views/errors/html/error_exception.php b/application/views/errors/html/error_exception.php old mode 100755 new mode 100644 diff --git a/application/views/errors/html/error_general.php b/application/views/errors/html/error_general.php old mode 100755 new mode 100644 diff --git a/application/views/errors/html/error_php.php b/application/views/errors/html/error_php.php old mode 100755 new mode 100644 diff --git a/application/views/errors/html/index.html b/application/views/errors/html/index.html old mode 100755 new mode 100644 diff --git a/application/views/errors/index.html b/application/views/errors/index.html old mode 100755 new mode 100644 diff --git a/application/views/extensions/.placeholder b/application/views/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/views/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/views/index.html b/application/views/index.html old mode 100755 new mode 100644 diff --git a/application/views/system/extensions/manager.php b/application/views/system/extensions/manager.php new file mode 100644 index 000000000..6c48bc80a --- /dev/null +++ b/application/views/system/extensions/manager.php @@ -0,0 +1,168 @@ +load->view('templates/header', array('title' => 'Extensions manager', 'jqueryV1' => true, 'tablesort' => true)); ?> + + + + + + '; + } + elseif (isError($extensions)) + { + echo 'An error occurred while retriving extenions list.'; + } + elseif (hasData($extensions)) + { + ?> +
+ List of installed extensions +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + '; + + foreach ($extensions->retval as $key => $extension) + { + echo sprintf( + $tableRow, + $extension->name, + $extension->description, + $extension->version, + $extension->license, + $extension->url, + $extension->core_version, + count($extension->dependencies) == 0 ? 'None' : json_encode($extension->dependencies), + $extension->extension_id, + $extension->enabled === true ? 'checked' : '', + $extension->extension_id + ); + } + ?> + + +
NameDescriptionVersionLicenceURLMinimum required Core versionDependes on (extensions)Enabled 
%s%s%s%s%s%s%s + + + Remove +
+ + +
+ + + + + + + + +load->view('templates/footer'); ?> 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..b8a7de4bd --- /dev/null +++ b/application/views/system/infocenter/infocenterData.php @@ -0,0 +1,133 @@ + ' + SELECT + p.person_id AS "PersonId", + p.vorname AS "Vorname", + p.nachname AS "Nachname", + p.gebdatum AS "Gebdatum", + ( + SELECT zeitpunkt + FROM system.tbl_log + WHERE taetigkeit_kurzbz = \'bewerbung\' + AND person_id = p.person_id + ORDER BY zeitpunkt DESC + LIMIT 1 + ) AS "LastAction", + ( + SELECT insertvon + FROM system.tbl_log + WHERE taetigkeit_kurzbz = \'bewerbung\' + AND person_id = p.person_id + ORDER BY zeitpunkt DESC + LIMIT 1 + ) AS "User/Operator", + ( + SELECT + pss.studiensemester_kurzbz + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + WHERE pss.status_kurzbz = \'Interessent\' + AND pss.bestaetigtam IS NULL + AND pss.bestaetigtvon IS NULL + AND ps.person_id = p.person_id + ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC + LIMIT 1 + ) AS "Studiensemester", + ( + SELECT pss.bewerbung_abgeschicktamum + FROM + public.tbl_prestudentstatus pss + INNER JOIN public.tbl_prestudent ps USING(prestudent_id) + WHERE pss.status_kurzbz = \'Interessent\' + AND pss.bestaetigtam IS NULL + AND pss.bestaetigtvon IS NULL + AND ps.person_id = p.person_id + ORDER BY pss.datum DESC, pss.insertamum DESC, pss.ext_id DESC + LIMIT 1 + ) AS "SendDate" + FROM public.tbl_person p + WHERE + EXISTS( + SELECT 1 + FROM public.tbl_prestudent + WHERE person_id=p.person_id + AND \'Interessent\' = (SELECT status_kurzbz FROM public.tbl_prestudentstatus + WHERE prestudent_id=tbl_prestudent.prestudent_id + ORDER BY datum DESC, insertamum DESC, ext_id DESC + LIMIT 1 + ) + AND EXISTS (SELECT 1 FROM public.tbl_prestudentstatus + WHERE prestudent_id=tbl_prestudent.prestudent_id + AND status_kurzbz=\'Interessent\' AND bestaetigtam IS NULL and bestaetigtvon IS NULL + AND studiensemester_kurzbz IN ( + SELECT studiensemester_kurzbz + FROM public.tbl_studiensemester + WHERE (NOW() >= start AND NOW() <= ende) + OR start > NOW() + ) + ) + ) + ORDER BY "LastAction" DESC + ', + 'hideHeader' => false, + 'hideSave' => false, + 'additionalColumns' => array('Details'), + 'formatRaw' => function($fieldName, $fieldValue, $datasetRaw) { + + if ($fieldName == 'Details') + { + $link = 'Details'; + + $datasetRaw->{$fieldName} = sprintf( + $link, + base_url('index.ci.php/system/infocenter/infocenterDetails/showDetails/'), + $datasetRaw->PersonId + ); + } + + if ($fieldName == 'SendDate') + { + if ($datasetRaw->{$fieldName} == '1970.01.01 01:00:00') + { + $datasetRaw->{$fieldName} = 'Not sent'; + } + } + + if ($fieldName == 'LastAction') + { + if ($datasetRaw->{$fieldName} == '1970.01.01 01:00:00') + { + $datasetRaw->{$fieldName} = 'Not logged'; + } + } + + if ($fieldName == 'User/Operator') + { + if ($datasetRaw->{$fieldName} == '') + { + $datasetRaw->{$fieldName} = 'NA'; + } + } + + return $datasetRaw; + } + ); + + $filterId = isset($_GET['filterId']) ? $_GET['filterId'] : null; + + if (isset($filterId) && is_numeric($filterId)) + { + $filterWidgetArray['filterId'] = $filterId; + } + else + { + $filterWidgetArray['app'] = 'aufnahme'; + $filterWidgetArray['datasetName'] = 'PersonActions'; + $filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll'; + } + + 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..19e9dc1d9 --- /dev/null +++ b/application/views/system/infocenter/infocenterDetails.php @@ -0,0 +1,667 @@ +load->view('templates/FHC-Header', array('title' => 'InfocenterDetails', 'jquery3' => true, 'bootstrap' => true, 'fontawesome' => true, 'bootstrapdatepicker' => true, 'datatables' => true, 'sbadmintemplate' => true)); +?> + +
+
+
+ +
+
+
+
+
+
+

Stammdaten

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Vornamevorname ?>
Nachname + nachname ?>
Geburtsdatum + gebdatum), 'd.m.Y') ?>
Sozialversicherungsnr + svnr ?>
Staatsbürgerschaft + staatsbuergerschaft ?>
Geschlecht + geschlecht ?>
Geburtsnation + geburtsnation ?>
Geburtsortgebort ?>
+
+
+ + + + + + + + + + + + + + kontakte as $kontakt): ?> + + + + + + + + + adressen as $adresse): ?> + + + + + + + + +
Kontakte
TypKontaktZustellungAnmerkung
kontakttyp); ?> + kontakttyp === 'email'): ?> + + kontakt; + if ($kontakt->kontakttyp === 'email'): + ?> + + + zustellung === true ? '' : ''; ?>anmerkung; ?>
+ Adresse + + strasse.', '.$adresse->plz.' '.$adresse->ort : '' ?> + + zustelladresse === true ? '' : '' ?> + + heimatadresse === true ? 'Heimatadresse' : '').($adresse->heimatadresse === true && $adresse->rechnungsadresse === true ? ', ' : '').($adresse->rechnungsadresse === true ? 'Rechnungsadresse' : ''); ?> +
+
+
+
+
+
+
+
+
+
+
+
+ +

Dokumentenprüfung

+
+ + + + + + + + + + + formal_geprueft_amum) ? "checked" : ""; + ?> + + + + + + + + + + +
NameTypUploaddatumAusstellungsnationFormal geprüft
+ titel) ? $dokument->bezeichnung : $dokument->titel ?> + dokument_bezeichnung ?>erstelltam), 'd.m.Y') ?>langtext ?> + /> + formal_geprueft_amum) ? date_format(date_create($dokument->formal_geprueft_amum), 'd.m.Y') : ''; ?> +
+ 0): ?> +
+

Nachzureichende Dokumente:

+ + + + + + + + + + + + + + + + + + +
TypNachzureichen amAusstellungsnationAnmerkung
dokument_bezeichnung ?> + nachgereicht_am) ? date_format(date_create($dokument->nachgereicht_am), 'd.m.Y') : ''; ?> + + langtext ?> + + anmerkung; ?> +
+ +
+
+
+
+
+
+
+
+
+
+ +

ZGV-Prüfung

+
+
+
+ infoonly; ?> +
+ +
+
+
+
+
+
+ + prestudentstatus->bestaetigtam) ? "ja" : "nein" ?> +
+
+
+
+ + prestudentstatus->status_kurzbz) ? $zgvpruefung->prestudentstatus->status_kurzbz : '' ?> +
+
+
+
+ + prestudentstatus->studiensemester_kurzbz) ? $zgvpruefung->prestudentstatus->studiensemester_kurzbz : '' ?> +
+
+
+
+ + prestudentstatus->ausbildungssemester) ? $zgvpruefung->prestudentstatus->ausbildungssemester : '' ?> +
+
+
+
+
+
+ + zgv_bez; + else + echo $this->widgetlib->widget( + 'Zgv_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgv_code), + array('name' => 'zgv', 'id' => 'zgv') + ); ?> +
+
+
+
+ + zgvort; + else: + ?> + + +
+
+
+
+ + zgvdatum), 'd.m.Y'); + else: + ?> + zgvdatum), 'd.m.Y') ?>" + name="zgvdatum"> + +
+
+
+
+ + zgvnation_bez; + else + echo $this->widgetlib->widget( + 'Nation_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvnation_code), + array('name' => 'zgvnation', 'id' => 'zgvnation') + ); ?> +
+
+
+ + studiengangtyp === 'm') : ?> +
+
+
+ zgvmas_bez; + else + echo $this->widgetlib->widget( + 'Zgvmaster_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvmas_code), + array('name' => 'zgvmas', 'id' => 'zgvmas') + ); ?> +
+
+
+
+ + zgvmaort; + else: + ?> + + +
+
+
+
+ + zgvmadatum), 'd.m.Y'); + else: + ?> + zgvmadatum), 'd.m.Y') ?>" + name="zgvmadatum"> + +
+
+
+
+ zgvmanation_bez; + else + echo $this->widgetlib->widget( + 'Nation_widget', + array(DropdownWidget::SELECTED_ELEMENT => $zgvpruefung->zgvmanation_code), + array('name' => 'zgvmanation', 'id' => 'zgvmanation') + ); ?> +
+
+
+ + + +
+
+ +
+
+ +
+ + +
+
+
+
+
+ + +
+ + +
+
+
+
+
+
+ +
+
+ + +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +

Notizen & Aktivitäten

+
+
+
+
+
+
+
+ +
+
+ +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
DatumNotizUser
insertamum), 'd.m.Y H:i:s') ?>titel ?>verfasser_uid ?>
+
+
+ + + + + + + + + + + + + + + +
DatumAktivitätUser
zeitpunkt), 'd.m.Y H:i:s') ?>logdata->name) ? $log->logdata->name : '' ?>insertvon ?>
+
+
+
+
+
+
+
+
+ + +load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/infocenter/infocenterFilters.php b/application/views/system/infocenter/infocenterFilters.php new file mode 100644 index 000000000..9780be77f --- /dev/null +++ b/application/views/system/infocenter/infocenterFilters.php @@ -0,0 +1,30 @@ + $description) + { + $toPrint = ''; + + echo sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filterId'), $filterId, $description).PHP_EOL; + } + } + +// HTML + // body + // span +?> +
+ +
+ Abgeschickt: +
+ + + +
+ Nicht abgeschickt: +
+ + + +
diff --git a/application/views/system/messageHTML.php b/application/views/system/messageHTML.php old mode 100755 new mode 100644 diff --git a/application/views/system/vorlage/templatetextList.php b/application/views/system/vorlage/templatetextList.php old mode 100755 new mode 100644 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..40467bfbd --- /dev/null +++ b/application/views/templates/FHC-Header.php @@ -0,0 +1,149 @@ +'; + + 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/templates/mailHTML.php b/application/views/templates/mailHTML.php old mode 100755 new mode 100644 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..438862eb1 --- /dev/null +++ b/application/widgets/FilterWidget.php @@ -0,0 +1,1115 @@ +_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) + { + // + $filterSessionArray = $this->session->userdata(self::SESSION_NAME); + + // + if ($this->filterId == null && isset($filterSessionArray[self::FILTER_ID])) + { + $this->filterId = $filterSessionArray[self::FILTER_ID]; + } + + // + if ($filterSessionArray[self::FILTER_ID] != $this->filterId) + { + // + $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(); + } + + if (!isset($filterSessionArray[self::FILTER_ID])) + { + $filterSessionArray[self::FILTER_ID] = -1; + } + + $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] + ); + + $filterSessionArray[self::FILTER_ID] = $this->filterId; + + $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 ($first) + { + $first = false; + } + else + { + $where .= ' AND '; + } + + if (isset($activeFiltersOperation[$field])) + { + $where .= '"'.$field.'"'; + $condition = ''; + + switch ($activeFiltersOperation[$field]) + { + case self::OP_EQUAL: + if (!is_numeric($activeFilterValue)) $activeFilterValue = 0; + $condition = ' = '.$activeFilterValue; + break; + case self::OP_NOT_EQUAL: + if (!is_numeric($activeFilterValue)) $activeFilterValue = 0; + $condition = ' != '.$activeFilterValue; + break; + case self::OP_GREATER_THAN: + if (!is_numeric($activeFilterValue)) $activeFilterValue = 0; + $condition = ' > '.$activeFilterValue; + break; + case self::OP_LESS_THAN: + if (!is_numeric($activeFilterValue)) $activeFilterValue = 0; + 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; + case self::OP_SET: + $condition = ' IS NOT NULL'; + break; + case self::OP_NOT_SET: + $condition = ' IS NULL'; + 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..8337a92c1 --- /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, + 'Nation wählen...', + 'keine Nation gefunden' + ); + + $this->loadDropDownView($widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/Organisationseinheit_widget.php b/application/widgets/Organisationseinheit_widget.php old mode 100755 new mode 100644 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..a2500a1e9 --- /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, + 'Zgv wählen...', + 'keine Zgv gefunden' + ); + + $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..357a4273c --- /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, + 'Zgv wählen...', + 'keine Zgv gefunden' + ); + + $this->loadDropDownView($widgetData); + } +} \ No newline at end of file diff --git a/application/widgets/extensions/.placeholder b/application/widgets/extensions/.placeholder new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/application/widgets/extensions/.placeholder @@ -0,0 +1 @@ + diff --git a/application/widgets/mimetype_widget.php b/application/widgets/mimetype_widget.php old mode 100755 new mode 100644 diff --git a/assets/grocery_crud/languages/catalan.php b/assets/grocery_crud/languages/catalan.php old mode 100755 new mode 100644 diff --git a/assets/grocery_crud/themes/flexigrid/css/flexigrid.css b/assets/grocery_crud/themes/flexigrid/css/flexigrid.css old mode 100755 new mode 100644 diff --git a/assets/grocery_crud/themes/flexigrid/views/list_template.php b/assets/grocery_crud/themes/flexigrid/views/list_template.php old mode 100755 new mode 100644 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/ampel.php b/cis/ampel.php old mode 100755 new mode 100644 diff --git a/cis/cisdocs/muster_semesterplan.doc b/cis/cisdocs/muster_semesterplan.doc old mode 100755 new mode 100644 diff --git a/cis/private/coodle/coodle_autocomplete.php b/cis/private/coodle/coodle_autocomplete.php old mode 100755 new mode 100644 diff --git a/cis/private/coodle/coodle_events.php b/cis/private/coodle/coodle_events.php old mode 100755 new mode 100644 diff --git a/cis/private/coodle/stammdaten.php b/cis/private/coodle/stammdaten.php old mode 100755 new mode 100644 diff --git a/cis/private/coodle/termin.php b/cis/private/coodle/termin.php old mode 100755 new mode 100644 diff --git a/cis/private/coodle/uebersicht.php b/cis/private/coodle/uebersicht.php old mode 100755 new mode 100644 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" > - - + + - - - + + + - - + + - + "; $awbild_content .= ""; $nt_content .= ""; - + 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/abgabe_student_file.php b/cis/private/lehre/abgabe_student_file.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/anwesenheitsliste.pdf.php b/cis/private/lehre/anwesenheitsliste.pdf.php old mode 100755 new mode 100644 index 8e2c6f4c0..80d823a4f --- a/cis/private/lehre/anwesenheitsliste.pdf.php +++ b/cis/private/lehre/anwesenheitsliste.pdf.php @@ -44,15 +44,15 @@ else $lv = new lehrveranstaltung(); $lv->load($lvid); - + if(isset($_GET['stsem'])) $studiensemester = $_GET['stsem']; else die('Eine Studiensemester muss uebergeben werden'); -if( !$berechtigung->isBerechtigt('admin') - && !$berechtigung->isBerechtigt('assistenz') - && !$berechtigung->isBerechtigt('lehre', $lv->oe_kurzbz, 's') +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'); @@ -95,6 +95,34 @@ if($result = $db->db_query($qry)) } } + +// Verplante Räume laden +$qry = "SELECT distinct(ort_kurzbz) + FROM lehre.tbl_stundenplan + WHERE lehreinheit_id in + ( + SELECT lehreinheit_id + FROM campus.vw_lehreinheit + WHERE lehrveranstaltung_id = ".$db->db_add_param($lvid, FHC_INTEGER)." + AND studiensemester_kurzbz = ".$db->db_add_param($studiensemester)." + )"; +if($lehreinheit!='') + $qry.= " AND tbl_stundenplan.lehreinheit_id = ".$db->db_add_param($lehreinheit, FHC_INTEGER); + + +$raum_string = ''; +if($result = $db->db_query($qry)) +{ + while($row = $db->db_fetch_object($result)) + { + if($raum_string!='') + $raum_string.=', '; + if($row->ort_kurzbz!='') + $raum_string.=$row->ort_kurzbz; + } +} + + $stg = new studiengang(); $stg->load($lv->studiengang_kz); @@ -114,6 +142,7 @@ $data = array( 'studiensemester'=>$studiensemester, 'semester'=>$lv->semester, 'orgform'=>$lv->orgform_kurzbz, + 'raum'=>$raum_string, ); //Lehrende der LV laden und in ein Array schreiben diff --git a/cis/private/lehre/anwesenheitsliste.php b/cis/private/lehre/anwesenheitsliste.php index 70a24f924..4e328f5f2 100644 --- a/cis/private/lehre/anwesenheitsliste.php +++ b/cis/private/lehre/anwesenheitsliste.php @@ -33,15 +33,15 @@ require_once('../../../include/studiengang.class.php'); require_once('../../../include/lehrveranstaltung.class.php'); require_once('../../../include/phrasen.class.php'); - - - $sprache = getSprache(); - $p=new phrasen($sprache); - + + + $sprache = getSprache(); + $p=new phrasen($sprache); + if (!$db = new basis_db()) die($p->t('global/fehlerBeimOeffnenDerDatenbankverbindung')); - - $error=0; + + $error=0; if(isset($_GET['stg_kz']) && is_numeric($_GET['stg_kz'])) $stg_kz=$_GET['stg_kz']; else @@ -56,10 +56,10 @@ $lvid=$_GET['lvid']; else $error=2; - + if(isset($_GET['stsem']) && check_stsem($_GET['stsem'])) $stsem = $_GET['stsem']; - else + else die($p->t('anwesenheitsliste/studiensemesterIstUngueltig')); ?> @@ -92,28 +92,28 @@ $stg_arr = array(); $stg_obj = new studiengang(); $stg_obj->getAll(); - + foreach ($stg_obj->result as $row) $stg_arr[$row->studiengang_kz]=$row->kuerzel; - + $lv = new lehrveranstaltung($lvid); - + $aw_content .= "
".$p->t('anwesenheitsliste/gesamtliste')." $lv->bezeichnung
".$p->t('anwesenheitsliste/gesamtliste')." $lv->bezeichnung
".$p->t('anwesenheitsliste/gesamtliste')." $lv->bezeichnung
"; - $qry = "SELECT *, tbl_lehreinheitgruppe.studiengang_kz, tbl_lehreinheitgruppe.semester FROM lehre.tbl_lehreinheit JOIN lehre.tbl_lehreinheitgruppe USING(lehreinheit_id) JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) + $qry = "SELECT *, tbl_lehreinheitgruppe.studiengang_kz, tbl_lehreinheitgruppe.semester FROM lehre.tbl_lehreinheit JOIN lehre.tbl_lehreinheitgruppe USING(lehreinheit_id) JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) WHERE lehrveranstaltung_id='$lvid' AND studiensemester_kurzbz=".$db->db_add_param($stsem); $qry = "SELECT *, tbl_lehreinheitgruppe.studiengang_kz, tbl_lehreinheitgruppe.semester ,tbl_lehreinheit.lehrform_kurzbz - FROM lehre.tbl_lehreinheit - JOIN lehre.tbl_lehreinheitgruppe USING(lehreinheit_id) - JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) + FROM lehre.tbl_lehreinheit + JOIN lehre.tbl_lehreinheitgruppe USING(lehreinheit_id) + JOIN lehre.tbl_lehrveranstaltung USING(lehrveranstaltung_id) WHERE lehrveranstaltung_id='$lvid' AND studiensemester_kurzbz=".$db->db_add_param($stsem); - + if($result = $db->db_query($qry)) { if($db->db_num_rows($result)>0) @@ -129,7 +129,7 @@ $qry = "SELECT * FROM lehre.tbl_lehreinheitmitarbeiter JOIN public.tbl_mitarbeiter USING(mitarbeiter_uid) WHERE lehreinheit_id=".$db->db_add_param($lastlehreinheit); $lektoren = ''; - + if($result_lkt = $db->db_query($qry)) { while($row_lkt = $db->db_fetch_object($result_lkt)) @@ -139,26 +139,26 @@ $lektoren .= $row_lkt->kurzbz; } } - + $aw_content .= "   $kurzbz - $lehrform - $gruppen ($lektoren)"; $awbild_content .= "   $kurzbz - $lehrform - $gruppen ($lektoren)"; $nt_content .= "   $kurzbz - $lehrform - $gruppen ($lektoren)"; - + $lastlehreinheit = $row->lehreinheit_id; $gruppen=''; } - else + else $lastlehreinheit = $row->lehreinheit_id; } - + if($gruppen!='') $gruppen.= ', '; - + if($row->gruppe_kurzbz!='') $gruppen .= $row->gruppe_kurzbz; - else + else $gruppen .= trim($stg_arr[$row->studiengang_kz].'-'.$row->semester.$row->verband.$row->gruppe); - + $lehrform = $row->lehrform_kurzbz; $kurzbz = $row->kurzbz; } @@ -174,7 +174,7 @@ $lektoren .= $row_lkt->kurzbz; } } - + $aw_content .= "   $kurzbz - $lehrform - $gruppen ($lektoren)"; $awbild_content .= "   $kurzbz - $lehrform - $gruppen ($lektoren)"; $nt_content .= "   $kurzbz - $lehrform - $gruppen ($lektoren)"; @@ -191,7 +191,7 @@ $aw_content = "".$aw_content."

".$p->t('anwesenheitsliste/anwesenheitslisten')."

"; else $aw_content = $p->t('anwesenheitsliste/keineStudentenVorhanden'); - + if($awbild_content!='') $awbild_content = "".$awbild_content."

".$p->t('anwesenheitsliste/anwesenheitslistenMitBildern')."

"; else @@ -208,9 +208,11 @@ $nt_content=''; if(defined('CIS_ANWESENHEITSLISTE_ANWESENHEITSLISTE_ANZEIGEN') && !CIS_ANWESENHEITSLISTE_ANWESENHEITSLISTE_ANZEIGEN) $aw_content=''; + if(defined('CIS_ANWESENHEITSLISTE_ANWESENHEITSLISTE_BILD_ANZEIGEN') && !CIS_ANWESENHEITSLISTE_ANWESENHEITSLISTE_BILD_ANZEIGEN) + $awbild_content=''; echo " - + @@ -220,7 +222,7 @@ - +
$aw_content
$nt_content
"; } } diff --git a/cis/private/lehre/anwesenheitsliste_bilder.pdf.php b/cis/private/lehre/anwesenheitsliste_bilder.pdf.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/benotungstool/copy_uebung.php b/cis/private/lehre/benotungstool/copy_uebung.php index a566d764a..855b106ed 100644 --- a/cis/private/lehre/benotungstool/copy_uebung.php +++ b/cis/private/lehre/benotungstool/copy_uebung.php @@ -455,21 +455,6 @@ if(isset($_GET['kopieren'])) return ($var!=''?"'".addslashes($var)."'":'null'); } - // *********************************************************************************************** - // String auf Laenge abschneiden - // *********************************************************************************************** - function CutString($strVal, $limit) - { - if(strlen($strVal) > $limit+3) - { - return substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } - } - ?> @@ -587,7 +572,7 @@ if(isset($_GET['kopieren'])) { if (empty($lehrveranstaltung_id)) $lehrveranstaltung_id=$row->lehrveranstaltung_id; - $content.=''; + $content.=''; } } else @@ -634,7 +619,7 @@ if(isset($_GET['kopieren'])) { $lektoren.= ($lektoren?',':'').' '.$ma->mitarbeiter_uid; } - $lektoren=CutString($lektoren, 30); + $lektoren=CutString($lektoren, 30, '...'); $content.=''; } } @@ -786,7 +771,7 @@ if(isset($_GET['kopieren'])) { if (empty($lehrveranstaltung_id_target)) $lehrveranstaltung_id_target=$row->lehrveranstaltung_id; - $content.=''; + $content.=''; } } else @@ -835,7 +820,7 @@ if(isset($_GET['kopieren'])) { $lektoren.= ($lektoren?',':'').' '.$ma->mitarbeiter_uid; } - $lektoren=CutString($lektoren, 30); + $lektoren=CutString($lektoren, 30, '...'); $content.=''; } } diff --git a/cis/private/lehre/benotungstool/functions.inc.php b/cis/private/lehre/benotungstool/functions.inc.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/benotungstool/legesamtnoteeintragen.php b/cis/private/lehre/benotungstool/legesamtnoteeintragen.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php b/cis/private/lehre/benotungstool/lvgesamtnoteeintragen.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/benotungstool/nachpruefungeintragen.php b/cis/private/lehre/benotungstool/nachpruefungeintragen.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/benotungstool/zipdownload_benotungstool.php b/cis/private/lehre/benotungstool/zipdownload_benotungstool.php old mode 100755 new mode 100644 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/lehre/lesson.php b/cis/private/lehre/lesson.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefung.js.php b/cis/private/lehre/pruefung/pruefung.js.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsanmeldung.json.php b/cis/private/lehre/pruefung/pruefungsanmeldung.json.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsanmeldung.php b/cis/private/lehre/pruefung/pruefungsanmeldung.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsanmeldungen_liste.pdf.php b/cis/private/lehre/pruefung/pruefungsanmeldungen_liste.pdf.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsanmeldungen_liste.php b/cis/private/lehre/pruefung/pruefungsanmeldungen_liste.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsanmeldungen_verwalten.php b/cis/private/lehre/pruefung/pruefungsanmeldungen_verwalten.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsbewertung.js.php b/cis/private/lehre/pruefung/pruefungsbewertung.js.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsbewertung.json.php b/cis/private/lehre/pruefung/pruefungsbewertung.json.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsbewertung.php b/cis/private/lehre/pruefung/pruefungsbewertung.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungsfenster_anlegen.php b/cis/private/lehre/pruefung/pruefungsfenster_anlegen.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungstermin.json.php b/cis/private/lehre/pruefung/pruefungstermin.json.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungstermin_aendern.php b/cis/private/lehre/pruefung/pruefungstermin_aendern.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/pruefung/pruefungstermin_festlegen.php b/cis/private/lehre/pruefung/pruefungstermin_festlegen.php old mode 100755 new mode 100644 diff --git a/cis/private/lehre/swd.php b/cis/private/lehre/swd.php old mode 100755 new mode 100644 diff --git a/cis/private/menu.php b/cis/private/menu.php deleted file mode 100644 index ce265c28c..000000000 --- a/cis/private/menu.php +++ /dev/null @@ -1,138 +0,0 @@ -, - * Andreas Oesterreicher and - * Rudolf Hangl < rudolf.hangl@technikum-wien.at > - * Gerald Simane-Sequens < gerald.simane-sequens@technikum-wien.at > - * - */ -require_once('../../config/cis.config.inc.php'); -require_once('../../include/globals.inc.php'); -require_once('../../include/functions.inc.php'); -require_once('../../include/benutzerberechtigung.class.php'); -require_once('../../include/funktion.class.php'); -require_once('../../include/studiensemester.class.php'); -require_once('../../include/studiengang.class.php'); -require_once('../../include/lehrveranstaltung.class.php'); -require_once('../../include/mitarbeiter.class.php'); -require_once('../../include/student.class.php'); -require_once('../../include/datum.class.php'); - -if (!$db = new basis_db()) - die('Es konnte keine Verbindung zum Server aufgebaut werden.'); - -if (!$user=get_uid()) - die('Sie sind nicht angemeldet. Es wurde keine Benutzer UID gefunden ! Zurück'); - -$cutlength=10; -$rechte=new benutzerberechtigung(); -$rechte->getBerechtigungen($user); - -$fkt=new funktion(); -$fkt->getAll($user); - -$stg_obj = new studiengang(); - -if($stg_obj->getAll('kurzbzlang', false)) -{ - $stg = array(); - foreach($stg_obj->result as $row) - $stg[$row->studiengang_kz] = $row->kurzbzlang; -} -else - die('Fehler beim Auslesen der Studiengaenge'); - - -if(check_lektor($user)) - $is_lector=true; -else - $is_lector=false; - -if(check_student($user)) - $is_student=true; -else - $is_student=false; - - function CutString($strVal, $limit) - { - if(strlen($strVal) > $limit+3) - { - return substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } - } - -$aktiv=false; -$qry = "SELECT aktiv FROM campus.vw_benutzer WHERE uid='$user'"; -if($result = $db->db_query($qry)) -{ - if($row = $db->db_fetch_object($result)) - { - $aktiv = ($row->aktiv=='t'?true:false); - } -} -?> - - - - - - - - - - - - - - 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))."

+ + + "; + } + else + { + echo ' + + + '.$p->t('mailverteiler/oeffnenFehlgeschlagen').' + + '; + } + echo ''; } 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/outgoing/akteupload.php b/cis/private/outgoing/akteupload.php old mode 100755 new mode 100644 diff --git a/cis/private/outgoing/outgoing.php b/cis/private/outgoing/outgoing.php old mode 100755 new mode 100644 diff --git a/cis/private/outgoing/registration.php b/cis/private/outgoing/registration.php old mode 100755 new mode 100644 diff --git a/cis/private/profile/change_password.php b/cis/private/profile/change_password.php index b45504496..39975353b 100644 --- a/cis/private/profile/change_password.php +++ b/cis/private/profile/change_password.php @@ -61,7 +61,13 @@ if(isset($_GET['requiredtochange'])) { echo ''.$p->t('passwort/RequiredToChangeInfo').'

'; } -echo $p->t('passwort/InfotextPolicy').' +echo $p->t('passwort/InfotextPolicy'); + +if($p->t('dms_link/passwortpolicy')!='') +{ + echo '

'.$p->t('passwort/weitereInfos',array($p->t('dms_link/passwortpolicy'))); +} +echo '

diff --git a/cis/private/profile/dokumente.php b/cis/private/profile/dokumente.php old mode 100755 new mode 100644 diff --git a/cis/private/profile/freebusy.php b/cis/private/profile/freebusy.php old mode 100755 new mode 100644 diff --git a/cis/private/profile/studienplan.php b/cis/private/profile/studienplan.php old mode 100755 new mode 100644 diff --git a/cis/private/profile/urlaubsfreigabe.php b/cis/private/profile/urlaubsfreigabe.php old mode 100755 new mode 100644 diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php old mode 100755 new mode 100644 diff --git a/cis/private/profile/zeitsperre_resturlaub.php b/cis/private/profile/zeitsperre_resturlaub.php old mode 100755 new mode 100644 diff --git a/cis/private/tools/ampelleiteruebersicht.php b/cis/private/tools/ampelleiteruebersicht.php old mode 100755 new mode 100644 diff --git a/cis/private/tools/ampelverwaltung.php b/cis/private/tools/ampelverwaltung.php old mode 100755 new mode 100644 diff --git a/cis/private/tools/suche.php b/cis/private/tools/suche.php old mode 100755 new mode 100644 index 7b56f2707..dbc8aea6a --- a/cis/private/tools/suche.php +++ b/cis/private/tools/suche.php @@ -46,19 +46,18 @@ $sprache = getSprache(); $p = new phrasen($sprache); echo ' + "http://www.w3.org/TR/html4/strict.dtd"> - - - - - - - Globale Suche + '; + + include('../../../include/meta/jquery.php'); + include('../../../include/meta/jquery-tablesorter.php'); + +echo 'Globale Suche '; @@ -74,14 +73,22 @@ echo '

'; -if($search=='') +if($search == '') exit; // String aufsplitten und Sonderzeichen entfernen $searchItems = explode(' ',TRIM(str_replace(',', '', $search),'!.?')); +// Leerzeichen und Whitespaces entfernen +$searchItems = preg_replace("/\s/", '', $searchItems); + + +// Leere Strings aus Array entfernen +while ($array_key = array_search("", $searchItems)) + unset ($searchItems[$array_key]); + // Wenn nach dem TRIM keine Zeichen uebrig bleiben, dann abbrechen -if(implode(',', $searchItems)=='') +if(implode(',', $searchItems) == '') exit; //Easter Egg @@ -228,55 +235,60 @@ function searchOE($searchItems) $benutzerfunktion->getOeFunktionen($row->oe_kurzbz,'ass,Leitung,stvLtg,oezuordnung','now()','now()'); $oebezeichnung = new organisationseinheit(); $oebezeichnung->load($row->oe_kurzbz); - echo '

',$row->organisationseinheittyp_kurzbz,' ',$oebezeichnung->bezeichnung,'

'; - echo ' - - - - - - - - - - - - '; - foreach($benutzerfunktion->result as $bf) + if (count($benutzerfunktion->result) > 0) { - $person = new person(); - $person->getPersonFromBenutzer($bf->uid); - $mitarbeiter = new mitarbeiter(); - $mitarbeiter->load($bf->uid); - $kontakt = new kontakt(); - $kontakt->loadFirmaKontakttyp($mitarbeiter->standort_id,'telefon'); - $bisverwendung = new bisverwendung(); - $bisverwendung->getLastAktVerwendung($bf->uid); - echo ''; - echo ''; - echo ''; - echo ''; - - echo ''; - echo ''; - //if($row->alias!='' && !in_array($row->studiengang_kz, $noalias)) ??? Was macht $noalias? - if($person->alias!='') - $mail = $person->alias.'@'.DOMAIN; - else - $mail = $person->uid.'@'.DOMAIN; - echo ''; - //if(!defined('CIS_SUCHE_LVPLAN_ANZEIGEN') || CIS_SUCHE_LVPLAN_ANZEIGEN) - //echo ''; - echo ''; + echo '

',$row->organisationseinheittyp_kurzbz,' ',$oebezeichnung->bezeichnung,'

'; + echo '
',$p->t('global/vorname'),'',$p->t('global/nachname'),'',$p->t('global/funktion'),'',$p->t('global/telefonnummer'),'',$p->t('lvplan/raum'),'',$p->t('global/mail'),'
'.$person->vorname.'',$person->nachname,''.$bf->bezeichnung; - if($person->aktiv==false) - echo ' (ausgeschieden)'; - elseif($bisverwendung->beschausmasscode=='5') - echo ' (karenziert)'; - echo '',($mitarbeiter->telefonklappe!=''?$kontakt->kontakt.'-'.$mitarbeiter->telefonklappe:'-'),'',($mitarbeiter->ort_kurzbz!=''?$mitarbeiter->ort_kurzbz:'-'),'',$mail,''.$p->t('lvplan/lvPlan').'
+ + + + + + + + + + + + '; + foreach($benutzerfunktion->result as $bf) + { + $person = new person(); + $person->getPersonFromBenutzer($bf->uid); + $mitarbeiter = new mitarbeiter(); + $mitarbeiter->load($bf->uid); + $kontakt = new kontakt(); + $kontakt->loadFirmaKontakttyp($mitarbeiter->standort_id,'telefon'); + $bisverwendung = new bisverwendung(); + $bisverwendung->getLastAktVerwendung($bf->uid); + $benutzer = new benutzer($bf->uid); + if ($benutzer->bnaktiv) + { + echo ''; + echo ''; + echo ''; + echo ''; + + echo ''; + echo ''; + //if($row->alias!='' && !in_array($row->studiengang_kz, $noalias)) ??? Was macht $noalias? + if($person->alias!='') + $mail = $person->alias.'@'.DOMAIN; + else + $mail = $person->uid.'@'.DOMAIN; + echo ''; + //if(!defined('CIS_SUCHE_LVPLAN_ANZEIGEN') || CIS_SUCHE_LVPLAN_ANZEIGEN) + //echo ''; + echo ''; + echo "\n"; + } + } echo "\n"; + echo '
',$p->t('global/vorname'),'',$p->t('global/nachname'),'',$p->t('global/funktion'),'',$p->t('global/telefonnummer'),'',$p->t('lvplan/raum'),'',$p->t('global/mail'),'
'.$person->vorname.'',$person->nachname,''.$bf->bezeichnung; + if($bisverwendung->beschausmasscode=='5') + echo ' (karenziert)'; + echo '',($mitarbeiter->telefonklappe!=''?$kontakt->kontakt.'-'.$mitarbeiter->telefonklappe:'-'),'',($mitarbeiter->ort_kurzbz!=''?$mitarbeiter->ort_kurzbz:'-'),'',$mail,''.$p->t('lvplan/lvPlan').'

'; } - echo "\n"; - echo '
'; } } return true; @@ -443,10 +455,10 @@ function searchContent($searchItems) $cms = new content(); $cms->search($searchItems, 21); - if(count($cms->result)>0) + if(count($cms->result) > 0) { echo '

',$p->t('tools/content'),'

'; - if(count($cms->result)>20) + if(count($cms->result) > 20) { echo '

'.$p->t("tools/esWurdenMehrAlsXInhalteGefunden").'

'; } @@ -454,30 +466,25 @@ function searchContent($searchItems) $anzeigesprache=''; foreach($cms->result as $row) { - if ($sprache==$row->sprache) + if ($sprache == $row->sprache) { - if ($anzeigesprache!=$row->sprache) + if ($anzeigesprache != $row->sprache) { - $anzeigesprache=$row->sprache; + $anzeigesprache = $row->sprache; echo '

',$row->sprache,'

'; echo '
    '; } - // Nur die hoechste Version des Contents anzeigen - $version = new content(); - $maxversion = $version->getMaxVersion($row->content_id, $row->sprache); - if ($row->version == $maxversion) + + $berechtigt = new content(); + $berechtigt = $berechtigt->berechtigt($row->content_id, $uid); + if ($berechtigt) { - $berechtigt = new content(); - $berechtigt = $berechtigt->berechtigt($row->content_id, $uid); - if ($berechtigt) - { - echo '
  • '; - echo '',$db->convert_html_chars($row->titel),'
    '; - $preview = findAndMark($row->content, $searchItems); - - echo $preview; - echo '

  • '; - } + echo '
  • '; + echo '',$db->convert_html_chars($row->titel),'
    '; + $preview = findAndMark($row->content, $searchItems); + + echo $preview; + echo '

  • '; } } } @@ -485,11 +492,11 @@ function searchContent($searchItems) $anzeigesprache=''; foreach($cms->result as $row) { - if ($sprache!=$row->sprache) + if ($sprache != $row->sprache) { - if ($anzeigesprache!=$row->sprache) + if ($anzeigesprache != $row->sprache) { - $anzeigesprache=$row->sprache; + $anzeigesprache = $row->sprache; echo '
'; echo '

',$row->sprache,'

'; echo '
    '; diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php old mode 100755 new mode 100644 index a61aabe07..636c368ff --- 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'); @@ -44,6 +45,9 @@ require_once('../../../include/benutzerberechtigung.class.php'); $sprache = getSprache(); $p=new phrasen($sprache); +$sprache_obj = new sprache(); +$sprache_obj->load($sprache); +$sprache_index=$sprache_obj->index; if (!$db = new basis_db()) die($p->t("global/fehlerBeimOeffnenDerDatenbankverbindung")); @@ -60,6 +64,8 @@ if(isset($_GET['uid'])) if($rechte->isBerechtigt('admin') || $rechte->isBerechtigt('mitarbeiter/urlaube', null, 'suid')) { $user = $_GET['uid']; + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($user); } else { @@ -646,7 +652,6 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $service_id = ''; $kunde_uid = ''; } - } } @@ -717,13 +722,15 @@ if($projekt->getProjekteMitarbeiter($user, true)) $anzprojekte = count($projekt->result); echo " - + CSV Export"; + if($anzprojekte > 0) + echo " | ".$p->t("zeitaufzeichnung/projektexport").""; + echo "
    - ".$p->t("zeitaufzeichnung/neu")." -   - CSV Import  + + ".$p->t("zeitaufzeichnung/neu")." | + + CSV Import | - CSV Export -
    "; + echo ' + + - + - + - + - + @@ -1868,13 +1868,13 @@ else if ($method == "profil") - + - + @@ -1923,14 +1923,14 @@ echo' '.$p->t('global/frau').' '; - echo ' + echo ' - + diff --git a/cis/public/incoming/registration.php b/cis/public/incoming/registration.php index 4943e439b..71ff33a69 100644 --- a/cis/public/incoming/registration.php +++ b/cis/public/incoming/registration.php @@ -83,11 +83,11 @@ echo ' - + - + diff --git a/cis/public/prestudententool/auth.php b/cis/public/prestudententool/auth.php old mode 100755 new mode 100644 diff --git a/cis/public/prestudententool/index.php b/cis/public/prestudententool/index.php old mode 100755 new mode 100644 diff --git a/cis/public/prestudententool/prestudent.php b/cis/public/prestudententool/prestudent.php old mode 100755 new mode 100644 diff --git a/cis/testtool/admin/uebersichtFragen.php b/cis/testtool/admin/uebersichtFragen.php old mode 100755 new mode 100644 diff --git a/cms/admin_dms.php b/cms/admin_dms.php old mode 100755 new mode 100644 diff --git a/cms/image.php b/cms/image.php old mode 100755 new mode 100644 diff --git a/cms/index.html b/cms/index.html old mode 100755 new mode 100644 diff --git a/cms/menu.inc.php b/cms/menu.inc.php old mode 100755 new mode 100644 diff --git a/cms/menu/menu_addon.class.php b/cms/menu/menu_addon.class.php old mode 100755 new mode 100644 diff --git a/cms/menu/menu_addon_freifaecher.inc.php b/cms/menu/menu_addon_freifaecher.inc.php old mode 100755 new mode 100644 index 1e34b05a3..336ac6cba --- a/cms/menu/menu_addon_freifaecher.inc.php +++ b/cms/menu/menu_addon_freifaecher.inc.php @@ -19,8 +19,8 @@ */ /** * Menue Addon fuer die Darstellung der Freifaecher - * - * Es wird eine Link-Liste mit allen aktuellen Freifaechern erstellt + * + * Es wird eine Link-Liste mit allen aktuellen Freifaechern erstellt */ require_once(dirname(__FILE__).'/menu_addon.class.php'); require_once(dirname(__FILE__).'/../../include/functions.inc.php'); @@ -32,9 +32,9 @@ class menu_addon_freifaecher extends menu_addon public function __construct() { parent::__construct(); - + $this->link=false; - + $sprache = getSprache(); $stsem = new studiensemester(); $stsem = $stsem->getAktOrNext(); @@ -48,28 +48,16 @@ class menu_addon_freifaecher extends menu_addon $this->items[] = array('title'=>$row->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/lehre/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$stsem, - 'name'=>'aktiv?' style="" ':' style=""').'>'.(!$row->aktiv?' ':' ').' '.$this->CutString($row->bezeichnung_arr[$sprache], 21).'' + 'name'=>'aktiv?' style="" ':' style=""').'>'.(!$row->aktiv?' ':' ').' '.CutString($row->bezeichnung_arr[$sprache], 21, '...').'' ); } - + $this->block.= ''; - + $this->output(); } - - private function CutString($strVal, $limit) - { - if(mb_strlen($strVal) > $limit+3) - { - return mb_substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } - } } new menu_addon_freifaecher(); diff --git a/cms/menu/menu_addon_lehrveranstaltungen.inc.php b/cms/menu/menu_addon_lehrveranstaltungen.inc.php old mode 100755 new mode 100644 index 42a514302..e9fdb7ed9 --- a/cms/menu/menu_addon_lehrveranstaltungen.inc.php +++ b/cms/menu/menu_addon_lehrveranstaltungen.inc.php @@ -235,7 +235,7 @@ class menu_addon_lehrveranstaltungen extends menu_addon } $this->block.= ''; $this->block.= ' '; $this->block.= ''; } @@ -243,18 +243,6 @@ class menu_addon_lehrveranstaltungen extends menu_addon $this->block.='
    '; + 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 '

    '.$p->t('zeitaufzeichnung/projektexport').''.$p->t('zeitaufzeichnung/monat').' '.$p->t('zeitaufzeichnung/jahr').'

    +/* echo '
    '; @@ -996,20 +1049,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) { @@ -946,14 +1007,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-Export'.$p->t('zeitaufzeichnung/startdatum').' '.$p->t('zeitaufzeichnung/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..391167186 --- /dev/null +++ b/cis/private/tools/zeitaufzeichnung_projektliste.php @@ -0,0 +1,578 @@ + + */ +/** + * 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"); + +$sprache = getSprache(); +$p = new phrasen($sprache); +$sprache_obj = new sprache(); +$sprache_obj->load($sprache); +$sprache_index = $sprache_obj->index; + +$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[$sprache_index][$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]; + +//sort 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 < count($ztaufdata); $i++) +{ + $ztaufrow = $ztaufdata[$i]; + //make sure dates are in correct format + $ztaufrow->start = $date->formatDatum($ztaufrow->start, $format = 'Y-m-d H:i:s'); + $ztaufrow->ende = $date->formatDatum($ztaufrow->ende, $format = 'Y-m-d H:i:s'); + $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 (count($allpauseranges) > 0) + { + $prevpause = $allpauseranges[count($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[count($allpauseranges) - 1]->ende = $ztaufrow->ende; + } + } + } + + //save new dayStart (if earlier) or dayEnd (if later) + if (($dayStart == '' || $dayStart > $ztaufrow->start) && $ztaufrow->aktivitaet_kurzbz != $toignore[1]) + $dayStart = $ztaufrow->start; + if (($dayEnd == '' || $dayEnd < $ztaufrow->ende) && $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 ($ztaufrow->start >= $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 ($ztaufrow->start < $lastende && $ztaufrow->ende > $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($dayEnd) - $date->mktime_fromtimestamp($dayStart); + $worktimehours = $worktime_unix / 3600; + + $projectlines[$day]->arbeitszeit = $worktimehours; + $pauseSubtracted = 0.00; + $lehreExternExists = false; + + //subtract pauses and LehreExtern from total worktime + 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) + { + //pause between project start and end + 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; + } + //pause and project time overlap at project time end + 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; + } + //pause and project time overlap at project time start + 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; + } + } + } + } + + //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($p->t('zeitaufzeichnung/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_heading_bottomline =& $workbook->addFormat(); +$format_heading_bottomline->setBottom(2); + +$format_heading_topline =& $workbook->addFormat(); +$format_heading_topline->setTop(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->setRight(1); +$format_cell_centered_leftline->setLeft(1); +$format_cell_centered_leftline->setBottom(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 = count($projectnames); +$daywidth = 4; +$totalworktimewidth = 13; +$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; + +//set language options +$decpoint = $sprache_index === '2' ? '.' : ','; +$thousandsep = $sprache_index === '2' ? ',' : '.'; + +//write global header +$lastspalte = ($nrProjects > 0) ? 2 + count($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, $monthtext.' '.$year, $format_heading_left); +for ($i = 1; $i < 3; $i++) +{ + $worksheet->write($zeile, $spalte + $i, '', $format_heading_topline); + $worksheet->write($zeile + 1, $spalte + $i, '', $format_heading_bottomline); +} +$worksheet->setMerge($zeile, $spalte + 3, $zeile, $lastspalte); +$worksheet->setMerge($zeile + 1, $spalte + 3, $zeile + 1, $lastspalte); +$worksheet->write($zeile, $spalte + 3, $p->t('zeitaufzeichnung/projektlistegedruckt').$spacesstringFirst.$username, $format_heading_right); +for ($i = 4; $i < $lastspalte; $i++) +{ + $worksheet->write($zeile, $i, '', $format_heading_topline); + $worksheet->write($zeile + 1, $i, '', $format_heading_bottomline); +} +$worksheet->write($zeile, $lastspalte, '', $format_heading_right); +$worksheet->write($zeile + 1, $spalte + 3, date('d.m.Y H:i').$spacesstringSecond.$p->t('zeitaufzeichnung/personalnr').$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, $p->t('zeitaufzeichnung/tag'), $format_bold_centered_alllines); +$worksheet->write($zeile + 1, $spalte, '', $format_bold_centered_alllines); +$worksheet->write($zeile, $spalte + 1, $p->t('zeitaufzeichnung/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, $p->t('zeitaufzeichnung/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, $p->t('zeitaufzeichnung/stunden'), $format_bold_centered_bottomline); + $worksheet->write($zeile + 1, $spalte + 1, $p->t('zeitaufzeichnung/taetigkeit'), $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[$sprache_index][$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->writeString($zeile, $spalte++, number_format($projectlines[$daysnmbr]->arbeitszeit, 2, $decpoint, $thousandsep), $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->writeString($zeile, $spalte++, number_format($projectlines[$daysnmbr]->projekte[$project]->stunden, 2, $decpoint, $thousandsep), $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 until end of table + $worksheet->writeString($zeile, $spalte, number_format(0, 2, $decpoint, $thousandsep), $format_cell_centered_leftline); + $toskip = count($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); + $spalte++; + } + } + $zeile++; +} + +if ($nrProjects < 1) + //no projects - merge all cells and write notice +{ + $worksheet->setMerge(3, 3, 4 + $daysinmonth, $lastspalte); + $worksheet->write(3, 3, $p->t('zeitaufzeichnung/keineprojekte'), $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, $p->t('zeitaufzeichnung/summe'), $format_bold_centered_alllines); +$worksheet->write($zeile, $spalte + 1, '', $format_bold_centered_alllines); +$spalte += 2; +$worksheet->writeString($zeile, $spalte++, number_format($monthsums[0], 2, $decpoint, $thousandsep), $format_cell_centered_alllines); +foreach ($projectnames as $project) +{ + $worksheet->writeString($zeile, $spalte++, number_format($monthsums[$project], 2, $decpoint, $thousandsep), $format_cell_centered_topbottomleftline); + $worksheet->write($zeile, $spalte++, '', $format_cell_centered_topbottomrightline); +} +$worksheet->fitToPages(1, 1); +$workbook->close(); diff --git a/cis/public/accountactivation.php b/cis/public/accountactivation.php old mode 100755 new mode 100644 diff --git a/cis/public/coodle.php b/cis/public/coodle.php old mode 100755 new mode 100644 diff --git a/cis/public/freebusy.php b/cis/public/freebusy.php old mode 100755 new mode 100644 diff --git a/cis/public/freebusy_coodle.php b/cis/public/freebusy_coodle.php old mode 100755 new mode 100644 diff --git a/cis/public/freebusy_lvplan.php b/cis/public/freebusy_lvplan.php old mode 100755 new mode 100644 diff --git a/cis/public/freebusy_sogo.php b/cis/public/freebusy_sogo.php old mode 100755 new mode 100644 diff --git a/cis/public/freebusy_zeitsperren.php b/cis/public/freebusy_zeitsperren.php old mode 100755 new mode 100644 diff --git a/cis/public/incoming/incoming.php b/cis/public/incoming/incoming.php index 2238d775a..fa7748433 100644 --- a/cis/public/incoming/incoming.php +++ b/cis/public/incoming/incoming.php @@ -1535,17 +1535,17 @@ echo'
    '.$p->t('incoming/masterstudiengang').' Department Coordinator International Coordinator
    '.$p->t('global/vorname').' '.$p->t('incoming/vorname').' '.$p->t('global/vorname').' '.$p->t('incoming/vorname').'
    '.$p->t('global/nachname').' '.$p->t('incoming/nachname').' '.$p->t('global/nachname').' '.$p->t('incoming/nachname').'
    '.$p->t('global/vorname').''.$p->t('incoming/vorname').' '.$p->t('incoming/abgelegtin').'
    '.$p->t('global/nachname').''.$p->t('incoming/nachname').' '.$p->t('incoming/abgelegtinort').' '.$p->t('global/vorname').''.$p->t('incoming/vorname').'
    '.$p->t('global/nachname').''.$p->t('incoming/nachname').'
    '.$p->t('global/vorname').'*'.$p->t('incoming/vorname').'*
    '.$p->t('global/nachname').'*'.$p->t('incoming/nachname').'*
    '; $this->output(); } - - private function CutString($strVal, $limit) - { - if(mb_strlen($strVal) > $limit+3) - { - return mb_substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } - } } new menu_addon_lehrveranstaltungen(); diff --git a/cms/menu/menu_addon_lehrveranstaltungen_studienplan.inc.php b/cms/menu/menu_addon_lehrveranstaltungen_studienplan.inc.php index c5f68776e..c518eb00e 100644 --- a/cms/menu/menu_addon_lehrveranstaltungen_studienplan.inc.php +++ b/cms/menu/menu_addon_lehrveranstaltungen_studienplan.inc.php @@ -331,27 +331,15 @@ class menu_addon_lehrveranstaltungen_studienplan extends menu_addon else $bold=''; if(!$row->lehrauftrag && defined('CIS_LEHRVERANSTALTUNG_MODULE_LINK') && !CIS_LEHRVERANSTALTUNG_MODULE_LINK) - $this->block.= "
  • ".$this->CutString($row->bezeichnung_arr[$sprache], 21).' '.$row->lehrform_kurzbz."
  • "; + $this->block.= "
  • ".CutString($row->bezeichnung_arr[$sprache], 21, '...').' '.$row->lehrform_kurzbz."
  • "; else - $this->block.= "
  • bezeichnung_arr[$sprache]."\" href=\"private/lehre/lesson.php?lvid=$row->lehrveranstaltung_id&studiensemester_kurzbz=$studiensemester_kurzbz\" target=\"content\">".$this->CutString($row->bezeichnung_arr[$sprache], 21).' '.$row->lehrform_kurzbz."
  • "; + $this->block.= "
  • bezeichnung_arr[$sprache]."\" href=\"private/lehre/lesson.php?lvid=$row->lehrveranstaltung_id&studiensemester_kurzbz=$studiensemester_kurzbz\" target=\"content\">".CutString($row->bezeichnung_arr[$sprache], 21, '...').' '.$row->lehrform_kurzbz."
  • "; if(isset($row->childs)) $this->printTree($row->childs, $sprache, $studiensemester_kurzbz); } $this->block.="
"; } - - private function CutString($strVal, $limit) - { - if(mb_strlen($strVal) > $limit+3) - { - return mb_substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } - } } new menu_addon_lehrveranstaltungen_studienplan(); ?> diff --git a/cms/menu/menu_addon_meinelehrfaecher.inc.php b/cms/menu/menu_addon_meinelehrfaecher.inc.php index 897898d64..8fa739cae 100644 --- a/cms/menu/menu_addon_meinelehrfaecher.inc.php +++ b/cms/menu/menu_addon_meinelehrfaecher.inc.php @@ -19,7 +19,7 @@ */ /** * Menue Addon zur Anzeige der zugeordneten LVs - * + * * Zeigt eine Liste mit den Lehrfächern an zu denen der Lektor oder Student zugeordnet ist. */ require_once(dirname(__FILE__).'/menu_addon.class.php'); @@ -34,15 +34,15 @@ class menu_addon_meinelvkompatibel extends menu_addon public function __construct() { parent::__construct(); - + $sprache = getSprache(); $user = get_uid(); - + $is_lector=check_lektor($user); - + $p = new phrasen($sprache); $cutlength=21; - + //Meine LVs Student if(!$is_lector) { @@ -57,34 +57,34 @@ class menu_addon_meinelvkompatibel extends menu_addon $stsem_array = array(); array_push($stsem_array, $stsem); array_push($stsem_array, $stsemobj->getNextFrom($stsem)); - + if(defined('CIS_MEINELV_ANZAHL_SEMESTER_PAST')) $end = CIS_MEINELV_ANZAHL_SEMESTER_PAST; else $end = 1; - + for($i=0; $i<$end; $i++) { $stsem = $stsemobj->getPreviousFrom($stsem); array_unshift($stsem_array, $stsem); } - + foreach($stsem_array as $stsem) { - $qry = "SELECT + $qry = "SELECT lehrfach.bezeichnung, lehrfach.lehrveranstaltung_id as lehrfach_id, vw_student_lehrveranstaltung.lehrveranstaltung_id, vw_student_lehrveranstaltung.studiengang_kz, vw_student_lehrveranstaltung.semester FROM campus.vw_student_lehrveranstaltung JOIN lehre.tbl_lehrveranstaltung as lehrfach ON(vw_student_lehrveranstaltung.lehrfach_id=lehrfach.lehrveranstaltung_id) - WHERE - uid=".$this->db_add_param($user)." + WHERE + uid=".$this->db_add_param($user)." AND studiensemester_kurzbz=".$this->db_add_param($stsem)." - AND vw_student_lehrveranstaltung.lehre=true - AND vw_student_lehrveranstaltung.lehreverzeichnis<>'' - ORDER BY + AND vw_student_lehrveranstaltung.lehre=true + AND vw_student_lehrveranstaltung.lehreverzeichnis<>'' + ORDER BY vw_student_lehrveranstaltung.studiengang_kz, vw_student_lehrveranstaltung.semester, lehrfach.bezeichnung"; - + if($result = $this->db_query($qry)) { $stsementry=array(); @@ -92,13 +92,13 @@ class menu_addon_meinelvkompatibel extends menu_addon { $lv_obj = new lehrveranstaltung(); $lv_obj->load($row->lehrfach_id); - + if($row->studiengang_kz==0 && $row->semester==0) // Freifach { $stsementry[] = array('title'=>$lv_obj->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/freifaecher/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$stsem, - 'name'=>'FF '.$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength) + 'name'=>'FF '.CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength, '...') ); } else @@ -106,7 +106,7 @@ class menu_addon_meinelvkompatibel extends menu_addon $stsementry[] = array('title'=>$lv_obj->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/lehre/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$stsem, - 'name'=>$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength) + 'name'=>$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength, '...') ); } } @@ -127,9 +127,9 @@ class menu_addon_meinelvkompatibel extends menu_addon else { echo "Fehler Semester beim Auslesen der LV"; - } + } } - + //Eigenen LV des eingeloggten Lektors anzeigen if($is_lector) { @@ -140,59 +140,59 @@ class menu_addon_meinelvkompatibel extends menu_addon $stsem_array[]=$stsemobj->getPreviousFrom($stsem); $stsem_array[]=$stsem; $stsem_array[]=$stsemobj->getNextFrom($stsem); - + $this->items[] = array('title'=>$p->t("lvaliste/titel"), 'target'=>'content', 'link'=>'private/profile/lva_liste.php', 'name'=>$p->t("lvaliste/titel")); - + foreach($stsem_array as $stsem) { - - $qry = "SELECT - distinct tbl_lehrveranstaltung.bezeichnung, tbl_lehrveranstaltung.studiengang_kz, - tbl_lehrveranstaltung.semester, tbl_lehrveranstaltung.lehreverzeichnis, tbl_lehrveranstaltung.lehrveranstaltung_id, + + $qry = "SELECT + distinct tbl_lehrveranstaltung.bezeichnung, tbl_lehrveranstaltung.studiengang_kz, + tbl_lehrveranstaltung.semester, tbl_lehrveranstaltung.lehreverzeichnis, tbl_lehrveranstaltung.lehrveranstaltung_id, tbl_lehrveranstaltung.orgform_kurzbz, lehrfach.lehrveranstaltung_id as lehrfach_id, lehrfach.bezeichnung as lf_bezeichnung - FROM + FROM lehre.tbl_lehrveranstaltung JOIN lehre.tbl_lehreinheit USING(lehrveranstaltung_id) JOIN lehre.tbl_lehreinheitmitarbeiter USING(lehreinheit_id) JOIN lehre.tbl_lehrveranstaltung as lehrfach ON(tbl_lehreinheit.lehrfach_id=lehrfach.lehrveranstaltung_id) - WHERE + WHERE mitarbeiter_uid=".$this->db_add_param($user)." AND tbl_lehreinheit.studiensemester_kurzbz=".$this->db_add_param($stsem)." ORDER BY tbl_lehrveranstaltung.studiengang_kz, tbl_lehrveranstaltung.semester, lehrfach.bezeichnung"; - + if($result = $this->db_query($qry)) { - - + + $stsementry=array(); while($row = $this->db_fetch_object($result)) { $lv_obj = new lehrveranstaltung(); $lv_obj->load($row->lehrfach_id); - + if($row->studiengang_kz==0 AND $row->semester==0) { $stsementry[] = array('title'=>$lv_obj->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/freifaecher/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$stsem, - 'name'=>'FF '.$this->CutString($row->lehreverzeichnis, $cutlength) + 'name'=>'FF '.$this->CutString($row->lehreverzeichnis, $cutlength, '...') ); - } + } else { $stg_obj = new studiengang(); $stg_obj->load($row->studiengang_kz); $kurzbz = $stg_obj->kuerzel.'-'.$row->semester.' '.$row->orgform_kurzbz; - + $stsementry[] = array('title'=>$lv_obj->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/lehre/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$stsem, - 'name'=>$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength) + 'name'=>$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength, '...') ); - } + } } if(count($stsementry)>0) { @@ -207,7 +207,7 @@ class menu_addon_meinelvkompatibel extends menu_addon else echo "Fehler beim Auslesen des Lehrfaches"; } - + } else { @@ -216,19 +216,7 @@ class menu_addon_meinelvkompatibel extends menu_addon } $this->output(); } - - private function CutString($strVal, $limit) - { - if(mb_strlen($strVal) > $limit+3) - { - return mb_substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } - } -} +} new menu_addon_meinelvkompatibel(); ?> diff --git a/cms/menu/menu_addon_meinelv.inc.php b/cms/menu/menu_addon_meinelv.inc.php old mode 100755 new mode 100644 index 7c650ed04..89eecf088 --- a/cms/menu/menu_addon_meinelv.inc.php +++ b/cms/menu/menu_addon_meinelv.inc.php @@ -101,7 +101,7 @@ class menu_addon_meinelv extends menu_addon $this->items[] = array('title'=>$lv_obj->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/freifaecher/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$row->studiensemester_kurzbz, - 'name'=>'FF '.$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength) + 'name'=>'FF '.CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength, '...') ); } else @@ -109,7 +109,7 @@ class menu_addon_meinelv extends menu_addon $this->items[] = array('title'=>$lv_obj->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/lehre/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$row->studiensemester_kurzbz, - 'name'=>strtoupper($row->typ.$row->kurzbz).$row->semester.' '.$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength) + 'name'=>strtoupper($row->typ.$row->kurzbz).$row->semester.' '.CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength, '...') ); } } @@ -192,7 +192,7 @@ class menu_addon_meinelv extends menu_addon $this->items[] = array('title'=>$lv_obj->bezeichnung_arr[$sprache], 'target'=>'content', 'link'=>'private/freifaecher/lesson.php?lvid='.$row->lehrveranstaltung_id, - 'name'=>'FF '.$this->CutString($row->lehreverzeichnis, $cutlength) + 'name'=>'FF '.CutString($row->lehreverzeichnis, $cutlength, '...') ); } else @@ -203,7 +203,7 @@ class menu_addon_meinelv extends menu_addon $this->items[] = array('title'=>$titel, 'target'=>'content', 'link'=>'private/lehre/lesson.php?lvid='.$row->lehrveranstaltung_id.'&studiensemester_kurzbz='.$row->studiensemester_kurzbz, - 'name'=>$kurzbz.' '.$this->CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength) + 'name'=>$kurzbz.' '.CutString($lv_obj->bezeichnung_arr[$sprache], $cutlength, '...') ); } } @@ -220,18 +220,6 @@ class menu_addon_meinelv extends menu_addon } $this->output(); } - - private function CutString($strVal, $limit) - { - if(mb_strlen($strVal) > $limit+3) - { - return mb_substr($strVal, 0, $limit) . "..."; - } - else - { - return $strVal; - } - } } new menu_addon_meinelv(); diff --git a/cms/menu/menu_addon_spacer.inc.php b/cms/menu/menu_addon_spacer.inc.php old mode 100755 new mode 100644 diff --git a/cms/menu/menu_addon_test.inc.php b/cms/menu/menu_addon_test.inc.php old mode 100755 new mode 100644 diff --git a/cms/menu/menu_addon_urlaub.inc.php b/cms/menu/menu_addon_urlaub.inc.php old mode 100755 new mode 100644 diff --git a/cms/menu/menu_addon_zeitsperren.inc.php b/cms/menu/menu_addon_zeitsperren.inc.php old mode 100755 new mode 100644 diff --git a/cms/news.php b/cms/news.php old mode 100755 new mode 100644 diff --git a/cms/newsverwaltung.php b/cms/newsverwaltung.php old mode 100755 new mode 100644 diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 index 40404beca..1a6904333 --- a/composer.json +++ b/composer.json @@ -185,6 +185,30 @@ "reference": "b15ea33268b587d986371c0b6f215c36ffbb860c" } } + }, + { + "type": "package", + "package": { + "name": "datatables/plugins", + "version": "3.3.7", + "source": { + "url": "https://github.com/DataTables/Plugins.git", + "type": "git", + "reference": "master" + } + } + }, + { + "type": "package", + "package": { + "name": "BlackrockDigital/startbootstrap-sb-admin-2", + "version": "3.3.7", + "source": { + "url": "https://github.com/BlackrockDigital/startbootstrap-sb-admin-2.git", + "type": "git", + "reference": "master" + } + } } ], "require": { @@ -222,7 +246,13 @@ "jquery/sizzle": "^1.0", "tomazdragar/SimpleCropper": "^1.0", "nicolaskruchten/pivottable": "^2.15.0", - "jquery-archive/jquery-metadata": "^1.0" + "jquery-archive/jquery-metadata": "^1.0", + "BlackrockDigital/startbootstrap-sb-admin-2": "^3.3", + "components/font-awesome": "^4.7", + "moment/moment": "^2.20", + "datatables/datatables": "^1.10", + "datatables/plugins": "^3.3", + "eternicode/bootstrap-datepicker": "^1.7" }, "require-dev": { "squizlabs/php_codesniffer": "2.*" diff --git a/composer.lock b/composer.lock index 9fa4855d9..9aa3c5f64 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,19 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "e528bc5e31312080d7db9b1b3ae4033b", - "content-hash": "69612123f7b612e61cf1e0368e01ee27", + "hash": "b386e8ea62cfd8c96c6697729860cc5a", + "content-hash": "65e7f00446fd7f602e914089cedaa931", "packages": [ + { + "name": "BlackrockDigital/startbootstrap-sb-admin-2", + "version": "3.3.7", + "source": { + "type": "git", + "url": "https://github.com/BlackrockDigital/startbootstrap-sb-admin-2.git", + "reference": "master" + }, + "type": "library" + }, { "name": "alvaro-prieto/colResizable", "version": "1.6", @@ -462,6 +472,41 @@ ], "time": "2015-06-17 06:08:09" }, + { + "name": "components/font-awesome", + "version": "4.7.0", + "source": { + "type": "git", + "url": "https://github.com/components/font-awesome.git", + "reference": "885308b939369d147bec93174722786bc2c4eedd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/components/font-awesome/zipball/885308b939369d147bec93174722786bc2c4eedd", + "reference": "885308b939369d147bec93174722786bc2c4eedd", + "shasum": "" + }, + "type": "component", + "extra": { + "component": { + "styles": [ + "css/font-awesome.css" + ], + "files": [ + "css/font-awesome.min.css", + "css/font-awesome.css.map", + "fonts/*" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT", + "OFL-1.1" + ], + "description": "The iconic font designed for use with Twitter Bootstrap.", + "time": "2016-10-25 10:56:23" + }, { "name": "components/jquery", "version": "2.1.4", @@ -635,6 +680,39 @@ "description": "jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.", "time": "2016-09-16 05:47:55" }, + { + "name": "datatables/datatables", + "version": "1.10.16", + "source": { + "type": "git", + "url": "https://github.com/DataTables/DataTables.git", + "reference": "75a665f64f02982c0f4666b15a25c4670e5e6b18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DataTables/DataTables/zipball/75a665f64f02982c0f4666b15a25c4670e5e6b18", + "reference": "75a665f64f02982c0f4666b15a25c4670e5e6b18", + "shasum": "" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table.", + "homepage": "http://www.datatables.net/", + "time": "2017-08-31 13:52:17" + }, + { + "name": "datatables/plugins", + "version": "3.3.7", + "source": { + "type": "git", + "url": "https://github.com/DataTables/Plugins.git", + "reference": "master" + }, + "type": "library" + }, { "name": "easyrdf/easyrdf", "version": "0.9.1", @@ -697,6 +775,61 @@ ], "time": "2015-02-27 09:45:49" }, + { + "name": "eternicode/bootstrap-datepicker", + "version": "v1.7.1", + "source": { + "type": "git", + "url": "https://github.com/uxsolutions/bootstrap-datepicker.git", + "reference": "4c12834aae54782ca41d9409d6334193f200124d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/uxsolutions/bootstrap-datepicker/zipball/4c12834aae54782ca41d9409d6334193f200124d", + "reference": "4c12834aae54782ca41d9409d6334193f200124d", + "shasum": "" + }, + "require": { + "components/bootstrap": ">=2.0, <4.0", + "components/jquery": ">=1.7.1, <4.0.0", + "robloach/component-installer": "*" + }, + "type": "component", + "extra": { + "component": { + "scripts": [ + "js/bootstrap-datepicker.js" + ], + "styles": [ + "dist/css/bootstrap-datepicker.css", + "dist/css/bootstrap-datepicker3.css" + ], + "files": [ + "js/locales/bootstrap-datepicker.*.js" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Andrew Rowls", + "email": "eternicode@gmail.com" + }, + { + "name": "Community", + "homepage": "https://github.com/uxsolutions/bootstrap-datepicker/contributors" + } + ], + "description": "A datepicker for Bootstrap", + "keywords": [ + "bootstrap", + "datepicker" + ], + "time": "2017-07-06 12:14:34" + }, { "name": "fgelinas/timepicker", "version": "0.3.3", @@ -1198,6 +1331,60 @@ ], "time": "2016-10-10 08:57:56" }, + { + "name": "moment/moment", + "version": "2.20.1", + "source": { + "type": "git", + "url": "https://github.com/moment/moment.git", + "reference": "03073778ec18ee38e179208cd1af899e8d1848dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/moment/moment/zipball/03073778ec18ee38e179208cd1af899e8d1848dc", + "reference": "03073778ec18ee38e179208cd1af899e8d1848dc", + "shasum": "" + }, + "require": { + "robloach/component-installer": "*" + }, + "type": "component", + "extra": { + "component": { + "scripts": [ + "moment.js" + ], + "files": [ + "min/*.js", + "locale/*.js" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tim Wood", + "email": "washwithcare@gmail.com" + } + ], + "description": "Parse, validate, manipulate, and display dates in JavaScript.", + "homepage": "https://github.com/moment/moment", + "keywords": [ + "date", + "ender", + "format", + "i18n", + "l10n", + "moment", + "parse", + "time", + "validate" + ], + "time": "2017-12-19 04:36:30" + }, { "name": "netcarver/textile", "version": "v3.6.0", @@ -1840,16 +2027,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803" + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803", - "reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { @@ -1861,7 +2048,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -1895,7 +2082,7 @@ "portable", "shim" ], - "time": "2017-06-14 15:44:48" + "time": "2017-10-11 12:05:26" }, { "name": "symfony/process", @@ -2008,16 +2195,16 @@ }, { "name": "tinymce/tinymce", - "version": "4.7.1", + "version": "4.7.2", "source": { "type": "git", "url": "https://github.com/tinymce/tinymce-dist.git", - "reference": "4fd91026d3765fee9b148b5e684b014a8e18ead1" + "reference": "2639396a6d5eb8db7457ed4f6de6f5d15303ef52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/4fd91026d3765fee9b148b5e684b014a8e18ead1", - "reference": "4fd91026d3765fee9b148b5e684b014a8e18ead1", + "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/2639396a6d5eb8db7457ed4f6de6f5d15303ef52", + "reference": "2639396a6d5eb8db7457ed4f6de6f5d15303ef52", "shasum": "" }, "type": "component", @@ -2050,7 +2237,7 @@ "tinymce", "wysiwyg" ], - "time": "2017-10-09 13:17:31" + "time": "2017-11-07 12:44:31" }, { "name": "tomazdragar/SimpleCropper", diff --git a/config/cis.config-default.inc.php b/config/cis.config-default.inc.php old mode 100755 new mode 100644 index e3c4931db..835be5d80 --- a/config/cis.config-default.inc.php +++ b/config/cis.config-default.inc.php @@ -104,6 +104,10 @@ define('LDAP2_USER_SEARCH_FILTER','sAMAccountName'); // LDAP MASTER SERVER fuer Passwort Aenderungen define('LDAP_SERVER_MASTER',LDAP_SERVER); +// Default Password fuer neue Accounts +// Hier sollte ein langes geheimes Passwort gesetzt werden! +define('ACCOUNT_ACTIVATION_PASSWORD',''); + // Attribut fuer Zutrittskartennummer im LDAP define("LDAP_CARD_NUMBER","twHitagCardNumber"); // Attribut fuer Zutrittskartennummer2 im LDAP @@ -228,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;TicketNumber='); ?> diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index e0f2147e6..8078d4fca 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -94,6 +94,11 @@ define('LDAP2_USER_SEARCH_FILTER','sAMAccountName'); // LDAP MASTER SERVER fuer Passwort Aenderungen define('LDAP_SERVER_MASTER',LDAP_SERVER); +// Default Password fuer neue Accounts +// Hier sollte ein langes geheimes Passwort gesetzt werden! +define('ACCOUNT_ACTIVATION_PASSWORD',''); + + // Attribut fuer Zutrittskartennummer im LDAP define("LDAP_CARD_NUMBER","twHitagCardNumber"); // Attribut fuer Zutrittskartennummer2 im LDAP diff --git a/content/akteupload.php b/content/akteupload.php index 8dd49850e..6f0b422ba 100644 --- a/content/akteupload.php +++ b/content/akteupload.php @@ -129,30 +129,15 @@ if(isset($_POST['submitbild'])) $dokument->loadDokumenttyp($_REQUEST['dokumenttyp']); $extension = end(explode(".",strtolower($_FILES['file']['name']))); - $titel = $_REQUEST['dokumenttyp']; - - // da nur 32 zeichen gespeichert werden dürfen, muss anhand vom typ gekürzt werden - if($_REQUEST['dokumenttyp']=='Lebenslf') - $titel = $p->t('incoming/lebenslauf').".".$extension; - if($_REQUEST['dokumenttyp']=='LearnAgr') - $titel = $p->t('incoming/learningAgreement').".".$extension; - if($_REQUEST['dokumenttyp']=='Motivat') - $titel = $p->t('incoming/motivationsschreiben').".".$extension; - if($_REQUEST['dokumenttyp']=='Zeugnis') - $titel = $p->t('incoming/zeugnis').".".$extension; - if($_REQUEST['dokumenttyp']=='Lichtbil') - $titel = $p->t('incoming/lichtbild').".".$extension; - // alle auf 32 $akte->dokument_kurzbz = $_REQUEST['dokumenttyp']; - $akte->bezeichnung = substr($_FILES['file']['name'],0,32); // auf 32 $akte->person_id = $_GET['person_id']; //$akte->inhalt = base64_encode($content); $akte->mimetype = $_FILES['file']['type']; $akte->erstelltam = date('Y-m-d H:i:s'); $akte->gedruckt = false; - $akte->titel = $titel; - //$akte->bezeichnung = $dokument->bezeichnung; + $akte->titel = $akte->titel = cutString($_FILES['file']['name'], 32, '~', true); // Filename gekuerzt auf 32 Zeichen; + $akte->bezeichnung = cutString($dokument->bezeichnung_mehrsprachig[DEFAULT_LANGUAGE], 32); $akte->updateamum = date('Y-m-d H:i:s'); $akte->updatevon = $user; $akte->insertamum = date('Y-m-d H:i:s'); diff --git a/content/createAusbildungsvertrag.php b/content/createAusbildungsvertrag.php old mode 100755 new mode 100644 diff --git a/content/dokumentenakt.pdf.php b/content/dokumentenakt.pdf.php old mode 100755 new mode 100644 index a4c5ba4c7..a27b8d562 --- a/content/dokumentenakt.pdf.php +++ b/content/dokumentenakt.pdf.php @@ -1,6 +1,4 @@ db_query($query); - + while($row = $db->db_fetch_object($result)) { $docErrors = array(); @@ -237,7 +235,7 @@ foreach($prestudent_ids as $pid) "filename" => $row->titel, "nachgereicht" => ($row->nachgereicht == 't'?'true':'false'), "anmerkung" => $row->anmerkung); - else + else $dokumente[]['dokument'] = array( "name" => $row->bezeichnung, "filename" => $row->aktbezeichnung, @@ -286,7 +284,7 @@ foreach($prestudent_ids as $pid) { if(!isset($errors[$pid])) $errors[$pid] = array(); - + $errors[$pid] = array_merge($errors[$pid], $docErrors); } } @@ -301,14 +299,14 @@ foreach($prestudent_ids as $pid) $bundesland = ''; $heimatBundesland = ''; $zustellBundesland = ''; - + $nation = new nation($prestudent->geburtsnation); $geburtsnation = $nation->kurztext; $nation->load($prestudent->staatsbuergerschaft); $staatsbuergerschaft = $nation->kurztext; $nation->load($prestudent->zgvnation); $zgvnation = $nation->kurztext; - + $svnr = ($prestudent->svnr == '')?($prestudent->ersatzkennzeichen != ''?'Ersatzkennzeichen: '.$prestudent->ersatzkennzeichen:''):$prestudent->svnr; foreach($adresse->result as $row_adresse) @@ -342,7 +340,7 @@ foreach($prestudent_ids as $pid) else $errors[$pid][] = "Es ist ein Fehler bei der Ermittlung des Bundeslandes der Heimatadresse aufgetreten"; } - else + else $errors[$pid][] = "Heimat-Bundesland kann nicht ermittelt werden, da keine Gemeinde eingetragen ist"; } if($row_adresse->zustelladresse) @@ -394,22 +392,22 @@ foreach($prestudent_ids as $pid) { $telefonnummer = $row->kontakt; } - + if ($row->kontakttyp == 'email') { $mailadresse = $row->kontakt; } } - + } // Studiengang der Bewerbung $studiengang = new studiengang(); $studiengang->load($prestudent->studiengang_kz); - + // Datum Bewerbungabgschickt $prestudentstatus = new prestudent(); $prestudentstatus->getLastStatus($pid, '', 'Interessent'); - + // Spezielle Notizen auslesen und aufbereiten $notiz = new notiz(); $notiz->getNotiz('','','','','','',$pid,'','','','','','aufnahme/spezialisierung'); @@ -490,7 +488,7 @@ if(count($errors) == 0 || $force) echo fread($handle, 8192); } fclose($handle); - + } else { 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/lvplanung/timetable-week.xul.php b/content/lvplanung/timetable-week.xul.php index 0fe246577..439960110 100644 --- a/content/lvplanung/timetable-week.xul.php +++ b/content/lvplanung/timetable-week.xul.php @@ -29,8 +29,8 @@ require_once('../../include/benutzerberechtigung.class.php'); require_once('../../include/lehreinheit.class.php'); require_once('../../include/zeitwunsch.class.php'); require_once('../../include/wochenplan.class.php'); -require_once('../../include/reservierung.class.php'); -require_once('../../include/log.class.php'); +require_once('../../include/reservierung.class.php'); +require_once('../../include/log.class.php'); echo ''; echo ''; @@ -93,7 +93,7 @@ if (isset($_GET['new_ort'])) $new_ort=$_GET['new_ort']; if (isset($_GET['kollisionsanzahl'])) $kollisionsanzahl=$_GET['kollisionsanzahl']; -else +else $kollisionsanzahl=0; if (isset($_GET['ort'])) $ort=$_GET['ort']; @@ -224,7 +224,7 @@ if ($aktion=='stpl_move' || $aktion=='stpl_single_search' || $aktion=='stpl_set' } $name_stpl_idx='x'.++$j.'stundenplan_id0'; } - + //ReservierungsIDs $i=0; $name_res_id='reservierung_id'.$i; @@ -233,7 +233,7 @@ if ($aktion=='stpl_move' || $aktion=='stpl_single_search' || $aktion=='stpl_set' $res_id[]=$_GET[$name_res_id]; $name_res_id='reservierung_id'.++$i; } - + // Mehrfachauswahl uebernehmen $j=0; $name_res_idx='x'.$j.'reservierung_id0'; @@ -259,7 +259,7 @@ if ($aktion=='stpl_move' || $aktion=='stpl_set') $undo=''; $sql=''; $moved=array(); - + foreach ($stpl_id as $stundenplan_id) { $moved[]=$stundenplan_id; @@ -332,9 +332,9 @@ if ($aktion=='stpl_move' || $aktion=='stpl_set') } } } - + //UNDO Befehl schreiben - if($undo!='' && $error_msg=='' && $sql!='') + if($undo!='' && $error_msg=='' && $sql!='' && $kollision_msg=='') { $log = new log(); $log->executetime = date('Y-m-d H:i:s'); @@ -344,14 +344,14 @@ if ($aktion=='stpl_move' || $aktion=='stpl_set') $log->mitarbeiter_uid = $uid; if(!$log->save(true)) $error_msg.='Fehler: '.$log->errormsg; - + } } // ****************** STPL Delete ******************************* elseif ($aktion=='stpl_delete_single' || $aktion=='stpl_delete_block') { $lehrstunde=new lehrstunde(); - + if($rechte->isBerechtigt('lehre/lvplan',null,'uid')) { //Einzelne Stunden entfernen @@ -363,7 +363,7 @@ elseif ($aktion=='stpl_delete_single' || $aktion=='stpl_delete_block') $error_msg.=$lehrstunde->errormsg; } } - + //Loeschen von mehreren Stunden if(isset($stpl_idx)) { @@ -373,7 +373,7 @@ elseif ($aktion=='stpl_delete_single' || $aktion=='stpl_delete_block') $error_msg.=$lehrstunde->errormsg; } } - + if(isset($res_id)) { foreach ($res_id as $reservierung_id) @@ -397,7 +397,7 @@ elseif ($aktion=='stpl_delete_single' || $aktion=='stpl_delete_block') } } } - + //Loeschen von mehreren Reservierungen if(isset($res_idx)) { @@ -459,7 +459,7 @@ elseif ($aktion=='lva_single_set') for ($j=0;$j<$lva[$i]->stundenblockung;$j++) { - + if (!$lva[$i]->save_stpl($new_datum,$new_stunde+$j,$new_ort,$db_stpl_table,$uid)) $error_msg.='Error: '.$lva[$i]->errormsg; } @@ -481,18 +481,18 @@ elseif ($aktion=='lva_multi_set') $ferien->getAll($stg_kz); else $ferien->getAll(0); - + // Ende holen if (!$result_semester=$db->db_query("SELECT * FROM public.tbl_studiensemester WHERE studiensemester_kurzbz=".$db->db_add_param($semester_aktuell).";")) die ($db->db_last_error()); if ($db->db_num_rows()>0) { - $row = $db->db_fetch_object(); + $row = $db->db_fetch_object(); $ende = $row->ende; } else $error_msg.="Fatal Error: Ende Datum ist nicht gesetzt ($semester_aktuell)!"; - + $ende=mktime(0,0,1,substr($ende,5,2),substr($ende,8,2),substr($ende,0,4)); $anz_lvas=count($lva_id); // Arrays intitialisieren @@ -510,7 +510,7 @@ elseif ($aktion=='lva_multi_set') $lvas.=' OR lehreinheit_id='.$id; $lvas=substr($lvas,3); $sql_query.=$lvas; - + if(!$result_lva = $db->db_query($sql_query)) $error_msg.=$db->db_last_error(); $num_rows_lva=$db->db_num_rows($result_lva); @@ -533,7 +533,7 @@ elseif ($aktion=='lva_multi_set') $offenestunden=$os; else $error_msg.='Offene Stunden sind nicht eindeutig!'; - + //Blockung $blk=$block[0]; $block=array_unique($block); @@ -630,7 +630,7 @@ if ($error_msg=='' && ($kollision_msg=='' || $kollisionsanzahl>0)) } else $db->db_query('ROLLBACK;'); - + $error_msg.=$kollision_msg; // Stundenplan erstellen @@ -686,17 +686,17 @@ while ($begin<=$ende) else $error_msg.=$wunsch->errormsg; } - + // Stundenplan einer Woche laden if (! $stdplan->load_week($datum,$db_stpl_table, $alle_unr_mitladen)) $error_msg.=$stdplan->errormsg; - + //Raumvorschlag setzen - + if ($aktion=='lva_single_search' || $aktion=='lva_multi_search') if (! $stdplan->load_lva_search($datum,$lva_id,$db_stpl_table, $aktion)) $error_msg.=$stdplan->errormsg; - + if ($aktion=='stpl_single_search') { if(isset($stpl_id)) @@ -704,13 +704,13 @@ while ($begin<=$ende) if (! $stdplan->load_stpl_search($datum,$stpl_id,$db_stpl_table)) $error_msg.=$stdplan->errormsg; } - else + else $error_msg.='Derzeit gibt es keinen Raumvorschlag fuer Reservierungen'; } // Stundenplan der Woche drucken $stdplan->draw_week_xul($semesterplan,$uid,$zeitwunsch, $ignore_kollision, $kollision_student, $max_kollision); - + } ?> @@ -724,7 +724,7 @@ while ($begin<=$ende) if ($error_msg!='') echo "alert('".str_replace("'",'"',str_replace(chr(10),'\n',htmlspecialchars($error_msg)))."');"; ?> - + top.document.getElementById("statusbarpanel-text").setAttribute("label",""); diff --git a/content/notiz.xml.php b/content/notiz.xml.php old mode 100755 new mode 100644 diff --git a/content/planner.js.php b/content/planner.js.php old mode 100755 new mode 100644 diff --git a/content/planner.overlay.js.php b/content/planner.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/planner.overlay.xul.php b/content/planner.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/planner.xul.php b/content/planner.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/GanttChart.svg b/content/projekt/GanttChart.svg old mode 100755 new mode 100644 diff --git a/content/projekt/bestellung.overlay.js.php b/content/projekt/bestellung.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/bestellung.overlay.xul.php b/content/projekt/bestellung.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/gantt.css b/content/projekt/gantt.css old mode 100755 new mode 100644 diff --git a/content/projekt/gantt.overlay.js.php b/content/projekt/gantt.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/gantt.overlay.xul.php b/content/projekt/gantt.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/gantt.svg.css b/content/projekt/gantt.svg.css old mode 100755 new mode 100644 diff --git a/content/projekt/gantt.svg.php b/content/projekt/gantt.svg.php old mode 100755 new mode 100644 diff --git a/content/projekt/gantt.svg.xbl b/content/projekt/gantt.svg.xbl old mode 100755 new mode 100644 diff --git a/content/projekt/mantisdetail.overlay.xul.php b/content/projekt/mantisdetail.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/parsedown.php b/content/projekt/parsedown.php old mode 100755 new mode 100644 diff --git a/content/projekt/projekt.overlay.js.php b/content/projekt/projekt.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/projekt.overlay.xul.php b/content/projekt/projekt.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projekt_ressource.window.js.php b/content/projekt/projekt_ressource.window.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/projekt_ressource.window.xul.php b/content/projekt/projekt_ressource.window.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektdetail.overlay.xul.php b/content/projekt/projektdetail.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektdokument.overlay.js.php b/content/projekt/projektdokument.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektdokument.overlay.xul.php b/content/projekt/projektdokument.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektdokument.window.js.php b/content/projekt/projektdokument.window.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektdokument.window.xul.php b/content/projekt/projektdokument.window.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektphase.overlay.js.php b/content/projekt/projektphase.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektphase.overlay.xul.php b/content/projekt/projektphase.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projektphasedetail.overlay.xul.php b/content/projekt/projektphasedetail.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projekttask.overlay.js.php b/content/projekt/projekttask.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/projekttask.overlay.xul.php b/content/projekt/projekttask.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/projekttaskdetail.overlay.xul.php b/content/projekt/projekttaskdetail.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/ressource.js.php b/content/projekt/ressource.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/ressource.overlay.js.php b/content/projekt/ressource.overlay.js.php old mode 100755 new mode 100644 diff --git a/content/projekt/ressource.overlay.xul.php b/content/projekt/ressource.overlay.xul.php old mode 100755 new mode 100644 diff --git a/content/projekt/ressource.xml.php b/content/projekt/ressource.xml.php old mode 100755 new mode 100644 diff --git a/content/projekt/ressourcenauslastung.php b/content/projekt/ressourcenauslastung.php old mode 100755 new mode 100644 diff --git a/content/projektbeschreibung.php b/content/projektbeschreibung.php old mode 100755 new mode 100644 diff --git a/content/statistik/StudierendeZGV.php b/content/statistik/StudierendeZGV.php old mode 100755 new mode 100644 diff --git a/content/statistik/dropout.php b/content/statistik/dropout.php old mode 100755 new mode 100644 diff --git a/content/statistik/dropoutZGV.php b/content/statistik/dropoutZGV.php old mode 100755 new mode 100644 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/content/student/interessentdokumenteoverlay.xul.php b/content/student/interessentdokumenteoverlay.xul.php index 3cde73f5f..d932eae61 100644 --- a/content/student/interessentdokumenteoverlay.xul.php +++ b/content/student/interessentdokumenteoverlay.xul.php @@ -171,11 +171,11 @@ echo ''; class="sortDirectionIndicator" sort="rdf:http://www.technikum-wien.at/dokumentprestudent/rdf#bezeichnung" onclick="InteressentDokumenteAbgegebenTreeSort()" /> -