ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 getDetailsLevel ($a_objective_id)
 get details level
 getMainContent ()
 Impementation of abstract method getMainContent.
 showStatus ($tpl)
 show status
 showObjectives ($a_tpl, $a_is_order=false)
 show objectives
 addFooterRow ()
 add footer row
 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 Member Functions inherited from ilContainerContentGUI
 __construct (&$container_gui_obj)
 Constructor.
 getContainerObject ()
 Get container object.
 getContainerGUI ()
 Get container GUI object.
 setOutput ()
 Sets view output into column layout.
 determinePageEmbeddedBlocks ($a_container_page_html)
 Determine all blocks that are embedded in the container page.
 addEmbeddedBlock ($block_type, $block_parameter)
 Add embedded block.
 getEmbeddedBlocks ()
 Get page embedded blocks.
 renderPageEmbeddedBlocks ()
 Render Page Embedded Blocks.
 renderItem ($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
 Render an item.
 insertPageEmbeddedBlocks ($a_output_html)
 Insert blocks into container page.
 getGroupedObjTypes ()
 Get grouped repository object types.
 getIntroduction ()
 Get introduction.
 getItemGroupsHTML ($a_pos=0)
 Get item groups HTML.
 renderItemGroup ($a_itgr)
 Render item group.

Static Public Member Functions

static buildObjectiveProgressBar ($a_has_initial_test, $a_objective_id, array $a_lo_result, $a_list_mode=false)

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
 initDetails ()
 init details
 parseLOUserResults ()
 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
- Protected Member Functions inherited from ilContainerContentGUI
 getRightColumnHTML ()
 Get HTML for right column.
 getCenterColumnHTML ()
 Get HTML for center column.
 initRenderer ()
 Init container renderer.
 clearAdminCommandsDetermination ()
 cleaer administration commands determination
 determineAdminCommands ($a_ref_id, $a_admin_com_included_in_list=false)
 determin admin commands
 getItemGUI ($item_data, $a_show_path=false)
 Get ListGUI object for item.

Protected Attributes

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

Private Attributes

 $output_html = ''

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

ilContainerObjectiveGUI::__construct (   $a_container_gui)

Constructor.

public

Parameters
objectcontainer gui object
Returns

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

References $lng, and initDetails().

{
global $lng;
$this->lng = $lng;
parent::__construct($a_container_gui);
$this->initDetails();
}

+ Here is the call graph for this function:

Member Function Documentation

ilContainerObjectiveGUI::addFooterRow ( )

add footer row

public

Parameters
@return

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

Referenced by showObjectives().

{
// no details
return;
/*
global $ilCtrl;
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->getRefId());
$ilCtrl->setParameterByClass("ilrepositorygui", "details_level", "1");
$url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
$this->renderer->addDetailsLevel(2, $url, ($this->details_level == self::DETAILS_TITLE));
$ilCtrl->setParameterByClass("ilrepositorygui", "details_level", "2");
$url = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
$this->renderer->addDetailsLevel(3, $url, ($this->details_level == self::DETAILS_ALL));
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
*/
}

+ Here is the caller graph for this function:

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

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

References $GLOBALS, $ilCtrl, $lng, $res, ilConditionHandler\_checkAllConditionsOfTarget(), ilObjectListGUI\addCustomProperty(), 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, and updateResult().

{
global $lng, $ilCtrl;
$item_ref_id = $a_item["ref_id"];
if(is_array($this->objective_map))
{
$details = array();
if(isset($this->objective_map["material"][$item_ref_id]))
{
// #12965
foreach($this->objective_map["material"][$item_ref_id] as $objective_id)
{
$ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', $objective_id);
$url = $ilCtrl->getLinkTargetByClass(array('illoeditorgui', 'ilcourseobjectivesgui'), 'edit');
$ilCtrl->setParameterByClass('ilcourseobjectivesgui', 'objective_id', '');
$details[] = array(
'desc' => $lng->txt('crs_loc_tab_materials').': ',
'target' => '_top',
'link' => $url,
'name' => $this->objective_map["names"][$objective_id]
);
}
}
if($this->objective_map["test_i"] == $item_ref_id)
{
$ilCtrl->setParameterByClass('illoeditorgui', 'tt', 1);
$details[] = array(
'desc' => '',
'target' => '_top',
'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
'name' => $lng->txt('crs_loc_tab_itest')
);
$ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
}
if($this->objective_map["test_q"] == $item_ref_id)
{
$ilCtrl->setParameterByClass('illoeditorgui', 'tt', 2);
$details[] = array(
'desc' => '',
'target' => '_top',
'link' => $ilCtrl->getLinkTargetByClass('illoeditorgui', 'testOverview'),
'name' => $lng->txt('crs_loc_tab_qtest')
);
$ilCtrl->setParameterByClass('illoeditorgui', 'tt', 0);
}
if(sizeof($details))
{
$a_item_list_gui->enableItemDetailLinks(true);
$a_item_list_gui->setItemDetailLinks($details, $lng->txt('crs_loc_settings_tbl').': ');
}
else
{
$a_item_list_gui->enableItemDetailLinks(false);
}
}
// order
if($this->getContainerGUI()->isActiveOrdering())
{
$a_item_list_gui->enableCommands(true, true);
$a_item_list_gui->enableProperties(false);
}
// view
else if(!$this->getContainerGUI()->isActiveAdministrationPanel())
{
$a_item_list_gui->enableCommands(true, true);
$a_item_list_gui->enableProperties(false);
}
if($a_item['objective_id'])
{
$a_item_list_gui->setDefaultCommandParameters(array('objective_id' => $a_item['objective_id']));
if($this->loc_settings->getQualifiedTest() == $a_item['ref_id'])
{
$a_item_list_gui->setConditionTarget($this->getContainerObject()->getRefId(), $a_item['objective_id'], 'lobj');
// check conditions of target
include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
$fullfilled = ilConditionHandler::_checkAllConditionsOfTarget($this->getContainerObject()->getRefId(),$a_item['objective_id'],'lobj');
if(!$fullfilled || $a_item['objective_status'])
{
$a_item_list_gui->disableTitleLink(true);
}
}
include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
$this->getContainerObject()->getId(),
$GLOBALS['ilUser']->getId(),
$a_item['objective_id'],
$res = $this->updateResult($res,$a_item['ref_id'],$a_item['objective_id'],$GLOBALS['ilUser']->getId());
if($res['is_final'])
{
$a_item_list_gui->disableTitleLink(true);
$a_item_list_gui->enableProperties(true);
$a_item_list_gui->addCustomProperty(
$this->lng->txt('crs_loc_passes_reached'),
'',
true
);
}
elseif($this->loc_settings->getQualifiedTest() == $a_item['ref_id'])
{
include_once './Modules/Course/classes/class.ilCourseObjective.php';
$poss_pass = ilCourseObjective::lookupMaxPasses($a_item['objective_id']);
if($poss_pass)
{
$a_item_list_gui->enableProperties(true);
$a_item_list_gui->addCustomProperty(
$this->lng->txt('crs_loc_passes_left'),
(($poss_pass - $res['tries']) > 0) ? ($poss_pass - $res['tries']) : 1,
false
);
}
}
}
}

+ Here is the call graph for this function:

ilContainerObjectiveGUI::buildAccordionContent ( array  $a_items)
protected

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

References $tpl.

Referenced by showMaterials().

{
$tpl = new ilTemplate("tpl.objective_accordion_content.html", true, true, "Services/Container");
foreach($a_items as $item)
{
$tpl->setCurrentBlock("items_bl");
$tpl->setVariable("ITEM", $item);
$tpl->parseCurrentBlock();
}
return $tpl->get();
}

+ Here is the caller graph for this function:

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

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

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

Referenced by renderObjective().

{
$tpl = new ilTemplate("tpl.objective_accordion_title.html", true, true, "Services/Container");
if($a_lo_result)
{
$tpl->setVariable("PROGRESS_BAR", self::buildObjectiveProgressBar(
(bool)$this->loc_settings->getInitialTest(),
$a_objective->getObjectiveId(),
$a_lo_result)
);
}
// $tpl->setVariable("ICON_SRC", ilObject::_getIcon($a_objective->getObjectiveId(), "small", "lobj"));
// $tpl->setVariable("ICON_TXT", $this->lng->txt("icon")." ".$this->lng->txt("crs_objectives"));
$tpl->setVariable("TITLE", $this->lng->txt("crs_loc_learning_objective").": ".trim($a_objective->getTitle()));
$tpl->setVariable("DESCRIPTION", nl2br(trim($a_objective->getDescription())));
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerObjectiveGUI::buildObjectiveMap ( )
protected

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

References ilCourseObjectiveMaterials\_getAssignedMaterials(), ilCourseObjective\_getObjectiveIds(), and ilContainerContentGUI\getContainerObject().

Referenced by showMaterials().

{
$objective_map = array();
include_once './Modules/Course/classes/class.ilCourseObjective.php';
// begin-patch lok
if(count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(),true)))
// end-patch lok
{
include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
foreach($objective_ids as $objective_id)
{
foreach(ilCourseObjectiveMaterials::_getAssignedMaterials($objective_id) as $mat_ref_id)
{
$objective_map["material"][$mat_ref_id][] = $objective_id;
if(!isset($objective_map["names"][$objective_id]))
{
$objective = new ilCourseObjective($this->getContainerObject(), $objective_id);
$objective_map["names"][$objective_id] = $objective->getTitle();
}
}
}
// initial/qualifying test
$tst = $this->loc_settings->getInitialTest();
if($tst)
{
$objective_map["test_i"] = $tst;
}
$tst = $this->loc_settings->getQualifiedTest();
if($tst)
{
$objective_map["test_q"] = $tst;
}
}
return $objective_map;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $lng, $tpl, ilTooltipGUI\addTooltip(), ilLOUserResults\STATUS_COMPLETED, and ilLOUserResults\TYPE_QUALIFIED.

Referenced by ilPortfolioPageGUI\renderMyCourses().

{
global $lng;
$tpl = new ilTemplate("tpl.objective_progressbar.html", true, true, "Services/Container");
$tooltip_id = "crsobjtvusr_".$a_objective_id;
$tt_txt = sprintf($lng->txt("crs_loc_tt_info"),
$a_lo_result["result_perc"], $a_lo_result["limit_perc"]);
// #12970
$perc_resize = (int)$a_lo_result["result_perc"];
/*
if($a_lo_result["limit_perc"] && $a_lo_result["result_perc"])
{
$perc_resize = min(round($a_lo_result["result_perc"]*(100/$a_lo_result["limit_perc"])), 100);
}
*/
$next_step = $progress_txt = $bar_color = null;
// qualifying test
if($a_lo_result["type"] == ilLOUserResults::TYPE_QUALIFIED)
{
$progress_txt = $lng->txt("crs_loc_progress_result_qtest");
$tt_txt = $lng->txt("crs_loc_tab_qtest").": ".$tt_txt;
if($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED)
{
$next_step = $lng->txt("crs_loc_progress_objective_complete");
$bar_color = "#80f080";
}
else
{
$next_step = $lng->txt("crs_loc_progress_do_qualifying_again");
$bar_color = "#f08080";
}
}
// initial test
else
{
if($a_lo_result["status"])
{
$progress_txt = $lng->txt("crs_loc_progress_result_itest");
$tt_txt = $lng->txt("crs_loc_tab_itest").": ".$tt_txt;
$bar_color = "#aaa";
if($a_lo_result["status"] == ilLOUserResults::STATUS_COMPLETED)
{
$next_step = $lng->txt("crs_loc_progress_do_qualifying");
}
else
{
$next_step = $lng->txt("crs_loc_suggested");
}
}
// not attempted: no progress bar
else
{
if((bool)$a_has_initial_test)
{
$next_step = $lng->txt("crs_loc_progress_no_result_do_initial");
}
else
{
$next_step = $lng->txt("crs_loc_progress_no_result_no_initial");
}
}
}
if($progress_txt)
{
$tpl->setCurrentBlock("statustxt_bl");
$tpl->setVariable("TXT_PROGRESS_STATUS", $progress_txt);
$tpl->parseCurrentBlock();
}
if($bar_color)
{
if($a_lo_result["limit_perc"])
{
$limit_pos = (121-ceil(125/100*$a_lo_result["limit_perc"]))*-1;
}
else
{
$limit_pos = -121;
}
$tpl->setCurrentBlock("statusbar_bl");
$tpl->setVariable("PERC_STATUS", $a_lo_result["result_perc"]);
$tpl->setVariable("LIMIT_POS", $limit_pos);
$tpl->setVariable("PERC_WIDTH", $perc_resize);
$tpl->setVariable("PERC_COLOR", $bar_color);
$tpl->setVariable("BG_COLOR", "#fff");
$tpl->setVariable("TT_ID", $tooltip_id);
$tpl->parseCurrentBlock();
}
if($next_step && !$a_list_mode)
{
$tpl->setCurrentBlock("nstep_bl");
$tpl->setVariable("TXT_NEXT_STEP", $next_step);
$tpl->parseCurrentBlock();
}
if($tt_txt)
{
include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
ilTooltipGUI::addTooltip($tooltip_id, $tt_txt);
}
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerObjectiveGUI::getDetailsLevel (   $a_objective_id)

get details level

public

Parameters
@return

Reimplemented from ilContainerContentGUI.

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

References ilContainerContentGUI\DETAILS_ALL.

Referenced by renderObjective().

{
// no details anymore
/*
if($a_objective_id == $this->force_details)
{
return self::DETAILS_ALL;
}
return $this->details_level;
*/
}

+ Here is the caller graph for this function:

ilContainerObjectiveGUI::getMainContent ( )

Impementation of abstract method getMainContent.

public

Returns

Reimplemented from ilContainerContentGUI.

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

References $GLOBALS, $lng, $tpl, ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), ilLOSettings\getInstanceByObjId(), ilLOUserResults\hasResults(), ilContainerContentGUI\initRenderer(), renderTest(), showButton(), showMaterials(), and showObjectives().

{
global $lng,$ilTabs,$ilAccess;
// see bug #7452
// $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
$tpl = new ilTemplate("tpl.container_page.html", true, true,"Services/Container");
if($GLOBALS['ilAccess']->checkAccess('write','',$this->getContainerObject()->getRefId()))
{
// check for results
include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
if(ilLOUserResults::hasResults($this->getContainerObject()->getId(),$GLOBALS['ilUser']->getId()))
{
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$ilToolbar = new ilToolbarGUI();
$ilToolbar->addButton(
$lng->txt('crs_reset_results'),
$GLOBALS['ilCtrl']->getLinkTargetByClass(get_class($this->getContainerGUI()),'reset')
);
}
}
// Feedback
// @todo
// $this->__showFeedBack();
$this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
$is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
$is_order = $this->getContainerGUI()->isActiveOrdering();
include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
$this->loc_settings = ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId());
$this->initRenderer();
if(!$is_manage && !$is_order)
{
// currently inactive
// $this->showStatus($tpl);
}
if(!$is_manage)
{
$this->showObjectives($tpl, $is_order);
// $this->showMaterials($tpl,self::MATERIALS_TESTS, false, !$is_order);
if(
$this->loc_settings->getQualifiedTest() &&
$this->loc_settings->isGeneralQualifiedTestVisible()
)
{
$this->output_html .= $this->renderTest($this->loc_settings->getQualifiedTest(), null, false, true);
}
$this->showMaterials($tpl,self::MATERIALS_OTHER, false, !$is_order);
}
else
{
$this->showMaterials($tpl, null, $is_manage);
}
// reset results by setting or for admins
include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
if(
ilLOSettings::getInstanceByObjId($this->getContainerObject()->getId())->isResetResultsEnabled() or
$GLOBALS['ilAccess']->checkAccess('write','',$this->getContainerObject()->getRefId())
)
{
// check for results
include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
if(ilLOUserResults::hasResults($this->getContainerObject()->getId(),$GLOBALS['ilUser']->getId()))
{
if (!$is_manage && !$is_order)
{
$this->showButton('askReset',$lng->txt('crs_reset_results'));
}
}
}
$tpl->setVariable('CONTAINER_PAGE_CONTENT',$this->output_html);
return $tpl->get();
}

+ Here is the call graph for this function:

ilContainerObjectiveGUI::initDetails ( )
protected

init details

protected

Parameters
@return

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

References $ilUser.

Referenced by __construct().

{
global $ilUser;
// no details
return;
/*
if(isset($_GET['details_level']))
{
$this->details_level = (int) $_GET['details_level'];
ilObjUser::_writePref($ilUser->getId(),'crs_objectives_details',$this->details_level);
}
else
{
$this->details_level = $ilUser->getPref('crs_objectives_details') ? $ilUser->getPref('crs_objectives_details') : self::DETAILS_TITLE;
}
if(isset($_GET['objective_details']))
{
$this->force_details = (int) $_GET['objective_details'];
ilObjUser::_writePref($ilUser->getId(),'crs_objectives_force_details_'.$this->getContainerObject()->getId(),$this->force_details);
}
elseif($details_id = $ilUser->getPref('crs_objectives_force_details_'.$this->getContainerObject()->getId()))
{
$this->force_details = $details_id;
}
else
{
include_once './Modules/Course/classes/class.ilCourseObjective.php';
include_once('./Modules/Course/classes/class.ilCourseObjectiveResultCache.php');
foreach(ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId()) as $objective_id)
{
if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->getId(),$objective_id))
{
$this->force_details = $objective_id;
break;
}
}
}
return true;
*/
}

+ Here is the caller graph for this function:

ilContainerObjectiveGUI::parseLOUserResults ( )
protected

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

References $ilUser, $res, $result, ilContainerContentGUI\getContainerObject(), ilLOUserResults\TYPE_INITIAL, and ilLOUserResults\TYPE_QUALIFIED.

Referenced by showObjectives().

{
global $ilUser;
$res = array();
include_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php";
$lur = new ilLOUserResults($this->getContainerObject()->getId(), $ilUser->getId());
foreach($lur->getCourseResultsForUserPresentation() as $objective_id => $types)
{
// show either initial or qualified for objective
if(isset($types[ilLOUserResults::TYPE_INITIAL]))
{
$initial_status = $types[ilLOUserResults::TYPE_INITIAL]["status"];
}
// qualified test has priority
{
$result = $types[ilLOUserResults::TYPE_QUALIFIED];
$result["type"] = ilLOUserResults::TYPE_QUALIFIED;
}
else
{
$result = $types[ilLOUserResults::TYPE_INITIAL];
$result["type"] = ilLOUserResults::TYPE_INITIAL;
}
$result["initial_status"] = $initial_status;
$res[$objective_id] = $result;
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

References $ilUser, $lng, ilPageUtil\_existsAndNotEmpty(), buildAccordionTitle(), ilContainerContentGUI\getContainerGUI(), ilContainerContentGUI\getContainerObject(), getDetailsLevel(), ilObjStyleSheet\getEffectiveContentStyleId(), ilContainerContentGUI\getItemGUI(), ilObjectActivation\getItemsByObjective(), ilLOSettings\LOC_INITIAL_SEL, and renderTest().

Referenced by showObjectives().

{
global $ilUser,$lng;
include_once('./Modules/Course/classes/class.ilCourseObjective.php');
$objective = new ilCourseObjective($this->getContainerObject(),$a_objective_id);
include_once('./Services/Container/classes/class.ilContainerSorting.php');
include_once('./Services/Object/classes/class.ilObjectActivation.php');
$items = ilObjectActivation::getItemsByObjective($a_objective_id);
// sorting is handled by ilCourseObjectiveMaterials
// $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
$objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
// #13381 - map material assignment to position
$sort_map = array();
foreach($objectives_lm_obj->getMaterials() as $item)
{
$sort_map[$item["lm_ass_id"]] = $item["position"];
}
$is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
$is_order = $this->getContainerGUI()->isActiveOrdering();
$sort_content = array();
foreach($items as $item)
{
if($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL)
{
continue;
}
$item_list_gui2 = $this->getItemGUI($item);
$item_list_gui2->enableIcon(true);
if($is_order || $a_accordion)
{
$item_list_gui2->enableCommands(true, true);
$item_list_gui2->enableProperties(false);
}
$chapters = $objectives_lm_obj->getChapters();
if(count($chapters))
{
$has_sections = false;
foreach($chapters as $chapter)
{
if($chapter['ref_id'] != $item['child'])
{
continue;
}
$has_sections = true;
include_once './Modules/LearningModule/classes/class.ilLMObject.php';
$title = $item['title'].
" &rsaquo; ".ilLMObject::_lookupTitle($chapter['obj_id']).
" (".$lng->txt('obj_'.$chapter['type']).")";
$item_list_gui2->setDefaultCommandParameters(array(
"obj_id" => $chapter['obj_id'],
"focus_id" => $chapter['obj_id'],
"focus_return" => $this->container_obj->getRefId()));
if($is_order)
{
$item_list_gui2->setPositionInputField("[lobj][".$a_objective_id."][".$chapter['lm_ass_id']."]",
sprintf('%d', $chapter['position']*10));
}
$sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'],
$item['obj_id'], $title, $item['description']);
// #13381 - use materials order
$sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT)."_".strtolower($title)."_".$chapter['lm_ass_id'];
$sort_content[$sort_key] = $sub_item_html;
}
}
$this->rendered_items[$item['child']] = true;
if($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true))
{
if($is_order)
{
$item_list_gui2->setPositionInputField("[lobj][".$a_objective_id."][".$lm_ass_id."]",
sprintf('%d', $sort_map[$lm_ass_id]*10));
}
$sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'],
$item['obj_id'], $item['title'], $item['description']);
// #13381 - use materials order
$sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT)."_".strtolower($item['title'])."_".$lm_ass_id;
$sort_content[$sort_key] = $sub_item_html;
}
}
if($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL)
{
$this->objective_list_gui->enableCommands(false);
}
else
{
$this->objective_list_gui->enableCommands(true);
}
if($is_order)
{
$this->objective_list_gui->setPositionInputField("[lobj][".$a_objective_id."][0]",
$objective->__getPosition()*10);
}
ksort($sort_content);
if(!$a_accordion)
{
foreach($sort_content as $sub_item_html)
{
$this->objective_list_gui->addSubItemHTML($sub_item_html);
}
return $this->objective_list_gui->getListItemHTML(
0,
$a_objective_id,
$objective->getTitle(),
$objective->getDescription(),
($is_manage || $is_order));
}
else
{
$acc_content = $sort_content;
$initial_shown = false;
if($this->loc_settings->getInitialTest() &&
$this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL &&
!$a_lo_result["initial_status"])
{
$acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result);
$initial_shown = true;
}
if(!$initial_shown &&
$this->loc_settings->getQualifiedTest() &&
$this->loc_settings->isQualifiedTestPerObjectiveVisible())
{
$acc_content[] = $this->renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id, false, false, $a_lo_result);
}
$co_page = null;
include_once("./Services/COPage/classes/class.ilPageUtil.php");
if(ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId()))
{
$a_has_lo_page = true;
include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php';
$page_gui = new ilLOPageGUI($objective->getObjectiveId());
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$page_gui->setPresentationTitle("");
$page_gui->setTemplateOutput(false);
$page_gui->setHeader("");
$co_page = "<div class='ilContObjectiveIntro'>".$page_gui->showPage()."</div>";
}
$a_accordion->addItem(
$this->buildAccordionTitle($objective, $a_lo_result),
$co_page.
$this->buildAccordionContent($acc_content)
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

Referenced by getMainContent(), and renderObjective().

{
$node_data = $GLOBALS['tree']->getNodeData($a_test_ref_id);
// update ti
if($a_objective_id)
{
if($a_is_initial)
{
$title = sprintf($this->lng->txt('crs_loc_itst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
}
else
{
$title = sprintf($this->lng->txt('crs_loc_qtst_for_objective'), ilCourseObjective::lookupObjectiveTitle($a_objective_id));
}
$node_data['objective_id'] = $a_objective_id;
$node_data['objective_status'] =
(
$a_lo_result['status'] == ilLOUserResults::STATUS_COMPLETED ?
false :
false
);
}
else
{
$obj_id = ilObject::_lookupObjId($a_test_ref_id);
$title = ilObject::_lookupTitle($obj_id);
$title .= (
' ('.
(
$a_is_initial
? $this->lng->txt('crs_loc_itest_info')
: $this->lng->txt('crs_loc_qtest_info')
).
')'
);
$node_data['objective_id'] = 0;
}
$node_data['title'] = $title;
return "<div class='ilContObjectivesViewTestItem'>".$this->renderItem($node_data)."</div>";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

show action button

protected

Parameters
@return

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

References $ilCtrl.

Referenced by getMainContent(), and showObjectives().

{
global $ilToolbar, $ilCtrl;
// #11842
$ilToolbar->addButton($a_text,
$ilCtrl->getLinkTarget($this->getContainerGUI(),$a_cmd),
$a_target, "", '', $a_id);
}

+ Here is the caller graph for this function:

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

References $lng, $txt, buildAccordionContent(), buildObjectiveMap(), ilContainerContentGUI\clearAdminCommandsDetermination(), ilContainerContentGUI\getItemGroupsHTML(), and ilContainerContentGUI\renderItem().

Referenced by getMainContent().

{
global $ilAccess, $lng;
if (is_array($this->items["_all"]))
{
$this->objective_map = $this->buildObjectiveMap();
// all rows
$item_r = array();
$position = 1;
foreach($this->items["_all"] as $k => $item_data)
{
if($a_mode == self::MATERIALS_TESTS and $item_data['type'] != 'tst')
{
continue;
}
if ($item_data['type'] == 'itgr')
{
continue;
}
if(!$a_is_manage)
{
// if test object is qualified or initial do not show here
if($this->objective_map["test_i"] && $item_data["child"] == $this->objective_map["test_i"])
{
continue;
}
if($this->objective_map["test_q"] && $item_data["child"] == $this->objective_map["test_q"])
{
continue;
}
}
if($this->rendered_items[$item_data["child"]] !== true &&
!$this->renderer->hasItem($item_data["child"]))
{
$this->rendered_items[$item_data['child']] = true;
// TODO: Position (DONE ?)
$html = $this->renderItem($item_data,$position++,$a_mode == self::MATERIALS_TESTS ? false : true);
if ($html != "")
{
$item_r[] = array("html" => $html, "id" => $item_data["child"], "type" => $item_data["type"]);
}
}
}
// if we have at least one item, output the block
if (count($item_r) > 0)
{
if(!$a_as_accordion)
{
$pos = 0;
switch($a_mode)
{
case self::MATERIALS_TESTS:
$block_id = "tst";
$this->renderer->addTypeBlock($block_id);
break;
case self::MATERIALS_OTHER:
$block_id = "oth";
$this->renderer->addCustomBlock($block_id, $lng->txt('crs_other_resources'));
break;
// manage
default:
$block_id = "all";
$this->renderer->addCustomBlock($block_id, $lng->txt('content'));
break;
}
// :TODO:
if ($a_mode != self::MATERIALS_TESTS)
{
$pos = $this->getItemGroupsHTML();
}
foreach($item_r as $h)
{
if(!$this->renderer->hasItem($h["id"]))
{
$this->renderer->addItemToBlock($block_id, $h["type"], $h["id"], $h["html"]);
}
}
$this->output_html .= $this->renderer->getHTML();
}
else
{
switch($a_mode)
{
case self::MATERIALS_TESTS:
$txt = $lng->txt('objs_tst');
break;
case self::MATERIALS_OTHER:
$txt = $lng->txt('crs_other_resources');
break;
}
include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
$acc = new ilAccordionGUI();
$acc->setId("crsobjtvmat".$a_mode."_".$this->container_obj->getId());
$acc_content = array();
foreach($item_r as $h)
{
$acc_content[] = $h["html"];
}
$acc->addItem($txt, $this->buildAccordionContent($acc_content));
$this->output_html .= $acc->getHTML();
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

show objectives

public

Parameters
object$tpltemplate object
Returns

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

References $GLOBALS, $ilSetting, $lng, $output_html, ilCourseObjective\_getObjectiveIds(), addFooterRow(), 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().

{
global $lng,$ilSetting;
// get embedded blocks
$has_container_page = false;
if(!$a_is_order)
{
$output_html = $this->getContainerGUI()->getContainerPageHTML();
if ($output_html != "")
{
$has_container_page = true;
$this->output_html .= $this->insertPageEmbeddedBlocks($output_html);
}
unset($output_html);
}
// All objectives
include_once './Modules/Course/classes/class.ilCourseObjective.php';
if(!count($objective_ids = ilCourseObjective::_getObjectiveIds($this->getContainerObject()->getId(),true)))
{
return false;
}
include_once('./Modules/Course/classes/class.ilCourseObjectiveListGUI.php');
$this->objective_list_gui = new ilCourseObjectiveListGUI();
$this->objective_list_gui->setContainerObject($this->getContainerGUI());
if ($ilSetting->get("icon_position_in_lists") == "item_rows")
{
$this->objective_list_gui->enableIcon(true);
}
$acc = null;
if(!$a_is_order)
{
include_once "Services/Accordion/classes/class.ilAccordionGUI.php";
$acc = new ilAccordionGUI();
$acc->setUseSessionStorage(true);
$acc->setAllowMultiOpened(true);
$acc->setBehaviour(ilAccordionGUI::FIRST_OPEN);
$acc->setId("crsobjtv_".$this->container_obj->getId());
}
else
{
$this->renderer->addCustomBlock('lobj',$lng->txt('crs_objectives'));
}
$lur_data = $this->parseLOUserResults();
$has_initial = ilLOSettings::getInstanceByObjId($this->container_obj->getId())->worksWithInitialTest();
$has_lo_page = false;
$obj_cnt = 0;
foreach($objective_ids as $objective_id)
{
include_once './Modules/Course/classes/Objectives/class.ilLOUtils.php';
if(
$has_initial &&
(
!isset($lur_data[$objective_id]) or
$this->container_obj->getId(),
ilLOSettings::getInstanceByObjId($this->container_obj->getId())->getInitialTest(),
$objective_id)
)
)
{
$lur_data[$objective_id] = array("type"=>ilLOSettings::TYPE_TEST_INITIAL);
}
if($html = $this->renderObjective($objective_id, $has_lo_page, $acc, $lur_data[$objective_id]))
{
$this->renderer->addItemToBlock('lobj', 'lobj', $objective_id, $html);
}
$obj_cnt++;
}
// buttons for showing/hiding all objectives
if (!$a_is_order && $obj_cnt > 1)
{
$this->showButton("", $lng->txt("crs_show_all_obj"), "", "crs_show_all_obj_btn");
$this->showButton("", $lng->txt("crs_hide_all_obj"), "", "crs_hide_all_obj_btn");
$acc->setShowAllElement("crs_show_all_obj_btn");
$acc->setHideAllElement("crs_hide_all_obj_btn");
}
if(!$has_container_page && $has_lo_page)
{
// add core co page css
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$GLOBALS["tpl"]->setVariable("LOCATION_CONTENT_STYLESHEET",
$GLOBALS["tpl"]->setCurrentBlock("SyntaxStyle");
$GLOBALS["tpl"]->setVariable("LOCATION_SYNTAX_STYLESHEET",
$GLOBALS["tpl"]->parseCurrentBlock();
}
// order/block
if($a_is_order)
{
$this->addFooterRow();
$this->output_html .= $output_html.$this->renderer->getHTML();
$this->renderer->resetDetails();
}
// view/accordion
else
{
$this->output_html .= "<div class='ilCrsObjAcc'>".$acc->getHTML()."</div>";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerObjectiveGUI::showStatus (   $tpl)

show status

public

Parameters
@return

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

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

{
global $ilUser,$lng;
include_once('./Modules/Course/classes/class.ilCourseObjectiveResultCache.php');
$status = ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->getId());
if($status == IL_OBJECTIVE_STATUS_EMPTY) {
return;
}
$info_tpl = new ilTemplate('tpl.crs_objectives_view_info_table.html',true,true,'Modules/Course');
$info_tpl->setVariable("INFO_STRING",$lng->txt('crs_objectives_info_'.$status));
$this->output_html .= $info_tpl->get();
}

+ Here is the call graph for this function:

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

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

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

Referenced by addItemDetails().

{
if($this->loc_settings->getQualifiedTest() == $a_item_ref_id)
{
// Check for existing test run, and decrease tries, reset final if run exists
include_once './Modules/Test/classes/class.ilObjTest.php';
include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
$a_item_ref_id,
$a_user_id);
if($active)
{
include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
ilObject::_lookupObjId($a_item_ref_id),
$a_objective_id,
$a_user_id))
{
($a_res['tries'] > 0) ? --$a_res['tries'] : 0;
$a_res['is_final'] = 0;
}
}
}
return $a_res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilContainerObjectiveGUI::$force_details = 0
protected

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

ilContainerObjectiveGUI::$loc_settings
protected

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

ilContainerObjectiveGUI::$output_html = ''
private

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

Referenced by showObjectives().

const ilContainerObjectiveGUI::MATERIALS_OTHER = 2

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

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: