ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPCProfileGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPCProfileGUI:
+ Collaboration diagram for ilPCProfileGUI:

Public Member Functions

 __construct (ilPageObject $a_pg_obj, ?ilPageContent $a_content_obj, string $a_hier_id, string $a_pc_id="")
 
 executeCommand ()
 
 insert (?ilPropertyFormGUI $a_form=null)
 Insert new personal data form. More...
 
 edit (?ilPropertyFormGUI $a_form=null)
 Edit personal data form. More...
 
 create ()
 Create new personal data. More...
 
 update ()
 Update personal data. More...
 
- 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

 initForm (bool $a_insert=false)
 Init profile form. More...
 
 getFieldsValues ()
 Gather field values. More...
 
- 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

ILIAS HTTP Services $http
 
ilToolbarGUI $toolbar
 
- 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilPCProfileGUI Handles user commands on personal data

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 24 of file class.ilPCProfileGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 29 of file class.ilPCProfileGUI.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\toolbar().

34  {
35  global $DIC;
36 
37  $this->tpl = $DIC["tpl"];
38  $this->ctrl = $DIC->ctrl();
39  $this->toolbar = $DIC->toolbar();
40  $this->http = $DIC->http();
41  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
42  }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCProfileGUI::create ( )

Create new personal data.

Definition at line 178 of file class.ilPCProfileGUI.php.

References ILIAS\Repository\ctrl(), getFieldsValues(), ilPageContentGUI\getPage(), initForm(), and insert().

178  : void
179  {
180  $form = $this->initForm(true);
181  if ($form->checkInput()) {
182  $this->content_obj = new ilPCProfile($this->getPage());
183  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
184  $this->content_obj->setFields(
185  $form->getInput("mode"),
186  $this->getFieldsValues()
187  );
188  $this->updated = $this->pg_obj->update();
189  if ($this->updated === true) {
190  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
191  }
192  }
193 
194  $this->insert($form);
195  }
insert(?ilPropertyFormGUI $a_form=null)
Insert new personal data form.
initForm(bool $a_insert=false)
Init profile form.
getFieldsValues()
Gather field values.
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()

ilPCProfileGUI::edit ( ?ilPropertyFormGUI  $a_form = null)

Edit personal data form.

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

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

Referenced by update().

77  : void
78  {
79  $tpl = $this->tpl;
80 
81  $this->displayValidationError();
82 
83  if (!$a_form) {
84  $a_form = $this->initForm();
85  }
86  $tpl->setContent($a_form->getHTML());
87  }
setContent(string $a_html)
Sets content for standard template.
initForm(bool $a_insert=false)
Init profile form.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCProfileGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

44  : void
45  {
46  // get next class that processes or forwards current command
47  $next_class = $this->ctrl->getNextClass($this);
48 
49  // get current command
50  $cmd = $this->ctrl->getCmd();
51 
52  switch ($next_class) {
53  default:
54  $this->$cmd();
55  break;
56  }
57  }
+ Here is the call graph for this function:

◆ getFieldsValues()

ilPCProfileGUI::getFieldsValues ( )
protected

Gather field values.

Definition at line 162 of file class.ilPCProfileGUI.php.

References ILIAS\FileDelivery\http().

Referenced by create(), and update().

162  : array
163  {
164  $fields = array();
165  foreach ($this->http->request()->getParsedBody() as $name => $value) {
166  if (substr($name, 0, 4) == "chk_") {
167  if ($value) {
168  $fields[] = substr($name, 4);
169  }
170  }
171  }
172  return $fields;
173  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilPCProfileGUI::initForm ( bool  $a_insert = false)
protected

Init profile form.

Definition at line 92 of file class.ilPCProfileGUI.php.

References ilPageContentGUI\$ctrl, $toolbar, ilToolbarGUI\addButton(), ilPageContentGUI\getPageConfig(), ILIAS\Repository\lng(), and ilRadioOption\setInfo().

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

93  {
94  $ilCtrl = $this->ctrl;
95  $ilToolbar = $this->toolbar;
96 
97  $is_template = ($this->getPageConfig()->getEnablePCType("PlaceHolder"));
98 
99  if (!$is_template) {
100  $ilToolbar->addButton(
101  $this->lng->txt("cont_edit_personal_data"),
102  $ilCtrl->getLinkTargetByClass("ildashboardgui", "jumptoprofile"),
103  "profile"
104  );
105 
106  $lng_suffix = "";
107  } else {
108  $lng_suffix = "_template";
109  }
110 
111  $form = new ilPropertyFormGUI();
112  $form->setFormAction($ilCtrl->getFormAction($this));
113  if ($a_insert) {
114  $form->setTitle($this->lng->txt("cont_insert_profile"));
115  } else {
116  $form->setTitle($this->lng->txt("cont_update_profile"));
117  }
118 
119  $mode = new ilRadioGroupInputGUI($this->lng->txt("cont_profile_mode"), "mode");
120  $form->addItem($mode);
121 
122  $mode_inherit = new ilRadioOption($this->lng->txt("cont_profile_mode_inherit"), "inherit");
123  $mode_inherit->setInfo($this->lng->txt("cont_profile_mode" . $lng_suffix . "_inherit_info"));
124  $mode->addOption($mode_inherit);
125 
126  $mode_manual = new ilRadioOption($this->lng->txt("cont_profile_mode_manual"), "manual");
127  $mode_manual->setInfo($this->lng->txt("cont_profile_mode_manual_info"));
128  $mode->addOption($mode_manual);
129 
130  $prefs = array();
131  if ($a_insert) {
132  $mode->setValue("inherit");
133  } else {
134  $mode_value = $this->content_obj->getMode();
135  $mode->setValue($mode_value);
136 
137  $prefs = array();
138  if ($mode_value == "manual") {
139  foreach ($this->content_obj->getFields() as $name) {
140  $prefs["public_" . $name] = "y";
141  }
142  }
143  }
144 
145  $profile = new ilPersonalProfileGUI();
146  $profile->showPublicProfileFields($form, $prefs, $mode_manual, $is_template);
147 
148  if ($a_insert) {
149  $form->addCommandButton("create", $this->lng->txt("save"));
150  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
151  } else {
152  $form->addCommandButton("update", $this->lng->txt("save"));
153  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
154  }
155 
156  return $form;
157  }
This class represents an option in a radio group.
setInfo(string $a_info)
This class represents a property in a property form.
addButton(string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCProfileGUI::insert ( ?ilPropertyFormGUI  $a_form = null)

Insert new personal data form.

Definition at line 62 of file class.ilPCProfileGUI.php.

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

Referenced by create().

62  : void
63  {
64  $tpl = $this->tpl;
65 
66  $this->displayValidationError();
67 
68  if (!$a_form) {
69  $a_form = $this->initForm(true);
70  }
71  $tpl->setContent($a_form->getHTML());
72  }
setContent(string $a_html)
Sets content for standard template.
initForm(bool $a_insert=false)
Init profile form.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCProfileGUI::update ( )

Update personal data.

Definition at line 200 of file class.ilPCProfileGUI.php.

References ILIAS\Repository\ctrl(), edit(), getFieldsValues(), and initForm().

200  : void
201  {
202  $form = $this->initForm(true);
203  if ($form->checkInput()) {
204  $this->content_obj->setFields(
205  $form->getInput("mode"),
206  $this->getFieldsValues()
207  );
208  $this->updated = $this->pg_obj->update();
209  if ($this->updated === true) {
210  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
211  }
212  }
213 
214  $this->pg_obj->addHierIDs();
215  $this->edit($form);
216  }
initForm(bool $a_insert=false)
Init profile form.
getFieldsValues()
Gather field values.
edit(?ilPropertyFormGUI $a_form=null)
Edit personal data form.
+ Here is the call graph for this function:

Field Documentation

◆ $http

ILIAS HTTP Services ilPCProfileGUI::$http
protected

Definition at line 26 of file class.ilPCProfileGUI.php.

◆ $toolbar

ilToolbarGUI ilPCProfileGUI::$toolbar
protected

Definition at line 27 of file class.ilPCProfileGUI.php.

Referenced by initForm().


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