diff --git a/application/controllers/jobs/ReihungstestJob.php b/application/controllers/jobs/ReihungstestJob.php new file mode 100644 index 000000000..e58595bb0 --- /dev/null +++ b/application/controllers/jobs/ReihungstestJob.php @@ -0,0 +1,193 @@ +input->is_cli_request()) + { + $cli = true; + } + else + { + $this->output->set_status_header(403, 'Jobs must be run from the CLI'); + echo "Jobs must be run from the CLI"; + exit; + } + + $this->VILESCI_RT_VERWALTUNGS_URL = site_url(). "/organisation/Reihungstest"; + + // Load models + $this->load->model('crm/Reihungstest_model', 'ReihungstestModel'); + + // Load helpers + $this->load->helper('hlp_sancho_helper'); + } + + /** + * Main function index as help + * + * @return void + */ + public function index() + { + $result = "The following are the available command line interface commands\n\n"; + $result .= "php index.ci.php jobs/ReihungstestJob runReihungstestInfo"; + + echo $result. PHP_EOL; + } + + public function runReihungstestJob() + { + // Get study plans that have no assigned placement tests yet + $result = $this->ReihungstestModel->checkMissingReihungstest(); + + $missing_rt_arr = array(); + if (hasData($result)) + { + $missing_rt_arr = $result->retval; + } + elseif (isError($result)) + { + show_error($result->error); + } + + // Get free places + $result = $this->ReihungstestModel->getFreePlaces(); + + $free_places_arr = array(); + if (hasData($result)) + { + $free_places_arr = $result->retval; + } + elseif (isError($result)) + { + show_error($result->error); + } + + // Prepare data for mail template 'ReihungstestJob' + $content_data_arr = $this->_getContentData($missing_rt_arr, $free_places_arr); + + // Send email in Sancho design + if (!empty($missing_rt_arr) || !empty($free_places_arr)) + { + sendSanchoMail( + 'ReihungstestJob', + $content_data_arr, + MAIL_INFOCENTER, + 'Support für die Reihungstest-Verwaltung'); + } + } + + // ------------------------------------------------------------------------ + // Private methods + /** + * Returns associative array with data as needed in the reihungstest job template. + * @param array $missing_rt_arr Array with studienpläne, which have no assigned placement tests. + * @param array $free_places_arr Array with info and amount of free placement test places. + * @return array + */ + private function _getContentData($missing_rt_arr, $free_places_arr) + { + $style_tbl1 = ' cellpadding="0" cellspacing="10" width="100%" style="font-family: courier, verdana, sans-serif; font-size: 0.95em; border: 1px solid #000000;" '; + $style_tbl2 = ' cellpadding="0" cellspacing="20" width="100%" style="font-family: courier, verdana, sans-serif; font-size: 0.95em; border: 1px solid #000000;" '; + + // Prepare HTML table with study plans that have no placement tests yet + if (!empty($missing_rt_arr)) + { + $studienplan_list = ' + + '; + + foreach ($missing_rt_arr as $rt) + { + $studienplan_list .= ' + '. $rt->bezeichnung. ' + '; + } + + $studienplan_list .= ' + + '; + } + else + { + $studienplan_list = ' + + Alles okay! Alle Studienpläne haben zumindest einen Reihungstest. + + '; + } + + // Prepare HTML table with information and amount of free places + if (!empty($free_places_arr)) + { + $freie_plaetze_list = ' + + + Fakultät + Reihungstesttermine + Freie Plätze + + '; + + foreach ($free_places_arr as $free_place) + { + $datum = new DateTime($free_place->datum); + $style_alarm = ($free_place->freie_plaetze <= 5) ? ' style=" color: red; font-weight: bold" ' : ''; // mark if <=5 free places + + $freie_plaetze_list .= ' + + '. $free_place->fakultaet. ' + '. $datum->format('d.m.Y'). ' + '. $free_place->freie_plaetze. ' + + '; + } + + $freie_plaetze_list .= ' + + '; + } + else + { + $freie_plaetze_list = ' + + Es gibt heute keine Ergebnisse zu freien Reihungstestplätze. + + '; + } + + // Set associative array with the prepared HTML tables and URL be used by the template's variables + $content_data_arr['studienplan_list'] = $studienplan_list; + $content_data_arr['freie_plaetze_list'] = $freie_plaetze_list; + $content_data_arr['link'] = $this->VILESCI_RT_VERWALTUNGS_URL; + ; + + return $content_data_arr; + } +} + diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index de02a3a11..f96f6ff12 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -857,9 +857,20 @@ class InfoCenter extends Auth_Controller } $this->navigationlib->setSessionMenu( - array( + array('filters' => $this->navigationlib->oneLevel( + 'Filters', // description + '#', // link + $filtersArray, // children + 'filter', // icon + true, // expand + null, // subscriptDescription + null, // subscriptLinkClass + null, // subscriptLinkValue + '', // target + 1 // sort + ), 'freigegeben' => $this->navigationlib->oneLevel( - 'zum RT Freigegeben', // description + 'zum RT freigegeben', // description $freigegebenLink, // link null, // children 'thumbs-up', // icon @@ -868,7 +879,7 @@ class InfoCenter extends Auth_Controller null, // subscriptLinkClass null, // subscriptLinkValue '', // target - 1 // sort + 10 // sort ), 'reihungstestAbsolviert' => $this->navigationlib->oneLevel( 'Reihungstest absolviert', // description @@ -880,19 +891,7 @@ class InfoCenter extends Auth_Controller null, // subscriptLinkClass null, // subscriptLinkValue '', // target - 2 // sort - ), - 'filters' => $this->navigationlib->oneLevel( - 'Filters', // description - '#', // link - $filtersArray, // children - '', // icon - true, // expand - null, // subscriptDescription - null, // subscriptLinkClass - null, // subscriptLinkValue - '', // target - 10 // sort + 20 // sort ) ) ); @@ -951,6 +950,8 @@ class InfoCenter extends Auth_Controller // Generate the home link with the eventually loaded filter $homeLink = site_url(self::INFOCENTER_URI.'/'.self::INDEX_PAGE); + $freigegebenLink = site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE); + $absolviertLink = site_url(self::INFOCENTER_URI.'/'.self::REIHUNGSTESTABSOLVIERT_PAGE); $prevFilterId = $this->input->get(self::PREV_FILTER_ID); if (isset($prevFilterId)) { @@ -958,20 +959,57 @@ class InfoCenter extends Auth_Controller } $this->navigationlib->setElementSessionMenu( - $page, + 'uebersicht', $this->navigationlib->oneLevel( - 'Home', // description + 'Infocenter Übersicht', // description $homeLink, // link null, // children - 'angle-left', // icon + 'info', // icon null, // subscriptDescription false, // expand null, // subscriptLinkClass null, // subscriptLinkValue '', // target - 1 // sort + 20 // sort ) ); + + if($page == self::REIHUNGSTESTABSOLVIERT_PAGE) + { + $this->navigationlib->setElementSessionMenu( + 'freigegeben', + $this->navigationlib->oneLevel( + 'zum RT freigegeben', // description + $freigegebenLink, // link + null, // children + 'thumbs-up', // icon + null, // subscriptDescription + false, // expand + null, // subscriptLinkClass + null, // subscriptLinkValue + '', // target + 30 // sort + ) + ); + } + if($page == self::FREIGEGEBEN_PAGE) + { + $this->navigationlib->setElementSessionMenu( + 'reihungstestAbsolviert', + $this->navigationlib->oneLevel( + 'Reihungstest absolviert', // description + $absolviertLink, // link + null, // children + 'check', // icon + null, // subscriptDescription + false, // expand + null, // subscriptLinkClass + null, // subscriptLinkValue + '', // target + 30 // sort + ) + ); + } } /** @@ -993,25 +1031,6 @@ class InfoCenter extends Auth_Controller } } - /** - * Utility method used to fill elements of the InfoCenter left menu of the freigegeben InfoCenter page - */ - private function _fillFiltersFreigegeben($filters, &$toFill) - { - foreach ($filters as $filterId => $description) - { - $toFill['children'][] = $this->navigationlib->oneLevel( - $description, // description - sprintf( - '%s?%s=%s', - site_url(self::INFOCENTER_URI.'/'.self::FREIGEGEBEN_PAGE), - self::FILTER_ID, - $filterId - ) // link - ); - } - } - /** * Utility method used to fill elements of the InfoCenter left menu * with the list of the custom filter of the authenticated user diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index f063365ec..97d37a120 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -23,7 +23,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); // Functions needed in the view FHC-Header // ------------------------------------------------------------------------ -const DEFAULT_SANCHO_HEADER_IMG = 'sancho_header_du_hast_neue_nachrichten.jpg'; +const DEFAULT_SANCHO_HEADER_IMG = 'sancho_header_DEFAULT.jpg'; /** * Send single Mail with Sancho Design and Layout. diff --git a/application/libraries/FiltersLib.php b/application/libraries/FiltersLib.php index 0875716d1..1e3a591ac 100644 --- a/application/libraries/FiltersLib.php +++ b/application/libraries/FiltersLib.php @@ -757,7 +757,7 @@ class FiltersLib self::NAV_MENU_FILTER_NAME, // description '#', // link $childrenArray, // children - '', // icon + 'filter', // icon true, // expand null, // subscriptDescription null, // subscriptLinkClass diff --git a/application/models/crm/Reihungstest_model.php b/application/models/crm/Reihungstest_model.php index a8d048463..9614c2e38 100644 --- a/application/models/crm/Reihungstest_model.php +++ b/application/models/crm/Reihungstest_model.php @@ -38,4 +38,190 @@ class Reihungstest_model extends DB_Model return $this->execQuery($query, array($reihungstest_id)); } + + /** + * Checks if there are active studyplans which have no public placement tests assigned yet. + * Only check assignment to studyplans that are + * - Bachelor, + * - active, + * - set as online application + * - valid for 1st terms + * @return array Returns object array with studyplans that have no public placement tests assigned yet. + */ + public function checkMissingReihungstest() + { + $query = ' + SELECT + bezeichnung + FROM + lehre.tbl_studienplan + WHERE + studienplan_id + IN + ( + SELECT DISTINCT + studienplan_id + FROM + public.tbl_studiensemester + JOIN + lehre.tbl_studienplan_semester + USING (studiensemester_kurzbz) + JOIN + lehre.tbl_studienplan + USING (studienplan_id) + JOIN + lehre.tbl_studienordnung + USING (studienordnung_id) + JOIN + public.tbl_studiengang + USING (studiengang_kz) + WHERE + tbl_studiengang.aktiv = \'t\' + AND + tbl_studiensemester.onlinebewerbung = \'t\' + AND + tbl_studienplan.onlinebewerbung_studienplan = \'t\' + AND + semester = 1 + AND + typ = \'b\' + + EXCEPT + + SELECT DISTINCT + studienplan_id + FROM + public.tbl_reihungstest + JOIN + public.tbl_rt_studienplan + USING (reihungstest_id) + WHERE + datum >= now() + AND + oeffentlich = \'t\' + ) + '; + + return $this->execQuery($query); + } + + /** + * Gets amount of free places. + * @return array Returns object array with faculty and amount of free places + * for each public actual placement test date. + */ + public function getFreePlaces() + { + $query = ' + SELECT + datum, + fakultaet, + max_plaetze - anzahl_angemeldet AS freie_plaetze + FROM + ( + SELECT + studiengang_kz, + oeffentlich, + tbl_studiengang.bezeichnung, + reihungstest_id, + tbl_reihungstest.datum, + COALESCE + ( + max_teilnehmer, + ( + SELECT + sum(arbeitsplaetze) - ceil(sum(arbeitsplaetze)/100.0*'. REIHUNGSTEST_ARBEITSPLAETZE_SCHWUND. ') + FROM + public.tbl_rt_ort + JOIN + public.tbl_ort + ON (tbl_rt_ort.ort_kurzbz = tbl_ort.ort_kurzbz) + WHERE + tbl_rt_ort.rt_id = tbl_reihungstest.reihungstest_id + ) + ) + AS max_plaetze, + ( + SELECT + count(*) + FROM + public.tbl_rt_person + WHERE + rt_id = tbl_reihungstest.reihungstest_id + ) + AS anzahl_angemeldet, + ( + WITH RECURSIVE meine_oes + ( + oe_kurzbz, + oe_parent_kurzbz, + organisationseinheittyp_kurzbz + ) + AS + ( + SELECT + oe_kurzbz, oe_parent_kurzbz, organisationseinheittyp_kurzbz + FROM + public.tbl_organisationseinheit + WHERE + oe_kurzbz in + ( + SELECT + oe_kurzbz + FROM + public.tbl_rt_studienplan + JOIN + lehre.tbl_studienplan sp USING (studienplan_id) + JOIN + lehre.tbl_studienordnung USING (studienordnung_id) + JOIN + public.tbl_studiengang sg USING (studiengang_kz) + WHERE + tbl_rt_studienplan.reihungstest_id = tbl_reihungstest.reihungstest_id + ) + AND + aktiv = true + + UNION ALL + + SELECT + o.oe_kurzbz, o.oe_parent_kurzbz, o.organisationseinheittyp_kurzbz + FROM + public.tbl_organisationseinheit o, meine_oes + WHERE + o.oe_kurzbz = meine_oes.oe_parent_kurzbz + AND + aktiv = true + ) + SELECT + ARRAY_TO_STRING(ARRAY_AGG(DISTINCT tbl_organisationseinheit.bezeichnung),\', \') + FROM + meine_oes + JOIN public.tbl_organisationseinheit USING(oe_kurzbz) + WHERE + meine_oes.organisationseinheittyp_kurzbz=\'Fakultaet\' + ) + AS fakultaet + FROM + public.tbl_reihungstest + JOIN + public.tbl_studiengang + USING (studiengang_kz) + WHERE + tbl_reihungstest.datum >= now() + AND + tbl_reihungstest.oeffentlich = \'t\' + GROUP BY + tbl_studiengang.bezeichnung, + oe_kurzbz, + reihungstest_id + ) + AS tbl + ORDER BY + fakultaet, + freie_plaetze + '; + + return $this->execQuery($query); + } } \ No newline at end of file diff --git a/application/views/system/infocenter/infocenterFreigegeben.php b/application/views/system/infocenter/infocenterFreigegeben.php index eee68d69d..96fd3349b 100755 --- a/application/views/system/infocenter/infocenterFreigegeben.php +++ b/application/views/system/infocenter/infocenterFreigegeben.php @@ -33,7 +33,7 @@
diff --git a/ci_loader.php b/ci_loader.php deleted file mode 100644 index 7466739a9..000000000 --- a/ci_loader.php +++ /dev/null @@ -1,11 +0,0 @@ -load->library('xxx'); - */ -ob_start(); -require_once('index.ci.php'); -ob_get_clean(); -return $CI; diff --git a/config/vilesci.config-default.inc.php b/config/vilesci.config-default.inc.php index 7cfff8938..eedefc2df 100644 --- a/config/vilesci.config-default.inc.php +++ b/config/vilesci.config-default.inc.php @@ -141,6 +141,8 @@ define('MAIL_IT', 'invalid@example.com'); define('MAIL_SUPPORT', 'invalid@example.com'); // Lehrgaenge define('MAIL_LG', 'invalid@example.com'); +// Infocenter +define('MAIL_INFOCENTER','invalid@example.com'); // Default Anmerkung fuer neue Lehreinheiten // Beispiel: 'Abhaengigkeiten von anderen LV\'s\n\nSpez. Software/Equipment:\n\n' diff --git a/content/functions.js.php b/content/functions.js.php index 3789e505b..55eed5414 100644 --- a/content/functions.js.php +++ b/content/functions.js.php @@ -169,6 +169,28 @@ function ConvertDateToISO(datum) return ''; } +// **** +// * Wandelt ein Datum ins ISO Format um +// * aus 2007-02-31 wird 31.2.2007 +// **** +function ConvertDateToGerman(datum) +{ + if(datum!='') + { + arr = datum.split('-'); + + if(arr[1].length==1) + arr[1]='0'+arr[1]; + + if(arr[2].length==1) + arr[2]='0'+arr[2]; + + return arr[2]+'.'+arr[1]+'.'+arr[0]; + } + else + return ''; +} + // **** // * Liefert die Daten aus der Zwischenablage // **** @@ -281,7 +303,7 @@ function getMultipleTreeCellText(tree, col) returnArray.push(getTreeCellText(tree, col, v)); } } - + return returnArray; } @@ -295,18 +317,18 @@ function openWindowPostArray(action, dataName, data) { var FORM_HEAD = "
\n"; var FORM_FOOT = "
"; - + var inputsHidden = ""; - + for (var i = 0; i < data.length; i++) { inputsHidden += " \n"; } - + var newwindow = window.open("", "FAS"); newwindow.document.getElementsByTagName('body')[0].innerHTML = FORM_HEAD + inputsHidden + FORM_FOOT; newwindow.document.getElementById('postform-form').action = action; - + newwindow.document.postfrm.submit(); } diff --git a/content/student/interessentdokumentedialog.js.php b/content/student/interessentdokumentedialog.js.php index b5b344c84..8e24ac790 100644 --- a/content/student/interessentdokumentedialog.js.php +++ b/content/student/interessentdokumentedialog.js.php @@ -31,29 +31,30 @@ var glob_akte_id; function InteressentDokumenteDialogInit(prestudent_id, akte_id) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - + if(akte_id!='') - { + { glob_prestudent_id = prestudent_id; glob_akte_id = akte_id; //Daten holen var url = 'rdf/akte.rdf.php?akte_id='+akte_id+'&'+gettimestamp(); - + var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"]. getService(Components.interfaces.nsIRDFService); - + var dsource = rdfService.GetDataSourceBlocking(url); - + var subject = rdfService.GetResource("http://www.technikum-wien.at/akte/" + akte_id); - + var predicateNS = "http://www.technikum-wien.at/akte/rdf"; - - //RDF parsen + + //RDF parsen var titel_intern = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#titel_intern" )); var anmerkung_intern = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#anmerkung_intern" )); var anmerkung = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#anmerkung" )); var nachgereicht = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#nachgereicht" )); + var nachgereicht_am = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#nachgereicht_am" )); var dokument_kurzbz = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#dokument_kurzbz" )); var dokument_bezeichnung = getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#dokument_bezeichnung" )); } @@ -67,7 +68,7 @@ function InteressentDokumenteDialogInit(prestudent_id, akte_id) menuentry.setAttribute("label",dokument_bezeichnung); dokumentemenue.appendChild(menuentry); } - + document.getElementById('interessent-dokumente-dialog-textbox-titel').value=titel_intern; document.getElementById('interessent-dokumente-dialog-textbox-anmerkung').value=anmerkung_intern; @@ -78,6 +79,8 @@ function InteressentDokumenteDialogInit(prestudent_id, akte_id) document.getElementById('interessent-dokumente-dialog-label-nachgereicht').value='Dokument wird nachgereicht'; else document.getElementById('interessent-dokumente-dialog-label-nachgereicht').value=''; + + document.getElementById('interessent-dokumente-dialog-textbox-nachgereicht_am').value=ConvertDateToGerman(nachgereicht_am); } // **** diff --git a/content/student/interessentdokumentedialog.xul.php b/content/student/interessentdokumentedialog.xul.php index dfa81107d..2f33f3c67 100644 --- a/content/student/interessentdokumentedialog.xul.php +++ b/content/student/interessentdokumentedialog.xul.php @@ -100,6 +100,12 @@ $db = new basis_db(); +