-
Notifications
You must be signed in to change notification settings - Fork 0
/
stocks.php
48 lines (39 loc) · 1.79 KB
/
stocks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
defined('SYSPATH') or die('No direct script access.');
class Controller_Stocks extends Controller_Frontend {
public $template = 'templates/frontend_news';
function before()
{
parent::before();
// breadcrumbs title
$this->template->bc['stocks'] = 'Акции автосервисов';
// add class for news pages
$this->template->css_class = 'wrapper-news';
}
function action_index()
{
$service = ORM::factory('service', Arr::get($_GET, 'service', NULL));
if ($service->loaded())
$this->request->redirect('services/'.$service->id.'/stocks', 301);
$this->template->title = 'Акции автосервисов';
// company_page = FALSE - указывает что это не страница акций компании
$this->view = View::factory('frontend/stock/all')
->set('company_page', FALSE)
->set('stock', ORM::factory('stock')->get_stocks())
->set('h1_title', $this->template->title);
$this->template->content = $this->view;
}
function action_view()
{
$stock = ORM::factory('stock', $this->request->param('id', NULL));
if (!$stock->loaded())
throw new HTTP_Exception_404('Акция не найдена');
else
$this->request->redirect('services/'.$stock->service->id.'/stocks/'.$stock->id, 301);
$this->view = View::factory('frontend/stock/view')
->set('stock', $stock);
$this->template->bc['#'] = 'Акция сервиса '.$stock->service->name;
$this->template->title = $this->site_name.'Акция сервиса '.$stock->service->name;
$this->template->content = $this->view;
}
}