ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilContributorTableGUI.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 
13 {
14  protected $contributor_role_id; // [int]
15  protected $contributor_ids; // [array]
16 
25  public function __construct($a_parent_obj, $a_parent_cmd, $a_contributor_role_id, array $a_contributor_ids = null)
26  {
27  global $ilCtrl;
28 
29  $this->contributor_role_id = $a_contributor_role_id;
30  $this->contributor_ids = $a_contributor_ids;
31 
32  parent::__construct($a_parent_obj, $a_parent_cmd);
33 
34  $this->addColumn("", "", 1);
35  $this->addColumn($this->lng->txt("name"), "name");
36 
37  $this->setDefaultOrderField("name");
38 
39  $this->setRowTemplate("tpl.contributor_row.html", "Modules/Blog");
40  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
41 
42  if($this->contributor_ids)
43  {
44  $this->setTitle($this->lng->txt("blog_contributor_container_add"));
45  $this->addMultiCommand("addContributorContainerAction", $this->lng->txt("add"));
46  }
47  else
48  {
49  $this->setTitle($this->lng->txt("blog_contributors"));
50  $this->addMultiCommand("removeContributor", $this->lng->txt("remove"));
51  }
52 
53  $this->getItems();
54  }
55 
59  protected function getItems()
60  {
61  global $rbacreview;
62 
63  if($this->contributor_ids)
64  {
65  $assigned =$rbacreview->assignedUsers($this->contributor_role_id);
66  }
67  else
68  {
69  $assigned = array();
70  $this->contributor_ids = $rbacreview->assignedUsers($this->contributor_role_id);
71  }
72 
73  include_once "Services/User/classes/class.ilUserUtil.php";
74 
75  $data = array();
76  foreach($this->contributor_ids as $id)
77  {
78  if(!in_array($id, $assigned))
79  {
80  $data[] = array("id" => $id,
81  "name" => ilUserUtil::getNamePresentation($id, false, false, "", true));
82  }
83  }
84 
85  $this->setData($data);
86  }
87 
93  protected function fillRow($a_set)
94  {
95  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
96  $this->tpl->setVariable("TXT_NAME", $a_set["name"]);
97  }
98 }
99 
100 ?>