1: <?php defined('_JOOS_CORE') or exit();
2:
3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16: class actionsNews extends joosController
17: {
18: public static function action_before()
19: {
20: joosBreadcrumbs::instance()
21: ->add('Главная', joosRoute::href('default'))
22: ->add('Новости', joosRoute::href('news'));
23:
24: joosDocument::instance()
25: ->add_js_file( JPATH_SITE . '/app/components/news/media/js/news.js' );
26:
27: }
28:
29: 30: 31: 32: 33: 34:
35: public static function index()
36: {
37: $news = new modelNews();
38:
39: $page = isset(self::$param['page']) ? self::$param['page'] : 0;
40: $pager = new joosPager(joosRoute::href('news'), $news->count('WHERE state = 1'), 5);
41: $pager->paginate($page);
42:
43: $news = $news->get_list(array(
44: 'where' => 'state = 1',
45: 'order' => 'id DESC',
46: 'limit' => $pager->limit,
47: 'offset' => $pager->offset
48: ));
49:
50: joosDocument::instance()
51: ->set_page_title('Новости')
52: ->add_meta_tag('description', 'Новости компании');
53:
54: joosBreadcrumbs::instance()
55: ->add('Новости');
56:
57: return array('news' => $news, 'pager' => $pager);
58: }
59:
60: public static function view()
61: {
62: $id = self::$param['id'];
63:
64: $item = new modelNews();
65: $item->id = $id;
66: $item->find() ? null : joosPages::page404();
67:
68: joosDocument::instance()
69: ->set_page_title($item->title)
70: ->add_meta_tag('description', 'Новости компании');
71:
72: return array('item' => $item);
73: }
74:
75:
76: public static function edit()
77: {
78: 79: 80: 81: 82:
83:
84: joosDocument::instance()
85: ->set_page_title('Новости')
86: ->add_meta_tag('description', 'Новости сайта');
87:
88: joosBreadcrumbs::instance()
89: ->add('Новости');
90:
91: return array();
92:
93: }
94:
95: private static function save()
96: {
97: joosCSRF::check_code(1);
98:
99: 100: 101: 102: 103:
104:
105: joosDocument::instance()
106: ->set_page_title('Новости')
107: ->add_meta_tag('description', 'Новости сайта');
108:
109: joosBreadcrumbs::instance()
110: ->add('Новости');
111:
112: return array();
113: }
114:
115: }
116: