ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSurveyParticipantsTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
6
12{
17
18 public function __construct($a_parent_obj, $a_parent_cmd, ilObjSurvey $a_svy)
19 {
20 global $DIC;
21
22 $this->lng = $DIC->language();
23 $this->ctrl = $DIC->ctrl();
24 $lng = $DIC->language();
25 $ilCtrl = $DIC->ctrl();
26 $this->invitation_manager = new Participants\InvitationsManager();
27
28 parent::__construct($a_parent_obj, $a_parent_cmd);
29
30 $this->setTitle($lng->txt("svy_anonymous_participants_svy"));
31
32 $this->addColumn($this->lng->txt("name"), "name");
33 $this->addColumn($this->lng->txt("login"), "login");
34 // $this->addColumn($this->lng->txt("gender"), "gender");
35 $this->addColumn($this->lng->txt("status"), "status");
36
37 $this->setRowTemplate("tpl.il_svy_svy_participants_row.html", "Modules/Survey/Participants");
38 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
39 $this->setDefaultOrderField("name");
40
41 $this->getItems($a_svy);
42 }
43
44 protected function getItems(ilObjSurvey $a_svy)
45 {
47
48 $data = array();
49
50 foreach ($a_svy->getSurveyParticipants(null, true) as $user) {
51 if ($user["finished"]) {
52 $status = $lng->txt("survey_results_finished");
53 } else {
54 $status = $lng->txt("survey_results_started");
55 }
56
57 $data[$user["login"]] = array(
58 "name" => $user["sortname"],
59 "login" => $user["login"],
60 "status" => $status
61 );
62 }
63
64 foreach ($this->invitation_manager->getAllForSurvey($a_svy->getSurveyId()) as $user_id) {
65 $user = ilObjUser::_lookupName($user_id);
66 if ($user["login"] &&
67 !array_key_exists($user["login"], $data)) {
68 $data[$user["login"]] = array(
69 "name" => $user["lastname"] . ", " . $user["firstname"],
70 "login" => $user["login"],
71 "status" => $lng->txt("survey_results_not_started")
72 );
73 }
74 }
75
76 $this->setData($data);
77 }
78
79 public function fillRow($a_set)
80 {
81 $this->tpl->setVariable("NAME", $a_set["name"]);
82 $this->tpl->setVariable("LOGIN", $a_set["login"]);
83 $this->tpl->setVariable("STATUS", $a_set["status"]);
84 }
85}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjSurvey.
& getSurveyParticipants($finished_ids=null, $force_non_anonymous=false, $include_invites=false)
getSurveyId()
Returns the survey database id.
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 $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc