Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Item selector for Form Builder
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 12 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -82,12 +82,12 @@ class _Item extends FormAbstract
|
||||
{
|
||||
$results = array();
|
||||
$class = $this->options['class'];
|
||||
$field = $class::$databasePrefix . $class::$databaseColumnMap['title'];
|
||||
$field = $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['title'];
|
||||
$where = array( array( $field . " LIKE CONCAT('%', ?, '%')", \IPS\Request::i()->q ) );
|
||||
$idField = $class::$databaseColumnId;
|
||||
if ( isset( $class::$databaseColumnMap['container'] ) and is_array( $this->options['containerIds'] ) and count( $this->options['containerIds'] ) )
|
||||
{
|
||||
$where[] = array( \IPS\Db::i()->in( $class::$databasePrefix . $class::$databaseColumnMap['container'], $this->options['containerIds'] ) );
|
||||
$where[] = array( \IPS\Db::i()->in( $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['container'], $this->options['containerIds'] ) );
|
||||
}
|
||||
|
||||
if ( isset( $this->options['where'] ) and count( $this->options['where'] ) )
|
||||
@@ -130,14 +130,14 @@ class _Item extends FormAbstract
|
||||
/**
|
||||
* Format Value
|
||||
*
|
||||
* @return \IPS\Node\Model|array|NULL
|
||||
* @return array|NULL
|
||||
*/
|
||||
public function formatValue()
|
||||
{
|
||||
$itemClass = $this->options['class'];
|
||||
$order = NULL;
|
||||
$items = array();
|
||||
|
||||
$idField = $itemClass::$databaseColumnId;
|
||||
if ( ! $this->value )
|
||||
{
|
||||
$this->value = array();
|
||||
@@ -157,10 +157,10 @@ class _Item extends FormAbstract
|
||||
}
|
||||
}
|
||||
|
||||
$where = array( \IPS\Db::i()->in( $itemClass::$databaseColumnId, $this->value ) );
|
||||
$where = array( \IPS\Db::i()->in( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnId, $this->value ) );
|
||||
foreach( $itemClass::getItemsWithPermission( array( $where ), $order, NULL, $this->options['permissionCheck'] ) as $item )
|
||||
{
|
||||
$items[ $item->_id ] = $item;
|
||||
$items[ $item->$idField ] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,4 +187,19 @@ class _Item extends FormAbstract
|
||||
}
|
||||
return (string) $value;
|
||||
}
|
||||
/**
|
||||
* Validate
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return TRUE
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
if( empty( $this->value ) and $this->required )
|
||||
{
|
||||
throw new \InvalidArgumentException('form_required');
|
||||
}
|
||||
|
||||
parent::validate();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user