ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilStudyProgrammeProgressListGUI Class Reference

Class ilStudyProgrammeProgressListGUI. More...

+ Inheritance diagram for ilStudyProgrammeProgressListGUI:
+ Collaboration diagram for ilStudyProgrammeProgressListGUI:

Public Member Functions

 __construct (ilStudyProgrammeUserProgress $a_progress)
 
 getHTML ()
 
 setShowInfoMessage ($show_info_mesage)
 
 setVisibleOnPDMode ($visible_on_pd_mode)
 
 setOnlyRelevant ($only_relevant)
 

Data Fields

const SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarCompleted"
 
const NON_SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarNeutral"
 

Protected Member Functions

 fillTemplate ($tpl)
 
 getTitleForItem (ilObjStudyProgramme $a_programme)
 
 getTemplate ($a_component, $a_file, $a_remove_unknown_vars, $a_remove_empty_blocks)
 
 getIconPath ($a_obj_id)
 
 getAltIcon ($a_obj_id)
 
 getTitleAndIconTarget (ilStudyProgrammeUserProgress $a_progress)
 
 buildProgressBar (ilStudyProgrammeUserProgress $a_progress)
 
 buildToolTip (ilStudyProgrammeUserProgress $a_progress)
 
 buildProgressStatus (ilStudyProgrammeUserProgress $a_progress)
 
 showMoreObjectsInfo ($programme)
 

Protected Attributes

 $il_lng
 
 $il_ctrl
 
 $progress
 
 $html
 
 $show_info_mesage
 
 $visible_on_pd_mode
 
 $only_relevant = false
 

Static Protected Attributes

static $tpl_file = "tpl.progress_list_item.html"
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeProgressListGUI::__construct ( ilStudyProgrammeUserProgress  $a_progress)

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

References $DIC, $ilCtrl, and $lng.

54  {
55  global $DIC;
56  $lng = $DIC['lng'];
57  $ilCtrl = $DIC['ilCtrl'];
58  $this->il_lng = $lng;
59  $this->il_lng->loadLanguageModule("prg");
60  $this->il_ctrl = $ilCtrl;
61 
62  $this->progress = $a_progress;
63  $this->tpl = null;
64  $this->html = null;
65  $this->show_info_mesage = false;
66  $this->visible_on_pd_mode = "read";
67  }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
global $DIC

Member Function Documentation

◆ buildProgressBar()

ilStudyProgrammeProgressListGUI::buildProgressBar ( ilStudyProgrammeUserProgress  $a_progress)
protected

Definition at line 139 of file class.ilStudyProgrammeProgressListGUI.php.

References buildProgressStatus(), buildToolTip(), ilStudyProgrammeUserProgress\getAmountOfPoints(), ilStudyProgrammeUserProgress\getCurrentAmountOfPoints(), ilStudyProgrammeUserProgress\getMaximumPossibleAmountOfPoints(), ilStudyProgrammeUserProgress\isSuccessful(), and ilContainerObjectiveGUI\renderProgressBar().

Referenced by fillTemplate().

139  {
140  $tooltip_id = "prg_".$a_progress->getId();
141 
142  $required_amount_of_points = $a_progress->getAmountOfPoints();
143  $maximum_possible_amount_of_points = $a_progress->getMaximumPossibleAmountOfPoints(true);
144  $current_amount_of_points = $a_progress->getCurrentAmountOfPoints();
145 
146  if ($maximum_possible_amount_of_points > 0) {
147  $current_percent = (int)($current_amount_of_points * 100 / $maximum_possible_amount_of_points);
148  $required_percent = (int)($required_amount_of_points * 100 / $maximum_possible_amount_of_points);
149  }
150  else {
151  if ($a_progress->isSuccessful()) {
152  $current_percent = 100;
153  $required_percent = 100;
154  }
155  else {
156  $current_percent = 0;
157  $required_percent = 0;
158  }
159  }
160 
161  //required to dodge bug in ilContainerObjectiveGUI::renderProgressBar
162  if($required_percent == 0) {
163  $required_percent = 0.1;
164  }
165 
166  $tooltip_txt = $this->buildToolTip($a_progress);
167  $progress_status = $this->buildProgressStatus($a_progress);
168 
169  if ($a_progress->isSuccessful()) {
170  $css_class = self::SUCCESSFUL_PROGRESS_CSS_CLASS;
171  }
172  else {
173  $css_class = self::NON_SUCCESSFUL_PROGRESS_CSS_CLASS;
174  }
175 
176  require_once("Services/Container/classes/class.ilContainerObjectiveGUI.php");
177  return ilContainerObjectiveGUI::renderProgressBar($current_percent, $required_percent, $css_class
178  , $progress_status, null, $tooltip_id, $tooltip_txt);
179  }
buildProgressStatus(ilStudyProgrammeUserProgress $a_progress)
getCurrentAmountOfPoints()
Get the amount of points the user currently achieved.
isSuccessful()
Check whether the user was successful on this node.
getAmountOfPoints()
Get the amount of points needed to complete the node.
buildToolTip(ilStudyProgrammeUserProgress $a_progress)
getMaximumPossibleAmountOfPoints($only_relevant=false)
Get the maximum possible amount of points a user can achieve for the completion of this node...
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildProgressStatus()

ilStudyProgrammeProgressListGUI::buildProgressStatus ( ilStudyProgrammeUserProgress  $a_progress)
protected

Definition at line 188 of file class.ilStudyProgrammeProgressListGUI.php.

References ilStudyProgrammeUserProgress\getAmountOfPoints(), ilStudyProgrammeUserProgress\getCurrentAmountOfPoints(), ilStudyProgrammeUserProgress\getMaximumPossibleAmountOfPoints(), and ilStudyProgrammeUserProgress\getStudyProgramme().

Referenced by buildProgressBar().

188  {
189  $lang_val = "prg_progress_status";
190  $max_points = $a_progress->getAmountOfPoints();
191  $study_programm = $a_progress->getStudyProgramme();
192 
193  if($study_programm->hasChildren() && !$study_programm->hasLPChildren()) {
194  $lang_val = "prg_progress_status_with_child_sp";
195  }
196 
197  if($a_progress->getStudyProgramme()->hasChildren()) {
198  $max_points = $a_progress->getMaximumPossibleAmountOfPoints($this->only_relevant);
199  }
200  return sprintf( $this->il_lng->txt($lang_val)
201  , $a_progress->getCurrentAmountOfPoints()
202  , $max_points
203  );
204  }
getCurrentAmountOfPoints()
Get the amount of points the user currently achieved.
getStudyProgramme()
Get the program node where this progress belongs to was made.
getAmountOfPoints()
Get the amount of points needed to complete the node.
getMaximumPossibleAmountOfPoints($only_relevant=false)
Get the maximum possible amount of points a user can achieve for the completion of this node...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildToolTip()

ilStudyProgrammeProgressListGUI::buildToolTip ( ilStudyProgrammeUserProgress  $a_progress)
protected

Definition at line 181 of file class.ilStudyProgrammeProgressListGUI.php.

References ilStudyProgrammeUserProgress\getAmountOfPoints(), and ilStudyProgrammeUserProgress\getCurrentAmountOfPoints().

Referenced by buildProgressBar().

181  {
182  return sprintf( $this->il_lng->txt("prg_progress_info")
183  , $a_progress->getCurrentAmountOfPoints()
184  , $a_progress->getAmountOfPoints()
185  );
186  }
getCurrentAmountOfPoints()
Get the amount of points the user currently achieved.
getAmountOfPoints()
Get the amount of points needed to complete the node.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillTemplate()

ilStudyProgrammeProgressListGUI::fillTemplate (   $tpl)
protected

Definition at line 78 of file class.ilStudyProgrammeProgressListGUI.php.

References $tpl, buildProgressBar(), getAltIcon(), getIconPath(), getTitleAndIconTarget(), getTitleForItem(), and showMoreObjectsInfo().

Referenced by getHTML().

78  {
79  $programme = $this->progress->getStudyProgramme();
80  $title_and_icon_target = $this->getTitleAndIconTarget($this->progress);
81 
82  if ($title_and_icon_target) {
83  $tpl->setCurrentBlock("linked_icon");
84  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
85  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
86  $tpl->setVariable("ICON_HREF", $title_and_icon_target);
87  $tpl->parseCurrentBlock();
88 
89  $tpl->setCurrentBlock("linked_title");
90  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
91  $tpl->setVariable("HREF_TITLE", $title_and_icon_target);
92  $tpl->parseCurrentBlock();
93  }
94  else {
95  $tpl->setCurrentBlock("not_linked_icon");
96  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
97  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
98  $tpl->parseCurrentBlock();
99 
100  $tpl->setCurrentBlock("not_linked_title");
101  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
102  $tpl->parseCurrentBlock();
103  }
104 
105  if($this->show_info_mesage) {
106  if($this->showMoreObjectsInfo($programme)) {
107  $tpl->setVariable("MORE_OBJECTS",$this->il_lng->txt("prg_more_objects_without_read_permission"));
108  }
109  }
110  $tpl->setVariable("TXT_DESC", $programme->getDescription());
111  $tpl->setVariable("PROGRESS_BAR", $this->buildProgressBar($this->progress));
112  }
buildProgressBar(ilStudyProgrammeUserProgress $a_progress)
global $tpl
Definition: ilias.php:8
getTitleAndIconTarget(ilStudyProgrammeUserProgress $a_progress)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAltIcon()

ilStudyProgrammeProgressListGUI::getAltIcon (   $a_obj_id)
protected

Definition at line 126 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by fillTemplate().

126  {
127  return $this->il_lng->txt("icon")." ".$this->il_lng->txt("obj_prg");
128  }
+ Here is the caller graph for this function:

◆ getHTML()

ilStudyProgrammeProgressListGUI::getHTML ( )

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

References $html, $tpl, fillTemplate(), and getTemplate().

69  {
70  if ($this->html === null) {
71  $tpl = $this->getTemplate("Modules/StudyProgramme", static::$tpl_file, true, true);
72  $this->fillTemplate($tpl);
73  $this->html = $tpl->get();
74  }
75  return $this->html;
76  }
global $tpl
Definition: ilias.php:8
getTemplate($a_component, $a_file, $a_remove_unknown_vars, $a_remove_empty_blocks)
+ Here is the call graph for this function:

◆ getIconPath()

ilStudyProgrammeProgressListGUI::getIconPath (   $a_obj_id)
protected

Definition at line 122 of file class.ilStudyProgrammeProgressListGUI.php.

References ilObject\_getIcon().

Referenced by fillTemplate().

122  {
123  return ilObject::_getIcon($a_obj_id, "small", "prg");
124  }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplate()

ilStudyProgrammeProgressListGUI::getTemplate (   $a_component,
  $a_file,
  $a_remove_unknown_vars,
  $a_remove_empty_blocks 
)
protected

Definition at line 118 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by getHTML().

118  {
119  return new ilTemplate($a_file, $a_remove_unknown_vars, $a_remove_empty_blocks, $a_component);
120  }
special template class to simplify handling of ITX/PEAR
+ Here is the caller graph for this function:

◆ getTitleAndIconTarget()

ilStudyProgrammeProgressListGUI::getTitleAndIconTarget ( ilStudyProgrammeUserProgress  $a_progress)
protected

Definition at line 130 of file class.ilStudyProgrammeProgressListGUI.php.

References ilStudyProgrammeUserProgress\getId().

Referenced by fillTemplate().

130  {
131  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "prg_progress_id", $a_progress->getId());
132  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "expand", 1);
133  $link = $this->il_ctrl->getLinkTargetByClass("ilPersonalDesktopGUI", "jumpToSelectedItems");
134  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "prg_progress_id", null);
135  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "expand", null);
136  return $link;
137  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitleForItem()

ilStudyProgrammeProgressListGUI::getTitleForItem ( ilObjStudyProgramme  $a_programme)
protected

Definition at line 114 of file class.ilStudyProgrammeProgressListGUI.php.

References ilObject\getTitle().

Referenced by fillTemplate().

114  {
115  return $a_programme->getTitle();
116  }
getTitle()
get object title public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOnlyRelevant()

ilStudyProgrammeProgressListGUI::setOnlyRelevant (   $only_relevant)

Definition at line 214 of file class.ilStudyProgrammeProgressListGUI.php.

References $only_relevant.

214  {
215  $this->only_relevant = $only_relevant;
216  }

◆ setShowInfoMessage()

ilStudyProgrammeProgressListGUI::setShowInfoMessage (   $show_info_mesage)

Definition at line 206 of file class.ilStudyProgrammeProgressListGUI.php.

References $show_info_mesage.

206  {
207  $this->show_info_mesage = $show_info_mesage;
208  }

◆ setVisibleOnPDMode()

ilStudyProgrammeProgressListGUI::setVisibleOnPDMode (   $visible_on_pd_mode)

Definition at line 210 of file class.ilStudyProgrammeProgressListGUI.php.

References $visible_on_pd_mode.

210  {
211  $this->visible_on_pd_mode = $visible_on_pd_mode;
212  }

◆ showMoreObjectsInfo()

ilStudyProgrammeProgressListGUI::showMoreObjectsInfo (   $programme)
protected

Definition at line 218 of file class.ilStudyProgrammeProgressListGUI.php.

References $read, and ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_ALLWAYS.

Referenced by fillTemplate().

218  {
219  $children = $programme->getChildren();
220  foreach ($children as $key => $child) {
221  $read = $this->il_access->checkAccess("read", "", $child->getRefId(), "prg", $child->getId());
222  if(!$read && $this->visible_on_pd_mode != ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS) {
223  return true;
224  }
225  }
226 
227  return false;
228  }
+ Here is the caller graph for this function:

Field Documentation

◆ $html

ilStudyProgrammeProgressListGUI::$html
protected

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

Referenced by getHTML().

◆ $il_ctrl

ilStudyProgrammeProgressListGUI::$il_ctrl
protected

Definition at line 27 of file class.ilStudyProgrammeProgressListGUI.php.

◆ $il_lng

ilStudyProgrammeProgressListGUI::$il_lng
protected

Definition at line 22 of file class.ilStudyProgrammeProgressListGUI.php.

◆ $only_relevant

ilStudyProgrammeProgressListGUI::$only_relevant = false
protected

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

Referenced by setOnlyRelevant().

◆ $progress

ilStudyProgrammeProgressListGUI::$progress
protected

◆ $show_info_mesage

ilStudyProgrammeProgressListGUI::$show_info_mesage
protected

Definition at line 42 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by setShowInfoMessage().

◆ $tpl_file

ilStudyProgrammeProgressListGUI::$tpl_file = "tpl.progress_list_item.html"
staticprotected

Definition at line 14 of file class.ilStudyProgrammeProgressListGUI.php.

◆ $visible_on_pd_mode

ilStudyProgrammeProgressListGUI::$visible_on_pd_mode
protected

Definition at line 47 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by setVisibleOnPDMode().

◆ NON_SUCCESSFUL_PROGRESS_CSS_CLASS

const ilStudyProgrammeProgressListGUI::NON_SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarNeutral"

Definition at line 17 of file class.ilStudyProgrammeProgressListGUI.php.

◆ SUCCESSFUL_PROGRESS_CSS_CLASS

const ilStudyProgrammeProgressListGUI::SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarCompleted"

Definition at line 16 of file class.ilStudyProgrammeProgressListGUI.php.


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