Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

+84 -18
View File
@@ -244,6 +244,16 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
return $this->count_comments;
}
/**
* [Node] Get number of content reviews
*
* @return int
*/
protected function get__reviews()
{
return $this->count_reviews;
}
/**
* [Node] Get number of unapproved content items
*
@@ -253,6 +263,16 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
{
return $this->count_imgs_hidden;
}
/**
* [Node] Get number of unapproved content reviews
*
* @return int
*/
protected function get__unapprovedReviews()
{
return $this->count_reviews_hidden;
}
/**
* [Node] Get number of unapproved content comments
@@ -288,7 +308,7 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
/**
* Set number of items
*
* @param int $val Comments
* @param int $val Comments
* @return void
*/
protected function set__comments( $val )
@@ -296,6 +316,17 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$this->count_comments = (int) $val;
}
/**
* Set number of items
*
* @param int $val Reviews
* @return void
*/
protected function set__reviews( $val )
{
$this->count_reviews = (int) $val;
}
/**
* [Node] Get number of unapproved content items
*
@@ -317,6 +348,17 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
{
$this->count_comments_hidden = $val;
}
/**
* [Node] Get number of unapproved content reviews
*
* @param int $val Unapproved Reviews
* @return void
*/
protected function set__unapprovedReviews( $val )
{
$this->count_reviews_hidden = $val;
}
/**
* [Node] Add/Edit Form
@@ -345,8 +387,9 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$return = array();
$return[] = new \IPS\Helpers\Form\Text( 'album_name', $album ? $album->name : '', $required ?: NULL );
$return[] = new \IPS\Helpers\Form\Editor( 'album_description', $album ? $album->description : '', FALSE, array( 'app' => 'gallery', 'key' => 'Albums', 'autoSaveKey' => ( $album ? "gallery_album_{$album->id}_desc" : "gallery-new-album" ), 'attachIds' => $album ? array( $album->id, NULL, 'description' ) : NULL, 'minimize' => 'cdesc_placeholder' ) );
$return[] = new \IPS\Helpers\Form\Editor( 'album_description', $album ? $album->description : '', FALSE, array( 'app' => 'gallery', 'key' => 'Albums', 'autoSaveKey' => ( $album ? "gallery_album_{$album->id}_desc" : "gallery-new-album" ), 'attachIds' => $album ? array( $album->id, NULL, 'description' ) : NULL, 'minimize' => 'cdesc_placeholder' ) );
$return[] = new \IPS\Helpers\Form\Node( 'album_category', ( $album and $album->category_id ) ? \IPS\gallery\Category::load( $album->category_id ) : NULL, $required ?: NULL, array(
'class' => 'IPS\gallery\Category',
'disabled' => false,
@@ -395,11 +438,12 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
{
$return[] = new \IPS\Helpers\Form\SocialGroup( 'album_allowed_access', $album ? $album->allowed_access : NULL, FALSE, array( 'owner' => $album ? \IPS\Member::load( $album->owner_id ) : ( \IPS\Request::i()->album_owner ? \IPS\Member::load( \IPS\Request::i()->album_owner, 'name' ) : \IPS\Member::loggedIn() ) ), NULL, NULL, NULL, 'album_allowed_access' );
}
$return[] = new \IPS\Helpers\Form\Select( 'album_sort_options', ( $album and $album->sort_options ) ? $album->sort_options : 'updated', FALSE, array( 'options' => array( 'updated' => 'sort_updated', 'rating' => 'sort_rating', 'num_comments' => 'sort_num_comments' ) ), NULL, NULL, NULL, 'album_sort_options' );
$return[] = new \IPS\Helpers\Form\Select( 'album_sort_options', ( $album and $album->sort_options ) ? $album->sort_options : 'updated', FALSE, array( 'options' => array( 'updated' => 'sort_updated', 'last_comment' => 'sort_last_comment', 'title' => 'sort_title', 'rating' => 'sort_rating', 'date' => 'sort_date', 'num_comments' => 'sort_num_comments', 'num_reviews' => 'sort_num_reviews', 'views' => 'sort_views' ) ), NULL, NULL, NULL, 'album_sort_options' );
$return[] = new \IPS\Helpers\Form\YesNo( 'album_allow_comments', $album ? $album->allow_comments : TRUE, FALSE );
$return[] = new \IPS\Helpers\Form\YesNo( 'album_allow_rating', $album ? $album->allow_rating : TRUE, FALSE );
$return[] = new \IPS\Helpers\Form\YesNo( 'album_allow_reviews', $album ? $album->allow_reviews : TRUE, FALSE );
return $return;
}
@@ -480,6 +524,10 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$values['owner_id'] = ( $values['album_owner'] instanceof \IPS\Member ) ? $values['album_owner']->member_id : $values['album_owner'];
unset( $values['album_owner'] );
}
else
{
$values['owner_id'] = \IPS\Member::loggedIn()->member_id;
}
/* Send to parent */
return $values;
@@ -571,21 +619,21 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
* @brief Cached URL
*/
protected $_url = NULL;
/**
* Get URL
*
* @return \IPS\Http\Url
* @brief URL Base
*/
public function url()
{
if( $this->_url === NULL )
{
$this->_url = \IPS\Http\Url::internal( "app=gallery&module=gallery&controller=browse&album={$this->_id}", 'front', 'gallery_album', $this->name_seo );
}
return $this->_url;
}
public static $urlBase = 'app=gallery&module=gallery&controller=browse&album=';
/**
* @brief URL Base
*/
public static $urlTemplate = 'gallery_album';
/**
* @brief SEO Title Column
*/
public static $seoTitleColumn = 'name_seo';
/**
* Get latest image information
@@ -621,6 +669,18 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$this->setLastImage();
}
/**
* Set last review
*
* @param \IPS\Content\Review|NULL $review The latest review or NULL to work it out
* @return int
* @note We actually want to set the last image info, not the last review, so we ignore $review
*/
public function setLastReview( \IPS\Content\Review $review=NULL )
{
$this->setLastImage();
}
/**
* Set last image data
*
@@ -632,7 +692,9 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
{
/* Figure out our latest images in this album */
$_latestImages = array();
$this->last_img_date = 0;
$this->last_img_id = 0;
foreach( \IPS\Db::i()->select( '*', 'gallery_images', array( 'image_album_id=? AND image_approved=1', $this->id ), 'image_date DESC', array( 0, 20 ) ) as $image )
{
if( $image['image_date'] > $this->last_img_date )
@@ -652,6 +714,10 @@ class _Album extends \IPS\Node\Model implements \IPS\Node\Ratings, \IPS\Content\
$this->_comments = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_comments', array( 'gallery_images.image_album_id=? AND comment_approved=1', $this->id ) )->join( 'gallery_images', 'image_id=comment_img_id' )->first();
$this->_unapprovedComments = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_comments', array( 'gallery_images.image_album_id=? AND comment_approved=0', $this->id ) )->join( 'gallery_images', 'image_id=comment_img_id' )->first();
$this->_reviews = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_reviews', array( 'gallery_images.image_album_id=? AND review_approved=1', $this->id ) )->join( 'gallery_images', 'image_id=review_image_id' )->first();
$this->_unapprovedReviews = \IPS\Db::i()->select( 'COUNT(*) as total', 'gallery_reviews', array( 'gallery_images.image_album_id=? AND review_approved=0', $this->id ) )->join( 'gallery_images', 'image_id=review_image_id' )->first();
$this->save();
}