ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilPCSkillsGUI Class Reference

Class ilPCSkillsGUI. More...

+ Inheritance diagram for ilPCSkillsGUI:
+ Collaboration diagram for ilPCSkillsGUI:

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 skills form. More...
 
 edit (ilPropertyFormGUI $a_form=null)
 Edit skills form. More...
 
 create ()
 Create new skill. More...
 
 update ()
 Update blog. 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 skills form. 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 ilPCSkillsGUI.

Handles user commands on skills 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.ilPCSkillsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor public.

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

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

Member Function Documentation

◆ create()

ilPCSkillsGUI::create ( )

Create new skill.

Definition at line 195 of file class.ilPCSkillsGUI.php.

References $_GET, $data, $valid, ilPageContentGUI\getPage(), ilPageContentGUI\getPageConfig(), initForm(), and insert().

196  {
197  $valid = false;
198 
199  // template mode: get skills from global skill tree
200  if($this->getPageConfig()->getEnablePCType("PlaceHolder"))
201  {
202  $data = (int)$_GET["skill_id"];
203  $valid = true;
204  }
205  // editor mode: use personal skills
206  else
207  {
208  $form = $this->initForm(true);
209  if($form->checkInput())
210  {
211  $data = $form->getInput("skill_id");
212  $valid = true;
213  }
214  }
215 
216  if($valid)
217  {
218  $this->content_obj = new ilPCSkills($this->getPage());
219  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
220  $this->content_obj->setData($data);
221  $this->updated = $this->pg_obj->update();
222  if ($this->updated === true)
223  {
224  $this->ctrl->returnToParent($this, "jump".$this->hier_id);
225  }
226  }
227 
228  $form->setValuesByPost();
229  return $this->insert($form);
230  }
$_GET["client_id"]
$valid
getPageConfig()
Get Page Config.
Class ilPCSkills.
insert(ilPropertyFormGUI $a_form=null)
Insert skills form.
initForm($a_insert=false)
Init skills form.
+ Here is the call graph for this function:

◆ edit()

ilPCSkillsGUI::edit ( ilPropertyFormGUI  $a_form = null)

Edit skills form.

Parameters
ilPropertyFormGUI$a_form

Definition at line 107 of file class.ilPCSkillsGUI.php.

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

Referenced by update().

108  {
109  global $tpl;
110 
111  $this->displayValidationError();
112 
113  // template mode: get skills from global skill tree
114  if($this->getPageConfig()->getEnablePCType("PlaceHolder"))
115  {
116  include_once "Services/Skill/classes/class.ilPersonalSkillExplorerGUI.php";
117  $exp = new ilPersonalSkillExplorerGUI($this, "edit", $this, "update", "skill_id");
118  if (!$exp->handleCommand())
119  {
120  $tpl->setContent($exp->getHTML());
121  }
122  }
123  // editor mode: use personal skills
124  else
125  {
126  if(!$a_form)
127  {
128  $a_form = $this->initForm();
129  }
130  $tpl->setContent($a_form->getHTML());
131  }
132  }
Explorer for selecting a personal skill.
getPageConfig()
Get Page Config.
displayValidationError()
display validation errors
initForm($a_insert=false)
Init skills form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCSkillsGUI::executeCommand ( )

execute command

Definition at line 52 of file class.ilPCSkillsGUI.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
$ret
Definition: parser.php:6

◆ initForm()

ilPCSkillsGUI::initForm (   $a_insert = false)
protected

Init skills form.

Parameters
bool$a_insert
Returns
ilPropertyFormGUI

Definition at line 140 of file class.ilPCSkillsGUI.php.

References $ilCtrl, $ilUser, ilPageContentGUI\$lng, $options, array, ilPersonalSkill\getSelectedUserSkills(), ilUtil\sendFailure(), and ilFormPropertyGUI\setRequired().

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

141  {
142  global $ilCtrl, $ilUser, $lng;
143 
144  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
145  $form = new ilPropertyFormGUI();
146  $form->setFormAction($ilCtrl->getFormAction($this));
147  if ($a_insert)
148  {
149  $form->setTitle($this->lng->txt("cont_insert_skills"));
150  }
151  else
152  {
153  $form->setTitle($this->lng->txt("cont_update_skills"));
154  }
155 
156  $options = array();
157  include_once "Services/Skill/classes/class.ilPersonalSkill.php";
158 
159  $skills = ilPersonalSkill::getSelectedUserSkills($ilUser->getId());
160  if($skills)
161  {
162  foreach($skills as $skill)
163  {
164  $options[$skill["skill_node_id"]] = $skill["title"];
165  }
166  asort($options);
167  }
168  else
169  {
170  ilUtil::sendFailure("cont_no_skills");
171  }
172  $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_skills"), "skill_id");
173  $obj->setRequired(true);
174  $obj->setOptions($options);
175  $form->addItem($obj);
176 
177  if ($a_insert)
178  {
179  $form->addCommandButton("create_skill", $this->lng->txt("select"));
180  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
181  }
182  else
183  {
184  $obj->setValue($this->content_obj->getSkillId());
185  $form->addCommandButton("update", $this->lng->txt("select"));
186  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
187  }
188 
189  return $form;
190  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
static getSelectedUserSkills($a_user_id)
Get personal selected user skills.
global $ilCtrl
Definition: ilias.php:18
if(!is_array($argv)) $options
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

ilPCSkillsGUI::insert ( ilPropertyFormGUI  $a_form = null)

Insert skills form.

Parameters
ilPropertyFormGUI$a_form

Definition at line 75 of file class.ilPCSkillsGUI.php.

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

Referenced by create().

76  {
77  global $tpl;
78 
79  $this->displayValidationError();
80 
81  // template mode: get skills from global skill tree
82  if($this->getPageConfig()->getEnablePCType("PlaceHolder"))
83  {
84  include_once "Services/Skill/classes/class.ilPersonalSkillExplorerGUI.php";
85  $exp = new ilPersonalSkillExplorerGUI($this, "insert", $this, "create", "skill_id");
86  if (!$exp->handleCommand())
87  {
88  $tpl->setContent($exp->getHTML());
89  }
90  }
91  // editor mode: use personal skills
92  else
93  {
94  if(!$a_form)
95  {
96  $a_form = $this->initForm(true);
97  }
98  $tpl->setContent($a_form->getHTML());
99  }
100  }
Explorer for selecting a personal skill.
getPageConfig()
Get Page Config.
displayValidationError()
display validation errors
initForm($a_insert=false)
Init skills form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCSkillsGUI::update ( )

Update blog.

Definition at line 235 of file class.ilPCSkillsGUI.php.

References $_GET, $data, $valid, edit(), ilPageContentGUI\getPageConfig(), and initForm().

236  {
237  // template mode: get skills from global skill tree
238  if($this->getPageConfig()->getEnablePCType("PlaceHolder"))
239  {
240  $data = (int)$_GET["skill_id"];
241  $valid = true;
242  }
243  // editor mode: use personal skills
244  else
245  {
246  $form = $this->initForm();
247  if($form->checkInput())
248  {
249  $data = $form->getInput("skill_id");
250  $valid = true;
251  }
252  }
253 
254  if($valid)
255  {
256  $this->content_obj->setData($data);
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  $form->setValuesByPost();
266  return $this->edit($form);
267  }
edit(ilPropertyFormGUI $a_form=null)
Edit skills form.
$_GET["client_id"]
$valid
getPageConfig()
Get Page Config.
initForm($a_insert=false)
Init skills form.
+ Here is the call graph for this function:

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