ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilStudyProgrammeProgressListGUI Class Reference

Class ilStudyProgrammeProgressListGUI. More...

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

Public Member Functions

 __construct (ilPRGProgress $a_progress)
 
 getHTML ()
 
 setShowInfoMessage (bool $show_info_message)
 
 setVisibleOnPDMode (string $visible_on_pd_mode)
 
 setOnlyRelevant (bool $only_relevant)
 

Protected Member Functions

 fillTemplate (ilTemplate $tpl)
 
 getTitleForItem (ilObjStudyProgramme $programme)
 
 getTemplate (string $component, string $file, bool $remove_unknown_vars, bool $remove_empty_blocks)
 
 getIconPath (int $obj_id)
 
 getAltIcon ()
 
 getTitleAndIconTarget (ilPRGProgress $progress)
 
 buildProgressBar (ilPRGProgress $progress)
 
 buildToolTip (ilPRGProgress $progress)
 
 buildProgressStatus (ilPRGProgress $progress)
 
 showMoreObjectsInfo (ilObjStudyProgramme $programme)
 

Protected Attributes

ilLanguage $lng
 
ilCtrl $ctrl
 
ilAccess $access
 
ilPRGProgress $progress
 
ilGlobalTemplateInterface $tpl
 
string $html
 
bool $show_info_message
 
string $visible_on_pd_mode
 
bool $only_relevant = false
 

Static Protected Attributes

static string $tpl_file = "tpl.progress_list_item.html"
 

Private Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeProgressListGUI::__construct ( ilPRGProgress  $a_progress)

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

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\html(), ILIAS\Repository\lng(), and null.

45  {
46  global $DIC;
47  $this->lng = $DIC['lng'];
48  $this->lng->loadLanguageModule("prg");
49  $this->ctrl = $DIC['ilCtrl'];
50  $this->access = $DIC['ilAccess'];
51 
52  $this->progress = $a_progress;
53  $this->tpl = null;
54  $this->html = null;
55  $this->show_info_message = false;
56  $this->visible_on_pd_mode = "read";
57  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ buildProgressBar()

ilStudyProgrammeProgressListGUI::buildProgressBar ( ilPRGProgress  $progress)
protected

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

References buildProgressStatus(), buildToolTip(), ilPRGProgress\getAmountOfPoints(), ilPRGProgress\getCurrentAmountOfPoints(), ILIAS\StudyProgramme\Assignment\Node\getId(), ilPRGProgress\getPossiblePointsOfRelevantChildren(), ILIAS\Repository\int(), ilPRGProgress\isSuccessful(), null, and ilContainerObjectiveGUI\renderProgressBar().

Referenced by fillTemplate().

137  : string
138  {
139  $tooltip_id = "prg_" . $progress->getId();
140  $required_amount_of_points = $progress->getAmountOfPoints();
141 
142  $maximum_possible_amount_of_points = $progress->getPossiblePointsOfRelevantChildren();
143 
144  $current_amount_of_points = $progress->getCurrentAmountOfPoints();
145  $current_percent = 0;
146  $required_percent = 0;
147 
148  if ($maximum_possible_amount_of_points > 0) {
149  $current_percent = (int) ($current_amount_of_points * 100 / $maximum_possible_amount_of_points);
150  $required_percent = (int) ($required_amount_of_points * 100 / $maximum_possible_amount_of_points);
151  } elseif ($progress->isSuccessful()) {
152  $current_percent = 100;
153  $required_percent = 100;
154  }
155 
156  //required to dodge bug in ilContainerObjectiveGUI::renderProgressBar
157  if ($required_percent === 0) {
158  $required_percent = 0.1;
159  }
160 
161  $tooltip_txt = $this->buildToolTip($progress);
162  $progress_status = $this->buildProgressStatus($progress);
163 
164  if ($progress->isSuccessful()) {
165  $css_class = self::SUCCESSFUL_PROGRESS_CSS_CLASS;
166  } else {
167  $css_class = self::NON_SUCCESSFUL_PROGRESS_CSS_CLASS;
168  }
169 
171  (int)$current_percent,
172  (int)$required_percent,
173  $css_class,
174  $progress_status,
175  null,
176  $tooltip_id,
177  $tooltip_txt
178  );
179  }
static renderProgressBar(?int $a_perc_result=null, ?int $a_perc_limit=null, ?string $a_css=null, ?string $a_caption=null, ?string $a_url=null, ?string $a_tt_id=null, ?string $a_tt_txt=null, ?string $a_next_step=null, bool $a_sub=false, int $a_sub_style=30)
Render progress bar(s)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildProgressStatus()

ilStudyProgrammeProgressListGUI::buildProgressStatus ( ilPRGProgress  $progress)
protected

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

References ilPRGProgress\getAmountOfPoints(), ilPRGProgress\getCurrentAmountOfPoints(), ilObjStudyProgramme\getInstanceByObjId(), ilPRGProgress\getNodeId(), ilPRGProgress\getPossiblePointsOfRelevantChildren(), and ILIAS\Repository\lng().

Referenced by buildProgressBar().

190  : string
191  {
192  $lang_val = "prg_progress_status";
193  $max_points = $progress->getAmountOfPoints();
194  $programme = ilObjStudyProgramme::getInstanceByObjId($progress->getNodeId());
195 
196  if ($programme->hasChildren() && !$programme->hasLPChildren()) {
197  $lang_val = "prg_progress_status_with_child_sp";
198  }
199 
200  if ($programme->hasChildren()) {
201  $max_points = $progress->getPossiblePointsOfRelevantChildren($progress);
202  }
203 
204  return sprintf(
205  $this->lng->txt($lang_val),
206  $progress->getCurrentAmountOfPoints(),
207  $max_points
208  );
209  }
static getInstanceByObjId(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildToolTip()

ilStudyProgrammeProgressListGUI::buildToolTip ( ilPRGProgress  $progress)
protected

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

References ilPRGProgress\getAmountOfPoints(), ilPRGProgress\getCurrentAmountOfPoints(), and ILIAS\Repository\lng().

Referenced by buildProgressBar().

181  : string
182  {
183  return sprintf(
184  $this->lng->txt("prg_progress_info"),
185  $progress->getCurrentAmountOfPoints(),
186  $progress->getAmountOfPoints()
187  );
188  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillTemplate()

ilStudyProgrammeProgressListGUI::fillTemplate ( ilTemplate  $tpl)
protected

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

References buildProgressBar(), getAltIcon(), getIconPath(), ilObjStudyProgramme\getInstanceByObjId(), getTitleAndIconTarget(), getTitleForItem(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and showMoreObjectsInfo().

Referenced by getHTML().

69  : void
70  {
71  $programme = ilObjStudyProgramme::getInstanceByObjId($this->progress->getNodeId());
72  $title_and_icon_target = $this->getTitleAndIconTarget($this->progress);
73 
74  if ($title_and_icon_target) {
75  $tpl->setCurrentBlock("linked_icon");
76  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
77  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
78  $tpl->setVariable("ICON_HREF", $title_and_icon_target);
79  $tpl->parseCurrentBlock();
80 
81  $tpl->setCurrentBlock("linked_title");
82  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
83  $tpl->setVariable("HREF_TITLE", $title_and_icon_target);
84  $tpl->parseCurrentBlock();
85  } else {
86  $tpl->setCurrentBlock("not_linked_icon");
87  $tpl->setVariable("SRC_ICON", $this->getIconPath($programme->getId()));
88  $tpl->setVariable("ALT_ICON", $this->getAltIcon($programme->getId()));
89  $tpl->parseCurrentBlock();
90 
91  $tpl->setCurrentBlock("not_linked_title");
92  $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
93  $tpl->parseCurrentBlock();
94  }
95 
96  if ($this->show_info_message && $this->showMoreObjectsInfo($programme)) {
97  $tpl->setVariable("MORE_OBJECTS", $this->lng->txt("prg_more_objects_without_read_permission"));
98  }
99  $tpl->setVariable("TXT_DESC", $programme->getDescription());
100  $tpl->setVariable("PROGRESS_BAR", $this->buildProgressBar($this->progress));
101  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
static getInstanceByObjId(int $obj_id)
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAltIcon()

ilStudyProgrammeProgressListGUI::getAltIcon ( )
protected

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

References ILIAS\Repository\lng().

Referenced by fillTemplate().

122  : string
123  {
124  return $this->lng->txt("icon") . " " . $this->lng->txt("obj_prg");
125  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilStudyProgrammeProgressListGUI::getHTML ( )

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

References $html, fillTemplate(), ILIAS\UICore\GlobalTemplate\get(), getTemplate(), ILIAS\Repository\html(), and null.

59  : string
60  {
61  if ($this->html === null) {
62  $tpl = $this->getTemplate("components/ILIAS/StudyProgramme", static::$tpl_file, true, true);
63  $this->fillTemplate($tpl);
64  $this->html = $tpl->get();
65  }
66  return $this->html;
67  }
getTemplate(string $component, string $file, bool $remove_unknown_vars, bool $remove_empty_blocks)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
+ Here is the call graph for this function:

◆ getIconPath()

ilStudyProgrammeProgressListGUI::getIconPath ( int  $obj_id)
protected

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

References ilObject\_getIcon().

Referenced by fillTemplate().

117  : string
118  {
119  return ilObject::_getIcon($obj_id, "small", "prg");
120  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $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 ( string  $component,
string  $file,
bool  $remove_unknown_vars,
bool  $remove_empty_blocks 
)
protected

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

Referenced by getHTML().

113  : ilTemplate {
114  return new ilTemplate($file, $remove_unknown_vars, $remove_empty_blocks, $component);
115  }
+ Here is the caller graph for this function:

◆ getTitleAndIconTarget()

ilStudyProgrammeProgressListGUI::getTitleAndIconTarget ( ilPRGProgress  $progress)
protected

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

References ILIAS\Repository\ctrl(), ILIAS\StudyProgramme\Assignment\Node\getId(), and null.

Referenced by fillTemplate().

127  : ?string
128  {
129  $this->ctrl->setParameterByClass("ilDashboardGUI", "prg_progress_id", $progress->getId());
130  $this->ctrl->setParameterByClass("ilDashboardGUI", "expand", 1);
131  $link = $this->ctrl->getLinkTargetByClass("ilDashboardGUI", "jumpToSelectedItems");
132  $this->ctrl->setParameterByClass("ilDashboardGUI", "prg_progress_id", null);
133  $this->ctrl->setParameterByClass("ilDashboardGUI", "expand", null);
134  return $link;
135  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitleForItem()

ilStudyProgrammeProgressListGUI::getTitleForItem ( ilObjStudyProgramme  $programme)
protected

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

References ilObject\getTitle().

Referenced by fillTemplate().

103  : string
104  {
105  return $programme->getTitle();
106  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOnlyRelevant()

ilStudyProgrammeProgressListGUI::setOnlyRelevant ( bool  $only_relevant)

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

References $only_relevant.

221  : void
222  {
223  $this->only_relevant = $only_relevant;
224  }

◆ setShowInfoMessage()

ilStudyProgrammeProgressListGUI::setShowInfoMessage ( bool  $show_info_message)

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

References $show_info_message.

211  : void
212  {
213  $this->show_info_message = $show_info_message;
214  }

◆ setVisibleOnPDMode()

ilStudyProgrammeProgressListGUI::setVisibleOnPDMode ( string  $visible_on_pd_mode)

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

References $visible_on_pd_mode.

216  : void
217  {
218  $this->visible_on_pd_mode = $visible_on_pd_mode;
219  }

◆ showMoreObjectsInfo()

ilStudyProgrammeProgressListGUI::showMoreObjectsInfo ( ilObjStudyProgramme  $programme)
protected

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

References ILIAS\Repository\access(), ilObjStudyProgramme\getChildren(), and ilObjStudyProgrammeAdmin\SETTING_VISIBLE_ON_PD_ALLWAYS.

Referenced by fillTemplate().

226  : bool
227  {
228  $children = $programme->getChildren();
229  foreach ($children as $child) {
230  $read = $this->access->checkAccess("read", "", $child->getRefId(), "prg", $child->getId());
231  if (!$read && $this->visible_on_pd_mode !== ilObjStudyProgrammeAdmin::SETTING_VISIBLE_ON_PD_ALLWAYS) {
232  return true;
233  }
234  }
235 
236  return false;
237  }
getChildren(bool $include_references=false)
Get all ilObjStudyProgrammes that are direct children of this object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccess ilStudyProgrammeProgressListGUI::$access
protected

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

◆ $ctrl

ilCtrl ilStudyProgrammeProgressListGUI::$ctrl
protected

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

◆ $html

string ilStudyProgrammeProgressListGUI::$html
protected

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

Referenced by getHTML().

◆ $lng

ilLanguage ilStudyProgrammeProgressListGUI::$lng
protected

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

◆ $only_relevant

bool ilStudyProgrammeProgressListGUI::$only_relevant = false
protected

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

Referenced by setOnlyRelevant().

◆ $progress

ilPRGProgress ilStudyProgrammeProgressListGUI::$progress
protected

◆ $show_info_message

bool ilStudyProgrammeProgressListGUI::$show_info_message
protected

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

Referenced by setShowInfoMessage().

◆ $tpl

ilGlobalTemplateInterface ilStudyProgrammeProgressListGUI::$tpl
protected

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

◆ $tpl_file

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

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

◆ $visible_on_pd_mode

string ilStudyProgrammeProgressListGUI::$visible_on_pd_mode
protected

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

Referenced by setVisibleOnPDMode().

◆ NON_SUCCESSFUL_PROGRESS_CSS_CLASS

const ilStudyProgrammeProgressListGUI::NON_SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarNeutral"
private

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

◆ SUCCESSFUL_PROGRESS_CSS_CLASS

const ilStudyProgrammeProgressListGUI::SUCCESSFUL_PROGRESS_CSS_CLASS = "ilCourseObjectiveProgressBarCompleted"
private

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


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