Version 4.7.23
This commit is contained in:
1 parent
7124a02564
commit
25ddeb65d6
1791 files changed
+76990
-44452
No files matched your search
@@ -762,6 +762,19 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
$this->_data['featured_settings'] = ( \is_array( $value ) ? json_encode( $value ) : $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return false|mixed
|
||||
*/
|
||||
public function get_allow_club_categories()
|
||||
{
|
||||
if( \IPS\Settings::i()->clubs )
|
||||
{
|
||||
return $this->_data['allow_club_categories'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the title of the page when using a database
|
||||
@@ -959,8 +972,7 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
$fieldsClass = '\IPS\cms\Fields' . $this->id;
|
||||
|
||||
$class = '\IPS\cms\Categories' . $this->id;
|
||||
foreach( $class::roots( NULL ) as $id => $cat )
|
||||
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'cms_database_categories', array( 'category_database_id=?', $this->id ) ), '\IPS\cms\Categories' . $this->id ) as $cat )
|
||||
{
|
||||
$cat->delete();
|
||||
}
|
||||
@@ -1163,24 +1175,34 @@ class _Databases extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Number of categories
|
||||
*/
|
||||
protected $_numberOfCategories = NULL;
|
||||
|
||||
/**
|
||||
* Get the number of categories in this database
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function numberOfCategories()
|
||||
public function numberOfCategories() : int
|
||||
{
|
||||
if ( $this->_numberOfCategories === NULL )
|
||||
static $count = null;
|
||||
if ( $count === NULL )
|
||||
{
|
||||
$this->_numberOfCategories = \IPS\Db::i()->select( 'count(*)', 'cms_database_categories', array( 'category_database_id=?', $this->_id ) )->first();
|
||||
$count = \IPS\Db::i()->select( 'count(*)', 'cms_database_categories', array( 'category_database_id=?', $this->_id ) )->first();
|
||||
}
|
||||
return $this->_numberOfCategories;
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of categories in this database
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function numberOfClubCategories() : int
|
||||
{
|
||||
static $count = null;
|
||||
if ( $count === NULL )
|
||||
{
|
||||
$count = \IPS\Db::i()->select( 'count(*)', 'cms_database_categories', array( 'category_database_id=? AND category_club_id IS NOT NULL', $this->_id ) )->first();
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user