ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRepositoryObjectResultTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once("./Services/Table/classes/class.ilTable2GUI.php");
25 
35 {
42  public function __construct($a_parent_obj,$a_parent_cmd)
43  {
44  global $ilCtrl, $lng, $ilAccess, $lng;
45 
46  parent::__construct($a_parent_obj, $a_parent_cmd);
47 
48  $this->addColumn("", "", "1", true);
49  $this->addColumn($this->lng->txt("title"), "title", "80%");
50  $this->addColumn($this->lng->txt("members"), "members", "20%");
51 
52  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj));
53  $this->setRowTemplate("tpl.rep_search_obj_result_row.html", "Services/Search");
54  $this->setTitle($this->lng->txt('search_results'));
55  $this->setEnableTitle(true);
56  $this->setId("group_table");
57  $this->setDefaultOrderField("title");
58  $this->setDefaultOrderDirection("asc");
59  $this->enable('select_all');
60  $this->setSelectAllCheckbox("obj[]");
61 
62  $this->addMultiCommand('listUsers', $this->lng->txt('grp_list_users'));
63  }
64 
70  public function fillRow($row)
71  {
72  $this->tpl->setVariable('VAL_ID',$row['id']);
73  $this->tpl->setVariable('VAL_TITLE',$row['title']);
74  if(strlen($row['desc']))
75  {
76  $this->tpl->setVariable('VAL_DESC',$row['desc']);
77  }
78  $this->tpl->setVariable('VAL_MEMBER',$row['member']);
79  return true;
80  }
81 
82 
88  public function parseObjectIds($a_ids)
89  {
90  foreach($a_ids as $object_id)
91  {
92  $row = array();
93  $type = ilObject::_lookupType($object_id);
94 
95  $row['title'] = ilObject::_lookupTitle($object_id);
96  $row['desc'] = ilObject::_lookupDescription($object_id);
97  $row['id'] = $object_id;
98 
99  switch($type)
100  {
101  case 'grp':
102  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
103  $part = ilGroupParticipants::_getInstanceByObjId($object_id);
104  $row['member'] = $part->getCountParticipants();
105  break;
106 
107  case 'crs':
108  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
109  $part = ilCourseParticipants::_getInstanceByObjId($object_id);
110  $row['member'] = $part->getCountParticipants();
111  break;
112 
113  case 'role':
114  global $rbacreview;
115  $row['member'] = count($rbacreview->assignedUsers($object_id));
116  break;
117  }
118 
119  $data[] = $row;
120  }
121  $this->setData($data ? $data : array());
122  }
123 }
124 ?>