$members = $POD->getPeople(array(), 'memberSince DESC', 10); $stats['members_total'] = $members->totalCount(); $visitors = $POD->getPeople(array('lastVisit:gte' => date('Y-m-d') . ' 00:00:00')); $stats['visits_today'] = $visitors->totalCount(); $visitors = $POD->getPeople(array('lastVisit:gte' => date('Y-m-d', strtotime('-7 days')))); $stats['visits_week'] = $visitors->totalCount(); $visitors = $POD->getPeople(array('lastVisit:gte' => date('Y-m-d', strtotime('-30 days'))), 'lastVisit DESC', 10); $stats['visits_total'] = $visitors->totalCount(); $content = $POD->getContents(array('date:gte' => date('Y-m-d') . ' 00:00:00')); $stats['content_today'] = $content->totalCount(); $content = $POD->getContents(array('date:gte' => date('Y-m-d', strtotime('-7 days')))); $stats['content_week'] = $content->totalCount(); $content = $POD->getContents(array(), 'date desc', 10); $stats['content_total'] = $content->totalCount(); $active_content = $POD->getContents(array(), 'commentDate DESC', 10); $comments = $POD->getComments(array('date:gte' => date('Y-m-d') . ' 00:00:00')); $stats['comments_today'] = $comments->totalCount(); $comments = $POD->getComments(array('date:gte' => date('Y-m-d', strtotime('-7 days')))); $stats['comments_week'] = $comments->totalCount(); $comments = $POD->getComments(array(), 'date desc', 10); $stats['comments_total'] = $comments->totalCount(); $files = $POD->getFiles(array('date:gte' => date('Y-m-d') . ' 00:00:00')); $stats['files_today'] = $files->totalCount(); $files = $POD->getFiles(array('date:gte' => date('Y-m-d', strtotime('-7 days')))); $stats['files_week'] = $files->totalCount(); $files = $POD->getFiles(array(), 'date desc', 10); $stats['files_total'] = $files->totalCount(); $groups = $POD->getGroups(array('date:gte' => date('Y-m-d') . ' 00:00:00')); $stats['groups_today'] = $groups->totalCount(); $groups = $POD->getGroups(array('date:gte' => date('Y-m-d', strtotime('-7 days')))); $stats['groups_week'] = $groups->totalCount();
function testCommentFunctions() { $POD = new PeoplePod(); $user = $POD->getPerson(); $user->email = '*****@*****.**'; //create user $user->password = '******'; $user->nick = 'test'; $user->save(); $POD->changeActor(array('id' => $user->id)); $content = $POD->getContent(); $content->set('headline', 'this is the headline'); $content->set('type', 'this is the type'); $content->save(); $comment = $content->addComment('amazing!'); $comment->type = 'rating'; $comment2 = $content->addComment('blah'); $comment->type = 'rating'; $this->assertEqual($comment->author()->get('id'), $user->id); $this->assertEqual($comment->parent()->id, $content->id); $comment_stack = $content->comments(); $this->assertEqual($comment_stack->count(), 2); $next_comm = $comment_stack->getNext(); $this->assertIsA($next_comm, 'Comment'); $pod_comm_stack = $POD->getComments(); $pod_comm = $pod_comm_stack->getNext(); $this->assertIsA($pod_comm, 'Comment'); //test getComment to return a specific comment $pull_comm = $POD->getComment(array('id' => $comment2->id)); $this->assertEqual($pull_comm->comment, 'blah'); //test getComment to create a comment and associate it with a person and content obj $new_comment = $POD->getComment(); $new_comment->set('comment', 'This comment sucks!'); $new_comment->set('userId', $user->id); $new_comment->set('contentId', $content->get('id')); $new_comment->save(); $comment_stack = $POD->getComments(array('userId' => $user->id)); $this->assertEqual($comment_stack->count(), 3); $comment->delete(); $content->delete(); $user->delete(); }
?> <div class="info"> <?php echo $msg; ?> </div> <?php } $comment->output('comment.edit'); } else { if (isset($_GET['type'])) { $type = $_GET['type']; if ($type == 'comment') { $type = 'null'; } $comments = $POD->getComments(array('type' => $type), 'date desc'); } else { $comments = $POD->getComments(array(), 'date desc'); } if (isset($_GET['offset'])) { $comments->getOtherPage($_GET['offset']); } if (isset($msg)) { ?> <div class="info"> <?php echo $msg; ?> </div> <?php }