Esempio n. 1
0
 /**
  * Return the HTML representing this widget.
  *
  * @return string  The HTML for this widget.
  */
 public function html()
 {
     if (!$GLOBALS['conf']['faces']['driver']) {
         return '';
     }
     $this->_faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
     $this->_owner = $this->_view->gallery->get('owner');
     try {
         $this->_count = $this->_faces->countOwnerFaces($this->_owner);
     } catch (Ansel_Exception $e) {
         Horde::log($e->getMessage(), 'ERR');
         $this->_count = 0;
     }
     if (empty($this->_count)) {
         return null;
     }
     $this->_title = Horde::url('faces/search/owner.php')->add('owner', $this->_owner)->link() . sprintf(_("People in galleries owned by %s (%d of %d)"), $this->_owner, min(12, $this->_count), number_format($this->_count)) . '</a>';
     $html = $this->_htmlBegin();
     $results = $this->_faces->ownerFaces($this->_owner, 0, 12, true);
     $html .= '<div style="display: block' . ';background:' . $this->_style->background . ';width:100%;max-height:300px;overflow:auto;" id="faces_widget_content" >';
     foreach ($results as $face) {
         $facename = htmlspecialchars($face['face_name']);
         $html .= '<a href="' . Ansel_Faces::getLink($face) . '" title="' . $facename . '">' . '<img src="' . $this->_faces->getFaceUrl($face['image_id'], $face['face_id'], 'mini') . '" style="padding-bottom: 5px; padding-left: 5px" alt="' . $facename . '" /></a>';
     }
     return $html . '</div>' . $this->_htmlEnd();
 }
Esempio n. 2
0
 /**
  */
 protected function _content()
 {
     $faces = $GLOBALS['injector']->getInstance('Ansel_Faces');
     $results = $faces->allFaces(0, $this->_params['limit']);
     $html = '';
     foreach ($results as $face) {
         $facename = htmlspecialchars($face['face_name']);
         $html .= '<a href="' . Ansel_Faces::getLink($face) . '" title="' . $facename . '">' . '<img src="' . $faces->getFaceUrl($face['image_id'], $face['face_id']) . '" style="padding-bottom: 5px; padding-left: 5px" alt="' . $facename . '" /></a>';
     }
     return $html;
 }
Esempio n. 3
0
}
$title = _("Tell us who is in this photo");
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, $title);
$form->addHidden('', 'face', 'int', true);
$form->addVariable(_("Person"), 'person', 'text', true);
$form->setButtons($title);
if ($form->validate()) {
    if (Horde_Util::getFormData('submitbutton') == _("Cancel")) {
        $notification->push(_("Action was cancelled."), 'horde.warning');
    } else {
        $report = Ansel_Report::factory();
        $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($face['gallery_id']);
        $face_link = Horde::url('faces/custom.php', true)->add(array('name' => $vars->get('person'), 'face' => $face_id, 'image' => $face['image_id']))->setRaw(true);
        $title = _("I know who is on one of your photos");
        $body = _("Gallery Name") . ': ' . $gallery->get('name') . "\n" . _("Gallery Description") . ': ' . $gallery->get('desc') . "\n\n" . $title . "\n" . _("Person") . ': ' . $vars->get('person') . "\n" . _("Face") . ': ' . $face_link;
        $report->setTitle($title);
        try {
            $result = $report->report($body, $gallery->get('owner'));
            $notification->push(_("The owner of the photo, who will delegate the face name, was notified."), 'horde.success');
        } catch (Ansel_Exception $e) {
            $notification->push(_("Face name was not reported.") . ' ' . $e->getMessage(), 'horde.error');
        }
    }
    Ansel_Faces::getLink($face)->redirect();
    exit;
}
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, null, null, 'post');
$page_output->footer();