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
00039 class ilCourseContentInterface
00040 {
00041 var $cci_course_obj;
00042 var $cci_course_id;
00043 var $cci_ref_id;
00044 var $cci_client_class;
00045
00046 var $chi_obj;
00047
00048
00049 function ilCourseContentInterface(&$client_class,$a_ref_id)
00050 {
00051 global $lng,$tpl,$ilCtrl,$tree,$ilUser;
00052
00053 $this->lng =& $lng;
00054 $this->tpl =& $tpl;
00055 $this->ctrl =& $ilCtrl;
00056 $this->tree =& $tree;
00057 $this->ilUser =& $ilUser;
00058
00059 $this->cci_ref_id = $a_ref_id;
00060 $this->cci_read();
00061 $this->cci_client_class = strtolower(get_class($client_class));
00062
00063 $this->cci_client_obj =& $client_class;
00064 $this->cci_course_obj =& ilObjectFactory::getInstanceByRefId($this->cci_course_id);
00065 $this->cci_course_obj->initCourseItemObject($this->cci_ref_id);
00066
00067 $this->lng->loadLanguageModule('crs');
00068
00069 return true;
00070 }
00071
00072 function &executeCommand()
00073 {
00074 global $rbacsystem;
00075
00076 $next_class = $this->ctrl->getNextClass($this);
00077 $cmd = $this->ctrl->getCmd();
00078
00079
00080 switch($next_class)
00081 {
00082
00083 case "ilconditionhandlerinterface":
00084 include_once './classes/class.ilConditionHandlerInterface.php';
00085
00086 $new_gui =& new ilConditionHandlerInterface($this,$_GET['item_id']);
00087 $this->ctrl->saveParameter($this,'item_id',$_GET['item_id']);
00088 $new_gui->setBackButtons(array('edit' => $this->ctrl->getLinkTarget($this,'cciEdit'),
00089 'preconditions' => $this->ctrl->getLinkTargetByClass('ilconditionhandlerinterface',
00090 'listConditions')));
00091 $this->ctrl->forwardCommand($new_gui);
00092 break;
00093
00094 default:
00095 if(!$cmd)
00096 {
00097 $cmd = "view";
00098 }
00099 $this->$cmd();
00100
00101 break;
00102 }
00103 return true;
00104 }
00105
00106 function cci_init(&$client_class,$a_ref_id)
00107 {
00108 $this->cci_ref_id = $a_ref_id;
00109 $this->cci_read();
00110 $this->cci_client_class = strtolower(get_class($client_class));
00111
00112 $this->cci_course_obj =& ilObjectFactory::getInstanceByRefId($this->cci_course_id);
00113 $this->cci_course_obj->initCourseItemObject($this->cci_ref_id);
00114
00115 $this->lng->loadLanguageModule('crs');
00116
00117 return true;
00118 }
00119
00120 function cci_objectives_ask_reset()
00121 {
00122 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objectives_ask_reset.html","course");
00123
00124 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this->cci_client_obj));
00125 $this->tpl->setVariable("INFO_STRING",$this->lng->txt('crs_objectives_reset_sure'));
00126 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00127 $this->tpl->setVariable("TXT_RESET",$this->lng->txt('reset'));
00128
00129 return true;
00130 }
00131
00132 function cci_view()
00133 {
00134 include_once "./classes/class.ilRepositoryExplorer.php";
00135 include_once "./payment/classes/class.ilPaymentObject.php";
00136 include_once './course/classes/class.ilCourseStart.php';
00137
00138 global $rbacsystem;
00139 global $ilias;
00140 global $ilUser;
00141
00142 $write_perm = $rbacsystem->checkAccess("write",$this->cci_ref_id);
00143 $enabled_objectives = $this->cci_course_obj->enabledObjectiveView();
00144 $view_objectives = ($enabled_objectives and ($this->cci_ref_id == $this->cci_course_obj->getRefId()));
00145
00146
00147 $start_obj =& new ilCourseStart($this->cci_course_obj->getRefId(),$this->cci_course_obj->getId());
00148 if(count($this->starter = $start_obj->getStartObjects()) and
00149 !$start_obj->isFullfilled($ilUser->getId()) and
00150 !$write_perm)
00151 {
00152 $this->cci_start_objects();
00153
00154 return true;
00155 }
00156
00157
00158
00159 if(($view_objectives and !$write_perm) or ($_SESSION['crs_viewmode'] == 'objectives' and $write_perm))
00160 {
00161 $this->cci_objectives();
00162
00163 return true;
00164 }
00165
00166 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_view.html","course");
00167
00168
00169 $write_perm = $rbacsystem->checkAccess("write",$this->cci_ref_id);
00170 if($write_perm)
00171 {
00172 $items = $this->cci_course_obj->items_obj->getAllItems();
00173 }
00174 else
00175 {
00176 $items = $this->cci_course_obj->items_obj->getItems();
00177 }
00178
00179
00180 if(!count($items))
00181 {
00182 sendInfo($this->lng->txt("crs_no_items_found"));
00183
00184 return true;
00185 }
00186
00187 $tpl =& new ilTemplate("tpl.table.html", true, true);
00188
00189 $maxcount = count($items);
00190
00191 #$cont_arr = array_slice($items, $_GET["offset"], $_GET["limit"]);
00192
00193 $cont_arr = $items;
00194
00195 $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_content_row.html","course");
00196 $cont_num = count($cont_arr);
00197
00198
00199 if ($cont_num > 0)
00200 {
00201
00202 $num = 0;
00203 foreach ($cont_arr as $cont_data)
00204 {
00205 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($cont_data['obj_id']);
00206
00207 #if ($rbacsystem->checkAccess('read',$cont_data["ref_id"]) and
00208 # ($conditions_ok or $rbacsystem->checkAccess('write',$cont_data['ref_id'])))
00209 $obj_link = ilRepositoryExplorer::buildLinkTarget($cont_data["child"],$cont_data["type"]);
00210 $obj_frame = ilRepositoryExplorer::buildFrameTarget($cont_data["type"],$cont_data["child"],$cont_data["obj_id"]);
00211 $contentObj = false;
00212 if (strcmp($cont_data["type"], "lm") == 0)
00213 {
00214 require_once("./content/classes/class.ilObjContentObject.php");
00215 $contentObj = new ilObjContentObject($cont_data["ref_id"]);
00216 $contentObj->readProperties();
00217 }
00218 if(ilRepositoryExplorer::isClickable($cont_data['type'],$cont_data['ref_id'],$cont_data['obj_id'])
00219 && $obj_link != "")
00220 {
00221 $tpl->setCurrentBlock("crs_read");
00222 $tpl->setVariable("READ_TITLE", $cont_data["title"]);
00223 $tpl->setVariable("READ_LINK", $obj_link);
00224 if (strcmp($cont_data["type"], "lm") == 0)
00225 {
00226 if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) && !$contentObj->getOnline())
00227 {
00228 $tpl->setVariable("R_CLASS", " class=\"offline\"");
00229 }
00230 }
00231 if ($obj_frame == "")
00232 {
00233 $tpl->setVariable("READ_TARGET", "");
00234 }
00235 else
00236 {
00237 $tpl->setVariable("READ_TARGET", $obj_frame);
00238 }
00239 $tpl->parseCurrentBlock();
00240 }
00241 else
00242 {
00243 $tpl->setCurrentBlock("crs_visible");
00244 $tpl->setVariable("VIEW_TITLE", $cont_data["title"]);
00245 $tpl->parseCurrentBlock();
00246 }
00247 if($cont_data["type"] == "file" and $rbacsystem->checkAccess('read',$cont_data['ref_id']))
00248 {
00249 $this->cci_client_obj->ctrl->setParameterByClass('ilObjFileGUI','cmd','sendFile');
00250 $this->cci_client_obj->ctrl->setParameterByClass('ilObjFileGUI','ref_id',$cont_data['ref_id']);
00251 }
00252
00253 if(!$conditions_ok)
00254 {
00255 foreach(ilConditionHandler::_getConditionsOfTarget($cont_data['obj_id']) as $condition)
00256 {
00257 if(ilConditionHandler::_checkCondition($condition['id']))
00258 {
00259 continue;
00260 }
00261 $trigger_obj =& ilObjectFactory::getInstanceByRefId($condition['trigger_ref_id']);
00262
00263 if(ilRepositoryExplorer::isClickable($trigger_obj->getType(),$trigger_obj->getRefId(),$trigger_obj->getId()))
00264 {
00265 $tpl->setCurrentBlock("link");
00266 $tpl->setVariable("PRECONDITION_LINK",
00267 ilRepositoryExplorer::buildLinkTarget($trigger_obj->getRefId(),$trigger_obj->getType()));
00268 $tpl->setVariable("PRECONDITION_NAME",$trigger_obj->getTitle());
00269 $tpl->parseCurrentBlock();
00270 }
00271 else
00272 {
00273 $tpl->setCurrentBlock("no_link");
00274 $tpl->setVariable("PRECONDITION_NO_TITLE",$trigger_obj->getTitle());
00275 $tpl->parseCurrentBlock();
00276 }
00277 }
00278 $tpl->setCurrentBlock("crs_preconditions");
00279 $tpl->setVariable("TXT_PRECONDITIONS",$this->lng->txt('condition_precondition'));
00280 $tpl->parseCurrentBlock();
00281 }
00282
00283 if($rbacsystem->checkAccess('write',$cont_data['ref_id']))
00284 {
00285 if($obj_link = ilRepositoryExplorer::buildEditLinkTarget($cont_data["child"],$cont_data["type"]))
00286 {
00287 $tpl->setCurrentBlock("crs_edit");
00288 $tpl->setVariable("EDIT_LINK", $obj_link);
00289 $tpl->setVariable("TXT_EDIT",$this->lng->txt('edit'));
00290 $tpl->parseCurrentBlock();
00291 }
00292 }
00293 if($rbacsystem->checkAccess('delete',$cont_data['ref_id']))
00294 {
00295 $tpl->setCurrentBlock("crs_delete");
00296
00297 $this->cci_client_obj->ctrl->setParameterByClass("ilRepositoryGUI","ref_id",$cont_data["ref_id"]);
00298
00299 $tpl->setVariable("DELETE_LINK",$this->cci_client_obj->ctrl->getLinkTargetByClass("ilRepositoryGUI","delete"));
00300 $tpl->setVariable("TXT_DELETE",$this->lng->txt('delete'));
00301 $tpl->parseCurrentBlock();
00302 }
00303
00304
00305 if (strcmp($cont_data["type"], "svy") == 0)
00306 {
00307 require_once("./survey/classes/class.ilObjSurvey.php");
00308 $this->lng->loadLanguageModule("survey");
00309 $svy_data =& ilObjSurvey::_getGlobalSurveyData($cont_data["obj_id"]);
00310 if (($rbacsystem->checkAccess('write',$cont_data["ref_id"])
00311 and $svy_data["complete"]) or ($svy_data["evaluation_access"]
00312 and $svy_data["complete"]))
00313 {
00314 $tpl->setCurrentBlock("svy_evaluation");
00315 $tpl->setVariable("EVALUATION_LINK", "survey/survey.php?cmd=evaluation&ref_id=".$cont_data["ref_id"]);
00316 $tpl->setVariable("TXT_EVALUATION", $this->lng->txt("evaluation"));
00317 $tpl->parseCurrentBlock();
00318 }
00319 }
00320
00321
00322 if (strcmp($cont_data["type"], "tst") == 0)
00323 {
00324 require_once("./assessment/classes/class.ilObjTest.php");
00325 $this->lng->loadLanguageModule("assessment");
00326 $complete = ilObjTest::_isComplete($cont_data["obj_id"]);
00327
00328 if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) and ($complete))
00329 {
00330 $tpl->setCurrentBlock("tst_anon_eval");
00331 $tpl->setVariable("ANON_EVAL_LINK", "assessment/test.php?cmd=eval_a&ref_id=".$cont_data["ref_id"]);
00332 $tpl->setVariable("TXT_ANON_EVAL", $this->lng->txt("tst_anon_eval"));
00333 $tpl->parseCurrentBlock();
00334 }
00335
00336
00337 if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) and ($complete))
00338 {
00339 $tpl->setCurrentBlock("tst_statistical_evaluation");
00340 $tpl->setVariable("STATISTICAL_EVALUATION_LINK", "assessment/test.php?cmd=eval_stat&ref_id=".$cont_data["ref_id"]);
00341 $tpl->setVariable("TXT_STATISTICAL_EVALUATION", $this->lng->txt("tst_statistical_evaluation"));
00342 $tpl->parseCurrentBlock();
00343 }
00344 }
00345
00346
00347 if ($ilias->account->getId() != ANONYMOUS_USER_ID and
00348 !$ilias->account->isDesktopItem($cont_data['ref_id'], $cont_data["type"]) and
00349 $this->cci_course_obj->getAboStatus() == $this->cci_course_obj->ABO_ENABLED)
00350 {
00351 if ($rbacsystem->checkAccess('read', $cont_data['ref_id']))
00352 {
00353 $tpl->setCurrentBlock("crs_subscribe");
00354 $tpl->setVariable("TO_DESK_LINK", "repository.php?cmd=addToDeskCourse&ref_id=".$this->cci_ref_id.
00355 "&item_ref_id=".$cont_data["ref_id"]."&type=".$cont_data["type"]);
00356
00357 $tpl->setVariable("TXT_TO_DESK", $this->lng->txt("to_desktop"));
00358 $tpl->parseCurrentBlock();
00359 }
00360 }
00361
00362
00363 if($write_perm)
00364 {
00365 if($this->cci_course_obj->getOrderType() == $this->cci_course_obj->SORT_MANUAL)
00366 {
00367 if($num != 0)
00368 {
00369 $tmp_array["gif"] = ilUtil::getImagePath("a_up.gif");
00370 $tmp_array["lng"] = $this->lng->txt("crs_move_up");
00371 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"ref_id",
00372 $this->cci_client_obj->object->getRefId());
00373 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",$cont_data["child"]);
00374 $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTarget($this->cci_client_obj,"cciMove");
00375 $tmp_array["tar"] = "";
00376
00377 $images[] = $tmp_array;
00378 }
00379 if($num != count($cont_arr) - 1)
00380 {
00381 $tmp_array["gif"] = ilUtil::getImagePath("a_down.gif");
00382 $tmp_array["lng"] = $this->lng->txt("crs_move_down");
00383 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"ref_id",
00384 $this->cci_client_obj->object->getRefId());
00385 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",-$cont_data["child"]);
00386 $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTarget($this->cci_client_obj,"cciMove");
00387 $tmp_array["tar"] = "";
00388
00389 $images[] = $tmp_array;
00390 }
00391 }
00392 $tmp_array["gif"] = ilUtil::getImagePath("edit.gif");
00393 $tmp_array["lng"] = $this->lng->txt("edit");
00394 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"ref_id",$this->cci_client_obj->object->getRefId());
00395 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",$cont_data["child"]);
00396 $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTarget($this->cci_client_obj,"cciEdit");
00397 $tmp_array["tar"] = "";
00398
00399 $images[] = $tmp_array;
00400
00401 if ($rbacsystem->checkAccess('delete',$cont_data["ref_id"]))
00402 {
00403 $tmp_array["gif"] = ilUtil::getImagePath("delete.gif");
00404 $tmp_array["lng"] = $this->lng->txt("delete");
00405 $this->cci_client_obj->ctrl->setParameterByClass("ilRepositoryGUI","ref_id",$cont_data["child"]);
00406 $tmp_array["lnk"] = $this->cci_client_obj->ctrl->getLinkTargetByClass("ilRepositoryGUI","delete");
00407 $tmp_array["tar"] = "";
00408
00409 $images[] = $tmp_array;
00410 }
00411
00412 foreach($images as $key => $image)
00413 {
00414 $tpl->setCurrentBlock("img");
00415 $tpl->setVariable("IMG_TYPE",$image["gif"]);
00416 $tpl->setVariable("IMG_ALT",$image["lng"]);
00417 $tpl->setVariable("IMG_LINK",$image["lnk"]);
00418 $tpl->setVariable("IMG_TARGET",$image["tar"]);
00419 $tpl->parseCurrentBlock();
00420 }
00421 unset($images);
00422
00423 $tpl->setCurrentBlock("options");
00424 $tpl->setVariable("OPT_ROWCOL", ilUtil::switchColor($num,"tblrow2","tblrow1"));
00425 $tpl->parseCurrentBlock();
00426 }
00427
00428 $tpl->setCurrentBlock("tbl_content");
00429
00430
00431 $tpl->setVariable("ROWCOL", ilUtil::switchColor($num,"tblrow2","tblrow1"));
00432 if($cont_data["type"] == "lm")
00433 {
00434 if ($rbacsystem->checkAccess('write',$cont_data["ref_id"]) && !$contentObj->getOnline())
00435 {
00436 $tpl->setVariable("TYPE_IMG", ilUtil::getImagePath("icon_".$cont_data["type"]."_offline".".gif"));
00437 $tpl->setVariable("ALT_IMG", $this->lng->txt("obj_".$cont_data["type"]) . " (" . $this->lng->txt("offline") . ")");
00438 }
00439 else
00440 {
00441 $tpl->setVariable("TYPE_IMG", ilUtil::getImagePath("icon_".$cont_data["type"].".gif"));
00442 $tpl->setVariable("ALT_IMG", $this->lng->txt("obj_".$cont_data["type"]));
00443 }
00444 }
00445 else
00446 {
00447 $tpl->setVariable("TYPE_IMG", ilUtil::getImagePath("icon_".$cont_data["type"].".gif"));
00448 $tpl->setVariable("ALT_IMG", $this->lng->txt("obj_".$cont_data["type"]));
00449 }
00450 $tpl->setVariable("DESCRIPTION", $cont_data["description"]);
00451
00452
00453 $buyable = ilPaymentObject::_isBuyable($this->cci_ref_id);
00454 if (($rbacsystem->checkAccess('write',$this->cci_ref_id) ||
00455 $buyable == false) &&
00456 $cont_data["activation_unlimited"])
00457 {
00458 $txt = $this->lng->txt("crs_unlimited");
00459 }
00460 else if ($buyable)
00461 {
00462 if (is_array($activation = ilPaymentObject::_getActivation($this->cci_ref_id)))
00463 {
00464 $txt = $this->lng->txt("crs_from")." ".strftime("%Y-%m-%d %R",$activation["activation_start"]).
00465 "<br>".$this->lng->txt("crs_to")." ".strftime("%Y-%m-%d %R",$activation["activation_end"]);
00466 }
00467 else
00468 {
00469 $txt = "N/A";
00470 }
00471 }
00472 else
00473 {
00474 $txt = $this->lng->txt("crs_from")." ".strftime("%Y-%m-%d %R",$cont_data["activation_start"]).
00475 "<br>".$this->lng->txt("crs_to")." ".strftime("%Y-%m-%d %R",$cont_data["activation_end"]);
00476 }
00477 $tpl->setVariable("ACTIVATION_END",$txt);
00478
00479 $tpl->parseCurrentBlock();
00480 $num++;
00481 }
00482 }
00483
00484
00485 $tbl = new ilTableGUI();
00486
00487
00488 $tbl->setTitle($this->lng->txt("crs_content"),"icon_crs.gif",$this->lng->txt("courses"));
00489 $tbl->setHelp("tbl_help.php","icon_help.gif",$this->lng->txt("help"));
00490
00491 if($write_perm)
00492 {
00493 $tbl->setHeaderNames(array($this->lng->txt("type"),$this->lng->txt("title"),
00494 $this->lng->txt("activation"),$this->lng->txt("options")));
00495 $tbl->setHeaderVars(array("type","title","activation","options"),
00496 array("ref_id" => $this->cci_course_obj->getRefId(),
00497 "cmdClass" => "ilobjcoursegui",
00498 "cmdNode" => $_GET["cmdNode"]));
00499 $tbl->setColumnWidth(array("1%","69%","20%","10%"));
00500 }
00501 else
00502 {
00503 $tbl->setHeaderNames(array($this->lng->txt("type"),$this->lng->txt("title"),
00504 $this->lng->txt("activation")));
00505 $tbl->setHeaderVars(array("type","title","activation","options"),
00506 array("ref_id" => $this->cci_course_obj->getRefId(),
00507 "cmdClass" => "ilobjcoursegui",
00508 "cmdNode" => $_GET["cmdNode"]));
00509 $tbl->setColumnWidth(array("1%","89%","20%"));
00510 }
00511
00512 $tbl->setLimit($_GET["limit"]);
00513 $tbl->setOffset($_GET["offset"]);
00514 $tbl->setMaxCount($maxcount);
00515
00516
00517 $tbl->disable("footer");
00518 $tbl->disable('sort');
00519
00520
00521 $tbl->setTemplate($tpl);
00522 $tbl->render();
00523
00524 $this->tpl->setVariable("CONTENT_TABLE", $tpl->get());
00525
00526 return true;
00527 }
00528
00529 function cci_start_objects()
00530 {
00531 include_once './course/classes/class.ilCourseLMHistory.php';
00532 include_once './classes/class.ilRepositoryExplorer.php';
00533
00534 global $rbacsystem,$ilias,$ilUser;
00535
00536 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_start_view.html","course");
00537 #$this->__showButton('view',$this->lng->txt('refresh'));
00538
00539 $this->tpl->setVariable("INFO_STRING",$this->lng->txt('crs_info_start'));
00540 $this->tpl->setVariable("TBL_TITLE_START",$this->lng->txt('crs_table_start_objects'));
00541 $this->tpl->setVariable("HEADER_NR",$this->lng->txt('crs_nr'));
00542 $this->tpl->setVariable("HEADER_DESC",$this->lng->txt('description'));
00543 $this->tpl->setVariable("HEADER_EDITED",$this->lng->txt('crs_objective_accomplished'));
00544
00545
00546 $lm_continue =& new ilCourseLMHistory($this->cci_ref_id,$ilUser->getId());
00547 $continue_data = $lm_continue->getLMHistory();
00548
00549 $counter = 0;
00550 foreach($this->starter as $start)
00551 {
00552 $tmp_obj =& ilObjectFactory::getInstanceByRefId($start['item_ref_id']);
00553
00554 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($tmp_obj->getId());
00555
00556 $obj_link = ilRepositoryExplorer::buildLinkTarget($tmp_obj->getRefId(),$tmp_obj->getType());
00557 $obj_frame = ilRepositoryExplorer::buildFrameTarget($tmp_obj->getType(),$tmp_obj->getRefId(),$tmp_obj->getId());
00558 $obj_frame = $obj_frame ? $obj_frame : '';
00559
00560
00561 $obj_frame = $tmp_obj->getType() == 'tst' ? '' : $obj_frame;
00562
00563 $contentObj = false;
00564
00565 if(ilRepositoryExplorer::isClickable($tmp_obj->getType(),$tmp_obj->getRefId(),$tmp_obj->getId()))
00566 {
00567 $this->tpl->setCurrentBlock("start_read");
00568 $this->tpl->setVariable("READ_TITLE_START",$tmp_obj->getTitle());
00569 $this->tpl->setVariable("READ_TARGET_START",$obj_frame);
00570 $this->tpl->setVariable("READ_LINK_START", $obj_link.'&crs_show_result='.$this->cci_ref_id);
00571 $this->tpl->parseCurrentBlock();
00572 }
00573 else
00574 {
00575 $this->tpl->setCurrentBlock("start_visible");
00576 $this->tpl->setVariable("VISIBLE_LINK_START",$tmp_obj->getTitle());
00577 $this->tpl->parseCurrentBlock();
00578 }
00579
00580 if(!$ilias->account->isDesktopItem($tmp_obj->getRefId(),$tmp_obj->getType()) and
00581 ($this->cci_course_obj->getAboStatus() == $this->cci_course_obj->ABO_ENABLED))
00582 {
00583 if ($rbacsystem->checkAccess('read',$tmp_obj->getRefId()))
00584 {
00585 $this->tpl->setCurrentBlock("start_desklink");
00586 $this->tpl->setVariable("DESK_LINK_START", "repository.php?cmd=addToDeskCourse&ref_id=".$this->cci_ref_id.
00587 "&item_ref_id=".$tmp_obj->getRefId()."&type=".$tmp_obj->getType());
00588
00589 $this->tpl->setVariable("TXT_DESK_START", $this->lng->txt("to_desktop"));
00590 $this->tpl->parseCurrentBlock();
00591 }
00592 }
00593
00594
00595 if(isset($continue_data[$tmp_obj->getRefId()]))
00596 {
00597 $this->tpl->setCurrentBlock("start_continuelink");
00598 $this->tpl->setVariable("CONTINUE_LINK_START",'./content/lm_presentation.php?ref_id='.$tmp_obj->getRefId().'&obj_id='.
00599 $continue_data[$tmp_obj->getRefId()]['lm_page_id']);
00600
00601 $target = $ilias->ini->readVariable("layout","view_target") == "frame" ?
00602 '' :
00603 'ilContObj'.$cont_data[$obj_id]['obj_page_id'];
00604
00605 $this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
00606 $this->tpl->setVariable("TXT_CONTINUE_START",$this->lng->txt('continue_work'));
00607 $this->tpl->parseCurrentBlock();
00608 }
00609
00610
00611 if(strlen($tmp_obj->getDescription()))
00612 {
00613 $this->tpl->setCurrentBlock("start_description");
00614 $this->tpl->setVariable("DESCRIPTION_START",$tmp_obj->getDescription());
00615 $this->tpl->parseCurrentBlock();
00616 }
00617
00618 switch($tmp_obj->getType())
00619 {
00620 case 'tst':
00621 include_once './assessment/classes/class.ilObjTest.php';
00622 $accomplished = ilObjTest::_checkCondition($tmp_obj->getId(),'finished','') ? 'accomplished' : 'not_accomplished';
00623 break;
00624
00625 default:
00626 $accomplished = isset($continue_data[$tmp_obj->getRefId()]) ? 'accomplished' : 'not_accomplished';
00627 break;
00628 }
00629 $this->tpl->setCurrentBlock("start_row");
00630 $this->tpl->setVariable("EDITED_IMG",ilUtil::getImagePath('crs_'.$accomplished.'.gif'));
00631 $this->tpl->setVariable("EDITED_ALT",$this->lng->txt('crs_objective_'.$accomplished));
00632 $this->tpl->setVariable("ROW_CLASS",'option_value');
00633 $this->tpl->setVariable("ROW_CLASS_CENTER",'option_value_center');
00634 $this->tpl->setVariable("OBJ_NR_START",++$counter.'.');
00635 $this->tpl->parseCurrentBlock();
00636 }
00637 return true;
00638 }
00639
00640 function cci_objectives()
00641 {
00642 include_once "./course/classes/class.ilCourseStart.php";
00643
00644 global $rbacsystem,$ilUser,$ilBench;
00645
00646 $ilBench->start('Objectives','Objectives_view');
00647
00648
00649
00650 $ilBench->start('Objectives','Objectives_start_objects');
00651 if(!$_SESSION['objectives_fullfilled'][$this->cci_course_obj->getId()])
00652 {
00653 $start_obj =& new ilCourseStart($this->cci_course_obj->getRefId(),$this->cci_course_obj->getId());
00654 if(count($this->starter = $start_obj->getStartObjects()) and !$start_obj->isFullfilled($ilUser->getId()))
00655 {
00656 $this->cci_start_objects();
00657
00658 return true;
00659 }
00660 $_SESSION['objectives_fullfilled'][$this->cci_course_obj->getId()] = true;
00661 }
00662 $ilBench->stop('Objectives','Objectives_start_objects');
00663
00664 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objective_view.html","course");
00665 $this->__showButton('cciObjectivesAskReset',$this->lng->txt('crs_reset_results'));
00666
00667 $ilBench->start('Objectives','Objectives_read');
00668
00669 $ilBench->start('Objectives','Objectives_read_accomplished');
00670 $this->__readAccomplished();
00671 $ilBench->stop('Objectives','Objectives_read_accomplished');
00672
00673 $ilBench->start('Objectives','Objectives_read_suggested');
00674 $this->__readSuggested();
00675 $ilBench->stop('Objectives','Objectives_read_suggested');
00676
00677 $ilBench->start('Objectives','Objectives_read_status');
00678 $this->__readStatus();
00679 $ilBench->stop('Objectives','Objectives_read_status');
00680
00681 $ilBench->stop('Objectives','Objectives_read');
00682
00683
00684 $this->__showInfo();
00685
00686
00687 $ilBench->start('Objectives','Objectives_objectives');
00688 $this->__showObjectives();
00689 $ilBench->stop('Objectives','Objectives_objectives');
00690
00691
00692 $ilBench->start('Objectives','Objectives_lms');
00693 $this->__showLearningMaterials();
00694 $ilBench->stop('Objectives','Objectives_lms');
00695
00696
00697 $ilBench->start('Objectives','Objectives_tests');
00698 $this->__showTests();
00699 $ilBench->stop('Objectives','Objectives_tests');
00700
00701
00702 $ilBench->start('Objectives','Objectives_or');
00703 $this->__showOtherResources();
00704 $ilBench->stop('Objectives','Objectives_or');
00705
00706 $ilBench->stop('Objectives','Objectives_view');
00707
00708 $ilBench->save();
00709
00710 return true;
00711 }
00712
00713 function cci_edit()
00714 {
00715 global $rbacsystem;
00716
00717 if(!$rbacsystem->checkAccess("write", $this->cci_ref_id))
00718 {
00719 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
00720 }
00721 if(!isset($_GET["item_id"]))
00722 {
00723 sendInfo($this->lng->txt("crs_no_item_id_given"));
00724 $this->cci_view();
00725
00726 return false;
00727 }
00728
00729 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_editItem.html","course");
00730 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00731
00732
00733
00734 $this->tpl->setCurrentBlock("btn_cell");
00735
00736 $this->ctrl->setParameterByClass(strtolower(get_class($this->cci_client_obj)),'item_id',(int) $_GET['item_id']);
00737 $this->tpl->setVariable("BTN_LINK",
00738 $this->ctrl->getLinkTarget($this->cci_client_obj,'cciEdit'));
00739 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('edit'));
00740 $this->tpl->parseCurrentBlock();
00741
00742 $this->tpl->setCurrentBlock("btn_cell");
00743 $this->ctrl->setParameterByClass('ilConditionHandlerInterface','item_id',(int) $_GET['item_id']);
00744 $this->tpl->setVariable("BTN_LINK",
00745 $this->ctrl->getLinkTargetByClass('ilConditionHandlerInterface','listConditions'));
00746 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('preconditions'));
00747 $this->tpl->parseCurrentBlock();
00748
00749
00750
00751 $this->cci_client_obj->ctrl->setParameter($this->cci_client_obj,"item_id",$_GET["item_id"]);
00752 $this->tpl->setVariable("FORMACTION",$this->cci_client_obj->ctrl->getFormAction($this->cci_client_obj));
00753
00754 $item_data = $this->cci_course_obj->items_obj->getItem((int) $_GET["item_id"]);
00755
00756 $tmp_obj = ilObjectFactory::getInstanceByRefId($_GET["item_id"]);
00757 $title = $tmp_obj->getTitle();
00758
00759
00760 $activation_unlimited = $_SESSION["error_post_vars"]["crs"]["activation_unlimited"] ?
00761 1 :
00762 (int) $item_data["activation_unlimited"];
00763
00764 $activation_start = $_SESSION["error_post_vars"]["crs"]["activation_start"] ?
00765 $this->cciToUnix($_SESSION["error_post_vars"]["crs"]["activation_start"]) :
00766 $item_data["activation_start"];
00767
00768 $activation_end = $_SESSION["error_post_vars"]["crs"]["activation_end"] ?
00769 $this->cciToUnix($_SESSION["error_post_vars"]["crs"]["activation_end"]) :
00770 $item_data["activation_end"];
00771
00772
00773 $this->tpl->setVariable("ALT_IMG",$this->lng->txt("obj_".$tmp_obj->getType()));
00774 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath("icon_".$tmp_obj->getType().".gif"));
00775 $this->tpl->setVariable("TITLE",$title);
00776 $this->tpl->setVariable("TXT_ACTIVATION",$this->lng->txt("activation"));
00777 $this->tpl->setVariable("TXT_ACTIVATION_UNLIMITED",$this->lng->txt("crs_unlimited"));
00778 $this->tpl->setVariable("TXT_ACTIVATION_START",$this->lng->txt("crs_start"));
00779 $this->tpl->setVariable("TXT_ACTIVATION_END",$this->lng->txt("crs_end"));
00780 $this->tpl->setVariable("CMD_SUBMIT","cciUpdate");
00781 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt("cancel"));
00782 $this->tpl->setVariable("TXT_SUBMIT",$this->lng->txt("submit"));
00783
00784 $this->tpl->setVariable("ACTIVATION_UNLIMITED",ilUtil::formCheckbox($activation_unlimited,"crs[activation_unlimited]",1));
00785
00786
00787 $this->tpl->setVariable("SELECT_ACTIVATION_START_DAY",$this->cciGetDateSelect("day","crs[activation_start][day]",
00788 date("d",$activation_start)));
00789 $this->tpl->setVariable("SELECT_ACTIVATION_START_MONTH",$this->cciGetDateSelect("month","crs[activation_start][month]",
00790 date("m",$activation_start)));
00791 $this->tpl->setVariable("SELECT_ACTIVATION_START_YEAR",$this->cciGetDateSelect("year","crs[activation_start][year]",
00792 date("Y",$activation_start)));
00793 $this->tpl->setVariable("SELECT_ACTIVATION_START_HOUR",$this->cciGetDateSelect("hour","crs[activation_start][hour]",
00794 date("G",$activation_start)));
00795 $this->tpl->setVariable("SELECT_ACTIVATION_START_MINUTE",$this->cciGetDateSelect("minute","crs[activation_start][minute]",
00796 date("i",$activation_start)));
00797 $this->tpl->setVariable("SELECT_ACTIVATION_END_DAY",$this->cciGetDateSelect("day","crs[activation_end][day]",
00798 date("d",$activation_end)));
00799 $this->tpl->setVariable("SELECT_ACTIVATION_END_MONTH",$this->cciGetDateSelect("month","crs[activation_end][month]",
00800 date("m",$activation_end)));
00801 $this->tpl->setVariable("SELECT_ACTIVATION_END_YEAR",$this->cciGetDateSelect("year","crs[activation_end][year]",
00802 date("Y",$activation_end)));
00803 $this->tpl->setVariable("SELECT_ACTIVATION_END_HOUR",$this->cciGetDateSelect("hour","crs[activation_end][hour]",
00804 date("G",$activation_end)));
00805 $this->tpl->setVariable("SELECT_ACTIVATION_END_MINUTE",$this->cciGetDateSelect("minute","crs[activation_end][minute]",
00806 date("i",$activation_end)));
00807 # $this->cci_client_obj->initConditionHandlerGUI($_GET['item_id']);
00808 # $this->tpl->setVariable("PRECONDITION_TABLE",$this->cci_client_obj->chi_obj->chi_list());
00809
00810 }
00811
00812 function cci_update()
00813 {
00814 if(!isset($_GET["item_id"]))
00815 {
00816 echo "CourseContentInterface: No item_id given!";
00817 exit;
00818 }
00819
00820 $this->cci_course_obj->items_obj->setActivationUnlimitedStatus((bool) $_POST["crs"]["activation_unlimited"]);
00821 $this->cci_course_obj->items_obj->setActivationStart($this->cciToUnix($_POST["crs"]["activation_start"]));
00822 $this->cci_course_obj->items_obj->setActivationEnd($this->cciToUnix($_POST["crs"]["activation_end"]));
00823
00824 if(!$this->cci_course_obj->items_obj->validateActivation())
00825 {
00826 sendInfo($this->cci_course_obj->getMessage());
00827 $this->cci_edit();
00828
00829 return true;
00830 }
00831 $this->cci_course_obj->items_obj->update((int) $_GET["item_id"]);
00832 $this->cci_view();
00833
00834 return true;
00835 }
00836
00837 function cci_move()
00838 {
00839 if($_GET["item_id"] > 0)
00840 {
00841 $this->cci_course_obj->items_obj->moveUp((int) $_GET["item_id"]);
00842 }
00843 else
00844 {
00845 $this->cci_course_obj->items_obj->moveDown((int) -$_GET["item_id"]);
00846 }
00847 sendInfo($this->lng->txt("crs_moved_item"));
00848
00849 $this->cci_view();
00850
00851 return true;
00852 }
00853
00854 function __showHideLinks($a_part)
00855 {
00856 if($_GET['show_hide_'.$a_part] == 1)
00857 {
00858 unset($_SESSION['crs_hide_'.$a_part]);
00859 }
00860 if($_GET['show_hide_'.$a_part] == 2)
00861 {
00862 $_SESSION['crs_hide_'.$a_part] = true;
00863 }
00864
00865 $this->ctrl->setParameter($this->cci_client_obj,'show_hide_'.$a_part,$_SESSION['crs_hide_'.$a_part] ? 1 : 2);
00866 $this->tpl->setVariable("LINK_HIDE_SHOW_".strtoupper($a_part),$this->ctrl->getLinkTarget($this->cci_client_obj,'cciObjectives'));
00867 $this->tpl->setVariable("TXT_HIDE_SHOW_".strtoupper($a_part),$_SESSION['crs_hide_'.$a_part] ?
00868 $this->lng->txt('crs_show_link_'.$a_part) :
00869 $this->lng->txt('crs_hide_link_'.$a_part));
00870
00871 $this->ctrl->setParameter($this->cci_client_obj,'show_hide_'.$a_part,'');
00872
00873 $this->tpl->setVariable("HIDE_SHOW_IMG_".strtoupper($a_part),$_SESSION['crs_hide_'.$a_part] ?
00874 ilUtil::getImagePath('a_down.gif') :
00875 ilUtil::getImagePath('a_up.gif'));
00876
00877 return true;
00878 }
00879
00880 function __getAllLearningMaterials()
00881 {
00882 foreach($items = $this->cci_course_obj->items_obj->getItems() as $node)
00883 {
00884 switch($node['type'])
00885 {
00886 case 'lm':
00887 case 'htlm':
00888 case 'alm':
00889 case 'sahs':
00890 $all_lms[] = $node['ref_id'];
00891 break;
00892 }
00893 }
00894 return $all_lms ? $all_lms : array();
00895 }
00896
00897 function __getAllTests()
00898 {
00899 foreach($items = $this->cci_course_obj->items_obj->getItems() as $node)
00900 {
00901 switch($node['type'])
00902 {
00903 case 'tst':
00904 $tests[] = $node['ref_id'];
00905 break;
00906 }
00907 }
00908 return $tests ? $tests : array();
00909 }
00910
00911 function __getOtherResources()
00912 {
00913 foreach($items = $this->cci_course_obj->items_obj->getItems() as $node)
00914 {
00915 switch($node['type'])
00916 {
00917 case 'lm':
00918 case 'htlm':
00919 case 'sahs':
00920 case 'tst':
00921 continue;
00922
00923 default:
00924 $all_lms[] = $node['ref_id'];
00925 break;
00926 }
00927 }
00928 return $all_lms ? $all_lms : array();
00929 }
00930
00931 function __showInfo()
00932 {
00933 include_once './course/classes/class.ilCourseObjective.php';
00934
00935 if(!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->cci_course_obj->getId())))
00936 {
00937 return true;
00938 }
00939
00940 $this->tpl->addBlockfile('INFO_BLOCK','info_block','tpl.crs_objectives_view_info_table.html','course');
00941 $this->tpl->setVariable("INFO_STRING",$this->lng->txt('crs_objectives_info_'.$this->objective_status));
00942
00943 return true;
00944 }
00945
00946
00947 function __showOtherResources()
00948 {
00949 global $ilias,$rbacsystem;
00950
00951 if(!count($ors = $this->__getOtherResources()))
00952 {
00953 return false;
00954 }
00955
00956 $this->tpl->addBlockfile('RESOURCES_BLOCK','resources_block','tpl.crs_objectives_view_or_table.html','course');
00957 $this->tpl->setVariable("TBL_TITLE_OR",$this->lng->txt('crs_other_resources'));
00958
00959
00960 $this->__showHideLinks('or');
00961
00962 if(isset($_SESSION['crs_hide_or']))
00963 {
00964 return true;
00965 }
00966
00967 $this->tpl->setCurrentBlock("tbl_header_columns_or");
00968 $this->tpl->setVariable("TBL_HEADER_WIDTH_OR","5%");
00969 $this->tpl->setVariable("TBL_HEADER_NAME_OR",$this->lng->txt('type'));
00970 $this->tpl->parseCurrentBlock();
00971
00972 $this->tpl->setCurrentBlock("tbl_header_columns_or");
00973 $this->tpl->setVariable("TBL_HEADER_WIDTH_OR","95%");
00974 $this->tpl->setVariable("TBL_HEADER_NAME_OR",$this->lng->txt('description'));
00975 $this->tpl->parseCurrentBlock();
00976
00977 $counter = 1;
00978 foreach($ors as $or_id)
00979 {
00980
00981 $tmp_or = ilObjectFactory::getInstanceByRefId($or_id);
00982
00983 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($tmp_or->getId());
00984
00985 $obj_link = ilRepositoryExplorer::buildLinkTarget($tmp_or->getRefId(),$tmp_or->getType());
00986 $obj_frame = ilRepositoryExplorer::buildFrameTarget($tmp_or->getType(),$tmp_or->getRefId(),$tmp_or->getId());
00987 $obj_frame = $obj_frame ? $obj_frame : '';
00988
00989 if(ilRepositoryExplorer::isClickable($tmp_or->getType(),$tmp_or->getRefId(),$tmp_or->getId()))
00990 {
00991 $this->tpl->setCurrentBlock("or_read");
00992 $this->tpl->setVariable("READ_TITLE_OR",$tmp_or->getTitle());
00993 $this->tpl->setVariable("READ_TARGET_OR",$obj_frame);
00994 $this->tpl->setVariable("READ_LINK_OR", $obj_link);
00995 $this->tpl->parseCurrentBlock();
00996 }
00997 else
00998 {
00999 $this->tpl->setCurrentBlock("or_visible");
01000 $this->tpl->setVariable("VISIBLE_LINK_OR",$tmp_or->getTitle());
01001 $this->tpl->parseCurrentBlock();
01002 }
01003
01004 if(!$ilias->account->isDesktopItem($tmp_or->getRefId(),$tmp_or->getType()) and
01005 ($this->cci_course_obj->getAboStatus() == $this->cci_course_obj->ABO_ENABLED))
01006 {
01007 if ($rbacsystem->checkAccess('read',$tmp_or->getRefId()))
01008 {
01009 $this->tpl->setCurrentBlock("or_desklink");
01010 $this->tpl->setVariable("DESK_LINK_OR", "repository.php?cmd=addToDeskCourse&ref_id=".$this->cci_ref_id.
01011 "&item_ref_id=".$tmp_or->getRefId()."&type=".$tmp_or->getType());
01012
01013 $this->tpl->setVariable("TXT_DESK_OR", $this->lng->txt("to_desktop"));
01014 $this->tpl->parseCurrentBlock();
01015 }
01016 }
01017
01018 $this->tpl->setCurrentBlock("or_row");
01019 $this->tpl->setVariable("OBJ_TITLE_OR",$tmp_or->getTitle());
01020 $this->tpl->setVariable("IMG_TYPE_OR",ilUtil::getImagePath('icon_'.$tmp_or->getType().'.gif'));
01021 $this->tpl->setVariable("TXT_IMG_OR",$this->lng->txt('obj_'.$tmp_or->getType()));
01022 $this->tpl->setVariable("OBJ_CLASS_CENTER_OR",'option_value_center');
01023 $this->tpl->setVariable("OBJ_CLASS_OR",'option_value');
01024 $this->tpl->parseCurrentBlock();
01025
01026 unset($tmp_or);
01027 ++$counter;
01028 }
01029 }
01030
01031
01032 function __showLearningMaterials()
01033 {
01034 global $rbacsystem,$ilias,$ilUser;
01035
01036 include_once './course/classes/class.ilCourseObjectiveLM.php';
01037 include_once './classes/class.ilRepositoryExplorer.php';
01038 include_once './course/classes/class.ilCourseLMHistory.php';
01039
01040 if(!count($lms = $this->__getAllLearningMaterials()))
01041 {
01042 return false;
01043 }
01044 if($this->details_id)
01045 {
01046 $objectives_lm_obj =& new ilCourseObjectiveLM($this->details_id);
01047 }
01048
01049 $lm_continue =& new ilCourseLMHistory($this->cci_ref_id,$ilUser->getId());
01050 $continue_data = $lm_continue->getLMHistory();
01051
01052 $this->tpl->addBlockfile('LM_BLOCK','lm_block','tpl.crs_objectives_view_lm_table.html','course');
01053 $this->tpl->setVariable("TBL_TITLE_LMS",$this->lng->txt('crs_learning_materials'));
01054
01055
01056 $this->__showHideLinks('lms');
01057
01058 if(isset($_SESSION['crs_hide_lms']))
01059 {
01060 return true;
01061 }
01062
01063 $this->tpl->setCurrentBlock("tbl_header_columns_lms");
01064 $this->tpl->setVariable("TBL_HEADER_WIDTH_LMS","5%");
01065 $this->tpl->setVariable("TBL_HEADER_NAME_LMS",$this->lng->txt('crs_nr'));
01066 $this->tpl->parseCurrentBlock();
01067
01068 $this->tpl->setCurrentBlock("tbl_header_columns_lms");
01069 $this->tpl->setVariable("TBL_HEADER_WIDTH_LMS","95%");
01070 $this->tpl->setVariable("TBL_HEADER_NAME_LMS",$this->lng->txt('description'));
01071 $this->tpl->parseCurrentBlock();
01072
01073 $counter = 1;
01074 foreach($lms as $lm_id)
01075 {
01076 $tmp_lm = ilObjectFactory::getInstanceByRefId($lm_id);
01077
01078 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($tmp_lm->getId());
01079
01080 $obj_link = ilRepositoryExplorer::buildLinkTarget($tmp_lm->getRefId(),$tmp_lm->getType());
01081 $obj_frame = ilRepositoryExplorer::buildFrameTarget($tmp_lm->getType(),$tmp_lm->getRefId(),$tmp_lm->getId());
01082 $obj_frame = $obj_frame ? $obj_frame : '';
01083 $contentObj = false;
01084
01085 if(ilRepositoryExplorer::isClickable($tmp_lm->getType(),$tmp_lm->getRefId(),$tmp_lm->getId()))
01086 {
01087 $this->tpl->setCurrentBlock("lm_read");
01088 $this->tpl->setVariable("READ_TITLE_LMS",$tmp_lm->getTitle());
01089 $this->tpl->setVariable("READ_TARGET_LMS",$obj_frame);
01090 $this->tpl->setVariable("READ_LINK_LMS", $obj_link);
01091 $this->tpl->parseCurrentBlock();
01092 }
01093 else
01094 {
01095 $this->tpl->setCurrentBlock("lm_visible");
01096 $this->tpl->setVariable("VISIBLE_LINK_LMS",$tmp_lm->getTitle());
01097 $this->tpl->parseCurrentBlock();
01098 }
01099
01100 if(!$ilias->account->isDesktopItem($tmp_lm->getRefId(),$tmp_lm->getType()) and
01101 ($this->cci_course_obj->getAboStatus() == $this->cci_course_obj->ABO_ENABLED))
01102 {
01103 if ($rbacsystem->checkAccess('read',$tmp_lm->getRefId()))
01104 {
01105 $this->tpl->setCurrentBlock("lm_desklink");
01106 $this->tpl->setVariable("DESK_LINK_LMS", "repository.php?cmd=addToDeskCourse&ref_id=".$this->cci_ref_id.
01107 "&item_ref_id=".$tmp_lm->getRefId()."&type=".$tmp_lm->getType());
01108
01109 $this->tpl->setVariable("TXT_DESK_LMS", $this->lng->txt("to_desktop"));
01110 $this->tpl->parseCurrentBlock();
01111 }
01112 }
01113
01114
01115 if(isset($continue_data["$lm_id"]))
01116 {
01117 $this->tpl->setCurrentBlock("lm_continuelink");
01118 $this->tpl->setVariable("CONTINUE_LINK_LMS",'./content/lm_presentation.php?ref_id='.$lm_id.'&obj_id='.
01119 $cont_data[$lm_id]['lm_page_id']);
01120
01121 $target = $ilias->ini->readVariable("layout","view_target") == "frame" ?
01122 '' :
01123 'ilContObj'.$cont_data[$lm_id]['lm_page_id'];
01124
01125 $this->tpl->setVariable("CONTINUE_LINK_TARGET",$target);
01126 $this->tpl->setVariable("TXT_CONTINUE_LMS",$this->lng->txt('continue_work'));
01127 $this->tpl->parseCurrentBlock();
01128 }
01129
01130
01131 if(strlen($tmp_lm->getDescription()))
01132 {
01133 $this->tpl->setCurrentBlock("lms_description");
01134 $this->tpl->setVariable("DESCRIPTION_LMS",$tmp_lm->getDescription());
01135 $this->tpl->parseCurrentBlock();
01136 }
01137
01138 if(isset($continue_data["$lm_id"]))
01139 {
01140 $this->tpl->setVariable("TEXT_INFO_LMS",$this->lng->txt('last_access'));
01141 $this->tpl->setVariable("INFO_LMS",date('Y-m-d H:i:s',$continue_data["$lm_id"]['last_access']));
01142 }
01143 else
01144 {
01145 $this->tpl->setVariable("INFO_LMS",$this->lng->txt('not_accessed'));
01146 }
01147
01148
01149 #if($this->details_id and !$this->accomplished[$this->details_id] and $this->suggested[$this->details_id])
01150 if($this->details_id)
01151 {
01152 $objectives_lm_obj->setLMRefId($tmp_lm->getRefId());
01153 #$objectives_lm_obj->setLMObjId($tmp_lm->getId());
01154 if($objectives_lm_obj->checkExists())
01155 {
01156 $objectives_lm_obj =& new ilCourseObjectiveLM($this->details_id);
01157
01158 if($conditions_ok)
01159 {
01160 foreach($objectives_lm_obj->getChapters() as $lm_obj_data)
01161 {
01162 if($lm_obj_data['ref_id'] != $lm_id)
01163 {
01164 continue;
01165 }
01166
01167 include_once './content/classes/class.ilLMObjectFactory.php';
01168
01169 $st_obj = ilLMObjectFactory::getInstance($tmp_lm,$lm_obj_data['obj_id']);
01170
01171 $this->tpl->setCurrentBlock("chapters");
01172 $this->tpl->setVariable("TXT_CHAPTER",$this->lng->txt('chapter'));
01173 $this->tpl->setVariable("CHAPTER_LINK_LMS","content/lm_presentation.php?ref_id=".$lm_obj_data['ref_id'].
01174 '&obj_id='.$lm_obj_data['obj_id']);
01175 $this->tpl->setVariable("CHAPTER_LINK_TARGET_LMS",$obj_frame);
01176 $this->tpl->setVariable("CHAPTER_TITLE",$st_obj->getTitle());
01177 $this->tpl->parseCurrentBlock();
01178 }
01179 }
01180 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS",'option_value_center_details');
01181 $this->tpl->setVariable("OBJ_CLASS_LMS",'option_value_details');
01182 }
01183 else
01184 {
01185 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS",'option_value_center');
01186 $this->tpl->setVariable("OBJ_CLASS_LMS",'option_value');
01187 }
01188 }
01189 else
01190 {
01191 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS",'option_value_center');
01192 $this->tpl->setVariable("OBJ_CLASS_LMS",'option_value');
01193 }
01194 $this->tpl->setCurrentBlock("lm_row");
01195 $this->tpl->setVariable("OBJ_NR_LMS",$counter.'.');
01196 $this->tpl->parseCurrentBlock();
01197
01198 ++$counter;
01199 }
01200 }
01201
01202 function __showTests()
01203 {
01204 global $ilias,$rbacsystem;
01205
01206 include_once './course/classes/class.ilCourseObjectiveLM.php';
01207
01208 if(!count($tests = $this->__getAllTests()))
01209 {
01210 return false;
01211 }
01212
01213 $this->tpl->addBlockfile('TEST_BLOCK','test_block','tpl.crs_objectives_view_tst_table.html','course');
01214 $this->tpl->setVariable("TBL_TITLE_TST",$this->lng->txt('tests'));
01215
01216
01217 $this->__showHideLinks('tst');
01218
01219 if(isset($_SESSION['crs_hide_tst']))
01220 {
01221 return true;
01222 }
01223
01224 $this->tpl->setCurrentBlock("tbl_header_columns_tst");
01225 $this->tpl->setVariable("TBL_HEADER_WIDTH_TST","5%");
01226 $this->tpl->setVariable("TBL_HEADER_NAME_TST",$this->lng->txt('crs_nr'));
01227 $this->tpl->parseCurrentBlock();
01228
01229 $this->tpl->setCurrentBlock("tbl_header_columns_tst");
01230 $this->tpl->setVariable("TBL_HEADER_WIDTH_TST","95%");
01231 $this->tpl->setVariable("TBL_HEADER_NAME_TST",$this->lng->txt('description'));
01232 $this->tpl->parseCurrentBlock();
01233
01234 $counter = 1;
01235 foreach($tests as $tst_id)
01236 {
01237
01238 $tmp_tst = ilObjectFactory::getInstanceByRefId($tst_id);
01239
01240 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($tmp_tst->getId());
01241
01242 $obj_link = ilRepositoryExplorer::buildLinkTarget($tmp_tst->getRefId(),$tmp_tst->getType());
01243
01244 #$obj_frame = ilRepositoryExplorer::buildFrameTarget($tmp_tst->getType(),$tmp_tst->getRefId(),$tmp_tst->getId());
01245 #$obj_frame = $obj_frame ? $obj_frame : 'bottom';
01246
01247 $obj_frame = '';
01248
01249 if(ilRepositoryExplorer::isClickable($tmp_tst->getType(),$tmp_tst->getRefId(),$tmp_tst->getId()))
01250 {
01251 $this->tpl->setCurrentBlock("tst_read");
01252 $this->tpl->setVariable("READ_TITLE_TST",$tmp_tst->getTitle());
01253 $this->tpl->setVariable("READ_TARGET_TST",$obj_frame);
01254 $this->tpl->setVariable("READ_LINK_TST", $obj_link.'&crs_show_result='.$this->cci_ref_id);
01255 $this->tpl->parseCurrentBlock();
01256 }
01257 else
01258 {
01259 $this->tpl->setCurrentBlock("tst_visible");
01260 $this->tpl->setVariable("VISIBLE_LINK_TST",$tmp_tst->getTitle());
01261 $this->tpl->parseCurrentBlock();
01262 }
01263
01264 if(!$ilias->account->isDesktopItem($tmp_tst->getRefId(),$tmp_tst->getType()) and
01265 ($this->cci_course_obj->getAboStatus() == $this->cci_course_obj->ABO_ENABLED))
01266 {
01267 if ($rbacsystem->checkAccess('read',$tmp_tst->getRefId()))
01268 {
01269 $this->tpl->setCurrentBlock("tst_desklink");
01270 $this->tpl->setVariable("DESK_LINK_TST", "repository.php?cmd=addToDeskCourse&ref_id=".$this->cci_ref_id.
01271 "&item_ref_id=".$tmp_tst->getRefId()."&type=".$tmp_tst->getType());
01272
01273 $this->tpl->setVariable("TXT_DESK_TST", $this->lng->txt("to_desktop"));
01274 $this->tpl->parseCurrentBlock();
01275 }
01276 }
01277
01278
01279
01280
01281 $tmp_tst = ilObjectFactory::getInstanceByRefId($tst_id);
01282
01283 $this->tpl->setCurrentBlock("tst_row");
01284 $this->tpl->setVariable("OBJ_TITLE_TST",$tmp_tst->getTitle());
01285 $this->tpl->setVariable("OBJ_NR_TST",$counter.'.');
01286
01287 $this->tpl->setVariable("OBJ_CLASS_CENTER_TST",'option_value_center');
01288 $this->tpl->setVariable("OBJ_CLASS_TST",'option_value');
01289 $this->tpl->parseCurrentBlock();
01290
01291 unset($tmp_tst);
01292 ++$counter;
01293 }
01294 }
01295
01296 function __showObjectives()
01297 {
01298 include_once './course/classes/class.ilCourseObjective.php';
01299
01300 if(!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->cci_course_obj->getId())))
01301 {
01302 return false;
01303 }
01304
01305 if($_GET['details'])
01306 {
01307 $_SESSION['crs_details_id'] = $_GET['details'];
01308 }
01309 $this->details_id = $_SESSION['crs_details_id'] ? $_SESSION['crs_details_id'] : $objective_ids[0];
01310
01311
01312 switch($this->objective_status)
01313 {
01314 case 'none':
01315 $status = $this->lng->txt('crs_objective_accomplished');
01316 break;
01317
01318 case 'pretest':
01319 case 'pretest_non_suggest':
01320 $status = $this->lng->txt('crs_objective_pretest');
01321 break;
01322
01323 default:
01324 $status = $this->lng->txt('crs_objective_result');
01325 }
01326
01327
01328 $this->tpl->addBlockfile('OBJECTIVE_BLOCK','objective_block','tpl.crs_objectives_view_table.html','course');
01329
01330 $this->tpl->setVariable("TBL_TITLE_OBJECTIVES",$this->lng->txt('crs_objectives'));
01331
01332 $this->__showHideLinks('objectives');
01333
01334 if(isset($_SESSION['crs_hide_objectives']))
01335 {
01336 return true;
01337 }
01338
01339
01340 for($i = 0; $i < 2; ++$i)
01341 {
01342 $this->tpl->setCurrentBlock("tbl_header_columns");
01343 $this->tpl->setVariable("TBL_HEADER_WIDTH_OBJECTIVES","5%");
01344 $this->tpl->setVariable("TBL_HEADER_NAME_OBJECTIVES",$this->lng->txt('crs_nr'));
01345 $this->tpl->parseCurrentBlock();
01346
01347 $this->tpl->setCurrentBlock("tbl_header_columns");
01348 $this->tpl->setVariable("TBL_HEADER_WIDTH_OBJECTIVES","35%");
01349 $this->tpl->setVariable("TBL_HEADER_NAME_OBJECTIVES",$this->lng->txt('description'));
01350 $this->tpl->parseCurrentBlock();
01351
01352 $this->tpl->setCurrentBlock("tbl_header_columns");
01353 $this->tpl->setVariable("TBL_HEADER_WIDTH_OBJECTIVES","10%");
01354 $this->tpl->setVariable("TBL_HEADER_NAME_OBJECTIVES",$status);
01355 $this->tpl->parseCurrentBlock();
01356 }
01357
01358 $max = count($objective_ids) % 2 ? count($objective_ids) + 1 : count($objective_ids);
01359 for($i = 0; $i < $max/2; ++$i)
01360 {
01361 $tmp_objective =& new ilCourseObjective($this->cci_course_obj,$objective_ids[$i]);
01362
01363 $this->tpl->setCurrentBlock("objective_row");
01364
01365 if($this->details_id == $objective_ids[$i])
01366 {
01367 $this->tpl->setVariable("OBJ_CLASS_1_OBJECTIVES",'option_value_details');
01368 $this->tpl->setVariable("OBJ_CLASS_1_CENTER_OBJECTIVES",'option_value_center_details');
01369 }
01370 else
01371 {
01372 $this->tpl->setVariable("OBJ_CLASS_1_OBJECTIVES",'option_value');
01373 $this->tpl->setVariable("OBJ_CLASS_1_CENTER_OBJECTIVES",'option_value_center');
01374 }
01375 $this->tpl->setVariable("OBJ_NR_1_OBJECTIVES",($i + 1).'.');
01376
01377 $this->ctrl->setParameter($this->cci_client_obj,'details',$objective_ids[$i]);
01378 $this->tpl->setVariable("OBJ_LINK_1_OBJECTIVES",$this->ctrl->getLinkTarget($this->cci_client_obj,'cciObjectives'));
01379 $this->tpl->setVariable("OBJ_TITLE_1_OBJECTIVES",$tmp_objective->getTitle());
01380
01381 $img = !$this->suggested["$objective_ids[$i]"] ?
01382 ilUtil::getImagePath('crs_accomplished.gif') :
01383 ilUtil::getImagePath('crs_not_accomplished.gif');
01384
01385 $txt = !$this->suggested["$objective_ids[$i]"] ?
01386 $this->lng->txt('crs_objective_accomplished') :
01387 $this->lng->txt('crs_objective_not_accomplished');
01388
01389 $this->tpl->setVariable("OBJ_STATUS_IMG_1_OBJECTIVES",$img);
01390 $this->tpl->setVariable("OBJ_STATUS_ALT_1_OBJECTIVES",$txt);
01391
01392
01393 if(isset($objective_ids[$i + $max / 2]))
01394 {
01395 $tmp_objective =& new ilCourseObjective($this->cci_course_obj,$objective_ids[$i + $max / 2]);
01396
01397 $this->tpl->setCurrentBlock("objective_row");
01398 if($this->details_id == $objective_ids[$i + $max / 2])
01399 {
01400 $this->tpl->setVariable("OBJ_CLASS_2_OBJECTIVES",'option_value_details');
01401 $this->tpl->setVariable("OBJ_CLASS_2_CENTER_OBJECTIVES",'option_value_center_details');
01402 }
01403 else
01404 {
01405 $this->tpl->setVariable("OBJ_CLASS_2_OBJECTIVES",'option_value');
01406 $this->tpl->setVariable("OBJ_CLASS_2_CENTER_OBJECTIVES",'option_value_center');
01407 }
01408 $this->tpl->setVariable("OBJ_NR_2_OBJECTIVES",($i + $max / 2 + 1).'.');
01409 $this->ctrl->setParameter($this->cci_client_obj,'details',$objective_ids[$i + $max / 2]);
01410 $this->tpl->setVariable("OBJ_LINK_2_OBJECTIVES",$this->ctrl->getLinkTarget($this->cci_client_obj,'cciObjectives'));
01411 $this->tpl->setVariable("OBJ_TITLE_2_OBJECTIVES",$tmp_objective->getTitle());
01412
01413
01414 $objective_id = $objective_ids[$i + $max / 2];
01415 $img = !$this->suggested[$objective_id] ?
01416 ilUtil::getImagePath('crs_accomplished.gif') :
01417 ilUtil::getImagePath('crs_not_accomplished.gif');
01418
01419 $txt = !$this->suggested[$objective_id] ?
01420 $this->lng->txt('crs_objective_accomplished') :
01421 $this->lng->txt('crs_objective_not_accomplished');
01422
01423 $this->tpl->setVariable("OBJ_STATUS_IMG_2_OBJECTIVES",$img);
01424 $this->tpl->setVariable("OBJ_STATUS_ALT_2_OBJECTIVES",$txt);
01425 }
01426
01427 $this->tpl->parseCurrentBlock();
01428 unset($tmp_objective);
01429 }
01430 $this->ctrl->setParameter($this->cci_client_obj,'details','');
01431 }
01432
01433 function __readAccomplished()
01434 {
01435 global $ilUser;
01436
01437 if(isset($_SESSION['accomplished'][$this->cci_course_obj->getId()]))
01438 {
01439 return $this->accomplished = $_SESSION['accomplished'][$this->cci_course_obj->getId()];
01440 }
01441
01442
01443 include_once './course/classes/class.ilCourseObjectiveResult.php';
01444 include_once './course/classes/class.ilCourseObjective.php';
01445
01446 $tmp_obj_res =& new ilCourseObjectiveResult($ilUser->getId());
01447
01448 if(!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->cci_course_obj->getId())))
01449 {
01450 return $this->accomplished = array();
01451 }
01452 $this->accomplished = array();
01453 foreach($objective_ids as $objective_id)
01454 {
01455 if($tmp_obj_res->hasAccomplishedObjective($objective_id))
01456 {
01457 $this->accomplished["$objective_id"] = true;
01458 }
01459 else
01460 {
01461 $this->accomplished["$objective_id"] = false;
01462 }
01463 }
01464 $_SESSION['accomplished'][$this->cci_course_obj->getId()] = $this->accomplished;
01465 }
01466 function __readSuggested()
01467 {
01468 global $ilUser;
01469
01470 if(isset($_SESSION['objectives_suggested'][$this->cci_course_obj->getId()]))
01471 {
01472 return $this->suggested = $_SESSION['objectives_suggested'][$this->cci_course_obj->getId()];
01473 }
01474
01475 include_once './course/classes/class.ilCourseObjectiveResult.php';
01476
01477 $tmp_obj_res =& new ilCourseObjectiveResult($ilUser->getId());
01478
01479 $this->suggested = array();
01480 foreach($this->accomplished as $objective_id => $ok)
01481 {
01482 if($ok)
01483 {
01484 $this->suggested["$objective_id"] = false;
01485 }
01486 else
01487 {
01488 $this->suggested["$objective_id"] = $tmp_obj_res->isSuggested($objective_id);
01489 }
01490 }
01491
01492 return $_SESSION['objectives_suggested'][$this->cci_course_obj->getId()] = $this->suggested;
01493
01494 }
01495
01496 function __readStatus()
01497 {
01498 global $ilUser;
01499
01500 if(isset($_SESSION['objectives_status'][$this->cci_course_obj->getId()]))
01501 {
01502 return $this->objective_status = $_SESSION['objectives_status'][$this->cci_course_obj->getId()];
01503 }
01504 $all_success = true;
01505
01506 foreach($this->accomplished as $id => $success)
01507 {
01508 if(!$success)
01509 {
01510 $all_success = false;
01511 }
01512 }
01513 if($all_success)
01514 {
01515
01516 include_once 'course/classes/class.ilCourseMembers.php';
01517
01518 ilCourseMembers::_setPassed($this->cci_course_obj->getId(),$ilUser->getId());
01519
01520 $this->objective_status = 'finished';
01521 $_SESSION['objectives_status'][$this->cci_course_obj->getId()] = $this->objective_status;
01522
01523 return true;
01524 }
01525 include_once './course/classes/class.ilCourseObjectiveResult.php';
01526 include_once './course/classes/class.ilCourseObjective.php';
01527
01528 $tmp_obj_res =& new ilCourseObjectiveResult($ilUser->getId());
01529
01530 $this->objective_status = $tmp_obj_res->getStatus($this->cci_course_obj->getId());
01531
01532 if($this->objective_status == 'pretest')
01533 {
01534 $none_suggested = true;
01535 foreach($this->suggested as $value)
01536 {
01537 if($value)
01538 {
01539 $_SESSION['objectives_status'][$this->cci_course_obj->getId()] = $this->objective_status;
01540 return true;
01541 }
01542 }
01543 $this->objective_status = 'pretest_non_suggest';
01544 }
01545 $_SESSION['objectives_status'][$this->cci_course_obj->getId()] = $this->objective_status;
01546
01547 return true;
01548 }
01549
01550 function __showButton($a_cmd,$a_text,$a_target = '')
01551 {
01552 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
01553
01554
01555 $this->tpl->setCurrentBlock("btn_cell");
01556 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this->cci_client_obj,$a_cmd));
01557 $this->tpl->setVariable("BTN_TXT",$a_text);
01558
01559 if($a_target)
01560 {
01561 $this->tpl->setVariable("BTN_TARGET",$a_target);
01562 }
01563
01564 $this->tpl->parseCurrentBlock();
01565 }
01566
01567
01568
01569 function cci_read()
01570 {
01571 global $tree;
01572
01573 if(!$this->cci_course_id = $tree->checkForParentType($this->cci_ref_id,'crs'))
01574 {
01575 echo "ilCourseContentInterface: Cannot find course object";
01576 exit;
01577 }
01578 return true;
01579 }
01580
01581 function cciToUnix($a_time_arr)
01582 {
01583 return mktime($a_time_arr["hour"],
01584 $a_time_arr["minute"],
01585 $a_time_arr["second"],
01586 $a_time_arr["month"],
01587 $a_time_arr["day"],
01588 $a_time_arr["year"]);
01589 }
01590 function cciGetDateSelect($a_type,$a_varname,$a_selected)
01591 {
01592 switch($a_type)
01593 {
01594 case "minute":
01595 for($i=0;$i<=60;$i++)
01596 {
01597 $days[$i] = $i < 10 ? "0".$i : $i;
01598 }
01599 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
01600
01601 case "hour":
01602 for($i=0;$i<24;$i++)
01603 {
01604 $days[$i] = $i < 10 ? "0".$i : $i;
01605 }
01606 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
01607
01608 case "day":
01609 for($i=1;$i<32;$i++)
01610 {
01611 $days[$i] = $i < 10 ? "0".$i : $i;
01612 }
01613 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
01614
01615 case "month":
01616 for($i=1;$i<13;$i++)
01617 {
01618 $month[$i] = $i < 10 ? "0".$i : $i;
01619 }
01620 return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
01621
01622 case "year":
01623 for($i = date("Y",time());$i < date("Y",time()) + 3;++$i)
01624 {
01625 $year[$i] = $i;
01626 }
01627 return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
01628 }
01629 }
01630 }
01631 ?>