ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
33  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
35  {
36  $this->lng->loadLanguageModule("file");
37  ilUtil::sendFailure($this->lng->txt("personal_workspace_quota_exceeded_warning"), true);
38  $this->ctrl->redirect($this, "cancel");
39  }
40  }
41 
42  $this->lng->loadLanguageModule("scov");
43 
44  $ilTabs->setBackTarget($this->lng->txt("back"),
45  $this->ctrl->getLinkTarget($this, "cancel"));
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  {
62  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
64  if($type == "scorm")
65  {
66  include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
67  $lm = new ilObjSCORMLearningModule($lm_id, false);
68  }
69  else
70  {
71  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
72  $lm = new ilObjSCORM2004LearningModule($lm_id, false);
73  }
74  include_once "Modules/ScormAicc/classes/Verification/class.ilObjSCORMVerification.php";
75  $newObj = ilObjSCORMVerification::createFromSCORMLM($lm, $ilUser->getId());
76  if($newObj)
77  {
79  $this->node_id = null;
80  $this->putObjectInTree($newObj, $parent_id);
81 
82  $this->afterSave($newObj);
83  }
84  else
85  {
86  ilUtil::sendFailure($this->lng->txt("msg_failed"));
87  }
88  }
89  else
90  {
91  ilUtil::sendFailure($this->lng->txt("select_one"));
92  }
93  $this->create();
94  }
95 
96  public function deliver()
97  {
98  $file = $this->object->getFilePath();
99  if($file)
100  {
101  ilUtil::deliverFile($file, $this->object->getTitle().".pdf");
102  }
103  }
104 
111  public function render($a_return = false, $a_url = false)
112  {
113  global $ilUser, $lng;
114 
115  if(!$a_return)
116  {
117  $this->deliver();
118  }
119  else
120  {
121  $tree = new ilWorkspaceTree($ilUser->getId());
122  $wsp_id = $tree->lookupNodeId($this->object->getId());
123 
124  $caption = $lng->txt("wsp_type_scov").' "'.$this->object->getTitle().'"';
125 
126  $valid = true;
127  if(!file_exists($this->object->getFilePath()))
128  {
129  $valid = false;
130  $message = $lng->txt("url_not_found");
131  }
132  else if(!$a_url)
133  {
134  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
136  if(!$access_handler->checkAccess("read", "", $wsp_id))
137  {
138  $valid = false;
139  $message = $lng->txt("permission_denied");
140  }
141  }
142 
143  if($valid)
144  {
145  if(!$a_url)
146  {
147  $a_url = $this->getAccessHandler()->getGotoLink($wsp_id, $this->object->getId());
148  }
149  return '<div><a href="'.$a_url.'">'.$caption.'</a></div>';
150  }
151  else
152  {
153  return '<div>'.$caption.' ('.$message.')</div>';
154  }
155  }
156  }
157 
159  {
160  global $ilErr;
161 
162  include_once "Services/COPage/classes/class.ilPCVerification.php";
163  if(ilPCVerification::isInPortfolioPage($a_page, $this->object->getType(), $this->object->getId()))
164  {
165  $this->deliver();
166  }
167 
168  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->MESSAGE);
169  }
170 
171  public static function _goto($a_target)
172  {
173  $id = explode("_", $a_target);
174 
175  $_GET["baseClass"] = "ilsharedresourceGUI";
176  $_GET["wsp_id"] = $id[0];
177  include("ilias.php");
178  exit;
179  }
180 }
181 
182 ?>
global $ilErr
Definition: raiseError.php:16
List all completed learning modules for current user.
New implementation of ilObjectGUI.
$_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)
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, aicc, hacp)
Tree handler for personal workspace.
static isUploadPossible($a_additional_size=null)
$ilUser
Definition: imgupload.php:18
Page for user portfolio.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
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
GUI class for scorm verification.
Class ilObjSCORMLearningModule.