本文整理汇总了PHP中Zend_View_Interface::linkTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Interface::linkTo方法的具体用法?PHP Zend_View_Interface::linkTo怎么用?PHP Zend_View_Interface::linkTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View_Interface
的用法示例。
在下文中一共展示了Zend_View_Interface::linkTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pagination
/**
* Generates a list of pagination links
*
* @param QFrame_Paginator paginator object
* @param string (optional) action to use for page link
* @param string (optional) variable to use for page number
* @param Array (optional) list of additional parameters to add to each link
* @return string
*/
public function pagination($pager, $action = 'page', $pageNum = 'id', $params = array())
{
if (count($pager->pageNumbers()) <= 1) {
return '';
}
$controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
$b = new Tag_Builder();
$content = '';
// set up an array of arguments that are common to all links
$linkArgs = array_merge($params, array('controller' => $controller, 'action' => $action));
// print out links to each page number (unless it is the current page number
// in which case print out just the number, no link)
foreach ($pager->pageNumbers() as $page) {
if ($page == $pager->currentNumber()) {
$pageContent = "{$page} ";
} else {
$linkArgs[$pageNum] = $page;
$pageContent = $this->_view->linkTo($linkArgs, "{$page}") . ' ';
}
$content .= $b->li($pageContent);
}
// prepend a previous page link if there is/are previous page(s), otherwise
// just the equivalent text
if ($pager->currentNumber() > 1) {
$linkArgs[$pageNum] = $pager->currentNumber() - 1;
$content = $b->li($this->_view->linkTo($linkArgs, '< prev'), ' ', $content);
}
// append a next page link if there is/are next page(s), otherwise just
// the equivalent text
if ($pager->currentNumber() < $pager->lastPageNumber()) {
$linkArgs[$pageNum] = $pager->currentNumber() + 1;
$content .= $b->li($this->_view->linkTo($linkArgs, 'next >'), ' ');
}
return $b->ol(array('class' => 'pagination'), $content);
}
示例2: lockIcon
/**
* Output a lock icon which also serves as a link to unlock a page (if the user has permission
* to do this)
*
* @param Array menu item array for this lock
* @param DbUserModel user that is currently logged in
* @return string
*/
public function lockIcon($menu, DbUserModel $user)
{
if ($menu['locked']) {
$user = new DbUserModel(array('dbUserID' => $menu['locked'], 'depth' => 'dbUser'));
$title = "Currently locked by '{$this->h($user->dbUserFullName)}'.";
if ($user->hasAccess('edit', $menu['page']) || $user->hasAccess('approve', $menu['page'])) {
$title .= ' Click to unlock.';
$html = $this->view->linkTo('#', $this->view->imageTag('icons/ffffff/lock_small.png', array('id' => $this->view->url(array('action' => 'unlock', 'id' => $menu['page']->pageID)), 'class' => 'inline lock tooltip', 'tooltip' => $title)));
} else {
$html = $this->view->imageTag('icons/ffffff/lock_small.png', array('class' => 'inline', 'title' => $title));
}
} else {
$html = '';
}
return $html;
}
示例3: topLinks
/**
* Returns a link for the header bar of a page
*
* @param PageModel current page
* @param DbUserModel currently logged in user
* @param integer The current page number
* @return string
*/
public function topLinks($page, $user, $spNum)
{
if ($page->numQuestions <= 0) {
return;
}
$current = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
$actions = "<li class=\"current\">{$current}</li>";
//TODO need to relocate this list of available actions somewhere more appropriate
foreach (array('view', 'edit', 'approve') as $action) {
if ($action !== $current && $user->hasAccess($action, $page)) {
$links[] = $this->view->linkTo($this->view->url(array('action' => $action, 'id' => $page->pageID)) . "?sp={$spNum}", $action);
}
}
$actions = '<ul id="pageHeading">' . $actions . '<li>';
if (isset($links)) {
$actions .= implode($links, ' | </li><li>') . '</li>';
}
return "{$actions}<li class=\"stats\">{$this->stats($page)}</li><li class=\"bottom\"></li></ul>";
}
示例4: optionButton
/**
* Outputs an option button for the "more options" panel
*
* @param string name of the javascript event handler
* @param string image filename
* @param string description (when hovered over)
* @param string (optional) class to apply to the button
* @return string
*/
public function optionButton($handler, $image, $description, $class = 'inline')
{
$image = 'icons/ffffff/' . $image;
return $this->view->linkTo("#{$handler}", $this->view->imageTag($image, array('class' => $class, 'title' => $description)));
}