function test_File_fields() { $POD = new PeoplePod(); $user = $POD->getPerson(array('nick' => 'admin')); $POD->changeActor(array('id' => $user->id)); $most_recent = $POD->getFiles(array('userId' => $user->get('id'))); $file = $most_recent->getNext(); $this->assertIsA($file, 'File'); $this->assertTrue($file->isImage()); $creator = $file->creator(); $this->assertIsA($creator, 'Person'); $owner = $file->owner(); $this->assertIsA($owner, 'Person'); $this->assertTrue($file->get('userId'), $user->id); $this->assertEqual($file->get('extension'), 'jpg'); $this->assertNotNull($file->get('id')); $this->assertNotNull($file->get('contentId')); $this->assertEqual($file->get('original_name'), 'darwin.jpg'); $this->assertNull($file->get('description')); //should this be initialized to null? $this->assertEqual($file->get('mime_type'), 'image/jpeg'); $this->assertNotNull($file->get('date')); $this->assertNotNull($file->get('minutes')); $parent_content = $file->parent(); $this->assertIsA($parent_content, 'Content'); $this->assertEqual($parent_content->get('headline'), 'Darwin'); //now attempt to get a file by means of getFile() $new_file = $POD->getFile(array('id' => $file->get('id'))); $this->assertIsA($new_file, 'File'); }
$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(); $groups = $POD->getGroups(array(), 'date desc', 10); $stats['groups_total'] = $groups->totalCount(); ?> <script type="text/javascript"> function doSearch() {
$files = $user->files(); $title = $user->nick; } $newfile = $POD->getFile(array('userId' => $user->get('id'))); } else { if (isset($_GET['groupId'])) { $group = $POD->getGroup(array('id' => $_GET['groupId'])); if (!$group->success()) { $message = $group->error(); } else { $files = $group->files(); $title = $group->groupname; } $newfile = $POD->getFile(array('groupId' => $group->get('id'))); } else { $files = $POD->getFiles(); $title = "All Files"; } } } if (isset($_POST['delete'])) { $f = $POD->getFile(array('id' => $_POST['id'])); if ($f->success()) { $f->delete(); if (!$f->success()) { $message = $f->error(); } else { $message = "File deleted!"; } } else { $message = $f->error();