ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

References $_GET, and $DIC.

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  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]

Member Function Documentation

◆ executeCommand()

ilLearningHistoryGUI::executeCommand ( )

Execute command.

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

References $ctrl.

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  }

◆ 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.

References $ctrl, and $from.

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

◆ 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.

References $ctrl, $from, $html, $tpl, ilTimelineGUI\getInstance(), and renderButton().

Referenced by getHTML(), and show().

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  }
$tpl
Definition: ilias.php:10
$from
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilLearningHistoryGUI::getHTML (   $par)

Get HTML.

Parameters

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

References getHistoryHtml().

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.
+ Here is the call graph for this function:

◆ renderAsync()

ilLearningHistoryGUI::renderAsync ( )
protected

Render Async.

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

References $response, exit, and renderButton().

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: backend.php:16
$response
+ Here is the call graph for this function:

◆ renderButton()

ilLearningHistoryGUI::renderButton ( )
protected

render Button

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

References $ctrl, $f, $id, $url, and ILIAS\UI\Implementation\Component\withLoadingAnimationOnClick().

Referenced by getHistoryHtml(), and renderAsync().

245  {
246  $ctrl = $this->ctrl;
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"), "")
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  }
if(!array_key_exists('StateId', $_REQUEST)) $id
withLoadingAnimationOnClick(bool $loading_animation_on_click=true)
$url
+ 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.

References $f, $html, $lng, $main_tpl, and getHistoryHtml().

113  {
115  $lng = $this->lng;
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  }
getHistoryHtml($from=null, $to=null, $classes=null, $mode=null)
Get history html.
$html
Definition: example_001.php:87
+ 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

◆ $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: