ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCAMDFormGUI Class Reference

AMD Form Page UI. More...

+ Inheritance diagram for ilPCAMDFormGUI:
+ Collaboration diagram for ilPCAMDFormGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 insert (Form\Standard $form=null)
 
 edit ()
 
 editTemplate (Form\Standard $form=null)
 
 getTemplateForm (bool $edit=false)
 
 create ()
 
 update ()
 
 editPortfolio (?ilPropertyFormGUI $form=null)
 Edit courses form. More...
 
 getPortfolioForm (bool $edit=false)
 
 updateAdvancedMetaData ()
 
- Public Member Functions inherited from ilPageContentGUI
 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id="", string $a_pc_id="0")
 
 setContentObject (ilPageContent $a_val)
 
 getContentObject ()
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 setPageConfig (ilPageConfig $a_val)
 
 getPageConfig ()
 
 setStyleId (int $a_styleid)
 
 getStyleId ()
 
 getStyle ()
 
 getCharacteristicsOfCurrentStyle (array $a_type)
 Get characteristics of current style and call setCharacteristics, if style is given. More...
 
 setCharacteristics (array $a_chars)
 
 getCharacteristics ()
 
 getHierId ()
 
 setHierId (string $a_hier_id)
 set hierarchical id in dom object More...
 
 delete ()
 
 moveAfter ()
 move content element after another element More...
 
 moveBefore ()
 move content element before another element More...
 
 splitPage ()
 split page to new page at specified position More...
 
 splitPageNext ()
 split page to next page at specified position More...
 
 displayValidationError ()
 
 cancelCreate ()
 cancel creating page content More...
 
 cancelUpdate ()
 cancel update More...
 
 cancel ()
 Cancel. More...
 
 deactivate ()
 gui function set enabled if is not enabled and vice versa More...
 
 cut ()
 Cut single element. More...
 
 copy ()
 Copy single element. More...
 
 getTemplateOptions (string $a_type="")
 Get table templates. More...
 

Protected Member Functions

 isTemplate ()
 
 getRecordIdsFromForm (Form\Standard $form)
 
 getAdvRecords ()
 
- Protected Member Functions inherited from ilPageContentGUI
 redirectToParent (string $hier_id="")
 
 getParentReturn (string $hier_id="")
 
 updateAndReturn ()
 
 setCurrentTextLang (string $lang_key)
 
 getCurrentTextLang ()
 

Protected Attributes

ilAdvancedMDRecordGUI $record_gui
 
ILIAS DI UIServices $ui
 
StandardGUIRequest $port_request
 
ServerRequestInterface $http_request
 
- Protected Attributes inherited from ilPageContentGUI
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
Style Content CharacteristicManager $char_manager
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 
- Data Fields inherited from ilPageContentGUI
ilPageContent $content_obj
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilPageObject $pg_obj
 
string $hier_id = ""
 
php4DOMDocument $dom
 
 $updated
 
string $target_script = ""
 
string $return_location = ""
 
ilPageConfig $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static string $style_selector_reset = "margin-top:2px; margin-bottom:2px; text-indent:0px; position:static; float:none; width: auto;"
 
- Static Protected Attributes inherited from ilPageContentGUI
static array $common_bb_buttons
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPCAMDFormGUI::__construct ( ilPageObject  $a_pg_obj,
?ilPageContent  $a_content_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

41  {
42  global $DIC;
43  $this->ctrl = $DIC->ctrl();
44  $this->ui = $DIC->ui();
45  $this->http_request = $DIC->http()->request();
46  $this->port_request = $DIC->portfolio()
47  ->internal()
48  ->gui()
49  ->standardRequest();
50  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
51 
52  $this->lng->loadLanguageModule("prtt");
53  $this->lng->loadLanguageModule("prtf");
54  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCAMDFormGUI::create ( )

Definition at line 145 of file class.ilPCAMDFormGUI.php.

References $data, $http_request, ilPageContentGUI\$lng, ilPageContentGUI\$request, ilPageContentGUI\$tpl, ILIAS\Repository\ctrl(), ilPageContentGUI\getPage(), getRecordIdsFromForm(), getTemplateForm(), ilGlobalTemplateInterface\setContent(), ilLanguage\txt(), and ILIAS\Repository\ui().

145  : void
146  {
148  $form = $this->getTemplateForm();
149  $lng = $this->lng;
150  $tpl = $this->tpl;
151 
152  if ($request->getMethod() === "POST") {
153  $form = $form->withRequest($request);
154  $data = $form->getData();
155  if (is_null($data)) {
156  $tpl->setContent($this->ui->renderer()->render($form));
157  return;
158  }
159  if (is_array($data["sec"])) {
160  $this->content_obj = new ilPCAMDForm($this->getPage());
161  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
162  $this->content_obj->setRecordIds($this->getRecordIdsFromForm($form));
163  $this->updated = $this->pg_obj->update();
164  if (!$this->updated) {
165  $tpl->setContent($this->ui->renderer()->render($form));
166  return;
167  }
168  $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
169  }
170  }
171  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
172  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ServerRequestInterface $http_request
getRecordIdsFromForm(Form\Standard $form)
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
getTemplateForm(bool $edit=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ edit()

ilPCAMDFormGUI::edit ( )

Definition at line 94 of file class.ilPCAMDFormGUI.php.

References editPortfolio(), editTemplate(), and isTemplate().

94  : void
95  {
96  if ($this->isTemplate()) {
97  $this->editTemplate();
98  return;
99  }
100  $this->editPortfolio();
101  }
editPortfolio(?ilPropertyFormGUI $form=null)
Edit courses form.
editTemplate(Form\Standard $form=null)
+ Here is the call graph for this function:

◆ editPortfolio()

ilPCAMDFormGUI::editPortfolio ( ?ilPropertyFormGUI  $form = null)

Edit courses form.

Definition at line 240 of file class.ilPCAMDFormGUI.php.

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), getPortfolioForm(), and ilGlobalTemplateInterface\setContent().

Referenced by edit(), and updateAdvancedMetaData().

240  : void
241  {
242  $tpl = $this->tpl;
243 
244  $this->displayValidationError();
245 
246  if (!$form) {
247  $form = $this->getPortfolioForm(true);
248  }
249  $tpl->setContent($form->getHTML());
250  }
getPortfolioForm(bool $edit=false)
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editTemplate()

ilPCAMDFormGUI::editTemplate ( Form\Standard  $form = null)

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

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), getTemplateForm(), ilGlobalTemplateInterface\setContent(), and ILIAS\Repository\ui().

Referenced by edit().

103  : void
104  {
105  $tpl = $this->tpl;
106 
107  $this->displayValidationError();
108 
109  if (!$form) {
110  $form = $this->getTemplateForm(true);
111  }
112  $tpl->setContent($this->ui->renderer()->render($form));
113  }
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
getTemplateForm(bool $edit=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCAMDFormGUI::executeCommand ( )

Definition at line 56 of file class.ilPCAMDFormGUI.php.

References ILIAS\Repository\ctrl(), and getPortfolioForm().

56  : void
57  {
58  // get next class that processes or forwards current command
59  $next_class = $this->ctrl->getNextClass($this);
60 
61  // get current command
62  $cmd = $this->ctrl->getCmd();
63 
64  switch ($next_class) {
65 
66  case "ilpropertyformgui":
67  $form = $this->getPortfolioForm(true);
68  $this->ctrl->forwardCommand($form);
69  break;
70 
71  default:
72  $ret = $this->$cmd();
73  break;
74  }
75  }
getPortfolioForm(bool $edit=false)
+ Here is the call graph for this function:

◆ getAdvRecords()

ilPCAMDFormGUI::getAdvRecords ( )
protected

Definition at line 191 of file class.ilPCAMDFormGUI.php.

References $id, ilPageContentGUI\$requested_ref_id, ilAdvancedMDRecord\_getSelectedRecordsByObject(), ilPageContentGUI\getPage(), and isTemplate().

Referenced by getPortfolioForm(), getRecordIdsFromForm(), and getTemplateForm().

191  : array
192  {
193  if ($this->isTemplate()) {
195  $is_ref_id = true;
196  } else {
197  $id = $this->getPage()->getPortfolioId();
198  $is_ref_id = false;
199  }
200 
201  $recs = \ilAdvancedMDRecord::_getSelectedRecordsByObject($this->getPage()->getParentType(), $id, "pfpg", $is_ref_id);
202  return $recs;
203  }
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPortfolioForm()

ilPCAMDFormGUI::getPortfolioForm ( bool  $edit = false)

Definition at line 252 of file class.ilPCAMDFormGUI.php.

References ilPageContentGUI\$content_obj, ilPageContentGUI\$ctrl, ilPageContentGUI\$lng, ilPageObject\buildDom(), getAdvRecords(), ilCtrl\getFormAction(), ILIAS\Survey\Mode\getId(), ilPageContentGUI\getPage(), ilAdvancedMDRecordGUI\MODE_EDITOR, and ilLanguage\txt().

Referenced by editPortfolio(), executeCommand(), and updateAdvancedMetaData().

253  {
255  if (is_null($content_obj)) {
256  $page = new ilPortfolioPage($this->port_request->getPortfolioPageId());
257  $page->buildDom();
258  $content_obj = $page->getContentObjectForPcId($this->request->getPCId());
259  }
260 
261  $lng = $this->lng;
262  $ctrl = $this->ctrl;
263 
264  $selected = [];
265  if ($edit) {
266  $selected = $content_obj->getRecordIds();
267  }
268  $recs = $this->getAdvRecords();
269  foreach ($recs as $r) {
270  $val = (in_array($r->getRecordId(), $selected));
271  }
272 
273  $form = new ilPropertyFormGUI();
274  $form->setFormAction($ctrl->getFormAction($this, "updateAdvancedMetaData"));
275 
276  $form->setTitle($lng->txt("prtf_edit_data"));
277 
278  $this->record_gui = new ilAdvancedMDRecordGUI(
280  'prtf',
281  $this->getPage()->getPortfolioId(),
282  'pfpg',
283  $this->getPage()->getId(),
284  false
285  );
286  $this->record_gui->setRecordFilter($selected);
287  $this->record_gui->setPropertyForm($form);
288  $this->record_gui->parse();
289 
290  $form->addCommandButton("updateAdvancedMetaData", $lng->txt("save"));
291  $form->addCommandButton("cancel", $lng->txt("cancel"));
292 
293  return $form;
294  }
buildDom(bool $a_force=false)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordIdsFromForm()

ilPCAMDFormGUI::getRecordIdsFromForm ( Form\Standard  $form)
protected

Definition at line 174 of file class.ilPCAMDFormGUI.php.

References $data, and getAdvRecords().

Referenced by create(), and update().

174  : array
175  {
176  $data = $form->getData();
177  $ids = [];
178  if (!is_null($data) && is_array($data["sec"])) {
179  $recs = $this->getAdvRecords();
180  $ids = [];
181  foreach ($recs as $r) {
182  $rec_id = $data["sec"]["rec" . $r->getRecordId()];
183  if (isset($rec_id) && $rec_id) {
184  $ids[] = $r->getRecordId();
185  }
186  }
187  }
188  return $ids;
189  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplateForm()

ilPCAMDFormGUI::getTemplateForm ( bool  $edit = false)

Definition at line 115 of file class.ilPCAMDFormGUI.php.

References ilPageContentGUI\$ctrl, Vendor\Package\$f, $ui, getAdvRecords(), ilCtrl\getLinkTarget(), ILIAS\Repository\lng(), and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by create(), editTemplate(), insert(), and update().

115  : Form\Standard
116  {
117  $ui = $this->ui;
118  $f = $ui->factory();
119  $ctrl = $this->ctrl;
120 
121  $selected = [];
122  if ($edit) {
123  $selected = $this->content_obj->getRecordIds();
124  }
125  $recs = $this->getAdvRecords();
126  $fields = array();
127  foreach ($recs as $r) {
128  $val = (in_array($r->getRecordId(), $selected));
129  $fields["rec" . $r->getRecordId()] =
130  $f->input()->field()->checkbox($r->getTitle(), $r->getDescription())
131  ->withValue($val);
132  }
133 
134  // section
135  $section1 = $f->input()->field()->section($fields, $this->lng->txt("prtt_select_datasets"));
136 
137  if ($edit) {
138  $form_action = $ctrl->getLinkTarget($this, "update");
139  } else {
140  $form_action = $ctrl->getLinkTarget($this, "create_amdfrm");
141  }
142  return $f->input()->container()->form()->standard($form_action, ["sec" => $section1]);
143  }
ILIAS DI UIServices $ui
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCAMDFormGUI::insert ( Form\Standard  $form = null)

Definition at line 82 of file class.ilPCAMDFormGUI.php.

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), getTemplateForm(), ilGlobalTemplateInterface\setContent(), and ILIAS\Repository\ui().

82  : void
83  {
84  $tpl = $this->tpl;
85 
86  $this->displayValidationError();
87 
88  if (!$form) {
89  $form = $this->getTemplateForm();
90  }
91  $tpl->setContent($this->ui->renderer()->render($form));
92  }
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
getTemplateForm(bool $edit=false)
+ Here is the call graph for this function:

◆ isTemplate()

ilPCAMDFormGUI::isTemplate ( )
protected

Definition at line 77 of file class.ilPCAMDFormGUI.php.

References ilPageContentGUI\getPage().

Referenced by edit(), and getAdvRecords().

77  : bool
78  {
79  return ($this->getPage()->getParentType() === "prtt");
80  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCAMDFormGUI::update ( )

Definition at line 205 of file class.ilPCAMDFormGUI.php.

References $data, $http_request, ilPageContentGUI\$lng, ilPageContentGUI\$request, ilPageContentGUI\$tpl, ILIAS\Repository\ctrl(), getRecordIdsFromForm(), getTemplateForm(), ilGlobalTemplateInterface\setContent(), ilLanguage\txt(), and ILIAS\Repository\ui().

205  : void
206  {
208  $form = $this->getTemplateForm(true);
209  $lng = $this->lng;
210  $tpl = $this->tpl;
211 
212  if ($request->getMethod() === "POST") {
213  $form = $form->withRequest($request);
214  $data = $form->getData();
215  if (is_null($data)) {
216  $tpl->setContent($this->ui->renderer()->render($form));
217  return;
218  }
219  if (is_array($data["sec"])) {
220  $this->content_obj->setRecordIds($this->getRecordIdsFromForm($form));
221  $this->updated = $this->pg_obj->update();
222  if (!$this->updated) {
223  $tpl->setContent($this->ui->renderer()->render($form));
224  return;
225  }
226  $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
227  }
228  }
229  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
230  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ServerRequestInterface $http_request
getRecordIdsFromForm(Form\Standard $form)
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
getTemplateForm(bool $edit=false)
+ Here is the call graph for this function:

◆ updateAdvancedMetaData()

ilPCAMDFormGUI::updateAdvancedMetaData ( )

Definition at line 296 of file class.ilPCAMDFormGUI.php.

References ilPageContentGUI\$lng, ILIAS\Repository\ctrl(), editPortfolio(), getPortfolioForm(), and ilLanguage\txt().

296  : void
297  {
298  $lng = $this->lng;
299 
300  $form = $this->getPortfolioForm(true);
301 
302  // needed for proper advanced MD validation
303  $form->checkInput();
304  if (!$this->record_gui->importEditFormPostValues()) {
305  $this->editPortfolio($form); // #16470
306  return;
307  }
308 
309  if ($this->record_gui->writeEditForm()) {
310  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
311  }
312  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
313  }
getPortfolioForm(bool $edit=false)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
editPortfolio(?ilPropertyFormGUI $form=null)
Edit courses form.
+ Here is the call graph for this function:

Field Documentation

◆ $http_request

ServerRequestInterface ilPCAMDFormGUI::$http_request
protected

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

Referenced by create(), and update().

◆ $port_request

StandardGUIRequest ilPCAMDFormGUI::$port_request
protected

Definition at line 33 of file class.ilPCAMDFormGUI.php.

◆ $record_gui

ilAdvancedMDRecordGUI ilPCAMDFormGUI::$record_gui
protected

Definition at line 31 of file class.ilPCAMDFormGUI.php.

◆ $ui

ILIAS DI UIServices ilPCAMDFormGUI::$ui
protected

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

Referenced by getTemplateForm().


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