Skip to content

Commit

Permalink
site views tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rogercreagh committed Feb 5, 2023
1 parent f3f803f commit e80984f
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 116 deletions.
2 changes: 1 addition & 1 deletion src/com_xbbooks/site/models/forms/filter_groups.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
label="XBCULTURE_CATFILT_LABEL"
description="XBCULTURE_CATFILT_DESC"
extension="com_xbpeople"
itemtable="#__xbpersons"
itemtable="#__xbgroups"
published="1" multiple="true"
onchange="this.form.submit();"
class="multipleCats"
Expand Down
36 changes: 12 additions & 24 deletions src/com_xbbooks/site/models/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*******
* @package xbBooks
* @filesource site/models/groups.php
* @version 1.0.3.5 19th January 2023
* @version 1.0.4.0 5th February 2023
* @author Roger C-O
* @copyright Copyright (c) Roger Creagh-Osborne, 2022
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -91,17 +91,16 @@ protected function getListQuery() {

// Filter by search in title/id/synop
$search = $this->getState('filter.search');

if (!empty($search)) {
if (stripos($search,'s:')===0) {
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim(substr($search,2)), true) . '%'));
$query->where('(a.biography LIKE ' . $search.' OR a.summary LIKE '.$search.')');
} else {
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
$query->where('(a.firstname LIKE ' . $search . ' OR a.lastname LIKE ' . $search . ')');
}
if (!empty($search)) {
if ((stripos($search,'d:')===0) || (stripos($search,'s:')===0)) {
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim(substr($search,2)), true) . '%'));
$query->where('(a.description LIKE ' . $search.' OR a.summary LIKE '.$search.')');
} else {
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
$query->where('(a.title LIKE ' . $search .')');
}

}

// Filter by category and subcats
$categoryId = $this->getState('categoryId');
$this->setState('categoryId','');
Expand Down Expand Up @@ -185,9 +184,6 @@ protected function getListQuery() {
case 'category_title':
$query->order('category_title '.$orderDirn.', lastname');
break;
// case 'bcnt':
// $query->order('bcnt '.$orderDirn.', lastname');
// break;
default:
$query->order($db->escape($orderCol.' '.$orderDirn));
break;
Expand All @@ -214,19 +210,11 @@ public function getItems() {

if ($item->bcnt>0) {
$item->books = XbcultureHelper::getGroupBooks($item->id);
$item->booklist = XbcultureHelper::makeLinkedNameList($item->books,'','ul',true,2);
}
if ($item->ecnt>0) {
$item->events = XbcultureHelper::getGroupEvents($item->id);
$item->eventlist = XbcultureHelper::makeLinkedNameList($item->events,'','ul',true,2);
}
if ($item->fcnt>0) {
$item->films = XbcultureHelper::getGroupFilms($item->id);
$item->filmlist = XbcultureHelper::makeLinkedNameList($item->films,'','ul',true,2);
$item->booklist = XbcultureHelper::makeItemLists($item->books,'','tr',3,'bpvmodal');
}
if ($item->pcnt>0) {
$item->members = XbcultureHelper::getGroupMembers($item->id);
$item->memberlist = XbcultureHelper::makeLinkedNameList($item->members,'','ul',true,2);
$item->memberlist = XbcultureHelper::makeItemLists($item->members,'','tr',3,'gpvmodal');
}


Expand Down
5 changes: 2 additions & 3 deletions src/com_xbbooks/site/views/booklist/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
?>
<style type="text/css" media="screen">
.xbpvmodal .modal-content {padding:15px;max-height:calc(100vh - 190px); overflow:scroll; z-index-2 }
.xbpvmodal .modal-body {max-height: calc(100vh - 190px); }
.xbpvmodal .modal-body iframe { max-height:calc(100vh - 270px);}
</style>
<div class="xbculture ">
<?php if(($this->header['showheading']) || ($this->header['title'] != '') || ($this->header['text'] != '')) {
Expand Down Expand Up @@ -155,7 +153,8 @@
<p class="xbtitle">
<a href="<?php echo Route::_(XbbooksHelperRoute::getBookLink($item->id)) ;?>" >
<b><?php echo $this->escape($item->title); ?></b></a>
&nbsp;<a href="" data-toggle="modal" data-target="#ajax-bpvmodal" onclick="window.pvid=<?php echo $item->id; ?>;"><i class="far fa-eye"></i></a>
&nbsp;<a href="" data-toggle="modal" data-target="#ajax-bpvmodal" onclick="window.pvid=<?php echo $item->id; ?>;">
<i class="far fa-eye"></i></a>
<?php if (!empty($item->subtitle)) :?>
<br /><span class="xb09"><?php echo $this->escape($item->subtitle); ?></span>
<?php endif; ?>
Expand Down
22 changes: 7 additions & 15 deletions src/com_xbbooks/site/views/booklist/tmpl/default.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- xbBooks site/views/booklist/default.xml v0.9.9.3 14th July 2022 -->
<!-- xbBooks site/views/booklist/default.xml v1.0.3.5 5th February 2023 -->
<metadata>
<layout title="Book List">
<message>Displays a list (table) of books. Options enable user search &amp; filtering or to restrict to single category and filter person and tags.</message>
Expand Down Expand Up @@ -108,24 +108,16 @@
<option value="2">XBCULTURE_FICTION</option>
</field>
<field
name="menu_category_id"
type="category"
name="menu_category_id" type="xbitemcats"
label="XBCULTURE_CATFILT_LABEL"
extension="com_xbbooks"
description="XBCULTURE_CATFILT_DESC"
extension="com_xbbooks"
itemtable="#__xbbooks"
published="1" multiple="true"
class="multipleCats"
onchange="this.form.submit();"
>
<option value="0">XBCULTURE_ALL_CATS</option>
</field>
<field name="menu_subcats" type="radio"
default=""
label="XBCULTURE_CATFILT_SUBS_LABEL"
description="XBCULTURE_CATFILT_SUBS_DESC"
class="btn-group btn-small radiotop"
showon="menu_category_id!:0"
>
<option value="" >XBCULTURE_EXCLUDE</option>
<option value="1">XBCULTURE_INCLUDE</option>
</field>
<field
name="menu_tag" type="tag"
label="XBCULTURE_TAGFILT_LABEL"
Expand Down
20 changes: 11 additions & 9 deletions src/com_xbbooks/site/views/bookreviews/tmpl/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<layout title="Book Reviews List">
<message>Displays a list (table) of reviews. Options enable user search &amp; filtering or to restrict to single category and filter by tags.</message>
</layout>
<fields name="params" addfieldpath="administrator/components/com_xbbooks/models/fields">
<fields name="params" addfieldpath="administrator/components/com_xbpeople/models/fields">
<!-- Basic options. -->
<fieldset name="basic" label="Options">
<field name="show_bpiccol" type="radio"
Expand All @@ -17,7 +17,7 @@
<option value="1">JSHOW</option>
</field>

<field name="show_bsumcol" type="radio"
<field name="show_rsumcol" type="radio"
label="Summary Column"
description="Show summary column"
class="btn-group btn-group-yesno btn-small"
Expand All @@ -27,8 +27,8 @@
<option value="1">JSHOW</option>
</field>

<field name="show_bcat" type="list"
label="Show Book Category"
<field name="show_rcat" type="list"
label="Show Book Review Category"
description="If Category, Fiction, and Tag are all hidden the column will be hidden. The category label can optionally be linked to the Category view showing all items in that category"
class="btn-group btn-group-yesno"
useglobal="true"
Expand All @@ -37,7 +37,7 @@
<option value="1">Show (no link)</option>
<option value="2">Show (linked)</option>
</field>
<field name="show_btags" type="radio"
<field name="show_rtags" type="radio"
label="Show Tags"
description="If Category, Fiction, and Tag are all hidden the column will be hidden. Tag labels are always linked to their Tag view"
class="btn-group btn-group-yesno"
Expand All @@ -61,13 +61,15 @@
<option value="1">JYES</option>
</field>
<field
name="menu_category_id"
type="category"
name="menu_category_id" type="xbitemcats"
label="XBCULTURE_CATFILT_LABEL"
extension="com_xbbooks"
description="XBCULTURE_CATFILT_DESC"
extension="com_xbbooks"
itemtable="#__xbbookreviews"
published="1" multiple="true"
class="multipleCats"
onchange="this.form.submit();"
>
<option value="0">XBCULTURE_ALL_CATS</option>
</field>
<field
name="menu_tag" type="tag"
Expand Down
6 changes: 3 additions & 3 deletions src/com_xbbooks/site/views/bookreviews/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ function display($tpl = null) {
$this->header['text'] = $params->get('list_headtext','','text');

$show_cats = $params->get('show_cats','1','int');
$this->showcat = ($show_cats) ? $params->get('show_bcat','1','int') : 0;
$this->showcat = ($show_cats) ? $params->get('show_rcat','1','int') : 0;

$show_tags = $params->get('show_tags','1','int');
$this->showtags = ($show_tags) ? $params->get('show_btags','1','int') : 0;
$this->showtags = ($show_tags) ? $params->get('show_rtags','1','int') : 0;

$this->search_bar = $params->get('search_bar','','int');
$this->hide_cat = (!$this->showcat || ($params->get('menu_category_id',0)>0)) ? true : false;
$this->hide_tag = (!$this->showtags || (!empty($params->get('menu_tag','')))) ? true : false;

$this->show_pic = $params->get('show_bpiccol','1','int');
$this->show_sum = $params->get('show_bsumcol','1','int');
$this->show_sum = $params->get('show_rsumcol','1','int');

// Check for errors.
if (count($errors = $this->get('Errors'))) {
Expand Down
99 changes: 39 additions & 60 deletions src/com_xbbooks/site/views/groups/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*******
* @package xbBooks
* @filesource site/views/groups/tmpl/default.php
* @version 1.0.3.5 19th January 2023
* @version 1.0.4.0 5th February 2023
* @author Roger C-O
* @copyright Copyright (c) Roger Creagh-Osborne, 2021
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -45,11 +45,11 @@
echo XbcultureHelper::sitePageheader($this->header);
} ?>

<form action="<?php echo Route::_('index.php?option=com_xbpeople&view=groups'); ?>" method="post" name="adminForm" id="adminForm">
<form action="<?php echo Route::_('index.php?option=com_xbbooks&view=groups'); ?>" method="post" name="adminForm" id="adminForm">
<?php // Search tools bar
if ($this->search_bar) {
$hide = '';
if ((!$this->showcat) || ($this->hide_cat)) { $hide .= 'filter_category_id, filter_subcats,';}
if ((!$this->showcat) || ($this->hide_cat)) { $hide .= 'filter_category_id,';}
if (!$this->showtags || $this->hide_tag) { $hide .= 'filter_tagfilt,filter_taglogic,';}
echo '<div class="row-fluid"><div class="span12">';
echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this,'hide'=>$hide));
Expand Down Expand Up @@ -101,22 +101,10 @@
<?php echo JText::_('XBCULTURE_SUMMARY');?>
</th>
<?php endif; ?>
<?php if ($this->showccnts) : ?>
<?php if($this->xbbooksStatus) : ?>
<th>
<?php echo HtmlHelper::_('searchtools.sort','Books','bcnt',$listDirn,$listOrder ); ?>
</th>
<?php endif; ?>
<?php if($this->xbeventsStatus) : ?>
<th>
<?php echo HtmlHelper::_('searchtools.sort','Events','ecnt',$listDirn,$listOrder ); ?>
</th>
<?php endif; ?>
<?php if($this->xbfilmsStatus) : ?>
<th>
<?php echo HtmlHelper::_('searchtools.sort','Films','fcnt',$listDirn,$listOrder ); ?>
</th>
<?php endif; ?>
<?php if ($this->showgcnts) : ?>
<th>
<?php echo HtmlHelper::_('searchtools.sort','Books','bcnt',$listDirn,$listOrder ); ?>
</th>
<?php endif; ?>
<?php if($this->showcat || $this->showtags) : ?>
<th class="hidden-tablet hidden-phone">
Expand Down Expand Up @@ -178,7 +166,7 @@
<?php echo $item->pcnt.' ';
echo $item->pcnt ==1 ? Text::_('XBCULTURE_MEMBER') : lcfirst(Text::_('XBCULTURE_MEMBERS')); ?>
</span></summary>
<?php echo $item->memberlist; ?>
<?php echo $item->memberlist['ullist']; ?>
</details>
<?php else : ?>
<p class="xbnit"><?php echo Text::_('None listed')?></p>
Expand Down Expand Up @@ -206,46 +194,37 @@
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($this->showccnts) : ?>
<?php if ($this->xbbooksStatus) : ?>
<td>
<?php if ($item->bcnt>0) :?>
<details>
<summary><span class="xbnit">
<?php echo $item->bcnt.' ';
echo $item->bcnt ==1 ? Text::_('XBCULTURE_BOOK') : Text::_('XBCULTURE_BOOKS'); ?>
</span></summary>
<?php echo $item->booklist; ?>
</details>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($this->xbeventsStatus) : ?>
<td>
<?php if ($item->ecnt>0) :?>
<details>
<summary><span class="xbnit">
<?php echo $item->ecnt.' ';
echo $item->ecnt ==1 ? lcfirst(Text::_('XBCULTURE_EVENT')) : lcfirst(Text::_('XBCULTURE_EVENTS')); ?>
</span></summary>
<?php echo $item->eventlist; ?>
</details>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($this->xbfilmsStatus) : ?>
<td>
<?php if ($item->fcnt>0) :?>
<details>
<summary><span class="xbnit">
<?php echo $item->fcnt.' ';
echo $item->fcnt ==1 ? Text::_('XBCULTURE_FILM') : Text::_('XBCULTURE_FILMS'); ?>
</span></summary>
<?php echo $item->filmlist; ?>
</details>
<?php endif; ?>
</td>
<?php endif; ?>
<?php if ($this->showgcnts) : ?>
<td>
<?php if ($item->bcnt>0) :?>
<details>
<summary><span class="xbnit">
<?php echo $item->bcnt.' ';
echo $item->bcnt ==1 ? Text::_('XBCULTURE_BOOK') : Text::_('XBCULTURE_BOOKS'); ?>
</span></summary>
<?php echo $item->booklist['ullist']; ?>
</details>
<?php endif; ?>
<p class="xbnit">
<?php if (($item->fcnt + $item->ecnt)>0) : ?>
<?php echo Text::_('also in').' ';
if ($item->fcnt>0) {
echo $item->fcnt.' ';
echo $item->fcnt ==1 ? Text::_('XBCULTURE_FILM') : Text::_('XBCULTURE_FILMS');
}
if (($item->fcnt>0) && ($item->ecnt)>0) {
echo ' and ';
}
if ($item->ecnt>0) {
echo $item->ecnt.' ';
echo $item->ecnt ==1 ? Text::_('XBCULTURE_EVENT') : Text::_('XBCULTURE_EVENTS');
} ?>
&nbsp;<a href="" data-toggle="modal" class="xbpv" data-target="#ajax-gpvmodal" onclick="window.pvid= <?php echo $item->id; ?>;">
<i class="far fa-eye"></i>
</a>
<?php endif; ?>
</p>
</td>
<?php endif; ?>
<?php if($this->show_ctcol) : ?>
<td class="hidden-phone">
Expand Down
2 changes: 1 addition & 1 deletion src/com_xbbooks/site/views/groups/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function display($tpl = null) {
$this->xbbooksStatus = Factory::getSession()->get('xbbooks_ok',false);
$this->xbeventsStatus = Factory::getSession()->get('xbevents_ok',false);

$this->showccnts = $this->params->get('showccnts',1);
$this->showgcnts = $this->params->get('showgcnts',1);

if (count($errors = $this->get('Errors'))) {
Factory::getApplication()->enqueueMessage(implode('<br />', $errors),'error');
Expand Down

0 comments on commit e80984f

Please sign in to comment.