ILIAS  release_7 Revision v7.30-3-g800a261c036
ilADTInternalLinkSearchBridgeSingle Class Reference

external link search bridge More...

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

Public Member Functions

 addToForm ()
 Add ADT-specific fields to form. More...
 
 setTitleQuery (string $query)
 
 getTitleQuery ()
 
 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 ()
 Is null ? More...
 
 isValid ()
 
 validate ()
 Validate current data. More...
 
- 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...
 
 getSearchColumn ()
 
 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
 
- Data Fields inherited from ilADTSearchBridge
const DEFAULT_SEARCH_COLUMN = 'value'
 

Protected Member Functions

 isValidADTDefinition (\ilADTDefinition $a_adt_def)
 Is valid type. More...
 
- Protected Member Functions inherited from ilADTSearchBridgeSingle
 setDefinition (ilADTDefinition $a_adt_def)
 Set ADT definition. More...
 
- 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...
 

Private Attributes

 $title_query = ''
 

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 ( )

Add ADT-specific fields to form.

Reimplemented from ilADTSearchBridge.

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

35 {
36 $title = new ilTextInputGUI($this->getTitle(), $this->getElementId());
37 $title->setSize(255);
39 }
addToParentElement(ilFormPropertyGUI $a_field)
Add form field to parent element.
getElementId()
Get element id.
This class represents a text property in a property form.

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

+ Here is the call graph for this function:

◆ getSerializedValue()

ilADTInternalLinkSearchBridgeSingle::getSerializedValue ( )

get serialized value

Returns
type

Reimplemented from ilADTSearchBridge.

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

137 {
138 if (!$this->isNull() && $this->isValid()) {
139 return serialize(array($this->getADT()->getTargetRefId()));
140 }
141 }

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

+ Here is the call graph for this function:

◆ 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 99 of file class.ilADTInternalLinkSearchBridgeSingle.php.

100 {
101 $db = $GLOBALS['DIC']->database();
102
103 if (!$a_value) {
104 if ($this->isNull() || !$this->isValid()) {
105 return;
106 }
107 $a_value = $this->getADT()->getTargetRefId();
108 }
109
110 $subselect = $a_element_id . ' IN ' .
111 '( select ref_id from object_reference obr join object_data obd on obr.obj_id = obd.obj_id ' .
112 'where ' . $db->like('title', 'text', $a_value . '%') . ' ' .
113 ')';
114 return $subselect;
115 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64

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

+ Here is the call graph for this function:

◆ getTitleQuery()

ilADTInternalLinkSearchBridgeSingle::getTitleQuery ( )

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

References $title_query.

Referenced by isInCondition().

+ Here is the caller graph for this function:

◆ importFromPost()

ilADTInternalLinkSearchBridgeSingle::importFromPost ( array  $a_post = null)

Import from post.

Parameters
array$a_post

Reimplemented from ilADTSearchBridge.

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

71 {
72 $post = $this->extractPostValues($a_post);
73
74 if ($post && $this->shouldBeImportedFromPost($post)) {
75 if ($this->getForm() instanceof ilPropertyFormGUI) {
76 $item = $this->getForm()->getItemByPostVar($this->getElementId());
77 $item->setValue($post);
78 $this->setTitleQuery($post);
79 $this->getADT()->setTargetRefId(1);
80 } elseif (array_key_exists($this->getElementId(), $this->table_filter_fields)) {
81 $this->table_filter_fields[$this->getElementId()]->setValue($post);
82 $this->writeFilter($post);
83 $this->setTitleQuery($post);
84 $this->getADT()->setTargetRefId(1);
85 }
86 } else {
87 $this->writeFilter();
88 $this->setTitleQuery('');
89 $this->getADT()->setTargetRefId(null);
90 }
91 return true;
92 }
extractPostValues(array $a_post=null)
Extract data from (post) values.
shouldBeImportedFromPost($a_post)
Check if incoming values should be imported at all.
writeFilter($a_value=null)
Write value(s) to filter store (in session)
This class represents a property form user interface.

References ilADTSearchBridge\extractPostValues(), ilADTSearchBridgeSingle\getADT(), ilADTSearchBridge\getElementId(), ilADTSearchBridge\getForm(), setTitleQuery(), ilADTSearchBridge\shouldBeImportedFromPost(), and ilADTSearchBridge\writeFilter().

+ Here is the call graph for this function:

◆ isInCondition()

ilADTInternalLinkSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Is in condition.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADTSearchBridge.

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

123 {
124 if ($this->getADT()->getCopyOfDefinition()->isComparableTo($a_adt)) {
125 $ref_id = $a_adt->getTargetRefId();
127 return strcasecmp($title, $this->getTitleQuery()) === 0;
128 }
129 return false;
130 }
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title

References ilADTSearchBridge\$title, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilADTSearchBridgeSingle\getADT(), and getTitleQuery().

+ Here is the call graph for this function:

◆ isValidADTDefinition()

ilADTInternalLinkSearchBridgeSingle::isValidADTDefinition ( \ilADTDefinition  $a_adt_def)
protected

Is valid type.

Parameters
ilADT$a_adt
Returns
bool

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

◆ loadFilter()

ilADTInternalLinkSearchBridgeSingle::loadFilter ( )

/** Load from filter

Reimplemented from ilADTSearchBridge.

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

58 {
59 $value = $this->readFilter();
60 if ($value !== null) {
61 $this->getADT()->setTargetRefId(1);
62 $this->setTitleQuery($value);
63 }
64 }
readFilter()
Load value(s) from filter store (in session)

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

+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTInternalLinkSearchBridgeSingle::setSerializedValue (   $a_value)

Set serialized value.

Parameters
string$a_value

Reimplemented from ilADTSearchBridge.

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

148 {
149 $a_value = unserialize($a_value);
150 if (is_array($a_value)) {
151 $this->getADT()->setTargetRefId($a_value[0]);
152 }
153 }

References ilADTSearchBridgeSingle\getADT().

+ Here is the call graph for this function:

◆ setTitleQuery()

ilADTInternalLinkSearchBridgeSingle::setTitleQuery ( string  $query)

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

41 : void
42 {
43 $this->title_query = $query;
44 }
$query

References $query.

Referenced by importFromPost(), and loadFilter().

+ Here is the caller graph for this function:

Field Documentation

◆ $title_query

ilADTInternalLinkSearchBridgeSingle::$title_query = ''
private

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

Referenced by getTitleQuery().

◆ 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: