Phalcon 框架随笔


namespace admin;
class WorkSpacesController extends BaseController
{
    function indexAction()
    {
        $operator_id = $this->session->get('operator_id');
        $operator = \Operators::findById($operator_id);

        $params = [];

        if ($operator->isAdmin()) {
            $params['article'] = [
                'article[operator_id_eq]' => $operator->id
            ];
        }

        debug($params);
        $this->view->article_link = '$params['article']) . '">我的文章';
        $this->view->comment_link = '我的评论';
    }

    function articlelistAction()
    {
            $page = $this->params('page');
            $cond = $this->getConditions('article');

            $cond['order'] = 'id desc';
            $articles = \Articles::findPagination($cond, $page);
            $this->view->articles = $articles;
            foreach($articles as $article){
                debug($article);
            }


        $this->pick('admin/articles/list');
    }

    function commentAction()
    {
        $page = $this->params('page');
        $cond = $this->getConditions('comment');
        $cond['order'] = 'id desc';

        $comments = \Comments::findPagination($cond, $page);
        $this->view->comments = $comments;

        $this->pick('/admin/comments/list');
    }
}

你可能感兴趣的:(php)