コード例 #1
0
 function testGetByUserId()
 {
     //print("\n user_id = {$this->user['_id']} \n");
     $articles = $this->articleManager->getByUserId($this->user['_id']);
     $this->assertTrue(!empty($articles));
     $this->assertTrue(count($articles) > 0);
 }
コード例 #2
0
 function getDashboard(Application $app)
 {
     $current_page = $app['request']->get("current_page") ? (int) $app['request']->get("current_page") : 1;
     $articles_per_pages = $app['request']->get('articles_per_pages') ? (int) $app['request']->get('articles_per_pages') : 5;
     $currentUser = $app['user_manager']->getUser();
     $app['monolog']->addInfo("current user : "******"user articles : " . json_encode($articles));
     $total_pages = ceil(count($articles) / $articles_per_pages);
     $paginated_articles = $this->paginator($articles, $current_page, $articles_per_pages);
     return $app["twig"]->render("article/dashboard.twig", array("articles" => $paginated_articles, "current_page" => $current_page, "articles_per_pages" => $articles_per_pages, "total_pages" => $total_pages, 'title' => 'Article Dashboard'));
 }