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

external link search bridge More...

+ Inheritance diagram for ilADTExternalLinkSearchBridgeSingle:
+ Collaboration diagram for ilADTExternalLinkSearchBridgeSingle:

Public Member Functions

 loadFilter ()
 Load from filter. More...
 
 addToForm ()
 add external link property to form 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.ilADTExternalLinkSearchBridgeSingle.php.

Member Function Documentation

◆ addToForm()

ilADTExternalLinkSearchBridgeSingle::addToForm ( )

add external link property to form

Definition at line 44 of file class.ilADTExternalLinkSearchBridgeSingle.php.

References $def, $url, ilADTSearchBridge\addToParentElement(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), and ilADTSearchBridge\getTitle().

45  {
46  $def = $this->getADT()->getCopyOfDefinition();
47 
48  $url = new ilTextInputGUI($this->getTitle(), $this->getElementId());
49  $url->setSize(255);
50  $url->setValue($this->getADT()->getUrl());
51  $this->addToParentElement($url);
52  }
This class represents a text property in a property form.
$def
Definition: croninfo.php:21
$url
getElementId()
Get element id.
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTExternalLinkSearchBridgeSingle::getSerializedValue ( )

get serialized value

Returns
type

Definition at line 143 of file class.ilADTExternalLinkSearchBridgeSingle.php.

References array, ilADTSearchBridgeSingle\getADT(), ilADTSearchBridgeSingle\isNull(), and ilADTSearchBridgeSingle\isValid().

144  {
145  if (!$this->isNull() && $this->isValid()) {
146  return serialize(array($this->getADT()->getUrl()));
147  }
148  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTExternalLinkSearchBridgeSingle::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 76 of file class.ilADTExternalLinkSearchBridgeSingle.php.

References $GLOBALS, array, ilADTSearchBridgeSingle\getADT(), ilADTSearchBridgeSingle\isNull(), and ilADTSearchBridgeSingle\isValid().

77  {
78  $db = $GLOBALS['DIC']->database();
79 
80  if (!$a_value) {
81  if ($this->isNull() || !$this->isValid()) {
82  return;
83  }
84  $a_value = $this->getADT()->getUrl();
85  }
86 
87  switch ($a_mode) {
88  case self::SQL_STRICT:
89  if (!is_array($a_value)) {
90  return $a_element_id . " = " . $db->quote($a_value, "text");
91  } else {
92  return $db->in($a_element_id, $a_value, "", "text");
93  }
94  break;
95 
96  case self::SQL_LIKE:
97  if (!is_array($a_value)) {
98  return $db->like($a_element_id, "text", "%" . $a_value . "%");
99  } else {
100  $tmp = array();
101  foreach ($a_value as $word) {
102  if ($word) {
103  $tmp[] = $db->like($a_element_id, "text", "%" . $word . "%");
104  }
105  }
106  if (sizeof($tmp)) {
107  return "(" . implode(" OR ", $tmp) . ")";
108  }
109  }
110  break;
111 
112  case self::SQL_LIKE_END:
113  if (!is_array($a_value)) {
114  return $db->like($a_element_id, "text", $a_value . "%");
115  }
116  break;
117 
118  case self::SQL_LIKE_START:
119  if (!is_array($a_value)) {
120  return $db->like($a_element_id, "text", "%" . $a_value);
121  }
122  break;
123  }
124  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ importFromPost()

ilADTExternalLinkSearchBridgeSingle::importFromPost ( array  $a_post = null)

Import from post.

Parameters
array$a_post

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

References $post, ilADTSearchBridge\extractPostValues(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), ilADTSearchBridge\getForm(), and ilADTSearchBridge\shouldBeImportedFromPost().

59  {
60  $post = $this->extractPostValues($a_post);
61 
62  if ($post && $this->shouldBeImportedFromPost($post)) {
63  $item = $this->getForm()->getItemByPostVar($this->getElementId());
64  $item->setValue($post);
65  $this->getADT()->setUrl($post);
66  } else {
67  $this->getADT()->setUrl();
68  }
69  }
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.
+ Here is the call graph for this function:

◆ isInCondition()

ilADTExternalLinkSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Is in condition.

Parameters
ilADT$a_adt
Returns
bool

Definition at line 131 of file class.ilADTExternalLinkSearchBridgeSingle.php.

References ilADTSearchBridgeSingle\getADT().

132  {
133  if ($this->isValidADT($a_adt)) {
134  return $this->getADT()->equals($a_adt);
135  }
136  // @todo throw exception
137  }
+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTExternalLinkSearchBridgeSingle::isValidADTDefinition ( \ilADTDefinition  $a_adt_def)
protected

Is valid type.

Parameters
ilADT$a_adt
Returns
bool

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

25  {
26  return $a_adt_def instanceof ilADTExternalLinkDefinition;
27  }

◆ loadFilter()

ilADTExternalLinkSearchBridgeSingle::loadFilter ( )

Load from filter.

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

References ilADTSearchBridgeSingle\getADT(), and ilADTSearchBridge\readFilter().

34  {
35  $value = $this->readFilter();
36  if ($value !== null) {
37  $this->getADT()->setUrl($value);
38  }
39  }
readFilter()
Load value(s) from filter store (in session)
+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTExternalLinkSearchBridgeSingle::setSerializedValue (   $a_value)

Set serialized value.

Parameters
string$a_value

Definition at line 154 of file class.ilADTExternalLinkSearchBridgeSingle.php.

References ilADTSearchBridgeSingle\getADT().

155  {
156  $a_value = unserialize($a_value);
157  if (is_array($a_value)) {
158  $this->getADT()->setUrl($a_value[0]);
159  }
160  }
+ Here is the call graph for this function:

Field Documentation

◆ SQL_LIKE

const ilADTExternalLinkSearchBridgeSingle::SQL_LIKE = 2

◆ SQL_LIKE_END

const ilADTExternalLinkSearchBridgeSingle::SQL_LIKE_END = 3

◆ SQL_LIKE_START

const ilADTExternalLinkSearchBridgeSingle::SQL_LIKE_START = 4

◆ SQL_STRICT

const ilADTExternalLinkSearchBridgeSingle::SQL_STRICT = 1

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