ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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_amdfrm ()
 
 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 ()
 
 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 ()
 
 setEditorToolContext ()
 
 initEditor ()
 
 getEditorScriptTag (string $form_pc_id="", string $form_cname="")
 

Protected Attributes

ilAdvancedMDRecordGUI $record_gui
 
ILIAS DI UIServices $ui
 
StandardGUIRequest $port_request
 
ServerRequestInterface $http_request
 
- Protected Attributes inherited from ilPageContentGUI
ILIAS COPage Editor GUIService $editor_gui
 
ILIAS COPage InternalGUIService $gui
 
EditSessionRepository $edit_repo
 
string $pc_id = ""
 
array $chars
 
ilObjStyleSheet $style = null
 
LOMServices $lom_services
 
ilLogger $log
 
int $styleid = 0
 
EditGUIRequest $request
 
string $sub_command = ""
 
int $requested_ref_id = 0
 
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
 
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 = ""
 
DOMDocument $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: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCAMDFormGUI::create ( )

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

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

Referenced by create_amdfrm().

149  : void
150  {
152  $form = $this->getTemplateForm();
153  $lng = $this->lng;
154  $tpl = $this->tpl;
155 
156  if ($request->getMethod() === "POST") {
157  $form = $form->withRequest($request);
158  $data = $form->getData();
159  if (is_null($data)) {
160  $tpl->setContent($this->ui->renderer()->render($form));
161  return;
162  }
163  if (is_array($data["sec"])) {
164  $this->content_obj = new ilPCAMDForm($this->getPage());
165  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
166  $this->content_obj->setRecordIds($this->getRecordIdsFromForm($form));
167  $this->updated = $this->pg_obj->update();
168  if (!$this->updated) {
169  $tpl->setContent($this->ui->renderer()->render($form));
170  return;
171  }
172  $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
173  }
174  }
175  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
176  }
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:
+ Here is the caller graph for this function:

◆ create_amdfrm()

ilPCAMDFormGUI::create_amdfrm ( )

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

References create().

144  : void
145  {
146  $this->create();
147  }
+ Here is the call graph for this function:

◆ edit()

ilPCAMDFormGUI::edit ( )

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

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

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

◆ editPortfolio()

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

Edit courses form.

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

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), getPortfolioForm(), and ILIAS\UICore\GlobalTemplate\setContent().

Referenced by edit(), and updateAdvancedMetaData().

244  : void
245  {
246  $tpl = $this->tpl;
247 
248  $this->displayValidationError();
249 
250  if (!$form) {
251  $form = $this->getPortfolioForm(true);
252  }
253  $tpl->setContent($form->getHTML());
254  }
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 102 of file class.ilPCAMDFormGUI.php.

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

Referenced by edit().

102  : void
103  {
104  $tpl = $this->tpl;
105 
106  $this->displayValidationError();
107 
108  if (!$form) {
109  $form = $this->getTemplateForm(true);
110  }
111  $tpl->setContent($this->ui->renderer()->render($form));
112  }
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  case "ilpropertyformgui":
66  $form = $this->getPortfolioForm(true);
67  $this->ctrl->forwardCommand($form);
68  break;
69 
70  default:
71  $ret = $this->$cmd();
72  break;
73  }
74  }
getPortfolioForm(bool $edit=false)
+ Here is the call graph for this function:

◆ getAdvRecords()

ilPCAMDFormGUI::getAdvRecords ( )
protected

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

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

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

195  : array
196  {
197  if ($this->isTemplate()) {
199  $is_ref_id = true;
200  } else {
201  $id = $this->getPage()->getPortfolioId();
202  $is_ref_id = false;
203  }
204 
205  $recs = \ilAdvancedMDRecord::_getSelectedRecordsByObject($this->getPage()->getParentType(), $id, "pfpg", $is_ref_id);
206  return $recs;
207  }
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 256 of file class.ilPCAMDFormGUI.php.

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

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

257  {
259  if (is_null($content_obj)) {
260  $page = new ilPortfolioPage($this->port_request->getPortfolioPageId());
261  $page->buildDom();
262  $content_obj = $page->getContentObjectForPcId($this->request->getPCId());
263  }
264 
265  $lng = $this->lng;
266  $ctrl = $this->ctrl;
267 
268  $selected = [];
269  if ($edit) {
270  $selected = $content_obj->getRecordIds();
271  }
272  $recs = $this->getAdvRecords();
273  foreach ($recs as $r) {
274  $val = (in_array($r->getRecordId(), $selected));
275  }
276 
277  $form = new ilPropertyFormGUI();
278  $form->setFormAction($ctrl->getFormAction($this, "updateAdvancedMetaData"));
279 
280  $form->setTitle($lng->txt("prtf_edit_data"));
281 
282  $this->record_gui = new ilAdvancedMDRecordGUI(
284  'prtf',
285  $this->getPage()->getPortfolioId(),
286  'pfpg',
287  $this->getPage()->getId(),
288  false
289  );
290  $this->record_gui->setRecordFilter($selected);
291  $this->record_gui->setPropertyForm($form);
292  $this->record_gui->parse();
293 
294  $form->addCommandButton("updateAdvancedMetaData", $lng->txt("save"));
295  $form->addCommandButton("cancel", $lng->txt("cancel"));
296 
297  return $form;
298  }
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
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...
$r
+ 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 178 of file class.ilPCAMDFormGUI.php.

References $data, $r, and getAdvRecords().

Referenced by create(), and update().

178  : array
179  {
180  $data = $form->getData();
181  $ids = [];
182  if (!is_null($data) && is_array($data["sec"])) {
183  $recs = $this->getAdvRecords();
184  $ids = [];
185  foreach ($recs as $r) {
186  $rec_id = $data["sec"]["rec" . $r->getRecordId()];
187  if (isset($rec_id) && $rec_id) {
188  $ids[] = $r->getRecordId();
189  }
190  }
191  }
192  return $ids;
193  }
$r
+ 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 114 of file class.ilPCAMDFormGUI.php.

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

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

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

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

81  : void
82  {
83  $tpl = $this->tpl;
84 
85  $this->displayValidationError();
86 
87  if (!$form) {
88  $form = $this->getTemplateForm();
89  }
90  $tpl->setContent($this->ui->renderer()->render($form));
91  }
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 76 of file class.ilPCAMDFormGUI.php.

References ilPageContentGUI\getPage().

Referenced by edit(), and getAdvRecords().

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

◆ update()

ilPCAMDFormGUI::update ( )

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

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

209  : void
210  {
212  $form = $this->getTemplateForm(true);
213  $lng = $this->lng;
214  $tpl = $this->tpl;
215 
216  if ($request->getMethod() === "POST") {
217  $form = $form->withRequest($request);
218  $data = $form->getData();
219  if (is_null($data)) {
220  $tpl->setContent($this->ui->renderer()->render($form));
221  return;
222  }
223  if (is_array($data["sec"])) {
224  $this->content_obj->setRecordIds($this->getRecordIdsFromForm($form));
225  $this->updated = $this->pg_obj->update();
226  if (!$this->updated) {
227  $tpl->setContent($this->ui->renderer()->render($form));
228  return;
229  }
230  $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
231  }
232  }
233  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
234  }
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 300 of file class.ilPCAMDFormGUI.php.

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

300  : void
301  {
302  $lng = $this->lng;
303 
304  $form = $this->getPortfolioForm(true);
305 
306  // needed for proper advanced MD validation
307  $form->checkInput();
308  if (!$this->record_gui->importEditFormPostValues()) {
309  $this->editPortfolio($form); // #16470
310  return;
311  }
312 
313  if ($this->record_gui->writeEditForm()) {
314  $this->tpl->setOnScreenMessage('success', $lng->txt("settings_saved"), true);
315  }
316  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
317  }
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: