ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSCORMVerificationTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
20  public function __construct($a_parent_obj, $a_parent_cmd = "")
21  {
22  global $ilCtrl;
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 
26  $this->addColumn($this->lng->txt("title"), "title");
27  $this->addColumn($this->lng->txt("passed"), "passed");
28  $this->addColumn($this->lng->txt("action"), "");
29 
30  $this->setTitle($this->lng->txt("scov_create"));
31  $this->setDescription($this->lng->txt("scov_create_info"));
32 
33  $this->setRowTemplate("tpl.sahs_verification_row.html", "Modules/ScormAicc");
34  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
35 
36  $this->getItems();
37  }
38 
42  protected function getItems()
43  {
44  global $ilUser, $tree;
45 
46  $data = array();
47 
48  include_once "Services/Certificate/classes/class.ilCertificate.php";
50  $obj_ids = array();
51  $root = $tree->getNodeData($tree->getRootId());
52  foreach ($tree->getSubTree($root, true, "sahs") as $node) {
53  $obj_ids[] = $node["obj_id"];
54  }
55  if ($obj_ids) {
56  include_once "./Services/Tracking/classes/class.ilObjUserTracking.php";
57  include_once "./Services/Tracking/classes/class.ilLPStatus.php";
58  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
59  include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
60  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
61  include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
63  foreach (ilCertificate::areObjectsActive($obj_ids) as $obj_id => $active) {
64  if ($active) {
66  if ($type == "scorm") {
67  $lm = new ilObjSCORMLearningModule($obj_id, false);
68  } else {
69  $lm = new ilObjSCORM2004LearningModule($obj_id, false);
70  }
73  $lpdata = $completed = false;
74  if ($lp_active) {
75  $completed = ilLPStatus::_hasUserCompleted($obj_id, $ilUser->getId());
76  $lpdata = true;
77  }
78  if (!$lpdata) {
79  switch ($type) {
80  case "scorm":
81  $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId());
82  break;
83 
84  case "scorm2004":
85  $completed = ilObjSCORM2004LearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId());
86  break;
87  }
88  }
89 
90  $data[] = array("id" => $obj_id,
91  "title" => ilObject::_lookupTitle($obj_id),
92  "passed" => (bool) $completed);
93  }
94  }
95  }
96  }
97  }
98 
99  $this->setData($data);
100  }
101 
107  protected function fillRow($a_set)
108  {
109  global $ilCtrl;
110 
111  $this->tpl->setVariable("TITLE", $a_set["title"]);
112  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
113  $this->lng->txt("no"));
114 
115  if ($a_set["passed"]) {
116  $ilCtrl->setParameter($this->parent_obj, "lm_id", $a_set["id"]);
117  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
118  $this->tpl->setVariable("URL_SELECT", $action);
119  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
120  }
121  }
122 }
setDescription($a_val)
Set description.
List all completed learning modules for current user.
static _isComplete($adapter)
Checks the status of the certificate.
$action
$type
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
static _lookupTitle($a_id)
lookup object title
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static _enabledLearningProgress()
check wether learing progress is enabled or not
Class ilTable2GUI.
static _hasUserCompleted($a_obj_id, $a_user_id)
Lookup user object completion.
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
Class ilObjSCORM2004LearningModule.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
Class ilObjSCORMLearningModule.
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.