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]); }
public function GroupAction() { $groups = GroupModel::GetAll()->all('ORDER BY `qty` DESC'); $this->render('setgroup', ['groups' => $groups]); }
<?php $groups = GroupModel::GetAll('id, name, qty')->all('ORDER BY qty DESC LIMIT 15'); ?> <div class="leftmenu"> <?php if ($group_id == 0) { $add = ' id="selected"'; } echo '<a href="' . Site::link('list/0/') . '" ' . $add . '>Все Направления</a>' . "\n"; foreach ($groups as $group) { $add = ''; if ($group_id == $group->id) { $add = ' id="selected"'; } echo '<a href="' . Site::link('list/' . $group->id . '/') . '"' . $add . '>' . $group->name . '</a>' . "\n"; } echo '<a href="' . Site::link('list/setgroup/') . '">Другие направления</a>' . "\n"; ?> </div> <a href="<?php echo Site::link('list/setregion/?id=0'); ?> " id="filter_btn">Сбросить настройки фильтра</a>