Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -22,7 +22,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
/**
|
||||
* Ajax only methods
|
||||
*/
|
||||
class _ajax extends \IPS\Content\Controller
|
||||
class _ajax extends \IPS\Dispatcher\Controller
|
||||
{
|
||||
/**
|
||||
* Return a FURL
|
||||
@@ -33,5 +33,42 @@ class _ajax extends \IPS\Content\Controller
|
||||
{
|
||||
return \IPS\Output::i()->json( array( 'slug' => \IPS\Http\Url::seoTitle( \IPS\Request::i()->slug ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Record
|
||||
*
|
||||
* @retun void
|
||||
*/
|
||||
public function findRecord()
|
||||
{
|
||||
$results = array();
|
||||
$database = \IPS\cms\Databases::load( \IPS\Request::i()->id );
|
||||
$input = mb_strtolower( \IPS\Request::i()->input );
|
||||
$field = "field_" . $database->field_title;
|
||||
$class = '\IPS\cms\Records' . $database->id;
|
||||
$category = '';
|
||||
|
||||
$where = array( $field . " LIKE CONCAT('%', ?, '%')" );
|
||||
$binds = array( $input );
|
||||
|
||||
foreach ( \IPS\Db::i()->select( '*', 'cms_custom_database_' . $database->id, array_merge( array( implode( ' OR ', $where ) ), $binds ), 'LENGTH(' . $field . ') ASC', array( 0, 20 ) ) as $row )
|
||||
{
|
||||
$record = $class::constructFromData( $row );
|
||||
|
||||
if ( $database->use_categories )
|
||||
{
|
||||
$category = \IPS\Member::loggedIn()->language()->addToStack( 'cms_autocomplete_category', NULL, array( 'sprintf' => array( $record->container()->_title ) ) );
|
||||
}
|
||||
|
||||
$results[] = array(
|
||||
'id' => $record->_id,
|
||||
'value' => $record->_title,
|
||||
'category' => $category,
|
||||
'date' => \IPS\DateTime::ts( $record->record_publish_date )->html(),
|
||||
);
|
||||
}
|
||||
|
||||
\IPS\Output::i()->json( $results );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user