ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
16  function __construct($a_parent_obj, $a_parent_cmd = "")
17  {
18  global $ilCtrl, $lng;
19 
20  $this->setId("ilCOPgHistoryTable");
21  parent::__construct($a_parent_obj, $a_parent_cmd);
22  $this->setTitle($lng->txt("content_page_history"));
23 
24  $this->addColumn("", "", "1");
25  $this->addColumn("", "", "1");
26  $this->addColumn($lng->txt("date"), "", "33%");
27  $this->addColumn($lng->txt("user"), "", "33%");
28  $this->addColumn($lng->txt("action"), "", "33%");
29  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
30  $this->setRowTemplate("tpl.page_history_row.html", "Services/COPage");
31  $this->setDefaultOrderField("sortkey");
32  $this->setDefaultOrderDirection("desc");
33  $this->addMultiCommand("compareVersion", $lng->txt("cont_page_compare"));
34  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
35  }
36 
42  function numericOrdering($a_field)
43  {
44  if ($a_field == "sortkey")
45  {
46  return true;
47  }
48  return false;
49  }
50 
55  protected function fillRow($a_set)
56  {
57  global $lng, $ilCtrl, $ilAccess;
58 
59  // rollback command
60  if ($a_set["nr"] > 0)
61  {
62  $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
63  $this->tpl->setCurrentBlock("command");
64  $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback"));
65  $this->tpl->setVariable("HREF_COMMAND",
66  $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation"));
67  $this->tpl->parseCurrentBlock();
68  $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
69  }
70 
71  if (!$this->rselect)
72  {
73  $this->tpl->setVariable("RSELECT", 'checked="checked"');
74  $this->rselect = true;
75  }
76  else if (!$this->lselect)
77  {
78  $this->tpl->setVariable("LSELECT", 'checked="checked"');
79  $this->lselect = true;
80  }
81 
82 
83  $this->tpl->setVariable("NR", $a_set["nr"]);
84  $this->tpl->setVariable("TXT_HDATE",
86 
87  $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
88  $ilCtrl->setParameter($this->getParentObject(), "history_mode", "1");
89  $this->tpl->setVariable("HREF_OLD_PAGE",
90  $ilCtrl->getLinkTarget($this->getParentObject(), "preview"));
91  $ilCtrl->setParameter($this->getParentObject(), "history_mode", "");
92 
93  if (ilObject::_exists($a_set["user"]))
94  {
95  // user name
96  $user = ilObjUser::_lookupName($a_set["user"]);
97  $login = ilObjUser::_lookupLogin($a_set["user"]);
98  //$this->tpl->setVariable("TXT_LINKED_USER",
99  // $user["lastname"].", ".$user["firstname"]." [".$login."]");
100 
101  // profile link
102  include_once("./Services/User/classes/class.ilUserUtil.php");
103  $name_pres = ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()));
104  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
105  //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
106  // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
107  //$this->tpl->setVariable("USER_LINK",
108  // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
109  //$img = ilObjUser::_getPersonalPicturePath($a_set["user"], "xxsmall");
110  //$this->tpl->setVariable("IMG_USER", $img);
111  $this->tpl->setVariable("TXT_USER", $name_pres);
112 
113  }
114 
115  $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
116  }
117 
118 }
119 ?>
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
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.
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.
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)
Default behaviour is:
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
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="")
global $lng
Definition: privfeed.php:17
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.
numericOrdering($a_field)
Should this field be sorted numeric?
fillRow($a_set)
Standard Version of Fill Row.