ILIAS  release_7 Revision v7.30-3-g800a261c036
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 (ilStudyProgrammeProgress $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 (ilStudyProgrammeProgress $a_progress)
 
 buildProgressBar (ilStudyProgrammeProgress $a_progress)
 
 buildToolTip (ilStudyProgrammeProgress $a_progress)
 
 buildProgressStatus (ilStudyProgrammeProgress $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 ( ilStudyProgrammeProgress  $a_progress)

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

References $DIC, 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  }
$lng
global $DIC
Definition: goto.php:24

Member Function Documentation

◆ buildProgressBar()

ilStudyProgrammeProgressListGUI::buildProgressBar ( ilStudyProgrammeProgress  $a_progress)
protected

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

References buildProgressStatus(), buildToolTip(), ilStudyProgrammeProgress\getAmountOfPoints(), ilStudyProgrammeProgress\getCurrentAmountOfPoints(), ilStudyProgrammeProgress\getId(), ilObjStudyProgramme\getInstanceByObjId(), ilStudyProgrammeProgress\getNodeId(), ilStudyProgrammeProgress\isSuccessful(), and ilContainerObjectiveGUI\renderProgressBar().

Referenced by fillTemplate().

148  {
149  $tooltip_id = "prg_" . $a_progress->getId();
150  $required_amount_of_points = $a_progress->getAmountOfPoints();
151 
152  $programme = ilObjStudyProgramme::getInstanceByObjId($a_progress->getNodeId());
153  $maximum_possible_amount_of_points = $programme->getPossiblePointsOfRelevantChildren($a_progress, true);
154 
155  $current_amount_of_points = $a_progress->getCurrentAmountOfPoints();
156 
157  if ($maximum_possible_amount_of_points > 0) {
158  $current_percent = (int) ($current_amount_of_points * 100 / $maximum_possible_amount_of_points);
159  $required_percent = (int) ($required_amount_of_points * 100 / $maximum_possible_amount_of_points);
160  } else {
161  if ($a_progress->isSuccessful()) {
162  $current_percent = 100;
163  $required_percent = 100;
164  } else {
165  $current_percent = 0;
166  $required_percent = 0;
167  }
168  }
169 
170  //required to dodge bug in ilContainerObjectiveGUI::renderProgressBar
171  if ($required_percent == 0) {
172  $required_percent = 0.1;
173  }
174 
175  $tooltip_txt = $this->buildToolTip($a_progress);
176  $progress_status = $this->buildProgressStatus($a_progress);
177 
178  if ($a_progress->isSuccessful()) {
179  $css_class = self::SUCCESSFUL_PROGRESS_CSS_CLASS;
180  } else {
181  $css_class = self::NON_SUCCESSFUL_PROGRESS_CSS_CLASS;
182  }
183 
184  require_once("Services/Container/classes/class.ilContainerObjectiveGUI.php");
185  return ilContainerObjectiveGUI::renderProgressBar($current_percent, $required_percent, $css_class, $progress_status, null, $tooltip_id, $tooltip_txt);
186  }
buildProgressStatus(ilStudyProgrammeProgress $a_progress)
getId()
Get the id of the progress.
getAmountOfPoints()
Get the amount of points the user needs to achieve on the subnodes 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)
buildToolTip(ilStudyProgrammeProgress $a_progress)
getNodeId()
Get the obj_id of the program node this progress belongs to.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildProgressStatus()

ilStudyProgrammeProgressListGUI::buildProgressStatus ( ilStudyProgrammeProgress  $a_progress)
protected

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

References ilStudyProgrammeProgress\getAmountOfPoints(), ilStudyProgrammeProgress\getCurrentAmountOfPoints(), ilObjStudyProgramme\getInstanceByObjId(), and ilStudyProgrammeProgress\getNodeId().

Referenced by buildProgressBar().

198  {
199  $lang_val = "prg_progress_status";
200  $max_points = $a_progress->getAmountOfPoints();
201  $programme = ilObjStudyProgramme::getInstanceByObjId($a_progress->getNodeId());
202 
203  if ($programme->hasChildren() && !$programme->hasLPChildren()) {
204  $lang_val = "prg_progress_status_with_child_sp";
205  }
206 
207  if ($programme->hasChildren()) {
208  $max_points = $programme->getPossiblePointsOfRelevantChildren($a_progress, $this->only_relevant);
209  }
210 
211  return sprintf(
212  $this->il_lng->txt($lang_val),
213  $a_progress->getCurrentAmountOfPoints(),
214  $max_points
215  );
216  }
getAmountOfPoints()
Get the amount of points the user needs to achieve on the subnodes of this node.
getNodeId()
Get the obj_id of the program node this progress belongs to.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildToolTip()

ilStudyProgrammeProgressListGUI::buildToolTip ( ilStudyProgrammeProgress  $a_progress)
protected

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

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

Referenced by buildProgressBar().

189  {
190  return sprintf(
191  $this->il_lng->txt("prg_progress_info"),
192  $a_progress->getCurrentAmountOfPoints(),
193  $a_progress->getAmountOfPoints()
194  );
195  }
getAmountOfPoints()
Get the amount of points the user needs to achieve on the subnodes of this 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(), ilObjStudyProgramme\getInstanceByObjId(), getTitleAndIconTarget(), getTitleForItem(), and showMoreObjectsInfo().

Referenced by getHTML().

82  {
83  $programme = ilObjStudyProgramme::getInstanceByObjId($this->progress->getNodeId());
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  }
buildProgressBar(ilStudyProgrammeProgress $a_progress)
getTitleAndIconTarget(ilStudyProgrammeProgress $a_progress)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ 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  }
getTemplate($a_component, $a_file, $a_remove_unknown_vars, $a_remove_empty_blocks)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ getIconPath()

ilStudyProgrammeProgressListGUI::getIconPath (   $a_obj_id)
protected

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

References ilObject\_getIcon().

Referenced by fillTemplate().

128  {
129  return ilObject::_getIcon($a_obj_id, "small", "prg");
130  }
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 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 ( ilStudyProgrammeProgress  $a_progress)
protected

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

References ilStudyProgrammeProgress\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  }
getId()
Get the id of the progress.
+ 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 228 of file class.ilStudyProgrammeProgressListGUI.php.

References $only_relevant.

229  {
230  $this->only_relevant = $only_relevant;
231  }

◆ setShowInfoMessage()

ilStudyProgrammeProgressListGUI::setShowInfoMessage (   $show_info_mesage)

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

References $show_info_mesage.

219  {
220  $this->show_info_mesage = $show_info_mesage;
221  }

◆ setVisibleOnPDMode()

ilStudyProgrammeProgressListGUI::setVisibleOnPDMode (   $visible_on_pd_mode)

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

References $visible_on_pd_mode.

224  {
225  $this->visible_on_pd_mode = $visible_on_pd_mode;
226  }

◆ showMoreObjectsInfo()

ilStudyProgrammeProgressListGUI::showMoreObjectsInfo (   $programme)
protected

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

References ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_ALLWAYS.

Referenced by fillTemplate().

234  {
235  $children = $programme->getChildren();
236  foreach ($children as $key => $child) {
237  $read = $this->il_access->checkAccess("read", "", $child->getRefId(), "prg", $child->getId());
238  if (!$read && $this->visible_on_pd_mode != ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS) {
239  return true;
240  }
241  }
242 
243  return false;
244  }
+ 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: