ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
ilHACPPresentationGUI Class Reference

Class ilHACPPresentationGUI. More...

+ Inheritance diagram for ilHACPPresentationGUI:
+ Collaboration diagram for ilHACPPresentationGUI:

Public Member Functions

 ilHACPPresentationGUI ()
 
executeCommand ()
 execute command More...
 
 explorer ($a_target="sahs_content")
 output table of content More...
 
 launchSahs ()
 
- Public Member Functions inherited from ilAICCPresentationGUI
 ilAICCPresentationGUI ()
 
executeCommand ()
 execute command More...
 
 view ()
 
 explorer ($a_target="sahs_content")
 output table of content More...
 
 launchSahs ()
 
- Public Member Functions inherited from ilSCORMPresentationGUI
 ilSCORMPresentationGUI ()
 
executeCommand ()
 execute command More...
 
 attrib2arr (&$a_attributes)
 
 frameset ()
 Output main frameset. More...
 
 get_max_attempts ()
 Get max. More...
 
 get_actual_attempts ()
 Get number of actual attempts for the user. More...
 
 increase_attemptAndsave_module_version ()
 Increases attempts by one for this package. More...
 
 explorer ($a_target="sahs_content")
 save the active module version to scorm_tracking More...
 
 view ()
 SCORM content screen. More...
 
 contentSelect ()
 
 apiInitData ()
 SCORM Data for Javascript-API. More...
 
 api ()
 
 launchSahs ()
 This function is called by the API applet in the content frame when a SCO is started. More...
 
 finishSahs ()
 
 unloadSahs ()
 
 launchAsset ()
 
 pingSession ()
 
 logMessage ()
 
 logWarning ()
 
 setSingleVariable ($a_var, $a_value)
 set single value More...
 
 setArray ($a_left, $a_value, $a_name, &$v_array)
 set single value More...
 
 downloadCertificate ()
 Download the certificate for the active user. More...
 

Data Fields

 $ilias
 
 $slm
 
 $tpl
 
 $lng
 
- Data Fields inherited from ilAICCPresentationGUI
 $ilias
 
 $slm
 
 $tpl
 
 $lng
 
- Data Fields inherited from ilSCORMPresentationGUI
 $ilias
 
 $slm
 
 $tpl
 
 $lng
 

Detailed Description

Class ilHACPPresentationGUI.

GUI class for hacp learning module presentation

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 39 of file class.ilHACPPresentationGUI.php.

Member Function Documentation

◆ executeCommand()

& ilHACPPresentationGUI::executeCommand ( )

execute command

Definition at line 64 of file class.ilHACPPresentationGUI.php.

References $_GET, $cmd, and $ilLog.

65  {
66  global $ilAccess, $ilLog;
67 
68  $next_class = $this->ctrl->getNextClass($this);
69  $cmd = $this->ctrl->getCmd("frameset");
70 
71  if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))
72  {
73  $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
74  }
75 
76  switch($next_class)
77  {
78  default:
79  $this->$cmd();
80  }
81  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35

◆ explorer()

ilHACPPresentationGUI::explorer (   $a_target = "sahs_content")

output table of content

Definition at line 86 of file class.ilHACPPresentationGUI.php.

References $_GET, $slm, ilUtil\getStyleSheetLocation(), ilTree\readRootId(), and ilExplorer\setTargetGet().

87  {
88  $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, "Modules/ScormAicc");
89 
90  require_once("./Modules/ScormAicc/classes/HACP/class.ilHACPExplorer.php");
91  $exp = new ilHACPExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
92  $exp->setTargetGet("obj_id");
93  $exp->setFrameTarget($a_target);
94  //$exp->setFiltered(true);
95 
96  if ($_GET["scexpand"] == "")
97  {
98  $mtree = new ilSCORMTree($this->slm->getId());
99  $expanded = $mtree->readRootId();
100  }
101  else
102  {
103  $expanded = $_GET["scexpand"];
104  }
105  $exp->setExpand($expanded);
106 
107  $exp->forceExpandAll(true, false);
108 
109  // build html-output
110  //666$exp->setOutput(0);
111  $exp->setOutput(0);
112 
113  $output = $exp->getOutput();
114 
115  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
116  $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
117  $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
118  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
119  $this->tpl->setVariable("EXPLORER",$output);
120  $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, $_GET["cmd"])."&frame=".$_GET["frame"].
121  "&ref_id=".$this->slm->getRefId()."&scexpand=".$_GET["scexpand"]);
122  $this->tpl->parseCurrentBlock();
123  $this->tpl->show();
124  }
setTargetGet($a_target_get)
set the varname in Get-string public
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
SCORM Object Tree.
readRootId()
read root id from database
+ Here is the call graph for this function:

◆ ilHACPPresentationGUI()

ilHACPPresentationGUI::ilHACPPresentationGUI ( )

Definition at line 46 of file class.ilHACPPresentationGUI.php.

References $_GET, $cmd, $ilCtrl, $ilias, $lng, and $tpl.

47  {
48  global $ilias, $tpl, $lng, $ilCtrl;;
49 
50  $this->ilias =& $ilias;
51  $this->tpl =& $tpl;
52  $this->lng =& $lng;
53  $this->ctrl =& $ilCtrl;
54 
55  $cmd = (!empty($_GET["cmd"])) ? $_GET["cmd"] : "frameset";
56 
57  // Todo: check lm id
58  $this->slm =& new ilObjHACPLearningModule($_GET["ref_id"], true);
59  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
Class ilObjAICCLearningModule.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ launchSahs()

ilHACPPresentationGUI::launchSahs ( )

Definition at line 126 of file class.ilHACPPresentationGUI.php.

References $_GET, $_POST, $ilDB, $ilUser, $lng, $ref_id, $url, ilObject\_lookupObjId(), exit, ilUtil\getImagePath(), ilSCORMPresentationGUI\setArray(), and ilSCORMPresentationGUI\setSingleVariable().

127  {
128  echo "launchSahs";
129  exit;
130 
131  global $ilUser, $ilDB;
132 
133  $sahs_id = ($_GET["sahs_id"] == "")
134  ? $_POST["sahs_id"]
135  : $_GET["sahs_id"];
136  $ref_id = ($_GET["ref_id"] == "")
137  ? $_POST["ref_id"]
138  : $_GET["ref_id"];
139 
140  $this->slm =& new ilObjAICCLearningModule($ref_id, true);
141 
142  include_once("./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
143  $unit =& new ilAICCUnit($sahs_id);
144 
145  //guess the url to be able to launch most contents
146  $url=$unit->getCommand_line();
147  if (strlen($url)==0)
148  $url=$unit->getFilename();
149  if (strcasecmp(substr($unit->getFilename(),0,4),"http")!=0)
150  $url=$unit->slm->getDataDirectory("output")."/".$url;
151  if (strlen($unit->getWebLaunch())>0)
152  $url.="?".$unit->getWebLaunch();
153 
154 /*
155  if (strcasecmp(substr($unit->getFilename(),0,4),"http")==0)
156  $href=$unit->getFilename();
157  else
158  $href=$this->slm->getDataDirectory("output")."/".$unit->getFilename();
159 */
160  $this->tpl = new ilTemplate("tpl.sahs_launch_cbt.html", true, true, "Modules/ScormAicc");
161  $this->tpl->setVariable("HREF", $url);
162 // $this->tpl->setVariable("LAUNCH_DATA", $unit->getDataFromLms());
163  $this->tpl->setVariable("MAST_SCORE", $unit->getMasteryScore());
164  $this->tpl->setVariable("MAX_TIME", $unit->getMaxTimeAllowed());
165  $this->tpl->setVariable("LIMIT_ACT", $unit->getTimeLimitAction());
166  if($ilUser->getFirstName() == "Joe") // for test purpose
167  {
168  $this->tpl->setCurrentBlock("credit");
169  $this->tpl->setVariable("CREDIT_MODE", "normal");
170  $this->tpl->parseCurrentBlock();
171  }
172 
173  $val_set = $ilDB->queryF('
174  SELECT * FROM scorm_tracking
175  WHERE user_id = %s
176  AND sco_id = %s
177  AND obj_id = %s',
178  array('integer','integer','integer'),
179  array($ilUser->getId(),$sahs_id,$this->slm->getId()));
180 
181  $re_value = array();
182 
183  while($val_rec = $ilDB->fetchAssoc($val_set))
184 
185  {
186  $val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
187  $val_rec["rvalue"] = str_replace("\r", "\n", $val_rec["rvalue"]);
188  $val_rec["rvalue"] = str_replace("\n", "%n%", $val_rec["rvalue"]);
189  $re_value[$val_rec["lvalue"]] = $val_rec["rvalue"];
190  }
191 
192  foreach($re_value as $var => $value)
193  {
194  switch ($var)
195  {
196  case "cmi.core.lesson_location":
197  case "cmi.core.lesson_status":
198  case "cmi.core.entry":
199  case "cmi.core.score.raw":
200  case "cmi.core.score.max":
201  case "cmi.core.score.min":
202  case "cmi.core.total_time":
203  case "cmi.core.exit":
204  case "cmi.suspend_data":
205  case "cmi.comments":
206  case "cmi.student_preference.audio":
207  case "cmi.student_preference.language":
208  case "cmi.student_preference.speed":
209  case "cmi.student_preference.text":
210  $this->setSingleVariable($var, $value);
211  break;
212 
213  case "cmi.objectives._count":
214  $this->setSingleVariable($var, $value);
215  $this->setArray("cmi.objectives", $value, "id", $re_value);
216  $this->setArray("cmi.objectives", $value, "score.raw", $re_value);
217  $this->setArray("cmi.objectives", $value, "score.max", $re_value);
218  $this->setArray("cmi.objectives", $value, "score.min", $re_value);
219  $this->setArray("cmi.objectives", $value, "status", $re_value);
220  break;
221 
222  case "cmi.interactions._count":
223  $this->setSingleVariable($var, $value);
224  $this->setArray("cmi.interactions", $value, "id", $re_value);
225  for($i=0; $i<$value; $i++)
226  {
227  $var2 = "cmi.interactions.".$i.".objectives._count";
228  if (isset($v_array[$var2]))
229  {
230  $cnt = $v_array[$var2];
231  $this->setArray("cmi.interactions.".$i.".objectives",
232  $cnt, "id", $re_value);
233  /*
234  $this->setArray("cmi.interactions.".$i.".objectives",
235  $cnt, "score.raw", $re_value);
236  $this->setArray("cmi.interactions.".$i.".objectives",
237  $cnt, "score.max", $re_value);
238  $this->setArray("cmi.interactions.".$i.".objectives",
239  $cnt, "score.min", $re_value);
240  $this->setArray("cmi.interactions.".$i.".objectives",
241  $cnt, "status", $re_value);*/
242  }
243  }
244  $this->setArray("cmi.interactions", $value, "time", $re_value);
245  $this->setArray("cmi.interactions", $value, "type", $re_value);
246  for($i=0; $i<$value; $i++)
247  {
248  $var2 = "cmi.interactions.".$i.".correct_responses._count";
249  if (isset($v_array[$var2]))
250  {
251  $cnt = $v_array[$var2];
252  $this->setArray("cmi.interactions.".$i.".correct_responses",
253  $cnt, "pattern", $re_value);
254  $this->setArray("cmi.interactions.".$i.".correct_responses",
255  $cnt, "weighting", $re_value);
256  }
257  }
258  $this->setArray("cmi.interactions", $value, "student_response", $re_value);
259  $this->setArray("cmi.interactions", $value, "result", $re_value);
260  $this->setArray("cmi.interactions", $value, "latency", $re_value);
261  break;
262  }
263  }
264 
265  global $lng;
266  $this->tpl->setCurrentBlock("switch_icon");
267  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
268  $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.svg"));
269  $this->tpl->setVariable("SCO_ALT",
270  $lng->txt("cont_status").": "
271  .$lng->txt("cont_sc_stat_running")
272  );
273  $this->tpl->parseCurrentBlock();
274 
275  // lesson mode
276  $lesson_mode = $this->slm->getDefaultLessonMode();
277  if ($this->slm->getAutoReview())
278  {
279  if ($re_value["cmi.core.lesson_status"] == "completed" ||
280  $re_value["cmi.core.lesson_status"] == "passed" ||
281  $re_value["cmi.core.lesson_status"] == "failed")
282  {
283  $lesson_mode = "review";
284  }
285  }
286  $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
287 
288  // credit mode
289  if ($lesson_mode == "normal")
290  {
291  $this->tpl->setVariable("CREDIT_MODE",
292  str_replace("_", " ", $this->slm->getCreditMode()));
293  }
294  else
295  {
296  $this->tpl->setVariable("CREDIT_MODE", "no-credit");
297  }
298 
299  // init cmi.core.total_time, cmi.core.lesson_status and cmi.core.entry
300  $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
301  if (!isset($re_value["cmi.core.total_time"]))
302  {
303  $unit->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
304  }
305  if (!isset($re_value["cmi.core.lesson_status"]))
306  {
307  $unit->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
308  }
309  if (!isset($re_value["cmi.core.entry"]))
310  {
311  $unit->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
312  }
313 
314  $this->tpl->show();
315  }
exit
Definition: login.php:54
$_POST['username']
Definition: cron.php:12
setArray($a_left, $a_value, $a_name, &$v_array)
set single value
$_GET["client_id"]
Class ilObjAICCLearningModule.
setSingleVariable($a_var, $a_value)
set single value
$url
Definition: shib_logout.php:72
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $ilias

ilHACPPresentationGUI::$ilias

Definition at line 41 of file class.ilHACPPresentationGUI.php.

Referenced by ilHACPPresentationGUI().

◆ $lng

ilHACPPresentationGUI::$lng

Definition at line 44 of file class.ilHACPPresentationGUI.php.

Referenced by ilHACPPresentationGUI(), and launchSahs().

◆ $slm

ilHACPPresentationGUI::$slm

Definition at line 42 of file class.ilHACPPresentationGUI.php.

Referenced by explorer().

◆ $tpl

ilHACPPresentationGUI::$tpl

Definition at line 43 of file class.ilHACPPresentationGUI.php.

Referenced by ilHACPPresentationGUI().


The documentation for this class was generated from the following file: