No permissions !"); // show_page_footer(); // exit; // } ?> Undefined serviceid !"); // show_page_footer(); // exit; } ?> "; $result=DBselect("select h.hostid,h.host from hosts h,items i where h.status=".HOST_STATUS_MONITORED." and h.hostid=i.hostid group by h.hostid,h.host order by h.host"); $year=date("Y"); for($year=date("Y")-2;$year<=date("Y");$year++) { $h2=$h2.form_select("year",$year,$year); } $h2=$h2.""; $h2=$h2.SPACE.S_PERIOD.SPACE; $h2=$h2.""; $h2=$h2.SPACE.S_MEDIA_TYPE.SPACE; $h2=$h2.""; show_header2($h1,$h2,"
", "
"); ?> setHeader($header,"vertical_header"); for($year=date("Y")-5;$year<=date("Y");$year++) { $start=mktime(0,0,0,1,1,$year); $end=mktime(0,0,0,1,1,$year+1); $table_row = array(nbsp($year)); $style = NULL; $counter=1; while ($counter<$uindex) { $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$start and clock<$end"); while($row=DBfetch($result)) { $count_all=$row[0]; } $i=0; while ($i<$type_count) { $i++; $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$start and clock<$end and mediatypeid=$idarray[$i]"); while($row=DBfetch($result)) { $count_by_type[$i]=$row[0]; } } if ($_REQUEST["media_type"]==0) { $total_count=$count_all; $total_count.=" ("; $i=0; while ($i<$type_count) { $i++; if($i>1) { $total_count.="/"; } $total_count.=$count_by_type[$i]; } $total_count.=")"; } $i=0; while($i<=$type_count) { $i++; if ($_REQUEST["media_type"]==$i) $total_count=$count_by_type[$i]; } array_push($table_row,new CCol($total_count,$style)); $counter++; } $table->AddRow($table_row); } } else if($_REQUEST["period"]=="monthly") { $header=array(new CCol(SPACE.S_MONTH,"center")); $uindex=1; $result=DBselect("select * from users order by alias"); while($row=DBfetch($result)) { $header=array_merge($header,array(new CImg("vtext.php?text=".$row["alias"]))); $userarray[$uindex]=$row["userid"]; $uindex++; } $table->setHeader($header,"vertical_header"); for($month=1;$month<=12;$month++) { $start=mktime(0,0,0,$month,1,$_REQUEST["year"]); $end=mktime(0,0,0,$month+1,1,$_REQUEST["year"]); if($start>time()) break; $table_row = array(nbsp(date("M Y",$start))); $style = NULL; $counter=1; while ($counter<$uindex) { $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$start and clock<$end"); while($row=DBfetch($result)) { $count_all=$row[0]; } $i=0; while ($i<$type_count) { $i++; $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$start and clock<$end and mediatypeid=$idarray[$i]"); while($row=DBfetch($result)) { $count_by_type[$i]=$row[0]; } } if ($_REQUEST["media_type"]==0) { $total_count=$count_all; $total_count.=" ("; $i=0; while ($i<$type_count) { $i++; if($i>1) { $total_count.="/"; } $total_count.=$count_by_type[$i]; } $total_count.=")"; } $i=0; while($i<=$type_count) { $i++; if ($_REQUEST["media_type"]==$i) $total_count=$count_by_type[$i]; } array_push($table_row,new CCol($total_count,$style)); $counter++; } $table->AddRow($table_row); } } else if($_REQUEST["period"]=="daily") { $header=array(new CCol(SPACE.S_DAY,"center")); $uindex=1; $result=DBselect("select * from users order by alias"); while($row=DBfetch($result)) { $header=array_merge($header,array(new CImg("vtext.php?text=".$row["alias"]))); $userarray[$uindex]=$row["userid"]; $uindex++; } $table->setHeader($header,"vertical_header"); $s=mktime(0,0,0,1,1,$_REQUEST["year"]); $e=mktime(0,0,0,1,1,$_REQUEST["year"]+1); for($day=$s;$day<$e;$day+=24*3600) { $start=$day; $end=$day+24*3600; if($start>time()) break; $table_row = array(nbsp(date("d M Y",$start))); $style = NULL; $counter=1; while ($counter<$uindex) { $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$start and clock<$end"); while($row=DBfetch($result)) { $count_all=$row[0]; } $i=0; while ($i<$type_count) { $i++; $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$start and clock<$end and mediatypeid=$idarray[$i]"); while($row=DBfetch($result)) { $count_by_type[$i]=$row[0]; } } if ($_REQUEST["media_type"]==0) { $total_count=$count_all; $total_count.=" ("; $i=0; while ($i<$type_count) { $i++; if($i>1) { $total_count.="/"; } $total_count.=$count_by_type[$i]; } $total_count.=")"; } $i=0; while($i<=$type_count) { $i++; if ($_REQUEST["media_type"]==$i) $total_count=$count_by_type[$i]; } array_push($table_row,new CCol($total_count,$style)); $counter++; } $table->AddRow($table_row); } } else { //-------Weekly------------- $year=date("Y"); $header=array(new CCol(SPACE.S_FROM,"center"),new CCol(SPACE.S_TILL,"center")); $uindex=1; $result=DBselect("select * from users order by alias"); while($row=DBfetch($result)) { $header=array_merge($header,array(new CImg("vtext.php?text=".$row["alias"]))); $userarray[$uindex]=$row["userid"]; $uindex++; } $table->setHeader($header,"vertical_header"); for($year=date("Y")-2;$year<=date("Y");$year++) { if( isset($_REQUEST["year"]) && ($_REQUEST["year"] != $year) ) { continue; } $start=mktime(0,0,0,1,1,$year); $wday=date("w",$start); if($wday==0) $wday=7; $start=$start-($wday-1)*24*3600; $i=0; for($i=0;$i<53;$i++) { $period_start=$start+7*24*3600*$i; $period_end=$start+7*24*3600*($i+1); if($period_start>time()) { break; } $from=date(S_DATE_FORMAT_YMD,$period_start); $till=date(S_DATE_FORMAT_YMD,$period_end); $table_row = array($from,$till); $style = NULL; $counter=1; while ($counter<$uindex) { $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$period_start and clock<$period_end"); while($row=DBfetch($result)) { $count_all=$row[0]; } $k=0; while ($k<$type_count) { $k++; $result=DBselect("select count(*) from alerts where userid='$userarray[$counter]' and clock>$period_start and clock<$period_end and mediatypeid=$idarray[$k]"); while($row=DBfetch($result)) { $count_by_type[$k]=$row[0]; } } if ($_REQUEST["media_type"]==0) { $total_count=$count_all; $total_count.=" ("; $l=0; while ($l<$type_count) { $l++; if($l>1) { $total_count.="/"; } $total_count.=$count_by_type[$l]; } $total_count.=")"; } $m=0; while($m<=$type_count) { $m++; if ($_REQUEST["media_type"]==$m) $total_count=$count_by_type[$m]; } array_push($table_row,new CCol($total_count,$style)); $counter++; } $table->AddRow($table_row); } } //--------Weekly------------- } $table->show(); if ($_REQUEST["media_type"]=="0") { $style = "off"; $table = new CTableInfo(); $types="all ("; $i=0; while($i<$type_count) { $i++; if($i>1) {$types.="/";} $types.=$descarray[$i]; } $types.=")"; $table->AddRow(new CSpan(SPACE.SPACE.SPACE.SPACE.SPACE.SPACE.$types,$style)); $table->Show(); } show_page_footer(); ?>