ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTInternalLinkSearchBridgeSingle Class Reference

external link search bridge More...

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

Public Member Functions

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

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

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

35  {
36  $title = new ilTextInputGUI($this->getTitle(), $this->getElementId());
37  $title->setSize(255);
38  $this->addToParentElement($title);
39  }
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 136 of file class.ilADTInternalLinkSearchBridgeSingle.php.

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

◆ 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

◆ getTitleQuery()

ilADTInternalLinkSearchBridgeSingle::getTitleQuery ( )

◆ importFromPost()

ilADTInternalLinkSearchBridgeSingle::importFromPost ( array  $a_post = null)

Import from post.

Parameters
array$a_post

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  }
This class represents a property form user interface.
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)
getElementId()
Get element id.

◆ isInCondition()

ilADTInternalLinkSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Is in condition.

Parameters
ilADT$a_adt
Returns
bool

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 _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)

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

26  {
27  return $a_adt_def instanceof ilADTInternalLinkDefinition;
28  }

◆ loadFilter()

ilADTInternalLinkSearchBridgeSingle::loadFilter ( )

/** Load from filter

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)

◆ setSerializedValue()

ilADTInternalLinkSearchBridgeSingle::setSerializedValue (   $a_value)

Set serialized value.

Parameters
string$a_value

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  }

◆ setTitleQuery()

ilADTInternalLinkSearchBridgeSingle::setTitleQuery ( string  $query)

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

References $query.

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

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: