ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRepositoryObjectResultTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 
15 {
22  public function __construct($a_parent_obj,$a_parent_cmd,$a_allow_object_selection = false)
23  {
24  global $ilCtrl, $lng, $ilAccess, $lng;
25 
26  parent::__construct($a_parent_obj, $a_parent_cmd);
27 
28  $this->addColumn("", "", "1", true);
29  $this->addColumn($this->lng->txt("title"), "title", "80%");
30  $this->addColumn($this->lng->txt("members"), "member", "20%");
31 
32  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj));
33  $this->setRowTemplate("tpl.rep_search_obj_result_row.html", "Services/Search");
34  $this->setTitle($this->lng->txt('search_results'));
35  $this->setEnableTitle(true);
36  $this->setId("group_table");
37  $this->setDefaultOrderField("title");
38  $this->setDefaultOrderDirection("asc");
39  $this->enable('select_all');
40  $this->setSelectAllCheckbox("obj[]");
41 
42  $this->addMultiCommand('listUsers', $this->lng->txt('grp_list_users'));
43  if((bool)$a_allow_object_selection)
44  {
45  $this->addMultiCommand('selectObject', $this->lng->txt('grp_select_object'));
46  }
47  }
48 
54  public function fillRow($row)
55  {
56  if($row['member'])
57  {
58  $this->tpl->setVariable('VAL_ID',$row['id']);
59  }
60  $this->tpl->setVariable('VAL_TITLE',$row['title']);
61  if(strlen($row['desc']))
62  {
63  $this->tpl->setVariable('VAL_DESC',$row['desc']);
64  }
65  $this->tpl->setVariable('VAL_MEMBER',$row['member']);
66  return true;
67  }
68 
69 
75  public function parseObjectIds($a_ids)
76  {
77  foreach($a_ids as $object_id)
78  {
79  $row = array();
80  $type = ilObject::_lookupType($object_id);
81 
82  $row['title'] = ilObject::_lookupTitle($object_id);
83  $row['desc'] = ilObject::_lookupDescription($object_id);
84  $row['id'] = $object_id;
85 
86  switch($type)
87  {
88 
89  case 'crs':
90  case 'grp':
91 
92  include_once './Services/Membership/classes/class.ilParticipants.php';
94  {
95  $row['member'] = count(ilParticipants::getInstanceByObjId($object_id)->getParticipants());
96  }
97  else
98  {
99  $row['member'] = 0;
100  }
101  break;
102 
103  case 'role':
104  global $rbacreview;
105  include_once './Services/User/classes/class.ilUserFilter.php';
106  $row['member'] = count(ilUserFilter::getInstance()->filter($rbacreview->assignedUsers($object_id)));
107  break;
108  }
109 
110  $data[] = $row;
111  }
112  $this->setData($data ? $data : array());
113  }
114 
119  function numericOrdering($a_field)
120  {
121  if($a_field == "member")
122  {
123  return true;
124  }
125  return false;
126  }
127 }
128 ?>