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

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)
 Get SQL condition for current value(s)
 isInCondition (ilADTMultiEnum $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)

Protected Member Functions

 isValidADTDefinition (ilADTDefinition $a_adt_def)
 Check if given ADT definition is valid.
 convertADTDefinitionToMulti (ilADTDefinition $a_adt_def)
 Convert definition to multi version.
- Protected Member Functions inherited from ilADTSearchBridgeMulti
 setDefinition (ilADTDefinition $a_adt_def)
 Set ADT definition.

Protected Attributes

 $multi_source

Detailed Description

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

Member Function Documentation

ilADTEnumSearchBridgeMulti::addToForm ( )

Add ADT-specific fields to form.

Reimplemented from ilADTSearchBridge.

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

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

{
global $lng;
$def = $this->getADT()->getCopyOfDefinition();
$options = $def->getOptions();
asort($options); // ?
$cbox = new ilCheckboxGroupInputGUI($this->getTitle(), $this->getElementId());
$cbox->setValue($this->getADT()->getSelections());
foreach($options as $value => $caption)
{
$option = new ilCheckboxOption($caption, $value);
$cbox->addOption($option);
}
$this->addToParentElement($cbox);
}

+ Here is the call graph for this function:

ilADTEnumSearchBridgeMulti::convertADTDefinitionToMulti ( ilADTDefinition  $a_adt_def)
protected

Convert definition to multi version.

Returns
ilADTDefinition

Reimplemented from ilADTSearchBridgeMulti.

Definition at line 15 of file class.ilADTEnumSearchBridgeMulti.php.

References ilADTFactory\getInstance(), and ilADTDefinition\getType().

{
if($a_adt_def->getType() == "Enum")
{
$this->multi_source = false;
$def = ilADTFactory::getInstance()->getDefinitionInstanceByType("MultiEnum");
$def->setNumeric($a_adt_def->isNumeric());
$def->setOptions($a_adt_def->getOptions());
return $def;
}
else
{
$this->multi_source = true;
return $a_adt_def;
}
}

+ Here is the call graph for this function:

ilADTEnumSearchBridgeMulti::getSerializedValue ( )

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

Returns
string

Reimplemented from ilADTSearchBridge.

Definition at line 133 of file class.ilADTEnumSearchBridgeMulti.php.

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

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

+ Here is the call graph for this function:

ilADTEnumSearchBridgeMulti::getSQLCondition (   $a_element_id)

Get SQL condition for current value(s)

Parameters
string$a_element_id
Returns
string

Reimplemented from ilADTSearchBridge.

Definition at line 96 of file class.ilADTEnumSearchBridgeMulti.php.

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

Referenced by ilAdvancedMDFieldDefinitionSelectMulti\findBySingleValue().

{
global $ilDB;
if(!$this->isNull() && $this->isValid())
{
$type = ($this->getADT() instanceof ilADTMultiEnumText)
? "text"
: "integer";
if($this->multi_source)
{
include_once "Services/ADT/classes/Types/MultiEnum/class.ilADTMultiEnumDBBridge.php";
$parts = array();
foreach($this->getADT()->getSelections() as $item)
{
$item = "%".ilADTMultiEnumDBBridge::SEPARATOR.
$item.
$parts[] = $ilDB->like($a_element_id, "text", $item, false);
}
return "(".implode(" AND ", $parts).")";
}
return $ilDB->in($a_element_id, $this->getADT()->getSelections(), "", $type);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADTEnumSearchBridgeMulti::importFromPost ( array  $a_post = null)

Import values from (search) form request POST data.

Returns
bool

Reimplemented from ilADTSearchBridge.

Definition at line 65 of file class.ilADTEnumSearchBridgeMulti.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);
}
if(is_array($post))
{
$this->getADT()->setSelections($post);
}
}
else
{
$this->getADT()->setSelections();
}
}

+ Here is the call graph for this function:

ilADTEnumSearchBridgeMulti::isInCondition ( ilADTMultiEnum  $a_adt)

Definition at line 125 of file class.ilADTEnumSearchBridgeMulti.php.

References ilADTSearchBridgeSingle\getADT().

{
return $this->getADT()->equals($a_adt);
}

+ Here is the call graph for this function:

ilADTEnumSearchBridgeMulti::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 9 of file class.ilADTEnumSearchBridgeMulti.php.

{
return ($a_adt_def instanceof ilADTEnumDefinition ||
$a_adt_def instanceof ilADTMultiEnumDefinition);
}
ilADTEnumSearchBridgeMulti::loadFilter ( )

Load filter value(s) into ADT.

Reimplemented from ilADTSearchBridge.

Definition at line 32 of file class.ilADTEnumSearchBridgeMulti.php.

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

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

+ Here is the call graph for this function:

ilADTEnumSearchBridgeMulti::setSerializedValue (   $a_value)

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

Parameters
string

Reimplemented from ilADTSearchBridge.

Definition at line 141 of file class.ilADTEnumSearchBridgeMulti.php.

References ilADTSearchBridgeSingle\getADT().

{
$a_value = unserialize($a_value);
if(is_array($a_value))
{
$this->getADT()->setSelections($a_value);
}
}

+ Here is the call graph for this function:

Field Documentation

ilADTEnumSearchBridgeMulti::$multi_source
protected

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


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