ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)

Reimplemented in ilStudyProgrammeExpandableProgressListGUI.

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

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 }
global $DIC
Definition: shib_login.php:26

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

+ 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.

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()) {
166 } else {
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)

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

Referenced by fillTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildProgressStatus()

ilStudyProgrammeProgressListGUI::buildProgressStatus ( ilPRGProgress  $progress)
protected

Reimplemented in ilStudyProgrammeIndividualPlanProgressListGUI.

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

190 : string
191 {
192 $lang_val = "prg_progress_status";
193 $max_points = $progress->getAmountOfPoints();
195
196 if ($programme->hasChildren() && !$programme->hasLPChildren()) {
197 $lang_val = "prg_progress_status_with_child_sp";
198 }
199
200 if ($programme->hasChildren()) {
202 }
203
204 return sprintf(
205 $this->lng->txt($lang_val),
207 $max_points
208 );
209 }
static getInstanceByObjId(int $obj_id)

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

+ Here is the call graph for this function:

◆ buildToolTip()

ilStudyProgrammeProgressListGUI::buildToolTip ( ilPRGProgress  $progress)
protected

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

181 : string
182 {
183 return sprintf(
184 $this->lng->txt("prg_progress_info"),
185 $progress->getCurrentAmountOfPoints(),
187 );
188 }

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

+ Here is the call graph for this function:

◆ fillTemplate()

ilStudyProgrammeProgressListGUI::fillTemplate ( ilTemplate  $tpl)
protected

Reimplemented in ilStudyProgrammeExpandableProgressListGUI.

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

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);
80
81 $tpl->setCurrentBlock("linked_title");
82 $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
83 $tpl->setVariable("HREF_TITLE", $title_and_icon_target);
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()));
90
91 $tpl->setCurrentBlock("not_linked_title");
92 $tpl->setVariable("TXT_TITLE", $this->getTitleForItem($programme));
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 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.

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

Referenced by getHTML().

+ 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.

122 : string
123 {
124 return $this->lng->txt("icon") . " " . $this->lng->txt("obj_prg");
125 }

References ILIAS\Repository\lng().

Referenced by fillTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilStudyProgrammeProgressListGUI::getHTML ( )

Reimplemented in ilStudyProgrammeExpandableProgressListGUI.

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

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)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

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

+ Here is the call graph for this function:

◆ getIconPath()

ilStudyProgrammeProgressListGUI::getIconPath ( int  $obj_id)
protected

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

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.

References ilObject\_getIcon().

Referenced by fillTemplate().

+ 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.

113 : ilTemplate {
114 return new ilTemplate($file, $remove_unknown_vars, $remove_empty_blocks, $component);
115 }
special template class to simplify handling of ITX/PEAR

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getTitleAndIconTarget()

ilStudyProgrammeProgressListGUI::getTitleAndIconTarget ( ilPRGProgress  $progress)
protected

Reimplemented in ilStudyProgrammeExpandableProgressListGUI.

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

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 }

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

Referenced by fillTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitleForItem()

ilStudyProgrammeProgressListGUI::getTitleForItem ( ilObjStudyProgramme  $programme)
protected

Reimplemented in ilStudyProgrammeIndividualPlanProgressListGUI.

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

103 : string
104 {
105 return $programme->getTitle();
106 }

References ilObject\getTitle().

Referenced by fillTemplate().

+ 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.

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.

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.

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.

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.

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

Referenced by fillTemplate().

+ 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.

◆ $progress

◆ $show_info_message

bool ilStudyProgrammeProgressListGUI::$show_info_message
protected

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

◆ $tpl

ilGlobalTemplateInterface ilStudyProgrammeProgressListGUI::$tpl
protected

◆ $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.

◆ 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: