ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 

Private Member Functions

 getHomeItem ()
 

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

◆ getHomeItem()

ILIAS\Repository\Provider\RepositoryMainBarProvider::getHomeItem ( )
private

Definition at line 152 of file RepositoryMainBarProvider.php.

152 : Link
153 {
155
156 $title = static function () use ($dic): string {
157 try {
158 $nd = $dic['tree']->getNodeData(ROOT_FOLDER_ID);
159 $title = ($nd["title"] === "ILIAS" ? $dic->language()->txt("repository") : $nd["title"]);
161 } catch (InvalidArgumentException $e) {
162 return "";
163 }
164
165 return $title . " - " . $dic->language()->txt("rep_main_page");
166 };
167
168 $action = static function (): string {
169 try {
170 $static_link = (string) (new StandardURIBuilder(ILIAS_HTTP_PATH))->build('', null, ['?target=root_1']);
171 } catch (InvalidArgumentException $e) {
172 return "";
173 }
174
175 return $static_link;
176 };
177
178 return $this->mainmenu->link($this->if->identifier('rep_main_page'))
179 ->withTitle($title())
180 ->withAction($action());
181 }
language()
Get interface to the i18n service.
Definition: Container.php:95
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
const ROOT_FOLDER_ID
Definition: constants.php:32
$nd
Definition: error.php:30
withAction(URI|Signal|string $action)
if(!file_exists('../ilias.ini.php'))

References ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider\$dic, Vendor\Package\$e, $nd, ilObject\_getIcon(), ilObject\_lookupObjId(), if, ilUtil\img(), ILIAS\DI\Container\language(), ROOT_FOLDER_ID, ILIAS\GlobalScreen\Scope\Footer\Factory\withAction(), and ILIAS\GlobalScreen\Scope\Footer\Factory\withTitle().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNoLastVisitedMessage()

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

Definition at line 225 of file RepositoryMainBarProvider.php.

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

References $DIC, $lng, and $txt.

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): 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): 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 =>
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)

References ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider\$dic, Vendor\Package\$f, $ref_id, ILIAS\Repository\Provider\RepositoryMainBarProvider\getHomeItem(), ilUtil\getImagePath(), ILIAS\GlobalScreen\Helper\BasicAccessCheckClosuresSingleton\getInstance(), ILIAS\MainMenu\Provider\StandardTopItemsProvider\getInstance(), ilRepositoryExplorerGUI\getTopNodeForRefId(), if, ilExplorerBaseGUI\init(), ILIAS\Repository\Provider\RepositoryMainBarProvider\renderRepoTree(), ILIAS\UI\Component\Symbol\Icon\Standard\ROOT, 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 183 of file RepositoryMainBarProvider.php.

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

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

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: