ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $this->lng->loadLanguageModule("scov");
30
31 $ilTabs->setBackTarget(
32 $this->lng->txt("back"),
33 $this->ctrl->getLinkTarget($this, "cancel")
34 );
35
36 include_once "Modules/ScormAicc/classes/Verification/class.ilSCORMVerificationTableGUI.php";
37 $table = new ilSCORMVerificationTableGUI($this, "create");
38 $this->tpl->setContent($table->getHTML());
39 }
40
44 public function save()
45 {
46 global $DIC;
47
48 $ilUser = $DIC->user();
49
50 $objectId = $_REQUEST["lm_id"];
51 if ($objectId) {
52 $certificateVerificationFileService = new ilCertificateVerificationFileService(
53 $DIC->language(),
54 $DIC->database(),
55 $DIC->logger()->root(),
57 );
58
59 $userCertificateRepository = new ilUserCertificateRepository();
60
61 $userCertificatePresentation = $userCertificateRepository->fetchActiveCertificateForPresentation(
62 (int) $ilUser->getId(),
63 (int) $objectId
64 );
65
66 try {
67 $newObj = $certificateVerificationFileService->createFile($userCertificatePresentation);
68 } catch (\Exception $exception) {
69 ilUtil::sendFailure($this->lng->txt('error_creating_certificate_pdf'));
70 return $this->create();
71 }
72
73 if ($newObj) {
75 $this->node_id = null;
76 $this->putObjectInTree($newObj, $parent_id);
77
78 $this->afterSave($newObj);
79 } else {
80 ilUtil::sendFailure($this->lng->txt("msg_failed"));
81 }
82 } else {
83 ilUtil::sendFailure($this->lng->txt("select_one"));
84 }
85 $this->create();
86 }
87
88 public function deliver()
89 {
90 $file = $this->object->getFilePath();
91 if ($file) {
92 ilUtil::deliverFile($file, $this->object->getTitle() . ".pdf");
93 }
94 }
95
102 public function render($a_return = false, $a_url = false)
103 {
104 global $DIC;
105 $ilUser = $DIC['ilUser'];
106 $lng = $DIC['lng'];
107
108 if (!$a_return) {
109 $this->deliver();
110 } else {
111 $tree = new ilWorkspaceTree($ilUser->getId());
112 $wsp_id = $tree->lookupNodeId($this->object->getId());
113
114 $caption = $lng->txt("wsp_type_scov") . ' "' . $this->object->getTitle() . '"';
115
116 $valid = true;
117 if (!file_exists($this->object->getFilePath())) {
118 $valid = false;
119 $message = $lng->txt("url_not_found");
120 } elseif (!$a_url) {
121 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
123 if (!$access_handler->checkAccess("read", "", $wsp_id)) {
124 $valid = false;
125 $message = $lng->txt("permission_denied");
126 }
127 }
128
129 if ($valid) {
130 if (!$a_url) {
131 $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
132 }
133 return '<div><a href="' . $a_url . '">' . $caption . '</a></div>';
134 } else {
135 return '<div>' . $caption . ' (' . $message . ')</div>';
136 }
137 }
138 }
139
141 {
142 global $DIC;
143 $ilErr = $DIC['ilErr'];
144
145 include_once "Services/COPage/classes/class.ilPCVerification.php";
146 if (ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId())) {
147 $this->deliver();
148 }
149
150 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
151 }
152
153 public static function _goto($a_target)
154 {
155 $id = explode("_", $a_target);
156
157 $_GET["baseClass"] = "ilsharedresourceGUI";
158 $_GET["wsp_id"] = $id[0];
159 include("ilias.php");
160 exit;
161 }
162}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
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
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
exit
Definition: login.php:29
$message
Definition: xapiexit.php:14