Inheritance: extends Turba_Form_ContactBase
Ejemplo n.º 1
0
 public function html($active = true)
 {
     global $browser, $vars;
     if (!$this->contact) {
         echo '<h3>' . _("The requested contact was not found.") . '</h3>';
         return;
     }
     if (!$this->contact->hasPermission(Horde_Perms::EDIT)) {
         if (!$this->contact->hasPermission(Horde_Perms::READ)) {
             echo '<h3>' . _("You do not have permission to view this contact.") . '</h3>';
             return;
         } else {
             echo '<h3>' . _("You only have permission to view this contact.") . '</h3>';
             return;
         }
     }
     echo '<div id="EditContact"' . ($active ? '' : ' style="display:none"') . '>';
     $form = new Turba_Form_EditContact($vars, $this->contact);
     $form->renderActive($form->getRenderer(), $vars, Horde::url('edit.php'), 'post');
     echo '</div>';
     if ($active && $browser->hasFeature('dom')) {
         if ($this->contact->hasPermission(Horde_Perms::READ)) {
             $view = new Turba_View_Contact($this->contact);
             $view->html(false);
         }
         if ($this->contact->hasPermission(Horde_Perms::DELETE)) {
             $delete = new Turba_View_DeleteContact($this->contact);
             $delete->html(false);
         }
     }
 }
Ejemplo n.º 2
0
 public function execute()
 {
     parent::execute();
     $this->getInfo($this->_vars, $info);
     $next_page = Horde::url('edit.php', true)->add(array('source' => $info['source'], 'original_source' => $info['original_source'], 'objectkeys' => $info['objectkeys'], 'url' => $info['url'], 'actionID' => 'groupedit'));
     $objectkey = array_search($info['source'] . ':' . $info['key'], $info['objectkeys']);
     $submitbutton = $this->_vars->get('submitbutton');
     if ($submitbutton == _("Finish")) {
         $next_page = Horde::url('browse.php', true);
         if ($info['original_source'] == '**search') {
             $next_page->add('key', $info['original_source']);
         } else {
             $next_page->add('source', $info['original_source']);
         }
     } elseif ($submitbutton == _("Previous") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][0]) {
         /* Previous contact */
         list(, $previous_key) = explode(':', $info['objectkeys'][$objectkey - 1]);
         $next_page->add('key', $previous_key);
         if ($this->getOpenSection()) {
             $next_page->add('__formOpenSection', $this->getOpenSection());
         }
     } elseif ($submitbutton == _("Next") && $info['source'] . ':' . $info['key'] != $info['objectkeys'][count($info['objectkeys']) - 1]) {
         /* Next contact */
         list(, $next_key) = explode(':', $info['objectkeys'][$objectkey + 1]);
         $next_page->add('key', $next_key);
         if ($this->getOpenSection()) {
             $next_page->add('__formOpenSection', $this->getOpenSection());
         }
     }
     $next_page->redirect();
 }