ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 $ilCtrl, and $lng.

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

Member Function Documentation

◆ buildProgressBar()

ilStudyProgrammeProgressListGUI::buildProgressBar ( ilStudyProgrammeUserProgress  $a_progress)
protected

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

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

Referenced by fillTemplate().

137  {
138  $tooltip_id = "prg_".$a_progress->getId();
139 
140  $required_amount_of_points = $a_progress->getAmountOfPoints();
141  $maximum_possible_amount_of_points = $a_progress->getMaximumPossibleAmountOfPoints(true);
142  $current_amount_of_points = $a_progress->getCurrentAmountOfPoints();
143 
144  if ($maximum_possible_amount_of_points > 0) {
145  $current_percent = (int)($current_amount_of_points * 100 / $maximum_possible_amount_of_points);
146  $required_percent = (int)($required_amount_of_points * 100 / $maximum_possible_amount_of_points);
147  }
148  else {
149  if ($a_progress->isSuccessful()) {
150  $current_percent = 100;
151  $required_percent = 100;
152  }
153  else {
154  $current_percent = 0;
155  $required_percent = 0;
156  }
157  }
158 
159  //required to dodge bug in ilContainerObjectiveGUI::renderProgressBar
160  if($required_percent == 0) {
161  $required_percent = 0.1;
162  }
163 
164  $tooltip_txt = $this->buildToolTip($a_progress);
165  $progress_status = $this->buildProgressStatus($a_progress);
166 
167  if ($a_progress->isSuccessful()) {
168  $css_class = self::SUCCESSFUL_PROGRESS_CSS_CLASS;
169  }
170  else {
171  $css_class = self::NON_SUCCESSFUL_PROGRESS_CSS_CLASS;
172  }
173 
174  require_once("Services/Container/classes/class.ilContainerObjectiveGUI.php");
175  return ilContainerObjectiveGUI::renderProgressBar($current_percent, $required_percent, $css_class
176  , $progress_status, null, $tooltip_id, $tooltip_txt);
177  }
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 186 of file class.ilStudyProgrammeProgressListGUI.php.

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

Referenced by buildProgressBar().

186  {
187  $lang_val = "prg_progress_status";
188  $max_points = $a_progress->getAmountOfPoints();
189  $study_programm = $a_progress->getStudyProgramme();
190 
191  if($study_programm->hasChildren() && !$study_programm->hasLPChildren()) {
192  $lang_val = "prg_progress_status_with_child_sp";
193  }
194 
195  if($a_progress->getStudyProgramme()->hasChildren()) {
196  $max_points = $a_progress->getMaximumPossibleAmountOfPoints($this->only_relevant);
197  }
198  return sprintf( $this->il_lng->txt($lang_val)
199  , $a_progress->getCurrentAmountOfPoints()
200  , $max_points
201  );
202  }
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 179 of file class.ilStudyProgrammeProgressListGUI.php.

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

Referenced by buildProgressBar().

179  {
180  return sprintf( $this->il_lng->txt("prg_progress_info")
181  , $a_progress->getCurrentAmountOfPoints()
182  , $a_progress->getAmountOfPoints()
183  );
184  }
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 76 of file class.ilStudyProgrammeProgressListGUI.php.

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

Referenced by getHTML().

76  {
77  $programme = $this->progress->getStudyProgramme();
78  $title_and_icon_target = $this->getTitleAndIconTarget($this->progress);
79 
80  if ($title_and_icon_target) {
81  $tpl->setCurrentBlock("linked_icon");
82  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
83  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
84  $tpl->setVariable("ICON_HREF", $title_and_icon_target);
85  $tpl->parseCurrentBlock();
86 
87  $tpl->setCurrentBlock("linked_title");
88  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
89  $tpl->setVariable("HREF_TITLE", $title_and_icon_target);
90  $tpl->parseCurrentBlock();
91  }
92  else {
93  $tpl->setCurrentBlock("not_linked_icon");
94  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
95  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
96  $tpl->parseCurrentBlock();
97 
98  $tpl->setCurrentBlock("not_linked_title");
99  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
100  $tpl->parseCurrentBlock();
101  }
102 
103  if($this->show_info_mesage) {
104  if($this->showMoreObjectsInfo($programme)) {
105  $tpl->setVariable("MORE_OBJECTS",$this->il_lng->txt("prg_more_objects_without_read_permission"));
106  }
107  }
108  $tpl->setVariable("TXT_DESC", $programme->getDescription());
109  $tpl->setVariable("PROGRESS_BAR", $this->buildProgressBar($this->progress));
110  }
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 124 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by fillTemplate().

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

◆ getHTML()

ilStudyProgrammeProgressListGUI::getHTML ( )

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

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

67  {
68  if ($this->html === null) {
69  $tpl = $this->getTemplate("Modules/StudyProgramme", static::$tpl_file, true, true);
70  $this->fillTemplate($tpl);
71  $this->html = $tpl->get();
72  }
73  return $this->html;
74  }
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 120 of file class.ilStudyProgrammeProgressListGUI.php.

References ilObject\_getIcon().

Referenced by fillTemplate().

120  {
121  return ilObject::_getIcon($a_obj_id, "small", "prg");
122  }
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 116 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by getHTML().

116  {
117  return new ilTemplate($a_file, $a_remove_unknown_vars, $a_remove_empty_blocks, $a_component);
118  }
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 128 of file class.ilStudyProgrammeProgressListGUI.php.

References ilStudyProgrammeUserProgress\getId().

Referenced by fillTemplate().

128  {
129  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "prg_progress_id", $a_progress->getId());
130  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "expand", 1);
131  $link = $this->il_ctrl->getLinkTargetByClass("ilPersonalDesktopGUI", "jumpToSelectedItems");
132  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "prg_progress_id", null);
133  $this->il_ctrl->setParameterByClass("ilPersonalDesktopGUI", "expand", null);
134  return $link;
135  }
+ 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 112 of file class.ilStudyProgrammeProgressListGUI.php.

References ilObject\getTitle().

Referenced by fillTemplate().

112  {
113  return $a_programme->getTitle();
114  }
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 212 of file class.ilStudyProgrammeProgressListGUI.php.

References $only_relevant.

212  {
213  $this->only_relevant = $only_relevant;
214  }

◆ setShowInfoMessage()

ilStudyProgrammeProgressListGUI::setShowInfoMessage (   $show_info_mesage)

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

References $show_info_mesage.

204  {
205  $this->show_info_mesage = $show_info_mesage;
206  }

◆ setVisibleOnPDMode()

ilStudyProgrammeProgressListGUI::setVisibleOnPDMode (   $visible_on_pd_mode)

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

References $visible_on_pd_mode.

208  {
209  $this->visible_on_pd_mode = $visible_on_pd_mode;
210  }

◆ showMoreObjectsInfo()

ilStudyProgrammeProgressListGUI::showMoreObjectsInfo (   $programme)
protected

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

References ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_ALLWAYS.

Referenced by fillTemplate().

216  {
217  $children = $programme->getChildren();
218  foreach ($children as $key => $child) {
219  $read = $this->il_access->checkAccess("read", "", $child->getRefId(), "prg", $child->getId());
220  if(!$read && $this->visible_on_pd_mode != ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS) {
221  return true;
222  }
223  }
224 
225  return false;
226  }
+ 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: