ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\Repository\Provider\RepositoryMainBarProvider Class Reference

Repository related main menu items. More...

+ Inheritance diagram for ILIAS\Repository\Provider\RepositoryMainBarProvider:
+ Collaboration diagram for ILIAS\Repository\Provider\RepositoryMainBarProvider:

Public Member Functions

 __construct (Container $dic)
 @inheritDoc More...
 
 getStaticTopItems ()
 
 getStaticSubItems ()
 
 getNoLastVisitedMessage ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getAllIdentifications ()
 @inheritDoc More...
 
 provideTypeInformation ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getStaticTopItems ()
 
 getStaticSubItems ()
 
 provideTypeInformation ()
 
 getAllIdentifications ()
 

Protected Member Functions

 renderLastVisited ()
 
 renderRepoTree (int $ref_id)
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Protected Attributes

StandardGUIRequest $request
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
Container $dic
 
IdentificationProviderInterface $if
 
MainMenuItemFactory $mainmenu
 

Detailed Description

Repository related main menu items.

Note: The Favourites menut item is currently part of the Dashboard PDMainBarProvider and should be moved here, since the Favourites services is implemented as a sub-service of the repository service.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 54 of file RepositoryMainBarProvider.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Repository\Provider\RepositoryMainBarProvider::__construct ( Container  $dic)

Member Function Documentation

◆ getNoLastVisitedMessage()

ILIAS\Repository\Provider\RepositoryMainBarProvider::getNoLastVisitedMessage ( )

Definition at line 227 of file RepositoryMainBarProvider.php.

227 : MessageBox
228 {
229 global $DIC;
230
231 $lng = $DIC->language();
232 $ui = $DIC->ui();
233 $lng->loadLanguageModule("rep");
234 $txt = $lng->txt("rep_no_last_visited_mess");
235 $mbox = $ui->factory()->messageBox()->info($txt);
236
237 return $mbox;
238 }
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26

References $DIC, and $lng.

Referenced by ILIAS\Repository\Provider\RepositoryMainBarProvider\renderLastVisited().

+ Here is the caller graph for this function:

◆ getStaticSubItems()

ILIAS\Repository\Provider\RepositoryMainBarProvider::getStaticSubItems ( )
Returns
isItem[] These are Entries which will be available for configuration.

Implements ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider.

Definition at line 69 of file RepositoryMainBarProvider.php.

69 : array
70 {
72 $f = $this->dic->ui()->factory();
73
74 $top = StandardTopItemsProvider::getInstance()->getRepositoryIdentification();
76
77 $title = $this->getHomeItem()->getTitle();
78 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::ROOT, $title);
79
80 // Home
81 $entries[] = $this->getHomeItem()
82 ->withVisibilityCallable($access_helper->isRepositoryVisible())
83 ->withParent($top)
84 ->withSymbol($icon)
85 ->withPosition(10);
86
87 // Tree-View
88 $title = $this->dic->language()->txt("mm_repo_tree_view");
89
90 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(ilUtil::getImagePath("standard/icon_reptr.svg"), $title);
91
93 $ref_id = $this->request->getRefId();
95 $asynch = ($top_node === 0);
96 $entries[]
97 = $this->mainmenu->complex($this->if->identifier('rep_tree_view'))
98 ->withVisibilityCallable($access_helper->isRepositoryVisible())
99 ->withContentWrapper(function () use ($ref_id): Legacy\Content {
100 return $this->dic->ui()->factory()->legacy()->content($this->renderRepoTree($ref_id));
101 })
102 ->withSupportsAsynchronousLoading($asynch)
103 ->withTitle($title)
104 ->withSymbol($icon)
105 ->withParent($top)
106 ->withPosition(20);
107
108 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(ilUtil::getImagePath("standard/icon_lstv.svg"), $title);
109
110 $p = $this;
111 $entries[] = $this->mainmenu
112 ->complex($this->if->identifier('last_visited'))
113 ->withTitle($this->dic->language()->txt('last_visited'))
114 ->withSupportsAsynchronousLoading(true)
115 ->withVisibilityCallable($access_helper->isUserLoggedIn($access_helper->isRepositoryReadable()))
116 ->withPosition(30)
117 ->withSymbol($icon)
118 ->withParent($top)
119 ->withContentWrapper(function () use ($p): Legacy\Content {
120 return $this->dic->ui()->factory()->legacy()->content($p->renderLastVisited());
121 });
122
123 $title = $this->dic->language()->txt("mm_favorites");
124 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(ilUtil::getImagePath("standard/icon_fav.svg"), $title);
125
126 $entries[] = $this->mainmenu->complex($this->if->identifier('mm_pd_sel_items'))
127 ->withSupportsAsynchronousLoading(true)
128 ->withTitle($title)
129 ->withSymbol($icon)
130 ->withContentWrapper(
131 static fn(): Legacy\Content =>
132 $f->legacy()->content((new ilFavouritesListGUI())->render())
133 )
134 ->withParent(StandardTopItemsProvider::getInstance()->getPersonalWorkspaceIdentification())
135 ->withPosition(10)
136 ->withAvailableCallable(
137 static fn(): bool =>
138 (bool) $dic->settings()->get('rep_favourites', "0")
139 )
141 $access_helper->isUserLoggedIn($access_helper->isRepositoryReadable(
142 static function () use ($dic): bool {
143 $pdItemsViewSettings = new ilPDSelectedItemsBlockViewSettings($dic->user());
144 return $pdItemsViewSettings->allViewsEnabled() || $pdItemsViewSettings->enabledSelectedItems();
145 }
146 ))
147 );
148 return $entries;
149 }
factory()
user()
Get the current user.
Definition: Container.php:71
settings()
Get the interface to the settings.
Definition: Container.php:135
static init(?ilGlobalTemplateInterface $a_main_tpl=null)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
withParent(IdentificationInterface $identification)
withVisibilityCallable(callable $is_visible)
if(!file_exists('../ilias.ini.php'))

References ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider\$dic, Vendor\Package\$f, $ref_id, ilUtil\getImagePath(), ILIAS\GlobalScreen\Helper\BasicAccessCheckClosuresSingleton\getInstance(), ILIAS\MainMenu\Provider\StandardTopItemsProvider\getInstance(), ilRepositoryExplorerGUI\getTopNodeForRefId(), if, ilExplorerBaseGUI\init(), ILIAS\Repository\Provider\RepositoryMainBarProvider\renderRepoTree(), ILIAS\DI\Container\settings(), ILIAS\DI\Container\user(), ILIAS\GlobalScreen\Scope\Footer\Factory\withParent(), ILIAS\GlobalScreen\Scope\Footer\Factory\withTitle(), and ILIAS\GlobalScreen\Scope\withVisibilityCallable().

+ Here is the call graph for this function:

◆ getStaticTopItems()

ILIAS\Repository\Provider\RepositoryMainBarProvider::getStaticTopItems ( )
Returns
TopParentItem[] These are Slates which will be available for configuration.

Implements ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider.

Definition at line 64 of file RepositoryMainBarProvider.php.

64 : array
65 {
66 return [];
67 }

◆ renderLastVisited()

ILIAS\Repository\Provider\RepositoryMainBarProvider::renderLastVisited ( )
protected

Definition at line 185 of file RepositoryMainBarProvider.php.

185 : string
186 {
187 $nav_items = [];
188 if (isset($this->dic['ilNavigationHistory'])) {
189 $nav_items = $this->dic['ilNavigationHistory']->getItems();
190 }
191 reset($nav_items);
192 $cnt = 0;
193 $first = true;
194 $item_groups = [];
195 $items = [];
196
197 $f = $this->dic->ui()->factory();
198 foreach ($nav_items as $k => $nav_item) {
199 if ($cnt++ >= 10) {
200 break;
201 }
202
203 if (!isset($nav_item["ref_id"]) || $this->request->getRefId() === 0
204 || ((int) $nav_item["ref_id"] !== $this->request->getRefId() || !$first)
205 ) { // do not list current item
206 $ititle = ilStr::shortenTextExtended(strip_tags($nav_item["title"]), 50, true); // #11023
207 $obj_id = ilObject::_lookupObjectId((int) $nav_item["ref_id"]);
208 $icon = $f->symbol()->icon()->custom(ilObject::_getIcon($obj_id), $ititle);
209 $icon->setLabel("");
210 $items[] = $f->item()->standard(
211 $f->link()->standard($ititle, $nav_item["link"])
212 )->withLeadIcon($icon);
213 }
214 $first = false;
215 }
216
217 if (count($items) > 0) {
218 $item_groups[] = $f->item()->group("", $items);
219 $panel = $f->panel()->secondary()->listing("", $item_groups);
220 return $this->dic->ui()->renderer()->render([$panel]);
221 }
222
223 return $this->dic->ui()->renderer()->render($this->getNoLastVisitedMessage());
224 }
static _lookupObjectId(int $ref_id)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)

References Vendor\Package\$f, ilObject\_getIcon(), ilObject\_lookupObjectId(), ILIAS\Repository\Provider\RepositoryMainBarProvider\getNoLastVisitedMessage(), and ilStr\shortenTextExtended().

+ Here is the call graph for this function:

◆ renderRepoTree()

ILIAS\Repository\Provider\RepositoryMainBarProvider::renderRepoTree ( int  $ref_id)
protected

Definition at line 240 of file RepositoryMainBarProvider.php.

240 : string
241 {
242 global $DIC;
243 $tree = $DIC->repositoryTree();
244 if ($ref_id <= 0 || $this->request->getBaseClass() === "ilAdministrationGUI" || !$tree->isInTree($ref_id)) {
245 $ref_id = $tree->readRootId();
246 }
247 $DIC->ctrl()->setParameterByClass("ilrepositorygui", "ref_id", $ref_id);
248 $exp = new \ilRepositoryExplorerGUI("ilrepositorygui", "showRepTree");
249 $exp->setSkipRootNode(true);
250 return $exp->getHTML() . "<script>" . $exp->getOnLoadCode() . "</script>";
251 }

References $DIC, and $ref_id.

Referenced by ILIAS\Repository\Provider\RepositoryMainBarProvider\getStaticSubItems().

+ Here is the caller graph for this function:

Field Documentation

◆ $request

StandardGUIRequest ILIAS\Repository\Provider\RepositoryMainBarProvider::$request
protected

Definition at line 56 of file RepositoryMainBarProvider.php.


The documentation for this class was generated from the following file: