<?php
require_once(LIB_PATH . 'PrintElements.inc'); 
class x_km extends x_k7 { 
var $x_v = ''; 
var $x_b7 = ''; 
var $x_6u = ''; 
var $x_7j = ''; 
var $x_ds = Array(); 
var $x_kn = 0; 
var $x_ko = 0; 
var $x_kp = ''; 
var $x_kq = 0; 
var $x_kr = Array(); 
var $x_ks = ''; 
var $x_kt = ''; 
var $x_ku = 3; 
function x_km($x_v, $x_b7, $x_6u, $x_7j) { 
$this->x_v = $x_v; 
$this->x_b7 = $x_b7; 
$this->x_6u = $x_6u; 
$this->x_7j = $x_7j['period']; 
$this->x_kt = $x_7j['generated']; 
$x_5p = x_5g(); 
if ('MSIE 6' == $x_5p['name']) { 
$this->x_ku = 1; 
} 
} 
function x_e0($x_kv, $x_1m) { 
switch ($this->x_v) { 
case 'overall': 
$this->x_kw($x_kv, $x_1m); 
break; 
case 'individual': 
$this->x_kx($x_kv, $x_1m); 
break; 
case 'activity': 
$this->x_ky($x_kv, $x_1m); 
break; 
case 'traffic': 
$this->x_kz($x_kv, $x_1m); 
break; 
case 'sites': 
case 'categories': 
$this->x_l0($x_kv, $x_1m); 
break; 
} 
} 
function x_l1() { 
return '<div align="center">' . 
'<table class="printPage">' 
. '<thead><tr><td>' . $this->x_2f() . '</td></tr></thead>' 
. '<tbody><tr><td valign="top" align="center" class="fullHeight">' . $this->x_ex() . '</td></tr></tbody>' 
. '<tfoot><tr><td>' . $this->x_l2() . '</td></tr></tfoot>' 
. '</table>' . 
'</div>'; 
} 
function x_ex() { 
return '<span class="noData"><kerio:text id="noData" /></span>'; 
} 
function x_ey() { 
return '<span class="noData"><kerio:text id="no_user" /></span>'; 
} 
function x_ky($x_kv, $x_1m){ 
return; 
} 
function x_kz($x_kv, $x_1m){ 
switch ($x_1m) { 
case 1: 
$x_dx = $this->x_ka($x_kv[0], $x_kv[1], $x_kv[2], $x_kv[3], true); 
if (!is_array($x_dx)) { 
$x_dx = Array($x_dx); 
} 
$this->x_ds[$x_1m] = $x_dx; 
break; 
} 
} 
function x_l0($x_kv, $x_1m){ 
switch ($x_1m) { 
case 1: 
$x_f9 = (20 * count($x_kv['data'])); 
if ($x_f9 < 100) { 
$x_f9 = 100; 
} 
$x_f1 = Array('horizontal' => 1, 
'singleColor' => 1, 
'axisProperty' => webiface_SHOW_LINE | webiface_SHOW_LABEL | webiface_FORMAT_NUMBER, 
'axisName' => '', 
'fixedX' => '', 
'fixedY' => '', 
'print' => $this->x_ku); 
$x_dw = $this->kp_getCountedImage('bar', 590, $x_f9, 
$x_kv, 
'', 
$x_f1); 
$this->x_ds[$x_1m] = $x_dw; 
break; 
case 2: 
$x_iy = Array(); 
if (empty($x_kv[0])) { 
$x_kv[0] = Array(); 
} 
foreach ($x_kv[0] as $x_7d) { 
$x_l3 = $this->x_ka($x_7d['x_dx'], $x_kv[1], $x_kv[2], 'class="dataList" style="width: 60mm !important;"'); 
$x_f1 = Array('property' => webiface_REMOVE_OVERLAPPED_LABELS, 
'print' => $this->x_ku); 
$x_dw = $this->kp_getCountedImage('pie', 360, 160, 
$x_7d['x_dw'], 
$x_7d['x_dw']['other'], 
$x_f1); 
$x_iy[] = '<table class="fullWidth" cellpadding="0" cellspacing="0" border="0">


									<tr>


										<td colspan="2" class="siteHead">' 
. $x_7d['x_6u'] . ' - ' . $x_7d['x_ff'] 
. ' ' . $x_kv[3] . '</td>


									</tr> 


									<tr>


										<td colspan="2">


											' . $this->x_b9() . '


										</td>


									</tr>


									<tr>


										<td class="pTop" valign="top" align="left">' . $x_dw . '</td>


										<td valign="top" align="right"> ' . $x_l3 . '</td>


									</tr>


								</table>'; 
} 
$this->x_ds[$x_1m] = $x_iy; 
break; 
} 
} 
function x_kx($x_kv, $x_1m){ 
switch ($x_1m) { 
case 1: 
$this->x_ds[$x_1m] = $this->x_k8($x_kv, 'class="totalData"'); 
break; 
case 2: 
$this->x_ds[$x_1m] = $this->x_l4($x_kv); 
break; 
case 3: 
$this->x_ds[$x_1m] = $this->x_l5($x_kv); 
break; 
case 4: 
$this->x_ds[$x_1m] = $this->x_l6($x_kv); 
break; 
case 5: 
$this->x_ds[$x_1m] = $this->x_l7($x_kv); 
break; 
case 6: 
$this->x_ds[$x_1m] = $this->x_l8($x_kv); 
break; 
} 
} 
function x_kw ($x_kv, $x_1m){ 
switch ($x_1m) { 
case 1: 
$this->x_ds[$x_1m] = $this->x_k8($x_kv, 'class="totalData"'); 
break; 
case 2: 
$this->x_ds[$x_1m] = $this->x_l4($x_kv); 
break; 
case 3: 
if (!empty($x_kv)) { 
$x_f1 = Array('property' => webiface_REMOVE_OVERLAPPED_LABELS, 
'print' => $this->x_ku); 
$x_dw = $this->kp_getCountedImage('pie', 280, 150, 
$x_kv, 
$x_kv['other'], 
$x_f1); 
} else { 
$x_dw = $this->x_ex(); 
} 
$this->x_ds[$x_1m] = $x_dw; 
break; 
case 4: 
$this->x_ds[$x_1m] = $this->x_l5($x_kv); 
break; 
case 5: 
if (!empty($x_kv[0])) { 
$this->x_ds[$x_1m] = $this->x_ka($x_kv[0], $x_kv[1], $x_kv[2], $x_kv[3]); 
} 
break; 
case 6: 
$this->x_ds[$x_1m] = $this->x_l6($x_kv); 
break; 
case 7: 
$this->x_ds[$x_1m] = $this->x_l7($x_kv); 
break; 
case 8: 
$this->x_ds[$x_1m] = $this->x_l8($x_kv); 
break; 
} 
} 
function x_2f() { 
$x_7x = kerio("webiface::PhpNonAuth"); 
$x_eo = ''; 
$x_ep = Array(); 
$x_7x->getProductInfo($x_ep); 
$x_eo = $x_ep['fwName']; 
$x_l9 = '


				<table class="pageHeader fullWidth" cellpadding="0" cellspacing="0" border="0">


					<tr>


						<td class="headerIcon big bold">


							' . $this->kp_getImage(IMAGE_PATH . $this->x_b7, 32, 32, '', 'align="absmiddle"') . 
$this->x_6u . '


						</td>


						<td align="right">


							' . $this->kp_getImage(IMAGE_PATH . 'print_logo.gif', 113, 20) . '


						</td>


					</tr>


				</table>'; 
if (('individual' == $this->x_v || 'activity' == $this->x_v) && !empty($this->x_kr)) { 
$x_la = $this->x_kr['x_lb']['fullname']; 
$x_28 = $this->x_kr['x_lb']['username']; 
$x_lc = $this->x_kr['EMAIL']['value']; 
$x_ld = $this->x_kr['DESCRIPTION']['value']; 
if ($x_lc != '') { 
$x_le = '<kerio:text id="email" />: <span class="bold">' . $x_lc . '</span>'; 
} else { 
$x_le = '&nbsp;'; 
} 
if ($x_ld != '') { 
$x_lf = '<kerio:text id="description" />: ' 
. substr($x_ld, 0, 70); 
} else { 
$x_lf = '&nbsp;'; 
} 
$x_6u = x_6e( 'all', 
$this->x_a9, 
$x_28, 
$x_la, 
false, 
true, 
500, 
true, 
x_6a()); 
$x_l9 .= '	<table class="infoHeader fullWidth" cellpadding="0" cellspacing="0" border="0">


								<tr>


									<td class="big bold">' 
. $x_6u 
. '</td>


								</tr>


								<tr>


									<td>' 
. $x_le 
. '</td>


								</tr>


								<tr>


									<td>' 
. $x_lf 
. '</td>


								</tr>


								</table>'; 
} 
if ('traffic' == $this->x_v) { 
$x_l9 .= '<table class="infoHeader fullWidth" ' . 
'cellpadding="0" cellspacing="0" border="0">


								<tr>


									<td class="big bold">' 
. ($this->x_ko != 0 ? 
'<kerio:text id="lang_protocol" />: ' . $this->x_kp : 
'<kerio:text id="allProtocols" />' 
) 
. '</td>


								</tr>


							</table>'; 
} 
$x_l9 .= '<table class="infoHeader fullWidth" ' . 
'cellpadding="0" cellspacing="0" border="0">


							<tr>


								<td class="big bold">


									' . $this->x_7j . '


								</td>


								<td align="right">


									<kerio:text id="lang_firewall" />:&nbsp;<span class="bold">' . $x_eo . '</span>


								</td>


							</tr>


							<tr>	


								<td colspan="2">


									' . $this->x_b9(false) . 
'</td>


							</tr>


						</table>'; 
return $x_l9; 
} 
function x_l2() { 
return '<table cellpadding="0" cellspacing="0" border="0" class="pageFooter fullWidth">' . 
'<tr>' . 
'<td colspan="2">' . $this->x_b9(false) . '</td>' . 
'</tr>' . 
'<tr>' . 
'<td align="left"><kerio:text id="starGenerated" /> - www.kerio.com/kwf</td>' . 
'<td align="right">' . $this->x_kt . '</td>' . 
'</tr>' . 
'</table>'; 
} 
function x_lg() { 
switch ($this->x_v) { 
case 'overall' : 
$x_v = '


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td colspan="2" class="heading">' . $this->x_ks . '</td>


						</tr>


						<tr>


							<td colspan="2">' . $this->x_b9() . '</td>


						</tr>


						<tr class="trafficSamples">


							<td align="left" class="pTop">' . $this->x_ds[1] . '</td>


							<td align="center" class="pTop">' . $this->x_ds[2] . '</td>


						</tr>


					</table>


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td class="heading halfWidth"><kerio:text id="top" /> ' . $this->x_kn .' <kerio:text id="usersSmall" /></td>


							<td rowspan="4" class="divider"></td>


							<td class="heading halfWidth"><kerio:text id="usedProtocols" /></td>


						</tr>


						<tr>


							<td>' . $this->x_b9() . '</td>


							<td>' . $this->x_b9() . '</td>


						</tr>


						<tr class="topGraphs">


							<td align="center" class="pTop">' . $this->x_ds[3] . '</td>


							<td align="center" class="pTop">' . $this->x_ds[4] . '</td>


						</tr>


						<tr class="topTables">


							<td align="center" valign="top">' . $this->x_ds[5] . '</td>


							<td align="center" valign="top">' . $this->x_ds[6] . '</td>


						</tr>


					</table>


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td class="heading"><kerio:text id="topWebsites" /></td>


						</tr>


						<tr>


							<td>' . $this->x_b9() . '</td>


						</tr>		


						<tr>


							<td align="center" class="topWebs pTop">' . $this->x_ds[7] . '</td>


						</tr>


					</table>


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td class="heading"><kerio:text id="requestedCategories" /></td>


						</tr>


						<tr>


							<td>' . $this->x_b9() . '</td>


						</tr>		


						<tr>


							<td align="center" class="topWebs pTop">' . $this->x_ds[8] . '</td>


					</tr>


					</table>


					'; 
break; 
case 'individual' : 
$x_v = '


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td colspan="2" class="heading">' . $this->x_ks . '</td>


						</tr>


						<tr>


							<td colspan="2">' . $this->x_b9() . '</td>


						</tr>		


						<tr class="trafficSamples">


							<td align="left" class="pTop">' . $this->x_ds[1] . '</td>


							<td align="center" class="pTop">' . $this->x_ds[2] . '</td>


						</tr>


					</table>


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td colspan="3" class="heading"><kerio:text id="usedProtocols" /></td>


						</tr>


						<tr>


							<td colspan="3">' . $this->x_b9() . '</td>


						</tr>		


						<tr class="topGraphs">


							<td align="center" class="pTop halfWidth">' . $this->x_ds[3] . '</td>


							<td rowspan="3" class="divider"></td>


							<td align="left" valign="top" class="halfWidth">' . $this->x_ds[4] . '</td>


						</tr>


					</table>


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td class="heading"><kerio:text id="topWebsites" /></td>


						</tr>


						<tr>


							<td>' . $this->x_b9() . '</td>


						</tr>		


						<tr align="center" class="topWebs pTop">


							<td>' . $this->x_ds[5] . '</td>


						</tr>


					</table>


					<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


						<tr>


							<td class="heading"><kerio:text id="requestedCategories" /></td>


						</tr>


						<tr>


							<td>' . $this->x_b9() . '</td>


						</tr>		


						<tr align="center" class="topWebs pTop">


							<td>' . $this->x_ds[6] . '</td>


					</tr>


					</table>


					'; 
break; 
case 'traffic': 
$x_v = $this->x_ds[1]; 
break; 
case 'sites': 
case 'categories': 
$x_v = Array($this->x_ds[1], $this->x_ds[2]); 
break; 
} 
return $x_v; 
} 
function x_l4($x_kv) { 
if (!empty($x_kv)) { 
$x_f1 = Array('horizontal' => 0, 
'singleColor' => 1, 
'axisProperty' => webiface_SHOW_LABEL | webiface_SHOW_LINE | webiface_SHOW_TITLE | webiface_FORMAT_NUMBER , 
'axisName' => '', 
'fixedX' => 50, 
'fixedY' => -1, 
'print' => $this->x_ku); 
$x_dw = $this->kp_getCountedImage('bar', 460, 180, 
$x_kv, '', 
$x_f1); 
} elseif (-1 == $this->x_a9) { 
$x_dw = $this->x_ey(); 
} else { 
$x_dw = $this->x_ex(); 
} 
return $x_dw; 
} 
function x_l5($x_kv) { 
if (!empty($x_kv['data'])) { 
$x_f1 = Array('property' => webiface_REMOVE_OVERLAPPED_LABELS, 
'print' => $this->x_ku); 
$x_dw = $this->kp_getCountedImage('pie', 280, 150, 
$x_kv, 
$x_kv['other'], 
$x_f1); 
} elseif (-1 == $this->x_a9) { 
$x_dw = $this->x_ey(); 
} else { 
$x_dw = $this->x_ex(); 
} 
return $x_dw; 
} 
function x_l6($x_kv) { 
if (!empty($x_kv[0])) { 
return $this->x_ka($x_kv[0], $x_kv[1], $x_kv[2], $x_kv[3]); 
} 
} 
function x_l7($x_kv) { 
if (!empty($x_kv['data'])) { 
$x_f1 = Array('horizontal' => 1, 
'singleColor' => 1, 
'axisProperty' => webiface_SHOW_LABEL | webiface_SHOW_LINE | webiface_SHOW_TITLE | webiface_FORMAT_NUMBER , 
'axisName' => '', 
'fixedX' =>186, 
'fixedY' =>0, 
'print' => $this->x_ku); 
$x_dw = $this->kp_getCountedImage('bar', 590, 105, 
$x_kv, '', 
$x_f1); 
} elseif (!empty($x_kv['message'])) { 
$x_dw = '<kerio:text id="websites_noData" />'; 
} elseif (-1 == $this->x_a9) { 
$x_dw = $this->x_ey(); 
} else { 
$x_dw = $this->x_ex(); 
} 
return $x_dw; 
} 
function x_l8($x_kv) { 
if (!empty($x_kv)) { 
$x_f1 = Array('horizontal' => 1, 
'singleColor' => 1, 
'axisProperty' => webiface_SHOW_LABEL | webiface_SHOW_LINE | webiface_SHOW_TITLE | webiface_FORMAT_NUMBER , 
'axisName' => '', 
'fixedX' =>186, 
'fixedY' =>0, 
'print' => $this->x_ku); 
$x_dw = $this->kp_getCountedImage('bar', 590, 105, 
$x_kv, '', 
$x_f1); 
} elseif (-1 == $this->x_a9) { 
$x_dw = $this->x_ey(); 
} else { 
$x_dw = $this->x_ex(); 
} 
return $x_dw; 
} 
function x_lh() { 
$x_5c = ''; 
if ('traffic' == $this->x_v && is_array($this->x_ds[1])) { 
$x_1w = ''; 
$x_36 = count($this->x_ds[1]); 
if ($x_36 != 0) { 
foreach ($this->x_ds[1] as $x_1m => $x_7d) { 
$x_li = ($x_1m < $x_36 - 1 ? false : true); 
$x_lj = (0 == $x_1m ? '' : ' class="noScreen"'); 
$x_lk = (!$x_li ? ' class="noScreen"' : ''); 
$x_1w .= '<table class="printPage' . (!$x_li ? ' pageBreak' : '') . '">' 
. '<thead><tr><td><div' . $x_lj . '>' . $this->x_2f() . '</div></td></tr></thead>' 
. '<tbody><tr><td valign="top">' . $x_7d . '</td></tr></tbody>' 
. '<tfoot><tr><td><div' . $x_lk . '>' . $this->x_l2() . '</div></td></tr></tfoot>' 
. '</table>'; 
} 
$x_5c = '<div align="center">' 
. $x_1w 
.'</div>'; 
} else { 
$x_5c = $this->x_l1(); 
} 
} elseif (('sites' == $this->x_v || 'categories' == $this->x_v) && is_array($this->x_ds[2])) { 
if (!empty($this->x_ds[2])) { 
$x_1w = ''; 
$x_3u = ''; 
$x_7p = 1; 
if ($this->x_kn <= 13) { 
$x_ll = 3; 
} elseif ($this->x_kn > 13 && $this->x_kn <= 20) { 
$x_ll = 2; 
} else { 
$x_ll = 0; 
} 
if (isset($this->x_ds[1])) { 
$x_3u .= '<table cellpadding="0" cellspacing="0" border="0" class="fullWidth">


										<tr><td class="heading">' 
. ('categories' == $this->x_v ? '<kerio:text id="requestedCategories" />' : '<kerio:text id="topWebsites" />') . 
'</td></tr>


										<tr>


											<td>' . $this->x_b9() . '</td>


										</tr>		


										<tr>


											<td align="center" valign="top" class="pTop fullWidth">' . $this->x_ds[1] . '</td>


										</tr>


									</table>'; 
$x_7p++; 
} 
$x_36 = count($this->x_ds[2]); 
foreach ($this->x_ds[2] as $x_1m => $x_7d) { 
$x_li = ($x_1m < $x_36 - 1 ? false : true); 
$x_lj = ($x_1m <= $x_ll ? '' : ' class="noScreen"'); 
$x_lk = (!$x_li ? ' class="noScreen"' : ''); 
$x_3u .= $x_7d; 
if (($x_7p >= $x_ll || $x_36 -1 == $x_1m) && $x_ll != 0) { 
$x_1w .= '<table class="printPage' . (!$x_li ? ' pageBreak' : '') . '">' 
. '<thead><tr><td class="headerSmall"><div' . $x_lj . '>' . $this->x_2f() . '</div></td></tr></thead>' 
. '<tbody><tr><td valign="top" class="fullHeight">' . $x_3u . '</td></tr></tbody>' 
. '<tfoot><tr><td><div' . $x_lk . '>' . $this->x_l2() . '</div></td></tr></tfoot>' 
. '</table>'; 
$x_3u = ''; 
$x_7p = 0; 
} 
$x_7p++; 
} 
if ($x_ll != 0) { 
$x_5c = '<div align="center">' 
. $x_1w 
.'</div>'; 
} else { 
$x_5c = '<div align="center">' . 
'<table class="printPage">' 
. '<thead><tr><td class="headerSmall">' . $this->x_2f() . '</td></tr></thead>' 
. '<tbody><tr><td valign="top">' . $x_3u . '</td></tr></tbody>' 
. '<tfoot><tr><td>' . $this->x_l2() . '</td></tr></tfoot>' 
. '</table>' 
.'</div>'; 
} 
} else { 
$x_5c = $this->x_l1(); 
} 
} else { 
$x_5c = '<div align="center">' . 
'<table class="printPage">' 
. '<thead><tr><td>' . $this->x_2f() . '</td></tr></thead>' 
. '<tbody><tr><td valign="top" class="fullHeight">' . $this->x_lg() . '</td></tr></tbody>' 
. '<tfoot><tr><td>' . $this->x_l2() . '</td></tr></tfoot>' 
. '</table>' 
.'</div>'; 
} 
return $x_5c; 
} 
} 
?>
