ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjSCORMVerificationGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once('./Services/Object/classes/class.ilObject2GUI.php');
6
15{
16 public function getType()
17 {
18 return "scov";
19 }
20
24 public function create()
25 {
26 global $DIC;
27 $ilTabs = $DIC['ilTabs'];
28
29 if ($this->id_type == self::WORKSPACE_NODE_ID) {
30 include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
32 $this->lng->loadLanguageModule("file");
33 ilUtil::sendFailure($this->lng->txt("personal_resources_quota_exceeded_warning"), true);
34 $this->ctrl->redirect($this, "cancel");
35 }
36 }
37
38 $this->lng->loadLanguageModule("scov");
39
40 $ilTabs->setBackTarget(
41 $this->lng->txt("back"),
42 $this->ctrl->getLinkTarget($this, "cancel")
43 );
44
45 include_once "Modules/ScormAicc/classes/Verification/class.ilSCORMVerificationTableGUI.php";
46 $table = new ilSCORMVerificationTableGUI($this, "create");
47 $this->tpl->setContent($table->getHTML());
48 }
49
53 public function save()
54 {
55 global $DIC;
56
57 $ilUser = $DIC->user();
58
59 $objectId = $_REQUEST["lm_id"];
60 if ($objectId) {
61 $certificateVerificationFileService = new ilCertificateVerificationFileService(
62 $DIC->language(),
63 $DIC->database(),
64 $DIC->logger()->root(),
66 );
67
68 $userCertificateRepository = new ilUserCertificateRepository();
69
70 $userCertificatePresentation = $userCertificateRepository->fetchActiveCertificateForPresentation(
71 (int) $ilUser->getId(),
72 (int) $objectId
73 );
74
75 try {
76 $newObj = $certificateVerificationFileService->createFile($userCertificatePresentation);
77 } catch (\Exception $exception) {
78 ilUtil::sendFailure($this->lng->txt('error_creating_certificate_pdf'));
79 return $this->create();
80 }
81
82 if ($newObj) {
84 $this->node_id = null;
85 $this->putObjectInTree($newObj, $parent_id);
86
87 $this->afterSave($newObj);
88 } else {
89 ilUtil::sendFailure($this->lng->txt("msg_failed"));
90 }
91 } else {
92 ilUtil::sendFailure($this->lng->txt("select_one"));
93 }
94 $this->create();
95 }
96
97 public function deliver()
98 {
99 $file = $this->object->getFilePath();
100 if ($file) {
101 ilUtil::deliverFile($file, $this->object->getTitle() . ".pdf");
102 }
103 }
104
111 public function render($a_return = false, $a_url = false)
112 {
113 global $DIC;
114 $ilUser = $DIC['ilUser'];
115 $lng = $DIC['lng'];
116
117 if (!$a_return) {
118 $this->deliver();
119 } else {
120 $tree = new ilWorkspaceTree($ilUser->getId());
121 $wsp_id = $tree->lookupNodeId($this->object->getId());
122
123 $caption = $lng->txt("wsp_type_scov") . ' "' . $this->object->getTitle() . '"';
124
125 $valid = true;
126 if (!file_exists($this->object->getFilePath())) {
127 $valid = false;
128 $message = $lng->txt("url_not_found");
129 } elseif (!$a_url) {
130 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
132 if (!$access_handler->checkAccess("read", "", $wsp_id)) {
133 $valid = false;
134 $message = $lng->txt("permission_denied");
135 }
136 }
137
138 if ($valid) {
139 if (!$a_url) {
140 $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
141 }
142 return '<div><a href="' . $a_url . '">' . $caption . '</a></div>';
143 } else {
144 return '<div>' . $caption . ' (' . $message . ')</div>';
145 }
146 }
147 }
148
150 {
151 global $DIC;
152 $ilErr = $DIC['ilErr'];
153
154 include_once "Services/COPage/classes/class.ilPCVerification.php";
155 if (ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId())) {
156 $this->deliver();
157 }
158
159 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
160 }
161
162 public static function _goto($a_target)
163 {
164 $id = explode("_", $a_target);
165
166 $_GET["baseClass"] = "ilsharedresourceGUI";
167 $_GET["wsp_id"] = $id[0];
168 include("ilias.php");
169 exit;
170 }
171}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
static isUploadPossible($a_additional_size=null)
GUI class for scorm verification.
render($a_return=false, $a_url=false)
Render content.
create()
List all tests in which current user participated.
downloadFromPortfolioPage(ilPortfolioPage $a_page)
getType()
Functions that must be overwritten.
save()
create new instance and save it
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 learning modules 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:29
$ilUser
Definition: imgupload.php:18
$message
Definition: xapiexit.php:14
$DIC
Definition: xapitoken.php:46