*
* Gitium is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Gitium is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Gitium. If not, see .
*
* @package Gitium
*/
class Gitium_Submenu_Commits extends Gitium_Menu {
public function __construct() {
parent::__construct( $this->gitium_menu_slug, $this->commits_menu_slug );
add_action( GITIUM_ADMIN_MENU_ACTION, array( $this, 'admin_menu' ) );
}
public function admin_menu() {
$submenu_hook = add_submenu_page(
$this->menu_slug,
__( 'Git Commits', 'gitium' ),
__( 'Commits', 'gitium' ),
GITIUM_MANAGE_OPTIONS_CAPABILITY,
$this->submenu_slug,
array( $this, 'page' )
);
new Gitium_Help( $submenu_hook, 'commits' );
}
public function table_head() {
?>
|
|
';
}
public function table_start_row() {
static $counter = 0;
$counter++;
echo ( 0 != $counter % 2 ) ? '
' : '
';
}
public function page() {
?>
table_head(); ?>
git->get_last_commits( GITIUM_LAST_COMMITS ) as $commit_id => $data ) {
unset( $committer_name );
extract( $data );
if ( isset( $committer_name ) ) {
$committer = " -> $committer_name " . sprintf( __( 'committed %s ago', 'gitium' ), human_time_diff( strtotime( $committer_date ) ) ) . '';
$committers_avatar = '' . get_avatar( $committer_email, 16 ) . '
';
} else {
$committer = '';
$committers_avatar = '';
}
$this->table_start_row();
?>
|
|
table_end_row();
}
?>