public function IndexAction() { $top = CompanyModel::GetAll('id, name')->order('rate DESC', 10); $top_groups = GroupModel::GetAll('id, name')->order('qty DESC', 10); $last_company = CompanyModel::GetObj()->where('id = (select max(id) from companys)'); $products = SQL::Query('SELECT * FROM `products` ORDER BY id DESC LIMIT 3')->fetchAll(PDO::FETCH_OBJ); $company_count = SQL::Query('SELECT count(*) as total FROM `companys`')->fetch(PDO::FETCH_OBJ)->total; $groups_count = SQL::Query('SELECT count(*) as total FROM `groups`')->fetch(PDO::FETCH_OBJ)->total; Site::$sub = '<div class="div30 center">' . "\n" . 'Компаний на портале <h1><a href="' . Site::Link('list') . '">' . $company_count . '</a></h1>' . "\n" . '</div>' . "\n" . '<div class="div30 center">' . "\n" . 'Сфер деятельности <h1><a href="' . Site::Link('list/setgroup') . '">' . $groups_count . '</a></h1>' . "\n" . '</div>' . "\n"; $this->render('index', ['top_arr' => $top, 'top_groups' => $top_groups, 'last' => $last_company, 'products' => $products]); }