public function __construct($bookmarks = null, $browser = null)
{
$this->_bookmarks = $bookmarks;
if ($browser) {
$this->_browser = $browser;
} else {
$this->_browser = $GLOBALS['injector']->getInstance('Trean_TagBrowser');
}
$action = Horde_Util::getFormData('actionID', '');
switch ($action) {
case 'remove':
$tag = Horde_Util::getFormData('tag');
if (isset($tag)) {
$this->_browser->removeTag($tag);
$this->_browser->save();
}
break;
case 'add':
default:
// Add new tag to the stack, save to session.
$tag = Horde_Util::getFormData('tag');
if (isset($tag)) {
$this->_browser->addTag($tag);
$this->_browser->save();
}
}
// Check for empty tag search.. then do what?
$this->_noSearch = $this->_browser->tagCount() < 1;
}