<?php

require_once HORDE_BASE . '/lib/Form/Renderer.php';

/**
 * Turba Form Renderer
 *
 * $Horde: turba/lib/Renderer.php,v 1.7 2003/04/16 22:53:27 mdjukic Exp $
 *
 * @package turba
 */
class Turba_Renderer extends Horde_Form_Renderer {

    var $_active = false;
    var $_object;

    function setObject(&$object)
    {
        $this->_object = &$object;
    }

    function beginActive($name)
    {
        $this->_active = true;
        parent::beginActive($name);
    }

    function beginInactive($name)
    {
        $this->_active = false;
        parent::beginInactive($name);
    }

    function _sectionHeader($title)
    {
?><table border="0" cellpadding="2" cellspacing="1" width="100%">
<tr><td align="left" class="header"><b><?php echo $title ?></b></td>
<?php
if (!$this->_active &&
    Turba::checkPermissions($this->_object, 'object', _PERMS_EDIT)) {
    $url = Horde::addParameter('', 'source', $this->_object->source->name);
    $url = Horde::addParameter($url, 'key', $this->_object->getValue('__key'));
?>
  <td align="right" class="header">
    <?php echo Horde::link(Horde::applicationUrl('editobject.php' . $url), _("Edit"), 'menuitem') . _("Edit") ?></a> |
    <?php echo Horde::link(Horde::applicationUrl('deleteobject.php' . $url), _("Delete"), 'menuitem') . _("Delete") ?></a>
  </td>
<?php } ?>
</tr></table><?php
    }

}
