Skip to content

Commit

Permalink
refactoring rebase fixes and syncs
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili committed Aug 25, 2023
1 parent e03eb89 commit 43e70fe
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 95 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use srag\DIC\OpenCast\DICTrait;
use srag\Plugins\Opencast\Model\Publication\Config\PublicationUsageGroup;

/**
Expand All @@ -10,9 +9,6 @@
*/
class xoctPublicationGroupFormGUI extends ilPropertyFormGUI
{
use DICTrait;
public const PLUGIN_CLASS_NAME = ilOpenCastPlugin::class;

public const F_NAME = 'name';
public const F_DISPLAY_NAME = 'display_name';
public const F_DESCRIPTION = 'description';
Expand Down Expand Up @@ -44,7 +40,7 @@ public function __construct($parent_gui, $xoctPublicationUsageGroup, $is_new = t
$this->object = $xoctPublicationUsageGroup;
$this->parent_gui = $parent_gui;
$this->parent_gui->setTab();
self::dic()->ctrl()->saveParameter($parent_gui, 'id');
$this->ctrl->saveParameter($parent_gui, 'id');
$this->is_new = $is_new;
$this->initForm();
}
Expand All @@ -56,7 +52,7 @@ public function __construct($parent_gui, $xoctPublicationUsageGroup, $is_new = t
protected function initForm()
{
$this->setTarget('_top');
$this->setFormAction(self::dic()->ctrl()->getFormAction($this->parent_gui));
$this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
$this->initButtons();

$te = new ilTextInputGUI($this->txt(self::F_NAME), self::F_NAME);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use srag\DIC\OpenCast\DICTrait;
use srag\Plugins\Opencast\DI\OpencastDIC;
use srag\DIC\OpenCast\Exception\DICException;
use srag\Plugins\Opencast\Model\Publication\Config\PublicationUsageGroup;
use srag\Plugins\Opencast\Model\Publication\Config\PublicationUsageGroupRepository;
Expand All @@ -12,14 +12,19 @@
*/
class xoctPublicationGroupTableGUI extends ilTable2GUI
{
use DICTrait;
public const PLUGIN_CLASS_NAME = ilOpenCastPlugin::class;

public const TBL_ID = 'tbl_xoct_pub_g';
/**
* @var array
*/
protected $filter = [];
/**
* @var ilOpenCastPlugin
*/
protected $plugin;
/**
* @var OpencastDIC
*/
protected $container;


/**
Expand All @@ -28,15 +33,20 @@ class xoctPublicationGroupTableGUI extends ilTable2GUI
*/
public function __construct(xoctPublicationUsageGUI $a_parent_obj, $a_parent_cmd)
{
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->container = OpencastDIC::getInstance();
$this->plugin = $this->container->plugin();
$this->setId(self::TBL_ID);
$this->setPrefix(self::TBL_ID);
$this->setFormName(self::TBL_ID);
self::dic()->ctrl()->saveParameter($a_parent_obj, $this->getNavParameter());
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->ctrl->saveParameter($a_parent_obj, $this->getNavParameter());
$this->parent_obj = $a_parent_obj;
$this->setTitle($this->parent_obj->txt('table_title_usage_group'));
$this->setRowTemplate('tpl.publication_group.html', 'Customizing/global/plugins/Services/Repository/RepositoryObject/OpenCast');
$this->setFormAction(self::dic()->ctrl()->getFormAction($a_parent_obj));
$this->setRowTemplate(
'tpl.publication_group.html',
'Customizing/global/plugins/Services/Repository/RepositoryObject/OpenCast'
);
$this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
$this->initColumns();
$this->parseData();
}
Expand Down Expand Up @@ -67,7 +77,7 @@ protected function initColumns()
$this->addColumn($this->parent_obj->txt('group_display_name'));
$this->addColumn($this->parent_obj->txt('group_description'));

$this->addColumn(self::plugin()->getPluginObject()->txt('common_actions'), '', '150px');
$this->addColumn($this->plugin->txt('common_actions'), '', '150px');
}


Expand All @@ -79,13 +89,21 @@ protected function initColumns()
protected function addActionMenu(PublicationUsageGroup $xoctPublicationUsageGroup)
{
$current_selection_list = new ilAdvancedSelectionListGUI();
$current_selection_list->setListTitle(self::plugin()->getPluginObject()->txt('common_actions'));
$current_selection_list->setListTitle($this->plugin->txt('common_actions'));
$current_selection_list->setId(self::TBL_ID . '_actions_' . $xoctPublicationUsageGroup->getId());
$current_selection_list->setUseImages(false);

self::dic()->ctrl()->setParameter($this->parent_obj, 'id', $xoctPublicationUsageGroup->getId());
$current_selection_list->addItem($this->parent_obj->txt(xoctPublicationUsageGUI::CMD_EDIT), xoctPublicationUsageGUI::CMD_EDIT_GROUP, self::dic()->ctrl()->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_EDIT_GROUP));
$current_selection_list->addItem($this->parent_obj->txt(xoctPublicationUsageGUI::CMD_DELETE), xoctPublicationUsageGUI::CMD_DELETE_GROUP, self::dic()->ctrl()->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_CONFIRM_DELETE_GROUP));
$this->ctrl->setParameter($this->parent_obj, 'id', $xoctPublicationUsageGroup->getId());
$current_selection_list->addItem(
$this->parent_obj->txt(xoctPublicationUsageGUI::CMD_EDIT),
xoctPublicationUsageGUI::CMD_EDIT_GROUP,
$this->ctrl->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_EDIT_GROUP)
);
$current_selection_list->addItem(
$this->parent_obj->txt(xoctPublicationUsageGUI::CMD_DELETE),
xoctPublicationUsageGUI::CMD_DELETE_GROUP,
$this->ctrl->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_CONFIRM_DELETE_GROUP)
);

$this->tpl->setVariable('ACTIONS', $current_selection_list->getHTML());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use srag\DIC\OpenCast\DICTrait;
use srag\Plugins\Opencast\Model\Publication\Config\PublicationUsage;
use srag\Plugins\Opencast\Model\Publication\Config\PublicationUsageGroup;

Expand All @@ -11,9 +10,6 @@
*/
class xoctPublicationSubUsageFormGUI extends ilPropertyFormGUI
{
use DICTrait;
public const PLUGIN_CLASS_NAME = ilOpenCastPlugin::class;

public const F_PARENT_USAGE_ID = 'parent_usage_id';
public const F_TITLE = 'title';
public const F_DESCRIPTION = 'description';
Expand Down Expand Up @@ -50,12 +46,14 @@ class xoctPublicationSubUsageFormGUI extends ilPropertyFormGUI
public function __construct($parent_gui, $xoctPublicationSubUsage, $is_new = true)
{
global $DIC;
$DIC->ui()->mainTemplate()->addJavaScript(ilOpenCastPlugin::getInstance()->getDirectory() . '/templates/default/publication_usage_form.min.js');
$DIC->ui()->mainTemplate()->addJavaScript(
ilOpenCastPlugin::getInstance()->getDirectory() . '/templates/default/publication_usage_form.min.js'
);
parent::__construct();
$this->object = $xoctPublicationSubUsage;
$this->parent_gui = $parent_gui;
$this->parent_gui->setTab();
self::dic()->ctrl()->saveParameter($parent_gui, 'id');
$this->ctrl->saveParameter($parent_gui, 'id');
$this->is_new = $is_new;
$this->initForm();
}
Expand All @@ -67,7 +65,7 @@ public function __construct($parent_gui, $xoctPublicationSubUsage, $is_new = tru
protected function initForm()
{
$this->setTarget('_top');
$this->setFormAction(self::dic()->ctrl()->getFormAction($this->parent_gui));
$this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
$this->initButtons();

$te = new ilTextInputGUI($this->parent_gui->txt(self::F_PARENT_USAGE_ID), self::F_PARENT_USAGE_ID);
Expand Down Expand Up @@ -107,8 +105,12 @@ protected function initForm()
$te = new ilSelectInputGUI($this->parent_gui->txt(self::F_MD_TYPE), self::F_MD_TYPE);
$te->setRequired(true);
$te->setOptions([
PublicationUsage::MD_TYPE_PUBLICATION_ITSELF => $this->parent_gui->txt('md_type_' . PublicationUsage::MD_TYPE_PUBLICATION_ITSELF),
PublicationUsage::MD_TYPE_ATTACHMENT => $this->parent_gui->txt('md_type_' . PublicationUsage::MD_TYPE_ATTACHMENT),
PublicationUsage::MD_TYPE_PUBLICATION_ITSELF => $this->parent_gui->txt(
'md_type_' . PublicationUsage::MD_TYPE_PUBLICATION_ITSELF
),
PublicationUsage::MD_TYPE_ATTACHMENT => $this->parent_gui->txt(
'md_type_' . PublicationUsage::MD_TYPE_ATTACHMENT
),
PublicationUsage::MD_TYPE_MEDIA => $this->parent_gui->txt('md_type_' . PublicationUsage::MD_TYPE_MEDIA)
]);
$this->addItem($te);
Expand All @@ -135,11 +137,15 @@ protected function initForm()
$te->setInfo($this->parent_gui->txt(self::F_MEDIATYPE . '_info'));
$this->addItem($te);

if (in_array($this->object->getParentUsageId(), [PublicationUsage::USAGE_DOWNLOAD, PublicationUsage::USAGE_DOWNLOAD_FALLBACK])) {
if (in_array($this->object->getParentUsageId(),
[PublicationUsage::USAGE_DOWNLOAD, PublicationUsage::USAGE_DOWNLOAD_FALLBACK])) {
$allow_multiple = new ilCheckboxInputGUI($this->parent_gui->txt(self::F_ALLOW_MULTIPLE), self::F_ALLOW_MULTIPLE);
$allow_multiple->setInfo($this->parent_gui->txt(self::F_ALLOW_MULTIPLE . '_info'));
//F_IGNORE_OBJECT_SETTINGS
$ignore_object_setting = new ilCheckboxInputGUI($this->parent_gui->txt(self::F_IGNORE_OBJECT_SETTINGS), self::F_IGNORE_OBJECT_SETTINGS);
$ignore_object_setting = new ilCheckboxInputGUI(
$this->parent_gui->txt(self::F_IGNORE_OBJECT_SETTINGS),
self::F_IGNORE_OBJECT_SETTINGS
);
$ignore_object_setting->setInfo($this->parent_gui->txt(self::F_IGNORE_OBJECT_SETTINGS . '_info'));
} else {
$allow_multiple = new ilHiddenInputGUI(self::F_ALLOW_MULTIPLE);
Expand Down Expand Up @@ -231,10 +237,16 @@ protected function initButtons()
{
if ($this->is_new) {
$this->setTitle($this->parent_gui->txt('create_sub'));
$this->addCommandButton(xoctPublicationUsageGUI::CMD_CREATE_SUB, $this->parent_gui->txt(xoctPublicationUsageGUI::CMD_CREATE));
$this->addCommandButton(
xoctPublicationUsageGUI::CMD_CREATE_SUB,
$this->parent_gui->txt(xoctPublicationUsageGUI::CMD_CREATE)
);
} else {
$this->setTitle($this->parent_gui->txt('edit_sub'));
$this->addCommandButton(xoctPublicationUsageGUI::CMD_UPDATE_SUB, $this->parent_gui->txt(xoctPublicationUsageGUI::CMD_UPDATE));
$this->addCommandButton(
xoctPublicationUsageGUI::CMD_UPDATE_SUB,
$this->parent_gui->txt(xoctPublicationUsageGUI::CMD_UPDATE)
);
}

$this->addCommandButton(xoctPublicationUsageGUI::CMD_CANCEL, $this->parent_gui->txt(xoctPublicationUsageGUI::CMD_CANCEL));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use srag\DIC\OpenCast\DICTrait;
use srag\Plugins\Opencast\DI\OpencastDIC;
use srag\DIC\OpenCast\Exception\DICException;
use srag\Plugins\Opencast\Model\Publication\Config\PublicationUsage;
use srag\Plugins\Opencast\Model\Publication\Config\PublicationSubUsage;
Expand All @@ -13,32 +13,41 @@
*/
class xoctPublicationSubUsageTableGUI extends ilTable2GUI
{
use DICTrait;
public const PLUGIN_CLASS_NAME = ilOpenCastPlugin::class;

public const TBL_ID = 'tbl_xoct_pub_sub_u';
/**
* @var array
*/
protected $filter = [];


/**
* @var ilOpenCastPlugin
*/
protected $plugin;
/**
* @var OpencastDIC
*/
protected $container;

/**
* @param xoctPublicationUsageGUI $a_parent_obj
* @param string $a_parent_cmd
*/
public function __construct(xoctPublicationUsageGUI $a_parent_obj, $a_parent_cmd)
{
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->container = OpencastDIC::getInstance();
$this->plugin = $this->container->plugin();
$this->setId(self::TBL_ID);
$this->setPrefix(self::TBL_ID);
$this->setFormName(self::TBL_ID);
self::dic()->ctrl()->saveParameter($a_parent_obj, $this->getNavParameter());
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->ctrl->saveParameter($a_parent_obj, $this->getNavParameter());
$this->parent_obj = $a_parent_obj;
$this->setTitle($this->parent_obj->txt('table_title_sub_usage'));
$this->setRowTemplate('tpl.publication_sub_usage.html', 'Customizing/global/plugins/Services/Repository/RepositoryObject/OpenCast');
$this->setFormAction(self::dic()->ctrl()->getFormAction($a_parent_obj));
$this->setRowTemplate(
'tpl.publication_sub_usage.html',
'Customizing/global/plugins/Services/Repository/RepositoryObject/OpenCast'
);
$this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
$this->initColumns();
$this->parseData();
}
Expand Down Expand Up @@ -92,7 +101,7 @@ protected function initColumns()
$this->addColumn($this->parent_obj->txt('tag'));
$this->addColumn($this->parent_obj->txt('group_th'));

$this->addColumn(self::plugin()->getPluginObject()->txt('common_actions'), '', '150px');
$this->addColumn($this->plugin->txt('common_actions'), '', '150px');
}


Expand All @@ -104,13 +113,21 @@ protected function initColumns()
protected function addActionMenu(PublicationSubUsage $PublicationSubUsage)
{
$current_selection_list = new ilAdvancedSelectionListGUI();
$current_selection_list->setListTitle(self::plugin()->getPluginObject()->txt('common_actions'));
$current_selection_list->setListTitle($this->plugin->txt('common_actions'));
$current_selection_list->setId(self::TBL_ID . '_actions_' . $PublicationSubUsage->getId());
$current_selection_list->setUseImages(false);

self::dic()->ctrl()->setParameter($this->parent_obj, 'id', $PublicationSubUsage->getId());
$current_selection_list->addItem($this->parent_obj->txt(xoctPublicationUsageGUI::CMD_EDIT), xoctPublicationUsageGUI::CMD_EDIT_SUB, self::dic()->ctrl()->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_EDIT_SUB));
$current_selection_list->addItem($this->parent_obj->txt(xoctPublicationUsageGUI::CMD_DELETE), xoctPublicationUsageGUI::CMD_DELETE_SUB, self::dic()->ctrl()->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_CONFIRM_DELETE_SUB));
$this->ctrl->setParameter($this->parent_obj, 'id', $PublicationSubUsage->getId());
$current_selection_list->addItem(
$this->parent_obj->txt(xoctPublicationUsageGUI::CMD_EDIT),
xoctPublicationUsageGUI::CMD_EDIT_SUB,
$this->ctrl->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_EDIT_SUB)
);
$current_selection_list->addItem(
$this->parent_obj->txt(xoctPublicationUsageGUI::CMD_DELETE),
xoctPublicationUsageGUI::CMD_DELETE_SUB,
$this->ctrl->getLinkTarget($this->parent_obj, xoctPublicationUsageGUI::CMD_CONFIRM_DELETE_SUB)
);

$this->tpl->setVariable('ACTIONS', $current_selection_list->getHTML());
}
Expand Down

0 comments on commit 43e70fe

Please sign in to comment.