Skip to content
Snippets Groups Projects
Commit 6c90f6fc authored by Rasmus Fuhse's avatar Rasmus Fuhse Committed by Jan-Hendrik Willms
Browse files

Resolve "StEP00358 Schnittstelle zum OER Portal Niedersachsen"

parent 27d9dc12
No related branches found
No related tags found
No related merge requests found
Showing
with 2154 additions and 1962 deletions
...@@ -1057,7 +1057,7 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1057,7 +1057,7 @@ class Course_TimesroomsController extends AuthenticatedController
$end_semester = $this->course->semesters; $end_semester = $this->course->semesters;
} }
$this->start_weeks = $this->course->start_semester->getStartWeeks($this->course->duration_time); $this->start_weeks = $end_semester[count($end_semester) - 1]->getStartWeeks();
if (!empty($end_semester)) { if (!empty($end_semester)) {
$this->end_semester_weeks = []; $this->end_semester_weeks = [];
......
...@@ -131,6 +131,7 @@ class Oer_EndpointsController extends StudipController ...@@ -131,6 +131,7 @@ class Oer_EndpointsController extends StudipController
]; ];
$data['data'] = $material->toArray(); $data['data'] = $material->toArray();
unset($data['data']['material_id']); unset($data['data']['material_id']);
unset($data['data']['uri_hash']);
$data['users'] = []; $data['users'] = [];
foreach ($material->users as $userdata) { foreach ($material->users as $userdata) {
$user = $userdata['external_contact'] $user = $userdata['external_contact']
...@@ -242,7 +243,8 @@ class Oer_EndpointsController extends StudipController ...@@ -242,7 +243,8 @@ class Oer_EndpointsController extends StudipController
'player_url' => $material['player_url'], 'player_url' => $material['player_url'],
'tool' => $material['tool'], 'tool' => $material['tool'],
'structure' => ($material['structure'] ? $material['structure']->getArrayCopy() : null), 'structure' => ($material['structure'] ? $material['structure']->getArrayCopy() : null),
'license' => $material['license'] 'license' => $material['license'],
'uri' => $material['uri']
], ],
'users' => $users, 'users' => $users,
'topics' => $topics, 'topics' => $topics,
......
...@@ -8,7 +8,6 @@ class Oer_MymaterialController extends AuthenticatedController ...@@ -8,7 +8,6 @@ class Oer_MymaterialController extends AuthenticatedController
{ {
parent::before_filter($action, $args); parent::before_filter($action, $args);
PageLayout::setTitle(_('Lernmaterialien')); PageLayout::setTitle(_('Lernmaterialien'));
} }
public function index_action() public function index_action()
...@@ -36,6 +35,7 @@ class Oer_MymaterialController extends AuthenticatedController ...@@ -36,6 +35,7 @@ class Oer_MymaterialController extends AuthenticatedController
return; return;
} elseif (Request::isPost()) { } elseif (Request::isPost()) {
$was_new = $material->isNew(); $was_new = $material->isNew();
$was_on_twillo = (bool) $material['published_id_on_twillo'];
$material->setData(Request::getArray('data')); $material->setData(Request::getArray('data'));
$material['host_id'] = null; $material['host_id'] = null;
$material['license_identifier'] = Request::get('license', 'CC-BY-SA-4.0'); $material['license_identifier'] = Request::get('license', 'CC-BY-SA-4.0');
...@@ -131,6 +131,19 @@ class Oer_MymaterialController extends AuthenticatedController ...@@ -131,6 +131,19 @@ class Oer_MymaterialController extends AuthenticatedController
$material->pushDataToIndexServers(); $material->pushDataToIndexServers();
if (Config::get()->OERCAMPUS_ENABLE_TWILLO && TwilloConnector::getTwilloUserID()) {
if (Request::bool('publish_on_twillo') || $_SESSION['NEW_OER']['publish_on_twillo']) {
//upload it to twillo.de
$succes_or_error = $material->uploadToTwillo($material);
if (is_string($succes_or_error)) {
PageLayout::postWarning(_('Konnte Material nicht zu twillo.de hochladen.'), [$succes_or_error]);
}
} elseif ($was_on_twillo) {
//remove it from twillo.de if able
$material->deleteFromTwillo();
}
}
unset($_SESSION['NEW_OER']); unset($_SESSION['NEW_OER']);
PageLayout::postSuccess(_('Lernmaterial erfolgreich gespeichert.')); PageLayout::postSuccess(_('Lernmaterial erfolgreich gespeichert.'));
......
...@@ -238,6 +238,15 @@ ...@@ -238,6 +238,15 @@
value="<?= htmlReady($template['module_id']) ?>"> value="<?= htmlReady($template['module_id']) ?>">
<? endif ?> <? endif ?>
<? if (Config::get()->OERCAMPUS_ENABLE_TWILLO && TwilloConnector::getTwilloUserID()) : ?>
<input type="hidden" name="publish_on_twillo" value="0">
<label style="margin-top: 20px;">
<input type="checkbox"
name="publish_on_twillo"
value="1"<?= $material['published_id_on_twillo'] ? " checked" : "" ?>>
<?= _('Auf twillo.de veröffentlichen') ?>
</label>
<? endif ?>
</fieldset> </fieldset>
<? if (!Config::get()->OER_DISABLE_LICENSE) : ?> <? if (!Config::get()->OER_DISABLE_LICENSE) : ?>
......
#!/usr/bin/env php
<?php
require_once 'studip_cli_env.inc.php';
$app_id = str_replace(" ", "-", Config::get()->UNI_NAME_CLEAN);
$privatekey = @file_get_contents('../config/twillo-private.key');
if (!$privatekey) {
$key = EduSharingHelper::generateKeyPair();
$success = file_put_contents(
'../config/twillo.properties.xml',
EduSharingHelper::generateEduAppXMLData($app_id, $key['publickey'])
);
if ($success !== false) {
file_put_contents(
'../config/twillo-private.key',
$key['privatekey']
);
Config::get()->store('OERCAMPUS_TWILLO_APPID', $app_id);
echo "Wrote config/twillo.properties.xml file. Next steps:
- Send the file config/twillo.properties.xml to the twillo.de administrators support.twillo@tib.eu . If they ask you to change the app-ID, you can do this in the system at Admin -> System -> Configuration by editing the config value OERCAMPUS_TWILLO_APPID.
- Leave the config/twillo-private.key file as it is in the config folder. This file is important for the API to work.
- You need to either have or create a datafield for users which contains the DFN-AAI-ID of a person. Without this ID in the datafield a user cannot upload to twillo.de due to technical restrictions.
- Copy the datafield_id of this datafield (you find this in the DB-table datafields). In Stud.IP go to Admin -> System -> Configuration and edit the config value OERCAMPUS_TWILLO_DFNAAIID_DATAFIELD. What you inserted, should look like 6a9ee3ca3685d2551698a3dc6f0f0eff.
- Once the twillo.de adminstrators received your file and registered your Stud.IP, you can enable the connection to twillo: Go to Admin -> System -> Configuration and edit the config value OERCAMPUS_ENABLE_TWILLO and switch it on.
There you go. From now on all your users with a given DFN-AAI-ID should be able to upload their OERs to twillo.de.
";
} else {
echo "No permission to write into folder config. Cannot save private and public keys.\n";
}
} else {
echo "Private key already exists. Remove it or be happy that it is there.\n";
}
This diff is collapsed.
This diff is collapsed.
...@@ -100,3 +100,21 @@ StudipAutoloader::addClassLookup( ...@@ -100,3 +100,21 @@ StudipAutoloader::addClassLookup(
['xmlrpc_server'], ['xmlrpc_server'],
'composer/phpxmlrpc/phpxmlrpc/lib/xmlrpcs.inc' 'composer/phpxmlrpc/phpxmlrpc/lib/xmlrpcs.inc'
); );
//Edu-Sharing helper classes for twillo connector
StudipAutoloader::addClassLookup(
'EduSharingHelper',
'vendor/edu-sharing-plugin/edu-sharing-helper.php'
);
StudipAutoloader::addClassLookup(
'EduSharingHelperBase',
'vendor/edu-sharing-plugin/edu-sharing-helper-base.php'
);
StudipAutoloader::addClassLookup(
'EduSharingAuthHelper',
'vendor/edu-sharing-plugin/edu-sharing-auth-helper.php'
);
StudipAutoloader::addClassLookup(
'EduSharingNodeHelper',
'vendor/edu-sharing-plugin/edu-sharing-node-helper.php'
);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This library is a changed version of https://github.com/edu-sharing/php-auth-plugin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment