ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
5 include_once('./Services/Object/classes/class.ilObject2GUI.php');
6 
18 {
19  public function getType()
20  {
21  return "scov";
22  }
23 
27  public function create()
28  {
29  global $ilTabs;
30 
31  if ($this->id_type == self::WORKSPACE_NODE_ID) {
32  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
34  $this->lng->loadLanguageModule("file");
35  ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
36  $this->ctrl->redirect($this, "cancel");
37  }
38  }
39 
40  $this->lng->loadLanguageModule("scov");
41 
42  $ilTabs->setBackTarget(
43  $this->lng->txt("back"),
44  $this->ctrl->getLinkTarget($this, "cancel")
45  );
46 
47  include_once "Modules/ScormAicc/classes/Verification/class.ilSCORMVerificationTableGUI.php";
48  $table = new ilSCORMVerificationTableGUI($this, "create");
49  $this->tpl->setContent($table->getHTML());
50  }
51 
55  public function save()
56  {
57  global $ilUser;
58 
59  $lm_id = $_REQUEST["lm_id"];
60  if ($lm_id) {
61  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
63  if ($type == "scorm") {
64  include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
65  $lm = new ilObjSCORMLearningModule($lm_id, false);
66  } else {
67  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
68  $lm = new ilObjSCORM2004LearningModule($lm_id, false);
69  }
70  include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
71  $newObj = ilObjSCORMVerification::createFromSCORMLM($lm, $ilUser->getId());
72  if ($newObj) {
74  $this->node_id = null;
75  $this->putObjectInTree($newObj, $parent_id);
76 
77  $this->afterSave($newObj);
78  } else {
79  ilUtil::sendFailure($this->lng->txt("msg_failed"));
80  }
81  } else {
82  ilUtil::sendFailure($this->lng->txt("select_one"));
83  }
84  $this->create();
85  }
86 
87  public function deliver()
88  {
89  $file = $this->object->getFilePath();
90  if ($file) {
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  $this->deliver();
107  } else {
108  $tree = new ilWorkspaceTree($ilUser->getId());
109  $wsp_id = $tree->lookupNodeId($this->object->getId());
110 
111  $caption = $lng->txt("wsp_type_scov") . ' "' . $this->object->getTitle() . '"';
112 
113  $valid = true;
114  if (!file_exists($this->object->getFilePath())) {
115  $valid = false;
116  $message = $lng->txt("url_not_found");
117  } elseif (!$a_url) {
118  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
120  if (!$access_handler->checkAccess("read", "", $wsp_id)) {
121  $valid = false;
122  $message = $lng->txt("permission_denied");
123  }
124  }
125 
126  if ($valid) {
127  if (!$a_url) {
128  $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
129  }
130  return '<div><a href="' . $a_url . '">' . $caption . '</a></div>';
131  } else {
132  return '<div>' . $caption . ' (' . $message . ')</div>';
133  }
134  }
135  }
136 
138  {
139  global $ilErr;
140 
141  include_once "Services/COPage/classes/class.ilPCVerification.php";
142  if (ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId())) {
143  $this->deliver();
144  }
145 
146  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
147  }
148 
149  public static function _goto($a_target)
150  {
151  $id = explode("_", $a_target);
152 
153  $_GET["baseClass"] = "ilsharedresourceGUI";
154  $_GET["wsp_id"] = $id[0];
155  include("ilias.php");
156  exit;
157  }
158 }
List all completed learning modules for current user.
New implementation of ilObjectGUI.
$type
$_GET["client_id"]
static isInPortfolioPage(ilPortfolioPage $a_page, $a_type, $a_id)
getAccessHandler()
Get access handler.
$valid
save()
create new instance and save it
downloadFromPortfolioPage(ilPortfolioPage $a_page)
if(!array_key_exists('StateId', $_REQUEST)) $id
Access handler for personal workspace.
static createFromSCORMLM(ilObjSAHSLearningModule $a_lm, $a_user_id)
Import relevant properties from given learning module.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
Tree handler for personal workspace.
catch(Exception $e) $message
static isUploadPossible($a_additional_size=null)
$ilUser
Definition: imgupload.php:18
Page for user portfolio.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
Create new PHPExcel object
obj_idprivate
Class ilObjSCORM2004LearningModule.
render($a_return=false, $a_url=false)
Render content.
create()
List all tests in which current user participated.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
if(empty($password)) $table
Definition: pwgen.php:24
GUI class for scorm verification.
Class ilObjSCORMLearningModule.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.