Move all filters in the views to have the filters above the admin list view. (JCB improvement gh-378)

Add the new donation information to README.
Update the Repo URLs to point to Llewellyn's repo instead.
Improve the date methods in the Helper class. (JCB improvement)
Add a fix to the import export methods. (JCB improvement)
This commit is contained in:
Llewellyn van der Merwe 2020-11-30 18:57:29 +02:00
parent 5d3cb3dde8
commit e726e758b4
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
347 changed files with 4536 additions and 3034 deletions

View File

@ -1,6 +1,6 @@
# Sermon Distributor (2.0.x) # Sermon Distributor (2.0.x)
![Sermon Distributor image](https://raw.githubusercontent.com/SermonDistributor/Joomla-3-Component/master/admin/assets/images/vdm-component.jpg "The Sermon Distributor") ![Sermon Distributor image](https://raw.githubusercontent.com/Llewellynvdm/Joomla-Sermon-Distributor/master/admin/assets/images/vdm-component.jpg "The Sermon Distributor")
Distributor is a highly advanced sermon distributor that runs on the [Joomla 3.x](http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox. Distributor is a highly advanced sermon distributor that runs on the [Joomla 3.x](http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox.
@ -23,45 +23,74 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/) + *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015 + *First Build*: 22nd October, 2015
+ *Last Build*: 30th May, 2020 + *Last Build*: 30th November, 2020
+ *Version*: 2.0.x + *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time :hourglass: ## Build Time :hourglass:
**193 Hours** or **24 Eight Hour Days** (actual time the author saved - **203 Hours** or **25 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder)) due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.) > never making one mistake or taking any coffee break.)
+ *Line count*: **69273** + *Line count*: **72694**
+ *File count*: **443** + *File count*: **459**
+ *Folder count*: **93** + *Folder count*: **93**
**128 Hours** or **16 Eight Hour Days** (the actual time the author spent) **133 Hours** or **17 Eight Hour Days** (the actual time the author spent)
> (with the following break down: > (with the following break down:
> **debugging @48hours** = codingtime / 4; > **debugging @51hours** = codingtime / 4;
> **planning @28hours** = codingtime / 7; > **planning @29hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10; > **mapping @20hours** = codingtime / 10;
> **office @32hours** = codingtime / 6;) > **office @34hours** = codingtime / 6;)
**321 Hours** or **40 Eight Hour Days** **336 Hours** or **42 Eight Hour Days**
(a total of the realistic time frame for this project) (a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **8 weeks** or **1.7 months** Project duration: **8.4 weeks** or **1.8 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder). > This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
## Donations
Come on buy me a coffee :) ## Contributors
* PayPal: [paypal.me/payvdm](https://www.paypal.me/payvdm) This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder).
* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218 [![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors)
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)]
[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)]
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website)

View File

@ -1,6 +1,6 @@
# Sermon Distributor (2.0.x) # Sermon Distributor (2.0.x)
![Sermon Distributor image](https://raw.githubusercontent.com/SermonDistributor/Joomla-3-Component/master/admin/assets/images/vdm-component.jpg "The Sermon Distributor") ![Sermon Distributor image](https://raw.githubusercontent.com/Llewellynvdm/Joomla-Sermon-Distributor/master/admin/assets/images/vdm-component.jpg "The Sermon Distributor")
Distributor is a highly advanced sermon distributor that runs on the [Joomla 3.x](http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox. Distributor is a highly advanced sermon distributor that runs on the [Joomla 3.x](http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox.
@ -23,45 +23,74 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Sermon Distributor](https://www.vdm.io/) + *Name*: [Sermon Distributor](https://www.vdm.io/)
+ *First Build*: 22nd October, 2015 + *First Build*: 22nd October, 2015
+ *Last Build*: 30th May, 2020 + *Last Build*: 30th November, 2020
+ *Version*: 2.0.x + *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved + *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time :hourglass: ## Build Time :hourglass:
**193 Hours** or **24 Eight Hour Days** (actual time the author saved - **203 Hours** or **25 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder)) due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.) > never making one mistake or taking any coffee break.)
+ *Line count*: **69273** + *Line count*: **72694**
+ *File count*: **443** + *File count*: **459**
+ *Folder count*: **93** + *Folder count*: **93**
**128 Hours** or **16 Eight Hour Days** (the actual time the author spent) **133 Hours** or **17 Eight Hour Days** (the actual time the author spent)
> (with the following break down: > (with the following break down:
> **debugging @48hours** = codingtime / 4; > **debugging @51hours** = codingtime / 4;
> **planning @28hours** = codingtime / 7; > **planning @29hours** = codingtime / 7;
> **mapping @19hours** = codingtime / 10; > **mapping @20hours** = codingtime / 10;
> **office @32hours** = codingtime / 6;) > **office @34hours** = codingtime / 6;)
**321 Hours** or **40 Eight Hour Days** **336 Hours** or **42 Eight Hour Days**
(a total of the realistic time frame for this project) (a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **8 weeks** or **1.7 months** Project duration: **8.4 weeks** or **1.8 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder). > This **component** was build with a Joomla [Automated Component Builder](https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
## Donations
Come on buy me a coffee :) ## Contributors
* PayPal: [paypal.me/payvdm](https://www.paypal.me/payvdm) This project exists thanks to all the people who contribute to the [Joomla Component Builder Project](https://github.com/vdm-io/Joomla-Component-Builder).
* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218 [![Contributors](https://opencollective.com/Joomla-Component-Builder/contributors.svg?width=890&button=false)](https://github.com/vdm-io/Joomla-Component-Builder/graphs/contributors)
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/Joomla-Component-Builder#backer)]
[![Our Backers on opencollective](https://opencollective.com/Joomla-Component-Builder/backers.svg?width=890)](https://opencollective.com/Joomla-Component-Builder#backers)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/Joomla-Component-Builder#sponsor)]
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/0/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/0/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/1/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/1/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/2/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/2/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/3/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/3/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/4/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/4/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/5/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/5/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/6/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/6/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/7/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/7/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/8/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/8/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/9/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/9/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/10/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/10/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/11/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/11/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/12/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/12/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/13/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/13/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/14/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/14/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/15/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/15/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/16/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/16/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/17/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/17/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/18/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/18/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/19/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/19/website)
[![Sponsor](https://opencollective.com/Joomla-Component-Builder/sponsor/20/avatar.svg)](https://opencollective.com/Joomla-Component-Builder/sponsor/20/website)

View File

@ -26,6 +26,7 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Language; use Joomla\CMS\Language\Language;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper; use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
@ -2021,9 +2022,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice fancy date * Change to nice fancy date
*/ */
public static function fancyDate($date) public static function fancyDate($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2033,9 +2034,9 @@ abstract class SermondistributorHelper
/** /**
* get date based in period past * get date based in period past
*/ */
public static function fancyDynamicDate($date) public static function fancyDynamicDate($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2059,9 +2060,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice fancy day time and date * Change to nice fancy day time and date
*/ */
public static function fancyDayTimeDate($time) public static function fancyDayTimeDate($time, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($time)) if ($check_stamp && !self::isValidTimeStamp($time))
{ {
$time = strtotime($time); $time = strtotime($time);
} }
@ -2071,9 +2072,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice fancy time and date * Change to nice fancy time and date
*/ */
public static function fancyDateTime($time) public static function fancyDateTime($time, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($time)) if ($check_stamp && !self::isValidTimeStamp($time))
{ {
$time = strtotime($time); $time = strtotime($time);
} }
@ -2083,9 +2084,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice hour:minutes time * Change to nice hour:minutes time
*/ */
public static function fancyTime($time) public static function fancyTime($time, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($time)) if ($check_stamp && !self::isValidTimeStamp($time))
{ {
$time = strtotime($time); $time = strtotime($time);
} }
@ -2095,9 +2096,9 @@ abstract class SermondistributorHelper
/** /**
* set the date day as Sunday through Saturday * set the date day as Sunday through Saturday
*/ */
public static function setDayName($date) public static function setDayName($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2107,9 +2108,9 @@ abstract class SermondistributorHelper
/** /**
* set the date month as January through December * set the date month as January through December
*/ */
public static function setMonthName($date) public static function setMonthName($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2119,9 +2120,9 @@ abstract class SermondistributorHelper
/** /**
* set the date day as 1st * set the date day as 1st
*/ */
public static function setDay($date) public static function setDay($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2131,9 +2132,9 @@ abstract class SermondistributorHelper
/** /**
* set the date month as 5 * set the date month as 5
*/ */
public static function setMonth($date) public static function setMonth($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2143,9 +2144,9 @@ abstract class SermondistributorHelper
/** /**
* set the date year as 2004 (for charts) * set the date year as 2004 (for charts)
*/ */
public static function setYear($date) public static function setYear($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2155,9 +2156,9 @@ abstract class SermondistributorHelper
/** /**
* set the date as 2004/05 (for charts) * set the date as 2004/05 (for charts)
*/ */
public static function setYearMonth($date, $spacer = '/') public static function setYearMonth($date, $spacer = '/', $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2167,15 +2168,27 @@ abstract class SermondistributorHelper
/** /**
* set the date as 2004/05/03 (for charts) * set the date as 2004/05/03 (for charts)
*/ */
public static function setYearMonthDay($date, $spacer = '/') public static function setYearMonthDay($date, $spacer = '/', $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
return date('Y' . $spacer . 'm' . $spacer . 'd', $date); return date('Y' . $spacer . 'm' . $spacer . 'd', $date);
} }
/**
* set the date as 03/05/2004
*/
public static function setDayMonthYear($date, $spacer = '/', $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('d' . $spacer . 'm' . $spacer . 'Y', $date);
}
/** /**
* Check if string is a valid time stamp * Check if string is a valid time stamp
*/ */
@ -2186,6 +2199,16 @@ abstract class SermondistributorHelper
&& ($timestamp >= ~PHP_INT_MAX); && ($timestamp >= ~PHP_INT_MAX);
} }
/**
* Check if string is a valid date
* https://www.php.net/manual/en/function.checkdate.php#113205
*/
public static function isValidateDate($date, $format = 'Y-m-d H:i:s')
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
/** /**
* Workers to load tasks * Workers to load tasks
@ -3162,6 +3185,8 @@ abstract class SermondistributorHelper
->setLastModifiedBy($modified) ->setLastModifiedBy($modified)
->setTitle($title) ->setTitle($title)
->setSubject($subjectTab); ->setSubject($subjectTab);
// The file type
$file_type = 'Xls';
// set description // set description
if ($description) if ($description)
{ {
@ -3201,21 +3226,46 @@ abstract class SermondistributorHelper
)); ));
// Add some data // Add some data
if (self::checkArray($rows)) if (($size = self::checkArray($rows)) !== false)
{ {
$i = 1; $i = 1;
foreach ($rows as $array){
// Based on data size we adapt the behaviour.
$xls_mode = 1;
if ($size > 3000)
{
$xls_mode = 3;
$file_type = 'Csv';
}
elseif ($size > 2000)
{
$xls_mode = 2;
}
// Set active sheet and get it.
$active_sheet = $spreadsheet->setActiveSheetIndex(0);
foreach ($rows as $array)
{
$a = 'A'; $a = 'A';
foreach ($array as $value){ foreach ($array as $value)
$spreadsheet->setActiveSheetIndex(0)->setCellValue($a.$i, $value); {
if ($i == 1){ $active_sheet->setCellValue($a.$i, $value);
$spreadsheet->getActiveSheet()->getColumnDimension($a)->setAutoSize(true); if ($xls_mode != 3)
$spreadsheet->getActiveSheet()->getStyle($a.$i)->applyFromArray($headerStyles); {
$spreadsheet->getActiveSheet()->getStyle($a.$i)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER); if ($i == 1)
} elseif ($a === 'A'){ {
$spreadsheet->getActiveSheet()->getStyle($a.$i)->applyFromArray($sideStyles); $active_sheet->getColumnDimension($a)->setAutoSize(true);
} else { $active_sheet->getStyle($a.$i)->applyFromArray($headerStyles);
$spreadsheet->getActiveSheet()->getStyle($a.$i)->applyFromArray($normalStyles); $active_sheet->getStyle($a.$i)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER);
}
elseif ($a === 'A')
{
$active_sheet->getStyle($a.$i)->applyFromArray($sideStyles);
}
elseif ($xls_mode == 1)
{
$active_sheet->getStyle($a.$i)->applyFromArray($normalStyles);
}
} }
$a++; $a++;
} }
@ -3235,7 +3285,7 @@ abstract class SermondistributorHelper
// Redirect output to a client's web browser (Excel5) // Redirect output to a client's web browser (Excel5)
header('Content-Type: application/vnd.ms-excel'); header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$fileName.'.xls"'); header('Content-Disposition: attachment;filename="' . $fileName . '.' . strtolower($file_type) .'"');
header('Cache-Control: max-age=0'); header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed // If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1'); header('Cache-Control: max-age=1');
@ -3246,7 +3296,7 @@ abstract class SermondistributorHelper
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header ('Pragma: public'); // HTTP/1.0 header ('Pragma: public'); // HTTP/1.0
$writer = IOFactory::createWriter($spreadsheet, 'Xls'); $writer = IOFactory::createWriter($spreadsheet, $file_type);
$writer->save('php://output'); $writer->save('php://output');
jexit(); jexit();
} }

View File

@ -398,6 +398,8 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_CHECKED_IN_1="%d External Source
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_CHECKED_IN_MORE="%d External Sources successfully checked in." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_CHECKED_IN_MORE="%d External Sources successfully checked in."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_DELETED="%s External Sources deleted." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_DELETED="%s External Sources deleted."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_DELETED_1="%s External Source deleted." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_DELETED_1="%s External Source deleted."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FAILED_PUBLISHING="%s External Sources failed publishing."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FAILED_PUBLISHING_1="%s External Source failed publishing."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FEATURED="%s External Sources featured." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FEATURED="%s External Sources featured."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FEATURED_1="%s External Source featured." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_FEATURED_1="%s External Source featured."
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_PUBLISHED="%s External Sources published." COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_N_ITEMS_PUBLISHED="%s External Sources published."
@ -657,6 +659,80 @@ COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_WMV=".wmv"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLS=".xls" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLS=".xls"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLSX=".xlsx" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_XLSX=".xlsx"
COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ZIP=".zip" COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ZIP=".zip"
COM_SERMONDISTRIBUTOR_FILTER_ADMIN_VIEW_ASCENDING="Admin View ascending"
COM_SERMONDISTRIBUTOR_FILTER_ADMIN_VIEW_DESCENDING="Admin View descending"
COM_SERMONDISTRIBUTOR_FILTER_BUILD_ASCENDING="Build ascending"
COM_SERMONDISTRIBUTOR_FILTER_BUILD_DESCENDING="Build descending"
COM_SERMONDISTRIBUTOR_FILTER_COUNTER_ASCENDING="Counter ascending"
COM_SERMONDISTRIBUTOR_FILTER_COUNTER_DESCENDING="Counter descending"
COM_SERMONDISTRIBUTOR_FILTER_DESCRIPTION_ASCENDING="Description ascending"
COM_SERMONDISTRIBUTOR_FILTER_DESCRIPTION_DESCENDING="Description descending"
COM_SERMONDISTRIBUTOR_FILTER_EXTERNALSOURCES_ASCENDING="Externalsources ascending"
COM_SERMONDISTRIBUTOR_FILTER_EXTERNALSOURCES_DESCENDING="Externalsources descending"
COM_SERMONDISTRIBUTOR_FILTER_EXTERNAL_SOURCE_ASCENDING="External Source ascending"
COM_SERMONDISTRIBUTOR_FILTER_EXTERNAL_SOURCE_DESCENDING="External Source descending"
COM_SERMONDISTRIBUTOR_FILTER_FILENAME_ASCENDING="Filename ascending"
COM_SERMONDISTRIBUTOR_FILTER_FILENAME_DESCENDING="Filename descending"
COM_SERMONDISTRIBUTOR_FILTER_KEY_ASCENDING="Key ascending"
COM_SERMONDISTRIBUTOR_FILTER_KEY_DESCENDING="Key descending"
COM_SERMONDISTRIBUTOR_FILTER_LINK_TYPE_ASCENDING="Link Type ascending"
COM_SERMONDISTRIBUTOR_FILTER_LINK_TYPE_DESCENDING="Link Type descending"
COM_SERMONDISTRIBUTOR_FILTER_LOCATION_ASCENDING="Location ascending"
COM_SERMONDISTRIBUTOR_FILTER_LOCATION_DESCENDING="Location descending"
COM_SERMONDISTRIBUTOR_FILTER_NAME_ASCENDING="Name ascending"
COM_SERMONDISTRIBUTOR_FILTER_NAME_DESCENDING="Name descending"
COM_SERMONDISTRIBUTOR_FILTER_PREACHER_ASCENDING="Preacher ascending"
COM_SERMONDISTRIBUTOR_FILTER_PREACHER_DESCENDING="Preacher descending"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED="Status"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_EXTERNAL_SOURCES="Status options for external sources"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_HELP_DOCUMENTS="Status options for help documents"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_LOCAL_LISTINGS="Status options for local listings"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_PREACHERS="Status options for preachers"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_SERIES_LIST="Status options for series list"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_SERMONS="Status options for sermons"
COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_STATISTICS="Status options for statistics"
COM_SERMONDISTRIBUTOR_FILTER_SEARCH="Searchpreachers"
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_EXTERNAL_SOURCES="Search the external source items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_HELP_DOCUMENTS="Search the help document items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_LOCAL_LISTINGS="Search the local listing items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_PREACHERS="Search the preacher items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_SERIES_LIST="Search the series items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_SERMONS="Search the sermon items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SEARCH_STATISTICS="Search the statistic items. Prefix with ID: to search for an item by ID."
COM_SERMONDISTRIBUTOR_FILTER_SELECT_ADMIN_VIEW="Select Admin View"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD="Select Build"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_EXTERNALSOURCES="Select Externalsources"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_EXTERNAL_SOURCE="Select External Source"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_LINK_TYPE="Select Link Type"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_LOCATION="Select Location"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_PREACHER="Select Preacher"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERIES="Select Series"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERMON="Select Sermon"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERMONS_CATEGORIES="Select Sermons Categories"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_SITE_VIEW="Select Site View"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_SOURCE="Select Source"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_TYPE="Select Type"
COM_SERMONDISTRIBUTOR_FILTER_SELECT_UPDATE_METHOD="Select Update Method"
COM_SERMONDISTRIBUTOR_FILTER_SERIES_ASCENDING="Series ascending"
COM_SERMONDISTRIBUTOR_FILTER_SERIES_DESCENDING="Series descending"
COM_SERMONDISTRIBUTOR_FILTER_SERMONS_CATEGORIES_ASCENDING="Sermons Categories ascending"
COM_SERMONDISTRIBUTOR_FILTER_SERMONS_CATEGORIES_DESCENDING="Sermons Categories descending"
COM_SERMONDISTRIBUTOR_FILTER_SERMON_ASCENDING="Sermon ascending"
COM_SERMONDISTRIBUTOR_FILTER_SERMON_DESCENDING="Sermon descending"
COM_SERMONDISTRIBUTOR_FILTER_SHORT_DESCRIPTION_ASCENDING="Short Description ascending"
COM_SERMONDISTRIBUTOR_FILTER_SHORT_DESCRIPTION_DESCENDING="Short Description descending"
COM_SERMONDISTRIBUTOR_FILTER_SITE_VIEW_ASCENDING="Site View ascending"
COM_SERMONDISTRIBUTOR_FILTER_SITE_VIEW_DESCENDING="Site View descending"
COM_SERMONDISTRIBUTOR_FILTER_SIZE_ASCENDING="Size ascending"
COM_SERMONDISTRIBUTOR_FILTER_SIZE_DESCENDING="Size descending"
COM_SERMONDISTRIBUTOR_FILTER_SOURCE_ASCENDING="Source ascending"
COM_SERMONDISTRIBUTOR_FILTER_SOURCE_DESCENDING="Source descending"
COM_SERMONDISTRIBUTOR_FILTER_TITLE_ASCENDING="Title ascending"
COM_SERMONDISTRIBUTOR_FILTER_TITLE_DESCENDING="Title descending"
COM_SERMONDISTRIBUTOR_FILTER_TYPE_ASCENDING="Type ascending"
COM_SERMONDISTRIBUTOR_FILTER_TYPE_DESCENDING="Type descending"
COM_SERMONDISTRIBUTOR_FILTER_UPDATE_METHOD_ASCENDING="Update Method ascending"
COM_SERMONDISTRIBUTOR_FILTER_UPDATE_METHOD_DESCENDING="Update Method descending"
COM_SERMONDISTRIBUTOR_HELP_DOCUMENT="Help Document" COM_SERMONDISTRIBUTOR_HELP_DOCUMENT="Help Document"
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS="Help Documents" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS="Help Documents"
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS="Help Documents Access" COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_ACCESS="Help Documents Access"
@ -690,6 +766,8 @@ COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_1="%d Help Document succ
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_MORE="%d Help Documents successfully checked in." COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_MORE="%d Help Documents successfully checked in."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_DELETED="%s Help Documents deleted." COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_DELETED="%s Help Documents deleted."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_DELETED_1="%s Help Document deleted." COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_DELETED_1="%s Help Document deleted."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_FAILED_PUBLISHING="%s Help Documents failed publishing."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_FAILED_PUBLISHING_1="%s Help Document failed publishing."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_FEATURED="%s Help Documents featured." COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_FEATURED="%s Help Documents featured."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_FEATURED_1="%s Help Document featured." COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_FEATURED_1="%s Help Document featured."
COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_PUBLISHED="%s Help Documents published." COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_N_ITEMS_PUBLISHED="%s Help Documents published."
@ -868,6 +946,8 @@ COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_CHECKED_IN_1="%d Local Listing succ
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_CHECKED_IN_MORE="%d Local Listings successfully checked in." COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_CHECKED_IN_MORE="%d Local Listings successfully checked in."
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_DELETED="%s Local Listings deleted." COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_DELETED="%s Local Listings deleted."
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_DELETED_1="%s Local Listing deleted." COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_DELETED_1="%s Local Listing deleted."
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FAILED_PUBLISHING="%s Local Listings failed publishing."
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FAILED_PUBLISHING_1="%s Local Listing failed publishing."
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FEATURED="%s Local Listings featured." COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FEATURED="%s Local Listings featured."
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FEATURED_1="%s Local Listing featured." COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_FEATURED_1="%s Local Listing featured."
COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_PUBLISHED="%s Local Listings published." COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_N_ITEMS_PUBLISHED="%s Local Listings published."
@ -1001,6 +1081,8 @@ COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_CHECKED_IN_1="%d Preacher successfully c
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_CHECKED_IN_MORE="%d Preachers successfully checked in." COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_CHECKED_IN_MORE="%d Preachers successfully checked in."
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_DELETED="%s Preachers deleted." COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_DELETED="%s Preachers deleted."
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_DELETED_1="%s Preacher deleted." COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_DELETED_1="%s Preacher deleted."
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_FAILED_PUBLISHING="%s Preachers failed publishing."
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_FAILED_PUBLISHING_1="%s Preacher failed publishing."
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_FEATURED="%s Preachers featured." COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_FEATURED="%s Preachers featured."
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_FEATURED_1="%s Preacher featured." COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_FEATURED_1="%s Preacher featured."
COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_PUBLISHED="%s Preachers published." COM_SERMONDISTRIBUTOR_PREACHERS_N_ITEMS_PUBLISHED="%s Preachers published."
@ -1069,6 +1151,8 @@ COM_SERMONDISTRIBUTOR_RESPOND_TO_THIS_ISSUE_ON_GITHUB="Respond to this issue on
COM_SERMONDISTRIBUTOR_REVIEW_THIS_ISSUE_ON_GITHUB="Review this issue on Github" COM_SERMONDISTRIBUTOR_REVIEW_THIS_ISSUE_ON_GITHUB="Review this issue on Github"
COM_SERMONDISTRIBUTOR_SAVE_SUCCESS="Great! Item successfully saved." COM_SERMONDISTRIBUTOR_SAVE_SUCCESS="Great! Item successfully saved."
COM_SERMONDISTRIBUTOR_SAVE_WARNING="The value already existed so please select another." COM_SERMONDISTRIBUTOR_SAVE_WARNING="The value already existed so please select another."
COM_SERMONDISTRIBUTOR_SELECT_A_PREACHER="Select a preacher"
COM_SERMONDISTRIBUTOR_SELECT_A_SERIES="Select a series"
COM_SERMONDISTRIBUTOR_SERIES="Series" COM_SERMONDISTRIBUTOR_SERIES="Series"
COM_SERMONDISTRIBUTOR_SERIES_ACCESS_SITE="Series (Site) Access" COM_SERMONDISTRIBUTOR_SERIES_ACCESS_SITE="Series (Site) Access"
COM_SERMONDISTRIBUTOR_SERIES_ACCESS_SITE_DESC="Allows the users in this group to access site series." COM_SERMONDISTRIBUTOR_SERIES_ACCESS_SITE_DESC="Allows the users in this group to access site series."
@ -1128,6 +1212,8 @@ COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_CHECKED_IN_1="%d Series successfully c
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_CHECKED_IN_MORE="%d Series List successfully checked in." COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_CHECKED_IN_MORE="%d Series List successfully checked in."
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_DELETED="%s Series List deleted." COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_DELETED="%s Series List deleted."
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_DELETED_1="%s Series deleted." COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_DELETED_1="%s Series deleted."
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_FAILED_PUBLISHING="%s Series List failed publishing."
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_FAILED_PUBLISHING_1="%s Series failed publishing."
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_FEATURED="%s Series List featured." COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_FEATURED="%s Series List featured."
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_FEATURED_1="%s Series featured." COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_FEATURED_1="%s Series featured."
COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_PUBLISHED="%s Series List published." COM_SERMONDISTRIBUTOR_SERIES_LIST_N_ITEMS_PUBLISHED="%s Series List published."
@ -1202,6 +1288,8 @@ COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_CHECKED_IN_1="%d Sermon successfully check
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_CHECKED_IN_MORE="%d Sermons successfully checked in." COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_CHECKED_IN_MORE="%d Sermons successfully checked in."
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_DELETED="%s Sermons deleted." COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_DELETED="%s Sermons deleted."
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_DELETED_1="%s Sermon deleted." COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_DELETED_1="%s Sermon deleted."
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_FAILED_PUBLISHING="%s Sermons failed publishing."
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_FAILED_PUBLISHING_1="%s Sermon failed publishing."
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_FEATURED="%s Sermons featured." COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_FEATURED="%s Sermons featured."
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_FEATURED_1="%s Sermon featured." COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_FEATURED_1="%s Sermon featured."
COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_PUBLISHED="%s Sermons published." COM_SERMONDISTRIBUTOR_SERMONS_N_ITEMS_PUBLISHED="%s Sermons published."
@ -1426,6 +1514,8 @@ COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_CHECKED_IN_1="%d Statistic successfully
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_CHECKED_IN_MORE="%d Statistics successfully checked in." COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_CHECKED_IN_MORE="%d Statistics successfully checked in."
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_DELETED="%s Statistics deleted." COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_DELETED="%s Statistics deleted."
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_DELETED_1="%s Statistic deleted." COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_DELETED_1="%s Statistic deleted."
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_FAILED_PUBLISHING="%s Statistics failed publishing."
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_FAILED_PUBLISHING_1="%s Statistic failed publishing."
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_FEATURED="%s Statistics featured." COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_FEATURED="%s Statistics featured."
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_FEATURED_1="%s Statistic featured." COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_FEATURED_1="%s Statistic featured."
COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_PUBLISHED="%s Statistics published." COM_SERMONDISTRIBUTOR_STATISTICS_N_ITEMS_PUBLISHED="%s Statistics published."

View File

@ -141,25 +141,25 @@ $can = SermondistributorHelper::getActions('sermon');
<td> <td>
<?php echo JText::_($item->source); ?> <?php echo JText::_($item->source); ?>
</td> </td>
<?php if ($item->published == 1):?> <?php if ($item->published == 1): ?>
<td class="center" data-value="1"> <td class="center" data-value="1">
<span class="status-metro status-published" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>"> <span class="status-metro status-published" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == 0):?> <?php elseif ($item->published == 0): ?>
<td class="center" data-value="2"> <td class="center" data-value="2">
<span class="status-metro status-inactive" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>"> <span class="status-metro status-inactive" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == 2):?> <?php elseif ($item->published == 2): ?>
<td class="center" data-value="3"> <td class="center" data-value="3">
<span class="status-metro status-archived" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>"> <span class="status-metro status-archived" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == -2):?> <?php elseif ($item->published == -2): ?>
<td class="center" data-value="4"> <td class="center" data-value="4">
<span class="status-metro status-trashed" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>"> <span class="status-metro status-trashed" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>

View File

@ -136,25 +136,25 @@ $can = SermondistributorHelper::getActions('sermon');
<td> <td>
<?php echo JText::_($item->source); ?> <?php echo JText::_($item->source); ?>
</td> </td>
<?php if ($item->published == 1):?> <?php if ($item->published == 1): ?>
<td class="center" data-value="1"> <td class="center" data-value="1">
<span class="status-metro status-published" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>"> <span class="status-metro status-published" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == 0):?> <?php elseif ($item->published == 0): ?>
<td class="center" data-value="2"> <td class="center" data-value="2">
<span class="status-metro status-inactive" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>"> <span class="status-metro status-inactive" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == 2):?> <?php elseif ($item->published == 2): ?>
<td class="center" data-value="3"> <td class="center" data-value="3">
<span class="status-metro status-archived" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>"> <span class="status-metro status-archived" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == -2):?> <?php elseif ($item->published == -2): ?>
<td class="center" data-value="4"> <td class="center" data-value="4">
<span class="status-metro status-trashed" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>"> <span class="status-metro status-trashed" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>

View File

@ -117,25 +117,25 @@ else
<td> <td>
<?php echo $displayData->escape($item->counter); ?> <?php echo $displayData->escape($item->counter); ?>
</td> </td>
<?php if ($item->published == 1):?> <?php if ($item->published == 1): ?>
<td class="center" data-value="1"> <td class="center" data-value="1">
<span class="status-metro status-published" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>"> <span class="status-metro status-published" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_PUBLISHED'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == 0):?> <?php elseif ($item->published == 0): ?>
<td class="center" data-value="2"> <td class="center" data-value="2">
<span class="status-metro status-inactive" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>"> <span class="status-metro status-inactive" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_INACTIVE'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == 2):?> <?php elseif ($item->published == 2): ?>
<td class="center" data-value="3"> <td class="center" data-value="3">
<span class="status-metro status-archived" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>"> <span class="status-metro status-archived" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_ARCHIVED'); ?>
</span> </span>
</td> </td>
<?php elseif ($item->published == -2):?> <?php elseif ($item->published == -2): ?>
<td class="center" data-value="4"> <td class="center" data-value="4">
<span class="status-metro status-trashed" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>"> <span class="status-metro status-trashed" title="<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>">
<?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_TRASHED'); ?>

View File

@ -524,7 +524,7 @@ class SermondistributorModelExternal_source extends JModelAdmin
public function validate($form, $data, $group = null) public function validate($form, $data, $group = null)
{ {
// check if the not_required field is set // check if the not_required field is set
if (SermondistributorHelper::checkString($data['not_required'])) if (isset($data['not_required']) && SermondistributorHelper::checkString($data['not_required']))
{ {
$requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields); $requiredFields = array_unique($requiredFields);

View File

@ -42,10 +42,10 @@ class SermondistributorModelExternal_sources extends JModelList
'a.ordering','ordering', 'a.ordering','ordering',
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'a.description','description',
'a.externalsources','externalsources', 'a.externalsources','externalsources',
'a.update_method','update_method', 'a.update_method','update_method',
'a.build','build' 'a.build','build',
'a.description','description'
); );
} }
@ -55,7 +55,13 @@ class SermondistributorModelExternal_sources extends JModelList
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void * @return void
*
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
@ -66,27 +72,10 @@ class SermondistributorModelExternal_sources extends JModelList
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
$this->setState('filter.description', $description);
$externalsources = $this->getUserStateFromRequest($this->context . '.filter.externalsources', 'filter_externalsources');
$this->setState('filter.externalsources', $externalsources);
$update_method = $this->getUserStateFromRequest($this->context . '.filter.update_method', 'filter_update_method');
$this->setState('filter.update_method', $update_method);
$build = $this->getUserStateFromRequest($this->context . '.filter.build', 'filter_build');
$this->setState('filter.build', $build);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access); $this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published); $this->setState('filter.published', $published);
@ -96,6 +85,43 @@ class SermondistributorModelExternal_sources extends JModelList
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created); $this->setState('filter.created', $created);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$externalsources = $this->getUserStateFromRequest($this->context . '.filter.externalsources', 'filter_externalsources');
if ($formSubmited)
{
$externalsources = $app->input->post->get('externalsources');
$this->setState('filter.externalsources', $externalsources);
}
$update_method = $this->getUserStateFromRequest($this->context . '.filter.update_method', 'filter_update_method');
if ($formSubmited)
{
$update_method = $app->input->post->get('update_method');
$this->setState('filter.update_method', $update_method);
}
$build = $this->getUserStateFromRequest($this->context . '.filter.build', 'filter_build');
if ($formSubmited)
{
$build = $app->input->post->get('build');
$this->setState('filter.build', $build);
}
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
if ($formSubmited)
{
$description = $app->input->post->get('description');
$this->setState('filter.description', $description);
}
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
@ -300,24 +326,60 @@ class SermondistributorModelExternal_sources extends JModelList
} }
// Filter by Externalsources. // Filter by Externalsources.
if ($externalsources = $this->getState('filter.externalsources')) $_externalsources = $this->getState('filter.externalsources');
if (is_numeric($_externalsources))
{ {
$query->where('a.externalsources = ' . $db->quote($db->escape($externalsources))); if (is_float($_externalsources))
{
$query->where('a.externalsources = ' . (float) $_externalsources);
}
else
{
$query->where('a.externalsources = ' . (int) $_externalsources);
}
}
elseif (SermondistributorHelper::checkString($_externalsources))
{
$query->where('a.externalsources = ' . $db->quote($db->escape($_externalsources)));
} }
// Filter by Update_method. // Filter by Update_method.
if ($update_method = $this->getState('filter.update_method')) $_update_method = $this->getState('filter.update_method');
if (is_numeric($_update_method))
{ {
$query->where('a.update_method = ' . $db->quote($db->escape($update_method))); if (is_float($_update_method))
{
$query->where('a.update_method = ' . (float) $_update_method);
}
else
{
$query->where('a.update_method = ' . (int) $_update_method);
}
}
elseif (SermondistributorHelper::checkString($_update_method))
{
$query->where('a.update_method = ' . $db->quote($db->escape($_update_method)));
} }
// Filter by Build. // Filter by Build.
if ($build = $this->getState('filter.build')) $_build = $this->getState('filter.build');
if (is_numeric($_build))
{ {
$query->where('a.build = ' . $db->quote($db->escape($build))); if (is_float($_build))
{
$query->where('a.build = ' . (float) $_build);
}
else
{
$query->where('a.build = ' . (int) $_build);
}
}
elseif (SermondistributorHelper::checkString($_build))
{
$query->where('a.build = ' . $db->quote($db->escape($_build)));
} }
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -337,7 +399,7 @@ class SermondistributorModelExternal_sources extends JModelList
public function getExportData($pks, $user = null) public function getExportData($pks, $user = null)
{ {
// setup the query // setup the query
if (SermondistributorHelper::checkArray($pks)) if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{ {
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true; $_export = true;
@ -355,7 +417,24 @@ class SermondistributorModelExternal_sources extends JModelList
// From the sermondistributor_external_source table // From the sermondistributor_external_source table
$query->from($db->quoteName('#__sermondistributor_external_source', 'a')); $query->from($db->quoteName('#__sermondistributor_external_source', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')'); // The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
@ -450,10 +529,10 @@ class SermondistributorModelExternal_sources extends JModelList
$id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.description');
$id .= ':' . $this->getState('filter.externalsources'); $id .= ':' . $this->getState('filter.externalsources');
$id .= ':' . $this->getState('filter.update_method'); $id .= ':' . $this->getState('filter.update_method');
$id .= ':' . $this->getState('filter.build'); $id .= ':' . $this->getState('filter.build');
$id .= ':' . $this->getState('filter.description');
return parent::getStoreId($id); return parent::getStoreId($id);
} }

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage externalsourcesfilterbuild.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Externalsourcesfilterbuild Form Field class for the Sermondistributor component
*/
class JFormFieldExternalsourcesfilterbuild extends JFormFieldList
{
/**
* The externalsourcesfilterbuild field type.
*
* @var string
*/
public $type = 'externalsourcesfilterbuild';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('build'));
$query->from($db->quoteName('#__sermondistributor_external_source'));
$query->order($db->quoteName('build') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get external_sourcesmodel
$model = SermondistributorHelper::getModel('external_sources');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD') . ' -');
foreach ($results as $build)
{
// Translate the build selection
$text = $model->selectionTranslation($build,'build');
// Now add the build and its text to the options array
$_filter[] = JHtml::_('select.option', $build, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage externalsourcesfilterexternalsources.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Externalsourcesfilterexternalsources Form Field class for the Sermondistributor component
*/
class JFormFieldExternalsourcesfilterexternalsources extends JFormFieldList
{
/**
* The externalsourcesfilterexternalsources field type.
*
* @var string
*/
public $type = 'externalsourcesfilterexternalsources';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('externalsources'));
$query->from($db->quoteName('#__sermondistributor_external_source'));
$query->order($db->quoteName('externalsources') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get external_sourcesmodel
$model = SermondistributorHelper::getModel('external_sources');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_EXTERNALSOURCES') . ' -');
foreach ($results as $externalsources)
{
// Translate the externalsources selection
$text = $model->selectionTranslation($externalsources,'externalsources');
// Now add the externalsources and its text to the options array
$_filter[] = JHtml::_('select.option', $externalsources, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage externalsourcesfilterupdatemethod.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Externalsourcesfilterupdatemethod Form Field class for the Sermondistributor component
*/
class JFormFieldExternalsourcesfilterupdatemethod extends JFormFieldList
{
/**
* The externalsourcesfilterupdatemethod field type.
*
* @var string
*/
public $type = 'externalsourcesfilterupdatemethod';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('update_method'));
$query->from($db->quoteName('#__sermondistributor_external_source'));
$query->order($db->quoteName('update_method') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get external_sourcesmodel
$model = SermondistributorHelper::getModel('external_sources');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_UPDATE_METHOD') . ' -');
foreach ($results as $update_method)
{
// Translate the update_method selection
$text = $model->selectionTranslation($update_method,'update_method');
// Now add the update_method and its text to the options array
$_filter[] = JHtml::_('select.option', $update_method, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage helpdocumentsfilterlocation.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Helpdocumentsfilterlocation Form Field class for the Sermondistributor component
*/
class JFormFieldHelpdocumentsfilterlocation extends JFormFieldList
{
/**
* The helpdocumentsfilterlocation field type.
*
* @var string
*/
public $type = 'helpdocumentsfilterlocation';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('location'));
$query->from($db->quoteName('#__sermondistributor_help_document'));
$query->order($db->quoteName('location') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get help_documentsmodel
$model = SermondistributorHelper::getModel('help_documents');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_LOCATION') . ' -');
foreach ($results as $location)
{
// Translate the location selection
$text = $model->selectionTranslation($location,'location');
// Now add the location and its text to the options array
$_filter[] = JHtml::_('select.option', $location, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage helpdocumentsfiltertype.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Helpdocumentsfiltertype Form Field class for the Sermondistributor component
*/
class JFormFieldHelpdocumentsfiltertype extends JFormFieldList
{
/**
* The helpdocumentsfiltertype field type.
*
* @var string
*/
public $type = 'helpdocumentsfiltertype';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('type'));
$query->from($db->quoteName('#__sermondistributor_help_document'));
$query->order($db->quoteName('type') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get help_documentsmodel
$model = SermondistributorHelper::getModel('help_documents');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_TYPE') . ' -');
foreach ($results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage locallistingsfilterbuild.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Locallistingsfilterbuild Form Field class for the Sermondistributor component
*/
class JFormFieldLocallistingsfilterbuild extends JFormFieldList
{
/**
* The locallistingsfilterbuild field type.
*
* @var string
*/
public $type = 'locallistingsfilterbuild';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('build'));
$query->from($db->quoteName('#__sermondistributor_local_listing'));
$query->order($db->quoteName('build') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get local_listingsmodel
$model = SermondistributorHelper::getModel('local_listings');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_BUILD') . ' -');
foreach ($results as $build)
{
// Translate the build selection
$text = $model->selectionTranslation($build,'build');
// Now add the build and its text to the options array
$_filter[] = JHtml::_('select.option', $build, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -41,6 +41,110 @@ class JFormFieldPreachers extends JFormFieldList
*/ */
public $type = 'preachers'; public $type = 'preachers';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$set_button = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($set_button === 'true')
{
$button = array();
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = JFactory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referral if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) JUri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;
$refJ .= '&return=' . $_return;
}
// get button label
$button_label = trim($button_code_name);
$button_label = preg_replace('/_+/', ' ', $button_label);
$button_label = preg_replace('/\s+/', ' ', $button_label);
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = JFactory::getUser();
// only add if user allowed to create preacher
if ($user->authorise('preacher.create', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_SERMONDISTRIBUTOR_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_sermondistributor&amp;view=preacher&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit preacher
if ($user->authorise('preacher.edit', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
jQuery(document).ready(function() {
jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
e.preventDefault();
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
function ".$button_code_name."Button(value) {
if (value > 0) {
// hide the create button
jQuery('#".$button_code_name."Create').hide();
// show edit button
jQuery('#".$button_code_name."Edit').show();
var url = 'index.php?option=com_sermondistributor&view=preachers&task=preacher.edit&id='+value+'".$refJ."';
jQuery('#".$button_code_name."Edit').attr('href', url);
} else {
// show the create button
jQuery('#".$button_code_name."Create').show();
// hide edit button
jQuery('#".$button_code_name."Edit').hide();
}
}";
}
// check if button was created for preacher field.
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = JFactory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/** /**
* Method to get a list of options for a list input. * Method to get a list of options for a list input.
* *
@ -48,9 +152,10 @@ class JFormFieldPreachers extends JFormFieldList
*/ */
protected function getOptions() protected function getOptions()
{ {
// Get the database object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','preacher_request_id_name'))); $query->select($db->quoteName(array('a.id','a.name'),array('id','preacher_name')));
$query->from($db->quoteName('#__sermondistributor_preacher', 'a')); $query->from($db->quoteName('#__sermondistributor_preacher', 'a'));
$query->where($db->quoteName('a.published') . ' = 1'); $query->where($db->quoteName('a.published') . ' = 1');
$query->order('a.name ASC'); $query->order('a.name ASC');
@ -59,14 +164,16 @@ class JFormFieldPreachers extends JFormFieldList
$options = array(); $options = array();
if ($items) if ($items)
{ {
if ($this->multiple === false) { if ($this->multiple === false)
$options[] = JHtml::_('select.option', '', 'Select a preacher'); {
$options[] = JHtml::_('select.option', '', JText::_('COM_SERMONDISTRIBUTOR_SELECT_A_PREACHER'));
} }
foreach($items as $item) foreach($items as $item)
{ {
$options[] = JHtml::_('select.option', $item->id, $item->preacher_request_id_name); $options[] = JHtml::_('select.option', $item->id, $item->preacher_name);
} }
} }
return $options; return $options;
} }
} }

View File

@ -41,6 +41,110 @@ class JFormFieldSeries extends JFormFieldList
*/ */
public $type = 'series'; public $type = 'series';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$set_button = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($set_button === 'true')
{
$button = array();
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = JFactory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referral if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
// get the return value.
$_uri = (string) JUri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&amp;return=' . $_return;
$refJ .= '&return=' . $_return;
}
// get button label
$button_label = trim($button_code_name);
$button_label = preg_replace('/_+/', ' ', $button_label);
$button_label = preg_replace('/\s+/', ' ', $button_label);
$button_label = preg_replace("/[^A-Za-z ]/", '', $button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = JFactory::getUser();
// only add if user allowed to create series
if ($user->authorise('series.create', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area.
{
// build Create button
$button[] = '<a id="'.$button_code_name.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_SERMONDISTRIBUTOR_CREATE_NEW_S', $button_label).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_sermondistributor&amp;view=series&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// only add if user allowed to edit series
if ($user->authorise('series.edit', 'com_sermondistributor') && $app->isAdmin()) // TODO for now only in admin area.
{
// build edit button
$button[] = '<a id="'.$button_code_name.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_SERMONDISTRIBUTOR_EDIT_S', $button_label).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
jQuery(document).ready(function() {
jQuery('#adminForm').on('change', '#jform_".$button_code_name."',function (e) {
e.preventDefault();
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
var ".$button_code_name."Value = jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
function ".$button_code_name."Button(value) {
if (value > 0) {
// hide the create button
jQuery('#".$button_code_name."Create').hide();
// show edit button
jQuery('#".$button_code_name."Edit').show();
var url = 'index.php?option=com_sermondistributor&view=all_series&task=series.edit&id='+value+'".$refJ."';
jQuery('#".$button_code_name."Edit').attr('href', url);
} else {
// show the create button
jQuery('#".$button_code_name."Create').show();
// hide edit button
jQuery('#".$button_code_name."Edit').hide();
}
}";
}
// check if button was created for series field.
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = JFactory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/** /**
* Method to get a list of options for a list input. * Method to get a list of options for a list input.
* *
@ -48,9 +152,10 @@ class JFormFieldSeries extends JFormFieldList
*/ */
protected function getOptions() protected function getOptions()
{ {
// Get the database object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','series_request_id_name'))); $query->select($db->quoteName(array('a.id','a.name'),array('id','series_name')));
$query->from($db->quoteName('#__sermondistributor_series', 'a')); $query->from($db->quoteName('#__sermondistributor_series', 'a'));
$query->where($db->quoteName('a.published') . ' = 1'); $query->where($db->quoteName('a.published') . ' = 1');
$query->order('a.name ASC'); $query->order('a.name ASC');
@ -59,12 +164,16 @@ class JFormFieldSeries extends JFormFieldList
$options = array(); $options = array();
if ($items) if ($items)
{ {
$options[] = JHtml::_('select.option', '', 'Select a series'); if ($this->multiple === false)
{
$options[] = JHtml::_('select.option', '', JText::_('COM_SERMONDISTRIBUTOR_SELECT_A_SERIES'));
}
foreach($items as $item) foreach($items as $item)
{ {
$options[] = JHtml::_('select.option', $item->id, $item->series_request_id_name); $options[] = JHtml::_('select.option', $item->id, $item->series_name);
} }
} }
return $options; return $options;
} }
} }

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermonsfilterlinktype.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Sermonsfilterlinktype Form Field class for the Sermondistributor component
*/
class JFormFieldSermonsfilterlinktype extends JFormFieldList
{
/**
* The sermonsfilterlinktype field type.
*
* @var string
*/
public $type = 'sermonsfilterlinktype';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('link_type'));
$query->from($db->quoteName('#__sermondistributor_sermon'));
$query->order($db->quoteName('link_type') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get sermonsmodel
$model = SermondistributorHelper::getModel('sermons');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_LINK_TYPE') . ' -');
foreach ($results as $link_type)
{
// Translate the link_type selection
$text = $model->selectionTranslation($link_type,'link_type');
// Now add the link_type and its text to the options array
$_filter[] = JHtml::_('select.option', $link_type, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermonsfiltersource.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Sermonsfiltersource Form Field class for the Sermondistributor component
*/
class JFormFieldSermonsfiltersource extends JFormFieldList
{
/**
* The sermonsfiltersource field type.
*
* @var string
*/
public $type = 'sermonsfiltersource';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('source'));
$query->from($db->quoteName('#__sermondistributor_sermon'));
$query->order($db->quoteName('source') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get sermonsmodel
$model = SermondistributorHelper::getModel('sermons');
$results = array_unique($results);
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SOURCE') . ' -');
foreach ($results as $source)
{
// Translate the source selection
$text = $model->selectionTranslation($source,'source');
// Now add the source and its text to the options array
$_filter[] = JHtml::_('select.option', $source, JText::_($text));
}
return $_filter;
}
return false;
}
}

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_SERMONDISTRIBUTOR_FILTER_SEARCH"
description="COM_SERMONDISTRIBUTOR_FILTER_SEARCH_EXTERNAL_SOURCES"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED"
description="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_EXTERNAL_SOURCES"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="externalsourcesfilterexternalsources"
name="externalsources"
label="COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="externalsourcesfilterupdatemethod"
name="update_method"
label="COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="externalsourcesfilterbuild"
name="build"
label="COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.description ASC">COM_SERMONDISTRIBUTOR_FILTER_DESCRIPTION_ASCENDING</option>
<option value="a.description DESC">COM_SERMONDISTRIBUTOR_FILTER_DESCRIPTION_DESCENDING</option>
<option value="a.externalsources ASC">COM_SERMONDISTRIBUTOR_FILTER_EXTERNALSOURCES_ASCENDING</option>
<option value="a.externalsources DESC">COM_SERMONDISTRIBUTOR_FILTER_EXTERNALSOURCES_DESCENDING</option>
<option value="a.update_method ASC">COM_SERMONDISTRIBUTOR_FILTER_UPDATE_METHOD_ASCENDING</option>
<option value="a.update_method DESC">COM_SERMONDISTRIBUTOR_FILTER_UPDATE_METHOD_DESCENDING</option>
<option value="a.build ASC">COM_SERMONDISTRIBUTOR_FILTER_BUILD_ASCENDING</option>
<option value="a.build DESC">COM_SERMONDISTRIBUTOR_FILTER_BUILD_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_SERMONDISTRIBUTOR_FILTER_SEARCH"
description="COM_SERMONDISTRIBUTOR_FILTER_SEARCH_HELP_DOCUMENTS"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED"
description="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_HELP_DOCUMENTS"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"
/>
<field
type="helpdocumentsfiltertype"
name="type"
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="helpdocumentsfilterlocation"
name="location"
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="adminviewfolderlist"
name="admin_view"
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="siteviewfolderlist"
name="site_view"
label="COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.title ASC">COM_SERMONDISTRIBUTOR_FILTER_TITLE_ASCENDING</option>
<option value="a.title DESC">COM_SERMONDISTRIBUTOR_FILTER_TITLE_DESCENDING</option>
<option value="a.type ASC">COM_SERMONDISTRIBUTOR_FILTER_TYPE_ASCENDING</option>
<option value="a.type DESC">COM_SERMONDISTRIBUTOR_FILTER_TYPE_DESCENDING</option>
<option value="a.location ASC">COM_SERMONDISTRIBUTOR_FILTER_LOCATION_ASCENDING</option>
<option value="a.location DESC">COM_SERMONDISTRIBUTOR_FILTER_LOCATION_DESCENDING</option>
<option value="g. ASC">COM_SERMONDISTRIBUTOR_FILTER_ADMIN_VIEW_ASCENDING</option>
<option value="g. DESC">COM_SERMONDISTRIBUTOR_FILTER_ADMIN_VIEW_DESCENDING</option>
<option value="h. ASC">COM_SERMONDISTRIBUTOR_FILTER_SITE_VIEW_ASCENDING</option>
<option value="h. DESC">COM_SERMONDISTRIBUTOR_FILTER_SITE_VIEW_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_SERMONDISTRIBUTOR_FILTER_SEARCH"
description="COM_SERMONDISTRIBUTOR_FILTER_SEARCH_LOCAL_LISTINGS"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED"
description="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_LOCAL_LISTINGS"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="locallistingsfilterbuild"
name="build"
label="COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="externalsource"
name="external_source"
label="COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.name ASC">COM_SERMONDISTRIBUTOR_FILTER_NAME_ASCENDING</option>
<option value="a.name DESC">COM_SERMONDISTRIBUTOR_FILTER_NAME_DESCENDING</option>
<option value="a.build ASC">COM_SERMONDISTRIBUTOR_FILTER_BUILD_ASCENDING</option>
<option value="a.build DESC">COM_SERMONDISTRIBUTOR_FILTER_BUILD_DESCENDING</option>
<option value="a.size ASC">COM_SERMONDISTRIBUTOR_FILTER_SIZE_ASCENDING</option>
<option value="a.size DESC">COM_SERMONDISTRIBUTOR_FILTER_SIZE_DESCENDING</option>
<option value="g.description ASC">COM_SERMONDISTRIBUTOR_FILTER_EXTERNAL_SOURCE_ASCENDING</option>
<option value="g.description DESC">COM_SERMONDISTRIBUTOR_FILTER_EXTERNAL_SOURCE_DESCENDING</option>
<option value="a.key ASC">COM_SERMONDISTRIBUTOR_FILTER_KEY_ASCENDING</option>
<option value="a.key DESC">COM_SERMONDISTRIBUTOR_FILTER_KEY_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_SERMONDISTRIBUTOR_FILTER_SEARCH"
description="COM_SERMONDISTRIBUTOR_FILTER_SEARCH_PREACHERS"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED"
description="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_PREACHERS"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.name ASC">COM_SERMONDISTRIBUTOR_FILTER_NAME_ASCENDING</option>
<option value="a.name DESC">COM_SERMONDISTRIBUTOR_FILTER_NAME_DESCENDING</option>
<option value="a.description ASC">COM_SERMONDISTRIBUTOR_FILTER_DESCRIPTION_ASCENDING</option>
<option value="a.description DESC">COM_SERMONDISTRIBUTOR_FILTER_DESCRIPTION_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_SERMONDISTRIBUTOR_FILTER_SEARCH"
description="COM_SERMONDISTRIBUTOR_FILTER_SEARCH_SERIES_LIST"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED"
description="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_SERIES_LIST"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.name ASC">COM_SERMONDISTRIBUTOR_FILTER_NAME_ASCENDING</option>
<option value="a.name DESC">COM_SERMONDISTRIBUTOR_FILTER_NAME_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -1,150 +1,120 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<form <form
addrulepath="/administrator/components/com_sermondistributor/models/rules" addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields" addfieldpath="/administrator/components/com_sermondistributor/models/fields"
> >
<fields name="filter"> <fields name="filter">
<field <field
name="search" type="text"
type="text" name="search"
inputmode="search" inputmode="search"
label="COM_CONTENT_FILTER_SEARCH_LABEL" label="COM_SERMONDISTRIBUTOR_FILTER_SEARCH"
description="COM_CONTENT_FILTER_SEARCH_DESC" description="COM_SERMONDISTRIBUTOR_FILTER_SEARCH_SERMONS"
hint="JSEARCH_FILTER" hint="JSEARCH_FILTER"
/> />
<field <field
name="published" type="status"
type="status" name="published"
label="COM_CONTENT_FILTER_PUBLISHED" label="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED"
description="COM_CONTENT_FILTER_PUBLISHED_DESC" description="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_SERMONS"
onchange="this.form.submit();" onchange="this.form.submit();"
> >
<option value="">JOPTION_SELECT_PUBLISHED</option> <option value="">JOPTION_SELECT_PUBLISHED</option>
</field> </field>
<field <field
name="category_id" type="category"
type="category" name="category_id"
label="JOPTION_FILTER_CATEGORY" label="JOPTION_FILTER_CATEGORY"
description="JOPTION_FILTER_CATEGORY_DESC" description="JOPTION_FILTER_CATEGORY_DESC"
multiple="true" multiple="true"
class="multipleCategories" class="multipleCategories"
extension="com_sermondistributor.sermon" extension="com_sermondistributor.sermon"
onchange="this.form.submit();" onchange="this.form.submit();"
published="0,1,2" published="0,1,2"
/> />
<field <field
name="access" type="accesslevel"
type="accesslevel" name="access"
label="JOPTION_FILTER_ACCESS" label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC" description="JOPTION_FILTER_ACCESS_DESC"
multiple="true" multiple="true"
class="multipleAccessLevels" class="multipleAccessLevels"
onchange="this.form.submit();" onchange="this.form.submit();"
/> />
<!-- Preacher Field. Type: Preachers. (custom) -->
<field <field
type="preachers" type="preachers"
name="preacher" name="preacher"
label="COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL" label="COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL"
description="COM_SERMONDISTRIBUTOR_SERMON_PREACHER_DESCRIPTION" class="multiplePreachers"
class="multiplePreachers" multiple="true"
multiple="true" onchange="this.form.submit();"
onchange="this.form.submit();"
/> />
<!-- Series Field. Type: Series. (custom) -->
<field <field
type="series" type="series"
name="series" name="series"
label="COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL" label="COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL"
description="COM_SERMONDISTRIBUTOR_SERMON_SERIES_DESCRIPTION" class="multipleSeries"
class="list_class" multiple="true"
multiple="false" onchange="this.form.submit();"
onchange="this.form.submit();"
/> />
<!-- Link_type Field. Type: Radio. (joomla) -->
<field <field
type="list" type="sermonsfilterlinktype"
name="link_type" name="link_type"
label="COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL" label="COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL"
description="COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_DESCRIPTION" multiple="false"
class="list_class" onchange="this.form.submit();"
onchange="this.form.submit();" />
>
<!-- Option Set. -->
<option value="">
Select link type</option>
<option value="1">
COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED</option>
<option value="2">
COM_SERMONDISTRIBUTOR_SERMON_DIRECT</option>
</field>
<!-- Source Field. Type: List. (joomla) -->
<field <field
type="list" type="sermonsfiltersource"
name="source" name="source"
label="COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL" label="COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL"
description="COM_SERMONDISTRIBUTOR_SERMON_SOURCE_DESCRIPTION" multiple="false"
class="multipleSource" onchange="this.form.submit();"
multiple="true" />
onchange="this.form.submit();"
>
<!-- Option Set. -->
<option value="1">
COM_SERMONDISTRIBUTOR_SERMON_LOCAL_FOLDER</option>
<option value="2">
COM_SERMONDISTRIBUTOR_SERMON_EXTERNAL_SOURCE</option>
<option value="3">
COM_SERMONDISTRIBUTOR_SERMON_URL</option>
</field>
<input type="hidden" name="form_submited" value="1"/> <input type="hidden" name="form_submited" value="1"/>
</fields> </fields>
<fields name="list"> <fields name="list">
<field <field
name="fullordering" name="fullordering"
type="list" type="list"
label="COM_CONTENT_LIST_FULL_ORDERING" label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC" description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();" onchange="this.form.submit();"
default="a.id DESC" default="a.id DESC"
validate="options" validate="options"
> >
<option value="">JGLOBAL_SORT_BY</option> <option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option> <option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option> <option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option> <option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option> <option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.name ASC">Name ASC</option> <option value="a.name ASC">COM_SERMONDISTRIBUTOR_FILTER_NAME_ASCENDING</option>
<option value="a.name DESC">Name DESC</option> <option value="a.name DESC">COM_SERMONDISTRIBUTOR_FILTER_NAME_DESCENDING</option>
<option value="g.name ASC">Preacher ASC</option> <option value="g.name ASC">COM_SERMONDISTRIBUTOR_FILTER_PREACHER_ASCENDING</option>
<option value="g.name DESC">Preacher DESC</option> <option value="g.name DESC">COM_SERMONDISTRIBUTOR_FILTER_PREACHER_DESCENDING</option>
<option value="h.name ASC">Series ASC</option> <option value="h.name ASC">COM_SERMONDISTRIBUTOR_FILTER_SERIES_ASCENDING</option>
<option value="h.name DESC">Series DESC</option> <option value="h.name DESC">COM_SERMONDISTRIBUTOR_FILTER_SERIES_DESCENDING</option>
<option value="a.short_description ASC">Short description ASC</option> <option value="a.short_description ASC">COM_SERMONDISTRIBUTOR_FILTER_SHORT_DESCRIPTION_ASCENDING</option>
<option value="a.short_description DESC">Short description DESC</option> <option value="a.short_description DESC">COM_SERMONDISTRIBUTOR_FILTER_SHORT_DESCRIPTION_DESCENDING</option>
<option value="category_title ASC">Sermon categories ASC</option> <option value="category_title ASC">COM_SERMONDISTRIBUTOR_FILTER_SERMONS_CATEGORIES_ASCENDING</option>
<option value="category_title DESC">Sermon categories DESC</option> <option value="category_title DESC">COM_SERMONDISTRIBUTOR_FILTER_SERMONS_CATEGORIES_DESCENDING</option>
<option value="a.link_type ASC">Download Link Option ASC</option> <option value="a.link_type ASC">COM_SERMONDISTRIBUTOR_FILTER_LINK_TYPE_ASCENDING</option>
<option value="a.link_type DESC">Download Link Option DESC</option> <option value="a.link_type DESC">COM_SERMONDISTRIBUTOR_FILTER_LINK_TYPE_DESCENDING</option>
<option value="a.source ASC">File source ASC</option> <option value="a.source ASC">COM_SERMONDISTRIBUTOR_FILTER_SOURCE_ASCENDING</option>
<option value="a.source DESC">File source DESC</option> <option value="a.source DESC">COM_SERMONDISTRIBUTOR_FILTER_SOURCE_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option> <option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option> <option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field> </field>
<field <field
name="limit" name="limit"
type="limitbox" type="limitbox"
label="COM_CONTENT_LIST_LIMIT" label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC" description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini" class="input-mini"
default="25" default="25"
onchange="this.form.submit();" onchange="this.form.submit();"
/> />
</fields> </fields>
</form> </form>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_SERMONDISTRIBUTOR_FILTER_SEARCH"
description="COM_SERMONDISTRIBUTOR_FILTER_SEARCH_STATISTICS"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED"
description="COM_SERMONDISTRIBUTOR_FILTER_PUBLISHED_STATISTICS"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="accesslevel"
name="access"
label="JOPTION_FILTER_ACCESS"
description="JOPTION_FILTER_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"
/>
<field
type="sermon"
name="sermon"
label="COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="preachers"
name="preacher"
label="COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<field
type="series"
name="series"
label="COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.filename ASC">COM_SERMONDISTRIBUTOR_FILTER_FILENAME_ASCENDING</option>
<option value="a.filename DESC">COM_SERMONDISTRIBUTOR_FILTER_FILENAME_DESCENDING</option>
<option value="g.name ASC">COM_SERMONDISTRIBUTOR_FILTER_SERMON_ASCENDING</option>
<option value="g.name DESC">COM_SERMONDISTRIBUTOR_FILTER_SERMON_DESCENDING</option>
<option value="h.name ASC">COM_SERMONDISTRIBUTOR_FILTER_PREACHER_ASCENDING</option>
<option value="h.name DESC">COM_SERMONDISTRIBUTOR_FILTER_PREACHER_DESCENDING</option>
<option value="i.name ASC">COM_SERMONDISTRIBUTOR_FILTER_SERIES_ASCENDING</option>
<option value="i.name DESC">COM_SERMONDISTRIBUTOR_FILTER_SERIES_DESCENDING</option>
<option value="a.counter ASC">COM_SERMONDISTRIBUTOR_FILTER_COUNTER_ASCENDING</option>
<option value="a.counter DESC">COM_SERMONDISTRIBUTOR_FILTER_COUNTER_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -428,7 +428,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
public function validate($form, $data, $group = null) public function validate($form, $data, $group = null)
{ {
// check if the not_required field is set // check if the not_required field is set
if (SermondistributorHelper::checkString($data['not_required'])) if (isset($data['not_required']) && SermondistributorHelper::checkString($data['not_required']))
{ {
$requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields); $requiredFields = array_unique($requiredFields);

View File

@ -42,11 +42,11 @@ class SermondistributorModelHelp_documents extends JModelList
'a.ordering','ordering', 'a.ordering','ordering',
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'a.title','title',
'a.type','type', 'a.type','type',
'a.location','location', 'a.location','location',
'g.', 'a.admin_view','admin_view',
'h.' 'a.site_view','site_view',
'a.title','title'
); );
} }
@ -56,7 +56,13 @@ class SermondistributorModelHelp_documents extends JModelList
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void * @return void
*
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
@ -67,30 +73,10 @@ class SermondistributorModelHelp_documents extends JModelList
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
$title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title');
$this->setState('filter.title', $title);
$type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type');
$this->setState('filter.type', $type);
$location = $this->getUserStateFromRequest($this->context . '.filter.location', 'filter_location');
$this->setState('filter.location', $location);
$admin_view = $this->getUserStateFromRequest($this->context . '.filter.admin_view', 'filter_admin_view');
$this->setState('filter.admin_view', $admin_view);
$site_view = $this->getUserStateFromRequest($this->context . '.filter.site_view', 'filter_site_view');
$this->setState('filter.site_view', $site_view);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access); $this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published); $this->setState('filter.published', $published);
@ -100,6 +86,50 @@ class SermondistributorModelHelp_documents extends JModelList
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created); $this->setState('filter.created', $created);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type');
if ($formSubmited)
{
$type = $app->input->post->get('type');
$this->setState('filter.type', $type);
}
$location = $this->getUserStateFromRequest($this->context . '.filter.location', 'filter_location');
if ($formSubmited)
{
$location = $app->input->post->get('location');
$this->setState('filter.location', $location);
}
$admin_view = $this->getUserStateFromRequest($this->context . '.filter.admin_view', 'filter_admin_view');
if ($formSubmited)
{
$admin_view = $app->input->post->get('admin_view');
$this->setState('filter.admin_view', $admin_view);
}
$site_view = $this->getUserStateFromRequest($this->context . '.filter.site_view', 'filter_site_view');
if ($formSubmited)
{
$site_view = $app->input->post->get('site_view');
$this->setState('filter.site_view', $site_view);
}
$title = $this->getUserStateFromRequest($this->context . '.filter.title', 'filter_title');
if ($formSubmited)
{
$title = $app->input->post->get('title');
$this->setState('filter.title', $title);
}
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
@ -264,29 +294,77 @@ class SermondistributorModelHelp_documents extends JModelList
} }
// Filter by Type. // Filter by Type.
if ($type = $this->getState('filter.type')) $_type = $this->getState('filter.type');
if (is_numeric($_type))
{ {
$query->where('a.type = ' . $db->quote($db->escape($type))); if (is_float($_type))
{
$query->where('a.type = ' . (float) $_type);
}
else
{
$query->where('a.type = ' . (int) $_type);
}
}
elseif (SermondistributorHelper::checkString($_type))
{
$query->where('a.type = ' . $db->quote($db->escape($_type)));
} }
// Filter by Location. // Filter by Location.
if ($location = $this->getState('filter.location')) $_location = $this->getState('filter.location');
if (is_numeric($_location))
{ {
$query->where('a.location = ' . $db->quote($db->escape($location))); if (is_float($_location))
{
$query->where('a.location = ' . (float) $_location);
}
else
{
$query->where('a.location = ' . (int) $_location);
}
} }
// Filter by admin_view. elseif (SermondistributorHelper::checkString($_location))
if ($admin_view = $this->getState('filter.admin_view'))
{ {
$query->where('a.admin_view = ' . $db->quote($db->escape($admin_view))); $query->where('a.location = ' . $db->quote($db->escape($_location)));
} }
// Filter by site_view. // Filter by Admin_view.
if ($site_view = $this->getState('filter.site_view')) $_admin_view = $this->getState('filter.admin_view');
if (is_numeric($_admin_view))
{ {
$query->where('a.site_view = ' . $db->quote($db->escape($site_view))); if (is_float($_admin_view))
{
$query->where('a.admin_view = ' . (float) $_admin_view);
}
else
{
$query->where('a.admin_view = ' . (int) $_admin_view);
}
}
elseif (SermondistributorHelper::checkString($_admin_view))
{
$query->where('a.admin_view = ' . $db->quote($db->escape($_admin_view)));
}
// Filter by Site_view.
$_site_view = $this->getState('filter.site_view');
if (is_numeric($_site_view))
{
if (is_float($_site_view))
{
$query->where('a.site_view = ' . (float) $_site_view);
}
else
{
$query->where('a.site_view = ' . (int) $_site_view);
}
}
elseif (SermondistributorHelper::checkString($_site_view))
{
$query->where('a.site_view = ' . $db->quote($db->escape($_site_view)));
} }
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -306,7 +384,7 @@ class SermondistributorModelHelp_documents extends JModelList
public function getExportData($pks, $user = null) public function getExportData($pks, $user = null)
{ {
// setup the query // setup the query
if (SermondistributorHelper::checkArray($pks)) if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{ {
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true; $_export = true;
@ -324,7 +402,24 @@ class SermondistributorModelHelp_documents extends JModelList
// From the sermondistributor_help_document table // From the sermondistributor_help_document table
$query->from($db->quoteName('#__sermondistributor_help_document', 'a')); $query->from($db->quoteName('#__sermondistributor_help_document', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')'); // The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Implement View Level Access // Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
@ -415,11 +510,11 @@ class SermondistributorModelHelp_documents extends JModelList
$id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.title');
$id .= ':' . $this->getState('filter.type'); $id .= ':' . $this->getState('filter.type');
$id .= ':' . $this->getState('filter.location'); $id .= ':' . $this->getState('filter.location');
$id .= ':' . $this->getState('filter.admin_view'); $id .= ':' . $this->getState('filter.admin_view');
$id .= ':' . $this->getState('filter.site_view'); $id .= ':' . $this->getState('filter.site_view');
$id .= ':' . $this->getState('filter.title');
return parent::getStoreId($id); return parent::getStoreId($id);
} }

View File

@ -439,7 +439,15 @@ class SermondistributorModelImport extends JModelLegacy
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
foreach($target_headers as $header) foreach($target_headers as $header)
{ {
$data['target_headers'][$header] = $jinput->getString($header, null); if (($column = $jinput->getString($header, false)) !== false ||
($column = $jinput->getString(strtolower($header), false)) !== false)
{
$data['target_headers'][$header] = $column;
}
else
{
$data['target_headers'][$header] = null;
}
} }
// set the data // set the data
if(isset($package['dir'])) if(isset($package['dir']))

View File

@ -42,10 +42,10 @@ class SermondistributorModelLocal_listings extends JModelList
'a.ordering','ordering', 'a.ordering','ordering',
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'a.name','name',
'a.build','build', 'a.build','build',
'g.description','external_source',
'a.name','name',
'a.size','size', 'a.size','size',
'g.description',
'a.key','key' 'a.key','key'
); );
} }
@ -56,7 +56,13 @@ class SermondistributorModelLocal_listings extends JModelList
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void * @return void
*
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
@ -67,30 +73,10 @@ class SermondistributorModelLocal_listings extends JModelList
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
$build = $this->getUserStateFromRequest($this->context . '.filter.build', 'filter_build');
$this->setState('filter.build', $build);
$size = $this->getUserStateFromRequest($this->context . '.filter.size', 'filter_size');
$this->setState('filter.size', $size);
$external_source = $this->getUserStateFromRequest($this->context . '.filter.external_source', 'filter_external_source');
$this->setState('filter.external_source', $external_source);
$key = $this->getUserStateFromRequest($this->context . '.filter.key', 'filter_key');
$this->setState('filter.key', $key);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access); $this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published); $this->setState('filter.published', $published);
@ -100,6 +86,50 @@ class SermondistributorModelLocal_listings extends JModelList
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created); $this->setState('filter.created', $created);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$build = $this->getUserStateFromRequest($this->context . '.filter.build', 'filter_build');
if ($formSubmited)
{
$build = $app->input->post->get('build');
$this->setState('filter.build', $build);
}
$external_source = $this->getUserStateFromRequest($this->context . '.filter.external_source', 'filter_external_source');
if ($formSubmited)
{
$external_source = $app->input->post->get('external_source');
$this->setState('filter.external_source', $external_source);
}
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
if ($formSubmited)
{
$name = $app->input->post->get('name');
$this->setState('filter.name', $name);
}
$size = $this->getUserStateFromRequest($this->context . '.filter.size', 'filter_size');
if ($formSubmited)
{
$size = $app->input->post->get('size');
$this->setState('filter.size', $size);
}
$key = $this->getUserStateFromRequest($this->context . '.filter.key', 'filter_key');
if ($formSubmited)
{
$key = $app->input->post->get('key');
$this->setState('filter.key', $key);
}
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
@ -226,19 +256,43 @@ class SermondistributorModelLocal_listings extends JModelList
} }
// Filter by Build. // Filter by Build.
if ($build = $this->getState('filter.build')) $_build = $this->getState('filter.build');
if (is_numeric($_build))
{ {
$query->where('a.build = ' . $db->quote($db->escape($build))); if (is_float($_build))
{
$query->where('a.build = ' . (float) $_build);
}
else
{
$query->where('a.build = ' . (int) $_build);
}
} }
// Filter by external_source. elseif (SermondistributorHelper::checkString($_build))
if ($external_source = $this->getState('filter.external_source'))
{ {
$query->where('a.external_source = ' . $db->quote($db->escape($external_source))); $query->where('a.build = ' . $db->quote($db->escape($_build)));
}
// Filter by External_source.
$_external_source = $this->getState('filter.external_source');
if (is_numeric($_external_source))
{
if (is_float($_external_source))
{
$query->where('a.external_source = ' . (float) $_external_source);
}
else
{
$query->where('a.external_source = ' . (int) $_external_source);
}
}
elseif (SermondistributorHelper::checkString($_external_source))
{
$query->where('a.external_source = ' . $db->quote($db->escape($_external_source)));
} }
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -258,7 +312,7 @@ class SermondistributorModelLocal_listings extends JModelList
public function getExportData($pks, $user = null) public function getExportData($pks, $user = null)
{ {
// setup the query // setup the query
if (SermondistributorHelper::checkArray($pks)) if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{ {
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true; $_export = true;
@ -276,7 +330,24 @@ class SermondistributorModelLocal_listings extends JModelList
// From the sermondistributor_local_listing table // From the sermondistributor_local_listing table
$query->from($db->quoteName('#__sermondistributor_local_listing', 'a')); $query->from($db->quoteName('#__sermondistributor_local_listing', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')'); // The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Order the results by ordering // Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
@ -371,10 +442,10 @@ class SermondistributorModelLocal_listings extends JModelList
$id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.name');
$id .= ':' . $this->getState('filter.build'); $id .= ':' . $this->getState('filter.build');
$id .= ':' . $this->getState('filter.size');
$id .= ':' . $this->getState('filter.external_source'); $id .= ':' . $this->getState('filter.external_source');
$id .= ':' . $this->getState('filter.name');
$id .= ':' . $this->getState('filter.size');
$id .= ':' . $this->getState('filter.key'); $id .= ':' . $this->getState('filter.key');
return parent::getStoreId($id); return parent::getStoreId($id);

View File

@ -53,7 +53,13 @@ class SermondistributorModelPreachers extends JModelList
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void * @return void
*
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
@ -64,21 +70,10 @@ class SermondistributorModelPreachers extends JModelList
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
$this->setState('filter.description', $description);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access); $this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published); $this->setState('filter.published', $published);
@ -88,6 +83,29 @@ class SermondistributorModelPreachers extends JModelList
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created); $this->setState('filter.created', $created);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
if ($formSubmited)
{
$name = $app->input->post->get('name');
$this->setState('filter.name', $name);
}
$description = $this->getUserStateFromRequest($this->context . '.filter.description', 'filter_description');
if ($formSubmited)
{
$description = $app->input->post->get('description');
$this->setState('filter.description', $description);
}
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
@ -192,7 +210,7 @@ class SermondistributorModelPreachers extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -212,7 +230,7 @@ class SermondistributorModelPreachers extends JModelList
public function getExportData($pks, $user = null) public function getExportData($pks, $user = null)
{ {
// setup the query // setup the query
if (SermondistributorHelper::checkArray($pks)) if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{ {
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true; $_export = true;
@ -230,7 +248,24 @@ class SermondistributorModelPreachers extends JModelList
// From the sermondistributor_preacher table // From the sermondistributor_preacher table
$query->from($db->quoteName('#__sermondistributor_preacher', 'a')); $query->from($db->quoteName('#__sermondistributor_preacher', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')'); // The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Implement View Level Access // Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {

View File

@ -52,7 +52,13 @@ class SermondistributorModelSeries_list extends JModelList
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void * @return void
*
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
@ -63,18 +69,10 @@ class SermondistributorModelSeries_list extends JModelList
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access); $this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published); $this->setState('filter.published', $published);
@ -84,6 +82,22 @@ class SermondistributorModelSeries_list extends JModelList
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created); $this->setState('filter.created', $created);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
if ($formSubmited)
{
$name = $app->input->post->get('name');
$this->setState('filter.name', $name);
}
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
@ -188,7 +202,7 @@ class SermondistributorModelSeries_list extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -208,7 +222,7 @@ class SermondistributorModelSeries_list extends JModelList
public function getExportData($pks, $user = null) public function getExportData($pks, $user = null)
{ {
// setup the query // setup the query
if (SermondistributorHelper::checkArray($pks)) if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{ {
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true; $_export = true;
@ -226,7 +240,24 @@ class SermondistributorModelSeries_list extends JModelList
// From the sermondistributor_series table // From the sermondistributor_series table
$query->from($db->quoteName('#__sermondistributor_series', 'a')); $query->from($db->quoteName('#__sermondistributor_series', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')'); // The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Implement View Level Access // Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {

View File

@ -548,7 +548,7 @@ class SermondistributorModelSermon extends JModelAdmin
public function validate($form, $data, $group = null) public function validate($form, $data, $group = null)
{ {
// check if the not_required field is set // check if the not_required field is set
if (SermondistributorHelper::checkString($data['not_required'])) if (isset($data['not_required']) && SermondistributorHelper::checkString($data['not_required']))
{ {
$requiredFields = (array) explode(',',(string) $data['not_required']); $requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields); $requiredFields = array_unique($requiredFields);

View File

@ -38,7 +38,7 @@ class SermondistributorModelSermondistributor extends JModelList
$icons = array(); $icons = array();
// view groups array // view groups array
$viewGroups = array( $viewGroups = array(
'main' => array('png.preacher.add', 'png.preachers', 'png.sermon.add', 'png.sermons', 'png.sermons.catid', 'png.series.add', 'png.series_list', 'png.statistics', 'png.external_source.add', 'png.external_sources', 'png.manual_updater', 'png.local_listings', 'png.help_documents') 'main' => array('png.preacher.add', 'png.preachers', 'png.sermon.add', 'png.sermons', 'png.sermons.catid_qpo0O0oqp_com_sermondistributor_po0O0oq_sermon', 'png.series.add', 'png.series_list', 'png.statistics', 'png.external_source.add', 'png.external_sources', 'png.manual_updater', 'png.local_listings', 'png.help_documents')
); );
// view access array // view access array
$viewAccess = array( $viewAccess = array(
@ -103,8 +103,8 @@ class SermondistributorModelSermondistributor extends JModelList
$viewName = $name; $viewName = $name;
$alt = $name; $alt = $name;
$url = $url; $url = $url;
$image = $name.'.'.$type; $image = $name . '.' . $type;
$name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_'.SermondistributorHelper::safeString($name,'U'); $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . SermondistributorHelper::safeString($name,'U');
} }
} }
// internal views // internal views
@ -126,17 +126,27 @@ class SermondistributorModelSermondistributor extends JModelList
switch($action) switch($action)
{ {
case 'add': case 'add':
$url = 'index.php?option=com_sermondistributor&view='.$name.'&layout=edit'; $url = 'index.php?option=com_sermondistributor&view=' . $name . '&layout=edit';
$image = $name.'_'.$action.'.'.$type; $image = $name . '_' . $action. '.' . $type;
$alt = $name.'&nbsp;'.$action; $alt = $name . '&nbsp;' . $action;
$name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_'.SermondistributorHelper::safeString($name,'U').'_ADD'; $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_'.SermondistributorHelper::safeString($name,'U').'_ADD';
$add = true; $add = true;
break; break;
default: default:
$url = 'index.php?option=com_categories&view=categories&extension=com_sermondistributor.'.$name; // check for new convention (more stable)
$image = $name.'_'.$action.'.'.$type; if (strpos($action, '_qpo0O0oqp_') !== false)
$alt = $name.'&nbsp;'.$action; {
$name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_'.SermondistributorHelper::safeString($name,'U').'_'.SermondistributorHelper::safeString($action,'U'); list($action, $extension) = (array) explode('_qpo0O0oqp_', $action);
$extension = str_replace('_po0O0oq_', '.', $extension);
}
else
{
$extension = 'com_sermondistributor.' . $name;
}
$url = 'index.php?option=com_categories&view=categories&extension=' . $extension;
$image = $name . '_' . $action . '.' . $type;
$alt = $viewName . '&nbsp;' . $action;
$name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . SermondistributorHelper::safeString($name,'U') . '_' . SermondistributorHelper::safeString($action,'U');
break; break;
} }
} }
@ -144,9 +154,9 @@ class SermondistributorModelSermondistributor extends JModelList
{ {
$viewName = $name; $viewName = $name;
$alt = $name; $alt = $name;
$url = 'index.php?option=com_sermondistributor&view='.$name; $url = 'index.php?option=com_sermondistributor&view=' . $name;
$image = $name.'.'.$type; $image = $name . '.' . $type;
$name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_'.SermondistributorHelper::safeString($name,'U'); $name = 'COM_SERMONDISTRIBUTOR_DASHBOARD_' . SermondistributorHelper::safeString($name,'U');
$hover = false; $hover = false;
} }
} }
@ -154,8 +164,8 @@ class SermondistributorModelSermondistributor extends JModelList
{ {
$viewName = $view; $viewName = $view;
$alt = $view; $alt = $view;
$url = 'index.php?option=com_sermondistributor&view='.$view; $url = 'index.php?option=com_sermondistributor&view=' . $view;
$image = $view.'.png'; $image = $view . '.png';
$name = ucwords($view).'<br /><br />'; $name = ucwords($view).'<br /><br />';
$hover = false; $hover = false;
} }
@ -167,7 +177,7 @@ class SermondistributorModelSermondistributor extends JModelList
$dashboard_list = false; $dashboard_list = false;
$accessTo = ''; $accessTo = '';
$accessAdd = ''; $accessAdd = '';
// acces checking start // access checking start
$accessCreate = (isset($viewAccess[$viewName.'.create'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.create']):false; $accessCreate = (isset($viewAccess[$viewName.'.create'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.create']):false;
$accessAccess = (isset($viewAccess[$viewName.'.access'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.access']):false; $accessAccess = (isset($viewAccess[$viewName.'.access'])) ? SermondistributorHelper::checkString($viewAccess[$viewName.'.access']):false;
// set main controllers // set main controllers
@ -182,7 +192,7 @@ class SermondistributorModelSermondistributor extends JModelList
{ {
$accessAdd = 'core.create'; $accessAdd = 'core.create';
} }
// check if acces to view is set // check if access to view is set
if ($accessAccess) if ($accessAccess)
{ {
$accessTo = $viewAccess[$viewName.'.access']; $accessTo = $viewAccess[$viewName.'.access'];
@ -269,9 +279,9 @@ class SermondistributorModelSermondistributor extends JModelList
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addScript(JURI::root() . "media/com_sermondistributor/js/timeago.js"); $document->addScript(JURI::root() . "media/com_sermondistributor/js/timeago.js");
$document->addScriptDeclaration(' $document->addScriptDeclaration('
var urlToGetAllOpenIssues = "https://api.github.com/repos/SermonDistributor/Joomla-3-Component/issues?state=open&page=1&per_page=5"; var urlToGetAllOpenIssues = "https://api.github.com/repos/Llewellynvdm/Joomla-Sermon-Distributor/issues?state=open&page=1&per_page=5";
var urlToGetAllClosedIssues = "https://api.github.com/repos/SermonDistributor/Joomla-3-Component/issues?state=closed&page=1&per_page=5"; var urlToGetAllClosedIssues = "https://api.github.com/repos/Llewellynvdm/Joomla-Sermon-Distributor/issues?state=closed&page=1&per_page=5";
var urlToGetAllReleases = "https://api.github.com/repos/SermonDistributor/Joomla-3-Component/releases?page=1&per_page=5"; var urlToGetAllReleases = "https://api.github.com/repos/Llewellynvdm/Joomla-Sermon-Distributor/releases?page=1&per_page=5";
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery.getJSON(urlToGetAllOpenIssues, function (openissues) { jQuery.getJSON(urlToGetAllOpenIssues, function (openissues) {
jQuery("#openissues").html(""); jQuery("#openissues").html("");
@ -325,7 +335,7 @@ class SermondistributorModelSermondistributor extends JModelList
// set active release // set active release
var activeNotice = ""; var activeNotice = "";
if (i === 0) { if (i === 0) {
var activeNotice = "<a class=\'btn btn-small btn-success\' href=\'https://github.com/SermonDistributor/Joomla-3-Component/releases/latest\'><span class=\'icon-shield icon-white\'></span> '.JText::_('COM_SERMONDISTRIBUTOR_LATEST_RELEASE').'</a><br /><br />"; var activeNotice = "<a class=\'btn btn-small btn-success\' href=\'https://github.com/Llewellynvdm/Joomla-Sermon-Distributor/releases/latest\'><span class=\'icon-shield icon-white\'></span> '.JText::_('COM_SERMONDISTRIBUTOR_LATEST_RELEASE').'</a><br /><br />";
} }
// set time ago // set time ago
var timeago = jQuery.timeago(new Date(tagrelease.published_at)); var timeago = jQuery.timeago(new Date(tagrelease.published_at));
@ -341,11 +351,11 @@ class SermondistributorModelSermondistributor extends JModelList
}); });
});'); });');
$create = '<div class="btn-group pull-right"> $create = '<div class="btn-group pull-right">
<a href="https://github.com/SermonDistributor/Joomla-3-Component/issues/new" class="btn btn-primary" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_NEW_ISSUE').'</a> <a href="https://github.com/Llewellynvdm/Joomla-Sermon-Distributor/issues/new" class="btn btn-primary" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_NEW_ISSUE').'</a>
</div></br >'; </div></br >';
$moreopen = '<b><a href="https://github.com/SermonDistributor/Joomla-3-Component/issues" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'</a>...</b> '; $moreopen = '<b><a href="https://github.com/Llewellynvdm/Joomla-Sermon-Distributor/issues" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'</a>...</b> ';
$moreclosed = '<b><a href="https://github.com/SermonDistributor/Joomla-3-Component/issues?q=is%3Aissue+is%3Aclosed" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'</a>...</b> '; $moreclosed = '<b><a href="https://github.com/Llewellynvdm/Joomla-Sermon-Distributor/issues?q=is%3Aissue+is%3Aclosed" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_ISSUES_ON_GITHUB').'</a>...</b> ';
$viewissues = '<b><a href="https://github.com/SermonDistributor/Joomla-3-Component/releases" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_RELEASES_ON_GITHUB').'</a>...</b> '; $viewissues = '<b><a href="https://github.com/Llewellynvdm/Joomla-Sermon-Distributor/releases" target="_blank">'.JText::_('COM_SERMONDISTRIBUTOR_VIEW_MORE_RELEASES_ON_GITHUB').'</a>...</b> ';
return (object) array( return (object) array(
'openissues' => $create.'<div id="openissues">'.JText::_('COM_SERMONDISTRIBUTOR_A_FEW_OPEN_ISSUES_FROM_GITHUB_IS_LOADING').'.<span class="loading-dots">.</span></small></div>'.$moreopen, 'openissues' => $create.'<div id="openissues">'.JText::_('COM_SERMONDISTRIBUTOR_A_FEW_OPEN_ISSUES_FROM_GITHUB_IS_LOADING').'.<span class="loading-dots">.</span></small></div>'.$moreopen,
@ -358,7 +368,7 @@ class SermondistributorModelSermondistributor extends JModelList
{ {
$document = JFactory::getDocument(); $document = JFactory::getDocument();
$document->addScriptDeclaration(' $document->addScriptDeclaration('
var gewiki = "https://raw.githubusercontent.com/wiki/SermonDistributor/Joomla-3-Component/Home.md"; var gewiki = "https://raw.githubusercontent.com/wiki/Llewellynvdm/Joomla-Sermon-Distributor/Home.md";
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery.get(gewiki) jQuery.get(gewiki)
.success(function(wiki) { .success(function(wiki) {

View File

@ -42,16 +42,15 @@ class SermondistributorModelSermons extends JModelList
'a.ordering','ordering', 'a.ordering','ordering',
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'a.access','access',
'a.name','name',
'g.name','preacher', 'g.name','preacher',
'h.name','series', 'h.name','series',
'a.short_description','short_description',
'c.title','category_title', 'c.title','category_title',
'c.id', 'category_id', 'c.id', 'category_id',
'a.catid', 'catid', 'a.catid','catid',
'a.link_type','link_type', 'a.link_type','link_type',
'a.source','source' 'a.source','source',
'a.name','name',
'a.short_description','short_description'
); );
} }
@ -61,7 +60,13 @@ class SermondistributorModelSermons extends JModelList
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void * @return void
*
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
@ -72,32 +77,9 @@ class SermondistributorModelSermons extends JModelList
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
$series = $this->getUserStateFromRequest($this->context . '.filter.series', 'filter_series'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.series', $series); $this->setState('filter.access', $access);
$short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description');
$this->setState('filter.short_description', $short_description);
$category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category');
$this->setState('filter.category', $category);
$catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid');
$this->setState('filter.catid', $catid);
$link_type = $this->getUserStateFromRequest($this->context . '.filter.link_type', 'filter_link_type');
$this->setState('filter.link_type', $link_type);
$source = $this->getUserStateFromRequest($this->context . '.filter.source', 'filter_source');
$this->setState('filter.source', $source);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published); $this->setState('filter.published', $published);
@ -108,23 +90,70 @@ class SermondistributorModelSermons extends JModelList
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created); $this->setState('filter.created', $created);
// Handle multiple fields -> original code commented above $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited'); $formSubmited = $app->input->post->get('form_submited');
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access');
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
$preacher = $this->getUserStateFromRequest($this->context . '.filter.preacher', 'filter_preacher'); $preacher = $this->getUserStateFromRequest($this->context . '.filter.preacher', 'filter_preacher');
if ($formSubmited) if ($formSubmited)
{ {
$access = $app->input->post->get('access');
$this->setState('filter.access', $access);
$categoryId = $app->input->post->get('category_id');
$this->setState('filter.category_id', $categoryId);
$preacher = $app->input->post->get('preacher'); $preacher = $app->input->post->get('preacher');
$this->setState('filter.preacher', $preacher); $this->setState('filter.preacher', $preacher);
} }
$series = $this->getUserStateFromRequest($this->context . '.filter.series', 'filter_series');
if ($formSubmited)
{
$series = $app->input->post->get('series');
$this->setState('filter.series', $series);
}
$category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category');
$this->setState('filter.category', $category);
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
$this->setState('filter.category_id', $categoryId);
$catid = $this->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid');
if ($formSubmited)
{
$catid = $app->input->post->get('catid');
$this->setState('filter.catid', $catid);
}
$link_type = $this->getUserStateFromRequest($this->context . '.filter.link_type', 'filter_link_type');
if ($formSubmited)
{
$link_type = $app->input->post->get('link_type');
$this->setState('filter.link_type', $link_type);
}
$source = $this->getUserStateFromRequest($this->context . '.filter.source', 'filter_source');
if ($formSubmited)
{
$source = $app->input->post->get('source');
$this->setState('filter.source', $source);
}
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
if ($formSubmited)
{
$name = $app->input->post->get('name');
$this->setState('filter.name', $name);
}
$short_description = $this->getUserStateFromRequest($this->context . '.filter.short_description', 'filter_short_description');
if ($formSubmited)
{
$short_description = $app->input->post->get('short_description');
$this->setState('filter.short_description', $short_description);
}
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
@ -262,19 +291,10 @@ class SermondistributorModelSermons extends JModelList
$query->select('ag.title AS access_level'); $query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level. // Filter by access level.
$access = $this->getState('filter.access'); if ($access = $this->getState('filter.access'))
if (is_numeric($access))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
elseif (is_array($access))
{
$access = ArrayHelper::toInteger($access);
$access = implode(',', $access);
$query->where('a.access IN (' . $access . ')');
}
// Implement View Level Access // Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
@ -296,41 +316,119 @@ class SermondistributorModelSermons extends JModelList
} }
} }
// Filter by preacher. // Filter by Preacher.
$preacher = $this->getState('filter.preacher'); $_preacher = $this->getState('filter.preacher');
if (is_numeric($_preacher))
if (is_numeric($preacher))
{ {
$query->where('a.preacher = ' . (int) $preacher); if (is_float($_preacher))
{
$query->where('a.preacher = ' . (float) $_preacher);
}
else
{
$query->where('a.preacher = ' . (int) $_preacher);
}
} }
elseif (is_array($preacher)) elseif (SermondistributorHelper::checkString($_preacher))
{ {
$preacher = ArrayHelper::toInteger($preacher); $query->where('a.preacher = ' . $db->quote($db->escape($_preacher)));
$preacher = implode(',', $preacher);
$query->where('a.preacher IN (' . $preacher . ')');
} }
// Filter by series. elseif (SermondistributorHelper::checkArray($_preacher))
if ($series = $this->getState('filter.series'))
{ {
$query->where('a.series = ' . $db->quote($db->escape($series))); // Secure the array for the query
$_preacher = array_map( function ($val) use(&$db) {
if (is_numeric($val))
{
if (is_float($val))
{
return (float) $val;
}
else
{
return (int) $val;
}
}
elseif (SermondistributorHelper::checkString($val))
{
return $db->quote($db->escape($val));
}
}, $_preacher);
// Filter by the Preacher Array.
$query->where('a.preacher IN (' . implode(',', $_preacher) . ')');
}
// Filter by Series.
$_series = $this->getState('filter.series');
if (is_numeric($_series))
{
if (is_float($_series))
{
$query->where('a.series = ' . (float) $_series);
}
else
{
$query->where('a.series = ' . (int) $_series);
}
}
elseif (SermondistributorHelper::checkString($_series))
{
$query->where('a.series = ' . $db->quote($db->escape($_series)));
}
elseif (SermondistributorHelper::checkArray($_series))
{
// Secure the array for the query
$_series = array_map( function ($val) use(&$db) {
if (is_numeric($val))
{
if (is_float($val))
{
return (float) $val;
}
else
{
return (int) $val;
}
}
elseif (SermondistributorHelper::checkString($val))
{
return $db->quote($db->escape($val));
}
}, $_series);
// Filter by the Series Array.
$query->where('a.series IN (' . implode(',', $_series) . ')');
} }
// Filter by Link_type. // Filter by Link_type.
if ($link_type = $this->getState('filter.link_type')) $_link_type = $this->getState('filter.link_type');
if (is_numeric($_link_type))
{ {
$query->where('a.link_type = ' . $db->quote($db->escape($link_type))); if (is_float($_link_type))
{
$query->where('a.link_type = ' . (float) $_link_type);
}
else
{
$query->where('a.link_type = ' . (int) $_link_type);
}
}
elseif (SermondistributorHelper::checkString($_link_type))
{
$query->where('a.link_type = ' . $db->quote($db->escape($_link_type)));
} }
// Filter by Source. // Filter by Source.
$source = $this->getState('filter.source'); $_source = $this->getState('filter.source');
if (is_numeric($_source))
if (is_numeric($source))
{ {
$query->where('a.source = ' . (int) $source); if (is_float($_source))
{
$query->where('a.source = ' . (float) $_source);
}
else
{
$query->where('a.source = ' . (int) $_source);
}
} }
elseif (is_array($source)) elseif (SermondistributorHelper::checkString($_source))
{ {
$source = ArrayHelper::toInteger($source); $query->where('a.source = ' . $db->quote($db->escape($_source)));
$source = implode(',', $source);
$query->where('a.source IN (' . $source . ')');
} }
// Filter by a single or group of categories. // Filter by a single or group of categories.
@ -357,7 +455,7 @@ class SermondistributorModelSermons extends JModelList
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -377,7 +475,7 @@ class SermondistributorModelSermons extends JModelList
public function getExportData($pks, $user = null) public function getExportData($pks, $user = null)
{ {
// setup the query // setup the query
if (SermondistributorHelper::checkArray($pks)) if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{ {
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true; $_export = true;
@ -395,7 +493,24 @@ class SermondistributorModelSermons extends JModelList
// From the sermondistributor_sermon table // From the sermondistributor_sermon table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a')); $query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')'); // The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Implement View Level Access // Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
@ -486,15 +601,15 @@ class SermondistributorModelSermons extends JModelList
$id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.name');
$id .= ':' . $this->getState('filter.preacher'); $id .= ':' . $this->getState('filter.preacher');
$id .= ':' . $this->getState('filter.series'); $id .= ':' . $this->getState('filter.series');
$id .= ':' . $this->getState('filter.short_description');
$id .= ':' . $this->getState('filter.category'); $id .= ':' . $this->getState('filter.category');
$id .= ':' . $this->getState('filter.category_id'); $id .= ':' . $this->getState('filter.category_id');
$id .= ':' . $this->getState('filter.catid'); $id .= ':' . $this->getState('filter.catid');
$id .= ':' . $this->getState('filter.link_type'); $id .= ':' . $this->getState('filter.link_type');
$id .= ':' . $this->getState('filter.source'); $id .= ':' . $this->getState('filter.source');
$id .= ':' . $this->getState('filter.name');
$id .= ':' . $this->getState('filter.short_description');
return parent::getStoreId($id); return parent::getStoreId($id);
} }

View File

@ -42,10 +42,10 @@ class SermondistributorModelStatistics extends JModelList
'a.ordering','ordering', 'a.ordering','ordering',
'a.created_by','created_by', 'a.created_by','created_by',
'a.modified_by','modified_by', 'a.modified_by','modified_by',
'g.name','sermon',
'h.name','preacher',
'i.name','series',
'a.filename','filename', 'a.filename','filename',
'g.name',
'h.name',
'i.name',
'a.counter','counter' 'a.counter','counter'
); );
} }
@ -56,7 +56,13 @@ class SermondistributorModelStatistics extends JModelList
/** /**
* Method to auto-populate the model state. * Method to auto-populate the model state.
* *
* Note. Calling getState in this method will result in recursion.
*
* @param string $ordering An optional ordering field.
* @param string $direction An optional direction (asc|desc).
*
* @return void * @return void
*
*/ */
protected function populateState($ordering = null, $direction = null) protected function populateState($ordering = null, $direction = null)
{ {
@ -67,30 +73,10 @@ class SermondistributorModelStatistics extends JModelList
{ {
$this->context .= '.' . $layout; $this->context .= '.' . $layout;
} }
$filename = $this->getUserStateFromRequest($this->context . '.filter.filename', 'filter_filename');
$this->setState('filter.filename', $filename);
$sermon = $this->getUserStateFromRequest($this->context . '.filter.sermon', 'filter_sermon');
$this->setState('filter.sermon', $sermon);
$preacher = $this->getUserStateFromRequest($this->context . '.filter.preacher', 'filter_preacher');
$this->setState('filter.preacher', $preacher);
$series = $this->getUserStateFromRequest($this->context . '.filter.series', 'filter_series');
$this->setState('filter.series', $series);
$counter = $this->getUserStateFromRequest($this->context . '.filter.counter', 'filter_counter');
$this->setState('filter.counter', $counter);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access); $this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published); $this->setState('filter.published', $published);
@ -100,6 +86,50 @@ class SermondistributorModelStatistics extends JModelList
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created); $this->setState('filter.created', $created);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$sermon = $this->getUserStateFromRequest($this->context . '.filter.sermon', 'filter_sermon');
if ($formSubmited)
{
$sermon = $app->input->post->get('sermon');
$this->setState('filter.sermon', $sermon);
}
$preacher = $this->getUserStateFromRequest($this->context . '.filter.preacher', 'filter_preacher');
if ($formSubmited)
{
$preacher = $app->input->post->get('preacher');
$this->setState('filter.preacher', $preacher);
}
$series = $this->getUserStateFromRequest($this->context . '.filter.series', 'filter_series');
if ($formSubmited)
{
$series = $app->input->post->get('series');
$this->setState('filter.series', $series);
}
$filename = $this->getUserStateFromRequest($this->context . '.filter.filename', 'filter_filename');
if ($formSubmited)
{
$filename = $app->input->post->get('filename');
$this->setState('filter.filename', $filename);
}
$counter = $this->getUserStateFromRequest($this->context . '.filter.counter', 'filter_counter');
if ($formSubmited)
{
$counter = $app->input->post->get('counter');
$this->setState('filter.counter', $counter);
}
// List state information. // List state information.
parent::populateState($ordering, $direction); parent::populateState($ordering, $direction);
} }
@ -213,25 +243,61 @@ class SermondistributorModelStatistics extends JModelList
} }
} }
// Filter by sermon. // Filter by Sermon.
if ($sermon = $this->getState('filter.sermon')) $_sermon = $this->getState('filter.sermon');
if (is_numeric($_sermon))
{ {
$query->where('a.sermon = ' . $db->quote($db->escape($sermon))); if (is_float($_sermon))
{
$query->where('a.sermon = ' . (float) $_sermon);
}
else
{
$query->where('a.sermon = ' . (int) $_sermon);
}
} }
// Filter by preacher. elseif (SermondistributorHelper::checkString($_sermon))
if ($preacher = $this->getState('filter.preacher'))
{ {
$query->where('a.preacher = ' . $db->quote($db->escape($preacher))); $query->where('a.sermon = ' . $db->quote($db->escape($_sermon)));
} }
// Filter by series. // Filter by Preacher.
if ($series = $this->getState('filter.series')) $_preacher = $this->getState('filter.preacher');
if (is_numeric($_preacher))
{ {
$query->where('a.series = ' . $db->quote($db->escape($series))); if (is_float($_preacher))
{
$query->where('a.preacher = ' . (float) $_preacher);
}
else
{
$query->where('a.preacher = ' . (int) $_preacher);
}
}
elseif (SermondistributorHelper::checkString($_preacher))
{
$query->where('a.preacher = ' . $db->quote($db->escape($_preacher)));
}
// Filter by Series.
$_series = $this->getState('filter.series');
if (is_numeric($_series))
{
if (is_float($_series))
{
$query->where('a.series = ' . (float) $_series);
}
else
{
$query->where('a.series = ' . (int) $_series);
}
}
elseif (SermondistributorHelper::checkString($_series))
{
$query->where('a.series = ' . $db->quote($db->escape($_series)));
} }
// Add the list ordering clause. // Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id'); $orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc'); $orderDirn = $this->state->get('list.direction', 'desc');
if ($orderCol != '') if ($orderCol != '')
{ {
$query->order($db->escape($orderCol . ' ' . $orderDirn)); $query->order($db->escape($orderCol . ' ' . $orderDirn));
@ -251,7 +317,7 @@ class SermondistributorModelStatistics extends JModelList
public function getExportData($pks, $user = null) public function getExportData($pks, $user = null)
{ {
// setup the query // setup the query
if (SermondistributorHelper::checkArray($pks)) if (($pks_size = SermondistributorHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{ {
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME) // Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true; $_export = true;
@ -269,7 +335,24 @@ class SermondistributorModelStatistics extends JModelList
// From the sermondistributor_statistic table // From the sermondistributor_statistic table
$query->from($db->quoteName('#__sermondistributor_statistic', 'a')); $query->from($db->quoteName('#__sermondistributor_statistic', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')'); // The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Implement View Level Access // Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
@ -360,10 +443,10 @@ class SermondistributorModelStatistics extends JModelList
$id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by'); $id .= ':' . $this->getState('filter.modified_by');
$id .= ':' . $this->getState('filter.filename');
$id .= ':' . $this->getState('filter.sermon'); $id .= ':' . $this->getState('filter.sermon');
$id .= ':' . $this->getState('filter.preacher'); $id .= ':' . $this->getState('filter.preacher');
$id .= ':' . $this->getState('filter.series'); $id .= ':' . $this->getState('filter.series');
$id .= ':' . $this->getState('filter.filename');
$id .= ':' . $this->getState('filter.counter'); $id .= ':' . $this->getState('filter.counter');
return parent::getStoreId($id); return parent::getStoreId($id);

View File

@ -0,0 +1,3 @@
ALTER TABLE `#__sermondistributor_sermon` ENGINE = InnoDB;
ALTER TABLE `#__sermondistributor_sermon` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

View File

@ -92,7 +92,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<?php $this->tab_name = 'external_sourceTab'; ?> <?php $this->tab_name = 'external_sourceTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('external_source.delete') || $this->canDo->get('external_source.edit.created_by') || $this->canDo->get('external_source.edit.state') || $this->canDo->get('external_source.edit.created')) : ?> <?php if ($this->canDo->get('external_source.edit.created_by') || $this->canDo->get('external_source.edit.created') || $this->canDo->get('external_source.edit.state') || ($this->canDo->get('external_source.delete') && $this->canDo->get('external_source.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'external_sourceTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'external_sourceTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
<div class="span6"> <div class="span6">

View File

@ -160,12 +160,12 @@ class SermondistributorViewExternal_source extends JViewLegacy
if ($this->canDo->get('external_source.clear_local_listing')) if ($this->canDo->get('external_source.clear_local_listing'))
{ {
// add Clear Local Listing button. // add Clear Local Listing button.
JToolBarHelper::custom('external_source.clearLocalListing', 'delete', '', 'COM_SERMONDISTRIBUTOR_CLEAR_LOCAL_LISTING', false); JToolBarHelper::custom('external_source.clearLocalListing', 'delete custom-button-clearlocallisting', '', 'COM_SERMONDISTRIBUTOR_CLEAR_LOCAL_LISTING', false);
} }
if ($this->canDo->get('external_source.reset_update_status')) if ($this->canDo->get('external_source.reset_update_status'))
{ {
// add Reset Update Status button. // add Reset Update Status button.
JToolBarHelper::custom('external_source.resetUpdateStatus', 'undo-2', '', 'COM_SERMONDISTRIBUTOR_RESET_UPDATE_STATUS', false); JToolBarHelper::custom('external_source.resetUpdateStatus', 'undo-2 custom-button-resetupdatestatus', '', 'COM_SERMONDISTRIBUTOR_RESET_UPDATE_STATUS', false);
} }
JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE'); JToolBarHelper::cancel('external_source.cancel', 'JTOOLBAR_CLOSE');
} }

View File

@ -25,36 +25,16 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_sermondistributor&task=external_sources.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=external_sources.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'external_sourceList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'external_sourceList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=external_sources'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=external_sources'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
@ -64,35 +44,35 @@ if ($this->saveOrder)
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php
// Add the searchtools
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<?php echo $this->loadTemplate('toolbar');?> <div class="alert alert-no-items">
<div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div>
</div>
<?php else : ?> <?php else : ?>
<?php echo $this->loadTemplate('toolbar');?> <table class="table table-striped" id="external_sourceList">
<table class="table table-striped" id="external_sourceList"> <thead><?php echo $this->loadTemplate('head');?></thead>
<thead><?php echo $this->loadTemplate('head');?></thead> <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot> <tbody><?php echo $this->loadTemplate('body');?></tbody>
<tbody><?php echo $this->loadTemplate('body');?></tbody> </table>
</table> <?php // Load the batch processing form. ?>
<?php //Load the batch processing form. ?> <?php if ($this->canCreate && $this->canEdit) : ?>
<?php if ($this->canCreate && $this->canEdit) : ?> <?php echo JHtml::_(
<?php echo JHtml::_( 'bootstrap.renderModal',
'bootstrap.renderModal', 'collapseModal',
'collapseModal', array(
array( 'title' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_OPTIONS'),
'title' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer')
'footer' => $this->loadTemplate('batch_footer') ),
), $this->loadTemplate('batch_body')
$this->loadTemplate('batch_body') ); ?>
); ?> <?php endif; ?>
<?php endif; ?> <input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -38,11 +38,8 @@ $edit = "index.php?option=com_sermondistributor&view=external_sources&task=exter
<td class="order nowrap center hidden-phone"> <td class="order nowrap center hidden-phone">
<?php if ($canDo->get('external_source.edit.state')): ?> <?php if ($canDo->get('external_source.edit.state')): ?>
<?php <?php
if ($this->saveOrder) $iconClass = '';
{ if (!$this->saveOrder)
$iconClass = ' inactive';
}
else
{ {
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
} }

View File

@ -29,7 +29,7 @@ defined('_JEXEC') or die('Restricted access');
<tr> <tr>
<?php if ($this->canEdit&& $this->canState): ?> <?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone"> <th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th> </th>
<th width="20" class="nowrap center"> <th width="20" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?> <?php echo JHtml::_('grid.checkall'); ?>
@ -43,23 +43,23 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL', 'a.description', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL', 'a.description', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL', 'a.externalsources', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL', 'a.externalsources', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL', 'a.update_method', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL', 'a.update_method', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FILETYPES_LABEL'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_FILETYPES_LABEL'); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL', 'a.build', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL', 'a.build', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php if ($this->canState): ?> <?php if ($this->canState): ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php else: ?> <?php else: ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
@ -67,6 +67,6 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th width="5" class="nowrap center hidden-phone" > <th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ID', 'a.id', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th> </th>
</tr> </tr>

View File

@ -47,10 +47,14 @@ class SermondistributorViewExternal_sources extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
@ -167,127 +171,74 @@ class SermondistributorViewExternal_sources extends JViewLegacy
JToolBarHelper::preferences('com_sermondistributor'); JToolBarHelper::preferences('com_sermondistributor');
} }
if ($this->canState) // Only load published batch if state and batch is allowed
{ if ($this->canState && $this->canBatch)
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[access]', 'batch[published]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
); );
} }
// Set Externalsources Selection // Only load Externalsources batch if create, edit, and batch is allowed
$this->externalsourcesOptions = $this->getTheExternalsourcesSelections(); if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Externalsources filter
if (SermondistributorHelper::checkArray($this->externalsourcesOptions) &&
isset($this->externalsourcesOptions[0]->value) &&
!SermondistributorHelper::checkString($this->externalsourcesOptions[0]->value))
{ {
unset($this->externalsourcesOptions[0]); // Set Externalsources Selection
} $this->externalsourcesOptions = JFormHelper::loadFieldType('externalsourcesfilterexternalsources')->options;
// Only load Externalsources filter if it has values // We do some sanitation for Externalsources filter
if (SermondistributorHelper::checkArray($this->externalsourcesOptions)) if (SermondistributorHelper::checkArray($this->externalsourcesOptions) &&
{ isset($this->externalsourcesOptions[0]->value) &&
// Externalsources Filter !SermondistributorHelper::checkString($this->externalsourcesOptions[0]->value))
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL').' -',
'filter_externalsources',
JHtml::_('select.options', $this->externalsourcesOptions, 'value', 'text', $this->state->get('filter.externalsources'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
// Externalsources Batch Selection unset($this->externalsourcesOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL').' -',
'batch[externalsources]',
JHtml::_('select.options', $this->externalsourcesOptions, 'value', 'text')
);
} }
} // Externalsources Batch Selection
JHtmlBatch_::addListSelection(
// Set Update Method Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL').' -',
$this->update_methodOptions = $this->getTheUpdate_methodSelections(); 'batch[externalsources]',
// We do some sanitation for Update Method filter JHtml::_('select.options', $this->externalsourcesOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->update_methodOptions) &&
isset($this->update_methodOptions[0]->value) &&
!SermondistributorHelper::checkString($this->update_methodOptions[0]->value))
{
unset($this->update_methodOptions[0]);
}
// Only load Update Method filter if it has values
if (SermondistributorHelper::checkArray($this->update_methodOptions))
{
// Update Method Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL').' -',
'filter_update_method',
JHtml::_('select.options', $this->update_methodOptions, 'value', 'text', $this->state->get('filter.update_method'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load Update Method batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Update Method Selection
$this->update_methodOptions = JFormHelper::loadFieldType('externalsourcesfilterupdatemethod')->options;
// We do some sanitation for Update Method filter
if (SermondistributorHelper::checkArray($this->update_methodOptions) &&
isset($this->update_methodOptions[0]->value) &&
!SermondistributorHelper::checkString($this->update_methodOptions[0]->value))
{ {
// Update Method Batch Selection unset($this->update_methodOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL').' -',
'batch[update_method]',
JHtml::_('select.options', $this->update_methodOptions, 'value', 'text')
);
} }
} // Update Method Batch Selection
JHtmlBatch_::addListSelection(
// Set Build Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_UPDATE_METHOD_LABEL').' -',
$this->buildOptions = $this->getTheBuildSelections(); 'batch[update_method]',
// We do some sanitation for Build filter JHtml::_('select.options', $this->update_methodOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->buildOptions) &&
isset($this->buildOptions[0]->value) &&
!SermondistributorHelper::checkString($this->buildOptions[0]->value))
{
unset($this->buildOptions[0]);
}
// Only load Build filter if it has values
if (SermondistributorHelper::checkArray($this->buildOptions))
{
// Build Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL').' -',
'filter_build',
JHtml::_('select.options', $this->buildOptions, 'value', 'text', $this->state->get('filter.build'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load Build batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Build Selection
$this->buildOptions = JFormHelper::loadFieldType('externalsourcesfilterbuild')->options;
// We do some sanitation for Build filter
if (SermondistributorHelper::checkArray($this->buildOptions) &&
isset($this->buildOptions[0]->value) &&
!SermondistributorHelper::checkString($this->buildOptions[0]->value))
{ {
// Build Batch Selection unset($this->buildOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL').' -',
'batch[build]',
JHtml::_('select.options', $this->buildOptions, 'value', 'text')
);
} }
// Build Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_BUILD_LABEL').' -',
'batch[build]',
JHtml::_('select.options', $this->buildOptions, 'value', 'text')
);
} }
} }
@ -332,7 +283,7 @@ class SermondistributorViewExternal_sources extends JViewLegacy
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.description' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL'), 'a.description' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_DESCRIPTION_LABEL'),
'a.externalsources' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL'), 'a.externalsources' => JText::_('COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCE_EXTERNALSOURCES_LABEL'),
@ -341,112 +292,4 @@ class SermondistributorViewExternal_sources extends JViewLegacy
'a.id' => JText::_('JGRID_HEADING_ID') 'a.id' => JText::_('JGRID_HEADING_ID')
); );
} }
protected function getTheExternalsourcesSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('externalsources'));
$query->from($db->quoteName('#__sermondistributor_external_source'));
$query->order($db->quoteName('externalsources') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $externalsources)
{
// Translate the externalsources selection
$text = $model->selectionTranslation($externalsources,'externalsources');
// Now add the externalsources and its text to the options array
$_filter[] = JHtml::_('select.option', $externalsources, JText::_($text));
}
return $_filter;
}
return false;
}
protected function getTheUpdate_methodSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('update_method'));
$query->from($db->quoteName('#__sermondistributor_external_source'));
$query->order($db->quoteName('update_method') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $update_method)
{
// Translate the update_method selection
$text = $model->selectionTranslation($update_method,'update_method');
// Now add the update_method and its text to the options array
$_filter[] = JHtml::_('select.option', $update_method, JText::_($text));
}
return $_filter;
}
return false;
}
protected function getTheBuildSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('build'));
$query->from($db->quoteName('#__sermondistributor_external_source'));
$query->order($db->quoteName('build') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $build)
{
// Translate the build selection
$text = $model->selectionTranslation($build,'build');
// Now add the build and its text to the options array
$_filter[] = JHtml::_('select.option', $build, JText::_($text));
}
return $_filter;
}
return false;
}
} }

View File

@ -82,7 +82,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<?php $this->tab_name = 'help_documentTab'; ?> <?php $this->tab_name = 'help_documentTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('help_document.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('help_document.edit.state') || $this->canDo->get('core.edit.created')) : ?> <?php if ($this->canDo->get('core.edit.created_by') || $this->canDo->get('core.edit.created') || $this->canDo->get('help_document.edit.state') || ($this->canDo->get('help_document.delete') && $this->canDo->get('help_document.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'help_documentTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'help_documentTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
<div class="span6"> <div class="span6">

View File

@ -25,36 +25,16 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_sermondistributor&task=help_documents.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=help_documents.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'help_documentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'help_documentList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=help_documents'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=help_documents'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
@ -64,35 +44,35 @@ if ($this->saveOrder)
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php
// Add the searchtools
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<?php echo $this->loadTemplate('toolbar');?> <div class="alert alert-no-items">
<div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div>
</div>
<?php else : ?> <?php else : ?>
<?php echo $this->loadTemplate('toolbar');?> <table class="table table-striped" id="help_documentList">
<table class="table table-striped" id="help_documentList"> <thead><?php echo $this->loadTemplate('head');?></thead>
<thead><?php echo $this->loadTemplate('head');?></thead> <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot> <tbody><?php echo $this->loadTemplate('body');?></tbody>
<tbody><?php echo $this->loadTemplate('body');?></tbody> </table>
</table> <?php // Load the batch processing form. ?>
<?php //Load the batch processing form. ?> <?php if ($this->canCreate && $this->canEdit) : ?>
<?php if ($this->canCreate && $this->canEdit) : ?> <?php echo JHtml::_(
<?php echo JHtml::_( 'bootstrap.renderModal',
'bootstrap.renderModal', 'collapseModal',
'collapseModal', array(
array( 'title' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_OPTIONS'),
'title' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENTS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer')
'footer' => $this->loadTemplate('batch_footer') ),
), $this->loadTemplate('batch_body')
$this->loadTemplate('batch_body') ); ?>
); ?> <?php endif; ?>
<?php endif; ?> <input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -38,11 +38,8 @@ $edit = "index.php?option=com_sermondistributor&view=help_documents&task=help_do
<td class="order nowrap center hidden-phone"> <td class="order nowrap center hidden-phone">
<?php if ($canDo->get('help_document.edit.state')): ?> <?php if ($canDo->get('help_document.edit.state')): ?>
<?php <?php
if ($this->saveOrder) $iconClass = '';
{ if (!$this->saveOrder)
$iconClass = ' inactive';
}
else
{ {
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
} }

View File

@ -29,7 +29,7 @@ defined('_JEXEC') or die('Restricted access');
<tr> <tr>
<?php if ($this->canEdit&& $this->canState): ?> <?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone"> <th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th> </th>
<th width="20" class="nowrap center"> <th width="20" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?> <?php echo JHtml::_('grid.checkall'); ?>
@ -43,26 +43,26 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TITLE_LABEL', 'a.title', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TITLE_LABEL', 'a.title', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL', 'a.type', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL', 'a.type', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_GROUPS_LABEL'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_GROUPS_LABEL'); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL', 'a.location', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL', 'a.location', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL', 'g.', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL', 'g.', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL', 'h.', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL', 'h.', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php if ($this->canState): ?> <?php if ($this->canState): ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php else: ?> <?php else: ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
@ -70,6 +70,6 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th width="5" class="nowrap center hidden-phone" > <th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ID', 'a.id', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th> </th>
</tr> </tr>

View File

@ -47,10 +47,14 @@ class SermondistributorViewHelp_documents extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
@ -167,30 +171,17 @@ class SermondistributorViewHelp_documents extends JViewLegacy
JToolBarHelper::preferences('com_sermondistributor'); JToolBarHelper::preferences('com_sermondistributor');
} }
if ($this->canState) // Only load published batch if state and batch is allowed
if ($this->canState && $this->canBatch)
{ {
JHtmlSidebar::addFilter( JHtmlBatch_::addListSelection(
JText::_('JOPTION_SELECT_PUBLISHED'), JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'filter_published', 'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
); );
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
} }
JHtmlSidebar::addFilter( // Only load access batch if create, edit and batch is allowed
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit) if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
@ -200,124 +191,84 @@ class SermondistributorViewHelp_documents extends JViewLegacy
); );
} }
// Set Type Selection // Only load Type batch if create, edit, and batch is allowed
$this->typeOptions = $this->getTheTypeSelections(); if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Type filter
if (SermondistributorHelper::checkArray($this->typeOptions) &&
isset($this->typeOptions[0]->value) &&
!SermondistributorHelper::checkString($this->typeOptions[0]->value))
{ {
unset($this->typeOptions[0]); // Set Type Selection
} $this->typeOptions = JFormHelper::loadFieldType('helpdocumentsfiltertype')->options;
// Only load Type filter if it has values // We do some sanitation for Type filter
if (SermondistributorHelper::checkArray($this->typeOptions)) if (SermondistributorHelper::checkArray($this->typeOptions) &&
{ isset($this->typeOptions[0]->value) &&
// Type Filter !SermondistributorHelper::checkString($this->typeOptions[0]->value))
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL').' -',
'filter_type',
JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
// Type Batch Selection unset($this->typeOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL').' -',
'batch[type]',
JHtml::_('select.options', $this->typeOptions, 'value', 'text')
);
} }
} // Type Batch Selection
JHtmlBatch_::addListSelection(
// Set Location Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL').' -',
$this->locationOptions = $this->getTheLocationSelections(); 'batch[type]',
// We do some sanitation for Location filter JHtml::_('select.options', $this->typeOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->locationOptions) &&
isset($this->locationOptions[0]->value) &&
!SermondistributorHelper::checkString($this->locationOptions[0]->value))
{
unset($this->locationOptions[0]);
}
// Only load Location filter if it has values
if (SermondistributorHelper::checkArray($this->locationOptions))
{
// Location Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL').' -',
'filter_location',
JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load Location batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Location Selection
$this->locationOptions = JFormHelper::loadFieldType('helpdocumentsfilterlocation')->options;
// We do some sanitation for Location filter
if (SermondistributorHelper::checkArray($this->locationOptions) &&
isset($this->locationOptions[0]->value) &&
!SermondistributorHelper::checkString($this->locationOptions[0]->value))
{ {
// Location Batch Selection unset($this->locationOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL').' -',
'batch[location]',
JHtml::_('select.options', $this->locationOptions, 'value', 'text')
);
} }
} // Location Batch Selection
JHtmlBatch_::addListSelection(
// Set Admin View Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_LOCATION_LABEL').' -',
$this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->options; 'batch[location]',
// We do some sanitation for Admin View filter JHtml::_('select.options', $this->locationOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->admin_viewOptions) &&
isset($this->admin_viewOptions[0]->value) &&
!SermondistributorHelper::checkString($this->admin_viewOptions[0]->value))
{
unset($this->admin_viewOptions[0]);
}
// Only load Admin View filter if it has values
if (SermondistributorHelper::checkArray($this->admin_viewOptions))
{
// Admin View Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -',
'filter_admin_view',
JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load Admin View batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Admin View Selection
$this->admin_viewOptions = JFormHelper::loadFieldType('Adminviewfolderlist')->options;
// We do some sanitation for Admin View filter
if (SermondistributorHelper::checkArray($this->admin_viewOptions) &&
isset($this->admin_viewOptions[0]->value) &&
!SermondistributorHelper::checkString($this->admin_viewOptions[0]->value))
{ {
// Admin View Batch Selection unset($this->admin_viewOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -',
'batch[admin_view]',
JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text')
);
} }
} // Admin View Batch Selection
JHtmlBatch_::addListSelection(
// Set Site View Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -',
$this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->options; 'batch[admin_view]',
// We do some sanitation for Site View filter JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->site_viewOptions) &&
isset($this->site_viewOptions[0]->value) &&
!SermondistributorHelper::checkString($this->site_viewOptions[0]->value))
{
unset($this->site_viewOptions[0]);
}
// Only load Site View filter if it has values
if (SermondistributorHelper::checkArray($this->site_viewOptions))
{
// Site View Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL').' -',
'filter_site_view',
JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load Site View batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Site View Selection
$this->site_viewOptions = JFormHelper::loadFieldType('Siteviewfolderlist')->options;
// We do some sanitation for Site View filter
if (SermondistributorHelper::checkArray($this->site_viewOptions) &&
isset($this->site_viewOptions[0]->value) &&
!SermondistributorHelper::checkString($this->site_viewOptions[0]->value))
{ {
// Site View Batch Selection unset($this->site_viewOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL').' -',
'batch[site_view]',
JHtml::_('select.options', $this->site_viewOptions, 'value', 'text')
);
} }
// Site View Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE_VIEW_LABEL').' -',
'batch[site_view]',
JHtml::_('select.options', $this->site_viewOptions, 'value', 'text')
);
} }
} }
@ -362,7 +313,7 @@ class SermondistributorViewHelp_documents extends JViewLegacy
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.title' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TITLE_LABEL'), 'a.title' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TITLE_LABEL'),
'a.type' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL'), 'a.type' => JText::_('COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TYPE_LABEL'),
@ -372,76 +323,4 @@ class SermondistributorViewHelp_documents extends JViewLegacy
'a.id' => JText::_('JGRID_HEADING_ID') 'a.id' => JText::_('JGRID_HEADING_ID')
); );
} }
protected function getTheTypeSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('type'));
$query->from($db->quoteName('#__sermondistributor_help_document'));
$query->order($db->quoteName('type') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $type)
{
// Translate the type selection
$text = $model->selectionTranslation($type,'type');
// Now add the type and its text to the options array
$_filter[] = JHtml::_('select.option', $type, JText::_($text));
}
return $_filter;
}
return false;
}
protected function getTheLocationSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('location'));
$query->from($db->quoteName('#__sermondistributor_help_document'));
$query->order($db->quoteName('location') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $location)
{
// Translate the location selection
$text = $model->selectionTranslation($location,'location');
// Now add the location and its text to the options array
$_filter[] = JHtml::_('select.option', $location, JText::_($text));
}
return $_filter;
}
return false;
}
} }

View File

@ -82,7 +82,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<?php $this->tab_name = 'local_listingTab'; ?> <?php $this->tab_name = 'local_listingTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('local_listing.delete') || $this->canDo->get('local_listing.edit.created_by') || $this->canDo->get('local_listing.edit.state') || $this->canDo->get('local_listing.edit.created')) : ?> <?php if ($this->canDo->get('local_listing.edit.created_by') || $this->canDo->get('local_listing.edit.created') || $this->canDo->get('local_listing.edit.state') || ($this->canDo->get('local_listing.delete') && $this->canDo->get('local_listing.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'local_listingTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'local_listingTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
<div class="span6"> <div class="span6">

View File

@ -25,36 +25,16 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_sermondistributor&task=local_listings.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=local_listings.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'local_listingList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'local_listingList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=local_listings'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=local_listings'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
@ -64,35 +44,35 @@ if ($this->saveOrder)
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php
// Add the searchtools
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<?php echo $this->loadTemplate('toolbar');?> <div class="alert alert-no-items">
<div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div>
</div>
<?php else : ?> <?php else : ?>
<?php echo $this->loadTemplate('toolbar');?> <table class="table table-striped" id="local_listingList">
<table class="table table-striped" id="local_listingList"> <thead><?php echo $this->loadTemplate('head');?></thead>
<thead><?php echo $this->loadTemplate('head');?></thead> <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot> <tbody><?php echo $this->loadTemplate('body');?></tbody>
<tbody><?php echo $this->loadTemplate('body');?></tbody> </table>
</table> <?php // Load the batch processing form. ?>
<?php //Load the batch processing form. ?> <?php if ($this->canCreate && $this->canEdit) : ?>
<?php if ($this->canCreate && $this->canEdit) : ?> <?php echo JHtml::_(
<?php echo JHtml::_( 'bootstrap.renderModal',
'bootstrap.renderModal', 'collapseModal',
'collapseModal', array(
array( 'title' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_OPTIONS'),
'title' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTINGS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer')
'footer' => $this->loadTemplate('batch_footer') ),
), $this->loadTemplate('batch_body')
$this->loadTemplate('batch_body') ); ?>
); ?> <?php endif; ?>
<?php endif; ?> <input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -38,11 +38,8 @@ $edit = "index.php?option=com_sermondistributor&view=local_listings&task=local_l
<td class="order nowrap center hidden-phone"> <td class="order nowrap center hidden-phone">
<?php if ($canDo->get('local_listing.edit.state')): ?> <?php if ($canDo->get('local_listing.edit.state')): ?>
<?php <?php
if ($this->saveOrder) $iconClass = '';
{ if (!$this->saveOrder)
$iconClass = ' inactive';
}
else
{ {
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
} }

View File

@ -29,7 +29,7 @@ defined('_JEXEC') or die('Restricted access');
<tr> <tr>
<?php if ($this->canEdit&& $this->canState): ?> <?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone"> <th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th> </th>
<th width="20" class="nowrap center"> <th width="20" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?> <?php echo JHtml::_('grid.checkall'); ?>
@ -43,23 +43,23 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL', 'a.build', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL', 'a.build', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_LABEL', 'a.size', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_SIZE_LABEL', 'a.size', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL', 'g.description', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL', 'g.description', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_LABEL', 'a.key', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_KEY_LABEL', 'a.key', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php if ($this->canState): ?> <?php if ($this->canState): ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php else: ?> <?php else: ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
@ -67,6 +67,6 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th width="5" class="nowrap center hidden-phone" > <th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ID', 'a.id', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_LOCAL_LISTING_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th> </th>
</tr> </tr>

View File

@ -47,10 +47,14 @@ class SermondistributorViewLocal_listings extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
@ -167,97 +171,54 @@ class SermondistributorViewLocal_listings extends JViewLegacy
JToolBarHelper::preferences('com_sermondistributor'); JToolBarHelper::preferences('com_sermondistributor');
} }
if ($this->canState) // Only load published batch if state and batch is allowed
{ if ($this->canState && $this->canBatch)
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'), JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[access]', 'batch[published]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
); );
} }
// Set Build Selection // Only load Build batch if create, edit, and batch is allowed
$this->buildOptions = $this->getTheBuildSelections(); if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Build filter
if (SermondistributorHelper::checkArray($this->buildOptions) &&
isset($this->buildOptions[0]->value) &&
!SermondistributorHelper::checkString($this->buildOptions[0]->value))
{ {
unset($this->buildOptions[0]); // Set Build Selection
} $this->buildOptions = JFormHelper::loadFieldType('locallistingsfilterbuild')->options;
// Only load Build filter if it has values // We do some sanitation for Build filter
if (SermondistributorHelper::checkArray($this->buildOptions)) if (SermondistributorHelper::checkArray($this->buildOptions) &&
{ isset($this->buildOptions[0]->value) &&
// Build Filter !SermondistributorHelper::checkString($this->buildOptions[0]->value))
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL').' -',
'filter_build',
JHtml::_('select.options', $this->buildOptions, 'value', 'text', $this->state->get('filter.build'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
// Build Batch Selection unset($this->buildOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL').' -',
'batch[build]',
JHtml::_('select.options', $this->buildOptions, 'value', 'text')
);
} }
} // Build Batch Selection
JHtmlBatch_::addListSelection(
// Set External Source Description Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL').' -',
$this->external_sourceDescriptionOptions = JFormHelper::loadFieldType('Externalsource')->options; 'batch[build]',
// We do some sanitation for External Source Description filter JHtml::_('select.options', $this->buildOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->external_sourceDescriptionOptions) &&
isset($this->external_sourceDescriptionOptions[0]->value) &&
!SermondistributorHelper::checkString($this->external_sourceDescriptionOptions[0]->value))
{
unset($this->external_sourceDescriptionOptions[0]);
}
// Only load External Source Description filter if it has values
if (SermondistributorHelper::checkArray($this->external_sourceDescriptionOptions))
{
// External Source Description Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL').' -',
'filter_external_source',
JHtml::_('select.options', $this->external_sourceDescriptionOptions, 'value', 'text', $this->state->get('filter.external_source'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load External Source Description batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set External Source Description Selection
$this->external_sourceDescriptionOptions = JFormHelper::loadFieldType('Externalsource')->options;
// We do some sanitation for External Source Description filter
if (SermondistributorHelper::checkArray($this->external_sourceDescriptionOptions) &&
isset($this->external_sourceDescriptionOptions[0]->value) &&
!SermondistributorHelper::checkString($this->external_sourceDescriptionOptions[0]->value))
{ {
// External Source Description Batch Selection unset($this->external_sourceDescriptionOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL').' -',
'batch[external_source]',
JHtml::_('select.options', $this->external_sourceDescriptionOptions, 'value', 'text')
);
} }
// External Source Description Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_EXTERNAL_SOURCE_LABEL').' -',
'batch[external_source]',
JHtml::_('select.options', $this->external_sourceDescriptionOptions, 'value', 'text')
);
} }
} }
@ -302,7 +263,7 @@ class SermondistributorViewLocal_listings extends JViewLegacy
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL'), 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_NAME_LABEL'),
'a.build' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL'), 'a.build' => JText::_('COM_SERMONDISTRIBUTOR_LOCAL_LISTING_BUILD_LABEL'),
@ -312,40 +273,4 @@ class SermondistributorViewLocal_listings extends JViewLegacy
'a.id' => JText::_('JGRID_HEADING_ID') 'a.id' => JText::_('JGRID_HEADING_ID')
); );
} }
protected function getTheBuildSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('build'));
$query->from($db->quoteName('#__sermondistributor_local_listing'));
$query->order($db->quoteName('build') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $build)
{
// Translate the build selection
$text = $model->selectionTranslation($build,'build');
// Now add the build and its text to the options array
$_filter[] = JHtml::_('select.option', $build, JText::_($text));
}
return $_filter;
}
return false;
}
} }

View File

@ -25,14 +25,14 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// get the needed module for translation
$model = SermondistributorHelper::getModel('external_sources');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation'); JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive'); JHtml::_('behavior.keepalive');
// get the needed module for translation
$model = SermondistributorHelper::getModel('external_sources');
?> ?>
<?php if ($this->canDo->get('manual_updater.access')): ?> <?php if ($this->canDo->get('manual_updater.access')): ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -168,7 +168,7 @@ class SermondistributorViewManual_updater extends JViewLegacy
if ($this->canDo->get('manual_updater.external_sources')) if ($this->canDo->get('manual_updater.external_sources'))
{ {
// add External Sources button. // add External Sources button.
JToolBarHelper::custom('manual_updater.gotoExternalSources', 'puzzle', '', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES', false); JToolBarHelper::custom('manual_updater.gotoExternalSources', 'puzzle custom-button-gotoexternalsources', '', 'COM_SERMONDISTRIBUTOR_EXTERNAL_SOURCES', false);
} }
// set help url for this view if found // set help url for this view if found

View File

@ -94,7 +94,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<?php $this->tab_name = 'preacherTab'; ?> <?php $this->tab_name = 'preacherTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('preacher.delete') || $this->canDo->get('preacher.edit.created_by') || $this->canDo->get('preacher.edit.state') || $this->canDo->get('preacher.edit.created')) : ?> <?php if ($this->canDo->get('preacher.edit.created_by') || $this->canDo->get('preacher.edit.created') || $this->canDo->get('preacher.edit.state') || ($this->canDo->get('preacher.delete') && $this->canDo->get('preacher.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'preacherTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_PREACHER_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'preacherTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_PREACHER_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
<div class="span6"> <div class="span6">

View File

@ -25,36 +25,16 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_sermondistributor&task=preachers.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=preachers.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'preacherList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'preacherList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=preachers'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=preachers'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
@ -64,35 +44,35 @@ if ($this->saveOrder)
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php
// Add the searchtools
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<?php echo $this->loadTemplate('toolbar');?> <div class="alert alert-no-items">
<div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div>
</div>
<?php else : ?> <?php else : ?>
<?php echo $this->loadTemplate('toolbar');?> <table class="table table-striped" id="preacherList">
<table class="table table-striped" id="preacherList"> <thead><?php echo $this->loadTemplate('head');?></thead>
<thead><?php echo $this->loadTemplate('head');?></thead> <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot> <tbody><?php echo $this->loadTemplate('body');?></tbody>
<tbody><?php echo $this->loadTemplate('body');?></tbody> </table>
</table> <?php // Load the batch processing form. ?>
<?php //Load the batch processing form. ?> <?php if ($this->canCreate && $this->canEdit) : ?>
<?php if ($this->canCreate && $this->canEdit) : ?> <?php echo JHtml::_(
<?php echo JHtml::_( 'bootstrap.renderModal',
'bootstrap.renderModal', 'collapseModal',
'collapseModal', array(
array( 'title' => JText::_('COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_OPTIONS'),
'title' => JText::_('COM_SERMONDISTRIBUTOR_PREACHERS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer')
'footer' => $this->loadTemplate('batch_footer') ),
), $this->loadTemplate('batch_body')
$this->loadTemplate('batch_body') ); ?>
); ?> <?php endif; ?>
<?php endif; ?> <input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -38,11 +38,8 @@ $edit = "index.php?option=com_sermondistributor&view=preachers&task=preacher.edi
<td class="order nowrap center hidden-phone"> <td class="order nowrap center hidden-phone">
<?php if ($canDo->get('preacher.edit.state')): ?> <?php if ($canDo->get('preacher.edit.state')): ?>
<?php <?php
if ($this->saveOrder) $iconClass = '';
{ if (!$this->saveOrder)
$iconClass = ' inactive';
}
else
{ {
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
} }

View File

@ -29,7 +29,7 @@ defined('_JEXEC') or die('Restricted access');
<tr> <tr>
<?php if ($this->canEdit&& $this->canState): ?> <?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone"> <th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th> </th>
<th width="20" class="nowrap center"> <th width="20" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?> <?php echo JHtml::_('grid.checkall'); ?>
@ -43,14 +43,14 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_PREACHER_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_PREACHER_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_PREACHERS_PREACHER_DETAILS', 'a.description', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_PREACHERS_PREACHER_DETAILS', 'a.description', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php if ($this->canState): ?> <?php if ($this->canState): ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_PREACHER_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_PREACHER_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php else: ?> <?php else: ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
@ -58,6 +58,6 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th width="5" class="nowrap center hidden-phone" > <th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_PREACHER_ID', 'a.id', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_PREACHER_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th> </th>
</tr> </tr>

View File

@ -47,10 +47,14 @@ class SermondistributorViewPreachers extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
@ -167,30 +171,17 @@ class SermondistributorViewPreachers extends JViewLegacy
JToolBarHelper::preferences('com_sermondistributor'); JToolBarHelper::preferences('com_sermondistributor');
} }
if ($this->canState) // Only load published batch if state and batch is allowed
if ($this->canState && $this->canBatch)
{ {
JHtmlSidebar::addFilter( JHtmlBatch_::addListSelection(
JText::_('JOPTION_SELECT_PUBLISHED'), JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'filter_published', 'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
); );
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
} }
JHtmlSidebar::addFilter( // Only load access batch if create, edit and batch is allowed
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit) if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
@ -242,7 +233,7 @@ class SermondistributorViewPreachers extends JViewLegacy
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('COM_SERMONDISTRIBUTOR_PREACHER_NAME_LABEL'), 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_PREACHER_NAME_LABEL'),
'a.description' => JText::_('COM_SERMONDISTRIBUTOR_PREACHER_DESCRIPTION_LABEL'), 'a.description' => JText::_('COM_SERMONDISTRIBUTOR_PREACHER_DESCRIPTION_LABEL'),

View File

@ -94,7 +94,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<?php $this->tab_name = 'seriesTab'; ?> <?php $this->tab_name = 'seriesTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('series.delete') || $this->canDo->get('series.edit.created_by') || $this->canDo->get('series.edit.state') || $this->canDo->get('series.edit.created')) : ?> <?php if ($this->canDo->get('series.edit.created_by') || $this->canDo->get('series.edit.created') || $this->canDo->get('series.edit.state') || ($this->canDo->get('series.delete') && $this->canDo->get('series.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'seriesTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_SERIES_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'seriesTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_SERIES_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
<div class="span6"> <div class="span6">

View File

@ -25,36 +25,16 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_sermondistributor&task=series_list.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=series_list.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'seriesList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'seriesList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=series_list'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=series_list'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
@ -64,35 +44,35 @@ if ($this->saveOrder)
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php
// Add the searchtools
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<?php echo $this->loadTemplate('toolbar');?> <div class="alert alert-no-items">
<div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div>
</div>
<?php else : ?> <?php else : ?>
<?php echo $this->loadTemplate('toolbar');?> <table class="table table-striped" id="seriesList">
<table class="table table-striped" id="seriesList"> <thead><?php echo $this->loadTemplate('head');?></thead>
<thead><?php echo $this->loadTemplate('head');?></thead> <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot> <tbody><?php echo $this->loadTemplate('body');?></tbody>
<tbody><?php echo $this->loadTemplate('body');?></tbody> </table>
</table> <?php // Load the batch processing form. ?>
<?php //Load the batch processing form. ?> <?php if ($this->canCreate && $this->canEdit) : ?>
<?php if ($this->canCreate && $this->canEdit) : ?> <?php echo JHtml::_(
<?php echo JHtml::_( 'bootstrap.renderModal',
'bootstrap.renderModal', 'collapseModal',
'collapseModal', array(
array( 'title' => JText::_('COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_OPTIONS'),
'title' => JText::_('COM_SERMONDISTRIBUTOR_SERIES_LIST_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer')
'footer' => $this->loadTemplate('batch_footer') ),
), $this->loadTemplate('batch_body')
$this->loadTemplate('batch_body') ); ?>
); ?> <?php endif; ?>
<?php endif; ?> <input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -38,11 +38,8 @@ $edit = "index.php?option=com_sermondistributor&view=series_list&task=series.edi
<td class="order nowrap center hidden-phone"> <td class="order nowrap center hidden-phone">
<?php if ($canDo->get('series.edit.state')): ?> <?php if ($canDo->get('series.edit.state')): ?>
<?php <?php
if ($this->saveOrder) $iconClass = '';
{ if (!$this->saveOrder)
$iconClass = ' inactive';
}
else
{ {
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
} }

View File

@ -29,7 +29,7 @@ defined('_JEXEC') or die('Restricted access');
<tr> <tr>
<?php if ($this->canEdit&& $this->canState): ?> <?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone"> <th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th> </th>
<th width="20" class="nowrap center"> <th width="20" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?> <?php echo JHtml::_('grid.checkall'); ?>
@ -43,14 +43,14 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERIES_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERIES_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JText::_('COM_SERMONDISTRIBUTOR_SERIES_DESCRIPTION_LABEL'); ?> <?php echo JText::_('COM_SERMONDISTRIBUTOR_SERIES_DESCRIPTION_LABEL'); ?>
</th> </th>
<?php if ($this->canState): ?> <?php if ($this->canState): ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERIES_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERIES_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php else: ?> <?php else: ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
@ -58,6 +58,6 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th width="5" class="nowrap center hidden-phone" > <th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERIES_ID', 'a.id', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERIES_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th> </th>
</tr> </tr>

View File

@ -47,10 +47,14 @@ class SermondistributorViewSeries_list extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
@ -167,30 +171,17 @@ class SermondistributorViewSeries_list extends JViewLegacy
JToolBarHelper::preferences('com_sermondistributor'); JToolBarHelper::preferences('com_sermondistributor');
} }
if ($this->canState) // Only load published batch if state and batch is allowed
if ($this->canState && $this->canBatch)
{ {
JHtmlSidebar::addFilter( JHtmlBatch_::addListSelection(
JText::_('JOPTION_SELECT_PUBLISHED'), JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'filter_published', 'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
); );
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
} }
JHtmlSidebar::addFilter( // Only load access batch if create, edit and batch is allowed
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit) if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
@ -242,7 +233,7 @@ class SermondistributorViewSeries_list extends JViewLegacy
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('COM_SERMONDISTRIBUTOR_SERIES_NAME_LABEL'), 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_SERIES_NAME_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID') 'a.id' => JText::_('JGRID_HEADING_ID')

View File

@ -104,7 +104,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<?php $this->tab_name = 'sermonTab'; ?> <?php $this->tab_name = 'sermonTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('sermon.delete') || $this->canDo->get('sermon.edit.created_by') || $this->canDo->get('sermon.edit.state') || $this->canDo->get('sermon.edit.created')) : ?> <?php if ($this->canDo->get('sermon.edit.created_by') || $this->canDo->get('sermon.edit.created') || $this->canDo->get('sermon.edit.state') || ($this->canDo->get('sermon.delete') && $this->canDo->get('sermon.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'sermonTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_SERMON_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'sermonTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_SERMON_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
<div class="span6"> <div class="span6">

View File

@ -25,22 +25,17 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleCategories', null, array('placeholder_text_multiple' => JText::_('JOPTION_SELECT_CATEGORY'))); JHtml::_('formbehavior.chosen', '.multiplePreachers', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_PREACHER') . ' -'));
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => JText::_('JOPTION_SELECT_ACCESS'))); JHtml::_('formbehavior.chosen', '.multipleSeries', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_SERMONDISTRIBUTOR_FILTER_SELECT_SERIES') . ' -'));
JHtml::_('formbehavior.chosen', '.multiplePreachers', null, array('placeholder_text_multiple' => JText::_('Select preachers')));
JHtml::_('formbehavior.chosen', '.multipleSource', null, array('placeholder_text_multiple' => JText::_('Select source')));
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_sermondistributor&task=sermons.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=sermons.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'sermonList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'sermonList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=sermons'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=sermons'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
@ -51,35 +46,35 @@ if ($this->saveOrder)
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php <?php
// Search tools bar // Add the searchtools
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?> ?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<div class="alert alert-no-items"> <div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div> </div>
<?php else : ?> <?php else : ?>
<table class="table table-striped" id="sermonList"> <table class="table table-striped" id="sermonList">
<thead><?php echo $this->loadTemplate('head');?></thead> <thead><?php echo $this->loadTemplate('head');?></thead>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot> <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tbody><?php echo $this->loadTemplate('body');?></tbody> <tbody><?php echo $this->loadTemplate('body');?></tbody>
</table> </table>
<?php //Load the batch processing form. ?> <?php // Load the batch processing form. ?>
<?php if ($this->canCreate && $this->canEdit) : ?> <?php if ($this->canCreate && $this->canEdit) : ?>
<?php echo JHtml::_( <?php echo JHtml::_(
'bootstrap.renderModal', 'bootstrap.renderModal',
'collapseModal', 'collapseModal',
array( array(
'title' => JText::_('COM_SERMONDISTRIBUTOR_SERMONS_BATCH_OPTIONS'), 'title' => JText::_('COM_SERMONDISTRIBUTOR_SERMONS_BATCH_OPTIONS'),
'footer' => $this->loadTemplate('batch_footer') 'footer' => $this->loadTemplate('batch_footer')
), ),
$this->loadTemplate('batch_body') $this->loadTemplate('batch_body')
); ?> ); ?>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="boxchecked" value="0" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -38,11 +38,8 @@ $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit";
<td class="order nowrap center hidden-phone"> <td class="order nowrap center hidden-phone">
<?php if ($canDo->get('sermon.edit.state')): ?> <?php if ($canDo->get('sermon.edit.state')): ?>
<?php <?php
if ($this->saveOrder) $iconClass = '';
{ if (!$this->saveOrder)
$iconClass = '';
}
else
{ {
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
} }

View File

@ -47,9 +47,13 @@ class SermondistributorViewSermons extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
@ -60,8 +64,6 @@ class SermondistributorViewSermons extends JViewLegacy
$this->canCreate = $this->canDo->get('sermon.create'); $this->canCreate = $this->canDo->get('sermon.create');
$this->canDelete = $this->canDo->get('sermon.delete'); $this->canDelete = $this->canDo->get('sermon.delete');
$this->canBatch = $this->canDo->get('core.batch'); $this->canBatch = $this->canDo->get('core.batch');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// We don't need toolbar in the modal window. // We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') if ($this->getLayout() !== 'modal')
@ -169,19 +171,17 @@ class SermondistributorViewSermons extends JViewLegacy
JToolBarHelper::preferences('com_sermondistributor'); JToolBarHelper::preferences('com_sermondistributor');
} }
if ($this->canState) // Only load published batch if state and batch is allowed
if ($this->canState && $this->canBatch)
{ {
// only load if batch allowed JHtmlBatch_::addListSelection(
if ($this->canBatch) JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
{ 'batch[published]',
JHtmlBatch_::addListSelection( JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'), );
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
} }
// Only load access batch if create, edit and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit) if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
@ -201,96 +201,84 @@ class SermondistributorViewSermons extends JViewLegacy
); );
} }
// Set Preacher Name Selection // Only load Preacher Name batch if create, edit, and batch is allowed
$this->preacherNameOptions = JFormHelper::loadFieldType('Preachers')->options; if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Preacher Name filter
if (SermondistributorHelper::checkArray($this->preacherNameOptions) &&
isset($this->preacherNameOptions[0]->value) &&
!SermondistributorHelper::checkString($this->preacherNameOptions[0]->value))
{ {
unset($this->preacherNameOptions[0]); // Set Preacher Name Selection
} $this->preacherNameOptions = JFormHelper::loadFieldType('Preachers')->options;
// Only load Preacher Name filter if it has values // We do some sanitation for Preacher Name filter
if (SermondistributorHelper::checkArray($this->preacherNameOptions)) if (SermondistributorHelper::checkArray($this->preacherNameOptions) &&
{ isset($this->preacherNameOptions[0]->value) &&
if ($this->canBatch && $this->canCreate && $this->canEdit) !SermondistributorHelper::checkString($this->preacherNameOptions[0]->value))
{ {
// Preacher Name Batch Selection unset($this->preacherNameOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL').' -',
'batch[preacher]',
JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text')
);
} }
// Preacher Name Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL').' -',
'batch[preacher]',
JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text')
);
} }
// Set Series Name Selection // Only load Series Name batch if create, edit, and batch is allowed
$this->seriesNameOptions = JFormHelper::loadFieldType('Series')->options; if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Series Name filter
if (SermondistributorHelper::checkArray($this->seriesNameOptions) &&
isset($this->seriesNameOptions[0]->value) &&
!SermondistributorHelper::checkString($this->seriesNameOptions[0]->value))
{ {
unset($this->seriesNameOptions[0]); // Set Series Name Selection
} $this->seriesNameOptions = JFormHelper::loadFieldType('Series')->options;
// Only load Series Name filter if it has values // We do some sanitation for Series Name filter
if (SermondistributorHelper::checkArray($this->seriesNameOptions)) if (SermondistributorHelper::checkArray($this->seriesNameOptions) &&
{ isset($this->seriesNameOptions[0]->value) &&
if ($this->canBatch && $this->canCreate && $this->canEdit) !SermondistributorHelper::checkString($this->seriesNameOptions[0]->value))
{ {
// Series Name Batch Selection unset($this->seriesNameOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL').' -',
'batch[series]',
JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text')
);
} }
// Series Name Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL').' -',
'batch[series]',
JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text')
);
} }
// Set Link Type Selection // Only load Link Type batch if create, edit, and batch is allowed
$this->link_typeOptions = $this->getTheLink_typeSelections(); if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Link Type filter
if (SermondistributorHelper::checkArray($this->link_typeOptions) &&
isset($this->link_typeOptions[0]->value) &&
!SermondistributorHelper::checkString($this->link_typeOptions[0]->value))
{ {
unset($this->link_typeOptions[0]); // Set Link Type Selection
} $this->link_typeOptions = JFormHelper::loadFieldType('sermonsfilterlinktype')->options;
// Only load Link Type filter if it has values // We do some sanitation for Link Type filter
if (SermondistributorHelper::checkArray($this->link_typeOptions)) if (SermondistributorHelper::checkArray($this->link_typeOptions) &&
{ isset($this->link_typeOptions[0]->value) &&
if ($this->canBatch && $this->canCreate && $this->canEdit) !SermondistributorHelper::checkString($this->link_typeOptions[0]->value))
{ {
// Link Type Batch Selection unset($this->link_typeOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL').' -',
'batch[link_type]',
JHtml::_('select.options', $this->link_typeOptions, 'value', 'text')
);
} }
// Link Type Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL').' -',
'batch[link_type]',
JHtml::_('select.options', $this->link_typeOptions, 'value', 'text')
);
} }
// Set Source Selection // Only load Source batch if create, edit, and batch is allowed
$this->sourceOptions = $this->getTheSourceSelections(); if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Source filter
if (SermondistributorHelper::checkArray($this->sourceOptions) &&
isset($this->sourceOptions[0]->value) &&
!SermondistributorHelper::checkString($this->sourceOptions[0]->value))
{ {
unset($this->sourceOptions[0]); // Set Source Selection
} $this->sourceOptions = JFormHelper::loadFieldType('sermonsfiltersource')->options;
// Only load Source filter if it has values // We do some sanitation for Source filter
if (SermondistributorHelper::checkArray($this->sourceOptions)) if (SermondistributorHelper::checkArray($this->sourceOptions) &&
{ isset($this->sourceOptions[0]->value) &&
if ($this->canBatch && $this->canCreate && $this->canEdit) !SermondistributorHelper::checkString($this->sourceOptions[0]->value))
{ {
// Source Batch Selection unset($this->sourceOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL').' -',
'batch[source]',
JHtml::_('select.options', $this->sourceOptions, 'value', 'text')
);
} }
// Source Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL').' -',
'batch[source]',
JHtml::_('select.options', $this->sourceOptions, 'value', 'text')
);
} }
} }
@ -335,7 +323,7 @@ class SermondistributorViewSermons extends JViewLegacy
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_NAME_LABEL'), 'a.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_NAME_LABEL'),
'g.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL'), 'g.name' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL'),
@ -347,76 +335,4 @@ class SermondistributorViewSermons extends JViewLegacy
'a.id' => JText::_('JGRID_HEADING_ID') 'a.id' => JText::_('JGRID_HEADING_ID')
); );
} }
protected function getTheLink_typeSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('link_type'));
$query->from($db->quoteName('#__sermondistributor_sermon'));
$query->order($db->quoteName('link_type') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $link_type)
{
// Translate the link_type selection
$text = $model->selectionTranslation($link_type,'link_type');
// Now add the link_type and its text to the options array
$_filter[] = JHtml::_('select.option', $link_type, JText::_($text));
}
return $_filter;
}
return false;
}
protected function getTheSourceSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('source'));
$query->from($db->quoteName('#__sermondistributor_sermon'));
$query->order($db->quoteName('source') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $source)
{
// Translate the source selection
$text = $model->selectionTranslation($source,'source');
// Now add the source and its text to the options array
$_filter[] = JHtml::_('select.option', $source, JText::_($text));
}
return $_filter;
}
return false;
}
} }

View File

@ -55,7 +55,7 @@ $componentParams = $this->params; // will be removed just use $this->params inst
<?php $this->tab_name = 'statisticTab'; ?> <?php $this->tab_name = 'statisticTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?> <?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('statistic.delete') || $this->canDo->get('statistic.edit.created_by') || $this->canDo->get('statistic.edit.state') || $this->canDo->get('statistic.edit.created')) : ?> <?php if ($this->canDo->get('statistic.edit.created_by') || $this->canDo->get('statistic.edit.created') || $this->canDo->get('statistic.edit.state') || ($this->canDo->get('statistic.delete') && $this->canDo->get('statistic.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'statisticTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_PUBLISHING', true)); ?> <?php echo JHtml::_('bootstrap.addTab', 'statisticTab', 'publishing', JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop"> <div class="row-fluid form-horizontal-desktop">
<div class="span6"> <div class="span6">

View File

@ -25,36 +25,16 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip'); JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect'); JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init'); JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', 'select'); JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder) if ($this->saveOrder)
{ {
$saveOrderingUrl = 'index.php?option=com_sermondistributor&task=statistics.saveOrderAjax&tmpl=component'; $saveOrderingUrl = 'index.php?option=com_sermondistributor&task=statistics.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'statisticList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); JHtml::_('sortablelist.sortable', 'statisticList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
} }
?> ?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=statistics'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=statistics'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?> <?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2"> <div id="j-sidebar-container" class="span2">
@ -64,35 +44,35 @@ if ($this->saveOrder)
<?php else : ?> <?php else : ?>
<div id="j-main-container"> <div id="j-main-container">
<?php endif; ?> <?php endif; ?>
<?php
// Add the searchtools
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<?php echo $this->loadTemplate('toolbar');?> <div class="alert alert-no-items">
<div class="alert alert-no-items"> <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> </div>
</div>
<?php else : ?> <?php else : ?>
<?php echo $this->loadTemplate('toolbar');?> <table class="table table-striped" id="statisticList">
<table class="table table-striped" id="statisticList"> <thead><?php echo $this->loadTemplate('head');?></thead>
<thead><?php echo $this->loadTemplate('head');?></thead> <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot> <tbody><?php echo $this->loadTemplate('body');?></tbody>
<tbody><?php echo $this->loadTemplate('body');?></tbody> </table>
</table> <?php // Load the batch processing form. ?>
<?php //Load the batch processing form. ?> <?php if ($this->canCreate && $this->canEdit) : ?>
<?php if ($this->canCreate && $this->canEdit) : ?> <?php echo JHtml::_(
<?php echo JHtml::_( 'bootstrap.renderModal',
'bootstrap.renderModal', 'collapseModal',
'collapseModal', array(
array( 'title' => JText::_('COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_OPTIONS'),
'title' => JText::_('COM_SERMONDISTRIBUTOR_STATISTICS_BATCH_OPTIONS'), 'footer' => $this->loadTemplate('batch_footer')
'footer' => $this->loadTemplate('batch_footer') ),
), $this->loadTemplate('batch_body')
$this->loadTemplate('batch_body') ); ?>
); ?> <?php endif; ?>
<?php endif; ?> <input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div> </div>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value="" /> <input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?> <?php echo JHtml::_('form.token'); ?>
</form> </form>

View File

@ -38,11 +38,8 @@ $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.e
<td class="order nowrap center hidden-phone"> <td class="order nowrap center hidden-phone">
<?php if ($canDo->get('statistic.edit.state')): ?> <?php if ($canDo->get('statistic.edit.state')): ?>
<?php <?php
if ($this->saveOrder) $iconClass = '';
{ if (!$this->saveOrder)
$iconClass = ' inactive';
}
else
{ {
$iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
} }

View File

@ -29,7 +29,7 @@ defined('_JEXEC') or die('Restricted access');
<tr> <tr>
<?php if ($this->canEdit&& $this->canState): ?> <?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone"> <th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> <?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th> </th>
<th width="20" class="nowrap center"> <th width="20" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?> <?php echo JHtml::_('grid.checkall'); ?>
@ -43,23 +43,23 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_LABEL', 'a.filename', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_LABEL', 'a.filename', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL', 'g.name', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL', 'g.name', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL', 'h.name', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL', 'h.name', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap" > <th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL', 'i.name', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL', 'i.name', $this->listDirn, $this->listOrder); ?>
</th> </th>
<th class="nowrap hidden-phone" > <th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_COUNTER_LABEL', 'a.counter', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_COUNTER_LABEL', 'a.counter', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php if ($this->canState): ?> <?php if ($this->canState): ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th> </th>
<?php else: ?> <?php else: ?>
<th width="10" class="nowrap center" > <th width="10" class="nowrap center" >
@ -67,6 +67,6 @@ defined('_JEXEC') or die('Restricted access');
</th> </th>
<?php endif; ?> <?php endif; ?>
<th width="5" class="nowrap center hidden-phone" > <th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_ID', 'a.id', $this->listDirn, $this->listOrder); ?> <?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_STATISTIC_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th> </th>
</tr> </tr>

View File

@ -47,10 +47,14 @@ class SermondistributorViewStatistics extends JViewLegacy
$this->pagination = $this->get('Pagination'); $this->pagination = $this->get('Pagination');
$this->state = $this->get('State'); $this->state = $this->get('State');
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause. // Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc')); $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value // set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance())); $this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions // get global action permissions
@ -167,30 +171,17 @@ class SermondistributorViewStatistics extends JViewLegacy
JToolBarHelper::preferences('com_sermondistributor'); JToolBarHelper::preferences('com_sermondistributor');
} }
if ($this->canState) // Only load published batch if state and batch is allowed
if ($this->canState && $this->canBatch)
{ {
JHtmlSidebar::addFilter( JHtmlBatch_::addListSelection(
JText::_('JOPTION_SELECT_PUBLISHED'), JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'filter_published', 'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
); );
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
} }
JHtmlSidebar::addFilter( // Only load access batch if create, edit and batch is allowed
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit) if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
JHtmlBatch_::addListSelection( JHtmlBatch_::addListSelection(
@ -200,94 +191,64 @@ class SermondistributorViewStatistics extends JViewLegacy
); );
} }
// Set Sermon Name Selection // Only load Sermon Name batch if create, edit, and batch is allowed
$this->sermonNameOptions = JFormHelper::loadFieldType('Sermon')->options; if ($this->canBatch && $this->canCreate && $this->canEdit)
// We do some sanitation for Sermon Name filter
if (SermondistributorHelper::checkArray($this->sermonNameOptions) &&
isset($this->sermonNameOptions[0]->value) &&
!SermondistributorHelper::checkString($this->sermonNameOptions[0]->value))
{ {
unset($this->sermonNameOptions[0]); // Set Sermon Name Selection
} $this->sermonNameOptions = JFormHelper::loadFieldType('Sermon')->options;
// Only load Sermon Name filter if it has values // We do some sanitation for Sermon Name filter
if (SermondistributorHelper::checkArray($this->sermonNameOptions)) if (SermondistributorHelper::checkArray($this->sermonNameOptions) &&
{ isset($this->sermonNameOptions[0]->value) &&
// Sermon Name Filter !SermondistributorHelper::checkString($this->sermonNameOptions[0]->value))
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL').' -',
'filter_sermon',
JHtml::_('select.options', $this->sermonNameOptions, 'value', 'text', $this->state->get('filter.sermon'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{ {
// Sermon Name Batch Selection unset($this->sermonNameOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL').' -',
'batch[sermon]',
JHtml::_('select.options', $this->sermonNameOptions, 'value', 'text')
);
} }
} // Sermon Name Batch Selection
JHtmlBatch_::addListSelection(
// Set Preacher Name Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL').' -',
$this->preacherNameOptions = JFormHelper::loadFieldType('Preachers')->options; 'batch[sermon]',
// We do some sanitation for Preacher Name filter JHtml::_('select.options', $this->sermonNameOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->preacherNameOptions) &&
isset($this->preacherNameOptions[0]->value) &&
!SermondistributorHelper::checkString($this->preacherNameOptions[0]->value))
{
unset($this->preacherNameOptions[0]);
}
// Only load Preacher Name filter if it has values
if (SermondistributorHelper::checkArray($this->preacherNameOptions))
{
// Preacher Name Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL').' -',
'filter_preacher',
JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text', $this->state->get('filter.preacher'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load Preacher Name batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Preacher Name Selection
$this->preacherNameOptions = JFormHelper::loadFieldType('Preachers')->options;
// We do some sanitation for Preacher Name filter
if (SermondistributorHelper::checkArray($this->preacherNameOptions) &&
isset($this->preacherNameOptions[0]->value) &&
!SermondistributorHelper::checkString($this->preacherNameOptions[0]->value))
{ {
// Preacher Name Batch Selection unset($this->preacherNameOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL').' -',
'batch[preacher]',
JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text')
);
} }
} // Preacher Name Batch Selection
JHtmlBatch_::addListSelection(
// Set Series Name Selection '- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_PREACHER_LABEL').' -',
$this->seriesNameOptions = JFormHelper::loadFieldType('Series')->options; 'batch[preacher]',
// We do some sanitation for Series Name filter JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text')
if (SermondistributorHelper::checkArray($this->seriesNameOptions) &&
isset($this->seriesNameOptions[0]->value) &&
!SermondistributorHelper::checkString($this->seriesNameOptions[0]->value))
{
unset($this->seriesNameOptions[0]);
}
// Only load Series Name filter if it has values
if (SermondistributorHelper::checkArray($this->seriesNameOptions))
{
// Series Name Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL').' -',
'filter_series',
JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text', $this->state->get('filter.series'))
); );
}
if ($this->canBatch && $this->canCreate && $this->canEdit) // Only load Series Name batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Series Name Selection
$this->seriesNameOptions = JFormHelper::loadFieldType('Series')->options;
// We do some sanitation for Series Name filter
if (SermondistributorHelper::checkArray($this->seriesNameOptions) &&
isset($this->seriesNameOptions[0]->value) &&
!SermondistributorHelper::checkString($this->seriesNameOptions[0]->value))
{ {
// Series Name Batch Selection unset($this->seriesNameOptions[0]);
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL').' -',
'batch[series]',
JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text')
);
} }
// Series Name Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERIES_LABEL').' -',
'batch[series]',
JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text')
);
} }
} }
@ -332,7 +293,7 @@ class SermondistributorViewStatistics extends JViewLegacy
protected function getSortFields() protected function getSortFields()
{ {
return array( return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'), 'a.published' => JText::_('JSTATUS'),
'a.filename' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_LABEL'), 'a.filename' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_FILENAME_LABEL'),
'g.name' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL'), 'g.name' => JText::_('COM_SERMONDISTRIBUTOR_STATISTIC_SERMON_LABEL'),

View File

@ -1800,7 +1800,7 @@ class com_sermondistributorInstallerScript
echo '<a target="_blank" href="https://www.vdm.io/" title="Sermon Distributor"> echo '<a target="_blank" href="https://www.vdm.io/" title="Sermon Distributor">
<img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/> <img src="components/com_sermondistributor/assets/images/vdm-component.jpg"/>
</a> </a>
<h3>Upgrade to Version 2.0.3 Was Successful! Let us know if anything is not working as expected.</h3>'; <h3>Upgrade to Version 2.0.4 Was Successful! Let us know if anything is not working as expected.</h3>';
// Set db if not set already. // Set db if not set already.
if (!isset($db)) if (!isset($db))

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_SERMONDISTRIBUTOR</name> <name>COM_SERMONDISTRIBUTOR</name>
<creationDate>30th May, 2020</creationDate> <creationDate>30th November, 2020</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail> <authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io/</authorUrl> <authorUrl>https://www.vdm.io/</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright> <copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license> <license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>2.0.3</version> <version>2.0.4</version>
<description><![CDATA[ <description><![CDATA[
<h1>Sermon Distributor (v.2.0.3)</h1> <h1>Sermon Distributor (v.2.0.4)</h1>
<div style="clear: both;"></div> <div style="clear: both;"></div>
<p>Distributor is a highly advanced sermon distributor that runs on the [Joomla 3.x](http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox.</p> <p>Distributor is a highly advanced sermon distributor that runs on the [Joomla 3.x](http://www.joomla.org) framework. You can link a shared folder from Dropbox to the component and use Dropbox as your file host, not to mention the advanced auto builder that gives you the ability to simply load sermons to your website by only adding them to Dropbox.</p>
<p>Created by <a href="https://www.vdm.io/" target="_blank">Llewellyn van der Merwe</a><br /><small>Development started 22nd October, 2015</small></p> <p>Created by <a href="https://www.vdm.io/" target="_blank">Llewellyn van der Merwe</a><br /><small>Development started 22nd October, 2015</small></p>

View File

@ -50,4 +50,21 @@
<maintainerurl>https://www.vdm.io/</maintainerurl> <maintainerurl>https://www.vdm.io/</maintainerurl>
<targetplatform name="joomla" version="3.*"/> <targetplatform name="joomla" version="3.*"/>
</update> </update>
<update>
<name>Sermon Distributor</name>
<description>A sermon distributor that links to Dropbox.</description>
<element>com_sermondistributor</element>
<type>component</type>
<version>2.0.4</version>
<infourl title="Sermon Distributor!">https://www.vdm.io/</infourl>
<downloads>
<downloadurl type="full" format="zip">http://domain.com/demo.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>https://www.vdm.io/</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
</updates> </updates>

View File

@ -26,6 +26,7 @@
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Language; use Joomla\CMS\Language\Language;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper; use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper; use Joomla\Utilities\ArrayHelper;
@ -2018,9 +2019,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice fancy date * Change to nice fancy date
*/ */
public static function fancyDate($date) public static function fancyDate($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2030,9 +2031,9 @@ abstract class SermondistributorHelper
/** /**
* get date based in period past * get date based in period past
*/ */
public static function fancyDynamicDate($date) public static function fancyDynamicDate($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2056,9 +2057,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice fancy day time and date * Change to nice fancy day time and date
*/ */
public static function fancyDayTimeDate($time) public static function fancyDayTimeDate($time, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($time)) if ($check_stamp && !self::isValidTimeStamp($time))
{ {
$time = strtotime($time); $time = strtotime($time);
} }
@ -2068,9 +2069,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice fancy time and date * Change to nice fancy time and date
*/ */
public static function fancyDateTime($time) public static function fancyDateTime($time, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($time)) if ($check_stamp && !self::isValidTimeStamp($time))
{ {
$time = strtotime($time); $time = strtotime($time);
} }
@ -2080,9 +2081,9 @@ abstract class SermondistributorHelper
/** /**
* Change to nice hour:minutes time * Change to nice hour:minutes time
*/ */
public static function fancyTime($time) public static function fancyTime($time, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($time)) if ($check_stamp && !self::isValidTimeStamp($time))
{ {
$time = strtotime($time); $time = strtotime($time);
} }
@ -2092,9 +2093,9 @@ abstract class SermondistributorHelper
/** /**
* set the date day as Sunday through Saturday * set the date day as Sunday through Saturday
*/ */
public static function setDayName($date) public static function setDayName($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2104,9 +2105,9 @@ abstract class SermondistributorHelper
/** /**
* set the date month as January through December * set the date month as January through December
*/ */
public static function setMonthName($date) public static function setMonthName($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2116,9 +2117,9 @@ abstract class SermondistributorHelper
/** /**
* set the date day as 1st * set the date day as 1st
*/ */
public static function setDay($date) public static function setDay($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2128,9 +2129,9 @@ abstract class SermondistributorHelper
/** /**
* set the date month as 5 * set the date month as 5
*/ */
public static function setMonth($date) public static function setMonth($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2140,9 +2141,9 @@ abstract class SermondistributorHelper
/** /**
* set the date year as 2004 (for charts) * set the date year as 2004 (for charts)
*/ */
public static function setYear($date) public static function setYear($date, $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2152,9 +2153,9 @@ abstract class SermondistributorHelper
/** /**
* set the date as 2004/05 (for charts) * set the date as 2004/05 (for charts)
*/ */
public static function setYearMonth($date, $spacer = '/') public static function setYearMonth($date, $spacer = '/', $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
@ -2164,15 +2165,27 @@ abstract class SermondistributorHelper
/** /**
* set the date as 2004/05/03 (for charts) * set the date as 2004/05/03 (for charts)
*/ */
public static function setYearMonthDay($date, $spacer = '/') public static function setYearMonthDay($date, $spacer = '/', $check_stamp = true)
{ {
if (!self::isValidTimeStamp($date)) if ($check_stamp && !self::isValidTimeStamp($date))
{ {
$date = strtotime($date); $date = strtotime($date);
} }
return date('Y' . $spacer . 'm' . $spacer . 'd', $date); return date('Y' . $spacer . 'm' . $spacer . 'd', $date);
} }
/**
* set the date as 03/05/2004
*/
public static function setDayMonthYear($date, $spacer = '/', $check_stamp = true)
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('d' . $spacer . 'm' . $spacer . 'Y', $date);
}
/** /**
* Check if string is a valid time stamp * Check if string is a valid time stamp
*/ */
@ -2183,6 +2196,16 @@ abstract class SermondistributorHelper
&& ($timestamp >= ~PHP_INT_MAX); && ($timestamp >= ~PHP_INT_MAX);
} }
/**
* Check if string is a valid date
* https://www.php.net/manual/en/function.checkdate.php#113205
*/
public static function isValidateDate($date, $format = 'Y-m-d H:i:s')
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
/** /**
* Workers to load tasks * Workers to load tasks

View File

@ -203,7 +203,7 @@ class SermondistributorModelSermon extends JModelItem
if ($e->getCode() == 404) if ($e->getCode() == 404)
{ {
// Need to go thru the error handler to allow Redirect to work. // Need to go thru the error handler to allow Redirect to work.
JError::raiseWaring(404, $e->getMessage()); JError::raiseWarning(404, $e->getMessage());
} }
else else
{ {

View File

@ -25,6 +25,7 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<div class="uk-alert uk-alert-danger" data-uk-alert> <div class="uk-alert uk-alert-danger" data-uk-alert>

View File

@ -25,9 +25,10 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// Set the heading of the page // Set the heading of the page
$heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading'):(isset($this->menu->title)) ? $this->menu->title:''; $heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading'):(isset($this->menu->title)) ? $this->menu->title:'';
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->params->get('show_page_heading')): ?> <?php if ($this->params->get('show_page_heading')): ?>

View File

@ -25,6 +25,7 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->category): ?> <?php if ($this->category): ?>

View File

@ -16,7 +16,7 @@
type="category" type="category"
name="id" name="id"
label="COM_SERMONDISTRIBUTOR_CONFIG_CATEGORY_REQUEST_ID_LABEL" label="COM_SERMONDISTRIBUTOR_CONFIG_CATEGORY_REQUEST_ID_LABEL"
extension="com_sermondistributor.sermons" extension="com_sermondistributor.sermon"
required="false" required="false"
default="" default=""
description="COM_SERMONDISTRIBUTOR_CONFIG_CATEGORY_REQUEST_ID_DESCRIPTION" description="COM_SERMONDISTRIBUTOR_CONFIG_CATEGORY_REQUEST_ID_DESCRIPTION"

View File

@ -25,6 +25,7 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->preacher): ?> <?php if ($this->preacher): ?>

View File

@ -25,9 +25,10 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// Set the heading of the page // Set the heading of the page
$heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading'):(isset($this->menu->title)) ? $this->menu->title:''; $heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading'):(isset($this->menu->title)) ? $this->menu->title:'';
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->params->get('show_page_heading')): ?> <?php if ($this->params->get('show_page_heading')): ?>

View File

@ -25,6 +25,7 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->series): ?> <?php if ($this->series): ?>

View File

@ -25,9 +25,10 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
// Set the heading of the page // Set the heading of the page
$heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading'):(isset($this->menu->title)) ? $this->menu->title:''; $heading = ($this->params->get('page_heading')) ? $this->params->get('page_heading'):(isset($this->menu->title)) ? $this->menu->title:'';
?> ?>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?php echo JRoute::_('index.php?option=com_sermondistributor'); ?>" method="post" name="adminForm" id="adminForm">
<?php if ($this->params->get('show_page_heading')): ?> <?php if ($this->params->get('show_page_heading')): ?>

View File

@ -25,6 +25,7 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); defined('_JEXEC') or die('Restricted access');
?> ?>
<?php if ($this->item): ?> <?php if ($this->item): ?>