• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List

system/admin/dashboard.php

00001 <?php namespace Habari; ?>
00002 <?php if ( !defined( 'HABARI_PATH' ) ) { die('No direct access'); } ?>
00003 <?php include( 'header.php' ); ?>
00004 <div class="container">
00005     <!--[if lte IE 6]>
00006     <p><?php
00007     
00008       $ie6_age = DateTime::difference( 'now', 'August 27, 2001' );
00009       
00010       echo _t( "Oh, great! You're using IE6! I've finally found someone I can pawn this old betamax player off on!" ) . '<br />';
00011       echo _t( "If you're reading this you're surfing using Internet Explorer 6, a browser that is %d %s old and cannot cope with the demands of the modern internet.", array( $ie6_age['y'], _n( 'year', 'years', $ie6_age['y'] ) ) ) . '<br />';
00012       echo _t( 'Consider switching to <a href="http://mozilla.com">Mozilla Firefox</a>, <a href="http://www.apple.com/safari/download/">Safari</a>, <a href="http://www.google.com/chrome">Google Chrome</a>, or a more recent version of <a href="http://www.microsoft.com/windows/Internet-explorer/default.aspx">Internet Explorer</a>.' );
00013       
00014     ?></p>
00015     <![endif]-->
00016     <div id="welcome" class="sixteen columns alpha">
00017       <p>
00018       <?php
00019       if ( isset($active_time) ) {
00020         _e( '%s has been active for %s', array( Options::get('title'), $active_time->friendly( 3, false ) ) );
00021       }
00022       ?>
00023       </p>
00024     <p><?php
00025     $content_type_msg = array();
00026     $user = User::identify();
00027     if ( !empty( $stats['post_count'] ) ) {
00028       $message = sprintf( _n( '%d post', '%d posts', $stats['post_count'] ), $stats['post_count'] );
00029       $perms = array(
00030         'post_any' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
00031         'own_posts' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
00032       );
00033       if ( $user->can_any( $perms ) ) {
00034         $message = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'posts', 'type' => Post::type( 'any' ), 'status' => Post::status( 'published' ) ) ) ) . '">' . $message . '</a>';
00035       }
00036       $content_type_msg[] = $message;
00037     }
00038 
00039     $comment_tag_msg = array();
00040     if ( !empty( $stats['comment_count'] ) ) {
00041       $message = sprintf( _n( '%d comment', '%d comments', $stats['comment_count'] ), $stats['comment_count'] );
00042       $perms = array( 'manage_all_comments' => true, 'manage_own_post_comments' => true );
00043       if ( $user->can( 'manage_all_comments' ) ) {
00044         $message = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'comments', 'status' => 'approved' ) ) ) . '">' . $message . '</a>';
00045       }
00046       $comment_tag_msg[] = $message;
00047     }
00048 
00049     if ( !empty( $stats['tag_count'] ) ) {
00050       $message = sprintf( _n( '%d tag', '%d tags', $stats['tag_count'] ), $stats['tag_count'] );
00051       if ( $user->can( 'manage_tags' ) ) {
00052         $message = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'tags' ) ) ) . '">' . $message . '</a>';
00053       }
00054       $comment_tag_msg[] = $message;
00055     }
00056     if ( !empty( $content_type_msg ) ) {
00057       $status_report = sprintf( _n( '[You] have published %1$s%2$s', 'The [%3$d authors] have published %1$s%2$s', $stats['author_count'] ),
00058         Format::and_list( $content_type_msg ),
00059         !empty( $comment_tag_msg ) ? _t( ' with ' ) . Format::and_list( $comment_tag_msg ) : "",
00060         $stats['author_count'] );
00061 
00062       $perms = array( 'manage_users' => true );
00063       if ( $user->can_any( $perms ) ) {
00064         $status_report = str_replace( array( '[', ']' ),
00065           array( '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array('page'=>'users') ) ) . '">', '</a>' ),
00066           $status_report );
00067       }
00068       else {
00069         $status_report = str_replace( array( '[', ']' ), array( '', '' ), $status_report );
00070       }
00071       echo $status_report;
00072     }
00073     ?></p>
00074 
00075     <p><?php
00076     $message_bits = array();
00077     $user= User::identify();
00078     if ( !empty( $stats['user_draft_count'] ) ) {
00079       $message = sprintf( _n( '%d draft', '%d drafts', $stats['user_draft_count'] ), $stats['user_draft_count'] );
00080       $perms = array(
00081         'post_any' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
00082         'own_posts' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
00083       );
00084       if ( $user->can_any( $perms ) ) {
00085         $message = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'posts', 'type' => Post::type( 'any' ), 'status' => Post::status( 'draft' ), 'user_id' => $user->id ) ) ) . '">' . $message . '</a>';
00086       }
00087       $message_bits[] = $message;
00088     }
00089     if ( !empty( $stats['user_scheduled_count'] ) ) {
00090       $message = sprintf( _n( '%d scheduled post' , '%d scheduled posts' , $stats['user_scheduled_count'] ), $stats['user_scheduled_count' ] );
00091       $perms = array(
00092         'post_any' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
00093         'own_posts' => array( ACL::get_bitmask( 'delete' ), ACL::get_bitmask( 'edit' ) ),
00094       );
00095       if ( $user->can_any( $perms ) ) {
00096         $message = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'posts', 'status' => Post::status( 'scheduled' ) ) ) ) . '">' . $message . '</a>';
00097       }
00098       $message_bits[] = $message;
00099     }
00100     if ( $user->can_any( array( 'manage_all_comments' => true, 'manage_own_post_comments' => true ) ) ) {
00101       if ( !empty(  $stats['unapproved_comment_count'] ) ) {
00102         $message = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'comments', 'status' => 'unapproved' ) ) ) . '">';
00103         $message .= sprintf( _n( '%d comment awaiting approval', '%d comments awaiting approval', $stats['unapproved_comment_count'] ), $stats['unapproved_comment_count'] );
00104         $message .= '</a>';
00105         $message_bits[] = $message;
00106       }
00107 
00108       if ( !empty(  $stats['spam_comment_count'] ) && $user->info->dashboard_hide_spam_count != true ) {
00109         $message = '<a href="' . Utils::htmlspecialchars( URL::get( 'admin', array( 'page' => 'comments', 'status' => 'spam' ) ) ) . '">';
00110         $message .= sprintf( _n( '%d spam comment', '%d spam comments', $stats['spam_comment_count'] ), $stats['spam_comment_count'] );
00111         $message .= '</a>';
00112         $message_bits[] = $message;
00113       }
00114     }
00115     if ( !empty( $message_bits ) ) {
00116       _e('You have %s', array(Format::and_list( $message_bits)) );
00117     }
00118     ?></p>
00119     </div>
00120     <?php
00121       
00122       if ( !empty( $updates ) ) {
00123         
00124         ?>
00125         
00126           <ul class="updates">
00127           
00128             <?php
00129 
00130               foreach ( $updates as $beacon_id => $beacon ) {
00131                                 
00132                 $u_strings = array();
00133                 foreach ( $beacon['updates'] as $u_version => $u ) {
00134                   
00135                   if ( !empty( $u['date'] ) ) {
00136                     $u_title = _t( '%1$s update released on %2$s: %3$s', array( MultiByte::ucfirst( $u['severity'] ), DateTime::create( $u['date'] )->format( 'Y-m-d' ), Utils::htmlspecialchars( $u['text'] ) ) );
00137                   }
00138                   else {
00139                     $u_title = _t( '%1$s update: %3$s', array( MultiByte::ucfirst( $u['severity'] ), $u['date'], Utils::htmlspecialchars( $u['text'] ) ) );
00140                   }
00141                   
00142                   if ( !empty( $u['url'] ) ) {
00143                     $u_string = sprintf( '<a href="%1$s" title="%2$s" class="%3$s">%4$s</a>', $u['url'], $u_title, $u['severity'], $u['version'] );
00144                   }
00145                   else {
00146                     $u_string = sprintf( '<span title="%1$s" class="%2$s">%3$s</span>', $u_title, $u['severity'], $u['version'] );
00147                   }
00148                   
00149                   // add it to the array of updates available for this plugin
00150                   $u_strings[ $u['version'] ] = $u_string;
00151                   
00152                 }
00153                 
00154                 $u_strings = Format::and_list( $u_strings );
00155                 
00156                 ?>
00157                 
00158                   <li class="update">
00159                     <?php echo _t( '%1$s <a href="%2$s">%3$s</a> has the following updates available: %4$s', array( MultiByte::ucfirst( $beacon['type'] ), $beacon['url'], $beacon['name'], $u_strings ) ); ?>
00160                   </li>
00161                 
00162                 <?php
00163       
00164               }
00165               
00166             ?>
00167             
00168           </ul>
00169           
00170         <?php
00171         
00172       }
00173 
00174     ?>
00175 
00176 </div>
00177 
00178 <?php if ( $first_run ):
00179   $msg = _t('Welcome to Habari! We hope that you will jump right in and start exploring. If you get stuck or want to learn more about some of the advanced features, we encourage you to read the [manual], which is bundled with every Habari install. This link also appears at the bottom of every page in the admin area.');
00180   $msg = str_replace( array( '[', ']' ), array( '<a href="' . Site::get_url('habari') . '/doc/manual/index.html" onclick="popUp(this.href);return false;" title="' . _t('Habari Manual') . '">', '</a>' ), $msg );
00181 ?>
00182 
00183 <div class="container">
00184   <div class="item">
00185   <p><?php echo $msg; ?></p>
00186   <p><?php _e( 'This message will disappear next time you visit.' ); ?></p>
00187   </div>
00188 </div>
00189 
00190 <?php endif; ?>
00191 
00192 <div class="container dashboard">
00193 
00194   <ul class="modules">
00195     <?php echo $theme->display('dashboard_modules'); ?>
00196   </ul>
00197 
00198 </div>
00199 
00200 <?php include( 'footer.php' ); ?>

Generated on Sun Aug 4 2013 12:51:42 for Habari by  doxygen 1.7.1