Exemplo n.º 1
0
 /**
  * Get user's new comment counts
  *
  * @return  array
  */
 public function find_new_comments()
 {
     $new = array();
     // Profile comments
     if ($this->new_comment_count) {
         $new['new-comments'] = HTML::anchor(URL::user($this), __(':comments', array(':comments' => '<div></div><var>' . $this->new_comment_count . '</var>')), array('title' => __('New comments')));
     }
     // Blog comments
     $blog_comments = Model_Blog_Entry::find_new_comments($this);
     if (count($blog_comments)) {
         $new_comments = 0;
         foreach ($blog_comments as $blog_entry) {
             $new_comments += $blog_entry->new_comment_count;
         }
         $new['new-blog-comments'] = HTML::anchor(Route::model($blog_entry), __(':comments', array(':comments' => '<div></div><var>' . $new_comments . '</var>')), array('title' => __('New blog comments')));
     }
     unset($blog_comments);
     // Forum quotes
     $forum_quotes = Model_Forum_Quote::find_by_user($this);
     if (count($forum_quotes)) {
         $new_quotes = count($forum_quotes);
         $quote = $forum_quotes->current();
         $new['new-forum-quotes'] = HTML::anchor(Route::get('forum_post')->uri(array('topic_id' => Route::model_id($quote->topic), 'id' => $quote->post->id)) . '#post-' . $quote->post->id, __(':quotes', array(':quotes' => '<div></div><var>' . $new_quotes . '</var>')), array('title' => __('Forum quotes')));
     }
     // Images waiting for approval
     if (Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE_WAITING, $this)) {
         $gallery_approvals = Model_Gallery::find_pending(Permission::has(new Model_Gallery(), Model_Gallery::PERMISSION_APPROVE, $this) ? null : $this);
         if (count($gallery_approvals)) {
             $new_approvals = count($gallery_approvals);
             $new['new-gallery-approvals'] = HTML::anchor(Route::get('galleries')->uri(array('action' => 'approval')), __(':galleries', array(':galleries' => '<div></div><var>' . $new_approvals . '</var>')), array('title' => __('Galleries waiting for approval')));
         }
     }
     // Image comments
     $image_comments = Model_Image::find_new_comments($this);
     if (count($image_comments)) {
         $new_comments = 0;
         foreach ($image_comments as $image) {
             $new_comments += $image->new_comment_count;
         }
         $new['new-image-comments'] = HTML::anchor(Route::get('gallery_image')->uri(array('gallery_id' => Route::model_id(Model_Gallery::find_by_image($image->id)), 'id' => $image->id, 'action' => '')), __(':comments', array(':comments' => '<div></div><var>' . $new_comments . '</var>')), array('title' => __('New image comments')));
     }
     unset($image_comments);
     // Private messages
     return $new;
 }