ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  parent::__construct($a_parent_obj, $a_parent_cmd);
21  $this->setTitle($lng->txt("content_page_history"));
22 
23  $this->addColumn("", "c", "1");
24  $this->addColumn("", "d", "1");
25  $this->addColumn($lng->txt("date"), "", "33%");
26  $this->addColumn($lng->txt("user"), "", "33%");
27  $this->addColumn($lng->txt("action"), "", "33%");
28  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
29  $this->setRowTemplate("tpl.page_history_row.html", "Services/COPage");
30  $this->setDefaultOrderField("sortkey");
31  $this->setDefaultOrderDirection("desc");
32  $this->addMultiCommand("compareVersion", $lng->txt("cont_page_compare"));
33  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
34  }
35 
41  function numericOrdering($a_field)
42  {
43  if ($a_field == "sortkey")
44  {
45  return true;
46  }
47  return false;
48  }
49 
54  protected function fillRow($a_set)
55  {
56  global $lng, $ilCtrl, $ilAccess;
57 
58  // rollback command
59  if ($a_set["nr"] > 0)
60  {
61  $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
62  $this->tpl->setCurrentBlock("command");
63  $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback"));
64  $this->tpl->setVariable("HREF_COMMAND",
65  $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation"));
66  $this->tpl->parseCurrentBlock();
67  $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
68  }
69 
70  if (!$this->rselect)
71  {
72  $this->tpl->setVariable("RSELECT", 'checked="checked"');
73  $this->rselect = true;
74  }
75  else if (!$this->lselect)
76  {
77  $this->tpl->setVariable("LSELECT", 'checked="checked"');
78  $this->lselect = true;
79  }
80 
81 
82  $this->tpl->setVariable("NR", $a_set["nr"]);
83  $this->tpl->setVariable("TXT_HDATE",
85 
86  $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]);
87  $this->tpl->setVariable("HREF_OLD_PAGE",
88  $ilCtrl->getLinkTarget($this->getParentObject(), "preview"));
89 
90  if (ilObject::_exists($a_set["user"]))
91  {
92  // user name
93  $user = ilObjUser::_lookupName($a_set["user"]);
94  $login = ilObjUser::_lookupLogin($a_set["user"]);
95  $this->tpl->setVariable("TXT_LINKED_USER",
96  $user["lastname"].", ".$user["firstname"]." [".$login."]");
97 
98  // profile link
99  $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]);
100  $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url",
101  rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())));
102  $this->tpl->setVariable("USER_LINK",
103  $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
104  $img = ilObjUser::_getPersonalPicturePath($a_set["user"], "xxsmall", true);
105  $this->tpl->setVariable("IMG_USER", $img);
106  }
107 
108  $ilCtrl->setParameter($this->getParentObject(), "old_nr", "");
109  }
110 
111 }
112 ?>