本文整理汇总了PHP中Ansel::getTagLinks方法的典型用法代码示例。如果您正苦于以下问题:PHP Ansel::getTagLinks方法的具体用法?PHP Ansel::getTagLinks怎么用?PHP Ansel::getTagLinks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ansel
的用法示例。
在下文中一共展示了Ansel::getTagLinks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getTagHTML
/**
* Helper function to build the list of tags
*
* @return string The HTML representing the tag list.
*/
protected function _getTagHTML()
{
global $registry;
// Clear the tag cache?
if (Horde_Util::getFormData('havesearch', 0) == 0) {
$tag_browser = new Ansel_TagBrowser($GLOBALS['injector']->getInstance('Ansel_Tagger'));
$tag_browser->clearSearch();
}
$tagger = $GLOBALS['injector']->getInstance('Ansel_Tagger');
$hasEdit = $this->_view->gallery->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT);
$owner = $this->_view->gallery->get('owner');
$tags = $tagger->getTags((int) $this->_view->resource->id, $this->_resourceType);
if (count($tags)) {
$tags = $tagger->getTagInfo(array_keys($tags), 500, $this->_resourceType);
}
if ($this->_resourceType != 'image') {
$removeLink = Horde::url('gallery.php')->add(array('actionID' => 'removeTags', 'gallery' => $this->_view->gallery->id));
} else {
$removeLink = Horde::url('image.php')->add(array('actionID' => 'removeTags', 'gallery' => $this->_view->gallery->id, 'image' => $this->_view->resource->id));
}
$links = Ansel::getTagLinks($tags, 'add', $owner);
$html = '<ul class="horde-tags">';
foreach ($tags as $taginfo) {
$tag_id = $taginfo['tag_id'];
$html .= '<li>' . $links[$tag_id]->link(array('title' => sprintf(ngettext("%d photo", "%d photos", $taginfo['count']), $taginfo['count']))) . htmlspecialchars($taginfo['tag_name']) . '</a>' . ($hasEdit ? '<a href="' . strval($removeLink) . '" onclick="return AnselTagActions.remove(' . $tag_id . ');"> ' . Horde::img('delete-small.png', _("Remove Tag")) . '</a>' : '') . '</li>';
}
$html .= '</ul>';
return $html;
}
示例2: _getTagHtml
/**
*/
private function _getTagHtml($tags, $hasEdit)
{
$links = Ansel::getTagLinks($tags, 'add');
$html = '<ul>';
foreach ($tags as $taginfo) {
$tag_id = $taginfo['tag_id'];
$html .= '<li>' . $links[$tag_id]->link(array('title' => sprintf(ngettext("%d photo", "%d photos", $taginfo['count']), $taginfo['count']))) . htmlspecialchars($taginfo['tag_name']) . '</a>' . ($hasEdit ? '<a href="#" onclick="removeTag(' . $tag_id . ');">' . Horde::img('delete-small.png', _("Remove Tag")) . '</a>' : '') . '</li>';
}
return $html . '</ul>';
}
示例3: html
/**
* Get the HTML representing this view.
*
* @return string The HTML
*/
public function html()
{
global $conf, $prefs;
$view = $GLOBALS['injector']->getInstance('Horde_View');
$view->addTemplatePath(ANSEL_TEMPLATES . '/view');
$view->perPage = $this->_perPage;
// Ansel Storage
$ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
// Get the slice of galleries/images to view on this page.
try {
$view->results = $this->_browser->getSlice($this->_page, $this->_perPage);
} catch (Ansel_Exception $e) {
Horde::log($e->getMessage(), 'ERR');
return _("An error has occured retrieving the image. Details have been logged.");
}
$view->total = $this->_browser->count();
$view->total = $view->total['galleries'] + $view->total['images'];
// The number of resources to display on this page.
$view->numimages = count($view->results);
$view->tilesperrow = $prefs->getValue('tilesperrow');
$view->cellwidth = round(100 / $view->tilesperrow);
// Get any related tags to display.
if ($conf['tags']['relatedtags']) {
$view->rtags = $this->_browser->getRelatedTags();
$view->taglinks = Ansel::getTagLinks($view->rtags, 'add');
}
$vars = Horde_Variables::getDefaultVariables();
$option_move = $option_copy = $ansel_storage->countGalleries($GLOBALS['registry']->getAuth(), array('perm' => Horde_Perms::EDIT));
$this->_pagestart = $this->_page * $this->_perPage + 1;
$this->_pageend = min($this->_pagestart + $view->numimages - 1, $this->_pagestart + $this->_perPage - 1);
$view->pageStart = $this->_pageStart;
$view->pageEnd = $this->_pageEnd;
$view->owner = $this->_owner;
$view->tagTrail = $this->_browser->getTagTrail();
$view->title = $this->getTitle();
$view->params = $this->_params;
$view->style = Ansel::getStyleDefinition($GLOBALS['prefs']->getValue('default_gallerystyle'));
$viewurl = Horde::url('view.php')->add(array('view' => 'Results', 'actionID' => 'add'));
$view->pager = new Horde_Core_Ui_Pager('page', $vars, array('num' => $view->total, 'url' => $viewurl, 'perpage' => $this->_perPage));
$GLOBALS['page_output']->addScriptFile('views/common.js');
$GLOBALS['page_output']->addScriptFile('views/gallery.js');
return $view->render('results');
}