ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPCSkillsGUI 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 ilPCSkillsGUI:
+ Collaboration diagram for ilPCSkillsGUI:

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)
 
 edit (?ilPropertyFormGUI $a_form=null)
 
 create ()
 
 update ()
 
- 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 skills form. 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

ilObjUser $user
 
ILIAS Skill Service SkillPersonalService $skill_personal_service
 
- 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 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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

34  {
35  global $DIC;
36 
37  $this->tpl = $DIC["tpl"];
38  $this->ctrl = $DIC->ctrl();
39  $this->user = $DIC->user();
40  $this->lng = $DIC->language();
41  $this->skill_personal_service = $DIC->skills()->personal();
42  parent::__construct($a_pg_obj, $a_content_obj, $a_hier_id, $a_pc_id);
43  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ create()

ilPCSkillsGUI::create ( )

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

References $data, $valid, ILIAS\Repository\ctrl(), ilPageContentGUI\getPage(), ilPageContentGUI\getPageConfig(), initForm(), insert(), and null.

149  : void
150  {
151  $valid = false;
152  $data = null;
153  $form = null;
154 
155  // template mode: get skills from global skill tree
156  if ($this->getPageConfig()->getEnablePCType("PlaceHolder")) {
157  $data = $this->request->getInt("skill_id");
158  $valid = true;
159  }
160  // editor mode: use personal skills
161  else {
162  $form = $this->initForm(true);
163  if ($form->checkInput()) {
164  $data = $form->getInput("skill_id");
165  $valid = true;
166  }
167  }
168 
169  if ($valid) {
170  $this->content_obj = new ilPCSkills($this->getPage());
171  $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
172  $this->content_obj->setData($data);
173  $this->updated = $this->pg_obj->update();
174  if ($this->updated === true) {
175  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
176  }
177  }
178 
179  $form->setValuesByPost();
180  $this->insert($form);
181  }
initForm(bool $a_insert=false)
Init skills form.
$valid
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
insert(?ilPropertyFormGUI $a_form=null)
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()

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

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

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

Referenced by update().

82  : void
83  {
84  $tpl = $this->tpl;
85 
86  $this->displayValidationError();
87 
88  // template mode: get skills from global skill tree
89  if ($this->getPageConfig()->getEnablePCType("PlaceHolder")) {
90  $exp = new ilPersonalSkillExplorerGUI($this, "edit", $this, "update", "skill_id");
91  if (!$exp->handleCommand()) {
92  $tpl->setContent($exp->getHTML());
93  }
94  }
95  // editor mode: use personal skills
96  else {
97  if (!$a_form) {
98  $a_form = $this->initForm();
99  }
100  $tpl->setContent($a_form->getHTML());
101  }
102  }
initForm(bool $a_insert=false)
Init skills form.
Explorer for selecting a personal skill.
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPCSkillsGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

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

◆ initForm()

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

Init skills form.

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

References ilPageContentGUI\$ctrl, $user, ILIAS\Repository\lng(), and ilFormPropertyGUI\setRequired().

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

110  $ilCtrl = $this->ctrl;
111  $ilUser = $this->user;
112 
113  $form = new ilPropertyFormGUI();
114  $form->setFormAction($ilCtrl->getFormAction($this));
115  if ($a_insert) {
116  $form->setTitle($this->lng->txt("cont_insert_skills"));
117  } else {
118  $form->setTitle($this->lng->txt("cont_update_skills"));
119  }
120 
121  $options = array();
122 
123  $skills = $this->skill_personal_service->getSelectedUserSkills($ilUser->getId());
124  if ($skills) {
125  foreach ($skills as $skill) {
126  $options[$skill->getSkillNodeId()] = $skill->getTitle();
127  }
128  asort($options);
129  } else {
130  $this->tpl->setOnScreenMessage('failure', "cont_no_skills");
131  }
132  $obj = new ilSelectInputGUI($this->lng->txt("cont_pc_skills"), "skill_id");
133  $obj->setRequired(true);
134  $obj->setOptions($options);
135  $form->addItem($obj);
136 
137  if ($a_insert) {
138  $form->addCommandButton("create", $this->lng->txt("select"));
139  $form->addCommandButton("cancelCreate", $this->lng->txt("cancel"));
140  } else {
141  $obj->setValue($this->content_obj->getSkillId());
142  $form->addCommandButton("update", $this->lng->txt("select"));
143  $form->addCommandButton("cancelUpdate", $this->lng->txt("cancel"));
144  }
145 
146  return $form;
147  }
This class represents a selection list property in a property form.
setRequired(bool $a_required)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insert()

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

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

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

Referenced by create().

60  : void
61  {
62  $tpl = $this->tpl;
63 
64  $this->displayValidationError();
65 
66  // template mode: get skills from global skill tree
67  if ($this->getPageConfig()->getEnablePCType("PlaceHolder")) {
68  $exp = new ilPersonalSkillExplorerGUI($this, "insert", $this, "create", "skill_id");
69  if (!$exp->handleCommand()) {
70  $tpl->setContent($exp->getHTML());
71  }
72  }
73  // editor mode: use personal skills
74  else {
75  if (!$a_form) {
76  $a_form = $this->initForm(true);
77  }
78  $tpl->setContent($a_form->getHTML());
79  }
80  }
initForm(bool $a_insert=false)
Init skills form.
Explorer for selecting a personal skill.
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilPCSkillsGUI::update ( )

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

References $data, $valid, ILIAS\Repository\ctrl(), edit(), ilPageContentGUI\getPageConfig(), initForm(), and null.

183  : void
184  {
185  $valid = false;
186  $data = null;
187  $form = null;
188 
189  // template mode: get skills from global skill tree
190  if ($this->getPageConfig()->getEnablePCType("PlaceHolder")) {
191  $data = $this->request->getInt("skill_id");
192  $valid = true;
193  }
194  // editor mode: use personal skills
195  else {
196  $form = $this->initForm();
197  if ($form->checkInput()) {
198  $data = $form->getInput("skill_id");
199  $valid = true;
200  }
201  }
202 
203  if ($valid) {
204  $this->content_obj->setData($data);
205  $this->updated = $this->pg_obj->update();
206  if ($this->updated === true) {
207  $this->ctrl->returnToParent($this, "jump" . $this->hier_id);
208  }
209  }
210 
211  $this->pg_obj->addHierIDs();
212  $form->setValuesByPost();
213  $this->edit($form);
214  }
initForm(bool $a_insert=false)
Init skills form.
$valid
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
edit(?ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

Field Documentation

◆ $skill_personal_service

ILIAS Skill Service SkillPersonalService ilPCSkillsGUI::$skill_personal_service
protected

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

◆ $user

ilObjUser ilPCSkillsGUI::$user
protected

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

Referenced by initForm().


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