ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPageHistoryTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
27 protected bool $rselect = false;
28 protected bool $lselect = false;
29
30 public function __construct(
31 object $a_parent_obj,
32 string $a_parent_cmd = ""
33 ) {
34 global $DIC;
35
36 $this->ctrl = $DIC->ctrl();
37 $this->lng = $DIC->language();
38 $this->access = $DIC->access();
39 $ilCtrl = $DIC->ctrl();
40 $lng = $DIC->language();
41
42 $this->setId("ilCOPgHistoryTable");
43 parent::__construct($a_parent_obj, $a_parent_cmd);
44 $this->setTitle($lng->txt("content_page_history"));
45
46 $this->addColumn("", "", "1");
47 $this->addColumn("", "", "1");
48 $this->addColumn($lng->txt("date"), "", "33%");
49 $this->addColumn($lng->txt("user"), "", "33%");
50 $this->addColumn($lng->txt("action"), "", "33%");
51 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
52 $this->setRowTemplate("tpl.page_history_row.html", "components/ILIAS/COPage");
53 $this->setDefaultOrderField("sortkey");
54 $this->setDefaultOrderDirection("desc");
55 $this->addMultiCommand("compareVersion", $lng->txt("cont_page_compare"));
56 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
57 }
58
63 public function numericOrdering(string $a_field): bool
64 {
65 if ($a_field == "sortkey") {
66 return true;
67 }
68 return false;
69 }
70
75 protected function fillRow(array $a_set): void
76 {
78 $ilCtrl = $this->ctrl;
79 $ilAccess = $this->access;
80
81 // rollback command
82 if ($a_set["nr"] > 0) {
83 $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
84 $this->tpl->setCurrentBlock("command");
85 $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback"));
86 $this->tpl->setVariable(
87 "HREF_COMMAND",
88 $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation")
89 );
90 $this->tpl->parseCurrentBlock();
91 $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
92 }
93
94 if (!$this->rselect) {
95 $this->tpl->setVariable("RSELECT", 'checked="checked"');
96 $this->rselect = true;
97 } elseif (!$this->lselect) {
98 $this->tpl->setVariable("LSELECT", 'checked="checked"');
99 $this->lselect = true;
100 }
101
102
103 $this->tpl->setVariable("NR", $a_set["nr"]);
104 $this->tpl->setVariable(
105 "TXT_HDATE",
107 );
108
109 $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
110 $ilCtrl->setParameter($this->getParentObject(), "history_mode", "1");
111 $this->tpl->setVariable(
112 "HREF_OLD_PAGE",
113 $ilCtrl->getLinkTarget($this->getParentObject(), "preview")
114 );
115 $ilCtrl->setParameter($this->getParentObject(), "history_mode", "");
116
117 if (ilObject::_exists($a_set["user"])) {
118 // user name
119 $name_pres = ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()));
120 $this->tpl->setVariable("TXT_USER", $name_pres);
121 }
122
123 $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
124 }
125}
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
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...
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd="")
fillRow(array $a_set)
Standard Version of Fill Row.
numericOrdering(string $a_field)
Should this field be sorted numeric?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
addMultiCommand(string $a_cmd, string $a_text)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
ilLanguage $lng
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26