3
* The Turba_View_DeleteContact:: class provides an API for viewing events.
4
* @TODO: Refactor to a Horde_View
6
* @author Chuck Hagenbuch <chuck@horde.org>
9
class Turba_View_DeleteContact
18
* @param Turba_Object $contact
20
public function __construct(Turba_Object $contact)
22
$this->contact = $contact;
25
public function getTitle()
28
? sprintf($this->contact->isGroup() ? _("Delete Group \"%s\"") : _("Delete \"%s\""), $this->contact->getValue('name'))
32
public function html($active = true)
34
if (!$this->contact) {
35
echo '<h3>' . _("The requested contact was not found.") . '</h3>';
39
if (!$this->contact->hasPermission(Horde_Perms::DELETE)) {
40
if (!$this->contact->hasPermission(Horde_Perms::READ)) {
41
echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
44
echo '<h3>' . _("You only have permission to view this contact.") . '</h3>';
49
echo '<div id="DeleteContact"' . ($active ? '' : ' style="display:none"') . '>';
51
<form action="<?php echo Horde::url('delete.php') ?>" method="post">
52
<?php echo Horde_Util::formInput() ?>
53
<input type="hidden" name="url" value="<?php echo htmlspecialchars(Horde_Util::getFormData('url')) ?>" />
54
<input type="hidden" name="source" value="<?php echo htmlspecialchars($this->contact->driver->getName()) ?>" />
55
<input type="hidden" name="key" value="<?php echo htmlspecialchars($this->contact->getValue('__key')) ?>" />
56
<div class="headerbox" style="padding: 8px">
57
<p><?php echo _("Permanently delete this contact?") ?></p>
58
<input type="submit" class="horde-delete" name="delete" value="<?php echo _("Delete") ?>" />
63
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
64
if ($this->contact->hasPermission(Horde_Perms::READ)) {
65
$view = new Turba_View_Contact($this->contact);
68
if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
69
$delete = new Turba_View_EditContact($this->contact);