public function check($data, $virtualobject, $relevantfields) { $errors = ""; if (!$data['fleximport_dozenten'] || !count($data['fleximport_dozenten'])) { $errors .= "Dozent kann nicht gemapped werden. "; } else { $exist = false; foreach ((array) $data['fleximport_dozenten'] as $dozent_id) { if (User::find($dozent_id)) { $exist = true; break; } } if (!$exist) { $errors .= "Angegebene Dozenten sind nicht im System vorhanden. "; } else { if ($GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$virtualobject['status']]['class']]['only_inst_user']) { $statement = DBManager::get()->prepare("\n SELECT 1\n FROM user_inst\n WHERE user_id IN (:dozent_ids)\n AND Institut_id IN (:institut_ids)\n AND inst_perms IN ('autor','tutor','dozent')\n "); $statement->execute(array('dozent_ids' => (array) $data['fleximport_dozenten'], 'institut_ids' => $data['fleximport_related_institutes'] ?: array($virtualobject['institut_id']))); if (!$statement->fetch(PDO::FETCH_COLUMN, 0)) { $errors .= "Keiner der Dozenten ist in einer beteiligten Einrichtung angestellt. "; } } } } if (!$data['institut_id'] || !Institute::find($data['institut_id'])) { $errors .= "Keine gültige Heimateinrichtung. "; } if (!Semester::findByTimestamp($data['start_time'])) { $errors .= "Semester wurde nicht gefunden. "; } if ($data['status']) { if ($GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$data['status']]['class']]['bereiche']) { $found = false; foreach ((array) $data['fleximport_studyarea'] as $sem_tree_id) { if (StudipStudyArea::find($sem_tree_id)) { $found = true; break; } } if (!$found) { $errors .= "Keine (korrekten) Studienbereiche definiert. "; } } } else { $errors .= "Kein Veranstaltungstyp definiert. "; } return $errors; }
/** * This method adds an area to the selected study areas. * * @param string the MD5ish ID of the study area to add * * @return object this instance */ function add($area) { # convert to an object if (!is_object($area)) { $area = StudipStudyArea::find($area); } $id = $area->getID(); if (!isset($this->areas[$id])) { $this->areas[$id] = $area; } $this->sortAreas(); return $this; }
/** * Returns the name of the study area for the id found in the given * field or the id if the study area is unknown. * * @param string $field The name of the table field. * @return string The name of seminar or the id. */ protected function formatStudyarea($field) { $study_area = StudipStudyArea::find($this->{$field}); if (!$study_area) { return $this->{$field}; } return '<em>' . $study_area->getPath(' > ') . '</em>'; }
public function getAncestorTree($id) { $result = array(); $node = StudipStudyArea::find($id); $root = StudipStudyArea::backwards(array($node)); $result = $this->buildPartialSemTree($root); return json_encode($result); }