ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilAdvancedMDSettingsGUI Class Reference
+ Collaboration diagram for ilAdvancedMDSettingsGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 showRecords ()
 show record list More...
 
 showPresentation ()
 
 updateSubstitutions ()
 Update substitution. More...
 
 exportRecords ()
 Export records. More...
 
 showFiles ()
 show export files More...
 
 downloadFile ()
 Download XML file. More...
 
 confirmDeleteFiles ()
 confirm delete files More...
 
 deleteFiles ()
 Delete files. More...
 
 confirmDeleteRecords ()
 Confirm delete. More...
 
 deleteRecords ()
 Permanently delete records. More...
 
 updateRecords ()
 Save records (assigned object typed) More...
 
 confirmDeleteFields ()
 show delete fields confirmation screen More...
 
 deleteFields ()
 delete fields More...
 
 editRecord ()
 Edit one record. More...
 
 editFields ()
 
 updateFields ()
 Update fields. More...
 
 updateRecord ()
 Update record. More...
 
 createRecord ()
 Show
More...
 
 importRecords ()
 
 importRecord ()
 import xml file More...
 
 saveRecord ()
 Save record. More...
 
 editField (ilPropertyFormGUI $a_form=null)
 Edit field. More...
 
 updateField ()
 Update field. More...
 
 createField (ilPropertyFormGUI $a_form=null)
 Show field type selection. More...
 
 saveField ()
 create field More...
 

Protected Member Functions

 getPermissions ()
 
 initImportForm ()
 show import form More...
 
 initFieldForm (ilAdvancedMDFieldDefinition $a_definition)
 init field form More...
 
 initForm ($a_mode)
 Init Form. More...
 
 getSubstitutionFieldPermissions ($a_obj_type, $a_field_id)
 
 initFormSubstitutions ()
 init form table 'substitutions' More...
 
 loadRecordFormData ()
 load record form data More...
 
 initRecordObject ()
 Init record object. More...
 
 setSubTabs ()
 Set sub tabs. More...
 
 getRecordObjects ()
 Get and cache record objects. More...
 

Protected Attributes

 $lng
 
 $tpl
 
 $ctrl
 
 $tabs
 
 $permissions
 

Detailed Description

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

@ilCtrl_Calls ilAdvancedMDSettingsGUI:

Definition at line 16 of file class.ilAdvancedMDSettingsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDSettingsGUI::__construct ( )

Constructor.

@access public

Definition at line 30 of file class.ilAdvancedMDSettingsGUI.php.

31 {
32 global $tpl,$lng,$ilCtrl,$ilTabs;
33
34 $this->ctrl = $ilCtrl;
35 $this->lng = $lng;
36 $this->lng->loadLanguageModule('meta');
37 $this->tpl = $tpl;
38 $this->tabs_gui = $ilTabs;
39
40 $this->permissions = ilAdvancedMDPermissionHelper::getInstance();
41 }
static getInstance($a_user_id=null, $a_ref_id=null)
Factory.
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $lng, $tpl, and ilClaimingPermissionHelper\getInstance().

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDeleteFields()

ilAdvancedMDSettingsGUI::confirmDeleteFields ( )

show delete fields confirmation screen

@access public

Definition at line 545 of file class.ilAdvancedMDSettingsGUI.php.

546 {
547 if(!isset($_POST['field_id']))
548 {
549 ilUtil::sendFailure($this->lng->txt('select_one'));
550 $this->editFields();
551 return false;
552 }
553
554 $this->ctrl->saveParameter($this,'record_id');
555
556 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
557 $c_gui = new ilConfirmationGUI();
558
559 // set confirm/cancel commands
560 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFields"));
561 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_fields_sure"));
562 $c_gui->setCancel($this->lng->txt("cancel"), "editFields");
563 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFields");
564
565 // add items to delete
566 foreach($_POST["field_id"] as $field_id)
567 {
569 $c_gui->addItem("field_id[]", $field_id, $field->getTitle() ? $field->getTitle() : 'No Title');
570 }
571 $this->tpl->setContent($c_gui->getHTML());
572 }
static getInstance($a_field_id, $a_type=null)
Get definition instance by type.
Confirmation screen class.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, editFields(), ilAdvancedMDFieldDefinition\getInstance(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ confirmDeleteFiles()

ilAdvancedMDSettingsGUI::confirmDeleteFiles ( )

confirm delete files

@access public

Definition at line 356 of file class.ilAdvancedMDSettingsGUI.php.

357 {
358 if(!isset($_POST['file_id']))
359 {
360 ilUtil::sendFailure($this->lng->txt('select_one'));
361 $this->showFiles();
362 return false;
363 }
364
365 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
366 $c_gui = new ilConfirmationGUI();
367
368 // set confirm/cancel commands
369 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
370 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_files_sure"));
371 $c_gui->setCancel($this->lng->txt("cancel"), "showFiles");
372 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
373
374 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
375 $files = new ilAdvancedMDRecordExportFiles();
376 $file_data = $files->readFilesInfo();
377
378
379 // add items to delete
380 foreach($_POST["file_id"] as $file_id)
381 {
382 $info = $file_data[$file_id];
383 $c_gui->addItem("file_id[]", $file_id, is_array($info['name']) ? implode(',',$info['name']) : 'No Records');
384 }
385 $this->tpl->setContent($c_gui->getHTML());
386 }

References $_POST, ilUtil\sendFailure(), and showFiles().

+ Here is the call graph for this function:

◆ confirmDeleteRecords()

ilAdvancedMDSettingsGUI::confirmDeleteRecords ( )

Confirm delete.

@access public

Definition at line 421 of file class.ilAdvancedMDSettingsGUI.php.

422 {
423 if(!isset($_POST['record_id']))
424 {
425 ilUtil::sendFailure($this->lng->txt('select_one'));
426 $this->showRecords();
427 return false;
428 }
429
430 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
431 $c_gui = new ilConfirmationGUI();
432
433 // set confirm/cancel commands
434 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRecords"));
435 $c_gui->setHeaderText($this->lng->txt("md_adv_delete_record_sure"));
436 $c_gui->setCancel($this->lng->txt("cancel"), "showRecords");
437 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRecords");
438
439 // add items to delete
440 foreach($_POST["record_id"] as $record_id)
441 {
442 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
443 $c_gui->addItem("record_id[]", $record_id, $record->getTitle() ? $record->getTitle() : 'No Title');
444 }
445 $this->tpl->setContent($c_gui->getHTML());
446 }
static _getInstanceByRecordId($a_record_id)
Get instance by record id.

References $_POST, ilAdvancedMDRecord\_getInstanceByRecordId(), ilUtil\sendFailure(), and showRecords().

+ Here is the call graph for this function:

◆ createField()

ilAdvancedMDSettingsGUI::createField ( ilPropertyFormGUI  $a_form = null)

Show field type selection.

@access public

Definition at line 990 of file class.ilAdvancedMDSettingsGUI.php.

991 {
992
993 if(!$_REQUEST["record_id"] || !$_REQUEST["ftype"])
994 {
995 return $this->editFields();
996 }
997
998 $this->ctrl->saveParameter($this,'record_id');
999 $this->ctrl->saveParameter($this,'ftype');
1000
1001 if(!$a_form)
1002 {
1003 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1004 $field_definition = ilAdvancedMDFieldDefinition::getInstance(null, $_REQUEST["ftype"]);
1005 $field_definition->setRecordId($_REQUEST["record_id"]);
1006 $a_form = $this->initFieldForm($field_definition);
1007 }
1008 $this->tpl->setContent($a_form->getHTML());
1009 }
initFieldForm(ilAdvancedMDFieldDefinition $a_definition)
init field form
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST, editFields(), ilAdvancedMDFieldDefinition\getInstance(), and initFieldForm().

Referenced by saveField().

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

◆ createRecord()

ilAdvancedMDSettingsGUI::createRecord ( )

Show

@access public

Parameters

Definition at line 791 of file class.ilAdvancedMDSettingsGUI.php.

792 {
793 $this->initRecordObject();
794 $this->initForm('create');
795 $this->tpl->setContent($this->form->getHTML());
796 return true;
797 }

References initForm(), and initRecordObject().

Referenced by importRecord(), and saveRecord().

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

◆ deleteFields()

ilAdvancedMDSettingsGUI::deleteFields ( )

delete fields

@access public

Parameters

Definition at line 581 of file class.ilAdvancedMDSettingsGUI.php.

582 {
583 $this->ctrl->saveParameter($this,'record_id');
584
585 if(!isset($_POST['field_id']))
586 {
587 ilUtil::sendFailure($this->lng->txt('select_one'));
588 $this->editFields();
589 return false;
590 }
591
592 // all fields have to be deletable
593 $fail = array();
594 foreach($_POST['field_id'] as $field_id)
595 {
596 if(!$this->getPermissions()->hasPermission(
598 $field_id,
600 {
601 $field = ilAdvancedMDFieldDefinition::getInstance($field_id);
602 $fail[] = $field->getTitle();
603 }
604 }
605 if($fail)
606 {
607 ilUtil::sendFailure($this->lng->txt('msg_no_perm_delete')." ".implode(", ", $fail), true);
608 $this->ctrl->redirect($this, "editFields");
609 }
610
611 foreach($_POST["field_id"] as $field_id)
612 {
614 $field->delete();
615 }
616 ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_fields'), true);
617 $this->ctrl->redirect($this, "editFields");
618 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $_POST, ilAdvancedMDPermissionHelper\ACTION_FIELD_DELETE, ilAdvancedMDPermissionHelper\CONTEXT_FIELD, editFields(), ilAdvancedMDFieldDefinition\getInstance(), getPermissions(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ deleteFiles()

ilAdvancedMDSettingsGUI::deleteFiles ( )

Delete files.

@access public

Parameters

Definition at line 395 of file class.ilAdvancedMDSettingsGUI.php.

396 {
397 if(!isset($_POST['file_id']))
398 {
399 ilUtil::sendFailure($this->lng->txt('select_one'));
400 $this->editFiles();
401 return false;
402 }
403
404 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
405 $files = new ilAdvancedMDRecordExportFiles();
406
407 foreach($_POST['file_id'] as $file_id)
408 {
409 $files->deleteByFileId((int) $file_id);
410 }
411 ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_files'));
412 $this->showFiles();
413 }

References $_POST, ilUtil\sendFailure(), ilUtil\sendSuccess(), and showFiles().

+ Here is the call graph for this function:

◆ deleteRecords()

ilAdvancedMDSettingsGUI::deleteRecords ( )

Permanently delete records.

@access public

Definition at line 454 of file class.ilAdvancedMDSettingsGUI.php.

455 {
456 if(!isset($_POST['record_id']))
457 {
458 ilUtil::sendFailure($this->lng->txt('select_one'));
459 $this->showRecords();
460 return false;
461 }
462
463 // all records have to be deletable
464 $fail = array();
465 foreach($_POST['record_id'] as $record_id)
466 {
467 if(!$this->getPermissions()->hasPermission(
469 $record_id,
471 {
472 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
473 $fail[] = $record->getTitle();
474 }
475 }
476 if($fail)
477 {
478 ilUtil::sendFailure($this->lng->txt('msg_no_perm_delete')." ".implode(", ", $fail), true);
479 $this->ctrl->redirect($this, "showRecords");
480 }
481
482 foreach($_POST['record_id'] as $record_id)
483 {
484 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
485 $record->delete();
486 }
487 ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_records'), true);
488 $this->ctrl->redirect($this, "showRecords");
489 }

References $_POST, ilAdvancedMDRecord\_getInstanceByRecordId(), ilAdvancedMDPermissionHelper\ACTION_RECORD_DELETE, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, getPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showRecords().

+ Here is the call graph for this function:

◆ downloadFile()

ilAdvancedMDSettingsGUI::downloadFile ( )

Download XML file.

@access public

Parameters

Definition at line 334 of file class.ilAdvancedMDSettingsGUI.php.

335 {
336 if(!isset($_POST['file_id']) or count($_POST['file_id']) != 1)
337 {
338 ilUtil::sendFailure($this->lng->txt('md_adv_select_one_file'));
339 $this->showFiles();
340 return false;
341 }
342
343 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
344 $files = new ilAdvancedMDRecordExportFiles();
345 $abs_path = $files->getAbsolutePathByFileId((int) $_POST['file_id'][0]);
346
347 ilUtil::deliverFile($abs_path,'ilias_meta_data_record.xml','application/xml');
348 }
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.

References $_POST, ilUtil\deliverFile(), ilUtil\sendFailure(), and showFiles().

+ Here is the call graph for this function:

◆ editField()

ilAdvancedMDSettingsGUI::editField ( ilPropertyFormGUI  $a_form = null)

Edit field.

@access public

Definition at line 917 of file class.ilAdvancedMDSettingsGUI.php.

918 {
919 if(!$_REQUEST["record_id"] || !$_REQUEST["field_id"])
920 {
921 return $this->editFields();
922 }
923
924 $this->ctrl->saveParameter($this,'record_id');
925 $this->ctrl->saveParameter($this,'field_id');
926
927 if(!$a_form)
928 {
929 $field_definition = ilAdvancedMDFieldDefinition::getInstance((int)$_REQUEST['field_id']);
930 $a_form = $this->initFieldForm($field_definition);
931 }
932 $this->tpl->setContent($a_form->getHTML());
933 }

References $_REQUEST, editFields(), ilAdvancedMDFieldDefinition\getInstance(), and initFieldForm().

Referenced by updateField().

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

◆ editFields()

ilAdvancedMDSettingsGUI::editFields ( )

Definition at line 636 of file class.ilAdvancedMDSettingsGUI.php.

637 {
638 global $ilToolbar;
639
640 $this->ctrl->saveParameter($this,'record_id');
641 $this->initRecordObject();
642
643 $perm = $this->getPermissions()->hasPermissions(
645 $this->record->getRecordId(),
646 array(
649 ));
650
652 {
653 // type selection
654 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
655 $types = new ilSelectInputGUI("", "ftype");
656 $options = array();
658 {
659 $field = ilAdvancedMDFieldDefinition::getInstance(null, $type);
660 $options[$type] = $this->lng->txt($field->getTypeTitle());
661 }
662 $types->setOptions($options);
663 $ilToolbar->addInputItem($types);
664
665 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "createField"));
666
667 include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
668 $button = ilSubmitButton::getInstance();
669 $button->setCaption("add");
670 $button->setCommand("createField");
671 $ilToolbar->addButtonInstance($button);
672 }
673
674 // show field table
675 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
676 $fields = ilAdvancedMDFieldDefinition::getInstancesByRecordId($this->record->getRecordId());
677
678 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php");
680 $table_gui->setTitle($this->lng->txt("md_adv_field_table"));
681 $table_gui->parseDefinitions($fields);
682 if(sizeof($fields))
683 {
684 $table_gui->addCommandButton("updateFields", $this->lng->txt("save"));
685 }
686 $table_gui->addCommandButton("showRecords", $this->lng->txt('cancel'));
687 $table_gui->addMultiCommand("confirmDeleteFields", $this->lng->txt("delete"));
688 $table_gui->setSelectAllCheckbox("field_id");
689
690 $this->tpl->setContent($table_gui->getHTML());
691 }
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
This class represents a selection list property in a property form.
static getInstance()
Factory.
if(!is_array($argv)) $options

References $options, ilAdvancedMDPermissionHelper\ACTION_RECORD_CREATE_FIELD, ilAdvancedMDPermissionHelper\ACTION_RECORD_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, ilAdvancedMDFieldDefinition\getInstance(), ilSubmitButton\getInstance(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getPermissions(), ilAdvancedMDFieldDefinition\getValidTypes(), and initRecordObject().

Referenced by confirmDeleteFields(), createField(), deleteFields(), editField(), saveField(), updateField(), and updateFields().

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

◆ editRecord()

ilAdvancedMDSettingsGUI::editRecord ( )

Edit one record.

@access public

Parameters

Definition at line 627 of file class.ilAdvancedMDSettingsGUI.php.

628 {
629 $this->ctrl->saveParameter($this,'record_id');
630 $this->initRecordObject();
631 $this->initForm('edit');
632 $this->tpl->setContent($this->form->getHTML());
633
634 }

References initForm(), and initRecordObject().

Referenced by updateRecord().

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

◆ executeCommand()

ilAdvancedMDSettingsGUI::executeCommand ( )

Execute command.

@access public

Parameters

Definition at line 55 of file class.ilAdvancedMDSettingsGUI.php.

56 {
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
59
60 $this->setSubTabs();
61 switch($next_class)
62 {
63 default:
64 if(!$cmd)
65 {
66 $cmd = 'showRecords';
67 }
68 $this->$cmd();
69 }
70 }
$cmd
Definition: sahs_server.php:35

References $cmd, and setSubTabs().

+ Here is the call graph for this function:

◆ exportRecords()

ilAdvancedMDSettingsGUI::exportRecords ( )

Export records.

@access public

Definition at line 260 of file class.ilAdvancedMDSettingsGUI.php.

261 {
262 if(!isset($_POST['record_id']))
263 {
264 ilUtil::sendFailure($this->lng->txt('select_one'));
265 $this->showRecords();
266 return false;
267 }
268
269 // all records have to be exportable
270 $fail = array();
271 foreach($_POST['record_id'] as $record_id)
272 {
273 if(!$this->getPermissions()->hasPermission(
275 $record_id,
277 {
278 $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
279 $fail[] = $record->getTitle();
280 }
281 }
282 if($fail)
283 {
284 ilUtil::sendFailure($this->lng->txt('msg_no_perm_copy')." ".implode(", ", $fail), true);
285 $this->ctrl->redirect($this, "showRecords");
286 }
287
288 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php');
289 $xml_writer = new ilAdvancedMDRecordXMLWriter($_POST['record_id']);
290 $xml_writer->write();
291
292 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
293 $export_files = new ilAdvancedMDRecordExportFiles();
294 $export_files->create($xml_writer->xmlDumpMem());
295
296 ilUtil::sendSuccess($this->lng->txt('md_adv_records_exported'));
297 $this->showFiles();
298 }

References $_POST, ilAdvancedMDRecord\_getInstanceByRecordId(), ilAdvancedMDPermissionHelper\ACTION_RECORD_EXPORT, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, getPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), showFiles(), and showRecords().

+ Here is the call graph for this function:

◆ getPermissions()

◆ getRecordObjects()

ilAdvancedMDSettingsGUI::getRecordObjects ( )
protected

Get and cache record objects.

@access protected

Definition at line 1492 of file class.ilAdvancedMDSettingsGUI.php.

1493 {
1494 if(!isset($this->record_objs))
1495 {
1496 return $this->record_objs = ilAdvancedMDRecord::_getRecords();
1497 }
1498 return $this->record_objs;
1499 }
static _getRecords()
Get records.

References ilAdvancedMDRecord\_getRecords().

Referenced by showRecords(), and updateRecords().

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

◆ getSubstitutionFieldPermissions()

ilAdvancedMDSettingsGUI::getSubstitutionFieldPermissions (   $a_obj_type,
  $a_field_id 
)
protected

Definition at line 1184 of file class.ilAdvancedMDSettingsGUI.php.

1185 {
1186 if($a_obj_type == "crs")
1187 {
1188 $perm = $this->getPermissions()->hasPermissions(
1190 $a_field_id,
1191 array(
1197 ));
1198 return array(
1202 );
1203 }
1204 else if($a_obj_type == "cat")
1205 {
1206 $perm = $this->getPermissions()->hasPermissions(
1208 $a_field_id,
1209 array(
1215 ));
1216 return array(
1220 );
1221 }
1222 }

References ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_CATEGORY_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_CATEGORY_SHOW_FIELD, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_COURSE_EDIT_FIELD_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_COURSE_SHOW_FIELD, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_CATEGORY, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION_COURSE, getPermissions(), ilAdvancedMDPermissionHelper\SUBACTION_SUBSTITUTION_BOLD, and ilAdvancedMDPermissionHelper\SUBACTION_SUBSTITUTION_NEWLINE.

Referenced by initFormSubstitutions(), and updateSubstitutions().

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

◆ importRecord()

ilAdvancedMDSettingsGUI::importRecord ( )

import xml file

@access public

Parameters

Definition at line 841 of file class.ilAdvancedMDSettingsGUI.php.

842 {
843 $this->initImportForm();
844 if(!$this->import_form->checkInput())
845 {
846 $this->import_form->setValuesByPost();
847 $this->createRecord();
848 return false;
849 }
850
851 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordImportFiles.php');
852 $import_files = new ilAdvancedMDRecordImportFiles();
853 if(!$create_time = $import_files->moveUploadedFile($_FILES['file']['tmp_name']))
854 {
855 $this->createRecord();
856 return false;
857 }
858
859 try
860 {
861 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordParser.php');
862 $parser = new ilAdvancedMDRecordParser($import_files->getImportFileByCreationDate($create_time));
863
864 // Validate
866 $parser->startParsing();
867
868 // Insert
870 $parser->startParsing();
871 ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'), true);
872 $this->ctrl->redirect($this, "showRecords");
873 }
874 catch(ilSAXParserException $exc)
875 {
876 ilUtil::sendFailure($exc->getMessage(), true);
877 $this->ctrl->redirect($this, "importRecords");
878 }
879
880 // Finally delete import file
881 $import_files->deleteFileByCreationDate($create_time);
882 return true;
883 }
SAX based XML parser for record import files.

References createRecord(), initImportForm(), ilAdvancedMDRecordParser\MODE_INSERT, ilAdvancedMDRecordParser\MODE_INSERT_VALIDATION, ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ importRecords()

ilAdvancedMDSettingsGUI::importRecords ( )

Definition at line 799 of file class.ilAdvancedMDSettingsGUI.php.

800 {
801 // Import Table
802 $this->initImportForm();
803 $this->tpl->setContent($this->import_form->getHTML());
804 }

References initImportForm().

+ Here is the call graph for this function:

◆ initFieldForm()

ilAdvancedMDSettingsGUI::initFieldForm ( ilAdvancedMDFieldDefinition  $a_definition)
protected

init field form

@access protected

Definition at line 1051 of file class.ilAdvancedMDSettingsGUI.php.

1052 {
1053 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1054
1055 $form = new ilPropertyFormGUI();
1056 $form->setFormAction($this->ctrl->getFormAction($this));
1057
1058 $type = new ilNonEditableValueGUI($this->lng->txt("type"));
1059 $type->setValue($this->lng->txt($a_definition->getTypeTitle()));
1060 $form->addItem($type);
1061
1062 $a_definition->addToFieldDefinitionForm($form, $this->getPermissions());
1063
1064 if(!$a_definition->getFieldId())
1065 {
1066 $form->setTitle($this->lng->txt('md_adv_create_field'));
1067 $form->addCommandButton('saveField',$this->lng->txt('create'));
1068 }
1069 else
1070 {
1071 $form->setTitle($this->lng->txt('md_adv_edit_field'));
1072 $form->addCommandButton('updateField',$this->lng->txt('save'));
1073 }
1074
1075 $form->addCommandButton('editFields',$this->lng->txt('cancel'));
1076
1077 return $form;
1078 }
addToFieldDefinitionForm(ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
Add input elements to definition form.
This class represents a non editable value in a property form.
This class represents a property form user interface.

References ilAdvancedMDFieldDefinition\addToFieldDefinitionForm(), ilAdvancedMDFieldDefinition\getFieldId(), getPermissions(), and ilAdvancedMDFieldDefinition\getTypeTitle().

Referenced by createField(), editField(), saveField(), and updateField().

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

◆ initForm()

ilAdvancedMDSettingsGUI::initForm (   $a_mode)
protected

Init Form.

@access protected

Definition at line 1085 of file class.ilAdvancedMDSettingsGUI.php.

1086 {
1087 if(is_object($this->form))
1088 {
1089 return true;
1090 }
1091
1092 $perm = $this->getPermissions()->hasPermissions(
1094 $this->record->getRecordId(),
1095 array(
1103 ));
1104
1105 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1106
1107 $this->form = new ilPropertyFormGUI();
1108 $this->form->setFormAction($this->ctrl->getFormAction($this));
1109
1110
1111 // title
1112 $title = new ilTextInputGUI($this->lng->txt('title'),'title');
1113 $title->setValue($this->record->getTitle());
1114 $title->setSize(20);
1115 $title->setMaxLength(70);
1116 $title->setRequired(true);
1117 $this->form->addItem($title);
1118
1120 {
1121 $title->setDisabled(true);
1122 }
1123
1124 // desc
1125 $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'desc');
1126 $desc->setValue($this->record->getDescription());
1127 $desc->setRows(3);
1128 $desc->setCols(50);
1129 $this->form->addItem($desc);
1130
1132 {
1133 $desc->setDisabled(true);
1134 }
1135
1136 // active
1137 $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_active'),'active');
1138 $check->setChecked($this->record->isActive());
1139 $check->setValue(1);
1140 $this->form->addItem($check);
1141
1143 {
1144 $check->setDisabled(true);
1145 }
1146
1148 $section->setTitle($this->lng->txt('md_obj_types'));
1149 $this->form->addItem($section);
1150
1151 foreach(ilAdvancedMDRecord::_getAssignableObjectTypes(true) as $type)
1152 {
1153 $t = $type["obj_type"].":".$type["sub_type"];
1154 $this->lng->loadLanguageModule($type["obj_type"]);
1155 $check = new ilCheckboxInputGUI($type["text"],'obj_types[]');
1156 $check->setChecked($this->record->isAssignedObjectType($type["obj_type"], $type["sub_type"]));
1157 $check->setValue($t);
1158 $this->form->addItem($check);
1159
1161 {
1162 $check->setDisabled(true);
1163 }
1164 }
1165
1166 switch($a_mode)
1167 {
1168 case 'create':
1169 $this->form->setTitle($this->lng->txt('md_adv_create_record'));
1170 $this->form->addCommandButton('saveRecord',$this->lng->txt('add'));
1171 $this->form->addCommandButton('showRecords',$this->lng->txt('cancel'));
1172
1173 return true;
1174
1175 case 'edit':
1176 $this->form->setTitle($this->lng->txt('md_adv_edit_record'));
1177 $this->form->addCommandButton('updateRecord',$this->lng->txt('save'));
1178 $this->form->addCommandButton('showRecords',$this->lng->txt('cancel'));
1179
1180 return true;
1181 }
1182 }
$section
Definition: Utf8Test.php:84
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
This class represents a checkbox property in a property form.
This class represents a section header 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.

References $section, $t, ilAdvancedMDRecord\_getAssignableObjectTypes(), ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_TOGGLE_ACTIVATION, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, getPermissions(), ilAdvancedMDPermissionHelper\SUBACTION_RECORD_DESCRIPTION, ilAdvancedMDPermissionHelper\SUBACTION_RECORD_OBJECT_TYPES, and ilAdvancedMDPermissionHelper\SUBACTION_RECORD_TITLE.

Referenced by createRecord(), and editRecord().

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

◆ initFormSubstitutions()

ilAdvancedMDSettingsGUI::initFormSubstitutions ( )
protected

init form table 'substitutions'

@access protected

Definition at line 1229 of file class.ilAdvancedMDSettingsGUI.php.

1230 {
1231 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1232
1233 if(!$visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType())
1234 {
1235 return;
1236 }
1237
1238 $this->form = new ilPropertyFormGUI();
1239 $this->form->setFormAction($this->ctrl->getFormAction($this));
1240 #$this->form->setTableWidth('100%');
1241
1242 // substitution
1243 foreach($visible_records as $obj_type => $records)
1244 {
1245 $perm = null;
1246 // :TODO: hardwird ?
1247 if(in_array($obj_type, array("crs", "cat")))
1248 {
1249 $perm = $this->getPermissions()->hasPermissions(
1251 $obj_type,
1252 array(
1256 ));
1257 }
1258
1259 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
1261
1262 // Show section
1264 $section->setTitle($this->lng->txt('objs_'.$obj_type));
1265 $this->form->addItem($section);
1266
1267 $check = new ilCheckboxInputGUI($this->lng->txt('description'),'enabled_desc_'.$obj_type);
1268 $check->setValue(1);
1269 $check->setOptionTitle($this->lng->txt('md_adv_desc_show'));
1270 $check->setChecked($sub->isDescriptionEnabled() ? true : false);
1271 $this->form->addItem($check);
1272
1274 {
1275 $check->setDisabled(true);
1276 }
1277
1278 $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'),'enabled_field_names_'.$obj_type);
1279 $check->setValue(1);
1280 $check->setOptionTitle($this->lng->txt('md_adv_fields_show'));
1281 $check->setChecked($sub->enabledFieldNames() ? true : false);
1282 $this->form->addItem($check);
1283
1285 {
1286 $check->setDisabled(true);
1287 }
1288
1289 #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
1290 #$area->setUseRte(true);
1291 #$area->setRteTagSet('standard');
1292 #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
1293 #$area->setRows(5);
1294 #$area->setCols(80);
1295 #$this->form->addItem($area);
1296
1297 if($perm)
1298 {
1300 }
1301
1303 $definitions = $sub->sortDefinitions($definitions);
1304
1305 $counter = 1;
1306 foreach($definitions as $def)
1307 {
1308 $definition_id = $def->getFieldId();
1309
1310 $perm = $this->getSubstitutionFieldPermissions($obj_type, $definition_id);
1311
1312 $title = ilAdvancedMDRecord::_lookupTitle($def->getRecordId());
1313 $title = $def->getTitle().' ('.$title.')';
1314
1315 $check = new ilCheckboxInputGUI($title,'show['.$obj_type.']['.$definition_id.']');
1316 $check->setValue(1);
1317 $check->setOptionTitle($this->lng->txt('md_adv_show'));
1318 $check->setChecked($sub->isSubstituted($definition_id));
1319
1320 if($perm && !$perm["show"])
1321 {
1322 $check->setDisabled(true);
1323 }
1324
1325 $pos = new ilNumberInputGUI($this->lng->txt('position'),'position['.$obj_type.']['.$definition_id.']');
1326 $pos->setSize(3);
1327 $pos->setMaxLength(4);
1328 $pos->allowDecimals(true);
1329 $pos->setValue(sprintf('%.1f',$counter++));
1330 $check->addSubItem($pos);
1331
1332 if($perm && !$perm_pos)
1333 {
1334 $pos->setDisabled(true);
1335 }
1336
1337 $bold = new ilCheckboxInputGUI($this->lng->txt('bold'),'bold['.$obj_type.']['.$definition_id.']');
1338 $bold->setValue(1);
1339 $bold->setChecked($sub->isBold($definition_id));
1340 $check->addSubItem($bold);
1341
1342 if($perm && !$perm["bold"])
1343 {
1344 $bold->setDisabled(true);
1345 }
1346
1347 $bold = new ilCheckboxInputGUI($this->lng->txt('newline'),'newline['.$obj_type.']['.$definition_id.']');
1348 $bold->setValue(1);
1349 $bold->setChecked($sub->hasNewline($definition_id));
1350 $check->addSubItem($bold);
1351
1352 if($perm && !$perm["newline"])
1353 {
1354 $bold->setDisabled(true);
1355 }
1356
1357
1358 $this->form->addItem($check);
1359 }
1360
1361
1362 // placeholder
1363 /*
1364 $custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders'));
1365 $tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData');
1366 foreach($records as $record)
1367 {
1368 foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition)
1369 {
1370 $tpl->setCurrentBlock('field');
1371 $tpl->setVariable('FIELD_NAME',$definition->getTitle());
1372 $tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'.
1373 '[/IF_F_'.$definition->getFieldId().']');
1374 $tpl->parseCurrentBlock();
1375 }
1376
1377 $tpl->setCurrentBlock('record');
1378 $tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for'));
1379 $tpl->setVariable('TITLE',$record->getTitle());
1380 $tpl->parseCurrentBlock();
1381 }
1382 $custom->setHTML($tpl->get());
1383 $this->form->addItem($custom);
1384 */
1385 }
1386 $this->form->setTitle($this->lng->txt('md_adv_substitution_table'));
1387 $this->form->addCommandButton('updateSubstitutions',$this->lng->txt('save'));
1388 return true;
1389 }
static getInstancesByObjType($a_obj_type, $a_active_only=true)
static _lookupTitle($a_record_id)
Lookup title.
static _getAllRecordsByObjectType()
Get records by obj_type Note: this returns only records with no sub types! @access public.
getSubstitutionFieldPermissions($a_obj_type, $a_field_id)
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
This class represents a number property in a property form.
$records
Definition: simple_test.php:17

References $records, $section, ilAdvancedMDRecord\_getAllRecordsByObjectType(), ilAdvancedMDSubstitution\_getInstanceByObjectType(), ilAdvancedMDRecord\_lookupTitle(), ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION, ilAdvancedMDFieldDefinition\getInstancesByObjType(), getPermissions(), and getSubstitutionFieldPermissions().

Referenced by showPresentation().

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

◆ initImportForm()

ilAdvancedMDSettingsGUI::initImportForm ( )
protected

show import form

@access protected

Definition at line 811 of file class.ilAdvancedMDSettingsGUI.php.

812 {
813 if(is_object($this->import_form))
814 {
815 return true;
816 }
817
818 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
819 $this->import_form = new ilPropertyFormGUI();
820 $this->import_form->setMultipart(true);
821 $this->import_form->setFormAction($this->ctrl->getFormAction($this));
822
823 // add file property
824 $file = new ilFileInputGUI($this->lng->txt('file'),'file');
825 $file->setSuffixes(array('xml'));
826 $file->setRequired(true);
827 $this->import_form->addItem($file);
828
829 $this->import_form->setTitle($this->lng->txt('md_adv_import_record'));
830 $this->import_form->addCommandButton('importRecord',$this->lng->txt('import'));
831 $this->import_form->addCommandButton('showRecords',$this->lng->txt('cancel'));
832 }
print $file
This class represents a file property in a property form.

References $file.

Referenced by importRecord(), and importRecords().

+ Here is the caller graph for this function:

◆ initRecordObject()

ilAdvancedMDSettingsGUI::initRecordObject ( )
protected

Init record object.

@access protected

Definition at line 1446 of file class.ilAdvancedMDSettingsGUI.php.

1447 {
1448 if(is_object($this->record))
1449 {
1450 return $this->record;
1451 }
1452
1453 $record_id = isset($_GET['record_id']) ?
1454 $_GET['record_id'] :
1455 0;
1456 return $this->record = ilAdvancedMDRecord::_getInstanceByRecordId($_GET['record_id']);
1457 }
$_GET["client_id"]

References $_GET, and ilAdvancedMDRecord\_getInstanceByRecordId().

Referenced by createRecord(), editFields(), editRecord(), saveRecord(), and updateRecord().

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

◆ loadRecordFormData()

ilAdvancedMDSettingsGUI::loadRecordFormData ( )
protected

load record form data

@access protected

Definition at line 1396 of file class.ilAdvancedMDSettingsGUI.php.

1397 {
1398 $perm = $this->getPermissions()->hasPermissions(
1400 $this->record->getRecordId(),
1401 array(
1409 ));
1410
1412 {
1413 $this->record->setActive(ilUtil::stripSlashes($_POST['active']));
1414 }
1416 {
1417 $this->record->setTitle(ilUtil::stripSlashes($_POST['title']));
1418 }
1420 {
1421 $this->record->setDescription(ilUtil::stripSlashes($_POST['desc']));
1422 }
1424 {
1425 $obj_types = array();
1426 if (is_array($_POST['obj_types']))
1427 {
1428 foreach ($_POST['obj_types'] as $t)
1429 {
1430 $t = explode(":", $t);
1431 $obj_types[] = array(
1432 "obj_type" => ilUtil::stripSlashes($t[0]),
1433 "sub_type" => ilUtil::stripSlashes($t[1])
1434 );
1435 }
1436 }
1437 $this->record->setAssignedObjectTypes($obj_types);
1438 }
1439 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, $t, ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_TOGGLE_ACTIVATION, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, getPermissions(), ilUtil\stripSlashes(), ilAdvancedMDPermissionHelper\SUBACTION_RECORD_DESCRIPTION, ilAdvancedMDPermissionHelper\SUBACTION_RECORD_OBJECT_TYPES, and ilAdvancedMDPermissionHelper\SUBACTION_RECORD_TITLE.

Referenced by saveRecord(), and updateRecord().

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

◆ saveField()

ilAdvancedMDSettingsGUI::saveField ( )

create field

@access public

Definition at line 1016 of file class.ilAdvancedMDSettingsGUI.php.

1017 {
1018 global $ilErr;
1019
1020 if(!$_REQUEST["record_id"] || !$_REQUEST["ftype"])
1021 {
1022 return $this->editFields();
1023 }
1024
1025 $this->ctrl->saveParameter($this,'record_id');
1026 $this->ctrl->saveParameter($this,'ftype');
1027
1028 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
1029 $field_definition = ilAdvancedMDFieldDefinition::getInstance(null, $_REQUEST["ftype"]);
1030 $field_definition->setRecordId($_REQUEST["record_id"]);
1031 $form = $this->initFieldForm($field_definition);
1032
1033 if($form->checkInput())
1034 {
1035 $field_definition->importDefinitionFormPostValues($form, $this->getPermissions());
1036 $field_definition->save();
1037
1038 ilUtil::sendSuccess($this->lng->txt('save_settings'), true);
1039 $this->ctrl->redirect($this, "editFields");
1040 }
1041
1042 $form->setValuesByPost();
1043 $this->createField($form);
1044 }
createField(ilPropertyFormGUI $a_form=null)
Show field type selection.

References $_REQUEST, $ilErr, createField(), editFields(), ilAdvancedMDFieldDefinition\getInstance(), getPermissions(), initFieldForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveRecord()

ilAdvancedMDSettingsGUI::saveRecord ( )

Save record.

@access public

Parameters

Definition at line 893 of file class.ilAdvancedMDSettingsGUI.php.

894 {
895 global $ilErr;
896
897 $this->initRecordObject();
898 $this->loadRecordFormData();
899
900 if(!$this->record->validate())
901 {
902 ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
903 $this->createRecord();
904 return false;
905 }
906 $this->record->save();
907 ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'));
908 $this->showRecords();
909 }

References $ilErr, createRecord(), initRecordObject(), loadRecordFormData(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showRecords().

+ Here is the call graph for this function:

◆ setSubTabs()

ilAdvancedMDSettingsGUI::setSubTabs ( )
protected

Set sub tabs.

@access protected

Definition at line 1464 of file class.ilAdvancedMDSettingsGUI.php.

1465 {
1466 $this->tabs_gui->clearSubTabs();
1467
1468 $this->tabs_gui->addSubTabTarget("md_adv_record_list",
1469 $this->ctrl->getLinkTarget($this, "showRecords"),
1470 '',
1471 '',
1472 '',
1473 true);
1474
1475
1477 {
1478 $this->tabs_gui->addSubTabTarget("md_adv_presentation",
1479 $this->ctrl->getLinkTarget($this, "showPresentation"));
1480 }
1481
1482 $this->tabs_gui->addSubTabTarget("md_adv_file_list",
1483 $this->ctrl->getLinkTarget($this, "showFiles"),
1484 "showFiles");
1485 }

References ilAdvancedMDRecord\_getAllRecordsByObjectType().

Referenced by executeCommand().

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

◆ showFiles()

ilAdvancedMDSettingsGUI::showFiles ( )

show export files

@access public

Parameters

Definition at line 307 of file class.ilAdvancedMDSettingsGUI.php.

308 {
309 $this->tabs_gui->setSubTabActive('md_adv_file_list');
310
311 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
312 $files = new ilAdvancedMDRecordExportFiles();
313 $file_data = $files->readFilesInfo();
314
315 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFilesTableGUI.php");
316 $table_gui = new ilAdvancedMDRecordExportFilesTableGUI($this, "showFiles");
317 $table_gui->setTitle($this->lng->txt("md_record_export_table"));
318 $table_gui->parseFiles($file_data);
319 $table_gui->addMultiCommand("downloadFile",$this->lng->txt('download'));
320 $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
321 $table_gui->addCommandButton('showFiles',$this->lng->txt('cancel'));
322 $table_gui->setSelectAllCheckbox("file_id");
323
324 $this->tpl->setContent($table_gui->getHTML());
325 }

Referenced by confirmDeleteFiles(), deleteFiles(), downloadFile(), and exportRecords().

+ Here is the caller graph for this function:

◆ showPresentation()

ilAdvancedMDSettingsGUI::showPresentation ( )

Definition at line 134 of file class.ilAdvancedMDSettingsGUI.php.

135 {
136 if($this->initFormSubstitutions())
137 {
138 if (is_object($this->form))
139 {
140 $this->tabs_gui->setSubTabActive('md_adv_presentation');
141 return $this->tpl->setContent($this->form->getHTML());
142 }
143 }
144 return $this->showRecords();
145 }
initFormSubstitutions()
init form table 'substitutions'

References initFormSubstitutions(), and showRecords().

+ Here is the call graph for this function:

◆ showRecords()

ilAdvancedMDSettingsGUI::showRecords ( )

show record list

@access public

Parameters

Definition at line 79 of file class.ilAdvancedMDSettingsGUI.php.

80 {
81 global $ilToolbar;
82
83 $perm = $this->getPermissions()->hasPermissions(
85 $_REQUEST["ref_id"],
86 array(
89 ));
90
92 {
93 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
94 $button = ilLinkButton::getInstance();
95 $button->setCaption("add");
96 $button->setUrl($this->ctrl->getLinkTarget($this, "createRecord"));
97 $ilToolbar->addButtonInstance($button);
98
100 {
101 $ilToolbar->addSeparator();
102 }
103 }
104
106 {
107 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
108 $button = ilLinkButton::getInstance();
109 $button->setCaption("import");
110 $button->setUrl($this->ctrl->getLinkTarget($this, "importRecords"));
111 $ilToolbar->addButtonInstance($button);
112 }
113
114 $this->record_objs = $this->getRecordObjects();
115 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.show_records.html','Services/AdvancedMetaData');
116
117 include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php");
118 $table_gui = new ilAdvancedMDRecordTableGUI($this, "showRecords", $this->getPermissions());
119 $table_gui->setTitle($this->lng->txt("md_record_list_table"));
120 $table_gui->parseRecords($this->record_objs);
121
122 // permissions?
123 $table_gui->addCommandButton("updateRecords", $this->lng->txt("save"));
124 //$table_gui->addCommandButton('createRecord',$this->lng->txt('add'));
125 $table_gui->addMultiCommand("exportRecords",$this->lng->txt('export'));
126 $table_gui->addMultiCommand("confirmDeleteRecords", $this->lng->txt("delete"));
127 $table_gui->setSelectAllCheckbox("record_id");
128
129 $this->tpl->setVariable('RECORD_TABLE',$table_gui->getHTML());
130
131 return true;
132 }
getRecordObjects()
Get and cache record objects.
static getInstance()
Factory.

References $_REQUEST, ilAdvancedMDPermissionHelper\ACTION_MD_CREATE_RECORD, ilAdvancedMDPermissionHelper\ACTION_MD_IMPORT_RECORDS, ilAdvancedMDPermissionHelper\CONTEXT_MD, ilLinkButton\getInstance(), getPermissions(), and getRecordObjects().

Referenced by confirmDeleteRecords(), deleteRecords(), exportRecords(), saveRecord(), showPresentation(), and updateRecord().

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

◆ updateField()

ilAdvancedMDSettingsGUI::updateField ( )

Update field.

@access public

Definition at line 941 of file class.ilAdvancedMDSettingsGUI.php.

942 {
943 global $ilErr;
944
945 if(!$_REQUEST["record_id"] || !$_REQUEST["field_id"])
946 {
947 return $this->editFields();
948 }
949
950 $this->ctrl->saveParameter($this,'record_id');
951 $this->ctrl->saveParameter($this,'field_id');
952
953 $confirm = false;
954 $field_definition = ilAdvancedMDFieldDefinition::getInstance((int)$_REQUEST['field_id']);
955 $form = $this->initFieldForm($field_definition);
956 if($form->checkInput())
957 {
958 $field_definition->importDefinitionFormPostValues($form, $this->getPermissions());
959 if(!$field_definition->importDefinitionFormPostValuesNeedsConfirmation())
960 {
961 $field_definition->update();
962
963 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
964 $this->ctrl->redirect($this, "editFields");
965 }
966 else
967 {
968 $confirm = true;
969 }
970 }
971
972 $form->setValuesByPost();
973
974 // fields needs confirmation of updated settings
975 if($confirm)
976 {
977 ilUtil::sendInfo($this->lng->txt("md_adv_confirm_definition"));
978 $field_definition->prepareDefinitionFormConfirmation($form);
979 }
980
981 $this->editField($form);
982 }
editField(ilPropertyFormGUI $a_form=null)
Edit field.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_REQUEST, $ilErr, editField(), editFields(), ilAdvancedMDFieldDefinition\getInstance(), getPermissions(), initFieldForm(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ updateFields()

ilAdvancedMDSettingsGUI::updateFields ( )

Update fields.

@access public

Definition at line 699 of file class.ilAdvancedMDSettingsGUI.php.

700 {
701 $this->ctrl->saveParameter($this,'record_id');
702
703 if(!isset($_GET['record_id']) or !$_GET['record_id'])
704 {
705 ilUtil::sendFailure($this->lng->txt('select_one'));
706 $this->editFields();
707 return false;
708 }
709
710 include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
712
713 if($this->getPermissions()->hasPermission(
715 $_GET['record_id'],
717 {
718 if(!isset($_POST['position']) or !is_array($_POST['position']))
719 {
720 $this->editFields();
721 return false;
722 }
723 // sort by position
724 asort($_POST['position'],SORT_NUMERIC);
725 $positions = array_flip(array_keys($_POST['position']));
726 foreach($fields as $field)
727 {
728 $field->setPosition($positions[$field->getFieldId()]);
729 $field->update();
730 }
731 }
732
733 foreach($fields as $field)
734 {
735 if($this->getPermissions()->hasPermission(
737 $field->getFieldId(),
740 {
741 $field->setSearchable(isset($_POST['searchable'][$field->getFieldId()]) ? true : false);
742 $field->update();
743 }
744 }
745
746
747 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
748 $this->ctrl->redirect($this, "editFields");
749 }

References $_GET, $_POST, ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\CONTEXT_FIELD, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, editFields(), ilAdvancedMDFieldDefinition\getInstancesByRecordId(), getPermissions(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilAdvancedMDPermissionHelper\SUBACTION_FIELD_SEARCHABLE.

+ Here is the call graph for this function:

◆ updateRecord()

ilAdvancedMDSettingsGUI::updateRecord ( )

Update record.

@access public

Parameters

Definition at line 758 of file class.ilAdvancedMDSettingsGUI.php.

759 {
760 global $ilErr;
761
762 if(!isset($_GET['record_id']) or !$_GET['record_id'])
763 {
764 ilUtil::sendFailure($this->lng->txt('select_one'));
765 $this->showRecords();
766 return false;
767 }
768 $this->initRecordObject();
769 $this->loadRecordFormData();
770
771 if(!$this->record->validate())
772 {
773 ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
774 $this->editRecord();
775 return false;
776 }
777 $this->record->update();
778 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
779 $this->showRecords();
780 return true;
781 }

References $_GET, $ilErr, editRecord(), initRecordObject(), loadRecordFormData(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showRecords().

+ Here is the call graph for this function:

◆ updateRecords()

ilAdvancedMDSettingsGUI::updateRecords ( )

Save records (assigned object typed)

@access public

Parameters

Definition at line 498 of file class.ilAdvancedMDSettingsGUI.php.

499 {
500 foreach($this->getRecordObjects() as $record_obj)
501 {
502 $perm = $this->getPermissions()->hasPermissions(
504 $record_obj->getRecordId(),
505 array(
509 ));
510
512 {
513 $obj_types = array();
514 if (is_array($_POST['obj_types'][$record_obj->getRecordId()]))
515 {
516 foreach ($_POST['obj_types'][$record_obj->getRecordId()] as $t)
517 {
518 $t = explode(":", $t);
519 $obj_types[] = array(
520 "obj_type" => ilUtil::stripSlashes($t[0]),
521 "sub_type" => ilUtil::stripSlashes($t[1])
522 );
523 }
524 }
525 $record_obj->setAssignedObjectTypes($obj_types);
526 }
527
529 {
530 $record_obj->setActive(isset($_POST['active'][$record_obj->getRecordId()]));
531 }
532
533 $record_obj->update();
534 }
535 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
536 $this->ctrl->redirect($this, "showRecords");
537 }

References $_POST, $t, ilAdvancedMDPermissionHelper\ACTION_RECORD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\ACTION_RECORD_TOGGLE_ACTIVATION, ilAdvancedMDPermissionHelper\CONTEXT_RECORD, getPermissions(), getRecordObjects(), ilUtil\sendSuccess(), ilUtil\stripSlashes(), and ilAdvancedMDPermissionHelper\SUBACTION_RECORD_OBJECT_TYPES.

+ Here is the call graph for this function:

◆ updateSubstitutions()

ilAdvancedMDSettingsGUI::updateSubstitutions ( )

Update substitution.

@access public

Definition at line 153 of file class.ilAdvancedMDSettingsGUI.php.

154 {
155 foreach(ilAdvancedMDRecord::_getActivatedObjTypes() as $obj_type)
156 {
157 $perm = null;
158 // :TODO: hardwired?
159 if(in_array($obj_type, array("crs", "cat")))
160 {
161 $perm = $this->getPermissions()->hasPermissions(
163 $obj_type,
164 array(
168 ));
169 }
170
171 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
173
175 {
176 $sub->enableDescription($_POST['enabled_desc_'.$obj_type]);
177 }
178
180 {
181 $sub->enableFieldNames((int) $_POST['enabled_field_names_'.$obj_type]);
182 }
183
185 $definitions = $sub->sortDefinitions($definitions);
186
187 // gather existing data
188 $counter = 1;
189 $old_sub = array();
190 foreach($definitions as $def)
191 {
192 $field_id = $def->getFieldId();
193 $old_sub[$field_id] = array(
194 "active" => $sub->isSubstituted($field_id),
195 "pos" => $counter++,
196 "bold" => $sub->isBold($field_id),
197 "newline" => $sub->hasNewline($field_id)
198 );
199 }
200
201 $sub->resetSubstitutions(array());
202
203 $new_sub = array();
204 foreach($definitions as $def)
205 {
206 $field_id = $def->getFieldId();
207 $old = $old_sub[$field_id];
208
209 $perm_def = $this->getSubstitutionFieldPermissions($obj_type, $field_id);
210 if($perm_def["show"])
211 {
212 $active = (isset($_POST['show'][$obj_type][$field_id]) && $_POST['show'][$obj_type][$field_id]);
213 }
214 else
215 {
216 $active = $old["active"];
217 }
218
219 if($active)
220 {
221 $new_sub[$field_id] = $old;
222
224 {
225 $new_sub[$field_id]["pos"] = (int)$_POST['position'][$obj_type][$field_id];
226 }
227 if($perm_def["bold"])
228 {
229 $new_sub[$field_id]["bold"] = (isset($_POST['bold'][$obj_type][$field_id]) && $_POST['bold'][$obj_type][$field_id]);
230 }
231 if($perm_def["newline"])
232 {
233 $new_sub[$field_id]["newline"] = (isset($_POST['newline'][$obj_type][$field_id]) && $_POST['newline'][$obj_type][$field_id]);
234 }
235 }
236 }
237
238 if(sizeof($new_sub))
239 {
240 $new_sub = ilUtil::sortArray($new_sub, "pos", "asc", true, true);
241 foreach($new_sub as $field_id => $field)
242 {
243 $sub->appendSubstitution($field_id, $field["bold"], $field["newline"]);
244 }
245 }
246
247 $sub->update();
248 }
249
250
251 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
252 $this->ctrl->redirect($this, "showPresentation");
253 }
static _getActivatedObjTypes()
get activated obj types
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

References $_POST, ilAdvancedMDRecord\_getActivatedObjTypes(), ilAdvancedMDSubstitution\_getInstanceByObjectType(), ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_FIELD_POSITIONS, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_DESCRIPTION, ilAdvancedMDPermissionHelper\ACTION_SUBSTITUTION_SHOW_FIELDNAMES, ilAdvancedMDPermissionHelper\CONTEXT_SUBSTITUTION, ilAdvancedMDFieldDefinition\getInstancesByObjType(), getPermissions(), getSubstitutionFieldPermissions(), ilUtil\sendSuccess(), and ilUtil\sortArray().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilAdvancedMDSettingsGUI::$ctrl
protected

Definition at line 20 of file class.ilAdvancedMDSettingsGUI.php.

◆ $lng

ilAdvancedMDSettingsGUI::$lng
protected

Definition at line 18 of file class.ilAdvancedMDSettingsGUI.php.

Referenced by __construct().

◆ $permissions

ilAdvancedMDSettingsGUI::$permissions
protected

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

Referenced by getPermissions().

◆ $tabs

ilAdvancedMDSettingsGUI::$tabs
protected

Definition at line 21 of file class.ilAdvancedMDSettingsGUI.php.

◆ $tpl

ilAdvancedMDSettingsGUI::$tpl
protected

Definition at line 19 of file class.ilAdvancedMDSettingsGUI.php.

Referenced by __construct().


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