ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
ilADTInternalLinkSearchBridgeSingle Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 setTitleQuery (string $query)
 
 getTitleQuery ()
 
 addToForm ()
 
 loadFilter ()
 Load from filter. More...
 
 importFromPost (array $a_post=null)
 
 getSQLCondition (string $a_element_id, int $mode=self::SQL_LIKE, array $quotedWords=[])
 Get sql condition. More...
 
 isInCondition (ilADT $a_adt)
 Is in condition. More...
 
 getSerializedValue ()
 get serialized value More...
 
 setSerializedValue (string $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)
 
 isNull ()
 
 setForm (ilPropertyFormGUI $a_form)
 
 getForm ()
 
 setElementId (string $a_value)
 
 getElementId ()
 
 setTitle (string $a_value)
 
 getTitle ()
 
 getSearchColumn ()
 
 setTableGUI (ilTable2GUI $a_table)
 
 getTableGUI ()
 Get table gui. More...
 
 loadFilter ()
 Load filter value(s) into ADT. More...
 
 addToForm ()
 Add ADT-specific fields to form. More...
 
 addToFilterForm ()
 Add ADT-specific fields to filter. More...
 
 importFromPost (array $a_post=null)
 
 validate ()
 Validate current data. More...
 
 getSQLCondition (string $a_element_id, int $mode=self::SQL_LIKE, array $quotedWords=[])
 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 (string $a_value)
 Set current value(s) in serialized form (for easy persisting) More...
 

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)
 
 setDefinition (ilADTDefinition $a_adt_def)
 
 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 (string $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

- Data Fields inherited from ilADTSearchBridge
const SQL_STRICT = 1
 
const SQL_LIKE = 2
 
const SQL_LIKE_END = 3
 
const SQL_LIKE_START = 4
 
const DEFAULT_SEARCH_COLUMN = 'value'
 
- Protected Attributes inherited from ilADTSearchBridgeSingle
ilADT $adt
 
- Protected Attributes inherited from ilADTSearchBridge
ilPropertyFormGUI $form = null
 
ilTable2GUI $table_gui = null
 
array $table_filter_fields = []
 
string $id = ''
 
string $title = ''
 
string $info = ''
 
ilLanguage $lng
 
ilDBInterface $db
 
HttpServices $http
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning external link search bridge

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

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

Member Function Documentation

◆ addToForm()

ilADTInternalLinkSearchBridgeSingle::addToForm ( )

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

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

53  : void
54  {
55  $title = new ilTextInputGUI($this->getTitle(), $this->getElementId());
56  $title->setSize(255);
57  $title->setValue($this->getTitleQuery());
58  $this->addToParentElement($title);
59  }
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
string

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

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

145  : string
146  {
147  if (!$this->isNull() && $this->isValid()) {
148  return serialize(array($this->getADT()->getTargetRefId()));
149  }
150  return '';
151  }
+ Here is the call graph for this function:

◆ getSQLCondition()

ilADTInternalLinkSearchBridgeSingle::getSQLCondition ( string  $a_element_id,
int  $mode = self::SQL_LIKE,
array  $quotedWords = [] 
)

Get sql condition.

Parameters
string$a_element_id
int$mode
array$quotedWords
Returns
string

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

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

104  : string
105  {
106  $a_value = '';
107  if (!$quotedWords) {
108  if ($this->isNull() || !$this->isValid()) {
109  return '';
110  }
111  $a_value = $this->getADT()->getTargetRefId();
112  } elseif (count($quotedWords)) {
113  $a_value = $quotedWords[0];
114  }
115  if (!strlen($a_value)) {
116  return '';
117  }
118 
119  $subselect = $a_element_id . ' IN ' .
120  '( select ref_id from object_reference obr join object_data obd on obr.obj_id = obd.obj_id ' .
121  'where ' . $this->db->like('title', 'text', $a_value . '%') . ' ' .
122  ')';
123  return $subselect;
124  }
+ Here is the call graph for this function:

◆ getTitleQuery()

ilADTInternalLinkSearchBridgeSingle::getTitleQuery ( )

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

References $title_query.

Referenced by addToForm(), and isInCondition().

+ Here is the caller graph for this function:

◆ importFromPost()

ilADTInternalLinkSearchBridgeSingle::importFromPost ( array  $a_post = null)

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

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

73  : bool
74  {
75  $post = $this->extractPostValues($a_post);
76 
77  if ($post && $this->shouldBeImportedFromPost($post)) {
78  if ($this->getForm() instanceof ilPropertyFormGUI) {
79  $item = $this->getForm()->getItemByPostVar($this->getElementId());
80  $item->setValue($post);
81  $this->setTitleQuery($post);
82  $this->getADT()->setTargetRefId(1);
83  } elseif (array_key_exists($this->getElementId(), $this->table_filter_fields)) {
84  $this->table_filter_fields[$this->getElementId()]->setValue($post);
85  $this->writeFilter($post);
86  $this->setTitleQuery($post);
87  $this->getADT()->setTargetRefId(1);
88  }
89  } else {
90  $this->writeFilter();
91  $this->setTitleQuery('');
92  $this->getADT()->setTargetRefId(null);
93  }
94  return true;
95  }
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)
$post
Definition: ltitoken.php:47
+ Here is the call graph for this function:

◆ isInCondition()

ilADTInternalLinkSearchBridgeSingle::isInCondition ( ilADT  $a_adt)

Is in condition.

Parameters
ilADT$a_adt
Returns
bool

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

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

131  : bool
132  {
133  if ($this->getADT()->getCopyOfDefinition()->isComparableTo($a_adt)) {
134  $ref_id = $a_adt->getTargetRefId();
136  return strcasecmp($title, $this->getTitleQuery()) === 0;
137  }
138  return false;
139  }
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:65
static _lookupTitle(int $obj_id)
+ 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 35 of file class.ilADTInternalLinkSearchBridgeSingle.php.

35  : bool
36  {
37  return $a_adt_def instanceof ilADTInternalLinkDefinition;
38  }

◆ loadFilter()

ilADTInternalLinkSearchBridgeSingle::loadFilter ( )

Load from filter.

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

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

64  : void
65  {
66  $value = $this->readFilter();
67  if ($value !== null && $value !== '') {
68  $this->getADT()->setTargetRefId(1);
69  $this->setTitleQuery($value);
70  }
71  }
readFilter()
Load value(s) from filter store (in session)
+ Here is the call graph for this function:

◆ setSerializedValue()

ilADTInternalLinkSearchBridgeSingle::setSerializedValue ( string  $a_value)

Set serialized value.

Parameters
string$a_value

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

References ilADTSearchBridgeSingle\getADT().

157  : void
158  {
159  $a_value = unserialize($a_value);
160  if (is_array($a_value)) {
161  $this->getADT()->setTargetRefId($a_value[0]);
162  }
163  }
+ Here is the call graph for this function:

◆ setTitleQuery()

ilADTInternalLinkSearchBridgeSingle::setTitleQuery ( string  $query)

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

Referenced by importFromPost(), and loadFilter().

40  : void
41  {
42  $this->title_query = $query;
43  }
+ Here is the caller graph for this function:

Field Documentation

◆ $title_query

ilADTInternalLinkSearchBridgeSingle::$title_query = ''
private

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

Referenced by getTitleQuery().


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