ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjSurveyListGUI.php
Go to the documentation of this file.
1<?php
2
26{
28
29 public function __construct()
30 {
31 global $DIC;
32
33 $this->lng = $DIC->language();
34 $this->lng->loadLanguageModule("survey");
35 $this->user = $DIC->user();
36 $this->rbacsystem = $DIC->rbac()->system();
38 $this->info_screen_enabled = true;
39 }
40
41 public function init(): void
42 {
43 $this->static_link_enabled = true;
44 $this->delete_enabled = true;
45 $this->cut_enabled = true;
46 $this->copy_enabled = true;
47 $this->subscribe_enabled = true;
48 $this->link_enabled = true;
49 $this->type = "svy";
50 $this->gui_class_name = "ilobjsurveygui";
51
52 // general commands array
53 $this->commands = ilObjSurveyAccess::_getCommands();
54 }
55
56
57 public function getProperties(): array
58 {
60 $ilUser = $this->user;
62
63 $props = [];
64
65 if (!$rbacsystem->checkAccess("visible,read", $this->ref_id)) {
66 return $props;
67 }
68
69 $props = parent::getProperties();
70
71 if (!ilObject::lookupOfflineStatus($this->obj_id)) {
72 // BEGIN Usability Distinguish between status and participation
74 // no completion
75 $props[] = array("alert" => true,
76 "property" => $lng->txt("svy_participation"),
77 "value" => $lng->txt("svy_warning_survey_not_complete"),
78 'propertyNameVisible' => false);
79 } elseif ($ilUser->getId() !== ANONYMOUS_USER_ID) {
82 $props[] = array("alert" => false, "property" => $lng->txt("type"),
83 "value" => $lng->txt("survey_360_mode"), 'propertyNameVisible' => true);
84 } elseif ($mode === ilObjSurvey::MODE_SELF_EVAL) {
85 $props[] = array("alert" => false, "property" => $lng->txt("type"),
86 "value" => $lng->txt("survey_360_self_evaluation"), 'propertyNameVisible' => true);
87 } else {
88 $finished = ilObjSurveyAccess::_lookupFinished($this->obj_id, $ilUser->getId());
89
90 // finished
91 if ($finished === 1) {
92 $stat = $this->lng->txt("svy_finished");
93 }
94 // not finished
95 elseif ($finished === 0) {
96 $stat = $this->lng->txt("svy_not_finished");
97 }
98 // not started
99 else {
100 $stat = $this->lng->txt("svy_not_started");
101 }
102 $props[] = array("alert" => false, "property" => $lng->txt("svy_participation"),
103 "value" => $stat, 'propertyNameVisible' => true);
104 }
105 }
106 // END Usability Distinguish between status and participation
107 }
108
109 return $props;
110 }
111
112 public function getCommandLink(string $cmd): string
113 {
114 $link = "ilias.php?baseClass=ilObjSurveyGUI&amp;ref_id=" . $this->ref_id .
115 "&amp;cmd=$cmd";
116
117 $this->ctrl->setParameterByClass("ilObjSurveyGUI", "ref_id", $this->ref_id);
118 if ($cmd === "questions") {
119 $link = $this->ctrl->getLinkTargetByClass(
120 [
121 "ilObjSurveyGUI", "ilSurveyEditorGUI"],
122 "questions"
123 );
124 }
125 if ($cmd === "run") {
126 $link = $this->ctrl->getLinkTargetByClass(
127 [
128 "ilObjSurveyGUI"
129 ],
130 "run"
131 );
132 }
133 $this->ctrl->setParameterByClass(
134 "ilObjSurveyGUI",
135 "ref_id",
136 $this->requested_ref_id
137 );
138 return $link;
139 }
140}
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupMode(int $a_obj_id)
Get survey mode (see ilObjSurvey::MODE_... constants)
static _lookupFinished(int $a_obj_id, int $a_user_id=0)
get finished status
static _getCommands()
get commands
static _lookupCreationComplete(int $a_obj_id)
checks whether all necessary parts of the survey are given
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCommandLink(string $cmd)
Get command link url.
getProperties()
Get item properties.
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
const ANONYMOUS_USER_ID
Definition: constants.php:27
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26