ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilOrgUnitAssignmentTableGUI.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 require_once "./Services/Table/classes/class.ilTable2GUI.php";
5 
6 
17 {
18  public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id)
19  {
20  global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
21 
22  $this->setId("user");
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 // $this->setTitle($this->lng->txt("users"));
26 
27  #$this->addColumn("", "", "1", true);
28  $this->addColumn($this->lng->txt("org_unit_title"), "org_unit_title", "30%");
29  $this->addColumn($this->lng->txt("org_unit_subtitle"), "org_unit_subtitle", "50%");
30  $this->addColumn($this->lng->txt("org_unit_reporting_access"), "org_unit_reporting_access", "20%");
31 
32  $this->setExternalSorting(true);
33  $this->setExternalSegmentation(true);
34  $this->setEnableHeader(true);
35  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $this->parent_cmd));
36  $this->setRowTemplate("tpl.org_unit_assignment_row.html", "Services/OrgUnit");
37  //$this->disable("footer");
38  $this->setEnableTitle(true);
39  #$this->initFilter();
40  #$this->setFilterCommand("applyFilter");
41  $this->setDefaultOrderField("title");
42  $this->setDefaultOrderDirection("asc");
43 
44  #$this->setSelectAllCheckbox("id[]");
45  $this->setTopCommands(true);
46 
47  /*if ($rbacsystem->checkAccess('delete', $a_parent_obj->object->getRefId()))
48  {
49  $this->addMultiCommand("deleteUsers", $lng->txt("delete"));
50  }
51  $this->addMultiCommand("activateUsers", $lng->txt("activate"));
52  $this->addMultiCommand("deactivateUsers", $lng->txt("deactivate"));
53  $this->addMultiCommand("restrictAccess", $lng->txt("accessRestrict"));
54  $this->addMultiCommand("freeAccess", $lng->txt("accessFree"));
55  $this->addMultiCommand("exportUsers", $lng->txt("export"));
56  $this->addCommandButton("importUserForm", $lng->txt("import_users"));
57  $this->addCommandButton("addUser", $lng->txt("usr_add"));*/
58 
59  $this->getItems($a_user_id);
60  }
61 
62  public function fillRow($a_set)
63  {
64  global $ilCtrl, $lng;
65 
66  $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
67  $this->tpl->setVariable("VAL_SUBTITLE", $a_set["subtitle"]);
68  $reporting_access = $a_set["reporting_access"] ? $lng->txt('yes') : $lng->txt('no');
69  $this->tpl->setVariable("VAL_REPORTING_ACCESS", $reporting_access);
70  #$ilCtrl->setParameterByClass("ilobjusergui", "obj_id", $a_set["usr_id"]);
71  #$this->tpl->setVariable("HREF_LOGIN",
72  # $ilCtrl->getLinkTargetByClass("ilobjusergui", "view"));
73  #$ilCtrl->setParameterByClass("ilobjusergui", "obj_id", "");
74  }
75 
76  private function getItems($a_user_id)
77  {
78  global $lng;
79 
80  require_once('Services/OrgUnit/classes/class.ilOrgUnit.php');
81  $units = ilOrgUnit::getInstancesByAssignedUser($a_user_id);
82 
83  $data = array();
84  foreach($units as $unit)
85  {
86  $data[] = array(
87  'title' => $unit->getTitle(),
88  'subtitle' => $unit->getSubTitle(),
89  'reporting_access' => $unit->hasUserReportingAccess($a_user_id)
90  );
91  }
92 
93  $this->setData($data);
94  }
95 }
96 
97 ?>