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 Table 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 18 Feb 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -28,7 +28,8 @@ const SEARCH_NUMERIC = 6;
|
||||
const SEARCH_BOOL = 7;
|
||||
const HEADER = 8;
|
||||
const SEARCH_RADIO = 9;
|
||||
|
||||
const SEARCH_NUMERIC_TEXT = 10;
|
||||
const SEARCH_QUERY_TEXT = 11;
|
||||
/**
|
||||
* List Table Builder
|
||||
*/
|
||||
@@ -306,6 +307,28 @@ abstract class _Table
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the column without a table prefix
|
||||
* For example, we might allow array( 'last_post', 'author' ) but the $this->sortBy property is often set as "app_table.last_post" meaning
|
||||
* that the filter drop down doesn't show the selected value correctly.
|
||||
*
|
||||
* @param string $property Property we are updating
|
||||
* @param mixed $value Value being set
|
||||
* @return void
|
||||
*/
|
||||
public function getSortByColumn()
|
||||
{
|
||||
if ( mb_strpos( $this->sortBy, '.' ) )
|
||||
{
|
||||
list( $table, $column ) = explode( '.', $this->sortBy );
|
||||
return $column;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->sortBy;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Advanced Search Form
|
||||
*
|
||||
@@ -337,6 +360,21 @@ abstract class _Table
|
||||
$form->add( new \IPS\Helpers\Form\Text( $this->langPrefix . $k, NULL, FALSE, $options ) );
|
||||
break;
|
||||
|
||||
case SEARCH_QUERY_TEXT:
|
||||
$form->add( new \IPS\Helpers\Form\Custom( $this->langPrefix . $k, NULL, FALSE, array(
|
||||
'getHtml' => function( $element )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core' )->select( "{$element->name}[0]", $element->value[0], $element->required, array(
|
||||
'c' => \IPS\Member::loggedIn()->language()->addToStack('contains'),
|
||||
'bw' => \IPS\Member::loggedIn()->language()->addToStack('begins_with'),
|
||||
'eq' => \IPS\Member::loggedIn()->language()->addToStack('exactly'),
|
||||
) )
|
||||
. ' '
|
||||
. \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->text( "{$element->name}[1]", 'text', $element->value[1], $element->required, NULL, FALSE, NULL, NULL, NULL, '', NULL, FALSE, NULL, array(), array(), array( $element->name . '-qty' ) );
|
||||
}
|
||||
) ) );
|
||||
break;
|
||||
|
||||
case SEARCH_DATE_RANGE:
|
||||
$form->add( new \IPS\Helpers\Form\DateRange( $this->langPrefix . $k, array( 'start' => '', 'end' => '' ), FALSE, $options ) );
|
||||
break;
|
||||
@@ -358,6 +396,7 @@ abstract class _Table
|
||||
break;
|
||||
|
||||
case SEARCH_NUMERIC:
|
||||
case SEARCH_NUMERIC_TEXT:
|
||||
$form->add( new \IPS\Helpers\Form\Custom( $this->langPrefix . $k, NULL, FALSE, array(
|
||||
'getHtml' => function( $element )
|
||||
{
|
||||
@@ -411,6 +450,9 @@ abstract class _Table
|
||||
/* Are we displaying the advanced search form? */
|
||||
if ( \IPS\Request::i()->advancedSearchForm )
|
||||
{
|
||||
/* If we are showing just the advanced search form, send a noindex meta tag */
|
||||
\IPS\Output::i()->metaTags['robots'] = 'noindex';
|
||||
|
||||
return (string) $this->advancedSearch();
|
||||
}
|
||||
/* No? Try getting some values then */
|
||||
@@ -422,7 +464,7 @@ abstract class _Table
|
||||
|
||||
/* Get rows */
|
||||
$rows = $this->getRows( $advancedSearchValues );
|
||||
|
||||
|
||||
/* Check we're on a valid page (must come after getRows() as this is where $this->pages is set) */
|
||||
if ( $this->page )
|
||||
{
|
||||
@@ -435,9 +477,15 @@ abstract class _Table
|
||||
/* Add link tags */
|
||||
if ( $this->page != 1 )
|
||||
{
|
||||
\IPS\Output::i()->linkTags['canonical'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, $this->page );
|
||||
\IPS\Output::i()->linkTags['first'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, 1 );
|
||||
\IPS\Output::i()->linkTags['prev'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, $this->page - 1 );
|
||||
}
|
||||
/* If we literally requested ?page=1 add canonical tag to get rid of the page query string param */
|
||||
elseif( isset( $this->baseUrl->data[ \IPS\Http\Url::COMPONENT_QUERY ][ $this->paginationKey ] ) )
|
||||
{
|
||||
\IPS\Output::i()->linkTags['canonical'] = (string) $this->baseUrl->stripQueryString( $this->paginationKey );
|
||||
}
|
||||
if ( $this->pages > $this->page )
|
||||
{
|
||||
\IPS\Output::i()->linkTags['next'] = (string) $this->baseUrl->setQueryString( $this->paginationKey, $this->page + 1 );
|
||||
@@ -476,6 +524,10 @@ abstract class _Table
|
||||
{
|
||||
\IPS\IPS::exceptionHandler( $e );
|
||||
}
|
||||
catch ( \Throwable $e )
|
||||
{
|
||||
\IPS\IPS::exceptionHandler( $e );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -558,7 +610,16 @@ abstract class _Table
|
||||
{
|
||||
if( !empty( $advancedSearchValues ) )
|
||||
{
|
||||
$headers = array_combine( array_merge( $this->include, array_keys( $advancedSearchValues ) ), array_merge( $this->include, array_keys( $advancedSearchValues ) ) );
|
||||
$headers = array_combine( $this->include, $this->include );
|
||||
|
||||
foreach ( $this->getRows( $advancedSearchValues ) as $row )
|
||||
{
|
||||
foreach ( array_keys( $row ) as $header )
|
||||
{
|
||||
$headers[ $header ] = $header;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -589,7 +650,7 @@ abstract class _Table
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the advanced search values
|
||||
*
|
||||
@@ -623,7 +684,7 @@ abstract class _Table
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $v )
|
||||
if ( $v !== NULL )
|
||||
{
|
||||
if( \IPS\Request::i()->isAjax() )
|
||||
{
|
||||
@@ -638,7 +699,10 @@ abstract class _Table
|
||||
}
|
||||
else
|
||||
{
|
||||
$v = urldecode( $v );
|
||||
if ( ! is_object( $v ) )
|
||||
{
|
||||
$v = urldecode( $v );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user