ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 55 of file class.ilStudyProgrammeProgressListGUI.php.

References $DIC, $ilCtrl, and $lng.

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

Member Function Documentation

◆ buildProgressBar()

ilStudyProgrammeProgressListGUI::buildProgressBar ( ilStudyProgrammeUserProgress  $a_progress)
protected

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

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

Referenced by fillTemplate().

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

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

Referenced by buildProgressBar().

196  {
197  $lang_val = "prg_progress_status";
198  $max_points = $a_progress->getAmountOfPoints();
199  $study_programm = $a_progress->getStudyProgramme();
200 
201  if ($study_programm->hasChildren() && !$study_programm->hasLPChildren()) {
202  $lang_val = "prg_progress_status_with_child_sp";
203  }
204 
205  if ($a_progress->getStudyProgramme()->hasChildren()) {
206  $max_points = $a_progress->getMaximumPossibleAmountOfPoints($this->only_relevant);
207  }
208  return sprintf(
209  $this->il_lng->txt($lang_val),
210  $a_progress->getCurrentAmountOfPoints(),
211  $max_points
212  );
213  }
getCurrentAmountOfPoints()
Get the amount of points the user currently achieved.
getStudyProgramme()
Get the program node this progress belongs to.
getMaximumPossibleAmountOfPoints(bool $only_relevant=false)
Get the maximum possible amount of points a user can achieve for the completion of this node...
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:

◆ buildToolTip()

ilStudyProgrammeProgressListGUI::buildToolTip ( ilStudyProgrammeUserProgress  $a_progress)
protected

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

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

Referenced by buildProgressBar().

187  {
188  return sprintf(
189  $this->il_lng->txt("prg_progress_info"),
190  $a_progress->getCurrentAmountOfPoints(),
191  $a_progress->getAmountOfPoints()
192  );
193  }
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 81 of file class.ilStudyProgrammeProgressListGUI.php.

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

Referenced by getHTML().

82  {
83  $programme = $this->progress->getStudyProgramme();
84  $title_and_icon_target = $this->getTitleAndIconTarget($this->progress);
85 
86  if ($title_and_icon_target) {
87  $tpl->setCurrentBlock("linked_icon");
88  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
89  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
90  $tpl->setVariable("ICON_HREF", $title_and_icon_target);
91  $tpl->parseCurrentBlock();
92 
93  $tpl->setCurrentBlock("linked_title");
94  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
95  $tpl->setVariable("HREF_TITLE", $title_and_icon_target);
96  $tpl->parseCurrentBlock();
97  } else {
98  $tpl->setCurrentBlock("not_linked_icon");
99  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
100  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
101  $tpl->parseCurrentBlock();
102 
103  $tpl->setCurrentBlock("not_linked_title");
104  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
105  $tpl->parseCurrentBlock();
106  }
107 
108  if ($this->show_info_mesage) {
109  if ($this->showMoreObjectsInfo($programme)) {
110  $tpl->setVariable("MORE_OBJECTS", $this->il_lng->txt("prg_more_objects_without_read_permission"));
111  }
112  }
113  $tpl->setVariable("TXT_DESC", $programme->getDescription());
114  $tpl->setVariable("PROGRESS_BAR", $this->buildProgressBar($this->progress));
115  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
buildProgressBar(ilStudyProgrammeUserProgress $a_progress)
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 132 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by fillTemplate().

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

◆ getHTML()

ilStudyProgrammeProgressListGUI::getHTML ( )

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

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

72  {
73  if ($this->html === null) {
74  $tpl = $this->getTemplate("Modules/StudyProgramme", static::$tpl_file, true, true);
75  $this->fillTemplate($tpl);
76  $this->html = $tpl->get();
77  }
78  return $this->html;
79  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 127 of file class.ilStudyProgrammeProgressListGUI.php.

Referenced by fillTemplate().

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

Referenced by getHTML().

123  {
124  return new ilTemplate($a_file, $a_remove_unknown_vars, $a_remove_empty_blocks, $a_component);
125  }
+ Here is the caller graph for this function:

◆ getTitleAndIconTarget()

ilStudyProgrammeProgressListGUI::getTitleAndIconTarget ( ilStudyProgrammeUserProgress  $a_progress)
protected

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

References ilStudyProgrammeUserProgress\getId().

Referenced by fillTemplate().

138  {
139  $this->il_ctrl->setParameterByClass("ilDashboardGUI", "prg_progress_id", $a_progress->getId());
140  $this->il_ctrl->setParameterByClass("ilDashboardGUI", "expand", 1);
141  $link = $this->il_ctrl->getLinkTargetByClass("ilDashboardGUI", "jumpToSelectedItems");
142  $this->il_ctrl->setParameterByClass("ilDashboardGUI", "prg_progress_id", null);
143  $this->il_ctrl->setParameterByClass("ilDashboardGUI", "expand", null);
144  return $link;
145  }
+ 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 117 of file class.ilStudyProgrammeProgressListGUI.php.

References ilObject\getTitle().

Referenced by fillTemplate().

118  {
119  return $a_programme->getTitle();
120  }
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 225 of file class.ilStudyProgrammeProgressListGUI.php.

References $only_relevant.

226  {
227  $this->only_relevant = $only_relevant;
228  }

◆ setShowInfoMessage()

ilStudyProgrammeProgressListGUI::setShowInfoMessage (   $show_info_mesage)

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

References $show_info_mesage.

216  {
217  $this->show_info_mesage = $show_info_mesage;
218  }

◆ setVisibleOnPDMode()

ilStudyProgrammeProgressListGUI::setVisibleOnPDMode (   $visible_on_pd_mode)

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

References $visible_on_pd_mode.

221  {
222  $this->visible_on_pd_mode = $visible_on_pd_mode;
223  }

◆ showMoreObjectsInfo()

ilStudyProgrammeProgressListGUI::showMoreObjectsInfo (   $programme)
protected

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

References ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_ALLWAYS.

Referenced by fillTemplate().

231  {
232  $children = $programme->getChildren();
233  foreach ($children as $key => $child) {
234  $read = $this->il_access->checkAccess("read", "", $child->getRefId(), "prg", $child->getId());
235  if (!$read && $this->visible_on_pd_mode != ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS) {
236  return true;
237  }
238  }
239 
240  return false;
241  }
+ Here is the caller graph for this function:

Field Documentation

◆ $html

ilStudyProgrammeProgressListGUI::$html
protected

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

Referenced by getHTML().

◆ $il_ctrl

ilStudyProgrammeProgressListGUI::$il_ctrl
protected

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

◆ $il_lng

ilStudyProgrammeProgressListGUI::$il_lng
protected

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

◆ $only_relevant

ilStudyProgrammeProgressListGUI::$only_relevant = false
protected

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

Referenced by setOnlyRelevant().

◆ $progress

ilStudyProgrammeProgressListGUI::$progress
protected

◆ $show_info_mesage

ilStudyProgrammeProgressListGUI::$show_info_mesage
protected

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

Referenced by setShowInfoMessage().

◆ $tpl_file

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

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

◆ $visible_on_pd_mode

ilStudyProgrammeProgressListGUI::$visible_on_pd_mode
protected

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

Referenced by setVisibleOnPDMode().

◆ NON_SUCCESSFUL_PROGRESS_CSS_CLASS

const ilStudyProgrammeProgressListGUI::NON_SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarNeutral"

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

◆ SUCCESSFUL_PROGRESS_CSS_CLASS

const ilStudyProgrammeProgressListGUI::SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarCompleted"

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


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