/** * common tasks for all actions */ function before_filter(&$action, &$args) { global $perm; parent::before_filter($action, $args); if (Request::get('termin_id')) { $this->dates[0] = new SingleDate(Request::option('termin_id')); $this->course_id = $this->dates[0]->range_id; } if (Request::get('issue_id')) { $this->issue_id = Request::option('issue_id'); $this->dates = array_values(array_map(function ($data) { $d = new SingleDate(); $d->fillValuesFromArray($data); return $d; }, IssueDB::getDatesforIssue(Request::option('issue_id')))); $this->course_id = $this->dates[0]->range_id; } if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) { throw new Trails_Exception(400); } PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen"); PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _("Veranstaltungstermine absagen")); $this->set_content_type('text/html;charset=windows-1252'); if (Request::isXhr()) { $this->set_layout(null); $this->response->add_header('X-Title', PageLayout::getTitle()); $request = Request::getInstance(); foreach ($request as $key => $value) { $request[$key] = studip_utf8decode($value); } } }
public function &getSingleDates($filter = false, $force = false, $include_deleted_dates = false) { $this->readSingleDates($force, $filter); if (!$include_deleted_dates) { return $this->irregularSingleDates; } else { $deleted_dates = array(); foreach (SeminarDB::getDeletedSingleDates($this->getId(), $this->filterStart, $this->filterEnd) as $val) { $termin = new SingleDate(); $termin->fillValuesFromArray($val); $deleted_dates[$val['termin_id']] = $termin; } $dates = array_merge($this->irregularSingleDates, $deleted_dates); uasort($dates, function($a,$b) { if ($a->getStartTime() == $b->getStartTime()) return 0; return $a->getStartTime() < $b->getStartTime() ? -1 : 1;} ); return $dates; } }
/** * load corresponding single dates from database * give timestamps as params to filter by time range * * @param int $start * @param int $end * @return boolean */ function readSingleDates($start = 0, $end = 0) { $this->termine = array(); $termin_data = CycleDataDB::getTermine($this->metadate_id, $start, $end); if ($termin_data) { foreach ($termin_data as $val) { unset($termin); $termin = new SingleDate(); $termin->fillValuesFromArray($val); $termin->setExTermin($val['ex_termin']); $this->termine[$val['termin_id']] = $termin; } return TRUE; } return FALSE; }