ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilUserLPTableGUI.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, $a_ref_id)
17  {
18  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
19 
20  $this->ref_id = $a_ref_id;
21  $this->setId("admusrlp");
22 
23  parent::__construct($a_parent_obj, $a_parent_cmd);
24  // $this->setTitle($this->lng->txt("obj_usr"));
25 
26  $this->addColumn($this->lng->txt("login"), "login");
27  $this->addColumn($this->lng->txt("firstname"), "firstname");
28  $this->addColumn($this->lng->txt("lastname"), "lastname");
29  $this->addColumn($this->lng->txt("online_time"), "online_time");
30  $this->addColumn($this->lng->txt("last_login"), "last_login");
31  $this->setExternalSorting(true);
32  $this->setExternalSegmentation(true);
33 
34  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj));
35 
36  $this->setRowTemplate("tpl.user_list_lp_row.html", "Services/User");
37 
38  $this->setDefaultOrderField("login");
39  $this->setDefaultOrderDirection("asc");
40 
41  $this->setExportFormats(array(self::EXPORT_EXCEL));
42 
43  $this->getItems();
44  }
45 
46  function getItems()
47  {
48  $this->determineOffsetAndOrder();
49 
50  include_once("./Services/User/classes/class.ilUserQuery.php");
51  $usr_data = ilUserQuery::getUserListData(
56  null,
57  null,
58  null,
59  null,
60  null,
61  null,
62  null,
63  null,
64  array("online_time"),
65  null,
66  null
67  );
68 
69  if (count($usr_data["set"]) == 0 && $this->getOffset() > 0)
70  {
71  $this->resetOffset();
72  $usr_data = ilUserQuery::getUserListData(
77  null,
78  null,
79  null,
80  null,
81  null,
82  null,
83  null,
84  null,
85  array("online_time"),
86  null,
87  null
88  );
89  }
90 
91  $this->setMaxCount($usr_data["cnt"]);
92  $this->setData($usr_data["set"]);
93 
94  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
96  }
97 
98  protected function fillRow($user)
99  {
100  global $ilCtrl;
101 
102  if ($this->lp_active)
103  {
104  $ilCtrl->setParameterByClass("illearningprogressgui", "ref_id", $this->ref_id);
105  $ilCtrl->setParameterByClass("illearningprogressgui", "obj_id", $user["usr_id"]);
106  $link = $ilCtrl->getLinkTargetByClass(array("ilobjusergui",'illearningprogressgui'), "");
107 
108  $this->tpl->setCurrentBlock("login_link");
109  $this->tpl->setVariable("HREF_LOGIN", $link);
110  $this->tpl->setVariable("VAL_LOGIN", $user["login"]);
111  $this->tpl->parseCurrentBlock();
112 
113  }
114  else
115  {
116  $this->tpl->setCurrentBlock("login_plain");
117  $this->tpl->setVariable("VAL_LOGIN_PLAIN", $user["login"]);
118  $this->tpl->parseCurrentBlock();
119  }
120 
121  $this->tpl->setVariable("VAL_FIRSTNAME", $user["firstname"]);
122  $this->tpl->setVariable("VAL_LASTNAME", $user["lastname"]);
123  $this->tpl->setVariable("VAL_ONLINE_TIME",
124  ilFormat::_secondsToShortString($user["online_time"]));
125  $this->tpl->setVariable("VAL_LAST_LOGIN",
126  ilDatePresentation::formatDate(new ilDateTime($user["last_login"], IL_CAL_DATETIME)));
127  }
128 
129  protected function fillRowExcel($a_worksheet, &$a_row, $a_set)
130  {
131  $a_worksheet->write($a_row, 0, $a_set["login"]);
132  $a_worksheet->write($a_row, 1, $a_set["firstname"]);
133  $a_worksheet->write($a_row, 2, $a_set["lastname"]);
134  $a_worksheet->write($a_row, 3,
135  ilFormat::_secondsToShortString($a_set["online_time"]));
136  $a_worksheet->write($a_row, 4,
137  ilDatePresentation::formatDate(new ilDateTime($a_set["last_login"], IL_CAL_DATETIME)));
138  }
139 }
140 
141 ?>