Filter: tcp reports tabs

Description

Allows to add more reports to the main reports systea,.

Parameters

$tabs
(array) using format: array(
‘title’ => ”,
‘url’ => ‘admin.php?page=new-report’,
)

Example


class NewReport {

	function __construct() {
		if ( is_admin() ) {
			add_submenu_page( 'tcp' , 'New report', 'New Reports', 'tcp_edit_products', 'new-report', array( $this, 'show' ) );

			// Adds the 'New Report' tab
			add_filter( 'tcp_reports_tabs'	, array( $this, 'tcp_reports_tabs' ) );
		}
	}

	/**
	 * Adds New report tab
	 *
	 * @param $tabs
	 * @return $tabs
	 */
	function tcp_reports_tabs( $tabs ) {
		$tabs[] = array(
			'title'	=> 'New report',
			'url'	=> 'admin.php?page=new-report',
		);
		return $tabs;
	}

	/**
	 * Outputs the reports
	 * 
	 * @uses get_top_ten_products()
	 * @uses get_top_ten_products()
	 */
	function show() {
?>
<script src="//cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>

<div class="wrap">

	<?php TCPReports::echoHead( 'New Report ' ); ?>

	<div class="clear"></div>
	....
</div>

<!-- .wrap -->
	}
}

Change Log

Since 1.4.9