ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPageHistoryTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
19  protected $ctrl;
20 
24  protected $access;
25 
26  public function __construct($a_parent_obj, $a_parent_cmd = "")
27  {
28  global $DIC;
29 
30  $this->ctrl = $DIC->ctrl();
31  $this->lng = $DIC->language();
32  $this->access = $DIC->access();
33  $ilCtrl = $DIC->ctrl();
34  $lng = $DIC->language();
35 
36  $this->setId("ilCOPgHistoryTable");
37  parent::__construct($a_parent_obj, $a_parent_cmd);
38  $this->setTitle($lng->txt("content_page_history"));
39 
40  $this->addColumn("", "", "1");
41  $this->addColumn("", "", "1");
42  $this->addColumn($lng->txt("date"), "", "33%");
43  $this->addColumn($lng->txt("user"), "", "33%");
44  $this->addColumn($lng->txt("action"), "", "33%");
45  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
46  $this->setRowTemplate("tpl.page_history_row.html", "Services/COPage");
47  $this->setDefaultOrderField("sortkey");
48  $this->setDefaultOrderDirection("desc");
49  $this->addMultiCommand("compareVersion", $lng->txt("cont_page_compare"));
50  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
51  }
52 
58  public function numericOrdering($a_field)
59  {
60  if ($a_field == "sortkey") {
61  return true;
62  }
63  return false;
64  }
65 
70  protected function fillRow($a_set)
71  {
72  $lng = $this->lng;
74  $ilAccess = $this->access;
75 
76  // rollback command
77  if ($a_set["nr"] > 0) {
78  $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
79  $this->tpl->setCurrentBlock("command");
80  $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback"));
81  $this->tpl->setVariable(
82  "HREF_COMMAND",
83  $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation")
84  );
85  $this->tpl->parseCurrentBlock();
86  $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
87  }
88 
89  if (!$this->rselect) {
90  $this->tpl->setVariable("RSELECT", 'checked="checked"');
91  $this->rselect = true;
92  } elseif (!$this->lselect) {
93  $this->tpl->setVariable("LSELECT", 'checked="checked"');
94  $this->lselect = true;
95  }
96 
97 
98  $this->tpl->setVariable("NR", $a_set["nr"]);
99  $this->tpl->setVariable(
100  "TXT_HDATE",
102  );
103 
104  $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
105  $ilCtrl->setParameter($this->getParentObject(), "history_mode", "1");
106  $this->tpl->setVariable(
107  "HREF_OLD_PAGE",
108  $ilCtrl->getLinkTarget($this->getParentObject(), "preview")
109  );
110  $ilCtrl->setParameter($this->getParentObject(), "history_mode", "");
111 
112  if (ilObject::_exists($a_set["user"])) {
113  // user name
114  $user = ilObjUser::_lookupName($a_set["user"]);
115  $login = ilObjUser::_lookupLogin($a_set["user"]);
116  //$this->tpl->setVariable("TXT_LINKED_USER",
117  // $user["lastname"].", ".$user["firstname"]." [".$login."]");
118 
119  // profile link
120  include_once("./Services/User/classes/class.ilUserUtil.php");
121  $name_pres = ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()));
122  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
123  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
124  // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
125  //$this->tpl->setVariable("USER_LINK",
126  // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
127  //$img = ilObjUser::_getPersonalPicturePath($a_set["user"], "xxsmall");
128  //$this->tpl->setVariable("IMG_USER", $img);
129  $this->tpl->setVariable("TXT_USER", $name_pres);
130  }
131 
132  $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
133  }
134 }
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
const IL_CAL_DATETIME
global $DIC
Definition: saml.php:7
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getParentCmd()
Get parent command.
Page History Table GUI Class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getParentObject()
Get parent object.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
Date and time handling
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
$user
Definition: migrateto20.php:57
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct($a_parent_obj, $a_parent_cmd="")
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
$login
Definition: cron.php:13
numericOrdering($a_field)
Should this field be sorted numeric?
fillRow($a_set)
Standard Version of Fill Row.