예제 #1
0
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

// Initialization
require_once('tiki-setup.php');
require_once("lib/metrics/metricslib.php");
require_once("lib/metrics/input-validation.php");

$access->check_feature('feature_metrics_dashboard');

$metricslib = new MetricsLib($dbTiki);

$tabs = $metricslib->getAllTabs();

$range = isset( $_REQUEST['range'] ) ? $_REQUEST['range'] : null;
$date_from = isset( $_REQUEST['date_from'] ) ? $_REQUEST['date_from'] : null;
$date_to = isset( $_REQUEST['date_to'] ) ? $_REQUEST['date_to'] : null;
$converted_range = convert_date_range($range, $date_from, $date_to);
if (!empty($converted_range['msg'])) {
	$smarty->assign('msg', $converted_range['msg']);
	$smarty->display('error.tpl');
	die;
}
$metrics_range = $converted_range['date_from'] . tra(' to ') . $converted_range['date_to'];
$smarty->assign('date_from', $converted_range['date_from']);
$smarty->assign('date_to', $converted_range['date_to']);
$smarty->assign('metrics_range_prefix', $converted_range['metrics_range_prefix']);
$smarty->assign('range', $range);
		$assigned_id = NULL;
		$logslib->add_log('adminmodules', 'assigned new metric '.$_REQUEST["assign_metric"]);
	} else {
		//update
		$assigned_id = $_POST['assigned_id'];
		$logslib->add_log('adminmodules', 'reassigned metric '.$_REQUEST["assign_metric"] . ' (assigned_id = ' .$assigned_id .')');
	}
	$smarty->assign('assigned_id', $assigned_id);

	$smarty->assign('assign_metric', $_REQUEST["assign_metric"]);
	$smarty->assign('assign_tab', $_REQUEST["assign_tab"]);
	$metricslib->createUpdateMetricAssigned($assigned_id, $_REQUEST["assign_metric"], $_REQUEST["assign_tab"]);
	header("location: tiki-admin_metrics.php");
}

$metrics_list = $metricslib->getAllMetrics();
$smarty->assign('metrics_list', $metrics_list);
$tabs_list = $metricslib->getAllTabs();
$smarty->assign('tabs_list', $tabs_list);
$metrics_assigned_list = $metricslib->getAllMetricsAssigned();
$smarty->assign('metrics_assigned_list', $metrics_assigned_list);

ask_ticket('admin-metrics');

// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');

$smarty->assign('mid', 'tiki-admin_metrics.tpl');
$smarty->display("tiki.tpl");