{* ********************************************************************************************* *}
{* REPORT NOT STARTED YET (status: pending) **************************************************** *}
{* ********************************************************************************************* *}
{if $reportGenerationDetails.status=="pending"}
	<div class="reportGeneratingDetails report_pending">
		<div class="pendingReport">{$_LANG.reportsGeneration.viewReportStatus.pendingReport}</div>

		<div class="pendingReportNotStarted">
			{$_LANG.reportsGeneration.viewReportStatus.pendingReportDescr}
			<a href="#;" class="controlButtons"
				onclick="
					viewReport('{$idReportGenerating}');
					$('{$refreshDiv}').hide();
				"
			>{$_LANG.reportsGeneration.viewReportStatus.pendingReportDetails}</a>
		</div>

		<div class="setToStartTime">
			{$_LANG.reportsGeneration.viewReportStatus.pendingReportGenTime}: {$reportGenerationDetails.setToStartTime|dateTimeFormat:'dateWithHM'}
		</div>

	</div>

	{* ----- automatically refresh the div ----- *}
	<script language="javascript">
		clearTimeout(reportRefreshFunctionExecute);
		reportRefreshFunctionExecute=setTimeout( 'refreshReportStatus(\'{$refreshDiv}\', \'{$idReportGenerating}\', \'\');', {$reportStatusViewerRefreshTime.pending});
	</script>

{/if}


{* ********************************************************************************************* *}
{* REPORT IS GENERATING (status: generating/paused) ******************************************** *}
{* ********************************************************************************************* *}
{if $reportGenerationDetails.status=="generating"}

	<div class="reportGeneratingDetails report_generating" id="reportIsGeneratingDiv_{$idReportGenerating}">

		{if $phase_current}
			<div
				{if $reportGenerationDetails.status=="generating"}class="phase"{/if}
				{if $reportGenerationDetails.status=="paused"}class="phasePaused"{/if}
			>
				{$_LANG.reportsGeneration.viewReportStatus.phase} {$phase_current}/{$phase_count} - {$phaseName}
			</div>
			<div class="center">
				{progressbar value=$total_percent/100 label=sprintf("%s%%", $total_percent)}
			</div>
		{/if}

		{if $steps_current}
			<div
				{if $reportGenerationDetails.status=="generating"}class="step"{/if}
				{if $reportGenerationDetails.status=="paused"}class="stepPaused"{/if}
			>
				{$_LANG.reportsGeneration.viewReportStatus.step} {$steps_current}/{$steps_count} - {$stepName}
			</div>
			<div class="center">
				{progressbar value=$phase_percent/100 label=sprintf("%s%%", $phase_percent)}
			</div>
		{/if}

		<table class="timeElapsed" cellpadding="0" cellspacing="0">
			<tr>
				<td class="left" width="37%">{$_LANG.reportsGeneration.viewReportStatus.start}: {$startTime}</td>
				<td class="center memoryUsed">
					{if $reportGenerationDetails.memoryUsed}
						<div class="help" tooltip="{$_LANG.reportsGeneration.viewReportStatus.currentMemoryUsed}">({$reportGenerationDetails.memoryUsed|formatFilesize})</div>
					{/if}
				</td>
				<td class="right" width="37%">{$_LANG.reportsGeneration.viewReportStatus.elapsed}:
					{if $timeElapsed.d}{$timeElapsed.d}{/if}
					{$timeElapsed.h}:{$timeElapsed.m}:{$timeElapsed.s}
				</td>
			</tr>
		</div>

		<table class="controlButtons" cellpadding="0" cellspacing="0">
			<tr>
				<td class="left">

					{if $reportGenerationDetails.status=="generating"}
						<a href="#;" class="controlButtons"
							onclick="refreshReportStatus('{$refreshDiv}', '{$idReportGenerating}', 'paused');"
						>{$_LANG.reportsGeneration.viewReportStatus.pause_button}</a>
					{/if}
					{if $reportGenerationDetails.status=="paused"}
						<a href="#;" class="controlButtons"
							onclick="refreshReportStatus('{$refreshDiv}', '{$idReportGenerating}', 'generating');"
						>{$_LANG.reportsGeneration.viewReportStatus.continue_button}</a>
					{/if}

				</td>
				<td class="right">
					<a href="#;" class="controlButtons"
						onclick="refreshReportStatus('{$refreshDiv}', '{$idReportGenerating}', 'stopped');"
					>{$_LANG.reportsGeneration.viewReportStatus.stop_button}</a>
				</td>
			</tr>
		</table>

	</div>

	{if $sleepingReport}
		<div id="reportIsSleepingDiv_{$idReportGenerating}"
			style="
				position:absolute;z-index:2;
				background-color:#FFFFFF;
				border:1px solid #E0E0E0;
				filter:alpha(opacity=80);
				-moz-opacity: 0.8;
				opacity: 0.8;
			"
		>
			<div class="center" style="font-family:arial;font-weight:bold;font-size:18px;color:red;padding:5px 5px 0px 5px;">
				{$_LANG.reportsGeneration.viewReportStatus.reportIsSleeping}
			</div>
			<div class="center" style="font-size:10px;padding:5px 10px;background-color:#FFFFFF;color:#000000;">
				{$_LANG.reportsGeneration.viewReportStatus.reportIsSleepingDescr}
			</div>

		</div>
	{/if}

	{* ----- automatically refresh the div ----- *}
	<script language="javascript">
		clearTimeout(reportRefreshFunctionExecute);
		{if $sleepingReport}
			reportRefreshFunctionExecute=setTimeout( 'refreshReportStatus(\'{$refreshDiv}\', \'{$idReportGenerating}\', \'\');', {$reportStatusViewerRefreshTime.sleeping});
		{else}
			reportRefreshFunctionExecute=setTimeout( 'refreshReportStatus(\'{$refreshDiv}\', \'{$idReportGenerating}\', \'\');', {$reportStatusViewerRefreshTime.generating});
		{/if}

		{* display covering spleeping div *}
		{if $sleepingReport}
			$('reportIsSleepingDiv_{$idReportGenerating}').setTop( $('reportIsGeneratingDiv_{$idReportGenerating}').getTop() );
			$('reportIsSleepingDiv_{$idReportGenerating}').setLeft( $('reportIsGeneratingDiv_{$idReportGenerating}').getLeft() );
			$('reportIsSleepingDiv_{$idReportGenerating}').setWidth( $('reportIsGeneratingDiv_{$idReportGenerating}').getWidth()-2 );
			$('reportIsSleepingDiv_{$idReportGenerating}').setHeight( $('reportIsGeneratingDiv_{$idReportGenerating}').getHeight()-40 );
			//$('reportIsSleepingDiv_{$idReportGenerating}').show();
		{/if}
	</script>

{/if}



{* ********************************************************************************************* *}
{* REPORT IS GENERATING (status: paused) ******************************************************* *}
{* ********************************************************************************************* *}
{if $reportGenerationDetails.status=="paused"}

	<div class="reportGeneratingDetails report_paused">

		{if $reportGenerationDetails.status=="paused"}
			<div class="reportPaused">
				{$_LANG.reportsGeneration.viewReportStatus.reportPaused}
			</div>
			<div class="pausedInfo">
				{$_LANG.reportsGeneration.viewReportStatus.reportPausedInfo}
			</div>
		{/if}

		<table class="timeElapsed" cellpadding="0" cellspacing="0">
			<tr>
				<td class="left" width="37%">{$_LANG.reportsGeneration.viewReportStatus.start}: {$startTime}</td>
				<td class="center memoryUsed">
					{if $reportGenerationDetails.memoryUsed}
						<div class="help" tooltip="{$_LANG.reportsGeneration.viewReportStatus.currentMemoryUsed}">({$reportGenerationDetails.memoryUsed|formatFilesize})</div>
					{/if}
				</td>
				<td class="right" width="37%">{$_LANG.reportsGeneration.viewReportStatus.elapsed}:
					{if $timeElapsed.d}{$timeElapsed.d}{/if}
					{$timeElapsed.h}:{$timeElapsed.m}:{$timeElapsed.s}
				</td>
			</tr>
		</div>

		<table class="controlButtons" cellpadding="0" cellspacing="0">
			<tr>
				<td class="left">

					{if $reportGenerationDetails.status=="generating"}
						<a href="#;" class="controlButtons"
							onclick="refreshReportStatus('{$refreshDiv}', '{$idReportGenerating}', 'paused');"
						>{$_LANG.reportsGeneration.viewReportStatus.pause_button}</a>
					{/if}
					{if $reportGenerationDetails.status=="paused"}
						<a href="#;" class="controlButtons"
							onclick="refreshReportStatus('{$refreshDiv}', '{$idReportGenerating}', 'generating');"
						>{$_LANG.reportsGeneration.viewReportStatus.continue_button}</a>
					{/if}

				</td>
				<td class="right">
					<a href="#;" class="controlButtons"
						onclick="refreshReportStatus('{$refreshDiv}', '{$idReportGenerating}', 'stopped');"
					>{$_LANG.reportsGeneration.viewReportStatus.stop_button}</a>
				</td>
			</tr>
		</table>

	</div>

	{* ----- automatically refresh the div ----- *}
	<script language="javascript">
		clearTimeout(reportRefreshFunctionExecute);
		reportRefreshFunctionExecute=setTimeout( 'refreshReportStatus(\'{$refreshDiv}\', \'{$idReportGenerating}\', \'\');', {$reportStatusViewerRefreshTime.paused});
	</script>

{/if}



{* ********************************************************************************************* *}
{* REPORT FINISHED (status: finished) ********************************************************** *}
{* ********************************************************************************************* *}
{if $reportGenerationDetails.status=="finished" and !$reportGenerationDetails.viewed}

	<div class="reportGeneratingDetails report_finished">

		<div class="finishedReport">{$_LANG.reportsGeneration.viewReportStatus.reportGenerated}</div>

		<div class="finishedReportNoView">
			{$_LANG.reportsGeneration.viewReportStatus.reportNotViewed}
			<a href="#;" class="controlButtons"
				onclick="
					viewReport('{$idReportGenerating}');
					$('{$refreshDiv}').hide();
				"
			>{$_LANG.reportsGeneration.viewReportStatus.viewReport}</a>
		</div>

		<table class="timeElapsed" cellpadding="0" cellspacing="0">
			<tr>
				<td class="left">{$_LANG.reportsGeneration.viewReportStatus.start}: {$startTime}</td>
				<td class="right">{$_LANG.reportsGeneration.viewReportStatus.elapsed}: {$timeElapsed.h}:{$timeElapsed.m}:{$timeElapsed.s}</td>
			</tr>
		</div>

	</div>

{/if}


{* ********************************************************************************************* *}
{* REPORT CRASHED BECAUSE OF ERROR (status: error) ********************************************* *}
{* ********************************************************************************************* *}
{if $reportGenerationDetails.status=="error" and !$reportGenerationDetails.viewed}

	<div class="reportGeneratingDetails report_error">

		<div class="finishedReport">
			{$_LANG.reportsGeneration.viewReportStatus.reportError}
		</div>

		<div class="finishedReportNoView">
			{$_LANG.reportsGeneration.viewReportStatus.reportNotViewed}
			<a href="#;" class="controlButtons"
				onclick="
					viewReport('{$idReportGenerating}');
					$('{$refreshDiv}').hide();
				"
			>{$_LANG.reportsGeneration.viewReportStatus.viewReport}</a>
		</div>

		<table class="timeElapsed" cellpadding="0" cellspacing="0">
			<tr>
				<td class="left">{$_LANG.reportsGeneration.viewReportStatus.start}: {$startTime}</td>
				<td class="right">{$_LANG.reportsGeneration.viewReportStatus.elapsed}: {$timeElapsed.h}:{$timeElapsed.m}:{$timeElapsed.s}</td>
			</tr>
		</div>

	</div>

{/if}

