1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<?php
require_once 'Horde/Form/Renderer.php';
/**
* Turba Form Renderer
*
* $Horde: turba/lib/Renderer.php,v 1.19.6.1 2005/10/18 12:50:05 jan 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)
{
$actions = array();
if (!$this->_active && is_a($this->_object, 'Turba_Object')) {
$params = array('source' => $this->_object->driver->name,
'key' => $this->_object->getValue('__key'));
if ($this->_object->hasPermission(PERMS_EDIT)) {
$url = Util::addParameter(Horde::applicationUrl('edit.php'), $params);
$actions[] = '<li>' . Horde::link($url, _("Edit")) . _("Edit") . '</a>';
}
if ($this->_object->hasPermission(PERMS_DELETE)) {
$url = Util::addParameter(Horde::applicationUrl('delete.php'), $params);
$actions[] = '<li>' .
Horde::link($url, _("Delete"), '', '',
$GLOBALS['prefs']->getValue('delete_opt') ?
'return window.confirm(\'' . addslashes(_("Really delete this contact?")) . '\');' : '') .
_("Delete") . '</a>';
}
}
echo '<div class="header">';
if (!empty($actions)) {
echo '<ul>' . implode(' | </li>', $actions) . '</li></ul>';
}
echo htmlspecialchars($title);
echo '</div>';
}
}
|