Skip to content

Commit

Permalink
*8613* introduce link category page
Browse files Browse the repository at this point in the history
  • Loading branch information
jnugent committed May 6, 2014
1 parent 8d4e284 commit 92edc5c
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 2 deletions.
56 changes: 56 additions & 0 deletions pages/links/LinksHandler.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

/**
* @file pages/links/LinksHandler.inc.php
*
* Copyright (c) 2014 Simon Fraser University Library
* Copyright (c) 2003-2014 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class LinksHandler
* @ingroup pages_links
*
* @brief Handle link info requests.
*/


import('classes.handler.Handler');

class LinksHandler extends Handler {
/**
* Constructor
*/
function LinksHandler() {
parent::Handler();
}


//
// Public handler operations
//
/**
* Display the link info page.
* @param $args array
* @param $request Request
*/
function link($args, $request) {
$templateMgr = TemplateManager::getManager($request);
$this->setupTemplate($request);

$path = $args[0];
if ($path != '') {
$context = $request->getContext();
$footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
$category = $footerCategoryDao->getByPath($path, $context->getId());
if ($category) {
$templateMgr->assign('category', $category);
$footerLinkDao = DAORegistry::getDAO('FooterLinkDAO');
$links = $footerLinkDao->getByCategoryId($category->getId(), $context->getId());
$templateMgr->assign('links', $links->toArray());
return $templateMgr->display('links/link.tpl');
}
}
}
}

?>
27 changes: 27 additions & 0 deletions pages/links/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* @defgroup pages_links Link page
*/

/**
* @file pages/links/index.php
*
* Copyright (c) 2014 Simon Fraser University Library
* Copyright (c) 2003-2014 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @ingroup pages_links
* @brief Handle site link page requests.
*
*/


switch ($op) {
case 'link':
define('HANDLER_CLASS', 'LinksHandler');
import('lib.pkp.pages.links.LinksHandler');
break;
}

?>
4 changes: 2 additions & 2 deletions templates/common/footer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
{foreach from=$footerCategories item=category name=loop}
{assign var=links value=$category->getLinks()}
<div class="unit size1of{$footerCategories|@count} {if $smarty.foreach.loop.last}lastUnit{/if}">
<h4>{$category->getLocalizedTitle()}</h4>
<h4><a href="{url page="links" op="link" path=$category->getPath()|escape}">{$category->getLocalizedTitle()|strip_unsafe_html}</a></h4>
<ul>
{foreach from=$links item=link}
<li><a href="{$link->getUrl()}">{$link->getLocalizedTitle()}</a></li>
<li><a href="{$link->getUrl()}">{$link->getLocalizedTitle()|strip_unsafe_html}</a></li>
{/foreach}
{if $links|@count < $maxLinks}
{section name=padding start=$links|@count loop=$maxLinks step=1}
Expand Down
27 changes: 27 additions & 0 deletions templates/links/link.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{**
* templates/links/link.tpl
*
* Copyright (c) 2014 Simon Fraser University Library
* Copyright (c) 2000-2014 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Display a link category and associated links.
*
*}
{strip}
{assign var="pageTitleTranslated" value=$category->getLocalizedTitle()|strip_unsafe_html}
{include file="common/header.tpl"}
{/strip}

<div id="linkInfo">
<p>
{$category->getLocalizedDescription()|strip_unsafe_html}
</p>
<ul>
{foreach from=$links item=link}
<li><a href="{$link->getUrl()}">{$link->getLocalizedTitle()|strip_unsafe_html}</a></li>
{/foreach}
</ul>
</div>

{include file="common/footer.tpl"}

0 comments on commit 92edc5c

Please sign in to comment.