/** * Carrega a tela principal do backend */ public function indexAction() { $this->session->start(); if ($this->session->get("user_id") != NULL) { $posts = Posts::findByPost_status_id(1); $vars = $this->getUserLoggedInformation(); $vars += $this->getApiSocialsData(); //Busca as últimas 15 postagens $posts = Posts::find(array("conditions" => "post_status_id = :status:", "order" => "post_date_posted DESC", "limit" => 15, "bind" => array("status" => 1))); //Conta o total de postagens existentes; $vars['total_posts'] = count($posts); //Cria uma prévia do conteúdo da postagem foreach ($posts as $post) { $post_content[$post->post_id] = substr(strip_tags($post->post_content), 0, 500) . "..."; } $vars['posts'] = $posts; $vars['post_content'] = $post_content; $vars['menus'] = $this->getSideBarMenus(); $this->view->setVars($vars); $this->view->render('dashboard', 'index'); } else { $this->response->redirect(URL_PROJECT . "admin"); } }