diff --git a/application/controllers/jobs/ModulgrafikTest.php b/application/controllers/jobs/ModulgrafikTest.php new file mode 100644 index 000000000..7835e6ad3 --- /dev/null +++ b/application/controllers/jobs/ModulgrafikTest.php @@ -0,0 +1,141 @@ +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"); + } + } + + foreach($semester as $sem => $mods) + { + echo $sem . ". Semester: \n"; + foreach($mods as $mod) + { + $level = "\t"; + echo $level . $mod->bezeichnung . " (" . $mod->ects . ") " . $mod->lehrtyp_kurzbz . "\n"; + printchilds($mod->childs, $level . "\t"); + } + } + exit(); + + if(count($errors) === 0) { + $this->DrawIoLib->renderFileStart(); + + foreach($roots AS &$root) + { + $this->maxxoffset = self::DEFAULT_XOFFSET; + $this->DrawIoLib->renderDiagramStart($studienplan_id, 'Modulgrafik'); + $this->renderSemester($semster); + $this->DrawIoLib->renderDiagramEnd(); + } + $this->DrawIoLib->renderFileEnd(); + } + else + { + foreach ($errors as $error) + { + echo $error; + } + } + } + else + { + echo "Keine LVs gefunden.\n"; + } + } +} diff --git a/application/controllers/jobs/OrganigrammTest.php b/application/controllers/jobs/OrganigrammTest.php index 07244453c..89c60830f 100644 --- a/application/controllers/jobs/OrganigrammTest.php +++ b/application/controllers/jobs/OrganigrammTest.php @@ -26,6 +26,8 @@ class OrganigrammTest extends JOB_Controller $this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); + $this->load->library('DrawIoLib', null, 'DrawIoLib'); + $this->maxxoffset = self::DEFAULT_XOFFSET; $this->donotrenderchildsoftype = array(); } @@ -125,46 +127,18 @@ EOSQL; if(count($errors) === 0) { $pages = count($roots); - $modified = (new DateTime('now', new DateTimeZone('UTC')))->format(DateTime::ATOM); - $agent = 'FH-Complete'; - echo <<
- -HEADER; + $this->DrawIoLib->renderFileStart($pages); foreach($roots AS &$root) { $this->maxxoffset = self::DEFAULT_XOFFSET; $this->donotrenderchildsoftype = $root->donotrenderchildsoftype; $this->prepareChildsToRender($root); - - $bezeichnung = htmlspecialchars($root->bezeichnung); - - echo << - - - - - -STARTDIAGRAMM; - + $this->DrawIoLib->renderDiagramStart($root->oe_kurzbz, $root->bezeichnung); $this->renderOE($root, 0, 0); - - echo << - - - -ENDDIAGRAMM; - + $this->DrawIoLib->renderDiagramEnd(); } - - echo <<