<?php
/**
 * Turba_Minisearch_Block:: Implementation of the Horde_Block API to
 * allows searching of addressbooks from the portal.
 *
 * @package horde.block
 *
 * $Horde: turba/lib/Block/minisearch.php,v 1.3 2003/06/12 14:07:07 chuck Exp $
 */
class turba_minisearch_Block extends Horde_Block {

    /* Constructor */
    function turba_minisearch_Block($params = array())
    {
        $this->_params = $params;
        $this->_app = 'turba';
        $this->_type = 'minisearch';
    }

    /**
     * Does this block have any user editable parameters?
     *
     * @return boolean  True is there are editable paramters
     *                  False if there are not
     */
    function isEditable()
    {
        return false;
    }

    /**
     * The title to go in this block.
     *
     * @return string   The title text.
     */
    function _title()
    {
        global $registry;

        $html  = Horde::link(Horde::url($registry->getInitialPage(), true), $registry->getParam('name'), 'header') . $registry->getParam('name') . '</a> - ';
        $html .= Horde::link(Horde::applicationUrl('addobject.php', true), _("New Contact"), 'smallheader') . Horde::img('add.gif', _("New Contact"), 'hspace="5"', Horde::url($registry->getParam('graphics'), true, -1)) . _("New Contact") . '</a>';

        return $html;
    }

    /**
     * The content to go in this block.
     *
     * @return string   The content
     */
    function _content()
    {
        global $browser, $registry, $prefs;
        require_once dirname(__FILE__) . '/../base.php';

        if ($browser->hasFeature('iframes')) {
            $html = Horde::bufferOutput('include', TURBA_TEMPLATES . '/block/minisearch.inc');
        } else {
            $html = '<i>' . _("A browser that supports iFrames is required") . '</i>';
        }

        return $html;
    }

}
