Skip to content

Commit

Permalink
ADT: search fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jluetzen-ilias committed Aug 20, 2015
1 parent 3425a31 commit 1d17bd2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@

class ilADTEnumSearchBridgeMulti extends ilADTSearchBridgeMulti
{
protected $multi_source; // [boo]
protected $multi_source; // [bool]
protected $search_mode; // [int]

const SEARCH_MODE_ALL = 1;
const SEARCH_MODE_ANY = 2;

public function setSearchMode($a_mode)
{
$this->search_mode = (int)$a_mode;
}

protected function isValidADTDefinition(ilADTDefinition $a_adt_def)
{
Expand Down Expand Up @@ -107,6 +116,10 @@ public function getSQLCondition($a_element_id)
{
include_once "Services/ADT/classes/Types/MultiEnum/class.ilADTMultiEnumDBBridge.php";

$mode_concat = ($this->search_mode == self::SEARCH_MODE_ANY)
? " OR "
: " AND ";

$parts = array();
foreach($this->getADT()->getSelections() as $item)
{
Expand All @@ -115,7 +128,7 @@ public function getSQLCondition($a_element_id)
ilADTMultiEnumDBBridge::SEPARATOR."%";
$parts[] = $ilDB->like($a_element_id, "text", $item, false);
}
return "(".implode(" AND ", $parts).")";
return "(".implode($mode_concat, $parts).")";
}

return $ilDB->in($a_element_id, $this->getADT()->getSelections(), "", $type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function addToForm()
$number->setMaxLength($length);
}

$number->setValue($this->getADT()->getNumber());

$this->addToParentElement($number);
}

Expand Down

0 comments on commit 1d17bd2

Please sign in to comment.