ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilObjTestListGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
16include_once "Services/Object/classes/class.ilObjectListGUI.php";
17include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
18
20{
21 protected $command_link_params = array();
22
28 {
29 $this->ilObjectListGUI();
30 $this->info_screen_enabled = true;
31 }
32
36 function init()
37 {
38 $this->static_link_enabled = true;
39 $this->delete_enabled = true;
40 $this->cut_enabled = true;
41 $this->copy_enabled = true;
42 $this->subscribe_enabled = true;
43 $this->link_enabled = true;
44 $this->payment_enabled = true;
45 $this->type = "tst";
46 $this->gui_class_name = "ilobjtestgui";
47
48 // general commands array
49 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
50 $this->commands = ilObjTestAccess::_getCommands();
51 }
52
53
62 function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
63 {
64 parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
65 }
66
67
75 function getCommandFrame($a_cmd)
76 {
77 switch($a_cmd)
78 {
79 case "":
80 case "infoScreen":
81 case "eval_a":
82 case "eval_stat":
83 include_once "./Services/UICore/classes/class.ilFrameTargetInfo.php";
84 $frame = ilFrameTargetInfo::_getFrame("MainContent");
85 break;
86
87 default:
88 }
89
90 return $frame;
91 }
92
93
94
103 function getProperties()
104 {
105 global $lng, $ilUser;
106
107 $props = array();
108 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
109
110 if (!ilObjTestAccess::_isOnline($this->obj_id))
111 {
112 $props[] = array("alert" => true, "property" => $lng->txt("status"),
113 "value" => $lng->txt("offline"));
114 }
115
116
117 // we cannot use ilObjTestAccess::_isOffline() because of text messages
118 $onlineaccess = ilObjTestAccess::_lookupOnlineTestAccess($this->obj_id, $ilUser->id);
119 if ($onlineaccess !== true)
120 {
121 $props[] = array("alert" => true, "property" => $lng->txt("status"),
122 "value" => $onlineaccess);
123 }
124
125 return $props;
126 }
127
128
136 function getCommandLink($a_cmd)
137 {
138 global $ilCtrl;
139
140 $a_cmd = explode('::', $a_cmd);
141
142 if( count($a_cmd) == 2 )
143 {
144 $cmd_link = $ilCtrl->getLinkTargetByClass(array('ilRepositoryGUI', 'ilObjTestGUI', $a_cmd[0]), $a_cmd[1]);
145 }
146 else
147 {
148 $cmd_link = $ilCtrl->getLinkTargetByClass('ilObjTestGUI', $a_cmd[0]);
149 }
150
151 $params = array_merge(array('ref_id' => $this->ref_id), $this->command_link_params);
152
153 foreach($params as $param => $value)
154 {
155 $cmd_link = ilUtil::appendUrlParameterString($cmd_link, "$param=$value", true);
156 }
157
158 return $cmd_link;
159 }
160
168 public function createDefaultCommand($a_command)
169 {
170 return $a_command;
171 }
172
173
181 public function addCommandLinkParameter($a_param)
182 {
183 $this->command_link_params = $a_param;
184 }
185
186 // begin-patch lok
187 protected function modifyTitleLink($a_default_link)
188 {
189 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
190 $id = ilLOSettings::isObjectiveTest($this->ref_id);
191
192 $cmd_link = $a_default_link;
193
194 if($id)
195 {
196 $ref_ids = ilObject::_getAllReferences($id);
197 $ref_id = end($ref_ids);
198
199 $this->ctrl->setParameterByClass("ilrepositorygui", 'ref_id', $ref_id);
200 $this->ctrl->setParameterByClass("ilrepositorygui", 'tid', $this->ref_id);
201 $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", 'redirectLocToTest');
202 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
203 $this->ctrl->clearParametersByClass('ilrepositorygui');
204 }
205 return parent::modifyTitleLink($cmd_link);
206 }
207 // end-patch lok
208
209} // END class.ilObjTestListGUI
210?>
static _getFrame($a_class, $a_type='')
Get content frame name.
static isObjectiveTest($a_trst_ref_id)
Check if test ref_id is used in an objective course.
_lookupOnlineTestAccess($a_test_id, $a_user_id)
Checks if a user is allowd to run an online exam.
_getCommands()
get commands
static _isOnline($a_obj_id)
returns the objects's ONline status
Class ilObjTestListGUI.
addCommandLinkParameter($a_param)
add command link parameters
getCommandFrame($a_cmd)
Get command target frame.
getProperties()
Get item properties.
modifyTitleLink($a_default_link)
getCommandLink($a_cmd)
Get command link url.
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item
createDefaultCommand($a_command)
overwritten from base class for course objectives
Class ilObjectListGUI.
ilObjectListGUI()
constructor
static _getAllReferences($a_id)
get all reference ids of object
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15