Skip to content
Snippets Groups Projects
Commit 64eea637 authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Resolve "Materialien von anderen Servern nicht zugreifbar"

Closes #2542

Merge request studip/studip!1718
parent 945bac51
No related branches found
No related tags found
No related merge requests found
......@@ -223,6 +223,9 @@ 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']
];
}
......@@ -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();
......
......@@ -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
]);
}
......
<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 ?>
......
......@@ -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?') ?>">
......
......@@ -24,6 +24,11 @@ class ExternalUser extends SimpleORMap
protected static function configure($config = [])
{
$config['db_table'] = 'external_users';
$config['belongs_to']['host'] = [
'class_name' => OERHost::class,
'foreign_key' => 'host_id'
];
$config['serialized_fields']['data'] = 'JSONArrayObject';
parent::configure($config);
}
}
......@@ -267,10 +267,10 @@ class OERHost extends OERIdentity
if ($materialdata['external_contact']) {
$user = $materialdata['oeruser'];
$users[] = [
'user_id' => $user['foreign_user_id'],
'user_id' => $user['foreign_id'],
'name' => $user['name'],
'avatar' => $user['avatar'],
'description' => $user['description'],
'avatar' => $user['avatar_url'],
'description' => $user['data']['description'],
'host_url' => $user->host['url'],
'link' => URLHelper::getURL('dispatch.php/oer/market/profile/' . $user->getId()),
'hostname' => $this['name']
......
......@@ -566,7 +566,9 @@ class OERMaterial extends SimpleORMap
$user['contact_type'] = "oercampus";
$user['name'] = $review_data['user']['name'];
$user['avatar_url'] = $review_data['user']['avatar'] ?: null;
$user['data']['description'] = $review_data['user']['description'] ?: null;
$user['data'] = [
'description' => $review_data['user']['description'] ?: ''
];
$user->store();
$review['user_id'] = $user->getId();
......@@ -609,7 +611,7 @@ class OERMaterial extends SimpleORMap
}
$user['name'] = $userdata['name'];
$user['avatar_url'] = $userdata['avatar'] ?: null;
$userdata = $user['data'] ? $user['data']->toArrayCopy() : [];
$userdata = $user['data'] ? $user['data']->getArrayCopy() : [];
$userdata['description'] = $userdata['description'] ?: null;
$user['data'] = $userdata;
$user->store();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment