ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 @access 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 @access 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;"
 
- Protected Attributes inherited from ilPageContentGUI
 $log
 
- 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 @access public.

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

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

Member Function Documentation

◆ create()

ilPCProfileGUI::create ( )

Create new personal data.

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

219 {
220 $form = $this->initForm(true);
221 if($form->checkInput())
222 {
223 $this->content_obj = new ilPCProfile($this->getPage());
224 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
225 $this->content_obj->setFields($form->getInput("mode"),
226 $this->getFieldsValues());
227 $this->updated = $this->pg_obj->update();
228 if ($this->updated === true)
229 {
230 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
231 }
232 }
233
234 $this->insert($form);
235 }
initForm($a_insert=false)
Init profile form.
insert(ilPropertyFormGUI $a_form=null)
Insert new personal data form.
Class ilPCProfile.

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

+ 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.

94 {
95 global $tpl;
96
98
99 if(!$a_form)
100 {
101 $a_form = $this->initForm();
102 }
103 $tpl->setContent($a_form->getHTML());
104 }
displayValidationError()
display validation errors

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

Referenced by update().

+ 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.

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 }
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35

References $cmd, and $ret.

◆ getFieldsValues()

ilPCProfileGUI::getFieldsValues ( )
protected

Gather field values.

Returns
array

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

200 {
201 $fields = array();
202 foreach($_POST as $name => $value)
203 {
204 if(substr($name, 0, 4) == "chk_")
205 {
206 if($value)
207 {
208 $fields[] = substr($name, 4);
209 }
210 }
211 }
212 return $fields;
213 }
$_POST["username"]

References $_POST.

◆ 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.

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 include_once "Services/User/classes/class.ilPersonalProfileGUI.php";
175 $profile = new ilPersonalProfileGUI();
176 $profile->showPublicProfileFields($form, $prefs, $mode_manual, $is_template);
177
178 if ($a_insert)
179 {
180
181 $form->addCommandButton("create_profile", $this->lng->txt("save"));
182 $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
183 }
184 else
185 {
186
187 $form->addCommandButton("update", $this->lng->txt("save"));
188 $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
189 }
190
191 return $form;
192 }
getPageConfig()
Get Page Config.
GUI class for personal profile.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, and ilPageContentGUI\getPageConfig().

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

+ 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.

76 {
77 global $tpl;
78
80
81 if(!$a_form)
82 {
83 $a_form = $this->initForm(true);
84 }
85 $tpl->setContent($a_form->getHTML());
86 }

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

Referenced by create().

+ 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 240 of file class.ilPCProfileGUI.php.

241 {
242 $form = $this->initForm(true);
243 if($form->checkInput())
244 {
245 $this->content_obj->setFields($form->getInput("mode"),
246 $this->getFieldsValues());
247 $this->updated = $this->pg_obj->update();
248 if ($this->updated === true)
249 {
250 $this->ctrl->returnToParent($this, "jump".$this->hier_id);
251 }
252 }
253
254 $this->pg_obj->addHierIDs();
255 $this->edit($form);
256 }
edit(ilPropertyFormGUI $a_form=null)
Edit personal data form.

References edit(), and initForm().

+ Here is the call graph for this function:

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