/
promo.php
65 lines (45 loc) · 1.39 KB
/
promo.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?
require_once('includes/utils.php');
__autoload('PromoDAO');
class promoController extends BaseController {
// 0: guest
// 1: admin
// 2: mod
public function getPermissionDefine() {
return array(
'index' => array(0, 1, 2)
);
}
public function isAllowCountStats() {
return TRUE;
}
private function notFound() {
header('Location: ' . __SITE_CONTEXT);
}
public function index() {
if ( empty($_GET['seo_url']) ) {
$this->notFound();
return;
}
$promoDAO = new PromoDAO( DataSource::getInstance() );
$promo = $promoDAO->findBySeoUrl( $_GET['seo_url'] );
if (!$promo) {
$this->notFound();
return;
}
$categoryDAO = new CatDAO( DataSource::getInstance() );
$categories_list = $categoryDAO->findByAll_Navigation();
$cart = getCart();
$this->registry->template->categories_list = $categories_list;
$this->registry->template->cart = $cart;
$this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
$this->registry->template->is_promo_active = TRUE;
$this->registry->template->promo = $promo;
$this->registry->template->related_promos = $promoDAO->findNewestList();
$this->registry->template->tile_title = $promo['subject'];
$this->registry->template->tile_content = 'promo.php';
$this->registry->template->tile_footer = 'footer.php';
$this->registry->template->show('layout/user.php');
}
}
?>