本文整理汇总了PHP中Poll::getTagList方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::getTagList方法的具体用法?PHP Poll::getTagList怎么用?PHP Poll::getTagList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poll
的用法示例。
在下文中一共展示了Poll::getTagList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleDetail
/**
* handle detail request
*/
private function handleDetail()
{
$request = Request::getInstance();
$view = ViewManager::getInstance();
// it makes no sense to have multiple tags for this plugin.
// if someone did it, you get strange results and he probably can figure out why.. no multiple detail stuff in 1 page supported!
// so take a shot and get the first tag to set the content
$taglist = $this->plugin->getTagList();
if (!$taglist) {
return;
}
$taginfo = current($taglist);
// clear subtitle
$view->setName('');
if (!$request->exists('id')) {
continue;
}
$id = intval($request->getValue('id'));
$key = array('id' => $id, 'active' => true);
$overview = $this->getPollOverview();
if (!$overview->exists($key)) {
throw new HttpException('404');
}
$detail = $overview->getDetail($key);
// check if tree node of poll item is accessable
$tree = $this->director->tree;
if (!$tree->exists($detail['tree_id'])) {
throw new HttpException('404');
}
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$template->setPostfix($detail['tag']);
// disable cache because we want to count visits
$template->setCacheable(false);
Cache::disableCache();
// overwrite default naming
$template->setVariable('pageTitle', $detail['name'], false);
$template->setVariable('poll', $detail, false);
$url = new Url(true);
$url->clearParameter('id');
$url->setParameter($view->getUrlId(), ViewManager::OVERVIEW);
$template->setVariable('href_back', $url->getUrl(true), false);
$breadcrumb = array('name' => $detail['name'], 'path' => $url->getUrl(true));
$this->director->theme->addBreadcrumb($breadcrumb);
$this->template[$taginfo['tag']] = $template;
}
示例2: handleOverview
/**
* handle overview request
*/
private function handleOverview()
{
$request = Request::getInstance();
$view = ViewManager::getInstance();
// retrieve tags that are linked to this plugin
$taglist = $this->plugin->getTagList();
if (!$taglist) {
return;
}
$url = new Url(true);
$url->setParameter($view->getUrlId(), Poll::VIEW_DETAIL);
Cache::disableCache();
foreach ($taglist as $tag) {
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
//$template->setPostfix($tag['tag']);
$template->setCacheable(false);
// check if template is in cache
if (!$template->isCached()) {
// get settings
$settings = array_merge($this->getPollSettings()->getSettings($tag['tag'], $tag['tree_id']), $this->plugin->getSettings());
$template->setVariable('settings', $settings);
$searchcriteria = array('tree_id' => $tag['tree_id'], 'tag' => $tag['tag'], 'activated' => true);
if (!$this->exists($searchcriteria)) {
continue;
}
$poll = $this->getDetail($searchcriteria);
$searchcriteria['poll_id'] = $poll['id'];
$voted = $this->hasVoted($poll['id']);
$template->setVariable('voted', $voted);
$template->setVariable('poll', $poll);
$itemlist = $this->getPollResult($poll['id'], $tag['tag'], $settings, $voted);
$template->setVariable('tpl_poll_result', $itemlist);
}
$this->template[$tag['tag']] = $template;
}
}