aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRasmus Fuhse <fuhse@data-quest.de>2023-04-14 14:43:13 +0000
committerRasmus Fuhse <fuhse@data-quest.de>2023-04-14 14:43:13 +0000
commit64eea6377fdf7a9e89a3acabaafc58c6e1e14877 (patch)
treee6dac9aab62425c32c7d05c27ea9006c2b374abf /app
parent945bac517bab5888f759e53d491b9bd17c4c851d (diff)
Resolve "Materialien von anderen Servern nicht zugreifbar"
Closes #2542 Merge request studip/studip!1718
Diffstat (limited to 'app')
-rw-r--r--app/controllers/oer/endpoints.php13
-rw-r--r--app/controllers/oer/market.php6
-rw-r--r--app/views/oer/market/profile.php6
-rw-r--r--app/views/oer/mymaterial/_material_list.php6
4 files changed, 19 insertions, 12 deletions
diff --git a/app/controllers/oer/endpoints.php b/app/controllers/oer/endpoints.php
index 448565d..30c9716 100644
--- a/app/controllers/oer/endpoints.php
+++ b/app/controllers/oer/endpoints.php
@@ -223,11 +223,14 @@ class Oer_EndpointsController extends StudipController
'avatar' => $userdata['external_contact']
? $user->avatar_url
: Avatar::getAvatar($userdata['user_id'])->getURL(Avatar::NORMAL),
+ 'description' => $userdata['external_contact']
+ ? $user['data']['description']
+ : $user->datafields,
'host_url' => $material->host ? $material->host['url'] : $me['url']
];
}
$this->render_json([
- 'data' => [
+ 'data' => [
'name' => $material['name'],
'short_description' => $material['short_description'],
'description' => $material['description'],
@@ -407,7 +410,9 @@ class Oer_EndpointsController extends StudipController
$user['contact_type'] = 'oercampus';
$user['name'] = $data['user']['name'];
$user['avatar_url'] = $data['user']['avatar'];
- $user['data']['description'] = $data['user']['description'] ?: "";
+ $user['data'] = [
+ 'description' => $data['user']['description'] ?: ''
+ ];
$user->store();
$review = OERReview::findOneBySQL("display_class = 'OERReview'
@@ -488,7 +493,9 @@ class Oer_EndpointsController extends StudipController
$user['contact_type'] = 'oercampus';
$user['name'] = $data['user']['name'];
$user['avatar_url'] = $data['user']['avatar'];
- $user['data']['description'] = $data['user']['description'] ?: "";
+ $user['data'] = [
+ 'description' => $data['user']['description'] ?: ''
+ ];
$user->store();
$comment = new BlubberComment();
diff --git a/app/controllers/oer/market.php b/app/controllers/oer/market.php
index fadc7b6..9e15406 100644
--- a/app/controllers/oer/market.php
+++ b/app/controllers/oer/market.php
@@ -453,9 +453,9 @@ class Oer_MarketController extends StudipController
if ($this->user->isNew()) {
throw new Exception(_("Nutzer ist nicht erfasst."));
}
- $this->materials = OERMaterial::findBySQL("user_id = ?
- AND host_id IS NOT NULL
- ORDER BY mkdate DESC", [
+ $this->materials = OERMaterial::findBySQL("LEFT JOIN oer_material_users ON (oer_material_users.material_id = oer_material.material_id AND external_contact = 1)
+ WHERE oer_material_users.user_id = ?
+ ORDER BY oer_material.mkdate DESC", [
$external_user_id
]);
}
diff --git a/app/views/oer/market/profile.php b/app/views/oer/market/profile.php
index cce1342..5c90412 100644
--- a/app/views/oer/market/profile.php
+++ b/app/views/oer/market/profile.php
@@ -1,11 +1,11 @@
<div style="display: flex; width: 100%; margin-bottom: 20px;">
<div>
- <img class="avatar-normal" src="<?= htmlReady($user['avatar']) ?>">
+ <img class="avatar-normal" src="<?= htmlReady($user['avatar_url']) ?>">
</div>
<div style="width: 100%; padding-left: 10px;">
<h1><?= htmlReady($user['name']) ?></h1>
<div>
- <?= formatReady($user['description']) ?>
+ <?= formatReady($user['data']['description']) ?>
</div>
</div>
</div>
@@ -19,7 +19,7 @@
</h1>
</header>
<section>
- <?= $this->render_partial("mymaterial/_material_list.php", ['materialien' => $materials]) ?>
+ <?= $this->render_partial("oer/mymaterial/_material_list.php", ['materialien' => $materials]) ?>
</section>
</section>
<? endif ?>
diff --git a/app/views/oer/mymaterial/_material_list.php b/app/views/oer/mymaterial/_material_list.php
index 371c392..237ae07 100644
--- a/app/views/oer/mymaterial/_material_list.php
+++ b/app/views/oer/mymaterial/_material_list.php
@@ -44,17 +44,17 @@
<? endif ?>
</td>
<td>
- <a href="<?= $controller->statistics($material) ?>" data-dialog="size=auto">
+ <a href="<?= $controller->link_for('oer/mymaterial/statistics/' . $material->id) ?>" data-dialog="size=auto">
<?= OERDownloadcounter::countBySQL('material_id = ?', [$material->id]) ?>
</a>
</td>
<td class="actions">
<? if ($material->isMine()) : ?>
- <a href="<?= $controller->edit($material) ?>" data-dialog
+ <a href="<?= $controller->link_for('oer/mymaterial/edit/' . $material->id) ?>" data-dialog
title="<?= _('Lernmaterial bearbeiten') ?>">
<?= Icon::create('edit', Icon::ROLE_CLICKABLE)->asImg(20) ?>
</a>
- <form action="<?= $controller->delete($material) ?>"
+ <form action="<?= $controller->link_for('oer/mymaterial/delete/' . $material->id) ?>"
class="inlineform"
method="post"
data-confirm="<?= _('Dieses Material wirklich löschen?') ?>">