Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

@@ -252,4 +252,75 @@ class _Category extends \IPS\Node\Model
return $return;
}
/**
* Retrieve the content item count
*
* @param null|array $data Data array for mass move/delete
* @return null|int
*/
public function getContentItemCount( $data=NULL )
{
if ( !isset( static::$contentItemClass ) )
{
return false;
}
$contentItemClass = static::$contentItemClass;
$idColumn = static::$databaseColumnId;
$where = array( array( 'blog_blogs.blog_category_id=?', $this->$idColumn ) );
if( $data )
{
$where = array_merge_recursive( $where, $this->massMoveorDeleteWhere( $data ) );
}
$select = \IPS\Db::i()->select( 'COUNT(*)', $contentItemClass::$databaseTable, $where )->join( 'blog_blogs', "blog_entries.entry_blog_id=blog_blogs.blog_id" );
return (int) $select->first();
}
/**
* Retrieve content items (if applicable) for a node.
*
* @param int $limit The limit
* @param int $offset The offset
* @param array $additional Where Additional where clauses
* @param int $countOnly If TRUE, will get the number of results
* @return \IPS\Patterns\ActiveRecordIterator|int
* @throws \BadMethodCallException
*/
public function getContentItems( $limit, $offset, $additionalWhere = array(), $countOnly=FALSE )
{
if ( !isset( static::$contentItemClass ) )
{
throw new \BadMethodCallException;
}
$contentItemClass = static::$contentItemClass;
$where = array();
$where[] = array( 'blog_blogs.blog_category_id=?', $this->_id );
if ( \count( $additionalWhere ) )
{
foreach( $additionalWhere AS $clause )
{
$where[] = $clause;
}
}
if ( $countOnly )
{
return \IPS\Db::i()->select( 'COUNT(*)', $contentItemClass::$databaseTable, $where )->join( 'blog_blogs', "blog_entries.entry_blog_id=blog_blogs.blog_id" )->first();
}
else
{
$contentItemClass = static::$contentItemClass;
$limit = ( $offset !== NULL ) ? array( $offset, $limit ) : NULL;
return new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', $contentItemClass::$databaseTable, $where, $contentItemClass::$databasePrefix . $contentItemClass::$databaseColumnId, $limit )->join( 'blog_blogs', "blog_entries.entry_blog_id=blog_blogs.blog_id" ), $contentItemClass );
}
}
}