ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAdvancedMDSettingsGUI Class Reference
+ Collaboration diagram for ilAdvancedMDSettingsGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 showRecords ()
 show record list More...
 
 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...
 
 updateFields ()
 Update fields. More...
 
 updateRecord ()
 Update record. More...
 
 createRecord ()
 Show. More...
 
 importRecord ()
 import xml file More...
 
 saveRecord ()
 Save record. More...
 
 editField ()
 Edit field. More...
 
 updateField ()
 Update field. More...
 
 createField ()
 Show field type selection. More...
 
 addValue ()
 add value More...
 
 saveField ()
 create field More...
 

Protected Member Functions

 initImportForm ()
 show import form More...
 
 initFieldForm ($a_mode)
 init field form More...
 
 initForm ($a_mode)
 Init Form. More...
 
 initFormSubstitutions ()
 init form table 'substitutions' More...
 
 loadRecordFormData ()
 load record form data More...
 
 loadFieldFormData ()
 load field definition from 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDSettingsGUI::__construct ( )

Constructor.

public

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

References $ilCtrl, $lng, and $tpl.

32  {
33  global $tpl,$lng,$ilCtrl,$ilTabs;
34 
35  $this->ctrl = $ilCtrl;
36  $this->lng = $lng;
37  $this->lng->loadLanguageModule('meta');
38  $this->tpl = $tpl;
39  $this->tabs_gui = $ilTabs;
40  }
global $ilCtrl
Definition: ilias.php:18

Member Function Documentation

◆ addValue()

ilAdvancedMDSettingsGUI::addValue ( )

add value

public

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

References $_GET, $_SESSION, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), createField(), editField(), and loadFieldFormData().

736  {
737  ++$_SESSION['num_values'];
738 
739  $this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId(isset($_GET['field_id']) ? (int) $_GET['field_id'] : 0);
740  $this->loadFieldFormData();
741 
742  if(isset($_GET['field_id']) and $_GET['field_id'])
743  {
744  $this->editField();
745  }
746  else
747  {
748  $this->createField();
749  }
750  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
createField()
Show field type selection.
$_GET["client_id"]
loadFieldFormData()
load field definition from form data
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
+ Here is the call graph for this function:

◆ confirmDeleteFields()

ilAdvancedMDSettingsGUI::confirmDeleteFields ( )

show delete fields confirmation screen

public

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

References $_POST, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), editRecord(), and ilUtil\sendFailure().

388  {
389  if(!isset($_POST['field_id']))
390  {
391  ilUtil::sendFailure($this->lng->txt('select_one'));
392  $this->editRecord();
393  return false;
394  }
395  $this->ctrl->saveParameter($this,'record_id');
396 
397  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
398  $c_gui = new ilConfirmationGUI();
399 
400  // set confirm/cancel commands
401  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFields"));
402  $c_gui->setHeaderText($this->lng->txt("md_adv_delete_fields_sure"));
403  $c_gui->setCancel($this->lng->txt("cancel"), "showRecords");
404  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFields");
405 
406  // add items to delete
407  foreach($_POST["field_id"] as $field_id)
408  {
410  $c_gui->addItem("field_id[]", $field_id, $field->getTitle() ? $field->getTitle() : 'No Title');
411  }
412  $this->tpl->setContent($c_gui->getHTML());
413  }
$_POST['username']
Definition: cron.php:12
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteFiles()

ilAdvancedMDSettingsGUI::confirmDeleteFiles ( )

confirm delete files

public

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

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

234  {
235  if(!isset($_POST['file_id']))
236  {
237  ilUtil::sendFailure($this->lng->txt('select_one'));
238  $this->showFiles();
239  return false;
240  }
241 
242  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
243  $c_gui = new ilConfirmationGUI();
244 
245  // set confirm/cancel commands
246  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
247  $c_gui->setHeaderText($this->lng->txt("md_adv_delete_files_sure"));
248  $c_gui->setCancel($this->lng->txt("cancel"), "showFiles");
249  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
250 
251  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
252  $files = new ilAdvancedMDRecordExportFiles();
253  $file_data = $files->readFilesInfo();
254 
255 
256  // add items to delete
257  foreach($_POST["file_id"] as $file_id)
258  {
259  $info = $file_data[$file_id];
260  $c_gui->addItem("file_id[]", $file_id, is_array($info['name']) ? implode(',',$info['name']) : 'No Records');
261  }
262  $this->tpl->setContent($c_gui->getHTML());
263  }
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteRecords()

ilAdvancedMDSettingsGUI::confirmDeleteRecords ( )

Confirm delete.

public

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

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

299  {
300  if(!isset($_POST['record_id']))
301  {
302  ilUtil::sendFailure($this->lng->txt('select_one'));
303  $this->showRecords();
304  return false;
305  }
306 
307  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
308  $c_gui = new ilConfirmationGUI();
309 
310  // set confirm/cancel commands
311  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRecords"));
312  $c_gui->setHeaderText($this->lng->txt("md_adv_delete_record_sure"));
313  $c_gui->setCancel($this->lng->txt("cancel"), "showRecords");
314  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteRecords");
315 
316  // add items to delete
317  foreach($_POST["record_id"] as $record_id)
318  {
319  $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
320  $c_gui->addItem("record_id[]", $record_id, $record->getTitle() ? $record->getTitle() : 'No Title');
321  }
322  $this->tpl->setContent($c_gui->getHTML());
323  }
$_POST['username']
Definition: cron.php:12
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Confirmation screen class.
+ Here is the call graph for this function:

◆ createField()

ilAdvancedMDSettingsGUI::createField ( )

Show field type selection.

public

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

References ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), and initFieldForm().

Referenced by addValue(), and saveField().

720  {
721  $this->ctrl->saveParameter($this,'record_id');
722 
723  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
724  $this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId(0);
725  $this->initFieldForm('create');
726  $this->tpl->setContent($this->form->getHTML());
727  }
initFieldForm($a_mode)
init field form
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createRecord()

ilAdvancedMDSettingsGUI::createRecord ( )

Show.

public

Parameters

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

References initForm(), initImportForm(), and initRecordObject().

Referenced by importRecord(), and saveRecord().

553  {
554  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.new_record.html','Services/AdvancedMetaData');
555 
556  $this->initRecordObject();
557  $this->initForm('create');
558  $this->tpl->setVariable('NEW_RECORD_TABLE',$this->form->getHTML());
559 
560  // Import Table
561  $this->initImportForm();
562  $this->tpl->setVariable('IMPORT_RECORD_TABLE',$this->import_form->getHTML());
563  return true;
564  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFields()

ilAdvancedMDSettingsGUI::deleteFields ( )

delete fields

public

Parameters

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

References $_POST, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), editRecord(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

423  {
424  if(!isset($_POST['field_id']))
425  {
426  ilUtil::sendFailure($this->lng->txt('select_one'));
427  $this->editRecord();
428  return false;
429  }
430  foreach($_POST["field_id"] as $field_id)
431  {
433  $field->delete();
434  }
435  ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_fields'));
436  $this->editRecord();
437  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ deleteFiles()

ilAdvancedMDSettingsGUI::deleteFiles ( )

Delete files.

public

Parameters

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

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

273  {
274  if(!isset($_POST['file_id']))
275  {
276  ilUtil::sendFailure($this->lng->txt('select_one'));
277  $this->editFiles();
278  return false;
279  }
280 
281  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
282  $files = new ilAdvancedMDRecordExportFiles();
283 
284  foreach($_POST['file_id'] as $file_id)
285  {
286  $files->deleteByFileId((int) $file_id);
287  }
288  ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_files'));
289  $this->showFiles();
290  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ deleteRecords()

ilAdvancedMDSettingsGUI::deleteRecords ( )

Permanently delete records.

public

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

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

332  {
333  if(!isset($_POST['record_id']))
334  {
335  ilUtil::sendFailure($this->lng->txt('select_one'));
336  $this->showRecords();
337  return false;
338  }
339  foreach($_POST['record_id'] as $record_id)
340  {
341  $record = ilAdvancedMDRecord::_getInstanceByRecordId($record_id);
342  $record->delete();
343  }
344  ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_records'));
345  $this->showRecords();
346  return true;
347  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ downloadFile()

ilAdvancedMDSettingsGUI::downloadFile ( )

Download XML file.

public

Parameters

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

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

212  {
213  if(!isset($_POST['file_id']) or count($_POST['file_id']) != 1)
214  {
215  ilUtil::sendFailure($this->lng->txt('md_adv_select_one_file'));
216  $this->showFiles();
217  return false;
218  }
219 
220  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
221  $files = new ilAdvancedMDRecordExportFiles();
222  $abs_path = $files->getAbsolutePathByFileId((int) $_POST['file_id'][0]);
223 
224  ilUtil::deliverFile($abs_path,'ilias_meta_data_record.xml','application/xml');
225  }
$_POST['username']
Definition: cron.php:12
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ editField()

ilAdvancedMDSettingsGUI::editField ( )

Edit field.

public

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

References $_GET, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), and initFieldForm().

Referenced by addValue(), and updateField().

678  {
679  $this->ctrl->saveParameter($this,'record_id');
680  $this->ctrl->saveParameter($this,'field_id');
681 
682  $this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId((int) $_GET['field_id']);
683  $this->initFieldForm('edit');
684  $this->tpl->setContent($this->form->getHTML());
685  }
$_GET["client_id"]
initFieldForm($a_mode)
init field form
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editRecord()

ilAdvancedMDSettingsGUI::editRecord ( )

Edit one record.

public

Parameters

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

References $_SESSION, ilAdvancedMDFieldDefinition\_getDefinitionsByRecordId(), initForm(), and initRecordObject().

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

447  {
448  // reset session
449  $_SESSION['num_values'] = 5;
450 
451  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.edit_record.html','Services/AdvancedMetaData');
452  $this->ctrl->saveParameter($this,'record_id');
453  $this->initRecordObject();
454  $this->initForm('edit');
455  $this->tpl->setVariable('EDIT_RECORD_TABLE',$this->form->getHTML());
456 
457  // show field table
458  include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
459  $fields = ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($this->record->getRecordId());
460 
461  include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php");
462  $table_gui = new ilAdvancedMDFieldTableGUI($this, "editRecord");
463  $table_gui->setTitle($this->lng->txt("md_adv_field_table"));
464  $table_gui->parseDefinitions($fields);
465  $table_gui->addCommandButton("updateFields", $this->lng->txt("save"));
466  $table_gui->addCommandButton('createField',$this->lng->txt('add'));
467  $table_gui->addCommandButton('showRecords',$this->lng->txt('cancel'));
468  $table_gui->addMultiCommand("confirmDeleteFields", $this->lng->txt("delete"));
469  $table_gui->setSelectAllCheckbox("field_id");
470 
471  $this->tpl->setVariable('FIELDS_TABLE',$table_gui->getHTML());
472  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static _getDefinitionsByRecordId($a_record_id)
get definitions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilAdvancedMDSettingsGUI::executeCommand ( )

Execute command.

public

Parameters

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

References $cmd, and setSubTabs().

50  {
51  $next_class = $this->ctrl->getNextClass($this);
52  $cmd = $this->ctrl->getCmd();
53 
54  $this->setSubTabs();
55  switch($next_class)
56  {
57  default:
58  if(!$cmd)
59  {
60  $cmd = 'showRecords';
61  }
62  $this->$cmd();
63  }
64  }
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ exportRecords()

ilAdvancedMDSettingsGUI::exportRecords ( )

Export records.

public

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

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

157  {
158  if(!isset($_POST['record_id']))
159  {
160  ilUtil::sendFailure($this->lng->txt('select_one'));
161  $this->showRecords();
162  return false;
163  }
164  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php');
165  $xml_writer = new ilAdvancedMDRecordXMLWriter($_POST['record_id']);
166  $xml_writer->write();
167 
168  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
169  $export_files = new ilAdvancedMDRecordExportFiles();
170  $export_files->create($xml_writer->xmlDumpMem());
171 
172  ilUtil::sendSuccess($this->lng->txt('md_adv_records_exported'));
173  $this->showFiles();
174  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ getRecordObjects()

ilAdvancedMDSettingsGUI::getRecordObjects ( )
protected

Get and cache record objects.

protected

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

References ilAdvancedMDRecord\_getRecords().

Referenced by showRecords(), and updateRecords().

1157  {
1158  if(!isset($this->record_objs))
1159  {
1160  return $this->record_objs = ilAdvancedMDRecord::_getRecords();
1161  }
1162  return $this->record_objs;
1163  }
static _getRecords()
Get records.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importRecord()

ilAdvancedMDSettingsGUI::importRecord ( )

import xml file

public

Parameters

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

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

602  {
603  $this->initImportForm();
604  if(!$this->import_form->checkInput())
605  {
606  $this->import_form->setValuesByPost();
607  $this->createRecord();
608  return false;
609  }
610 
611  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordImportFiles.php');
612  $import_files = new ilAdvancedMDRecordImportFiles();
613  if(!$create_time = $import_files->moveUploadedFile($_FILES['file']['tmp_name']))
614  {
615  $this->createRecord();
616  return false;
617  }
618 
619  try
620  {
621  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordParser.php');
622  $parser = new ilAdvancedMDRecordParser($import_files->getImportFileByCreationDate($create_time));
623 
624  // Validate
626  $parser->startParsing();
627 
628  // Insert
629  $parser->setMode(ilAdvancedMDRecordParser::MODE_INSERT);
630  $parser->startParsing();
631  ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'));
632  $this->showRecords();
633  }
634  catch(ilSAXParserException $exc)
635  {
636  ilUtil::sendFailure($exc->getMessage());
637  $this->createRecord();
638  }
639 
640  // Finally delete import file
641  $import_files->deleteFileByCreationDate($create_time);
642  return true;
643  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
SAX based XML parser for record import files.
+ Here is the call graph for this function:

◆ initFieldForm()

ilAdvancedMDSettingsGUI::initFieldForm (   $a_mode)
protected

init field form

protected

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

References $_SESSION, ilCheckboxInputGUI\setChecked(), ilTextInputGUI\setValue(), ilRadioGroupInputGUI\setValue(), ilTextAreaInputGUI\setValue(), ilAdvancedMDFieldDefinition\TYPE_DATE, ilAdvancedMDFieldDefinition\TYPE_DATETIME, ilAdvancedMDFieldDefinition\TYPE_SELECT, and ilAdvancedMDFieldDefinition\TYPE_TEXT.

Referenced by createField(), and editField().

783  {
784  if(is_object($this->field_form))
785  {
786  return true;
787  }
788 
789  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
790 
791  $this->form = new ilPropertyFormGUI();
792  $this->form->setFormAction($this->ctrl->getFormAction($this));
793 
794  // title
795  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
796  $title->setValue($this->field_definition->getTitle());
797  $title->setSize(20);
798  $title->setMaxLength(70);
799  $title->setRequired(true);
800  $this->form->addItem($title);
801 
802  // desc
803  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
804  $desc->setValue($this->field_definition->getDescription());
805  $desc->setRows(3);
806  $desc->setCols(50);
807  $this->form->addItem($desc);
808 
809  // Searchable
810  $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_searchable'),'searchable');
811  $check->setChecked($this->field_definition->isSearchable());
812  $check->setValue(1);
813  $this->form->addItem($check);
814 
815  // field type
816  $radio = new ilRadioGroupInputGUI($this->lng->txt('field_type'), "field_type");
817  $radio->setValue($this->field_definition->getFieldType() ?
818  $this->field_definition->getFieldType() :
820  $radio->setRequired(true);
821 
822  $radio_option = new ilRadioOption($this->lng->txt("udf_type_text"),ilAdvancedMDFieldDefinition::TYPE_TEXT);
823  $radio->addOption($radio_option);
824 
825  $radio_option = new ilRadioOption($this->lng->txt("udf_type_date"),ilAdvancedMDFieldDefinition::TYPE_DATE);
826  $radio->addOption($radio_option);
827 
828  $radio_option = new ilRadioOption($this->lng->txt("udf_type_datetime"),ilAdvancedMDFieldDefinition::TYPE_DATETIME);
829  $radio->addOption($radio_option);
830 
831  $radio_option = new ilRadioOption($this->lng->txt("udf_type_select"),ilAdvancedMDFieldDefinition::TYPE_SELECT);
832  $radio->addOption($radio_option);
833 
834  $values = $this->field_definition->getFieldValues();
835 
836  $max_values = max(count($values),$_SESSION['num_values'] ? $_SESSION['num_values'] : 5);
837  $_SESSION['num_values'] = $max_values;
838  for($i = 1; $i <= $max_values;$i++)
839  {
840  $title = new ilTextInputGUI($this->lng->txt('udf_value').' '.$i,'value_'.$i);
841  $title->setValue(isset($values[$i - 1]) ? $values[$i - 1] : '');
842  $title->setSize(20);
843  $title->setMaxLength(70);
844  $radio_option->addSubItem($title);
845  }
846  $this->form->addItem($radio);
847 
848  switch($a_mode)
849  {
850  case 'create':
851  $this->form->setTitle($this->lng->txt('md_adv_create_field'));
852  $this->form->addCommandButton('saveField',$this->lng->txt('create'));
853  $this->form->addCommandButton('addValue',$this->lng->txt('md_adv_add_value'));
854  $this->form->addCommandButton('editRecord',$this->lng->txt('cancel'));
855 
856  return true;
857 
858  case 'edit':
859  $this->form->setTitle($this->lng->txt('md_adv_edit_field'));
860  $this->form->addCommandButton('updateField',$this->lng->txt('save'));
861  $this->form->addCommandButton('addValue',$this->lng->txt('md_adv_add_value'));
862  $this->form->addCommandButton('editRecord',$this->lng->txt('cancel'));
863 
864  return true;
865  }
866  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
This class represents an option in a radio group.
This class represents a property form user interface.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
setChecked($a_checked)
Set Checked.
This class represents a property in a property form.
This class represents a text property in a property form.
This class represents a text area property in a property form.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

ilAdvancedMDSettingsGUI::initForm (   $a_mode)
protected

Init Form.

protected

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

References $section, $t, ilAdvancedMDRecord\_getAssignableObjectTypes(), ilCheckboxInputGUI\setChecked(), ilTextInputGUI\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by createRecord(), and editRecord().

874  {
875  if(is_object($this->form))
876  {
877  return true;
878  }
879 
880  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
881 
882  $this->form = new ilPropertyFormGUI();
883  $this->form->setFormAction($this->ctrl->getFormAction($this));
884 
885  // title
886  $title = new ilTextInputGUI($this->lng->txt('title'),'title');
887  $title->setValue($this->record->getTitle());
888  $title->setSize(20);
889  $title->setMaxLength(70);
890  $title->setRequired(true);
891  $this->form->addItem($title);
892 
893  // desc
894  $desc = new ilTextAreaInputGUI($this->lng->txt('description'),'desc');
895  $desc->setValue($this->record->getDescription());
896  $desc->setRows(3);
897  $desc->setCols(50);
898  $this->form->addItem($desc);
899 
900  // active
901  $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_active'),'active');
902  $check->setChecked($this->record->isActive());
903  $check->setValue(1);
904  $this->form->addItem($check);
905 
907  $section->setTitle($this->lng->txt('md_obj_types'));
908  $this->form->addItem($section);
909 
910  foreach(ilAdvancedMDRecord::_getAssignableObjectTypes(true) as $type)
911  {
912  $t = $type["obj_type"].":".$type["sub_type"];
913  $this->lng->loadLanguageModule($type["obj_type"]);
914  $check = new ilCheckboxInputGUI($type["text"],'obj_types[]');
915  $check->setChecked($this->record->isAssignedObjectType($type["obj_type"], $type["sub_type"]));
916  $check->setValue($t);
917  $this->form->addItem($check);
918  }
919 
920 
921  switch($a_mode)
922  {
923  case 'create':
924  $this->form->setTitle($this->lng->txt('md_adv_create_record'));
925  $this->form->addCommandButton('saveRecord',$this->lng->txt('add'));
926  $this->form->addCommandButton('showRecords',$this->lng->txt('cancel'));
927 
928  return true;
929 
930  case 'edit':
931  $this->form->setTitle($this->lng->txt('md_adv_edit_record'));
932  $this->form->addCommandButton('updateRecord',$this->lng->txt('save'));
933  $this->form->addCommandButton('showRecords',$this->lng->txt('cancel'));
934 
935  return true;
936  }
937  }
This class represents a property form user interface.
This class represents a section header in a property form.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
$section
Definition: Utf8Test.php:84
setChecked($a_checked)
Set Checked.
This class represents a text property in a property form.
static _getAssignableObjectTypes($a_include_text=false)
Get assignable object type.
This class represents a text area property in a property form.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSubstitutions()

ilAdvancedMDSettingsGUI::initFormSubstitutions ( )
protected

init form table 'substitutions'

protected

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

References $records, $section, ilAdvancedMDFieldDefinition\_getActiveDefinitionsByObjType(), ilAdvancedMDRecord\_getAllRecordsByObjectType(), ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), ilAdvancedMDSubstitution\_getInstanceByObjectType(), ilAdvancedMDRecord\_lookupTitle(), ilUtil\getImagePath(), and ilCheckboxInputGUI\setValue().

Referenced by showRecords().

945  {
946  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
947 
948  if(!$visible_records = ilAdvancedMDRecord::_getAllRecordsByObjectType())
949  {
950  return true;
951  }
952 
953  $this->form = new ilPropertyFormGUI();
954  $this->form->setFormAction($this->ctrl->getFormAction($this));
955  #$this->form->setTableWidth('100%');
956 
957  // substitution
958  foreach($visible_records as $obj_type => $records)
959  {
960  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
962 
963  // Show section
965  $section->setSectionIcon(ilUtil::getImagePath('icon_'.$obj_type.'_s.png'),$this->lng->txt('objs_'.$obj_type));
966  $section->setTitle($this->lng->txt('objs_'.$obj_type));
967  $this->form->addItem($section);
968 
969  $check = new ilCheckboxInputGUI($this->lng->txt('description'),'enabled_desc_'.$obj_type);
970  $check->setValue(1);
971  $check->setOptionTitle($this->lng->txt('md_adv_desc_show'));
972  $check->setChecked($sub->isDescriptionEnabled() ? true : false);
973  $this->form->addItem($check);
974 
975  $check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'),'enabled_field_names_'.$obj_type);
976  $check->setValue(1);
977  $check->setOptionTitle($this->lng->txt('md_adv_fields_show'));
978  $check->setChecked($sub->enabledFieldNames() ? true : false);
979  $this->form->addItem($check);
980 
981  #$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
982  #$area->setUseRte(true);
983  #$area->setRteTagSet('standard');
984  #$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
985  #$area->setRows(5);
986  #$area->setCols(80);
987  #$this->form->addItem($area);
988 
990  $definitions = $sub->sortDefinitions($definitions);
991 
992  $counter = 1;
993  foreach($definitions as $definition_id)
994  {
996 
997  if($def->isDeleted())
998  {
999  continue;
1000  }
1001 
1002  $title = ilAdvancedMDRecord::_lookupTitle($def->getRecordId());
1003  $title = $def->getTitle().' ('.$title.')';
1004 
1005  $check = new ilCheckboxInputGUI($title,'show['.$obj_type.']['.$definition_id.']');
1006  $check->setValue(1);
1007  $check->setOptionTitle($this->lng->txt('md_adv_show'));
1008  $check->setChecked($sub->isSubstituted($definition_id));
1009 
1010  $pos = new ilTextInputGUI($this->lng->txt('position'),'position['.$obj_type.']['.$definition_id.']');
1011  $pos->setSize(3);
1012  $pos->setMaxLength(4);
1013  $pos->setValue(sprintf('%.1f',$counter++));
1014  $check->addSubItem($pos);
1015 
1016  $bold = new ilCheckboxInputGUI($this->lng->txt('bold'),'bold['.$obj_type.']['.$definition_id.']');
1017  $bold->setValue(1);
1018  $bold->setChecked($sub->isBold($definition_id));
1019  $check->addSubItem($bold);
1020 
1021  $bold = new ilCheckboxInputGUI($this->lng->txt('newline'),'newline['.$obj_type.']['.$definition_id.']');
1022  $bold->setValue(1);
1023  $bold->setChecked($sub->hasNewline($definition_id));
1024  $check->addSubItem($bold);
1025 
1026 
1027  $this->form->addItem($check);
1028  }
1029 
1030 
1031  // placeholder
1032  /*
1033  $custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders'));
1034  $tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData');
1035  foreach($records as $record)
1036  {
1037  foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition)
1038  {
1039  $tpl->setCurrentBlock('field');
1040  $tpl->setVariable('FIELD_NAME',$definition->getTitle());
1041  $tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'.
1042  '[/IF_F_'.$definition->getFieldId().']');
1043  $tpl->parseCurrentBlock();
1044  }
1045 
1046  $tpl->setCurrentBlock('record');
1047  $tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for'));
1048  $tpl->setVariable('TITLE',$record->getTitle());
1049  $tpl->parseCurrentBlock();
1050  }
1051  $custom->setHTML($tpl->get());
1052  $this->form->addItem($custom);
1053  */
1054  }
1055  $this->form->setTitle($this->lng->txt('md_adv_substitution_table'));
1056  $this->form->addCommandButton('updateSubstitutions',$this->lng->txt('save'));
1057  return true;
1058  }
This class represents a property form user interface.
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
$records
Definition: simple_test.php:22
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
$section
Definition: Utf8Test.php:84
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
setValue($a_value)
Set Value.
This class represents a text property in a property form.
static _getAllRecordsByObjectType()
Get records by obj_type Note: this returns only records with no sub types! public.
static _lookupTitle($a_record_id)
Lookup title.
static _getActiveDefinitionsByObjType($a_type)
get active definitions by obj type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initImportForm()

ilAdvancedMDSettingsGUI::initImportForm ( )
protected

show import form

protected

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

References $file.

Referenced by createRecord(), and importRecord().

572  {
573  if(is_object($this->import_form))
574  {
575  return true;
576  }
577 
578  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
579  $this->import_form = new ilPropertyFormGUI();
580  $this->import_form->setMultipart(true);
581  $this->import_form->setFormAction($this->ctrl->getFormAction($this));
582 
583  // add file property
584  $file = new ilFileInputGUI($this->lng->txt('file'),'file');
585  $file->setSuffixes(array('xml'));
586  $file->setRequired(true);
587  $this->import_form->addItem($file);
588 
589  $this->import_form->setTitle($this->lng->txt('md_adv_import_record'));
590  $this->import_form->addCommandButton('importRecord',$this->lng->txt('import'));
591  $this->import_form->addCommandButton('editRecord',$this->lng->txt('cancel'));
592  }
print $file
This class represents a property form user interface.
This class represents a file property in a property form.
+ Here is the caller graph for this function:

◆ initRecordObject()

ilAdvancedMDSettingsGUI::initRecordObject ( )
protected

Init record object.

protected

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

References $_GET, and ilAdvancedMDRecord\_getInstanceByRecordId().

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

1114  {
1115  if(is_object($this->record))
1116  {
1117  return $this->record;
1118  }
1119 
1120  $record_id = isset($_GET['record_id']) ?
1121  $_GET['record_id'] :
1122  0;
1123  return $this->record = ilAdvancedMDRecord::_getInstanceByRecordId($_GET['record_id']);
1124  }
$_GET["client_id"]
static _getInstanceByRecordId($a_record_id)
Get instance by record id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFieldFormData()

ilAdvancedMDSettingsGUI::loadFieldFormData ( )
protected

load field definition from form data

protected

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

References $_GET, $_POST, $_SESSION, and ilUtil\stripSlashes().

Referenced by addValue(), saveField(), and updateField().

1091  {
1092  $this->field_definition->setRecordId((int) $_GET['record_id']);
1093  $this->field_definition->setTitle(ilUtil::stripSlashes($_POST['title']));
1094  $this->field_definition->setDescription(ilUtil::stripSlashes($_POST['description']));
1095  $this->field_definition->enableSearchable(isset($_POST['searchable']) ? true : false);
1096  $this->field_definition->setFieldType(ilUtil::stripSlashes($_POST['field_type']));
1097  $this->field_definition->setFieldValues(array());
1098 
1099  for($i = 1; $i <= $_SESSION['num_values'];$i++)
1100  {
1101  if(isset($_POST['value_'.$i]))
1102  {
1103  $this->field_definition->appendFieldValue($_POST['value_'.$i]);
1104  }
1105  }
1106  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadRecordFormData()

ilAdvancedMDSettingsGUI::loadRecordFormData ( )
protected

load record form data

protected

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

References $_POST, $t, and ilUtil\stripSlashes().

Referenced by saveRecord(), and updateRecord().

1066  {
1067  $this->record->setActive(ilUtil::stripSlashes($_POST['active']));
1068  $this->record->setTitle(ilUtil::stripSlashes($_POST['title']));
1069  $this->record->setDescription(ilUtil::stripSlashes($_POST['desc']));
1070  $obj_types = array();
1071  if (is_array($_POST['obj_types']))
1072  {
1073  foreach ($_POST['obj_types'] as $t)
1074  {
1075  $t = explode(":", $t);
1076  $obj_types[] = array(
1077  "obj_type" => ilUtil::stripSlashes($t[0]),
1078  "sub_type" => ilUtil::stripSlashes($t[1])
1079  );
1080  }
1081  }
1082  $this->record->setAssignedObjectTypes($obj_types);
1083  }
$_POST['username']
Definition: cron.php:12
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveField()

ilAdvancedMDSettingsGUI::saveField ( )

create field

public

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

References $ilErr, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), createField(), editRecord(), loadFieldFormData(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

758  {
759  global $ilErr;
760 
761  $this->ctrl->saveParameter($this,'record_id');
762  $this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId(0);
763  $this->loadFieldFormData();
764 
765  if(!$this->field_definition->validate())
766  {
767  ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
768  $this->createField();
769  return false;
770  }
771  $this->field_definition->add();
772  ilUtil::sendSuccess($this->lng->txt('save_settings'));
773  $this->editRecord();
774  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
createField()
Show field type selection.
loadFieldFormData()
load field definition from form data
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ saveRecord()

ilAdvancedMDSettingsGUI::saveRecord ( )

Save record.

public

Parameters

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

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

654  {
655  global $ilErr;
656 
657  $this->initRecordObject();
658  $this->loadRecordFormData();
659 
660  if(!$this->record->validate())
661  {
662  ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
663  $this->createRecord();
664  return false;
665  }
666  $this->record->save();
667  ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'));
668  $this->showRecords();
669  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
loadRecordFormData()
load record form data
+ Here is the call graph for this function:

◆ setSubTabs()

ilAdvancedMDSettingsGUI::setSubTabs ( )
protected

Set sub tabs.

protected

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

Referenced by executeCommand().

1132  {
1133  $this->tabs_gui->clearSubTabs();
1134 
1135  $this->tabs_gui->addSubTabTarget("md_adv_record_list",
1136  $this->ctrl->getLinkTarget($this, "showRecords"),
1137  '',
1138  '',
1139  '',
1140  true);
1141 
1142  $this->tabs_gui->addSubTabTarget("md_adv_file_list",
1143  $this->ctrl->getLinkTarget($this, "showFiles"),
1144  "showFiles",
1145  array(),
1146  '',
1147  false);
1148 
1149  }
+ Here is the caller graph for this function:

◆ showFiles()

ilAdvancedMDSettingsGUI::showFiles ( )

show export files

public

Parameters

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

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

184  {
185 
186  $this->tabs_gui->setSubTabActive('md_adv_file_list');
187 
188  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
189  $files = new ilAdvancedMDRecordExportFiles();
190  $file_data = $files->readFilesInfo();
191 
192  include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFilesTableGUI.php");
193  $table_gui = new ilAdvancedMDRecordExportFilesTableGUI($this, "showFiles");
194  $table_gui->setTitle($this->lng->txt("md_record_export_table"));
195  $table_gui->parseFiles($file_data);
196  $table_gui->addMultiCommand("downloadFile",$this->lng->txt('download'));
197  $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
198  $table_gui->addCommandButton('showFiles',$this->lng->txt('cancel'));
199  $table_gui->setSelectAllCheckbox("file_id");
200 
201  $this->tpl->setContent($table_gui->getHTML());
202  }
+ Here is the caller graph for this function:

◆ showRecords()

ilAdvancedMDSettingsGUI::showRecords ( )

show record list

public

Parameters

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

References getRecordObjects(), and initFormSubstitutions().

Referenced by confirmDeleteRecords(), deleteRecords(), exportRecords(), importRecord(), saveRecord(), updateFields(), updateRecord(), updateRecords(), and updateSubstitutions().

74  {
75  global $ilToolbar;
76 
77  $ilToolbar->addButton($this->lng->txt('add'),
78  $this->ctrl->getLinkTarget($this, "createRecord"));
79 
80  $this->record_objs = $this->getRecordObjects();
81  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.show_records.html','Services/AdvancedMetaData');
82 
83  include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php");
84  $table_gui = new ilAdvancedMDRecordTableGUI($this, "showRecords");
85  $table_gui->setTitle($this->lng->txt("md_record_list_table"));
86  $table_gui->parseRecords($this->record_objs);
87  $table_gui->addCommandButton("updateRecords", $this->lng->txt("save"));
88  //$table_gui->addCommandButton('createRecord',$this->lng->txt('add'));
89  $table_gui->addMultiCommand("exportRecords",$this->lng->txt('export'));
90  $table_gui->addMultiCommand("confirmDeleteRecords", $this->lng->txt("delete"));
91  $table_gui->setSelectAllCheckbox("record_id");
92  $this->tpl->setVariable('RECORD_TABLE',$table_gui->getHTML());
93 
94  if(!$this->initFormSubstitutions())
95  {
96  return true;
97  }
98  if (is_object($this->form))
99  {
100  $this->tpl->setVariable('SUBSTITUTION_TABLE',$this->form->getHTML());
101  }
102  return true;
103  }
getRecordObjects()
Get and cache record objects.
initFormSubstitutions()
init form table &#39;substitutions&#39;
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateField()

ilAdvancedMDSettingsGUI::updateField ( )

Update field.

public

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

References $_GET, $ilErr, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), editField(), editRecord(), loadFieldFormData(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

694  {
695  global $ilErr;
696 
697  $this->ctrl->saveParameter($this,'record_id');
698 
699  $this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId((int) $_GET['field_id']);
700  $this->loadFieldFormData();
701 
702  if(!$this->field_definition->validate())
703  {
704  ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
705  $this->editField();
706  return false;
707  }
708  $this->field_definition->update();
709  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
710  $this->editRecord();
711  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
loadFieldFormData()
load field definition from form data
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ updateFields()

ilAdvancedMDSettingsGUI::updateFields ( )

Update fields.

public

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

References $_GET, $_POST, ilAdvancedMDFieldDefinition\_getInstanceByFieldId(), editRecord(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and showRecords().

481  {
482  if(!isset($_GET['record_id']) or !$_GET['record_id'])
483  {
484  ilUtil::sendFailure($this->lng->txt('select_one'));
485  $this->showRecords();
486  return false;
487  }
488 
489  if(!isset($_POST['position']) or !is_array($_POST['position']))
490  {
491  $this->showRecords();
492  return false;
493  }
494  // sort by position
495  asort($_POST['position'],SORT_NUMERIC);
496  $counter = 1;
497 
498  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
499  foreach($_POST['position'] as $field_id => $pos)
500  {
502  $definition->setPosition($counter++);
503  $definition->enableSearchable(isset($_POST['searchable'][$field_id]) ? true : false);
504  $definition->update();
505  }
506 
507  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
508  $this->editRecord();
509  return true;
510  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static _getInstanceByFieldId($a_field_id)
Get instance by field_id.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ updateRecord()

ilAdvancedMDSettingsGUI::updateRecord ( )

Update record.

public

Parameters

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

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

520  {
521  global $ilErr;
522 
523  if(!isset($_GET['record_id']) or !$_GET['record_id'])
524  {
525  ilUtil::sendFailure($this->lng->txt('select_one'));
526  $this->showRecords();
527  return false;
528  }
529  $this->initRecordObject();
530  $this->loadRecordFormData();
531 
532  if(!$this->record->validate())
533  {
534  ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
535  $this->editRecord();
536  return false;
537  }
538  $this->record->update();
539  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
540  $this->showRecords();
541  return true;
542  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
loadRecordFormData()
load record form data
+ Here is the call graph for this function:

◆ updateRecords()

ilAdvancedMDSettingsGUI::updateRecords ( )

Save records (assigned object typed)

public

Parameters

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

References $_POST, $t, getRecordObjects(), ilUtil\sendSuccess(), showRecords(), and ilUtil\stripSlashes().

357  {
358  foreach($this->getRecordObjects() as $record_obj)
359  {
360  $obj_types = array();
361  if (is_array($_POST['obj_types'][$record_obj->getRecordId()]))
362  {
363  foreach ($_POST['obj_types'][$record_obj->getRecordId()] as $t)
364  {
365  $t = explode(":", $t);
366  $obj_types[] = array(
367  "obj_type" => ilUtil::stripSlashes($t[0]),
368  "sub_type" => ilUtil::stripSlashes($t[1])
369  );
370  }
371  }
372 
373  $record_obj->setAssignedObjectTypes($obj_types);
374  $record_obj->setActive(isset($_POST['active'][$record_obj->getRecordId()]));
375  $record_obj->update();
376  }
377  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
378  $this->showRecords();
379  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
getRecordObjects()
Get and cache record objects.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ updateSubstitutions()

ilAdvancedMDSettingsGUI::updateSubstitutions ( )

Update substitution.

public

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

References $_POST, ilAdvancedMDRecord\_getActivatedObjTypes(), ilAdvancedMDSubstitution\_getInstanceByObjectType(), ilUtil\sendSuccess(), and showRecords().

112  {
113  foreach(ilAdvancedMDRecord::_getActivatedObjTypes() as $obj_type)
114  {
115  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
117  $sub->resetSubstitutions(array());
118  $sub->enableDescription($_POST['enabled_desc_'.$obj_type]);
119  $sub->enableFieldNames((int) $_POST['enabled_field_names_'.$obj_type]);
120 
121  if(isset($_POST['position'][$obj_type]))
122  {
123  asort($_POST['position'][$obj_type],SORT_NUMERIC);
124  foreach($_POST['position'][$obj_type] as $field_id => $pos)
125  {
126  if(isset($_POST['show'][$obj_type][$field_id]) and $_POST['show'][$obj_type][$field_id])
127  {
128  $newline = $bold = false;
129  if(isset($_POST['bold'][$obj_type][$field_id]) and $_POST['bold'][$obj_type][$field_id])
130  {
131  $bold = true;
132  }
133  if(isset($_POST['newline'][$obj_type][$field_id]) and $_POST['newline'][$obj_type][$field_id])
134  {
135  $newline = true;
136  }
137  $sub->appendSubstitution($field_id,$bold,$newline);
138  }
139  }
140  }
141 
142  $sub->update();
143  }
144 
145 
146  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
147  $this->showRecords();
148  return true;
149  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static _getInstanceByObjectType($a_type)
Singleton: use this method to get an instance.
static _getActivatedObjTypes()
get activated obj types
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilAdvancedMDSettingsGUI::$ctrl
protected

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

◆ $lng

ilAdvancedMDSettingsGUI::$lng
protected

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

Referenced by __construct().

◆ $tabs

ilAdvancedMDSettingsGUI::$tabs
protected

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

◆ $tpl

ilAdvancedMDSettingsGUI::$tpl
protected

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

Referenced by __construct().


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