1: <?php
2:
3: 4: 5: 6: 7: 8: 9:
10:
11: defined('_JOOS_CORE') or exit();
12:
13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26: class pluginSitemapBlog
27: {
28: public static function get_mapdata_scheme()
29: {
30: return array(
31: array('id' => 'index',
32: 'link' => joosRoute::href('blog'),
33: 'title' => 'Блоги',
34: 'level' => 1,
35: 'type' => 'single',
36: 'priority' => 0.5,
37: 'changefreq' => 'daily'),
38: array('id' => 'dj',
39: 'link' => joosRoute::href('blog_cat', array('cat_slug' => 'dj')),
40: 'title' => 'Блоги крутых',
41: 'level' => 2,
42: 'type' => 'single',
43: 'priority' => 0.5,
44: 'changefreq' => 'daily'),
45: array('id' => 'dj',
46: 'link' => '',
47: 'title' => '',
48: 'level' => 3,
49: 'type' => 'list',
50: 'call_from' => 'blogMap::lists',
51: 'call_param' => array('cat_id' => 1,),
52: 'priority' => 0.5,
53: 'changefreq' => 'daily'),
54: );
55: }
56:
57: public static function lists($param)
58: {
59: $cat_id = $param['cat_id'];
60:
61: $sql = sprintf("SELECT b.id, b.title, b.created_at AS lastmod, c.slug as cat_slug FROM #__blog AS b
62: INNER JOIN #__blog_category AS c ON ( c.id=b.category_id AND c.state=1 AND c.id=%s )
63: WHERE b.state=1 ORDER BY b.id DESC", $cat_id);
64: $objs = joosDatabase::instance()->set_query($sql)->load_object_list();
65:
66: foreach ($objs as $obj) {
67: $obj->loc = joosRoute::href('blog_view', array('id' => $obj->id,
68: 'cat_slug' => $obj->cat_slug));
69: }
70:
71: return $objs;
72: }
73:
74: }
75: