ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTTextSearchBridgeSingle Class Reference
+ Inheritance diagram for ilADTTextSearchBridgeSingle:
+ Collaboration diagram for ilADTTextSearchBridgeSingle:

Public Member Functions

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

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

Additional Inherited Members

- Protected Attributes inherited from ilADTSearchBridgeSingle
 $adt

Detailed Description

Definition at line 5 of file class.ilADTTextSearchBridgeSingle.php.

Member Function Documentation

ilADTTextSearchBridgeSingle::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTSearchBridge.

Definition at line 31 of file class.ilADTTextSearchBridgeSingle.php.

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

{
$text = new ilTextInputGUI($this->getTitle(), $this->getElementId());
$text->setSize(20);
$text->setMaxLength(512);
$text->setSubmitFormOnEnter(true);
$text->setValue($this->getADT()->getText());
$this->addToParentElement($text);
}

+ Here is the call graph for this function:

ilADTTextSearchBridgeSingle::getSerializedValue ( )

Get current value(s) in serialized form (for easy persisting)

Returns
string

Reimplemented from ilADTSearchBridge.

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

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

{
if(!$this->isNull() && $this->isValid())
{
return serialize(array($this->getADT()->getText()));
}
}

+ Here is the call graph for this function:

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

Definition at line 72 of file class.ilADTTextSearchBridgeSingle.php.

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

{
global $ilDB;
if(!$a_value)
{
if($this->isNull() || !$this->isValid())
{
return;
}
$a_value = $this->getADT()->getText();
}
switch($a_mode)
{
case self::SQL_STRICT:
if(!is_array($a_value))
{
return $a_element_id." = ".$ilDB->quote($a_value, "text");
}
else
{
return $ilDB->in($a_element_id, $a_value, "", "text");
}
break;
case self::SQL_LIKE:
if(!is_array($a_value))
{
return $ilDB->like($a_element_id, "text", "%".$a_value."%");
}
else
{
$tmp = array();
foreach($a_value as $word)
{
if($word)
{
$tmp[] = $ilDB->like($a_element_id, "text", "%".$word."%");
}
}
if(sizeof($tmp))
{
return "(".implode(" OR ", $tmp).")";
}
}
break;
case self::SQL_LIKE_END:
if(!is_array($a_value))
{
return $ilDB->like($a_element_id, "text", $a_value."%");
}
break;
case self::SQL_LIKE_START:
if(!is_array($a_value))
{
return $ilDB->like($a_element_id, "text", "%".$a_value);
}
break;
}
}

+ Here is the call graph for this function:

ilADTTextSearchBridgeSingle::importFromPost ( array  $a_post = null)

Import values from (search) form request POST data.

Returns
bool

Reimplemented from ilADTSearchBridge.

Definition at line 43 of file class.ilADTTextSearchBridgeSingle.php.

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

{
$post = $this->extractPostValues($a_post);
if($post && $this->shouldBeImportedFromPost($post))
{
if($this->getForm() instanceof ilPropertyFormGUI)
{
$item = $this->getForm()->getItemByPostVar($this->getElementId());
$item->setValue($post);
}
else if(array_key_exists($this->getElementId(), $this->table_filter_fields))
{
$this->table_filter_fields[$this->getElementId()]->setValue($post);
$this->writeFilter($post);
}
$this->getADT()->setText($post);
}
else
{
$this->writeFilter();
$this->getADT()->setText();
}
}

+ Here is the call graph for this function:

ilADTTextSearchBridgeSingle::isInCondition ( ilADTText  $a_adt)

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

References ilADTSearchBridgeSingle\getADT().

{
// :TODO: search mode (see above)
return $this->getADT()->equals($a_adt);
}

+ Here is the call graph for this function:

ilADTTextSearchBridgeSingle::isValidADTDefinition ( ilADTDefinition  $a_adt_def)
protected

Check if given ADT definition is valid.

:TODO: This could be avoided with type-specifc constructors :TODO: bridge base class?

Parameters
ilADTDefinition$a_adt_def

Reimplemented from ilADTSearchBridge.

Definition at line 12 of file class.ilADTTextSearchBridgeSingle.php.

{
return ($a_adt_def instanceof ilADTTextDefinition);
}
ilADTTextSearchBridgeSingle::loadFilter ( )

Load filter value(s) into ADT.

Reimplemented from ilADTSearchBridge.

Definition at line 19 of file class.ilADTTextSearchBridgeSingle.php.

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

{
$value = $this->readFilter();
if($value !== null)
{
$this->getADT()->setText($value);
}
}

+ Here is the call graph for this function:

ilADTTextSearchBridgeSingle::setSerializedValue (   $a_value)

Set current value(s) in serialized form (for easy persisting)

Parameters
string

Reimplemented from ilADTSearchBridge.

Definition at line 153 of file class.ilADTTextSearchBridgeSingle.php.

References ilADTSearchBridgeSingle\getADT().

{
$a_value = unserialize($a_value);
if(is_array($a_value))
{
$this->getADT()->setText($a_value[0]);
}
}

+ Here is the call graph for this function:

Field Documentation

const ilADTTextSearchBridgeSingle::SQL_LIKE = 2
const ilADTTextSearchBridgeSingle::SQL_LIKE_END = 3

Definition at line 9 of file class.ilADTTextSearchBridgeSingle.php.

const ilADTTextSearchBridgeSingle::SQL_LIKE_START = 4

Definition at line 10 of file class.ilADTTextSearchBridgeSingle.php.

const ilADTTextSearchBridgeSingle::SQL_STRICT = 1

Definition at line 7 of file class.ilADTTextSearchBridgeSingle.php.


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