static function GetSemesterIndexById($semester_id) { $index = false; foreach (SemesterData::getAllSemesterData() as $i => $sem) { if ($sem['semester_id'] == $semester_id) { $index = $i + 1; } } return $index; }
/** * this action is the main action of the schedule-controller, setting the environment for the timetable, * accepting a comma-separated list of days. * * @param string a list of an arbitrary mix of the numbers 0-6, separated with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default)) */ function index_action($days = false) { if ($GLOBALS['perm']->have_perm('admin')) { $inst_mode = true; } $my_schedule_settings = $GLOBALS['user']->cfg->SCHEDULE_SETTINGS; // set the days to be displayed if ($days === false) { if (Request::getArray('days')) { $this->days = array_keys(Request::getArray('days')); } else { $this->days = array(0, 1, 2, 3, 4, 5, 6); } } else { $this->days = explode(',', $days); } // try to find the correct institute-id $institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false)); if (!$institute_id) { $institute_id = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT; } if (!$institute_id || in_array(get_object_type($institute_id), words('inst fak')) === false) { throw new Exception(sprintf(_('Kann Einrichtungskalendar nicht anzeigen!' . 'Es wurde eine ungültige Instituts-Id übergeben (%s)!', $institute_id))); } // load semester-data and current semester $semdata = new SemesterData(); $this->semesters = $semdata->getAllSemesterData(); if (Request::option('semester_id')) { $this->current_semester = $semdata->getSemesterData(Request::option('semester_id')); } else { $this->current_semester = $semdata->getCurrentSemesterData(); } $this->entries = (array) CalendarInstscheduleModel::getInstituteEntries($GLOBALS['user']->id, $this->current_semester, 8, 20, $institute_id, $this->days); Navigation::activateItem('/course/main/schedule'); PageLayout::setHelpKeyword('Basis.TerminkalenderStundenplan'); PageLayout::setTitle($GLOBALS['SessSemName']['header_line'] . ' - ' . _('Veranstaltungs-Stundenplan')); $zoom = Request::int('zoom', 0); $this->controller = $this; $this->calendar_view = new CalendarWeekView($this->entries, 'instschedule'); $this->calendar_view->setHeight(40 + 20 * $zoom); $this->calendar_view->setRange($my_schedule_settings['glb_start_time'], $my_schedule_settings['glb_end_time']); $this->calendar_view->groupEntries(); // if enabled, group entries with same start- and end-date URLHelper::addLinkParam('zoom', $zoom); URLHelper::addLinkParam('semester_id', $this->current_semester['semester_id']); $style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight()); $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views'); PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters)); if (Request::option('printview')) { PageLayout::addStylesheet('print.css'); } else { PageLayout::addStylesheet('print.css', array('media' => 'print')); } }
function ExternSemBrowseTemplate (&$module, $start_item_id) { global $SEM_TYPE,$SEM_CLASS; $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); array_unshift($all_semester, 0); $this->group_by_fields = array( array('name' => _("Semester"), 'group_field' => 'sem_number'), array('name' => _("Bereich"), 'group_field' => 'bereich'), array('name' => _("Lehrende"), 'group_field' => 'fullname', 'unique_field' => 'username'), array('name' => _("Typ"), 'group_field' => 'status'), array('name' => _("Einrichtung"), 'group_field' => 'Institut', 'unique_field' => 'Institut_id')); $this->module = $module; $this->sem_browse_data["group_by"] = $this->module->config->getValue("Main", "grouping"); $this->sem_dates = $all_semester; $this->sem_dates[0] = array("name" => sprintf(_("vor dem %s"),$this->sem_dates[1]['name'])); // reorganize the $SEM_TYPE-array foreach ($SEM_CLASS as $key_class => $class) { $i = 0; foreach ($SEM_TYPE as $key_type => $type) { if ($type["class"] == $key_class) { $i++; $this->sem_types_position[$key_type] = $i; } } } $switch_time = mktime(0, 0, 0, date("m"), date("d") + 7 * $this->module->config->getValue("Main", "semswitch"), date("Y")); // get current semester $current_sem = get_sem_num($switch_time) + 1; switch ($this->module->config->getValue("Main", "semstart")) { case "previous" : if (isset($all_semester[$current_sem - 1])) { $current_sem--; } break; case "next" : if (isset($all_semester[$current_sem + 1])) { $current_sem++; } break; case "current" : break; default : if (isset($all_semester[$this->module->config->getValue('Main', 'semstart')])) { $current_sem = $this->module->config->getValue('Main', 'semstart'); } } $last_sem = $current_sem + $this->module->config->getValue('Main', 'semrange'); if ($last_sem < $current_sem) $last_sem = $current_sem; if (!isset($all_semester[$last_sem])) $last_sem = sizeof($all_semester); for (;$last_sem > $current_sem; $last_sem--) $this->sem_number[] = $last_sem - 1; $semclasses = $this->module->config->getValue('Main', 'semclasses'); foreach ($SEM_TYPE as $key => $type) { if (in_array($type['class'], (array) $semclasses)) $this->sem_browse_data['sem_status'][] = $key; } $this->get_sem_range_tree($start_item_id, true); }
/** * Returns the name of the semester for the id found in the given * field or the id if the seminar is unknown. * * @param string $field The name of the table field. * @return string The name of semester or the id. */ protected function formatSemester($field) { $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); foreach ($all_semester as $val) { if ($val['beginn'] == $this->{$field}) { return '<em>' . $val['name'] . '</em>'; } } return $this->{$field}; }
global $SEM_TYPE, $SEM_CLASS; // reorganize the $SEM_TYPE-array foreach ($SEM_CLASS as $key_class => $class) { $i = 0; foreach ($SEM_TYPE as $key_type => $type) { if ($type["class"] == $key_class) { $i++; $sem_types_position[$key_type] = $i; } } } // get semester data $semester = new SemesterData(); $semester_data = $semester->getAllSemesterData(); // current semester $now = time(); foreach ($semester_data as $key => $sem) { if ($sem["beginn"] >= $now) break; } $i = 1; $data_group[] = 1; $data_group[] = 1; $data_group[] = 2; $data_sem[0]["Name"] = sprintf(_("Name der Veranstaltung %s"), $i++); $data_sem[0]["Untertitel"] = sprintf(_("Untertitel der Veranstaltung %s"), $i); $data_sem[1]["Name"] = sprintf(_("Name der Veranstaltung %s"), $i++); $data_sem[1]["Untertitel"] = sprintf(_("Untertitel der Veranstaltung %s"), $i); $data_sem[2]["Name"] = sprintf(_("Name der Veranstaltung %s"), $i);
function getContent($args = null, $raw = false) { global $SEM_TYPE, $SEM_CLASS; $this->group_by_fields = array(array('name' => _("Semester"), 'group_field' => 'sem_number'), array('name' => _("Bereich"), 'group_field' => 'bereich'), array('name' => _("Lehrende"), 'group_field' => 'fullname', 'unique_field' => 'username'), array('name' => _("Typ"), 'group_field' => 'status'), array('name' => _("Einrichtung"), 'group_field' => 'Institut', 'unique_field' => 'Institut_id')); // initialise data $this->sem_browse_data = array('start_item_id' => $this->getRootStartItemId(), 'do_search' => '0', 'type' => 'all', 'sem' => 'all', 'withkids' => '0', 'show_result' => '0'); // Daten aus config übernehmen $this->sem_browse_data['group_by'] = $this->config->getValue('Main', 'grouping'); $level_change = $args['start_item_id']; $this->search_obj = new StudipSemSearchHelper(null, true); $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); array_unshift($all_semester, 0); $switch_time = mktime(0, 0, 0, date('m'), date('d') + 7 * $this->config->getValue('Main', 'semswitch'), date('Y')); // get current semester $current_sem = get_sem_num($switch_time) + 1; switch ($this->config->getValue('Main', 'semstart')) { case 'previous': if (isset($all_semester[$current_sem - 1])) { $current_sem--; } break; case 'next': if (isset($all_semester[$current_sem + 1])) { $current_sem++; } break; case 'current': break; default: if (isset($all_semester[$this->config->getValue('Main', 'semstart')])) { $current_sem = $this->config->getValue('Main', 'semstart'); } } $this->sem_number = array($current_sem); $this->sem_browse_data['sem'] = $current_sem; $sem_classes = (array) $this->config->getValue('Main', 'semclasses'); $sem_types_order = (array) $this->config->getValue('ReplaceTextSemType', 'order'); $sem_types_visbility = (array) $this->config->getValue('ReplaceTextSemType', 'visibility'); foreach ($sem_types_order as $type_id) { if ($sem_types_visbility[$type_id] && in_array($GLOBALS['SEM_TYPE'][$type_id]['class'], $sem_classes)) { $this->sem_browse_data['sem_status'][] = $type_id; } } $this->module_params = $this->getModuleParams($this->approved_params); if (!$this->module_params['reset_search']) { $this->sem_browse_data = array_merge($this->sem_browse_data, $this->module_params); } $sem_status = is_array($this->sem_browse_data['sem_status']) ? $this->sem_browse_data['sem_status'] : false; $params = $this->sem_browse_data; // delete array of semester data from the search object's parameters $params['sem_status'] = false; if ($this->config->getValue('Main', 'mode') == 'show_sem_range') { $params['scope_choose'] = $this->sem_browse_data['start_item_id']; } else { $params['range_choose'] = $this->sem_browse_data['start_item_id']; } if ($this->sem_browse_data['sem'] == 'all') { $this->sem_number = array_keys($all_semester); } else { if (isset($this->sem_browse_data['sem'])) { $this->sem_number = array((int) $this->sem_browse_data['sem']); } } // set params for search object $this->search_obj->setParams($params, true); if ($this->sem_browse_data['do_search'] == 1) { $this->search_obj->doSearch(); $search_result = $this->search_obj->getSearchResultAsArray(); if (count($search_result)) { $this->sem_browse_data['search_result'] = array_flip($search_result); } else { $this->sem_browse_data['search_result'] = array(); } $this->sem_browse_data['show_result'] = '1'; $this->sem_browse_data['show_entries'] = false; } else { if ($this->config->getValue('Main', 'mode') == 'show_sem_range') { $this->get_sem_range($this->sem_browse_data['start_item_id'], $this->sem_browse_data['withkids'] == 1); } else { //($this->config->getValue('Main', 'mode') == 'show_sem_range_tree') { $this->get_sem_range_tree($this->sem_browse_data['start_item_id'], $this->sem_browse_data['withkids'] == 1); } } $this->sem_dates = $all_semester; $this->sem_dates[0] = array('name' => sprintf(_("vor dem %s"), $this->sem_dates[1]['name'])); // reorganize the $SEM_TYPE-array foreach ($GLOBALS['SEM_CLASS'] as $key_class => $class) { $i = 0; foreach ($GLOBALS['SEM_TYPE'] as $key_type => $type) { if ($type['class'] == $key_class) { $i++; $this->sem_types_position[$key_type] = $i; } } } if ($this->sem_browse_data['xls_export']) { $tmp_file = basename($this->createResultXls()); if ($tmp_file) { ob_end_clean(); header('Location: ' . getDownloadLink($tmp_file, _("ErgebnisVeranstaltungssuche.xls"), 4)); page_close(); die; } } $this->global_markers['URL_SEARCH_PARAMS'] = ''; $search_params = $this->module_params; $param_key = 'ext_' . strtolower($this->name); foreach ($search_params as $key => $value) { $this->global_markers['URL_SEARCH_PARAMS'] .= "&{$param_key}[{$key}]=" . urlencode($value); } $this->global_markers['URL_PERSONDETAILS'] = $this->getLinkToModule('LinkInternPersondetails'); $this->global_markers['URL_LECTUREDETAILS'] = $this->getLinkToModule('LinkInternLecturedetails'); $this->global_markers['URL_LEVEL_NO_COURSES'] = $this->getLinkToModule('LinkInternTree'); $this->global_markers['URL_LEVEL_COURSES'] = $this->getLinkToModule('LinkInternShowCourses'); $this->global_markers['CURRENT_SEMESTER'] = ExternModule::ExtHtmlReady($all_semester[$this->sem_number[0]]['name']); if (trim($this->config->getValue('TemplateSimpleSearch', 'template'))) { $content['SEM_BROWSER']['SIMPLE_SEARCH'] = $this->elements['TemplateSimpleSearch']->toString(array('content' => $this->getContentSimpleSearch(), 'subpart' => 'SIMPLE_SEARCH')); } if (trim($this->config->getValue('TemplateExtendedSearch', 'template'))) { $content['SEM_BROWSER']['EXTENDED_SEARCH'] = $this->elements['TemplateExtendedSearch']->toString(array('content' => $this->getContentExtendedSearch(), 'subpart' => 'EXTENDED_SEARCH')); } if (trim($this->config->getValue('TemplateTree', 'template'))) { $content['SEM_BROWSER']['TREE'] = $this->elements['TemplateTree']->toString(array('content' => $this->getContentTree(), 'subpart' => 'TREE')); } if (trim($this->config->getValue('TemplateResult', 'template')) && $this->sem_browse_data['show_result'] == '1') { $content['SEM_BROWSER']['RESULT'] = $this->elements['TemplateResult']->toString(array('content' => $this->getContentResult(), 'subpart' => 'RESULT')); } // set super global markers $content['__GLOBAL__'] = $this->global_markers; return $content; }
function showRequestList() { global $_fullname_sql, $CANONICAL_RELATIVE_PATH_STUDIP; $license_to_kill = (get_config('RESOURCES_ALLOW_DELETE_REQUESTS') && getGlobalPerms($GLOBALS['user']->id) == 'admin'); if ($license_to_kill){ echo chr(10) . '<script type="text/javascript">'; echo chr(10) . ' function auswahl_umkehr(){ my_elements = document.forms[\'list_requests_form\'].elements[\'requests_marked_to_kill[]\']; if(!my_elements.length){ if(my_elements.checked) my_elements.checked = false; else my_elements.checked = true; } else { for(i = 0; i < my_elements.length; ++i){ if(my_elements[i].checked) my_elements[i].checked = false; else my_elements[i].checked = true; } } }'; echo chr(10) . '</script>'; echo chr(10) . '<form name="list_requests_form" method="post" action="'.URLHelper::getLink().'">'; echo CSRFProtection::tokenTag(); ?> <div align="right" style="padding-right: 5px"> <?php echo LinkButton::create(_('Auswahl umkehren'), 'javascript:auswahl_umkehr();'); ?> <?php echo Button::create('Löschen', 'do_delete_requests', array(title => _('Ausgewählte Anfragen löschen'))); ?> </div> <br> <? } $i = 0; $zt = new ZebraTable(array('width' => '99%', 'padding' => '1', 'align' => 'center')); $zt->switchClass(); echo $zt->openRow(); echo $zt->cell(" ", array("class" => "content_seperator")); echo $zt->cell("<font size=\"-1\"><b>" . _("Zähler") . "</b></font>", array("class" => "content_seperator", 'colspan' => '3')); echo $zt->cell("<font size=\"-1\"><b>" . _("V.-Nummer") . "</b></font>", array("class" => "content_seperator")); echo $zt->cell("<font size=\"-1\"><b>" . _("Titel") . "</b></font>", array("class" => "content_seperator")); echo $zt->cell("<font size=\"-1\"><b>" . _("Dozenten") . "</b></font>", array("class" => "content_seperator")); echo $zt->cell("<font size=\"-1\"><b>" . _("Anfrager") . "</b></font>", array("class" => "content_seperator")); echo $zt->cell("<font size=\"-1\"><b>" . _("Start-Semester") . "<b></font>", array("class" => "content_seperator")); if ($license_to_kill){ echo $zt->cell("<font size=\"-1\"><b>" . _("löschen") . "<b></font>", array("class" => "content_seperator", 'width' => '5%')); } echo $zt->closeRow(); ?> <? foreach ($_SESSION['resources_data']['requests_working_on'] as $key => $val) { $i++; if ($_SESSION['resources_data']['requests_open'][$val['request_id']] || !$_SESSION['resources_data']['skip_closed_requests']) { $reqObj = new RoomRequest($val['request_id']); $semObj = new Seminar($reqObj->getSeminarId()); if ($semObj->getName() != "") { echo $zt->openRow(); //echo "<font size=\"-1\">"; echo $zt->cell(" "); echo $zt->cell("<font size=\"-1\">$i.</font>"); echo $zt->cell("<a href=\"resources.php?view=edit_request&edit=".$val['request_id']."\">".Icon::create('edit', 'clickable', ['title' => _("Anfrage bearbeiten")])->asImg()."</a>"); echo $zt->cell((($_SESSION['resources_data']['requests_open'][$val['request_id']]) ? '' : Icon::create('accept', 'accept')->asImg())."</font>"); echo $zt->cell("<font size=\"-1\">".htmlReady($semObj->seminar_number)."</font>"); echo $zt->cell("<font size=\"-1\"><a href=\"dispatch.php/course/details/?sem_id=".$semObj->getId()."&send_from_search=true&send_from_search_page=".urlencode($CANONICAL_RELATIVE_PATH_STUDIP."resources.php?view=list_requests")."\">".my_substr(htmlReady($semObj->getName()),0,50)."</a><br></font>"); echo $zt->openCell(); echo "<font size=\"-1\">"; $k = false; foreach ($semObj->getMembers('dozent') as $doz) { if ($k) echo ", "; echo "<a href=\"dispatch.php/profile?username={$doz['username']}\">".HtmlReady($doz['fullname'])."</a>"; $k = true; } echo "</font>"; $this->selectSemInstituteNames($semObj->getInstitutId()); if (!$this->all_semester) { $semester = new SemesterData(); $this->all_semester = $semester->getAllSemesterData(); } foreach ($this->all_semester as $one_sem) { if ($one_sem['beginn'] == $semObj->semester_start_time) { $cursem = $one_sem['name']; } } echo $zt->closeCell(); echo $zt->cell("<font size=\"-1\"><a href=\"dispatch.php/profile?username="******"\">".get_fullname($reqObj->user_id)."</a></font>"); echo $zt->cell("<font size=\"-1\">$cursem</font>"); if ($license_to_kill){ echo $zt->cell("<font size=\"-1\"><input type=\"checkbox\" name=\"requests_marked_to_kill[]\" value=\"{$val['request_id']}\"></font>", array('align' => 'center')); } echo $zt->closeRow(); } } } echo $zt->close(); if ($license_to_kill){ echo chr(10) . '</form>'; } }
/** * */ function toStringEdit ($post_vars = "", $faulty_values = "", $edit_form = "", $anker = "") { // get semester data $semester = new SemesterData(); $semester_data = $semester->getAllSemesterData(); update_generic_datafields($this->config, $this->data_fields, $this->field_names, "sem"); $out = ""; $table = ""; if ($edit_form == "") $edit_form = new ExternEditModule($this->config, $post_vars, $faulty_values, $anker); $edit_form->setElementName($this->getName()); $element_headline = $edit_form->editElementHeadline($this->real_name, $this->config->getName(), $this->config->getId(), TRUE, $anker); $headline = $edit_form->editHeadline(_("Name der Konfiguration")); $table = $edit_form->editName("name"); $content_table = $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $content_table .= $this->getSRIFormContent($edit_form); $headline = $edit_form->editHeadline(_("Allgemeine Angaben zum Tabellenaufbau")); $edit_function = $this->edit_function; $table = $edit_form->$edit_function($this->field_names, array(), array("sort")); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Allgemeine Angaben Seitenaufbau")); $title = _("Gruppierung:"); $info = _("Wählen Sie, wie die Veranstaltungen gruppiert werden sollen."); $values = array("0", "1", "2", "3", "4"); $names = array(_("Semester"), _("Bereich"), _("Lehrende"), _("Typ"), _("Einrichtung")); $table = $edit_form->editOptionGeneric("grouping", $title, $info, $values, $names); $title = _("Startsemester:"); $info = _("Geben Sie das erste anzuzeigende Semester an. Die Angaben \"vorheriges\", \"aktuelles\" und \"nächstes\" beziehen sich immer auf das laufende Semester und werden automatisch angepasst."); $current_sem = get_sem_num_sem_browse(); if ($current_sem === FALSE) { $names = array(_("keine Auswahl"), _("aktuelles"), _("nächstes")); $values = array("", "current", "next"); } else if ($current_sem === TRUE) { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles")); $values = array("", "previous", "current"); } else { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles"), "nächstes"); $values = array("", "previous", "current", "next"); } foreach ($semester_data as $sem_num => $sem) { $names[] = $sem["name"]; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric("semstart", $title, $info, $values, $names); $title = _("Anzahl der anzuzeigenden Semester:"); $info = _("Geben Sie an, wieviele Semester (ab o.a. Startsemester) angezeigt werden sollen."); $names = array(_("keine Auswahl")); $values = array(""); $i = 1; foreach ($semester_data as $sem_num => $sem) { $names[] = $i++; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric("semrange", $title, $info, $values, $names); $title = _("Umschalten des aktuellen Semesters:"); $info = _("Geben Sie an, wieviele Wochen vor Semesterende automatisch auf das nächste Semester umgeschaltet werden soll."); $names = array(_("keine Auswahl"), _("am Semesterende"), _("1 Woche vor Semesterende")); for ($i = 2; $i < 13; $i++) $names[] = sprintf(_("%s Wochen vor Semesterende"), $i); $values = array("", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); $table .= $edit_form->editOptionGeneric("semswitch", $title, $info, $values, $names); $title = _("Veranstaltungen beteiligter Institute anzeigen:"); $info = _("Wählen Sie diese Option, um Veranstaltungen anzuzeigen, bei denen diese Einrichtung als beteiligtes Institut eingetragen ist."); $values = "1"; $names = ""; $table .= $edit_form->editCheckboxGeneric("allseminars", $title, $info, $values, $names); $title = _("Bereichspfad ab Ebene:"); $info = _("Wählen Sie, ab welcher Ebene der Bereichspfad ausgegeben werden soll."); $values = array("1", "2", "3", "4", "5"); $names = array("1", "2", "3", "4", "5"); $table .= $edit_form->editOptionGeneric("rangepathlevel", $title, $info, $values, $names); $title = _("Anzahl Veranstaltungen/Gruppierung anzeigen:"); $info = _("Wählen Sie diese Option, wenn die Anzahl der Veranstaltungen und die gewählte Gruppierungsart angezeigt werden sollen."); $values = "1"; $names = ""; $table .= $edit_form->editCheckboxGeneric("addinfo", $title, $info, $values, $names); $title = _("Spaltenüberschriften<br>wiederholen:"); $info = _("Wiederholung der Spaltenberschriften ber oder unter der Gruppierungszeile."); $values = array("above", "beneath", ""); $names = array(_("über"), _("unter Gruppierungszeile"), _("keine")); $table .= $edit_form->editRadioGeneric("repeatheadrow", $title, $info, $values, $names); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Ausgabe bestimmter Veranstaltungsklassen")); $table = ""; unset($names); unset($values); $info = _("Wählen Sie die anzuzeigenden Veranstaltungsklassen aus."); foreach ($GLOBALS["SEM_CLASS"] as $key => $class) { $values[] = $key; $names[] = $class["name"]; } $table = $edit_form->editCheckboxGeneric("semclasses", $names, $info, $values, ""); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Textersetzungen")); $title = _("Anzahl Veranstaltungen:"); $info = _("Geben Sie einen Text ein, der nach der Anzahl der Veranstaltungen steht. Nur wirksam, wenn die Ausgabe der Anzahl der Veranstaltungen und der Gruppierung aktiviert wurde."); $table = $edit_form->editTextfieldGeneric("textlectures", $title, $info, 40, 150); $title = _("Gruppierungsinformation:"); $info = _("Geben Sie einen Text ein, der vor der Gruppierungsart steht. Nur wirksam, wenn die Ausgabe der Anzahl der Veranstaltungen und der Gruppierung aktiviert wurde."); $table .= $edit_form->editTextfieldGeneric("textgrouping", $title, $info, 40, 150); $title = _(""Keine Studienbereiche":"); $info = _("Geben Sie einen Text ein, der Angezeigt wird, wenn Lehrveranstaltungen vorliegen, die keinem Bereich zugeordnet sind. Nur wirksam in Gruppierung nach Bereich."); $table .= $edit_form->editTextfieldGeneric("textnogroups", $title, $info, 40, 150); $titles = array(_("Semester"), _("Bereich"), _("Lehrende"), _("Typ"), _("Einrichtung")); $info = _("Geben Sie eine Bezeichnung für die entsprechende Gruppierungsart ein."); $table .= $edit_form->editTextfieldGeneric("aliasesgrouping", $titles, $info, 40, 150); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Weitere Angaben")); $title = _("Namensformat:"); $info = _("Wählen Sie, wie Personennamen formatiert werden sollen."); $values = array("", "no_title_short", "no_title", "no_title_rev", "full", "full_rev"); $names = array(_("keine Auswahl"), _("Meyer, P."), _("Peter Meyer"), _("Meyer Peter"), _("Dr. Peter Meyer"), _("Meyer, Peter, Dr.")); $table = $edit_form->editOptionGeneric("nameformat", $title, $info, $values, $names); $title = _("Sprache:"); $info = _("Wählen Sie eine Sprache für die Datumsangaben aus."); $values = array("", "de_DE", "en_GB"); $names = array(_("keine Auswahl"), _("Deutsch"), _("Englisch")); $table .= $edit_form->editOptionGeneric("language", $title, $info, $values, $names); $title = _("HTML-Header/Footer:"); $info = _("Anwählen, wenn die Seite als komplette HTML-Seite ausgegeben werden soll, z.B. bei direkter Verlinkung oder in einem Frameset."); $values = "1"; $names = ""; $table .= $edit_form->editCheckboxGeneric("wholesite", $title, $info, $values, $names); $title = _("Stylesheet-Datei:"); $info = _("Geben Sie hier die URL Ihrer Stylesheet-Datei an."); $table .= $edit_form->editTextfieldGeneric("urlcss", $title, $info, 50, 200); $title = _("Seitentitel:"); $info = _("Geben Sie hier den Titel der Seite ein. Der Titel wird bei der Anzeige im Web-Browser in der Titelzeile des Anzeigefensters angezeigt."); $table .= $edit_form->editTextfieldGeneric("title", $title, $info, 50, 200); $title = _("Copyright:"); $info = _("Geben Sie hier einen Copyright-Vermerk an. Dieser wird im Meta-Tag \"copyright\" ausgegeben, wenn Sie die Option \"HTML-Header/Footer\" angewählt haben."); $table .= $edit_form->editTextfieldGeneric("copyright", $title, $info, 50, 200); $title = _("Autor:"); $info = _("Geben Sie hier den Namen des Seitenautors an. Dieser wird im Meta-Tag \"author\" ausgegeben, wenn Sie die Option \"HTML-Header/Footer\" angewählt haben."); $table .= $edit_form->editTextfieldGeneric("author", $title, $info, 50, 200); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $submit = $edit_form->editSubmit($this->config->getName(), $this->config->getId(), $this->getName()); $out = $edit_form->editContent($content_table, $submit); $out .= $edit_form->editBlank(); return $element_headline . $out; }
/** * this action is the main action of the schedule-controller, setting the environment * for the timetable, accepting a comma-separated list of days. * * @param string $days a list of an arbitrary mix of the numbers 0-6, separated * with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default)) * @return void */ function index_action($days = false) { global $user; $schedule_settings = CalendarScheduleModel::getScheduleSettings(); if ($GLOBALS['perm']->have_perm('admin')) { $inst_mode = true; } if ($inst_mode) { // try to find the correct institute-id $institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false)); if (!$institute_id) { $institute_id = UserConfig::get($user->id)->MY_INSTITUTES_DEFAULT; } if (!$institute_id || !in_array(get_object_type($institute_id), words('fak inst'))) { throw new Exception('Cannot display institute-calender. No valid ID given!'); } Navigation::activateItem('/browse/my_courses/schedule'); } else { Navigation::activateItem('/calendar/schedule'); } // check, if the hidden seminar-entries shall be shown $show_hidden = Request::int('show_hidden', 0); // load semester-data and current semester $semdata = new SemesterData(); $this->semesters = array_reverse($semdata->getAllSemesterData()); if (Request::option('semester_id')) { $this->current_semester = $semdata->getSemesterData(Request::option('semester_id')); } else { $this->current_semester = $semdata->getCurrentSemesterData(); } // check type-safe if days is false otherwise sunday (0) cannot be chosen if ($days === false) { if (Request::getArray('days')) { $this->days = array_keys(Request::getArray('days')); } else { $this->days = $schedule_settings['glb_days']; foreach ($this->days as $key => $day_number) { $this->days[$key] = ($day_number + 6) % 7; } } } else { $this->days = explode(',', $days); } $this->controller = $this; $this->calendar_view = $inst_mode ? CalendarScheduleModel::getInstCalendarView($institute_id, $show_hidden, $this->current_semester, $this->days) : CalendarScheduleModel::getUserCalendarView($GLOBALS['user']->id, $show_hidden, $this->current_semester, $this->days); // have we chosen an entry to display? if ($this->flash['entry']) { if ($inst_mode) { $this->show_entry = $this->flash['entry']; } else { if ($this->flash['entry']['id'] == null) { $this->show_entry = $this->flash['entry']; } else { foreach ($this->calendar_view->getColumns() as $entry_days) { foreach ($entry_days->getEntries() as $entry) { if ($this->flash['entry']['cycle_id']) { if ($this->flash['entry']['id'] . '-' . $this->flash['entry']['cycle_id'] == $entry['id']) { $this->show_entry = $entry; $this->show_entry['id'] = reset(explode('-', $this->show_entry['id'])); } } else { if ($entry['id'] == $this->flash['entry']['id']) { $this->show_entry = $entry; } } } } } } } $style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight()); $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views'); PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters), 'screen, print'); if (Request::option('printview')) { $this->calendar_view->setReadOnly(); PageLayout::addStylesheet('print.css'); } else { PageLayout::addStylesheet('print.css', array('media' => 'print')); } $this->show_hidden = $show_hidden; $inst = get_object_name($institute_id, 'inst'); $this->inst_mode = $inst_mode; $this->institute_name = $inst['name']; $this->institute_id = $institute_id; if (Request::get('show_settings')) { $this->show_settings = true; } }
function showTimeRange() { $colspan = $this->mode == 'browse' ? ' colspan="2" ' : ''; ?> <tr> <td <? $this->cssSw->switchClass(); echo $this->cssSw->getFullClass() ?> > <?=_("gefundene Ressourcen sollen zu folgender Zeit <u>nicht</u> belegt sein:")?> <br> </td> </tr> <tr> <td <? $this->cssSw->switchClass(); echo $this->cssSw->getFullClass() ?> > <br> <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr> <td width="120"> <b><?= _('Einzeltermin:') ?></b> </td> <td> <?=_("Beginn")?>: <input type="text" style="font-size:8pt;" name="search_begin_hour" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_begin"]) ? date("H", $this->searchArray["search_assign_begin"]) : _("ss")?>"> <input type="text" style="font-size:8pt;" name="search_begin_minute" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_begin"]) ? date("i", $this->searchArray["search_assign_begin"]) : _("mm")?>"> <?=_("Uhr")?> <?=_("Ende")?>: <input type="text" style="font-size:8pt;" name="search_end_hour" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_end"]) ? date("H", $this->searchArray["search_assign_end"]) : _("ss")?>"> <input type="text" style="font-size:8pt;" name="search_end_minute" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_end"]) ? date("i", $this->searchArray["search_assign_end"]) : _("mm")?>"> <?=_("Uhr")?> <br> <?=_("Datum")?>: <input name="searchDate" id="searchDate" size="10" value="<?=($this->searchArray["search_assign_begin"]) ? date("j.n.Y", $this->searchArray["search_assign_begin"]) : date('j.n.Y', time())?>"> <script> jQuery('#searchDate').datepicker(); </script> <!-- <input type="text" style="font-size:8pt;" name="search_day" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_begin"]) ? date("d", $this->searchArray["search_assign_begin"]) : _("tt")?>"> .<input type="text" style="font-size:8pt;" name="search_month" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_begin"]) ? date("m", $this->searchArray["search_assign_begin"]) : _("mm")?>"> .<input type="text" style="font-size:8pt;" name="search_year" size="4" maxlength="4" value="<?=($this->searchArray["search_assign_begin"]) ? date("Y", $this->searchArray["search_assign_begin"]) : _("jjjj")?>"> --> <input type="checkbox" style="font-size:8pt;" name="search_repeating" value="1" <?=($this->searchArray["search_repeating"]==1) ? "checked=checked" : ""?>> <?= _('für restliches Semester prüfen') ?> <br> </td> </tr> </table> </td> </tr> <tr> <td <? $this->cssSw->switchClass(); echo $this->cssSw->getFullClass() ?> > <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr> <td width="120"> <b><?= _('Semestertermin:') ?></b> </td> <td> <br> <?=_("Beginn")?>: <input type="text" style="font-size:8pt;" name="search_begin_hour_2" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_begin"]) ? date("H", $this->searchArray["search_assign_begin"]) : _("ss")?>"> <input type="text" style="font-size:8pt;" name="search_begin_minute_2" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_begin"]) ? date("i", $this->searchArray["search_assign_begin"]) : _("mm")?>"> <?=_("Uhr")?> <?=_("Ende")?>: <input type="text" style="font-size:8pt;" name="search_end_hour_2" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_end"]) ? date("H", $this->searchArray["search_assign_end"]) : _("ss")?>"> <input type="text" style="font-size:8pt;" name="search_end_minute_2" size="2" maxlength="2" value="<?=($this->searchArray["search_assign_end"]) ? date("i", $this->searchArray["search_assign_end"]) : _("mm")?>"> <?=_("Uhr")?> <br> <?=_("Tag der Woche")?>: <select name = 'search_day_of_week'> <option value=-1 <?=$this->searchArray["search_day_of_week"]==-1? "selected=selected":""?>><?=_("--")?> </option> <option value='Monday' <?=$this->searchArray["search_day_of_week"]=='Monday'? "selected=selected":""?>><?=_("Montag")?> </option> <option value='Tuesday' <?=$this->searchArray["search_day_of_week"]=='Tuesday'? "selected=selected":""?>><?=_("Dienstag")?> </option> <option value='Wednesday' <?=$this->searchArray["search_day_of_week"]=='Wednesday'? "selected=selected":""?>><?=_("Mittwoch")?> </option> <option value='Thursday' <?=$this->searchArray["search_day_of_week"]=='Thursday'? "selected=selected":""?>><?=_("Donnerstag")?> </option> <option value='Friday' <?=$this->searchArray["search_day_of_week"]=='Friday'? "selected=selected":""?>><?=_("Freitag")?> </option> <option value='Saturday' <?=$this->searchArray["search_day_of_week"]=='Saturday'? "selected=selected":""?>><?=_("Samstag")?> </option> <option value='Sunday' <?=$this->searchArray["search_day_of_week"]=='Sunday'? "selected=selected":""?>><?=_("Sonntag")?> </option> </select> <?=_("Semester")?>: <select name = 'search_semester'> <? $semesterData = new SemesterData(); $all_semester = $semesterData->getAllSemesterData(); if (!$this->searchArray["search_semester"]) { $current_semester = $semesterData->getCurrentSemesterData(); $selected_semester = $semesterData->getSemesterDataByDate(strtotime("+1 Day",$current_semester["ende"])); } else { $selected_semester["semester_id"] = $this->searchArray["search_semester"]; } $this_sem = false; foreach($all_semester as $semester) { $this_sem = $selected_semester["semester_id"] == $semester["semester_id"]; echo "<option value='".$semester["semester_id"]."' ".($this_sem?" selected=selected ":"").">".$semester["name"]."</option>"; } ?> </select> </td> </tr> </table> <br> </td> </tr> <? }
/** * generate single date objects for one cycle and all semester, existing dates are merged in * * @param startAfterTimeStamp => int timestamp to override semester start * @return array array of arrays, for each semester id an array of two arrays of SingleDate objects: 'dates' => all new and surviving dates, 'dates_to_delete' => obsolete dates */ public function createTerminSlots($startAfterTimeStamp = 0) { $course = Course::find($this->seminar_id); $ret = array(); $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); // get the starting-point for creating singleDates for the choosen cycleData foreach ($all_semester as $val) { if ($course->start_time >= $val["beginn"] && $course->start_time <= $val["ende"]) { $sem_begin = mktime(0, 0, 0, date("n", $val["vorles_beginn"]), date("j", $val["vorles_beginn"]), date("Y", $val["vorles_beginn"])); } } // get the end-point if ($course->duration_time == -1) { foreach ($all_semester as $val) { $sem_end = $val['vorles_ende']; } } else { $i = 0; foreach ($all_semester as $val) { $i++; $timestamp = $course->duration_time + $course->start_time; if ($timestamp >= $val['beginn'] && $timestamp <= $val['ende']) { $sem_end = $val["vorles_ende"]; } } } $passed = false; foreach ($all_semester as $val) { if ($sem_begin <= $val['vorles_beginn']) { $passed = true; } if ($passed && $sem_end >= $val['vorles_ende'] && $startAfterTimeStamp <= $val['ende']) { // correction calculation, if the semester does not start on monday $dow = date("w", $val['vorles_beginn']); if ($dow <= 5) { $corr = ($dow - 1) * -1; } elseif ($dow == 6) { $corr = 2; } elseif ($dow == 0) { $corr = 1; } else { $corr = 0; } $ret[$val['semester_id']] = $this->createSemesterTerminSlots($val['vorles_beginn'], $val['vorles_ende'], $startAfterTimeStamp, $corr); } } return $ret; }
function lehre (&$module, $row, $alias_content, $text_div, $text_div_end) { global $attr_text_td, $end, $start; $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); // old hard coded $SEMESTER-array starts with index 1 array_unshift($all_semester, 0); if ($margin = $module->config->getValue('TableParagraphSubHeadline', 'margin')) { $subheadline_div = '<div style="margin-left:' . $margin . ';">'; $subheadline_div_end = '</div>'; } else { $subheadline_div = ''; $subheadline_div_end = ''; } if ($margin = $module->config->getValue('List', 'margin')) { $list_div = '<div style="margin-left:' . $margin . ';">'; $list_div_end = '</div>'; } else { $list_div = ''; $list_div_end = ''; } $types = array(); $semclass = $module->config->getValue('PersondetailsLectures', 'semclass'); if (is_null($semclass)) { $semclass = array(1); } foreach ($GLOBALS['SEM_TYPE'] as $key => $type) { if (in_array($type['class'], $semclass)) { $types[] = $key; } } $switch_time = mktime(0, 0, 0, date('m'), date('d') + 7 * $module->config->getValue('PersondetailsLectures', 'semswitch'), date('Y')); // get current semester $current_sem = get_sem_num($switch_time) + 1; switch ($module->config->getValue('PersondetailsLectures', 'semstart')) { case 'previous': if (isset($all_semester[$current_sem - 1])) { $current_sem -= 1; } break; case 'next': if (isset($all_semester[$current_sem + 1])) { $current_sem += 1; } break; case 'current': break; default: if (isset($all_semester[$module->config->getValue('PersondetailsLectures', 'semstart')])) { $current_sem = $module->config->getValue('PersondetailsLectures', 'semstart'); } } $last_sem = $current_sem + $module->config->getValue('PersondetailsLectures', 'semrange') - 1; if ($last_sem < $current_sem) { $last_sem = $current_sem; } if (!isset($all_semester[$last_sem])) { $last_sem = count($all_semester) - 1; } $query = "SELECT * FROM seminar_user AS su LEFT JOIN seminare AS s USING (seminar_id) WHERE user_id = :user_id AND su.status = 'dozent' AND start_time <= :beginn AND (:beginn <= start_time + duration_time OR duration_time = -1) AND s.status IN (:types) AND s.visible = 1"; if (Config::get()->IMPORTANT_SEMNUMBER) { $query .= " ORDER BY s.`VeranstaltungsNummer`, s.`Name`"; } else { $query .= " ORDER BY s.`Name`"; } $statement = DBManager::get()->prepare($query); $statement->bindValue(':user_id', $row['user_id']); $statement->bindValue(':types', $types ?: ''); $out = ''; for (;$current_sem <= $last_sem; $last_sem--) { $statement->bindValue(':beginn', $all_semester[$last_sem]['beginn']); $statement->execute(); $data = $statement->fetchAll(PDO::FETCH_ASSOC); if (count($data) > 0) { if (!($module->config->getValue("PersondetailsLectures", "semstart") == "current" && $module->config->getValue("PersondetailsLectures", "semrange") == 1)) { $out .= "<tr" . $module->config->getAttributes("TableParagraphSubHeadline", "tr") . ">"; $out .= "<td" . $module->config->getAttributes("TableParagraphSubHeadline", "td") . ">"; $out .= $subheadline_div; $out .= "<font" . $module->config->getAttributes("TableParagraphSubHeadline", "font") . ">"; $month = date("n", $all_semester[$last_sem]['beginn']); if($month > 9) { $out .= $module->config->getValue("PersondetailsLectures", "aliaswise"); $out .= date(" Y/", $all_semester[$last_sem]['beginn']) . date("y", $all_semester[$last_sem]['ende']); } else if($month > 3 && $month < 10) { $out .= $module->config->getValue("PersondetailsLectures", "aliassose"); $out .= date(" Y", $all_semester[$last_sem]['beginn']); } $out .= "</font>$subheadline_div_end</td></tr>\n"; } $out .= "<tr" . $module->config->getAttributes("TableParagraphText", "tr") . ">"; $out .= "<td" . $module->config->getAttributes("TableParagraphText", "td") . ">"; if ($module->config->getValue("PersondetailsLectures", "aslist")) { $out .= "$list_div<ul" . $module->config->getAttributes("List", "ul") . ">\n"; foreach ($data as $item) { $out .= "<li" . $module->config->getAttributes("List", "li") . ">"; $name = $item['Name']; if (Config::get()->IMPORTANT_SEMNUMBER && $item['VeranstaltungsNummer']) { $name = $item['VeranstaltungsNummer'].' '.$name; } $out .= $module->elements["LinkIntern"]->toString(array("module" => "Lecturedetails", "link_args" => "seminar_id=" . $item['Seminar_id'], "content" => htmlReady($name, TRUE))); if ($item['Untertitel'] != '') { $out .= "<font" . $module->config->getAttributes("TableParagraphText", "font") . "><br>"; $out .= htmlReady($item['Untertitel'], TRUE) . "</font>\n"; } } $out .= "</ul>$list_div_end"; } else { $out .= $text_div; $j = 0; foreach ($data as $item) { if ($j) { $out .= '<br>'; } $out .= $module->elements['LinkIntern']->toString(array('module' => 'Lecturedetails', 'link_args' => 'seminar_id=' . $item['Seminar_id'], 'content' => htmlReady($item['Name'], TRUE))); if ($item['Untertitel'] != '') { $out .= "<font" . $module->config->getAttributes("TableParagraphText", "font") . ">"; $out .= "<br>" . htmlReady($item['Untertitel'], TRUE) . "</font>\n"; } $j = 1; } $out .= $text_div_end; } $out .= "</td></tr>\n"; } } if ($out) { $out_title = '<tr><td width="100%">' . "\n"; $out_title .= '<table' . $module->config->getAttributes('TableParagraph', 'table') . '>' . "\n"; $out_title .= '<tr' . $module->config->getAttributes('TableParagraphHeadline', 'tr') . '>'; $out_title .= '<td' . $module->config->getAttributes('TableParagraphHeadline', 'td') . '>'; $out_title .= '<font' . $module->config->getAttributes('TableParagraphHeadline', 'font') . '>'; $out_title .= $alias_content . '</font></td></tr>' . "\n"; echo $out_title . $out; echo '</table>' . "\n"; echo '</td></tr>' . "\n"; } }
function isRepeatEndSemEnd() { $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); foreach ($all_semester as $a) { if ($this->begin >= $a["beginn"] && $this->begin <= $a["ende"]) { if ($this->repeat_end == $a["vorles_ende"]) { return true; } } } return false; }
function lehre (&$module, $data, $alias_content, $text_div, $text_div_end) { global $attr_text_td; $semester = new SemesterData; $all_semester = $semester->getAllSemesterData(); // old hard coded $SEMESTER-array starts with index 1 array_unshift($all_semester, 0); if ($margin = $module->config->getValue("TableParagraphSubHeadline", "margin")) { $subheadline_div = "<div style=\"margin-left:$margin;\">"; $subheadline_div_end = "</div>"; } else { $subheadline_div = ""; $subheadline_div_end = ""; } if ($margin = $module->config->getValue("List", "margin")) { $list_div = "<div style=\"margin-left:$margin;\">"; $list_div_end = "</div>"; } else { $list_div = ""; $list_div_end = ""; } // sem-types in class 1 (Lehre) foreach ($GLOBALS["SEM_TYPE"] as $key => $type) { if ($type["class"] == 1) $types[] = $key; } $types = implode("','", $types); $switch_time = mktime(0, 0, 0, date("m"), date("d") + 7 * $module->config->getValue("PersondetailsLectures", "semswitch"), date("Y")); // get current semester $current_sem = get_sem_num($switch_time) + 1; switch ($module->config->getValue("PersondetailsLectures", "semstart")) { case "previous" : if (isset($all_semester[$current_sem - 1])) $current_sem--; break; case "next" : if (isset($all_semester[$current_sem + 1])) $current_sem++; break; case "current" : break; default : if (isset($all_semester[$module->config->getValue("PersondetailsLectures", "semstart")])) $current_sem = $module->config->getValue("PersondetailsLectures", "semstart"); } $last_sem = $current_sem + $module->config->getValue("PersondetailsLectures", "semrange") - 1; if ($last_sem < $current_sem) $last_sem = $current_sem; if (!isset($all_semester[$last_sem])) $last_sem = sizeof($all_semester) - 1; $out = ""; for (;$current_sem <= $last_sem; $last_sem--) { if (!($module->config->getValue("PersondetailsLectures", "semstart") == "current" && $module->config->getValue("PersondetailsLectures", "semrange") == 1)) { $out .= "<tr" . $module->config->getAttributes("TableParagraphSubHeadline", "tr") . ">"; $out .= "<td" . $module->config->getAttributes("TableParagraphSubHeadline", "td") . ">"; $out .= $subheadline_div; $out .= "<font" . $module->config->getAttributes("TableParagraphSubHeadline", "font") . ">"; $month = date("n", $all_semester[$last_sem]["beginn"]); if($month > 9) { $out .= $module->config->getValue("PersondetailsLectures", "aliaswise"); $out .= date(" Y/", $all_semester[$last_sem]["beginn"]) . date("y", $all_semester[$last_sem]["ende"]); } else if($month > 3 && $month < 10) { $out .= $module->config->getValue("PersondetailsLectures", "aliassose"); $out .= date(" Y", $all_semester[$last_sem]["beginn"]); } $out .= "</font>$subheadline_div_end</td></tr>\n"; } $out .= "<tr" . $module->config->getAttributes("TableParagraphText", "tr") . ">"; $out .= "<td" . $module->config->getAttributes("TableParagraphText", "td") . ">"; if ($module->config->getValue("PersondetailsLectures", "aslist")) { $out .= "$list_div<ul" . $module->config->getAttributes("List", "ul") . ">\n"; foreach ($data as $dat) { $out .= "<li" . $module->config->getAttributes("List", "li") . ">"; $out .= "<font" . $module->config->getAttributes("LinkIntern", "font") . ">"; $out .= "<a href=\"\"" . $module->config->getAttributes("LinkIntern", "a") . ">"; $out .= $dat["name"] . "</a></font>\n"; $out .= "<font" . $module->config->getAttributes("TableParagraphText", "font") . "><br>"; $out .= $dat["untertitel"] . "</font>\n"; } $out .= "</ul>$list_div_end"; } else { $out .= $text_div; $j = 0; foreach ($data as $dat) { if ($j) $out .= "<br><br>"; $out .= "<font" . $module->config->getAttributes("LinkIntern", "font") . ">"; $out .= "<a href=\"$lnk\"" . $module->config->getAttributes("LinkIntern", "a") . ">"; $out .= $dat["name"] . "</a></font>\n"; $out .= "<font" . $module->config->getAttributes("TableParagraphText", "font") . ">"; $out .= "<br>" . $dat["untertitel"] . "</font>\n"; $j = 1; } $out .= $text_div_end; } $out .= "</td></tr>\n"; } if ($out) { $out_title = "<tr><td width=\"100%\">\n"; $out_title .= "<table" . $module->config->getAttributes("TableParagraph", "table") . ">\n"; $out_title .= "<tr" . $module->config->getAttributes("TableParagraphHeadline", "tr") . ">"; $out_title .= "<td" . $module->config->getAttributes("TableParagraphHeadline", "td") . ">"; $out_title .= "<font" . $module->config->getAttributes("TableParagraphHeadline", "font") . ">"; $out_title .= $alias_content . "</font></td></tr>\n"; echo $out_title . $out . "</table>\n</td></tr>\n"; } }
/** * */ function toStringEdit ($post_vars = "", $faulty_values = "", $edit_form = "", $anker = "") { // get semester data $semester = new SemesterData(); $semester_data = $semester->getAllSemesterData(); $out = ""; $table = ""; if ($edit_form == "") $edit_form = new ExternEditModule($this->config, $post_vars, $faulty_values, $anker); $edit_form->setElementName($this->getName()); $element_headline = $edit_form->editElementHeadline($this->real_name, $this->config->getName(), $this->config->getId(), TRUE, $anker); $headline = $edit_form->editHeadline(_("Name der globalen Konfiguration")); $table = $edit_form->editName("name"); $content_table = $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Anzuzeigende Lehrveranstaltungen")); $title = _("Startsemester:"); $info = _("Geben Sie das erste anzuzeigende Semester an. Die Angaben \"vorheriges\", \"aktuelles\" und \"nächstes\" beziehen sich immer auf das laufende Semester und werden automatisch angepasst."); $current_sem = get_sem_num_sem_browse(); if ($current_sem === FALSE) { $names = array(_("keine Auswahl"), _("aktuelles"), _("nächstes")); $values = array("", "current", "next"); } else if ($current_sem === TRUE) { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles")); $values = array("", "previous", "current"); } else { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles"), "nächstes"); $values = array("", "previous", "current", "next"); } foreach ($semester_data as $sem_num => $sem) { $names[] = $sem["name"]; $values[] = $sem_num + 1; } $table = $edit_form->editOptionGeneric("semstart", $title, $info, $values, $names); $title = _("Anzahl der anzuzeigenden Semester:"); $info = _("Geben Sie an, wieviele Semester (ab o.a. Startsemester) angezeigt werden sollen."); $names = array(_("keine Auswahl")); $values = array(""); $i = 1; foreach ($semester_data as $sem_num => $sem) { $names[] = $i++; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric("semrange", $title, $info, $values, $names); $title = _("Umschalten des aktuellen Semesters:"); $info = _("Geben Sie an, wieviele Wochen vor Semesterende automatisch auf das nächste Semester umgeschaltet werden soll."); $names = array(_("keine Auswahl"), _("am Semesterende"), _("1 Woche vor Semesterende")); for ($i = 2; $i < 13; $i++) $names[] = sprintf(_("%s Wochen vor Semesterende"), $i); $values = array("", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); $table .= $edit_form->editOptionGeneric("semswitch", $title, $info, $values, $names); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Weitere Angaben")); $title = _("Namensformat:"); $info = _("Wählen Sie, wie Personennamen formatiert werden sollen."); $values = array("", "no_title_short", "no_title", "no_title_rev", "full", "full_rev"); $names = array(_("keine Auswahl"), _("Meyer, P."), _("Peter Meyer"), _("Meyer Peter"), _("Dr. Peter Meyer"), _("Meyer, Peter, Dr.")); $table = $edit_form->editOptionGeneric("nameformat", $title, $info, $values, $names); $title = _("Sprache:"); $info = _("Wählen Sie eine Sprache für die Datumsangaben aus."); $values = array("", "de_DE", "en_GB"); $names = array(_("keine Auswahl"), _("Deutsch"), _("Englisch")); $table .= $edit_form->editOptionGeneric("language", $title, $info, $values, $names); $title = _("Standard-Adresse:"); $info = _("Wenn Sie diese Option wählen, wird die Standard-Adresse ausgegeben, die jede(r) Mitarbeiter(in) bei seinen universitären Daten auswählen kann. Wählen Sie diese Option nicht, wenn immer die Adresse der Einrichtung ausgegeben werden soll."); $table .= $edit_form->editCheckboxGeneric('defaultadr', $title, $info, '1', '0'); $title = _("HTML-Header/Footer:"); $info = _("Anwählen, wenn die Seite als komplette HTML-Seite ausgegeben werden soll, z.B. bei direkter Verlinkung oder in einem Frameset."); $values = "1"; $names = ""; $table .= $edit_form->editCheckboxGeneric("wholesite", $title, $info, $values, $names); $title = _("Stylesheet-Datei:"); $info = _("Geben Sie hier die URL Ihrer Stylesheet-Datei an."); $table .= $edit_form->editTextfieldGeneric("urlcss", $title, $info, 50, 200); $title = _("Copyright:"); $info = _("Geben Sie hier einen Copyright-Vermerk an. Dieser wird im Meta-Tag \"copyright\" ausgegeben, wenn Sie die Option \"HTML-Header/Footer\" angewählt haben."); $table .= $edit_form->editTextfieldGeneric("copyright", $title, $info, 50, 200); $title = _("Autor:"); $info = _("Geben Sie hier den Namen des Seitenautors an. Dieser wird im Meta-Tag \"author\" ausgegeben, wenn Sie die Option \"HTML-Header/Footer\" angewählt haben."); $table .= $edit_form->editTextfieldGeneric("author", $title, $info, 50, 200); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $submit = $edit_form->editSubmit($this->config->getName(), $this->config->getId(), $this->getName()); $out = $edit_form->editContent($content_table, $submit); $out .= $edit_form->editBlank(); return $element_headline . $out; }
/** * generate single date objects for one cycle and all semester, existing dates are merged in * * @param mixed cycle id (string) or array with 'metadate_id' => string cycle id, 'startAfterTimeStamp' => int timestamp to override semester start * @return array array of arrays, for each semester id an array of two arrays of SingleDate objects: 'dates' => all new and surviving dates, 'dates_to_delete' => obsolete dates */ function getVirtualSingleDates($data) { if (is_array($data)) { $metadate_id = $data['metadate_id']; $startAfterTimeStamp = $data['startAfterTimeStamp']; } else { $metadate_id = $data; $startAfterTimeStamp = 0; } $ret = array(); $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); // get the starting-point for creating singleDates for the choosen cycleData foreach ($all_semester as $val) { if ($this->seminarStartTime >= $val["beginn"] && $this->seminarStartTime <= $val["ende"]) { $sem_begin = mktime(0, 0, 0, date("n", $val["vorles_beginn"]), date("j", $val["vorles_beginn"]), date("Y", $val["vorles_beginn"])); } } // get the end-point if ($this->seminarDurationTime == -1) { foreach ($all_semester as $val) { $sem_end = $val['vorles_ende']; } } else { $i = 0; foreach ($all_semester as $val) { $i++; $timestamp = $this->seminarDurationTime + $this->seminarStartTime; if ($timestamp >= $val['beginn'] && $timestamp <= $val['ende']) { $sem_end = $val["vorles_ende"]; } } } $passed = false; foreach ($all_semester as $val) { if ($sem_begin <= $val['vorles_beginn']) { $passed = true; } if ($passed && $sem_end >= $val['vorles_ende'] && $startAfterTimeStamp <= $val['ende']) { // correction calculation, if the semester does not start on monday $dow = date("w", $val['vorles_beginn']); if ($dow <= 5) { $corr = ($dow - 1) * -1; } elseif ($dow == 6) { $corr = 2; } elseif ($dow == 0) { $corr = 1; } else { $corr = 0; } $ret[$val['semester_id']] = $this->getVirtualSingleDatesForSemester($metadate_id, $val['vorles_beginn'], $val['vorles_ende'], $startAfterTimeStamp, $corr); } } return $ret; }
function toStringEdit($post_vars = '', $faulty_values = '', $edit_form = '', $anker = '') { // get semester data $semester = new SemesterData(); $semester_data = $semester->getAllSemesterData(); update_generic_datafields($this->config, $this->data_fields, $this->field_names, "sem"); $out = ''; $table = ''; if ($edit_form == '') { $edit_form = new ExternEditModule($this->config, $post_vars, $faulty_values, $anker); } $edit_form->setElementName($this->getName()); $element_headline = $edit_form->editElementHeadline($this->real_name, $this->config->getName(), $this->config->getId(), TRUE, $anker); if ($faulty_values == '') { $faulty_values = array(); } $headline = $edit_form->editHeadline(_("Name der Konfiguration")); $table = $edit_form->editName('name'); $content_table = $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $content_table .= $this->getSRIFormContent($edit_form, true); $headline = $edit_form->editHeadline(_("Konfiguration des Moduls")); $title = _("Anzeigemodus:"); $info = _("Auswahl zwischen Einrichtungsbaum und Bereichsbaum"); $values = array('show_sem_range', 'show_sem_range_tree'); $names = array(_("Vorlesungsverzeichnis"), _("Einrichtungen")); $table = $edit_form->editRadioGeneric('mode', $title, $info, $values, $names); $title = _("Gruppierung:"); $info = _("Wählen Sie, wie die Veranstaltungen gruppiert werden sollen."); $values = array('0', '1', '2', '3', '4'); $names = array(_("Semester"), _("Bereich"), _("Lehrende"), _("Typ"), _("Einrichtung")); $table .= $edit_form->editOptionGeneric('grouping', $title, $info, $values, $names); $title = _("Startsemester:"); $info = _("Geben Sie das erste anzuzeigende Semester an. Die Angaben \"vorheriges\", \"aktuelles\" und \"nächstes\" beziehen sich immer auf das laufende Semester und werden automatisch angepasst."); $current_sem = get_sem_num_sem_browse(); if ($current_sem === FALSE) { $names = array(_("keine Auswahl"), _("aktuelles"), _("nächstes")); $values = array('', 'current', 'next'); } else { if ($current_sem === TRUE) { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles")); $values = array('', 'previous', 'current'); } else { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles"), "nächstes"); $values = array('', 'previous', 'current', 'next'); } } foreach ($semester_data as $sem_num => $sem) { $names[] = $sem['name']; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric("semstart", $title, $info, $values, $names); /* $title = _("Anzahl der anzuzeigenden Semester:"); $info = _("Geben Sie an, wieviele Semester (ab o.a. Startsemester) angezeigt werden sollen."); $names = array(_("keine Auswahl")); $values = array(''); $i = 1; foreach ($semester_data as $sem_num => $sem) { $names[] = $i++; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric('semrange', $title, $info, $values, $names); */ $title = _("Umschalten des aktuellen Semesters:"); $info = _("Geben Sie an, wieviele Wochen vor Semesterende automatisch auf das nächste Semester umgeschaltet werden soll."); $names = array(_("keine Auswahl"), _("am Semesterende"), _("1 Woche vor Semesterende")); for ($i = 2; $i < 13; $i++) { $names[] = sprintf(_("%s Wochen vor Semesterende"), $i); } $values = array('', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'); $table .= $edit_form->editOptionGeneric('semswitch', $title, $info, $values, $names); /* $title = _("Veranstaltungen beteiligter Institute anzeigen:"); $info = _("Wählen Sie diese Option, um Veranstaltungen anzuzeigen, bei denen diese Einrichtung als beteiligtes Institut eingetragen ist."); $values = '1'; $names = ''; $table .= $edit_form->editCheckboxGeneric('allseminars', $title, $info, $values, $names); */ $title = _("Bereichspfad ab Ebene:"); $info = _("Wählen Sie, ab welcher Ebene der Bereichspfad ausgegeben werden soll."); $values = array('1', '2', '3', '4', '5', '6'); $names = array('1', '2', '3', '4', '5', '6'); $table .= $edit_form->editOptionGeneric('rangepathlevel', $title, $info, $values, $names); $title = _("Anzeige von Unterebenen:"); $info = _("Anzahl der Unterebenen des Baumes, die angezeigt werden sollen."); $values = array('0', '1', '2', '3', '4', '5', '6'); $names = array('0', '1', '2', '3', '4', '5', '6'); $table .= $edit_form->editOptionGeneric('countshowsublevels', $title, $info, $values, $names); $cid = Request::option('cid'); if ($GLOBALS['perm']->have_perm('root') && ($cid = 'studip')) { $title = _("Start bei Root-Ebene:"); $info = _("Wird das Modul ohne weitere Parameter aufgerufen startet die Anzeige beim Root-Level (alle Fakultäten)."); $table .= $edit_form->editCheckboxGeneric('startitem', $title, $info, 'root', '0'); } $title = _("Leere Ebenen ausblenden:"); $info = _("Ebenen ohne Veranstaltungen und ohne Veranstaltungen in ihren Unterebenen werden nicht angezeigt."); $table .= $edit_form->editCheckboxGeneric('disableemptylevels', $title, $info, '1', '0'); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Konfiguration der Suche")); $title = _("Sortierung des Treffersets:"); $info = _("Nach welchem Tabellenfeld soll das Trefferset sortiert werden?"); $values = array('VeranstaltungsNummer', 'Name'); $names = array('Veranstaltungsnummer', 'Name'); $table = $edit_form->editOptionGeneric('resultorderby', $title, $info, $values, $names); $title = _("Anzahl der Treffer bei Suche:"); $info = _("Maximale Anzahl der Veranstaltungen im Trefferset. Angabe 0, um alle anzuzeigen."); $table .= $edit_form->editTextfieldGeneric('maxnumberofhits', $title, $info, 3, 3); $title = _("Anzahl der Seiten im Result Browser:"); $info = _("Maximale Anzahl der Seiten, die der Result Browser anzeigen soll."); $table .= $edit_form->editTextfieldGeneric('maxpagesresultbrowser', $title, $info, 3, 3); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Ausgabe bestimmter Veranstaltungsklassen")); $names = array(); $values = array(); $info = _("Wählen Sie die anzuzeigenden Veranstaltungsklassen aus."); foreach ($GLOBALS['SEM_CLASS'] as $key => $class) { $values[] = $key; $names[] = $class['name']; } $table = $edit_form->editCheckboxGeneric('semclasses', $names, $info, $values, ""); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Textersetzungen")); $titles = array(_("Semester"), _("Bereich"), _("Lehrende"), _("Typ"), _("Einrichtung")); $info = _("Geben Sie eine Bezeichnung für die entsprechende Gruppierungsart ein."); $table = $edit_form->editTextfieldGeneric('aliasesgrouping', $titles, $info, 40, 150); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Termine")); $title = _("Termintypen:"); $info = _("Wählen Sie aus, welche Termintypen angezeigt werden sollen."); $values = array('all', 'meeting', 'other', ''); $names = array(_("alle Termine"), _("nur Sitzungstermine"), _("nur andere Termine"), '-----------'); foreach ($GLOBALS['TERMIN_TYP'] as $termin_key => $termin_typ) { $values[] = $termin_key; $names[] = $termin_typ['name'] . ($termin_typ['sitzung'] ? ' (' . _("Sitzung") . ')' : ''); } $table = $edit_form->editOptionGeneric('selectedeventtypes', $title, $info, $values, $names, 5, true); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Weitere Angaben")); $title = _("Namensformat:"); $info = _("Wählen Sie, wie Personennamen formatiert werden sollen."); $values = array("", "no_title_short", "no_title", "no_title_rev", "full", "full_rev"); $names = array(_("keine Auswahl"), _("Meyer, P."), _("Peter Meyer"), _("Meyer Peter"), _("Dr. Peter Meyer"), _("Meyer, Peter, Dr.")); $table = $edit_form->editOptionGeneric('nameformat', $title, $info, $values, $names); $title = _("Sprache:"); $info = _("Wählen Sie eine Sprache für die Datumsangaben aus."); $values = array("", "de_DE", "en_GB"); $names = array(_("keine Auswahl"), _("Deutsch"), _("Englisch")); $table .= $edit_form->editOptionGeneric('language', $title, $info, $values, $names); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $submit = $edit_form->editSubmit($this->config->getName(), $this->config->getId(), $this->getName()); $out = $edit_form->editContent($content_table, $submit); $out .= $edit_form->editBlank(); return $element_headline . $out; }
private function getContentLectures () { global $attr_text_td, $end, $start; $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); // old hard coded $SEMESTER-array starts with index 1 array_unshift($all_semester, 0); $types = array(); $semclass = $this->config->getValue('PersondetailsLectures', 'semclass'); if (is_null($semclass)) { $semclass = array(1); } if (in_array($type["class"], $semclass)) { } $switch_time = mktime(0, 0, 0, date("m"), date("d") + 7 * $this->config->getValue("PersondetailsLectures", "semswitch"), date("Y")); // get current semester $current_sem = get_sem_num($switch_time) + 1; switch ($this->config->getValue("PersondetailsLectures", "semstart")) { case "previous" : if (isset($all_semester[$current_sem - 1])) { $current_sem--; } break; case "next" : if (isset($all_semester[$current_sem + 1])) { $current_sem++; } break; case "current" : break; default : if (isset($all_semester[$this->config->getValue("PersondetailsLectures", "semstart")])) { $current_sem = $this->config->getValue("PersondetailsLectures", "semstart"); } } $last_sem = $current_sem + $this->config->getValue("PersondetailsLectures", "semrange") - 1; if ($last_sem < $current_sem) { $last_sem = $current_sem; } if (!isset($all_semester[$last_sem])) { $last_sem = sizeof($all_semester) - 1; } $types = array(); $semclass = $this->config->getValue('PersondetailsLectures', 'semclass'); if (is_null($semclass)) { $semclass = array(1); } foreach ($GLOBALS["SEM_TYPE"] as $key => $type) { if (in_array($type["class"], $semclass)) { $types[] = $key; } } $stm = DBManager::get()->prepare( "SELECT s.Name, s.Seminar_id, s.Untertitel, s.VeranstaltungsNummer " . "FROM seminar_user su " . "LEFT JOIN seminare s USING(seminar_id) " . "WHERE user_id = ? AND su.status LIKE 'dozent' " . "AND start_time <= ? AND (? <= start_time + duration_time OR duration_time = -1) " . "AND s.status IN (?) AND s.visible = 1 " . "ORDER BY Name"); $i = 0; for (;$current_sem <= $last_sem; $last_sem--) { $stm->execute(array($this->user_id, $all_semester[$last_sem]['beginn'], $all_semester[$last_sem]['beginn'], $types ?: '')); $result = $stm->fetchAll(); if ($result && sizeof($result)) { if (!($this->config->getValue('PersondetailsLectures', 'semstart') == 'current' && $this->config->getValue('PersondetailsLectures', 'semrange') == 1)) { $month = date('n', $all_semester[$last_sem]['beginn']); if ($month > 9) { $content['LECTURES']['SEMESTER'][$i]['NAME'] = $this->config->getValue('PersondetailsLectures', 'aliaswise') . date(' Y/', $all_semester[$last_sem]['beginn']) . date('y', $all_semester[$last_sem]['ende']); } else if ($month > 3 && $month < 10) { $content['LECTURES']['SEMESTER'][$i]['NAME'] = $this->config->getValue('PersondetailsLectures', 'aliassose') . date(' Y', $all_semester[$last_sem]['beginn']); } } $k = 0; foreach ($result as $row) { $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['TITLE'] = ExternModule::ExtHtmlReady($row['Name']); $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['LECTUREDETAILS-HREF'] = $this->elements['LinkInternLecturedetails']->createUrl(array('link_args' => 'seminar_id=' . $row['Seminar_id'])); if (trim($row['Untertitel']) != '') { $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['SUBTITLE'] = ExternModule::ExtHtmlReady($row['Untertitel']); } if (trim($row['VeranstaltungsNummer']) != '') { $content['LECTURES']['SEMESTER'][$i]['LECTURE'][$k]['NUMBER'] = ExternModule::ExtHtmlReady($row['VeranstaltungsNummer']); } $k++; } } $i++; } return $content; }
/** * */ function toStringEdit ($post_vars = "", $faulty_values = "", $edit_form = "", $anker = "") { // get semester data $semester = new SemesterData(); $semester_data = $semester->getAllSemesterData(); $out = ""; $table = ""; if ($edit_form == "") $edit_form = new ExternEditModule($this->config, $post_vars, $faulty_values, $anker); $edit_form->setElementName($this->getName()); $element_headline = $edit_form->editElementHeadline($this->real_name, $this->config->getName(), $this->config->getId(), TRUE, $anker); $headline = $edit_form->editHeadline(_("Allgemeine Angaben")); $title = _("Startsemester:"); $info = _("Geben Sie das erste anzuzeigende Semester an. Die Angaben \"vorheriges\", \"aktuelles\" und \"nächstes\" beziehen sich immer auf das laufende Semester und werden automatisch angepasst."); $current_sem = get_sem_num_sem_browse(); if ($current_sem === FALSE) { $names = array(_("keine Auswahl"), _("aktuelles"), _("nächstes")); $values = array("", "current", "next"); } else if ($current_sem === TRUE) { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles")); $values = array("", "previous", "current"); } else { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles"), "nächstes"); $values = array("", "previous", "current", "next"); } foreach ($semester_data as $sem_num => $sem) { $names[] = $sem["name"]; $values[] = $sem_num + 1; } $table = $edit_form->editOptionGeneric("semstart", $title, $info, $values, $names); $title = _("Anzahl der anzuzeigenden Semester:"); $info = _("Geben Sie an, wieviele Semester (ab o.a. Startsemester) angezeigt werden sollen."); $names = array(_("keine Auswahl")); $values = array(""); $i = 1; foreach ($semester_data as $sem_num => $sem) { $names[] = $i++; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric("semrange", $title, $info, $values, $names); $title = _("Umschalten des aktuellen Semesters:"); $info = _("Geben Sie an, wieviele Wochen vor Semesterende automatisch auf das nächste Semester umgeschaltet werden soll."); $names = array(_("keine Auswahl"), _("am Semesterende"), _("1 Woche vor Semesterende")); for ($i = 2; $i < 13; $i++) $names[] = sprintf(_("%s Wochen vor Semesterende"), $i); $values = array("", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); $table .= $edit_form->editOptionGeneric("semswitch", $title, $info, $values, $names); $title = _("Bezeichnung Sommersemester:"); $info = _("Alternative Bezeichnung für den Begriff \"Sommersemester\"."); $table .= $edit_form->editTextfieldGeneric("aliassose", $title, $info, 40, 80); $title = _("Bezeichnung Wintersemester:"); $info = _("Alternative Bezeichnung für den Begriff \"Wintersemester\"."); $table .= $edit_form->editTextfieldGeneric("aliaswise", $title, $info, 40, 80); $title = _("Darstellungsart:"); $info = _("Wählen Sie zwischen Listendarstellung und reiner Textdarstellung."); $names = array(_("Liste"), _("nur Text")); $values = array("1", "0"); $table .= $edit_form->editRadioGeneric("aslist", $title, $info, $values, $names); $title = _("Veranstaltungsklassen:"); $info = _("Wählen Sie aus, welche Veranstaltungsklassen angezeigt werden sollen."); foreach ($GLOBALS['SEM_CLASS'] as $key => $lecture_class) { $class_names[] = $lecture_class['name']; $class_values[] = $key; } $table .= $edit_form->editCheckboxGeneric("semclass", $title, $info, $class_values, $class_names); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $submit = $edit_form->editSubmit($this->config->getName(), $this->config->getId(), $this->getName()); $out = $edit_form->editContent($content_table, $submit); $out .= $edit_form->editBlank(); return $element_headline . $out; }
* @package resources */ $view = Request::option('view'); $view_mode = Request::option('view_mode'); $quick_view_mode = Request::option('quick_view_mode'); /***************************************************************************** Requires & Registers /*****************************************************************************/ require_once 'lib/msg.inc.php'; require_once $GLOBALS['RELATIVE_PATH_RESOURCES'] . '/views/Msg.class.php'; $_SESSION['resources_data'] = @unserialize($_SESSION['resources_data']); if (empty($_SESSION['resources_data'])) { $temp_semester = SemesterData::getCurrentSemesterData() ?: end(SemesterData::getAllSemesterData()); $_SESSION['resources_data'] = array( 'view' => 'search', 'view_mode' => false, 'sem_schedule_semester_id' => $temp_semester['semester_id'], 'sem_schedule_timespan' => 'course_time' ); } $globalPerm = getGlobalPerms($user->id); $msg = new Msg; /***************************************************************************** empfangene Werte auswerten und Befehle ausfuehren /*****************************************************************************/
function in_archiv ($sem_id) { global $SEM_CLASS,$SEM_TYPE, $ARCHIV_PATH, $TMP_PATH, $ZIP_PATH, $ZIP_OPTIONS, $_fullname_sql; NotificationCenter::postNotification('CourseWillArchive', $sem_id); //Besorgen der Grunddaten des Seminars $query = "SELECT Seminar_id, Name, Untertitel, Beschreibung, start_time, Institut_id, status FROM seminare WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id)); $row = $statement->fetch(PDO::FETCH_ASSOC); $seminar_id = $row['Seminar_id']; $name = $row['Name']; $untertitel = $row['Untertitel']; $beschreibung = $row['Beschreibung']; $start_time = $row['start_time']; $heimat_inst_id = $row['Institut_id']; //Besorgen von einzelnen Daten zu dem Seminar $semester = new SemesterData; $all_semester = $semester->getAllSemesterData(); foreach ($all_semester as $sem) { if (($start_time >= $sem['beginn']) && ($start_time <= $sem['ende'])) { $semester_tmp = $sem['name']; } } //Studienbereiche if ($SEM_CLASS[$SEM_TYPE[$row['status']]['class']]['bereiche']) { $sem_path = get_sem_tree_path($seminar_id); if (is_array($sem_path)) { $studienbereiche = join(', ', $sem_path); } } // das Heimatinstitut als erstes $query = "SELECT Name FROM Institute WHERE Institut_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($heimat_inst_id)); $institute = $statement->fetchColumn(); // jetzt den Rest $query = "SELECT Name FROM Institute LEFT JOIN seminar_inst USING (institut_id) WHERE seminar_id = ? AND Institute.Institut_id != ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id, $heimat_inst_id)); while ($temp = $statement->fetchColumn()) { $institute .= ', ' . $temp; } $query = "SELECT GROUP_CONCAT({$_fullname_sql['full']} SEPARATOR ', ') FROM seminar_user LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE seminar_id = ? AND seminar_user.status = 'dozent'"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $dozenten = $statement->fetchColumn(); $query = "SELECT fakultaets_id FROM seminare LEFT JOIN Institute USING (Institut_id) WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $fakultaet_id = $statement->fetchColumn(); $query = "SELECT GROUP_CONCAT(DISTINCT c.Name SEPARATOR ' | ') FROM seminar_inst AS a LEFT JOIN Institute AS b USING (Institut_id) LEFT JOIN Institute AS c ON (c.Institut_id = b.fakultaets_id) WHERE a.seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $fakultaet = $statement->fetchColumn(); setTempLanguage(); // use $DEFAULT_LANGUAGE for archiv-dumps //Dump holen $dump = dump_sem($sem_id, 'nobody'); //Forumdump holen foreach (PluginEngine::getPlugins('ForumModule', $sem_id) as $plugin) { $forumdump .= $plugin->getDump($sem_id); } // Wikidump holen $wikidump = getAllWikiPages($sem_id, $name, FALSE); restoreLanguage(); //OK, naechster Schritt: Kopieren der Personendaten aus seminar_user in archiv_user $query = "INSERT INTO archiv_user (seminar_id, user_id, status) SELECT Seminar_id, user_id, status FROM seminar_user WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); // Eventuelle Vertretungen in der Veranstaltung haben weiterhin Zugriff mit Dozentenrechten if (get_config('DEPUTIES_ENABLE')) { $deputies = getDeputies($seminar_id); // Eintragen ins Archiv mit Zugriffsberechtigung "dozent" $query = "INSERT IGNORE INTO archiv_user SET seminar_id = ?, user_id = ?, status = 'dozent'"; $statement = DBManager::get()->prepare($query); foreach ($deputies as $deputy) { $statement->execute(array($seminar_id, $deputy['user_id'])); } } $Modules = new Modules; $Modules = $Modules->getLocalModules($sem_id); $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $sem_id,'entity_type' => 'sem')); if ($Modules['documents_folder_permissions'] || StudipDocumentTree::ExistsGroupFolders($sem_id)) { $unreadable_folders = $folder_tree->getUnReadableFolders('nobody'); } $query = "SELECT COUNT(dokument_id) FROM dokumente WHERE seminar_id = ? AND url = ''"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $count = $statement->fetchColumn(); if ($count) { $hash_secret = "frauen"; $archiv_file_id = md5(uniqid($hash_secret,1)); //temporaeres Verzeichnis anlegen $tmp_full_path = "$TMP_PATH/$archiv_file_id"; mkdir($tmp_full_path, 0700); if($folder_tree->getNumKids('root')) { $list = $folder_tree->getKids('root'); } if (is_array($list) && count($list) > 0) { $query = "SELECT folder_id, name FROM folder WHERE range_id IN (?) ORDER BY name"; $statement = DBManager::get()->prepare($query); $statement->execute(array($list)); $folder = 0; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $folder += 1; $temp_folder = $tmp_full_path . "/[$folder]_" . prepareFilename($row['name'], FALSE); mkdir($temp_folder, 0700); createTempFolder($row['folder_id'], $temp_folder, $seminar_id, 'nobody'); } //zip all the stuff $archiv_full_path = "$ARCHIV_PATH/$archiv_file_id"; create_zip_from_directory($tmp_full_path, $tmp_full_path); @rename($tmp_full_path . '.zip', $archiv_full_path); } rmdirr($tmp_full_path); if (is_array($unreadable_folders)) { $query = "SELECT dokument_id FROM dokumente WHERE seminar_id = ? AND url = '' AND range_id IN (?)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id, $unreadable_folders)); $archiv_protected_file_id = createSelectedZip($statement->fetchAll(PDO::FETCH_COLUMN), false, false); @rename("$TMP_PATH/$archiv_protected_file_id", "$ARCHIV_PATH/$archiv_protected_file_id"); } } else { $archiv_file_id = ''; } //Reinschreiben von diversem Klumpatsch in die Datenbank $query = "INSERT INTO archiv (seminar_id, name, untertitel, beschreibung, start_time, semester, heimat_inst_id, institute, dozenten, fakultaet, dump, archiv_file_id,archiv_protected_file_id, forumdump, wikidump, studienbereiche, mkdate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP())"; $statement = DBManager::get()->prepare($query); $success = $statement->execute(array( $seminar_id, $name ?: '', $untertitel ?: '', $beschreibung ?: '', $start_time, $semester_tmp ?: '', $heimat_inst_id, $institute ?: '', $dozenten ?: '', $fakultaet ?: '', $dump ?: '', $archiv_file_id ?: '', $archiv_protected_file_id ?: '', $forumdump ?: '', $wikidump ?: '', $studienbereiche ?: '', )); if ($success) { NotificationCenter::postNotification('CourseDidArchive', $seminar_id); } }
public function getGroupedDates($singledate = null, $metadate = null) { $i = 0; $first_event = FALSE; $semesterData = new SemesterData(); $all_semester = $semesterData->getAllSemesterData(); if (Config::get()->RESOURCES_HIDE_PAST_SINGLE_DATES) { // filtering foreach ($all_semester as $semester) { if ($semester['ende'] > time()) { $new_as[] = $semester; } } $all_semester = $new_as; } if (!$singledate) { foreach ($all_semester as $semester) { foreach ($this->metadate->cycles as $metadate_id => $cycle) { if ($metadate && $metadate_id != $metadate) continue; $group = $cycle->getSingleDates(); $metadate_has_termine = 0; $single = true; foreach ($group as $termin) { if (!$termin->isExTermin() && $termin->getStartTime() >= $semester['beginn'] && $termin->getStartTime() <= $semester['ende'] && (!Config::get()->RESOURCES_HIDE_PAST_SINGLE_DATES || $termin->getStartTime() >= time()) && $termin->isPresence()) { if (empty($first_event)) { $first_event = $termin->getStartTime(); } $groups[$i]["termin_ids"][$termin->getSingleDateId()] = TRUE; $metadate_has_termine = 1; if (empty($info[$i]['raum'])) { $info[$i]['raum'] = $termin->resource_id; } else if ($info[$i]['raum'] != $termin->resource_id) { $single = false; } } } if ($metadate_has_termine) { $info[$i]['name'] = $cycle->toString('long').' ('.$semester['name'].')'; $info[$i]['weekend'] = ($cycle->getDay() == 6 || $cycle->getDay() == 0); $this->applyTimeFilter($semester['beginn'], $semester['ende']); $raum = $this->getDatesTemplate('dates/seminar_predominant_html', array('cycle_id' => $metadate_id)); if ($raum) { $info[$i]['name'] .= '<br> '.$raum; $room_stat = $this->getStatOfNotBookedRooms($cycle->getMetadateId()); $info[$i]['name'] .= sprintf(_(" (%s von %s belegt)"), $room_stat['all'] - $room_stat['open'] , $room_stat['all']); $groups[$i]['complete'] = ($room_stat['all'] - $room_stat['open'] >= sizeof($groups[$i]['termin_ids'])) ? true : false; } if (!$single) unset($info[$i]['raum']); $i++; } } } if (!$metadate) { $irreg = $this->getSingleDates(); if (Config::get()->RESOURCES_HIDE_PAST_SINGLE_DATES) { $anzahl = 0; foreach ($irreg as $termin_id => $termin) { if ($termin->getStartTime() > time() - 3600) { $anzahl++; } } } else { $anzahl = sizeof($irreg); } if ($anzahl > Config::get()->RESOURCES_ALLOW_SINGLE_DATE_GROUPING) { $single = true; $first = true; foreach ($irreg as $termin_id => $termin) { if ($termin->isPresence()) { if (!Config::get()->RESOURCES_HIDE_PAST_SINGLE_DATES || $termin->getStartTime() > time() - 3600) { if (empty($first_event)) { $first_event = $termin->getStartTime(); } $groups[$i]["termin_ids"][$termin->getSingleDateId()] = TRUE; if (!$first) $info[$i]['name'] .= '<br> '; $info[$i]['name'] .= $termin->toString(); $resObj = ResourceObject::Factory($termin->resource_id); if ($link = $resObj->getFormattedLink($termin->getStartTime())) { $info[$i]['name'] .= '<br> '.$link; if (empty($info[$i]['raum'])) { $info[$i]['raum'] = $termin->resource_id; } else if ($info[$i]['raum'] != $termin->resource_id) { $single = false; } } if (date('w', $termin->getStartTime()) == 6 || date('w', $termin->getStartTime()) == 0) { $info[$i]['weekend'] = true; } $first = false; } } } if (!$single) unset($info[$i]['raum']); } else { foreach ($irreg as $termin_id => $termin) { if ($termin->isPresence()) { if (!Config::get()->RESOURCES_HIDE_PAST_SINGLE_DATES || $termin->getStartTime() > time() - 3600) { if (empty($first_event)) { $first_event = $termin->getStartTime(); } $groups[$i]["termin_ids"][$termin->getSingleDateId()] = TRUE; $info[$i]['name'] = $termin->toString(); $resObj = ResourceObject::Factory($termin->resource_id); if ($link = $resObj->getFormattedLink($termin->getStartTime())) { $info[$i]['name'] .= '<br> '.$link; $info[$i]['raum'] = $termin->resource_id; } $info[$i]['weekend'] = (date('w', $termin->getStartTime()) == 6 || date('w', $termin->getStartTime()) == 0); $i++; } } } } } } else { // we have a single date $termin = new SingleDate($singledate); $groups[0]['termin_ids'][$termin->getSingleDateID()] = TRUE; $info[0]['name'] = $termin->toString(); $info[0]['raum'] = $termin->resource_id; $info[0]['weekend'] = (date('w', $termin->getStartTime()) == 6 || date('w', $termin->getStartTime()) == 0); $first_event = $termin->getStartTime(); } return array('first_event' => $first_event, 'groups' => $groups, 'info' => $info); }
<? if (sizeof($dates)) : ?> <table cellspacing="0" cellpadding="0" border="1" width="100%"> <tr> <th colspan="3"> <h2><?php echo htmlReady(PageLayout::getTitle()); ?> </h2> </th> </tr> <? $semester = new SemesterData(); $all_semester = $semester->getAllSemesterData(); foreach ($dates as $date) : if ( ($grenze == 0) || ($grenze < $date['start']) ) { foreach ($all_semester as $zwsem) { if ( ($zwsem['beginn'] < $date['start']) && ($zwsem['ende'] > $date['start']) ) { $grenze = $zwsem['ende']; ?> <tr> <td colspan="3"> <h3><?php echo htmlReady($zwsem['name']); ?> </h3> </td> </tr>
/** * */ function toStringEdit ($post_vars = "", $faulty_values = "", $edit_form = "", $anker = "") { // get semester data $semester = new SemesterData(); $semester_data = $semester->getAllSemesterData(); update_generic_datafields($this->config, $this->data_fields, $this->field_names, "sem"); $out = ""; $table = ""; if ($edit_form == "") $edit_form = new ExternEditModule($this->config, $post_vars, $faulty_values, $anker); $edit_form->setElementName($this->getName()); $element_headline = $edit_form->editElementHeadline($this->real_name, $this->config->getName(), $this->config->getId(), TRUE, $anker); $headline = $edit_form->editHeadline(_("Name der Konfiguration")); $table = $edit_form->editName("name"); $content_table = $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $content_table .= $this->getSRIFormContent($edit_form); $headline = $edit_form->editHeadline(_("Allgemeine Angaben Seitenaufbau")); $title = _("Gruppierung:"); $info = _("Wählen Sie, wie die Veranstaltungen gruppiert werden sollen."); $values = array("0", "1", "2", "3", "4"); $names = array(_("Semester"), _("Bereich"), _("Lehrende"), _("Typ"), _("Einrichtung")); $table = $edit_form->editOptionGeneric("grouping", $title, $info, $values, $names); $title = _("Startsemester:"); $info = _("Geben Sie das erste anzuzeigende Semester an. Die Angaben \"vorheriges\", \"aktuelles\" und \"nächstes\" beziehen sich immer auf das laufende Semester und werden automatisch angepasst."); $current_sem = get_sem_num_sem_browse(); if ($current_sem === FALSE) { $names = array(_("keine Auswahl"), _("aktuelles"), _("nächstes")); $values = array("", "current", "next"); } else if ($current_sem === TRUE) { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles")); $values = array("", "previous", "current"); } else { $names = array(_("keine Auswahl"), _("vorheriges"), _("aktuelles"), "nächstes"); $values = array("", "previous", "current", "next"); } foreach ($semester_data as $sem_num => $sem) { $names[] = $sem["name"]; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric("semstart", $title, $info, $values, $names); $title = _("Anzahl der anzuzeigenden Semester:"); $info = _("Geben Sie an, wieviele Semester (ab o.a. Startsemester) angezeigt werden sollen."); $names = array(_("keine Auswahl")); $values = array(""); $i = 1; foreach ($semester_data as $sem_num => $sem) { $names[] = $i++; $values[] = $sem_num + 1; } $table .= $edit_form->editOptionGeneric("semrange", $title, $info, $values, $names); $title = _("Umschalten des aktuellen Semesters:"); $info = _("Geben Sie an, wieviele Wochen vor Semesterende automatisch auf das nächste Semester umgeschaltet werden soll."); $names = array(_("keine Auswahl"), _("am Semesterende"), _("1 Woche vor Semesterende")); for ($i = 2; $i < 13; $i++) $names[] = sprintf(_("%s Wochen vor Semesterende"), $i); $values = array("", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); $table .= $edit_form->editOptionGeneric("semswitch", $title, $info, $values, $names); $title = _("Veranstaltungen beteiligter Institute anzeigen:"); $info = _("Wählen Sie diese Option, um Veranstaltungen anzuzeigen, bei denen diese Einrichtung als beteiligtes Institut eingetragen ist."); $values = "1"; $names = ""; $table .= $edit_form->editCheckboxGeneric("allseminars", $title, $info, $values, $names); $title = _("Bereichspfad ab Ebene:"); $info = _("Wählen Sie, ab welcher Ebene der Bereichspfad ausgegeben werden soll."); $values = array("1", "2", "3", "4", "5"); $names = array("1", "2", "3", "4", "5"); $table .= $edit_form->editOptionGeneric("rangepathlevel", $title, $info, $values, $names); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Ausgabe bestimmter Veranstaltungsklassen")); $table = ""; unset($names); unset($values); $info = _("Wählen Sie die anzuzeigenden Veranstaltungsklassen aus."); foreach ($GLOBALS["SEM_CLASS"] as $key => $class) { $values[] = $key; $names[] = $class["name"]; } $table = $edit_form->editCheckboxGeneric("semclasses", $names, $info, $values, ""); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Textersetzungen")); $title = _(""Keine Studienbereiche":"); $info = _("Geben Sie einen Text ein, der Angezeigt wird, wenn Lehrveranstaltungen vorliegen, die keinem Bereich zugeordnet sind. Nur wirksam in Gruppierung nach Bereich."); $table = $edit_form->editTextfieldGeneric("textnogroups", $title, $info, 40, 150); $titles = array(_("Semester"), _("Bereich"), _("Lehrende"), _("Typ"), _("Einrichtung")); $info = _("Geben Sie eine Bezeichnung für die entsprechende Gruppierungsart ein."); $table .= $edit_form->editTextfieldGeneric("aliasesgrouping", $titles, $info, 40, 150); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $headline = $edit_form->editHeadline(_("Weitere Angaben")); $title = _("Namensformat:"); $info = _("Wählen Sie, wie Personennamen formatiert werden sollen."); $values = array("", "no_title_short", "no_title", "no_title_rev", "full", "full_rev"); $names = array(_("keine Auswahl"), _("Meyer, P."), _("Peter Meyer"), _("Meyer Peter"), _("Dr. Peter Meyer"), _("Meyer, Peter, Dr.")); $table = $edit_form->editOptionGeneric("nameformat", $title, $info, $values, $names); $title = _("Sprache:"); $info = _("Wählen Sie eine Sprache für die Datumsangaben aus."); $values = array("", "de_DE", "en_GB"); $names = array(_("keine Auswahl"), _("Deutsch"), _("Englisch")); $table .= $edit_form->editOptionGeneric("language", $title, $info, $values, $names); $title = _("Keine Veranstaltungen:"); $info = _("Dieser Text wird an Stelle der Tabelle ausgegeben, wenn keine Veranstaltungen vorhanden sind."); $table .= $edit_form->editTextareaGeneric("nodatatext", $title, $info, 3, 50); $content_table .= $edit_form->editContentTable($headline, $table); $content_table .= $edit_form->editBlankContent(); $submit = $edit_form->editSubmit($this->config->getName(), $this->config->getId(), $this->getName()); $out = $edit_form->editContent($content_table, $submit); $out .= $edit_form->editBlank(); return $element_headline . $out; }