ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilRepositoryGlobalScreenProvider Class Reference

Class ilRepositoryGlobalScreenProvider. More...

+ Inheritance diagram for ilRepositoryGlobalScreenProvider:
+ Collaboration diagram for ilRepositoryGlobalScreenProvider:

Public Member Functions

 __construct (\ILIAS\DI\Container $dic)
 ilRepositoryGlobalScreenProvider constructor. More...
 
 getTopItem ()
 Some other components want to provide Items for the main menu which are located at the PD TopTitem by default. More...
 
 getStaticTopItems ()
 @inheritDoc More...
 
 getStaticSubItems ()
 @inheritDoc More...
 
- 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 (Container $dic)
 @inheritDoc More...
 
 getFullyQualifiedClassName ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getStaticTopItems ()
 
 getStaticSubItems ()
 
 provideTypeInformation ()
 
 getAllIdentifications ()
 

Protected Attributes

 $top_item
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
 $dic
 
 $if
 
 $mainmenu
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 $dic
 

Additional Inherited Members

- Data Fields inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider
const PURPOSE_MAINBAR = 'mainmenu'
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilRepositoryGlobalScreenProvider::__construct ( \ILIAS\DI\Container  $dic)

ilRepositoryGlobalScreenProvider constructor.

Parameters
\ILIAS\DI\Container$dic

Definition at line 25 of file class.ilRepositoryGlobalScreenProvider.php.

26 {
27 parent::__construct($dic);
28 $this->top_item = $this->if->identifier('rep');
29 }

References ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider\$dic.

Member Function Documentation

◆ getStaticSubItems()

ilRepositoryGlobalScreenProvider::getStaticSubItems ( )

@inheritDoc

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

Definition at line 66 of file class.ilRepositoryGlobalScreenProvider.php.

66 : array
67 {
69
70 $title = function () use ($dic) : string {
71 try {
72 $nd = $dic['tree']->getNodeData(ROOT_FOLDER_ID);
73 $title = ($nd["title"] === "ILIAS" ? $dic->language()->txt("repository") : $nd["title"]);
74 $icon = ilUtil::img(ilObject::_getIcon(ilObject::_lookupObjId(1), "tiny"));
75 } catch (InvalidArgumentException $e) {
76 return "";
77 }
78
79 return $title . " - " . $dic->language()->txt("rep_main_page");
80 };
81
82 $action = function () : string {
83 try {
84 $static_link = ilLink::_getStaticLink(1, 'root', true);
85 } catch (InvalidArgumentException $e) {
86 return "";
87 }
88
89 return $static_link;
90 };
91
92 $entries[] = $this->mainmenu->link($this->if->identifier('rep_main_page'))
93 ->withTitle($title())
94 ->withAction($action())
95 ->withParent($this->getTopItem());
96
97 // LastVisited
98 $links = function () : array {
99 $items = [];
100 if (isset($this->dic['ilNavigationHistory'])) {
101 $items = $this->dic['ilNavigationHistory']->getItems();
102 }
103 $links = [];
104 reset($items);
105 $cnt = 0;
106 $first = true;
107
108 foreach ($items as $k => $item) {
109 if ($cnt >= 10) {
110 break;
111 }
112
113 if (!isset($item["ref_id"]) || !isset($_GET["ref_id"])
114 || ($item["ref_id"] != $_GET["ref_id"] || !$first)
115 ) { // do not list current item
116 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
117 $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"), $this->dic->language()->txt("obj_".
118 ilObject::_lookupType($obj_id)));
119 $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true); // #11023
120 $links[] = $this->mainmenu->link($this->if->identifier('last_visited_' . $obj_id))
121 ->withTitle($icon . " " . $ititle)
122 ->withAction($item["link"]);
123 }
124 $first = false;
125 }
126
127 return $links;
128 };
129 $entries[] = $this->mainmenu->linkList($this->if->identifier('last_visited'))
130 ->withLinks($links)
131 ->withTitle($this->dic->language()->txt('last_visited'))
132 ->withParent($this->getTopItem())->withVisibilityCallable(
133 function () use ($dic) {
134 return ($dic->user()->getId() != ANONYMOUS_USER_ID);
135 }
136 );
137
138 return $entries;
139 }
$_GET["client_id"]
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
getTopItem()
Some other components want to provide Items for the main menu which are located at the PD TopTitem by...
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
$action
$nd
Definition: error.php:10
$links

References $_GET, $action, ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider\$dic, $links, $nd, $title, ilLink\_getStaticLink(), ilObject\_lookupObjId(), ilObject\_lookupType(), getTopItem(), if, ilUtil\img(), and ilUtil\shortenText().

+ Here is the call graph for this function:

◆ getStaticTopItems()

ilRepositoryGlobalScreenProvider::getStaticTopItems ( )

@inheritDoc

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

Definition at line 48 of file class.ilRepositoryGlobalScreenProvider.php.

48 : array
49 {
51
52 return [$this->mainmenu->topParentItem($this->getTopItem())
53 ->withTitle($this->dic->language()->txt("repository"))
54 ->withPosition(2)
55 ->withVisibilityCallable(
56 function () use ($dic) {
57 return (bool) ($dic->access()->checkAccess('visible', '', ROOT_FOLDER_ID));
58 }
59 )];
60 }

References ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider\$dic, and getTopItem().

+ Here is the call graph for this function:

◆ getTopItem()

ilRepositoryGlobalScreenProvider::getTopItem ( )

Some other components want to provide Items for the main menu which are located at the PD TopTitem by default.

Therefore we have to provide our TopTitem Identification for others

Returns
IdentificationInterface

Definition at line 39 of file class.ilRepositoryGlobalScreenProvider.php.

References $top_item.

Referenced by getStaticSubItems(), and getStaticTopItems().

+ Here is the caller graph for this function:

Field Documentation

◆ $top_item

ilRepositoryGlobalScreenProvider::$top_item
protected

Definition at line 17 of file class.ilRepositoryGlobalScreenProvider.php.

Referenced by getTopItem().


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