ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAdvancedMDFieldDefinitionText Class Reference

AMD field type text. More...

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

Public Member Functions

 getType ()
 Get type. More...
 
 setMaxLength ($a_value)
 Set max length. More...
 
 getMaxLength ()
 Get max length. More...
 
 setMulti ($a_value)
 Set multi-line. More...
 
 isMulti ()
 Is multi-line? More...
 
 getFieldDefinitionForTableGUI ()
 Parse properties for table gui. More...
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false)
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form. More...
 
 importXMLProperty ($a_key, $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML ($a_cdata)
 Import value from xml. More...
 
 importFromECS ($a_ecs_type, $a_value, $a_sub_id)
 Import meta data from ECS. More...
 
 prepareElementForEditor (ilADTFormBridge $a_text)
 Prepare editor form elements. More...
 
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser. More...
 
 searchObjects (ilADTSearchBridge $a_adt_search, ilQueryParser $a_parser, array $a_object_types, $a_locate, $a_search_type)
 Search. More...
 
- Public Member Functions inherited from ilAdvancedMDFieldDefinition
 __construct ($a_field_id=null)
 Constructor. More...
 
 getType ()
 Get type. More...
 
 getTypeTitle ()
 Get type title (lang id) More...
 
 getADTDefinition ()
 Get ADT definition instance. More...
 
 getADT ()
 Get ADT instance. More...
 
 getFieldId ()
 Get field_id. More...
 
 setRecordId ($a_id)
 Set record id. More...
 
 getRecordId ()
 Get record id. More...
 
 setImportId ($a_id_string)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 setPosition ($a_pos)
 Set position. More...
 
 getPosition ()
 Get position. More...
 
 setTitle ($a_title)
 Get title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription ($a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 isSearchSupported ()
 Is search supported at all. More...
 
 isFilterSupported ()
 Is search by filter supported. More...
 
 setSearchable ($a_status)
 Toggle searchable. More...
 
 isSearchable ()
 Is searchable. More...
 
 setRequired ($a_status)
 Toggle required. More...
 
 isRequired ()
 Is required field. More...
 
 getFieldDefinitionForTableGUI ()
 Parse properties for table gui. More...
 
 addToFieldDefinitionForm (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Add input elements to definition form. More...
 
 importCustomDefinitionFormPostValues (ilPropertyFormGUI $a_form)
 Import custom post values from definition form. More...
 
 importDefinitionFormPostValues (ilPropertyFormGUI $a_form, ilAdvancedMDPermissionHelper $a_permissions)
 Import post values from definition form. More...
 
 importDefinitionFormPostValuesNeedsConfirmation ()
 
 prepareCustomDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 prepareDefinitionFormConfirmation (ilPropertyFormGUI $a_form)
 
 generateImportId ($a_field_id)
 Generate unique record id. More...
 
 save ($a_keep_pos=false)
 Create new field entry. More...
 
 update ()
 Update field entry. More...
 
 delete ()
 Delete field entry. More...
 
 toXML (ilXmlWriter $a_writer)
 To Xml. More...
 
 importXMLProperty ($a_key, $a_value)
 Import property from XML. More...
 
 getValueForXML (ilADT $element)
 Parse ADT value for xml (export) More...
 
 importValueFromXML ($a_cdata)
 Import value from xml. More...
 
 importFromECS ($a_ecs_type, $a_value, $a_sub_id)
 Import meta data from ECS. More...
 
 prepareElementForEditor (ilADTFormBridge $a_bridge)
 Prepare editor form elements. More...
 
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 Get value for search query parser. More...
 
 getSearchValueSerialized (ilADTSearchBridge $a_adt_search)
 Get value for search persistence. More...
 
 setSearchValueSerialized (ilADTSearchBridge $a_adt_search, $a_value)
 Set value from search persistence. More...
 
 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. More...
 
 getLuceneSearchString ($a_value)
 Get search string in lucene syntax. More...
 
 prepareElementForSearch (ilADTSearchBridge $a_bridge)
 Prepare search form elements. More...
 
 _clone ($a_new_record_id)
 Clone field definition. More...
 

Protected Member Functions

 initADTDefinition ()
 Init adt instance. More...
 
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB. More...
 
 getFieldDefinition ()
 Get (type-specific) field definition. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export. More...
 
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results. More...
 
- Protected Member Functions inherited from ilAdvancedMDFieldDefinition
 init ()
 Init properties. More...
 
 initADTDefinition ()
 Init adt instance. More...
 
 setADT (ilADT $a_adt)
 Set ADT instance. More...
 
 setFieldId ($a_id)
 Set field_id. More...
 
 importFieldDefinition (array $a_def)
 Import (type-specific) field definition from DB. More...
 
 getFieldDefinition ()
 Get (type-specific) field definition. More...
 
 addCustomFieldToDefinitionForm (ilPropertyFormGUI $a_form, $a_disabled=false)
 Add custom input elements to definition form. More...
 
 getLastPosition ()
 Get last position of record. More...
 
 getDBProperties ()
 Get all definition properties for DB. More...
 
 import (array $a_data)
 Import from DB. More...
 
 read ($a_field_id)
 Read field definition. More...
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 Add (type-specific) properties to xml export. More...
 
 parseSearchObjects (array $a_records, array $a_object_types)
 Add object-data needed for global search to AMD search results. More...
 

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. More...
 
static getInstanceByTypeString ($a_type)
 Get instance by type string (used by import) More...
 
static getInstancesByRecordId ($a_record_id, $a_only_searchable=false)
 Get definitions by record id. More...
 
static getInstancesByObjType ($a_obj_type, $a_active_only=true)
 
static getInstanceByImportId ($a_import_id)
 Get definition instance by import id. More...
 
static getSearchableDefinitionIds ()
 Get searchable definition ids (performance is key) More...
 
static getADTGroupForDefinitions (array $a_defs)
 Init ADTGroup for definitions. More...
 
static getValidTypes ()
 Get all valid types. More...
 
static isValidType ($a_type)
 Is given type valid. More...
 
- 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
 
const TYPE_EXTERNAL_LINK = 9
 
const TYPE_INTERNAL_LINK = 10
 
- Static Protected Member Functions inherited from ilAdvancedMDFieldDefinition
static getTypeString ($a_type)
 Get type string. More...
 

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

◆ addCustomFieldToDefinitionForm()

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 139 of file class.ilAdvancedMDFieldDefinitionText.php.

140 {
141 global $DIC;
142
143 $lng = $DIC['lng'];
144
145 $max = new ilNumberInputGUI($lng->txt("md_adv_text_max_length"), "max");
146 $max->setValue($this->getMaxLength());
147 $max->setSize(10);
148 $max->setMinValue(1);
149 $max->setMaxValue(4000); // DB limit
150 $a_form->addItem($max);
151
152 $multi = new ilCheckboxInputGUI($lng->txt("md_adv_text_multi"), "multi");
153 $multi->setValue(1);
154 $multi->setChecked($this->isMulti());
155 $a_form->addItem($multi);
156
157 if ($a_disabled) {
158 $max->setDisabled(true);
159 $multi->setDisabled(true);
160 }
161 }
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
global $DIC
Definition: saml.php:7
$lng

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

+ Here is the call graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinitionText::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

Add (type-specific) properties to xml export.

Parameters
ilXmlWriter$a_writer

Reimplemented from ilAdvancedMDFieldDefinition.

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

181 {
182 $a_writer->xmlElement('FieldValue', array("id" => "max"), $this->getMaxLength());
183 $a_writer->xmlElement('FieldValue', array("id" => "multi"), $this->isMulti());
184 }
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

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

+ Here is the call graph for this function:

◆ getFieldDefinition()

ilAdvancedMDFieldDefinitionText::getFieldDefinition ( )
protected

Get (type-specific) field definition.

Returns
array

Reimplemented from ilAdvancedMDFieldDefinition.

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

108 {
109 return array(
110 "max" => $this->getMaxLength(),
111 "multi" => $this->isMulti()
112 );
113 }

References getMaxLength(), and isMulti().

+ Here is the call graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinitionText::getFieldDefinitionForTableGUI ( )

Parse properties for table gui.

Returns
array

Reimplemented from ilAdvancedMDFieldDefinition.

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

116 {
117 global $DIC;
118
119 $lng = $DIC['lng'];
120
121 $res = array();
122
123 if ($this->getMaxLength() !== null) {
124 $res[$lng->txt("md_adv_text_max_length")] = $this->getMaxLength();
125 }
126 if ($this->isMulti()) {
127 $res[$lng->txt("md_adv_text_multi")] = $lng->txt("yes");
128 }
129
130 return $res;
131 }
foreach($_POST as $key=> $value) $res

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

+ Here is the call graph for this function:

◆ getMaxLength()

ilAdvancedMDFieldDefinitionText::getMaxLength ( )

Get max length.

Returns
int

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

References $max_length.

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

+ Here is the caller graph for this function:

◆ getSearchQueryParserValue()

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 252 of file class.ilAdvancedMDFieldDefinitionText.php.

253 {
254 return $a_adt_search->getADT()->getText();
255 }

◆ getType()

ilAdvancedMDFieldDefinitionText::getType ( )

Get type.

Returns
int

Reimplemented from ilAdvancedMDFieldDefinition.

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

References ilAdvancedMDFieldDefinition\TYPE_TEXT.

◆ getValueForXML()

ilAdvancedMDFieldDefinitionText::getValueForXML ( ilADT  $element)

Parse ADT value for xml (export)

Parameters
ilADT$element
Returns
string

Reimplemented from ilAdvancedMDFieldDefinition.

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

197 {
198 return $element->getText();
199 }

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinitionText::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilAdvancedMDFieldDefinition.

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

169 {
170 $max = $a_form->getInput("max");
171 $this->setMaxLength(($max !== "") ? $max : null);
172
173 $this->setMulti($a_form->getInput("multi"));
174 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

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

+ Here is the call graph for this function:

◆ importFieldDefinition()

ilAdvancedMDFieldDefinitionText::importFieldDefinition ( array  $a_def)
protected

Import (type-specific) field definition from DB.

Parameters
array$a_def

Reimplemented from ilAdvancedMDFieldDefinition.

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

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

References setMaxLength(), and setMulti().

+ Here is the call graph for this function:

◆ importFromECS()

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 206 of file class.ilAdvancedMDFieldDefinitionText.php.

207 {
208 switch ($a_ecs_type) {
210 $value = implode(',', (array) $a_value);
211 break;
212
214 $value = (int) $a_value;
215 break;
216
218 $value = (string) $a_value;
219 break;
220
222 if ($a_value instanceof ilECSTimePlace) {
223 $value = $a_value->{'get' . ucfirst($a_sub_id)}();
224 }
225 break;
226 }
227
228 if (trim($value)) {
229 $this->getADT()->setText($value);
230 return true;
231 }
232 return false;
233 }
Representation of ECS EContent Time Place.
const TYPE_TIMEPLACE

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

◆ importValueFromXML()

ilAdvancedMDFieldDefinitionText::importValueFromXML (   $a_cdata)

Import value from xml.

Parameters
string$a_cdata

Reimplemented from ilAdvancedMDFieldDefinition.

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

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

References ilAdvancedMDFieldDefinition\getADT().

+ Here is the call graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinitionText::importXMLProperty (   $a_key,
  $a_value 
)

Import property from XML.

Parameters
string$a_key
string$a_value

Reimplemented from ilAdvancedMDFieldDefinition.

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

187 {
188 if ($a_key == "max") {
189 $this->setMaxLength($a_value != "" ? $a_value : null);
190 }
191 if ($a_key == "multi") {
192 $this->setMulti($a_value != "" ? $a_value : null);
193 }
194 }

References setMaxLength(), and setMulti().

+ Here is the call graph for this function:

◆ initADTDefinition()

ilAdvancedMDFieldDefinitionText::initADTDefinition ( )
protected

Init adt instance.

Returns
ilADTDefinition

Reimplemented from ilAdvancedMDFieldDefinition.

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

35 {
36 $def = ilADTFactory::getInstance()->getDefinitionInstanceByType("Text");
37
38 $max = $this->getMaxLength();
39 if (is_numeric($max)) {
40 $def->setMaxLength($max);
41 }
42
43 // multi-line is presentation property
44
45 return $def;
46 }
static getInstance()
Get singleton.
$def
Definition: croninfo.php:21

References $def, ilADTFactory\getInstance(), and getMaxLength().

+ Here is the call graph for this function:

◆ isMulti()

ilAdvancedMDFieldDefinitionText::isMulti ( )

Is multi-line?

Returns
bool

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

92 {
93 return $this->multi;
94 }

References $multi.

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

+ Here is the caller graph for this function:

◆ parseSearchObjects()

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 257 of file class.ilAdvancedMDFieldDefinitionText.php.

258 {
259 global $DIC;
260
261 $ilDB = $DIC['ilDB'];
262
263 $res = array();
264
265 $obj_ids = array();
266 foreach ($a_records as $record) {
267 if ($record["sub_type"] == "-") {
268 // keep found information
269 $obj_ids[$record["obj_id"]] = $record;
270 }
271 }
272
273 $sql = "SELECT obj_id,type" .
274 " FROM object_data" .
275 " WHERE " . $ilDB->in("obj_id", array_keys($obj_ids), "", "integer") .
276 " AND " . $ilDB->in("type", $a_object_types, "", "text");
277 $set = $ilDB->query($sql);
278 while ($row = $ilDB->fetchAssoc($set)) {
279 $row["found"] = array();
280 foreach ($obj_ids[$row["obj_id"]] as $field => $value) {
281 if (substr($field, 0, 5) == "found") {
282 $row["found"][$field] = $value;
283 }
284 }
285 $res[] = $row;
286 }
287
288 return $res;
289 }
$row
global $ilDB

References $DIC, $ilDB, $res, and $row.

◆ prepareElementForEditor()

ilAdvancedMDFieldDefinitionText::prepareElementForEditor ( ilADTFormBridge  $a_bridge)

Prepare editor form elements.

Parameters
ilADTFormBridge$a_bridge

Reimplemented from ilAdvancedMDFieldDefinition.

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

240 {
241 assert($a_text instanceof ilADTTextFormBridge);
242
243 // seems to be default in course info editor
244 $a_text->setMulti($this->isMulti(), 80, 6);
245 }

◆ searchObjects()

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 301 of file class.ilAdvancedMDFieldDefinitionText.php.

302 {
303 // :TODO: search type (like, fulltext)
304
305 include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
306 $condition = $a_adt_search->getSQLCondition(
309 $a_parser->getQuotedWords()
310 );
311 if ($condition) {
312 $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
313 if (sizeof($objects)) {
314 return $this->parseSearchObjects($objects, $a_object_types);
315 }
316 return array();
317 }
318 }
static find($a_table, $a_type, $a_field_id, $a_condition, $a_additional_fields=null)
Find entries.
getSQLCondition($a_element_id)
Get SQL condition for current value(s)
parseSearchObjects(array $a_records, array $a_object_types)
Add object-data needed for global search to AMD search results.
getQuotedWords($with_quotation=false)

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

+ Here is the call graph for this function:

◆ setMaxLength()

ilAdvancedMDFieldDefinitionText::setMaxLength (   $a_value)

Set max length.

Parameters
int$a_value

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

59 {
60 if ($a_value !== null) {
61 $a_value = (int) $a_value;
62 }
63 $this->max_length = $a_value;
64 }

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

+ Here is the caller graph for this function:

◆ setMulti()

ilAdvancedMDFieldDefinitionText::setMulti (   $a_value)

Set multi-line.

Parameters
string$a_value

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

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

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

+ Here is the caller graph for this function:

Field Documentation

◆ $max_length

ilAdvancedMDFieldDefinitionText::$max_length
protected

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

Referenced by getMaxLength().

◆ $multi

ilAdvancedMDFieldDefinitionText::$multi
protected

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