00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00036 include_once 'Modules/Course/classes/class.ilCourseObjectiveResult.php';
00037
00038 class ilCourseObjectivePresentationGUI
00039 {
00040 var $container_obj;
00041 var $course_obj;
00042
00043 var $tpl;
00044 var $ctrl;
00045 var $lng;
00046 var $tabs_gui;
00047
00052 function ilCourseObjectivePresentationGUI(&$container_gui)
00053 {
00054 global $tpl,$ilCtrl,$lng,$ilObjDataCache,$ilTabs,$ilUser;
00055
00056 $this->tpl =& $tpl;
00057 $this->ctrl =& $ilCtrl;
00058 $this->lng =& $lng;
00059 $this->tabs_gui =& $ilTabs;
00060
00061 $this->container_gui =& $container_gui;
00062 $this->container_obj =& $this->container_gui->object;
00063
00064 $this->objective_result_obj = new ilCourseObjectiveResult($ilUser->getId());
00065
00066 $this->__initCourseObject();
00067 }
00068
00069
00070
00071 function &executeCommand()
00072 {
00073 $next_class = $this->ctrl->getNextClass();
00074 switch($next_class)
00075 {
00076
00077 case 'ileventadministrationgui':
00078 include_once 'Modules/Course/classes/Event/class.ilEventAdministrationGUI.php';
00079
00080 $this->ctrl->setReturn($this,'');
00081 $event_gui = new ilEventAdministrationGUI($this->container_gui,(int) $_GET['event_id']);
00082 $this->ctrl->forwardCommand($event_gui);
00083 break;
00084
00085 default:
00086 $cmd = $this->ctrl->getCmd();
00087 if (!$cmd = $this->ctrl->getCmd())
00088 {
00089 $cmd = "view";
00090 }
00091 $this->$cmd();
00092 break;
00093 }
00094 }
00095
00100 function &getHTML()
00101 {
00102 $this->view();
00103 }
00104
00105 function view()
00106 {
00107 global $rbacsystem,$ilUser,$ilBench;
00108
00109 $ilBench->start('Objectives','Objectives_view');
00110
00111 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objective_view.html",'Modules/Course');
00112 $this->__showButton('askReset',$this->lng->txt('crs_reset_results'));
00113
00114 $this->__readObjectivesStatus();
00115
00116 $ilBench->stop('Objectives','Objectives_read');
00117
00118
00119 $this->__showInfo();
00120
00121
00122 $ilBench->start('Objectives','Objectives_objectives');
00123 $this->__showObjectives();
00124 $ilBench->stop('Objectives','Objectives_objectives');
00125
00126
00127 $ilBench->start('Objectives','Objectives_lms');
00128 $this->__showLearningMaterials();
00129 $ilBench->stop('Objectives','Objectives_lms');
00130
00131
00132 $ilBench->start('Objectives','Objectives_tests');
00133 $this->__showTests();
00134 $ilBench->stop('Objectives','Objectives_tests');
00135
00136 $ilBench->start('Objectives','Objectives_sessions');
00137 $this->__showSessions();
00138 $ilBench->stop('Objectives','Objectives_sessions');
00139
00140
00141 $ilBench->start('Objectives','Objectives_or');
00142 $this->__showOtherResources();
00143 $ilBench->stop('Objectives','Objectives_or');
00144
00145 $ilBench->stop('Objectives','Objectives_view');
00146
00147 $ilBench->save();
00148
00149 return true;
00150 }
00151
00152
00153 function askReset()
00154 {
00155 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objectives_ask_reset.html",'Modules/Course');
00156
00157 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00158 $this->tpl->setVariable("INFO_STRING",$this->lng->txt('crs_objectives_reset_sure'));
00159 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00160 $this->tpl->setVariable("TXT_RESET",$this->lng->txt('reset'));
00161
00162 return true;
00163 }
00164
00165 function reset()
00166 {
00167 global $ilUser;
00168
00169 include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
00170
00171 $tmp_obj_res =& new ilCourseObjectiveResult($ilUser->getId());
00172 $tmp_obj_res->reset($this->course_obj->getId());
00173
00174 ilUtil::sendInfo($this->lng->txt('crs_objectives_reseted'));
00175 $this->view();
00176 }
00177
00178
00179
00180
00181 function __showButton($a_cmd,$a_text,$a_target = '')
00182 {
00183 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00184
00185
00186 $this->tpl->setCurrentBlock("btn_cell");
00187 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,$a_cmd));
00188 $this->tpl->setVariable("BTN_TXT",$a_text);
00189
00190 if($a_target)
00191 {
00192 $this->tpl->setVariable("BTN_TARGET",$a_target);
00193 }
00194
00195 $this->tpl->parseCurrentBlock();
00196 }
00197
00198 function __readObjectivesStatus()
00199 {
00200 $this->objective_result_obj->readStatus($this->course_obj->getId());
00201 $this->accomplished = $this->objective_result_obj->getAccomplished($this->course_obj->getId());
00202 $this->status = $this->objective_result_obj->getStatus($this->course_obj->getId());
00203 $this->suggested = $this->objective_result_obj->getSuggested($this->course_obj->getId(),$this->status);
00204 }
00205
00206 function __showInfo()
00207 {
00208 include_once './Modules/Course/classes/class.ilCourseObjective.php';
00209
00210 if(!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->course_obj->getId())))
00211 {
00212 return true;
00213 }
00214
00215 $this->tpl->addBlockfile('INFO_BLOCK','info_block','tpl.crs_objectives_view_info_table.html','Modules/Course');
00216 $this->tpl->setVariable("INFO_STRING",$this->lng->txt('crs_objectives_info_'.$this->status));
00217
00218 return true;
00219 }
00220
00221 function __showObjectives()
00222 {
00223 include_once './Modules/Course/classes/class.ilCourseObjective.php';
00224
00225 if(!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->course_obj->getId())))
00226 {
00227 return false;
00228 }
00229 if($_GET['details'])
00230 {
00231 $_SESSION['crs_details_id'] = $_GET['details'];
00232 }
00233 $this->details_id = $_SESSION['crs_details_id'] ? $_SESSION['crs_details_id'] : $objective_ids[0];
00234
00235
00236 switch($this->status)
00237 {
00238 case 'none':
00239 $status = $this->lng->txt('crs_objective_accomplished');
00240 break;
00241
00242 case 'pretest':
00243 case 'pretest_non_suggest':
00244 $status = $this->lng->txt('crs_objective_pretest');
00245 break;
00246
00247 default:
00248 $status = $this->lng->txt('crs_objective_result');
00249 }
00250
00251
00252 $this->tpl->addBlockfile('OBJECTIVE_BLOCK','objective_block','tpl.crs_objectives_view_table.html','Modules/Course');
00253
00254 $this->tpl->setVariable("TBL_TITLE_OBJECTIVES",$this->lng->txt('crs_objectives'));
00255
00256 $this->__showHideLinks('objectives');
00257
00258 if(isset($_SESSION['crs_hide_objectives']))
00259 {
00260 return true;
00261 }
00262
00263 $this->tpl->setVariable('TBL_HEADER_NAME_OBJECTIVES_A',$this->lng->txt('type'));
00264
00265 $this->tpl->setVariable('TBL_HEADER_NAME_OBJECTIVES_B',$this->lng->txt('description'));
00266
00267 $this->tpl->setVariable('TBL_HEADER_NAME_OBJECTIVES_C',$status);
00268
00269
00270
00271 $max = count($objective_ids);
00272 for($i = 0; $i < $max; ++$i)
00273 {
00274 $tmp_objective =& new ilCourseObjective($this->course_obj,$objective_ids[$i]);
00275
00276 $this->tpl->setCurrentBlock("objective_row");
00277
00278 if($this->details_id == $objective_ids[$i])
00279 {
00280 $this->tpl->setVariable("OBJ_CLASS_1_OBJECTIVES",'option_value_details');
00281 $this->tpl->setVariable("OBJ_CLASS_1_CENTER_OBJECTIVES",'option_value_center_details');
00282 }
00283 else
00284 {
00285 $this->tpl->setVariable("OBJ_CLASS_1_OBJECTIVES",'option_value');
00286 $this->tpl->setVariable("OBJ_CLASS_1_CENTER_OBJECTIVES",'option_value_center');
00287 }
00288 $this->tpl->setVariable("OBJ_NR_1_OBJECTIVES",($i + 1).'.');
00289
00290 $this->ctrl->setParameter($this,'details',$objective_ids[$i]);
00291 $this->tpl->setVariable("OBJ_LINK_1_OBJECTIVES",$this->ctrl->getLinkTarget($this,'view'));
00292 $this->tpl->setVariable("OBJ_TITLE_1_OBJECTIVES",$tmp_objective->getTitle());
00293
00294 $img = !in_array($objective_ids[$i],$this->suggested) ?
00295 ilUtil::getImagePath('icon_ok.gif') :
00296 ilUtil::getImagePath('icon_not_ok.gif');
00297
00298 $txt = !in_array($objective_ids[$i],$this->suggested) ?
00299 $this->lng->txt('crs_objective_accomplished') :
00300 $this->lng->txt('crs_objective_not_accomplished');
00301
00302 $this->tpl->setVariable("OBJ_STATUS_IMG_1_OBJECTIVES",$img);
00303 $this->tpl->setVariable("OBJ_STATUS_ALT_1_OBJECTIVES",$txt);
00304
00305
00306 if(isset($objective_ids[$i + $max / 2]))
00307 {
00308 $tmp_objective =& new ilCourseObjective($this->course_obj,$objective_ids[$i + $max / 2]);
00309
00310 $this->tpl->setCurrentBlock("objective_row");
00311 if($this->details_id == $objective_ids[$i + $max / 2])
00312 {
00313 $this->tpl->setVariable("OBJ_CLASS_2_OBJECTIVES",'option_value_details');
00314 $this->tpl->setVariable("OBJ_CLASS_2_CENTER_OBJECTIVES",'option_value_center_details');
00315 }
00316 else
00317 {
00318 $this->tpl->setVariable("OBJ_CLASS_2_OBJECTIVES",'option_value');
00319 $this->tpl->setVariable("OBJ_CLASS_2_CENTER_OBJECTIVES",'option_value_center');
00320 }
00321 $this->tpl->setVariable("OBJ_NR_2_OBJECTIVES",($i + $max / 2 + 1).'.');
00322 $this->ctrl->setParameter($this,'details',$objective_ids[$i + $max / 2]);
00323 $this->tpl->setVariable("OBJ_LINK_2_OBJECTIVES",$this->ctrl->getLinkTarget($this,'view'));
00324 $this->tpl->setVariable("OBJ_TITLE_2_OBJECTIVES",$tmp_objective->getTitle());
00325
00326
00327 $objective_id = $objective_ids[$i + $max / 2];
00328
00329 $img = !in_array($objective_id,$this->suggested) ?
00330 ilUtil::getImagePath('icon_ok.gif') :
00331 ilUtil::getImagePath('icon_not_ok.gif');
00332
00333 $txt = !in_array($objective_id,$this->suggested) ?
00334 $this->lng->txt('crs_objective_accomplished') :
00335 $this->lng->txt('crs_objective_not_accomplished');
00336
00337 $this->tpl->setVariable("OBJ_STATUS_IMG_2_OBJECTIVES",$img);
00338 $this->tpl->setVariable("OBJ_STATUS_ALT_2_OBJECTIVES",$txt);
00339 }
00340
00341 $this->tpl->parseCurrentBlock();
00342 unset($tmp_objective);
00343 }
00344 $this->ctrl->setParameter($this,'details','');
00345 }
00346
00347 function __showLearningMaterials()
00348 {
00349 global $rbacsystem,$ilias,$ilUser,$ilObjDataCache;
00350
00351 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
00352 include_once './classes/class.ilRepositoryExplorer.php';
00353 include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
00354
00355 if(!count($lms = ilCourseObjectiveMaterials::_getAllAssignedMaterials($this->course_obj->getId())))
00356 {
00357 return false;
00358 }
00359 if($this->details_id)
00360 {
00361 $objectives_lm_obj =& new ilCourseObjectiveMaterials($this->details_id);
00362 }
00363
00364 $lm_continue =& new ilCourseLMHistory($this->course_obj->getRefId(),$ilUser->getId());
00365 $continue_data = $lm_continue->getLMHistory();
00366
00367 $this->tpl->addBlockfile('LM_BLOCK','lm_block','tpl.crs_objectives_view_lm_table.html','Modules/Course');
00368 $this->tpl->setVariable("TBL_TITLE_LMS",$this->lng->txt('crs_learning_materials'));
00369
00370
00371 $this->__showHideLinks('lms');
00372
00373 if(isset($_SESSION['crs_hide_lms']))
00374 {
00375 return true;
00376 }
00377
00378 $this->tpl->setVariable("TBL_HEADER_LMS_TYPE",$this->lng->txt('type'));
00379 $this->tpl->setVariable("TBL_HEADER_NAME_LMS",$this->lng->txt('description'));
00380
00381 $counter = 1;
00382 foreach($lms as $lm_id)
00383 {
00384 $obj_id = $ilObjDataCache->lookupObjId($lm_id);
00385 $obj_type = $ilObjDataCache->lookupType($obj_id);
00386
00387 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($lm_id,$obj_id);
00388
00389 $obj_link = ilRepositoryExplorer::buildLinkTarget($lm_id,$ilObjDataCache->lookupType($obj_id));
00390 $obj_frame = ilRepositoryExplorer::buildFrameTarget($ilObjDataCache->lookupType($obj_id),$lm_id,$obj_id);
00391 $obj_frame = $obj_frame ? $obj_frame : '';
00392 $contentObj = false;
00393
00394 if(ilRepositoryExplorer::isClickable($obj_type,$lm_id,$obj_id))
00395 {
00396 $this->tpl->setCurrentBlock("lm_read");
00397 $this->tpl->setVariable("READ_TITLE_LMS",$ilObjDataCache->lookupTitle($obj_id));
00398 $this->tpl->setVariable("READ_TARGET_LMS",$obj_frame);
00399 $this->tpl->setVariable("READ_LINK_LMS", $obj_link);
00400 $this->tpl->parseCurrentBlock();
00401 }
00402 else
00403 {
00404 $this->tpl->setCurrentBlock("lm_visible");
00405 $this->tpl->setVariable("VISIBLE_LINK_LMS",$ilObjDataCache->lookupTitle($obj_id));
00406 $this->tpl->parseCurrentBlock();
00407 }
00408
00409 if(!$ilUser->isDesktopItem($lm_id,$obj_type) and
00410 ($this->course_obj->getAboStatus() == $this->course_obj->ABO_ENABLED))
00411 {
00412 if ($rbacsystem->checkAccess('read',$lm_id))
00413 {
00414 $this->tpl->setCurrentBlock("lm_desklink");
00415 $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_ref_id',$lm_id);
00416 $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_id',$lm_id);
00417 $this->ctrl->setParameterByClass(get_class($this->container_gui),'type',$obj_type);
00418
00419 $this->tpl->setVariable("DESK_LINK_LMS",$this->ctrl->getLinkTarget($this->container_gui,'addToDesk'));
00420 $this->tpl->setVariable("TXT_DESK_LMS", $this->lng->txt("to_desktop"));
00421 $this->tpl->parseCurrentBlock();
00422 }
00423 }
00424
00425
00426 if(isset($continue_data[$lm_id]))
00427 {
00428 $this->tpl->setCurrentBlock("lm_continuelink");
00429 $this->tpl->setVariable("CONTINUE_LINK_LMS",'ilias.php?baseClass=ilLMPresentationGUI&ref_id='.$lm_id.'&obj_id='.
00430 $continue_data[$lm_id]['lm_page_id']);
00431
00432 $target = '';
00433 $this->tpl->setVariable("CONTINUE_LINK_TARGET",$obj_frame);
00434 $this->tpl->setVariable("TXT_CONTINUE_LMS",$this->lng->txt('continue_work'));
00435 $this->tpl->parseCurrentBlock();
00436 }
00437
00438
00439 if(strlen($ilObjDataCache->lookupDescription($obj_id)))
00440 {
00441 $this->tpl->setCurrentBlock("lms_description");
00442 $this->tpl->setVariable("DESCRIPTION_LMS",$ilObjDataCache->lookupDescription($obj_id));
00443 $this->tpl->parseCurrentBlock();
00444 }
00445
00446 if(isset($continue_data["$lm_id"]))
00447 {
00448 $this->tpl->setVariable("TEXT_INFO_LMS",$this->lng->txt('last_access'));
00449 $this->tpl->setVariable("INFO_LMS",ilFormat::formatUnixTime($continue_data["$lm_id"]['last_access'],true));
00450 }
00451 elseif($obj_type == 'lm')
00452 {
00453 $this->tpl->setVariable("INFO_LMS",$this->lng->txt('not_accessed'));
00454 }
00455
00456 if($this->details_id)
00457 {
00458 $objectives_lm_obj->setLMRefId($lm_id);
00459 if($objectives_lm_obj->checkExists())
00460 {
00461 $objectives_lm_obj =& new ilCourseObjectiveMaterials($this->details_id);
00462
00463 if($conditions_ok)
00464 {
00465 foreach($objectives_lm_obj->getChapters() as $lm_obj_data)
00466 {
00467 if($lm_obj_data['ref_id'] != $lm_id)
00468 {
00469 continue;
00470 }
00471
00472 include_once './Modules/LearningModule/classes/class.ilLMObject.php';
00473
00474
00475 $this->tpl->setCurrentBlock("chapters");
00476 $this->tpl->setVariable("TXT_CHAPTER",$this->lng->txt('chapter'));
00477 $this->tpl->setVariable("CHAPTER_LINK_LMS","ilias.php?baseClass=ilLMPresentationGUI&ref_id=".
00478 $lm_obj_data['ref_id'].
00479 '&obj_id='.$lm_obj_data['obj_id']);
00480 $this->tpl->setVariable("CHAPTER_LINK_TARGET_LMS",$obj_frame);
00481 $this->tpl->setVariable("CHAPTER_TITLE",ilLMObject::_lookupTitle($lm_obj_data['obj_id']));
00482 $this->tpl->parseCurrentBlock();
00483 }
00484 }
00485 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS",'option_value_center_details');
00486 $this->tpl->setVariable("OBJ_CLASS_LMS",'option_value_details');
00487 }
00488 else
00489 {
00490 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS",'option_value_center');
00491 $this->tpl->setVariable("OBJ_CLASS_LMS",'option_value');
00492 }
00493 }
00494 else
00495 {
00496 $this->tpl->setVariable("OBJ_CLASS_CENTER_LMS",'option_value_center');
00497 $this->tpl->setVariable("OBJ_CLASS_LMS",'option_value');
00498 }
00499 $this->tpl->setCurrentBlock("lm_row");
00500 $this->tpl->setVariable('IMG_TYPE_MAT',ilUtil::getImagePath('icon_'.$obj_type.'.gif'));
00501 $this->tpl->setVariable('TXT_IMG_MAT',$this->lng->txt('obj_'.$obj_type));
00502 $this->tpl->setVariable("OBJ_NR_LMS",$counter.'.');
00503 $this->tpl->parseCurrentBlock();
00504
00505 ++$counter;
00506 }
00507 }
00508
00509 function __showSessions()
00510 {
00511 global $ilUser;
00512
00513 include_once('./Modules/Course/classes/Event/class.ilEvent.php');
00514 include_once('./Modules/Course/classes/Event/class.ilEventParticipants.php');
00515
00516 if(!count($event_objs = ilEvent::_getEvents($this->container_obj->getId())))
00517 {
00518 return true;
00519 }
00520 $this->tpl->addBlockfile('SESSION_BLOCK','session_block','tpl.crs_objectives_view_session_table.html','Modules/Course');
00521 $this->tpl->setVariable("TBL_TITLE_SESSION",$this->lng->txt('events'));
00522
00523 $this->__showHideLinks('session');
00524
00525 if(isset($_SESSION['crs_hide_session']))
00526 {
00527 return true;
00528 }
00529 $this->tpl->setVariable("TBL_HEADER_WIDTH_SESSION_1","75%");
00530 $this->tpl->setVariable("TBL_HEADER_NAME_SESSION_1",$this->lng->txt('description'));
00531
00532 $this->tpl->setVariable("TBL_HEADER_WIDTH_SESSION","5%");
00533 $this->tpl->setVariable("TBL_HEADER_NAME_SESSION",$this->lng->txt('crs_nr'));
00534
00535 $this->tpl->setVariable("TBL_HEADER_WIDTH_SESSION_2","20%");
00536 $this->tpl->setVariable("TBL_HEADER_NAME_SESSION_2",'');
00537
00538 $counter = 1;
00539 foreach($event_objs as $event_obj)
00540 {
00541 if(strlen($event_obj->getDescription()))
00542 {
00543 $this->tpl->setCurrentBlock('session_desc_block');
00544 $this->tpl->setVariable('SESSION_DESC',$event_obj->getDescription());
00545 $this->tpl->parseCurrentBlock();
00546 }
00547
00548 $this->tpl->setVariable("READ_TITLE_SESSION",$event_obj->getTitle());
00549 $this->tpl->setVariable("READ_TARGET_SESSION",'');
00550
00551 $this->ctrl->setParameterByClass('ileventadministrationgui','event_id',$event_obj->getEventId());
00552 $this->tpl->setVariable("READ_LINK_SESSION",$this->ctrl->getLinkTargetByClass('ileventadministrationgui','info'));
00553
00554 $this->tpl->setCurrentBlock("session_link");
00555 $this->ctrl->setParameterByClass('ileventadministrationgui','event_id',$event_obj->getEventId());
00556 $this->tpl->setVariable("LINK_SESSION",$this->ctrl->getLinkTargetByClass('ileventadministrationgui','info'));
00557 $this->tpl->setVariable("TXT_LINK_SESSION",$this->lng->txt('info_short'));
00558 $this->tpl->parseCurrentBlock();
00559
00560 if($event_obj->enabledRegistration() and ilEventParticipants::_isRegistered($ilUser->getId(),$event_obj->getEventId()))
00561 {
00562 $this->tpl->setCurrentBlock("session_link");
00563 $this->ctrl->setParameterByClass('ileventadministrationgui','event_id',$event_obj->getEventId());
00564 $this->tpl->setVariable("LINK_SESSION",$this->ctrl->getLinkTargetByClass('ileventadministrationgui','unregister'));
00565 $this->tpl->setVariable("TXT_LINK_SESSION",$this->lng->txt('event_unregister'));
00566 $this->tpl->parseCurrentBlock();
00567 }
00568 elseif($event_obj->enabledRegistration())
00569 {
00570 $this->tpl->setCurrentBlock("session_link");
00571 $this->ctrl->setParameterByClass('ileventadministrationgui','event_id',$event_obj->getEventId());
00572 $this->tpl->setVariable("LINK_SESSION",$this->ctrl->getLinkTargetByClass('ileventadministrationgui','register'));
00573 $this->tpl->setVariable("TXT_LINK_SESSION",$this->lng->txt('event_register'));
00574 $this->tpl->parseCurrentBlock();
00575 }
00576
00577 $this->tpl->setCurrentBlock("session_row");
00578 $this->tpl->setVariable('TXT_EVENT_DATE',$this->lng->txt('event_date'));
00579 $first_appointment =& $event_obj->getFirstAppointment();
00580 $this->tpl->setVariable('EVENT_DATE',$first_appointment->appointmentToString());
00581 $this->tpl->setVariable("OBJ_NR_SESSION",$counter.'.');
00582 $this->tpl->setVariable("OBJ_CLASS_CENTER_SESSION",'option_value_center');
00583 $this->tpl->setVariable("OBJ_CLASS_SESSION",'option_value');
00584 $this->tpl->parseCurrentBlock();
00585
00586 $counter++;
00587 }
00588 }
00589
00590
00591 function __showTests()
00592 {
00593 global $ilias,$rbacsystem,$ilObjDataCache,$ilUser;
00594
00595 include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
00596
00597 if(!count($tests = $this->__getAllTests()))
00598 {
00599 return false;
00600 }
00601
00602 $this->tpl->addBlockfile('TEST_BLOCK','test_block','tpl.crs_objectives_view_tst_table.html','Modules/Course');
00603 $this->tpl->setVariable("TBL_TITLE_TST",$this->lng->txt('tests'));
00604
00605
00606 $this->__showHideLinks('tst');
00607
00608 if(isset($_SESSION['crs_hide_tst']))
00609 {
00610 return true;
00611 }
00612
00613 $this->tpl->setVariable("TBL_HEADER_WIDTH_TST_1","75%");
00614 $this->tpl->setVariable("TBL_HEADER_NAME_TST_1",$this->lng->txt('description'));
00615
00616 $this->tpl->setVariable("TBL_HEADER_WIDTH_TST","5%");
00617 $this->tpl->setVariable("TBL_HEADER_NAME_TST",$this->lng->txt('crs_nr'));
00618
00619 $this->tpl->setVariable("TBL_HEADER_WIDTH_TST_2","20%");
00620 $this->tpl->setVariable("TBL_HEADER_NAME_TST_2",'');
00621 $counter = 1;
00622 foreach($tests as $tst_id)
00623 {
00624 $obj_id = $ilObjDataCache->lookupObjId($tst_id);
00625 $obj_type = $ilObjDataCache->lookupType($obj_id);
00626
00627 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($tst_id,$obj_id);
00628
00629 $obj_link = ilRepositoryExplorer::buildLinkTarget($tst_id,$obj_type);
00630 $obj_link = "ilias.php?baseClass=ilObjTestGUI&ref_id=".$tst_id."&cmd=infoScreen";
00631 $obj_frame = '';
00632
00633 if(ilRepositoryExplorer::isClickable($obj_type,$tst_id,$obj_id))
00634 {
00635 $this->tpl->setCurrentBlock("tst_read");
00636 $this->tpl->setVariable("READ_TITLE_TST",$ilObjDataCache->lookupTitle($obj_id));
00637 $this->tpl->setVariable("READ_TARGET_TST",$obj_frame);
00638 $this->tpl->setVariable("READ_LINK_TST", $obj_link.'&crs_show_result='.$this->course_obj->getRefId());
00639 $this->tpl->parseCurrentBlock();
00640 }
00641 else
00642 {
00643 $this->tpl->setCurrentBlock("tst_visible");
00644 $this->tpl->setVariable("VISIBLE_LINK_TST",$ilObjDataCache->lookupTitle($obj_id));
00645 $this->tpl->parseCurrentBlock();
00646 }
00647
00648 if(!$ilUser->isDesktopItem($tst_id,$obj_type) and
00649 ($this->course_obj->getAboStatus() == $this->course_obj->ABO_ENABLED))
00650 {
00651 if ($rbacsystem->checkAccess('read',$tst_id))
00652 {
00653 $this->tpl->setCurrentBlock("tst_desklink");
00654 $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_ref_id',$tst_id);
00655 $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_id',$tst_id);
00656 $this->ctrl->setParameterByClass(get_class($this->container_gui),'type',$obj_type);
00657 $this->tpl->setVariable("DESK_LINK_TST",$this->ctrl->getLinkTarget($this->container_gui,'addToDesk'));
00658
00659 $this->tpl->setVariable("TXT_DESK_TST", $this->lng->txt("to_desktop"));
00660 $this->tpl->parseCurrentBlock();
00661 }
00662 }
00663
00664 $this->tpl->setCurrentBlock("tst_row");
00665 $this->tpl->setVariable("OBJ_TITLE_TST",$ilObjDataCache->lookupTitle($obj_id));
00666 $this->tpl->setVariable("OBJ_NR_TST",$counter.'.');
00667
00668
00669 include_once('Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
00670 if($this->details_id and ilCourseObjectiveQuestion::_isTestAssignedToObjective($tst_id,$this->details_id))
00671 {
00672 $this->tpl->setVariable("OBJ_CLASS_CENTER_TST",'option_value_center_details');
00673 $this->tpl->setVariable("OBJ_CLASS_TST",'option_value_details');
00674 }
00675 else
00676 {
00677 $this->tpl->setVariable("OBJ_CLASS_CENTER_TST",'option_value_center');
00678 $this->tpl->setVariable("OBJ_CLASS_TST",'option_value');
00679 }
00680 $this->tpl->parseCurrentBlock();
00681 ++$counter;
00682 }
00683 }
00684
00685 function __showOtherResources()
00686 {
00687 global $ilias,$rbacsystem,$ilObjDataCache,$objDefinition;
00688
00689 if(!count($ors = $this->__getOtherResources()))
00690 {
00691 return false;
00692 }
00693
00694 $this->tpl->addBlockfile('RESOURCES_BLOCK','resources_block','tpl.crs_objectives_view_or_table.html','Modules/Course');
00695 $this->tpl->setVariable("TBL_TITLE_OR",$this->lng->txt('crs_other_resources'));
00696
00697
00698 $this->__showHideLinks('or');
00699
00700 if(isset($_SESSION['crs_hide_or']))
00701 {
00702 return true;
00703 }
00704
00705 $this->tpl->setCurrentBlock("tbl_header_columns_or");
00706 $this->tpl->setVariable("TBL_HEADER_WIDTH_OR","5%");
00707 $this->tpl->setVariable("TBL_HEADER_NAME_OR",$this->lng->txt('type'));
00708 $this->tpl->parseCurrentBlock();
00709
00710 $this->tpl->setCurrentBlock("tbl_header_columns_or");
00711 $this->tpl->setVariable("TBL_HEADER_WIDTH_OR","75%");
00712 $this->tpl->setVariable("TBL_HEADER_NAME_OR",$this->lng->txt('description'));
00713 $this->tpl->parseCurrentBlock();
00714
00715 $this->tpl->setCurrentBlock("tbl_header_columns_or");
00716 $this->tpl->setVariable("TBL_HEADER_WIDTH_OR","20%");
00717 $this->tpl->setVariable("TBL_HEADER_NAME_OR",'');
00718 $this->tpl->parseCurrentBlock();
00719
00720 $counter = 1;
00721 foreach($ors as $or_id)
00722 {
00723 $obj_id = $ilObjDataCache->lookupObjId($or_id);
00724 $obj_type = $ilObjDataCache->lookupType($obj_id);
00725
00726
00727 if ($objDefinition->isSideBlock($obj_type))
00728 {
00729 continue;
00730 }
00731
00732 $conditions_ok = ilConditionHandler::_checkAllConditionsOfTarget($or_id,$obj_id);
00733
00734 $obj_link = ilRepositoryExplorer::buildLinkTarget($or_id,$obj_type);
00735 $obj_frame = ilRepositoryExplorer::buildFrameTarget($obj_type,$or_id,$obj_id);
00736 $obj_frame = $obj_frame ? $obj_frame : '';
00737
00738 if(ilRepositoryExplorer::isClickable($obj_type,$or_id,$obj_id))
00739 {
00740 $this->tpl->setCurrentBlock("or_read");
00741 $this->tpl->setVariable("READ_TITLE_OR",$ilObjDataCache->lookupTitle($obj_id));
00742 $this->tpl->setVariable("READ_TARGET_OR",$obj_frame);
00743 $this->tpl->setVariable("READ_LINK_OR", $obj_link);
00744 $this->tpl->parseCurrentBlock();
00745 }
00746 else
00747 {
00748 $this->tpl->setCurrentBlock("or_visible");
00749 $this->tpl->setVariable("VISIBLE_LINK_OR",$ilObjDataCache->lookupTitle($obj_id));
00750 $this->tpl->parseCurrentBlock();
00751 }
00752
00753 if(!$ilias->account->isDesktopItem($or_id,$obj_type) and
00754 ($this->course_obj->getAboStatus() == $this->course_obj->ABO_ENABLED))
00755 {
00756 if ($rbacsystem->checkAccess('read',$or_id))
00757 {
00758 $this->tpl->setCurrentBlock("or_desklink");
00759 $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_ref_id',$or_id);
00760 $this->ctrl->setParameterByClass(get_class($this->container_gui),'item_id',$or_id);
00761 $this->ctrl->setParameterByClass(get_class($this->container_gui),'type',$obj_type);
00762
00763 $this->tpl->setVariable("DESK_LINK_OR",$this->ctrl->getLinkTarget($this->container_gui,'addToDesk'));
00764
00765 $this->tpl->setVariable("TXT_DESK_OR", $this->lng->txt("to_desktop"));
00766 $this->tpl->parseCurrentBlock();
00767 }
00768 }
00769
00770 $this->tpl->setCurrentBlock("or_row");
00771 $this->tpl->setVariable("OBJ_TITLE_OR",$ilObjDataCache->lookupTitle($obj_id));
00772 $this->tpl->setVariable('IMG_TYPE_OR',ilUtil::getTypeIconPath($obj_type,$obj_id,'small'));
00773 $this->tpl->setVariable("TXT_IMG_OR",$this->lng->txt('obj_'.$obj_type));
00774 $this->tpl->setVariable("OBJ_CLASS_CENTER_OR",'option_value_center');
00775 $this->tpl->setVariable("OBJ_CLASS_OR",'option_value');
00776 $this->tpl->parseCurrentBlock();
00777
00778 ++$counter;
00779 }
00780 }
00781
00782
00783 function __getAllTests()
00784 {
00785 foreach($items = $this->course_obj->items_obj->getItems() as $node)
00786 {
00787 switch($node['type'])
00788 {
00789 case 'tst':
00790 $tests[] = $node['ref_id'];
00791 break;
00792 }
00793 }
00794 return $tests ? $tests : array();
00795 }
00796
00797 function __getOtherResources()
00798 {
00799 include_once('Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
00800 $assigned = ilCourseObjectiveMaterials::_getAllAssignedMaterials($this->course_obj->getId());
00801
00802 foreach($items = $this->course_obj->items_obj->getItems() as $node)
00803 {
00804 if(in_array($node['ref_id'],$assigned))
00805 {
00806 continue;
00807 }
00808 if($node['type'] == 'tst')
00809 {
00810 continue;
00811 }
00812 $all_lms[] = $node['ref_id'];
00813 }
00814 return $all_lms ? $all_lms : array();
00815 }
00816
00817
00818 function __showHideLinks($a_part)
00819 {
00820 if($_GET['show_hide_'.$a_part] == 1)
00821 {
00822 unset($_SESSION['crs_hide_'.$a_part]);
00823 }
00824 if($_GET['show_hide_'.$a_part] == 2)
00825 {
00826 $_SESSION['crs_hide_'.$a_part] = true;
00827 }
00828
00829 $this->ctrl->setParameter($this,'show_hide_'.$a_part,$_SESSION['crs_hide_'.$a_part] ? 1 : 2);
00830 $this->tpl->setVariable("LINK_HIDE_SHOW_".strtoupper($a_part),$this->ctrl->getLinkTarget($this,'view'));
00831 $this->tpl->setVariable("TXT_HIDE_SHOW_".strtoupper($a_part),$_SESSION['crs_hide_'.$a_part] ?
00832 $this->lng->txt('crs_show_link_'.$a_part) :
00833 $this->lng->txt('crs_hide_link_'.$a_part));
00834
00835 $this->ctrl->setParameter($this,'show_hide_'.$a_part,'');
00836
00837 $this->tpl->setVariable("HIDE_SHOW_IMG_".strtoupper($a_part),$_SESSION['crs_hide_'.$a_part] ?
00838 ilUtil::getImagePath('a_down.gif') :
00839 ilUtil::getImagePath('a_up.gif'));
00840
00841 return true;
00842 }
00843
00844
00845
00846 function __initCourseObject()
00847 {
00848 global $tree;
00849
00850 if($this->container_obj->getType() == 'crs')
00851 {
00852
00853 $this->course_obj =& $this->container_obj;
00854 }
00855 else
00856 {
00857 $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(),'crs');
00858 $this->course_obj =& ilObjectFactory::getInstanceByRefId($course_ref_id);
00859 }
00860 $this->course_obj->initCourseItemObject();
00861 return true;
00862 }
00863
00864 }
00865 ?>