Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/GUI/Form/Input/class.ilMultiSelectSearchInputGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public function __construct($title, $post_var)
parent::__construct($title, $post_var);

$this->lng = $lng;
$tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/templates/default/form/select2/select2.min.js");
$tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/node_modules/select2/dist/js/select2.js");
//$tpl->addJavaScript("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/templates/default/form/select2/select2_locale_".$ilUser->getCurrentLanguage().".js");
$tpl->addCss("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/templates/default/form/select2/select2.css");
$tpl->addCss("./Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP/node_modules/select2/dist/css/select2.css");
$this->setInputTemplate(new ilTemplate("tpl.multiple_select.html", true, true,
"Customizing/global/plugins/Services/Repository/RepositoryObject/ViMP"));
$this->setWidth(308);
Expand Down
40 changes: 30 additions & 10 deletions classes/GUI/Form/class.xvmpConfFormGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class xvmpConfFormGUI extends xvmpFormGUI
protected $db;

protected Services $http;
protected const PASS_MASK = '********';

/**
* xvmpConfFormGUI constructor.
Expand Down Expand Up @@ -343,6 +344,11 @@ private function getValuesForItem($item, &$array) : void
} else {
$value = xvmpConf::getConfig($key);
}
if($key === xvmpConf::F_API_PASSWORD && $value !== '' && $value !== null) {
$value = self::PASS_MASK;
} else if($key === xvmpConf::F_API_KEY && $value !== '' && $value !== null) {
$value = self::PASS_MASK;
}
$array[$key] = $value;
if (self::checkForSubItem($item)) {
foreach ($item->getSubItems() as $subitem) {
Expand Down Expand Up @@ -390,7 +396,15 @@ public function saveObject() : bool
return false;
}
foreach ($this->getItems() as $item) {
$this->saveValueForItem($item);
if($item->getPostVar() === xvmpConf::F_API_PASSWORD || $item->getPostVar() === xvmpConf::F_API_KEY) {
$value = $this->getInput($item->getPostVar());
if($value !== '' && $value !== self::PASS_MASK) {
xvmpConf::set($item->getPostVar(), $value);
$this->saveValueForItem($item);
}
} else {
$this->saveValueForItem($item);
}
}
xvmpConf::set(xvmpConf::F_CONFIG_VERSION, xvmpConf::CONFIG_VERSION);

Expand All @@ -411,26 +425,29 @@ private function saveValueForItem($item) : void
// obj
$sql = $this->db->query('select value from lng_data where module = "rep_robj_xvmp" and identifier = "rep_robj_xvmp_obj_xvmp"');
$existing = $this->db->fetchObject($sql);

$date_local_change = date('Y-m-d H:i:s');
if ($existing) {
$this->db->update('lng_data', array(
'value' => array('text', $value)
'value' => array('text', $value),
'local_change' => array('text', $date_local_change)
), array(
'module' => array('text', 'rep_robj_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp')
));
} else {
$this->db->insert('lng_data', array(
'lang_key' => array('text', 'de'),
'module' => array('text', 'rep_robj_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp'),
'value' => array('text', $value)
'value' => array('text', $value),
'local_change' => array('text', $date_local_change)
));
$this->db->insert('lng_data', array(
'lang_key' => array('text', 'en'),
'module' => array('text', 'rep_robj_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_obj_xvmp'),
'value' => array('text', $value)
'value' => array('text', $value),
'local_change' => array('text', $date_local_change)
));
}

Expand All @@ -440,23 +457,26 @@ private function saveValueForItem($item) : void

if ($existing) {
$this->db->update('lng_data', array(
'value' => array('text', $value)
'value' => array('text', $value),
'local_change' => array('text', $date_local_change)
), array(
'module' => array('text', 'rep_robj_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp')
));
} else {
$this->db->insert('lng_data', array(
'lang_key' => array('text', 'de'),
'module' => array('text', 'rep_robj_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp'),
'value' => array('text', $value)
'value' => array('text', $value),
'local_change' => array('text', $date_local_change)
));
$this->db->insert('lng_data', array(
'lang_key' => array('text', 'en'),
'module' => array('text', 'rep_robj_xvmp'),
'identifier' => array('text', 'rep_robj_xvmp_objs_xvmp'),
'value' => array('text', $value)
'value' => array('text', $value),
'local_change' => array('text', $date_local_change)
));
}
return;
Expand Down
14 changes: 11 additions & 3 deletions classes/GUI/Table/class.xvmpSelectedVideosTableGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ class xvmpSelectedVideosTableGUI extends xvmpTableGUI
*/
public function __construct($parent_gui, $parent_cmd)
{
global $DIC;
$ilUser = $DIC['ilUser'];
$id = 'xvmp_selected_' . (int) $_GET['ref_id'] . '_' . $ilUser->getId();
$this->setId($id);
$this->setPrefix($id);
$this->setFormName($id);
parent::__construct($parent_gui, $parent_cmd);

$this->setTitle($this->pl->txt('selected_videos'));
Expand All @@ -59,8 +65,8 @@ public function __construct($parent_gui, $parent_cmd)
$this->setDescription($description);

$this->setExternalSorting(true);
$this->setEnableNumInfo(false);
$this->setShowRowsSelector(false);
$this->setEnableNumInfo(true);
$this->setShowRowsSelector(true);

$base_link = $this->ctrl->getLinkTarget($this->parent_obj, '', '', true);
$this->tpl_global->addOnLoadCode('VimpSelected.init("' . $base_link . '");');
Expand Down Expand Up @@ -98,7 +104,9 @@ protected function addRepositoryPreviewCss($number) : void

public function parseData() : void
{
$this->setData(xvmpMedium::getSelectedAsArray($this->parent_obj->getObjId()));
$data = xvmpMedium::getSelectedAsArray($this->parent_obj->getObjId());
$this->setData($data);
$this->setMaxCount(count($data));
}

protected function initColumns() : void
Expand Down
31 changes: 25 additions & 6 deletions classes/GUI/class.xvmpSelectedVideosGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,34 @@ public function executeCommand() : void
*/
public function reorder()
{
$ids = $_POST['ids'];
$sort = 10;
$ids = $_POST['ids'] ?? [];
$media = xvmpSelectedMedia::where(['mid' => $ids, 'obj_id' => $this->getObjId()])->get();

if (empty($media)) {
echo json_encode(['success' => true]);
exit;
}

$mediaByMid = [];
foreach ($media as $obj) {
$mediaByMid[$obj->getMid()] = $obj;
}

$orderedMedia = [];
foreach ($ids as $id) {
$xvmpSelectedMedia = xvmpSelectedMedia::where(array('mid' => $id, 'obj_id' => $this->getObjId()))->first();
$xvmpSelectedMedia->setSort($sort);
$xvmpSelectedMedia->update();
if (isset($mediaByMid[$id])) {
$orderedMedia[] = $mediaByMid[$id];
}
}

$sort = min(array_map(fn($o) => $o->getSort(), $orderedMedia));
foreach ($orderedMedia as $obj) {
$obj->setSort($sort);
$obj->update();
$sort += 10;
}
echo "{\"success\": true}";

echo json_encode(['success' => true]);
exit;
}

Expand Down
1 change: 1 addition & 0 deletions classes/Model/API/class.xvmpMedium.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class xvmpMedium extends xvmpObject
protected array|string $streaming;
protected int $count_likes;
protected ?array $subtitles = [];
protected ?array $channels = [];
protected bool $download_allowed = false;
protected ?DateTime $startdate = null;
protected ?DateTime $enddate = null;
Expand Down
6 changes: 6 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading