00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once "classes/class.ilObjectGUI.php";
00025 require_once("classes/class.ilFileSystemGUI.php");
00026 require_once("classes/class.ilTabsGUI.php");
00027 require_once("content/classes/class.ilObjSAHSLearningModuleGUI.php");
00028 require_once("content/classes/class.ilObjSCORMLearningModule.php");
00029
00041 class ilObjSCORMLearningModuleGUI extends ilObjSAHSLearningModuleGUI
00042 {
00048 function ilObjSCORMLearningModuleGUI($a_data,$a_id,$a_call_by_reference, $a_prepare_output = true)
00049 {
00050 global $lng;
00051
00052 $lng->loadLanguageModule("content");
00053 $this->type = "sahs";
00054 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
00055 #$this->tabs_gui =& new ilTabsGUI();
00056 }
00057
00061 function assignObject()
00062 {
00063 if ($this->id != 0)
00064 {
00065 if ($this->call_by_reference)
00066 {
00067 $this->object =& new ilObjSCORMLearningModule($this->id, true);
00068 }
00069 else
00070 {
00071 $this->object =& new ilObjSCORMLearningModule($this->id, false);
00072 }
00073 }
00074 }
00075
00079 function properties()
00080 {
00081 global $rbacsystem, $tree, $tpl;
00082
00083
00084 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00085
00086
00087 $this->tpl->setCurrentBlock("btn_cell");
00088 $this->tpl->setVariable("BTN_LINK",
00089 "../ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=".$this->object->getRefID());
00090 $this->tpl->setVariable("BTN_TARGET"," target=\"ilContObj".$this->object->getID()."\" ");
00091 $this->tpl->setVariable("BTN_TXT",$this->lng->txt("view"));
00092 $this->tpl->parseCurrentBlock();
00093
00094
00095 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.sahs_properties.html", true);
00096 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00097 $this->tpl->setVariable("TXT_PROPERTIES", $this->lng->txt("cont_lm_properties"));
00098
00099
00100 $this->tpl->setVariable("TXT_ONLINE", $this->lng->txt("cont_online"));
00101 $this->tpl->setVariable("CBOX_ONLINE", "cobj_online");
00102 $this->tpl->setVariable("VAL_ONLINE", "y");
00103 if ($this->object->getOnline())
00104 {
00105 $this->tpl->setVariable("CHK_ONLINE", "checked");
00106 }
00107
00108
00109 $this->tpl->setVariable("TXT_API_ADAPTER", $this->lng->txt("cont_api_adapter"));
00110 $this->tpl->setVariable("VAL_API_ADAPTER", $this->object->getAPIAdapterName());
00111
00112
00113 $this->tpl->setVariable("TXT_API_PREFIX", $this->lng->txt("cont_api_func_prefix"));
00114 $this->tpl->setVariable("VAL_API_PREFIX", $this->object->getAPIFunctionsPrefix());
00115
00116
00117 $this->tpl->setVariable("TXT_LESSON_MODE", $this->lng->txt("cont_def_lesson_mode"));
00118 $lesson_modes = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"),
00119 "browse" => $this->lng->txt("cont_sc_less_mode_browse"));
00120 $sel_lesson = ilUtil::formSelect($this->object->getDefaultLessonMode(),
00121 "lesson_mode", $lesson_modes, false, true);
00122 $this->tpl->setVariable("SEL_LESSON_MODE", $sel_lesson);
00123
00124
00125 $this->tpl->setVariable("TXT_CREDIT_MODE", $this->lng->txt("cont_credit_mode"));
00126 $credit_modes = array("credit" => $this->lng->txt("cont_credit_on"),
00127 "no_credit" => $this->lng->txt("cont_credit_off"));
00128 $sel_credit = ilUtil::formSelect($this->object->getCreditMode(),
00129 "credit_mode", $credit_modes, false, true);
00130 $this->tpl->setVariable("SEL_CREDIT_MODE", $sel_credit);
00131
00132
00133 $this->tpl->setVariable("TXT_AUTO_REVIEW", $this->lng->txt("cont_sc_auto_review"));
00134 $this->tpl->setVariable("CBOX_AUTO_REVIEW", "auto_review");
00135 $this->tpl->setVariable("VAL_AUTO_REVIEW", "y");
00136 if ($this->object->getAutoReview())
00137 {
00138 $this->tpl->setVariable("CHK_AUTO_REVIEW", "checked");
00139 }
00140
00141 $this->tpl->setCurrentBlock("commands");
00142 $this->tpl->setVariable("BTN_NAME", "saveProperties");
00143 $this->tpl->setVariable("BTN_TEXT", $this->lng->txt("save"));
00144 $this->tpl->parseCurrentBlock();
00145
00146 }
00147
00151 function saveProperties()
00152 {
00153 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
00154 $this->object->setAutoReview(ilUtil::yn2tf($_POST["auto_review"]));
00155 $this->object->setAPIAdapterName($_POST["api_adapter"]);
00156 $this->object->setAPIFunctionsPrefix($_POST["api_func_prefix"]);
00157 $this->object->setCreditMode($_POST["credit_mode"]);
00158 $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
00159 $this->object->update();
00160 sendInfo($this->lng->txt("msg_obj_modified"), true);
00161 $this->ctrl->redirect($this, "properties");
00162 }
00163
00167 function showTrackingItems()
00168 {
00169
00170 include_once "./classes/class.ilTableGUI.php";
00171
00172
00173 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00174
00175 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scorm_track_items.html", true);
00176
00177 $num = 1;
00178
00179 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");
00180
00181
00182 $tbl = new ilTableGUI();
00183
00184
00185 $tbl->setTitle($this->lng->txt("cont_tracking_items"));
00186
00187 $tbl->setHeaderNames(array($this->lng->txt("title")));
00188
00189 $header_params = array("ref_id" => $this->ref_id, "cmd" => $_GET["cmd"],
00190 "cmdClass" => get_class($this));
00191 $cols = array("title");
00192 $tbl->setHeaderVars($cols, $header_params);
00193 $tbl->setColumnWidth(array("100%"));
00194
00195
00196 $tbl->setOrderColumn($_GET["sort_by"]);
00197 $tbl->setOrderDirection($_GET["sort_order"]);
00198 $tbl->setLimit($_GET["limit"]);
00199 $tbl->setOffset($_GET["offset"]);
00200 $tbl->setMaxCount($this->maxcount);
00201
00202
00203
00204
00205
00206 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00207 #$tbl->disable("footer");
00208
00209
00210 $items = $this->object->getTrackedItems();
00211
00212
00213 $tbl->setMaxCount(count($items));
00214 $items = array_slice($items, $_GET["offset"], $_GET["limit"]);
00215
00216 $tbl->render();
00217 if (count($items) > 0)
00218 {
00219 foreach ($items as $item)
00220 {
00221 $this->tpl->setCurrentBlock("tbl_content");
00222 $this->tpl->setVariable("TXT_ITEM_TITLE", $item->getTitle());
00223 $this->ctrl->setParameter($this, "obj_id", $item->getId());
00224 $this->tpl->setVariable("LINK_ITEM",
00225 $this->ctrl->getLinkTarget($this, "showTrackingItem"));
00226
00227 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00228 $this->tpl->setVariable("CSS_ROW", $css_row);
00229 $this->tpl->parseCurrentBlock();
00230 }
00231 }
00232 else
00233 {
00234 $this->tpl->setCurrentBlock("notfound");
00235 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00236 $this->tpl->setVariable("NUM_COLS", $num);
00237 $this->tpl->parseCurrentBlock();
00238 }
00239 }
00240
00244 function showTrackingItem()
00245 {
00246
00247 include_once "./classes/class.ilTableGUI.php";
00248
00249
00250 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00251
00252 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scorm_track_item.html", true);
00253
00254 $num = 2;
00255
00256 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");
00257
00258
00259 $tbl = new ilTableGUI();
00260
00261 include_once("content/classes/SCORM/class.ilSCORMItem.php");
00262 $sc_item =& new ilSCORMItem($_GET["obj_id"]);
00263
00264
00265 $tbl->setTitle($sc_item->getTitle());
00266
00267 $tbl->setHeaderNames(array($this->lng->txt("name"),
00268 $this->lng->txt("cont_status"), $this->lng->txt("cont_time"),
00269 $this->lng->txt("cont_score")));
00270
00271 $header_params = array("ref_id" => $this->ref_id, "cmd" => $_GET["cmd"],
00272 "cmdClass" => get_class($this), "obj_id" => $_GET["obj_id"]);
00273 $cols = array("name", "status", "time", "score");
00274 $tbl->setHeaderVars($cols, $header_params);
00275
00276
00277
00278 $tbl->setOrderColumn($_GET["sort_by"]);
00279 $tbl->setOrderDirection($_GET["sort_order"]);
00280 $tbl->setLimit($_GET["limit"]);
00281 $tbl->setOffset($_GET["offset"]);
00282 $tbl->setMaxCount($this->maxcount);
00283
00284
00285
00286
00287
00288 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00289 #$tbl->disable("footer");
00290
00291 $tr_data = $this->object->getTrackingDataAgg($_GET["obj_id"]);
00292
00293
00294 $tbl->setMaxCount(count($tr_data));
00295 $tr_data = array_slice($tr_data, $_GET["offset"], $_GET["limit"]);
00296
00297 $tbl->render();
00298 if (count($tr_data) > 0)
00299 {
00300 foreach ($tr_data as $data)
00301 {
00302 if (ilObject::_exists($data["user_id"]))
00303 {
00304 $this->tpl->setCurrentBlock("tbl_content");
00305 $user = new ilObjUser($data["user_id"]);
00306 $this->tpl->setVariable("VAL_USERNAME", $user->getLastname().", ".
00307 $user->getFirstname());
00308 $this->ctrl->setParameter($this, "user_id", $data["user_id"]);
00309 $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
00310 $this->tpl->setVariable("LINK_USER",
00311 $this->ctrl->getLinkTarget($this, "showTrackingItemPerUser"));
00312 $this->tpl->setVariable("VAL_TIME", $data["time"]);
00313 $this->tpl->setVariable("VAL_STATUS", $data["status"]);
00314 $this->tpl->setVariable("VAL_SCORE", $data["score"]);
00315
00316 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00317 $this->tpl->setVariable("CSS_ROW", $css_row);
00318 $this->tpl->parseCurrentBlock();
00319 }
00320 }
00321 }
00322 else
00323 {
00324 $this->tpl->setCurrentBlock("notfound");
00325 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00326 $this->tpl->setVariable("NUM_COLS", $num);
00327 $this->tpl->parseCurrentBlock();
00328 }
00329 }
00330
00334 function showTrackingItemPerUser()
00335 {
00336
00337 include_once "./classes/class.ilTableGUI.php";
00338
00339
00340 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
00341
00342 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scorm_track_item_per_user.html", true);
00343
00344 $num = 2;
00345
00346 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");
00347
00348
00349 $tbl = new ilTableGUI();
00350
00351 include_once("content/classes/SCORM/class.ilSCORMItem.php");
00352 $sc_item =& new ilSCORMItem($_GET["obj_id"]);
00353
00354
00355 $tbl->setTitle($sc_item->getTitle());
00356
00357 $tbl->setHeaderNames(array($this->lng->txt("firstname"),$this->lng->txt("lastname"),
00358 $this->lng->txt("cont_lvalue"), $this->lng->txt("cont_rvalue")));
00359
00360 $header_params = array("ref_id" => $this->ref_id, "cmd" => $_GET["cmd"],
00361 "cmdClass" => get_class($this), "obj_id" => $_GET["obj_id"],
00362 "user_id" => $_GET["user_id"]);
00363 $cols = array("firstname", "lastname", "lvalue", "rvalue");
00364 $tbl->setHeaderVars($cols, $header_params);
00365
00366
00367
00368 $tbl->setOrderColumn($_GET["sort_by"]);
00369 $tbl->setOrderDirection($_GET["sort_order"]);
00370 $tbl->setLimit($_GET["limit"]);
00371 $tbl->setOffset($_GET["offset"]);
00372 $tbl->setMaxCount($this->maxcount);
00373
00374
00375
00376
00377
00378 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00379 #$tbl->disable("footer");
00380
00381 $tr_data = $this->object->getTrackingDataPerUser($_GET["obj_id"], $_GET["user_id"]);
00382
00383
00384 $tbl->setMaxCount(count($tr_data));
00385 $tr_data = array_slice($tr_data, $_GET["offset"], $_GET["limit"]);
00386
00387 $tbl->render();
00388 if (count($tr_data) > 0)
00389 {
00390 foreach ($tr_data as $data)
00391 {
00392 $this->tpl->setCurrentBlock("tbl_content");
00393 $user = new ilObjUser($data["user_id"]);
00394 $this->tpl->setVariable("VAL_FIRSTNAME", $user->getFirstname());
00395 $this->tpl->setVariable("VAL_LASTNAME", $user->getLastname());
00396 $this->tpl->setVariable("VAR", $data["lvalue"]);
00397 $this->tpl->setVariable("VAL", $data["rvalue"]);
00398
00399 $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
00400 $this->tpl->setVariable("CSS_ROW", $css_row);
00401 $this->tpl->parseCurrentBlock();
00402 }
00403 }
00404 else
00405 {
00406 $this->tpl->setCurrentBlock("notfound");
00407 $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
00408 $this->tpl->setVariable("NUM_COLS", $num);
00409 $this->tpl->parseCurrentBlock();
00410 }
00411 }
00412
00413 }
00414 ?>