<?php
class Overview extends Admin {

  public function __construct() {
  
    parent::__construct();

  }
  
  //---[CZ]: nejčtenější články
  public function most_read_articles() {
  
    $print=$this->db->query("SELECT id, quick, title, section, views, published FROM kcms_articles WHERE published!=0 ORDER by views DESC LIMIT 0,20");
    while(list($id, $quick, $title, $section, $views, $published)=$this->db->fetch_row($print)) {

    $comments=$this->db->query("SELECT COUNT(*) AS id FROM kcms_comments WHERE article=$id");
    $comments=$this->db->fetch_array($comments);

    echo "<tr>
    <td><a href=\"".$this->urls->article($quick)."\" target=\"_blank\">$title</a></td>
    <td style=\"text-align: right;\">".$views."</td>
    <td style=\"text-align: right;\">".$comments["id"]."</td>
    <td style=\"text-align: center;\" class=\"small-text\">".date("d.m.Y [H:i]", $published)."</td>
    </tr>\n";
    
    }
    
  }

}
?>