From 7ae8f67fd323643a7da2198a96d3140cb92f42a1 Mon Sep 17 00:00:00 2001 From: Paolo Date: Tue, 26 Nov 2024 12:50:36 +0100 Subject: [PATCH] - Moved Drawio XML generation from application/libraries/DrawIoLib.php to application/models/CL/Drawio_model.php - Changed application/libraries/DocsboxLib.php to bettere handle output files - Jobs Modulgrafik and Organigramm now they generates PNGs from the Drawio XML --- application/controllers/jobs/Modulgrafik.php | 196 ++++++++++ .../controllers/jobs/ModulgrafikTest.php | 169 --------- application/controllers/jobs/Organigramm.php | 339 ++++++++++++++++++ .../controllers/jobs/OrganigrammTest.php | 319 ---------------- application/libraries/DocsboxLib.php | 9 +- application/libraries/DrawIoLib.php | 155 -------- application/models/CL/Drawio_model.php | 170 +++++++++ 7 files changed, 709 insertions(+), 648 deletions(-) create mode 100644 application/controllers/jobs/Modulgrafik.php delete mode 100644 application/controllers/jobs/ModulgrafikTest.php create mode 100644 application/controllers/jobs/Organigramm.php delete mode 100644 application/controllers/jobs/OrganigrammTest.php delete mode 100644 application/libraries/DrawIoLib.php create mode 100644 application/models/CL/Drawio_model.php diff --git a/application/controllers/jobs/Modulgrafik.php b/application/controllers/jobs/Modulgrafik.php new file mode 100644 index 000000000..48da2987b --- /dev/null +++ b/application/controllers/jobs/Modulgrafik.php @@ -0,0 +1,196 @@ +load->model('organisation/Studienplan_model', 'StudienplanModel'); + + $this->load->model('CL/Drawio_model', 'DrawioModel'); + + $this->load->library('DocsboxLib', null, 'DocsboxLib'); + } + + public function drawModulGrafik($studienplan_id) + { + $sql = << '0.00' + ORDER BY + sl.semester ASC, + lvgrp ASC, + lv.lehrtyp_kurzbz DESC +EOSQL; + + $result = $this->StudienplanModel->execReadOnlyQuery($sql); + $lvs = getData($result); + + $errors = array(); + $assoclvs = array(); + $semester = array(); + if($lvs) + { + ob_start(); + + foreach($lvs as &$lv) + { + if( !isset($semester[$lv->semester]) ) { + $semester[$lv->semester] = array(); + } + $lv->parent = null; + $lv->childs = array(); + $assoclvs[$lv->studienplan_lehrveranstaltung_id] = $lv; + } + + foreach($assoclvs as &$assoclv) + { + if( $assoclv->studienplan_lehrveranstaltung_id_parent === NULL ) + { + $semester[$assoclv->semester][] = $assoclv; + } + else + { + if( isset($assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]) ) + { + $assoclv->parent = $assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]; + $assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]->childs[] = $assoclv; + } + else + { + $errors[] = "ERROR: Missing parent lv " . $assoclv->studienplan_lehrveranstaltung_id_parent . "\n"; + } + } + } + + function printchilds($childs, $level) { + if( count($childs) < 1 ) + { + return; + } + + foreach($childs as $child) + { + echo $level . $child->bezeichnung . " (" . $child->ects . ") " . $child->lehrtyp_kurzbz . "\n"; + printchilds($child->childs, $level . "\t"); + } + } + + echo "\n\n"; + + if (count($errors) === 0) + { + $this->DrawioModel->renderFileStart(); + $this->maxxoffset = self::DEFAULT_XOFFSET; + $this->DrawioModel->renderDiagramStart($studienplan_id, 'Modulgrafik'); + $this->renderSemester($semester); + $this->DrawioModel->renderDiagramEnd(); + $this->DrawioModel->renderFileEnd(); + } + else + { + foreach ($errors as $error) + { + echo $error; + } + } + + $output = ob_get_clean(); + file_put_contents(sys_get_temp_dir().'/Modulgrafik.xml', $output); + + $ret = DocsboxLib::convert(sys_get_temp_dir().'/Modulgrafik.xml', sys_get_temp_dir().'/Modulgrafik.png', 'png'); + + echo 'File: '.sys_get_temp_dir().'/Modulgrafik.png'."\n"; + } + else + { + echo "Keine LVs gefunden.\n"; + } + } + + protected function renderSemester($semester) + { + $cury = self::DEFAULT_YOFFSET; + + foreach($semester as $sem => $mods) + { + $curx = self::DEFAULT_XOFFSET; + $id = uniqid(); + $ects = 30; //TODO calc + $this->DrawioModel->renderSemesterLabel($id, $sem, $ects, self::DEFAULT_XOFFSET, $cury, self::DEFAULT_SEMESTER_LABEL_WIDTH, self::DEFAULT_HEIGHT); + $curx += self::DEFAULT_SEMESTER_LABEL_WIDTH + self::DEFAULT_SPACING; + $maxmodulheight = 0; + foreach($mods as $mod) + { + $modid = uniqid(); + $size = $this->DrawioModel->renderModulList($modid, $mod, $curx, $cury, self::DEFAULT_ECTS_WIDTH, self::DEFAULT_HEIGHT); + $curx += $size->width + self::DEFAULT_SPACING; + if( $size->height > $maxmodulheight) + { + $maxmodulheight = $size->height; + } + } + $cury += $maxmodulheight + self::DEFAULT_SPACING; + } + } +} + diff --git a/application/controllers/jobs/ModulgrafikTest.php b/application/controllers/jobs/ModulgrafikTest.php deleted file mode 100644 index 8973e8f1f..000000000 --- a/application/controllers/jobs/ModulgrafikTest.php +++ /dev/null @@ -1,169 +0,0 @@ -load->model('organisation/Studienplan_model', 'StudienplanModel'); - - $this->load->library('DrawIoLib', null, 'DrawIoLib'); - } - - public function drawModulGrafik($studienplan_id) - { - $sql = << '0.00' - ORDER BY - sl.semester ASC, - lvgrp ASC, - lv.lehrtyp_kurzbz DESC -EOSQL; - - $result = $this->StudienplanModel->execReadOnlyQuery($sql); - $lvs = getData($result); -/* - print_r($lvs); - exit(); -*/ - $errors = array(); - $assoclvs = array(); - $semester = array(); - if($lvs) - { - foreach($lvs as &$lv) - { - if( !isset($semester[$lv->semester]) ) { - $semester[$lv->semester] = array(); - } - $lv->parent = null; - $lv->childs = array(); - $assoclvs[$lv->studienplan_lehrveranstaltung_id] = $lv; - } - - foreach($assoclvs as &$assoclv) - { - if( $assoclv->studienplan_lehrveranstaltung_id_parent === NULL ) - { - $semester[$assoclv->semester][] = $assoclv; - } - else - { - if( isset($assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]) ) - { - $assoclv->parent = $assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]; - $assoclvs[$assoclv->studienplan_lehrveranstaltung_id_parent]->childs[] = $assoclv; - } - else - { - $errors[] = "ERROR: Missing parent lv " . $assoclv->studienplan_lehrveranstaltung_id_parent . "\n"; - } - } - } - - function printchilds($childs, $level) { - if( count($childs) < 1 ) { - return; - } - foreach($childs as $child) { - echo $level . $child->bezeichnung . " (" . $child->ects . ") " . $child->lehrtyp_kurzbz . "\n"; - printchilds($child->childs, $level . "\t"); - } - } - - echo "\n\n"; - - if(count($errors) === 0) { - $this->DrawIoLib->renderFileStart(); - $this->maxxoffset = self::DEFAULT_XOFFSET; - $this->DrawIoLib->renderDiagramStart($studienplan_id, 'Modulgrafik'); - $this->renderSemester($semester); - $this->DrawIoLib->renderDiagramEnd(); - $this->DrawIoLib->renderFileEnd(); - } - else - { - foreach ($errors as $error) - { - echo $error; - } - } - } - else - { - echo "Keine LVs gefunden.\n"; - } - } - - protected function renderSemester($semester) - { - $cury = self::DEFAULT_YOFFSET; - - foreach($semester as $sem => $mods) - { - $curx = self::DEFAULT_XOFFSET; - $id = uniqid(); - $ects = 30; //TODO calc - $this->DrawIoLib->renderSemesterLabel($id, $sem, $ects, self::DEFAULT_XOFFSET, $cury, self::DEFAULT_SEMESTER_LABEL_WIDTH, self::DEFAULT_HEIGHT); - $curx += self::DEFAULT_SEMESTER_LABEL_WIDTH + self::DEFAULT_SPACING; - $maxmodulheight = 0; - foreach($mods as $mod) - { - $modid = uniqid(); - $size = $this->DrawIoLib->renderModulList($modid, $mod, $curx, $cury, self::DEFAULT_ECTS_WIDTH, self::DEFAULT_HEIGHT); - $curx += $size->width + self::DEFAULT_SPACING; - if( $size->height > $maxmodulheight) - { - $maxmodulheight = $size->height; - } - } - $cury += $maxmodulheight + self::DEFAULT_SPACING; - } - } -} diff --git a/application/controllers/jobs/Organigramm.php b/application/controllers/jobs/Organigramm.php new file mode 100644 index 000000000..7e451f68d --- /dev/null +++ b/application/controllers/jobs/Organigramm.php @@ -0,0 +1,339 @@ +load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); + + $this->load->model('CL/Drawio_model', 'DrawioModel'); + + $this->load->library('DocsboxLib', null, 'DocsboxLib'); + + $this->maxxoffset = self::DEFAULT_XOFFSET; + $this->donotrenderchildsoftype = array(); + } + + public function getAllActiveOes() + { + $sql = << NOW() :: date + ) + AND ( + bf.funktion_kurzbz IS NULL + OR bf.funktion_kurzbz = 'Leitung' + ) + LEFT JOIN public.tbl_benutzer b USING(uid) + LEFT JOIN public.tbl_person p USING(person_id) + WHERE + oe.aktiv = true + AND oe.oe_kurzbz NOT IN ('betriebsrat', 'oeh', 'FUEWahl', 'atw', 'etw', 'gf20') + GROUP BY + oe.oe_kurzbz, + oe.oe_parent_kurzbz, + oe.bezeichnung, + oe.organisationseinheittyp_kurzbz + ORDER BY + oe.oe_parent_kurzbz ASC NULLS FIRST, + oe.oe_kurzbz ASC; +EOSQL; + + $result = $this->OrganisationseinheitModel->execReadOnlyQuery($sql); + $oes = getData($result); + + $errors = array(); + $assocoes = array(); + $roots = array(); + if($oes) + { + ob_start(); + + foreach($oes as &$oe) + { + $oe->parent = NULL; + $oe->childs = array(); + $oe->renderchilds = self::RENDER_CHILDS_HORIZONTAL; + $oe->childstorender = array(); + $oe->donotrenderchildsoftype = array(); + $assocoes[$oe->oe_kurzbz] = $oe; + } + + foreach($assocoes as &$assocoe) + { + if( $assocoe->oe_parent_kurzbz === NULL ) + { + $roots[$assocoe->oe_kurzbz] = $assocoe; + $assocoe->donotrenderchildsoftype = array( + 'Team', + 'Lehrgang', + 'Studiengang', + 'Kompetenzfeld', + 'Forschungsfeld', + 'Container' + ); + } + else + { + if( isset($assocoes[$assocoe->oe_parent_kurzbz]) ) + { + $assocoe->parent = $assocoes[$assocoe->oe_parent_kurzbz]; + $assocoes[$assocoe->oe_parent_kurzbz]->childs[] = $assocoe; + + if( $assocoe->organisationseinheittyp_kurzbz === 'Fakultaet' ) + { + $roots[$assocoe->oe_kurzbz] = $assocoe; + } + } + else + { + $errors[] = "ERROR: Missing parent oe " . $assocoe->oe_parent_kurzbz . "\n"; + } + } + } + + if(count($errors) === 0) + { + $pages = count($roots); + $this->DrawioModel->renderFileStart($pages); + + foreach($roots AS &$root) + { + $this->maxxoffset = self::DEFAULT_XOFFSET; + $this->donotrenderchildsoftype = $root->donotrenderchildsoftype; + $this->prepareChildsToRender($root); + $this->DrawioModel->renderDiagramStart($root->oe_kurzbz, $root->bezeichnung); + $this->renderOE($root, 0, 0); + $this->DrawioModel->renderDiagramEnd(); + } + $this->DrawioModel->renderFileEnd(); + } + else + { + foreach ($errors as $error) + { + echo $error; + } + } + + $output = ob_get_clean(); + file_put_contents(sys_get_temp_dir().'/Organigramm.xml', $output); + + $ret = DocsboxLib::convert(sys_get_temp_dir().'/Organigramm.xml', sys_get_temp_dir().'/Organigramm.png', 'png'); + + echo 'File: '.sys_get_temp_dir().'//Organigramm.png'."\n"; + } + else + { + echo "Keine Oes gefunden.\n"; + } + } + + protected function prepareChildsToRender(&$oe) + { + $oe->childstorender = array(); + $oe->renderchilds = self::RENDER_CHILDS_HORIZONTAL; + if( isset($oe->childsxoffset) ) + { + unset($oe->childsxoffset); + } + + foreach($oe->childs AS &$oechild ) + { + $this->prepareChildsToRender($oechild); + if( !in_array($oechild->organisationseinheittyp_kurzbz, $this->donotrenderchildsoftype) ) + { + $oe->childstorender[] = $oechild; + } + } + + $nurLehrgaengeOderStudiengaengeOhneKinder = true; + foreach($oe->childstorender AS &$oechildtorender ) + { + if( !(count($oechildtorender->childstorender) === 0) ) + { + $nurLehrgaengeOderStudiengaengeOhneKinder = false; + } + } + + if( $nurLehrgaengeOderStudiengaengeOhneKinder && $oe->parent !== NULL ) + { + $oe->renderchilds = self::RENDER_CHILDS_VERTICAL; + } + } + + protected function renderOE($oe, $level, $parentrenderedchildcount) + { + $width = self::DEFAULT_WIDTH; + $height = self::DEFAULT_HEIGHT; + $spacing = self::DEFAULT_SPACING; + $fontsize = self::DEFAULT_FONTSIZE; + $nextlevel = $level + 1; + $renderedchildcount = 0; + + $curxoffset = $this->maxxoffset; + + if( count($oe->childstorender) > 0 ) + { + if( !isset($oe->childsxoffset) ) + { + $oe->childsxoffset = (object) array( + 'min' => $curxoffset, + 'max' => $curxoffset + ); + } + + foreach($oe->childstorender AS $child) + { + $ret = $this->renderOE($child, $nextlevel, $renderedchildcount); + $renderedchildcount++; + if( $renderedchildcount === 1 ) + { + $oe->childsxoffset->min = $ret->minx; + } + $oe->childsxoffset->max = $ret->maxx; + } + + if( count($oe->childstorender) === $renderedchildcount ) + { + $curxoffset = $oe->childsxoffset->min + + floor((($oe->childsxoffset->max - $oe->childsxoffset->min) / 2)) - + floor((($width + $spacing) / 2)); + } + } + + if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL ) + { + $x = $curxoffset; + $y = self::DEFAULT_YOFFSET + + (($level - 1) * ($height + $spacing)) + + (($parentrenderedchildcount + 1) * ($height + floor($spacing / 2))); + } + else + { + $x = $curxoffset; + $y = self::DEFAULT_YOFFSET + ($level * ($height + $spacing)); + } + $bezeichnung = htmlspecialchars($oe->bezeichnung); + $leitung = ($oe->leitung_uid !== null) ? htmlspecialchars($oe->leitung_uid) : 'N.N.'; + $fillcolors = array( + 'Team' => '#ffe6cc', + 'Abteilung' => '#e6ffcc', + 'Studiengang' => '#cce6ff', + 'Lehrgang' => '#e6ccff', + 'Fakultaet' => '#f8cecc', + 'Department' => '#fff2cc', + 'Forschungsfeld' => '#e1d5e7', + 'Kompetenzfeld' => '#f5f5f5' + ); + $fillcolor = (isset($fillcolors[$oe->organisationseinheittyp_kurzbz])) ? $fillcolors[$oe->organisationseinheittyp_kurzbz] : '#ffffff'; + $value = <<organisationseinheittyp_kurzbz}]</div><b style="">{$bezeichnung}</b><div>({$leitung})</div></font>" style="whiteSpace=wrap;html=1;align=center;verticalAlign=middle;treeFolding=1;treeMoving=1;newEdgeStyle={"edgeStyle":"elbowEdgeStyle","startArrow":"none","endArrow":"none"};fillColor={$fillcolor}; +EOVAL; + + $this->DrawioModel->renderCell($oe->oe_kurzbz, $value, $x, $y, $width, $height); + + if( $oe->oe_parent_kurzbz !== NULL ) + { + $exitX = '0.5'; + $exitY = '1'; + $entryX = '0.5'; + $entryY = '0'; + $points = array(); + if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL) + { + $exitX = '0'; + $exitY = '0.5'; + $entryX = '0'; + $entryY = '0.5'; + $points = array( + (object) array( + 'x' => ($x - floor($spacing / 2)), + 'y' => ($y + floor($height / 2)) + ) + ); + } + $this->DrawioModel->renderEdge($oe->oe_parent_kurzbz, $oe->oe_kurzbz, $exitX, $exitY, $entryX, $entryY, $points); + } + + if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL ) + { + if( count($oe->parent->childstorender) === ($parentrenderedchildcount + 1) ) + { + if( $this->maxxoffset < ($x + $width + $spacing) ) + { + $this->maxxoffset = ($x + $width + $spacing); + } + return (object) array( + 'minx' => $curxoffset, + 'maxx' => ($x + $width + $spacing) + ); + } + return (object) array( + 'minx' => $curxoffset, + 'maxx' => $x + ); + } + + if( $this->maxxoffset < ($x + $width + $spacing) ) + { + $this->maxxoffset = ($x + $width + $spacing); + } + + return (object) array( + 'minx' => $curxoffset, + 'maxx' => ($x + $width + $spacing) + ); + } +} + diff --git a/application/controllers/jobs/OrganigrammTest.php b/application/controllers/jobs/OrganigrammTest.php deleted file mode 100644 index 89c60830f..000000000 --- a/application/controllers/jobs/OrganigrammTest.php +++ /dev/null @@ -1,319 +0,0 @@ -load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); - - $this->load->library('DrawIoLib', null, 'DrawIoLib'); - - $this->maxxoffset = self::DEFAULT_XOFFSET; - $this->donotrenderchildsoftype = array(); - } - - public function getAllActiveOes() - { - $sql = << NOW() :: date - ) - AND ( - bf.funktion_kurzbz IS NULL - OR bf.funktion_kurzbz = 'Leitung' - ) - LEFT JOIN public.tbl_benutzer b USING(uid) - LEFT JOIN public.tbl_person p USING(person_id) - WHERE - oe.aktiv = true - AND oe.oe_kurzbz NOT IN ('betriebsrat', 'oeh', 'FUEWahl', 'atw', 'etw', 'gf20') - GROUP BY - oe.oe_kurzbz, - oe.oe_parent_kurzbz, - oe.bezeichnung, - oe.organisationseinheittyp_kurzbz - ORDER BY - oe.oe_parent_kurzbz ASC NULLS FIRST, - oe.oe_kurzbz ASC; -EOSQL; - - $result = $this->OrganisationseinheitModel->execReadOnlyQuery($sql); - $oes = getData($result); - - $errors = array(); - $assocoes = array(); - $roots = array(); - if($oes) - { - foreach($oes as &$oe) - { - $oe->parent = NULL; - $oe->childs = array(); - $oe->renderchilds = self::RENDER_CHILDS_HORIZONTAL; - $oe->childstorender = array(); - $oe->donotrenderchildsoftype = array(); - $assocoes[$oe->oe_kurzbz] = $oe; - } - - foreach($assocoes as &$assocoe) - { - if( $assocoe->oe_parent_kurzbz === NULL ) - { - $roots[$assocoe->oe_kurzbz] = $assocoe; - $assocoe->donotrenderchildsoftype = array( - 'Team', - 'Lehrgang', - 'Studiengang', - 'Kompetenzfeld', - 'Forschungsfeld', - 'Container' - ); - } - else - { - if( isset($assocoes[$assocoe->oe_parent_kurzbz]) ) - { - $assocoe->parent = $assocoes[$assocoe->oe_parent_kurzbz]; - $assocoes[$assocoe->oe_parent_kurzbz]->childs[] = $assocoe; - - if( $assocoe->organisationseinheittyp_kurzbz === 'Fakultaet' ) - { - $roots[$assocoe->oe_kurzbz] = $assocoe; - } - } - else - { - $errors[] = "ERROR: Missing parent oe " . $assocoe->oe_parent_kurzbz . "\n"; - } - } - } - - if(count($errors) === 0) { - $pages = count($roots); - $this->DrawIoLib->renderFileStart($pages); - - foreach($roots AS &$root) - { - $this->maxxoffset = self::DEFAULT_XOFFSET; - $this->donotrenderchildsoftype = $root->donotrenderchildsoftype; - $this->prepareChildsToRender($root); - $this->DrawIoLib->renderDiagramStart($root->oe_kurzbz, $root->bezeichnung); - $this->renderOE($root, 0, 0); - $this->DrawIoLib->renderDiagramEnd(); - } - $this->DrawIoLib->renderFileEnd(); - } - else - { - foreach ($errors as $error) - { - echo $error; - } - } - } - else - { - echo "Keine Oes gefunden.\n"; - } - } - - protected function prepareChildsToRender(&$oe) - { - $oe->childstorender = array(); - $oe->renderchilds = self::RENDER_CHILDS_HORIZONTAL; - if( isset($oe->childsxoffset) ) - { - unset($oe->childsxoffset); - } - - foreach($oe->childs AS &$oechild ) - { - $this->prepareChildsToRender($oechild); - if( !in_array($oechild->organisationseinheittyp_kurzbz, $this->donotrenderchildsoftype) ) - { - $oe->childstorender[] = $oechild; - } - } - - $nurLehrgaengeOderStudiengaengeOhneKinder = true; - foreach($oe->childstorender AS &$oechildtorender ) - { -/* - if( !(($oechild->organisationseinheittyp_kurzbz == 'Studiengang' - || $oechild->organisationseinheittyp_kurzbz == 'Lehrgang') - && count($oechild->childs) === 0) ) -*/ - if( !(count($oechildtorender->childstorender) === 0) ) - { - $nurLehrgaengeOderStudiengaengeOhneKinder = false; - } - } - - if( $nurLehrgaengeOderStudiengaengeOhneKinder && $oe->parent !== NULL ) - { - $oe->renderchilds = self::RENDER_CHILDS_VERTICAL; - } - } - - protected function renderOE($oe, $level, $parentrenderedchildcount) - { - $width = self::DEFAULT_WIDTH; - $height = self::DEFAULT_HEIGHT; - $spacing = self::DEFAULT_SPACING; - $fontsize = self::DEFAULT_FONTSIZE; - $nextlevel = $level + 1; - $renderedchildcount = 0; - - $curxoffset = $this->maxxoffset; - - if( count($oe->childstorender) > 0 ) - { - if( !isset($oe->childsxoffset) ) - { - $oe->childsxoffset = (object) array( - 'min' => $curxoffset, - 'max' => $curxoffset - ); - } - - foreach($oe->childstorender AS $child) - { - $ret = $this->renderOE($child, $nextlevel, $renderedchildcount); - $renderedchildcount++; - if( $renderedchildcount === 1 ) - { - $oe->childsxoffset->min = $ret->minx; - } - $oe->childsxoffset->max = $ret->maxx; - } - - if( count($oe->childstorender) === $renderedchildcount ) - { - $curxoffset = $oe->childsxoffset->min + - floor((($oe->childsxoffset->max - $oe->childsxoffset->min) / 2)) - - floor((($width + $spacing) / 2)); - } - } - - - if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL ) - { - $x = $curxoffset; - $y = self::DEFAULT_YOFFSET - + (($level - 1) * ($height + $spacing)) - + (($parentrenderedchildcount + 1) * ($height + floor($spacing / 2))); - } - else - { - $x = $curxoffset; - $y = self::DEFAULT_YOFFSET + ($level * ($height + $spacing)); - } - $bezeichnung = htmlspecialchars($oe->bezeichnung); - $leitung = ($oe->leitung_uid !== null) ? htmlspecialchars($oe->leitung_uid) : 'N.N.'; - $fillcolors = array( - 'Team' => '#ffe6cc', - 'Abteilung' => '#e6ffcc', - 'Studiengang' => '#cce6ff', - 'Lehrgang' => '#e6ccff', - 'Fakultaet' => '#f8cecc', - 'Department' => '#fff2cc', - 'Forschungsfeld' => '#e1d5e7', - 'Kompetenzfeld' => '#f5f5f5' - ); - $fillcolor = (isset($fillcolors[$oe->organisationseinheittyp_kurzbz])) ? $fillcolors[$oe->organisationseinheittyp_kurzbz] : '#ffffff'; - $value = <<organisationseinheittyp_kurzbz}]</div><b style="">{$bezeichnung}</b><div>({$leitung})</div></font>" style="whiteSpace=wrap;html=1;align=center;verticalAlign=middle;treeFolding=1;treeMoving=1;newEdgeStyle={"edgeStyle":"elbowEdgeStyle","startArrow":"none","endArrow":"none"};fillColor={$fillcolor}; -EOVAL; - - $this->DrawIoLib->renderCell($oe->oe_kurzbz, $value, $x, $y, $width, $height); - - if( $oe->oe_parent_kurzbz !== NULL ) - { - $exitX = '0.5'; - $exitY = '1'; - $entryX = '0.5'; - $entryY = '0'; - $points = array(); - if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL) - { - $exitX = '0'; - $exitY = '0.5'; - $entryX = '0'; - $entryY = '0.5'; - $points = array( - (object) array( - 'x' => ($x - floor($spacing / 2)), - 'y' => ($y + floor($height / 2)) - ) - ); - } - $this->DrawIoLib->renderEdge($oe->oe_parent_kurzbz, $oe->oe_kurzbz, $exitX, $exitY, $entryX, $entryY, $points); - } - - if( $oe->parent !== null && $oe->parent->renderchilds === self::RENDER_CHILDS_VERTICAL ) - { - if( count($oe->parent->childstorender) === ($parentrenderedchildcount + 1) ) - { - if( $this->maxxoffset < ($x + $width + $spacing) ) - { - $this->maxxoffset = ($x + $width + $spacing); - } - return (object) array( - 'minx' => $curxoffset, - 'maxx' => ($x + $width + $spacing) - ); - } - return (object) array( - 'minx' => $curxoffset, - 'maxx' => $x - ); - } - - if( $this->maxxoffset < ($x + $width + $spacing) ) - { - $this->maxxoffset = ($x + $width + $spacing); - } - - return (object) array( - 'minx' => $curxoffset, - 'maxx' => ($x + $width + $spacing) - ); - } -} diff --git a/application/libraries/DocsboxLib.php b/application/libraries/DocsboxLib.php index 8d3582c78..432afdc97 100644 --- a/application/libraries/DocsboxLib.php +++ b/application/libraries/DocsboxLib.php @@ -32,7 +32,6 @@ class DocsboxLib const STATUS_QUEUED = 'queued'; // Docsbox status when a file has been queued for the conversion const STATUS_STARTED = 'started'; // Docsbox status when a file has started being worked const STATUS_WORKING = 'working'; // Docsbox status when a file is being converted - const OUTPUT_FILENAME = 'out.zip.%s'; // File name used by docsbox to save a converted document const JSON_FORMATS = '{"formats": ["%s"]}'; // JSON object to be sent to docsbox to specify the file format const DEFAULT_FORMAT = 'pdf'; // Default supported format @@ -61,7 +60,7 @@ class DocsboxLib if ($resultUrl == null) return self::ERROR; // Download and rename the converted file - $downloaded = self::_downloadFile($resultUrl, $outputFileName, $format); + $downloaded = self::_downloadFile($inputFileName, $resultUrl, $outputFileName, $format); // If an error occurred if (!$downloaded) return self::ERROR; @@ -227,7 +226,7 @@ class DocsboxLib /** * Download the converted file using the provided URL, unzip it, and renames it into the provided file name */ - private static function _downloadFile($resultUrl, $outputFileName, $format) + private static function _downloadFile($inputFileName, $resultUrl, $outputFileName, $format) { $downloaded = false; // pessimistic assumption @@ -259,7 +258,7 @@ class DocsboxLib // Opened, extracted and closed! // Rename the extracted file to the given output file name - if (rename($outputDirectory.'/'.sprintf(self::OUTPUT_FILENAME, $format), $outputFileName)) + if (@rename($inputFileName.'.'.$format, $outputFileName)) { $downloaded = true; } @@ -267,7 +266,7 @@ class DocsboxLib { error_log( 'An error occurred while renaming the extracted file: '. - $outputDirectory.'/'.sprintf(self::OUTPUT_FILENAME, $format).' into: '. + $inputFileName.'.'.$format.' into: '. $outputFileName ); } diff --git a/application/libraries/DrawIoLib.php b/application/libraries/DrawIoLib.php deleted file mode 100644 index bafd062c2..000000000 --- a/application/libraries/DrawIoLib.php +++ /dev/null @@ -1,155 +0,0 @@ -format(DateTime::ATOM); - echo <<
- -HEADER; - - } - - public function renderFileEnd() - { - echo <<