From f9da54f9894ad3101fc937ac2af5d53c51793e05 Mon Sep 17 00:00:00 2001 From: rogercreagh <44980188+rogercreagh@users.noreply.github.com> Date: Fri, 27 Jan 2023 20:18:43 +0000 Subject: [PATCH] v1.0.3.8 site book view ok with pv --- .../admin/views/book/view.html.php | 6 +- src/com_xbbooks/site/models/book.php | 25 +- .../site/views/book/tmpl/default.php | 409 +++++++++++------- .../site/views/book/tmpl/modalcpv.php | 31 ++ .../site/views/book/tmpl/modalgpv.php | 31 ++ .../site/views/book/tmpl/modalppv.php | 31 ++ src/com_xbbooks/xbbooks.xml | 2 +- 7 files changed, 355 insertions(+), 180 deletions(-) create mode 100755 src/com_xbbooks/site/views/book/tmpl/modalcpv.php create mode 100755 src/com_xbbooks/site/views/book/tmpl/modalgpv.php create mode 100755 src/com_xbbooks/site/views/book/tmpl/modalppv.php diff --git a/src/com_xbbooks/admin/views/book/view.html.php b/src/com_xbbooks/admin/views/book/view.html.php index 65d6b12..0a4d92d 100644 --- a/src/com_xbbooks/admin/views/book/view.html.php +++ b/src/com_xbbooks/admin/views/book/view.html.php @@ -2,7 +2,7 @@ /******* * @package xbBooks * @filesource admin/views/book/view.html.php - * @version 1.0.2.2 6th January 2023 + * @version 1.0.3.8 27th January 2023 * @author Roger C-O * @copyright Copyright (c) Roger Creagh-Osborne, 2021 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html @@ -90,8 +90,6 @@ protected function addToolBar() ToolbarHelper::save('book.save'); ToolbarHelper::save2new('book.save2new'); ToolbarHelper::save2copy('book.save2copy'); - ToolbarHelper::custom('book.save2NewPer', 'user', '', 'XBCULTURE_BTN_SAVE2PER', false) ; - ToolbarHelper::custom('book.save2NewChar', 'user', '', 'XBCULTURE_BTN_SAVE2CHAR', false) ; ToolbarHelper::custom('book.save2NewRev', 'comment', '', 'XBCULTURE_BTN_SAVE2REV', false) ; if ($isNew) { ToolbarHelper::cancel('book.cancel','JTOOLBAR_CANCEL'); @@ -104,7 +102,7 @@ protected function addToolBar() if ($this->item->id > 0) { $dhtml = ' '.Text::_('Preview').''; + class="btn btn-small btn-primary"> '.Text::_('Preview').''; $bar->appendButton('Custom', $dhtml); } ToolbarHelper::help( '', false,'https://crosborne.uk/xbbooks/doc?tmpl=component#bookedit' ); diff --git a/src/com_xbbooks/site/models/book.php b/src/com_xbbooks/site/models/book.php index 9d6c383..0bafbbb 100644 --- a/src/com_xbbooks/site/models/book.php +++ b/src/com_xbbooks/site/models/book.php @@ -2,7 +2,7 @@ /******* * @package xbBooks * @filesource site/models/book.php - * @version 0.9.11.2 17th November 2022 + * @version 1.0.3.8 27th January 2023 * @author Roger C-O * @copyright Copyright (c) Roger Creagh-Osborne, 2021 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html @@ -38,6 +38,9 @@ public function getItem($id = null) { a.state AS published, a.catid AS catid, a.params AS params, a.metadata AS metadata, a.created AS created '); $query->from('#__xbbooks AS a'); $query->select('(SELECT AVG(br.rating) FROM #__xbbookreviews AS br WHERE br.book_id=a.id) AS averat'); + $query->select('(SELECT COUNT(DISTINCT(bp.person_id)) FROM #__xbbookperson AS bp WHERE bp.book_id = a.id) AS pcnt'); + $query->select('(SELECT COUNT(DISTINCT(bc.char_id)) FROM #__xbbookcharacter AS bc WHERE bc.book_id = a.id) AS ccnt'); + $query->select('(SELECT COUNT(DISTINCT(bg.group_id)) FROM #__xbbookgroup AS bg WHERE bg.book_id = a.id) AS gcnt'); $query->select('c.title AS category_title'); $query->leftJoin('#__categories AS c ON c.id = a.catid'); $query->where('a.id = '.$id); @@ -84,15 +87,21 @@ public function getItem($id = null) { $item->mencnt = count(array_keys($roles, 'mention')); $item->othcnt = count(array_keys($roles, 'other')); - $item->alist = $item->authcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'author','comma'); - $item->elist = $item->editcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'editor','comma'); - $item->mlist = $item->mencnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'mention','ul',true,1); - $item->olist =$item->othcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->people,'other','ul',true,1); + $item->alist = $item->authcnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'author','tn',5,'ppvmodal'); + $item->elist = $item->editcnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'editor','tn',5,'ppvmodal'); + $item->mlist = $item->mencnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'mention','tn',5,'ppvmodal'); + $item->olist =$item->othcnt==0 ? '' : XbcultureHelper::makeItemLists($item->people,'other','rtn',5,'ppvmodal'); - $item->chars = XbbooksGeneral::getBookChars($item->id); - $item->charcnt = empty($item->chars) ? 0 : count($item->chars); - $item->clist = $item->charcnt==0 ? '' : XbcultureHelper::makeLinkedNameList($item->chars,'char','ul',true,1); + if ($item->ccnt>0) { + $item->chars = XbbooksGeneral::getBookChars($item->id); + $item->clist = $item->ccnt==0 ? '' : XbcultureHelper::makeItemLists($item->chars,'char','tn',5,'cpvmodal'); + } + if ($item->gcnt>0) { + $item->groups = XbbooksGeneral::getBookGroups($item->id); + $item->grouplist = XbcultureHelper::makeItemLists($item->groups,'','rtn',5,'gpvgmodal'); + } + //order by review rating or date? $item->reviews = XbbooksGeneral::getBookReviews($item->id); $item->revcnt = count($item->reviews); diff --git a/src/com_xbbooks/site/views/book/tmpl/default.php b/src/com_xbbooks/site/views/book/tmpl/default.php index ea6ce3b..d2f94ca 100644 --- a/src/com_xbbooks/site/views/book/tmpl/default.php +++ b/src/com_xbbooks/site/views/book/tmpl/default.php @@ -2,7 +2,7 @@ /******* * @package xbBooks * @filesource site/views/book/tmpl/default.php - * @version 1.0.3.2 9th January 2023 + * @version 1.0.3.8 27th January 2023 * @author Roger C-O * @copyright Copyright (c) Roger Creagh-Osborne, 2021 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html @@ -33,16 +33,23 @@ } ?> +
+
no reviews available
pubyear>0) { + echo Text::_('XBBOOKS_FIRSTPUB').': '.$item->pubyear.''; + } ?>
show_fict) : ?>fiction==1) : ?> - ' + @@ -77,141 +90,165 @@ subtitle != '') : ?>
- authcnt>0) : ?> -
People mentioned & Characters
+ mencnt > 0) || (!$hide_empty)) : ?> +Other Production Roles
+ othcnt == 0) : ?> + + +Groups
+ gcnt == 0) : ?> + + ++ ext_links_list; ?> +
People mentioned & Characters
- mencnt > 0) || (!$hide_empty)) : ?> -Other Production Roles
- othcnt > 0) || (!$hide_empty)) : ?> - othcnt == 0) : ?> - - -- ext_links_list; ?> -