<?php

class blogPersonal extends blogBase {

  protected function getActiveBlogSql($activeType, $matchType) {
    $bl_id = $this->blog->getBlId();
    switch ($activeType) {
      case 'all':
        return
         "select bl_id, bl_hit from tblblog, tblbloguser
          where us_user=bl_user and us_blog=$bl_id and
          bl_type $matchType
          order by bl_hit desc limit 9";

      case 'week':
        $week = myUtility::dateToWeek(date('Y-m-d'));
        return
         "select std_blog, sum(std_visitors) as s
          from tblblogstatday use index (std_date), tblbloguser
          where us_user=std_blogadmin and us_blog=$bl_id and
          std_date>='$week' and std_blogtype $matchType
          group by(std_blog)
          order by s desc limit 9";

      case 'day':
        $today = date('Y-m-d');
        return
         "select std_blog, std_visitors from tblblogstatday, tblbloguser
          where us_user=std_blogadmin and us_blog=$bl_id and
          std_date='$today' and std_blogtype $matchType
          order by std_visitors desc limit 9";
    }
  }

}
?>
