ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLearningHistoryGUI Class Reference

Learning history main GUI class. More...

+ Collaboration diagram for ilLearningHistoryGUI:

Public Member Functions

 __construct ()
 
 setUserId (int $user_id)
 
 executeCommand ()
 
 getEmbeddedHTML (?int $from=null, ?int $to=null, ?array $classes=null, ?string $a_mode=null)
 
 getHTML (array $par)
 Get HTML. More...
 

Data Fields

const TAB_ID_LEARNING_HISTORY = 'lhist_learning_history'
 
const TAB_ID_MY_CERTIFICATES = 'certificates'
 
const MAX = 50
 

Protected Member Functions

 show ()
 
 renderAsync ()
 
 send (string $output)
 
 getHistoryHtml (?int $from=null, ?int $to=null, ?array $classes=null, ?string $mode=null)
 Get history html. More...
 
 renderButton ()
 

Protected Attributes

ILIAS HTTP Services $http
 
int $to
 
int $from
 
int $user_id
 
ilAccessHandler $access
 
ilLearningHistoryService $lhist_service
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $main_tpl
 
ilLanguage $lng
 
ILIAS DI UIServices $ui
 
ilSetting $certificateSettings
 
ilTabsGUI $tabs
 
bool $show_more = false
 
int $last_ts = 0
 

Detailed Description

Learning history main GUI class.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLearningHistoryGUI::__construct ( )

Definition at line 45 of file class.ilLearningHistoryGUI.php.

46 {
47 global $DIC;
48
49 $this->ctrl = $DIC->ctrl();
50
51 $this->lhist_service = $DIC->learningHistory();
52 $this->ui = $this->lhist_service->ui();
53 $this->main_tpl = $this->ui->mainTemplate();
54 $this->lng = $this->lhist_service->language();
55 $this->access = $this->lhist_service->access();
56 $this->tabs = $DIC->tabs();
57
58 $this->lng->loadLanguageModule("lhist");
59
60 $this->user_id = $this->lhist_service->user()->getId();
61
62 $this->certificateSettings = new ilSetting("certificate");
63
64 $request = $this->lhist_service->request();
65 $to = $request->getToTS();
66 $this->from = null;
67 $this->to = ($to > 0)
68 ? $to
69 : null;
70
71 $this->main_tpl->addJavaScript("assets/js/LearningHistory.js");
72 $this->http = $DIC->http();
73 }
ILIAS Setting Class.
static http()
Fetches the global http state from ILIAS.
to(\GdImage $image, ?int $quality=null)
Currently this is the only way to make a FileStream from a GD image resource.
global $DIC
Definition: shib_login.php:26

References $DIC, $to, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\to(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilLearningHistoryGUI::executeCommand ( )

Definition at line 80 of file class.ilLearningHistoryGUI.php.

80 : void
81 {
83
84 $next_class = $ctrl->getNextClass($this);
85 $cmd = $ctrl->getCmd("show");
86
87 switch ($next_class) {
88 default:
89 if (in_array($cmd, array("show", "renderAsync"))) {
90 $this->$cmd();
91 }
92 }
93 }
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(?string $fallback_command=null)
@inheritDoc

References $ctrl, ilCtrl\getCmd(), and ilCtrl\getNextClass().

+ Here is the call graph for this function:

◆ getEmbeddedHTML()

ilLearningHistoryGUI::getEmbeddedHTML ( ?int  $from = null,
?int  $to = null,
?array  $classes = null,
?string  $a_mode = null 
)
Exceptions
ilCtrlException

Definition at line 138 of file class.ilLearningHistoryGUI.php.

143 : string {
144 return $this->ctrl->getHTML($this, ["from" => $from, "to" => $to, "classes" => $classes, "mode" => $a_mode]);
145 }

◆ getHistoryHtml()

ilLearningHistoryGUI::getHistoryHtml ( ?int  $from = null,
?int  $to = null,
?array  $classes = null,
?string  $mode = null 
)
protected

Get history html.

Definition at line 158 of file class.ilLearningHistoryGUI.php.

163 : string {
164 $tpl = new ilTemplate("tpl.timeline.html", true, true, "components/ILIAS/LearningHistory");
165
166 $tpl->setVariable("TIMELINE", $this->renderTimeline($from, $to, $classes, $mode));
167
168 if ($this->show_more && $mode !== "print") {
169 $tpl->setCurrentBlock("show_more");
170 $tpl->setVariable("SHOW_MORE_BUTTON", $this->renderButton());
171 $tpl->parseCurrentBlock();
172 }
173
174 return $tpl->get();
175 }
special template class to simplify handling of ITX/PEAR

Referenced by show().

+ Here is the caller graph for this function:

◆ getHTML()

ilLearningHistoryGUI::getHTML ( array  $par)

Get HTML.

Definition at line 150 of file class.ilLearningHistoryGUI.php.

150 : string
151 {
152 return $this->getHistoryHtml($par["from"], $par["to"], $par["classes"], $par["mode"]);
153 }
getHistoryHtml(?int $from=null, ?int $to=null, ?array $classes=null, ?string $mode=null)
Get history html.

◆ renderAsync()

ilLearningHistoryGUI::renderAsync ( )
protected

Definition at line 115 of file class.ilLearningHistoryGUI.php.

115 : void
116 {
117 $response["timeline"] = $this->renderTimeline($this->from, $this->to);
118 $response["more"] = $this->show_more ? $this->renderButton() : "";
119 $this->send(json_encode($response, JSON_THROW_ON_ERROR));
120 }
$response
Definition: xapitoken.php:93

References $response, ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), renderButton(), send(), and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\to().

+ Here is the call graph for this function:

◆ renderButton()

ilLearningHistoryGUI::renderButton ( )
protected

Definition at line 226 of file class.ilLearningHistoryGUI.php.

226 : string
227 {
229 $f = $this->ui->factory();
230 $renderer = $this->ui->renderer();
231 $ctrl->setParameter($this, "to_ts", $this->last_ts - 1);
232 $url = $ctrl->getLinkTarget($this, "renderAsync", "", true);
233
234 $button = $f->button()->standard($this->lng->txt("lhist_show_more"), "")
235 ->withLoadingAnimationOnClick(true)
236 ->withOnLoadCode(static function ($id) use ($url): string {
237 return "il.LearningHistory.initShowMore('$id', '" . $url . "');";
238 });
239 if ($ctrl->isAsynch()) {
240 return $renderer->renderAsync($button);
241 }
242
243 return $renderer->render($button);
244 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$renderer
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
isAsynch()
@inheritDoc
$url
Definition: shib_logout.php:68

References Vendor\Package\$f, $id, $renderer, $url, ilCtrl\getLinkTarget(), ilCtrl\isAsynch(), ILIAS\Repository\lng(), ilCtrl\setParameter(), and ILIAS\Repository\ui().

Referenced by renderAsync().

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

◆ send()

ilLearningHistoryGUI::send ( string  $output)
protected
Parameters
string$output
Exceptions

ILIAS\HTTP\Response\Sender\ResponseSendingException

Definition at line 126 of file class.ilLearningHistoryGUI.php.

126 : void
127 {
128 $this->http->saveResponse($this->http->response()->withBody(
129 Streams::ofString($output)
130 ));
131 $this->http->sendResponse();
132 $this->http->close();
133 }

References ILIAS\FileDelivery\http().

Referenced by renderAsync().

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

◆ setUserId()

ilLearningHistoryGUI::setUserId ( int  $user_id)

Definition at line 75 of file class.ilLearningHistoryGUI.php.

75 : void
76 {
77 $this->user_id = $user_id;
78 }

References $user_id.

◆ show()

ilLearningHistoryGUI::show ( )
protected

Definition at line 95 of file class.ilLearningHistoryGUI.php.

95 : void
96 {
99 $f = $this->ui->factory();
100 $renderer = $this->ui->renderer();
101
102 $html = $this->getHistoryHtml($this->from, $this->to);
103
104 if ($html !== "") {
105 $main_tpl->setContent($html);
106 } else {
108 $renderer->render(
109 $f->messageBox()->info($lng->txt("lhist_no_entries"))
110 )
111 );
112 }
113 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilGlobalTemplateInterface $main_tpl
setContent(string $a_html)
Sets content for standard template.

References Vendor\Package\$f, $lng, $main_tpl, $renderer, ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from(), getHistoryHtml(), ILIAS\UICore\GlobalTemplate\setContent(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\to(), ilLanguage\txt(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilLearningHistoryGUI::$access
protected

Definition at line 34 of file class.ilLearningHistoryGUI.php.

◆ $certificateSettings

ilSetting ilLearningHistoryGUI::$certificateSettings
protected

Definition at line 40 of file class.ilLearningHistoryGUI.php.

◆ $ctrl

ilCtrl ilLearningHistoryGUI::$ctrl
protected

Definition at line 36 of file class.ilLearningHistoryGUI.php.

Referenced by executeCommand().

◆ $from

int ilLearningHistoryGUI::$from
protected

Definition at line 32 of file class.ilLearningHistoryGUI.php.

◆ $http

ILIAS HTTP Services ilLearningHistoryGUI::$http
protected

Definition at line 30 of file class.ilLearningHistoryGUI.php.

◆ $last_ts

int ilLearningHistoryGUI::$last_ts = 0
protected

Definition at line 43 of file class.ilLearningHistoryGUI.php.

◆ $lhist_service

ilLearningHistoryService ilLearningHistoryGUI::$lhist_service
protected

Definition at line 35 of file class.ilLearningHistoryGUI.php.

◆ $lng

ilLanguage ilLearningHistoryGUI::$lng
protected

Definition at line 38 of file class.ilLearningHistoryGUI.php.

Referenced by show().

◆ $main_tpl

ilGlobalTemplateInterface ilLearningHistoryGUI::$main_tpl
protected

Definition at line 37 of file class.ilLearningHistoryGUI.php.

Referenced by show().

◆ $show_more

bool ilLearningHistoryGUI::$show_more = false
protected

Definition at line 42 of file class.ilLearningHistoryGUI.php.

◆ $tabs

ilTabsGUI ilLearningHistoryGUI::$tabs
protected

Definition at line 41 of file class.ilLearningHistoryGUI.php.

◆ $to

int ilLearningHistoryGUI::$to
protected

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

Referenced by __construct().

◆ $ui

ILIAS DI UIServices ilLearningHistoryGUI::$ui
protected

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

◆ $user_id

int ilLearningHistoryGUI::$user_id
protected

Definition at line 33 of file class.ilLearningHistoryGUI.php.

Referenced by setUserId().

◆ MAX

const ilLearningHistoryGUI::MAX = 50

Definition at line 29 of file class.ilLearningHistoryGUI.php.

◆ TAB_ID_LEARNING_HISTORY

const ilLearningHistoryGUI::TAB_ID_LEARNING_HISTORY = 'lhist_learning_history'

Definition at line 27 of file class.ilLearningHistoryGUI.php.

◆ TAB_ID_MY_CERTIFICATES

const ilLearningHistoryGUI::TAB_ID_MY_CERTIFICATES = 'certificates'

Definition at line 28 of file class.ilLearningHistoryGUI.php.


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