From 0dd2242a06d1a543e8c1a18060cb06deeb5e6be0 Mon Sep 17 00:00:00 2001 From: Chris Hallberg <crhallberg@gmail.com> Date: Fri, 31 Oct 2014 12:17:47 -0400 Subject: [PATCH] Search History: Only show MyResearch sidebar if logged in. --- .../blueprint/templates/search/history.phtml | 18 ++--- .../bootstrap/templates/search/history.phtml | 18 ++--- .../bootstrap3/templates/search/history.phtml | 65 ++++++++++--------- 3 files changed, 53 insertions(+), 48 deletions(-) diff --git a/themes/blueprint/templates/search/history.phtml b/themes/blueprint/templates/search/history.phtml index c36446774a5..3611bccab1e 100644 --- a/themes/blueprint/templates/search/history.phtml +++ b/themes/blueprint/templates/search/history.phtml @@ -23,13 +23,15 @@ <? endif; ?> </div> -<div class="<?=$this->layoutClass('sidebar')?>"> - <?=$this->context($this)->renderInContext( - "myresearch/menu.phtml", - // Only activate search history in account menu if user is logged in. - $this->auth()->isLoggedIn() ? array('active' => 'history') : array() - ); - ?> -</div> +<? if ($user = $this->auth()->isLoggedIn()): ?> + <div class="<?=$this->layoutClass('sidebar')?>"> + <?=$this->context($this)->renderInContext( + "myresearch/menu.phtml", + // Only activate search history in account menu if user is logged in. + $this->auth()->isLoggedIn() ? array('active' => 'history') : array() + ); + ?> + </div> +<? endif; ?> <div class="clear"></div> \ No newline at end of file diff --git a/themes/bootstrap/templates/search/history.phtml b/themes/bootstrap/templates/search/history.phtml index 65e508057f9..d2c3499deb1 100644 --- a/themes/bootstrap/templates/search/history.phtml +++ b/themes/bootstrap/templates/search/history.phtml @@ -21,11 +21,13 @@ <? endif; ?> </div> -<div class="<?=$this->layoutClass('sidebar')?>"> - <?=$this->context($this)->renderInContext( - "myresearch/menu.phtml", - // Only activate search history in account menu if user is logged in. - $this->auth()->isLoggedIn() ? array('active' => 'history') : array() - ); - ?> -</div> \ No newline at end of file +<? if ($user = $this->auth()->isLoggedIn()): ?> + <div class="<?=$this->layoutClass('sidebar')?>"> + <?=$this->context($this)->renderInContext( + "myresearch/menu.phtml", + // Only activate search history in account menu if user is logged in. + $this->auth()->isLoggedIn() ? array('active' => 'history') : array() + ); + ?> + </div> +<? endif; ?> \ No newline at end of file diff --git a/themes/bootstrap3/templates/search/history.phtml b/themes/bootstrap3/templates/search/history.phtml index 04874808ab5..02de3570f27 100644 --- a/themes/bootstrap3/templates/search/history.phtml +++ b/themes/bootstrap3/templates/search/history.phtml @@ -1,33 +1,34 @@ -<? - // Set page title. - $this->headTitle($this->translate('Search History')); - - // Set up breadcrumbs: - $this->layout()->breadcrumbs = '<li><a href="' . $this->url('myresearch-home') . '">' . $this->transEsc('Your Account') . '</a></li>' - . '<li class="active">' . $this->transEsc('History') . '</li>'; -?> - -<div class="row"> - <div class="<?=$this->layoutClass('mainbody')?>"> - <? if (!empty($this->saved)): ?> - <h2><?=$this->transEsc("history_saved_searches")?></h2> - <?=$this->context()->renderInContext('search/history-table.phtml', array('showSaved' => true));?> - <? endif; ?> - - <h2><?=$this->transEsc("history_recent_searches")?></h2> - <? if (!empty($this->unsaved)): ?> - <?=$this->context()->renderInContext('search/history-table.phtml', array('showSaved' => false));?> - <? else: ?> - <?=$this->transEsc("history_no_searches")?> - <? endif; ?> - </div> - - <div class="<?=$this->layoutClass('sidebar')?>"> - <?=$this->context($this)->renderInContext( - "myresearch/menu.phtml", - // Only activate search history in account menu if user is logged in. - $this->auth()->isLoggedIn() ? array('active' => 'history') : array() - ); - ?> - </div> +<? + // Set page title. + $this->headTitle($this->translate('Search History')); + + // Set up breadcrumbs: + $this->layout()->breadcrumbs = '<li><a href="' . $this->url('myresearch-home') . '">' . $this->transEsc('Your Account') . '</a></li>' + . '<li class="active">' . $this->transEsc('History') . '</li>'; +?> + +<div class="row"> + <div class="<?=$this->layoutClass('mainbody')?>"> + <? if (!empty($this->saved)): ?> + <h2><?=$this->transEsc("history_saved_searches")?></h2> + <?=$this->context()->renderInContext('search/history-table.phtml', array('showSaved' => true));?> + <? endif; ?> + + <h2><?=$this->transEsc("history_recent_searches")?></h2> + <? if (!empty($this->unsaved)): ?> + <?=$this->context()->renderInContext('search/history-table.phtml', array('showSaved' => false));?> + <? else: ?> + <?=$this->transEsc("history_no_searches")?> + <? endif; ?> + </div> + <? if ($user = $this->auth()->isLoggedIn()): ?> + <div class="<?=$this->layoutClass('sidebar')?>"> + <?=$this->context($this)->renderInContext( + "myresearch/menu.phtml", + // Only activate search history in account menu if user is logged in. + $this->auth()->isLoggedIn() ? array('active' => 'history') : array() + ); + ?> + </div> + <? endif; ?> </div> \ No newline at end of file -- GitLab