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

AMD field type text. More...

+ Inheritance diagram for ilAdvancedMDFieldDefinitionText:
+ Collaboration diagram for ilAdvancedMDFieldDefinitionText:

Public Member Functions

 getType ()
 Get type.
 setMaxLength ($a_value)
 Set max length.
 getMaxLength ()
 Get max length.
 setMulti ($a_value)
 Set multi-line.
 isMulti ()
 Is multi-line?
 getFieldDefinitionForTableGUI ()
 Parse properties for table gui.
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false)
 Add input elements to definition form.
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form.
 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 (ilADTTextFormBridge $a_text)
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser.
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
 Search.
- 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.
 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.
 prepareElementForEditor (ilADTFormBridge $a_bridge)
 Prepare editor form elements.
 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)
 getLuceneSearchString ($a_value)
 Get search string in lucene syntax.
 prepareElementForSearch (ilADTSearchBridge $a_bridge)
 Prepare search form elements.

Protected Member Functions

 initADTDefinition ()
 Init adt instance.
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB.
 getFieldDefinition ()
 Get (type-specific) 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.
- 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.

Protected Attributes

 $max_length
 $multi
- Protected Attributes inherited from ilAdvancedMDFieldDefinition
 $field_id
 $record_id
 $import_id
 $position
 $title
 $description
 $searchable
 $required
 $adt_def
 $adt

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.
- Data Fields inherited from ilAdvancedMDFieldDefinition
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
- Static Protected Member Functions inherited from ilAdvancedMDFieldDefinition
static getTypeString ($a_type)
 Get type string.

Detailed Description

AMD field type text.

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

Member Function Documentation

ilAdvancedMDFieldDefinitionText::addCustomFieldToDefinitionForm ( ilPropertyFormGUI  $a_form,
  $a_disabled = false 
)

Add input elements to definition form.

Parameters
ilPropertyFormGUI$a_form
bool$a_disabled

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 141 of file class.ilAdvancedMDFieldDefinitionText.php.

References $lng, $multi, ilPropertyFormGUI\addItem(), getMaxLength(), isMulti(), and ilNumberInputGUI\setValue().

{
global $lng;
$max = new ilNumberInputGUI($lng->txt("md_adv_text_max_length"), "max");
$max->setValue($this->getMaxLength());
$max->setSize(10);
$max->setMinValue(1);
$max->setMaxValue(4000); // DB limit
$a_form->addItem($max);
$multi = new ilCheckboxInputGUI($lng->txt("md_adv_text_multi"), "multi");
$multi->setValue(1);
$multi->setChecked($this->isMulti());
$a_form->addItem($multi);
if($a_disabled)
{
$max->setDisabled(true);
$multi->setDisabled(true);
}
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Add (type-specific) properties to xml export.

Parameters
ilXmlWriter$a_writer

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 181 of file class.ilAdvancedMDFieldDefinitionText.php.

References getMaxLength(), isMulti(), and ilXmlWriter\xmlElement().

{
$a_writer->xmlElement('FieldValue',array("id"=>"max"),$this->getMaxLength());
$a_writer->xmlElement('FieldValue',array("id"=>"multi"),$this->isMulti());
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::getFieldDefinition ( )
protected

Get (type-specific) field definition.

Returns
array

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 109 of file class.ilAdvancedMDFieldDefinitionText.php.

References getMaxLength(), and isMulti().

{
return array(
"max" => $this->getMaxLength(),
"multi" => $this->isMulti()
);
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::getFieldDefinitionForTableGUI ( )

Parse properties for table gui.

Returns
array

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 117 of file class.ilAdvancedMDFieldDefinitionText.php.

References $lng, $res, getMaxLength(), and isMulti().

{
global $lng;
$res = array();
if($this->getMaxLength() !== null)
{
$res[$lng->txt("md_adv_text_max_length")] = $this->getMaxLength();
}
if($this->isMulti())
{
$res[$lng->txt("md_adv_text_multi")] = $lng->txt("yes");
}
return $res;
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::getMaxLength ( )

Get max length.

Returns
int

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

References $max_length.

Referenced by addCustomFieldToDefinitionForm(), addPropertiesToXML(), getFieldDefinition(), getFieldDefinitionForTableGUI(), and initADTDefinition().

{
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinitionText::getSearchQueryParserValue ( ilADTSearchBridge  $a_adt_search)

Get value for search query parser.

Parameters
ilADTSearchBridge$a_adt_search
Returns
mixed

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 256 of file class.ilAdvancedMDFieldDefinitionText.php.

{
return $a_adt_search->getADT()->getText();
}
ilAdvancedMDFieldDefinitionText::getType ( )

Get type.

Returns
int

Reimplemented from ilAdvancedMDFieldDefinition.

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

References ilAdvancedMDFieldDefinition\TYPE_TEXT.

{
}
ilAdvancedMDFieldDefinitionText::getValueForXML ( ilADT  $element)

Parse ADT value for xml (export)

Parameters
ilADT$element
Returns
string

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 199 of file class.ilAdvancedMDFieldDefinitionText.php.

{
return $element->getText();
}
ilAdvancedMDFieldDefinitionText::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 169 of file class.ilAdvancedMDFieldDefinitionText.php.

References ilPropertyFormGUI\getInput(), setMaxLength(), and setMulti().

{
$max = $a_form->getInput("max");
$this->setMaxLength(($max !== "") ? $max : null);
$this->setMulti($a_form->getInput("multi"));
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::importFieldDefinition ( array  $a_def)
protected

Import (type-specific) field definition from DB.

Parameters
array$a_def

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 103 of file class.ilAdvancedMDFieldDefinitionText.php.

References setMaxLength(), and setMulti().

{
$this->setMaxLength($a_def["max"]);
$this->setMulti($a_def["multi"]);
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::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 from ilAdvancedMDFieldDefinition.

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

References ilECSUtils\TYPE_ARRAY, ilECSUtils\TYPE_INT, ilECSUtils\TYPE_STRING, and ilECSUtils\TYPE_TIMEPLACE.

{
switch($a_ecs_type)
{
$value = implode(',', (array)$a_value);
break;
$value = (int)$a_value;
break;
$value = (string)$a_value;
break;
if($a_value instanceof ilECSTimePlace)
{
$value = $a_value->{'get'.ucfirst($a_sub_id)}();
}
break;
}
if(trim($value))
{
$this->getADT()->setText($value);
return true;
}
return false;
}
ilAdvancedMDFieldDefinitionText::importValueFromXML (   $a_cdata)

Import value from xml.

Parameters
string$a_cdata

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 204 of file class.ilAdvancedMDFieldDefinitionText.php.

References ilAdvancedMDFieldDefinition\getADT().

{
$this->getADT()->setText($a_cdata);
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::importXMLProperty (   $a_key,
  $a_value 
)

Import property from XML.

Parameters
string$a_key
string$a_value

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 187 of file class.ilAdvancedMDFieldDefinitionText.php.

References setMaxLength(), and setMulti().

{
if($a_key == "max")
{
$this->setMaxLength($a_value != "" ? $a_value : null);
}
if($a_key == "multi")
{
$this->setMulti($a_value != "" ? $a_value : null);
}
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::initADTDefinition ( )
protected

Init adt instance.

Returns
ilADTDefinition

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 34 of file class.ilAdvancedMDFieldDefinitionText.php.

References ilAdvancedMDFieldDefinition\getInstance(), and getMaxLength().

{
$def = ilADTFactory::getInstance()->getDefinitionInstanceByType("Text");
$max = $this->getMaxLength();
if(is_numeric($max))
{
$def->setMaxLength($max);
}
// multi-line is presentation property
return $def;
}

+ Here is the call graph for this function:

ilAdvancedMDFieldDefinitionText::isMulti ( )

Is multi-line?

Returns
bool

Definition at line 93 of file class.ilAdvancedMDFieldDefinitionText.php.

References $multi.

Referenced by addCustomFieldToDefinitionForm(), addPropertiesToXML(), getFieldDefinition(), and getFieldDefinitionForTableGUI().

{
return $this->multi;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinitionText::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 from ilAdvancedMDFieldDefinition.

Definition at line 261 of file class.ilAdvancedMDFieldDefinitionText.php.

References $ilDB, $res, and $row.

{
global $ilDB;
$res = array();
$obj_ids = array();
foreach($a_records as $record)
{
if($record["sub_type"] == "-")
{
// keep found information
$obj_ids[$record["obj_id"]] = $record;
}
}
$sql = "SELECT obj_id,type".
" FROM object_data".
" WHERE ".$ilDB->in("obj_id", array_keys($obj_ids), "", "integer").
" AND ".$ilDB->in("type", $a_object_types, "", "text");
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$row["found"] = array();
foreach($obj_ids[$row["obj_id"]] as $field => $value)
{
if(substr($field, 0, 5) == "found")
{
$row["found"][$field] = $value;
}
}
$res[] = $row;
}
return $res;
}
ilAdvancedMDFieldDefinitionText::prepareElementForEditor ( ilADTTextFormBridge  $a_text)

Definition at line 245 of file class.ilAdvancedMDFieldDefinitionText.php.

References ilADTTextFormBridge\setMulti().

{
// seems to be default in course info editor
$a_text->setMulti($this->isMulti(), 80, 6);
}

+ Here is the call graph for this function:

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

Search.

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

Reimplemented from ilAdvancedMDFieldDefinition.

Definition at line 308 of file class.ilAdvancedMDFieldDefinitionText.php.

References ilADTActiveRecordByType\find(), ilQueryParser\getQuotedWords(), ilADTSearchBridge\getSQLCondition(), ilADTActiveRecordByType\SINGLE_COLUMN_NAME, and ilADTTextSearchBridgeSingle\SQL_LIKE.

{
// :TODO: search type (like, fulltext)
include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
$condition = $a_adt_search->getSQLCondition(
$a_parser->getQuotedWords());
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:

ilAdvancedMDFieldDefinitionText::setMaxLength (   $a_value)

Set max length.

Parameters
int$a_value

Definition at line 59 of file class.ilAdvancedMDFieldDefinitionText.php.

Referenced by importCustomDefinitionFormPostValues(), importFieldDefinition(), and importXMLProperty().

{
if($a_value !== null)
{
$a_value = (int)$a_value;
}
$this->max_length = $a_value;
}

+ Here is the caller graph for this function:

ilAdvancedMDFieldDefinitionText::setMulti (   $a_value)

Set multi-line.

Parameters
string$a_value

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

Referenced by importCustomDefinitionFormPostValues(), importFieldDefinition(), and importXMLProperty().

{
$this->multi = (bool)$a_value;
}

+ Here is the caller graph for this function:

Field Documentation

ilAdvancedMDFieldDefinitionText::$max_length
protected

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

Referenced by getMaxLength().

ilAdvancedMDFieldDefinitionText::$multi
protected

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