ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 $tabs
 
 $toolbar
 
 $force_details = 0
 
 $loc_settings
 
- Protected Attributes inherited from ilContainerContentGUI
 $tpl
 
 $ctrl
 
 $user
 
 $lng
 
 $access
 
 $plugin_admin
 
 $db
 
 $rbacsystem
 
 $settings
 
 $obj_definition
 
 $details_level = self::DETAILS_DEACTIVATED
 
 $renderer
 
 $log
 

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 64 of file class.ilContainerObjectiveGUI.php.

References $DIC, ilContainerContentGUI\$lng, initDetails(), initTestAssignments(), settings(), and user().

65  {
66  global $DIC;
67 
68  $this->tabs = $DIC->tabs();
69  $this->access = $DIC->access();
70  $this->user = $DIC->user();
71  $this->settings = $DIC->settings();
72  $this->ctrl = $DIC->ctrl();
73  $this->toolbar = $DIC->toolbar();
74  $lng = $DIC->language();
75 
76  $this->lng = $lng;
77  parent::__construct($a_container_gui);
78 
79  $this->initDetails();
80  $this->initTestAssignments();
81  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ addFooterRow()

ilContainerObjectiveGUI::addFooterRow ( )

add footer row

public

Parameters

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

Referenced by showObjectives().

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

◆ addItemDetails()

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

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

References ilContainerContentGUI\$ctrl, $GLOBALS, $ilCtrl, ilContainerContentGUI\$lng, $res, $type, $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().

587  {
588  $lng = $this->lng;
590 
591  $item_ref_id = $a_item["ref_id"];
592 
593  if (is_array($this->objective_map)) {
594  $details = array();
595  if (isset($this->objective_map["material"][$item_ref_id])) {
596  // #12965
597  foreach ($this->objective_map["material"][$item_ref_id] as $objective_id) {
598  $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $objective_id);
599  $url = $ilCtrl->getLinkTargetByClass(array('illoeditorgui', 'ilcourseobjectivesgui'), 'edit');
600  $ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', '');
601 
602  $details[] = array(
603  'desc' => $lng->txt('crs_loc_tab_materials') . ': ',
604  'target' => '_top',
605  'link' => $url,
606  'name' => $this->objective_map["names"][$objective_id]
607  );
608  }
609  }
610  if ($this->objective_map["test_i"] == $item_ref_id) {
611  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
612  $details[] = array(
613  'desc' => '',
614  'target' => '_top',
615  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
616  'name' => $lng->txt('crs_loc_tab_itest')
617  );
618  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
619  }
620  if ($this->objective_map["test_q"] == $item_ref_id) {
621  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
622  $details[] = array(
623  'desc' => '',
624  'target' => '_top',
625  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
626  'name' => $lng->txt('crs_loc_tab_qtest')
627  );
628  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
629  }
630 
631  // #15367
632  if (is_array($this->objective_map["test_ass"][$item_ref_id])) {
633  foreach ($this->objective_map["test_ass"][$item_ref_id] as $type => $items) {
635  $caption = $lng->txt('crs_loc_tab_itest');
636  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
637  } else {
638  $caption = $lng->txt('crs_loc_tab_qtest');
639  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
640  }
641  foreach ($items as $objtv_title) {
642  $details[] = array(
643  'desc' => '',
644  'target' => '_top',
645  'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testsOverview'),
646  'name' => $caption . " (" . $this->lng->txt("crs_loc_learning_objective") . ": " . $objtv_title . ")"
647  );
648  }
649  $ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
650  }
651  }
652 
653  if (sizeof($details)) {
654  $a_item_list_gui->enableItemDetailLinks(true);
655  $a_item_list_gui->setItemDetailLinks($details, $lng->txt('crs_loc_settings_tbl') . ': ');
656  } else {
657  $a_item_list_gui->enableItemDetailLinks(false);
658  }
659  }
660 
661  // order
662  if ($this->getContainerGUI()->isActiveOrdering()) {
663  $a_item_list_gui->enableCommands(true, true);
664  $a_item_list_gui->enableProperties(false);
665  }
666  // view
667  elseif (!$this->getContainerGUI()->isActiveAdministrationPanel()) {
668  $a_item_list_gui->enableCommands(true, true);
669  $a_item_list_gui->enableProperties(false);
670  }
671 
672  if ($a_item['objective_id']) {
673  $a_item_list_gui->setDefaultCommandParameters(array('objective_id' => $a_item['objective_id']));
674 
675 
676  if ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
677  $a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
678  // check conditions of target
679  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
680  $fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
681  if (!$fullfilled || $a_item['objective_status']) {
682  $a_item_list_gui->disableTitleLink(true);
683  }
684  }
685  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
687  $this->getContainerObject()->getId(),
688  $GLOBALS['ilUser']->getId(),
689  $a_item['objective_id'],
691  );
692 
693  $res = $this->updateResult($res, $a_item['ref_id'], $a_item['objective_id'], $GLOBALS['ilUser']->getId());
694 
695  if ($res['is_final']) {
696  $a_item_list_gui->disableTitleLink(true);
697  $a_item_list_gui->enableProperties(true);
698  $a_item_list_gui->addCustomProperty(
699  $this->lng->txt('crs_loc_passes_reached'),
700  '',
701  true
702  );
703  } elseif ($this->loc_settings->getQualifiedTest() == $a_item['ref_id']) {
704  include_once './Modules/Course/classes/class.ilCourseObjective.php';
705  $poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']);
706 
707  if ($poss_pass) {
708  $a_item_list_gui->enableProperties(true);
709  $a_item_list_gui->addCustomProperty(
710  $this->lng->txt('crs_loc_passes_left'),
711  (($poss_pass - $res['tries']) > 0) ? ($poss_pass - $res['tries']) : 1,
712  false
713  );
714  }
715  }
716  }
717  }
setConditionTarget($a_ref_id, $a_obj_id, $a_target_type)
static lookupMaxPasses($a_objective_id)
$type
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.
global $ilCtrl
Definition: ilias.php:18
addCustomProperty( $a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property
foreach($_POST as $key=> $value) $res
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.
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
$url
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 1234 of file class.ilContainerObjectiveGUI.php.

References ilContainerContentGUI\$tpl.

Referenced by renderObjective(), and showMaterials().

1235  {
1236  $tpl = new ilTemplate("tpl.objective_accordion_content.html", true, true, "Services/Container");
1237  foreach ($a_items as $item) {
1238  $tpl->setCurrentBlock("items_bl");
1239  $tpl->setVariable("ITEM", $item);
1240  $tpl->parseCurrentBlock();
1241  }
1242  return $tpl->get();
1243  }
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 1208 of file class.ilContainerObjectiveGUI.php.

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

Referenced by renderObjective().

1209  {
1210  $tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "Services/Container");
1211 
1212  if ($a_lo_result) {
1213  $tpl->setVariable(
1214  "PROGRESS_BAR",
1215  self::buildObjectiveProgressBar(
1216  (bool) $this->loc_settings->worksWithInitialTest(),
1217  $a_objective->getObjectiveId(),
1218  $a_lo_result
1219  )
1220  );
1221  }
1222 
1223  // $tpl->setVariable("ICON_SRC", ilObject::_getIcon($a_objective->getObjectiveId(), "small", "lobj"));
1224  // $tpl->setVariable("ICON_TXT", $this->lng->txt("icon")." ".$this->lng->txt("crs_objectives"));
1225  $tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective") . ": " . trim($a_objective->getTitle()));
1226  $tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
1227 
1228  // #15510
1229  $tpl->setVariable("ANCHOR_ID", "objtv_acc_" . $a_objective->getObjectiveId());
1230 
1231  return $tpl->get();
1232  }
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 540 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().

541  {
542  $objective_map = array();
543  include_once './Modules/Course/classes/class.ilCourseObjective.php';
544  // begin-patch lok
545  if (count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
546  // end-patch lok
547  include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
548  foreach ($objective_ids as $objective_id) {
549  foreach (ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id) as $mat_ref_id) {
550  $objective_map["material"][$mat_ref_id][] = $objective_id;
551 
552  if (!isset($objective_map["names"][$objective_id])) {
553  $objective = new ilCourseObjective($this->getContainerObject(), $objective_id);
554  $objective_map["names"][$objective_id] = $objective->getTitle();
555  }
556  }
557  }
558 
559  // initial/qualifying test
560  $tst = $this->loc_settings->getInitialTest();
561  if ($tst) {
562  $objective_map["test_i"] = $tst;
563  }
564  $tst = $this->loc_settings->getQualifiedTest();
565  if ($tst) {
566  $objective_map["test_q"] = $tst;
567  }
568 
569  // objective test assignments
570  include_once 'Modules/Course/classes/Objectives/class.ilLOSettings.php';
571  include_once 'Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
572  $ass_test = new ilLOTestAssignments($this->getContainerObject()->getId());
573  foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_INITIAL) as $ass) {
574  $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
575  $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
576  }
577  foreach ($ass_test->getAssignmentsByType(ilLOSettings::TYPE_TEST_QUALIFIED) as $ass) {
578  $title = ilCourseObjective::lookupObjectiveTitle($ass->getObjectiveId());
579  $objective_map["test_ass"][$ass->getTestRefId()][$ass->getAssignmentType()][] = $title;
580  }
581  }
582 
583  return $objective_map;
584  }
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 1108 of file class.ilContainerObjectiveGUI.php.

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

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

1109  {
1110  global $DIC;
1111 
1112  $lng = $DIC->language();
1113 
1114  // tooltip (has to be unique!)
1115 
1116  $tooltip_id = "crsobjtvusr_" . $a_objective_id . "_" . $a_lo_result["type"] . "_" . ((int) $a_sub);
1117  if ($a_tt_suffix !== null) {
1118  $tooltip_id .= "_" . $a_tt_suffix;
1119  }
1120 
1121  $tt_txt = sprintf(
1122  $lng->txt("crs_loc_tt_info"),
1123  $a_lo_result["result_perc"],
1124  $a_lo_result["limit_perc"]
1125  );
1126 
1127 
1128  include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
1129  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
1130 
1131  $is_qualified = ($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED);
1132  $is_qualified_initial = ($a_lo_result['type'] == ilLOUserResults::TYPE_INITIAL &&
1133  ilLOSettings::getInstanceByObjId($a_lo_result['course_id'])->isInitialTestQualifying());
1134  $has_completed = ($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED);
1135 
1136  $next_step = $progress_txt = $bar_color = $test_url = $initial_sub = null;
1137 
1138  if ($is_qualified ||
1139  $is_qualified_initial) {
1140  $progress_txt = $lng->txt("crs_loc_progress_result_qtest");
1141  $tt_txt = $lng->txt("crs_loc_tab_qtest") . ": " . $tt_txt;
1142 
1143  if ($has_completed) {
1144  $next_step = $lng->txt("crs_loc_progress_objective_complete");
1145  $bar_color = "ilCourseObjectiveProgressBarCompleted";
1146 
1147  // render 2nd progressbar if there is also an initial test
1148  if ($is_qualified &&
1149  $a_has_initial_test &&
1150  is_array($a_lo_result["initial"])) {
1151  $a_lo_result["initial"]["itest"] = $a_lo_result["itest"];
1152 
1153  // force list mode to get rid of next step
1154  $initial_sub = self::buildObjectiveProgressBar(true, $a_objective_id, $a_lo_result["initial"], true, true, $a_tt_suffix);
1155  }
1156  } else {
1157  $next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
1158  $bar_color = "ilCourseObjectiveProgressBarFailed";
1159  }
1160  }
1161  // initial test
1162  else {
1163  if ($a_lo_result["status"]) {
1164  $progress_txt = $lng->txt("crs_loc_progress_result_itest");
1165  $tt_txt = $lng->txt("crs_loc_tab_itest") . ": " . $tt_txt;
1166 
1167  $bar_color = "ilCourseObjectiveProgressBarNeutral";
1168  $next_step = $has_completed
1169  ? $lng->txt("crs_loc_progress_do_qualifying")
1170  : $lng->txt("crs_loc_suggested");
1171  }
1172  // not attempted: no progress bar
1173  else {
1174  $next_step = (bool) $a_has_initial_test
1175  ? $lng->txt("crs_loc_progress_no_result_do_initial")
1176  : $lng->txt("crs_loc_progress_no_result_no_initial");
1177  }
1178  }
1179 
1180  // link to test results
1181  // - first try to fetch a link for qualifying test results
1182  if ($a_lo_result["qtest"]) {
1183  $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["qtest"], $a_lo_result["user_id"]);
1184  }
1185  // - when no qualifiying test results link was fetched, try for initial test
1186  if (!$test_url && $a_lo_result["itest"]) {
1187  $test_url = ilLOUtils::getTestResultLinkForUser($a_lo_result["itest"], $a_lo_result["user_id"]);
1188  }
1189 
1190  return self::renderProgressBar(
1191  $a_lo_result["result_perc"],
1192  $a_lo_result["limit_perc"],
1193  $bar_color,
1194  $progress_txt,
1195  $test_url,
1196  $tooltip_id,
1197  $tt_txt,
1198  $a_list_mode
1199  ? null
1200  : $next_step,
1201  $initial_sub,
1202  $a_list_mode
1203  ? 30
1204  : 10
1205  );
1206  }
static getInstanceByObjId($a_obj_id)
get singleton instance
global $DIC
Definition: saml.php:7
static getTestResultLinkForUser($a_test_ref_id, $a_user_id)
+ 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 109 of file class.ilContainerObjectiveGUI.php.

Referenced by renderObjective().

110  {
111  // no details anymore
112  return self::DETAILS_ALL;
113  }
+ Here is the caller graph for this function:

◆ getMainContent()

ilContainerObjectiveGUI::getMainContent ( )

Impementation of abstract method getMainContent.

public

Returns

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

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

122  {
123  $lng = $this->lng;
124  $ilTabs = $this->tabs;
125  $ilAccess = $this->access;
127 
128  // see bug #7452
129  // $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
130 
131 
132  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
133 
134  $tpl = new ilTemplate("tpl.container_page.html", true, true, "Services/Container");
135 
136  if ($GLOBALS['ilAccess']->checkAccess('write', '', $this->getContainerObject()->getRefId())) {
137  // check for results
138  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
139  if (ilLOUserResults::hasResults($this->getContainerObject()->getId(), $GLOBALS['ilUser']->getId())) {
140  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
141  $ilToolbar = new ilToolbarGUI();
142  $ilToolbar->addButton(
143  $lng->txt('crs_reset_results'),
144  $GLOBALS['ilCtrl']->getLinkTargetByClass(get_class($this->getContainerGUI()), 'reset')
145  );
146  }
147  }
148 
149  // Feedback
150  // @todo
151  // $this->__showFeedBack();
152 
153  $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
154 
155  $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
156  $is_order = $this->getContainerGUI()->isActiveOrdering();
157 
158  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
159  $this->loc_settings = ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId());
160 
161  $this->initRenderer();
162 
163  if (!$is_manage && !$is_order) {
164  // currently inactive
165  // $this->showStatus($tpl);
166  }
167  if (!$is_manage) {
168  $this->showObjectives($tpl, $is_order);
169 
170  // $this->showMaterials($tpl,self::MATERIALS_TESTS, false, !$is_order);
171 
172  // check for results
173  include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
174  $has_results = ilLOUserResults::hasResults($this->getContainerObject()->getId(), $ilUser->getId());
175 
176  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
177  $tst_obj_id = ilObject::_lookupObjId($this->loc_settings->getInitialTest());
178 
179  if (
180  $this->loc_settings->getInitialTest() &&
181  $this->loc_settings->isGeneralInitialTestVisible() &&
182  !$this->loc_settings->isInitialTestStart() &&
184  ) {
185  $this->output_html .= $this->renderTest($this->loc_settings->getInitialTest(), null, true, true);
186  } elseif (
187  $this->loc_settings->getQualifiedTest() &&
188  $this->loc_settings->isGeneralQualifiedTestVisible()
189  ) {
190  $this->output_html .= $this->renderTest($this->loc_settings->getQualifiedTest(), null, false, true);
191  }
192 
193  $this->showMaterials($tpl, self::MATERIALS_OTHER, false, !$is_order);
194  } else {
195  $this->showMaterials($tpl, null, $is_manage);
196  }
197 
198  // reset results by setting or for admins
199  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
200  if (
201  ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId())->isResetResultsEnabled() or
202  $GLOBALS['ilAccess']->checkAccess('write', '', $this->getContainerObject()->getRefId())
203  ) {
204  if ($has_results) {
205  if (!$is_manage && !$is_order) {
206  $this->showButton('askReset', $lng->txt('crs_reset_results'));
207  }
208  }
209  }
210 
211  $tpl->setVariable('CONTAINER_PAGE_CONTENT', $this->output_html);
212 
213  return $tpl->get();
214  }
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.
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())
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 95 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 87 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 967 of file class.ilContainerObjectiveGUI.php.

References $ilUser, and ilContainerContentGUI\$user.

Referenced by __construct().

968  {
970 
971  // no details
972  return;
973  }
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ initTestAssignments()

ilContainerObjectiveGUI::initTestAssignments ( )
protected

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

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

Referenced by __construct().

976  {
977  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
978  $this->test_assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
979  }
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 986 of file class.ilContainerObjectiveGUI.php.

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

Referenced by showObjectives().

987  {
989 
990  $res = array();
991 
992  include_once "Modules/Course/classes/Objectives/class.ilLOTestAssignments.php";
993  $lo_ass = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
994 
995  include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
996  $lur = new ilLOUserResults($this->getContainerObject()->getId(), $ilUser->getId());
997  foreach ($lur->getCourseResultsForUserPresentation() as $objective_id => $types) {
998  // show either initial or qualified for objective
999  if (isset($types[ilLOUserResults::TYPE_INITIAL])) {
1000  $initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
1001  }
1002 
1003  // qualified test has priority
1004  if (isset($types[ilLOUserResults::TYPE_QUALIFIED])) {
1007  $result["initial"] = $types[ilLOUserResults::TYPE_INITIAL];
1008  } else {
1011  }
1012 
1013  $result["initial_status"] = $initial_status;
1014 
1015  $result["itest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_INITIAL);
1016  $result["qtest"] = $lo_ass->getTestByObjective($objective_id, ilLOSettings::TYPE_TEST_QUALIFIED);
1017 
1018  $res[$objective_id] = $result;
1019  }
1020 
1021  return $res;
1022  }
static getInstance($a_container_id)
Get instance by container id.
$result
foreach($_POST as $key=> $value) $res
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 755 of file class.ilContainerObjectiveGUI.php.

References $_GET, $ilUser, ilContainerContentGUI\$lng, $title, ilContainerContentGUI\$user, ilPageUtil\_existsAndNotEmpty(), ilObject\_lookupObjId(), ilLMObject\_lookupTitle(), array, buildAccordionContent(), 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().

756  {
758  $lng = $this->lng;
759 
760  include_once('./Modules/Course/classes/class.ilCourseObjective.php');
761  $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id);
762 
763  include_once('./Services/Container/classes/class.ilContainerSorting.php');
764  include_once('./Services/Object/classes/class.ilObjectActivation.php');
765  $items = ilObjectActivation::getItemsByObjective($a_objective_id);
766 
767  // sorting is handled by ilCourseObjectiveMaterials
768  // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
769 
770  include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
771  $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
772 
773  // #13381 - map material assignment to position
774  $sort_map = array();
775  foreach ($objectives_lm_obj->getMaterials() as $item) {
776  $sort_map[$item["lm_ass_id"]] = $item["position"];
777  }
778 
779  $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
780  $is_order = $this->getContainerGUI()->isActiveOrdering();
781 
782  $sort_content = array();
783 
784  foreach ($items as $item) {
785  if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
786  continue;
787  }
788 
789  $item_list_gui2 = $this->getItemGUI($item);
790  $item_list_gui2->enableIcon(true);
791 
792  if ($is_order || $a_accordion) {
793  $item_list_gui2->enableCommands(true, true);
794  $item_list_gui2->enableProperties(false);
795  }
796 
797  $chapters = $objectives_lm_obj->getChapters();
798  if (count($chapters)) {
799  $has_sections = false;
800  foreach ($chapters as $chapter) {
801  if ($chapter['ref_id'] != $item['child']) {
802  continue;
803  }
804  $has_sections = true;
805 
806  include_once './Modules/LearningModule/classes/class.ilLMObject.php';
807  $title = $item['title'] .
808  " &rsaquo; " . ilLMObject::_lookupTitle($chapter['obj_id']) .
809  " (" . $lng->txt('obj_' . $chapter['type']) . ")";
810 
811  $item_list_gui2->setDefaultCommandParameters(array(
812  "obj_id" => $chapter['obj_id'],
813  "focus_id" => $chapter['obj_id'],
814  "focus_return" => $this->container_obj->getRefId()));
815 
816  if ($is_order) {
817  $item_list_gui2->setPositionInputField(
818  "[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]",
819  sprintf('%d', $chapter['position']*10)
820  );
821  }
822 
823  $sub_item_html = $item_list_gui2->getListItemHTML(
824  $item['ref_id'],
825  $item['obj_id'],
826  $title,
827  $item['description']
828  );
829 
830  // #13381 - use materials order
831  $sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
832  $sort_content[$sort_key] = $sub_item_html;
833  }
834  }
835 
836  $this->rendered_items[$item['child']] = true;
837 
838  if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) {
839  if ($is_order) {
840  $item_list_gui2->setPositionInputField(
841  "[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]",
842  sprintf('%d', $sort_map[$lm_ass_id]*10)
843  );
844  }
845 
846  $sub_item_html = $item_list_gui2->getListItemHTML(
847  $item['ref_id'],
848  $item['obj_id'],
849  $item['title'],
850  $item['description']
851  );
852 
853  // #13381 - use materials order
854  $sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id;
855  $sort_content[$sort_key] = $sub_item_html;
856  }
857  }
858 
859  if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) {
860  $this->objective_list_gui->enableCommands(false);
861  } else {
862  $this->objective_list_gui->enableCommands(true);
863  }
864 
865  if ($is_order) {
866  $this->objective_list_gui->setPositionInputField(
867  "[lobj][" . $a_objective_id . "][0]",
868  $objective->__getPosition()*10
869  );
870  }
871 
872  ksort($sort_content);
873 
874  if (!$a_accordion) {
875  foreach ($sort_content as $sub_item_html) {
876  $this->objective_list_gui->addSubItemHTML($sub_item_html);
877  }
878 
879  return $this->objective_list_gui->getObjectiveListItemHTML(
880  0,
881  $a_objective_id,
882  $objective->getTitle(),
883  $objective->getDescription(),
884  ($is_manage || $is_order)
885  );
886  } else {
887  $acc_content = $sort_content;
888 
889  $initial_shown = false;
890  $initial_test_ref_id = $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL);
891  $initial_test_obj_id = ilObject::_lookupObjId($initial_test_ref_id);
892  include_once './Modules/Test/classes/class.ilObjTestAccess.php';
893 
894  if (
895  $initial_test_obj_id &&
896  $this->getSettings()->hasSeparateInitialTests() &&
898  ) {
899  $acc_content[] = $this->renderTest(
900  $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL),
901  $a_objective_id,
902  true,
903  false,
904  $a_lo_result
905  );
906  $initial_shown = true;
907  } elseif ($this->getSettings()->hasSeparateQualifiedTests()) {
908  $acc_content[] = $this->renderTest(
909  $this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED),
910  $a_objective_id,
911  false,
912  false,
913  $a_lo_result
914  );
915  }
916 
917 
918  /*
919  if($this->loc_settings->getInitialTest() &&
920  $this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL &&
921  !$a_lo_risult["initial_status"])
922  {
923  $acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result);
924  $initial_shown = true;
925  }
926  if(!$initial_shown &&
927  $this->loc_settings->getQualifiedTest() &&
928  $this->loc_settings->isQualifiedTestPerObjectiveVisible())
929  {
930  $acc_content[] = $this->renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id, false, false, $a_lo_result);
931  }
932  */
933 
934  $co_page = null;
935  include_once("./Services/COPage/classes/class.ilPageUtil.php");
936  if (ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) {
937  $a_has_lo_page = true;
938 
939  include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php';
940  $page_gui = new ilLOPageGUI($objective->getObjectiveId());
941 
942  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
943  $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0));
944  $page_gui->setPresentationTitle("");
945  $page_gui->setTemplateOutput(false);
946  $page_gui->setHeader("");
947 
948  $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>";
949  }
950 
951  $a_accordion->addItem(
952  $this->buildAccordionTitle($objective, $a_lo_result),
953  $co_page .
954  $this->buildAccordionContent($acc_content),
955  (isset($_GET["oobj"]) && (int) $_GET["oobj"] == $objective->getObjectiveId())
956  );
957  }
958  }
$_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.
static _lookupTitle($a_obj_id)
Lookup title.
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.
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 1039 of file class.ilContainerObjectiveGUI.php.

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

Referenced by ilStudyProgrammeProgressListGUI\buildProgressBar().

1040  {
1041  $tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container");
1042 
1043  if ($a_perc_result !== null) {
1044  $tpl->setCurrentBlock("statusbar_bl");
1045  $tpl->setVariable("PERC_STATUS", $a_perc_result);
1046  $tpl->setVariable("PERC_WIDTH", $a_perc_result);
1047  $tpl->setVariable("PERC_COLOR", $a_css);
1048  if ($a_perc_limit) {
1049  // :TODO: magic?
1050  $limit_pos = (99-(int) $a_perc_limit)*-1;
1051  $tpl->setVariable("LIMIT_POS", $limit_pos);
1052  }
1053  if ($a_tt_txt &&
1054  $a_tt_id) {
1055  $tpl->setVariable("TT_ID", $a_tt_id);
1056  }
1057  $tpl->parseCurrentBlock();
1058  }
1059 
1060  if ($a_caption) {
1061  if ($a_url) {
1062  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1063  $button = ilLinkButton::getInstance();
1064  $button->setCaption($a_caption, false);
1065  $button->setUrl($a_url);
1066 
1067  $tpl->setCurrentBlock("statustxt_bl");
1068  $tpl->setVariable("TXT_PROGRESS_STATUS", $button->render());
1069  $tpl->parseCurrentBlock();
1070  } else {
1071  $tpl->setCurrentBlock("statustxt_no_link_bl");
1072  $tpl->setVariable("TXT_PROGRESS_STATUS_NO_LINK", $a_caption);
1073  $tpl->parseCurrentBlock();
1074  }
1075  }
1076 
1077  if ($a_next_step) {
1078  $tpl->setCurrentBlock("nstep_bl");
1079  $tpl->setVariable("TXT_NEXT_STEP", $a_next_step);
1080  $tpl->parseCurrentBlock();
1081  }
1082 
1083  if ($a_tt_id &&
1084  $a_tt_txt) {
1085  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1086  ilTooltipGUI::addTooltip($a_tt_id, $a_tt_txt);
1087  }
1088 
1089  if ($a_sub) {
1090  $tpl->setVariable("SUB_STYLE", ' style="padding-left: ' . $a_sub_style . 'px;"');
1091  $tpl->setVariable("SUB_INIT", $a_sub);
1092  }
1093 
1094  return $tpl->get();
1095  }
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 383 of file class.ilContainerObjectiveGUI.php.

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

Referenced by getMainContent(), and renderObjective().

384  {
385  $node_data = [];
386  if ($a_test_ref_id) {
387  $node_data = $GLOBALS['tree']->getNodeData($a_test_ref_id);
388  }
389  if (!$node_data['child']) {
390  return '';
391  }
392 
393  // update ti
394  if ($a_objective_id) {
395  if ($a_is_initial) {
396  $title = sprintf($this->lng->txt('crs_loc_itst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
397  } else {
398  $title = sprintf($this->lng->txt('crs_loc_qtst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
399  }
400  $node_data['objective_id'] = $a_objective_id;
401  $node_data['objective_status'] =
402  (
403  $a_lo_result['status'] == ilLOUserResults::STATUS_COMPLETED ?
404  false :
405  false
406  );
407  } else {
408  $obj_id = ilObject::_lookupObjId($a_test_ref_id);
409  $title = ilObject::_lookupTitle($obj_id);
410 
411  $title .= (
412  ' (' .
413  (
414  $a_is_initial
415  ? $this->lng->txt('crs_loc_itest_info')
416  : $this->lng->txt('crs_loc_qtest_info')
417  ) .
418  ')'
419  );
420  $node_data['objective_id'] = 0;
421  }
422 
423  $node_data['title'] = $title;
424 
425  return "<div class='ilContObjectivesViewTestItem'>" . $this->renderItem($node_data) . "</div>";
426  }
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)
renderItem($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
Render an item.
+ 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 1252 of file class.ilContainerObjectiveGUI.php.

References ilContainerContentGUI\$ctrl, $ilCtrl, and $toolbar.

Referenced by getMainContent(), and showObjectives().

1253  {
1254  $ilToolbar = $this->toolbar;
1255  $ilCtrl = $this->ctrl;
1256 
1257  // #11842
1258  $ilToolbar->addButton(
1259  $a_text,
1260  $ilCtrl->getLinkTarget($this->getContainerGUI(), $a_cmd),
1261  $a_target,
1262  "",
1263  '',
1264  $a_id
1265  );
1266  }
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 435 of file class.ilContainerObjectiveGUI.php.

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

Referenced by getMainContent().

436  {
437  $ilAccess = $this->access;
438  $lng = $this->lng;
439 
441 
442  if (is_array($this->items["_all"])) {
443  $this->objective_map = $this->buildObjectiveMap();
444 
445  // all rows
446  $item_r = array();
447 
448  $position = 1;
449  foreach ($this->items["_all"] as $k => $item_data) {
450  if ($a_mode == self::MATERIALS_TESTS and $item_data['type'] != 'tst') {
451  continue;
452  }
453  if ($item_data['type'] == 'itgr') {
454  continue;
455  }
456  if (!$a_is_manage) {
457  // if test object is qualified or initial do not show here
458  include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
459  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
460  $assignments = ilLOTestAssignments::getInstance($this->getContainerObject()->getId());
461  if ($assignments->getTypeByTest($item_data['child']) != ilLOSettings::TYPE_TEST_UNDEFINED) {
462  continue;
463  }
464  }
465 
466  if ($this->rendered_items[$item_data["child"]] !== true &&
467  !$this->renderer->hasItem($item_data["child"])) {
468  $this->rendered_items[$item_data['child']] = true;
469 
470  // TODO: Position (DONE ?)
471  $html = $this->renderItem($item_data, $position++, $a_mode == self::MATERIALS_TESTS ? false : true);
472  if ($html != "") {
473  $item_r[] = array("html" => $html, "id" => $item_data["child"], "type" => $item_data["type"]);
474  }
475  }
476  }
477 
478  // if we have at least one item, output the block
479  if (count($item_r) > 0) {
480  if (!$a_as_accordion) {
481  $pos = 0;
482 
483  switch ($a_mode) {
484  case self::MATERIALS_TESTS:
485  $block_id = "tst";
486  $this->renderer->addTypeBlock($block_id);
487  break;
488 
489  case self::MATERIALS_OTHER:
490  $block_id = "oth";
491  $this->renderer->addCustomBlock($block_id, $lng->txt('crs_other_resources'));
492  break;
493 
494  // manage
495  default:
496  $block_id = "all";
497  $this->renderer->addCustomBlock($block_id, $lng->txt('content'));
498  break;
499  }
500 
501  // :TODO:
502  if ($a_mode != self::MATERIALS_TESTS) {
503  $pos = $this->getItemGroupsHTML();
504  }
505 
506  foreach ($item_r as $h) {
507  if (!$this->renderer->hasItem($h["id"])) {
508  $this->renderer->addItemToBlock($block_id, $h["type"], $h["id"], $h["html"]);
509  }
510  }
511 
512  $this->output_html .= $this->renderer->getHTML();
513  } else {
514  switch ($a_mode) {
515  case self::MATERIALS_TESTS:
516  $txt = $lng->txt('objs_tst');
517  break;
518 
519  case self::MATERIALS_OTHER:
520  $txt = $lng->txt('crs_other_resources');
521  break;
522  }
523 
524  include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
525  $acc = new ilAccordionGUI();
526  $acc->setId("crsobjtvmat" . $a_mode . "_" . $this->container_obj->getId());
527 
528  $acc_content = array();
529  foreach ($item_r as $h) {
530  $acc_content[] = $h["html"];
531  }
532  $acc->addItem($txt, $this->buildAccordionContent($acc_content));
533 
534  $this->output_html .= $acc->getHTML();
535  }
536  }
537  }
538  }
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:11
Create styles array
The data for the language used.
clearAdminCommandsDetermination()
cleaer administration commands determination
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 247 of file class.ilContainerObjectiveGUI.php.

References $GLOBALS, $html, $ilSetting, ilContainerContentGUI\$lng, $output_html, ilContainerContentGUI\$settings, 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().

248  {
249  $lng = $this->lng;
251 
253 
254  // get embedded blocks
255  $has_container_page = false;
256  if (!$a_is_order) {
257  $output_html = $this->getContainerGUI()->getContainerPageHTML();
258  if ($output_html != "") {
259  $has_container_page = true;
260  $this->output_html .= $this->insertPageEmbeddedBlocks($output_html);
261  }
262  unset($output_html);
263  }
264 
265  // All objectives
266  include_once './Modules/Course/classes/class.ilCourseObjective.php';
267  if (!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(), true))) {
268  return false;
269  }
270 
271  include_once('./Modules/Course/classes/class.ilCourseObjectiveListGUI.php');
272  $this->objective_list_gui = new ilCourseObjectiveListGUI();
273  $this->objective_list_gui->setContainerObject($this->getContainerGUI());
274  if ($ilSetting->get("icon_position_in_lists") == "item_rows") {
275  $this->objective_list_gui->enableIcon(true);
276  }
277 
278  $acc = null;
279  if (!$a_is_order) {
280  include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
281  $acc = new ilAccordionGUI();
282  $acc->setUseSessionStorage(true);
283  $acc->setAllowMultiOpened(true);
284  $acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
285  $acc->setId("crsobjtv_" . $this->container_obj->getId());
286  } else {
287  $this->renderer->addCustomBlock('lobj', $lng->txt('crs_objectives'));
288  }
289 
290  $lur_data = $this->parseLOUserResults();
291 
292  $has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest();
293 
294  $has_lo_page = false;
295  $obj_cnt = 0;
296  foreach ($objective_ids as $objective_id) {
297  include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
298  if (
299  $has_initial &&
300  (
301  !isset($lur_data[$objective_id]) or
303  $this->container_obj->getId(),
304  ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(),
305  $objective_id
306  )
307  )
308  ) {
309  $lur_data[$objective_id] = array("type"=>ilLOSettings::TYPE_TEST_INITIAL);
310  }
311 
312  if ($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id])) {
313  $this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html);
314  }
315  $obj_cnt++;
316  }
317 
318  // buttons for showing/hiding all objectives
319  if (!$a_is_order && $obj_cnt > 1) {
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  // add core co page css
328  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
329  $GLOBALS["tpl"]->setVariable(
330  "LOCATION_CONTENT_STYLESHEET",
332  );
333  $GLOBALS["tpl"]->setCurrentBlock("SyntaxStyle");
334  $GLOBALS["tpl"]->setVariable(
335  "LOCATION_SYNTAX_STYLESHEET",
337  );
338  $GLOBALS["tpl"]->parseCurrentBlock();
339  }
340 
341  // order/block
342  if ($a_is_order) {
343  $this->addFooterRow();
344 
345  $this->output_html .= $output_html . $this->renderer->getHTML();
346 
347  $this->renderer->resetDetails();
348  }
349  // view/accordion
350  else {
351  $this->output_html .= "<div class='ilCrsObjAcc'>" . $acc->getHTML() . "</div>";
352  }
353  }
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
static getContentStylePath($a_style_id, $add_random=true)
get content 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
global $ilSetting
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 223 of file class.ilContainerObjectiveGUI.php.

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

224  {
226  $lng = $this->lng;
227 
228  include_once('./Modules/Course/classes/class.ilCourseObjectiveResultCache.php');
229 
230  $status = ilCourseObjectiveResultCache::getStatus($ilUser->getId(), $this->getContainerObject()->getId());
231  if ($status == IL_OBJECTIVE_STATUS_EMPTY) {
232  return;
233  }
234  $info_tpl = new ilTemplate('tpl.crs_objectives_view_info_table.html', true, true, 'Modules/Course');
235  $info_tpl->setVariable("INFO_STRING", $lng->txt('crs_objectives_info_' . $status));
236 
237  $this->output_html .= $info_tpl->get();
238  }
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
+ 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 719 of file class.ilContainerObjectiveGUI.php.

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

Referenced by addItemDetails().

720  {
721  if ($this->loc_settings->getQualifiedTest() == $a_item_ref_id) {
722  // Check for existing test run, and decrease tries, reset final if run exists
723  include_once './Modules/Test/classes/class.ilObjTest.php';
724  include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
726  $a_item_ref_id,
727  $a_user_id
728  );
729 
730  if ($active) {
731  include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
733  ilObject::_lookupObjId($a_item_ref_id),
734  $a_objective_id,
735  $a_user_id
736  )) {
737  ($a_res['tries'] > 0) ? --$a_res['tries'] : 0;
738  $a_res['is_final'] = 0;
739  }
740  }
741  }
742  return $a_res;
743  }
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 47 of file class.ilContainerObjectiveGUI.php.

◆ $loc_settings

ilContainerObjectiveGUI::$loc_settings
protected

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

Referenced by getSettings().

◆ $output_html

ilContainerObjectiveGUI::$output_html = ''
private

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

Referenced by showObjectives().

◆ $tabs

ilContainerObjectiveGUI::$tabs
protected

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

Referenced by getMainContent().

◆ $test_assignments

ilContainerObjectiveGUI::$test_assignments = null
private

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

Referenced by getTestAssignments().

◆ $toolbar

ilContainerObjectiveGUI::$toolbar
protected

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

Referenced by showButton().

◆ MATERIALS_OTHER

const ilContainerObjectiveGUI::MATERIALS_OTHER = 2

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

◆ MATERIALS_TESTS

const ilContainerObjectiveGUI::MATERIALS_TESTS = 1

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


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