ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
18 
22  function __construct($a_node_id = 0)
23  {
24  global $ilCtrl;
25 
26  $ilCtrl->saveParameter($this, "obj_id");
27 
28  parent::__construct($a_node_id);
29  }
30 
34  function getType()
35  {
36  return "skrt";
37  }
38 
42  function executeCommand()
43  {
44  global $ilCtrl, $tpl, $ilTabs;
45 
46  $next_class = $ilCtrl->getNextClass($this);
47  $cmd = $ilCtrl->getCmd();
48 
49  switch($next_class)
50  {
51  default:
52  $ret = $this->$cmd();
53  break;
54  }
55  }
56 
60  function listTemplates()
61  {
62  global $tpl, $ilToolbar, $ilCtrl, $lng, $ilTabs;
63 
64  $skmg_set = new ilSetting("skmg");
65  $enable_skmg = $skmg_set->get("enable_skmg");
66  if (!$enable_skmg)
67  {
68  ilUtil::sendInfo($lng->txt("skmg_skill_management_deactivated"));
69  }
70 
71  $this->getParentGUI()->showTree(true, $this, "listTemplates");
72  $ilTabs->activateTab("skill_templates");
73 
74  include_once("./Services/Skill/classes/class.ilSkillTemplateCategoryGUI.php");
75  if ($this->checkPermissionBool("write"))
76  {
78  }
79 
80  include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
81  $table = new ilSkillCatTableGUI($this, "listTemplates", (int) $_GET["obj_id"],
83 
84  $tpl->setContent($table->getHTML());
85  }
86 
90  function listSkills()
91  {
92  global $tpl, $ilToolbar, $ilCtrl, $lng, $ilTabs;
93 
94  $skmg_set = new ilSetting("skmg");
95  $enable_skmg = $skmg_set->get("enable_skmg");
96  if (!$enable_skmg)
97  {
98  ilUtil::sendInfo($lng->txt("skmg_skill_management_deactivated"));
99  }
100 
101  $this->getParentGUI()->showTree(false, $this, "listSkills");
102  $ilTabs->activateTab("skills");
103 
104  include_once("./Services/Skill/classes/class.ilSkillCategoryGUI.php");
105  if ($this->checkPermissionBool("write"))
106  {
108  }
109 
110  include_once("./Services/Skill/classes/class.ilSkillCatTableGUI.php");
111  $table = new ilSkillCatTableGUI($this, "listSkills", (int) $_GET["obj_id"],
113 
114  $tpl->setContent($table->getHTML());
115  }
116 
120  function cancelDelete()
121  {
122  global $ilCtrl;
123 
124  if ($_GET["tmpmode"])
125  {
126  $ilCtrl->redirect($this, "listTemplates");
127  }
128  else
129  {
130  $ilCtrl->redirect($this, "listSkills");
131  }
132  }
133 
137  function showImportForm()
138  {
139  global $tpl, $ilTabs;
140 
141  $ilTabs->activateTab("skills");
142  $tpl->setContent($this->initInputForm()->getHTML());
143  }
144 
148  public function initInputForm()
149  {
150  global $lng, $ilCtrl;
151 
152  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
153  $form = new ilPropertyFormGUI();
154 
155  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
156  $fi = new ilFileInputGUI($lng->txt("skmg_input_file"), "import_file");
157  $fi->setSuffixes(array("zip"));
158  $fi->setRequired(true);
159  $form->addItem($fi);
160 
161  // save and cancel commands
162  $form->addCommandButton("importSkills", $lng->txt("import"));
163  $form->addCommandButton("listSkills", $lng->txt("cancel"));
164 
165  $form->setTitle($lng->txt("skmg_import_skills"));
166  $form->setFormAction($ilCtrl->getFormAction($this));
167 
168  return $form;
169  }
170 
174  public function importSkills()
175  {
176  global $tpl, $lng, $ilCtrl, $ilTabs;
177 
178  $form = $this->initInputForm();
179  if ($form->checkInput())
180  {
181  include_once("./Services/Export/classes/class.ilImport.php");
182  $imp = new ilImport();
183  $imp->importEntity($_FILES["import_file"]["tmp_name"], $_FILES["import_file"]["name"], "skmg", "Services/Skill");
184 
185  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
186  $ilCtrl->redirect($this, "listSkills");
187  }
188  else
189  {
190  $ilTabs->activateTab("skills");
191  $form->setValuesByPost();
192  $tpl->setContent($form->getHtml());
193  }
194  }
195 
196 }
197 
198 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
ILIAS Setting Class.
Skill root GUI class.
static addCreationButtons()
Add creation buttons.
getType()
Get Node Type.
This class represents a property form user interface.
initInputForm()
Init input form.
$_GET["client_id"]
importSkills()
Import skills.
This class represents a file property in a property form.
$cmd
Definition: sahs_server.php:35
Import class.
cancelDelete()
cancel delete
getParentGUI()
Get Parent GUI class (ilObjSCORM2004LearningModuleGUI).
listSkills()
List skills.
global $tpl
Definition: ilias.php:8
checkPermissionBool($a_perm)
Check permission pool.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Basic GUI class for skill tree nodes.
Create styles array
The data for the language used.
listTemplates()
List templates.
static addCreationButtons()
Add creation buttons.
__construct($a_node_id=0)
Constructor.
global $lng
Definition: privfeed.php:17
$ret
Definition: parser.php:6
executeCommand()
Execute command.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
showImportForm()
Show import form.