ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPCProfileGUI Class Reference

Class ilPCProfileGUI. More...

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

Public Member Functions

 __construct (&$a_pg_obj, &$a_content_obj, $a_hier_id, $a_pc_id="")
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 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 ($a_pg_obj, $a_content_obj, $a_hier_id=0, $a_pc_id="")
 Constructor public. More...
 
 setContentObject ($a_val)
 Set content object. More...
 
 getContentObject ()
 Get content object. More...
 
 setPage ($a_val)
 Set page. More...
 
 getPage ()
 Get page. More...
 
 setPageConfig ($a_val)
 Set Page Config. More...
 
 getPageConfig ()
 Get Page Config. More...
 
 setStyleId ($a_styleid)
 Set Style Id. More...
 
 getStyleId ()
 Get Style Id. More...
 
 getStyle ()
 Get style object. More...
 
 setCharacteristics ($a_chars)
 Set Characteristics. More...
 
 getCharacteristics ()
 Get characteristics. More...
 
 getHierId ()
 get hierarchical id in dom object More...
 
 setHierId ($a_hier_id)
 get hierarchical id in dom object More...
 
 getBBMenu ($a_ta_name="par_content")
 Get the bb menu incl. More...
 
 delete ()
 delete content element More...
 
 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 ()
 display validation errors More...
 
 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 ($a_type)
 Get table templates. More...
 

Protected Member Functions

 initForm ($a_insert=false)
 Init profile form. More...
 
 getFieldsValues ()
 Gather field values. More...
 
- Protected Member Functions inherited from ilPageContentGUI
 getCharacteristicsOfCurrentStyle ($a_type)
 Get characteristics of current style. More...
 

Protected Attributes

 $toolbar
 
- Protected Attributes inherited from ilPageContentGUI
 $error
 
 $log
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $tpl
 
 $lng
 
 $ctrl
 
 $pg_obj
 
 $hier_id
 
 $dom
 
 $updated
 
 $target_script
 
 $return_location
 
 $page_config = null
 
- Static Public Attributes inherited from ilPageContentGUI
static $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 $common_bb_buttons
 

Detailed Description

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
Version
$I$

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

Constructor & Destructor Documentation

◆ __construct()

ilPCProfileGUI::__construct ( $a_pg_obj,
$a_content_obj,
  $a_hier_id,
  $a_pc_id = "" 
)

Constructor public.

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

50  {
51  global $DIC;
52 
53  $this->tpl = $DIC["tpl"];
54  $this->ctrl = $DIC->ctrl();
55  $this->toolbar = $DIC->toolbar();
56  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
57  }
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCProfileGUI::create ( )

Create new personal data.

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

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

209  {
210  $form = $this->initForm(true);
211  if ($form->checkInput()) {
212  $this->content_obj = new ilPCProfile($this->getPage());
213  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
214  $this->content_obj->setFields(
215  $form->getInput("mode"),
216  $this->getFieldsValues()
217  );
218  $this->updated = $this->pg_obj->update();
219  if ($this->updated === true) {
220  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
221  }
222  }
223 
224  $this->insert($form);
225  }
initForm($a_insert=false)
Init profile form.
insert(ilPropertyFormGUI $a_form=null)
Insert new personal data form.
getFieldsValues()
Gather field values.
Class ilPCProfile.
+ Here is the call graph for this function:

◆ edit()

ilPCProfileGUI::edit ( ilPropertyFormGUI  $a_form = null)

Edit personal data form.

Parameters
ilPropertyFormGUI$a_form

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

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initForm().

Referenced by update().

102  {
103  $tpl = $this->tpl;
104 
105  $this->displayValidationError();
106 
107  if (!$a_form) {
108  $a_form = $this->initForm();
109  }
110  $tpl->setContent($a_form->getHTML());
111  }
initForm($a_insert=false)
Init profile form.
displayValidationError()
display validation errors
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCProfileGUI::executeCommand ( )

execute command

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

References $ret.

63  {
64  // get next class that processes or forwards current command
65  $next_class = $this->ctrl->getNextClass($this);
66 
67  // get current command
68  $cmd = $this->ctrl->getCmd();
69 
70  switch ($next_class) {
71  default:
72  $ret = $this->$cmd();
73  break;
74  }
75 
76  return $ret;
77  }
$ret
Definition: parser.php:6

◆ getFieldsValues()

ilPCProfileGUI::getFieldsValues ( )
protected

Gather field values.

Returns
array

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

References $_POST, and $name.

Referenced by create(), and update().

193  {
194  $fields = array();
195  foreach ($_POST as $name => $value) {
196  if (substr($name, 0, 4) == "chk_") {
197  if ($value) {
198  $fields[] = substr($name, 4);
199  }
200  }
201  }
202  return $fields;
203  }
if($format !==null) $name
Definition: metadata.php:230
$_POST["username"]
+ Here is the caller graph for this function:

◆ initForm()

ilPCProfileGUI::initForm (   $a_insert = false)
protected

Init profile form.

Parameters
bool$a_insert
Returns
ilPropertyFormGUI

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

References ilPageContentGUI\$ctrl, $ilCtrl, $name, $toolbar, ilPageContentGUI\getPageConfig(), and ilRadioOption\setInfo().

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

120  {
122  $ilToolbar = $this->toolbar;
123 
124  $is_template = ($this->getPageConfig()->getEnablePCType("PlaceHolder"));
125 
126  if (!$is_template) {
127  $ilToolbar->addButton(
128  $this->lng->txt("cont_edit_personal_data"),
129  $ilCtrl->getLinkTargetByClass("ildashboardgui", "jumptoprofile"),
130  "profile"
131  );
132 
133  $lng_suffix = "";
134  } else {
135  $lng_suffix = "_template";
136  }
137 
138  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
139  $form = new ilPropertyFormGUI();
140  $form->setFormAction($ilCtrl->getFormAction($this));
141  if ($a_insert) {
142  $form->setTitle($this->lng->txt("cont_insert_profile"));
143  } else {
144  $form->setTitle($this->lng->txt("cont_update_profile"));
145  }
146 
147  $mode = new ilRadioGroupInputGUI($this->lng->txt("cont_profile_mode"), "mode");
148  $form->addItem($mode);
149 
150  $mode_inherit = new ilRadioOption($this->lng->txt("cont_profile_mode_inherit"), "inherit");
151  $mode_inherit->setInfo($this->lng->txt("cont_profile_mode" . $lng_suffix . "_inherit_info"));
152  $mode->addOption($mode_inherit);
153 
154  $mode_manual = new ilRadioOption($this->lng->txt("cont_profile_mode_manual"), "manual");
155  $mode_manual->setInfo($this->lng->txt("cont_profile_mode_manual_info"));
156  $mode->addOption($mode_manual);
157 
158  $prefs = array();
159  if ($a_insert) {
160  $mode->setValue("inherit");
161  } else {
162  $mode_value = $this->content_obj->getMode();
163  $mode->setValue($mode_value);
164 
165  $prefs = array();
166  if ($mode_value == "manual") {
167  foreach ($this->content_obj->getFields() as $name) {
168  $prefs["public_" . $name] = "y";
169  }
170  }
171  }
172 
173  $profile = new ilPersonalProfileGUI();
174  $profile->showPublicProfileFields($form, $prefs, $mode_manual, $is_template);
175 
176  if ($a_insert) {
177  $form->addCommandButton("create_profile", $this->lng->txt("save"));
178  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
179  } else {
180  $form->addCommandButton("update", $this->lng->txt("save"));
181  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
182  }
183 
184  return $form;
185  }
This class represents an option in a radio group.
This class represents a property form user interface.
getPageConfig()
Get Page Config.
setInfo($a_info)
Set Info.
global $ilCtrl
Definition: ilias.php:18
if($format !==null) $name
Definition: metadata.php:230
This class represents a property in a property form.
GUI class for personal profile.
+ 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.

Parameters
ilPropertyFormGUI$a_form

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

References ilPageContentGUI\$tpl, ilPageContentGUI\displayValidationError(), and initForm().

Referenced by create().

85  {
86  $tpl = $this->tpl;
87 
88  $this->displayValidationError();
89 
90  if (!$a_form) {
91  $a_form = $this->initForm(true);
92  }
93  $tpl->setContent($a_form->getHTML());
94  }
initForm($a_insert=false)
Init profile form.
displayValidationError()
display validation errors
+ 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 230 of file class.ilPCProfileGUI.php.

References edit(), getFieldsValues(), and initForm().

231  {
232  $form = $this->initForm(true);
233  if ($form->checkInput()) {
234  $this->content_obj->setFields(
235  $form->getInput("mode"),
236  $this->getFieldsValues()
237  );
238  $this->updated = $this->pg_obj->update();
239  if ($this->updated === true) {
240  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
241  }
242  }
243 
244  $this->pg_obj->addHierIDs();
245  $this->edit($form);
246  }
initForm($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

◆ $toolbar

ilPCProfileGUI::$toolbar
protected

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

Referenced by initForm().


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