Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Develop

See merge request ILIAS/Plugins/ViMP!7
  • Loading branch information
Theodor Truffer committed Apr 11, 2019
2 parents dd031f5 + 22c56b5 commit 884b912
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.0.3]
- Bugfix: after changing owner of a video, it couldn't be changed a 2nd time
- Bugfix: owner could not be changed if there's a required checkbox field

## [1.0.2]
- Usability Fix: Own Videos table shows button (-zone) "Show My Videos"

Expand Down
50 changes: 44 additions & 6 deletions classes/GUI/Abstract/class.xvmpGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,41 @@ abstract class xvmpGUI {
* @var ilObjViMPGUI
*/
protected $parent_gui;
/**
* @var ilTemplate
*/
protected $tpl;
/**
* @var ilTabsGUI
*/
protected $tabs;
/**
* @var ilCtrl
*/
protected $ctrl;
/**
* @var ilToolbarGUI|mixed
*/
protected $toolbar;
/**
* @var ilObjUser
*/
protected $user;
/**
* @var ilViMPPlugin
*/
protected $pl;
/**
* @var mixed
*/
protected $lng;


/**
* xvmpGUI constructor.
*
* @param ilObjViMPGUI $parent_gui
*/
public function __construct(ilObjViMPGUI $parent_gui) {
global $DIC;
$tpl = $DIC['tpl'];
Expand All @@ -27,12 +61,6 @@ public function __construct(ilObjViMPGUI $parent_gui) {
$ilToolbar = $DIC['ilToolbar'];
$ilUser = $DIC['ilUser'];
$lng = $DIC['lng'];
/**
* @var $ilCtrl ilCtrl
* @var $ilTabs ilTabsGUI
* @var $tpl ilTemplate
* @var $ilToolbar ilToolbarGUI
*/
$this->tpl = $tpl;
$this->tabs = $ilTabs;
$this->ctrl = $ilCtrl;
Expand All @@ -44,6 +72,9 @@ public function __construct(ilObjViMPGUI $parent_gui) {
}


/**
*
*/
public function executeCommand() {
if (!$this->ctrl->isAsynch()) {
$this->tabs->activateTab(static::TAB_ACTIVE);
Expand Down Expand Up @@ -73,6 +104,10 @@ protected function performCommand($cmd) {
$this->{$cmd}();
}


/**
*
*/
public function addFlushCacheButton () {
$button = ilLinkButton::getInstance();
$button->setUrl($this->ctrl->getLinkTarget($this,self::CMD_FLUSH_CACHE));
Expand All @@ -95,6 +130,9 @@ public function flushCache() {
}


/**
* @return mixed
*/
abstract protected function index();


Expand Down
4 changes: 2 additions & 2 deletions classes/GUI/Form/class.xvmpConfFormGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ protected function initForm(){
$input->addInput($subinput);
$subinput = new ilSelectInputGUI('', xvmpConf::F_FORM_FIELD_TYPE);
$subinput->setOptions(array(
0 => $this->pl->confTxt(xvmpConf::F_FORM_FIELD_TYPE_0),
1 => $this->pl->confTxt(xvmpConf::F_FORM_FIELD_TYPE_1)
0 => $this->pl->confTxt('form_field_type_' . xvmpConf::F_FORM_FIELD_TYPE_TEXT),
1 => $this->pl->confTxt('form_field_type_' . xvmpConf::F_FORM_FIELD_TYPE_CHECKBOX)
));
$input->addInput($subinput);
$this->addItem($input);
Expand Down
18 changes: 16 additions & 2 deletions classes/GUI/class.xvmpOwnVideosGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,31 @@ public function confirmedChangeOwner() {
}

$xvmpUser = xvmpUser::getOrCreateVimpUser(new ilObjUser(ilObjUser::getUserIdByLogin($login)));
$response = xvmpRequest::editMedium($mid, array('uid' => $xvmpUser->getUid()))->getResponseBody();
$medium['uid'] = $xvmpUser->getUid();
$edit_fields = ['uid' => $xvmpUser->getUid()];
foreach (xvmpConf::getConfig(xvmpConf::F_FORM_FIELDS) as $form_field) {
// workaround for vimp bug (see PLVIMP-53)
if ($form_field[xvmpConf::F_FORM_FIELD_REQUIRED] == 1 && $form_field[xvmpConf::F_FORM_FIELD_TYPE] == 1) {
$edit_fields[$form_field[xvmpConf::F_FORM_FIELD_ID]] = 1;
}
}
$response = xvmpRequest::editMedium($mid, $edit_fields)->getResponseBody();
if ($response) {
ilUtil::sendSuccess($this->pl->txt('form_saved'), true);
$medium['uid'];
xvmpCacheFactory::getInstance()->delete(xvmpMedium::class . '-' . $mid);
xvmpMedium::cache(xvmpMedium::class . '-' . $mid, $medium);
xvmpEventLog::logEvent(xvmpEventLog::ACTION_CHANGE_OWNER, $this->getObjId(), array(
'owner' => $login,
'mid' => $mid,
'title' => $medium['title']
));
/** @var xvmpUploadedMedia $xvmpUploadedMedia */
foreach (xvmpUploadedMedia::where(['user_id' => $this->user->getId()])->get() as $xvmpUploadedMedia) {
$new_user_id = ilObjUser::_lookupId($login);
$xvmpUploadedMedia->setUserId($new_user_id);
$xvmpUploadedMedia->setEmail(ilObjUser::_lookupEmail($new_user_id));
$xvmpUploadedMedia->update();
}
} else {
ilUtil::sendFailure($this->pl->txt('failure'));
}
Expand Down
4 changes: 2 additions & 2 deletions classes/Model/AR/class.xvmpConf.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class xvmpConf extends ActiveRecord {
const F_FORM_FIELD_REQUIRED = 'required';
const F_FORM_FIELD_FILL_USER_DATA = 'fill_user_data';
const F_FORM_FIELD_TYPE = 'field_type';
const F_FORM_FIELD_TYPE_0 = 'text';
const F_FORM_FIELD_TYPE_1 = 'checkbox';
const F_FORM_FIELD_TYPE_TEXT = 0;
const F_FORM_FIELD_TYPE_CHECKBOX = 1;

const F_UPLOAD_LIMIT = 'upload_limit';
const F_TOKEN = 'token';
Expand Down
2 changes: 2 additions & 0 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ conf_embed_player#:#Embedded Videoplayer nutzen
conf_embed_player_info#:#Wenn aktiviert, wird der eingebettete Videoplayer von ViMP genutzt. Wenn der Lernfortschritt für ein Objekt aktiviert ist, wird jedoch dennoch der Plugin-eigene Player verwendet, da der Lernfortschritt mit dem eingebetteten Player nicht gemessen werden kann.
conf_text#:#Textfeld
conf_checkbox#:#Checkbox
conf_form_field_type_0#:#Textfeld
conf_form_field_type_1#:#Checkbox
conf_upload_limit#:#Upload Limit (MB)
conf_upload_limit_info#:#Begrenzung der Dateigröße in MB. Geben Sie '0' ein, um keine Begrenzung festzulegen.
msg_success#:#Änderungen erfolgreich gespeichert.
Expand Down
2 changes: 2 additions & 0 deletions lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ conf_embed_player#:#Embedded Video Player
conf_embed_player_info#:#Use ViMP's embedded video player. If the learning progress is active, the plugin will still use it's own player, since the learning progress can not be tracked with the embedded player.
conf_text#:#Text Field
conf_checkbox#:#Checkbox
conf_form_field_type_0#:#Text Field
conf_form_field_type_1#:#Checkbox
conf_upload_limit#:#Upload Limit (MB)
conf_upload_limit_info#:#Limit for the uploaded filesize in MB. Enter '0' for no limit.
msg_success#:#Changes saved successfully.
Expand Down
2 changes: 1 addition & 1 deletion plugin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
$id = 'xvmp';
$version = '1.0.2';
$version = '1.0.3';
$ilias_min_version = '5.2.0';
$ilias_max_version = '5.3.999';
$responsible = 'Theodor Truffer';
Expand Down

0 comments on commit 884b912

Please sign in to comment.