ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 ()
 
 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:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCAMDFormGUI::create ( )

Definition at line 144 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().

144  : void
145  {
147  $form = $this->getTemplateForm();
148  $lng = $this->lng;
149  $tpl = $this->tpl;
150 
151  if ($request->getMethod() === "POST") {
152  $form = $form->withRequest($request);
153  $data = $form->getData();
154  if (is_null($data)) {
155  $tpl->setContent($this->ui->renderer()->render($form));
156  return;
157  }
158  if (is_array($data["sec"])) {
159  $this->content_obj = new ilPCAMDForm($this->getPage());
160  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
161  $this->content_obj->setRecordIds($this->getRecordIdsFromForm($form));
162  $this->updated = $this->pg_obj->update();
163  if (!$this->updated) {
164  $tpl->setContent($this->ui->renderer()->render($form));
165  return;
166  }
167  $this->tpl->setOnScreenMessage('info', $lng->txt("msg_obj_modified"), true);
168  }
169  }
170  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
171  }
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 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 239 of file class.ilPCAMDFormGUI.php.

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

Referenced by edit(), and updateAdvancedMetaData().

239  : void
240  {
241  $tpl = $this->tpl;
242 
243  $this->displayValidationError();
244 
245  if (!$form) {
246  $form = $this->getPortfolioForm(true);
247  }
248  $tpl->setContent($form->getHTML());
249  }
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 190 of file class.ilPCAMDFormGUI.php.

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

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

190  : array
191  {
192  if ($this->isTemplate()) {
194  $is_ref_id = true;
195  } else {
196  $id = $this->getPage()->getPortfolioId();
197  $is_ref_id = false;
198  }
199 
200  $recs = \ilAdvancedMDRecord::_getSelectedRecordsByObject($this->getPage()->getParentType(), $id, "pfpg", $is_ref_id);
201  return $recs;
202  }
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 251 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().

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

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

Referenced by create(), and update().

173  : array
174  {
175  $data = $form->getData();
176  $ids = [];
177  if (!is_null($data) && is_array($data["sec"])) {
178  $recs = $this->getAdvRecords();
179  $ids = [];
180  foreach ($recs as $r) {
181  $rec_id = $data["sec"]["rec" . $r->getRecordId()];
182  if (isset($rec_id) && $rec_id) {
183  $ids[] = $r->getRecordId();
184  }
185  }
186  }
187  return $ids;
188  }
$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 204 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().

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

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

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