ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAdvancedMDFieldDefinitionSelectMulti Class Reference

AMD field type select. More...

+ Inheritance diagram for ilAdvancedMDFieldDefinitionSelectMulti:
+ Collaboration diagram for ilAdvancedMDFieldDefinitionSelectMulti:

Public Member Functions

 getType ()
 Get type.
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form.
 update ()
 Update field entry.
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export)
 importValueFromXML ($a_cdata)
 Import value from xml.
- Public Member Functions inherited from ilAdvancedMDFieldDefinitionSelect
 setOptions (array $a_values=null)
 Set options.
 getOptions ()
 Get options.
 getFieldDefinitionForTableGUI ()
 Parse properties for table gui.
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false)
 Add input elements to definition form.
 importDefinitionFormPostValuesNeedsConfirmation ()
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 importXMLProperty ($a_key, $a_value)
 Import property from XML.
- Public Member Functions inherited from ilAdvancedMDFieldDefinition
 __construct ($a_field_id=null)
 Constructor.
 getTypeTitle ()
 Get type title (lang id)
 getADTDefinition ()
 Get ADT definition instance.
 getADT ()
 Get ADT instance.
 getFieldId ()
 Get field_id.
 setRecordId ($a_id)
 Set record id.
 getRecordId ()
 Get record id.
 setImportId ($a_id_string)
 Set import id.
 getImportId ()
 Get import id.
 setPosition ($a_pos)
 Set position.
 getPosition ()
 Get position.
 setTitle ($a_title)
 Get title.
 getTitle ()
 Get title.
 setDescription ($a_desc)
 Set description.
 getDescription ()
 Get description.
 setSearchable ($a_status)
 Toggle searchable.
 isSearchable ()
 Is searchable.
 setRequired ($a_status)
 Toggle required.
 isRequired ()
 Is required field.
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Add input elements to definition form.
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Import post values from definition form.
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 save ()
 Create new field entry.
 delete ()
 Delete field entry.
 toXML (ilXmlWriter $a_writer)
 To Xml.
 importFromECS ($a_ecs_type, $a_value, $a_sub_id)
 Import meta data from ECS.
 prepareElementForEditor (ilADTFormBridge $a_bridge)
 Prepare editor form elements.
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser.
 getSearchValueSerialized (ilADTSearchBridge $a_adt_search)
 Get value for search persistence.
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence.
 searchSubObjects (ilADTSearchBridge $a_adt_search, $a_obj_id, $sub_obj_type)
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
 Search objects.
 getLuceneSearchString ($a_value)
 Get search string in lucene syntax.
 prepareElementForSearch (ilADTSearchBridge $a_bridge)
 Prepare search form elements.

Data Fields

const XML_SEPARATOR = "~|~"

Protected Member Functions

 initADTDefinition ()
 Init adt instance.
 findBySingleValue (ilADTEnumSearchBridgeMulti $a_search, $a_value)
- Protected Member Functions inherited from ilAdvancedMDFieldDefinitionSelect
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB.
 getFieldDefinition ()
 Get (type-specific) field definition.
 buildConfirmedObjects (ilPropertyFormGUI $a_form)
 Process custom post values from definition form.
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export.
- Protected Member Functions inherited from ilAdvancedMDFieldDefinition
 init ()
 Init properties.
 setADT (ilADT $a_adt)
 Set ADT instance.
 setFieldId ($a_id)
 Set field_id.
 getLastPosition ()
 Get last position of record.
 generateImportId ($a_field_id)
 Generate unique record id.
 getDBProperties ()
 Get all definition properties for DB.
 import (array $a_data)
 Import from DB.
 read ($a_field_id)
 Read field definition.
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results.

Additional Inherited Members

- Static Public Member Functions inherited from ilAdvancedMDFieldDefinition
static getInstance ($a_field_id, $a_type=null)
 Get definition instance by type.
static getInstanceByTypeString ($a_type)
 Get instance by type string (used by import)
static getInstancesByRecordId ($a_record_id, $a_only_searchable=false)
 Get definitions by record id.
static getInstancesByObjType ($a_obj_type, $a_active_only=true)
static getInstanceByImportId ($a_import_id)
 Get definition instance by import id.
static getSearchableDefinitionIds ()
 Get searchable definition ids (performance is key)
static getADTGroupForDefinitions (array $a_defs)
 Init ADTGroup for definitions.
static getValidTypes ()
 Get all valid types.
static isValidType ($a_type)
 Is given type valid.
- Static Protected Member Functions inherited from ilAdvancedMDFieldDefinition
static getTypeString ($a_type)
 Get type string.
- Protected Attributes inherited from ilAdvancedMDFieldDefinitionSelect
 $options = array()
 $confirm_objects
 $confirmed_objects

Detailed Description

AMD field type select.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 14 of file class.ilAdvancedMDFieldDefinitionSelectMulti.php.

Member Function Documentation

ilAdvancedMDFieldDefinitionSelectMulti::findBySingleValue ( ilADTEnumSearchBridgeMulti  $a_search,
  $a_value 
)
protected

Definition at line 83 of file class.ilAdvancedMDFieldDefinitionSelectMulti.php.

References $res, ilADTActiveRecordByType\find(), ilADTSearchBridgeSingle\getADT(), ilAdvancedMDFieldDefinition\getFieldId(), ilADTEnumSearchBridgeMulti\getSQLCondition(), and ilADTActiveRecordByType\SINGLE_COLUMN_NAME.

Referenced by importCustomDefinitionFormPostValues(), and update().

{
$res = array();
$a_search->getADT()->setSelections(array($a_value));
"adv_md_values",
"Enum",
$this->getFieldId(),
$condition
);
if($in_use)
{
foreach($in_use as $item)
{
$res[] = array($item["obj_id"], $item["sub_type"], $item["sub_id"], $item["value"]);
}
}
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinitionSelectMulti::getType ( )
ilAdvancedMDFieldDefinitionSelectMulti::getValueForXML ( ilADT  $element)

Parse ADT value for xml (export)

Parameters
ilADT$element
Returns
string

Reimplemented from ilAdvancedMDFieldDefinitionSelect.

Definition at line 203 of file class.ilAdvancedMDFieldDefinitionSelectMulti.php.

{
return self::XML_SEPARATOR.
implode(self::XML_SEPARATOR, $element->getSelections()).
self::XML_SEPARATOR;
}
ilAdvancedMDFieldDefinitionSelectMulti::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilAdvancedMDFieldDefinitionSelect.

Definition at line 51 of file class.ilAdvancedMDFieldDefinitionSelectMulti.php.

References ilAdvancedMDFieldDefinitionSelect\buildConfirmedObjects(), findBySingleValue(), ilAdvancedMDFieldDefinition\getADTDefinition(), ilPropertyFormGUI\getInput(), ilAdvancedMDFieldDefinition\getInstance(), ilAdvancedMDFieldDefinitionSelect\getOptions(), ilADTFactory\initActiveRecordByType(), and ilAdvancedMDFieldDefinitionSelect\setOptions().

{
$old = $this->getOptions();
$new = $a_form->getInput("opts");
$missing = array_diff($old, $new);
if(sizeof($missing))
{
$this->confirmed_objects = $this->buildConfirmedObjects($a_form);
if(!is_array($this->confirmed_objects))
{
$search = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($this->getADTDefinition(), false, false);
foreach($missing as $missing_value)
{
$in_use = $this->findBySingleValue($search, $missing_value);
if(sizeof($in_use))
{
foreach($in_use as $item)
{
$this->confirm_objects[$missing_value][] = $item;
}
}
}
}
}
$this->old_options = $old;
$this->setOptions($new);
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionSelectMulti::importValueFromXML (   $a_cdata)

Import value from xml.

Parameters
string$a_cdata

Reimplemented from ilAdvancedMDFieldDefinitionSelect.

Definition at line 210 of file class.ilAdvancedMDFieldDefinitionSelectMulti.php.

References ilAdvancedMDFieldDefinition\getADT().

{
$this->getADT()->setSelections(explode(self::XML_SEPARATOR, $a_cdata));
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionSelectMulti::initADTDefinition ( )
protected

Init adt instance.

Returns
ilADTDefinition

Reimplemented from ilAdvancedMDFieldDefinitionSelect.

Definition at line 32 of file class.ilAdvancedMDFieldDefinitionSelectMulti.php.

References ilAdvancedMDFieldDefinitionSelect\$options, ilAdvancedMDFieldDefinition\getInstance(), and ilAdvancedMDFieldDefinitionSelect\getOptions().

{
$def = ilADTFactory::getInstance()->getDefinitionInstanceByType("MultiEnum");
$def->setNumeric(false);
$options = $this->getOptions();
$def->setOptions(array_combine($options, $options));
// see ilAdvancedMDValues::getActiveRecord()
// using ilADTMultiEnumDBBridge::setFakeSingle()
return $def;
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionSelectMulti::update ( )

Update field entry.

Reimplemented from ilAdvancedMDFieldDefinitionSelect.

Definition at line 112 of file class.ilAdvancedMDFieldDefinitionSelectMulti.php.

References ilADTActiveRecordByType\deleteByPrimary(), findBySingleValue(), ilAdvancedMDFieldDefinition\getADTDefinition(), ilAdvancedMDFieldDefinition\getFieldId(), ilAdvancedMDFieldDefinition\getInstance(), ilADTFactory\initActiveRecordByType(), ilPCAMDPageList\migrateField(), ilADTMultiEnumDBBridge\SEPARATOR, and ilADTActiveRecordByType\writeByPrimary().

{
if(sizeof($this->confirmed_objects))
{
// we need the "old" options for the search
$def = $this->getADTDefinition();
$def = clone($def);
$def->setOptions(array_combine($this->old_options, $this->old_options));
$search = ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($def, false, false);
foreach($this->confirmed_objects as $old_option => $item_ids)
{
// get complete old values
$old_values = array();
foreach($this->findBySingleValue($search, $old_option) as $item)
{
$old_values[$item[0]."_".$item[1]."_".$item[2]] = $item[3];
}
foreach($item_ids as $item => $new_option)
{
$parts = explode("_", $item);
$obj_id = $parts[0];
$sub_type = $parts[1];
$sub_id = $parts[2];
if(!$new_option)
{
// remove existing value
$primary = array(
"obj_id" => array("integer", $obj_id),
"sub_type" => array("text", $sub_type),
"sub_id" => array("integer", $sub_id),
"field_id" => array("integer", $this->getFieldId())
);
ilADTActiveRecordByType::deleteByPrimary("adv_md_values", $primary, "MultiEnum");
}
else
{
// update existing value (with changed option)
if(isset($old_values[$item]))
{
// find changed option in old value
$old_value = explode(ilADTMultiEnumDBBridge::SEPARATOR, $old_values[$item]);
// remove separators
array_shift($old_value);
array_pop($old_value);
$old_idx = array_keys($old_value, $old_option);
if(sizeof($old_idx))
{
// switch option
$old_idx = array_pop($old_idx);
$old_value[$old_idx] = $new_option;
$new_value = array_unique($old_value);
// add separators
implode(ilADTMultiEnumDBBridge::SEPARATOR, $new_value).
$primary = array(
"obj_id" => array("integer", $obj_id),
"sub_type" => array("text", $sub_type),
"sub_id" => array("integer", $sub_id),
"field_id" => array("integer", $this->getFieldId())
);
ilADTActiveRecordByType::writeByPrimary("adv_md_values", $primary, "MultiEnum", $new_value);
}
}
}
if($sub_type == "wpg")
{
// #15763 - adapt advmd page lists
include_once "Modules/Wiki/classes/class.ilPCAMDPageList.php";
ilPCAMDPageList::migrateField($obj_id, $this->getFieldId(), $old_option, $new_option, true);
}
}
}
$this->confirmed_objects = array();
}
}

+ Here is the call graph for this function:

Field Documentation

const ilAdvancedMDFieldDefinitionSelectMulti::XML_SEPARATOR = "~|~"

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