aboutsummaryrefslogtreecommitdiff
path: root/lib/modules
diff options
context:
space:
mode:
authorMurtaza Sultani <sultani@data-quest.de>2024-09-04 14:54:54 +0000
committerJan-Hendrik Willms <tleilax+github@gmail.com>2024-09-05 10:29:12 +0200
commit7ad5a7716339e56e85a8d8873699237d3ce33fb7 (patch)
treec29b4258370958bf4954af99b62ae5cab26ff0c5 /lib/modules
parentaac6bdebd1441af0f6219756f1f504eb60eab214 (diff)
Resolve "OER: Besser zurück Typ der Methode (oerModuleIntegrateMaterialToCourse())"
Closes #4561 Merge request studip/studip!3373
Diffstat (limited to 'lib/modules')
-rw-r--r--lib/modules/CoreDocuments.class.php31
-rw-r--r--lib/modules/OERModule.php4
2 files changed, 19 insertions, 16 deletions
diff --git a/lib/modules/CoreDocuments.class.php b/lib/modules/CoreDocuments.class.php
index 2acfeef..3f6de68 100644
--- a/lib/modules/CoreDocuments.class.php
+++ b/lib/modules/CoreDocuments.class.php
@@ -12,11 +12,8 @@
class CoreDocuments extends CorePlugin implements StudipModule, OERModule
{
-
/**
- * Determines if the StudipModule wants to handle the OERMaterial. Returns false if not.
- * @param OERMaterial $material
- * @return false|Icon
+ * {@inheritdoc}
*/
static public function oerModuleWantsToUseMaterial(OERMaterial $material)
{
@@ -24,9 +21,7 @@ class CoreDocuments extends CorePlugin implements StudipModule, OERModule
}
/**
- * Returns an Icon class object with the given role.
- * @param string $role
- * @return null|Icon
+ * {@inheritdoc}
*/
public function oerGetIcon($role = Icon::ROLE_CLICKABLE)
{
@@ -34,11 +29,7 @@ class CoreDocuments extends CorePlugin implements StudipModule, OERModule
}
/**
- * This function is triggered i a user chose to use this module as the target of the oermaterial.
- * Now this module should put a copy of $material in its own area of the given course.
- * @param OERMaterial $material
- * @param Course $course
- * @return array|FileType
+ * {@inheritdoc}
*/
static public function oerModuleIntegrateMaterialToCourse(OERMaterial $material, Course $course)
{
@@ -89,12 +80,24 @@ class CoreDocuments extends CorePlugin implements StudipModule, OERModule
if (!$newfile) {
return [_('Daten konnten nicht kopiert werden!')];
}
- return $newfile;
+
+ return [
+ 'type' => 'success',
+ 'message' => _('Das Lernmaterial wurde kopiert.'),
+ 'message_detail' => [],
+ 'redirect_url' => URLHelper::getURL('dispatch.php/course/files', ['cid' => $course->id])
+ ];
} else {
if ($tmp_name) {
@unlink($tmp_name);
}
- return [_('Daten konnten nicht kopiert werden!')];
+
+ return [
+ 'type' => 'error',
+ 'message' => _('Beim Kopieren ist ein Fehler aufgetaucht.'),
+ 'message_detail' => [_('Daten konnten nicht kopiert werden!')],
+ 'redirect_url' => URLHelper::getURL('dispatch.php/oer/market/details/' . $material->id)
+ ];
}
}
diff --git a/lib/modules/OERModule.php b/lib/modules/OERModule.php
index 6cc8909..4e71ebe 100644
--- a/lib/modules/OERModule.php
+++ b/lib/modules/OERModule.php
@@ -5,7 +5,7 @@ interface OERModule
/**
* Determines if the StudipModule wants to handle the OERMaterial. Returns false if not.
* @param OERMaterial $material
- * @return false|Icon
+ * @return false
*/
public static function oerModuleWantsToUseMaterial(OERMaterial $material);
@@ -14,7 +14,7 @@ interface OERModule
* Now this module should put a copy of $material in its own area of the given course.
* @param OERMaterial $material
* @param Course $course
- * @return void
+ * @return array
*/
public static function oerModuleIntegrateMaterialToCourse(OERMaterial $material, Course $course);