forked from cynial/STBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
100 lines (86 loc) · 2.44 KB
/
Copy pathdashboard.php
File metadata and controls
100 lines (86 loc) · 2.44 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* STBlog Blogging System
*
* 基于Codeigniter的单用户多权限开源博客系统
*
* STBlog is an open source multi-privilege blogging System built on the
* well-known PHP framework Codeigniter.
*
* @package STBLOG
* @author Saturn <huyanggang@gmail.com>
* @copyright Copyright (c) 2009 - 2010, cnsaturn.com.
* @license GNU General Public License 2.0
* @link http://code.google.com/p/stblog/
* @version 0.1.0
*/
// ------------------------------------------------------------------------
/**
* STBLOG Dashboard Controller Class
*
* 控制台控制器
*
* @package STBLOG
* @subpackage Controller
* @category Admin Controller
* @author Saturn <huyanggang@gmail.com>
* @link http://code.google.com/p/stblog/
*/
class Dashboard extends ST_Auth_Controller {
/**
* 传递到对应视图的数据
*
* @access private
* @var array
*/
private $_data = array();
/**
* 构造函数
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
/** 页面导航栏和标题 */
$this->_data['page_title'] = '网站概要';
$this->_data['parentPage'] = 'dashboard';
$this->_data['currentPage'] = 'dashboard';
}
/**
* 默认执行函数
*
* @access public
* @return void
*/
public function index()
{
/** 权限确认 */
$this->auth->exceed('contributor');
/** 最新日志文章5条 */
$my_recent_posts = $this->posts_mdl->get_posts('post', 'publish', $this->user->uid, 5, 0);
if($my_recent_posts->num_rows() >0)
{
foreach($my_recent_posts->result() as $recent_post)
{
$this->metas_mdl->get_metas($recent_post->pid);
$recent_post->categories = Common::format_metas($this->metas_mdl->metas['category']);
}
}
/** 最新评论5条 */
$my_recent_cmts = $this->comments_mdl->get_cmts_by_owner('comment', 'approved', $this->user->uid, 5, 0);
if($my_recent_cmts->num_rows() > 0)
{
foreach($my_recent_cmts->result() as $recent_cmt)
{
$recent_cmt->parent_post = $this->posts_mdl->get_post_by_id('pid', $recent_cmt->pid);
}
}
$this->_data['my_recent_posts'] = $my_recent_posts;
$this->_data['my_recent_cmts'] = $my_recent_cmts;
$this->load->view('admin/dashboard',$this->_data);
}
}
/* End of file dashboard.php */
/* Location: ./application/controllers/admin/dashboard.php */