Overview

Packages

  • Horde
    • Data
  • None
  • Turba

Classes

  • Turba
  • Turba_Api
  • Turba_Driver
  • Turba_Driver_Facebook
  • Turba_Driver_Favourites
  • Turba_Driver_Group
  • Turba_Driver_Imsp
  • Turba_Driver_Kolab
  • Turba_Driver_Ldap
  • Turba_Driver_Prefs
  • Turba_Driver_Share
  • Turba_Driver_Sql
  • Turba_Driver_Vbook
  • Turba_Exception
  • Turba_Factory_Driver
  • Turba_Form_AddContact
  • Turba_Form_Contact
  • Turba_Form_ContactBase
  • Turba_Form_CreateAddressBook
  • Turba_Form_DeleteAddressBook
  • Turba_Form_EditAddressBook
  • Turba_Form_EditContact
  • Turba_Form_EditContactGroup
  • Turba_List
  • Turba_LoginTasks_SystemTask_Upgrade
  • Turba_Object
  • Turba_Object_Group
  • Turba_Test
  • Turba_View_Browse
  • Turba_View_Contact
  • Turba_View_DeleteContact
  • Turba_View_Duplicates
  • Turba_View_EditContact
  • Turba_View_List
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * The Turba_View_DeleteContact:: class provides an API for viewing events.
 4:  * @TODO: Refactor to a Horde_View
 5:  *
 6:  * @author  Chuck Hagenbuch <chuck@horde.org>
 7:  * @package Turba
 8:  */
 9: class Turba_View_DeleteContact
10: {
11:     /**
12:      * @var Turba_Object
13:      *
14:      */
15:     public $contact;
16: 
17:     /**
18:      * @param Turba_Object $contact
19:      */
20:     public function __construct(Turba_Object $contact)
21:     {
22:         $this->contact = $contact;
23:     }
24: 
25:     public function getTitle()
26:     {
27:         return $this->contact
28:             ? sprintf($this->contact->isGroup() ? _("Delete Group \"%s\"") : _("Delete \"%s\""), $this->contact->getValue('name'))
29:             : _("Not Found");
30:     }
31: 
32:     public function html($active = true)
33:     {
34:         global $conf, $prefs;
35: 
36:         if (!$this->contact) {
37:             echo '<h3>' . _("The requested contact was not found.") . '</h3>';
38:             return;
39:         }
40: 
41:         if (!$this->contact->hasPermission(Horde_Perms::DELETE)) {
42:             if (!$this->contact->hasPermission(Horde_Perms::READ)) {
43:                 echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
44:                 return;
45:             } else {
46:                 echo '<h3>' . _("You only have permission to view this contact.") . '</h3>';
47:                 return;
48:             }
49:         }
50: 
51:         echo '<div id="DeleteContact"' . ($active ? '' : ' style="display:none"') . '>';
52:         ?>
53:         <form action="<?php echo Horde::url('delete.php') ?>" method="post">
54:         <?php echo Horde_Util::formInput() ?>
55:         <input type="hidden" name="url" value="<?php echo htmlspecialchars(Horde_Util::getFormData('url')) ?>" />
56:         <input type="hidden" name="source" value="<?php echo htmlspecialchars($this->contact->driver->getName()) ?>" />
57:         <input type="hidden" name="key" value="<?php echo htmlspecialchars($this->contact->getValue('__key')) ?>" />
58:         <div class="headerbox" style="padding: 8px">
59:          <p><?php echo _("Permanently delete this contact?") ?></p>
60:          <input type="submit" class="button" name="delete" value="<?php echo _("Delete") ?>" />
61:         </div>
62:         </form>
63:         </div>
64:         <?php
65:         if ($active && $GLOBALS['browser']->hasFeature('dom')) {
66:             if ($this->contact->hasPermission(Horde_Perms::READ)) {
67:                 $view = new Turba_View_Contact($this->contact);
68:                 $view->html(false);
69:             }
70:             if ($this->contact->hasPermission(Horde_Perms::EDIT)) {
71:                 $delete = new Turba_View_EditContact($this->contact);
72:                 $delete->html(false);
73:             }
74:         }
75:     }
76: 
77: }
78: 
API documentation generated by ApiGen