ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4include_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 $DIC;
18
19 $this->lng = $DIC->language();
20 $this->ctrl = $DIC->ctrl();
21 $lng = $DIC->language();
22 $ilCtrl = $DIC->ctrl();
23
24 parent::__construct($a_parent_obj, $a_parent_cmd);
25
26 $this->setTitle($lng->txt("svy_anonymous_participants_svy"));
27
28 $this->addColumn($this->lng->txt("name"), "name");
29 $this->addColumn($this->lng->txt("login"), "login");
30 // $this->addColumn($this->lng->txt("gender"), "gender");
31 $this->addColumn($this->lng->txt("status"), "status");
32
33 $this->setRowTemplate("tpl.il_svy_svy_participants_row.html", "Modules/Survey");
34 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
35 $this->setDefaultOrderField("name");
36
37 $this->getItems($a_svy);
38 }
39
40 protected function getItems(ilObjSurvey $a_svy)
41 {
43
44 $data = array();
45
46 foreach ($a_svy->getSurveyParticipants(null, true) as $user) {
47 if ($user["finished"]) {
48 $status = $lng->txt("survey_results_finished");
49 } else {
50 $status = $lng->txt("survey_results_started");
51 }
52
53 $data[$user["login"]] = array(
54 "name" => $user["sortname"],
55 "login" => $user["login"],
56 "status" => $status
57 );
58 }
59
60 foreach ($a_svy->getInvitedUsers() as $user_id) {
61 $user = ilObjUser::_lookupName($user_id);
62 if ($user["login"] &&
63 !array_key_exists($user["login"], $data)) {
64 $data[$user["login"]] = array(
65 "name" => $user["lastname"] . ", " . $user["firstname"],
66 "login" => $user["login"],
67 "status" => $lng->txt("survey_results_not_started")
68 );
69 }
70 }
71
72 $this->setData($data);
73 }
74
75 public function fillRow($a_set)
76 {
77 $this->tpl->setVariable("NAME", $a_set["name"]);
78 $this->tpl->setVariable("LOGIN", $a_set["login"]);
79 $this->tpl->setVariable("STATUS", $a_set["status"]);
80 }
81}
An exception for terminatinating execution or to throw for unit testing.
& getInvitedUsers()
Returns a list of all invited users in a survey.
& getSurveyParticipants($finished_ids=null, $force_non_anonymous=false)
static _lookupName($a_user_id)
lookup user name
fillRow($a_set)
Standard Version of Fill Row.
__construct($a_parent_obj, $a_parent_cmd, ilObjSurvey $a_svy)
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7