Exemple #1
0
function avg_lifetime($query_name,$pattern,$qreplace)
{
  $r=get_queries($query_name);
  $r=replace_queries($r,$pattern,$qreplace);
  $res=SQL_select($r[0]['replaced_query']);
  $days=floor($res[0]['res']/(60*24));
  $hours=round(($res[0]['res']/60)-$days*24,0);
  $avg=array();
  $avg['days']=$days;
  $avg['hours']=$hours;
  return $avg;
}
Exemple #2
0
//days set
$days=$monthes[$month-1]['month_duration'];

$xtpl->assign("SECTION_NAME", "Statistics: Managers work for ".$monthes[$month-1]['month_name']." ".$year);


//user set
if ( (isset($_POST['user'])) and ($_POST['user'])!=0 )

{
    $user=$_POST['user'];

//main part: get from db, replace and execute queries
$r=get_queries('answers_ud','closed_ud','complains_ud','comments_ud');
$r=replace_queries($r,array("#year#","#month#","#user#"),array($year,$month,$user));
$d=do_queries_d($r,$days);

//drawing diagrams
foreach ($d as $dn=>$dv)
{
    $s='';
    foreach ($r as $rk=>$rv )
    {
        if (isset($dv[$rv['q_html_title']]))
        {
            $title=$dv[$rv['q_html_title']];
            $height=$title*2;
            $xtpl->assign("TD_CONTENT",'<a href="stat_tickets.php?uname='.$users[$user].'&user='******'&day='.$dn.'&month='.$month.'&year='.$year.'&type='.$rv['q_html_title'].'">'.$dv[$rv['q_html_title']].'</a>');
        }
        else
Exemple #3
0
$cond1 = array("appear"=>"appear", "not appear"=>"not appear");
$cond2 = array("contain"=>"contain","not contain"=>"not contain","appear"=>"appear", "not appear"=>"not appear");



//query formation
if (isset($_GET['user']))
{
  $r=get_queries($_GET['type'].'_for1day_u');
  $r=replace_queries($r,array("#year#","#month#","#day#","#user#"),array($_GET['year'],$_GET['month'],$_GET['day'],$_GET['user']));
  $xtpl->assign("SECTION_NAME", "You are viewing ".$_GET['type']." tickets for ".$_GET['day']."-".$_GET['month']."-".$_GET['year']." which were maded by ".$_GET['uname']);
}
else
{
  $r=get_queries($_GET['type'].'_for1day');
  $r=replace_queries($r,array("#year#","#month#","#day#"),array($_GET['year'],$_GET['month'],$_GET['day']));
  $xtpl->assign("SECTION_NAME", "You are viewing ".$_GET['type']." tickets for ".$_GET['day']."-".$_GET['month']."-".$_GET['year']);
}
$query=$r[0]['replaced_query'];

    $xtpl->assign("TABLE_HEADER", '<td class="table_header_text" align="center">#</td><td class="table_header_text" align="center"><a href="#" onclick="return false" onmouseup="select_all_checkboxs(\'select[]\',\'form1\')" class="table_header_text">Select</a></td><td align="center" class="table_header_text">Subject</td><td align="center" class="table_header_text">Queues</td><td align="center" class="table_header_text">Status</td><td align="center" class="table_header_text">Owner</td><td class="table_header_text" align="center">From</td><td align="center" class="table_header_text">Complain</td><td align="center" class="table_header_text">Rate</td><td class="table_header_text" align="center">Updated</td><td align="center" class="table_header_text">Created</td> ');

    $pg_sel=SQL_select($query);

        foreach($pg_sel as $i=>$row)
        {
            $xtpl->assign("NUM", ($i+1));
            $xtpl->assign("_ID", $i);
            $xtpl->assign("TICKET_ID", $row["id"]);
            $xtpl->assign("SELECT", "<input type=\"checkbox\" id=\"" . $i . "\" name=\"select[]\" value=\"" . $row["id"] . "\" onclick=\"change_tr_class(this)\">");
            if(strlen(trim($row["subject"])) > 0)
Exemple #4
0
//monthes
$mquery="SELECT * FROM monthes";
$monthes=SQL_select($mquery);

$today=getdate();
//year set
if ( (isset($_POST['year'])) and ($_POST['year'])!=0 )
    $year=$years[$_POST['year']];
else
    $year=$today['year'];

$xtpl->assign("SECTION_NAME", "Statistics: Summary for ".$year." year");

//main part: get from db, replace and execute queries
$r=get_queries('answers_y','closed_y','new_y','complains_y','comments_y');
$r=replace_queries($r,array("#year#"),array($year));
$d=do_queries_d($r,12);

//drawing diagrams
foreach ($d as $dn=>$dv)
{
    $s='';
    foreach ($r as $rk=>$rv )
    {
        if (isset($dv[$rv['q_html_title']]))
        {
            $title=$dv[$rv['q_html_title']];
            $height=$title/6;
            $xtpl->assign("TD_CONTENT",$dv[$rv['q_html_title']]);
        }
        else