• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

course/classes/class.ilCourseObjectivePresentationGUI.php

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

Generated on Fri Dec 13 2013 13:52:10 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1