Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 13 #4

Open
wants to merge 18 commits into
base: issue-13
Choose a base branch
from
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## [5.6.0]
- Introduced Dynamic Workflows

## [5.5.0]
- Updated to Opencast API 1.5.0
- Introduced Publication Usages and solved issue #182

## [5.4.1]
- Fixed a compatibility issue in the new caching service.

## [5.4.0]
- Implemented improved Caching Service which fixes #194

## [5.3.2]
- Fix #220: Upload of large files lead to a memory limit error.
- Fixed the Overlay when creating a new Event.

## [5.3.1]
- Fix #11 and #113: Introducing new Paella 7 Player

## [5.3.0]
- Implemented #193: The Chunk Size for Uploads is now configurable. The default value is 20MB, this can be changes in the plugin configuration.
- Fix #176: Fixed a static timeout in fileuploads, this now uses max_execution_time of the server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function __construct(xoctPermissionTemplateGUI $a_parent_obj, $a_parent_c
$b->setUrl($this->ctrl->getLinkTarget($a_parent_obj, xoctPermissionTemplateGUI::CMD_ADD));
$this->addCommandButtonInstance($b);

xoctWaiterGUI::initJS();
new WaitOverlay($this->main_tpl); // TODO check if needed

$this->main_tpl->addJavaScript($this->plugin->getDirectory() . '/templates/default/sortable.js');
$base_link = $this->ctrl->getLinkTarget($this->parent_obj, 'reorder', '', true);
$this->main_tpl->addOnLoadCode("xoctSortable.init('" . $base_link . "');");
Expand Down
154 changes: 154 additions & 0 deletions classes/Conf/PublicationUsage/class.xoctPublicationGroupFormGUI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?php

use srag\Plugins\Opencast\Model\Publication\Config\PublicationUsageGroup;

/**
* Class xoctPublicationGroupFormGUI
*
* @author Farbod Zamani Boroujeni <zamani@elan-ev.de>
*/
class xoctPublicationGroupFormGUI extends ilPropertyFormGUI
{
public const F_NAME = 'name';
public const F_DISPLAY_NAME = 'display_name';
public const F_DESCRIPTION = 'description';
public const F_DISPLAY_NAME_MAX_LENGTH = 10;

/**
* @var PublicationUsageGroup
*/
protected $object;
/**
* @var xoctPublicationUsageGUI
*/
protected $parent_gui;
/**
* @var bool $is_new
*/
protected $is_new = true;



/**
* @param xoctPublicationUsageGUI $parent_gui
* @param PublicationUsageGroup $xoctPublicationUsageGroup
* @param bool $is_new
*/
public function __construct($parent_gui, $xoctPublicationUsageGroup, $is_new = true)
{
parent::__construct();
$this->object = $xoctPublicationUsageGroup;
$this->parent_gui = $parent_gui;
$this->parent_gui->setTab();
$this->ctrl->saveParameter($parent_gui, 'id');
$this->is_new = $is_new;
$this->initForm();
}


/**
*
*/
protected function initForm()
{
$this->setTarget('_top');
$this->setFormAction($this->ctrl->getFormAction($this->parent_gui));
$this->initButtons();

$te = new ilTextInputGUI($this->txt(self::F_NAME), self::F_NAME);
$te->setRequired(true);
$this->addItem($te);

$max_lenght = self::F_DISPLAY_NAME_MAX_LENGTH;
$display_name = (!empty($this->object->getDisplayName()) ? $this->object->getDisplayName() : '{added display name}');
$info = sprintf($this->txt(self::F_DISPLAY_NAME . '_info'), $max_lenght, strtolower($display_name));
$te = new ilTextInputGUI($this->txt(self::F_DISPLAY_NAME), self::F_DISPLAY_NAME);
$te->setInfo($info);
$te->setMaxLength($max_lenght);
$te->setRequired(true);
$this->addItem($te);

$te = new ilTextAreaInputGUI($this->txt(self::F_DESCRIPTION), self::F_DESCRIPTION);
$this->addItem($te);
}


/**
* @param $lang_var
*
* @return string
*/
protected function txt($lang_var): string
{
return $this->parent_gui->txt("group_{$lang_var}");
}


/**
*
*/
public function fillForm()
{
$array = [
self::F_NAME => $this->object->getName(),
self::F_DISPLAY_NAME => $this->object->getDisplayName(),
self::F_DESCRIPTION => $this->object->getDescription(),
];

$this->setValuesByArray($array);
}


/**
* returns whether checkinput was successful or not.
*
* @return bool
*/
public function fillObject(): bool
{
if (!$this->checkInput()) {
return false;
}

$this->object->setName($this->getInput(self::F_NAME));
$this->object->setDisplayName($this->getInput(self::F_DISPLAY_NAME));
$this->object->setDescription($this->getInput(self::F_DESCRIPTION));

return true;
}


/**
* @return bool
*/
public function saveObject(): bool
{
if (!$this->fillObject()) {
return false;
}
if ($this->is_new) {
$this->object->create();
} else {
$this->object->update();
}

return true;
}


/**
*
*/
protected function initButtons()
{
if ($this->is_new) {
$this->setTitle($this->parent_gui->txt('create_group'));
$this->addCommandButton(xoctPublicationUsageGUI::CMD_CREATE_NEW_GROUP, $this->parent_gui->txt(xoctPublicationUsageGUI::CMD_CREATE));
} else {
$this->setTitle($this->parent_gui->txt('edit_group'));
$this->addCommandButton(xoctPublicationUsageGUI::CMD_UPDATE_GROUP, $this->parent_gui->txt(xoctPublicationUsageGUI::CMD_UPDATE));
}

$this->addCommandButton(xoctPublicationUsageGUI::CMD_CANCEL, $this->parent_gui->txt(xoctPublicationUsageGUI::CMD_CANCEL));
}
}
132 changes: 132 additions & 0 deletions classes/Conf/PublicationUsage/class.xoctPublicationGroupTableGUI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php

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;

/**
* Class xoctPublicationGroupTableGUI
*
* @author Farbod Zamani Boroujeni <zamani@elan-ev.de>
*/
class xoctPublicationGroupTableGUI extends ilTable2GUI
{
public const TBL_ID = 'tbl_xoct_pub_g';
/**
* @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);
$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($this->ctrl->getFormAction($a_parent_obj));
$this->initColumns();
$this->parseData();
}


/**
* @param array $a_set
*
* @throws DICException
*/
public function fillRow($a_set)
{
/**
* @var $publication_usage_group PublicationUsageGroup
*/
$publication_usage_group = PublicationUsageGroup::find($a_set['id']);
$this->tpl->setVariable('NAME', $publication_usage_group->getName());
$this->tpl->setVariable('DISPLAY_NAME', $publication_usage_group->getDisplayName());
$this->tpl->setVariable('DESCRIPTION', $publication_usage_group->getDescription());

$this->addActionMenu($publication_usage_group);
}


protected function initColumns()
{
$this->addColumn($this->parent_obj->txt('group_name'));
$this->addColumn($this->parent_obj->txt('group_display_name'));
$this->addColumn($this->parent_obj->txt('group_description'));

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


/**
* @param PublicationUsageGroup $publication_usage_group
*
* @throws DICException
*/
protected function addActionMenu(PublicationUsageGroup $publication_usage_group)
{
$current_selection_list = new ilAdvancedSelectionListGUI();
$current_selection_list->setListTitle($this->plugin->txt('common_actions'));
$current_selection_list->setId(self::TBL_ID . '_actions_' . $publication_usage_group->getId());
$current_selection_list->setUseImages(false);

$this->ctrl->setParameter($this->parent_obj, 'id', $publication_usage_group->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());
}


protected function parseData()
{
$groups = PublicationUsageGroupRepository::getSortedArrayList();
$this->setData($groups);
}


/**
* @param $item
*/
protected function addAndReadFilterItem(ilFormPropertyGUI $item)
{
$this->addFilterItem($item);
$item->readFromSession();
if ($item instanceof ilCheckboxInputGUI) {
$this->filter[$item->getPostVar()] = $item->getChecked();
} else {
$this->filter[$item->getPostVar()] = $item->getValue();
}
}
}
Loading