ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjTestVerificationGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once ('./Services/Object/classes/class.ilObject2GUI.php');
5
17{
18 public function getType()
19 {
20 return "tstv";
21 }
22
26 public function create()
27 {
28 global $ilTabs;
29
30 if($this->id_type == self::WORKSPACE_NODE_ID)
31 {
32 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
34 {
35 $this->lng->loadLanguageModule("file");
36 ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
37 $this->ctrl->redirect($this, "cancel");
38 }
39 }
40
41 $this->lng->loadLanguageModule("tstv");
42
43 $ilTabs->setBackTarget($this->lng->txt("back"),
44 $this->ctrl->getLinkTarget($this, "cancel"));
45
46 include_once "Modules/Test/classes/tables/class.ilTestVerificationTableGUI.php";
47 $table = new ilTestVerificationTableGUI($this, "create");
48 $this->tpl->setContent($table->getHTML());
49 }
50
54 public function save()
55 {
56 global $ilUser;
57
58 $test_id = $_REQUEST["tst_id"];
59 if($test_id)
60 {
61 include_once "Modules/Test/classes/class.ilObjTest.php";
62 $test = new ilObjTest($test_id, false);
63
64 include_once "Modules/Test/classes/class.ilObjTestVerification.php";
66 if($newObj)
67 {
69 $this->node_id = null;
70 $this->putObjectInTree($newObj, $parent_id);
71
72 $this->afterSave($newObj);
73 }
74 else
75 {
76 ilUtil::sendFailure($this->lng->txt("msg_failed"));
77 }
78 }
79 else
80 {
81 ilUtil::sendFailure($this->lng->txt("select_one"));
82 }
83 $this->create();
84 }
85
86 public function deliver()
87 {
88 $file = $this->object->getFilePath();
89 if($file)
90 {
91 ilUtil::deliverFile($file, $this->object->getTitle().".pdf");
92 }
93 }
94
101 public function render($a_return = false, $a_url = false)
102 {
103 global $ilUser, $lng;
104
105 if(!$a_return)
106 {
107 $this->deliver();
108 }
109 else
110 {
111 $tree = new ilWorkspaceTree($ilUser->getId());
112 $wsp_id = $tree->lookupNodeId($this->object->getId());
113 $caption = $lng->txt("wsp_type_tstv").' "'.$this->object->getTitle().'"';
114
115 $valid = true;
116 if(!file_exists($this->object->getFilePath()))
117 {
118 $valid = false;
119 $message = $lng->txt("url_not_found");
120 }
121 else if(!$a_url)
122 {
123 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
125 if(!$access_handler->checkAccess("read", "", $wsp_id))
126 {
127 $valid = false;
128 $message = $lng->txt("permission_denied");
129 }
130 }
131
132 if($valid)
133 {
134 if(!$a_url)
135 {
136 $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
137 }
138 return '<div><a href="'.$a_url.'">'.$caption.'</a></div>';
139 }
140 else
141 {
142 return '<div>'.$caption.' ('.$message.')</div>';
143 }
144 }
145 }
146
148 {
149 global $ilErr;
150
151 include_once "Services/COPage/classes/class.ilPCVerification.php";
152 if(ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId()))
153 {
154 $this->deliver();
155 }
156
157 $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
158 }
159
160 public static function _goto($a_target)
161 {
162 $id = explode("_", $a_target);
163
164 $_GET["baseClass"] = "ilsharedresourceGUI";
165 $_GET["wsp_id"] = $id[0];
166 include("ilias.php");
167 exit;
168 }
169}
170
171?>
print $file
$test
Definition: Utf8Test.php:85
$_GET["client_id"]
static isUploadPossible($a_additional_size=null)
GUI class for test verification.
save()
create new instance and save it
downloadFromPortfolioPage(ilPortfolioPage $a_page)
getType()
Functions that must be overwritten.
render($a_return=false, $a_url=false)
Render content.
create()
List all tests in which current user participated.
static createFromTest(ilObjTest $a_test, $a_user_id)
Import relevant properties from given test.
New implementation of ilObjectGUI.
getAccessHandler()
Get access handler.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
static isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
Page for user portfolio.
List all completed tests for current user.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Access handler for personal workspace.
Tree handler for personal workspace.
$valid
exit
Definition: login.php:54
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15