ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSkillRootGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Skill/classes/class.ilSkillTreeNodeGUI.php");
6 
17 {
21  protected $ctrl;
22 
26  protected $tpl;
27 
31  protected $tabs;
32 
36  protected $toolbar;
37 
41  protected $lng;
42 
43 
47  public function __construct($a_node_id = 0)
48  {
49  global $DIC;
50 
51  $this->ctrl = $DIC->ctrl();
52  $this->tpl = $DIC["tpl"];
53  $this->tabs = $DIC->tabs();
54  $this->toolbar = $DIC->toolbar();
55  $this->lng = $DIC->language();
56  $ilCtrl = $DIC->ctrl();
57 
58  $ilCtrl->saveParameter($this, "obj_id");
59 
60  parent::__construct($a_node_id);
61  }
62 
66  public function getType()
67  {
68  return "skrt";
69  }
70 
74  public function executeCommand()
75  {
77  $tpl = $this->tpl;
78  $ilTabs = $this->tabs;
79 
80  $next_class = $ilCtrl->getNextClass($this);
81  $cmd = $ilCtrl->getCmd();
82 
83  switch ($next_class) {
84  default:
85  $ret = $this->$cmd();
86  break;
87  }
88  }
89 
93  public function listTemplates()
94  {
95  $tpl = $this->tpl;
96  $ilToolbar = $this->toolbar;
98  $lng = $this->lng;
99  $ilTabs = $this->tabs;
100 
101  $skmg_set = new ilSetting("skmg");
102  $enable_skmg = $skmg_set->get("enable_skmg");
103  if (!$enable_skmg) {
104  ilUtil::sendInfo($lng->txt("skmg_skill_management_deactivated"));
105  }
106 
107  $this->getParentGUI()->showTree(true, $this, "listTemplates");
108  $ilTabs->activateTab("skill_templates");
109 
110  include_once("./Services/Skill/classes/class.ilSkillTemplateCategoryGUI.php");
111  if ($this->checkPermissionBool("write")) {
113  }
114 
115  include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
117  $this,
118  "listTemplates",
119  (int) $_GET["obj_id"],
121  );
122 
123  $tpl->setContent($table->getHTML());
124  }
125 
129  public function listSkills()
130  {
131  $tpl = $this->tpl;
132  $ilToolbar = $this->toolbar;
134  $lng = $this->lng;
135  $ilTabs = $this->tabs;
136 
137  $skmg_set = new ilSetting("skmg");
138  $enable_skmg = $skmg_set->get("enable_skmg");
139  if (!$enable_skmg) {
140  ilUtil::sendInfo($lng->txt("skmg_skill_management_deactivated"));
141  }
142 
143  $this->getParentGUI()->showTree(false, $this, "listSkills");
144  $ilTabs->activateTab("skills");
145 
146  include_once("./Services/Skill/classes/class.ilSkillCategoryGUI.php");
147  if ($this->checkPermissionBool("write")) {
149  }
150 
151  include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
153  $this,
154  "listSkills",
155  (int) $_GET["obj_id"],
157  );
158 
159  $tpl->setContent($table->getHTML());
160  }
161 
165  public function cancelDelete()
166  {
168 
169  if ($_GET["tmpmode"]) {
170  $ilCtrl->redirect($this, "listTemplates");
171  } else {
172  $ilCtrl->redirect($this, "listSkills");
173  }
174  }
175 
179  public function showImportForm()
180  {
181  $tpl = $this->tpl;
182  $ilTabs = $this->tabs;
183 
184  $ilTabs->activateTab("skills");
185  $tpl->setContent($this->initInputForm()->getHTML());
186  }
187 
191  public function initInputForm()
192  {
193  $lng = $this->lng;
195 
196  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
197  $form = new ilPropertyFormGUI();
198 
199  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
200  $fi = new ilFileInputGUI($lng->txt("skmg_input_file"), "import_file");
201  $fi->setSuffixes(array("zip"));
202  $fi->setRequired(true);
203  $form->addItem($fi);
204 
205  // save and cancel commands
206  $form->addCommandButton("importSkills", $lng->txt("import"));
207  $form->addCommandButton("listSkills", $lng->txt("cancel"));
208 
209  $form->setTitle($lng->txt("skmg_import_skills"));
210  $form->setFormAction($ilCtrl->getFormAction($this));
211 
212  return $form;
213  }
214 
218  public function importSkills()
219  {
220  $tpl = $this->tpl;
221  $lng = $this->lng;
223  $ilTabs = $this->tabs;
224 
225  $form = $this->initInputForm();
226  if ($form->checkInput()) {
227  include_once("./Services/Export/classes/class.ilImport.php");
228  $imp = new ilImport();
229  $imp->importEntity($_FILES["import_file"]["tmp_name"], $_FILES["import_file"]["name"], "skmg", "Services/Skill");
230 
231  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
232  $ilCtrl->redirect($this, "listSkills");
233  } else {
234  $ilTabs->activateTab("skills");
235  $form->setValuesByPost();
236  $tpl->setContent($form->getHtml());
237  }
238  }
239 }
Skill root GUI class.
static addCreationButtons()
Add creation buttons.
getType()
Get Node Type.
This class represents a property form user interface.
global $DIC
Definition: saml.php:7
initInputForm()
Init input form.
$_GET["client_id"]
importSkills()
Import skills.
This class represents a file property in a property form.
Import class.
cancelDelete()
cancel delete
getParentGUI()
Get Parent GUI class (ilObjSCORM2004LearningModuleGUI).
listSkills()
List skills.
checkPermissionBool($a_perm)
Check permission pool.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
Basic GUI class for skill tree nodes.
listTemplates()
List templates.
static addCreationButtons()
Add creation buttons.
__construct($a_node_id=0)
Constructor.
$ret
Definition: parser.php:6
if(empty($password)) $table
Definition: pwgen.php:24
executeCommand()
Execute command.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
showImportForm()
Show import form.