ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAdvancedMDFieldDefinitionText Class Reference

AMD field type text. More...

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

Public Member Functions

 getType ()
 
 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 ()
 
 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)
 
 getValueForXML (ilADT $element)
 
 importValueFromXML ($a_cdata)
 
 importFromECS ($a_ecs_type, $a_value, $a_sub_id)
 
 prepareElementForEditor (ilADTFormBridge $a_text)
 
 getSearchQueryParserValue (ilADTSearchBridge $a_adt_search)
 
 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 ()
 
 importFieldDefinition (array $a_def)
 
 getFieldDefinition ()
 
 addPropertiesToXML (ilXmlWriter $a_writer)
 
 parseSearchObjects (array $a_records, array $a_object_types)
 
- 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

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

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

138  {
139  global $lng;
140 
141  $max = new ilNumberInputGUI($lng->txt("md_adv_text_max_length"), "max");
142  $max->setValue($this->getMaxLength());
143  $max->setSize(10);
144  $max->setMinValue(1);
145  $max->setMaxValue(4000); // DB limit
146  $a_form->addItem($max);
147 
148  $multi = new ilCheckboxInputGUI($lng->txt("md_adv_text_multi"), "multi");
149  $multi->setValue(1);
150  $multi->setChecked($this->isMulti());
151  $a_form->addItem($multi);
152 
153  if ($a_disabled) {
154  $max->setDisabled(true);
155  $multi->setDisabled(true);
156  }
157  }
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a number property in a property form.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ addPropertiesToXML()

ilAdvancedMDFieldDefinitionText::addPropertiesToXML ( ilXmlWriter  $a_writer)
protected

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

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

177  {
178  $a_writer->xmlElement('FieldValue', array("id"=>"max"), $this->getMaxLength());
179  $a_writer->xmlElement('FieldValue', array("id"=>"multi"), $this->isMulti());
180  }
Create styles array
The data for the language used.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ getFieldDefinition()

ilAdvancedMDFieldDefinitionText::getFieldDefinition ( )
protected

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

References array, getMaxLength(), and isMulti().

108  {
109  return array(
110  "max" => $this->getMaxLength(),
111  "multi" => $this->isMulti()
112  );
113  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getFieldDefinitionForTableGUI()

ilAdvancedMDFieldDefinitionText::getFieldDefinitionForTableGUI ( )

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

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

116  {
117  global $lng;
118 
119  $res = array();
120 
121  if ($this->getMaxLength() !== null) {
122  $res[$lng->txt("md_adv_text_max_length")] = $this->getMaxLength();
123  }
124  if ($this->isMulti()) {
125  $res[$lng->txt("md_adv_text_multi")] = $lng->txt("yes");
126  }
127 
128  return $res;
129  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ 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)

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

249  {
250  return $a_adt_search->getADT()->getText();
251  }

◆ getType()

ilAdvancedMDFieldDefinitionText::getType ( )

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

Referenced by searchObjects().

25  {
26  return self::TYPE_TEXT;
27  }
+ Here is the caller graph for this function:

◆ getValueForXML()

ilAdvancedMDFieldDefinitionText::getValueForXML ( ilADT  $element)

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

193  {
194  return $element->getText();
195  }

◆ importCustomDefinitionFormPostValues()

ilAdvancedMDFieldDefinitionText::importCustomDefinitionFormPostValues ( ilPropertyFormGUI  $a_form)

Import custom post values from definition form.

Parameters
ilPropertyFormGUI$a_form

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

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

165  {
166  $max = $a_form->getInput("max");
167  $this->setMaxLength(($max !== "") ? $max : null);
168 
169  $this->setMulti($a_form->getInput("multi"));
170  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ importFieldDefinition()

ilAdvancedMDFieldDefinitionText::importFieldDefinition ( array  $a_def)
protected

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

References setMaxLength(), and setMulti().

102  {
103  $this->setMaxLength($a_def["max"]);
104  $this->setMulti($a_def["multi"]);
105  }
+ Here is the call graph for this function:

◆ importFromECS()

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

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

References array, ilAdvancedMDFieldDefinition\getADT(), string, ilECSUtils\TYPE_ARRAY, ilECSUtils\TYPE_INT, ilECSUtils\TYPE_STRING, and ilECSUtils\TYPE_TIMEPLACE.

203  {
204  switch ($a_ecs_type) {
206  $value = implode(',', (array) $a_value);
207  break;
208 
210  $value = (int) $a_value;
211  break;
212 
214  $value = (string) $a_value;
215  break;
216 
218  if ($a_value instanceof ilECSTimePlace) {
219  $value = $a_value->{'get' . ucfirst($a_sub_id)}();
220  }
221  break;
222  }
223 
224  if (trim($value)) {
225  $this->getADT()->setText($value);
226  return true;
227  }
228  return false;
229  }
Add rich text string
Representation of ECS EContent Time Place.
const TYPE_TIMEPLACE
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ importValueFromXML()

ilAdvancedMDFieldDefinitionText::importValueFromXML (   $a_cdata)

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

References ilAdvancedMDFieldDefinition\getADT().

198  {
199  $this->getADT()->setText($a_cdata);
200  }
+ Here is the call graph for this function:

◆ importXMLProperty()

ilAdvancedMDFieldDefinitionText::importXMLProperty (   $a_key,
  $a_value 
)

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

References setMaxLength(), and setMulti().

183  {
184  if ($a_key == "max") {
185  $this->setMaxLength($a_value != "" ? $a_value : null);
186  }
187  if ($a_key == "multi") {
188  $this->setMulti($a_value != "" ? $a_value : null);
189  }
190  }
+ Here is the call graph for this function:

◆ initADTDefinition()

ilAdvancedMDFieldDefinitionText::initADTDefinition ( )
protected

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

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

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
+ 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.

References $multi.

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

+ Here is the caller graph for this function:

◆ parseSearchObjects()

ilAdvancedMDFieldDefinitionText::parseSearchObjects ( array  $a_records,
array  $a_object_types 
)
protected

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

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

Referenced by searchObjects().

254  {
255  global $ilDB;
256 
257  $res = array();
258 
259  $obj_ids = array();
260  foreach ($a_records as $record) {
261  if ($record["sub_type"] == "-") {
262  // keep found information
263  $obj_ids[$record["obj_id"]] = $record;
264  }
265  }
266 
267  $sql = "SELECT obj_id,type" .
268  " FROM object_data" .
269  " WHERE " . $ilDB->in("obj_id", array_keys($obj_ids), "", "integer") .
270  " AND " . $ilDB->in("type", $a_object_types, "", "text");
271  $set = $ilDB->query($sql);
272  while ($row = $ilDB->fetchAssoc($set)) {
273  $row["found"] = array();
274  foreach ($obj_ids[$row["obj_id"]] as $field => $value) {
275  if (substr($field, 0, 5) == "found") {
276  $row["found"][$field] = $value;
277  }
278  }
279  $res[] = $row;
280  }
281 
282  return $res;
283  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ prepareElementForEditor()

ilAdvancedMDFieldDefinitionText::prepareElementForEditor ( ilADTFormBridge  $a_text)

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

References isMulti().

236  {
237  assert($a_text instanceof ilADTTextFormBridge);
238 
239  // seems to be default in course info editor
240  $a_text->setMulti($this->isMulti(), 80, 6);
241  }
+ Here is the call graph for this function:

◆ 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

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

References array, ilADTActiveRecordByType\find(), ilAdvancedMDFieldDefinition\getADT(), ilAdvancedMDFieldDefinition\getFieldId(), ilQueryParser\getQuotedWords(), ilADTSearchBridge\getSQLCondition(), getType(), parseSearchObjects(), ilADTActiveRecordByType\SINGLE_COLUMN_NAME, and ilADTTextSearchBridgeSingle\SQL_LIKE.

296  {
297  // :TODO: search type (like, fulltext)
298 
299  include_once('Services/ADT/classes/ActiveRecord/class.ilADTActiveRecordByType.php');
300  $condition = $a_adt_search->getSQLCondition(
303  $a_parser->getQuotedWords()
304  );
305  if ($condition) {
306  $objects = ilADTActiveRecordByType::find("adv_md_values", $this->getADT()->getType(), $this->getFieldId(), $condition, $a_locate);
307  if (sizeof($objects)) {
308  return $this->parseSearchObjects($objects, $a_object_types);
309  }
310  return array();
311  }
312  }
getQuotedWords($with_quotation=false)
static find($a_table, $a_type, $a_field_id, $a_condition, $a_additional_fields=null)
Find entries.
Create styles array
The data for the language used.
parseSearchObjects(array $a_records, array $a_object_types)
getSQLCondition($a_element_id)
Get SQL condition for current value(s)
+ 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.

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

59  {
60  if ($a_value !== null) {
61  $a_value = (int) $a_value;
62  }
63  $this->max_length = $a_value;
64  }
+ 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.

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

82  {
83  $this->multi = (bool) $a_value;
84  }
+ 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: