ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Exercise\Assignment\PanelBuilderUI Class Reference
+ Collaboration diagram for ILIAS\Exercise\Assignment\PanelBuilderUI:

Public Member Functions

 __construct (PropertyAndActionBuilderUI $prop_builder, \ILIAS\UI\Factory $ui_factory, \ILIAS\UI\Renderer $ui_renderer, \ilCtrl $ctrl, \ilLanguage $lng)
 
 getPanel (Assignment $ass, int $user_id)
 
 getPanelViews (Assignment $ass, int $user_id)
 

Protected Member Functions

 addPropertyToItemProperties (array &$props, ?array $prop)
 
 renderActionButton (\ilTemplate $tpl, ?Component $c)
 
 renderLinkList (\ilTemplate $tpl, string $sec)
 

Protected Attributes

ILIAS UI Renderer $ui_renderer
 
ilCtrl $ctrl
 
ilLanguage $lng
 
PropertyAndActionBuilderUI $prop_builder
 
ILIAS UI Factory $ui_factory
 

Detailed Description

Definition at line 30 of file PanelBuilderUI.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ addPropertyToItemProperties()

ILIAS\Exercise\Assignment\PanelBuilderUI::addPropertyToItemProperties ( array &  $props,
?array  $prop 
)
protected

Definition at line 52 of file PanelBuilderUI.php.

52  : void
53  {
54  if ($prop) {
55  $props[$prop["prop"]] = $prop["val"];
56  }
57  }

◆ getPanel()

ILIAS\Exercise\Assignment\PanelBuilderUI::getPanel ( Assignment  $ass,
int  $user_id 
)

Definition at line 59 of file PanelBuilderUI.php.

References ILIAS\Exercise\Assignment\PanelBuilderUI\$prop_builder, ILIAS\Exercise\Assignment\Assignment\$title, ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI\build(), ILIAS\Exercise\Assignment\Assignment\getTitle(), ILIAS\Repository\lng(), ILIAS\Exercise\Assignment\PanelBuilderUI\renderActionButton(), and ILIAS\Exercise\Assignment\PanelBuilderUI\renderLinkList().

59  : \ILIAS\UI\Component\Panel\Standard
60  {
61  $pb = $this->prop_builder;
62  $pb->build($ass, $user_id);
63 
64  // schedule card
65  $sections = [];
66  foreach ($pb->getProperties($pb::SEC_SCHEDULE) as $prop) {
67  $sections[] = $this->ui_factory->legacy()->content($prop["prop"] . ": " . $prop["val"]);
68  }
69  $schedule_card = $this->ui_factory->card()->standard($this->lng->txt("exc_schedule"))
70  ->withSections($sections);
71 
72  $sub_panels = [];
73  $include_schedule = $pb->getInstructionsHidden();
74  foreach ($pb->getSections($include_schedule) as $sec => $title) {
75  $sec_empty = true;
76  $ctpl = new \ilTemplate(
77  "tpl.panel_content.html",
78  true,
79  true,
80  "components/ILIAS/Exercise/Assignment"
81  );
82 
83  // properties
84  foreach ($pb->getProperties($sec) as $prop) {
85  if ($prop["prop"] === "") {
86  $ctpl->setCurrentBlock("entry_no_label");
87  $ctpl->setVariable("VALUE_NO_LABEL", $prop["val"]);
88  $ctpl->parseCurrentBlock();
89  } else {
90  $ctpl->setCurrentBlock("entry");
91  $ctpl->setVariable("LABEL", $prop["prop"]);
92  $ctpl->setVariable("VALUE", $prop["val"]);
93  $ctpl->parseCurrentBlock();
94  }
95  $sec_empty = false;
96  }
97 
98  // actions
99  $this->renderActionButton($ctpl, $pb->getMainAction($sec));
100  foreach ($pb->getActions($sec) as $action) {
101  $this->renderActionButton($ctpl, $action);
102  $sec_empty = false;
103  }
104 
105  if (count($pb->getActions($sec)) > 0) {
106  $sec_empty = false;
107  }
108 
109  // links
110  $this->renderLinkList($ctpl, $sec);
111 
112  $sub_panel = $this->ui_factory->panel()->sub(
113  $title,
114  $this->ui_factory->legacy()->content($ctpl->get())
115  );
116  if ($sec === $pb::SEC_INSTRUCTIONS && !$pb->getInstructionsHidden()) {
117  $sub_panel = $sub_panel->withFurtherInformation($schedule_card);
118  $sec_empty = false;
119  }
120  if (!$sec_empty) {
121  $sub_panels[] = $sub_panel;
122  }
123  }
124 
125  $panel = $this->ui_factory->panel()->standard(
126  $ass->getTitle(),
127  $sub_panels
128  );
129 
130  return $panel;
131  }
renderActionButton(\ilTemplate $tpl, ?Component $c)
renderLinkList(\ilTemplate $tpl, string $sec)
PropertyAndActionBuilderUI $prop_builder
+ Here is the call graph for this function:

◆ getPanelViews()

ILIAS\Exercise\Assignment\PanelBuilderUI::getPanelViews ( Assignment  $ass,
int  $user_id 
)

Definition at line 153 of file PanelBuilderUI.php.

References ILIAS\Exercise\Assignment\PanelBuilderUI\$prop_builder, and ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI\build().

153  : array
154  {
155  $pb = $this->prop_builder;
156  $pb->build($ass, $user_id);
157  return $pb->getViews();
158  }
PropertyAndActionBuilderUI $prop_builder
+ Here is the call graph for this function:

◆ renderActionButton()

ILIAS\Exercise\Assignment\PanelBuilderUI::renderActionButton ( \ilTemplate  $tpl,
?Component  $c 
)
protected

Definition at line 133 of file PanelBuilderUI.php.

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by ILIAS\Exercise\Assignment\PanelBuilderUI\getPanel().

133  : void
134  {
135  if (!is_null($c) && $c instanceof Button) {
136  $tpl->setCurrentBlock("action");
137  $tpl->setVariable("BUTTON", $this->ui_renderer->render($c));
138  $tpl->parseCurrentBlock();
139  }
140  }
$c
Definition: deliver.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderLinkList()

ILIAS\Exercise\Assignment\PanelBuilderUI::renderLinkList ( \ilTemplate  $tpl,
string  $sec 
)
protected

Definition at line 142 of file PanelBuilderUI.php.

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by ILIAS\Exercise\Assignment\PanelBuilderUI\getPanel().

142  : void
143  {
144  foreach ($this->prop_builder->getActions($sec) as $action) {
145  if ($action instanceof Link) {
146  $tpl->setCurrentBlock("link");
147  $tpl->setVariable("LINK", $this->ui_renderer->render($action));
148  $tpl->parseCurrentBlock();
149  }
150  }
151  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ILIAS\Exercise\Assignment\PanelBuilderUI::$ctrl
protected

◆ $lng

ilLanguage ILIAS\Exercise\Assignment\PanelBuilderUI::$lng
protected

◆ $prop_builder

◆ $ui_factory

ILIAS UI Factory ILIAS\Exercise\Assignment\PanelBuilderUI::$ui_factory
protected

◆ $ui_renderer

ILIAS UI Renderer ILIAS\Exercise\Assignment\PanelBuilderUI::$ui_renderer
protected

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