CMS MADE SIMPLE FORGE

Statistics

 

[#7237] Previous Day/Week/Month stats

avatar
Created By: JD (calx)
Date Submitted: 2011-11-23 06:52

Assigned To:
Resolution: None
State: Open
Summary:
Previous Day/Week/Month stats
Detailed Description:
There are sometimes need to view stats for last day, week or month (like many
statistics counters do).  Just add some new params to "what" - add sth like this
to GetResult function in Statistics.module.php:

case "last_day":{
  return $this->GetValue("count_day",date("Ymd",strtotime("-1 day")),0);
}
case "last_week":{
  $tt=strtotime("-1 week");
  if ((date("W",$tt)>5) AND (date("j",$tt)==1)) {
    return $this->GetValue("count_week",(date("Y",$tt)-1).date("W",$tt),0);
  } else {
    if ((date("W",$tt)>5) AND (date("m",$tt)==1)) {
      return $this->GetValue("count_week",(date("Y",$tt)-1).date("W",$tt),0);
    } else {
      return $this->GetValue("count_week",date("YW",$tt),0);
    }
  }
}
case "last_month":{
  return $this->GetValue("count_month",date("Ym",strtotime("-1 month")),0);
}

//etc.

History