ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\LearningModule\Menu\ilLMMenuGUI Class Reference
+ Collaboration diagram for ILIAS\LearningModule\Menu\ilLMMenuGUI:

Public Member Functions

 __construct (\ilLMPresentationService $lm_pres_service)
 Constructor. More...
 
 getEntries ()
 Get entries. More...
 

Protected Attributes

 $service
 
 $ctrl
 
 $ui
 
 $lm
 
 $lng
 
 $access
 
 $user
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 11 of file class.ilLMMenuGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LearningModule\Menu\ilLMMenuGUI::__construct ( \ilLMPresentationService  $lm_pres_service)

Constructor.

Definition at line 51 of file class.ilLMMenuGUI.php.

52 {
53 global $DIC;
54
55 $this->ui = $DIC->ui();
56 $this->ctrl = $DIC->ctrl();
57 $this->service = $lm_pres_service;
58 $this->lng = $DIC->language();
59 $this->access = $DIC->access();
60 $this->lm = $this->service->getLearningModule();
61 $this->offline = $lm_pres_service->getPresentationStatus()->offline();
62 $this->user = $DIC->user();
63 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
ui()
Definition: ui.php:5

References $DIC, ilLMPresentationService\getPresentationStatus(), ui(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ getEntries()

ILIAS\LearningModule\Menu\ilLMMenuGUI::getEntries ( )

Get entries.

Returns
array

Definition at line 69 of file class.ilLMMenuGUI.php.

70 {
71 $ui = $this->ui;
76
77 $entries = [];
78
79 $ctrl->setParameterByClass("illmpresentationgui", 'ref_id', $this->lm->getRefId());
80
81 // print selection
82 if ($this->lm->isActivePrintView() && $access->checkAccess("read", "", $this->lm->getRefId())) {
83 if (!$this->offline) {
84 $ui->mainTemplate()->addJavaScript("./Services/Form/js/Form.js");
85 $modal = $ui->factory()->modal()->roundtrip(
86 $lng->txt("cont_print_view"),
87 $ui->factory()->legacy('some modal')
88 )->withAsyncRenderUrl($this->ctrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection"));
89
90 $entries[] = [
91 "label" => $this->lng->txt("cont_print_view"),
92 "signal" => $modal->getShowSignal(),
93 "modal" => $modal,
94 "on_load" => ""
95 ];
96 }
97 }
98
99 // download
100 if ($user->getId() == ANONYMOUS_USER_ID) {
101 $is_public = $this->lm->isActiveDownloadsPublic();
102 } else {
103 $is_public = true;
104 }
105
106 if ($this->lm->isActiveDownloads() && !$this->offline && $is_public &&
107 $access->checkAccess("read", "", $this->lm->getRefId())) {
108 $modal = $ui->factory()->modal()->roundtrip(
109 $lng->txt("download"),
110 $ui->factory()->legacy('some modal')
111 )->withAsyncRenderUrl($this->ctrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList"));
112 $entries[] = [
113 "label" => $this->lng->txt("download"),
114 "signal" => $modal->getShowSignal(),
115 "modal" => $modal,
116 "on_load" => ""
117 ];
118 }
119
120 // user defined menu entries
121 $menu_editor = new \ilLMMenuEditor();
122 $menu_editor->setObjId($this->lm->getId());
123
124 $cust_menu = $menu_editor->getMenuEntries(true);
125 $generator = new SignalGenerator();
126 if (count($cust_menu) > 0 && $access->checkAccess("read", "", $this->lm->getRefId())) {
127 foreach ($cust_menu as $entry) {
128 // build goto-link for internal resources
129 if ($entry["type"] == "intern") {
130 $entry["link"] = ILIAS_HTTP_PATH . "/goto.php?target=" . $entry["link"];
131 }
132
133 // add http:// prefix if not exist
134 if (!strstr($entry["link"], '://') && !strstr($entry["link"], 'mailto:')) {
135 $entry["link"] = "http://" . $entry["link"];
136 }
137
138 if (!strstr($entry["link"], 'mailto:')) {
139 $entry["link"] = \ilUtil::appendUrlParameterString($entry["link"], "ref_id=" . $this->lm->getRefId());
140 }
141
142 $signal = $generator->create();
143
144 $entries[] = [
145 "label" => $entry["title"],
146 "signal" => $signal,
147 "modal" => null,
148 "on_load" => "$(document).on('" .
149 $signal->getId() .
150 "', function(event, signalData) {il.LearningModule.openMenuLink('" . $entry["link"] . "');});"
151 ];
152 }
153 }
154
155
156 return $entries;
157 }
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
const ANONYMOUS_USER_ID
Definition: constants.php:25

References ILIAS\LearningModule\Menu\ilLMMenuGUI\$access, ILIAS\LearningModule\Menu\ilLMMenuGUI\$ctrl, ILIAS\LearningModule\Menu\ilLMMenuGUI\$lng, ILIAS\LearningModule\Menu\ilLMMenuGUI\$ui, ILIAS\LearningModule\Menu\ilLMMenuGUI\$user, ANONYMOUS_USER_ID, and ilUtil\appendUrlParameterString().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ILIAS\LearningModule\Menu\ilLMMenuGUI::$access
protected

◆ $ctrl

ILIAS\LearningModule\Menu\ilLMMenuGUI::$ctrl
protected

◆ $lm

ILIAS\LearningModule\Menu\ilLMMenuGUI::$lm
protected

Definition at line 31 of file class.ilLMMenuGUI.php.

◆ $lng

ILIAS\LearningModule\Menu\ilLMMenuGUI::$lng
protected

◆ $service

ILIAS\LearningModule\Menu\ilLMMenuGUI::$service
protected

Definition at line 16 of file class.ilLMMenuGUI.php.

◆ $ui

ILIAS\LearningModule\Menu\ilLMMenuGUI::$ui
protected

◆ $user

ILIAS\LearningModule\Menu\ilLMMenuGUI::$user
protected

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