Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -198,19 +198,32 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
parent::set__enabled( $enabled );
|
||||
|
||||
if ( $enabled )
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->massUpdate( static::$contentItemClass, $this->_id, NULL, $this->searchIndexPermissions() );
|
||||
}
|
||||
else
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->massUpdate( static::$contentItemClass, $this->_id, NULL, '' );
|
||||
}
|
||||
static::updateSearchIndexOnEnableDisable( $this, (bool) $enabled );
|
||||
|
||||
/* Trash widgets so files in this category are not viewable in widgets */
|
||||
\IPS\Widget::deleteCaches( NULL, 'downloads' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the search index on enable / disable of a category
|
||||
*
|
||||
* @param \IPS\downloads\Category $node The Category
|
||||
* @param bool $enabled Enabled / Disable
|
||||
* @return void
|
||||
*/
|
||||
protected static function updateSearchIndexOnEnableDisable( \IPS\downloads\Category $node, $enabled )
|
||||
{
|
||||
\IPS\Content\Search\Index::i()->massUpdate( static::$contentItemClass, $node->_id, NULL, ( $enabled ) ? $node->searchIndexPermissions() : '' );
|
||||
|
||||
if ( $node->hasChildren( NULL ) )
|
||||
{
|
||||
foreach( $node->children( NULL ) AS $child )
|
||||
{
|
||||
static::updateSearchIndexOnEnableDisable( $child, $enabled );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [Node] Add/Edit Form
|
||||
*
|
||||
@@ -565,10 +578,11 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
*
|
||||
* @param mixed $permission A key which has a value in static::$permissionMap['view'] matching a column ID in core_permission_index
|
||||
* @param \IPS\Member|\IPS\Member\Group|NULL $member The member or group to check (NULL for currently logged in member)
|
||||
* @param array $where Additional WHERE clause
|
||||
* @return bool
|
||||
* @throws \OutOfBoundsException If $permission does not exist in static::$permissionMap
|
||||
*/
|
||||
public static function canOnAny( $permission, $member=NULL )
|
||||
public static function canOnAny( $permission, $member=NULL, $where = array() )
|
||||
{
|
||||
$member = ( $member === NULL ) ? \IPS\Member::loggedIn() : $member;
|
||||
|
||||
@@ -577,7 +591,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::canOnAny( $permission, $member );
|
||||
return parent::canOnAny( $permission, $member, $where );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -678,7 +692,7 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
try
|
||||
{
|
||||
$file = \IPS\downloads\File::constructFromData( \IPS\Db::i()->select( '*', 'downloads_files', array( 'file_cat=? AND file_open=1', $this->id ), 'file_submitted DESC', 1 )->first() );
|
||||
$file = \IPS\downloads\File::constructFromData( \IPS\Db::i()->select( '*', 'downloads_files', array( 'file_cat=? AND file_open=1', $this->id ), 'file_submitted DESC', 1, NULL, NULL, \IPS\Db::SELECT_FROM_WRITE_SERVER )->first() );
|
||||
}
|
||||
catch ( \UnderflowException $e )
|
||||
{
|
||||
@@ -777,5 +791,21 @@ class _Category extends \IPS\Node\Model implements \IPS\Node\Permissions
|
||||
{
|
||||
$this->name_furl = \IPS\Http\Url\Friendly::seoTitle( $values['club_node_name'] );
|
||||
}
|
||||
|
||||
if ( !$this->_id )
|
||||
{
|
||||
$this->save();
|
||||
\IPS\File::claimAttachments( 'downloads-new-cat', $this->id, NULL, 'description' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Files in clubs the member can view
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function filesInClubNodes()
|
||||
{
|
||||
return \IPS\downloads\File::getItemsWithPermission( array( array( static::$databasePrefix . static::clubIdColumn() . ' IS NOT NULL' ) ), NULL, 1, 'read', \IPS\Content\Hideable::FILTER_AUTOMATIC, 0, NULL, TRUE, FALSE, FALSE, TRUE );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user