当前位置: 首页>>代码示例>>PHP>>正文


PHP Ansel::getUrlFor方法代码示例

本文整理汇总了PHP中Ansel::getUrlFor方法的典型用法代码示例。如果您正苦于以下问题:PHP Ansel::getUrlFor方法的具体用法?PHP Ansel::getUrlFor怎么用?PHP Ansel::getUrlFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ansel的用法示例。


在下文中一共展示了Ansel::getUrlFor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getOtherGalleries

 /**
  * Build the HTML for the other galleries widget content.
  *
  * @param Horde_View $view  The view object.
  */
 protected function _getOtherGalleries(&$view)
 {
     $owner = $this->_view->gallery->get('owner');
     // Set up the tree
     $tree = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Tree')->create('otherAnselGalleries_' . md5($owner), 'Javascript', array('class' => 'anselWidgets'));
     try {
         $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('attributes' => $owner));
     } catch (Ansel_Exception $e) {
         Horde::log($e, 'ERR');
         return;
     }
     foreach ($galleries as $gallery) {
         $parents = $gallery->get('parents');
         if (empty($parents)) {
             $parent = null;
         } else {
             $parents = explode(':', $parents);
             $parent = array_pop($parents);
         }
         $img = (string) Ansel::getImageUrl($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')), 'mini', true);
         $link = Ansel::getUrlFor('view', array('gallery' => $gallery->id, 'slug' => $gallery->get('slug'), 'view' => 'Gallery'), true);
         $tree->addNode(array('id' => $gallery->id, 'parent' => $parent, 'label' => $gallery->get('name'), 'expanded' => $gallery->id == $this->_view->gallery->id, 'params' => array('icon' => $img, 'url' => $link)));
     }
     Horde::startBuffer();
     $tree->sort('label');
     $tree->renderTree();
     $view->tree = Horde::endBuffer();
     $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('Ansel_Ajax_Imple_ToggleOtherGalleries', array('id' => 'othergalleries-toggle'));
 }
开发者ID:horde,项目名称:horde,代码行数:34,代码来源:OtherGalleries.php

示例2: _content

    /**
     */
    protected function _content()
    {
        $GLOBALS['page_output']->addScriptFile('block.js');
        /* Get the top level galleries */
        try {
            $galleries = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('perm' => Horde_Perms::EDIT, 'attributes' => $GLOBALS['registry']->getAuth(), 'all_levels' => false, 'count' => empty($this->_params['limit']) ? 0 : $this->_params['limit'], 'sort_by' => 'last_modified', 'direction' => Ansel::SORT_DESCENDING));
        } catch (Ansel_Exception $e) {
            return $e->getMessage();
        }
        $header = array(_("Gallery Name"), _("Last Modified"), _("Photo Count"));
        $html = <<<HEADER
<table class="linedRow" cellspacing="0" style="width:100%">
 <thead><tr class="item nowrap">
  <th class="item leftAlign">{$header['0']}</th>
  <th class="item leftAlign">{$header['1']}</th>
  <th class="item leftAlign">{$header['2']}</th>
 </tr></thead>
 <tbody>
HEADER;
        foreach ($galleries as $gallery) {
            $url = Ansel::getUrlFor('view', array('view' => 'Gallery', 'slug' => $gallery->get('slug'), 'gallery' => $gallery->id), true);
            $html .= '<tr><td>' . $url->link(array('onmouseout' => '$("ansel_preview").hide();$("ansel_preview").update("");', 'onmouseover' => 'Ansel.previewImage(event, ' . $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) . ');')) . htmlspecialchars($gallery->get('name')) . '</a></td><td>' . strftime($GLOBALS['prefs']->getValue('date_format'), $gallery->get('last_modified')) . '</td><td>' . (int) $gallery->countImages(true) . '</td></tr>';
        }
        $html .= '</tbody></table>';
        return $html;
    }
开发者ID:horde,项目名称:horde,代码行数:28,代码来源:MyGalleries.php

示例3: uploadNotification

 /**
  */
 public function uploadNotification()
 {
     global $conf, $injector, $prefs, $registry;
     $gallery = $injector->getInstance('Ansel_Storage')->getGallery($this->vars->g);
     switch ($this->vars->s) {
         case 'twitter':
             $url = Ansel::getUrlFor('view', array('view' => 'Gallery', 'gallery' => $gallery->id), true);
             if (!empty($conf['urlshortener'])) {
                 try {
                     $url = $injector->getInstance('Horde_Service_UrlShortener')->shorten($url->setRaw(true));
                 } catch (Horde_Service_UrlShortener_Exception $e) {
                     Horde::log($e, 'ERR');
                     header('HTTP/1.1 500');
                 }
             }
             $text = sprintf(_("New images uploaded to %s. %s"), $gallery->get('name'), $url);
             $token = unserialize($prefs->getValue('twitter'));
             if (empty($token['key']) && empty($token['secret'])) {
                 $pref_link = $registry->getServiceLink('prefs', 'horde')->add('group', 'twitter')->link();
                 throw new Ansel_Exception(sprintf(_("You have not properly connected your Twitter account with Horde. You should check your Twitter settings in your %s."), $pref_link . _("preferences") . '</a>'));
             }
             $twitter = $injector->getInstance('Horde_Service_Twitter');
             $auth_token = new Horde_Oauth_Token($token['key'], $token['secret']);
             $twitter->auth->setToken($auth_token);
             try {
                 return $twitter->statuses->update($text);
             } catch (Horde_Service_Twitter_Exception $e) {
                 Horde::log($e, 'ERR');
                 header('HTTP/1.1 500');
             }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:34,代码来源:Handler.php

示例4: _getGalleryActions

 /**
  * Helper function for generating the gallery actions selection widget.
  *
  * @param Horde_View $view  The view object.
  */
 protected function _getGalleryActions(&$view)
 {
     global $registry, $conf;
     $id = $this->_view->gallery->id;
     $galleryurl = Horde::url('gallery.php')->add('gallery', $id);
     $selfurl = Horde::selfUrl(true, false, true);
     $view->count = $count = $this->_view->gallery->countImages();
     $date = $this->_view->gallery->getDate();
     // Buid the url parameters to the zip link
     $view_params = array('gallery' => $this->_view->gallery->id, 'view' => 'Gallery', 'slug' => $this->_view->gallery->get('slug'), 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0);
     // Append the date information to the parameters if we need it
     $view_params = array_merge($view_params, $date);
     // Bookmark link
     if ($registry->hasMethod('bookmarks/getAddUrl')) {
         $api_params = array('url' => Ansel::getUrlFor('view', $view_params, true), 'title' => $this->_view->gallery->get('name'));
         try {
             $view->bookmark_url = new Horde_Url($registry->bookmarks->getAddUrl($api_params));
         } catch (Horde_Exception $e) {
         }
     }
     // Download as ZIP link
     if (!empty($conf['gallery']['downloadzip']) && $this->_view->gallery->canDownload() && $count && $this->_view->gallery->hasFeature('zipdownload')) {
         $zip_params = array_merge(array('actionID' => 'downloadzip'), $date);
         $view->zip_url = $galleryurl->copy()->add($zip_params)->link(array('class' => 'widget'));
     }
     // Image upload, subgalleries, captions etc..
     if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
         $view->hasEdit = true;
         $view->properties_url = $galleryurl->copy()->add(array('actionID' => 'modify', 'url' => $selfurl))->link(array('class' => 'widget'));
         if ($count) {
             if ($this->_view->gallery->hasFeature('image_captions')) {
                 $params = array_merge(array('gallery' => $id), $date);
                 $view->captions_url = Horde::url('gallery/captions.php')->add($params)->link(array('class' => 'widget'));
             }
             if ($this->_view->gallery->hasFeature('sort_images')) {
                 $view->sort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id), $date))->link(array('class' => 'widget'));
                 $view->resetsort_url = Horde::url('gallery/sort.php')->add(array_merge(array('gallery' => $id, 'action' => 'Reset'), $date))->link(array('class' => 'widget'));
             }
             $view->regenerate_url = $galleryurl->copy()->add(array('actionID' => 'generateThumbs'))->link(array('class' => 'widget'));
             $view->regenerate_all = $galleryurl->copy()->add(array('actionID' => 'deleteCache'))->link(array('class' => 'widget'));
             if ($conf['faces']['driver'] && $conf['faces']['driver'] !== 'user' && $this->_view->gallery->hasFeature('faces')) {
                 $view->faces_url = Horde::url('faces/gallery.php')->add(array_merge($date, array('gallery' => $id, 'page' => !empty($this->_view->_params['page']) ? $this->_view->_params['page'] : 0)))->link(array('class' => 'widget'));
             }
         }
         if ($this->_view->gallery->hasFeature('stacks')) {
             $view->gendefault_url = $galleryurl->copy()->add(array('actionID' => 'generateDefault', 'url' => $selfurl))->link(array('class' => 'widget'));
         }
     }
     if ($registry->getAuth() && $this->_view->gallery->get('owner') == $registry->getAuth()) {
         $url = new Horde_Url('#');
         $view->perms_link = $url->link(array('class' => 'popup widget', 'onclick' => Horde::popupJs(Horde::url('perms.php'), array('params' => array('cid' => $this->_view->gallery->id), 'urlencode' => true)) . 'return false;'));
     } elseif (!empty($conf['report_content']['driver']) && ($conf['report_content']['allow'] == 'authenticated' && $registry->isAuthenticated() || $conf['report_content']['allow'] == 'all')) {
         $view->report_url = Horde::url('report.php')->add('gallery', $id)->link(array('class' => 'widget'));
     }
     if ($this->_view->gallery->hasPermission($registry->getAuth(), Horde_Perms::DELETE)) {
         $view->have_delete = true;
         $view->deleteall_url = $galleryurl->copy()->add('actionID', 'empty')->link(array('class' => 'widget'));
         $view->deletegallery_url = $galleryurl->copy()->add('actionID', 'delete')->link(array('class' => 'widget'));
     }
 }
开发者ID:horde,项目名称:horde,代码行数:65,代码来源:Actions.php

示例5: html

 public function html()
 {
     global $registry;
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->addTemplatePath(ANSEL_TEMPLATES . '/widgets');
     $view->owner = $this->_view->gallery->get('owner');
     $view->userfeedurl = Ansel::getUrlFor('rss_user', array('owner' => $view->owner));
     $view->slug = $this->_view->gallery->get('slug');
     $view->galleryname = $this->_view->gallery->get('name');
     $view->galleryfeedurl = Ansel::getUrlFor('rss_gallery', array('gallery' => $this->_view->gallery->id, 'slug' => $view->slug));
     $view->title = _("Links");
     /* Embed html */
     if (empty($this->_view->_params['image_id'])) {
         /* Gallery view */
         $params = array('count' => 10);
         if (!empty($slug)) {
             $params['gallery_slug'] = $slug;
         } else {
             $params['gallery_id'] = $this->_view->gallery->id;
         }
     } else {
         // This is an image view
         $params = array('thumbsize' => 'screen', 'images' => $this->_view->_params['image_id'], 'count' => 10);
     }
     $view->embed = Ansel::embedCode($params);
     return $view->render('links');
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:27,代码来源:Links.php

示例6: getTile

 /**
  * Outputs the html for a DateGallery tile.
  *
  * @param Ansel_Gallery_Decorator_Date $dgallery  The Ansel_Gallery_Date we are
  *                                     displaying.
  * @param Ansel_Style $style  A style object.
  * @param boolean $mini       Force the use of a mini thumbail?
  * @param array $params       An array containing additional parameters.
  *                            Currently, gallery_view_url and image_view_url
  *                            are used to override the respective urls.
  *                            %g and %i are replaced with image id and
  *                            gallery id, respectively.
  *
  * @return string  The HTML for the tile.
  */
 public function getTile(Ansel_Gallery_Decorator_Date $dgallery, Ansel_Style $style = null, $mini = false, array $params = array())
 {
     $view = $GLOBALS['injector']->createInstance('Horde_View');
     $view->addTemplatePath(ANSEL_TEMPLATES . '/tile');
     // User's preferred date format
     $date_format = $GLOBALS['prefs']->getValue('date_format');
     $date_array = $dgallery->getDate();
     if (empty($date_array['month'])) {
         $date_array['month'] = 1;
     }
     if (empty($date_array['day'])) {
         $date_array['day'] = 1;
     }
     $full_date = new Horde_Date($date_array);
     // Need the unaltered date part array
     $date_array = $dgallery->getDate();
     // Figure out the needed link for the next drill down level. We *must*
     // have at least a year since we are in a date tile.
     if (empty($date_array['month'])) {
         // unit == year
         $view->caption = $full_date->strftime('%Y');
         $next_date = array('year' => (int) $view->caption);
     } elseif (empty($date_array['day'])) {
         // unit == month
         $view->caption = $full_date->strftime('%B %Y');
         $next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()));
     } else {
         // unit == day
         $view->caption = $full_date->strftime($date_format);
         $next_date = array('year' => date('Y', $full_date->timestamp()), 'month' => date('n', $full_date->timestamp()), 'day' => date('j', $full_date->timestamp()));
     }
     // Check permissions on the gallery and get appropriate tile image
     if ($dgallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         if (is_null($style)) {
             $style = $dgallery->getStyle();
         }
         $thumbstyle = $mini ? 'mini' : 'thumb';
         $view->gallery_image = Ansel::getImageUrl($dgallery->getKeyImage(), $thumbstyle, true, $style);
     } else {
         $view->gallery_image = Horde_Themes::img('thumb-error.png');
     }
     /* Check for being called via the api and generate correct view links */
     if (!isset($params['gallery_view_url'])) {
         if (empty($params['style'])) {
             $gstyle = $dgallery->getStyle();
         } else {
             $gstyle = $params['style'];
         }
         $params = array('gallery' => $dgallery->id, 'view' => 'Gallery', 'slug' => $dgallery->get('slug'));
         $view->view_link = Ansel::getUrlFor('view', array_merge($params, $next_date));
     } else {
         $view->view_link = new Horde_Url(str_replace(array('%g', '%s'), array($dgallery->id, $dgallery->get('slug')), urldecode($params['gallery_view_url'])));
         $view->view_link->add($next_date);
     }
     $view->gallery_count = $dgallery->countImages(true);
     return $view->render('dategallery');
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:72,代码来源:DateGallery.php

示例7: __construct

 /**
  * Const'r
  *
  * @see Ansel_View_Base::__construct
  */
 public function __construct(array $params = array())
 {
     parent::__construct($params);
     if (!empty($params['gallery_slug'])) {
         $this->gallery = $this->_getGallery(null, $params['gallery_slug']);
     } elseif (!empty($params['gallery_id'])) {
         $this->gallery = $this->_getGallery($params['gallery_id']);
     } else {
         $this->gallery = $this->_getGallery();
     }
     // Check user age
     if (!$this->gallery->isOldEnough()) {
         if (!empty($params['api'])) {
             throw new Ansel_Exception('Locked galleries are not viewable via the api.');
         }
         $date = Ansel::getDateParameter(array('year' => isset($this->_params['year']) ? $this->_params['year'] : 0, 'month' => isset($this->_params['month']) ? $this->_params['month'] : 0, 'day' => isset($this->_params['day']) ? $this->_params['day'] : 0));
         $galleryurl = Ansel::getUrlFor('view', array_merge(array('gallery' => $this->gallery->id, 'slug' => empty($params['slug']) ? '' : $params['slug'], 'page' => empty($params['page']) ? 0 : $params['page'], 'view' => 'Gallery'), $date), true);
         $params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
         Horde::url('disclamer.php')->add($params)->setRaw(true)->redirect();
         exit;
     }
     if ($this->gallery->hasPasswd()) {
         if (!empty($params['api'])) {
             throw new Ansel_Exception(_("Locked galleries are not viewable via the api."));
         }
         $date = Ansel::getDateParameter(array('year' => isset($this->_params['year']) ? $this->_params['year'] : 0, 'month' => isset($this->_params['month']) ? $this->_params['month'] : 0, 'day' => isset($this->_params['day']) ? $this->_params['day'] : 0));
         $galleryurl = Ansel::getUrlFor('view', array_merge(array('gallery' => $this->gallery->id, 'slug' => empty($params['slug']) ? '' : $params['slug'], 'page' => empty($params['page']) ? 0 : $params['page'], 'view' => 'Gallery'), $date), true);
         $params = array('gallery' => $this->gallery->id, 'url' => $galleryurl);
         Horde::url('protect.php')->add($params)->setRaw(true)->redirect();
         exit;
     }
     if (!$this->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         throw new Horde_Exception_PermissionDenied();
     }
     // Since this is a gallery view, the resource is the gallery.
     $this->resource = $this->gallery;
     // Do we have an explicit style set? If not, use the gallery's
     if (!empty($this->_params['style'])) {
         $style = Ansel::getStyleDefinition($this->_params['style']);
     } else {
         $style = $this->gallery->getStyle();
     }
     if (!empty($this->_params['gallery_view'])) {
         $renderer = $this->_params['gallery_view'];
     } else {
         $renderer = !empty($style->gallery_view) ? $style->gallery_view : 'Gallery';
     }
     // Load the helper
     $classname = 'Ansel_View_GalleryRenderer_' . basename($renderer);
     $this->_renderer = new $classname($this);
     $this->_renderer->init();
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:57,代码来源:Gallery.php

示例8: menu

 /**
  */
 public function menu($menu)
 {
     global $conf, $registry;
     /* Browse/Search */
     $menu->add(Horde::url('browse.php'), _("_Browse"), 'ansel-browse', null, null, null, $GLOBALS['prefs']->getValue('defaultview') == 'browse' && basename($_SERVER['PHP_SELF']) == 'index.php' || basename($_SERVER['PHP_SELF']) == 'browse.php' ? 'current' : '__noselection');
     if ($GLOBALS['registry']->getAuth()) {
         $url = Ansel::getUrlFor('view', array('owner' => $GLOBALS['registry']->getAuth(), 'groupby' => 'owner', 'view' => 'List'));
         $menu->add($url, _("_My Galleries"), 'ansel-mygalleries', null, null, null, Horde_Util::getFormData('owner', false) == $GLOBALS['registry']->getAuth() ? 'current' : '__noselection');
     }
     $menu->add(Ansel::getUrlFor('view', array('view' => 'List')), _("_All Galleries"), 'ansel-allgalleries', null, null, null, $GLOBALS['prefs']->getValue('defaultview') == 'galleries' && basename($_SERVER['PHP_SELF']) == 'index.php' || basename($_SERVER['PHP_SELF']) == 'group.php' && Horde_Util::getFormData('owner') !== $GLOBALS['registry']->getAuth() ? 'current' : '__noselection');
     if ($conf['faces']['driver'] && $registry->isAuthenticated()) {
         $menu->add(Horde::url('faces/search/all.php'), _("_Faces"), 'ansel-faces');
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:Application.php

示例9: _content

 /**
  */
 protected function _content()
 {
     /* Get the tags */
     $tags = $GLOBALS['injector']->getInstance('Ansel_Tagger')->getCloud(null, $this->_params['count']);
     if (count($tags)) {
         $cloud = new Horde_Core_Ui_TagCloud();
         foreach ($tags as $id => $tag) {
             $link = Ansel::getUrlFor('view', array('view' => 'Results', 'tag' => $tag['tag_name']));
             $cloud->addElement($tag['tag_name'], $link, $tag['count']);
         }
         $html = $cloud->buildHTML();
     } else {
         $html = '';
     }
     return $html;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:18,代码来源:Cloud.php

示例10: _content

 /**
  */
 protected function _content()
 {
     $gallery = $GLOBALS['injector']->getInstance('Ansel_Storage')->getRandomGallery();
     if (!$gallery) {
         return _("There are no photo galleries available.");
     }
     $imagelist = $gallery->listImages(rand(0, $gallery->countImages() - 1), 1);
     if (empty($imagelist)) {
         return '';
     }
     $imageId = $imagelist[0];
     $viewurl = Ansel::getUrlFor('view', array('gallery' => $gallery->id, 'slug' => $gallery->get('slug'), 'image' => $imageId, 'view' => 'Image'), true);
     if ($gallery->isOldEnough() && !$gallery->hasPasswd()) {
         $img = '<img src="' . Ansel::getImageUrl($imageId, 'thumb', true, Ansel::getStyleDefinition('ansel_default')) . '" alt="[random photo]" />';
     } else {
         $img = Horde::img('thumb-error.png');
     }
     return $viewurl->link(array('title' => _("View Photo"))) . $img . '</a>';
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:21,代码来源:RandomPhoto.php

示例11: __construct

 /**
  * Contructor.
  *
  * Also handles any actions from the view.
  *
  * @return Ansel_View_Results
  */
 public function __construct(array $params = array())
 {
     global $prefs, $conf, $injector, $notification;
     $ansel_storage = $injector->getInstance('Ansel_Storage');
     $this->_owner = Horde_Util::getFormData('owner', '');
     $this->_browser = new Ansel_TagBrowser($injector->getInstance('Ansel_Tagger'), null, $this->_owner);
     $this->_page = Horde_Util::getFormData('page', 0);
     $actionID = Horde_Util::getFormData('actionID', '');
     $image_id = Horde_Util::getFormData('image');
     $vars = Horde_Variables::getDefaultVariables();
     // Number perpage from prefs or config.
     $this->_perPage = min($prefs->getValue('tilesperpage'), $conf['thumbnail']['perpage']);
     // Common image actions.
     if (Ansel_ActionHandler::imageActions($actionID)) {
         Ansel::getUrlFor('view', array('view' => 'Results'), true)->redirect();
         exit;
     }
     // Tag browsing actions.
     switch ($actionID) {
         case 'remove':
             $tag = Horde_Util::getFormData('tag');
             if (isset($tag)) {
                 $this->_browser->removeTag($tag);
                 $this->_browser->save();
             }
             break;
         case 'add':
         default:
             $tag = Horde_Util::getFormData('tag');
             if (isset($tag)) {
                 $this->_browser->addTag($tag);
                 $this->_browser->save();
             }
             break;
     }
     // Check for empty tag search and redirect if empty
     if ($this->_browser->tagCount() < 1) {
         Horde::url('browse.php', true)->redirect();
         exit;
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:48,代码来源:Results.php

示例12: _content

 /**
  */
 protected function _content()
 {
     try {
         $gallery = $this->_getGallery();
     } catch (Ansel_Exception $e) {
         return $e->getMessage();
     }
     $params = array('gallery_id' => $gallery->id, 'count' => $this->_params['perpage']);
     if (!empty($this->_params['use_lightbox'])) {
         $params['lightbox'] = true;
     }
     $html = Ansel::embedCode($params);
     // Be nice to people with <noscript>
     $viewurl = Ansel::getUrlFor('view', array('view' => 'Gallery', 'gallery' => $gallery->id, 'slug' => $gallery->get('slug')), true);
     $html .= '<noscript>';
     $html .= $viewurl->link(array('title' => sprintf(_("View %s"), $gallery->get('name'))));
     if ($iid = $gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')) && $gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
         $html .= '<img src="' . Ansel::getImageUrl($gallery->getKeyImage(Ansel::getStyleDefinition('ansel_default')), 'thumb', true) . '" alt="' . htmlspecialchars($gallery->get('name')) . '" />';
     } else {
         $html .= Horde::img('thumb-error.png');
     }
     return $html . '</a></noscript>';
 }
开发者ID:horde,项目名称:horde,代码行数:25,代码来源:Gallery.php

示例13: _getRelatedImages

 /**
  * Helper function for generating a widget of images related to this one.
  *
  *
  * @return string  The HTML
  */
 public function _getRelatedImages()
 {
     $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
     $html = '';
     $args = array('typeId' => 'image', 'userId' => $this->_view->gallery->get('owner'));
     $results = $GLOBALS['injector']->getInstance('Ansel_Tagger')->listRelatedImages($this->_view->resource);
     if (count($results)) {
         $i = 0;
         foreach ($results as $result) {
             $img = $result['image'];
             try {
                 $rGal = $GLOBALS['injector']->getInstance('Ansel_Storage')->getGallery($img->gallery);
                 if ($rGal->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
                     $html .= Ansel::getUrlFor('view', array('image' => $img->id, 'view' => 'Image', 'gallery' => abs($img->gallery), 'slug' => $rGal->get('slug')), true)->link(array('title' => sprintf(_("%s from %s"), $img->filename, $rGal->get('name')))) . '<img src="' . Ansel::getImageUrl($img->id, 'mini', true) . '" alt="' . htmlspecialchars($img->filename) . '" /></a>';
                 }
             } catch (Ansel_Exception $e) {
                 Horde::log($e->getMessage(), 'ERR');
             }
             $i++;
         }
     }
     return $html;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:29,代码来源:SimilarPhotos.php

示例14: _content

 /**
  */
 protected function _content()
 {
     global $page_output, $registry, $injector, $prefs;
     Horde::initMap();
     $page_output->addScriptFile('map.js');
     $page_output->addScriptFile('blocks/geotag.js');
     try {
         $images = $injector->getInstance('Ansel_Storage')->getRecentImagesGeodata(null, 0, min($this->_params['limit'], 100));
     } catch (Ansel_Exception $e) {
         return $e->getMessage();
     }
     $images = array_reverse($images);
     foreach ($images as $key => $image) {
         $id = $image['image_id'];
         $gallery = $injector->getInstance('Ansel_Storage')->getGallery($image['gallery_id']);
         // Don't show locked galleries in the block.
         if (!$gallery->isOldEnough() || $gallery->hasPasswd()) {
             continue;
         }
         $style = $gallery->getStyle();
         // Generate the image view url
         $url = Ansel::getUrlFor('view', array('view' => 'Image', 'slug' => $gallery->get('slug'), 'gallery' => $gallery->id, 'image' => $id, 'gallery_view' => $style->gallery_view), true);
         $images[$key]['icon'] = strval(Ansel::getImageUrl($images[$key]['image_id'], 'mini', true));
         $images[$key]['link'] = strval($url);
         $images[$key]['markerOnly'] = false;
     }
     // URL for updating selected layer
     $layerUrl = $registry->getServiceLink('ajax', 'ansel')->setRaw(true);
     $layerUrl->url .= 'setPrefValue';
     // And the current defaultLayer, if any.
     $defaultLayer = $prefs->getValue('current_maplayer');
     $opts = array('layerUpdateEndpoint' => strval($layerUrl), 'layerUpdatePref' => 'current_maplayer', 'defaultBaseLayer' => $defaultLayer);
     $json = Horde_Serialize::serialize(array_values($images), Horde_Serialize::JSON);
     $js = array('var opts = ' . Horde_Serialize::serialize($opts, Horde_Serialize::JSON), 'new AnselBlockGeoTag(' . $json . ', opts);');
     $page_output->addInlineScript($js, true);
     return '<div id="ansel_map" style="height:' . $this->_params['height'] . 'px;"></div>';
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:RecentlyAddedGeodata.php

示例15: array_merge

            $gallery->setImageOrder($id, $pos);
        }
        $notification->push(_("Gallery sorted."), 'horde.success');
        $style = $gallery->getStyle();
        Ansel::getUrlFor('view', array_merge(array('view' => 'Gallery', 'gallery' => $galleryId, 'slug' => $gallery->get('slug')), $date), true)->redirect();
        exit;
    case 'Reset':
        // Reset the sort order by date.
        $images = $injector->getInstance('Ansel_Storage')->listImages(array('gallery_id' => $galleryId, 'sort' => 'image_original_date'));
        $pos = 0;
        foreach ($images as $id) {
            $gallery->setImageOrder($id, $pos++);
        }
        $notification->push(_("Gallery sort reset."), 'horde.success');
        $style = $gallery->getStyle();
        Ansel::getUrlFor('view', array_merge(array('view' => 'Gallery', 'gallery' => $galleryId, 'slug' => $gallery->get('slug')), $date), true)->redirect();
        exit;
}
$page_output->addInlineScript(array('jQuery("#sortContainer").sortable()', 'jQuery("#sortContainer").disableSelection()'), true);
$title = sprintf(_("%s :: Sort"), $gallery->get('name'));
$page_output->header(array('title' => _("Search Forums")));
$notification->notify(array('listeners' => 'status'));
?>
<h1 class="header"><?php 
echo htmlspecialchars($title);
?>
</h1>
<div class="instructions">
 <form action="<?php 
echo Horde::url('gallery/sort.php');
?>
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:sort.php


注:本文中的Ansel::getUrlFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。