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

AMD field abstract base class. More...

+ Inheritance diagram for ilAdvancedMDFieldDefinition:
+ Collaboration diagram for ilAdvancedMDFieldDefinition:

Public Member Functions

 __construct ($a_field_id=null)
 Constructor.
 getType ()
 Get type.
 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.
 getFieldDefinitionForTableGUI ()
 Parse properties for table gui.
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Add input elements to definition form.
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form.
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Import post values from definition form.
 importDefinitionFormPostValuesNeedsConfirmation ()
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 save ()
 Create new field entry.
 update ()
 Update field entry.
 delete ()
 Delete field entry.
 toXML (ilXmlWriter $a_writer)
 To Xml.
 importXMLProperty ($a_key, $a_value)
 Import property from XML.
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export)
 importValueFromXML ($a_cdata)
 Import value from 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.

Static Public Member Functions

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.

Data Fields

const TYPE_SELECT = 1
const TYPE_TEXT = 2
const TYPE_DATE = 3
const TYPE_DATETIME = 4
const TYPE_INTEGER = 5
const TYPE_FLOAT = 6
const TYPE_LOCATION = 7
const TYPE_SELECT_MULTI = 8

Protected Member Functions

 init ()
 Init properties.
 initADTDefinition ()
 Init adt instance.
 setADT (ilADT $a_adt)
 Set ADT instance.
 setFieldId ($a_id)
 Set field_id.
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB.
 getFieldDefinition ()
 Get (type-specific) field definition.
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false)
 Add custom input elements to definition form.
 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.
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export.
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results.

Static Protected Member Functions

static getTypeString ($a_type)
 Get type string.

Protected Attributes

 $field_id
 $record_id
 $import_id
 $position
 $title
 $description
 $searchable
 $required
 $adt_def
 $adt

Detailed Description

AMD field abstract base class.

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.ilAdvancedMDFieldDefinition.php.

Constructor & Destructor Documentation

ilAdvancedMDFieldDefinition::__construct (   $a_field_id = null)

Constructor.

Parameters
init$a_field_id
Returns
self

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

References init(), and read().

{
$this->init();
$this->read($a_field_id);
}

+ Here is the call graph for this function:

Member Function Documentation

ilAdvancedMDFieldDefinition::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
  $a_disabled = false 
)
protected

Add custom input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
bool$a_disabled

Reimplemented in ilAdvancedMDFieldDefinitionInteger, ilAdvancedMDFieldDefinitionText, ilAdvancedMDFieldDefinitionSelect, and ilAdvancedMDFieldDefinitionFloat.

Definition at line 579 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by addToFieldDefinitionForm().

{
// type-specific
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Add (type-specific) properties to xml export.

Parameters
ilXmlWriter$a_writer

Reimplemented in ilAdvancedMDFieldDefinitionSelect, ilAdvancedMDFieldDefinitionInteger, ilAdvancedMDFieldDefinitionText, and ilAdvancedMDFieldDefinitionFloat.

Definition at line 933 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by toXML().

{
// type-specific properties
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::addToFieldDefinitionForm ( ilPropertyFormGUI  $a_form,
ilAdvancedMDPermissionHelper  $a_permissions 
)

Add input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
ilAdvancedMDPermissionHelper$a_form

Definition at line 590 of file class.ilAdvancedMDFieldDefinition.php.

References $lng, $title, ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, addCustomFieldToDefinitionForm(), ilPropertyFormGUI\addItem(), ilAdvancedMDPermissionHelper\CONTEXT_FIELD, getDescription(), getFieldId(), getTitle(), ilClaimingPermissionHelper\hasPermissions(), isSearchable(), ilCheckboxInputGUI\setChecked(), ilTextAreaInputGUI\setValue(), ilAdvancedMDPermissionHelper\SUBACTION_FIELD_DESCRIPTION, ilAdvancedMDPermissionHelper\SUBACTION_FIELD_PROPERTIES, ilAdvancedMDPermissionHelper\SUBACTION_FIELD_SEARCHABLE, and ilAdvancedMDPermissionHelper\SUBACTION_FIELD_TITLE.

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

{
global $lng;
$perm = $a_permissions->hasPermissions(
$this->getFieldId(),
array(
));
// title
$title = new ilTextInputGUI($lng->txt('title'), 'title');
$title->setValue($this->getTitle());
$title->setSize(20);
$title->setMaxLength(70);
$title->setRequired(true);
$a_form->addItem($title);
{
$title->setDisabled(true);
}
// desc
$desc = new ilTextAreaInputGUI($lng->txt('description'), 'description');
$desc->setValue($this->getDescription());
$desc->setRows(3);
$desc->setCols(50);
$a_form->addItem($desc);
{
$desc->setDisabled(true);
}
// searchable
$check = new ilCheckboxInputGUI($lng->txt('md_adv_searchable'), 'searchable');
$check->setChecked($this->isSearchable());
$check->setValue(1);
$a_form->addItem($check);
{
$check->setDisabled(true);
}
/* required
$check = new ilCheckboxInputGUI($lng->txt('md_adv_required'), 'required');
$check->setChecked($this->isRequired());
$check->setValue(1);
$a_form->addItem($check);
*/
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::delete ( )

Delete field entry.

Definition at line 882 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, ilAdvancedMDValues\_deleteByFieldId(), getADT(), and getFieldId().

{
global $ilDB;
if(!$this->getFieldId())
{
return;
}
// delete all values
include_once("Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
$query = "DELETE FROM adv_mdf_definition".
" WHERE field_id = ".$ilDB->quote($this->getFieldId(), "integer");
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::generateImportId (   $a_field_id)
protected

Generate unique record id.

Parameters
int$a_field_id
Returns
string

Definition at line 756 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by save(), and toXML().

{
return 'il_'.IL_INST_ID.'_adv_md_field_'.$a_field_id;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getADTDefinition ( )

Get ADT definition instance.

Returns
ilADTDefinition

Definition at line 325 of file class.ilAdvancedMDFieldDefinition.php.

References $adt_def, and initADTDefinition().

Referenced by getADT(), ilAdvancedMDFieldDefinitionSelectMulti\importCustomDefinitionFormPostValues(), and ilAdvancedMDFieldDefinitionSelectMulti\update().

{
if(!$this->adt_def instanceof ilADTDefinition)
{
$this->adt_def = $this->initADTDefinition();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getADTGroupForDefinitions ( array  $a_defs)
static

Init ADTGroup for definitions.

Parameters
array$a_defs
Returns
ilADTGroup

Definition at line 209 of file class.ilAdvancedMDFieldDefinition.php.

References getInstance().

Referenced by ilAdvancedMDValues\getADTGroup(), and ilAdvancedMDValues\queryForRecords().

{
$group_def = $factory->getDefinitionInstanceByType("Group");
foreach($a_defs as $def)
{
$group_def->addElement($def->getFieldId(), $def->getADTDefinition());
}
$group = $factory->getInstanceByDefinition($group_def);
// bind adt instances to definition
foreach($group->getElements() as $element_id => $element)
{
$a_defs[$element_id]->setADT($element);
}
return $group;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getDBProperties ( )
protected

Get all definition properties for DB.

Returns
array

Definition at line 766 of file class.ilAdvancedMDFieldDefinition.php.

References getDescription(), getFieldDefinition(), getImportId(), getPosition(), getRecordId(), getTitle(), getType(), isRequired(), and isSearchable().

Referenced by save(), and update().

{
$fields = array(
"field_type" => array("integer", $this->getType()),
"record_id" => array("integer", $this->getRecordId()),
"import_id" => array("text", $this->getImportId()),
"title" => array("text", $this->getTitle()),
"description" => array("text", $this->getDescription()),
"position" => array("integer", $this->getPosition()),
"searchable" => array("integer", $this->isSearchable()),
"required" => array("integer", $this->isRequired())
);
$def = $this->getFieldDefinition();
if(is_array($def))
{
$fields["field_values"] = array("text", serialize($def));
}
return $fields;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getDescription ( )

Get description.

Returns
string

Definition at line 493 of file class.ilAdvancedMDFieldDefinition.php.

References $description.

Referenced by addToFieldDefinitionForm(), getDBProperties(), and toXML().

{
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getFieldDefinition ( )
protected

Get (type-specific) field definition.

Returns
array

Reimplemented in ilAdvancedMDFieldDefinitionInteger, ilAdvancedMDFieldDefinitionText, ilAdvancedMDFieldDefinitionSelect, and ilAdvancedMDFieldDefinitionFloat.

Definition at line 558 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getDBProperties().

{
// type-specific properties
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getFieldDefinitionForTableGUI ( )

Parse properties for table gui.

Returns
array

Reimplemented in ilAdvancedMDFieldDefinitionInteger, ilAdvancedMDFieldDefinitionText, ilAdvancedMDFieldDefinitionSelect, and ilAdvancedMDFieldDefinitionFloat.

Definition at line 568 of file class.ilAdvancedMDFieldDefinition.php.

{
// type-specific properties
}
ilAdvancedMDFieldDefinition::getImportId ( )

Get import id.

Returns
string

Definition at line 425 of file class.ilAdvancedMDFieldDefinition.php.

References $import_id.

Referenced by getDBProperties(), and save().

{
}

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getInstance (   $a_field_id,
  $a_type = null 
)
static

Get definition instance by type.

Parameters
int$a_field_id
int$a_type
Returns
self

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

References $ilDB.

Referenced by ilAdvancedMDSettingsGUI\confirmDeleteFields(), ilAdvancedMDSettingsGUI\createField(), ilAdvancedMDSettingsGUI\deleteFields(), ilAdvancedMDSettingsGUI\editField(), ilAdvancedMDSettingsGUI\editFields(), getADT(), getADTGroupForDefinitions(), getInstanceByImportId(), getInstanceByTypeString(), getInstancesByObjType(), getInstancesByRecordId(), ilAdvancedMDFieldDefinitionSelectMulti\importCustomDefinitionFormPostValues(), ilAdvancedMDFieldDefinitionDateTime\initADTDefinition(), ilAdvancedMDFieldDefinitionLocation\initADTDefinition(), ilAdvancedMDFieldDefinitionDate\initADTDefinition(), ilAdvancedMDFieldDefinitionSelectMulti\initADTDefinition(), ilAdvancedMDFieldDefinitionInteger\initADTDefinition(), ilAdvancedMDFieldDefinitionText\initADTDefinition(), ilAdvancedMDFieldDefinitionSelect\initADTDefinition(), ilAdvancedMDFieldDefinitionFloat\initADTDefinition(), ilAdvancedMDSettingsGUI\saveField(), ilAdvancedSearchGUI\searchAdvancedMD(), ilAdvancedMDRecordGUI\showECSStart(), ilAdvancedMDFieldDefinitionSelectMulti\update(), and ilAdvancedMDSettingsGUI\updateField().

{
global $ilDB;
if(!$a_type)
{
$set = $ilDB->query("SELECT field_type".
" FROM adv_mdf_definition".
" WHERE field_id = ".$ilDB->quote($a_field_id, "integer"));
$a_type = $ilDB->fetchAssoc($set);
$a_type = $a_type["field_type"];
}
if(self::isValidType($a_type))
{
$class = "ilAdvancedMDFieldDefinition".self::getTypeString($a_type);
require_once "Services/AdvancedMetaData/classes/Types/class.".$class.".php";
return new $class($a_field_id);
}
throw new ilException("unknown type ".$a_type);
}

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getInstanceByImportId (   $a_import_id)
static

Get definition instance by import id.

Parameters
string$a_import_id
Returns
self

Definition at line 166 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, $row, and getInstance().

Referenced by ilAdvancedMDParser\initValue().

{
global $ilDB;
$query = "SELECT field_id, field_type FROM adv_mdf_definition".
" WHERE import_id = ".$ilDB->quote($a_import_id,'text');
$set = $ilDB->query($query);
if($ilDB->numRows($set))
{
$row = $ilDB->fetchAssoc($set);
return self::getInstance($row["field_id"], $row["field_type"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getInstanceByTypeString (   $a_type)
static

Get instance by type string (used by import)

Parameters
string$a_type
Returns
self

Definition at line 84 of file class.ilAdvancedMDFieldDefinition.php.

References getInstance().

Referenced by ilAdvancedMDRecordParser\initFieldObject().

{
// see self::getTypeString()
$map = array(
self::TYPE_TEXT => "Text",
self::TYPE_SELECT => "Select",
self::TYPE_DATE => "Date",
self::TYPE_DATETIME => "DateTime",
self::TYPE_FLOAT => "Float",
self::TYPE_LOCATION => "Location",
self::TYPE_INTEGER => "Integer",
self::TYPE_SELECT_MULTI => "SelectMulti"
);
$map = array_flip($map);
if(array_key_exists($a_type, $map))
{
return self::getInstance(null, $map[$a_type]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getInstancesByObjType (   $a_obj_type,
  $a_active_only = true 
)
static

Definition at line 135 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $query, $res, $row, and getInstance().

Referenced by ilECSSettingsGUI\exportMappings(), ilECSSettingsGUI\importMappings(), ilAdvancedMDSettingsGUI\initFormSubstitutions(), ilECSSettingsGUI\initMappingsForm(), and ilAdvancedMDSettingsGUI\updateSubstitutions().

{
global $ilDB;
$defs = array();
$query = "SELECT amf.* FROM adv_md_record_objs aro".
" JOIN adv_md_record amr ON aro.record_id = amr.record_id".
" JOIN adv_mdf_definition amf ON aro.record_id = amf.record_id".
" WHERE obj_type = ".$ilDB->quote($a_obj_type,'text');
if((bool)$a_active_only)
{
$query .= " AND active = ".$ilDB->quote(1, "integer");
}
$query .= " ORDER BY aro.record_id,position";
$res = $ilDB->query($query);
while($row = $ilDB->fetchAssoc($res))
{
$field = self::getInstance(null, $row["field_type"]);
$field->import($row);
$defs[$row["field_id"]] = $field;
}
return $defs;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getInstancesByRecordId (   $a_record_id,
  $a_only_searchable = false 
)
static

Get definitions by record id.

Parameters
int$a_record_id
bool$a_only_searchable
Returns
array self

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

References $ilDB, $query, $row, and getInstance().

Referenced by ilAdvancedMDRecord\_delete(), ilAdvancedMDSettingsGUI\editFields(), ilAdvancedMDRecordTableGUI\fillRow(), ilPCAMDPageList\findPages(), ilGlossaryAdvMetaDataAdapter\getAllFields(), ilAdvancedMDValues\getDefinitions(), ilLuceneAdvancedSearchFields\getFields(), ilAdvancedMDRecordGUI\parseFilter(), ilAdvancedMDRecordGUI\parseSearch(), ilAdvancedMDValues\queryForRecords(), ilAdvancedMDRecord\toXML(), and ilAdvancedMDSettingsGUI\updateFields().

{
global $ilDB;
$defs = array();
$query = "SELECT * FROM adv_mdf_definition".
" WHERE record_id = ".$ilDB->quote($a_record_id, "integer");
if($a_only_searchable)
{
$query .= " AND searchable = ".$ilDB->quote(1, "integer");
}
$query .= " ORDER BY position";
$set = $ilDB->query($query);
while($row = $ilDB->fetchAssoc($set))
{
$field = self::getInstance(null, $row["field_type"]);
$field->import($row);
$defs[$row["field_id"]] = $field;
}
return $defs;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getLastPosition ( )
protected

Get last position of record.

Returns
int

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

References $ilDB, and getRecordId().

Referenced by save().

{
global $ilDB;
$sql = "SELECT max(position) pos".
" FROM adv_mdf_definition".
" WHERE record_id = ".$ilDB->quote($this->getRecordId(), "integer");
$set = $ilDB->query($sql);
if($ilDB->numRows($set))
{
$pos = $ilDB->fetchAssoc($set);
return (int)$pos["pos"];
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getLuceneSearchString (   $a_value)

Get search string in lucene syntax.

Parameters
mixed$a_value
Returns
string

Reimplemented in ilAdvancedMDFieldDefinitionDate, ilAdvancedMDFieldDefinitionDateTime, and ilAdvancedMDFieldDefinitionLocation.

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

{
return $a_value;
}
ilAdvancedMDFieldDefinition::getPosition ( )

Get position.

Returns
int

Definition at line 445 of file class.ilAdvancedMDFieldDefinition.php.

References $position.

Referenced by getDBProperties(), and toXML().

{
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getRecordId ( )

Get record id.

Returns
int

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

References $record_id.

Referenced by getDBProperties(), and getLastPosition().

{
}

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getSearchableDefinitionIds ( )
static

Get searchable definition ids (performance is key)

Returns
array

Definition at line 185 of file class.ilAdvancedMDFieldDefinition.php.

References $field_id, $ilDB, $query, and $row.

Referenced by ilAdvancedSearchGUI\setSubTabs().

{
global $ilDB;
$field_ids = array();
$query = "SELECT field_id FROM adv_md_record amr".
" JOIN adv_mdf_definition amfd ON (amr.record_id = amfd.record_id)".
" WHERE active = ".$ilDB->quote(1, "integer").
" AND searchable = ".$ilDB->quote(1, "integer");
$set = $ilDB->query($query);
while($row = $ilDB->fetchAssoc($set))
{
$field_ids[] = $row["field_id"];
}
return $field_id;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getSearchQueryParserValue ( ilADTSearchBridge  $a_adt_search)

Get value for search query parser.

Parameters
ilADTSearchBridge$a_adt_search
Returns
mixed

Reimplemented in ilAdvancedMDFieldDefinitionText.

Definition at line 1003 of file class.ilAdvancedMDFieldDefinition.php.

{
return '';
}
ilAdvancedMDFieldDefinition::getSearchValueSerialized ( ilADTSearchBridge  $a_adt_search)

Get value for search persistence.

Parameters
ilADTSearchBridge$a_adt_search
Returns
string

Definition at line 1014 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTSearchBridge\getSerializedValue().

{
return $a_adt_search->getSerializedValue();
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::getTitle ( )

Get title.

Returns
string

Definition at line 469 of file class.ilAdvancedMDFieldDefinition.php.

References $title.

Referenced by addToFieldDefinitionForm(), getDBProperties(), and toXML().

{
return $this->title;
}

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getTypeString (   $a_type)
staticprotected

Get type string.

Parameters
string$a_type
Returns
string

Definition at line 278 of file class.ilAdvancedMDFieldDefinition.php.

{
if(self::isValidType($a_type))
{
$map = array(
self::TYPE_TEXT => "Text",
self::TYPE_SELECT => "Select",
self::TYPE_DATE => "Date",
self::TYPE_DATETIME => "DateTime",
self::TYPE_FLOAT => "Float",
self::TYPE_LOCATION => "Location",
self::TYPE_INTEGER => "Integer",
self::TYPE_SELECT_MULTI => "SelectMulti"
);
return $map[$a_type];
}
}
ilAdvancedMDFieldDefinition::getTypeTitle ( )

Get type title (lang id)

Returns
string

Definition at line 301 of file class.ilAdvancedMDFieldDefinition.php.

References getType().

Referenced by ilAdvancedMDSettingsGUI\initFieldForm().

{
// :TODO: reuse udf stuff here ?!
return "udf_type_".strtolower(self::getTypeString($this->getType()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::getValidTypes ( )
static

Get all valid types.

Returns
array

Definition at line 247 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by ilAdvancedMDSettingsGUI\editFields().

{
return array(self::TYPE_TEXT, self::TYPE_DATE, self::TYPE_DATETIME,
self::TYPE_SELECT, self::TYPE_INTEGER, self::TYPE_FLOAT,
self::TYPE_LOCATION, self::TYPE_SELECT_MULTI);
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::getValueForXML ( ilADT  $element)
abstract
ilAdvancedMDFieldDefinition::import ( array  $a_data)
protected

Import from DB.

Parameters
array$a_data

Definition at line 793 of file class.ilAdvancedMDFieldDefinition.php.

References importFieldDefinition(), setDescription(), setFieldId(), setImportId(), setPosition(), setRecordId(), setRequired(), setSearchable(), and setTitle().

{
$this->setFieldId($a_data["field_id"]);
$this->setRecordId($a_data["record_id"]);
$this->setImportId($a_data["import_id"]);
$this->setTitle($a_data["title"]);
$this->setDescription($a_data["description"]);
$this->setPosition($a_data["position"]);
$this->setSearchable($a_data["searchable"]);
$this->setRequired($a_data["required"]);
if($a_data["field_values"])
{
$this->importFieldDefinition(unserialize($a_data["field_values"]));
}
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented in ilAdvancedMDFieldDefinitionInteger, ilAdvancedMDFieldDefinitionSelect, ilAdvancedMDFieldDefinitionText, ilAdvancedMDFieldDefinitionFloat, and ilAdvancedMDFieldDefinitionSelectMulti.

Definition at line 660 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by importDefinitionFormPostValues().

{
// type-specific
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::importDefinitionFormPostValues ( ilPropertyFormGUI  $a_form,
ilAdvancedMDPermissionHelper  $a_permissions 
)

Import post values from definition form.

Parameters
ilPropertyFormGUI$a_form
ilAdvancedMDPermissionHelper$a_permissions

Definition at line 671 of file class.ilAdvancedMDFieldDefinition.php.

References ilAdvancedMDPermissionHelper\ACTION_FIELD_EDIT_PROPERTY, ilAdvancedMDPermissionHelper\CONTEXT_FIELD, ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilClaimingPermissionHelper\hasPermission(), importCustomDefinitionFormPostValues(), setDescription(), setSearchable(), setTitle(), and ilAdvancedMDPermissionHelper\SUBACTION_FIELD_PROPERTIES.

{
if(!$a_form->getItemByPostVar("title")->getDisabled())
{
$this->setTitle($a_form->getInput("title"));
}
if(!$a_form->getItemByPostVar("description")->getDisabled())
{
$this->setDescription($a_form->getInput("description"));
}
if(!$a_form->getItemByPostVar("searchable")->getDisabled())
{
$this->setSearchable($a_form->getInput("searchable"));
}
if($a_permissions->hasPermission(
$this->getFieldId(),
{
}
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::importDefinitionFormPostValuesNeedsConfirmation ( )

Reimplemented in ilAdvancedMDFieldDefinitionSelect.

Definition at line 696 of file class.ilAdvancedMDFieldDefinition.php.

{
return false;
}
ilAdvancedMDFieldDefinition::importFieldDefinition ( array  $a_def)
protected

Import (type-specific) field definition from DB.

Parameters
array$a_def

Reimplemented in ilAdvancedMDFieldDefinitionInteger, ilAdvancedMDFieldDefinitionText, ilAdvancedMDFieldDefinitionSelect, and ilAdvancedMDFieldDefinitionFloat.

Definition at line 548 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import().

{
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::importFromECS (   $a_ecs_type,
  $a_value,
  $a_sub_id 
)

Import meta data from ECS.

Parameters
int$a_ecs_type
mixed$a_value
string$a_sub_id
Returns
bool

Reimplemented in ilAdvancedMDFieldDefinitionText, ilAdvancedMDFieldDefinitionDate, and ilAdvancedMDFieldDefinitionDateTime.

Definition at line 972 of file class.ilAdvancedMDFieldDefinition.php.

{
return false;
}
ilAdvancedMDFieldDefinition::importXMLProperty (   $a_key,
  $a_value 
)

Import property from XML.

Parameters
string$a_key
string$a_value

Reimplemented in ilAdvancedMDFieldDefinitionSelect, ilAdvancedMDFieldDefinitionInteger, ilAdvancedMDFieldDefinitionText, and ilAdvancedMDFieldDefinitionFloat.

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

{
}
ilAdvancedMDFieldDefinition::init ( )
protected

Init properties.

Reimplemented in ilAdvancedMDFieldDefinitionFloat.

Definition at line 231 of file class.ilAdvancedMDFieldDefinition.php.

References setRequired(), and setSearchable().

Referenced by __construct().

{
$this->setRequired(false);
$this->setSearchable(false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::isRequired ( )

Is required field.

Returns
bool

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

References $required.

Referenced by getDBProperties().

{
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::isSearchable ( )

Is searchable.

Returns
bool

Definition at line 513 of file class.ilAdvancedMDFieldDefinition.php.

References $searchable.

Referenced by addToFieldDefinitionForm(), getDBProperties(), and toXML().

{
}

+ Here is the caller graph for this function:

static ilAdvancedMDFieldDefinition::isValidType (   $a_type)
static

Is given type valid.

Parameters
int$a_type
Returns
bool

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

{
return in_array((int)$a_type, self::getValidTypes());
}
ilAdvancedMDFieldDefinition::parseSearchObjects ( array  $a_records,
array  $a_object_types 
)
protected

Add object-data needed for global search to AMD search results.

Parameters
array$a_records
array$a_object_types
Returns
array

Reimplemented in ilAdvancedMDFieldDefinitionText.

Definition at line 1037 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, $res, and $row.

Referenced by searchObjects().

{
global $ilDB;
$res = array();
$obj_ids = array();
foreach($a_records as $record)
{
if($record["sub_type"] == "-")
{
$obj_ids[] = $record["obj_id"];
}
}
$sql = "SELECT obj_id,type".
" FROM object_data".
" WHERE ".$ilDB->in("obj_id", $obj_ids, "", "integer").
" AND ".$ilDB->in("type", $a_object_types, "", "text");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$res[] = $row;
}
return $res;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::prepareCustomDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

Reimplemented in ilAdvancedMDFieldDefinitionSelect.

Definition at line 701 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by prepareDefinitionFormConfirmation().

{
// type-specific
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::prepareDefinitionFormConfirmation ( ilPropertyFormGUI  $a_form)

Definition at line 706 of file class.ilAdvancedMDFieldDefinition.php.

References ilPropertyFormGUI\addItem(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), and prepareCustomDefinitionFormConfirmation().

{
$a_form->getItemByPostVar("title")->setDisabled(true);
$a_form->getItemByPostVar("description")->setDisabled(true);
$a_form->getItemByPostVar("searchable")->setDisabled(true);
// checkboxes have no hidden on disabled
if($a_form->getInput("searchable"))
{
$hidden = new ilHiddenInputGUI("searchable");
$hidden->setValue(1);
$a_form->addItem($hidden);
}
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::prepareElementForEditor ( ilADTFormBridge  $a_bridge)

Prepare editor form elements.

Parameters
ilADTFormBridge$a_bridge

Reimplemented in ilAdvancedMDFieldDefinitionDate, and ilAdvancedMDFieldDefinitionDateTime.

Definition at line 987 of file class.ilAdvancedMDFieldDefinition.php.

{
// type-specific
}
ilAdvancedMDFieldDefinition::prepareElementForSearch ( ilADTSearchBridge  $a_bridge)

Prepare search form elements.

Parameters
ilADTSearchBridge$a_bridge

Reimplemented in ilAdvancedMDFieldDefinitionDate, and ilAdvancedMDFieldDefinitionDateTime.

Definition at line 1141 of file class.ilAdvancedMDFieldDefinition.php.

{
// type-specific
}
ilAdvancedMDFieldDefinition::read (   $a_field_id)
protected

Read field definition.

Definition at line 814 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, and $row.

Referenced by __construct().

{
global $ilDB;
if(!(int)$a_field_id)
{
return;
}
$sql = "SELECT * FROM adv_mdf_definition".
" WHERE field_id = ".$ilDB->quote($a_field_id, "integer");
$set = $ilDB->query($sql);
if($ilDB->numRows($set))
{
$row = $ilDB->fetchAssoc($set);
$this->import($row);
}
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::save ( )

Create new field entry.

Definition at line 836 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, generateImportId(), getDBProperties(), getFieldId(), getImportId(), getLastPosition(), setImportId(), setPosition(), and update().

Referenced by update().

{
global $ilDB;
if($this->getFieldId())
{
return $this->update();
}
$next_id = $ilDB->nextId("adv_mdf_definition");
// append
$this->setPosition($this->getLastPosition()+1);
// needs unique import id
if(!$this->getImportId())
{
$this->setImportId($this->generateImportId($next_id));
}
$fields = $this->getDBProperties();
$fields["field_id"] = array("integer", $next_id);
$ilDB->insert("adv_mdf_definition", $fields);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::searchObjects ( ilADTSearchBridge  $a_adt_search,
ilQueryParser  $a_parser,
array  $a_object_types,
  $a_locate,
  $a_search_type 
)

Search objects.

Parameters
ilADTSearchBridge$a_adt_search
ilQueryParser$a_parser
array$a_object_types
string$a_locate
string$a_search_type
Returns
array

Reimplemented in ilAdvancedMDFieldDefinitionText.

Definition at line 1108 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTActiveRecordByType\find(), getADT(), getFieldId(), ilADTSearchBridge\getSQLCondition(), getType(), parseSearchObjects(), and ilADTActiveRecordByType\SINGLE_COLUMN_NAME.

{
// search type only supported/needed for text
include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
if($condition)
{
$objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
if(sizeof($objects))
{
return $this->parseSearchObjects($objects, $a_object_types);
}
return array();
}
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::searchSubObjects ( ilADTSearchBridge  $a_adt_search,
  $a_obj_id,
  $sub_obj_type 
)

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

References $res, ilADTActiveRecordByType\find(), getADT(), getFieldId(), ilADTSearchBridge\getSQLCondition(), getType(), and ilADTActiveRecordByType\SINGLE_COLUMN_NAME.

{
include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
// :TODO:
if($a_adt_search instanceof ilADTLocationSearchBridgeSingle)
{
$element_id = "loc";
}
$condition = $a_adt_search->getSQLCondition($element_id);
if($condition)
{
$objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition);
if(sizeof($objects))
{
$res = array();
foreach($objects as $item)
{
if($item["obj_id"] == $a_obj_id &&
$item["sub_type"] == $sub_obj_type)
{
$res[] = $item["sub_id"];
}
}
return $res;
}
}
return array();
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::setADT ( ilADT  $a_adt)
protected

Set ADT instance.

See Also
self::getADTGroupForDefinitions()
Parameters
ilADT$a_adt

Definition at line 354 of file class.ilAdvancedMDFieldDefinition.php.

{
if(!$this->adt instanceof ilADT)
{
$this->adt = $a_adt;
}
}
ilAdvancedMDFieldDefinition::setDescription (   $a_desc)

Set description.

Parameters
string$a_desc

Definition at line 479 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and importDefinitionFormPostValues().

{
if($a_desc !== null)
{
$a_desc = trim($a_desc);
}
$this->description = $a_desc;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::setFieldId (   $a_id)
protected

Set field_id.

Parameters
int$a_id

Definition at line 371 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import().

{
$this->field_id = (int)$a_id;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::setImportId (   $a_id_string)

Set import id.

Parameters
string$a_id_string

Definition at line 411 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and save().

{
if($a_id_string !== null)
{
$a_id_string = trim($a_id_string);
}
$this->import_id = $a_id_string;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::setPosition (   $a_pos)

Set position.

Parameters
int$a_pos

Definition at line 435 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and save().

{
$this->position = (int)$a_pos;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::setRecordId (   $a_id)

Set record id.

Parameters
int$a_id

Definition at line 391 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import().

{
$this->record_id = (int)$a_id;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::setRequired (   $a_status)

Toggle required.

Parameters
bool$a_status

Definition at line 523 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and init().

{
$this->required = (bool)$a_status;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::setSearchable (   $a_status)

Toggle searchable.

Parameters
boolsearchable

Definition at line 503 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), importDefinitionFormPostValues(), and init().

{
$this->searchable = (bool)$a_status;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::setSearchValueSerialized ( ilADTSearchBridge  $a_adt_search,
  $a_value 
)

Set value from search persistence.

Parameters
ilADTSearchBridge$a_adt_search
string$a_value

Definition at line 1025 of file class.ilAdvancedMDFieldDefinition.php.

References ilADTSearchBridge\setSerializedValue().

{
return $a_adt_search->setSerializedValue($a_value);
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::setTitle (   $a_title)

Get title.

Parameters
string$a_title

Definition at line 455 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by import(), and importDefinitionFormPostValues().

{
if($a_title !== null)
{
$a_title = trim($a_title);
}
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinition::toXML ( ilXmlWriter  $a_writer)

To Xml.

This method writes only the subset Field Use class.ilAdvancedMDRecordXMLWriter to generate a complete xml presentation.

Parameters
ilXmlWriter$a_writer

Definition at line 912 of file class.ilAdvancedMDFieldDefinition.php.

References addPropertiesToXML(), generateImportId(), getDescription(), getFieldId(), getPosition(), getTitle(), getType(), isSearchable(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

{
$a_writer->xmlStartTag('Field',array(
'id' => $this->generateImportId($this->getFieldId()),
'searchable' => ($this->isSearchable() ? 'Yes' : 'No'),
'fieldType' => self::getTypeString($this->getType())));
$a_writer->xmlElement('FieldTitle',null,$this->getTitle());
$a_writer->xmlElement('FieldDescription',null,$this->getDescription());
$a_writer->xmlElement('FieldPosition',null,$this->getPosition());
$this->addPropertiesToXML($a_writer);
$a_writer->xmlEndTag('Field');
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinition::update ( )

Update field entry.

Reimplemented in ilAdvancedMDFieldDefinitionSelect, and ilAdvancedMDFieldDefinitionSelectMulti.

Definition at line 865 of file class.ilAdvancedMDFieldDefinition.php.

References $ilDB, getDBProperties(), getFieldId(), and save().

Referenced by save().

{
global $ilDB;
if(!$this->getFieldId())
{
return $this->save();
}
$ilDB->update("adv_mdf_definition",
$this->getDBProperties(),
array("field_id"=>array("integer", $this->getFieldId())));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilAdvancedMDFieldDefinition::$adt
protected
ilAdvancedMDFieldDefinition::$adt_def
protected

Definition at line 24 of file class.ilAdvancedMDFieldDefinition.php.

Referenced by getADTDefinition().

ilAdvancedMDFieldDefinition::$description
protected

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

Referenced by getDescription().

ilAdvancedMDFieldDefinition::$field_id
protected

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

Referenced by getFieldId(), and getSearchableDefinitionIds().

ilAdvancedMDFieldDefinition::$import_id
protected

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

Referenced by getImportId().

ilAdvancedMDFieldDefinition::$position
protected

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

Referenced by getPosition().

ilAdvancedMDFieldDefinition::$record_id
protected

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

Referenced by getRecordId().

ilAdvancedMDFieldDefinition::$required
protected

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

Referenced by isRequired().

ilAdvancedMDFieldDefinition::$searchable
protected

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

Referenced by isSearchable().

ilAdvancedMDFieldDefinition::$title
protected
const ilAdvancedMDFieldDefinition::TYPE_DATETIME = 4
const ilAdvancedMDFieldDefinition::TYPE_FLOAT = 6
const ilAdvancedMDFieldDefinition::TYPE_INTEGER = 5
const ilAdvancedMDFieldDefinition::TYPE_LOCATION = 7
const ilAdvancedMDFieldDefinition::TYPE_SELECT = 1
const ilAdvancedMDFieldDefinition::TYPE_SELECT_MULTI = 8
const ilAdvancedMDFieldDefinition::TYPE_TEXT = 2

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