diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index 4be3a0e78..5fac9c95c 100755 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -65,11 +65,21 @@ class Messages extends VileSci_Controller array_shift($variables->retval); // Remove person_id array_shift($variables->retval); // Remove prestudent_id + // + $oe_kurzbz = null; + $this->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); + $benutzerResult = $this->BenutzerfunktionModel->getByPersonId($sender_id); + if (hasData($benutzerResult)) + { + $oe_kurzbz = $benutzerResult->retval[0]->oe_kurzbz; + } + $data = array ( 'sender_id' => $sender_id, 'receivers' => $prestudent->retval, 'message' => $msg, - 'variables' => $variablesArray + 'variables' => $variablesArray, + 'oe_kurzbz' => $oe_kurzbz ); $v = $this->load->view('system/messageWrite', $data); diff --git a/application/libraries/OrganisationseinheitLib.php b/application/libraries/OrganisationseinheitLib.php index be66e2157..8d125abc0 100644 --- a/application/libraries/OrganisationseinheitLib.php +++ b/application/libraries/OrganisationseinheitLib.php @@ -59,7 +59,48 @@ class OrganisationseinheitLib return $this->treeSearch($schema, $table, $select, $where, $orderby, $result->retval[0]->_ppk); } } + + return $result; + } + + public function treeSearchEntire($table, $alias, $fields, $where, $orderby, $oe_kurzbz) + { + $select = ""; + if (is_array($fields)) + { + for ($i = 0; $i < count($fields); $i++) + { + $select .= $fields[$i]; + if ($i != count($fields) - 1) + { + $select .= ", "; + } + } + } + else + { + $select = $fields; + } + $result = $this->ci->OrganisationseinheitModel->getOneLevelAlias($table, $alias, $select, $where, $orderby, $oe_kurzbz); + + if (hasData($result)) + { + if ($result->retval[0]->_pk != null && $result->retval[0]->_ppk != null && $result->retval[0]->_jtpk != null) + { + $tmpResult = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk); + + if (hasData($tmpResult) && $tmpResult->retval[0]->_pk != null && $tmpResult->retval[0]->_ppk != null && $tmpResult->retval[0]->_jtpk != null) + { + $result->retval = array_merge($result->retval, $tmpResult->retval); + } + } + else if ($result->retval[0]->_ppk != null) + { + $result = $this->treeSearchEntire($table, $alias, $select, $where, $orderby, $result->retval[0]->_ppk); + } + } + return $result; } } \ No newline at end of file diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php index ccab383cd..0414cd560 100755 --- a/application/models/organisation/Organisationseinheit_model.php +++ b/application/models/organisation/Organisationseinheit_model.php @@ -78,9 +78,34 @@ class Organisationseinheit_model extends DB_Model ) _joined_table ON (orgs._pk = _joined_table._pk) WHERE orgs._pk = ? ORDER BY %s"; - + $query = sprintf($query, $table, $fields, $schema, $table, $where, $orderby); - + return $this->execQuery($query, array($oe_kurzbz)); } -} + + public function getOneLevelAlias($table, $alias, $fields, $where, $orderby, $oe_kurzbz) + { + $query = "WITH RECURSIVE organizations(_pk, _ppk) AS + ( + SELECT o.oe_kurzbz, o.oe_parent_kurzbz + FROM public.tbl_organisationseinheit o + WHERE o.oe_parent_kurzbz IS NULL + UNION ALL + SELECT o.oe_kurzbz, o.oe_parent_kurzbz + FROM public.tbl_organisationseinheit o INNER JOIN organizations orgs ON (o.oe_parent_kurzbz = orgs._pk) + ) + SELECT orgs._pk, orgs._ppk, _joined_table.* + FROM organizations orgs LEFT JOIN ( + SELECT %s.oe_kurzbz as _jtpk, %s + FROM %s + WHERE %s + ) _joined_table ON (orgs._pk = _joined_table._jtpk) + WHERE orgs._pk = ? + ORDER BY %s"; + + $query = sprintf($query, $alias, $fields, $table, $where, $orderby); + + return $this->execQuery($query, array($oe_kurzbz)); + } +} \ No newline at end of file diff --git a/application/models/person/Benutzerfunktion_model.php b/application/models/person/Benutzerfunktion_model.php index e570a8edf..c76dbd00d 100644 --- a/application/models/person/Benutzerfunktion_model.php +++ b/application/models/person/Benutzerfunktion_model.php @@ -1,7 +1,7 @@ dbTable = 'public.tbl_benutzerfunktion'; $this->pk = 'benutzerfunktion_id'; } -} + + /** + * + */ + public function getByPersonId($person_id) + { + // Join with the table + $this->addJoin('public.tbl_benutzer', 'uid'); + + return $this->loadWhere(array('person_id' => $person_id)); + } +} \ No newline at end of file diff --git a/application/views/system/messageWrite.php b/application/views/system/messageWrite.php index 84757b5cc..384d2a8db 100644 --- a/application/views/system/messageWrite.php +++ b/application/views/system/messageWrite.php @@ -93,7 +93,7 @@ widgetlib->widget( 'Vorlage_widget', - null, + array('oe_kurzbz' => $oe_kurzbz), array('name' => 'vorlage', 'id' => 'vorlageDnD') ); ?> diff --git a/application/widgets/vorlage_widget.php b/application/widgets/vorlage_widget.php index a720222b1..50065d1c7 100644 --- a/application/widgets/vorlage_widget.php +++ b/application/widgets/vorlage_widget.php @@ -4,13 +4,26 @@ class Vorlage_widget extends DropdownWidget { public function display($widgetData) { - $this->load->model('system/Vorlage_model', 'VorlageModel'); - $this->VorlageModel->addOrder('vorlage_kurzbz'); + // Loads + $this->load->library('OrganisationseinheitLib'); - $this->addSelectToModel($this->VorlageModel, 'vorlage_kurzbz', 'bezeichnung'); + $vorlage = $this->organisationseinheitlib->treeSearchEntire( + '( + SELECT v.vorlage_kurzbz, v.bezeichnung, vs.version, vs.oe_kurzbz, vs.aktiv, vs.subject, vs.text, v.mimetype + FROM tbl_vorlagestudiengang vs INNER JOIN tbl_vorlage v USING(vorlage_kurzbz) + ) templates', + 'templates', + array("templates.vorlage_kurzbz AS id", "UPPER(templates.oe_kurzbz) || ' - ' || templates.bezeichnung || ' - V' || templates.version AS description"), + 'templates.aktiv = TRUE + AND templates.subject IS NOT NULL + AND templates.text IS NOT NULL + AND templates.mimetype = \'text/html\'', + "description ASC", + $widgetData['oe_kurzbz'] + ); $this->setElementsArray( - $this->VorlageModel->loadWhere(array('mimetype' => 'text/html')), + $vorlage, true, 'Select a vorlage...', 'No vorlage found' diff --git a/cis/private/lvplan/stpl_kalender.php b/cis/private/lvplan/stpl_kalender.php index bae1b5795..16ea2e48f 100644 --- a/cis/private/lvplan/stpl_kalender.php +++ b/cis/private/lvplan/stpl_kalender.php @@ -289,12 +289,14 @@ $i=0; while($begin<$ende) { $i++; - if(!date("w",$begin)) - $begin=jump_day($begin,1); + $begin = montag($begin); $stdplan->init_stdplan(); $datum=$begin; - $begin+=604800; // eine Woche + + // eine Woche weiterspringen + $datum_tmp = new datum(); + $begin = $datum_tmp->jump_week($begin,1); // Stundenplan einer Woche laden if(!$stdplan->load_week($datum,$db_stpl_table)) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 8ca3c9304..9a2bd3277 100755 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -20,7 +20,7 @@ * Rudolf Hangl * Karl Burkhart * Manfred Kindl . - * Gerald Raab + * Gerald Raab */ require_once('../../../config/cis.config.inc.php'); require_once('../../../include/functions.inc.php'); @@ -32,7 +32,7 @@ require_once('../../../include/zeitaufzeichnung.class.php'); require_once('../../../include/zeitsperre.class.php'); require_once('../../../include/datum.class.php'); require_once('../../../include/projekt.class.php'); -require_once('../../../include/phrasen.class.php'); +require_once('../../../include/phrasen.class.php'); require_once('../../../include/organisationseinheit.class.php'); require_once('../../../include/service.class.php'); require_once('../../../include/mitarbeiter.class.php'); @@ -42,15 +42,15 @@ require_once('../../../include/bisverwendung.class.php'); require_once('../../../include/studiensemester.class.php'); require_once('../../../include/benutzerberechtigung.class.php'); -$sprache = getSprache(); -$p=new phrasen($sprache); - +$sprache = getSprache(); +$p=new phrasen($sprache); + if (!$db = new basis_db()) die($p->t("global/fehlerBeimOeffnenDerDatenbankverbindung")); - + $user = get_uid(); -//Wenn User Administrator ist und UID uebergeben wurde, dann die Zeiaufzeichnung +//Wenn User Administrator ist und UID uebergeben wurde, dann die Zeiaufzeichnung //des uebergebenen Users anzeigen if(isset($_GET['uid'])) { @@ -60,12 +60,18 @@ if(isset($_GET['uid'])) { $user = $_GET['uid']; } - else + else { die($p->t('global/FuerDieseAktionBenoetigenSieAdministrationsrechte')); } } - +$rechteexport = new benutzerberechtigung(); +$rechteexport->getBerechtigungen($user); +if($rechteexport->isBerechtigt('addon/casetimeGenerateXLS')) + $export_xls = 'true'; +else { + $export_xls = 'false'; +} $datum = new datum(); @@ -73,8 +79,8 @@ if (check_infrastruktur($user)) { $za_simple = 0; $activities = array('Design', 'Operativ', 'Betrieb', 'Pause', 'LehreIntern', 'LehreExtern', 'Arztbesuch', 'Dienstreise', 'Behoerde'); -} -else +} +else { $za_simple = 1; $activities = array('Arbeit', 'Pause', 'LehreIntern', 'LehreExtern', 'Arztbesuch', 'Dienstreise', 'Behoerde'); @@ -141,13 +147,13 @@ foreach($addon_obj->result as $addon) // Wenn Seite fertig geladen ist Addons aufrufen echo '