getName() public method

(This is the key into the cfgSources array)
public getName ( )
Ejemplo n.º 1
0
 /**
  * Renders this view.
  */
 public function display()
 {
     $view = new Horde_View(array('templatePath' => TURBA_TEMPLATES . '/search/duplicate'));
     new Horde_View_Helper_Text($view);
     $hasDuplicate = $this->_type && $this->_duplicate && isset($this->_duplicates[$this->_type]) && isset($this->_duplicates[$this->_type][$this->_duplicate]);
     if ($hasDuplicate) {
         $vars = new Horde_Variables();
         $view->type = $GLOBALS['attributes'][$this->_type]['label'];
         $view->value = $this->_duplicate;
         echo $view->render('header');
         $view->contactUrl = Horde::url('contact.php');
         $view->mergeUrl = Horde::url('merge.php');
         $view->first = true;
         $duplicate = $this->_duplicates[$this->_type][$this->_duplicate];
         while ($contact = $duplicate->next()) {
             $contact->lastModification();
         }
         $duplicate->sort(array(array('field' => '__modified', 'ascending' => false)));
         $view->mergeTarget = $duplicate->reset()->getValue('__key');
         while ($contact = $duplicate->next()) {
             $view->source = $contact->getSource();
             $view->id = $contact->getValue('__key');
             $history = $contact->getHistory();
             if (isset($history['modified'])) {
                 $view->changed = $history['modified'];
             } elseif (isset($history['created'])) {
                 $view->changed = $history['created'];
             } else {
                 unset($view->changed);
             }
             echo $view->render('contact_header');
             $contactView = new Turba_Form_Contact($vars, $contact, false);
             $contactView->renderInactive($contactView->getRenderer(), $vars);
             echo $view->render('contact_footer');
             $view->first = false;
         }
         echo $view->render('footer');
     }
     $view->duplicates = $this->_duplicates;
     $view->hasDuplicate = (bool) $hasDuplicate;
     $view->attributes = $GLOBALS['attributes'];
     $view->link = Horde::url('search.php')->add(array('source' => $this->_driver->getName(), 'search_mode' => 'duplicate'));
     echo $view->render('list');
 }
Ejemplo n.º 2
0
 /**
  * Returns a link to display, download, and delete a file from the VFS
  * backend associated with this object.
  *
  * @param string $file  The file name.
  *
  * @return string  The HTML code of the generated link.
  */
 public function vfsEditUrl($file)
 {
     $delform = '<form action="' . Horde::url('deletefile.php') . '" style="display:inline" method="post">' . Horde_Util::formInput() . '<input type="hidden" name="file" value="' . htmlspecialchars($file['name']) . '" />' . '<input type="hidden" name="source" value="' . htmlspecialchars($this->driver->getName()) . '" />' . '<input type="hidden" name="key" value="' . htmlspecialchars($this->getValue('__key')) . '" />' . '<input type="image" class="img" src="' . Horde_Themes::img('delete.png') . '" />' . '</form>';
     return $this->vfsDisplayUrl($file) . ' ' . $delform;
 }
Ejemplo n.º 3
0
 /**
  * Gets extended permissions on an address book.
  *
  * @param Turba_Driver $addressBook  The address book to get extended
  *                                   permissions for.
  * @param string $permission         What extended permission to get.
  *
  * @return mixed  The requested extended permissions value, or true if it
  *                doesn't exist.
  */
 public static function getExtendedPermission(Turba_Driver $addressBook, $permission)
 {
     // We want to check the base source as extended permissions
     // are enforced per backend, not per share.
     $key = $addressBook->getName() . ':' . $permission;
     $perms = $GLOBALS['injector']->getInstance('Horde_Perms');
     if (!$perms->exists('turba:sources:' . $key)) {
         return true;
     }
     $allowed = $perms->getPermissions('turba:sources:' . $key, $GLOBALS['registry']->getAuth());
     if (is_array($allowed)) {
         switch ($permission) {
             case 'max_contacts':
                 $allowed = max($allowed);
                 break;
         }
     }
     return $allowed;
 }