-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] 0028333: pulled changes from release_6 to fix
- Loading branch information
Showing
7 changed files
with
51 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
|
||
/** | ||
* Class ilGSProviderFactory | ||
* | ||
* @author Fabian Schmid <[email protected]> | ||
*/ | ||
class ilGSProviderFactory implements ProviderFactory | ||
|
@@ -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)) { | ||
|
@@ -62,7 +59,6 @@ private function initPlugins() : void | |
} | ||
} | ||
|
||
|
||
/** | ||
* @param array $providers | ||
*/ | ||
|
@@ -76,7 +72,6 @@ function (Provider $item) { | |
); | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -100,7 +95,6 @@ public function getMainBarProvider() : array | |
return $providers; | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -124,7 +118,6 @@ public function getMetaBarProvider() : array | |
return $providers; | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -148,7 +141,6 @@ public function getToolProvider() : array | |
return $providers; | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -170,7 +162,6 @@ public function getModificationProvider() : array | |
return $providers; | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -194,7 +185,6 @@ public function getNotificationsProvider() : array | |
return $providers; | ||
} | ||
|
||
|
||
/** | ||
* @param array $array_of_core_providers | ||
* @param string $interface | ||
|
@@ -213,7 +203,6 @@ private function appendPlugins(array &$array_of_core_providers, string $interfac | |
} | ||
} | ||
|
||
|
||
/** | ||
* @param array $array_of_providers | ||
* @param string $interface | ||
|
@@ -231,7 +220,6 @@ private function appendCore(array &$array_of_providers, string $interface) : voi | |
} | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -240,7 +228,6 @@ public function getMainBarItemInformation() : ItemInformation | |
return $this->main_menu_item_information; | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -253,7 +240,6 @@ public function getProviderByClassName(string $class_name) : Provider | |
return $this->all_providers[$class_name]; | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -266,7 +252,6 @@ public function isInstanceCreationPossible(string $class_name) : bool | |
} | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|
@@ -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; | ||
|
@@ -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); | ||
} | ||
|
@@ -127,10 +125,8 @@ public function executeCommand() : void | |
} | ||
} | ||
|
||
|
||
/** | ||
* @param $DIC | ||
* | ||
* @return string | ||
* @throws Throwable | ||
*/ | ||
|
@@ -141,10 +137,8 @@ private function add($DIC) : string | |
return $f->getHTML(); | ||
} | ||
|
||
|
||
/** | ||
* @param $DIC | ||
* | ||
* @return string | ||
* @throws Throwable | ||
*/ | ||
|
@@ -158,10 +152,8 @@ private function create($DIC) : string | |
return $f->getHTML(); | ||
} | ||
|
||
|
||
/** | ||
* @param $DIC | ||
* | ||
* @return string | ||
* @throws Throwable | ||
*/ | ||
|
@@ -172,10 +164,8 @@ private function edit($DIC) : string | |
return $f->getHTML(); | ||
} | ||
|
||
|
||
/** | ||
* @param $DIC | ||
* | ||
* @return string | ||
* @throws Throwable | ||
*/ | ||
|
@@ -206,7 +196,6 @@ private function resetFilter() : void | |
$this->cancel(); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
*/ | ||
|
@@ -244,7 +233,6 @@ private function cancel() : void | |
$this->ctrl->redirectByClass(self::class, self::CMD_VIEW_SUB_ITEMS); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
* @throws Throwable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
|
@@ -29,10 +30,8 @@ class ilMMSubItemTableGUI extends ilTable2GUI | |
*/ | ||
private $item_repository; | ||
|
||
|
||
/** | ||
* ilMMSubItemTableGUI constructor. | ||
* | ||
* @param ilMMSubItemGUI $a_parent_obj | ||
* @param ilMMItemRepository $item_repository | ||
*/ | ||
|
@@ -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)); | ||
|
@@ -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 | ||
*/ | ||
|
@@ -84,7 +81,6 @@ protected function addAndReadFilterItem(ilFormPropertyGUI $field) | |
} | ||
} | ||
|
||
|
||
private function initColumns() | ||
{ | ||
$this->addColumn($this->lng->txt('sub_parent')); | ||
|
@@ -97,7 +93,6 @@ private function initColumns() | |
$this->addColumn($this->lng->txt('sub_actions')); | ||
} | ||
|
||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
|
@@ -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())); | ||
|
@@ -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)); | ||
|
@@ -160,10 +159,8 @@ protected function fillRow($a_set) | |
} | ||
} | ||
|
||
|
||
/** | ||
* @param ilMMItemFacadeInterface $child | ||
* | ||
* @return ilSelectInputGUI | ||
*/ | ||
private function getSelect(ilMMItemFacadeInterface $child) : ilSelectInputGUI | ||
|
@@ -175,7 +172,6 @@ private function getSelect(ilMMItemFacadeInterface $child) : ilSelectInputGUI | |
return $s; | ||
} | ||
|
||
|
||
/** | ||
* @return array | ||
*/ | ||
|
@@ -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()) | ||
|
Oops, something went wrong.