ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSurveyParticipantsTableGUI.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 
14 {
15  public function __construct($a_parent_obj, $a_parent_cmd, ilObjSurvey $a_svy)
16  {
17  global $lng, $ilCtrl;
18 
19  parent::__construct($a_parent_obj, $a_parent_cmd);
20 
21  $this->setTitle($lng->txt("svy_anonymous_participants_svy"));
22 
23  $this->addColumn($this->lng->txt("name"), "name");
24  $this->addColumn($this->lng->txt("login"), "login");
25  // $this->addColumn($this->lng->txt("gender"), "gender");
26  $this->addColumn($this->lng->txt("status"), "status");
27 
28  $this->setRowTemplate("tpl.il_svy_svy_participants_row.html", "Modules/Survey");
29  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
30  $this->setDefaultOrderField("name");
31 
32  $this->getItems($a_svy);
33  }
34 
35  protected function getItems(ilObjSurvey $a_svy)
36  {
37  global $lng;
38 
39  $data = array();
40 
41  foreach($a_svy->getSurveyParticipants(null, true) as $user)
42  {
43  if($user["finished"])
44  {
45  $status = $lng->txt("survey_results_finished");
46  }
47  else
48  {
49  $status = $lng->txt("survey_results_started");
50  }
51 
52  $data[$user["login"]] = array(
53  "name" => $user["sortname"],
54  "login" => $user["login"],
55  "status" => $status
56  );
57  }
58 
59  foreach($a_svy->getInvitedUsers() as $user_id)
60  {
61  $user = ilObjUser::_lookupName($user_id);
62  if($user["login"] &&
63  !array_key_exists($user["login"], $data))
64  {
65  $data[$user["login"]] = array(
66  "name" => $user["lastname"].", ".$user["firstname"],
67  "login" => $user["login"],
68  "status" => $lng->txt("survey_results_not_started")
69  );
70  }
71  }
72 
73  $this->setData($data);
74  }
75 
76  public function fillRow($a_set)
77  {
78  $this->tpl->setVariable("NAME", $a_set["name"]);
79  $this->tpl->setVariable("LOGIN", $a_set["login"]);
80  $this->tpl->setVariable("STATUS", $a_set["status"]);
81  }
82 }
static _lookupName($a_user_id)
lookup user name
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
& getSurveyParticipants($finished_ids=null, $force_non_anonymous=false)
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd, ilObjSurvey $a_svy)
& getInvitedUsers()
Returns a list of all invited users in a survey.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $lng
Definition: privfeed.php:17
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.