/** * Test getTag method * * @return void */ public function testGetTagSample() { $bookmarks = WpHerissonBookmarksTable::getTag($this->sampleTag); $this->assertEquals(get_class($bookmarks), 'Doctrine_Collection'); $this->assertCount(0, $bookmarks); // Create a sample bookmark $f = new WpHerissonBookmarks(); $f->url = $this->sampleUrl; $f->title = $this->sampleName; $f->description = $this->sampleDescription; $f->addTags('helloworld'); $f->save(); $bookmarks = WpHerissonBookmarksTable::getTag($this->sampleTag); $this->assertEquals(get_class($bookmarks), 'Doctrine_Collection'); $this->assertCount(0, $bookmarks); // Create a sample bookmark $f = new WpHerissonBookmarks(); $f->url = $this->sampleUrl; $f->title = $this->sampleName; $f->description = $this->sampleDescription; $f->addTags($this->sampleTag); $f->save(); $bookmarks = WpHerissonBookmarksTable::getTag($this->sampleTag); $this->assertEquals(get_class($bookmarks), 'Doctrine_Collection'); $this->assertCount(1, $bookmarks); // Create a sample bookmark $f = new WpHerissonBookmarks(); $f->url = $this->sampleUrl; $f->title = $this->sampleName; $f->description = $this->sampleDescription; $f->addTags($this->sampleTag); $f->save(); $bookmarks = WpHerissonBookmarksTable::getTag($this->sampleTag); $this->assertEquals(get_class($bookmarks), 'Doctrine_Collection'); $this->assertCount(2, $bookmarks); }
/** * Action to display homepage of Herisson site * * This is the default action * * @return void */ function indexAction() { $tag = get('tag'); $search = get('search'); if ($tag) { $bookmarks = WpHerissonBookmarksTable::getTag(array($tag), true); } else { if ($search) { $bookmarks = WpHerissonBookmarksTable::getSearch($search, true); } else { $bookmarks = WpHerissonBookmarksTable::getAll(true); } } $this->view->bookmarks = $bookmarks; $this->view->title = $this->options['sitename']; $this->view->friends = WpHerissonFriendsTable::getWhere("is_active=1"); foreach ($this->view->friends as $friendId => $friend) { $this->view->friendBookmarks[$friend->id] = $friend->retrieveBookmarks($_GET); } }
/** * Action to list bookmarks * * This is the default action * * @return void */ function indexAction() { $tag = get('tag'); if ($tag) { $this->view->subtitle = __("Results for tag « " . esc_html($tag) . " »"); $this->view->countAll = sizeof(WpHerissonBookmarksTable::getTag($tag)); $this->view->bookmarks = WpHerissonBookmarksTable::getTag($tag, true); } else { $this->view->bookmarks = WpHerissonBookmarksTable::getAll(true); $this->view->countAll = sizeof(WpHerissonBookmarksTable::getAll()); } $this->view->pagination = Pagination::i()->getVars(); }