ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
51  $obj_ids = array();
52  $root = $tree->getNodeData($tree->getRootId());
53  foreach($tree->getSubTree($root, true, "sahs") as $node)
54  {
55  $obj_ids[] = $node["obj_id"];
56  }
57  if($obj_ids)
58  {
59  include_once "./Services/Tracking/classes/class.ilObjUserTracking.php";
60  include_once "./Services/Tracking/classes/class.ilLPStatus.php";
61  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
62  include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
63  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
64  include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
66  foreach(ilCertificate::areObjectsActive($obj_ids) as $obj_id => $active)
67  {
68  if($active)
69  {
71  if($type == "scorm")
72  {
73  $lm = new ilObjSCORMLearningModule($obj_id, false);
74  }
75  else
76  {
77  $lm = new ilObjSCORM2004LearningModule($obj_id, false);
78  }
81  {
82  $lpdata = $completed = false;
83  if($lp_active)
84  {
85  $completed = ilLPStatus::_hasUserCompleted($obj_id, $ilUser->getId());
86  $lpdata = true;
87  }
88  if(!$lpdata)
89  {
90  switch ($type)
91  {
92  case "scorm":
93  $completed = ilObjSCORMLearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId());
94  break;
95 
96  case "scorm2004":
97  $completed = ilObjSCORM2004LearningModule::_getCourseCompletionForUser($obj_id, $ilUser->getId());
98  break;
99  }
100  }
101 
102  $data[] = array("id" => $obj_id,
103  "title" => ilObject::_lookupTitle($obj_id),
104  "passed" => (bool)$completed);
105  }
106  }
107  }
108  }
109  }
110 
111  $this->setData($data);
112  }
113 
119  protected function fillRow($a_set)
120  {
121  global $ilCtrl;
122 
123  $this->tpl->setVariable("TITLE", $a_set["title"]);
124  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
125  $this->lng->txt("no"));
126 
127  if($a_set["passed"])
128  {
129  $ilCtrl->setParameter($this->parent_obj, "lm_id", $a_set["id"]);
130  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
131  $this->tpl->setVariable("URL_SELECT", $action);
132  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
133  }
134  }
135 }
136 
137 ?>
setDescription($a_val)
Set description.
List all completed learning modules for current user.
static _isComplete($adapter)
Checks the status of the certificate.
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, aicc, hacp)
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.