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

external link search bridge More...

+ Inheritance diagram for ilADTInternalLinkSearchBridgeSingle:
+ Collaboration diagram for ilADTInternalLinkSearchBridgeSingle:

Public Member Functions

 addToForm ()
 
 loadFilter ()
 /** Load from filter More...
 
 importFromPost (array $a_post=null)
 Import from post. More...
 
 getSQLCondition ($a_element_id, $a_mode=self::SQL_LIKE, $a_value=null)
 Get sql condition. More...
 
 isInCondition (ilADT $a_adt)
 Is in condition. More...
 
 getSerializedValue ()
 get serialized value More...
 
 setSerializedValue ($a_value)
 Set serialized value. More...
 
- Public Member Functions inherited from ilADTSearchBridgeSingle
 getADT ()
 Get ADT. More...
 
 isNull ()
 
 isValid ()
 
 validate ()
 
- Public Member Functions inherited from ilADTSearchBridge
 __construct (ilADTDefinition $a_adt_def)
 Constructor. More...
 
 isNull ()
 Is null ? More...
 
 setForm (ilPropertyFormGUI $a_form)
 Set form. More...
 
 getForm ()
 Get form. More...
 
 setElementId ($a_value)
 Set element id (aka form field) More...
 
 getElementId ()
 Get element id. More...
 
 setTitle ($a_value)
 Set title (aka form field caption) More...
 
 getTitle ()
 Get title. More...
 
 setTableGUI (ilTable2GUI $a_table)
 Set table gui (for filter mode) More...
 
 getTableGUI ()
 Get table gui. More...
 
 loadFilter ()
 Load filter value(s) into ADT. More...
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 importFromPost (array $a_post=null)
 Import values from (search) form request POST data. More...
 
 validate ()
 Validate current data. More...
 
 getSQLCondition ($a_element_id)
 Get SQL condition for current value(s) More...
 
 isInCondition (ilADT $a_adt)
 Compare directly against ADT. More...
 
 getSerializedValue ()
 Get current value(s) in serialized form (for easy persisting) More...
 
 setSerializedValue ($a_value)
 Set current value(s) in serialized form (for easy persisting) More...
 

Data Fields

const SQL_STRICT = 1
 
const SQL_LIKE = 2
 
const SQL_LIKE_END = 3
 
const SQL_LIKE_START = 4
 

Protected Member Functions

 isValidADTDefinition (\ilADTDefinition $a_adt_def)
 Is valid type. More...
 
- Protected Member Functions inherited from ilADTSearchBridgeSingle
 setDefinition (ilADTDefinition $a_adt_def)
 
- Protected Member Functions inherited from ilADTSearchBridge
 isValidADTDefinition (ilADTDefinition $a_adt_def)
 Check if given ADT definition is valid. More...
 
 setDefinition (ilADTDefinition $a_adt_def)
 Set ADT definition. More...
 
 writeFilter ($a_value=null)
 Write value(s) to filter store (in session) More...
 
 readFilter ()
 Load value(s) from filter store (in session) More...
 
 addToParentElement (ilFormPropertyGUI $a_field)
 Add form field to parent element. More...
 
 addToElementId ($a_add)
 Add sub-element. More...
 
 shouldBeImportedFromPost ($a_post)
 Check if incoming values should be imported at all. More...
 
 extractPostValues (array $a_post=null)
 Extract data from (post) values. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilADTSearchBridgeSingle
 $adt
 
- Protected Attributes inherited from ilADTSearchBridge
 $form
 
 $table_gui
 
 $table_filter_fields = []
 
 $id
 
 $title
 
 $info
 

Detailed Description

external link search bridge

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 11 of file class.ilADTInternalLinkSearchBridgeSingle.php.

Member Function Documentation

◆ addToForm()

ilADTInternalLinkSearchBridgeSingle::addToForm ( )

Definition at line 33 of file class.ilADTInternalLinkSearchBridgeSingle.php.

References ilADTSearchBridge\$title, ilADTSearchBridge\addToParentElement(), ilADTSearchBridge\getElementId(), and ilADTSearchBridge\getTitle().

34  {
35  $title = new ilTextInputGUI($this->getTitle(), $this->getElementId());
36  $title->setSize(255);
37  $this->addToParentElement($title);
38  }
This class represents a text property in a property form.
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTInternalLinkSearchBridgeSingle::getSerializedValue ( )

get serialized value

Returns
type

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

113  {
114  if (!$this->isNull() && $this->isValid()) {
115  return serialize(array($this->getADT()->getTargetRefId()));
116  }
117  }
Create styles array
The data for the language used.

◆ getSQLCondition()

ilADTInternalLinkSearchBridgeSingle::getSQLCondition (   $a_element_id,
  $a_mode = self::SQL_LIKE,
  $a_value = null 
)

Get sql condition.

Parameters
int$a_element_id
Returns
string

Definition at line 77 of file class.ilADTInternalLinkSearchBridgeSingle.php.

78  {
79  $db = $GLOBALS['DIC']->database();
80 
81  if (!$a_value) {
82  if ($this->isNull() || !$this->isValid()) {
83  return;
84  }
85  $a_value = $this->getADT()->getTargetRefId();
86  }
87 
88  $subselect = $a_element_id . ' IN ' .
89  '( select ref_id from object_reference obr join object_data obd on obr.obj_id = obd.obj_id ' .
90  'where ' . $db->like('title', 'text', $a_value . '%') . ' ' .
91  ')';
92  return $subselect;
93  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

◆ importFromPost()

ilADTInternalLinkSearchBridgeSingle::importFromPost ( array  $a_post = null)

Import from post.

Parameters
array$a_post

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

60  {
61  $post = $this->extractPostValues($a_post);
62 
63  if ($post && $this->shouldBeImportedFromPost($post)) {
64  $item = $this->getForm()->getItemByPostVar($this->getElementId());
65  $item->setValue($post);
66  $this->getADT()->setTargetRefId($post);
67  } else {
68  $this->getADT()->setTargetRefId(null);
69  }
70  }
extractPostValues(array $a_post=null)
Extract data from (post) values.
shouldBeImportedFromPost($a_post)
Check if incoming values should be imported at all.
$post
Definition: post.php:34
getElementId()
Get element id.

◆ isInCondition()

ilADTInternalLinkSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Is in condition.

Parameters
ilADT$a_adt
Returns
bool

Definition at line 100 of file class.ilADTInternalLinkSearchBridgeSingle.php.

101  {
102  if ($this->isValidADT($a_adt)) {
103  return $this->getADT()->equals($a_adt);
104  }
105  // @todo throw exception
106  }

◆ isValidADTDefinition()

ilADTInternalLinkSearchBridgeSingle::isValidADTDefinition ( \ilADTDefinition  $a_adt_def)
protected

Is valid type.

Parameters
ilADT$a_adt
Returns
bool

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

25  {
26  return $a_adt_def instanceof ilADTInternalLinkDefinition;
27  }

◆ loadFilter()

ilADTInternalLinkSearchBridgeSingle::loadFilter ( )

/** Load from filter

Definition at line 47 of file class.ilADTInternalLinkSearchBridgeSingle.php.

48  {
49  $value = $this->readFilter();
50  if ($value !== null) {
51  $this->getADT()->setTargetRefId($value);
52  }
53  }
readFilter()
Load value(s) from filter store (in session)

◆ setSerializedValue()

ilADTInternalLinkSearchBridgeSingle::setSerializedValue (   $a_value)

Set serialized value.

Parameters
string$a_value

Definition at line 123 of file class.ilADTInternalLinkSearchBridgeSingle.php.

124  {
125  $a_value = unserialize($a_value);
126  if (is_array($a_value)) {
127  $this->getADT()->setTargetRefId($a_value[0]);
128  }
129  }

Field Documentation

◆ SQL_LIKE

const ilADTInternalLinkSearchBridgeSingle::SQL_LIKE = 2

◆ SQL_LIKE_END

const ilADTInternalLinkSearchBridgeSingle::SQL_LIKE_END = 3

◆ SQL_LIKE_START

const ilADTInternalLinkSearchBridgeSingle::SQL_LIKE_START = 4

◆ SQL_STRICT

const ilADTInternalLinkSearchBridgeSingle::SQL_STRICT = 1

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