Dotclear


Ignore:
Timestamp:
04/12/16 13:43:19 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add counters on posts and comments list admin pages, closes #2184

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.pager.php

    r3118 r3239  
    175175 
    176176               if( $filter ) { 
    177                     $html_block .= '<caption>'.sprintf(__('List of %s entries match the filter.'), $this->rs_count).'</caption>'; 
     177                    $html_block .= '<caption>'.sprintf(__('List of %s entries matching the filter.'), $this->rs_count).'</caption>'; 
    178178               } else { 
    179                     $html_block .= '<caption class="hidden">'.__('Entries list').'</caption>'; 
     179                    $nb_published = $this->core->blog->getPosts(array('post_status' => 1),true)->f(0); 
     180                    $nb_pending = $this->core->blog->getPosts(array('post_status' => -2),true)->f(0); 
     181                    $nb_programmed = $this->core->blog->getPosts(array('post_status' => -1),true)->f(0); 
     182                    $nb_unpublished = $this->core->blog->getPosts(array('post_status' => 0),true)->f(0); 
     183                    $html_block .= '<caption>'. 
     184                         sprintf(__('List of entries (%s)'),$this->rs_count). 
     185                         ($nb_published ? 
     186                              sprintf( 
     187                              __(', <a href="%s">published</a> (1)',', <a href="%s">published</a> (%s)',$nb_published), 
     188                              $this->core->adminurl->get('admin.posts',array('status' => 1)), 
     189                              $nb_published) : ''). 
     190                         ($nb_pending ? 
     191                              sprintf( 
     192                              __(', <a href="%s">pending</a> (1)',', <a href="%s">pending</a> (%s)',$nb_pending), 
     193                              $this->core->adminurl->get('admin.posts',array('status' => -2)), 
     194                              $nb_pending) : ''). 
     195                         ($nb_programmed ? 
     196                              sprintf(__(', <a href="%s">programmed</a> (1)',', <a href="%s">programmed</a> (%s)',$nb_programmed), 
     197                              $this->core->adminurl->get('admin.posts',array('status' => -1)), 
     198                              $nb_programmed) : ''). 
     199                         ($nb_unpublished ? 
     200                              sprintf(__(', <a href="%s">unpublished</a> (1)',', <a href="%s">unpublished</a> (%s)',$nb_unpublished), 
     201                              $this->core->adminurl->get('admin.posts',array('status' => 0)), 
     202                              $nb_unpublished) : ''). 
     203                         '</caption>'; 
    180204               } 
    181205 
     
    454478                         '</caption>'; 
    455479               } else { 
    456                     $html_block .= '<caption class="hidden">'.__('Comments and trackbacks list').'</caption>'; 
     480                    $nb_published = $this->core->blog->getComments(array('comment_status' => 1),true)->f(0); 
     481                    $nb_spam = $this->core->blog->getComments(array('comment_status' => -2),true)->f(0); 
     482                    $nb_pending = $this->core->blog->getComments(array('comment_status' => -1),true)->f(0); 
     483                    $nb_unpublished = $this->core->blog->getComments(array('comment_status' => 0),true)->f(0); 
     484                    $html_block .= '<caption>'. 
     485                         sprintf(__('List of comments and trackbacks (%s)'),$this->rs_count). 
     486                         ($nb_published ? 
     487                              sprintf( 
     488                              __(', <a href="%s">published</a> (1)',', <a href="%s">published</a> (%s)',$nb_published), 
     489                              $this->core->adminurl->get('admin.comments',array('status' => 1)), 
     490                              $nb_published) : ''). 
     491                         ($nb_spam ? 
     492                              sprintf( 
     493                              __(', <a href="%s">spam</a> (1)',', <a href="%s">spam</a> (%s)',$nb_spam), 
     494                              $this->core->adminurl->get('admin.comments',array('status' => -2)), 
     495                              $nb_spam) : ''). 
     496                         ($nb_pending ? 
     497                              sprintf(__(', <a href="%s">pending</a> (1)',', <a href="%s">pending</a> (%s)',$nb_pending), 
     498                              $this->core->adminurl->get('admin.comments',array('status' => -1)), 
     499                              $nb_pending) : ''). 
     500                         ($nb_unpublished ? 
     501                              sprintf(__(', <a href="%s">unpublished</a> (1)',', <a href="%s">unpublished</a> (%s)',$nb_unpublished), 
     502                              $this->core->adminurl->get('admin.comments',array('status' => 0)), 
     503                              $nb_unpublished) : ''). 
     504                         '</caption>'; 
    457505               } 
    458506 
Note: See TracChangeset for help on using the changeset viewer.

Sites map