<?php

/*

* phpMyVisites : website statistics and audience measurements

* Copyright (C) 2002 - 2006

* http://www.phpmyvisites.net/

* phpMyVisites is free software (license GNU/GPL)

* Authors : Labsmedia

*/



// $Id: ViewClickheat.class.php 95 2007-03-31 14:46:00Z cmil $



require_once INCLUDE_PATH."/core/include/ViewModule.class.php";

/** On force la langue du navigateur */

$_SERVER['HTTP_ACCEPT_LANGUAGE'] = $GLOBALS['lang']['lang_iso'];



class ViewClickheat extends ViewModule

{

	var $viewTemplate = "clickheat/viewclickheat.tpl";



	function ViewClickheat()

	{

		parent::ViewModule();

	}



	function process()

	{

		ob_start();

		$t = split("-", $this->request->getDate());

		$pmvClickHeatDateStamp = mktime(0, 0, 0, $t[1], $t[2], $t[0] );

		if ($this->request->getPeriod() == DB_ARCHIVES_PERIOD_DAY)

		{

			$pmvClickHeatRange = 'd';

		}

		elseif ($this->request->getPeriod() == DB_ARCHIVES_PERIOD_WEEK)

		{

			$pmvClickHeatRange = 'w';

		}

		elseif ($this->request->getPeriod() == DB_ARCHIVES_PERIOD_MONTH)

		{

			$pmvClickHeatRange = 'm';

		}

		else

		{

			$pmvClickHeatRange = 'd';

		}

		$__action = '';

		define('PHPMV_SELECTED_SITE', (string) $this->request->getSiteId(true));

		include INCLUDE_PATH.'/plugins/clickheat/libs/index.php';

		$result = ob_get_clean();



		if ($__action === 'view')

		{

			$this->tpl->setMainTemplate("clickheat/tpl/structure_clickheat.tpl");



			$this->tpl->assign('clickheat_calendar', $__calendar);

			$this->tpl->assign('clickheat_path', CLICKHEAT_PATH);

			$this->tpl->assign('clickheat_index', CLICKHEAT_INDEX_PATH);

			$this->tpl->assign('clickheat_group', LANG_GROUP);

			$this->tpl->assign('clickheat_groups', $__selectGroups);

			$this->tpl->assign('clickheat_browser', LANG_BROWSER);

			$this->tpl->assign('clickheat_browsers', $__selectBrowsers);

			$this->tpl->assign('clickheat_screen', LANG_SCREENSIZE);

			$this->tpl->assign('clickheat_screens', $__selectScreens);

			$this->tpl->assign('clickheat_heatmap', LANG_HEATMAP);

			$this->tpl->assign('clickheat_js', $__js);

			$this->tpl->assign('clickheat_loading', str_replace('\'', '\\\'', LANG_ERROR_LOADING));

			$this->tpl->assign('clickheat_cleaner', str_replace('\'', '\\\'', LANG_CLEANER_RUNNING));

			$this->tpl->assign('clickheat_admincookie', str_replace('\'', '\\\'', LANG_JAVASCRIPT_ADMIN_COOKIE));

			$this->tpl->assign('clickheat_alpha', $clickheatConf['alpha']);

			$this->tpl->assign('clickheat_iframes', $clickheatConf['hideIframes'] === true ? 'true' : 'false');

			$this->tpl->assign('clickheat_flashes', $clickheatConf['hideFlashes'] === true ? 'true' : 'false');

			$this->tpl->assign('clickheat_force_heatmap', $clickheatConf['heatmap'] === true ? ' checked="checked"' : '');

			$this->tpl->assign('clickheat_jsokay', CLICKHEAT_ADMIN === true ? '<a href="#" onclick="showJsCode(); return false;">'.str_replace('\'', '\\\'', LANG_ERROR_JAVASCRIPT).'</a>' : '');

			$this->tpl->assign('clickheat_last', $__lastDayOfMonth);

			$this->tpl->assign('clickheat_day', $__day);

			$this->tpl->assign('clickheat_month', $__month);

			$this->tpl->assign('clickheat_year', $__year);

			$this->tpl->assign('clickheat_menu', '<a href="#" onclick="adminCookie(); return false;">'.LANG_LOG_MY_CLICKS.'</a><br />'.(CLICKHEAT_ADMIN === true ? '<a href="'.CLICKHEAT_INDEX_PATH.'action=config">'.LANG_CONFIG.'</a> - <a href="#" onclick="showJsCode(); return false;">Javascript</a>' : ''));

			return true;

		}



		echo $result;

		exit;

	}

}

?>