Skip to content

Commit

Permalink
[FIX] 0028333: pulled changes from release_6 to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chfsx committed May 29, 2020
1 parent 577801e commit eb395b8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 214 deletions.
19 changes: 2 additions & 17 deletions Services/GlobalScreen/classes/class.ilGSProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

/**
* Class ilGSProviderFactory
*
* @author Fabian Schmid <[email protected]>
*/
class ilGSProviderFactory implements ProviderFactory
Expand All @@ -40,18 +39,16 @@ class ilGSProviderFactory implements ProviderFactory
*/
protected $all_providers;


/**
* @inheritDoc
*/
public function __construct(Container $dic)
{
$this->dic = $dic;
$this->dic = $dic;
$this->main_menu_item_information = new ilMMItemInformation();
$this->class_loader = include "Services/GlobalScreen/artifacts/global_screen_providers.php";
$this->class_loader = include "Services/GlobalScreen/artifacts/global_screen_providers.php";
}


private function initPlugins() : void
{
if (!is_array($this->plugin_provider_collections)) {
Expand All @@ -62,7 +59,6 @@ private function initPlugins() : void
}
}


/**
* @param array $providers
*/
Expand All @@ -76,7 +72,6 @@ function (Provider $item) {
);
}


/**
* @inheritDoc
*/
Expand All @@ -100,7 +95,6 @@ public function getMainBarProvider() : array
return $providers;
}


/**
* @inheritDoc
*/
Expand All @@ -124,7 +118,6 @@ public function getMetaBarProvider() : array
return $providers;
}


/**
* @inheritDoc
*/
Expand All @@ -148,7 +141,6 @@ public function getToolProvider() : array
return $providers;
}


/**
* @inheritDoc
*/
Expand All @@ -170,7 +162,6 @@ public function getModificationProvider() : array
return $providers;
}


/**
* @inheritDoc
*/
Expand All @@ -194,7 +185,6 @@ public function getNotificationsProvider() : array
return $providers;
}


/**
* @param array $array_of_core_providers
* @param string $interface
Expand All @@ -213,7 +203,6 @@ private function appendPlugins(array &$array_of_core_providers, string $interfac
}
}


/**
* @param array $array_of_providers
* @param string $interface
Expand All @@ -231,7 +220,6 @@ private function appendCore(array &$array_of_providers, string $interface) : voi
}
}


/**
* @inheritDoc
*/
Expand All @@ -240,7 +228,6 @@ public function getMainBarItemInformation() : ItemInformation
return $this->main_menu_item_information;
}


/**
* @inheritDoc
*/
Expand All @@ -253,7 +240,6 @@ public function getProviderByClassName(string $class_name) : Provider
return $this->all_providers[$class_name];
}


/**
* @inheritDoc
*/
Expand All @@ -266,7 +252,6 @@ public function isInstanceCreationPossible(string $class_name) : bool
}
}


/**
* @inheritDoc
*/
Expand Down
18 changes: 3 additions & 15 deletions Services/MainMenu/classes/Administration/class.ilMMSubItemGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

/**
* Class ilMMTopItemGUI
*
* @ilCtrl_IsCalledBy ilMMSubItemGUI: ilObjMainMenuGUI
* @ilCtrl_Calls ilMMSubItemGUI: ilMMItemTranslationGUI
*
* @author Fabian Schmid <[email protected]>
*/
class ilMMSubItemGUI extends ilMMAbstractItemGUI
{
use Hasher;

const CMD_VIEW_SUB_ITEMS = 'subtab_subitems';
const CMD_ADD = 'subitem_add';
const CMD_CREATE = 'subitem_create';
Expand All @@ -27,7 +26,6 @@ class ilMMSubItemGUI extends ilMMAbstractItemGUI
const CMD_RENDER_INTERRUPTIVE = 'render_interruptive_modal';
const CMD_CANCEL = 'cancel';


private function dispatchCommand($cmd)
{
global $DIC;
Expand Down Expand Up @@ -95,10 +93,10 @@ private function saveTable() : void
global $DIC;
$r = $DIC->http()->request()->getParsedBody();
foreach ($r[self::IDENTIFIER] as $identification_string => $data) {
$item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
$item = $this->repository->getItemFacadeForIdentificationString($this->unhash($identification_string));
$position = (int) $data['position'];
$item->setPosition($position);
$item->setActiveStatus((bool) $data['active']);
$item->setActiveStatus(isset($data['active']) && (bool) $data['active']);
$item->setParent($this->unhash((string) $data['parent']));
$this->repository->updateItem($item);
}
Expand Down Expand Up @@ -127,10 +125,8 @@ public function executeCommand() : void
}
}


/**
* @param $DIC
*
* @return string
* @throws Throwable
*/
Expand All @@ -141,10 +137,8 @@ private function add($DIC) : string
return $f->getHTML();
}


/**
* @param $DIC
*
* @return string
* @throws Throwable
*/
Expand All @@ -158,10 +152,8 @@ private function create($DIC) : string
return $f->getHTML();
}


/**
* @param $DIC
*
* @return string
* @throws Throwable
*/
Expand All @@ -172,10 +164,8 @@ private function edit($DIC) : string
return $f->getHTML();
}


/**
* @param $DIC
*
* @return string
* @throws Throwable
*/
Expand Down Expand Up @@ -206,7 +196,6 @@ private function resetFilter() : void
$this->cancel();
}


/**
* @return string
*/
Expand Down Expand Up @@ -244,7 +233,6 @@ private function cancel() : void
$this->ctrl->redirectByClass(self::class, self::CMD_VIEW_SUB_ITEMS);
}


/**
* @return string
* @throws Throwable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?php

use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
use ILIAS\GlobalScreen\Scope\MainMenu\Factory\Item\Lost;

/**
* Class ilMMSubItemTableGUI
*
* @author Fabian Schmid <[email protected]>
*/
class ilMMSubItemTableGUI extends ilTable2GUI
{
use Hasher;

const IDENTIFIER = 'identifier';
const F_TABLE_SHOW_INACTIVE = 'table_show_inactive';
const F_TABLE_ENTRY_STATUS = 'entry_status';
Expand All @@ -29,10 +30,8 @@ class ilMMSubItemTableGUI extends ilTable2GUI
*/
private $item_repository;


/**
* ilMMSubItemTableGUI constructor.
*
* @param ilMMSubItemGUI $a_parent_obj
* @param ilMMItemRepository $item_repository
*/
Expand All @@ -44,7 +43,7 @@ public function __construct(ilMMSubItemGUI $a_parent_obj, ilMMItemRepository $it
$this->setExternalSegmentation(true);
parent::__construct($a_parent_obj);
$this->item_repository = $item_repository;
$this->lng = $this->parent_obj->lng;
$this->lng = $this->parent_obj->lng;
$this->addFilterItems();
$this->setData($this->resolveData());
$this->setFormAction($this->ctrl->getFormAction($this->parent_obj));
Expand All @@ -55,21 +54,19 @@ public function __construct(ilMMSubItemGUI $a_parent_obj, ilMMItemRepository $it
$this->setRowTemplate('tpl.sub_items.html', 'Services/MainMenu');
}


protected function addFilterItems()
{
$table_entry_status = new ilSelectInputGUI($this->lng->txt(self::F_TABLE_ENTRY_STATUS), self::F_TABLE_ENTRY_STATUS);
$table_entry_status->setOptions(
array(
self::F_TABLE_ALL_VALUE => $this->lng->txt("all"),
self::F_TABLE_ONLY_ACTIVE_VALUE => $this->lng->txt("only_active"),
self::F_TABLE_ALL_VALUE => $this->lng->txt("all"),
self::F_TABLE_ONLY_ACTIVE_VALUE => $this->lng->txt("only_active"),
self::F_TABLE_ONLY_INACTIVE_VALUE => $this->lng->txt("only_inactive"),
)
);
$this->addAndReadFilterItem($table_entry_status);
}


/**
* @param $field
*/
Expand All @@ -84,7 +81,6 @@ protected function addAndReadFilterItem(ilFormPropertyGUI $field)
}
}


private function initColumns()
{
$this->addColumn($this->lng->txt('sub_parent'));
Expand All @@ -97,7 +93,6 @@ private function initColumns()
$this->addColumn($this->lng->txt('sub_actions'));
}


/**
* @inheritDoc
*/
Expand All @@ -109,16 +104,20 @@ protected function fillRow($a_set)
global $DIC;

$renderer = $DIC->ui()->renderer();
$factory = $DIC->ui()->factory();
$factory = $DIC->ui()->factory();
/**
* @var $item_facade ilMMItemFacadeInterface
*/
$item_facade = $a_set['facade'];
if ($item_facade->isChild()) {
if (!$current_parent || $current_parent->getProviderIdentification() !== $item_facade->item()->getParent()) {
$current_parent = $this->item_repository->getSingleItem($item_facade->item()->getParent());
if ($current_parent instanceof Lost) {

if (!$current_parent || $current_parent->getProviderIdentification() !== $item_facade->item()->getParent()) {
$current_parent = $this->item_repository->getSingleItem($item_facade->item()->getParent());
$this->tpl->setVariable("PARENT_TITLE", $current_parent->getTitle());
$position = 1;
}
$this->tpl->setVariable("PARENT_TITLE", $current_parent->getTitle()); // ." ({$current_parent->getProviderIdentification()->getInternalIdentifier()})"
$position = 1;
}
}
$this->tpl->setVariable('IDENTIFIER', self::IDENTIFIER);
$this->tpl->setVariable('ID', $this->hash($item_facade->getId()));
Expand All @@ -145,11 +144,11 @@ protected function fillRow($a_set)

$rendered_modal = "";
if ($item_facade->isCustom()) {
$ditem = $factory->modal()->interruptiveItem($this->hash($a_set['identification']), $item_facade->getDefaultTitle());
$ditem = $factory->modal()->interruptiveItem($this->hash($a_set['identification']), $item_facade->getDefaultTitle());
$action = $this->ctrl->getFormActionByClass(ilMMSubItemGUI::class, ilMMSubItemGUI::CMD_DELETE);
$m = $factory->modal()
->interruptive($this->lng->txt(ilMMSubItemGUI::CMD_DELETE), $this->lng->txt(ilMMSubItemGUI::CMD_CONFIRM_DELETE), $action)
->withAffectedItems([$ditem]);
$m = $factory->modal()
->interruptive($this->lng->txt(ilMMSubItemGUI::CMD_DELETE), $this->lng->txt(ilMMSubItemGUI::CMD_CONFIRM_DELETE), $action)
->withAffectedItems([$ditem]);

$items[] = $shy = $factory->button()->shy($this->lng->txt(ilMMSubItemGUI::CMD_DELETE), "")->withOnClick($m->getShowSignal());
// $items[] = $factory->button()->shy($this->lng->txt(ilMMSubItemGUI::CMD_DELETE), $this->ctrl->getLinkTargetByClass(ilMMSubItemGUI::class, ilMMSubItemGUI::CMD_CONFIRM_DELETE));
Expand All @@ -160,10 +159,8 @@ protected function fillRow($a_set)
}
}


/**
* @param ilMMItemFacadeInterface $child
*
* @return ilSelectInputGUI
*/
private function getSelect(ilMMItemFacadeInterface $child) : ilSelectInputGUI
Expand All @@ -175,7 +172,6 @@ private function getSelect(ilMMItemFacadeInterface $child) : ilSelectInputGUI
return $s;
}


/**
* @return array
*/
Expand All @@ -189,14 +185,13 @@ public function getPossibleParentsForFormAndTable() : array
return $parents;
}


private function resolveData() : array
{
global $DIC;
$sub_items_for_table = $this->item_repository->getSubItemsForTable();

foreach ($sub_items_for_table as $k => $item) {
$item_facade = $this->item_repository->repository()->getItemFacade($DIC->globalScreen()->identification()->fromSerializedIdentification($item['identification']));
$item_facade = $this->item_repository->repository()->getItemFacade($DIC->globalScreen()->identification()->fromSerializedIdentification($item['identification']));
$sub_items_for_table[$k]['facade'] = $item_facade;
if (isset($this->filter[self::F_TABLE_ENTRY_STATUS]) && $this->filter[self::F_TABLE_ENTRY_STATUS] !== self::F_TABLE_ALL_VALUE) {
if (($this->filter[self::F_TABLE_ENTRY_STATUS] == self::F_TABLE_ONLY_ACTIVE_VALUE && !$item_facade->isActivated())
Expand Down
Loading

0 comments on commit eb395b8

Please sign in to comment.