ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
ilContainerObjectiveGUI Class Reference

GUI class for course objective view. More...

+ Inheritance diagram for ilContainerObjectiveGUI:
+ Collaboration diagram for ilContainerObjectiveGUI:

Public Member Functions

 __construct ($a_container_gui)
 Constructor. More...
 
 getTestAssignments ()
 Get test assignments object. More...
 
 getSettings ()
 
 getDetailsLevel ($a_objective_id)
 get details level More...
 
 getMainContent ()
 Impementation of abstract method getMainContent. More...
 
 showStatus ($tpl)
 show status More...
 
 showObjectives ($a_tpl, $a_is_order=false)
 show objectives More...
 
 addFooterRow ()
 add footer row More...
 
 showMaterials ($a_tpl, $a_mode=null, $a_is_manage=false, $a_as_accordion=false)
 Show all other (no assigned tests, no assigned materials) materials. More...
 
- Public Member Functions inherited from ilContainerContentGUI
 __construct (&$container_gui_obj)
 Constructor. More...
 
 getContainerObject ()
 Get container object. More...
 
 getContainerGUI ()
 Get container GUI object. More...
 
 setOutput ()
 Sets view output into column layout. More...
 
 getMainContent ()
 Get content HTML for main column, this one must be overwritten in derived classes. More...
 
 determinePageEmbeddedBlocks ($a_container_page_html)
 Determine all blocks that are embedded in the container page. More...
 
 addEmbeddedBlock ($block_type, $block_parameter)
 Add embedded block. More...
 
 getEmbeddedBlocks ()
 Get page embedded blocks. More...
 
 renderPageEmbeddedBlocks ()
 Render Page Embedded Blocks. More...
 
 renderItem ($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
 Render an item. More...
 
 insertPageEmbeddedBlocks ($a_output_html)
 Insert blocks into container page. More...
 
 getGroupedObjTypes ()
 Get grouped repository object types. More...
 
 getIntroduction ()
 Get introduction. More...
 
 getItemGroupsHTML ($a_pos=0)
 Get item groups HTML. More...
 
 renderItemGroup ($a_itgr)
 Render item group. More...
 

Static Public Member Functions

static renderProgressBar ($a_perc_result=null, $a_perc_limit=null, $a_css=null, $a_caption=null, $a_url=null, $a_tt_id=null, $a_tt_txt=null, $a_next_step=null, $a_sub=false, $a_sub_style=30)
 Render progress bar(s) More...
 
static buildObjectiveProgressBar ($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode=false, $a_sub=false, $a_tt_suffix=null)
 Render progressbar(s) for given objective and result data. More...
 

Data Fields

const MATERIALS_TESTS = 1
 
const MATERIALS_OTHER = 2
 
- Data Fields inherited from ilContainerContentGUI
const DETAILS_DEACTIVATED = 0
 
const DETAILS_TITLE = 1
 
const DETAILS_ALL = 2
 
 $container_gui
 
 $container_obj
 

Protected Member Functions

 renderTest ($a_test_ref_id, $a_objective_id, $a_is_initial=false, $a_add_border=false, $a_lo_result=array())
 
 buildObjectiveMap ()
 
 addItemDetails (ilObjectListGUI $a_item_list_gui, array $a_item)
 
 updateResult ($a_res, $a_item_ref_id, $a_objective_id, $a_user_id)
 
 renderObjective ($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion=null, array $a_lo_result=null)
 render objective More...
 
 initDetails ()
 init details More...
 
 initTestAssignments ()
 
 parseLOUserResults ()
 Parse learning objective results. More...
 
 buildAccordionTitle (ilCourseObjective $a_objective, array $a_lo_result=null)
 
 buildAccordionContent (array $a_items)
 
 showButton ($a_cmd, $a_text, $a_target='', $a_id="")
 show action button More...
 
- Protected Member Functions inherited from ilContainerContentGUI
 getDetailsLevel ($a_item_id)
 get details level More...
 
 getRightColumnHTML ()
 Get HTML for right column. More...
 
 getCenterColumnHTML ()
 Get HTML for center column. More...
 
 initRenderer ()
 Init container renderer. More...
 
 clearAdminCommandsDetermination ()
 cleaer administration commands determination More...
 
 determineAdminCommands ($a_ref_id, $a_admin_com_included_in_list=false)
 determin admin commands More...
 
 getItemGUI ($item_data, $a_show_path=false)
 Get ListGUI object for item. More...
 

Protected Attributes

 $force_details = 0
 
 $loc_settings
 
- Protected Attributes inherited from ilContainerContentGUI
 $details_level = self::DETAILS_DEACTIVATED
 
 $renderer
 

Private Attributes

 $output_html = ''
 
 $test_assignments = null
 

Detailed Description

GUI class for course objective view.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 35 of file class.ilContainerObjectiveGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerObjectiveGUI::__construct (   $a_container_gui)

Constructor.

public

Parameters
objectcontainer gui object
Returns

Definition at line 54 of file class.ilContainerObjectiveGUI.php.

References $lng, initDetails(), and initTestAssignments().

55  {
56  global $lng;
57 
58  $this->lng = $lng;
59  parent::__construct($a_container_gui);
60 
61  $this->initDetails();
62  $this->initTestAssignments();
63  }
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

Member Function Documentation

◆ addFooterRow()

ilContainerObjectiveGUI::addFooterRow ( )

add footer row

public

Parameters

Definition at line 361 of file class.ilContainerObjectiveGUI.php.

Referenced by showObjectives().

362  {
363  // no details
364  return;
365 
366  /*
367  global $ilCtrl;
368 
369  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->getRefId());
370  $ilCtrl->setParameterByClass("ilrepositorygui", "details_level", "1");
371  $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
372  $this->renderer->addDetailsLevel(2, $url, ($this->details_level == self::DETAILS_TITLE));
373 
374  $ilCtrl->setParameterByClass("ilrepositorygui", "details_level", "2");
375  $url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
376  $this->renderer->addDetailsLevel(3, $url, ($this->details_level == self::DETAILS_ALL));
377 
378  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
379  */
380  }
+ Here is the caller graph for this function:

◆ addItemDetails()

ilContainerObjectiveGUI::addItemDetails ( ilObjectListGUI  $a_item_list_gui,
array  $a_item 
)
protected

Definition at line 618 of file class.ilContainerObjectiveGUI.php.

References $GLOBALS, $ilCtrl, $lng, $res, $url, ilConditionHandler\_checkAllConditionsOfTarget(), ilObjectListGUI\addCustomProperty(), array, ilObjectListGUI\disableTitleLink(), ilObjectListGUI\enableCommands(), ilObjectListGUI\enableItemDetailLinks(), ilObjectListGUI\enableProperties(), ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), ilCourseObjective\lookupMaxPasses(), ilLOUserResults\lookupResult(), ilObjectListGUI\setConditionTarget(), ilObjectListGUI\setDefaultCommandParameters(), ilObjectListGUI\setItemDetailLinks(), ilLOUserResults\TYPE_QUALIFIED, ilLOSettings\TYPE_TEST_INITIAL, and updateResult().

619  {
620  global $lng, $ilCtrl;
621 
622  $item_ref_id = $a_item["ref_id"];
623 
624  if(is_array($this->objective_map))
625  {
626  $details = array();
627  if(isset($this->objective_map["material"][$item_ref_id]))
628  {
629  // #12965
630  foreach($this->objective_map["material"][$item_ref_id] as $objective_id)
631  {
632  $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $objective_id);
633  $url = $ilCtrl->getLinkTargetByClass(array('illoeditorgui', 'ilcourseobjectivesgui'), 'edit');
634  $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', '');
635 
636  $details[] = array(
637  'desc' => $lng->txt('crs_loc_tab_materials').': ',
638  'target' => '_top',
639  'link' => $url,
640  'name' => $this->objective_map["names"][$objective_id]
641  );
642  }
643  }
644  if($this->objective_map["test_i"] == $item_ref_id)
645  {
646  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
647  $details[] = array(
648  'desc' => '',
649  'target' => '_top',
650  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
651  'name' => $lng->txt('crs_loc_tab_itest')
652  );
653  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
654  }
655  if($this->objective_map["test_q"] == $item_ref_id)
656  {
657  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
658  $details[] = array(
659  'desc' => '',
660  'target' => '_top',
661  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
662  'name' => $lng->txt('crs_loc_tab_qtest')
663  );
664  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
665  }
666 
667  // #15367
668  if(is_array($this->objective_map["test_ass"][$item_ref_id]))
669  {
670  foreach($this->objective_map["test_ass"][$item_ref_id] as $type => $items)
671  {
673  {
674  $caption = $lng->txt('crs_loc_tab_itest');
675  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
676  }
677  else
678  {
679  $caption = $lng->txt('crs_loc_tab_qtest');
680  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
681  }
682  foreach($items as $objtv_title)
683  {
684  $details[] = array(
685  'desc' => '',
686  'target' => '_top',
687  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testsOverview'),
688  'name' => $caption." (".$this->lng->txt("crs_loc_learning_objective").": ".$objtv_title.")"
689  );
690  }
691  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
692  }
693  }
694 
695  if(sizeof($details))
696  {
697  $a_item_list_gui->enableItemDetailLinks(true);
698  $a_item_list_gui->setItemDetailLinks($details, $lng->txt('crs_loc_settings_tbl').': ');
699  }
700  else
701  {
702  $a_item_list_gui->enableItemDetailLinks(false);
703  }
704  }
705 
706  // order
707  if($this->getContainerGUI()->isActiveOrdering())
708  {
709  $a_item_list_gui->enableCommands(true, true);
710  $a_item_list_gui->enableProperties(false);
711  }
712  // view
713  else if(!$this->getContainerGUI()->isActiveAdministrationPanel())
714  {
715  $a_item_list_gui->enableCommands(true, true);
716  $a_item_list_gui->enableProperties(false);
717  }
718 
719  if($a_item['objective_id'])
720  {
721  $a_item_list_gui->setDefaultCommandParameters(array('objective_id' => $a_item['objective_id']));
722 
723 
724  if($this->loc_settings->getQualifiedTest() == $a_item['ref_id'])
725  {
726  $a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
727  // check conditions of target
728  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
729  $fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(),$a_item['objective_id'],'lobj');
730  if(!$fullfilled || $a_item['objective_status'])
731  {
732  $a_item_list_gui->disableTitleLink(true);
733  }
734  }
735  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
737  $this->getContainerObject()->getId(),
738  $GLOBALS['ilUser']->getId(),
739  $a_item['objective_id'],
741 
742  $res = $this->updateResult($res,$a_item['ref_id'],$a_item['objective_id'],$GLOBALS['ilUser']->getId());
743 
744  if($res['is_final'])
745  {
746  $a_item_list_gui->disableTitleLink(true);
747  $a_item_list_gui->enableProperties(true);
748  $a_item_list_gui->addCustomProperty(
749  $this->lng->txt('crs_loc_passes_reached'),
750  '',
751  true
752  );
753  }
754  elseif($this->loc_settings->getQualifiedTest() == $a_item['ref_id'])
755  {
756  include_once './Modules/Course/classes/class.ilCourseObjective.php';
757  $poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']);
758 
759  if($poss_pass)
760  {
761  $a_item_list_gui->enableProperties(true);
762  $a_item_list_gui->addCustomProperty(
763  $this->lng->txt('crs_loc_passes_left'),
764  (($poss_pass - $res['tries']) > 0) ? ($poss_pass - $res['tries']) : 1,
765  false
766  );
767  }
768  }
769  }
770  }
setConditionTarget($a_ref_id, $a_obj_id, $a_target_type)
static lookupMaxPasses($a_objective_id)
enableProperties($a_status)
En/disable properties.
static lookupResult($a_course_obj_id, $a_user_id, $a_objective_id, $a_tst_type)
Lookup user result.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$url
Definition: shib_logout.php:72
global $ilCtrl
Definition: ilias.php:18
getContainerGUI()
Get container GUI object.
getContainerObject()
Get container object.
static _checkAllConditionsOfTarget($a_target_ref_id, $a_target_id, $a_target_type="", $a_usr_id=0)
checks wether all conditions of a target object are fulfilled
enableCommands($a_status, $a_std_only=false)
En/disable commands.
Create styles array
The data for the language used.
addCustomProperty($a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property
setDefaultCommandParameters(array $a_params)
setItemDetailLinks($a_detail_links, $a_intro_txt='')
set items detail links
enableItemDetailLinks($a_status)
enable item detail links E.g Direct links to chapters or pages
global $lng
Definition: privfeed.php:17
updateResult($a_res, $a_item_ref_id, $a_objective_id, $a_user_id)
+ Here is the call graph for this function:

◆ buildAccordionContent()

ilContainerObjectiveGUI::buildAccordionContent ( array  $a_items)
protected

Definition at line 1317 of file class.ilContainerObjectiveGUI.php.

References $tpl.

Referenced by showMaterials().

1318  {
1319  $tpl = new ilTemplate("tpl.objective_accordion_content.html", true, true, "Services/Container");
1320  foreach($a_items as $item)
1321  {
1322  $tpl->setCurrentBlock("items_bl");
1323  $tpl->setVariable("ITEM", $item);
1324  $tpl->parseCurrentBlock();
1325  }
1326  return $tpl->get();
1327  }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ buildAccordionTitle()

ilContainerObjectiveGUI::buildAccordionTitle ( ilCourseObjective  $a_objective,
array  $a_lo_result = null 
)
protected

Definition at line 1293 of file class.ilContainerObjectiveGUI.php.

References $tpl, ilCourseObjective\getDescription(), ilCourseObjective\getObjectiveId(), and ilCourseObjective\getTitle().

Referenced by renderObjective().

1294  {
1295  $tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "Services/Container");
1296 
1297  if($a_lo_result)
1298  {
1299  $tpl->setVariable("PROGRESS_BAR", self::buildObjectiveProgressBar(
1300  (bool) $this->loc_settings->worksWithInitialTest(),
1301  $a_objective->getObjectiveId(),
1302  $a_lo_result)
1303  );
1304  }
1305 
1306  // $tpl->setVariable("ICON_SRC", ilObject::_getIcon($a_objective->getObjectiveId(), "small", "lobj"));
1307  // $tpl->setVariable("ICON_TXT", $this->lng->txt("icon")." ".$this->lng->txt("crs_objectives"));
1308  $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective").": ".trim($a_objective->getTitle()));
1309  $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
1310 
1311  // #15510
1312  $tpl->setVariable("ANCHOR_ID", "objtv_acc_".$a_objective->getObjectiveId());
1313 
1314  return $tpl->get();
1315  }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildObjectiveMap()

ilContainerObjectiveGUI::buildObjectiveMap ( )
protected

Definition at line 564 of file class.ilContainerObjectiveGUI.php.

References $title, ilCourseObjectiveMaterials\_getAssignedMaterials(), ilCourseObjective\_getObjectiveIds(), array, ilContainerContentGUI\getContainerObject(), ilCourseObjective\lookupObjectiveTitle(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by showMaterials().

565  {
566  $objective_map = array();
567  include_once './Modules/Course/classes/class.ilCourseObjective.php';
568  // begin-patch lok
569  if(count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(),true)))
570  // end-patch lok
571  {
572  include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
573  foreach($objective_ids as $objective_id)
574  {
575  foreach(ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id) as $mat_ref_id)
576  {
577  $objective_map["material"][$mat_ref_id][] = $objective_id;
578 
579  if(!isset($objective_map["names"][$objective_id]))
580  {
581  $objective = new ilCourseObjective($this->getContainerObject(), $objective_id);
582  $objective_map["names"][$objective_id] = $objective->getTitle();
583  }
584  }
585  }
586 
587  // initial/qualifying test
588  $tst = $this->loc_settings->getInitialTest();
589  if($tst)
590  {
591  $objective_map["test_i"] = $tst;
592  }
593  $tst = $this->loc_settings->getQualifiedTest();
594  if($tst)
595  {
596  $objective_map["test_q"] = $tst;
597  }
598 
599  // objective test assignments
600  include_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
601  include_once 'Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
602  $ass_test = new ilLOTestAssignments($this->getContainerObject()->getId());
603  foreach($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_INITIAL) as $ass)
604  {
605  $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
606  $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
607  }
608  foreach($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_QUALIFIED) as $ass)
609  {
610  $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
611  $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
612  }
613  }
614 
615  return $objective_map;
616  }
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
Settings for LO courses.
static _getObjectiveIds($course_id, $a_activated_only=false)
class ilcourseobjective
getContainerObject()
Get container object.
Create styles array
The data for the language used.
static _getAssignedMaterials($a_objective_id)
get assigned materials
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildObjectiveProgressBar()

static ilContainerObjectiveGUI::buildObjectiveProgressBar (   $a_has_initial_test,
  $a_objective_id,
array  $a_lo_result,
  $a_list_mode = false,
  $a_sub = false,
  $a_tt_suffix = null 
)
static

Render progressbar(s) for given objective and result data.

Parameters
bool$a_has_initial_test
int$a_objective_id
bool$a_lo_result
bool$a_list_mode
bool$a_sub
mixed$a_tt_suffix
Returns
string

Definition at line 1184 of file class.ilContainerObjectiveGUI.php.

References $lng, ilLOSettings\getInstanceByObjId(), ilLOUtils\getTestResultLinkForUser(), ilLOUserResults\STATUS_COMPLETED, ilLOUserResults\TYPE_INITIAL, and ilLOUserResults\TYPE_QUALIFIED.

Referenced by ilPortfolioPageGUI\renderMyCourses(), and ilTestLearningObjectivesStatusGUI\renderStatus().

1185  {
1186  global $lng;
1187 
1188  // tooltip (has to be unique!)
1189 
1190  $tooltip_id = "crsobjtvusr_".$a_objective_id."_".$a_lo_result["type"]."_".((int)$a_sub);
1191  if($a_tt_suffix !== null)
1192  {
1193  $tooltip_id .= "_".$a_tt_suffix;
1194  }
1195 
1196  $tt_txt = sprintf(
1197  $lng->txt("crs_loc_tt_info"),
1198  $a_lo_result["result_perc"],
1199  $a_lo_result["limit_perc"]
1200  );
1201 
1202 
1203  include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
1204  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
1205 
1206  $is_qualified = ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
1207  $is_qualified_initial = ($a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1208  ilLOSettings::getInstanceByObjId($a_lo_result['course_id'])->isInitialTestQualifying());
1209  $has_completed = ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED);
1210 
1211  $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
1212 
1213  if($is_qualified ||
1214  $is_qualified_initial)
1215  {
1216  $progress_txt = $lng->txt("crs_loc_progress_result_qtest");
1217  $tt_txt = $lng->txt("crs_loc_tab_qtest").": ".$tt_txt;
1218 
1219  if($has_completed)
1220  {
1221  $next_step = $lng->txt("crs_loc_progress_objective_complete");
1222  $bar_color = "ilCourseObjectiveProgressBarCompleted";
1223 
1224  // render 2nd progressbar if there is also an initial test
1225  if($is_qualified &&
1226  $a_has_initial_test &&
1227  is_array($a_lo_result["initial"]))
1228  {
1229  $a_lo_result["initial"]["itest"] = $a_lo_result["itest"];
1230 
1231  // force list mode to get rid of next step
1232  $initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix);
1233  }
1234  }
1235  else
1236  {
1237  $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
1238  $bar_color = "ilCourseObjectiveProgressBarFailed";
1239  }
1240  }
1241  // initial test
1242  else
1243  {
1244  if($a_lo_result["status"])
1245  {
1246  $progress_txt = $lng->txt("crs_loc_progress_result_itest");
1247  $tt_txt = $lng->txt("crs_loc_tab_itest").": ".$tt_txt;
1248 
1249  $bar_color = "ilCourseObjectiveProgressBarNeutral";
1250  $next_step = $has_completed
1251  ? $lng->txt("crs_loc_progress_do_qualifying")
1252  : $lng->txt("crs_loc_suggested");
1253  }
1254  // not attempted: no progress bar
1255  else
1256  {
1257  $next_step = (bool)$a_has_initial_test
1258  ? $lng->txt("crs_loc_progress_no_result_do_initial")
1259  : $lng->txt("crs_loc_progress_no_result_no_initial");
1260  }
1261  }
1262 
1263  // link to test results
1264  // - first try to fetch a link for qualifying test results
1265  if($a_lo_result["qtest"])
1266  {
1267  $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["qtest"], $a_lo_result["user_id"]);
1268  }
1269  // - when no qualifiying test results link was fetched, try for initial test
1270  if(!$test_url && $a_lo_result["itest"])
1271  {
1272  $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["itest"], $a_lo_result["user_id"]);
1273  }
1274 
1275  return self::renderProgressBar(
1276  $a_lo_result["result_perc"],
1277  $a_lo_result["limit_perc"],
1278  $bar_color,
1279  $progress_txt,
1280  $test_url,
1281  $tooltip_id,
1282  $tt_txt,
1283  $a_list_mode
1284  ? null
1285  : $next_step,
1286  $initial_sub,
1287  $a_list_mode
1288  ? 30
1289  : 10
1290  );
1291  }
static getInstanceByObjId($a_obj_id)
get singleton instance
static getTestResultLinkForUser($a_test_ref_id, $a_user_id)
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDetailsLevel()

ilContainerObjectiveGUI::getDetailsLevel (   $a_objective_id)

get details level

public

Parameters

Definition at line 91 of file class.ilContainerObjectiveGUI.php.

Referenced by renderObjective().

92  {
93  // no details anymore
94  return self::DETAILS_ALL;
95  }
+ Here is the caller graph for this function:

◆ getMainContent()

ilContainerObjectiveGUI::getMainContent ( )

Impementation of abstract method getMainContent.

public

Returns

Definition at line 103 of file class.ilContainerObjectiveGUI.php.

References $GLOBALS, $ilUser, $lng, $tpl, ilObject\_lookupObjId(), ilObjTestAccess\checkCondition(), ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), ilLOSettings\getInstanceByObjId(), ilLOUserResults\hasResults(), ilContainerContentGUI\initRenderer(), ilConditionHandler\OPERATOR_FINISHED, renderTest(), showButton(), showMaterials(), and showObjectives().

104  {
105  global $lng,$ilTabs,$ilAccess,$ilUser;
106 
107  // see bug #7452
108 // $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
109 
110 
111  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
112 
113  $tpl = new ilTemplate("tpl.container_page.html", true, true,"Services/Container");
114 
115  if($GLOBALS['ilAccess']->checkAccess('write','',$this->getContainerObject()->getRefId()))
116  {
117  // check for results
118  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
119  if(ilLOUserResults::hasResults($this->getContainerObject()->getId(),$GLOBALS['ilUser']->getId()))
120  {
121  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
122  $ilToolbar = new ilToolbarGUI();
123  $ilToolbar->addButton(
124  $lng->txt('crs_reset_results'),
125  $GLOBALS['ilCtrl']->getLinkTargetByClass(get_class($this->getContainerGUI()),'reset')
126  );
127  }
128 
129  }
130 
131  // Feedback
132  // @todo
133 // $this->__showFeedBack();
134 
135  $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
136 
137  $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
138  $is_order = $this->getContainerGUI()->isActiveOrdering();
139 
140  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
141  $this->loc_settings = ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId());
142 
143  $this->initRenderer();
144 
145  if(!$is_manage && !$is_order)
146  {
147  // currently inactive
148  // $this->showStatus($tpl);
149  }
150  if(!$is_manage)
151  {
152  $this->showObjectives($tpl, $is_order);
153 
154  // $this->showMaterials($tpl,self::MATERIALS_TESTS, false, !$is_order);
155 
156  // check for results
157  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
158  $has_results = ilLOUserResults::hasResults($this->getContainerObject()->getId(), $ilUser->getId());
159 
160  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
161  $tst_obj_id = ilObject::_lookupObjId($this->loc_settings->getInitialTest());
162 
163  if(
164  $this->loc_settings->getInitialTest() &&
165  $this->loc_settings->isGeneralInitialTestVisible() &&
166  !$this->loc_settings->isInitialTestStart() &&
168  )
169  {
170  $this->output_html .= $this->renderTest($this->loc_settings->getInitialTest(), null, true, true);
171  }
172  else if(
173  $this->loc_settings->getQualifiedTest() &&
174  $this->loc_settings->isGeneralQualifiedTestVisible()
175  )
176  {
177  $this->output_html .= $this->renderTest($this->loc_settings->getQualifiedTest(), null, false, true);
178  }
179 
180  $this->showMaterials($tpl,self::MATERIALS_OTHER, false, !$is_order);
181  }
182  else
183  {
184  $this->showMaterials($tpl, null, $is_manage);
185  }
186 
187  // reset results by setting or for admins
188  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
189  if(
190  ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId())->isResetResultsEnabled() or
191  $GLOBALS['ilAccess']->checkAccess('write','',$this->getContainerObject()->getRefId())
192  )
193  {
194  if($has_results)
195  {
196  if (!$is_manage && !$is_order)
197  {
198  $this->showButton('askReset',$lng->txt('crs_reset_results'));
199  }
200  }
201  }
202 
203  $tpl->setVariable('CONTAINER_PAGE_CONTENT',$this->output_html);
204 
205  return $tpl->get();
206  }
static getInstanceByObjId($a_obj_id)
get singleton instance
showObjectives($a_tpl, $a_is_order=false)
show objectives
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
initRenderer()
Init container renderer.
global $tpl
Definition: ilias.php:8
getContainerGUI()
Get container GUI object.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
getContainerObject()
Get container object.
$ilUser
Definition: imgupload.php:18
showButton($a_cmd, $a_text, $a_target='', $a_id="")
show action button
renderTest($a_test_ref_id, $a_objective_id, $a_is_initial=false, $a_add_border=false, $a_lo_result=array())
global $lng
Definition: privfeed.php:17
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
check condition
static hasResults($a_container_id, $a_user_id)
showMaterials($a_tpl, $a_mode=null, $a_is_manage=false, $a_as_accordion=false)
Show all other (no assigned tests, no assigned materials) materials.
+ Here is the call graph for this function:

◆ getSettings()

ilContainerObjectiveGUI::getSettings ( )
Returns
ilLOSettings

Definition at line 77 of file class.ilContainerObjectiveGUI.php.

References $loc_settings.

Referenced by renderObjective().

+ Here is the caller graph for this function:

◆ getTestAssignments()

ilContainerObjectiveGUI::getTestAssignments ( )

Get test assignments object.

Returns
ilLOTestAssignments

Definition at line 69 of file class.ilContainerObjectiveGUI.php.

References $test_assignments.

Referenced by renderObjective().

+ Here is the caller graph for this function:

◆ initDetails()

ilContainerObjectiveGUI::initDetails ( )
protected

init details

protected

Parameters

Definition at line 1027 of file class.ilContainerObjectiveGUI.php.

References $ilUser.

Referenced by __construct().

1028  {
1029  global $ilUser;
1030 
1031  // no details
1032  return;
1033 
1034  }
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ initTestAssignments()

ilContainerObjectiveGUI::initTestAssignments ( )
protected

Definition at line 1036 of file class.ilContainerObjectiveGUI.php.

References ilContainerContentGUI\getContainerObject(), and ilLOTestAssignments\getInstance().

Referenced by __construct().

1037  {
1038  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
1039  $this->test_assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
1040  }
static getInstance($a_container_id)
Get instance by container id.
getContainerObject()
Get container object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseLOUserResults()

ilContainerObjectiveGUI::parseLOUserResults ( )
protected

Parse learning objective results.

type $ilUser

Returns
type

Definition at line 1047 of file class.ilContainerObjectiveGUI.php.

References $ilUser, $res, $result, array, ilContainerContentGUI\getContainerObject(), ilLOTestAssignments\getInstance(), ilLOUserResults\TYPE_INITIAL, ilLOUserResults\TYPE_QUALIFIED, ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by showObjectives().

1048  {
1049  global $ilUser;
1050 
1051  $res = array();
1052 
1053  include_once "Modules/Course/classes/Objectives/class.ilLOTestAssignments.php";
1054  $lo_ass = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
1055 
1056  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
1057  $lur = new ilLOUserResults($this->getContainerObject()->getId(), $ilUser->getId());
1058  foreach($lur->getCourseResultsForUserPresentation() as $objective_id => $types)
1059  {
1060  // show either initial or qualified for objective
1061  if(isset($types[ilLOUserResults::TYPE_INITIAL]))
1062  {
1063  $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
1064  }
1065 
1066  // qualified test has priority
1067  if(isset($types[ilLOUserResults::TYPE_QUALIFIED]))
1068  {
1071  $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL];
1072  }
1073  else
1074  {
1077  }
1078 
1079  $result["initial_status"] = $initial_status;
1080 
1081  $result["itest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
1082  $result["qtest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
1083 
1084  $res[$objective_id] = $result;
1085  }
1086 
1087  return $res;
1088  }
static getInstance($a_container_id)
Get instance by container id.
$result
getContainerObject()
Get container object.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderObjective()

ilContainerObjectiveGUI::renderObjective (   $a_objective_id,
$a_has_lo_page,
ilAccordionGUI  $a_accordion = null,
array  $a_lo_result = null 
)
protected

render objective

protected

Parameters
intobjective id
boolco page status
ilAccordionGUI$a_accordion
array$a_lo_result
Returns
string html

Definition at line 811 of file class.ilContainerObjectiveGUI.php.

References $_GET, $ilUser, $lng, $title, ilPageUtil\_existsAndNotEmpty(), ilObject\_lookupObjId(), array, buildAccordionTitle(), ilObjTestAccess\checkCondition(), ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), getDetailsLevel(), ilObjStyleSheet\getEffectiveContentStyleId(), ilContainerContentGUI\getItemGUI(), ilObjectActivation\getItemsByObjective(), getSettings(), getTestAssignments(), ilConditionHandler\OPERATOR_FINISHED, renderTest(), ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by showObjectives().

812  {
813  global $ilUser,$lng;
814 
815  include_once('./Modules/Course/classes/class.ilCourseObjective.php');
816  $objective = new ilCourseObjective($this->getContainerObject(),$a_objective_id);
817 
818  include_once('./Services/Container/classes/class.ilContainerSorting.php');
819  include_once('./Services/Object/classes/class.ilObjectActivation.php');
820  $items = ilObjectActivation::getItemsByObjective($a_objective_id);
821 
822  // sorting is handled by ilCourseObjectiveMaterials
823  // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
824 
825  include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
826  $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
827 
828  // #13381 - map material assignment to position
829  $sort_map = array();
830  foreach($objectives_lm_obj->getMaterials() as $item)
831  {
832  $sort_map[$item["lm_ass_id"]] = $item["position"];
833  }
834 
835  $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
836  $is_order = $this->getContainerGUI()->isActiveOrdering();
837 
838  $sort_content = array();
839 
840  foreach($items as $item)
841  {
842  if($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL)
843  {
844  continue;
845  }
846 
847  $item_list_gui2 = $this->getItemGUI($item);
848  $item_list_gui2->enableIcon(true);
849 
850  if($is_order || $a_accordion)
851  {
852  $item_list_gui2->enableCommands(true, true);
853  $item_list_gui2->enableProperties(false);
854  }
855 
856  $chapters = $objectives_lm_obj->getChapters();
857  if(count($chapters))
858  {
859  $has_sections = false;
860  foreach($chapters as $chapter)
861  {
862  if($chapter['ref_id'] != $item['child'])
863  {
864  continue;
865  }
866  $has_sections = true;
867 
868  include_once './Modules/LearningModule/classes/class.ilLMObject.php';
869  $title = $item['title'].
870  " &rsaquo; ".ilLMObject::_lookupTitle($chapter['obj_id']).
871  " (".$lng->txt('obj_'.$chapter['type']).")";
872 
873  $item_list_gui2->setDefaultCommandParameters(array(
874  "obj_id" => $chapter['obj_id'],
875  "focus_id" => $chapter['obj_id'],
876  "focus_return" => $this->container_obj->getRefId()));
877 
878  if($is_order)
879  {
880  $item_list_gui2->setPositionInputField("[lobj][".$a_objective_id."][".$chapter['lm_ass_id']."]",
881  sprintf('%d', $chapter['position']*10));
882  }
883 
884  $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'],
885  $item['obj_id'], $title, $item['description']);
886 
887  // #13381 - use materials order
888  $sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT)."_".strtolower($title)."_".$chapter['lm_ass_id'];
889  $sort_content[$sort_key] = $sub_item_html;
890  }
891  }
892 
893  $this->rendered_items[$item['child']] = true;
894 
895  if($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true))
896  {
897  if($is_order)
898  {
899  $item_list_gui2->setPositionInputField("[lobj][".$a_objective_id."][".$lm_ass_id."]",
900  sprintf('%d', $sort_map[$lm_ass_id]*10));
901  }
902 
903  $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'],
904  $item['obj_id'], $item['title'], $item['description']);
905 
906  // #13381 - use materials order
907  $sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT)."_".strtolower($item['title'])."_".$lm_ass_id;
908  $sort_content[$sort_key] = $sub_item_html;
909  }
910  }
911 
912  if($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL)
913  {
914  $this->objective_list_gui->enableCommands(false);
915  }
916  else
917  {
918  $this->objective_list_gui->enableCommands(true);
919  }
920 
921  if($is_order)
922  {
923  $this->objective_list_gui->setPositionInputField("[lobj][".$a_objective_id."][0]",
924  $objective->__getPosition()*10);
925  }
926 
927  ksort($sort_content);
928 
929  if(!$a_accordion)
930  {
931  foreach($sort_content as $sub_item_html)
932  {
933  $this->objective_list_gui->addSubItemHTML($sub_item_html);
934  }
935 
936  return $this->objective_list_gui->getObjectiveListItemHTML(
937  0,
938  $a_objective_id,
939  $objective->getTitle(),
940  $objective->getDescription(),
941  ($is_manage || $is_order));
942  }
943  else
944  {
945  $acc_content = $sort_content;
946 
947  $initial_shown = false;
948  $initial_test_ref_id = $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL);
949  $initial_test_obj_id = ilObject::_lookupObjId($initial_test_ref_id);
950  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
951 
952  if(
953  $initial_test_obj_id &&
954  $this->getSettings()->hasSeparateInitialTests() &&
955  !ilObjTestAccess::checkCondition($initial_test_obj_id, ilConditionHandler::OPERATOR_FINISHED, '', $ilUser->getId())
956  )
957  {
958  $acc_content[] = $this->renderTest(
959  $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL),
960  $a_objective_id,
961  true,
962  false,
963  $a_lo_result);
964  $initial_shown = TRUE;
965  }
966  elseif($this->getSettings()->hasSeparateQualifiedTests())
967  {
968  $acc_content[] = $this->renderTest(
969  $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED),
970  $a_objective_id,
971  false,
972  false,
973  $a_lo_result);
974  }
975 
976 
977  /*
978  if($this->loc_settings->getInitialTest() &&
979  $this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL &&
980  !$a_lo_risult["initial_status"])
981  {
982  $acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result);
983  $initial_shown = true;
984  }
985  if(!$initial_shown &&
986  $this->loc_settings->getQualifiedTest() &&
987  $this->loc_settings->isQualifiedTestPerObjectiveVisible())
988  {
989  $acc_content[] = $this->renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id, false, false, $a_lo_result);
990  }
991  */
992 
993  $co_page = null;
994  include_once("./Services/COPage/classes/class.ilPageUtil.php");
995  if(ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId()))
996  {
997  $a_has_lo_page = true;
998 
999  include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php';
1000  $page_gui = new ilLOPageGUI($objective->getObjectiveId());
1001 
1002  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1003  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0));
1004  $page_gui->setPresentationTitle("");
1005  $page_gui->setTemplateOutput(false);
1006  $page_gui->setHeader("");
1007 
1008  $co_page = "<div class='ilContObjectiveIntro'>".$page_gui->showPage()."</div>";
1009  }
1010 
1011  $a_accordion->addItem(
1012  $this->buildAccordionTitle($objective, $a_lo_result),
1013  $co_page.
1014  $this->buildAccordionContent($acc_content),
1015  (isset($_GET["oobj"]) && (int)$_GET["oobj"] == $objective->getObjectiveId())
1016  );
1017  }
1018  }
$_GET["client_id"]
getItemGUI($item_data, $a_show_path=false)
Get ListGUI object for item.
addItem($a_header, $a_content, $a_force_open=false)
Add item.
buildAccordionTitle(ilCourseObjective $a_objective, array $a_lo_result=null)
class ilCourseObjectiveMaterials
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages) ...
getContainerGUI()
Get container GUI object.
class ilcourseobjective
static _lookupObjId($a_id)
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
getContainerObject()
Get container object.
$ilUser
Definition: imgupload.php:18
(Course) learning objective page GUI class
Create styles array
The data for the language used.
renderTest($a_test_ref_id, $a_objective_id, $a_is_initial=false, $a_add_border=false, $a_lo_result=array())
static getItemsByObjective($a_objective_id)
Get objective items.
global $lng
Definition: privfeed.php:17
static checkCondition($a_obj_id, $a_operator, $a_value, $a_usr_id)
check condition
getTestAssignments()
Get test assignments object.
getDetailsLevel($a_objective_id)
get details level
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderProgressBar()

static ilContainerObjectiveGUI::renderProgressBar (   $a_perc_result = null,
  $a_perc_limit = null,
  $a_css = null,
  $a_caption = null,
  $a_url = null,
  $a_tt_id = null,
  $a_tt_txt = null,
  $a_next_step = null,
  $a_sub = false,
  $a_sub_style = 30 
)
static

Render progress bar(s)

Parameters
int$a_perc_result
int$a_perc_limit
string$a_css
string$a_caption
string$a_url
string$a_tt_id
string$a_tt_txt
string$a_next_step
string$a_sub(html)
int$a_sub_style
Returns
type

Definition at line 1105 of file class.ilContainerObjectiveGUI.php.

References $tpl, ilTooltipGUI\addTooltip(), and ilLinkButton\getInstance().

Referenced by ilStudyProgrammeProgressListGUI\buildProgressBar().

1106  {
1107  $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container");
1108 
1109  if($a_perc_result !== null)
1110  {
1111  $tpl->setCurrentBlock("statusbar_bl");
1112  $tpl->setVariable("PERC_STATUS", $a_perc_result);
1113  $tpl->setVariable("PERC_WIDTH", $a_perc_result);
1114  $tpl->setVariable("PERC_COLOR", $a_css);
1115  if($a_perc_limit)
1116  {
1117  // :TODO: magic?
1118  $limit_pos = (99-(int)$a_perc_limit)*-1;
1119  $tpl->setVariable("LIMIT_POS", $limit_pos);
1120  }
1121  if($a_tt_txt &&
1122  $a_tt_id)
1123  {
1124  $tpl->setVariable("TT_ID", $a_tt_id);
1125  }
1126  $tpl->parseCurrentBlock();
1127  }
1128 
1129  if($a_caption)
1130  {
1131  if($a_url)
1132  {
1133  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1134  $button = ilLinkButton::getInstance();
1135  $button->setCaption($a_caption, false);
1136  $button->setUrl($a_url);
1137 
1138  $tpl->setCurrentBlock("statustxt_bl");
1139  $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
1140  $tpl->parseCurrentBlock();
1141  }
1142  else
1143  {
1144  $tpl->setCurrentBlock("statustxt_no_link_bl");
1145  $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
1146  $tpl->parseCurrentBlock();
1147  }
1148  }
1149 
1150  if($a_next_step)
1151  {
1152  $tpl->setCurrentBlock("nstep_bl");
1153  $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
1154  $tpl->parseCurrentBlock();
1155  }
1156 
1157  if($a_tt_id &&
1158  $a_tt_txt)
1159  {
1160  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1161  ilTooltipGUI::addTooltip($a_tt_id, $a_tt_txt);
1162  }
1163 
1164  if($a_sub)
1165  {
1166  $tpl->setVariable("SUB_STYLE", ' style="padding-left: '.$a_sub_style.'px;"');
1167  $tpl->setVariable("SUB_INIT", $a_sub);
1168  }
1169 
1170  return $tpl->get();
1171  }
global $tpl
Definition: ilias.php:8
static addTooltip($a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
Adds a tooltip to an HTML element.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderTest()

ilContainerObjectiveGUI::renderTest (   $a_test_ref_id,
  $a_objective_id,
  $a_is_initial = false,
  $a_add_border = false,
  $a_lo_result = array() 
)
protected

Definition at line 382 of file class.ilContainerObjectiveGUI.php.

References $GLOBALS, $title, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilCourseObjective\lookupObjectiveTitle(), and ilLOUserResults\STATUS_COMPLETED.

Referenced by getMainContent(), and renderObjective().

383  {
384  $node_data = [];
385  if($a_test_ref_id)
386  {
387  $node_data = $GLOBALS['tree']->getNodeData($a_test_ref_id);
388  }
389  if(!$node_data['child'])
390  {
391  return '';
392  }
393 
394  // update ti
395  if($a_objective_id)
396  {
397  if($a_is_initial)
398  {
399  $title = sprintf($this->lng->txt('crs_loc_itst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
400  }
401  else
402  {
403  $title = sprintf($this->lng->txt('crs_loc_qtst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
404  }
405  $node_data['objective_id'] = $a_objective_id;
406  $node_data['objective_status'] =
407  (
408  $a_lo_result['status'] == ilLOUserResults::STATUS_COMPLETED ?
409  false :
410  false
411  );
412  }
413  else
414  {
415  $obj_id = ilObject::_lookupObjId($a_test_ref_id);
416  $title = ilObject::_lookupTitle($obj_id);
417 
418  $title .= (
419  ' ('.
420  (
421  $a_is_initial
422  ? $this->lng->txt('crs_loc_itest_info')
423  : $this->lng->txt('crs_loc_qtest_info')
424  ).
425  ')'
426  );
427  $node_data['objective_id'] = 0;
428  }
429 
430  $node_data['title'] = $title;
431 
432  return "<div class='ilContObjectivesViewTestItem'>".$this->renderItem($node_data)."</div>";
433  }
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showButton()

ilContainerObjectiveGUI::showButton (   $a_cmd,
  $a_text,
  $a_target = '',
  $a_id = "" 
)
protected

show action button

protected

Parameters

Definition at line 1336 of file class.ilContainerObjectiveGUI.php.

References $ilCtrl.

Referenced by getMainContent(), and showObjectives().

1337  {
1338  global $ilToolbar, $ilCtrl;
1339 
1340  // #11842
1341  $ilToolbar->addButton($a_text,
1342  $ilCtrl->getLinkTarget($this->getContainerGUI(),$a_cmd),
1343  $a_target, "", '', $a_id);
1344  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ showMaterials()

ilContainerObjectiveGUI::showMaterials (   $a_tpl,
  $a_mode = null,
  $a_is_manage = false,
  $a_as_accordion = false 
)

Show all other (no assigned tests, no assigned materials) materials.

public

Parameters
object$tpltemplate object
Returns
void

Definition at line 442 of file class.ilContainerObjectiveGUI.php.

References $h, $html, $lng, $txt, array, buildAccordionContent(), buildObjectiveMap(), ilContainerContentGUI\clearAdminCommandsDetermination(), ilContainerContentGUI\getContainerObject(), ilLOTestAssignments\getInstance(), ilContainerContentGUI\getItemGroupsHTML(), ilContainerContentGUI\renderItem(), and ilLOSettings\TYPE_TEST_UNDEFINED.

Referenced by getMainContent().

443  {
444  global $ilAccess, $lng;
445 
447 
448  if (is_array($this->items["_all"]))
449  {
450  $this->objective_map = $this->buildObjectiveMap();
451 
452  // all rows
453  $item_r = array();
454 
455  $position = 1;
456  foreach($this->items["_all"] as $k => $item_data)
457  {
458  if($a_mode == self::MATERIALS_TESTS and $item_data['type'] != 'tst')
459  {
460  continue;
461  }
462  if ($item_data['type'] == 'itgr')
463  {
464  continue;
465  }
466  if(!$a_is_manage)
467  {
468  // if test object is qualified or initial do not show here
469  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
470  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
471  $assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
472  if($assignments->getTypeByTest($item_data['child']) != ilLOSettings::TYPE_TEST_UNDEFINED)
473  {
474  continue;
475  }
476  }
477 
478  if($this->rendered_items[$item_data["child"]] !== true &&
479  !$this->renderer->hasItem($item_data["child"]))
480  {
481  $this->rendered_items[$item_data['child']] = true;
482 
483  // TODO: Position (DONE ?)
484  $html = $this->renderItem($item_data,$position++,$a_mode == self::MATERIALS_TESTS ? false : true);
485  if ($html != "")
486  {
487  $item_r[] = array("html" => $html, "id" => $item_data["child"], "type" => $item_data["type"]);
488  }
489  }
490  }
491 
492  // if we have at least one item, output the block
493  if (count($item_r) > 0)
494  {
495  if(!$a_as_accordion)
496  {
497  $pos = 0;
498 
499  switch($a_mode)
500  {
501  case self::MATERIALS_TESTS:
502  $block_id = "tst";
503  $this->renderer->addTypeBlock($block_id);
504  break;
505 
506  case self::MATERIALS_OTHER:
507  $block_id = "oth";
508  $this->renderer->addCustomBlock($block_id, $lng->txt('crs_other_resources'));
509  break;
510 
511  // manage
512  default:
513  $block_id = "all";
514  $this->renderer->addCustomBlock($block_id, $lng->txt('content'));
515  break;
516  }
517 
518  // :TODO:
519  if ($a_mode != self::MATERIALS_TESTS)
520  {
521  $pos = $this->getItemGroupsHTML();
522  }
523 
524  foreach($item_r as $h)
525  {
526  if(!$this->renderer->hasItem($h["id"]))
527  {
528  $this->renderer->addItemToBlock($block_id, $h["type"], $h["id"], $h["html"]);
529  }
530  }
531 
532  $this->output_html .= $this->renderer->getHTML();
533  }
534  else
535  {
536  switch($a_mode)
537  {
538  case self::MATERIALS_TESTS:
539  $txt = $lng->txt('objs_tst');
540  break;
541 
542  case self::MATERIALS_OTHER:
543  $txt = $lng->txt('crs_other_resources');
544  break;
545  }
546 
547  include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
548  $acc = new ilAccordionGUI();
549  $acc->setId("crsobjtvmat".$a_mode."_".$this->container_obj->getId());
550 
551  $acc_content = array();
552  foreach($item_r as $h)
553  {
554  $acc_content[] = $h["html"];
555  }
556  $acc->addItem($txt, $this->buildAccordionContent($acc_content));
557 
558  $this->output_html .= $acc->getHTML();
559  }
560  }
561  }
562  }
static getInstance($a_container_id)
Get instance by container id.
$h
getItemGroupsHTML($a_pos=0)
Get item groups HTML.
getContainerObject()
Get container object.
renderItem($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
Render an item.
$txt
Definition: error.php:12
Create styles array
The data for the language used.
clearAdminCommandsDetermination()
cleaer administration commands determination
global $lng
Definition: privfeed.php:17
Accordion user interface class.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showObjectives()

ilContainerObjectiveGUI::showObjectives (   $a_tpl,
  $a_is_order = false 
)

show objectives

public

Parameters
object$tpltemplate object
Returns

Definition at line 238 of file class.ilContainerObjectiveGUI.php.

References $GLOBALS, $html, $ilSetting, $lng, $output_html, ilCourseObjective\_getObjectiveIds(), addFooterRow(), array, ilContainerContentGUI\clearAdminCommandsDetermination(), ilAccordionGUI\FIRST_OPEN, ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), ilObjStyleSheet\getContentStylePath(), ilLOSettings\getInstanceByObjId(), ilObjStyleSheet\getSyntaxStylePath(), ilLOUtils\hasActiveRun(), ilContainerContentGUI\insertPageEmbeddedBlocks(), parseLOUserResults(), renderObjective(), showButton(), and ilLOSettings\TYPE_TEST_INITIAL.

Referenced by getMainContent().

239  {
240  global $lng,$ilSetting;
241 
243 
244  // get embedded blocks
245  $has_container_page = false;
246  if(!$a_is_order)
247  {
248  $output_html = $this->getContainerGUI()->getContainerPageHTML();
249  if ($output_html != "")
250  {
251  $has_container_page = true;
252  $this->output_html .= $this->insertPageEmbeddedBlocks($output_html);
253  }
254  unset($output_html);
255  }
256 
257  // All objectives
258  include_once './Modules/Course/classes/class.ilCourseObjective.php';
259  if(!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(),true)))
260  {
261  return false;
262  }
263 
264  include_once('./Modules/Course/classes/class.ilCourseObjectiveListGUI.php');
265  $this->objective_list_gui = new ilCourseObjectiveListGUI();
266  $this->objective_list_gui->setContainerObject($this->getContainerGUI());
267  if ($ilSetting->get("icon_position_in_lists") == "item_rows")
268  {
269  $this->objective_list_gui->enableIcon(true);
270  }
271 
272  $acc = null;
273  if(!$a_is_order)
274  {
275  include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
276  $acc = new ilAccordionGUI();
277  $acc->setUseSessionStorage(true);
278  $acc->setAllowMultiOpened(true);
279  $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
280  $acc->setId("crsobjtv_".$this->container_obj->getId());
281  }
282  else
283  {
284  $this->renderer->addCustomBlock('lobj',$lng->txt('crs_objectives'));
285  }
286 
287  $lur_data = $this->parseLOUserResults();
288 
289  $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest();
290 
291  $has_lo_page = false;
292  $obj_cnt = 0;
293  foreach($objective_ids as $objective_id)
294  {
295  include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
296  if(
297  $has_initial &&
298  (
299  !isset($lur_data[$objective_id]) or
301  $this->container_obj->getId(),
302  ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(),
303  $objective_id)
304  )
305  )
306  {
307  $lur_data[$objective_id] = array("type"=>ilLOSettings::TYPE_TEST_INITIAL);
308  }
309 
310  if($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id]))
311  {
312  $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html);
313  }
314  $obj_cnt++;
315  }
316 
317  // buttons for showing/hiding all objectives
318  if (!$a_is_order && $obj_cnt > 1)
319  {
320  $this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn");
321  $this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn");
322  $acc->setShowAllElement("crs_show_all_obj_btn");
323  $acc->setHideAllElement("crs_hide_all_obj_btn");
324  }
325 
326  if(!$has_container_page && $has_lo_page)
327  {
328  // add core co page css
329  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
330  $GLOBALS["tpl"]->setVariable("LOCATION_CONTENT_STYLESHEET",
332  $GLOBALS["tpl"]->setCurrentBlock("SyntaxStyle");
333  $GLOBALS["tpl"]->setVariable("LOCATION_SYNTAX_STYLESHEET",
335  $GLOBALS["tpl"]->parseCurrentBlock();
336  }
337 
338  // order/block
339  if($a_is_order)
340  {
341  $this->addFooterRow();
342 
343  $this->output_html .= $output_html.$this->renderer->getHTML();
344 
345  $this->renderer->resetDetails();
346  }
347  // view/accordion
348  else
349  {
350  $this->output_html .= "<div class='ilCrsObjAcc'>".$acc->getHTML()."</div>";
351  }
352  }
static getInstanceByObjId($a_obj_id)
get singleton instance
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static hasActiveRun($a_container_id, $a_test_ref_id, $a_objective_id)
static _getObjectiveIds($course_id, $a_activated_only=false)
insertPageEmbeddedBlocks($a_output_html)
Insert blocks into container page.
parseLOUserResults()
Parse learning objective results.
getContainerGUI()
Get container GUI object.
getContainerObject()
Get container object.
static getSyntaxStylePath()
get syntax style path
Create styles array
The data for the language used.
clearAdminCommandsDetermination()
cleaer administration commands determination
renderObjective($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion=null, array $a_lo_result=null)
render objective
showButton($a_cmd, $a_text, $a_target='', $a_id="")
show action button
static getContentStylePath($a_style_id)
get content style path
global $ilSetting
Definition: privfeed.php:17
global $lng
Definition: privfeed.php:17
List gui for course objectives.
Accordion user interface class.
$html
Definition: example_001.php:87
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showStatus()

ilContainerObjectiveGUI::showStatus (   $tpl)

show status

public

Parameters

Definition at line 215 of file class.ilContainerObjectiveGUI.php.

References $ilUser, $lng, ilContainerContentGUI\getContainerObject(), ilCourseObjectiveResultCache\getStatus(), and IL_OBJECTIVE_STATUS_EMPTY.

216  {
217  global $ilUser,$lng;
218 
219  include_once('./Modules/Course/classes/class.ilCourseObjectiveResultCache.php');
220 
221  $status = ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->getId());
222  if($status == IL_OBJECTIVE_STATUS_EMPTY) {
223  return;
224  }
225  $info_tpl = new ilTemplate('tpl.crs_objectives_view_info_table.html',true,true,'Modules/Course');
226  $info_tpl->setVariable("INFO_STRING",$lng->txt('crs_objectives_info_'.$status));
227 
228  $this->output_html .= $info_tpl->get();
229  }
const IL_OBJECTIVE_STATUS_EMPTY
special template class to simplify handling of ITX/PEAR
getContainerObject()
Get container object.
static getStatus($a_usr_id, $a_crs_id)
get status of user
$ilUser
Definition: imgupload.php:18
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ updateResult()

ilContainerObjectiveGUI::updateResult (   $a_res,
  $a_item_ref_id,
  $a_objective_id,
  $a_user_id 
)
protected

Definition at line 772 of file class.ilContainerObjectiveGUI.php.

References ilObject\_lookupObjId(), ilObjTest\isParticipantsLastPassActive(), and ilLOTestRun\lookupRunExistsForObjective().

Referenced by addItemDetails().

773  {
774 
775  if($this->loc_settings->getQualifiedTest() == $a_item_ref_id)
776  {
777  // Check for existing test run, and decrease tries, reset final if run exists
778  include_once './Modules/Test/classes/class.ilObjTest.php';
779  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
781  $a_item_ref_id,
782  $a_user_id);
783 
784  if($active)
785  {
786  include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
788  ilObject::_lookupObjId($a_item_ref_id),
789  $a_objective_id,
790  $a_user_id))
791  {
792  ($a_res['tries'] > 0) ? --$a_res['tries'] : 0;
793  $a_res['is_final'] = 0;
794  }
795  }
796  }
797  return $a_res;
798 
799  }
static lookupRunExistsForObjective($a_test_id, $a_objective_id, $a_user_id)
type $ilDB
static _lookupObjId($a_id)
static isParticipantsLastPassActive($testRefId, $userId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $force_details

ilContainerObjectiveGUI::$force_details = 0
protected

Definition at line 37 of file class.ilContainerObjectiveGUI.php.

◆ $loc_settings

ilContainerObjectiveGUI::$loc_settings
protected

Definition at line 38 of file class.ilContainerObjectiveGUI.php.

Referenced by getSettings().

◆ $output_html

ilContainerObjectiveGUI::$output_html = ''
private

Definition at line 43 of file class.ilContainerObjectiveGUI.php.

Referenced by showObjectives().

◆ $test_assignments

ilContainerObjectiveGUI::$test_assignments = null
private

Definition at line 45 of file class.ilContainerObjectiveGUI.php.

Referenced by getTestAssignments().

◆ MATERIALS_OTHER

const ilContainerObjectiveGUI::MATERIALS_OTHER = 2

Definition at line 41 of file class.ilContainerObjectiveGUI.php.

◆ MATERIALS_TESTS

const ilContainerObjectiveGUI::MATERIALS_TESTS = 1

Definition at line 40 of file class.ilContainerObjectiveGUI.php.


The documentation for this class was generated from the following file: