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