ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAdvancedMDSettingsGUI Class Reference
+ Collaboration diagram for ilAdvancedMDSettingsGUI:

Public Member Functions

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

Protected Member Functions

 initImportForm ()
 show import form
 initFieldForm ($a_mode)
 init field form
 initForm ($a_mode)
 Init Form.
 initFormSubstitutions ()
 init form table 'substitutions'
 loadRecordFormData ()
 load record form data
 loadFieldFormData ()
 load field definition from form data
 initRecordObject ()
 Init record object.
 setSubTabs ()
 Set sub tabs.
 getRecordObjects ()
 Get and cache record objects.

Protected Attributes

 $lng
 $tpl
 $ctrl
 $tabs

Detailed Description

Constructor & Destructor Documentation

ilAdvancedMDSettingsGUI::__construct ( )

Constructor.

public

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

References $ilCtrl, $lng, and $tpl.

{
global $tpl,$lng,$ilCtrl,$ilTabs;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->lng->loadLanguageModule('meta');
$this->tpl = $tpl;
$this->tabs_gui = $ilTabs;
}

Member Function Documentation

ilAdvancedMDSettingsGUI::addValue ( )

add value

public

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

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

{
++$_SESSION['num_values'];
$this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId(isset($_GET['field_id']) ? (int) $_GET['field_id'] : 0);
if(isset($_GET['field_id']) and $_GET['field_id'])
{
$this->editField();
}
else
{
$this->createField();
}
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::confirmDeleteFields ( )

show delete fields confirmation screen

public

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

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

{
if(!isset($_POST['field_id']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->editRecord();
return false;
}
$this->ctrl->saveParameter($this,'record_id');
include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
$c_gui = new ilConfirmationGUI();
// set confirm/cancel commands
$c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFields"));
$c_gui->setHeaderText($this->lng->txt("md_adv_delete_fields_sure"));
$c_gui->setCancel($this->lng->txt("cancel"), "showRecords");
$c_gui->setConfirm($this->lng->txt("confirm"), "deleteFields");
// add items to delete
foreach($_POST["field_id"] as $field_id)
{
$c_gui->addItem("field_id[]", $field_id, $field->getTitle() ? $field->getTitle() : 'No Title');
}
$this->tpl->setContent($c_gui->getHTML());
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::confirmDeleteFiles ( )

confirm delete files

public

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

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

{
if(!isset($_POST['file_id']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->showFiles();
return false;
}
include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
$c_gui = new ilConfirmationGUI();
// set confirm/cancel commands
$c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
$c_gui->setHeaderText($this->lng->txt("md_adv_delete_files_sure"));
$c_gui->setCancel($this->lng->txt("cancel"), "showFiles");
$c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
$file_data = $files->readFilesInfo();
// add items to delete
foreach($_POST["file_id"] as $file_id)
{
$info = $file_data[$file_id];
$c_gui->addItem("file_id[]", $file_id, is_array($info['name']) ? implode(',',$info['name']) : 'No Records');
}
$this->tpl->setContent($c_gui->getHTML());
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::confirmDeleteRecords ( )

Confirm delete.

public

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

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

{
if(!isset($_POST['record_id']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->showRecords();
return false;
}
include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
$c_gui = new ilConfirmationGUI();
// set confirm/cancel commands
$c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteRecords"));
$c_gui->setHeaderText($this->lng->txt("md_adv_delete_record_sure"));
$c_gui->setCancel($this->lng->txt("cancel"), "showRecords");
$c_gui->setConfirm($this->lng->txt("confirm"), "deleteRecords");
// add items to delete
foreach($_POST["record_id"] as $record_id)
{
$c_gui->addItem("record_id[]", $record_id, $record->getTitle() ? $record->getTitle() : 'No Title');
}
$this->tpl->setContent($c_gui->getHTML());
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::createField ( )

Show field type selection.

public

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

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

Referenced by addValue(), and saveField().

{
$this->ctrl->saveParameter($this,'record_id');
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$this->initFieldForm('create');
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::createRecord ( )

Show.

public

Parameters

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

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

Referenced by importRecord(), and saveRecord().

{
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.new_record.html','Services/AdvancedMetaData');
$this->initRecordObject();
$this->initForm('create');
$this->tpl->setVariable('NEW_RECORD_TABLE',$this->form->getHTML());
// Import Table
$this->initImportForm();
$this->tpl->setVariable('IMPORT_RECORD_TABLE',$this->import_form->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::deleteFields ( )

delete fields

public

Parameters

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

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

{
if(!isset($_POST['field_id']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->editRecord();
return false;
}
foreach($_POST["field_id"] as $field_id)
{
$field->delete();
}
ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_fields'));
$this->editRecord();
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::deleteFiles ( )

Delete files.

public

Parameters

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

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

{
if(!isset($_POST['file_id']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->editFiles();
return false;
}
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
foreach($_POST['file_id'] as $file_id)
{
$files->deleteByFileId((int) $file_id);
}
ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_files'));
$this->showFiles();
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::deleteRecords ( )

Permanently delete records.

public

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

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

{
if(!isset($_POST['record_id']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->showRecords();
return false;
}
foreach($_POST['record_id'] as $record_id)
{
$record->delete();
}
ilUtil::sendSuccess($this->lng->txt('md_adv_deleted_records'));
$this->showRecords();
return true;
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::downloadFile ( )

Download XML file.

public

Parameters

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

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

{
if(!isset($_POST['file_id']) or count($_POST['file_id']) != 1)
{
ilUtil::sendFailure($this->lng->txt('md_adv_select_one_file'));
$this->showFiles();
return false;
}
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
$abs_path = $files->getAbsolutePathByFileId((int) $_POST['file_id'][0]);
ilUtil::deliverFile($abs_path,'ilias_meta_data_record.xml','application/xml');
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::editField ( )

Edit field.

public

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

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

Referenced by addValue(), and updateField().

{
$this->ctrl->saveParameter($this,'record_id');
$this->ctrl->saveParameter($this,'field_id');
$this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId((int) $_GET['field_id']);
$this->initFieldForm('edit');
$this->tpl->setContent($this->form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::editRecord ( )

Edit one record.

public

Parameters

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

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

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

{
// reset session
$_SESSION['num_values'] = 5;
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.edit_record.html','Services/AdvancedMetaData');
$this->ctrl->saveParameter($this,'record_id');
$this->initRecordObject();
$this->initForm('edit');
$this->tpl->setVariable('EDIT_RECORD_TABLE',$this->form->getHTML());
// show field table
include_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
$fields = ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($this->record->getRecordId());
include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldTableGUI.php");
$table_gui = new ilAdvancedMDFieldTableGUI($this, "editRecord");
$table_gui->setTitle($this->lng->txt("md_adv_field_table"));
$table_gui->parseDefinitions($fields);
$table_gui->addCommandButton("updateFields", $this->lng->txt("save"));
$table_gui->addCommandButton('createField',$this->lng->txt('add'));
$table_gui->addCommandButton('showRecords',$this->lng->txt('cancel'));
$table_gui->addMultiCommand("confirmDeleteFields", $this->lng->txt("delete"));
$table_gui->setSelectAllCheckbox("field_id");
$this->tpl->setVariable('FIELDS_TABLE',$table_gui->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::executeCommand ( )

Execute command.

public

Parameters

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

References $cmd, and setSubTabs().

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
$this->setSubTabs();
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = 'showRecords';
}
$this->$cmd();
}
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::exportRecords ( )

Export records.

public

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

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

{
if(!isset($_POST['record_id']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->showRecords();
return false;
}
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php');
$xml_writer = new ilAdvancedMDRecordXMLWriter($_POST['record_id']);
$xml_writer->write();
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
$export_files = new ilAdvancedMDRecordExportFiles();
$export_files->create($xml_writer->xmlDumpMem());
ilUtil::sendSuccess($this->lng->txt('md_adv_records_exported'));
$this->showFiles();
}

+ Here is the call graph for this function:

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().

{
if(!isset($this->record_objs))
{
return $this->record_objs = ilAdvancedMDRecord::_getRecords();
}
return $this->record_objs;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::importRecord ( )

import xml file

public

Parameters

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

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

{
$this->initImportForm();
if(!$this->import_form->checkInput())
{
$this->import_form->setValuesByPost();
$this->createRecord();
return false;
}
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordImportFiles.php');
$import_files = new ilAdvancedMDRecordImportFiles();
if(!$create_time = $import_files->moveUploadedFile($_FILES['file']['tmp_name']))
{
$this->createRecord();
return false;
}
try
{
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordParser.php');
$parser = new ilAdvancedMDRecordParser($import_files->getImportFileByCreationDate($create_time));
// Validate
$parser->startParsing();
// Insert
$parser->startParsing();
ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'));
$this->showRecords();
}
catch(ilSAXParserException $exc)
{
ilUtil::sendFailure($exc->getMessage());
$this->createRecord();
}
// Finally delete import file
$import_files->deleteFileByCreationDate($create_time);
return true;
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::initFieldForm (   $a_mode)
protected

init field form

protected

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

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

Referenced by createField(), and editField().

{
if(is_object($this->field_form))
{
return true;
}
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
// title
$title = new ilTextInputGUI($this->lng->txt('title'),'title');
$title->setValue($this->field_definition->getTitle());
$title->setSize(20);
$title->setMaxLength(70);
$title->setRequired(true);
$this->form->addItem($title);
// desc
$desc = new ilTextAreaInputGUI($this->lng->txt('description'),'description');
$desc->setValue($this->field_definition->getDescription());
$desc->setRows(3);
$desc->setCols(50);
$this->form->addItem($desc);
// Searchable
$check = new ilCheckboxInputGUI($this->lng->txt('md_adv_searchable'),'searchable');
$check->setChecked($this->field_definition->isSearchable());
$check->setValue(1);
$this->form->addItem($check);
// field type
$radio = new ilRadioGroupInputGUI($this->lng->txt('field_type'), "field_type");
$radio->setValue($this->field_definition->getFieldType() ?
$this->field_definition->getFieldType() :
$radio->setRequired(true);
$radio_option = new ilRadioOption($this->lng->txt("udf_type_text"),ilAdvancedMDFieldDefinition::TYPE_TEXT);
$radio->addOption($radio_option);
$radio_option = new ilRadioOption($this->lng->txt("udf_type_date"),ilAdvancedMDFieldDefinition::TYPE_DATE);
$radio->addOption($radio_option);
$radio_option = new ilRadioOption($this->lng->txt("udf_type_datetime"),ilAdvancedMDFieldDefinition::TYPE_DATETIME);
$radio->addOption($radio_option);
$radio_option = new ilRadioOption($this->lng->txt("udf_type_select"),ilAdvancedMDFieldDefinition::TYPE_SELECT);
$radio->addOption($radio_option);
$values = $this->field_definition->getFieldValues();
$max_values = max(count($values),$_SESSION['num_values'] ? $_SESSION['num_values'] : 5);
$_SESSION['num_values'] = $max_values;
for($i = 1; $i <= $max_values;$i++)
{
$title = new ilTextInputGUI($this->lng->txt('udf_value').' '.$i,'value_'.$i);
$title->setValue(isset($values[$i - 1]) ? $values[$i - 1] : '');
$title->setSize(20);
$title->setMaxLength(70);
$radio_option->addSubItem($title);
}
$this->form->addItem($radio);
switch($a_mode)
{
case 'create':
$this->form->setTitle($this->lng->txt('md_adv_create_field'));
$this->form->addCommandButton('saveField',$this->lng->txt('create'));
$this->form->addCommandButton('addValue',$this->lng->txt('md_adv_add_value'));
$this->form->addCommandButton('editRecord',$this->lng->txt('cancel'));
return true;
case 'edit':
$this->form->setTitle($this->lng->txt('md_adv_edit_field'));
$this->form->addCommandButton('updateField',$this->lng->txt('save'));
$this->form->addCommandButton('addValue',$this->lng->txt('md_adv_add_value'));
$this->form->addCommandButton('editRecord',$this->lng->txt('cancel'));
return true;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::initForm (   $a_mode)
protected

Init Form.

protected

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

References $desc, $title, $type, ilAdvancedMDRecord\_getAssignableObjectTypes(), and ilCheckboxInputGUI\setChecked().

Referenced by createRecord(), and editRecord().

{
if(is_object($this->form))
{
return true;
}
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
// title
$title = new ilTextInputGUI($this->lng->txt('title'),'title');
$title->setValue($this->record->getTitle());
$title->setSize(20);
$title->setMaxLength(70);
$title->setRequired(true);
$this->form->addItem($title);
// desc
$desc = new ilTextAreaInputGUI($this->lng->txt('description'),'desc');
$desc->setValue($this->record->getDescription());
$desc->setRows(3);
$desc->setCols(50);
$this->form->addItem($desc);
// active
$check = new ilCheckboxInputGUI($this->lng->txt('md_adv_active'),'active');
$check->setChecked($this->record->isActive());
$check->setValue(1);
$this->form->addItem($check);
$section = new ilFormSectionHeaderGUI();
$section->setTitle($this->lng->txt('md_obj_types'));
$this->form->addItem($section);
{
$check = new ilCheckboxInputGUI($this->lng->txt('objs_'.$type),'obj_types[]');
$check->setChecked(in_array($type,$this->record->getAssignedObjectTypes()) ? true : false);
$check->setValue($type);
$this->form->addItem($check);
}
switch($a_mode)
{
case 'create':
$this->form->setTitle($this->lng->txt('md_adv_create_record'));
$this->form->addCommandButton('saveRecord',$this->lng->txt('add'));
$this->form->addCommandButton('showRecords',$this->lng->txt('cancel'));
return true;
case 'edit':
$this->form->setTitle($this->lng->txt('md_adv_edit_record'));
$this->form->addCommandButton('updateRecord',$this->lng->txt('save'));
$this->form->addCommandButton('showRecords',$this->lng->txt('cancel'));
return true;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::initFormSubstitutions ( )
protected

init form table 'substitutions'

protected

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

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

Referenced by showRecords().

{
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
{
return true;
}
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this));
#$this->form->setTableWidth('100%');
// substitution
foreach($visible_records as $obj_type => $records)
{
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
// Show section
$section = new ilFormSectionHeaderGUI();
$section->setSectionIcon(ilUtil::getImagePath('icon_'.$obj_type.'_s.gif'),$this->lng->txt('objs_'.$obj_type));
$section->setTitle($this->lng->txt('objs_'.$obj_type));
$this->form->addItem($section);
$check = new ilCheckboxInputGUI($this->lng->txt('description'),'enabled_desc_'.$obj_type);
$check->setValue(1);
$check->setOptionTitle($this->lng->txt('md_adv_desc_show'));
$check->setChecked($sub->isDescriptionEnabled() ? true : false);
$this->form->addItem($check);
$check = new ilCheckboxInputGUI($this->lng->txt('md_adv_field_names'),'enabled_field_names_'.$obj_type);
$check->setValue(1);
$check->setOptionTitle($this->lng->txt('md_adv_fields_show'));
$check->setChecked($sub->enabledFieldNames() ? true : false);
$this->form->addItem($check);
#$area = new ilTextAreaInputGUI($this->lng->txt('md_adv_substitution'),'substitution_'.$obj_type);
#$area->setUseRte(true);
#$area->setRteTagSet('standard');
#$area->setValue(ilUtil::prepareFormOutput($sub->getSubstitutionString()));
#$area->setRows(5);
#$area->setCols(80);
#$this->form->addItem($area);
$definitions = $sub->sortDefinitions($definitions);
$counter = 1;
foreach($definitions as $definition_id)
{
if($def->isDeleted())
{
continue;
}
$title = ilAdvancedMDRecord::_lookupTitle($def->getRecordId());
$title = $def->getTitle().' ('.$title.')';
$check = new ilCheckboxInputGUI($title,'show['.$obj_type.']['.$definition_id.']');
$check->setValue(1);
$check->setOptionTitle($this->lng->txt('md_adv_show'));
$check->setChecked($sub->isSubstituted($definition_id));
$pos = new ilTextInputGUI($this->lng->txt('position'),'position['.$obj_type.']['.$definition_id.']');
$pos->setSize(3);
$pos->setMaxLength(4);
$pos->setValue(sprintf('%.1f',$counter++));
$check->addSubItem($pos);
$bold = new ilCheckboxInputGUI($this->lng->txt('bold'),'bold['.$obj_type.']['.$definition_id.']');
$bold->setValue(1);
$bold->setChecked($sub->isBold($definition_id));
$check->addSubItem($bold);
$bold = new ilCheckboxInputGUI($this->lng->txt('newline'),'newline['.$obj_type.']['.$definition_id.']');
$bold->setValue(1);
$bold->setChecked($sub->hasNewline($definition_id));
$check->addSubItem($bold);
$this->form->addItem($check);
}
// placeholder
/*
$custom = new ilCustomInputGUI($this->lng->txt('md_adv_placeholders'));
$tpl = new ilTemplate('tpl.placeholder_info.html',true,true,'Services/AdvancedMetaData');
foreach($records as $record)
{
foreach(ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($record->getRecordId()) as $definition)
{
$tpl->setCurrentBlock('field');
$tpl->setVariable('FIELD_NAME',$definition->getTitle());
$tpl->setVariable('MODULE_VARS','[IF_F_'.$definition->getFieldId().']...[F_'.$definition->getFieldId().']'.
'[/IF_F_'.$definition->getFieldId().']');
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('record');
$tpl->setVariable('PLACEHOLDER_FOR',$this->lng->txt('md_adv_placeholder_for'));
$tpl->setVariable('TITLE',$record->getTitle());
$tpl->parseCurrentBlock();
}
$custom->setHTML($tpl->get());
$this->form->addItem($custom);
*/
}
$this->form->setTitle($this->lng->txt('md_adv_substitution_table'));
$this->form->addCommandButton('updateSubstitutions',$this->lng->txt('save'));
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::initImportForm ( )
protected

show import form

protected

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

References $file.

Referenced by createRecord(), and importRecord().

{
if(is_object($this->import_form))
{
return true;
}
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$this->import_form = new ilPropertyFormGUI();
$this->import_form->setMultipart(true);
$this->import_form->setFormAction($this->ctrl->getFormAction($this));
// add file property
$file = new ilFileInputGUI($this->lng->txt('file'),'file');
$file->setSuffixes(array('xml'));
$file->setRequired(true);
$this->import_form->addItem($file);
$this->import_form->setTitle($this->lng->txt('md_adv_import_record'));
$this->import_form->addCommandButton('importRecord',$this->lng->txt('import'));
$this->import_form->addCommandButton('editRecord',$this->lng->txt('cancel'));
}

+ Here is the caller graph for this function:

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().

{
if(is_object($this->record))
{
return $this->record;
}
$record_id = isset($_GET['record_id']) ?
$_GET['record_id'] :
0;
return $this->record = ilAdvancedMDRecord::_getInstanceByRecordId($_GET['record_id']);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
$this->field_definition->setRecordId((int) $_GET['record_id']);
$this->field_definition->setTitle(ilUtil::stripSlashes($_POST['title']));
$this->field_definition->setDescription(ilUtil::stripSlashes($_POST['description']));
$this->field_definition->enableSearchable(isset($_POST['searchable']) ? true : false);
$this->field_definition->setFieldType(ilUtil::stripSlashes($_POST['field_type']));
$this->field_definition->setFieldValues(array());
for($i = 1; $i <= $_SESSION['num_values'];$i++)
{
if(isset($_POST['value_'.$i]))
{
$this->field_definition->appendFieldValue($_POST['value_'.$i]);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::loadRecordFormData ( )
protected

load record form data

protected

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

References $_POST, and ilUtil\stripSlashes().

Referenced by saveRecord(), and updateRecord().

{
$this->record->setActive(ilUtil::stripSlashes($_POST['active']));
$this->record->setTitle(ilUtil::stripSlashes($_POST['title']));
$this->record->setDescription(ilUtil::stripSlashes($_POST['desc']));
$this->record->setAssignedObjectTypes(isset($_POST['obj_types']) ? $_POST['obj_types'] : array());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::saveField ( )

create field

public

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

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

{
global $ilErr;
$this->ctrl->saveParameter($this,'record_id');
if(!$this->field_definition->validate())
{
ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
$this->createField();
return false;
}
$this->field_definition->add();
ilUtil::sendSuccess($this->lng->txt('save_settings'));
$this->editRecord();
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::saveRecord ( )

Save record.

public

Parameters

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

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

{
global $ilErr;
$this->initRecordObject();
if(!$this->record->validate())
{
ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
$this->createRecord();
return false;
}
$this->record->save();
ilUtil::sendSuccess($this->lng->txt('md_adv_added_new_record'));
$this->showRecords();
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::setSubTabs ( )
protected

Set sub tabs.

protected

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

Referenced by executeCommand().

{
$this->tabs_gui->clearSubTabs();
$this->tabs_gui->addSubTabTarget("md_adv_record_list",
$this->ctrl->getLinkTarget($this, "showRecords"),
'',
'',
'',
true);
$this->tabs_gui->addSubTabTarget("md_adv_file_list",
$this->ctrl->getLinkTarget($this, "showFiles"),
"showFiles",
array(),
'',
false);
}

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::showFiles ( )

show export files

public

Parameters

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

References $files.

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

{
$this->tabs_gui->setSubTabActive('md_adv_file_list');
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFiles.php');
$file_data = $files->readFilesInfo();
include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordExportFilesTableGUI.php");
$table_gui = new ilAdvancedMDRecordExportFilesTableGUI($this, "showFiles");
$table_gui->setTitle($this->lng->txt("md_record_export_table"));
$table_gui->parseFiles($file_data);
$table_gui->addMultiCommand("downloadFile",$this->lng->txt('download'));
$table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
$table_gui->addCommandButton('showFiles',$this->lng->txt('cancel'));
$table_gui->setSelectAllCheckbox("file_id");
$this->tpl->setContent($table_gui->getHTML());
}

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::showRecords ( )

show record list

public

Parameters

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

References getRecordObjects(), and initFormSubstitutions().

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

{
$this->record_objs = $this->getRecordObjects();
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.show_records.html','Services/AdvancedMetaData');
include_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordTableGUI.php");
$table_gui = new ilAdvancedMDRecordTableGUI($this, "showRecords");
$table_gui->setTitle($this->lng->txt("md_record_list_table"));
$table_gui->parseRecords($this->record_objs);
$table_gui->addCommandButton("updateRecords", $this->lng->txt("save"));
$table_gui->addCommandButton('createRecord',$this->lng->txt('add'));
$table_gui->addMultiCommand("exportRecords",$this->lng->txt('export'));
$table_gui->addMultiCommand("confirmDeleteRecords", $this->lng->txt("delete"));
$table_gui->setSelectAllCheckbox("record_id");
$this->tpl->setVariable('RECORD_TABLE',$table_gui->getHTML());
if(!$this->initFormSubstitutions())
{
return true;
}
if (is_object($this->form))
{
$this->tpl->setVariable('SUBSTITUTION_TABLE',$this->form->getHTML());
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDSettingsGUI::updateField ( )

Update field.

public

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

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

{
global $ilErr;
$this->ctrl->saveParameter($this,'record_id');
$this->field_definition = ilAdvancedMDFieldDefinition::_getInstanceByFieldId((int) $_GET['field_id']);
if(!$this->field_definition->validate())
{
ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
$this->editField();
return false;
}
$this->field_definition->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->editRecord();
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::updateFields ( )

Update fields.

public

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

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

{
if(!isset($_GET['record_id']) or !$_GET['record_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->showRecords();
return false;
}
if(!isset($_POST['position']) or !is_array($_POST['position']))
{
$this->showRecords();
return false;
}
// sort by position
asort($_POST['position'],SORT_NUMERIC);
$counter = 1;
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
foreach($_POST['position'] as $field_id => $pos)
{
$definition->setPosition($counter++);
$definition->enableSearchable(isset($_POST['searchable'][$field_id]) ? true : false);
$definition->update();
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->editRecord();
return true;
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::updateRecord ( )

Update record.

public

Parameters

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

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

{
global $ilErr;
if(!isset($_GET['record_id']) or !$_GET['record_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->showRecords();
return false;
}
$this->initRecordObject();
if(!$this->record->validate())
{
ilUtil::sendFailure($this->lng->txt($ilErr->getMessage()));
$this->editRecord();
return false;
}
$this->record->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->showRecords();
return true;
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::updateRecords ( )

Save records (assigned object typed)

public

Parameters

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

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

{
foreach($this->getRecordObjects() as $record_obj)
{
$new_types = isset($_POST['obj_types'][$record_obj->getRecordId()]) ?
$_POST['obj_types'][$record_obj->getRecordId()] :
array();
$record_obj->setAssignedObjectTypes($new_types);
$record_obj->setActive(isset($_POST['active'][$record_obj->getRecordId()]));
$record_obj->update();
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->showRecords();
}

+ Here is the call graph for this function:

ilAdvancedMDSettingsGUI::updateSubstitutions ( )

Update substitution.

public

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

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

{
{
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
$sub->resetSubstitutions(array());
$sub->enableDescription($_POST['enabled_desc_'.$obj_type]);
$sub->enableFieldNames((int) $_POST['enabled_field_names_'.$obj_type]);
if(isset($_POST['position'][$obj_type]))
{
asort($_POST['position'][$obj_type],SORT_NUMERIC);
foreach($_POST['position'][$obj_type] as $field_id => $pos)
{
if(isset($_POST['show'][$obj_type][$field_id]) and $_POST['show'][$obj_type][$field_id])
{
$newline = $bold = false;
if(isset($_POST['bold'][$obj_type][$field_id]) and $_POST['bold'][$obj_type][$field_id])
{
$bold = true;
}
if(isset($_POST['newline'][$obj_type][$field_id]) and $_POST['newline'][$obj_type][$field_id])
{
$newline = true;
}
$sub->appendSubstitution($field_id,$bold,$newline);
}
}
}
$sub->update();
}
/*
foreach(ilAdvancedMDRecord::_getAllRecordsByObjectType() as $obj_type => $visible_record)
{
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDSubstitution.php');
$sub = ilAdvancedMDSubstitution::_getInstanceByObjectType($obj_type);
$sub->setSubstitutionString(($_POST['substitution_'.$obj_type]));
$sub->enableDescription($_POST['enabled_desc_'.$obj_type]);
$sub->update();
}
*/
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->showRecords();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilAdvancedMDSettingsGUI::$ctrl
protected

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

ilAdvancedMDSettingsGUI::$lng
protected

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

Referenced by __construct().

ilAdvancedMDSettingsGUI::$tabs
protected

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

ilAdvancedMDSettingsGUI::$tpl
protected

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

Referenced by __construct().


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