ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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

 ilPCProfileGUI (&$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
 ilPageContentGUI ($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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContentGUI
static _getCommonBBButtons ()
 Get common bb buttons. More...
 
- Data Fields inherited from ilPageContentGUI
 $content_obj
 
 $ilias
 
 $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.

Member Function Documentation

◆ create()

ilPCProfileGUI::create ( )

Create new personal data.

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

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

229  {
230  $form = $this->initForm(true);
231  if($form->checkInput())
232  {
233  $this->content_obj = new ilPCProfile($this->getPage());
234  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
235  $this->content_obj->setFields($form->getInput("mode"),
236  $this->getFieldsValues());
237  $this->updated = $this->pg_obj->update();
238  if ($this->updated === true)
239  {
240  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
241  }
242  }
243 
244  $this->insert($form);
245  }
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 93 of file class.ilPCProfileGUI.php.

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

Referenced by update().

94  {
95  global $tpl;
96 
97  $this->displayValidationError();
98 
99  if(!$a_form)
100  {
101  $a_form = $this->initForm();
102  }
103  $tpl->setContent($a_form->getHTML());
104  }
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 52 of file class.ilPCProfileGUI.php.

References $cmd, and $ret.

53  {
54  // get next class that processes or forwards current command
55  $next_class = $this->ctrl->getNextClass($this);
56 
57  // get current command
58  $cmd = $this->ctrl->getCmd();
59 
60  switch($next_class)
61  {
62  default:
63  $ret =& $this->$cmd();
64  break;
65  }
66 
67  return $ret;
68  }
$cmd
Definition: sahs_server.php:35

◆ getFieldsValues()

ilPCProfileGUI::getFieldsValues ( )
protected

Gather field values.

Returns
array

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

References $_POST.

Referenced by create(), and update().

210  {
211  $fields = array();
212  foreach($_POST as $name => $value)
213  {
214  if(substr($name, 0, 4) == "chk_")
215  {
216  if($value)
217  {
218  $fields[] = substr($name, 4);
219  }
220  }
221  }
222  return $fields;
223  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ ilPCProfileGUI()

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

Constructor public.

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

45  {
46  parent::ilPageContentGUI($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
47  }

◆ initForm()

ilPCProfileGUI::initForm (   $a_insert = false)
protected

Init profile form.

Parameters
bool$a_insert
Returns
ilPropertyFormGUI

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

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

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

113  {
114  global $ilCtrl, $ilToolbar;
115 
116  $is_template = ($this->getPageConfig()->getEnablePCType("PlaceHolder"));
117 
118  if(!$is_template)
119  {
120  $ilToolbar->addButton($this->lng->txt("cont_edit_personal_data"),
121  $ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "jumptoprofile"),
122  "profile");
123 
124  $lng_suffix = "";
125  }
126  else
127  {
128  $lng_suffix = "_template";
129  }
130 
131  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
132  $form = new ilPropertyFormGUI();
133  $form->setFormAction($ilCtrl->getFormAction($this));
134  if ($a_insert)
135  {
136  $form->setTitle($this->lng->txt("cont_insert_profile"));
137  }
138  else
139  {
140  $form->setTitle($this->lng->txt("cont_update_profile"));
141  }
142 
143  $mode = new ilRadioGroupInputGUI($this->lng->txt("cont_profile_mode"), "mode");
144  $form->addItem($mode);
145 
146  $mode_inherit = new ilRadioOption($this->lng->txt("cont_profile_mode_inherit"), "inherit");
147  $mode_inherit->setInfo($this->lng->txt("cont_profile_mode".$lng_suffix."_inherit_info"));
148  $mode->addOption($mode_inherit);
149 
150  $mode_manual = new ilRadioOption($this->lng->txt("cont_profile_mode_manual"), "manual");
151  $mode_manual->setInfo($this->lng->txt("cont_profile_mode_manual_info"));
152  $mode->addOption($mode_manual);
153 
154  $prefs = array();
155  if ($a_insert)
156  {
157  $mode->setValue("inherit");
158  }
159  else
160  {
161  $mode_value = $this->content_obj->getMode();
162  $mode->setValue($mode_value);
163 
164  $prefs = array();
165  if($mode_value == "manual")
166  {
167  foreach($this->content_obj->getFields() as $name)
168  {
169  $prefs["public_".$name] = "y";
170  }
171  }
172  }
173 
174  // always has to be set
175  $im_arr = array("icq","yahoo","msn","aim","skype","jabber","voip");
176  foreach ($im_arr as $im)
177  {
178  if(!isset($prefs["public_im_".$im]))
179  {
180  $prefs["public_im_".$im] = "n";
181  }
182  }
183 
184  include_once "Services/User/classes/class.ilPersonalProfileGUI.php";
185  $profile = new ilPersonalProfileGUI();
186  $profile->showPublicProfileFields($form, $prefs, $mode_manual, $is_template);
187 
188  if ($a_insert)
189  {
190 
191  $form->addCommandButton("create_profile", $this->lng->txt("save"));
192  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
193  }
194  else
195  {
196 
197  $form->addCommandButton("update", $this->lng->txt("save"));
198  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
199  }
200 
201  return $form;
202  }
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
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 75 of file class.ilPCProfileGUI.php.

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

Referenced by create().

76  {
77  global $tpl;
78 
79  $this->displayValidationError();
80 
81  if(!$a_form)
82  {
83  $a_form = $this->initForm(true);
84  }
85  $tpl->setContent($a_form->getHTML());
86  }
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 250 of file class.ilPCProfileGUI.php.

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

251  {
252  $form = $this->initForm(true);
253  if($form->checkInput())
254  {
255  $this->content_obj->setFields($form->getInput("mode"),
256  $this->getFieldsValues());
257  $this->updated = $this->pg_obj->update();
258  if ($this->updated === true)
259  {
260  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
261  }
262  }
263 
264  $this->pg_obj->addHierIDs();
265  $this->edit($form);
266  }
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:

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