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:  * @package Turba
  4:  */
  5: class Turba_Form_EditContactGroup extends Turba_Form_EditContact
  6: {
  7:     public function __construct($vars, $contact)
  8:     {
  9:         $this->addHidden('', 'objectkeys', 'text', false);
 10:         $this->addHidden('', 'original_source', 'text', false);
 11:         $action = $this->addHidden('', 'actionID', 'text', false);
 12:         $action->setDefault('groupedit');
 13:         parent::__construct($vars, $contact);
 14:         $vars->set('actionID', 'groupedit');
 15: 
 16:         $objectkeys = $vars->get('objectkeys');
 17:         $source = $vars->get('source');
 18:         $key = $vars->get('key');
 19: 
 20:         if (count($objectkeys) == 1) {
 21:             /* Only one contact. */
 22:             $this->setButtons(_("Finish"));
 23:         } elseif ($source . ':' . $key == $objectkeys[0]) {
 24:             /* First contact */
 25:             $this->setButtons(_("Next"));
 26:             $this->appendButtons(_("Finish"));
 27:         } elseif ($source . ':' . $key == $objectkeys[count($objectkeys) - 1]) {
 28:             /* Last contact */
 29:             $this->setButtons(_("Previous"));
 30:             $this->appendButtons(_("Finish"));
 31:         } else {
 32:             /* In between */
 33:             $this->setButtons(_("Previous"));
 34:             $this->appendButtons(_("Next"));
 35:             $this->appendButtons(_("Finish"));
 36:         }
 37:     }
 38: 
 39:     public function renderActive($renderer, $vars, $action, $method)
 40:     {
 41:         parent::renderActive($renderer, $vars, $action, $method);
 42: 
 43:         $results = new Turba_List($vars->get('objectkeys'));
 44: 
 45:         /* Don't show listview if only 1 entry. */
 46:         if (count($results) > 1) {
 47:             /* Read the columns to display from the preferences. */
 48:             $source = $vars->get('source');
 49:             $sources = Turba::getColumns();
 50: 
 51:             $listView = new Turba_View_List(
 52:                 $results,
 53:                 array(
 54:                     'Group' => true
 55:                 ),
 56:                 isset($sources[$source]) ? $sources[$source] : array()
 57:             );
 58:             echo '<br />' . $listView->getPage($numDisplayed);
 59:         }
 60:     }
 61: 
 62:     public function execute()
 63:     {
 64:         $result = parent::execute();
 65: 
 66:         $this->getInfo($this->_vars, $info);
 67: 
 68:         $next_page = Horde::url('edit.php', true)->add(array(
 69:             'source' => $info['source'],
 70:             'original_source' => $info['original_source'],
 71:             'objectkeys' => $info['objectkeys'],
 72:             'url' => $info['url'],
 73:             'actionID' => 'groupedit'
 74:         ));
 75: 
 76:         $objectkey = array_search($info['source'] . ':' . $info['key'], $info['objectkeys']);
 77: 
 78:         $submitbutton = $this->_vars->get('submitbutton');
 79:         if ($submitbutton == _("Finish")) {
 80:             $next_page = Horde::url('browse.php', true);
 81:             if ($info['original_source'] == '**search') {
 82:                 $next_page->add('key', $info['original_source']);
 83:             } else {
 84:                 $next_page->add('source', $info['original_source']);
 85:             }
 86:         } elseif ($submitbutton == _("Previous") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][0]) {
 87:             /* Previous contact */
 88:             list(, $previous_key) = explode(':', $info['objectkeys'][$objectkey - 1]);
 89:             $next_page->add('key', $previous_key);
 90:             if ($this->getOpenSection()) {
 91:                 $next_page->add('__formOpenSection', $this->getOpenSection());
 92:             }
 93:         } elseif ($submitbutton == _("Next") &&
 94:                   $info['source'] . ':' . $info['key'] != $info['objectkeys'][count($info['objectkeys']) - 1]) {
 95:             /* Next contact */
 96:             list(, $next_key) = explode(':', $info['objectkeys'][$objectkey + 1]);
 97:             $next_page->add('key', $next_key);
 98:             if ($this->getOpenSection()) {
 99:                 $next_page->add('__formOpenSection', $this->getOpenSection());
100:             }
101:         }
102: 
103:         $next_page->redirect();
104:     }
105: 
106: }
107: 
API documentation generated by ApiGen