diff --git a/module/VuFind/src/VuFind/Recommend/FavoriteFacets.php b/module/VuFind/src/VuFind/Recommend/FavoriteFacets.php index a8032f5f38fe8886914af6903599cf5385bd3c5d..57f368ec8da32c5c636bc4a81fb803469cdd0b96 100644 --- a/module/VuFind/src/VuFind/Recommend/FavoriteFacets.php +++ b/module/VuFind/src/VuFind/Recommend/FavoriteFacets.php @@ -51,6 +51,6 @@ class FavoriteFacets extends SideFacets */ public function setConfig($settings) { - $this->mainFacets = array('lists' => 'Your Lists', 'tags' => 'Your Tags'); + $this->mainFacets = array('tags' => 'Your Tags'); } } diff --git a/module/VuFind/src/VuFind/Search/Favorites/Results.php b/module/VuFind/src/VuFind/Search/Favorites/Results.php index 1fa6449873363c7fc98e694675e0e84b2ad55d3d..f2c4886bc990b416707e0b9c245ffe9fd96cfe81 100644 --- a/module/VuFind/src/VuFind/Search/Favorites/Results.php +++ b/module/VuFind/src/VuFind/Search/Favorites/Results.php @@ -40,7 +40,18 @@ use VuFind\Exception\ListPermission as ListPermissionException, */ class Results extends BaseResults { + /** + * Object if user is logged in, false otherwise. + * + * @var \VuFind\Db\Row\User|bool + */ protected $user = null; + + /** + * Active user list (false if none). + * + * @var \VuFind\Db\Row\UserList|bool + */ protected $list = false; /** @@ -75,18 +86,6 @@ class Results extends BaseResults 'list' => array() ); switch ($field) { - case 'lists': - $lists = $this->user ? $this->user->getLists() : array(); - foreach ($lists as $list) { - $this->facets[$field]['list'][] = array( - 'value' => $list->id, - 'displayText' => $list->title, - 'count' => $list->cnt, - 'isApplied' => - $this->getParams()->hasFilter("$field:".$list->id) - ); - } - break; case 'tags': if ($this->list) { $tags = $this->list->getTags(); diff --git a/themes/blueprint/templates/Recommend/FavoriteFacets.phtml b/themes/blueprint/templates/Recommend/FavoriteFacets.phtml index ff8343a82a26baa6a8da76ad278463185954143e..13eafc7c0478cd4fbeb32adeaa103115f16a4ab0 100644 --- a/themes/blueprint/templates/Recommend/FavoriteFacets.phtml +++ b/themes/blueprint/templates/Recommend/FavoriteFacets.phtml @@ -2,30 +2,6 @@ <div class="sidegroup"> <? $sideFacetSet = $this->recommend->getFacetSet(); ?> - <? if (isset($sideFacetSet['lists']) && !empty($sideFacetSet['lists']['list'])): ?> - <div class="sidegroup"> - <h4 class="list"><?=$this->transEsc($sideFacetSet['lists']['label'])?></h4> - <ul> - <? foreach ($sideFacetSet['lists']['list'] as $current): ?> - <li> - <? if ($current['isApplied']): ?> - <strong><?=$this->escapeHtml($current['displayText'])?></strong> - <? else: ?> - <a href="<?=$this->url('userList', array('id' => $current['value']))?>"><?=$this->escapeHtml($current['displayText'])?></a> - <? endif; ?> - (<?=$this->escapeHtml($current['count'])?>) - </li> - <? endforeach; ?> - <li> - <a href="<?=$this->url('editList', array('id'=>'NEW'))?>" title="<?=$this->transEsc('Create a List') ?>"> - <?=$this->transEsc('Create a List') ?> - </a> - <img src="<?=$this->imageLink('silk/add.png')?>" style="margin-left:2px;vertical-align:text-bottom"/> - </li> - </ul> - </div> - <? endif; ?> - <? if (isset($sideFacetSet['tags']) && !empty($sideFacetSet['tags']['list'])): ?> <div class="sidegroup"> <h4 class="tag"><?=$this->transEsc($sideFacetSet['tags']['label'])?></h4> diff --git a/themes/blueprint/templates/myresearch/menu.phtml b/themes/blueprint/templates/myresearch/menu.phtml index 77a2716974659882da06aa1242c268392e39eaf5..5ada60e1006bb1122f7bddcc76fc34ada1acd3a6 100644 --- a/themes/blueprint/templates/myresearch/menu.phtml +++ b/themes/blueprint/templates/myresearch/menu.phtml @@ -10,4 +10,23 @@ <? endif; ?> <li<?=$this->active == 'history' ? ' class="active"' : ''?>><a href="<?=$this->url('search-history')?>?require_login"><?=$this->transEsc('history_saved_searches')?></a></li> </ul> + <? if ($user = $this->auth()->isLoggedIn()): ?> + <h4 class="list"><?=$this->transEsc('Your Lists')?></h4> + <ul> + <li<?=$this->active == 'favorites' ? ' class="active"' : ''?>><a href="<?=$this->url('myresearch-favorites')?>"><?=$this->transEsc('Your Favorites')?></a></li> + <? $lists = $user->getLists() ?> + <? foreach ($lists as $list): ?> + <li<?=$this->active == 'list' . $list['id'] ? ' class="active"' : ''?>> + <a href="<?=$this->url('userList', array('id' => $list['id']))?>"><?=$this->escapeHtml($list['title'])?></a> + (<?=$list->cnt?>) + </li> + <? endforeach; ?> + <li> + <a href="<?=$this->url('editList', array('id'=>'NEW'))?>" title="<?=$this->transEsc('Create a List') ?>"> + <?=$this->transEsc('Create a List') ?> + </a> + <img src="<?=$this->imagelink('silk/add.png')?>" style="margin-left:2px;vertical-align:text-bottom"/> + </li> + </ul> + <? endif ?> </div> diff --git a/themes/blueprint/templates/myresearch/mylist.phtml b/themes/blueprint/templates/myresearch/mylist.phtml index a2b5c8346f6bb9324a0d84d6d3f520adc6107145..6a7eb6cba1fc135c429178e16a67097d4a436fab 100644 --- a/themes/blueprint/templates/myresearch/mylist.phtml +++ b/themes/blueprint/templates/myresearch/mylist.phtml @@ -70,7 +70,7 @@ </div> <div class="<?=$this->layoutClass('sidebar')?>"> - <?=$this->context($this)->renderInContext("myresearch/menu.phtml", array('active' => isset($list) ? 'list' : 'favorites'))?> + <?=$this->context($this)->renderInContext("myresearch/menu.phtml", array('active' => isset($list) ? 'list' . $list['id'] : 'favorites'))?> <? foreach ($this->results->getRecommendations('side') as $current): ?> <?=$this->recommend($current)?> diff --git a/themes/bootprint/templates/myresearch/mylist.phtml b/themes/bootprint/templates/myresearch/mylist.phtml index 9725d17617bee6781e509897681a506e150503e7..5a747ecb509fba273ec20ca32b28737f31ad7bfa 100644 --- a/themes/bootprint/templates/myresearch/mylist.phtml +++ b/themes/bootprint/templates/myresearch/mylist.phtml @@ -74,7 +74,7 @@ </div> <div class="<?=$this->layoutClass('sidebar')?>"> - <?=$this->context($this)->renderInContext("myresearch/menu.phtml", array('active' => isset($list) ? 'list' : 'favorites'))?> + <?=$this->context($this)->renderInContext("myresearch/menu.phtml", array('active' => isset($list) ? 'list' . $list['id'] : 'favorites'))?> <? foreach ($this->results->getRecommendations('side') as $current): ?> <?=$this->recommend($current)?> diff --git a/themes/bootstrap/templates/Recommend/FavoriteFacets.phtml b/themes/bootstrap/templates/Recommend/FavoriteFacets.phtml index ea62ff471db583991d0424cb434c7d6b29abc1a7..c6fe3fabcb3d4c1f71aaf755ad261b4df345b1d2 100644 --- a/themes/bootstrap/templates/Recommend/FavoriteFacets.phtml +++ b/themes/bootstrap/templates/Recommend/FavoriteFacets.phtml @@ -1,18 +1,6 @@ <? $results = $this->recommend->getResults(); ?> <? $sideFacetSet = $this->recommend->getFacetSet(); ?> -<? if (isset($sideFacetSet['lists']) && !empty($sideFacetSet['lists']['list'])): ?> - <h4 class="list"><?=$this->transEsc($sideFacetSet['lists']['label'])?></h4> - <ul class="nav nav-list"> - <? foreach ($sideFacetSet['lists']['list'] as $current): ?> - <li<? if ($current['isApplied']): ?> class="active"<? endif ?>> - <a href="<?=$this->url('userList', array('id' => $current['value']))?>"><?=$this->escapeHtml($current['displayText'])?> <span class="pull-right"><?=$this->escapeHtml($current['count'])?></span></a> - </li> - <? endforeach; ?> - <li><a href="<?=$this->url('editList', array('id'=>'NEW'))?>" title="<?=$this->transEsc('Create a List') ?>"><?=$this->transEsc('Create a List') ?> <span class="pull-right"><i class="icon-plus"></i></span></a></li> - </ul> -<? endif; ?> - <? if (isset($sideFacetSet['tags']) && !empty($sideFacetSet['tags']['list'])): ?> <h4 class="tag"><?=$this->transEsc($sideFacetSet['tags']['label'])?></h4> <ul class="nav nav-list"> diff --git a/themes/bootstrap/templates/myresearch/menu.phtml b/themes/bootstrap/templates/myresearch/menu.phtml index 95da56187d497e2007829c0c59f7f4bc5607db01..969e8ae284066e2c0ea72c484569489b70a651f6 100644 --- a/themes/bootstrap/templates/myresearch/menu.phtml +++ b/themes/bootstrap/templates/myresearch/menu.phtml @@ -10,3 +10,14 @@ <li<?=$this->active == 'history' ? ' class="active"' : ''?>><a href="<?=$this->url('search-history')?>?require_login"><?=$this->transEsc('history_saved_searches')?> <i class="icon-search pull-right"></i></a></li> <li><a href="<?=$this->url('myresearch-logout')?>"><?=$this->transEsc("Log Out")?> <i class="icon-signout pull-right"></i></a></li> </ul> + <? if ($user = $this->auth()->isLoggedIn()): ?> + <h4 class="list"><?=$this->transEsc('Your Lists')?></h4> + <ul class="nav nav-list"> + <li<?=$this->active == 'favorites' ? ' class="active"' : ''?>><a href="<?=$this->url('myresearch-favorites')?>"><?=$this->transEsc('Your Favorites')?> <i class="icon-star pull-right"></i></a></li> + <? $lists = $user->getLists() ?> + <? foreach ($lists as $list): ?> + <li<?=$this->active == 'list' . $list['id'] ? ' class="active"' : ''?>> <a href="<?=$this->url('userList', array('id' => $list['id']))?>"><?=$this->escapeHtml($list['title'])?> <span class="pull-right"><?=$list->cnt?></span></a></li> + <? endforeach; ?> + <li><a href="<?=$this->url('editList', array('id'=>'NEW'))?>" title="<?=$this->transEsc('Create a List') ?>"><?=$this->transEsc('Create a List') ?> <span class="pull-right"><i class="icon-plus"></i></span></a></li> + </ul> + <? endif ?> diff --git a/themes/bootstrap/templates/myresearch/mylist.phtml b/themes/bootstrap/templates/myresearch/mylist.phtml index 5c51fc71012777a3a5368b934da4d3587779e802..b3698cf820005e3f8c33a4f8bb6f95157723ec71 100644 --- a/themes/bootstrap/templates/myresearch/mylist.phtml +++ b/themes/bootstrap/templates/myresearch/mylist.phtml @@ -74,9 +74,9 @@ </div> <div class="<?=$this->layoutClass('sidebar')?>"> - <?=$this->context($this)->renderInContext("myresearch/menu.phtml", array('active' => isset($list) ? 'list' : 'favorites'))?> + <?=$this->context($this)->renderInContext("myresearch/menu.phtml", array('active' => isset($list) ? 'list' . $list['id'] : 'favorites'))?> <? foreach ($this->results->getRecommendations('side') as $current): ?> <?=$this->recommend($current)?> <? endforeach; ?> -</div> \ No newline at end of file +</div>