56 $this->ctrl = $DIC->ctrl();
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();
65 $this->lng->loadLanguageModule(
"lhist");
67 $this->user_id = $this->lhist_service->user()->getId();
69 $this->certificateSettings =
new ilSetting(
"certificate");
72 $this->to = ((int)
$_GET[
"to_ts"] > 0)
73 ? (int)
$_GET[
"to_ts"]
76 $this->main_tpl->addJavaScript(
"./Services/LearningHistory/js/LearningHistory.js");
86 $this->user_id = $user_id;
97 $next_class =
$ctrl->getNextClass($this);
98 $cmd =
$ctrl->getCmd(
"show");
100 switch ($next_class) {
102 if (in_array($cmd, array(
"show",
"renderAsync"))) {
116 $f = $this->ui->factory();
117 $renderer = $this->ui->renderer();
126 $f->messageBox()->info(
$lng->txt(
"lhist_no_entries"))
137 $response[
"timeline"] = $this->renderTimeline($this->from, $this->to);
156 return $ctrl->getHTML($this, [
"from" =>
$from,
"to" => $to,
"classes" => $classes,
"mode" => $a_mode]);
167 return $this->
getHistoryHtml($par[
"from"], $par[
"to"], $par[
"classes"], $par[
"mode"]);
177 $tpl =
new ilTemplate(
"tpl.timeline.html",
true,
true,
"Services/LearningHistory");
179 $tpl->setVariable(
"TIMELINE", $this->renderTimeline(
$from, $to, $classes, $mode));
181 if ($this->show_more && $mode !=
"print") {
182 $tpl->setCurrentBlock(
"show_more");
184 $tpl->parseCurrentBlock();
198 protected function renderTimeline(
int $from = null,
int $to = null, array $classes = null,
string $mode = null) :
string 200 $collector = $this->lhist_service->factory()->collector();
207 ? $to - (365 * 24 * 60 * 60)
210 $entries = $collector->getEntries(
$from, $to, $this->user_id, $classes);
217 while (($e = current($entries)) && $cnt < self::MAX) {
223 $this->lhist_service->repositoryTree()
225 $this->last_ts = $e->getTimestamp();
231 if (count($entries) > 0) {
235 $this->show_more = (count($entries) > $cnt);
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);
252 $button =
$f->button()->standard($this->lng->txt(
"lhist_show_more"),
"")
254 ->withOnLoadCode(
function (
$id) use (
$url) {
255 return "il.LearningHistory.initShowMore('$id', '" .
$url .
"');";
257 if (
$ctrl->isAsynch()) {
258 return $renderer->renderAsync($button);
260 return $renderer->render($button);
getEmbeddedHTML($from=null, $to=null, $classes=null, $a_mode=null)
Get HTML.
renderAsync()
Render Async.
Learning history main GUI class.
if(!array_key_exists('StateId', $_REQUEST)) $id
__construct()
Constructor.
special template class to simplify handling of ITX/PEAR
executeCommand()
Execute command.
const TAB_ID_LEARNING_HISTORY
withLoadingAnimationOnClick(bool $loading_animation_on_click=true)
getHistoryHtml($from=null, $to=null, $classes=null, $mode=null)
Get history html.
setUserId($user_id)
Set user id.
const TAB_ID_MY_CERTIFICATES
static getInstance()
Get instance.
renderButton()
render Button