/** * set connection * * sets connection with seminar * @access public * @param string $seminar_id seminar-id * @return boolean successful */ function setConnection($seminar_id) { global $connected_cms, $messages; $write_permission = Request::option("write_permission"); $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type); $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false); $connected_cms[$this->cms_type]->soap_client->clearCache(); // Check, ob Kurs in ILIAS gelöscht wurde if ($crs_id != false and $connected_cms[$this->cms_type]->soap_client->getObjectByReference($crs_id) == false) { ObjectConnections::unsetConnection($seminar_id, $crs_id, "crs", $this->cms_type); $messages["info"] .= _("Der zugeordnete ILIAS-Kurs (ID {$crs_id}) existiert nicht mehr. Ein neuer Kurs wird angelegt.") . "<br>"; $crs_id = false; } $crs_id == $connected_cms[$this->cms_type]->createCourse($seminar_id); if ($crs_id == false) { return false; } $ref_id = $this->getId(); if (Request::get("copy_object") == "1") { $connected_cms[$this->cms_type]->soap_client->user_type = 'user'; $ref_id = $connected_cms[$this->cms_type]->soap_client->copyObject($this->id, $crs_id); $connected_cms[$this->cms_type]->soap_client->user_type = 'admin'; } else { $ref_id = $connected_cms[$this->cms_type]->soap_client->addReference($this->id, $crs_id); } if (!$ref_id) { $messages["error"] .= _("Zuordnungs-Fehler: Objekt konnte nicht angelegt werden."); return false; } $local_roles = $connected_cms[$this->cms_type]->soap_client->getLocalRoles($crs_id); $member_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ)); $admin_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE, OPERATION_DELETE)); $admin_operations_no_delete = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE)); $admin_operations_readonly = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_DELETE)); foreach ($local_roles as $key => $role_data) { // check only if local role is il_crs_member, -tutor or -admin if (strpos($role_data["title"], "il_crs_") === 0) { if (strpos($role_data["title"], 'il_crs_member') === 0) { $operations = $write_permission == "autor" ? $admin_operations_no_delete : $member_operations; } elseif (strpos($role_data["title"], 'il_crs_tutor') === 0) { $operations = $write_permission == "tutor" || $write_permission == "autor" ? $admin_operations : $admin_operations_readonly; } elseif (strpos($role_data["title"], 'il_crs_admin') === 0) { $operations = $write_permission == "dozent" || $write_permission == "tutor" || $write_permission == "autor" ? $admin_operations : $admin_operations_readonly; } else { continue; } $connected_cms[$this->cms_type]->soap_client->revokePermissions($role_data["obj_id"], $ref_id); $connected_cms[$this->cms_type]->soap_client->grantPermissions($operations, $role_data["obj_id"], $ref_id); } } if ($ref_id) { $this->setId($ref_id); return ContentModule::setConnection($seminar_id); } else { $messages["error"] .= _("Die Zuordnung konnte nicht gespeichert werden."); } return false; }
function getTabNavigation($course_id) { if (get_config('ELEARNING_INTERFACE_ENABLE')) { $navigation = new Navigation(_('Lernmodule')); $navigation->setImage(Icon::create('learnmodule', 'info_alt')); $navigation->setActiveImage(Icon::create('learnmodule', 'info')); if (ObjectConnections::isConnected($course_id)) { $elearning_nav = new Navigation(_('Lernmodule dieser Veranstaltung'), 'dispatch.php/course/elearning/show?seminar_id=' . $course_id); if ($sem_class == 'inst') { $elearning_nav->setTitle(_('Lernmodule dieser Einrichtung')); } $navigation->addSubNavigation('show', $elearning_nav); } if ($GLOBALS['perm']->have_studip_perm('tutor', $_SESSION['SessionSeminar'])) { $navigation->addSubNavigation('edit', new Navigation(_('Lernmodule hinzufügen / entfernen'), 'dispatch.php/course/elearning/edit?seminar_id=' . $course_id)); } return array('elearning' => $navigation); } else { return null; } }
function deleteConnectedModules($object_id) { return ObjectConnections::DeleteAllConnections($object_id, $this->cms_type); }
function moduleElearning_interfaceDeactivate($range_id) { global $connected_cms; foreach (ObjectConnections::GetConnectedSystems($range_id) as $system) { ELearningUtils::loadClass($system); $connected_cms[$system]->deleteConnectedModules($range_id); } }
/** * unset connection * * unsets connection with seminar * @access public * @param string $seminar_id seminar-id * @return boolean successful */ function unsetConnection($seminar_id) { $this->is_connected = false; return ObjectConnections::unsetConnection($seminar_id, $this->id, $this->module_type, $this->cms_type); }
/** * Displays a page. */ public function edit_action($id = null) { global $connected_cms, $current_module; if (!$this->rechte) { throw new AccessDeniedException(_('Keine Berechtigung zum Bearbeiten der Lernmodul-Verknüpfungen.')); } Navigation::activateItem('/course/elearning/edit'); $GLOBALS['view'] = 'edit'; // ggf. neuen Ilias4-Kurs anlegen if (Request::submitted('create_course') and $this->rechte) { ELearningUtils::loadClass($this->cms_select); if (method_exists($connected_cms[$this->cms_select], "createCourse")) { if ($connected_cms[$this->cms_select]->createCourse($this->seminar_id)) { PageLayout::postMessage(MessageBox::info(_('Kurs wurde angelegt.'))); } } } // ggf. bestehenden Ilias4-Kurs zuordnen if (Request::submitted('connect_course')) { if (ObjectConnections::getConnectionModuleId(Request::option("connect_course_sem_id"), "crs", $this->cms_select) and $GLOBALS['perm']->have_studip_perm("dozent", Request::option("connect_course_sem_id"))) { ObjectConnections::setConnection($this->seminar_id, ObjectConnections::getConnectionModuleId(Request::option("connect_course_sem_id"), "crs", $this->cms_select), "crs", $this->cms_select); PageLayout::postMessage(MessageBox::info(_('Zuordnung wurde gespeichert.'))); ELearningUtils::loadClass($this->cms_select); if (method_exists($connected_cms[$this->cms_select], "updateConnections")) { $connected_cms[$this->cms_select]->updateConnections(ObjectConnections::getConnectionModuleId(Request::option("connect_course_sem_id"), "crs", $this->cms_select)); } } } // Zugeordnete Ilias-Kurse ermitteln und ggf. aktualisieren $this->course_output = ELearningUtils::getIliasCourses($this->seminar_id); if ($this->new_account_cms == "") { if ($this->module_system_type != "") { $user_crs_role = $connected_cms[$this->module_system_type]->crs_roles[$GLOBALS['auth']->auth["perm"]]; ELearningUtils::loadClass($this->module_system_type); } if (Request::submitted('remove')) { $connected_cms[$this->module_system_type]->newContentModule($this->module_id, $this->module_type, true); if ($connected_cms[$this->module_system_type]->content_module[$this->module_id]->unsetConnection($this->seminar_id, $this->module_id, $this->module_type, $this->module_system_type)) { PageLayout::postMessage(MessageBox::info(_('Die Zuordnung wurde entfernt.'))); } unset($connected_cms[$this->module_system_type]->content_module[$this->module_id]); } elseif (Request::submitted('add')) { $connected_cms[$this->module_system_type]->newContentModule($this->module_id, $this->module_type, true); if ($connected_cms[$this->module_system_type]->content_module[$this->module_id]->setConnection($this->seminar_id)) { PageLayout::postMessage(MessageBox::info(_('Die Zuordnung wurde gespeichert.'))); } unset($connected_cms[$this->module_system_type]->content_module[$this->module_id]); } if ($this->search_key != "") { ELearningUtils::loadClass($this->cms_select); if (strlen(trim($this->search_key)) > 2) { $searchresult_content_modules = $connected_cms[$this->cms_select]->searchContentModules($this->search_key); } else { PageLayout::postMessage(MessageBox::error(_('Jeder Suchbegriff muss mindestens 3 Zeichen lang sein!'))); } } } //Instanz mit den Zuordnungen von Content-Modulen zur Veranstaltung $object_connections = new ObjectConnections($this->seminar_id); $connected_modules = $object_connections->getConnections(); $this->module_count = 0; $content_modules_list = array(); $user_modules_list = array(); $search_modules_list = array(); if ($object_connections->isConnected()) { $caching_active = true; foreach ($connected_modules as $key => $connection) { if (ELearningUtils::isCMSActive($connection["cms"])) { ELearningUtils::loadClass($connection["cms"]); $connected_cms[$connection["cms"]]->newContentModule($connection["id"], $connection["type"], true); $connected_modules[$key]['title'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getTitle(); $title_tmp[$key] = str_replace(array('ä', 'ö', 'ü', 'ß'), array('ae', 'oe', 'ue', 'ss'), strtolower($connected_modules[$key]['title'])); $type_tmp[$key] = array_search($connection['type'], array_keys($GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]['types'])); $class_tmp[$key] = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$connection["cms"]]["CLASS_PREFIX"]; } } array_multisort($class_tmp, SORT_ASC, $type_tmp, SORT_ASC, $title_tmp, SORT_ASC, $connected_modules); foreach ($connected_modules as $index => $connection) { $current_module = $connection["id"]; if ($this->module_count == 0) { $content_modules_list[$index]['show_header'] = true; } $this->module_count++; $this->module_system_count[$connection["cms"]]++; if ($this->open_all != "") { $_SESSION['elearning_open_close'][$connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getReferenceString()] = true; } elseif ($this->close_all != "") { $_SESSION['elearning_open_close'][$connected_cms[$connection["cms"]]->content_module[$connection["id"]]->getReferenceString()] = false; } $content_modules_list[$index]['module'] = $connected_cms[$connection["cms"]]->content_module[$connection["id"]]->view->showAdmin(); } } if ($this->module_count == 0 and $this->new_account_cms == "") { if ($_SESSION['SessSemName']['class'] == 'inst') { PageLayout::postMessage(MessageBox::info(_('Momentan sind dieser Einrichtung keine Lernmodule zugeordnet.'))); } else { PageLayout::postMessage(MessageBox::info(_('Momentan sind dieser Veranstaltung keine Lernmodule zugeordnet.'))); } } $this->caching_active = false; if (isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_select]["name"])) { ELearningUtils::loadClass($this->cms_select); $user_content_modules = $connected_cms[$this->cms_select]->getUserContentModules(); if (!($user_content_modules == false)) { foreach ($user_content_modules as $key => $connection) { // show only those modules which are not already connected to the seminar if (is_object($connected_cms[$this->cms_select]->content_module[$connection["ref_id"]])) { continue; } $connected_cms[$this->cms_select]->setContentModule($connection, false); $connected_cms[$this->cms_select]->content_module[$current_module]->view->showAdmin(); $user_modules_list[$key]['module'] = $connected_cms[$this->cms_select]->content_module[$current_module]->view->showAdmin(); } } if (!$connected_cms[$this->cms_select]->isAuthNecessary() || $connected_cms[$this->cms_select]->user->isConnected()) { $this->show_search = true; } if (!($searchresult_content_modules == false)) { foreach ($searchresult_content_modules as $key => $connection) { // show only those modules which are not already connected to the seminar if (is_object($connected_cms[$this->cms_select]->content_module[$connection["ref_id"]])) { continue; } $connected_cms[$this->cms_select]->setContentModule($connection, false); $search_modules_list[$key]['module'] = $connected_cms[$this->cms_select]->content_module[$current_module]->view->showAdmin(); } } // ILIAS 4: Leeren Kurs anlegen oder Kurse von anderen Veranstaltungen zuordnen if (method_exists($connected_cms[$this->cms_select], "updateConnections") and !$this->module_system_count[$this->cms_select] and !ObjectConnections::getConnectionModuleId($this->seminar_id, "crs", $this->cms_select)) { $show_ilias_empty_course = true; if ($GLOBALS['perm']->have_perm('root')) { $query = "SELECT DISTINCT object_id, module_id, Name\n FROM object_contentmodules\n LEFT JOIN seminare ON (object_id = Seminar_id)\n WHERE module_type = 'crs' AND system_type = ?"; } else { $query = "SELECT DISTINCT object_id, module_id, Name\n FROM object_contentmodules\n LEFT JOIN seminare ON (object_id = Seminar_id)\n LEFT JOIN seminar_user USING (Seminar_id)\n WHERE module_type = 'crs' AND system_type = ? AND seminar_user.status = 'dozent'"; } $statement = DBManager::get()->prepare($query); $statement->execute(array($this->cms_select)); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { if ($GLOBALS['perm']->have_studip_perm('dozent', $row['object_id'])) { $existing_courses[$row['object_id']] = my_substr($row['Name'], 0, 60) . " " . sprintf(_("(Kurs-ID %s)"), $row['module_id']); } } } elseif (method_exists($connected_cms[$this->cms_select], "updateConnections") and count($connected_cms[$this->cms_select]->types['webr'])) { $this->show_ilias_link_info = true; $crs_data = ObjectConnections::getConnectionModuleId($this->seminar_id, "crs", $this->cms_select); } } // Cachen der SOAP-Daten if (is_array($connected_cms)) { foreach ($connected_cms as $system) { $system->terminate(); } } $widget = new ActionsWidget(); if (count($this->course_output['courses'])) { $widget->addLink(_('Zuordnungen aktualisieren'), URLHelper::getURL('?view=edit&cms_select=' . $this->cms_select . '&update=1'), Icon::create('refresh', 'clickable')); } $this->sidebar->addWidget($widget); $this->new_account = $this->new_account_cms; $this->is_inst = $_SESSION['SessSemName']['class'] == 'inst'; if ($this->cms_select) { $this->cms_name = $connected_cms[$this->cms_select]->getName(); $this->cms_logo = $connected_cms[$this->cms_select]->getLogo(); $this->user_modules = $user_modules_list; $this->search_modules = $search_modules_list; $this->existing_courses = $existing_courses; $this->show_ilias_empty_course = $show_ilias_empty_course; } $this->content_modules = $content_modules_list; }
duration_time, start_time, art, Institut_id FROM seminare WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($_SESSION['archiv_assi_data']['sems'][$_SESSION['archiv_assi_data']['pos']]['id'])); $seminar = $statement->fetch(PDO::FETCH_ASSOC); $msg['info'] .= _("Sie sind im Begriff, die untenstehende Veranstaltung zu archivieren. Dieser Schritt kann nicht rückgängig gemacht werden!"); // check is Veranstaltung running if ($seminar['duration_time'] == -1) { $msg['info'] .= _("Das Archivieren könnte unter Umständen nicht sinnvoll sein, da es sich um eine dauerhafte Veranstaltung handelt."); } elseif (time() < $seminar['start_time'] + $seminar['duration_time']) { $msg['info'] .= _("Das Archivieren könnte unter Umständen nicht sinnvoll sein, da das oder die Semester, in denen die Veranstaltung stattfindet, noch nicht verstrichen sind."); } if (Config::get()->ELEARNING_INTERFACE_ENABLE) { $cms_types = ObjectConnections::GetConnectedSystems($_SESSION['archiv_assi_data']["sems"][$_SESSION['archiv_assi_data']["pos"]]["id"]); if (count($cms_types)) { $msg['info'] .= sprintf(_("Die Veranstaltung besitzt verknüpfte Inhalte in %s externen Systemen (%s). Diese verknüpften Inhalte werden durch die Archivierung gelöscht!"), count($cms_types), join(',', $cms_types)); } } ?> <body> <? if ($messages) : ?> <? foreach ($messages as $type => $message_data) : ?> <?= MessageBox::$type($message_data['title'], $message_data['details']) ?> <? endforeach ?> <? endif ?> <? if (!empty($msg)) : ?> <? foreach ($msg as $type => $message) : ?> <?= MessageBox::$type($message) ?>
/** * Deletes the current seminar * * @return void returns success-message if seminar could be deleted * otherwise an error-message */ public function delete() { $s_id = $this->id; // Delete that Seminar. // Alle Benutzer aus dem Seminar rauswerfen. $query = "DELETE FROM seminar_user WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Teilnehmende und Lehrende archiviert."), $db_ar)); } // Alle Benutzer aus Wartelisten rauswerfen $query = "DELETE FROM admission_seminar_user WHERE seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); // Alle beteiligten Institute rauswerfen $query = "DELETE FROM seminar_inst WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Zuordnungen zu Einrichtungen archiviert."), $db_ar)); } // user aus den Statusgruppen rauswerfen $count = DeleteAllStatusgruppen($s_id); if ($count > 0) { $this->createMessage(_("Einträge aus Funktionen / Gruppen gelöscht.")); } // Alle Eintraege aus dem Vorlesungsverzeichnis rauswerfen $db_ar = StudipSemTree::DeleteSemEntries(null, $s_id); if ($db_ar > 0) { $this->createMessage(sprintf(_("%s Zuordnungen zu Bereichen archiviert."), $db_ar)); } // Alle Termine mit allem was dranhaengt zu diesem Seminar loeschen. if (($db_ar = SingleDateDB::deleteAllDates($s_id)) > 0) { $this->createMessage(sprintf(_("%s Veranstaltungstermine archiviert."), $db_ar)); } //Themen IssueDB::deleteAllIssues($s_id); //Cycles SeminarCycleDate::deleteBySQL('seminar_id = ' . DBManager::get()->quote($s_id)); // Alle weiteren Postings zu diesem Seminar in den Forums-Modulen löschen foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $plugin->deleteContents($s_id); // delete content irrespective of plugin-activation in the seminar if ($plugin->isActivated($s_id)) { // only show a message, if the plugin is activated, to not confuse the user $this->createMessage(sprintf(_('Einträge in %s archiviert.'), $plugin->getPluginName())); } } // Alle Dokumente zu diesem Seminar loeschen. if (($db_ar = delete_all_documents($s_id)) > 0) { $this->createMessage(sprintf(_("%s Dokumente und Ordner archiviert."), $db_ar)); } // Freie Seite zu diesem Seminar löschen $query = "DELETE FROM scm WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(_("Freie Seite der Veranstaltung archiviert.")); } // delete literatur $del_lit = StudipLitList::DeleteListsByRange($s_id); if ($del_lit) { $this->createMessage(sprintf(_("%s Literaturlisten archiviert."),$del_lit['list'])); } // Alle News-Verweise auf dieses Seminar löschen if ( ($db_ar = StudipNews::DeleteNewsRanges($s_id)) ) { $this->createMessage(sprintf(_("%s Ankündigungen gelöscht."), $db_ar)); } //delete entry in news_rss_range StudipNews::UnsetRssId($s_id); //kill the datafields DataFieldEntry::removeAll($s_id); //kill all wiki-pages $query = "DELETE FROM wiki WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_wiki = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Wiki-Seiten archiviert."), $db_wiki)); } $query = "DELETE FROM wiki_links WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); $query = "DELETE FROM wiki_locks WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); // kill all the ressources that are assigned to the Veranstaltung (and all the linked or subordinated stuff!) if (Config::get()->RESOURCES_ENABLE) { $killAssign = new DeleteResourcesUser($s_id); $killAssign->delete(); if ($rr = RoomRequest::existsByCourse($s_id)) { RoomRequest::find($rr)->delete(); } } // kill virtual seminar-entries in calendar $query = "DELETE FROM schedule_seminare WHERE seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if(get_config('ELEARNING_INTERFACE_ENABLE')){ global $connected_cms; $del_cms = 0; $cms_types = ObjectConnections::GetConnectedSystems($s_id); if(count($cms_types)){ foreach($cms_types as $system){ ELearningUtils::loadClass($system); $del_cms += $connected_cms[$system]->deleteConnectedModules($s_id); } $this->createMessage(sprintf(_("%s Verknüpfungen zu externen Systemen gelöscht."), $del_cms )); } } //kill the object_user_vists for this seminar object_kill_visits(null, $s_id); // Logging... $query = "SELECT CONCAT(seminare.VeranstaltungsNummer, ' ', seminare.name, '(', semester_data.name, ')') FROM seminare LEFT JOIN semester_data ON (seminare.start_time = semester_data.beginn) WHERE seminare.Seminar_id='$s_id'"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); $semlogname = $statement->fetchColumn() ?: sprintf('unknown sem_id: %s', $s_id); StudipLog::log("SEM_ARCHIVE",$s_id,NULL,$semlogname); // ...logged // delete deputies if necessary deleteAllDeputies($s_id); UserDomain::removeUserDomainsForSeminar($s_id); AutoInsert::deleteSeminar($s_id); //Anmeldeset Zordnung entfernen $cs = $this->getCourseSet(); if ($cs) { CourseSet::removeCourseFromSet($cs->getId(), $this->getId()); $cs->load(); if (!count($cs->getCourses()) && $cs->isGlobal() && $cs->getUserid() != '') { $cs->delete(); } } AdmissionPriority::unsetAllPrioritiesForCourse($this->getId()); // und das Seminar loeschen. $this->course->delete(); $this->restore(); return true; }
function deleteConnectedModules($object_id) { global $connected_cms; $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false); $connected_cms[$this->cms_type]->soap_client->clearCache(); $connected_cms[$this->cms_type]->soap_client->user_type == "admin"; $crs_id = ObjectConnections::getConnectionModuleId($object_id, "crs", $this->cms_type); if ($crs_id && $connected_cms[$this->cms_type]->soap_client->checkReferenceById($crs_id)) { $connected_cms[$this->cms_type]->soap_client->deleteObject($crs_id); } return parent::deleteConnectedModules($object_id); }
/** * create course * * creates new ilias course * @access public * @param string $seminar_id seminar-id * @return boolean successful */ function createCourse($seminar_id) { global $messages, $SessSemName, $DEFAULT_LANGUAGE, $ELEARNING_INTERFACE_MODULES; $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type); $this->soap_client->setCachingStatus(false); $this->soap_client->clearCache(); if ($crs_id == false) { $seminar = Seminar::getInstance($seminar_id); $home_institute = Institute::find($seminar->getInstitutId()); if ($home_institute) { $ref_id = ObjectConnections::getConnectionModuleId($home_institute->getId(), "cat", $this->cms_type); } if ($ref_id < 1) { // Kategorie für Heimateinrichtung anlegen $object_data["title"] = sprintf("%s", $home_institute->name); $object_data["description"] = sprintf(_("Hier befinden sich die Veranstaltungsdaten zur Stud.IP-Einrichtung \"%s\"."), $home_institute->name); $object_data["type"] = "cat"; $object_data["owner"] = $this->soap_client->LookupUser($ELEARNING_INTERFACE_MODULES[$this->cms_type]["soap_data"]["username"]); $ref_id = $this->soap_client->addObject($object_data, $this->main_category_node_id); ObjectConnections::setConnection($home_institute->getId(), $ref_id, "cat", $this->cms_type); } if ($ref_id < 1) { $ref_id = $this->main_category_node_id; } // Kurs anlegen $lang_array = explode("_", $DEFAULT_LANGUAGE); $course_data["language"] = $lang_array[0]; $course_data["title"] = "Stud.IP-Kurs " . $seminar->getName(); $course_data["description"] = ""; $crs_id = $this->soap_client->addCourse($course_data, $ref_id); if ($crs_id == false) { $messages["error"] .= _("Zuordnungs-Fehler: Kurs konnte nicht angelegt werden."); return false; } ObjectConnections::setConnection($seminar_id, $crs_id, "crs", $this->cms_type); // Rollen zuordnen $this->permissions->CheckUserPermissions($crs_id); } return $crs_id; }
/** * set connection * * sets connection with seminar * @access public * @param string $seminar_id seminar-id * @return boolean successful */ function setConnection($seminar_id) { global $connected_cms, $messages, $SessSemName, $DEFAULT_LANGUAGE; $write_permission = Request::option("write_permission"); $write_permission_autor = Request::option("write_permission_autor"); $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type); // echo "SET?".$this->cms_type; $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false); $connected_cms[$this->cms_type]->soap_client->clearCache(); // Check, ob Kurs in ILIAS gelöscht wurde if ($crs_id != false and $connected_cms[$this->cms_type]->soap_client->getObjectByReference($crs_id) == false) { ObjectConnections::unsetConnection($seminar_id, $crs_id, "crs", $this->cms_type); // echo "deleted: ".ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type); // echo "Der zugeordnete ILIAS-Kurs (ID $crs_id) existiert nicht mehr. Ein neuer Kurs wird angelegt."; $messages["info"] .= _("Der zugeordnete ILIAS-Kurs (ID {$crs_id}) existiert nicht mehr. Ein neuer Kurs wird angelegt.") . "<br>"; $crs_id = false; } if ($crs_id == false) { $lang_array = explode("_", $DEFAULT_LANGUAGE); $course_data["language"] = $lang_array[0]; $course_data["title"] = "Stud.IP-Kurs " . $SessSemName[0]; $course_data["description"] = ""; $ref_id = $connected_cms[$this->cms_type]->main_category_node_id; $crs_id = $connected_cms[$this->cms_type]->soap_client->addCourse($course_data, $ref_id); if ($crs_id == false) { $messages["error"] .= _("Zuordnungs-Fehler: Kurs konnte nicht angelegt werden."); return false; } ObjectConnections::setConnection($seminar_id, $crs_id, "crs", $this->cms_type); // Rollen zuordnen $connected_cms[$this->cms_type]->permissions->CheckUserPermissions($crs_id); // $messages["info"] .= "Neue Kurs-ID: $crs_id. <br>"; } $ref_id = $this->getId(); $ref_id = $connected_cms[$this->cms_type]->soap_client->addReference($this->id, $crs_id); $local_roles = $connected_cms[$this->cms_type]->soap_client->getLocalRoles($crs_id); $member_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ)); $admin_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE)); foreach ($local_roles as $key => $role_data) { // check only if local role is il_crs_member, -tutor or -admin if (strpos($role_data["title"], "il_crs_") === 0) { if (strpos($role_data["title"], 'il_crs_member') === 0) { $operations = $write_permission_autor ? $admin_operations : $member_operations; } else { if (strpos($role_data["title"], 'il_crs_tutor') === 0) { $operations = $write_permission_autor || $write_permission ? $admin_operations : $member_operations; } else { continue; } } $connected_cms[$this->cms_type]->soap_client->revokePermissions($role_data["obj_id"], $ref_id); $connected_cms[$this->cms_type]->soap_client->grantPermissions($operations, $role_data["obj_id"], $ref_id); } } if ($ref_id) { $this->setId($ref_id); return parent::setConnection($seminar_id); } else { $messages["error"] .= _("Die Zuordnung konnte nicht gespeichert werden."); } return false; }