ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilDidacticTemplateSettingsGUI Class Reference

Settings for a single didactic template. More...

+ Collaboration diagram for ilDidacticTemplateSettingsGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 

Protected Member Functions

 overview ()
 Show didactic template administration. More...
 
 showImportForm (ilPropertyFormGUI $form=NULL)
 Show template import form. More...
 
 createImportForm ()
 Create template import form. More...
 
 importTemplate ()
 Import template. More...
 
 editTemplate (ilPropertyFormGUI $form=null)
 Edit template. More...
 
 updateTemplate ()
 Update template. More...
 
 initEditTemplate (ilDidacticTemplateSetting $set)
 Init edit template form. More...
 
 copyTemplate ()
 Copy on template. More...
 
 exportTemplate ()
 Export one template. More...
 
 confirmDelete ()
 Show delete confirmation screen. More...
 
 deleteTemplates ()
 Delete chosen didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 
 activateTemplates ()
 Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 
 deactivateTemplates ()
 Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl. More...
 

Private Attributes

 $parent_object
 
 $lng
 

Detailed Description

Settings for a single didactic template.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

@ilCtrl_IsCalledBy ilDidacticTemplateSettingsGUI: ilObjRoleFolderGUI

Definition at line 13 of file class.ilDidacticTemplateSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilDidacticTemplateSettingsGUI::__construct (   $a_parent_obj)

Constructor.

Definition at line 22 of file class.ilDidacticTemplateSettingsGUI.php.

23 {
24 global $lng;
25
26 $this->parent_object = $a_parent_obj;
27 $this->lng = $lng;
28 }

References $lng.

Member Function Documentation

◆ activateTemplates()

ilDidacticTemplateSettingsGUI::activateTemplates ( )
protected

Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

Definition at line 392 of file class.ilDidacticTemplateSettingsGUI.php.

393 {
394 global $ilErr, $ilCtrl;
395
396 if(!$_REQUEST['tpls'])
397 {
398 ilUtil::sendFailure($this->lng->txt('select_one'));
399 return $ilCtrl->redirect($this,'overview');
400 }
401
402 foreach($_REQUEST['tpls'] as $tplid)
403 {
404 $tpl = new ilDidacticTemplateSetting($tplid);
405 $tpl->enable(true);
406 $tpl->update();
407 }
408
409 ilUtil::sendSuccess($this->lng->txt('didactic_activated_msg'),true);
410 $ilCtrl->redirect($this,'overview');
411 }
global $tpl
Definition: ilias.php:8
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST, $ilCtrl, $ilErr, $tpl, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ confirmDelete()

ilDidacticTemplateSettingsGUI::confirmDelete ( )
protected

Show delete confirmation screen.

Definition at line 333 of file class.ilDidacticTemplateSettingsGUI.php.

334 {
335 global $ilErr, $ilCtrl;
336
337 if(!$_REQUEST['tpls'])
338 {
339 ilUtil::sendFailure($this->lng->txt('select_one'));
340 return $ilCtrl->redirect($this,'overview');
341 }
342
343 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
344
345 $confirm = new ilConfirmationGUI();
346 $confirm->setFormAction($ilCtrl->getFormAction($this));
347 $confirm->setConfirm($this->lng->txt('delete'), 'deleteTemplates');
348 $confirm->setCancel($this->lng->txt('cancel'), 'overview');
349
350 foreach((array) $_REQUEST['tpls'] as $tplid)
351 {
352 $tpl = new ilDidacticTemplateSetting($tplid);
353 $confirm->addItem('tpls[]', $tpl->getId(), $tpl->getTitle());
354 }
355
356 ilUtil::sendQuestion($this->lng->txt('didactic_confirm_delete_msg'));
357 $GLOBALS['tpl']->setContent($confirm->getHTML());
358 }
Confirmation screen class.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
$GLOBALS['ct_recipient']

References $_REQUEST, $GLOBALS, $ilCtrl, $ilErr, $tpl, ilUtil\sendFailure(), and ilUtil\sendQuestion().

+ Here is the call graph for this function:

◆ copyTemplate()

ilDidacticTemplateSettingsGUI::copyTemplate ( )
protected

Copy on template.

Definition at line 287 of file class.ilDidacticTemplateSettingsGUI.php.

288 {
289 global $ilErr, $ilCtrl;;
290
291 if(!$_REQUEST['tplid'])
292 {
293 ilUtil::sendFailure($this->lng->txt('select_one'));
294 return $ilCtrl->redirect($this,'overview');
295 }
296
297 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateCopier.php';
298
299 $copier = new ilDidacticTemplateCopier((int) $_REQUEST['tplid']);
300 $copier->start();
301
302 ilUtil::sendSuccess($this->lng->txt('didactic_copy_suc_message'), true);
303 $ilCtrl->redirect($this,'overview');
304 }
Copy a didactic template and all subitems.

References $_REQUEST, $ilCtrl, $ilErr, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ createImportForm()

ilDidacticTemplateSettingsGUI::createImportForm ( )
protected

Create template import form.

Returns
ilPropertyFormGUI $form

Definition at line 103 of file class.ilDidacticTemplateSettingsGUI.php.

104 {
105 global $ilCtrl;
106
107 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
108 $form = new ilPropertyFormGUI();
109 $form->setShowTopButtons(false);
110 $form->setFormAction($ilCtrl->getFormAction($this));
111 $form->setTitle($this->lng->txt('didactic_import_table_title'));
112 $form->addCommandButton('importTemplate', $this->lng->txt('import'));
113 $form->addCommandButton('overview', $this->lng->txt('cancel'));
114
115 $file = new ilFileInputGUI($this->lng->txt('import_file'), 'file');
116 $file->setSuffixes(array('xml'));
117 $file->setRequired(TRUE);
118 $form->addItem($file);
119
120 $created = true;
121
122 return $form;
123 }
print $file
This class represents a file property in a property form.
This class represents a property form user interface.

References $file, and $ilCtrl.

Referenced by importTemplate(), and showImportForm().

+ Here is the caller graph for this function:

◆ deactivateTemplates()

ilDidacticTemplateSettingsGUI::deactivateTemplates ( )
protected

Activate didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

Definition at line 419 of file class.ilDidacticTemplateSettingsGUI.php.

420 {
421 global $ilErr, $ilCtrl;
422
423 if(!$_REQUEST['tpls'])
424 {
425 ilUtil::sendFailure($this->lng->txt('select_one'));
426 return $ilCtrl->redirect($this,'overview');
427 }
428
429 foreach($_REQUEST['tpls'] as $tplid)
430 {
431 $tpl = new ilDidacticTemplateSetting($tplid);
432 $tpl->enable(false);
433 $tpl->update();
434 }
435
436 ilUtil::sendSuccess($this->lng->txt('didactic_deactivated_msg'),true);
437 $ilCtrl->redirect($this,'overview');
438 }

References $_REQUEST, $ilCtrl, $ilErr, $tpl, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteTemplates()

ilDidacticTemplateSettingsGUI::deleteTemplates ( )
protected

Delete chosen didactic templates @global ilErrorHandling $ilErr @global ilCtrl $ilCtrl.

Returns
void

Definition at line 366 of file class.ilDidacticTemplateSettingsGUI.php.

367 {
368 global $ilErr, $ilCtrl;
369
370 if(!$_REQUEST['tpls'])
371 {
372 ilUtil::sendFailure($this->lng->txt('select_one'));
373 return $ilCtrl->redirect($this,'overview');
374 }
375
376 foreach((array) $_REQUEST['tpls'] as $tplid)
377 {
378 $tpl = new ilDidacticTemplateSetting($tplid);
379 $tpl->delete();
380 }
381
382 ilUtil::sendSuccess($this->lng->txt('didactic_delete_msg'),true);
383 $ilCtrl->redirect($this,'overview');
384 }

References $_REQUEST, $ilCtrl, $ilErr, $tpl, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ editTemplate()

ilDidacticTemplateSettingsGUI::editTemplate ( ilPropertyFormGUI  $form = null)
protected

Edit template.

Returns
void

Definition at line 175 of file class.ilDidacticTemplateSettingsGUI.php.

176 {
177 global $ilCtrl,$ilTabs;
178
179 if(!$_REQUEST['tplid'])
180 {
181 ilUtil::sendFailure($this->lng->txt('select_one'));
182 return $ilCtrl->redirect($this,'overview');
183 }
184
185 $ilTabs->clearTargets();
186 $ilTabs->setBackTarget(
187 $this->lng->txt('didactic_back_to_overview'),
188 $ilCtrl->getLinkTarget($this,'overview')
189 );
190
191
192 $ilCtrl->saveParameter($this,'tplid');
193
194 if(!$form instanceof ilPropertyFormGUI)
195 {
196 $settings = new ilDidacticTemplateSetting((int) $_REQUEST['tplid']);
197 $form = $this->initEditTemplate($settings);
198 }
199 $GLOBALS['tpl']->setContent($form->getHTML());
200 }
initEditTemplate(ilDidacticTemplateSetting $set)
Init edit template form.

References $_REQUEST, $GLOBALS, $ilCtrl, initEditTemplate(), and ilUtil\sendFailure().

Referenced by updateTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilDidacticTemplateSettingsGUI::executeCommand ( )

Execute command.

Returns
<type>

Definition at line 34 of file class.ilDidacticTemplateSettingsGUI.php.

35 {
36 global $ilCtrl;
37
38 $next_class = $ilCtrl->getNextClass($this);
39 $cmd = $ilCtrl->getCmd();
40
41 switch($next_class)
42 {
43 default:
44 if(!$cmd)
45 {
46 $cmd = 'overview';
47 }
48 $this->$cmd();
49
50 break;
51 }
52 return true;
53 }
$cmd
Definition: sahs_server.php:35

References $cmd, and $ilCtrl.

◆ exportTemplate()

ilDidacticTemplateSettingsGUI::exportTemplate ( )
protected

Export one template.

Definition at line 309 of file class.ilDidacticTemplateSettingsGUI.php.

310 {
311 global $ilErr, $ilCtrl;
312
313 if(!$_REQUEST['tplid'])
314 {
315 ilUtil::sendFailure($this->lng->txt('select_one'));
316 return $ilCtrl->redirect($this,'overview');
317 }
318
319 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateXmlWriter.php';
320 $writer = new ilDidacticTemplateXmlWriter((int) $_REQUEST['tplid']);
321 $writer->write();
322
324 $writer->xmlDumpMem(TRUE),
325 $writer->getSetting()->getTitle().'.xml',
326 'application/xml'
327 );
328 }
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.

References $_REQUEST, $ilCtrl, $ilErr, ilUtil\deliverData(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ importTemplate()

ilDidacticTemplateSettingsGUI::importTemplate ( )
protected

Import template.

Definition at line 128 of file class.ilDidacticTemplateSettingsGUI.php.

129 {
130 global $ilCtrl;
131
132 $form = $this->createImportForm();
133 if(!$form->checkInput())
134 {
135 ilUtil::sendFailure($this->lng->txt('err_check_input'));
136 $form->setValuesByPost();
137 return $this->showImportForm($form);
138 }
139
140 // Do import
141 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateImport.php';
142
144
145 $file = $form->getInput('file');
146 $tmp = ilUtil::ilTempnam();
147
148 // move uploaded file
150 $file['tmp_name'],
151 $file['name'],
152 $tmp
153 );
154 $import->setInputFile($tmp);
155
156 $GLOBALS['ilLog']->write(__METHOD__.': Using '.$tmp);
157
158 try {
159 $import->import();
160 }
162 {
163 $GLOBALS['ilLog']->write(__METHOD__.': Import failed with message: '. $e->getMessage());
164 ilUtil::sendFailure($this->lng->txt('didactic_import_failed').': '.$e->getMessage());
165 }
166
167 ilUtil::sendSuccess($this->lng->txt('didactic_import_success'),TRUE);
168 $ilCtrl->redirect($this,'overview');
169 }
Description of ilDidacticTemplateImportException.
Description of ilDidacticTemplateImport.
showImportForm(ilPropertyFormGUI $form=NULL)
Show template import form.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static ilTempnam()
Create a temporary file in an ILIAS writable directory.

References $file, $GLOBALS, $ilCtrl, createImportForm(), ilUtil\ilTempnam(), ilDidacticTemplateImport\IMPORT_FILE, ilUtil\moveUploadedFile(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showImportForm().

+ Here is the call graph for this function:

◆ initEditTemplate()

ilDidacticTemplateSettingsGUI::initEditTemplate ( ilDidacticTemplateSetting  $set)
protected

Init edit template form.

Definition at line 232 of file class.ilDidacticTemplateSettingsGUI.php.

233 {
234 global $ilCtrl,$objDefinition;
235
236 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
237 $form = new ilPropertyFormGUI();
238 $form->setShowTopButtons(false);
239 $form->setFormAction($ilCtrl->getFormAction($this,'updateTemplate'));
240 $form->setTitle($this->lng->txt('didactic_edit_tpl'));
241 $form->addCommandButton('updateTemplate', $this->lng->txt('save'));
242 $form->addCommandButton('overview', $this->lng->txt('cancel'));
243
244 // title
245 $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
246 $title->setValue($set->getTitle());
247 $title->setSize(40);
248 $title->setMaxLength(64);
249 $title->setRequired(true);
250 $form->addItem($title);
251
252 // desc
253 $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
254 $desc->setValue($set->getDescription());
255 $desc->setRows(3);
256 $form->addItem($desc);
257
258 // info
259 $info = new ilTextAreaInputGUI($this->lng->txt('didactic_install_info'), 'info');
260 $info->setValue($set->getInfo());
261 $info->setRows(6);
262 $form->addItem($info);
263
264 // object type
265 $type = new ilSelectInputGUI($this->lng->txt('obj_type'),'type');
266 $type->setRequired(true);
267 $assigned = $set->getAssignments();
268 $type->setValue(isset($assigned[0]) ? $assigned[0] : '');
269 $subs = $objDefinition->getCreatableSubobjects('root', false);
270 $options = array();
271 foreach(array_merge($subs,array('fold' => 1)) as $obj => $null)
272 {
273 if($objDefinition->isAllowedInRepository($obj))
274 {
275 $options[$obj] = $this->lng->txt('obj_'.$obj);
276 }
277 }
278 $type->setOptions($options);
279 $form->addItem($type);
280
281 return $form;
282 }
getInfo()
Get installation info text.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
if(!is_array($argv)) $options

References $ilCtrl, $options, ilDidacticTemplateSetting\getAssignments(), ilDidacticTemplateSetting\getDescription(), ilDidacticTemplateSetting\getInfo(), and ilDidacticTemplateSetting\getTitle().

Referenced by editTemplate(), and updateTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ overview()

ilDidacticTemplateSettingsGUI::overview ( )
protected

Show didactic template administration.

@global ilToolbarGUI $ilToolbar

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

61 {
62 global $ilToolbar,$lng, $ilCtrl;
63
64 $ilToolbar->addButton(
65 $lng->txt('didactic_import_btn'),
66 $ilCtrl->getLinkTarget($this,'showImportForm')
67 );
68
69 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettingsTableGUI.php';
70 $table = new ilDidacticTemplateSettingsTableGUI($this,'overview');
71 $table->init();
72 $table->parse();
73
74 $GLOBALS['tpl']->setContent($table->getHTML());
75 }
Description of ilDidacticTemplateSettingsTableGUI.

References $GLOBALS, $ilCtrl, and $lng.

◆ showImportForm()

ilDidacticTemplateSettingsGUI::showImportForm ( ilPropertyFormGUI  $form = NULL)
protected

Show template import form.

@global ilTabsGUI $ilTabs

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

83 {
84 global $ilTabs, $ilCtrl;
85
86 $ilTabs->clearTargets();
87 $ilTabs->setBackTarget(
88 $this->lng->txt('didactic_back_to_overview'),
89 $ilCtrl->getLinkTarget($this,'overview')
90 );
91
92 if(!$form instanceof ilPropertyFormGUI)
93 {
94 $form = $this->createImportForm();
95 }
96 $GLOBALS['tpl']->setContent($form->getHTML());
97 }

References $GLOBALS, $ilCtrl, and createImportForm().

Referenced by importTemplate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTemplate()

ilDidacticTemplateSettingsGUI::updateTemplate ( )
protected

Update template.

Definition at line 205 of file class.ilDidacticTemplateSettingsGUI.php.

206 {
207 global $ilCtrl;
208
209 $temp = new ilDidacticTemplateSetting((int) $_REQUEST['tplid']);
210 $form = $this->initEditTemplate($temp);
211
212 if($form->checkInput())
213 {
214 $temp->setTitle($form->getInput('title'));
215 $temp->setDescription($form->getInput('description'));
216 $temp->setInfo($form->getInput('info'));
217 $temp->setAssignments(array($form->getInput('type')));
218 $temp->update();
219
220 ilUtil::sendSuccess($this->lng->txt('save_settings'));
221 $ilCtrl->redirect($this,'overview');
222 }
223
224 ilUtil::sendFailure($this->lng->txt('err_check_input'));
225 $form->setValuesByPost();
226 $this->editTemplate($form);
227 }
editTemplate(ilPropertyFormGUI $form=null)
Edit template.

References $_REQUEST, $ilCtrl, editTemplate(), initEditTemplate(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilDidacticTemplateSettingsGUI::$lng
private

Definition at line 17 of file class.ilDidacticTemplateSettingsGUI.php.

Referenced by __construct(), and overview().

◆ $parent_object

ilDidacticTemplateSettingsGUI::$parent_object
private

Definition at line 15 of file class.ilDidacticTemplateSettingsGUI.php.


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