ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLearningHistoryGUI Class Reference

Learning history main GUI class. More...

+ Collaboration diagram for ilLearningHistoryGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 setUserId ($user_id)
 Set user id. More...
 
 executeCommand ()
 Execute command. More...
 
 getEmbeddedHTML ($from=null, $to=null, $classes=null, $a_mode=null)
 Get HTML. More...
 
 getHTML ($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 ()
 Show. More...
 
 renderAsync ()
 Render Async. More...
 
 getHistoryHtml ($from=null, $to=null, $classes=null, $mode=null)
 Get history html. More...
 
 renderButton ()
 render Button More...
 

Protected Attributes

 $ctrl
 
 $main_tpl
 
 $lng
 
 $ui
 
 $certificateSettings
 
 $tabs
 
 $show_more = false
 
 $last_ts = 0
 

Detailed Description

Learning history main GUI class.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLearningHistoryGUI::__construct ( )

Constructor.

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

53 {
54 global $DIC;
55
56 $this->ctrl = $DIC->ctrl();
57
58 $this->lhist_service = $DIC->learningHistory();
59 $this->ui = $this->lhist_service->ui();
60 $this->main_tpl = $this->ui->mainTemplate();
61 $this->lng = $this->lhist_service->language();
62 $this->access = $this->lhist_service->access();
63 $this->tabs = $DIC->tabs();
64
65 $this->lng->loadLanguageModule("lhist");
66
67 $this->user_id = $this->lhist_service->user()->getId();
68
69 $this->certificateSettings = new ilSetting("certificate");
70
71 $this->from = null;
72 $this->to = ((int) $_GET["to_ts"] > 0)
73 ? (int) $_GET["to_ts"]
74 : null;
75
76 $this->main_tpl->addJavaScript("./Services/LearningHistory/js/LearningHistory.js");
77 }
$_GET["client_id"]
ILIAS Setting Class.
global $DIC
Definition: goto.php:24
ui()
Definition: ui.php:5

References $_GET, $DIC, and ui().

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilLearningHistoryGUI::executeCommand ( )

Execute command.

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

94 {
96
97 $next_class = $ctrl->getNextClass($this);
98 $cmd = $ctrl->getCmd("show");
99
100 switch ($next_class) {
101 default:
102 if (in_array($cmd, array("show", "renderAsync"))) {
103 $this->$cmd();
104 }
105 }
106 }

References $ctrl.

◆ getEmbeddedHTML()

ilLearningHistoryGUI::getEmbeddedHTML (   $from = null,
  $to = null,
  $classes = null,
  $a_mode = null 
)

Get HTML.

Parameters
null$from
null$to
null$classes
Returns
string
Exceptions
ilCtrlException

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

153 {
155
156 return $ctrl->getHTML($this, ["from" => $from, "to" => $to, "classes" => $classes, "mode" => $a_mode]);
157 }

References $ctrl.

◆ getHistoryHtml()

ilLearningHistoryGUI::getHistoryHtml (   $from = null,
  $to = null,
  $classes = null,
  $mode = null 
)
protected

Get history html.

Returns
string

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

176 {
177 $tpl = new ilTemplate("tpl.timeline.html", true, true, "Services/LearningHistory");
178
179 $tpl->setVariable("TIMELINE", $this->renderTimeline($from, $to, $classes, $mode));
180
181 if ($this->show_more && $mode != "print") {
182 $tpl->setCurrentBlock("show_more");
183 $tpl->setVariable("SHOW_MORE_BUTTON", $this->renderButton());
184 $tpl->parseCurrentBlock();
185 }
186
187 return $tpl->get();
188 }
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

References $tpl, and renderButton().

Referenced by getHTML(), and show().

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

◆ getHTML()

ilLearningHistoryGUI::getHTML (   $par)

Get HTML.

Parameters

return string

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

166 {
167 return $this->getHistoryHtml($par["from"], $par["to"], $par["classes"], $par["mode"]);
168 }
getHistoryHtml($from=null, $to=null, $classes=null, $mode=null)
Get history html.

References getHistoryHtml().

+ Here is the call graph for this function:

◆ renderAsync()

ilLearningHistoryGUI::renderAsync ( )
protected

Render Async.

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

136 {
137 $response["timeline"] = $this->renderTimeline($this->from, $this->to);
138 $response["more"] = $this->show_more ? $this->renderButton() : "";
139 echo json_encode($response);
140 exit;
141 }
exit
Definition: login.php:29
$response

References $response, exit, and renderButton().

+ Here is the call graph for this function:

◆ renderButton()

ilLearningHistoryGUI::renderButton ( )
protected

render Button

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

245 {
247 $f = $this->ui->factory();
248 $renderer = $this->ui->renderer();
249 $ctrl->setParameter($this, "to_ts", $this->last_ts - 1);
250 $url = $ctrl->getLinkTarget($this, "renderAsync", "", true);
251
252 $button = $f->button()->standard($this->lng->txt("lhist_show_more"), "")
253 ->withLoadingAnimationOnClick(true)
254 ->withOnLoadCode(function ($id) use ($url) {
255 return "il.LearningHistory.initShowMore('$id', '" . $url . "');";
256 });
257 if ($ctrl->isAsynch()) {
258 return $renderer->renderAsync($button);
259 } else {
260 return $renderer->render($button);
261 }
262 }
$url

References $ctrl, Vendor\Package\$f, $url, and ui().

Referenced by getHistoryHtml(), and renderAsync().

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

◆ setUserId()

ilLearningHistoryGUI::setUserId (   $user_id)

Set user id.

Parameters
int$user_id

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

85 {
86 $this->user_id = $user_id;
87 }

◆ show()

ilLearningHistoryGUI::show ( )
protected

Show.

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

113 {
116 $f = $this->ui->factory();
117 $renderer = $this->ui->renderer();
118
119 $html = $this->getHistoryHtml($this->from, $this->to);
120
121 if ($html != "") {
122 $main_tpl->setContent($html);
123 } else {
124 $main_tpl->setContent(
125 $renderer->render(
126 $f->messageBox()->info($lng->txt("lhist_no_entries"))
127 )
128 );
129 }
130 }

References Vendor\Package\$f, $lng, $main_tpl, getHistoryHtml(), and ui().

+ Here is the call graph for this function:

Field Documentation

◆ $certificateSettings

ilLearningHistoryGUI::$certificateSettings
protected

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

◆ $ctrl

ilLearningHistoryGUI::$ctrl
protected

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

Referenced by executeCommand(), getEmbeddedHTML(), and renderButton().

◆ $last_ts

ilLearningHistoryGUI::$last_ts = 0
protected

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

◆ $lng

ilLearningHistoryGUI::$lng
protected

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

Referenced by show().

◆ $main_tpl

ilLearningHistoryGUI::$main_tpl
protected

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

Referenced by show().

◆ $show_more

ilLearningHistoryGUI::$show_more = false
protected

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

◆ $tabs

ilLearningHistoryGUI::$tabs
protected

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

◆ $ui

ilLearningHistoryGUI::$ui
protected

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

◆ MAX

const ilLearningHistoryGUI::MAX = 50

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

◆ TAB_ID_LEARNING_HISTORY

const ilLearningHistoryGUI::TAB_ID_LEARNING_HISTORY = 'lhist_learning_history'

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

◆ TAB_ID_MY_CERTIFICATES

const ilLearningHistoryGUI::TAB_ID_MY_CERTIFICATES = 'certificates'

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


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