Insured that empty preacher, series, category are not loaded to the front.

This commit is contained in:
Llewellyn van der Merwe 2016-04-11 18:50:51 +01:00
parent 8eec1dd5e0
commit 85297fa52a
260 changed files with 2108 additions and 2000 deletions

View File

@ -23,7 +23,7 @@ The best way to see all your options is to install this component on you Joomla
+ *Author*: [Llewellyn van der Merwe] (mailto:llewellyn@vdm.io) + *Author*: [Llewellyn van der Merwe] (mailto:llewellyn@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*: 19th March, 2016 + *Last Build*: 11th April, 2016
+ *Version*: 1.3.2 + *Version*: 1.3.2
+ *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
@ -36,7 +36,7 @@ due to [Automated Component Builder] (https://www.vdm.io/joomla-component-builde
> (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*: **48065** + *Line count*: **48173**
+ *File count*: **351** + *File count*: **351**
+ *Folder count*: **79** + *Folder count*: **79**

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage admin.css @subpackage admin.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage dashboard.css @subpackage dashboard.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_document.css @subpackage help_document.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_documents.css @subpackage help_documents.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preacher.css @subpackage preacher.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preachers.css @subpackage preachers.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series.css @subpackage series.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series_list.css @subpackage series_list.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermon.css @subpackage sermon.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermons.css @subpackage sermons.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage statistic.css @subpackage statistic.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage statistics.css @subpackage statistics.css

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<config> <config>
<fieldset <fieldset
addrulepath="/administrator/components/com_sermondistributor/models/rules"
addfieldpath="/administrator/components/com_sermondistributor/models/fields"
name="global_config" name="global_config"
label="COM_SERMONDISTRIBUTOR_CONFIG_GLOBAL_LABEL" label="COM_SERMONDISTRIBUTOR_CONFIG_GLOBAL_LABEL"
description="COM_SERMONDISTRIBUTOR_CONFIG_GLOBAL_DESC"> description="COM_SERMONDISTRIBUTOR_CONFIG_GLOBAL_DESC">
@ -355,7 +357,7 @@
description="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_LOAD_DESC" description="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_LOAD_DESC"
class="btn-group btn-group-yesno" class="btn-group btn-group-yesno"
default=""> default="">
<!-- [Interpretation 11424] Option Set. --> <!-- [Interpretation 11581] Option Set. -->
<option value=""> <option value="">
COM_SERMONDISTRIBUTOR_CONFIG_AUTO_LOAD</option>" COM_SERMONDISTRIBUTOR_CONFIG_AUTO_LOAD</option>"
<option value="1"> <option value="1">
@ -371,7 +373,7 @@
description="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_MIN_DESC" description="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_MIN_DESC"
class="btn-group btn-group-yesno" class="btn-group btn-group-yesno"
default=""> default="">
<!-- [Interpretation 11449] Option Set. --> <!-- [Interpretation 11606] Option Set. -->
<option value=""> <option value="">
COM_SERMONDISTRIBUTOR_CONFIG_NO</option>" COM_SERMONDISTRIBUTOR_CONFIG_NO</option>"
<option value=".min"> <option value=".min">
@ -383,7 +385,7 @@
description="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_STYLE_DESC" description="COM_SERMONDISTRIBUTOR_CONFIG_UIKIT_STYLE_DESC"
class="btn-group btn-group-yesno" class="btn-group btn-group-yesno"
default=""> default="">
<!-- [Interpretation 11470] Option Set. --> <!-- [Interpretation 11627] Option Set. -->
<option value=""> <option value="">
COM_SERMONDISTRIBUTOR_CONFIG_FLAT_LOAD</option>" COM_SERMONDISTRIBUTOR_CONFIG_FLAT_LOAD</option>"
<option value=".almost-flat"> <option value=".almost-flat">

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage controller.php @subpackage controller.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage ajax.json.php @subpackage ajax.json.php
@ -62,10 +62,11 @@ class SermondistributorControllerAjax extends JControllerLegacy
case 'checkDropboxListing': case 'checkDropboxListing':
try try
{ {
$viewValue = $jinput->get('view', NULL, 'INT'); $returnRaw = $jinput->get('raw', false, 'BOOLEAN');
if($viewValue && $user->id != 0) $fromviewValue = $jinput->get('fromview', NULL, 'INT');
if($fromviewValue && $user->id != 0)
{ {
$result = $this->getModel('ajax')->dropbox($viewValue); $result = $this->getModel('ajax')->dropbox($fromviewValue);
} }
else else
{ {
@ -75,6 +76,10 @@ class SermondistributorControllerAjax extends JControllerLegacy
{ {
echo $_GET['callback'] . "(".json_encode($result).");"; echo $_GET['callback'] . "(".json_encode($result).");";
} }
elseif($returnRaw)
{
echo json_encode($result);
}
else else
{ {
echo "(".json_encode($result).");"; echo "(".json_encode($result).");";
@ -95,6 +100,7 @@ class SermondistributorControllerAjax extends JControllerLegacy
case 'updateDropboxListing': case 'updateDropboxListing':
try try
{ {
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$typeValue = $jinput->get('type', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'INT');
if($typeValue && $user->id != 0) if($typeValue && $user->id != 0)
{ {
@ -108,6 +114,10 @@ class SermondistributorControllerAjax extends JControllerLegacy
{ {
echo $_GET['callback'] . "(".json_encode($result).");"; echo $_GET['callback'] . "(".json_encode($result).");";
} }
elseif($returnRaw)
{
echo json_encode($result);
}
else else
{ {
echo "(".json_encode($result).");"; echo "(".json_encode($result).");";
@ -128,6 +138,7 @@ class SermondistributorControllerAjax extends JControllerLegacy
case 'getUpdateProgress': case 'getUpdateProgress':
try try
{ {
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$typeValue = $jinput->get('type', NULL, 'INT'); $typeValue = $jinput->get('type', NULL, 'INT');
if($typeValue && $user->id != 0) if($typeValue && $user->id != 0)
{ {
@ -141,6 +152,10 @@ class SermondistributorControllerAjax extends JControllerLegacy
{ {
echo $_GET['callback'] . "(".json_encode($result).");"; echo $_GET['callback'] . "(".json_encode($result).");";
} }
elseif($returnRaw)
{
echo json_encode($result);
}
else else
{ {
echo "(".json_encode($result).");"; echo "(".json_encode($result).");";

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help.php @subpackage help.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_document.php @subpackage help_document.php
@ -60,13 +60,13 @@ class SermondistributorControllerHelp_document extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// [Interpretation 8527] Access check. // [Interpretation 8642] Access check.
$access = JFactory::getUser()->authorise('help_document.access', 'com_sermondistributor'); $access = JFactory::getUser()->authorise('help_document.access', 'com_sermondistributor');
if (!$access) if (!$access)
{ {
return false; return false;
} }
// [Interpretation 8538] In the absense of better information, revert to the component permissions. // [Interpretation 8653] In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('help_document.create', $this->option); return JFactory::getUser()->authorise('help_document.create', $this->option);
} }
@ -82,13 +82,13 @@ class SermondistributorControllerHelp_document extends JControllerForm
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 8681] get user object. // [Interpretation 8796] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8683] get record id. // [Interpretation 8798] get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// [Interpretation 8690] Access check. // [Interpretation 8805] Access check.
$access = ($user->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_sermondistributor')); $access = ($user->authorise('help_document.access', 'com_sermondistributor.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_sermondistributor'));
if (!$access) if (!$access)
{ {
@ -97,17 +97,17 @@ class SermondistributorControllerHelp_document extends JControllerForm
if ($recordId) if ($recordId)
{ {
// [Interpretation 8699] The record has been set. Check the record permissions. // [Interpretation 8814] The record has been set. Check the record permissions.
$permission = $user->authorise('help_document.edit', 'com_sermondistributor.help_document.' . (int) $recordId); $permission = $user->authorise('help_document.edit', 'com_sermondistributor.help_document.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
if ($user->authorise('help_document.edit.own', 'com_sermondistributor.help_document.' . $recordId)) if ($user->authorise('help_document.edit.own', 'com_sermondistributor.help_document.' . $recordId))
{ {
// [Interpretation 8721] Now test the owner is the user. // [Interpretation 8836] Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId)) if (empty($ownerId))
{ {
// [Interpretation 8725] Need to do a lookup from the model. // [Interpretation 8840] Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId); $record = $this->getModel()->getItem($recordId);
if (empty($record)) if (empty($record))
@ -117,7 +117,7 @@ class SermondistributorControllerHelp_document extends JControllerForm
$ownerId = $record->created_by; $ownerId = $record->created_by;
} }
// [Interpretation 8733] If the owner matches 'me' then allow. // [Interpretation 8848] If the owner matches 'me' then allow.
if ($ownerId == $user->id) if ($ownerId == $user->id)
{ {
if ($user->authorise('help_document.edit.own', 'com_sermondistributor')) if ($user->authorise('help_document.edit.own', 'com_sermondistributor'))
@ -129,7 +129,7 @@ class SermondistributorControllerHelp_document extends JControllerForm
return false; return false;
} }
} }
// [Interpretation 8755] Since there is no permission, revert to the component permissions. // [Interpretation 8870] Since there is no permission, revert to the component permissions.
return $user->authorise('help_document.edit', $this->option); return $user->authorise('help_document.edit', $this->option);
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_documents.php @subpackage help_documents.php
@ -48,29 +48,29 @@ class SermondistributorControllerHelp_documents extends JControllerAdmin
public function exportData() public function exportData()
{ {
// [Interpretation 6595] Check for request forgeries // [Interpretation 6705] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6597] check if export is allowed for this user. // [Interpretation 6707] check if export is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('help_document.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) if ($user->authorise('help_document.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
{ {
// [Interpretation 6601] Get the input // [Interpretation 6711] Get the input
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// [Interpretation 6604] Sanitize the input // [Interpretation 6714] Sanitize the input
JArrayHelper::toInteger($pks); JArrayHelper::toInteger($pks);
// [Interpretation 6606] Get the model // [Interpretation 6716] Get the model
$model = $this->getModel('Help_documents'); $model = $this->getModel('Help_documents');
// [Interpretation 6608] get the data to export // [Interpretation 6718] get the data to export
$data = $model->getExportData($pks); $data = $model->getExportData($pks);
if (SermondistributorHelper::checkArray($data)) if (SermondistributorHelper::checkArray($data))
{ {
// [Interpretation 6612] now set the data to the spreadsheet // [Interpretation 6722] now set the data to the spreadsheet
$date = JFactory::getDate(); $date = JFactory::getDate();
SermondistributorHelper::xls($data,'Help_documents_'.$date->format('jS_F_Y'),'Help documents exported ('.$date->format('jS F, Y').')','help documents'); SermondistributorHelper::xls($data,'Help_documents_'.$date->format('jS_F_Y'),'Help documents exported ('.$date->format('jS F, Y').')','help documents');
} }
} }
// [Interpretation 6617] Redirect to the list screen with error. // [Interpretation 6727] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error');
return; return;
@ -79,31 +79,31 @@ class SermondistributorControllerHelp_documents extends JControllerAdmin
public function importData() public function importData()
{ {
// [Interpretation 6626] Check for request forgeries // [Interpretation 6736] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6628] check if import is allowed for this user. // [Interpretation 6738] check if import is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('help_document.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) if ($user->authorise('help_document.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
{ {
// [Interpretation 6632] Get the import model // [Interpretation 6742] Get the import model
$model = $this->getModel('Help_documents'); $model = $this->getModel('Help_documents');
// [Interpretation 6634] get the headers to import // [Interpretation 6744] get the headers to import
$headers = $model->getExImPortHeaders(); $headers = $model->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
// [Interpretation 6638] Load headers to session. // [Interpretation 6748] Load headers to session.
$session = JFactory::getSession(); $session = JFactory::getSession();
$headers = json_encode($headers); $headers = json_encode($headers);
$session->set('help_document_VDM_IMPORTHEADERS', $headers); $session->set('help_document_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'help_documents'); $session->set('backto_VDM_IMPORT', 'help_documents');
$session->set('dataType_VDM_IMPORTINTO', 'help_document'); $session->set('dataType_VDM_IMPORTINTO', 'help_document');
// [Interpretation 6644] Redirect to import view. // [Interpretation 6754] Redirect to import view.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_HELP_DOCUMENTS');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
return; return;
} }
} }
// [Interpretation 6656] Redirect to the list screen with error. // [Interpretation 6766] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=help_documents', false), $message, 'error');
return; return;

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage import.php @subpackage import.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preacher.php @subpackage preacher.php
@ -60,13 +60,13 @@ class SermondistributorControllerPreacher extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// [Interpretation 8527] Access check. // [Interpretation 8642] Access check.
$access = JFactory::getUser()->authorise('preacher.access', 'com_sermondistributor'); $access = JFactory::getUser()->authorise('preacher.access', 'com_sermondistributor');
if (!$access) if (!$access)
{ {
return false; return false;
} }
// [Interpretation 8538] In the absense of better information, revert to the component permissions. // [Interpretation 8653] In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('preacher.create', $this->option); return JFactory::getUser()->authorise('preacher.create', $this->option);
} }
@ -82,13 +82,13 @@ class SermondistributorControllerPreacher extends JControllerForm
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 8681] get user object. // [Interpretation 8796] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8683] get record id. // [Interpretation 8798] get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// [Interpretation 8690] Access check. // [Interpretation 8805] Access check.
$access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $recordId) && $user->authorise('preacher.access', 'com_sermondistributor')); $access = ($user->authorise('preacher.access', 'com_sermondistributor.preacher.' . (int) $recordId) && $user->authorise('preacher.access', 'com_sermondistributor'));
if (!$access) if (!$access)
{ {
@ -97,17 +97,17 @@ class SermondistributorControllerPreacher extends JControllerForm
if ($recordId) if ($recordId)
{ {
// [Interpretation 8699] The record has been set. Check the record permissions. // [Interpretation 8814] The record has been set. Check the record permissions.
$permission = $user->authorise('preacher.edit', 'com_sermondistributor.preacher.' . (int) $recordId); $permission = $user->authorise('preacher.edit', 'com_sermondistributor.preacher.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
if ($user->authorise('preacher.edit.own', 'com_sermondistributor.preacher.' . $recordId)) if ($user->authorise('preacher.edit.own', 'com_sermondistributor.preacher.' . $recordId))
{ {
// [Interpretation 8721] Now test the owner is the user. // [Interpretation 8836] Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId)) if (empty($ownerId))
{ {
// [Interpretation 8725] Need to do a lookup from the model. // [Interpretation 8840] Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId); $record = $this->getModel()->getItem($recordId);
if (empty($record)) if (empty($record))
@ -117,7 +117,7 @@ class SermondistributorControllerPreacher extends JControllerForm
$ownerId = $record->created_by; $ownerId = $record->created_by;
} }
// [Interpretation 8733] If the owner matches 'me' then allow. // [Interpretation 8848] If the owner matches 'me' then allow.
if ($ownerId == $user->id) if ($ownerId == $user->id)
{ {
if ($user->authorise('preacher.edit.own', 'com_sermondistributor')) if ($user->authorise('preacher.edit.own', 'com_sermondistributor'))
@ -129,7 +129,7 @@ class SermondistributorControllerPreacher extends JControllerForm
return false; return false;
} }
} }
// [Interpretation 8755] Since there is no permission, revert to the component permissions. // [Interpretation 8870] Since there is no permission, revert to the component permissions.
return $user->authorise('preacher.edit', $this->option); return $user->authorise('preacher.edit', $this->option);
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preachers.php @subpackage preachers.php
@ -48,29 +48,29 @@ class SermondistributorControllerPreachers extends JControllerAdmin
public function exportData() public function exportData()
{ {
// [Interpretation 6595] Check for request forgeries // [Interpretation 6705] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6597] check if export is allowed for this user. // [Interpretation 6707] check if export is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('preacher.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) if ($user->authorise('preacher.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
{ {
// [Interpretation 6601] Get the input // [Interpretation 6711] Get the input
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// [Interpretation 6604] Sanitize the input // [Interpretation 6714] Sanitize the input
JArrayHelper::toInteger($pks); JArrayHelper::toInteger($pks);
// [Interpretation 6606] Get the model // [Interpretation 6716] Get the model
$model = $this->getModel('Preachers'); $model = $this->getModel('Preachers');
// [Interpretation 6608] get the data to export // [Interpretation 6718] get the data to export
$data = $model->getExportData($pks); $data = $model->getExportData($pks);
if (SermondistributorHelper::checkArray($data)) if (SermondistributorHelper::checkArray($data))
{ {
// [Interpretation 6612] now set the data to the spreadsheet // [Interpretation 6722] now set the data to the spreadsheet
$date = JFactory::getDate(); $date = JFactory::getDate();
SermondistributorHelper::xls($data,'Preachers_'.$date->format('jS_F_Y'),'Preachers exported ('.$date->format('jS F, Y').')','preachers'); SermondistributorHelper::xls($data,'Preachers_'.$date->format('jS_F_Y'),'Preachers exported ('.$date->format('jS F, Y').')','preachers');
} }
} }
// [Interpretation 6617] Redirect to the list screen with error. // [Interpretation 6727] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error');
return; return;
@ -79,31 +79,31 @@ class SermondistributorControllerPreachers extends JControllerAdmin
public function importData() public function importData()
{ {
// [Interpretation 6626] Check for request forgeries // [Interpretation 6736] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6628] check if import is allowed for this user. // [Interpretation 6738] check if import is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('preacher.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) if ($user->authorise('preacher.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
{ {
// [Interpretation 6632] Get the import model // [Interpretation 6742] Get the import model
$model = $this->getModel('Preachers'); $model = $this->getModel('Preachers');
// [Interpretation 6634] get the headers to import // [Interpretation 6744] get the headers to import
$headers = $model->getExImPortHeaders(); $headers = $model->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
// [Interpretation 6638] Load headers to session. // [Interpretation 6748] Load headers to session.
$session = JFactory::getSession(); $session = JFactory::getSession();
$headers = json_encode($headers); $headers = json_encode($headers);
$session->set('preacher_VDM_IMPORTHEADERS', $headers); $session->set('preacher_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'preachers'); $session->set('backto_VDM_IMPORT', 'preachers');
$session->set('dataType_VDM_IMPORTINTO', 'preacher'); $session->set('dataType_VDM_IMPORTINTO', 'preacher');
// [Interpretation 6644] Redirect to import view. // [Interpretation 6754] Redirect to import view.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_PREACHERS'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_PREACHERS');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
return; return;
} }
} }
// [Interpretation 6656] Redirect to the list screen with error. // [Interpretation 6766] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=preachers', false), $message, 'error');
return; return;

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series.php @subpackage series.php
@ -60,13 +60,13 @@ class SermondistributorControllerSeries extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// [Interpretation 8527] Access check. // [Interpretation 8642] Access check.
$access = JFactory::getUser()->authorise('series.access', 'com_sermondistributor'); $access = JFactory::getUser()->authorise('series.access', 'com_sermondistributor');
if (!$access) if (!$access)
{ {
return false; return false;
} }
// [Interpretation 8538] In the absense of better information, revert to the component permissions. // [Interpretation 8653] In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('series.create', $this->option); return JFactory::getUser()->authorise('series.create', $this->option);
} }
@ -82,13 +82,13 @@ class SermondistributorControllerSeries extends JControllerForm
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 8681] get user object. // [Interpretation 8796] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8683] get record id. // [Interpretation 8798] get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// [Interpretation 8690] Access check. // [Interpretation 8805] Access check.
$access = ($user->authorise('series.access', 'com_sermondistributor.series.' . (int) $recordId) && $user->authorise('series.access', 'com_sermondistributor')); $access = ($user->authorise('series.access', 'com_sermondistributor.series.' . (int) $recordId) && $user->authorise('series.access', 'com_sermondistributor'));
if (!$access) if (!$access)
{ {
@ -97,17 +97,17 @@ class SermondistributorControllerSeries extends JControllerForm
if ($recordId) if ($recordId)
{ {
// [Interpretation 8699] The record has been set. Check the record permissions. // [Interpretation 8814] The record has been set. Check the record permissions.
$permission = $user->authorise('series.edit', 'com_sermondistributor.series.' . (int) $recordId); $permission = $user->authorise('series.edit', 'com_sermondistributor.series.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
if ($user->authorise('series.edit.own', 'com_sermondistributor.series.' . $recordId)) if ($user->authorise('series.edit.own', 'com_sermondistributor.series.' . $recordId))
{ {
// [Interpretation 8721] Now test the owner is the user. // [Interpretation 8836] Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId)) if (empty($ownerId))
{ {
// [Interpretation 8725] Need to do a lookup from the model. // [Interpretation 8840] Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId); $record = $this->getModel()->getItem($recordId);
if (empty($record)) if (empty($record))
@ -117,7 +117,7 @@ class SermondistributorControllerSeries extends JControllerForm
$ownerId = $record->created_by; $ownerId = $record->created_by;
} }
// [Interpretation 8733] If the owner matches 'me' then allow. // [Interpretation 8848] If the owner matches 'me' then allow.
if ($ownerId == $user->id) if ($ownerId == $user->id)
{ {
if ($user->authorise('series.edit.own', 'com_sermondistributor')) if ($user->authorise('series.edit.own', 'com_sermondistributor'))
@ -129,7 +129,7 @@ class SermondistributorControllerSeries extends JControllerForm
return false; return false;
} }
} }
// [Interpretation 8755] Since there is no permission, revert to the component permissions. // [Interpretation 8870] Since there is no permission, revert to the component permissions.
return $user->authorise('series.edit', $this->option); return $user->authorise('series.edit', $this->option);
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series_list.php @subpackage series_list.php
@ -48,29 +48,29 @@ class SermondistributorControllerSeries_list extends JControllerAdmin
public function exportData() public function exportData()
{ {
// [Interpretation 6595] Check for request forgeries // [Interpretation 6705] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6597] check if export is allowed for this user. // [Interpretation 6707] check if export is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('series.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) if ($user->authorise('series.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
{ {
// [Interpretation 6601] Get the input // [Interpretation 6711] Get the input
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// [Interpretation 6604] Sanitize the input // [Interpretation 6714] Sanitize the input
JArrayHelper::toInteger($pks); JArrayHelper::toInteger($pks);
// [Interpretation 6606] Get the model // [Interpretation 6716] Get the model
$model = $this->getModel('Series_list'); $model = $this->getModel('Series_list');
// [Interpretation 6608] get the data to export // [Interpretation 6718] get the data to export
$data = $model->getExportData($pks); $data = $model->getExportData($pks);
if (SermondistributorHelper::checkArray($data)) if (SermondistributorHelper::checkArray($data))
{ {
// [Interpretation 6612] now set the data to the spreadsheet // [Interpretation 6722] now set the data to the spreadsheet
$date = JFactory::getDate(); $date = JFactory::getDate();
SermondistributorHelper::xls($data,'Series_list_'.$date->format('jS_F_Y'),'Series list exported ('.$date->format('jS F, Y').')','series list'); SermondistributorHelper::xls($data,'Series_list_'.$date->format('jS_F_Y'),'Series list exported ('.$date->format('jS F, Y').')','series list');
} }
} }
// [Interpretation 6617] Redirect to the list screen with error. // [Interpretation 6727] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error');
return; return;
@ -79,31 +79,31 @@ class SermondistributorControllerSeries_list extends JControllerAdmin
public function importData() public function importData()
{ {
// [Interpretation 6626] Check for request forgeries // [Interpretation 6736] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6628] check if import is allowed for this user. // [Interpretation 6738] check if import is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('series.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) if ($user->authorise('series.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
{ {
// [Interpretation 6632] Get the import model // [Interpretation 6742] Get the import model
$model = $this->getModel('Series_list'); $model = $this->getModel('Series_list');
// [Interpretation 6634] get the headers to import // [Interpretation 6744] get the headers to import
$headers = $model->getExImPortHeaders(); $headers = $model->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
// [Interpretation 6638] Load headers to session. // [Interpretation 6748] Load headers to session.
$session = JFactory::getSession(); $session = JFactory::getSession();
$headers = json_encode($headers); $headers = json_encode($headers);
$session->set('series_VDM_IMPORTHEADERS', $headers); $session->set('series_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'series_list'); $session->set('backto_VDM_IMPORT', 'series_list');
$session->set('dataType_VDM_IMPORTINTO', 'series'); $session->set('dataType_VDM_IMPORTINTO', 'series');
// [Interpretation 6644] Redirect to import view. // [Interpretation 6754] Redirect to import view.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERIES_LIST'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERIES_LIST');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
return; return;
} }
} }
// [Interpretation 6656] Redirect to the list screen with error. // [Interpretation 6766] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=series_list', false), $message, 'error');
return; return;

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermon.php @subpackage sermon.php
@ -60,10 +60,10 @@ class SermondistributorControllerSermon extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// [Interpretation 8482] get the user object // [Interpretation 8597] get the user object
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8487] Access check. // [Interpretation 8602] Access check.
$access = $user->authorise('sermon.access', 'com_sermondistributor'); $access = $user->authorise('sermon.access', 'com_sermondistributor');
if (!$access) if (!$access)
{ {
@ -74,13 +74,13 @@ class SermondistributorControllerSermon extends JControllerForm
if ($categoryId) if ($categoryId)
{ {
// [Interpretation 8498] If the category has been passed in the URL check it. // [Interpretation 8613] If the category has been passed in the URL check it.
$allow = $user->authorise('core.create', $this->option . '.sermons.category.' . $categoryId); $allow = $user->authorise('core.create', $this->option . '.sermons.category.' . $categoryId);
} }
if ($allow === null) if ($allow === null)
{ {
// [Interpretation 8507] In the absense of better information, revert to the component permissions. // [Interpretation 8622] In the absense of better information, revert to the component permissions.
return $user->authorise('sermon.create', $this->option); return $user->authorise('sermon.create', $this->option);
} }
else else
@ -100,13 +100,13 @@ class SermondistributorControllerSermon extends JControllerForm
* @since 1.6 * @since 1.6
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ // [Interpretation 8585] get user object. { // [Interpretation 8700] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8587] get record id. // [Interpretation 8702] get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// [Interpretation 8594] Access check. // [Interpretation 8709] Access check.
$access = ($user->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $recordId) && $user->authorise('sermon.access', 'com_sermondistributor')); $access = ($user->authorise('sermon.access', 'com_sermondistributor.sermon.' . (int) $recordId) && $user->authorise('sermon.access', 'com_sermondistributor'));
if (!$access) if (!$access)
{ {
@ -115,17 +115,17 @@ class SermondistributorControllerSermon extends JControllerForm
if ($recordId) if ($recordId)
{ {
// [Interpretation 8603] The record has been set. Check the record permissions. // [Interpretation 8718] The record has been set. Check the record permissions.
$permission = $user->authorise('sermon.edit', 'com_sermondistributor.sermon.' . (int) $recordId); $permission = $user->authorise('sermon.edit', 'com_sermondistributor.sermon.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
if ($user->authorise('sermon.edit.own', 'com_sermondistributor.sermon.' . $recordId)) if ($user->authorise('sermon.edit.own', 'com_sermondistributor.sermon.' . $recordId))
{ {
// [Interpretation 8625] Fallback on edit.own. Now test the owner is the user. // [Interpretation 8740] Fallback on edit.own. Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId)) if (empty($ownerId))
{ {
// [Interpretation 8629] Need to do a lookup from the model. // [Interpretation 8744] Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId); $record = $this->getModel()->getItem($recordId);
if (empty($record)) if (empty($record))
@ -135,7 +135,7 @@ class SermondistributorControllerSermon extends JControllerForm
$ownerId = $record->created_by; $ownerId = $record->created_by;
} }
// [Interpretation 8637] If the owner matches 'me' then do the test. // [Interpretation 8752] If the owner matches 'me' then do the test.
if ($ownerId == $user->id) if ($ownerId == $user->id)
{ {
if ($user->authorise('sermon.edit.own', 'com_sermondistributor')) if ($user->authorise('sermon.edit.own', 'com_sermondistributor'))
@ -151,7 +151,7 @@ class SermondistributorControllerSermon extends JControllerForm
if ($categoryId) if ($categoryId)
{ {
// [Interpretation 8659] The category has been set. Check the category permissions. // [Interpretation 8774] The category has been set. Check the category permissions.
$catpermission = $user->authorise('core.edit', $this->option . '.sermons.category.' . $categoryId); $catpermission = $user->authorise('core.edit', $this->option . '.sermons.category.' . $categoryId);
if (!$catpermission && !is_null($catpermission)) if (!$catpermission && !is_null($catpermission))
{ {
@ -159,7 +159,7 @@ class SermondistributorControllerSermon extends JControllerForm
} }
} }
} }
// [Interpretation 8669] Since there is no permission, revert to the component permissions. // [Interpretation 8784] Since there is no permission, revert to the component permissions.
return $user->authorise('sermon.edit', $this->option); return $user->authorise('sermon.edit', $this->option);
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermondistributor.php @subpackage sermondistributor.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermons.php @subpackage sermons.php
@ -48,29 +48,29 @@ class SermondistributorControllerSermons extends JControllerAdmin
public function exportData() public function exportData()
{ {
// [Interpretation 6595] Check for request forgeries // [Interpretation 6705] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6597] check if export is allowed for this user. // [Interpretation 6707] check if export is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('sermon.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) if ($user->authorise('sermon.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
{ {
// [Interpretation 6601] Get the input // [Interpretation 6711] Get the input
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// [Interpretation 6604] Sanitize the input // [Interpretation 6714] Sanitize the input
JArrayHelper::toInteger($pks); JArrayHelper::toInteger($pks);
// [Interpretation 6606] Get the model // [Interpretation 6716] Get the model
$model = $this->getModel('Sermons'); $model = $this->getModel('Sermons');
// [Interpretation 6608] get the data to export // [Interpretation 6718] get the data to export
$data = $model->getExportData($pks); $data = $model->getExportData($pks);
if (SermondistributorHelper::checkArray($data)) if (SermondistributorHelper::checkArray($data))
{ {
// [Interpretation 6612] now set the data to the spreadsheet // [Interpretation 6722] now set the data to the spreadsheet
$date = JFactory::getDate(); $date = JFactory::getDate();
SermondistributorHelper::xls($data,'Sermons_'.$date->format('jS_F_Y'),'Sermons exported ('.$date->format('jS F, Y').')','sermons'); SermondistributorHelper::xls($data,'Sermons_'.$date->format('jS_F_Y'),'Sermons exported ('.$date->format('jS F, Y').')','sermons');
} }
} }
// [Interpretation 6617] Redirect to the list screen with error. // [Interpretation 6727] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error');
return; return;
@ -79,31 +79,31 @@ class SermondistributorControllerSermons extends JControllerAdmin
public function importData() public function importData()
{ {
// [Interpretation 6626] Check for request forgeries // [Interpretation 6736] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6628] check if import is allowed for this user. // [Interpretation 6738] check if import is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('sermon.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) if ($user->authorise('sermon.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
{ {
// [Interpretation 6632] Get the import model // [Interpretation 6742] Get the import model
$model = $this->getModel('Sermons'); $model = $this->getModel('Sermons');
// [Interpretation 6634] get the headers to import // [Interpretation 6744] get the headers to import
$headers = $model->getExImPortHeaders(); $headers = $model->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
// [Interpretation 6638] Load headers to session. // [Interpretation 6748] Load headers to session.
$session = JFactory::getSession(); $session = JFactory::getSession();
$headers = json_encode($headers); $headers = json_encode($headers);
$session->set('sermon_VDM_IMPORTHEADERS', $headers); $session->set('sermon_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'sermons'); $session->set('backto_VDM_IMPORT', 'sermons');
$session->set('dataType_VDM_IMPORTINTO', 'sermon'); $session->set('dataType_VDM_IMPORTINTO', 'sermon');
// [Interpretation 6644] Redirect to import view. // [Interpretation 6754] Redirect to import view.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERMONS'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_SERMONS');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
return; return;
} }
} }
// [Interpretation 6656] Redirect to the list screen with error. // [Interpretation 6766] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=sermons', false), $message, 'error');
return; return;

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage statistic.php @subpackage statistic.php
@ -60,13 +60,13 @@ class SermondistributorControllerStatistic extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// [Interpretation 8527] Access check. // [Interpretation 8642] Access check.
$access = JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor'); $access = JFactory::getUser()->authorise('statistic.access', 'com_sermondistributor');
if (!$access) if (!$access)
{ {
return false; return false;
} }
// [Interpretation 8538] In the absense of better information, revert to the component permissions. // [Interpretation 8653] In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('statistic.create', $this->option); return JFactory::getUser()->authorise('statistic.create', $this->option);
} }
@ -82,13 +82,13 @@ class SermondistributorControllerStatistic extends JControllerForm
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 8681] get user object. // [Interpretation 8796] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8683] get record id. // [Interpretation 8798] get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// [Interpretation 8690] Access check. // [Interpretation 8805] Access check.
$access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $recordId) && $user->authorise('statistic.access', 'com_sermondistributor')); $access = ($user->authorise('statistic.access', 'com_sermondistributor.statistic.' . (int) $recordId) && $user->authorise('statistic.access', 'com_sermondistributor'));
if (!$access) if (!$access)
{ {
@ -97,17 +97,17 @@ class SermondistributorControllerStatistic extends JControllerForm
if ($recordId) if ($recordId)
{ {
// [Interpretation 8699] The record has been set. Check the record permissions. // [Interpretation 8814] The record has been set. Check the record permissions.
$permission = $user->authorise('statistic.edit', 'com_sermondistributor.statistic.' . (int) $recordId); $permission = $user->authorise('statistic.edit', 'com_sermondistributor.statistic.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
if ($user->authorise('statistic.edit.own', 'com_sermondistributor.statistic.' . $recordId)) if ($user->authorise('statistic.edit.own', 'com_sermondistributor.statistic.' . $recordId))
{ {
// [Interpretation 8721] Now test the owner is the user. // [Interpretation 8836] Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId)) if (empty($ownerId))
{ {
// [Interpretation 8725] Need to do a lookup from the model. // [Interpretation 8840] Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId); $record = $this->getModel()->getItem($recordId);
if (empty($record)) if (empty($record))
@ -117,7 +117,7 @@ class SermondistributorControllerStatistic extends JControllerForm
$ownerId = $record->created_by; $ownerId = $record->created_by;
} }
// [Interpretation 8733] If the owner matches 'me' then allow. // [Interpretation 8848] If the owner matches 'me' then allow.
if ($ownerId == $user->id) if ($ownerId == $user->id)
{ {
if ($user->authorise('statistic.edit.own', 'com_sermondistributor')) if ($user->authorise('statistic.edit.own', 'com_sermondistributor'))
@ -129,7 +129,7 @@ class SermondistributorControllerStatistic extends JControllerForm
return false; return false;
} }
} }
// [Interpretation 8755] Since there is no permission, revert to the component permissions. // [Interpretation 8870] Since there is no permission, revert to the component permissions.
return $user->authorise('statistic.edit', $this->option); return $user->authorise('statistic.edit', $this->option);
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage statistics.php @subpackage statistics.php
@ -48,29 +48,29 @@ class SermondistributorControllerStatistics extends JControllerAdmin
public function exportData() public function exportData()
{ {
// [Interpretation 6595] Check for request forgeries // [Interpretation 6705] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6597] check if export is allowed for this user. // [Interpretation 6707] check if export is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('statistic.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor')) if ($user->authorise('statistic.export', 'com_sermondistributor') && $user->authorise('core.export', 'com_sermondistributor'))
{ {
// [Interpretation 6601] Get the input // [Interpretation 6711] Get the input
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array'); $pks = $input->post->get('cid', array(), 'array');
// [Interpretation 6604] Sanitize the input // [Interpretation 6714] Sanitize the input
JArrayHelper::toInteger($pks); JArrayHelper::toInteger($pks);
// [Interpretation 6606] Get the model // [Interpretation 6716] Get the model
$model = $this->getModel('Statistics'); $model = $this->getModel('Statistics');
// [Interpretation 6608] get the data to export // [Interpretation 6718] get the data to export
$data = $model->getExportData($pks); $data = $model->getExportData($pks);
if (SermondistributorHelper::checkArray($data)) if (SermondistributorHelper::checkArray($data))
{ {
// [Interpretation 6612] now set the data to the spreadsheet // [Interpretation 6722] now set the data to the spreadsheet
$date = JFactory::getDate(); $date = JFactory::getDate();
SermondistributorHelper::xls($data,'Statistics_'.$date->format('jS_F_Y'),'Statistics exported ('.$date->format('jS F, Y').')','statistics'); SermondistributorHelper::xls($data,'Statistics_'.$date->format('jS_F_Y'),'Statistics exported ('.$date->format('jS F, Y').')','statistics');
} }
} }
// [Interpretation 6617] Redirect to the list screen with error. // [Interpretation 6727] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error');
return; return;
@ -79,31 +79,31 @@ class SermondistributorControllerStatistics extends JControllerAdmin
public function importData() public function importData()
{ {
// [Interpretation 6626] Check for request forgeries // [Interpretation 6736] Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// [Interpretation 6628] check if import is allowed for this user. // [Interpretation 6738] check if import is allowed for this user.
$user = JFactory::getUser(); $user = JFactory::getUser();
if ($user->authorise('statistic.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor')) if ($user->authorise('statistic.import', 'com_sermondistributor') && $user->authorise('core.import', 'com_sermondistributor'))
{ {
// [Interpretation 6632] Get the import model // [Interpretation 6742] Get the import model
$model = $this->getModel('Statistics'); $model = $this->getModel('Statistics');
// [Interpretation 6634] get the headers to import // [Interpretation 6744] get the headers to import
$headers = $model->getExImPortHeaders(); $headers = $model->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
// [Interpretation 6638] Load headers to session. // [Interpretation 6748] Load headers to session.
$session = JFactory::getSession(); $session = JFactory::getSession();
$headers = json_encode($headers); $headers = json_encode($headers);
$session->set('statistic_VDM_IMPORTHEADERS', $headers); $session->set('statistic_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'statistics'); $session->set('backto_VDM_IMPORT', 'statistics');
$session->set('dataType_VDM_IMPORTINTO', 'statistic'); $session->set('dataType_VDM_IMPORTINTO', 'statistic');
// [Interpretation 6644] Redirect to import view. // [Interpretation 6754] Redirect to import view.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_STATISTICS'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_SELECT_FILE_FOR_STATISTICS');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=import', false), $message);
return; return;
} }
} }
// [Interpretation 6656] Redirect to the list screen with error. // [Interpretation 6766] Redirect to the list screen with error.
$message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED'); $message = JText::_('COM_SERMONDISTRIBUTOR_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error'); $this->setRedirect(JRoute::_('index.php?option=com_sermondistributor&view=statistics', false), $message, 'error');
return; return;

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage batch_.php @subpackage batch_.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermondistributor.php @subpackage sermondistributor.php
@ -50,10 +50,10 @@ abstract class SermondistributorHelper
checkDropboxListing(3); checkDropboxListing(3);
}); });
function checkDropboxListing(view){ function checkDropboxListing(fromview){
var getUrl = '".JRoute::_('index.php?option=com_sermondistributor&task=ajax.checkDropboxListing&format=json')."'; var getUrl = '".JURI::root()."administrator/index.php?option=com_sermondistributor&task=ajax.checkDropboxListing&format=json';
if(view > 0){ if(fromview > 0){
var request = 'token=".JSession::getFormToken()."&view='+view; var request = 'token=".JSession::getFormToken()."&fromview='+fromview;
} }
return jQuery.ajax({ return jQuery.ajax({
type: 'GET', type: 'GET',
@ -553,23 +553,23 @@ abstract class SermondistributorHelper
$targetgroups = json_decode($help->groups, true); $targetgroups = json_decode($help->groups, true);
if (!array_intersect($targetgroups, $groups)) if (!array_intersect($targetgroups, $groups))
{ {
// [Interpretation 646] if user not in those target groups then remove the item // [Interpretation 653] if user not in those target groups then remove the item
unset($helps[$nr]); unset($helps[$nr]);
continue; continue;
} }
} }
// [Interpretation 651] set the return type // [Interpretation 658] set the return type
switch ($help->type) switch ($help->type)
{ {
// [Interpretation 654] set joomla article // [Interpretation 661] set joomla article
case 1: case 1:
return self::loadArticleLink($help->article); return self::loadArticleLink($help->article);
break; break;
// [Interpretation 658] set help text // [Interpretation 665] set help text
case 2: case 2:
return self::loadHelpTextLink($help->id); return self::loadHelpTextLink($help->id);
break; break;
// [Interpretation 662] set Link // [Interpretation 669] set Link
case 3: case 3:
return $help->url; return $help->url;
break; break;
@ -698,7 +698,7 @@ abstract class SermondistributorHelper
{ {
if (strpos($content,'class="uk-') !== false) if (strpos($content,'class="uk-') !== false)
{ {
// [Interpretation 1890] reset // [Interpretation 1909] reset
$temp = array(); $temp = array();
foreach (self::$uk_components as $looking => $add) foreach (self::$uk_components as $looking => $add)
{ {
@ -707,15 +707,15 @@ abstract class SermondistributorHelper
$temp[] = $looking; $temp[] = $looking;
} }
} }
// [Interpretation 1899] make sure uikit is loaded to config // [Interpretation 1918] make sure uikit is loaded to config
if (strpos($content,'class="uk-') !== false) if (strpos($content,'class="uk-') !== false)
{ {
self::$uikit = true; self::$uikit = true;
} }
// [Interpretation 1904] sorter // [Interpretation 1923] sorter
if (self::checkArray($temp)) if (self::checkArray($temp))
{ {
// [Interpretation 1907] merger // [Interpretation 1926] merger
if (self::checkArray($classes)) if (self::checkArray($classes))
{ {
$newTemp = array_merge($temp,$classes); $newTemp = array_merge($temp,$classes);
@ -736,37 +736,37 @@ abstract class SermondistributorHelper
*/ */
public static function xls($rows,$fileName = null,$title = null,$subjectTab = null,$creator = 'Vast Development Method',$description = null,$category = null,$keywords = null,$modified = null) public static function xls($rows,$fileName = null,$title = null,$subjectTab = null,$creator = 'Vast Development Method',$description = null,$category = null,$keywords = null,$modified = null)
{ {
// [Interpretation 701] set the user // [Interpretation 708] set the user
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 704] set fieldname if not set // [Interpretation 711] set fieldname if not set
if (!$fileName) if (!$fileName)
{ {
$fileName = 'exported_'.JFactory::getDate()->format('jS_F_Y'); $fileName = 'exported_'.JFactory::getDate()->format('jS_F_Y');
} }
// [Interpretation 709] set modiefied if not set // [Interpretation 716] set modiefied if not set
if (!$modified) if (!$modified)
{ {
$modified = $user->name; $modified = $user->name;
} }
// [Interpretation 714] set title if not set // [Interpretation 721] set title if not set
if (!$title) if (!$title)
{ {
$title = 'Book1'; $title = 'Book1';
} }
// [Interpretation 719] set tab name if not set // [Interpretation 726] set tab name if not set
if (!$subjectTab) if (!$subjectTab)
{ {
$subjectTab = 'Sheet1'; $subjectTab = 'Sheet1';
} }
// [Interpretation 725] make sure the file is loaded // [Interpretation 732] make sure the file is loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
// [Interpretation 728] Create new PHPExcel object // [Interpretation 735] Create new PHPExcel object
$objPHPExcel = new PHPExcel(); $objPHPExcel = new PHPExcel();
// [Interpretation 731] Set document properties // [Interpretation 738] Set document properties
$objPHPExcel->getProperties()->setCreator($creator) $objPHPExcel->getProperties()->setCreator($creator)
->setCompany('Vast Development Method') ->setCompany('Vast Development Method')
->setLastModifiedBy($modified) ->setLastModifiedBy($modified)
@ -785,7 +785,7 @@ abstract class SermondistributorHelper
$objPHPExcel->getProperties()->setCategory($category); $objPHPExcel->getProperties()->setCategory($category);
} }
// [Interpretation 750] Some styles // [Interpretation 757] Some styles
$headerStyles = array( $headerStyles = array(
'font' => array( 'font' => array(
'bold' => true, 'bold' => true,
@ -807,7 +807,7 @@ abstract class SermondistributorHelper
'name' => 'Verdana' 'name' => 'Verdana'
)); ));
// [Interpretation 772] Add some data // [Interpretation 779] Add some data
if (self::checkArray($rows)) if (self::checkArray($rows))
{ {
$i = 1; $i = 1;
@ -834,20 +834,20 @@ abstract class SermondistributorHelper
return false; return false;
} }
// [Interpretation 799] Rename worksheet // [Interpretation 806] Rename worksheet
$objPHPExcel->getActiveSheet()->setTitle($subjectTab); $objPHPExcel->getActiveSheet()->setTitle($subjectTab);
// [Interpretation 802] Set active sheet index to the first sheet, so Excel opens this as the first sheet // [Interpretation 809] Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->setActiveSheetIndex(0);
// [Interpretation 805] Redirect output to a client's web browser (Excel5) // [Interpretation 812] 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.'.xls"');
header('Cache-Control: max-age=0'); header('Cache-Control: max-age=0');
// [Interpretation 809] If you're serving to IE 9, then the following may be needed // [Interpretation 816] 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');
// [Interpretation 812] If you're serving to IE over SSL, then the following may be needed // [Interpretation 819] If you're serving to IE over SSL, then the following may be needed
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
@ -863,13 +863,13 @@ abstract class SermondistributorHelper
*/ */
public static function getFileHeaders($dataType) public static function getFileHeaders($dataType)
{ {
// [Interpretation 828] make sure the file is loaded // [Interpretation 835] make sure the file is loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
// [Interpretation 830] get session object // [Interpretation 837] get session object
$session = JFactory::getSession(); $session = JFactory::getSession();
$package = $session->get('package', null); $package = $session->get('package', null);
$package = json_decode($package, true); $package = json_decode($package, true);
// [Interpretation 834] set the headers // [Interpretation 841] set the headers
if(isset($package['dir'])) if(isset($package['dir']))
{ {
$inputFileType = PHPExcel_IOFactory::identify($package['dir']); $inputFileType = PHPExcel_IOFactory::identify($package['dir']);
@ -1009,7 +1009,7 @@ abstract class SermondistributorHelper
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select(array('a.published')); $query->select(array('a.published'));
$query->from('#__sermondistributor_'.$type.' AS a'); $query->from('#__sermondistributor_'.$type.' AS a');
$query->where('a.id = '.$id); $query->where('a.id = '. (int) $id);
$query->where('a.published = 1'); $query->where('a.published = 1');
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
@ -1027,7 +1027,7 @@ abstract class SermondistributorHelper
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select(array('a.title')); $query->select(array('a.title'));
$query->from('#__usergroups AS a'); $query->from('#__usergroups AS a');
$query->where('a.id = '.$id); $query->where('a.id = '. (int) $id);
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
$found = $db->getNumRows(); $found = $db->getNumRows();

View File

@ -1,4 +1,4 @@
COM_SERMONDISTRIBUTOR="Sermon Distributor" COM_SERMONDISTRIBUTOR="Sermon Distributor Configuration"
COM_SERMONDISTRIBUTOR_CONFIGURATION="Sermon Distributor Configuration" COM_SERMONDISTRIBUTOR_CONFIGURATION="Sermon Distributor Configuration"
COM_SERMONDISTRIBUTOR_MENU="&#187; Sermon Distributor" COM_SERMONDISTRIBUTOR_MENU="&#187; Sermon Distributor"
COM_SERMONDISTRIBUTOR_MENU_CATEGORIES_DESC="All categories that are published" COM_SERMONDISTRIBUTOR_MENU_CATEGORIES_DESC="All categories that are published"

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage batchselection.php @subpackage batchselection.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_above.php @subpackage details_above.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_fullwidth.php @subpackage details_fullwidth.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_left.php @subpackage details_left.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_right.php @subpackage details_right.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_under.php @subpackage details_under.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage metadata.php @subpackage metadata.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage publishing.php @subpackage publishing.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_above.php @subpackage details_above.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_fullwidth.php @subpackage details_fullwidth.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_left.php @subpackage details_left.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_right.php @subpackage details_right.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage metadata.php @subpackage metadata.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage publishing.php @subpackage publishing.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermons_fullwidth.php @subpackage sermons_fullwidth.php
@ -42,7 +42,7 @@ $can = SermondistributorHelper::getActions('sermon');
<a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo JText::_('COM_SERMONDISTRIBUTOR_NEW'); ?></a><br /><br /> <a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo JText::_('COM_SERMONDISTRIBUTOR_NEW'); ?></a><br /><br />
<?php endif; ?> <?php endif; ?>
<?php if (SermondistributorHelper::checkArray($items)): ?> <?php if (SermondistributorHelper::checkArray($items)): ?>
<table class="footable table data sermons metro-blue" data-filter="#filter_sermons" data-page-size="20"> <table class="footable table data sermons metro-blue" data-page-size="20" data-filter="#filter_sermons">
<thead> <thead>
<tr> <tr>
<th data-toggle="true"> <th data-toggle="true">

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_above.php @subpackage details_above.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_fullwidth.php @subpackage details_fullwidth.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_left.php @subpackage details_left.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_right.php @subpackage details_right.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage metadata.php @subpackage metadata.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage publishing.php @subpackage publishing.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermons_fullwidth.php @subpackage sermons_fullwidth.php
@ -42,7 +42,7 @@ $can = SermondistributorHelper::getActions('sermon');
<a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo JText::_('COM_SERMONDISTRIBUTOR_NEW'); ?></a><br /><br /> <a class="btn btn-small btn-success" href="<?php echo $new; ?>"><span class="icon-new icon-white"></span> <?php echo JText::_('COM_SERMONDISTRIBUTOR_NEW'); ?></a><br /><br />
<?php endif; ?> <?php endif; ?>
<?php if (SermondistributorHelper::checkArray($items)): ?> <?php if (SermondistributorHelper::checkArray($items)): ?>
<table class="footable table data sermons metro-blue" data-filter="#filter_sermons" data-page-size="20"> <table class="footable table data sermons metro-blue" data-page-size="20" data-filter="#filter_sermons">
<thead> <thead>
<tr> <tr>
<th data-toggle="true"> <th data-toggle="true">

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_above.php @subpackage details_above.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_fullwidth.php @subpackage details_fullwidth.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_left.php @subpackage details_left.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_right.php @subpackage details_right.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_under.php @subpackage details_under.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage files_fullwidth.php @subpackage files_fullwidth.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage metadata.php @subpackage metadata.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage publishing.php @subpackage publishing.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage stastics_fullwidth.php @subpackage stastics_fullwidth.php
@ -36,7 +36,7 @@ $edit = "index.php?option=com_sermondistributor&view=statistics&task=statistic.e
?> ?>
<div class="form-vertical"> <div class="form-vertical">
<?php if (SermondistributorHelper::checkArray($items)): ?> <?php if (SermondistributorHelper::checkArray($items)): ?>
<table class="footable table data statistics metro-blue" data-filter="#filter_statistics" data-page-size="20"> <table class="footable table data statistics metro-blue" data-page-size="20" data-filter="#filter_statistics">
<thead> <thead>
<tr> <tr>
<th data-toggle="true"> <th data-toggle="true">

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_above.php @subpackage details_above.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_left.php @subpackage details_left.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage details_right.php @subpackage details_right.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage metadata.php @subpackage metadata.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage publishing.php @subpackage publishing.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage ajax.php @subpackage ajax.php
@ -43,7 +43,7 @@ class SermondistributorModelAjax extends JModelList
} }
// [Interpretation 8124] Used in sermon // [Interpretation 8239] Used in sermon
/** /**
* Check and Set Dropbox local listing * Check and Set Dropbox local listing
**/ **/

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage articles.php @subpackage articles.php
@ -50,36 +50,36 @@ class JFormFieldArticles extends JFormFieldList
*/ */
protected function getInput() protected function getInput()
{ {
// [Interpretation 6899] see if we should add buttons // [Interpretation 7009] see if we should add buttons
$setButton = $this->getAttribute('button'); $setButton = $this->getAttribute('button');
// [Interpretation 6901] get html // [Interpretation 7011] get html
$html = parent::getInput(); $html = parent::getInput();
// [Interpretation 6903] if true set button // [Interpretation 7013] if true set button
if ($setButton === 'true') if ($setButton === 'true')
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6907] only add if user allowed to create article // [Interpretation 7017] only add if user allowed to create article
if ($user->authorise('core.create', 'com_sermondistributor')) if ($user->authorise('core.create', 'com_sermondistributor'))
{ {
// [Interpretation 6925] get the input from url // [Interpretation 7035] get the input from url
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 6927] get the view name & id // [Interpretation 7037] get the view name & id
$values = $jinput->getArray(array( $values = $jinput->getArray(array(
'id' => 'int', 'id' => 'int',
'view' => 'word' 'view' => 'word'
)); ));
// [Interpretation 6932] check if new item // [Interpretation 7042] check if new item
$ref = ''; $ref = '';
if (!is_null($values['id']) && strlen($values['view'])) if (!is_null($values['id']) && strlen($values['view']))
{ {
// [Interpretation 6936] only load referal if not new item. // [Interpretation 7046] only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id']; $ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
} }
// [Interpretation 6939] build the button // [Interpretation 7049] build the button
$button = '<a class="btn btn-small btn-success" $button = '<a class="btn btn-small btn-success"
href="index.php?option=com_sermondistributor&amp;view=article&amp;layout=edit'.$ref.'" > href="index.php?option=com_sermondistributor&amp;view=article&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>'; <span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>';
// [Interpretation 6943] return the button attached to input field // [Interpretation 7053] return the button attached to input field
return $html . $button; return $html . $button;
} }
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage dropboxfiles.php @subpackage dropboxfiles.php
@ -50,36 +50,36 @@ class JFormFieldDropboxfiles extends JFormFieldList
*/ */
protected function getInput() protected function getInput()
{ {
// [Interpretation 6899] see if we should add buttons // [Interpretation 7009] see if we should add buttons
$setButton = $this->getAttribute('button'); $setButton = $this->getAttribute('button');
// [Interpretation 6901] get html // [Interpretation 7011] get html
$html = parent::getInput(); $html = parent::getInput();
// [Interpretation 6903] if true set button // [Interpretation 7013] if true set button
if ($setButton === 'true') if ($setButton === 'true')
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6907] only add if user allowed to create // [Interpretation 7017] only add if user allowed to create
if ($user->authorise('core.create', 'com_sermondistributor')) if ($user->authorise('core.create', 'com_sermondistributor'))
{ {
// [Interpretation 6925] get the input from url // [Interpretation 7035] get the input from url
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 6927] get the view name & id // [Interpretation 7037] get the view name & id
$values = $jinput->getArray(array( $values = $jinput->getArray(array(
'id' => 'int', 'id' => 'int',
'view' => 'word' 'view' => 'word'
)); ));
// [Interpretation 6932] check if new item // [Interpretation 7042] check if new item
$ref = ''; $ref = '';
if (!is_null($values['id']) && strlen($values['view'])) if (!is_null($values['id']) && strlen($values['view']))
{ {
// [Interpretation 6936] only load referal if not new item. // [Interpretation 7046] only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id']; $ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
} }
// [Interpretation 6939] build the button // [Interpretation 7049] build the button
$button = '<a class="btn btn-small btn-success" $button = '<a class="btn btn-small btn-success"
href="index.php?option=com_sermondistributor&amp;view=&amp;layout=edit'.$ref.'" > href="index.php?option=com_sermondistributor&amp;view=&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>'; <span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>';
// [Interpretation 6943] return the button attached to input field // [Interpretation 7053] return the button attached to input field
return $html . $button; return $html . $button;
} }
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage localfiles.php @subpackage localfiles.php
@ -50,36 +50,36 @@ class JFormFieldLocalfiles extends JFormFieldList
*/ */
protected function getInput() protected function getInput()
{ {
// [Interpretation 6899] see if we should add buttons // [Interpretation 7009] see if we should add buttons
$setButton = $this->getAttribute('button'); $setButton = $this->getAttribute('button');
// [Interpretation 6901] get html // [Interpretation 7011] get html
$html = parent::getInput(); $html = parent::getInput();
// [Interpretation 6903] if true set button // [Interpretation 7013] if true set button
if ($setButton === 'true') if ($setButton === 'true')
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6907] only add if user allowed to create // [Interpretation 7017] only add if user allowed to create
if ($user->authorise('core.create', 'com_sermondistributor')) if ($user->authorise('core.create', 'com_sermondistributor'))
{ {
// [Interpretation 6925] get the input from url // [Interpretation 7035] get the input from url
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 6927] get the view name & id // [Interpretation 7037] get the view name & id
$values = $jinput->getArray(array( $values = $jinput->getArray(array(
'id' => 'int', 'id' => 'int',
'view' => 'word' 'view' => 'word'
)); ));
// [Interpretation 6932] check if new item // [Interpretation 7042] check if new item
$ref = ''; $ref = '';
if (!is_null($values['id']) && strlen($values['view'])) if (!is_null($values['id']) && strlen($values['view']))
{ {
// [Interpretation 6936] only load referal if not new item. // [Interpretation 7046] only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id']; $ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
} }
// [Interpretation 6939] build the button // [Interpretation 7049] build the button
$button = '<a class="btn btn-small btn-success" $button = '<a class="btn btn-small btn-success"
href="index.php?option=com_sermondistributor&amp;view=&amp;layout=edit'.$ref.'" > href="index.php?option=com_sermondistributor&amp;view=&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>'; <span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>';
// [Interpretation 6943] return the button attached to input field // [Interpretation 7053] return the button attached to input field
return $html . $button; return $html . $button;
} }
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preachers.php @subpackage preachers.php
@ -50,36 +50,36 @@ class JFormFieldPreachers extends JFormFieldList
*/ */
protected function getInput() protected function getInput()
{ {
// [Interpretation 6899] see if we should add buttons // [Interpretation 7009] see if we should add buttons
$setButton = $this->getAttribute('button'); $setButton = $this->getAttribute('button');
// [Interpretation 6901] get html // [Interpretation 7011] get html
$html = parent::getInput(); $html = parent::getInput();
// [Interpretation 6903] if true set button // [Interpretation 7013] if true set button
if ($setButton === 'true') if ($setButton === 'true')
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6907] only add if user allowed to create preacher // [Interpretation 7017] only add if user allowed to create preacher
if ($user->authorise('preacher.create', 'com_sermondistributor')) if ($user->authorise('preacher.create', 'com_sermondistributor'))
{ {
// [Interpretation 6925] get the input from url // [Interpretation 7035] get the input from url
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 6927] get the view name & id // [Interpretation 7037] get the view name & id
$values = $jinput->getArray(array( $values = $jinput->getArray(array(
'id' => 'int', 'id' => 'int',
'view' => 'word' 'view' => 'word'
)); ));
// [Interpretation 6932] check if new item // [Interpretation 7042] check if new item
$ref = ''; $ref = '';
if (!is_null($values['id']) && strlen($values['view'])) if (!is_null($values['id']) && strlen($values['view']))
{ {
// [Interpretation 6936] only load referal if not new item. // [Interpretation 7046] only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id']; $ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
} }
// [Interpretation 6939] build the button // [Interpretation 7049] build the button
$button = '<a class="btn btn-small btn-success" $button = '<a class="btn btn-small btn-success"
href="index.php?option=com_sermondistributor&amp;view=preacher&amp;layout=edit'.$ref.'" > href="index.php?option=com_sermondistributor&amp;view=preacher&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>'; <span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>';
// [Interpretation 6943] return the button attached to input field // [Interpretation 7053] return the button attached to input field
return $html . $button; return $html . $button;
} }
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series.php @subpackage series.php
@ -50,36 +50,36 @@ class JFormFieldSeries extends JFormFieldList
*/ */
protected function getInput() protected function getInput()
{ {
// [Interpretation 6899] see if we should add buttons // [Interpretation 7009] see if we should add buttons
$setButton = $this->getAttribute('button'); $setButton = $this->getAttribute('button');
// [Interpretation 6901] get html // [Interpretation 7011] get html
$html = parent::getInput(); $html = parent::getInput();
// [Interpretation 6903] if true set button // [Interpretation 7013] if true set button
if ($setButton === 'true') if ($setButton === 'true')
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6907] only add if user allowed to create series // [Interpretation 7017] only add if user allowed to create series
if ($user->authorise('series.create', 'com_sermondistributor')) if ($user->authorise('series.create', 'com_sermondistributor'))
{ {
// [Interpretation 6925] get the input from url // [Interpretation 7035] get the input from url
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 6927] get the view name & id // [Interpretation 7037] get the view name & id
$values = $jinput->getArray(array( $values = $jinput->getArray(array(
'id' => 'int', 'id' => 'int',
'view' => 'word' 'view' => 'word'
)); ));
// [Interpretation 6932] check if new item // [Interpretation 7042] check if new item
$ref = ''; $ref = '';
if (!is_null($values['id']) && strlen($values['view'])) if (!is_null($values['id']) && strlen($values['view']))
{ {
// [Interpretation 6936] only load referal if not new item. // [Interpretation 7046] only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id']; $ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
} }
// [Interpretation 6939] build the button // [Interpretation 7049] build the button
$button = '<a class="btn btn-small btn-success" $button = '<a class="btn btn-small btn-success"
href="index.php?option=com_sermondistributor&amp;view=series&amp;layout=edit'.$ref.'" > href="index.php?option=com_sermondistributor&amp;view=series&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>'; <span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>';
// [Interpretation 6943] return the button attached to input field // [Interpretation 7053] return the button attached to input field
return $html . $button; return $html . $button;
} }
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermon.php @subpackage sermon.php
@ -50,36 +50,36 @@ class JFormFieldSermon extends JFormFieldList
*/ */
protected function getInput() protected function getInput()
{ {
// [Interpretation 6899] see if we should add buttons // [Interpretation 7009] see if we should add buttons
$setButton = $this->getAttribute('button'); $setButton = $this->getAttribute('button');
// [Interpretation 6901] get html // [Interpretation 7011] get html
$html = parent::getInput(); $html = parent::getInput();
// [Interpretation 6903] if true set button // [Interpretation 7013] if true set button
if ($setButton === 'true') if ($setButton === 'true')
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6907] only add if user allowed to create sermon // [Interpretation 7017] only add if user allowed to create sermon
if ($user->authorise('sermon.create', 'com_sermondistributor')) if ($user->authorise('sermon.create', 'com_sermondistributor'))
{ {
// [Interpretation 6925] get the input from url // [Interpretation 7035] get the input from url
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 6927] get the view name & id // [Interpretation 7037] get the view name & id
$values = $jinput->getArray(array( $values = $jinput->getArray(array(
'id' => 'int', 'id' => 'int',
'view' => 'word' 'view' => 'word'
)); ));
// [Interpretation 6932] check if new item // [Interpretation 7042] check if new item
$ref = ''; $ref = '';
if (!is_null($values['id']) && strlen($values['view'])) if (!is_null($values['id']) && strlen($values['view']))
{ {
// [Interpretation 6936] only load referal if not new item. // [Interpretation 7046] only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id']; $ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
} }
// [Interpretation 6939] build the button // [Interpretation 7049] build the button
$button = '<a class="btn btn-small btn-success" $button = '<a class="btn btn-small btn-success"
href="index.php?option=com_sermondistributor&amp;view=sermon&amp;layout=edit'.$ref.'" > href="index.php?option=com_sermondistributor&amp;view=sermon&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>'; <span class="icon-new icon-white"></span>' . JText::_('COM_SERMONDISTRIBUTOR_NEW') . '</a>';
// [Interpretation 6943] return the button attached to input field // [Interpretation 7053] return the button attached to input field
return $html . $button; return $html . $button;
} }
} }

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_document.js @subpackage help_document.js
@ -53,7 +53,7 @@ jQuery(document).ready(function()
// the vvvvvwe function // the vvvvvwe function
function vvvvvwe(location_vvvvvwe) function vvvvvwe(location_vvvvvwe)
{ {
// [Interpretation 7216] set the function logic // [Interpretation 7326] set the function logic
if (location_vvvvvwe == 1) if (location_vvvvvwe == 1)
{ {
jQuery('#jform_admin_view').closest('.control-group').show(); jQuery('#jform_admin_view').closest('.control-group').show();
@ -67,7 +67,7 @@ function vvvvvwe(location_vvvvvwe)
// the vvvvvwf function // the vvvvvwf function
function vvvvvwf(location_vvvvvwf) function vvvvvwf(location_vvvvvwf)
{ {
// [Interpretation 7216] set the function logic // [Interpretation 7326] set the function logic
if (location_vvvvvwf == 2) if (location_vvvvvwf == 2)
{ {
jQuery('#jform_site_view').closest('.control-group').show(); jQuery('#jform_site_view').closest('.control-group').show();
@ -94,7 +94,7 @@ function vvvvvwg(type_vvvvvwg)
var type = type_vvvvvwg.some(type_vvvvvwg_SomeFunc); var type = type_vvvvvwg.some(type_vvvvvwg_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (type) if (type)
{ {
jQuery('#jform_url').closest('.control-group').show(); jQuery('#jform_url').closest('.control-group').show();
@ -125,7 +125,7 @@ function vvvvvwg(type_vvvvvwg)
// the vvvvvwg Some function // the vvvvvwg Some function
function type_vvvvvwg_SomeFunc(type_vvvvvwg) function type_vvvvvwg_SomeFunc(type_vvvvvwg)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (type_vvvvvwg == 3) if (type_vvvvvwg == 3)
{ {
return true; return true;
@ -149,7 +149,7 @@ function vvvvvwh(type_vvvvvwh)
var type = type_vvvvvwh.some(type_vvvvvwh_SomeFunc); var type = type_vvvvvwh.some(type_vvvvvwh_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (type) if (type)
{ {
jQuery('#jform_article').closest('.control-group').show(); jQuery('#jform_article').closest('.control-group').show();
@ -180,7 +180,7 @@ function vvvvvwh(type_vvvvvwh)
// the vvvvvwh Some function // the vvvvvwh Some function
function type_vvvvvwh_SomeFunc(type_vvvvvwh) function type_vvvvvwh_SomeFunc(type_vvvvvwh)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (type_vvvvvwh == 1) if (type_vvvvvwh == 1)
{ {
return true; return true;
@ -204,7 +204,7 @@ function vvvvvwi(type_vvvvvwi)
var type = type_vvvvvwi.some(type_vvvvvwi_SomeFunc); var type = type_vvvvvwi.some(type_vvvvvwi_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (type) if (type)
{ {
jQuery('#jform_content-lbl').closest('.control-group').show(); jQuery('#jform_content-lbl').closest('.control-group').show();
@ -235,7 +235,7 @@ function vvvvvwi(type_vvvvvwi)
// the vvvvvwi Some function // the vvvvvwi Some function
function type_vvvvvwi_SomeFunc(type_vvvvvwi) function type_vvvvvwi_SomeFunc(type_vvvvvwi)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (type_vvvvvwi == 2) if (type_vvvvvwi == 2)
{ {
return true; return true;
@ -246,7 +246,7 @@ function type_vvvvvwi_SomeFunc(type_vvvvvwi)
// the vvvvvwj function // the vvvvvwj function
function vvvvvwj(target_vvvvvwj) function vvvvvwj(target_vvvvvwj)
{ {
// [Interpretation 7216] set the function logic // [Interpretation 7326] set the function logic
if (target_vvvvvwj == 1) if (target_vvvvvwj == 1)
{ {
jQuery('#jform_groups').closest('.control-group').show(); jQuery('#jform_groups').closest('.control-group').show();

View File

@ -276,15 +276,15 @@
</fieldset> </fieldset>
</fields> </fields>
<!-- [Interpretation 9284] Access Control Fields. --> <!-- [Interpretation 9399] Access Control Fields. -->
<fieldset name="accesscontrol"> <fieldset name="accesscontrol">
<!-- [Interpretation 9286] Asset Id Field. Type: Hidden (joomla) --> <!-- [Interpretation 9401] Asset Id Field. Type: Hidden (joomla) -->
<field <field
name="asset_id" name="asset_id"
type="hidden" type="hidden"
filter="unset" filter="unset"
/> />
<!-- [Interpretation 9292] Rules Field. Type: Rules (joomla) --> <!-- [Interpretation 9407] Rules Field. Type: Rules (joomla) -->
<field <field
name="rules" name="rules"
type="rules" type="rules"

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preacher.js @subpackage preacher.js

View File

@ -207,15 +207,15 @@
</fieldset> </fieldset>
</fields> </fields>
<!-- [Interpretation 9284] Access Control Fields. --> <!-- [Interpretation 9399] Access Control Fields. -->
<fieldset name="accesscontrol"> <fieldset name="accesscontrol">
<!-- [Interpretation 9286] Asset Id Field. Type: Hidden (joomla) --> <!-- [Interpretation 9401] Asset Id Field. Type: Hidden (joomla) -->
<field <field
name="asset_id" name="asset_id"
type="hidden" type="hidden"
filter="unset" filter="unset"
/> />
<!-- [Interpretation 9292] Rules Field. Type: Rules (joomla) --> <!-- [Interpretation 9407] Rules Field. Type: Rules (joomla) -->
<field <field
name="rules" name="rules"
type="rules" type="rules"

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series.js @subpackage series.js

View File

@ -194,15 +194,15 @@
</fieldset> </fieldset>
</fields> </fields>
<!-- [Interpretation 9284] Access Control Fields. --> <!-- [Interpretation 9399] Access Control Fields. -->
<fieldset name="accesscontrol"> <fieldset name="accesscontrol">
<!-- [Interpretation 9286] Asset Id Field. Type: Hidden (joomla) --> <!-- [Interpretation 9401] Asset Id Field. Type: Hidden (joomla) -->
<field <field
name="asset_id" name="asset_id"
type="hidden" type="hidden"
filter="unset" filter="unset"
/> />
<!-- [Interpretation 9292] Rules Field. Type: Rules (joomla) --> <!-- [Interpretation 9407] Rules Field. Type: Rules (joomla) -->
<field <field
name="rules" name="rules"
type="rules" type="rules"

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermon.js @subpackage sermon.js
@ -76,7 +76,7 @@ function vvvvvvv(source_vvvvvvv)
var source = source_vvvvvvv.some(source_vvvvvvv_SomeFunc); var source = source_vvvvvvv.some(source_vvvvvvv_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (source) if (source)
{ {
jQuery('#jform_build').closest('.control-group').show(); jQuery('#jform_build').closest('.control-group').show();
@ -107,7 +107,7 @@ function vvvvvvv(source_vvvvvvv)
// the vvvvvvv Some function // the vvvvvvv Some function
function source_vvvvvvv_SomeFunc(source_vvvvvvv) function source_vvvvvvv_SomeFunc(source_vvvvvvv)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (source_vvvvvvv == 2) if (source_vvvvvvv == 2)
{ {
return true; return true;
@ -143,7 +143,7 @@ function vvvvvvw(source_vvvvvvw,build_vvvvvvw)
var build = build_vvvvvvw.some(build_vvvvvvw_SomeFunc); var build = build_vvvvvvw.some(build_vvvvvvw_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (source && build) if (source && build)
{ {
jQuery('.note_auto_dropbox').closest('.control-group').show(); jQuery('.note_auto_dropbox').closest('.control-group').show();
@ -157,7 +157,7 @@ function vvvvvvw(source_vvvvvvw,build_vvvvvvw)
// the vvvvvvw Some function // the vvvvvvw Some function
function source_vvvvvvw_SomeFunc(source_vvvvvvw) function source_vvvvvvw_SomeFunc(source_vvvvvvw)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (source_vvvvvvw == 2) if (source_vvvvvvw == 2)
{ {
return true; return true;
@ -168,7 +168,7 @@ function source_vvvvvvw_SomeFunc(source_vvvvvvw)
// the vvvvvvw Some function // the vvvvvvw Some function
function build_vvvvvvw_SomeFunc(build_vvvvvvw) function build_vvvvvvw_SomeFunc(build_vvvvvvw)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (build_vvvvvvw == 2) if (build_vvvvvvw == 2)
{ {
return true; return true;
@ -204,7 +204,7 @@ function vvvvvvy(source_vvvvvvy,build_vvvvvvy)
var build = build_vvvvvvy.some(build_vvvvvvy_SomeFunc); var build = build_vvvvvvy.some(build_vvvvvvy_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (source && build) if (source && build)
{ {
jQuery('#jform_manual_files').closest('.control-group').show(); jQuery('#jform_manual_files').closest('.control-group').show();
@ -237,7 +237,7 @@ function vvvvvvy(source_vvvvvvy,build_vvvvvvy)
// the vvvvvvy Some function // the vvvvvvy Some function
function source_vvvvvvy_SomeFunc(source_vvvvvvy) function source_vvvvvvy_SomeFunc(source_vvvvvvy)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (source_vvvvvvy == 2) if (source_vvvvvvy == 2)
{ {
return true; return true;
@ -248,7 +248,7 @@ function source_vvvvvvy_SomeFunc(source_vvvvvvy)
// the vvvvvvy Some function // the vvvvvvy Some function
function build_vvvvvvy_SomeFunc(build_vvvvvvy) function build_vvvvvvy_SomeFunc(build_vvvvvvy)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (build_vvvvvvy == 1) if (build_vvvvvvy == 1)
{ {
return true; return true;
@ -284,7 +284,7 @@ function vvvvvvz(build_vvvvvvz,source_vvvvvvz)
var source = source_vvvvvvz.some(source_vvvvvvz_SomeFunc); var source = source_vvvvvvz.some(source_vvvvvvz_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (build && source) if (build && source)
{ {
jQuery('#jform_manual_files').closest('.control-group').show(); jQuery('#jform_manual_files').closest('.control-group').show();
@ -317,7 +317,7 @@ function vvvvvvz(build_vvvvvvz,source_vvvvvvz)
// the vvvvvvz Some function // the vvvvvvz Some function
function build_vvvvvvz_SomeFunc(build_vvvvvvz) function build_vvvvvvz_SomeFunc(build_vvvvvvz)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (build_vvvvvvz == 1) if (build_vvvvvvz == 1)
{ {
return true; return true;
@ -328,7 +328,7 @@ function build_vvvvvvz_SomeFunc(build_vvvvvvz)
// the vvvvvvz Some function // the vvvvvvz Some function
function source_vvvvvvz_SomeFunc(source_vvvvvvz) function source_vvvvvvz_SomeFunc(source_vvvvvvz)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (source_vvvvvvz == 2) if (source_vvvvvvz == 2)
{ {
return true; return true;
@ -352,7 +352,7 @@ function vvvvvwa(source_vvvvvwa)
var source = source_vvvvvwa.some(source_vvvvvwa_SomeFunc); var source = source_vvvvvwa.some(source_vvvvvwa_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (source) if (source)
{ {
jQuery('#jform_local_files').closest('.control-group').show(); jQuery('#jform_local_files').closest('.control-group').show();
@ -383,7 +383,7 @@ function vvvvvwa(source_vvvvvwa)
// the vvvvvwa Some function // the vvvvvwa Some function
function source_vvvvvwa_SomeFunc(source_vvvvvwa) function source_vvvvvwa_SomeFunc(source_vvvvvwa)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (source_vvvvvwa == 1) if (source_vvvvvwa == 1)
{ {
return true; return true;
@ -407,7 +407,7 @@ function vvvvvwb(source_vvvvvwb)
var source = source_vvvvvwb.some(source_vvvvvwb_SomeFunc); var source = source_vvvvvwb.some(source_vvvvvwb_SomeFunc);
// [Interpretation 7194] set this function logic // [Interpretation 7304] set this function logic
if (source) if (source)
{ {
jQuery('#jform_url').closest('.control-group').show(); jQuery('#jform_url').closest('.control-group').show();
@ -438,7 +438,7 @@ function vvvvvwb(source_vvvvvwb)
// the vvvvvwb Some function // the vvvvvwb Some function
function source_vvvvvwb_SomeFunc(source_vvvvvwb) function source_vvvvvwb_SomeFunc(source_vvvvvwb)
{ {
// [Interpretation 7181] set the function logic // [Interpretation 7291] set the function logic
if (source_vvvvvwb == 3) if (source_vvvvvwb == 3)
{ {
return true; return true;
@ -449,7 +449,7 @@ function source_vvvvvwb_SomeFunc(source_vvvvvwb)
// the vvvvvwc function // the vvvvvwc function
function vvvvvwc(link_type_vvvvvwc) function vvvvvwc(link_type_vvvvvwc)
{ {
// [Interpretation 7216] set the function logic // [Interpretation 7326] set the function logic
if (link_type_vvvvvwc == 2) if (link_type_vvvvvwc == 2)
{ {
jQuery('.note_link_directed').closest('.control-group').show(); jQuery('.note_link_directed').closest('.control-group').show();
@ -463,7 +463,7 @@ function vvvvvwc(link_type_vvvvvwc)
// the vvvvvwd function // the vvvvvwd function
function vvvvvwd(link_type_vvvvvwd) function vvvvvwd(link_type_vvvvvwd)
{ {
// [Interpretation 7216] set the function logic // [Interpretation 7326] set the function logic
if (link_type_vvvvvwd == 1) if (link_type_vvvvvwd == 1)
{ {
jQuery('.note_link_encrypted').closest('.control-group').show(); jQuery('.note_link_encrypted').closest('.control-group').show();

View File

@ -360,15 +360,15 @@
</fieldset> </fieldset>
</fields> </fields>
<!-- [Interpretation 9284] Access Control Fields. --> <!-- [Interpretation 9399] Access Control Fields. -->
<fieldset name="accesscontrol"> <fieldset name="accesscontrol">
<!-- [Interpretation 9286] Asset Id Field. Type: Hidden (joomla) --> <!-- [Interpretation 9401] Asset Id Field. Type: Hidden (joomla) -->
<field <field
name="asset_id" name="asset_id"
type="hidden" type="hidden"
filter="unset" filter="unset"
/> />
<!-- [Interpretation 9292] Rules Field. Type: Rules (joomla) --> <!-- [Interpretation 9407] Rules Field. Type: Rules (joomla) -->
<field <field
name="rules" name="rules"
type="rules" type="rules"

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage statistic.js @subpackage statistic.js

View File

@ -194,15 +194,15 @@
</fieldset> </fieldset>
</fields> </fields>
<!-- [Interpretation 9284] Access Control Fields. --> <!-- [Interpretation 9399] Access Control Fields. -->
<fieldset name="accesscontrol"> <fieldset name="accesscontrol">
<!-- [Interpretation 9286] Asset Id Field. Type: Hidden (joomla) --> <!-- [Interpretation 9401] Asset Id Field. Type: Hidden (joomla) -->
<field <field
name="asset_id" name="asset_id"
type="hidden" type="hidden"
filter="unset" filter="unset"
/> />
<!-- [Interpretation 9292] Rules Field. Type: Rules (joomla) --> <!-- [Interpretation 9407] Rules Field. Type: Rules (joomla) -->
<field <field
name="rules" name="rules"
type="rules" type="rules"

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_document.php @subpackage help_document.php
@ -97,7 +97,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
if (!empty($item->groups)) if (!empty($item->groups))
{ {
// [Interpretation 3163] JSON Decode groups. // [Interpretation 3187] JSON Decode groups.
$item->groups = json_decode($item->groups,true); $item->groups = json_decode($item->groups,true);
} }
@ -122,7 +122,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) public function getForm($data = array(), $loadData = true)
{ // [Interpretation 8774] Get the form. { // [Interpretation 8889] Get the form.
$form = $this->loadForm('com_sermondistributor.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData)); $form = $this->loadForm('com_sermondistributor.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) if (empty($form))
@ -132,12 +132,12 @@ class SermondistributorModelHelp_document extends JModelAdmin
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 8859] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. // [Interpretation 8974] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id')) if ($jinput->get('a_id'))
{ {
$id = $jinput->get('a_id', 0, 'INT'); $id = $jinput->get('a_id', 0, 'INT');
} }
// [Interpretation 8864] The back end uses id so we use that the rest of the time and set it to 0 by default. // [Interpretation 8979] The back end uses id so we use that the rest of the time and set it to 0 by default.
else else
{ {
$id = $jinput->get('id', 0, 'INT'); $id = $jinput->get('id', 0, 'INT');
@ -145,52 +145,52 @@ class SermondistributorModelHelp_document extends JModelAdmin
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8870] Check for existing item. // [Interpretation 8985] Check for existing item.
// [Interpretation 8871] Modify the form based on Edit State access controls. // [Interpretation 8986] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('help_document.edit.state', 'com_sermondistributor.help_document.' . (int) $id)) if ($id != 0 && (!$user->authorise('help_document.edit.state', 'com_sermondistributor.help_document.' . (int) $id))
|| ($id == 0 && !$user->authorise('help_document.edit.state', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('help_document.edit.state', 'com_sermondistributor')))
{ {
// [Interpretation 8884] Disable fields for display. // [Interpretation 8999] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true');
// [Interpretation 8887] Disable fields while saving. // [Interpretation 9002] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset');
} }
// [Interpretation 8892] If this is a new item insure the greated by is set. // [Interpretation 9007] If this is a new item insure the greated by is set.
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8895] Set the created_by to this user // [Interpretation 9010] Set the created_by to this user
$form->setValue('created_by', null, $user->id); $form->setValue('created_by', null, $user->id);
} }
// [Interpretation 8898] Modify the form based on Edit Creaded By access controls. // [Interpretation 9013] Modify the form based on Edit Creaded By access controls.
if (!$user->authorise('core.edit.created_by', 'com_sermondistributor')) if (!$user->authorise('core.edit.created_by', 'com_sermondistributor'))
{ {
// [Interpretation 8910] Disable fields for display. // [Interpretation 9025] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true'); $form->setFieldAttribute('created_by', 'disabled', 'true');
// [Interpretation 8912] Disable fields for display. // [Interpretation 9027] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true'); $form->setFieldAttribute('created_by', 'readonly', 'true');
// [Interpretation 8914] Disable fields while saving. // [Interpretation 9029] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset'); $form->setFieldAttribute('created_by', 'filter', 'unset');
} }
// [Interpretation 8917] Modify the form based on Edit Creaded Date access controls. // [Interpretation 9032] Modify the form based on Edit Creaded Date access controls.
if (!$user->authorise('core.edit.created', 'com_sermondistributor')) if (!$user->authorise('core.edit.created', 'com_sermondistributor'))
{ {
// [Interpretation 8929] Disable fields for display. // [Interpretation 9044] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true'); $form->setFieldAttribute('created', 'disabled', 'true');
// [Interpretation 8931] Disable fields while saving. // [Interpretation 9046] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset'); $form->setFieldAttribute('created', 'filter', 'unset');
} }
// [Interpretation 8964] Only load these values if no id is found // [Interpretation 9079] Only load these values if no id is found
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8967] Set redirected field name // [Interpretation 9082] Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING'); $redirectedField = $jinput->get('ref', null, 'STRING');
// [Interpretation 8969] Set redirected field value // [Interpretation 9084] Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT'); $redirectedValue = $jinput->get('refid', 0, 'INT');
if (0 != $redirectedValue && $redirectedField) if (0 != $redirectedValue && $redirectedField)
{ {
// [Interpretation 8973] Now set the local-redirected field default value // [Interpretation 9088] Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
@ -227,7 +227,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
} }
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 9095] The record has been set. Check the record permissions. // [Interpretation 9210] The record has been set. Check the record permissions.
return $user->authorise('help_document.delete', 'com_sermondistributor.help_document.' . (int) $record->id); return $user->authorise('help_document.delete', 'com_sermondistributor.help_document.' . (int) $record->id);
} }
return false; return false;
@ -249,14 +249,14 @@ class SermondistributorModelHelp_document extends JModelAdmin
if ($recordId) if ($recordId)
{ {
// [Interpretation 9182] The record has been set. Check the record permissions. // [Interpretation 9297] The record has been set. Check the record permissions.
$permission = $user->authorise('help_document.edit.state', 'com_sermondistributor.help_document.' . (int) $recordId); $permission = $user->authorise('help_document.edit.state', 'com_sermondistributor.help_document.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
return false; return false;
} }
} }
// [Interpretation 9199] In the absense of better information, revert to the component permissions. // [Interpretation 9314] In the absense of better information, revert to the component permissions.
return $user->authorise('help_document.edit.state', 'com_sermondistributor'); return $user->authorise('help_document.edit.state', 'com_sermondistributor');
} }
@ -271,7 +271,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 9007] Check specific edit permission then general edit permission. // [Interpretation 9122] Check specific edit permission then general edit permission.
$user = JFactory::getUser(); $user = JFactory::getUser();
return $user->authorise('help_document.edit', 'com_sermondistributor.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_sermondistributor'); return $user->authorise('help_document.edit', 'com_sermondistributor.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_sermondistributor');
@ -370,20 +370,20 @@ class SermondistributorModelHelp_document extends JModelAdmin
*/ */
public function validate($form, $data, $group = null) public function validate($form, $data, $group = null)
{ {
// [Interpretation 7978] check if the not_required field is set // [Interpretation 8088] check if the not_required field is set
if (SermondistributorHelper::checkString($data['not_required'])) if (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);
// [Interpretation 7983] now change the required field attributes value // [Interpretation 8093] now change the required field attributes value
foreach ($requiredFields as $requiredField) foreach ($requiredFields as $requiredField)
{ {
// [Interpretation 7986] make sure there is a string value // [Interpretation 8096] make sure there is a string value
if (SermondistributorHelper::checkString($requiredField)) if (SermondistributorHelper::checkString($requiredField))
{ {
// [Interpretation 7989] change to false // [Interpretation 8099] change to false
$form->setFieldAttribute($requiredField, 'required', 'false'); $form->setFieldAttribute($requiredField, 'required', 'false');
// [Interpretation 7991] also clear the data set // [Interpretation 8101] also clear the data set
$data[$requiredField] = ''; $data[$requiredField] = '';
} }
} }
@ -533,7 +533,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 4159] Set some needed variables. // [Interpretation 4183] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -547,12 +547,12 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false; return false;
} }
// [Interpretation 4179] get list of uniqe fields // [Interpretation 4203] get list of uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
// [Interpretation 4181] remove move_copy from array // [Interpretation 4205] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4184] make sure published is set // [Interpretation 4208] make sure published is set
if (!isset($values['published'])) if (!isset($values['published']))
{ {
$values['published'] = 0; $values['published'] = 0;
@ -564,21 +564,21 @@ class SermondistributorModelHelp_document extends JModelAdmin
$newIds = array(); $newIds = array();
// [Interpretation 4221] Parent exists so let's proceed // [Interpretation 4245] Parent exists so let's proceed
while (!empty($pks)) while (!empty($pks))
{ {
// [Interpretation 4224] Pop the first ID off the stack // [Interpretation 4248] Pop the first ID off the stack
$pk = array_shift($pks); $pk = array_shift($pks);
$this->table->reset(); $this->table->reset();
// [Interpretation 4229] only allow copy if user may edit this item. // [Interpretation 4253] only allow copy if user may edit this item.
if (!$this->user->authorise('help_document.edit', $contexts[$pk])) if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
{ {
// [Interpretation 4239] Not fatal error // [Interpretation 4263] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@ -586,19 +586,19 @@ class SermondistributorModelHelp_document extends JModelAdmin
} }
// [Interpretation 4244] Check that the row actually exists // [Interpretation 4268] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4249] Fatal error // [Interpretation 4273] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4256] Not fatal error // [Interpretation 4280] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
@ -606,7 +606,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
list($this->table->title, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->title); list($this->table->title, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->title);
// [Interpretation 4292] insert all set values // [Interpretation 4316] insert all set values
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
@ -618,7 +618,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
} }
} }
// [Interpretation 4304] update all uniqe fields // [Interpretation 4328] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqeFields as $uniqeField)
@ -627,13 +627,13 @@ class SermondistributorModelHelp_document extends JModelAdmin
} }
} }
// [Interpretation 4313] Reset the ID because we are making a copy // [Interpretation 4337] Reset the ID because we are making a copy
$this->table->id = 0; $this->table->id = 0;
// [Interpretation 4316] TODO: Deal with ordering? // [Interpretation 4340] TODO: Deal with ordering?
// [Interpretation 4317] $this->table->ordering = 1; // [Interpretation 4341] $this->table->ordering = 1;
// [Interpretation 4319] Check the row. // [Interpretation 4343] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -646,7 +646,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4332] Store the row. // [Interpretation 4356] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -654,14 +654,14 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false; return false;
} }
// [Interpretation 4340] Get the new item ID // [Interpretation 4364] Get the new item ID
$newId = $this->table->get('id'); $newId = $this->table->get('id');
// [Interpretation 4343] Add the new ID to the array // [Interpretation 4367] Add the new ID to the array
$newIds[$pk] = $newId; $newIds[$pk] = $newId;
} }
// [Interpretation 4347] Clean the cache // [Interpretation 4371] Clean the cache
$this->cleanCache(); $this->cleanCache();
return $newIds; return $newIds;
@ -682,7 +682,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 3961] Set some needed variables. // [Interpretation 3985] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -697,15 +697,15 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false; return false;
} }
// [Interpretation 3983] make sure published only updates if user has the permission. // [Interpretation 4007] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('help_document.edit.state')) if (isset($values['published']) && !$this->canDo->get('help_document.edit.state'))
{ {
unset($values['published']); unset($values['published']);
} }
// [Interpretation 3996] remove move_copy from array // [Interpretation 4020] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4017] Parent exists so we proceed // [Interpretation 4041] Parent exists so we proceed
foreach ($pks as $pk) foreach ($pks as $pk)
{ {
if (!$this->user->authorise('help_document.edit', $contexts[$pk])) if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
@ -715,30 +715,30 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false; return false;
} }
// [Interpretation 4034] Check that the row actually exists // [Interpretation 4058] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4039] Fatal error // [Interpretation 4063] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4046] Not fatal error // [Interpretation 4070] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
} }
// [Interpretation 4052] insert all set values. // [Interpretation 4076] insert all set values.
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
{ {
// [Interpretation 4057] Do special action for access. // [Interpretation 4081] Do special action for access.
if ('access' == $key && strlen($value) > 0) if ('access' == $key && strlen($value) > 0)
{ {
$this->table->$key = $value; $this->table->$key = $value;
@ -751,7 +751,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
} }
// [Interpretation 4069] Check the row. // [Interpretation 4093] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -764,7 +764,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4082] Store the row. // [Interpretation 4106] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -773,7 +773,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
} }
} }
// [Interpretation 4091] Clean the cache // [Interpretation 4115] Clean the cache
$this->cleanCache(); $this->cleanCache();
return true; return true;
@ -803,7 +803,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$data['metadata'] = (string) $metadata; $data['metadata'] = (string) $metadata;
} }
// [Interpretation 3273] Set the groups string to JSON string. // [Interpretation 3297] Set the groups string to JSON string.
if (isset($data['groups'])) if (isset($data['groups']))
{ {
$data['groups'] = (string) json_encode($data['groups']); $data['groups'] = (string) json_encode($data['groups']);
@ -817,7 +817,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// [Interpretation 4373] Alter the title for save as copy // [Interpretation 4397] Alter the title for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
$origTable = clone $this->getTable(); $origTable = clone $this->getTable();
@ -840,7 +840,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$data['published'] = 0; $data['published'] = 0;
} }
// [Interpretation 4400] Automatic handling of alias for empty fields // [Interpretation 4424] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{ {
if ($data['alias'] == null) if ($data['alias'] == null)
@ -871,10 +871,10 @@ class SermondistributorModelHelp_document extends JModelAdmin
} }
} }
// [Interpretation 4439] Alter the uniqe field for save as copy // [Interpretation 4463] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
// [Interpretation 4442] Automatic handling of other uniqe fields // [Interpretation 4466] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
@ -928,7 +928,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
protected function _generateNewTitle($alias, $title) protected function _generateNewTitle($alias, $title)
{ {
// [Interpretation 4473] Alter the title & alias // [Interpretation 4497] Alter the title & alias
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array('alias' => $alias))) while ($table->load(array('alias' => $alias)))

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_documents.php @subpackage help_documents.php
@ -113,16 +113,16 @@ class SermondistributorModelHelp_documents extends JModelList
*/ */
public function getItems() public function getItems()
{ {
// [Interpretation 9768] check in items // [Interpretation 9883] check in items
$this->checkInNow(); $this->checkInNow();
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -133,7 +133,7 @@ class SermondistributorModelHelp_documents extends JModelList
continue; continue;
} }
// [Interpretation 9914] decode groups // [Interpretation 10029] decode groups
$groupsArray = json_decode($item->groups, true); $groupsArray = json_decode($item->groups, true);
if (SermondistributorHelper::checkArray($groupsArray)) if (SermondistributorHelper::checkArray($groupsArray))
{ {
@ -156,14 +156,14 @@ class SermondistributorModelHelp_documents extends JModelList
} }
} }
// [Interpretation 10109] set selection value to a translatable value // [Interpretation 10224] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
// [Interpretation 10116] convert type // [Interpretation 10231] convert type
$item->type = $this->selectionTranslation($item->type, 'type'); $item->type = $this->selectionTranslation($item->type, 'type');
// [Interpretation 10116] convert location // [Interpretation 10231] convert location
$item->location = $this->selectionTranslation($item->location, 'location'); $item->location = $this->selectionTranslation($item->location, 'location');
} }
} }
@ -180,7 +180,7 @@ class SermondistributorModelHelp_documents extends JModelList
*/ */
public function selectionTranslation($value,$name) public function selectionTranslation($value,$name)
{ {
// [Interpretation 10142] Array of type language strings // [Interpretation 10257] Array of type language strings
if ($name == 'type') if ($name == 'type')
{ {
$typeArray = array( $typeArray = array(
@ -189,20 +189,20 @@ class SermondistributorModelHelp_documents extends JModelList
2 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TEXT', 2 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TEXT',
3 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL' 3 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($typeArray[$value]) && SermondistributorHelper::checkString($typeArray[$value])) if (isset($typeArray[$value]) && SermondistributorHelper::checkString($typeArray[$value]))
{ {
return $typeArray[$value]; return $typeArray[$value];
} }
} }
// [Interpretation 10142] Array of location language strings // [Interpretation 10257] Array of location language strings
if ($name == 'location') if ($name == 'location')
{ {
$locationArray = array( $locationArray = array(
1 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN', 1 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN',
2 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE' 2 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($locationArray[$value]) && SermondistributorHelper::checkString($locationArray[$value])) if (isset($locationArray[$value]) && SermondistributorHelper::checkString($locationArray[$value]))
{ {
return $locationArray[$value]; return $locationArray[$value];
@ -218,19 +218,19 @@ class SermondistributorModelHelp_documents extends JModelList
*/ */
protected function getListQuery() protected function getListQuery()
{ {
// [Interpretation 6723] Get the user object. // [Interpretation 6833] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6725] Create a new query object. // [Interpretation 6835] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6728] Select some fields // [Interpretation 6838] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6735] From the sermondistributor_item table // [Interpretation 6845] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_help_document', 'a')); $query->from($db->quoteName('#__sermondistributor_help_document', 'a'));
// [Interpretation 6749] Filter by published state // [Interpretation 6859] Filter by published state
$published = $this->getState('filter.published'); $published = $this->getState('filter.published');
if (is_numeric($published)) if (is_numeric($published))
{ {
@ -241,21 +241,21 @@ class SermondistributorModelHelp_documents extends JModelList
$query->where('(a.published = 0 OR a.published = 1)'); $query->where('(a.published = 0 OR a.published = 1)');
} }
// [Interpretation 6761] Join over the asset groups. // [Interpretation 6871] Join over the asset groups.
$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');
// [Interpretation 6764] Filter by access level. // [Interpretation 6874] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6769] Implement View Level Access // [Interpretation 6879] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6846] Filter by search. // [Interpretation 6956] Filter by search.
$search = $this->getState('filter.search'); $search = $this->getState('filter.search');
if (!empty($search)) if (!empty($search))
{ {
@ -270,28 +270,28 @@ class SermondistributorModelHelp_documents extends JModelList
} }
} }
// [Interpretation 6971] Filter by Type. // [Interpretation 7081] Filter by Type.
if ($type = $this->getState('filter.type')) if ($type = $this->getState('filter.type'))
{ {
$query->where('a.type = ' . $db->quote($db->escape($type, true))); $query->where('a.type = ' . $db->quote($db->escape($type, true)));
} }
// [Interpretation 6971] Filter by Location. // [Interpretation 7081] Filter by Location.
if ($location = $this->getState('filter.location')) if ($location = $this->getState('filter.location'))
{ {
$query->where('a.location = ' . $db->quote($db->escape($location, true))); $query->where('a.location = ' . $db->quote($db->escape($location, true)));
} }
// [Interpretation 6971] Filter by Admin_view. // [Interpretation 7081] Filter by Admin_view.
if ($admin_view = $this->getState('filter.admin_view')) if ($admin_view = $this->getState('filter.admin_view'))
{ {
$query->where('a.admin_view = ' . $db->quote($db->escape($admin_view, true))); $query->where('a.admin_view = ' . $db->quote($db->escape($admin_view, true)));
} }
// [Interpretation 6971] Filter by Site_view. // [Interpretation 7081] Filter by Site_view.
if ($site_view = $this->getState('filter.site_view')) if ($site_view = $this->getState('filter.site_view'))
{ {
$query->where('a.site_view = ' . $db->quote($db->escape($site_view, true))); $query->where('a.site_view = ' . $db->quote($db->escape($site_view, true)));
} }
// [Interpretation 6805] Add the list ordering clause. // [Interpretation 6915] 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', 'asc');
if ($orderCol != '') if ($orderCol != '')
@ -309,42 +309,42 @@ class SermondistributorModelHelp_documents extends JModelList
*/ */
public function getExportData($pks) public function getExportData($pks)
{ {
// [Interpretation 6513] setup the query // [Interpretation 6623] setup the query
if (SermondistributorHelper::checkArray($pks)) if (SermondistributorHelper::checkArray($pks))
{ {
// [Interpretation 6516] Get the user object. // [Interpretation 6626] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6518] Create a new query object. // [Interpretation 6628] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6521] Select some fields // [Interpretation 6631] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6523] From the sermondistributor_help_document table // [Interpretation 6633] 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) . ')'); $query->where('a.id IN (' . implode(',',$pks) . ')');
// [Interpretation 6533] Implement View Level Access // [Interpretation 6643] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6540] Order the results by ordering // [Interpretation 6650] Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6542] Load the items // [Interpretation 6652] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -355,13 +355,13 @@ class SermondistributorModelHelp_documents extends JModelList
continue; continue;
} }
// [Interpretation 10056] unset the values we don't want exported. // [Interpretation 10171] unset the values we don't want exported.
unset($item->asset_id); unset($item->asset_id);
unset($item->checked_out); unset($item->checked_out);
unset($item->checked_out_time); unset($item->checked_out_time);
} }
} }
// [Interpretation 10065] Add headers to items array. // [Interpretation 10180] Add headers to items array.
$headers = $this->getExImPortHeaders(); $headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
@ -380,13 +380,13 @@ class SermondistributorModelHelp_documents extends JModelList
*/ */
public function getExImPortHeaders() public function getExImPortHeaders()
{ {
// [Interpretation 6562] Get a db connection. // [Interpretation 6672] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 6564] get the columns // [Interpretation 6674] get the columns
$columns = $db->getTableColumns("#__sermondistributor_help_document"); $columns = $db->getTableColumns("#__sermondistributor_help_document");
if (SermondistributorHelper::checkArray($columns)) if (SermondistributorHelper::checkArray($columns))
{ {
// [Interpretation 6568] remove the headers you don't import/export. // [Interpretation 6678] remove the headers you don't import/export.
unset($columns['asset_id']); unset($columns['asset_id']);
unset($columns['checked_out']); unset($columns['checked_out']);
unset($columns['checked_out_time']); unset($columns['checked_out_time']);
@ -408,7 +408,7 @@ class SermondistributorModelHelp_documents extends JModelList
*/ */
protected function getStoreId($id = '') protected function getStoreId($id = '')
{ {
// [Interpretation 9391] Compile the store id. // [Interpretation 9506] Compile the store id.
$id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.published');
@ -432,15 +432,15 @@ class SermondistributorModelHelp_documents extends JModelList
*/ */
protected function checkInNow() protected function checkInNow()
{ {
// [Interpretation 9784] Get set check in time // [Interpretation 9899] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time) if ($time)
{ {
// [Interpretation 9789] Get a db connection. // [Interpretation 9904] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 9791] reset query // [Interpretation 9906] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select('*'); $query->select('*');
$query->from($db->quoteName('#__sermondistributor_help_document')); $query->from($db->quoteName('#__sermondistributor_help_document'));
@ -448,24 +448,24 @@ class SermondistributorModelHelp_documents extends JModelList
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
// [Interpretation 9799] Get Yesterdays date // [Interpretation 9914] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql(); $date = JFactory::getDate()->modify($time)->toSql();
// [Interpretation 9801] reset query // [Interpretation 9916] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 9803] Fields to update. // [Interpretation 9918] Fields to update.
$fields = array( $fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0' $db->quoteName('checked_out') . '=0'
); );
// [Interpretation 9808] Conditions for which records should be updated. // [Interpretation 9923] Conditions for which records should be updated.
$conditions = array( $conditions = array(
$db->quoteName('checked_out') . '!=0', $db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\'' $db->quoteName('checked_out_time') . '<\''.$date.'\''
); );
// [Interpretation 9813] Check table // [Interpretation 9928] Check table
$query->update($db->quoteName('#__sermondistributor_help_document'))->set($fields)->where($conditions); $query->update($db->quoteName('#__sermondistributor_help_document'))->set($fields)->where($conditions);
$db->setQuery($query); $db->setQuery($query);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage import.php @subpackage import.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preacher.php @subpackage preacher.php
@ -113,29 +113,29 @@ class SermondistributorModelPreacher extends JModelAdmin
*/ */
public function getVvvsermons() public function getVvvsermons()
{ {
// [Interpretation 6240] Get the user object. // [Interpretation 6337] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6242] Create a new query object. // [Interpretation 6339] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6245] Select some fields // [Interpretation 6342] Select some fields
$query->select('a.*'); $query->select('a.*');
$query->select($db->quoteName('c.title','category_title')); $query->select($db->quoteName('c.title','category_title'));
// [Interpretation 6252] From the sermondistributor_sermon table // [Interpretation 6349] From the sermondistributor_sermon table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a')); $query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')'); $query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')');
// [Interpretation 6876] From the sermondistributor_preacher table. // [Interpretation 6986] From the sermondistributor_preacher table.
$query->select($db->quoteName('g.name','preacher_name')); $query->select($db->quoteName('g.name','preacher_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'g') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('g.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'g') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('g.id') . ')');
// [Interpretation 6876] From the sermondistributor_series table. // [Interpretation 6986] From the sermondistributor_series table.
$query->select($db->quoteName('h.name','series_name')); $query->select($db->quoteName('h.name','series_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'h') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('h.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'h') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('h.id') . ')');
// [Interpretation 6268] Filter by preachervvvv global. // [Interpretation 6365] Filter by preachervvvv global.
$preachervvvv = $this->preachervvvv; $preachervvvv = $this->preachervvvv;
if (is_numeric($preachervvvv )) if (is_numeric($preachervvvv ))
{ {
@ -150,35 +150,36 @@ class SermondistributorModelPreacher extends JModelAdmin
$query->where('a.preacher = -5'); $query->where('a.preacher = -5');
} }
// [Interpretation 6285] Join over the asset groups. // [Interpretation 6382] Join over the asset groups.
$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');
// [Interpretation 6288] Filter by access level. // [Interpretation 6385] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6293] Implement View Level Access // [Interpretation 6390] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6300] Order the results by ordering // [Interpretation 6397] Order the results by ordering
$query->order('a.published ASC');
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6302] Load the items // [Interpretation 6399] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -192,14 +193,14 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
} }
// [Interpretation 10109] set selection value to a translatable value // [Interpretation 10224] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
// [Interpretation 10116] convert link_type // [Interpretation 10231] convert link_type
$item->link_type = $this->selectionTranslationVvvsermons($item->link_type, 'link_type'); $item->link_type = $this->selectionTranslationVvvsermons($item->link_type, 'link_type');
// [Interpretation 10116] convert source // [Interpretation 10231] convert source
$item->source = $this->selectionTranslationVvvsermons($item->source, 'source'); $item->source = $this->selectionTranslationVvvsermons($item->source, 'source');
} }
} }
@ -216,20 +217,20 @@ class SermondistributorModelPreacher extends JModelAdmin
*/ */
public function selectionTranslationVvvsermons($value,$name) public function selectionTranslationVvvsermons($value,$name)
{ {
// [Interpretation 10142] Array of link_type language strings // [Interpretation 10257] Array of link_type language strings
if ($name == 'link_type') if ($name == 'link_type')
{ {
$link_typeArray = array( $link_typeArray = array(
1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED', 1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED',
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT' 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value])) if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value]))
{ {
return $link_typeArray[$value]; return $link_typeArray[$value];
} }
} }
// [Interpretation 10142] Array of source language strings // [Interpretation 10257] Array of source language strings
if ($name == 'source') if ($name == 'source')
{ {
$sourceArray = array( $sourceArray = array(
@ -238,7 +239,7 @@ class SermondistributorModelPreacher extends JModelAdmin
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX', 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX',
3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value])) if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value]))
{ {
return $sourceArray[$value]; return $sourceArray[$value];
@ -258,7 +259,7 @@ class SermondistributorModelPreacher extends JModelAdmin
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) public function getForm($data = array(), $loadData = true)
{ // [Interpretation 8774] Get the form. { // [Interpretation 8889] Get the form.
$form = $this->loadForm('com_sermondistributor.preacher', 'preacher', array('control' => 'jform', 'load_data' => $loadData)); $form = $this->loadForm('com_sermondistributor.preacher', 'preacher', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) if (empty($form))
@ -268,12 +269,12 @@ class SermondistributorModelPreacher extends JModelAdmin
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 8859] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. // [Interpretation 8974] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id')) if ($jinput->get('a_id'))
{ {
$id = $jinput->get('a_id', 0, 'INT'); $id = $jinput->get('a_id', 0, 'INT');
} }
// [Interpretation 8864] The back end uses id so we use that the rest of the time and set it to 0 by default. // [Interpretation 8979] The back end uses id so we use that the rest of the time and set it to 0 by default.
else else
{ {
$id = $jinput->get('id', 0, 'INT'); $id = $jinput->get('id', 0, 'INT');
@ -281,54 +282,54 @@ class SermondistributorModelPreacher extends JModelAdmin
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8870] Check for existing item. // [Interpretation 8985] Check for existing item.
// [Interpretation 8871] Modify the form based on Edit State access controls. // [Interpretation 8986] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('preacher.edit.state', 'com_sermondistributor.preacher.' . (int) $id)) if ($id != 0 && (!$user->authorise('preacher.edit.state', 'com_sermondistributor.preacher.' . (int) $id))
|| ($id == 0 && !$user->authorise('preacher.edit.state', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('preacher.edit.state', 'com_sermondistributor')))
{ {
// [Interpretation 8884] Disable fields for display. // [Interpretation 8999] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true');
// [Interpretation 8887] Disable fields while saving. // [Interpretation 9002] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset');
} }
// [Interpretation 8892] If this is a new item insure the greated by is set. // [Interpretation 9007] If this is a new item insure the greated by is set.
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8895] Set the created_by to this user // [Interpretation 9010] Set the created_by to this user
$form->setValue('created_by', null, $user->id); $form->setValue('created_by', null, $user->id);
} }
// [Interpretation 8898] Modify the form based on Edit Creaded By access controls. // [Interpretation 9013] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('preacher.edit.created_by', 'com_sermondistributor.preacher.' . (int) $id)) if ($id != 0 && (!$user->authorise('preacher.edit.created_by', 'com_sermondistributor.preacher.' . (int) $id))
|| ($id == 0 && !$user->authorise('preacher.edit.created_by', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('preacher.edit.created_by', 'com_sermondistributor')))
{ {
// [Interpretation 8910] Disable fields for display. // [Interpretation 9025] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true'); $form->setFieldAttribute('created_by', 'disabled', 'true');
// [Interpretation 8912] Disable fields for display. // [Interpretation 9027] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true'); $form->setFieldAttribute('created_by', 'readonly', 'true');
// [Interpretation 8914] Disable fields while saving. // [Interpretation 9029] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset'); $form->setFieldAttribute('created_by', 'filter', 'unset');
} }
// [Interpretation 8917] Modify the form based on Edit Creaded Date access controls. // [Interpretation 9032] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('preacher.edit.created', 'com_sermondistributor.preacher.' . (int) $id)) if ($id != 0 && (!$user->authorise('preacher.edit.created', 'com_sermondistributor.preacher.' . (int) $id))
|| ($id == 0 && !$user->authorise('preacher.edit.created', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('preacher.edit.created', 'com_sermondistributor')))
{ {
// [Interpretation 8929] Disable fields for display. // [Interpretation 9044] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true'); $form->setFieldAttribute('created', 'disabled', 'true');
// [Interpretation 8931] Disable fields while saving. // [Interpretation 9046] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset'); $form->setFieldAttribute('created', 'filter', 'unset');
} }
// [Interpretation 8964] Only load these values if no id is found // [Interpretation 9079] Only load these values if no id is found
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8967] Set redirected field name // [Interpretation 9082] Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING'); $redirectedField = $jinput->get('ref', null, 'STRING');
// [Interpretation 8969] Set redirected field value // [Interpretation 9084] Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT'); $redirectedValue = $jinput->get('refid', 0, 'INT');
if (0 != $redirectedValue && $redirectedField) if (0 != $redirectedValue && $redirectedField)
{ {
// [Interpretation 8973] Now set the local-redirected field default value // [Interpretation 9088] Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
@ -365,7 +366,7 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 9095] The record has been set. Check the record permissions. // [Interpretation 9210] The record has been set. Check the record permissions.
return $user->authorise('preacher.delete', 'com_sermondistributor.preacher.' . (int) $record->id); return $user->authorise('preacher.delete', 'com_sermondistributor.preacher.' . (int) $record->id);
} }
return false; return false;
@ -387,14 +388,14 @@ class SermondistributorModelPreacher extends JModelAdmin
if ($recordId) if ($recordId)
{ {
// [Interpretation 9182] The record has been set. Check the record permissions. // [Interpretation 9297] The record has been set. Check the record permissions.
$permission = $user->authorise('preacher.edit.state', 'com_sermondistributor.preacher.' . (int) $recordId); $permission = $user->authorise('preacher.edit.state', 'com_sermondistributor.preacher.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
return false; return false;
} }
} }
// [Interpretation 9199] In the absense of better information, revert to the component permissions. // [Interpretation 9314] In the absense of better information, revert to the component permissions.
return $user->authorise('preacher.edit.state', 'com_sermondistributor'); return $user->authorise('preacher.edit.state', 'com_sermondistributor');
} }
@ -409,7 +410,7 @@ class SermondistributorModelPreacher extends JModelAdmin
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 9007] Check specific edit permission then general edit permission. // [Interpretation 9122] Check specific edit permission then general edit permission.
$user = JFactory::getUser(); $user = JFactory::getUser();
return $user->authorise('preacher.edit', 'com_sermondistributor.preacher.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('preacher.edit', 'com_sermondistributor'); return $user->authorise('preacher.edit', 'com_sermondistributor.preacher.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('preacher.edit', 'com_sermondistributor');
@ -635,7 +636,7 @@ class SermondistributorModelPreacher extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 4159] Set some needed variables. // [Interpretation 4183] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -649,12 +650,12 @@ class SermondistributorModelPreacher extends JModelAdmin
return false; return false;
} }
// [Interpretation 4179] get list of uniqe fields // [Interpretation 4203] get list of uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
// [Interpretation 4181] remove move_copy from array // [Interpretation 4205] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4184] make sure published is set // [Interpretation 4208] make sure published is set
if (!isset($values['published'])) if (!isset($values['published']))
{ {
$values['published'] = 0; $values['published'] = 0;
@ -666,21 +667,21 @@ class SermondistributorModelPreacher extends JModelAdmin
$newIds = array(); $newIds = array();
// [Interpretation 4221] Parent exists so let's proceed // [Interpretation 4245] Parent exists so let's proceed
while (!empty($pks)) while (!empty($pks))
{ {
// [Interpretation 4224] Pop the first ID off the stack // [Interpretation 4248] Pop the first ID off the stack
$pk = array_shift($pks); $pk = array_shift($pks);
$this->table->reset(); $this->table->reset();
// [Interpretation 4229] only allow copy if user may edit this item. // [Interpretation 4253] only allow copy if user may edit this item.
if (!$this->user->authorise('preacher.edit', $contexts[$pk])) if (!$this->user->authorise('preacher.edit', $contexts[$pk]))
{ {
// [Interpretation 4239] Not fatal error // [Interpretation 4263] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@ -688,19 +689,19 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
// [Interpretation 4244] Check that the row actually exists // [Interpretation 4268] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4249] Fatal error // [Interpretation 4273] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4256] Not fatal error // [Interpretation 4280] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
@ -708,7 +709,7 @@ class SermondistributorModelPreacher extends JModelAdmin
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
// [Interpretation 4292] insert all set values // [Interpretation 4316] insert all set values
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
@ -720,7 +721,7 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
} }
// [Interpretation 4304] update all uniqe fields // [Interpretation 4328] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqeFields as $uniqeField)
@ -729,13 +730,13 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
} }
// [Interpretation 4313] Reset the ID because we are making a copy // [Interpretation 4337] Reset the ID because we are making a copy
$this->table->id = 0; $this->table->id = 0;
// [Interpretation 4316] TODO: Deal with ordering? // [Interpretation 4340] TODO: Deal with ordering?
// [Interpretation 4317] $this->table->ordering = 1; // [Interpretation 4341] $this->table->ordering = 1;
// [Interpretation 4319] Check the row. // [Interpretation 4343] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -748,7 +749,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4332] Store the row. // [Interpretation 4356] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -756,14 +757,14 @@ class SermondistributorModelPreacher extends JModelAdmin
return false; return false;
} }
// [Interpretation 4340] Get the new item ID // [Interpretation 4364] Get the new item ID
$newId = $this->table->get('id'); $newId = $this->table->get('id');
// [Interpretation 4343] Add the new ID to the array // [Interpretation 4367] Add the new ID to the array
$newIds[$pk] = $newId; $newIds[$pk] = $newId;
} }
// [Interpretation 4347] Clean the cache // [Interpretation 4371] Clean the cache
$this->cleanCache(); $this->cleanCache();
return $newIds; return $newIds;
@ -784,7 +785,7 @@ class SermondistributorModelPreacher extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 3961] Set some needed variables. // [Interpretation 3985] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -799,15 +800,15 @@ class SermondistributorModelPreacher extends JModelAdmin
return false; return false;
} }
// [Interpretation 3983] make sure published only updates if user has the permission. // [Interpretation 4007] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('preacher.edit.state')) if (isset($values['published']) && !$this->canDo->get('preacher.edit.state'))
{ {
unset($values['published']); unset($values['published']);
} }
// [Interpretation 3996] remove move_copy from array // [Interpretation 4020] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4017] Parent exists so we proceed // [Interpretation 4041] Parent exists so we proceed
foreach ($pks as $pk) foreach ($pks as $pk)
{ {
if (!$this->user->authorise('preacher.edit', $contexts[$pk])) if (!$this->user->authorise('preacher.edit', $contexts[$pk]))
@ -817,30 +818,30 @@ class SermondistributorModelPreacher extends JModelAdmin
return false; return false;
} }
// [Interpretation 4034] Check that the row actually exists // [Interpretation 4058] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4039] Fatal error // [Interpretation 4063] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4046] Not fatal error // [Interpretation 4070] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
} }
// [Interpretation 4052] insert all set values. // [Interpretation 4076] insert all set values.
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
{ {
// [Interpretation 4057] Do special action for access. // [Interpretation 4081] Do special action for access.
if ('access' == $key && strlen($value) > 0) if ('access' == $key && strlen($value) > 0)
{ {
$this->table->$key = $value; $this->table->$key = $value;
@ -853,7 +854,7 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
// [Interpretation 4069] Check the row. // [Interpretation 4093] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -866,7 +867,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4082] Store the row. // [Interpretation 4106] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -875,7 +876,7 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
} }
// [Interpretation 4091] Clean the cache // [Interpretation 4115] Clean the cache
$this->cleanCache(); $this->cleanCache();
return true; return true;
@ -913,7 +914,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// [Interpretation 4373] Alter the name for save as copy // [Interpretation 4397] Alter the name for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
$origTable = clone $this->getTable(); $origTable = clone $this->getTable();
@ -936,7 +937,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$data['published'] = 0; $data['published'] = 0;
} }
// [Interpretation 4400] Automatic handling of alias for empty fields // [Interpretation 4424] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{ {
if ($data['alias'] == null) if ($data['alias'] == null)
@ -967,10 +968,10 @@ class SermondistributorModelPreacher extends JModelAdmin
} }
} }
// [Interpretation 4439] Alter the uniqe field for save as copy // [Interpretation 4463] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
// [Interpretation 4442] Automatic handling of other uniqe fields // [Interpretation 4466] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
@ -1024,7 +1025,7 @@ class SermondistributorModelPreacher extends JModelAdmin
protected function _generateNewTitle($alias, $title) protected function _generateNewTitle($alias, $title)
{ {
// [Interpretation 4473] Alter the title & alias // [Interpretation 4497] Alter the title & alias
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array('alias' => $alias))) while ($table->load(array('alias' => $alias)))

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preachers.php @subpackage preachers.php
@ -101,16 +101,16 @@ class SermondistributorModelPreachers extends JModelList
*/ */
public function getItems() public function getItems()
{ {
// [Interpretation 9768] check in items // [Interpretation 9883] check in items
$this->checkInNow(); $this->checkInNow();
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -135,19 +135,19 @@ class SermondistributorModelPreachers extends JModelList
*/ */
protected function getListQuery() protected function getListQuery()
{ {
// [Interpretation 6723] Get the user object. // [Interpretation 6833] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6725] Create a new query object. // [Interpretation 6835] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6728] Select some fields // [Interpretation 6838] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6735] From the sermondistributor_item table // [Interpretation 6845] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_preacher', 'a')); $query->from($db->quoteName('#__sermondistributor_preacher', 'a'));
// [Interpretation 6749] Filter by published state // [Interpretation 6859] Filter by published state
$published = $this->getState('filter.published'); $published = $this->getState('filter.published');
if (is_numeric($published)) if (is_numeric($published))
{ {
@ -158,21 +158,21 @@ class SermondistributorModelPreachers extends JModelList
$query->where('(a.published = 0 OR a.published = 1)'); $query->where('(a.published = 0 OR a.published = 1)');
} }
// [Interpretation 6761] Join over the asset groups. // [Interpretation 6871] Join over the asset groups.
$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');
// [Interpretation 6764] Filter by access level. // [Interpretation 6874] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6769] Implement View Level Access // [Interpretation 6879] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6846] Filter by search. // [Interpretation 6956] Filter by search.
$search = $this->getState('filter.search'); $search = $this->getState('filter.search');
if (!empty($search)) if (!empty($search))
{ {
@ -188,7 +188,7 @@ class SermondistributorModelPreachers extends JModelList
} }
// [Interpretation 6805] Add the list ordering clause. // [Interpretation 6915] 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', 'asc');
if ($orderCol != '') if ($orderCol != '')
@ -206,42 +206,42 @@ class SermondistributorModelPreachers extends JModelList
*/ */
public function getExportData($pks) public function getExportData($pks)
{ {
// [Interpretation 6513] setup the query // [Interpretation 6623] setup the query
if (SermondistributorHelper::checkArray($pks)) if (SermondistributorHelper::checkArray($pks))
{ {
// [Interpretation 6516] Get the user object. // [Interpretation 6626] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6518] Create a new query object. // [Interpretation 6628] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6521] Select some fields // [Interpretation 6631] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6523] From the sermondistributor_preacher table // [Interpretation 6633] 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) . ')'); $query->where('a.id IN (' . implode(',',$pks) . ')');
// [Interpretation 6533] Implement View Level Access // [Interpretation 6643] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6540] Order the results by ordering // [Interpretation 6650] Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6542] Load the items // [Interpretation 6652] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -252,13 +252,13 @@ class SermondistributorModelPreachers extends JModelList
continue; continue;
} }
// [Interpretation 10056] unset the values we don't want exported. // [Interpretation 10171] unset the values we don't want exported.
unset($item->asset_id); unset($item->asset_id);
unset($item->checked_out); unset($item->checked_out);
unset($item->checked_out_time); unset($item->checked_out_time);
} }
} }
// [Interpretation 10065] Add headers to items array. // [Interpretation 10180] Add headers to items array.
$headers = $this->getExImPortHeaders(); $headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
@ -277,13 +277,13 @@ class SermondistributorModelPreachers extends JModelList
*/ */
public function getExImPortHeaders() public function getExImPortHeaders()
{ {
// [Interpretation 6562] Get a db connection. // [Interpretation 6672] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 6564] get the columns // [Interpretation 6674] get the columns
$columns = $db->getTableColumns("#__sermondistributor_preacher"); $columns = $db->getTableColumns("#__sermondistributor_preacher");
if (SermondistributorHelper::checkArray($columns)) if (SermondistributorHelper::checkArray($columns))
{ {
// [Interpretation 6568] remove the headers you don't import/export. // [Interpretation 6678] remove the headers you don't import/export.
unset($columns['asset_id']); unset($columns['asset_id']);
unset($columns['checked_out']); unset($columns['checked_out']);
unset($columns['checked_out_time']); unset($columns['checked_out_time']);
@ -305,7 +305,7 @@ class SermondistributorModelPreachers extends JModelList
*/ */
protected function getStoreId($id = '') protected function getStoreId($id = '')
{ {
// [Interpretation 9391] Compile the store id. // [Interpretation 9506] Compile the store id.
$id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.published');
@ -326,15 +326,15 @@ class SermondistributorModelPreachers extends JModelList
*/ */
protected function checkInNow() protected function checkInNow()
{ {
// [Interpretation 9784] Get set check in time // [Interpretation 9899] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time) if ($time)
{ {
// [Interpretation 9789] Get a db connection. // [Interpretation 9904] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 9791] reset query // [Interpretation 9906] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select('*'); $query->select('*');
$query->from($db->quoteName('#__sermondistributor_preacher')); $query->from($db->quoteName('#__sermondistributor_preacher'));
@ -342,24 +342,24 @@ class SermondistributorModelPreachers extends JModelList
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
// [Interpretation 9799] Get Yesterdays date // [Interpretation 9914] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql(); $date = JFactory::getDate()->modify($time)->toSql();
// [Interpretation 9801] reset query // [Interpretation 9916] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 9803] Fields to update. // [Interpretation 9918] Fields to update.
$fields = array( $fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0' $db->quoteName('checked_out') . '=0'
); );
// [Interpretation 9808] Conditions for which records should be updated. // [Interpretation 9923] Conditions for which records should be updated.
$conditions = array( $conditions = array(
$db->quoteName('checked_out') . '!=0', $db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\'' $db->quoteName('checked_out_time') . '<\''.$date.'\''
); );
// [Interpretation 9813] Check table // [Interpretation 9928] Check table
$query->update($db->quoteName('#__sermondistributor_preacher'))->set($fields)->where($conditions); $query->update($db->quoteName('#__sermondistributor_preacher'))->set($fields)->where($conditions);
$db->setQuery($query); $db->setQuery($query);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series.php @subpackage series.php
@ -113,29 +113,29 @@ class SermondistributorModelSeries extends JModelAdmin
*/ */
public function getVwcsermons() public function getVwcsermons()
{ {
// [Interpretation 6240] Get the user object. // [Interpretation 6337] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6242] Create a new query object. // [Interpretation 6339] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6245] Select some fields // [Interpretation 6342] Select some fields
$query->select('a.*'); $query->select('a.*');
$query->select($db->quoteName('c.title','category_title')); $query->select($db->quoteName('c.title','category_title'));
// [Interpretation 6252] From the sermondistributor_sermon table // [Interpretation 6349] From the sermondistributor_sermon table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a')); $query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')'); $query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')');
// [Interpretation 6876] From the sermondistributor_preacher table. // [Interpretation 6986] From the sermondistributor_preacher table.
$query->select($db->quoteName('g.name','preacher_name')); $query->select($db->quoteName('g.name','preacher_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'g') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('g.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'g') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('g.id') . ')');
// [Interpretation 6876] From the sermondistributor_series table. // [Interpretation 6986] From the sermondistributor_series table.
$query->select($db->quoteName('h.name','series_name')); $query->select($db->quoteName('h.name','series_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'h') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('h.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'h') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('h.id') . ')');
// [Interpretation 6268] Filter by seriesvvvx global. // [Interpretation 6365] Filter by seriesvvvx global.
$seriesvvvx = $this->seriesvvvx; $seriesvvvx = $this->seriesvvvx;
if (is_numeric($seriesvvvx )) if (is_numeric($seriesvvvx ))
{ {
@ -150,35 +150,36 @@ class SermondistributorModelSeries extends JModelAdmin
$query->where('a.series = -5'); $query->where('a.series = -5');
} }
// [Interpretation 6285] Join over the asset groups. // [Interpretation 6382] Join over the asset groups.
$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');
// [Interpretation 6288] Filter by access level. // [Interpretation 6385] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6293] Implement View Level Access // [Interpretation 6390] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6300] Order the results by ordering // [Interpretation 6397] Order the results by ordering
$query->order('a.published ASC');
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6302] Load the items // [Interpretation 6399] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -192,14 +193,14 @@ class SermondistributorModelSeries extends JModelAdmin
} }
} }
// [Interpretation 10109] set selection value to a translatable value // [Interpretation 10224] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
// [Interpretation 10116] convert link_type // [Interpretation 10231] convert link_type
$item->link_type = $this->selectionTranslationVwcsermons($item->link_type, 'link_type'); $item->link_type = $this->selectionTranslationVwcsermons($item->link_type, 'link_type');
// [Interpretation 10116] convert source // [Interpretation 10231] convert source
$item->source = $this->selectionTranslationVwcsermons($item->source, 'source'); $item->source = $this->selectionTranslationVwcsermons($item->source, 'source');
} }
} }
@ -216,20 +217,20 @@ class SermondistributorModelSeries extends JModelAdmin
*/ */
public function selectionTranslationVwcsermons($value,$name) public function selectionTranslationVwcsermons($value,$name)
{ {
// [Interpretation 10142] Array of link_type language strings // [Interpretation 10257] Array of link_type language strings
if ($name == 'link_type') if ($name == 'link_type')
{ {
$link_typeArray = array( $link_typeArray = array(
1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED', 1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED',
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT' 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value])) if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value]))
{ {
return $link_typeArray[$value]; return $link_typeArray[$value];
} }
} }
// [Interpretation 10142] Array of source language strings // [Interpretation 10257] Array of source language strings
if ($name == 'source') if ($name == 'source')
{ {
$sourceArray = array( $sourceArray = array(
@ -238,7 +239,7 @@ class SermondistributorModelSeries extends JModelAdmin
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX', 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX',
3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value])) if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value]))
{ {
return $sourceArray[$value]; return $sourceArray[$value];
@ -258,7 +259,7 @@ class SermondistributorModelSeries extends JModelAdmin
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) public function getForm($data = array(), $loadData = true)
{ // [Interpretation 8774] Get the form. { // [Interpretation 8889] Get the form.
$form = $this->loadForm('com_sermondistributor.series', 'series', array('control' => 'jform', 'load_data' => $loadData)); $form = $this->loadForm('com_sermondistributor.series', 'series', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) if (empty($form))
@ -268,12 +269,12 @@ class SermondistributorModelSeries extends JModelAdmin
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 8859] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. // [Interpretation 8974] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id')) if ($jinput->get('a_id'))
{ {
$id = $jinput->get('a_id', 0, 'INT'); $id = $jinput->get('a_id', 0, 'INT');
} }
// [Interpretation 8864] The back end uses id so we use that the rest of the time and set it to 0 by default. // [Interpretation 8979] The back end uses id so we use that the rest of the time and set it to 0 by default.
else else
{ {
$id = $jinput->get('id', 0, 'INT'); $id = $jinput->get('id', 0, 'INT');
@ -281,54 +282,54 @@ class SermondistributorModelSeries extends JModelAdmin
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8870] Check for existing item. // [Interpretation 8985] Check for existing item.
// [Interpretation 8871] Modify the form based on Edit State access controls. // [Interpretation 8986] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('series.edit.state', 'com_sermondistributor.series.' . (int) $id)) if ($id != 0 && (!$user->authorise('series.edit.state', 'com_sermondistributor.series.' . (int) $id))
|| ($id == 0 && !$user->authorise('series.edit.state', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('series.edit.state', 'com_sermondistributor')))
{ {
// [Interpretation 8884] Disable fields for display. // [Interpretation 8999] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true');
// [Interpretation 8887] Disable fields while saving. // [Interpretation 9002] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset');
} }
// [Interpretation 8892] If this is a new item insure the greated by is set. // [Interpretation 9007] If this is a new item insure the greated by is set.
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8895] Set the created_by to this user // [Interpretation 9010] Set the created_by to this user
$form->setValue('created_by', null, $user->id); $form->setValue('created_by', null, $user->id);
} }
// [Interpretation 8898] Modify the form based on Edit Creaded By access controls. // [Interpretation 9013] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('series.edit.created_by', 'com_sermondistributor.series.' . (int) $id)) if ($id != 0 && (!$user->authorise('series.edit.created_by', 'com_sermondistributor.series.' . (int) $id))
|| ($id == 0 && !$user->authorise('series.edit.created_by', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('series.edit.created_by', 'com_sermondistributor')))
{ {
// [Interpretation 8910] Disable fields for display. // [Interpretation 9025] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true'); $form->setFieldAttribute('created_by', 'disabled', 'true');
// [Interpretation 8912] Disable fields for display. // [Interpretation 9027] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true'); $form->setFieldAttribute('created_by', 'readonly', 'true');
// [Interpretation 8914] Disable fields while saving. // [Interpretation 9029] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset'); $form->setFieldAttribute('created_by', 'filter', 'unset');
} }
// [Interpretation 8917] Modify the form based on Edit Creaded Date access controls. // [Interpretation 9032] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('series.edit.created', 'com_sermondistributor.series.' . (int) $id)) if ($id != 0 && (!$user->authorise('series.edit.created', 'com_sermondistributor.series.' . (int) $id))
|| ($id == 0 && !$user->authorise('series.edit.created', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('series.edit.created', 'com_sermondistributor')))
{ {
// [Interpretation 8929] Disable fields for display. // [Interpretation 9044] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true'); $form->setFieldAttribute('created', 'disabled', 'true');
// [Interpretation 8931] Disable fields while saving. // [Interpretation 9046] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset'); $form->setFieldAttribute('created', 'filter', 'unset');
} }
// [Interpretation 8964] Only load these values if no id is found // [Interpretation 9079] Only load these values if no id is found
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8967] Set redirected field name // [Interpretation 9082] Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING'); $redirectedField = $jinput->get('ref', null, 'STRING');
// [Interpretation 8969] Set redirected field value // [Interpretation 9084] Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT'); $redirectedValue = $jinput->get('refid', 0, 'INT');
if (0 != $redirectedValue && $redirectedField) if (0 != $redirectedValue && $redirectedField)
{ {
// [Interpretation 8973] Now set the local-redirected field default value // [Interpretation 9088] Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
@ -365,7 +366,7 @@ class SermondistributorModelSeries extends JModelAdmin
} }
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 9095] The record has been set. Check the record permissions. // [Interpretation 9210] The record has been set. Check the record permissions.
return $user->authorise('series.delete', 'com_sermondistributor.series.' . (int) $record->id); return $user->authorise('series.delete', 'com_sermondistributor.series.' . (int) $record->id);
} }
return false; return false;
@ -387,14 +388,14 @@ class SermondistributorModelSeries extends JModelAdmin
if ($recordId) if ($recordId)
{ {
// [Interpretation 9182] The record has been set. Check the record permissions. // [Interpretation 9297] The record has been set. Check the record permissions.
$permission = $user->authorise('series.edit.state', 'com_sermondistributor.series.' . (int) $recordId); $permission = $user->authorise('series.edit.state', 'com_sermondistributor.series.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
return false; return false;
} }
} }
// [Interpretation 9199] In the absense of better information, revert to the component permissions. // [Interpretation 9314] In the absense of better information, revert to the component permissions.
return $user->authorise('series.edit.state', 'com_sermondistributor'); return $user->authorise('series.edit.state', 'com_sermondistributor');
} }
@ -409,7 +410,7 @@ class SermondistributorModelSeries extends JModelAdmin
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 9007] Check specific edit permission then general edit permission. // [Interpretation 9122] Check specific edit permission then general edit permission.
$user = JFactory::getUser(); $user = JFactory::getUser();
return $user->authorise('series.edit', 'com_sermondistributor.series.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('series.edit', 'com_sermondistributor'); return $user->authorise('series.edit', 'com_sermondistributor.series.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('series.edit', 'com_sermondistributor');
@ -635,7 +636,7 @@ class SermondistributorModelSeries extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 4159] Set some needed variables. // [Interpretation 4183] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -649,12 +650,12 @@ class SermondistributorModelSeries extends JModelAdmin
return false; return false;
} }
// [Interpretation 4179] get list of uniqe fields // [Interpretation 4203] get list of uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
// [Interpretation 4181] remove move_copy from array // [Interpretation 4205] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4184] make sure published is set // [Interpretation 4208] make sure published is set
if (!isset($values['published'])) if (!isset($values['published']))
{ {
$values['published'] = 0; $values['published'] = 0;
@ -666,21 +667,21 @@ class SermondistributorModelSeries extends JModelAdmin
$newIds = array(); $newIds = array();
// [Interpretation 4221] Parent exists so let's proceed // [Interpretation 4245] Parent exists so let's proceed
while (!empty($pks)) while (!empty($pks))
{ {
// [Interpretation 4224] Pop the first ID off the stack // [Interpretation 4248] Pop the first ID off the stack
$pk = array_shift($pks); $pk = array_shift($pks);
$this->table->reset(); $this->table->reset();
// [Interpretation 4229] only allow copy if user may edit this item. // [Interpretation 4253] only allow copy if user may edit this item.
if (!$this->user->authorise('series.edit', $contexts[$pk])) if (!$this->user->authorise('series.edit', $contexts[$pk]))
{ {
// [Interpretation 4239] Not fatal error // [Interpretation 4263] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@ -688,19 +689,19 @@ class SermondistributorModelSeries extends JModelAdmin
} }
// [Interpretation 4244] Check that the row actually exists // [Interpretation 4268] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4249] Fatal error // [Interpretation 4273] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4256] Not fatal error // [Interpretation 4280] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
@ -708,7 +709,7 @@ class SermondistributorModelSeries extends JModelAdmin
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
// [Interpretation 4292] insert all set values // [Interpretation 4316] insert all set values
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
@ -720,7 +721,7 @@ class SermondistributorModelSeries extends JModelAdmin
} }
} }
// [Interpretation 4304] update all uniqe fields // [Interpretation 4328] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqeFields as $uniqeField)
@ -729,13 +730,13 @@ class SermondistributorModelSeries extends JModelAdmin
} }
} }
// [Interpretation 4313] Reset the ID because we are making a copy // [Interpretation 4337] Reset the ID because we are making a copy
$this->table->id = 0; $this->table->id = 0;
// [Interpretation 4316] TODO: Deal with ordering? // [Interpretation 4340] TODO: Deal with ordering?
// [Interpretation 4317] $this->table->ordering = 1; // [Interpretation 4341] $this->table->ordering = 1;
// [Interpretation 4319] Check the row. // [Interpretation 4343] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -748,7 +749,7 @@ class SermondistributorModelSeries extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4332] Store the row. // [Interpretation 4356] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -756,14 +757,14 @@ class SermondistributorModelSeries extends JModelAdmin
return false; return false;
} }
// [Interpretation 4340] Get the new item ID // [Interpretation 4364] Get the new item ID
$newId = $this->table->get('id'); $newId = $this->table->get('id');
// [Interpretation 4343] Add the new ID to the array // [Interpretation 4367] Add the new ID to the array
$newIds[$pk] = $newId; $newIds[$pk] = $newId;
} }
// [Interpretation 4347] Clean the cache // [Interpretation 4371] Clean the cache
$this->cleanCache(); $this->cleanCache();
return $newIds; return $newIds;
@ -784,7 +785,7 @@ class SermondistributorModelSeries extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 3961] Set some needed variables. // [Interpretation 3985] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -799,15 +800,15 @@ class SermondistributorModelSeries extends JModelAdmin
return false; return false;
} }
// [Interpretation 3983] make sure published only updates if user has the permission. // [Interpretation 4007] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('series.edit.state')) if (isset($values['published']) && !$this->canDo->get('series.edit.state'))
{ {
unset($values['published']); unset($values['published']);
} }
// [Interpretation 3996] remove move_copy from array // [Interpretation 4020] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4017] Parent exists so we proceed // [Interpretation 4041] Parent exists so we proceed
foreach ($pks as $pk) foreach ($pks as $pk)
{ {
if (!$this->user->authorise('series.edit', $contexts[$pk])) if (!$this->user->authorise('series.edit', $contexts[$pk]))
@ -817,30 +818,30 @@ class SermondistributorModelSeries extends JModelAdmin
return false; return false;
} }
// [Interpretation 4034] Check that the row actually exists // [Interpretation 4058] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4039] Fatal error // [Interpretation 4063] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4046] Not fatal error // [Interpretation 4070] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
} }
// [Interpretation 4052] insert all set values. // [Interpretation 4076] insert all set values.
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
{ {
// [Interpretation 4057] Do special action for access. // [Interpretation 4081] Do special action for access.
if ('access' == $key && strlen($value) > 0) if ('access' == $key && strlen($value) > 0)
{ {
$this->table->$key = $value; $this->table->$key = $value;
@ -853,7 +854,7 @@ class SermondistributorModelSeries extends JModelAdmin
} }
// [Interpretation 4069] Check the row. // [Interpretation 4093] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -866,7 +867,7 @@ class SermondistributorModelSeries extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4082] Store the row. // [Interpretation 4106] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -875,7 +876,7 @@ class SermondistributorModelSeries extends JModelAdmin
} }
} }
// [Interpretation 4091] Clean the cache // [Interpretation 4115] Clean the cache
$this->cleanCache(); $this->cleanCache();
return true; return true;
@ -913,7 +914,7 @@ class SermondistributorModelSeries extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// [Interpretation 4373] Alter the name for save as copy // [Interpretation 4397] Alter the name for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
$origTable = clone $this->getTable(); $origTable = clone $this->getTable();
@ -936,7 +937,7 @@ class SermondistributorModelSeries extends JModelAdmin
$data['published'] = 0; $data['published'] = 0;
} }
// [Interpretation 4400] Automatic handling of alias for empty fields // [Interpretation 4424] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{ {
if ($data['alias'] == null) if ($data['alias'] == null)
@ -967,10 +968,10 @@ class SermondistributorModelSeries extends JModelAdmin
} }
} }
// [Interpretation 4439] Alter the uniqe field for save as copy // [Interpretation 4463] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
// [Interpretation 4442] Automatic handling of other uniqe fields // [Interpretation 4466] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
@ -1024,7 +1025,7 @@ class SermondistributorModelSeries extends JModelAdmin
protected function _generateNewTitle($alias, $title) protected function _generateNewTitle($alias, $title)
{ {
// [Interpretation 4473] Alter the title & alias // [Interpretation 4497] Alter the title & alias
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array('alias' => $alias))) while ($table->load(array('alias' => $alias)))

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage series_list.php @subpackage series_list.php
@ -97,16 +97,16 @@ class SermondistributorModelSeries_list extends JModelList
*/ */
public function getItems() public function getItems()
{ {
// [Interpretation 9768] check in items // [Interpretation 9883] check in items
$this->checkInNow(); $this->checkInNow();
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -131,19 +131,19 @@ class SermondistributorModelSeries_list extends JModelList
*/ */
protected function getListQuery() protected function getListQuery()
{ {
// [Interpretation 6723] Get the user object. // [Interpretation 6833] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6725] Create a new query object. // [Interpretation 6835] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6728] Select some fields // [Interpretation 6838] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6735] From the sermondistributor_item table // [Interpretation 6845] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_series', 'a')); $query->from($db->quoteName('#__sermondistributor_series', 'a'));
// [Interpretation 6749] Filter by published state // [Interpretation 6859] Filter by published state
$published = $this->getState('filter.published'); $published = $this->getState('filter.published');
if (is_numeric($published)) if (is_numeric($published))
{ {
@ -154,21 +154,21 @@ class SermondistributorModelSeries_list extends JModelList
$query->where('(a.published = 0 OR a.published = 1)'); $query->where('(a.published = 0 OR a.published = 1)');
} }
// [Interpretation 6761] Join over the asset groups. // [Interpretation 6871] Join over the asset groups.
$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');
// [Interpretation 6764] Filter by access level. // [Interpretation 6874] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6769] Implement View Level Access // [Interpretation 6879] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6846] Filter by search. // [Interpretation 6956] Filter by search.
$search = $this->getState('filter.search'); $search = $this->getState('filter.search');
if (!empty($search)) if (!empty($search))
{ {
@ -184,7 +184,7 @@ class SermondistributorModelSeries_list extends JModelList
} }
// [Interpretation 6805] Add the list ordering clause. // [Interpretation 6915] 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', 'asc');
if ($orderCol != '') if ($orderCol != '')
@ -202,42 +202,42 @@ class SermondistributorModelSeries_list extends JModelList
*/ */
public function getExportData($pks) public function getExportData($pks)
{ {
// [Interpretation 6513] setup the query // [Interpretation 6623] setup the query
if (SermondistributorHelper::checkArray($pks)) if (SermondistributorHelper::checkArray($pks))
{ {
// [Interpretation 6516] Get the user object. // [Interpretation 6626] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6518] Create a new query object. // [Interpretation 6628] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6521] Select some fields // [Interpretation 6631] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6523] From the sermondistributor_series table // [Interpretation 6633] 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) . ')'); $query->where('a.id IN (' . implode(',',$pks) . ')');
// [Interpretation 6533] Implement View Level Access // [Interpretation 6643] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6540] Order the results by ordering // [Interpretation 6650] Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6542] Load the items // [Interpretation 6652] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -248,13 +248,13 @@ class SermondistributorModelSeries_list extends JModelList
continue; continue;
} }
// [Interpretation 10056] unset the values we don't want exported. // [Interpretation 10171] unset the values we don't want exported.
unset($item->asset_id); unset($item->asset_id);
unset($item->checked_out); unset($item->checked_out);
unset($item->checked_out_time); unset($item->checked_out_time);
} }
} }
// [Interpretation 10065] Add headers to items array. // [Interpretation 10180] Add headers to items array.
$headers = $this->getExImPortHeaders(); $headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
@ -273,13 +273,13 @@ class SermondistributorModelSeries_list extends JModelList
*/ */
public function getExImPortHeaders() public function getExImPortHeaders()
{ {
// [Interpretation 6562] Get a db connection. // [Interpretation 6672] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 6564] get the columns // [Interpretation 6674] get the columns
$columns = $db->getTableColumns("#__sermondistributor_series"); $columns = $db->getTableColumns("#__sermondistributor_series");
if (SermondistributorHelper::checkArray($columns)) if (SermondistributorHelper::checkArray($columns))
{ {
// [Interpretation 6568] remove the headers you don't import/export. // [Interpretation 6678] remove the headers you don't import/export.
unset($columns['asset_id']); unset($columns['asset_id']);
unset($columns['checked_out']); unset($columns['checked_out']);
unset($columns['checked_out_time']); unset($columns['checked_out_time']);
@ -301,7 +301,7 @@ class SermondistributorModelSeries_list extends JModelList
*/ */
protected function getStoreId($id = '') protected function getStoreId($id = '')
{ {
// [Interpretation 9391] Compile the store id. // [Interpretation 9506] Compile the store id.
$id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.published');
@ -321,15 +321,15 @@ class SermondistributorModelSeries_list extends JModelList
*/ */
protected function checkInNow() protected function checkInNow()
{ {
// [Interpretation 9784] Get set check in time // [Interpretation 9899] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time) if ($time)
{ {
// [Interpretation 9789] Get a db connection. // [Interpretation 9904] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 9791] reset query // [Interpretation 9906] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select('*'); $query->select('*');
$query->from($db->quoteName('#__sermondistributor_series')); $query->from($db->quoteName('#__sermondistributor_series'));
@ -337,24 +337,24 @@ class SermondistributorModelSeries_list extends JModelList
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
// [Interpretation 9799] Get Yesterdays date // [Interpretation 9914] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql(); $date = JFactory::getDate()->modify($time)->toSql();
// [Interpretation 9801] reset query // [Interpretation 9916] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 9803] Fields to update. // [Interpretation 9918] Fields to update.
$fields = array( $fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0' $db->quoteName('checked_out') . '=0'
); );
// [Interpretation 9808] Conditions for which records should be updated. // [Interpretation 9923] Conditions for which records should be updated.
$conditions = array( $conditions = array(
$db->quoteName('checked_out') . '!=0', $db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\'' $db->quoteName('checked_out_time') . '<\''.$date.'\''
); );
// [Interpretation 9813] Check table // [Interpretation 9928] Check table
$query->update($db->quoteName('#__sermondistributor_series'))->set($fields)->where($conditions); $query->update($db->quoteName('#__sermondistributor_series'))->set($fields)->where($conditions);
$db->setQuery($query); $db->setQuery($query);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermon.php @subpackage sermon.php
@ -97,13 +97,13 @@ class SermondistributorModelSermon extends JModelAdmin
if (!empty($item->local_files)) if (!empty($item->local_files))
{ {
// [Interpretation 3163] JSON Decode local_files. // [Interpretation 3187] JSON Decode local_files.
$item->local_files = json_decode($item->local_files); $item->local_files = json_decode($item->local_files);
} }
if (!empty($item->manual_files)) if (!empty($item->manual_files))
{ {
// [Interpretation 3163] JSON Decode manual_files. // [Interpretation 3187] JSON Decode manual_files.
$item->manual_files = json_decode($item->manual_files); $item->manual_files = json_decode($item->manual_files);
} }
@ -125,31 +125,31 @@ class SermondistributorModelSermon extends JModelAdmin
*/ */
public function getVwbstastics() public function getVwbstastics()
{ {
// [Interpretation 6240] Get the user object. // [Interpretation 6337] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6242] Create a new query object. // [Interpretation 6339] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6245] Select some fields // [Interpretation 6342] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6252] From the sermondistributor_statistic table // [Interpretation 6349] From the sermondistributor_statistic table
$query->from($db->quoteName('#__sermondistributor_statistic', 'a')); $query->from($db->quoteName('#__sermondistributor_statistic', 'a'));
// [Interpretation 6876] From the sermondistributor_sermon table. // [Interpretation 6986] From the sermondistributor_sermon table.
$query->select($db->quoteName('g.name','sermon_name')); $query->select($db->quoteName('g.name','sermon_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_sermon', 'g') . ' ON (' . $db->quoteName('a.sermon') . ' = ' . $db->quoteName('g.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_sermon', 'g') . ' ON (' . $db->quoteName('a.sermon') . ' = ' . $db->quoteName('g.id') . ')');
// [Interpretation 6876] From the sermondistributor_preacher table. // [Interpretation 6986] From the sermondistributor_preacher table.
$query->select($db->quoteName('h.name','preacher_name')); $query->select($db->quoteName('h.name','preacher_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'h') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('h.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'h') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('h.id') . ')');
// [Interpretation 6876] From the sermondistributor_series table. // [Interpretation 6986] From the sermondistributor_series table.
$query->select($db->quoteName('i.name','series_name')); $query->select($db->quoteName('i.name','series_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'i') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('i.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'i') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('i.id') . ')');
// [Interpretation 6268] Filter by sermonvvvw global. // [Interpretation 6365] Filter by sermonvvvw global.
$sermonvvvw = $this->sermonvvvw; $sermonvvvw = $this->sermonvvvw;
if (is_numeric($sermonvvvw )) if (is_numeric($sermonvvvw ))
{ {
@ -164,35 +164,36 @@ class SermondistributorModelSermon extends JModelAdmin
$query->where('a.sermon = -5'); $query->where('a.sermon = -5');
} }
// [Interpretation 6285] Join over the asset groups. // [Interpretation 6382] Join over the asset groups.
$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');
// [Interpretation 6288] Filter by access level. // [Interpretation 6385] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6293] Implement View Level Access // [Interpretation 6390] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6300] Order the results by ordering // [Interpretation 6397] Order the results by ordering
$query->order('a.published ASC');
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6302] Load the items // [Interpretation 6399] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -221,7 +222,7 @@ class SermondistributorModelSermon extends JModelAdmin
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) public function getForm($data = array(), $loadData = true)
{ // [Interpretation 8774] Get the form. { // [Interpretation 8889] Get the form.
$form = $this->loadForm('com_sermondistributor.sermon', 'sermon', array('control' => 'jform', 'load_data' => $loadData)); $form = $this->loadForm('com_sermondistributor.sermon', 'sermon', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) if (empty($form))
@ -231,17 +232,17 @@ class SermondistributorModelSermon extends JModelAdmin
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 8801] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. // [Interpretation 8916] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id')) if ($jinput->get('a_id'))
{ {
$id = $jinput->get('a_id', 0, 'INT'); $id = $jinput->get('a_id', 0, 'INT');
} }
// [Interpretation 8806] The back end uses id so we use that the rest of the time and set it to 0 by default. // [Interpretation 8921] The back end uses id so we use that the rest of the time and set it to 0 by default.
else else
{ {
$id = $jinput->get('id', 0, 'INT'); $id = $jinput->get('id', 0, 'INT');
} }
// [Interpretation 8811] Determine correct permissions to check. // [Interpretation 8926] Determine correct permissions to check.
if ($this->getState('sermon.id')) if ($this->getState('sermon.id'))
{ {
$id = $this->getState('sermon.id'); $id = $this->getState('sermon.id');
@ -249,74 +250,74 @@ class SermondistributorModelSermon extends JModelAdmin
$catid = 0; $catid = 0;
if (isset($this->getItem($id)->catid)) if (isset($this->getItem($id)->catid))
{ {
// [Interpretation 8818] set catagory id // [Interpretation 8933] set catagory id
$catid = $this->getItem($id)->catid; $catid = $this->getItem($id)->catid;
// [Interpretation 8820] Existing record. Can only edit in selected categories. // [Interpretation 8935] Existing record. Can only edit in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit'); $form->setFieldAttribute('catid', 'action', 'core.edit');
// [Interpretation 8822] Existing record. Can only edit own items in selected categories. // [Interpretation 8937] Existing record. Can only edit own items in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit.own'); $form->setFieldAttribute('catid', 'action', 'core.edit.own');
} }
} }
else else
{ {
// [Interpretation 8828] New record. Can only create in selected categories. // [Interpretation 8943] New record. Can only create in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.create'); $form->setFieldAttribute('catid', 'action', 'core.create');
} }
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8832] Check for existing item. // [Interpretation 8947] Check for existing item.
// [Interpretation 8833] Modify the form based on Edit State access controls. // [Interpretation 8948] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('sermon.edit.state', 'com_sermondistributor.sermon.' . (int) $id)) if ($id != 0 && (!$user->authorise('sermon.edit.state', 'com_sermondistributor.sermon.' . (int) $id))
|| (isset($catid) && $catid != 0 && !$user->authorise('core.edit.state', 'com_sermondistributor.sermons.category.' . (int) $catid)) || (isset($catid) && $catid != 0 && !$user->authorise('core.edit.state', 'com_sermondistributor.sermons.category.' . (int) $catid))
|| ($id == 0 && !$user->authorise('sermon.edit.state', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('sermon.edit.state', 'com_sermondistributor')))
{ {
// [Interpretation 8848] Disable fields for display. // [Interpretation 8963] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true');
// [Interpretation 8851] Disable fields while saving. // [Interpretation 8966] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset');
} }
// [Interpretation 8892] If this is a new item insure the greated by is set. // [Interpretation 9007] If this is a new item insure the greated by is set.
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8895] Set the created_by to this user // [Interpretation 9010] Set the created_by to this user
$form->setValue('created_by', null, $user->id); $form->setValue('created_by', null, $user->id);
} }
// [Interpretation 8898] Modify the form based on Edit Creaded By access controls. // [Interpretation 9013] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('sermon.edit.created_by', 'com_sermondistributor.sermon.' . (int) $id)) if ($id != 0 && (!$user->authorise('sermon.edit.created_by', 'com_sermondistributor.sermon.' . (int) $id))
|| ($id == 0 && !$user->authorise('sermon.edit.created_by', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('sermon.edit.created_by', 'com_sermondistributor')))
{ {
// [Interpretation 8910] Disable fields for display. // [Interpretation 9025] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true'); $form->setFieldAttribute('created_by', 'disabled', 'true');
// [Interpretation 8912] Disable fields for display. // [Interpretation 9027] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true'); $form->setFieldAttribute('created_by', 'readonly', 'true');
// [Interpretation 8914] Disable fields while saving. // [Interpretation 9029] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset'); $form->setFieldAttribute('created_by', 'filter', 'unset');
} }
// [Interpretation 8917] Modify the form based on Edit Creaded Date access controls. // [Interpretation 9032] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('sermon.edit.created', 'com_sermondistributor.sermon.' . (int) $id)) if ($id != 0 && (!$user->authorise('sermon.edit.created', 'com_sermondistributor.sermon.' . (int) $id))
|| ($id == 0 && !$user->authorise('sermon.edit.created', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('sermon.edit.created', 'com_sermondistributor')))
{ {
// [Interpretation 8929] Disable fields for display. // [Interpretation 9044] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true'); $form->setFieldAttribute('created', 'disabled', 'true');
// [Interpretation 8931] Disable fields while saving. // [Interpretation 9046] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset'); $form->setFieldAttribute('created', 'filter', 'unset');
} }
// [Interpretation 8964] Only load these values if no id is found // [Interpretation 9079] Only load these values if no id is found
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8967] Set redirected field name // [Interpretation 9082] Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING'); $redirectedField = $jinput->get('ref', null, 'STRING');
// [Interpretation 8969] Set redirected field value // [Interpretation 9084] Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT'); $redirectedValue = $jinput->get('refid', 0, 'INT');
if (0 != $redirectedValue && $redirectedField) if (0 != $redirectedValue && $redirectedField)
{ {
// [Interpretation 8973] Now set the local-redirected field default value // [Interpretation 9088] Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
@ -357,7 +358,7 @@ class SermondistributorModelSermon extends JModelAdmin
if ($allow) if ($allow)
{ {
// [Interpretation 9066] The record has been set. Check the record permissions. // [Interpretation 9181] The record has been set. Check the record permissions.
return $user->authorise('sermon.delete', 'com_sermondistributor.sermon.' . (int) $record->id); return $user->authorise('sermon.delete', 'com_sermondistributor.sermon.' . (int) $record->id);
} }
return $allow; return $allow;
@ -381,14 +382,14 @@ class SermondistributorModelSermon extends JModelAdmin
if ($recordId) if ($recordId)
{ {
// [Interpretation 9139] The record has been set. Check the record permissions. // [Interpretation 9254] The record has been set. Check the record permissions.
$permission = $user->authorise('sermon.edit.state', 'com_sermondistributor.sermon.' . (int) $recordId); $permission = $user->authorise('sermon.edit.state', 'com_sermondistributor.sermon.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
return false; return false;
} }
} }
// [Interpretation 9155] Check against the category. // [Interpretation 9270] Check against the category.
if (!empty($record->catid)) if (!empty($record->catid))
{ {
$catpermission = $user->authorise('core.edit.state', 'com_sermondistributor.sermons.category.' . (int) $record->catid); $catpermission = $user->authorise('core.edit.state', 'com_sermondistributor.sermons.category.' . (int) $record->catid);
@ -397,7 +398,7 @@ class SermondistributorModelSermon extends JModelAdmin
return false; return false;
} }
} }
// [Interpretation 9166] In the absense of better information, revert to the component permissions. // [Interpretation 9281] In the absense of better information, revert to the component permissions.
return $user->authorise('sermon.edit.state', 'com_sermondistributor'); return $user->authorise('sermon.edit.state', 'com_sermondistributor');
} }
@ -412,7 +413,7 @@ class SermondistributorModelSermon extends JModelAdmin
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 9007] Check specific edit permission then general edit permission. // [Interpretation 9122] Check specific edit permission then general edit permission.
$user = JFactory::getUser(); $user = JFactory::getUser();
return $user->authorise('sermon.edit', 'com_sermondistributor.sermon.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('sermon.edit', 'com_sermondistributor'); return $user->authorise('sermon.edit', 'com_sermondistributor.sermon.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('sermon.edit', 'com_sermondistributor');
@ -511,20 +512,20 @@ class SermondistributorModelSermon extends JModelAdmin
*/ */
public function validate($form, $data, $group = null) public function validate($form, $data, $group = null)
{ {
// [Interpretation 7978] check if the not_required field is set // [Interpretation 8088] check if the not_required field is set
if (SermondistributorHelper::checkString($data['not_required'])) if (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);
// [Interpretation 7983] now change the required field attributes value // [Interpretation 8093] now change the required field attributes value
foreach ($requiredFields as $requiredField) foreach ($requiredFields as $requiredField)
{ {
// [Interpretation 7986] make sure there is a string value // [Interpretation 8096] make sure there is a string value
if (SermondistributorHelper::checkString($requiredField)) if (SermondistributorHelper::checkString($requiredField))
{ {
// [Interpretation 7989] change to false // [Interpretation 8099] change to false
$form->setFieldAttribute($requiredField, 'required', 'false'); $form->setFieldAttribute($requiredField, 'required', 'false');
// [Interpretation 7991] also clear the data set // [Interpretation 8101] also clear the data set
$data[$requiredField] = ''; $data[$requiredField] = '';
} }
} }
@ -674,7 +675,7 @@ class SermondistributorModelSermon extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 4159] Set some needed variables. // [Interpretation 4183] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -688,12 +689,12 @@ class SermondistributorModelSermon extends JModelAdmin
return false; return false;
} }
// [Interpretation 4179] get list of uniqe fields // [Interpretation 4203] get list of uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
// [Interpretation 4181] remove move_copy from array // [Interpretation 4205] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4184] make sure published is set // [Interpretation 4208] make sure published is set
if (!isset($values['published'])) if (!isset($values['published']))
{ {
$values['published'] = 0; $values['published'] = 0;
@ -709,7 +710,7 @@ class SermondistributorModelSermon extends JModelAdmin
} }
elseif (isset($values['category']) && (int) $values['category'] > 0) elseif (isset($values['category']) && (int) $values['category'] > 0)
{ {
// [Interpretation 4209] move the category value to correct field name // [Interpretation 4233] move the category value to correct field name
$values['catid'] = $values['category']; $values['catid'] = $values['category'];
unset($values['category']); unset($values['category']);
} }
@ -720,21 +721,21 @@ class SermondistributorModelSermon extends JModelAdmin
$newIds = array(); $newIds = array();
// [Interpretation 4221] Parent exists so let's proceed // [Interpretation 4245] Parent exists so let's proceed
while (!empty($pks)) while (!empty($pks))
{ {
// [Interpretation 4224] Pop the first ID off the stack // [Interpretation 4248] Pop the first ID off the stack
$pk = array_shift($pks); $pk = array_shift($pks);
$this->table->reset(); $this->table->reset();
// [Interpretation 4229] only allow copy if user may edit this item. // [Interpretation 4253] only allow copy if user may edit this item.
if (!$this->user->authorise('sermon.edit', $contexts[$pk])) if (!$this->user->authorise('sermon.edit', $contexts[$pk]))
{ {
// [Interpretation 4239] Not fatal error // [Interpretation 4263] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@ -742,19 +743,19 @@ class SermondistributorModelSermon extends JModelAdmin
} }
// [Interpretation 4244] Check that the row actually exists // [Interpretation 4268] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4249] Fatal error // [Interpretation 4273] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4256] Not fatal error // [Interpretation 4280] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
@ -769,7 +770,7 @@ class SermondistributorModelSermon extends JModelAdmin
list($this->table->name, $this->table->alias) = $this->generateNewTitle($this->table->catid, $this->table->alias, $this->table->name); list($this->table->name, $this->table->alias) = $this->generateNewTitle($this->table->catid, $this->table->alias, $this->table->name);
} }
// [Interpretation 4292] insert all set values // [Interpretation 4316] insert all set values
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
@ -781,7 +782,7 @@ class SermondistributorModelSermon extends JModelAdmin
} }
} }
// [Interpretation 4304] update all uniqe fields // [Interpretation 4328] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqeFields as $uniqeField)
@ -790,13 +791,13 @@ class SermondistributorModelSermon extends JModelAdmin
} }
} }
// [Interpretation 4313] Reset the ID because we are making a copy // [Interpretation 4337] Reset the ID because we are making a copy
$this->table->id = 0; $this->table->id = 0;
// [Interpretation 4316] TODO: Deal with ordering? // [Interpretation 4340] TODO: Deal with ordering?
// [Interpretation 4317] $this->table->ordering = 1; // [Interpretation 4341] $this->table->ordering = 1;
// [Interpretation 4319] Check the row. // [Interpretation 4343] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -809,7 +810,7 @@ class SermondistributorModelSermon extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4332] Store the row. // [Interpretation 4356] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -817,14 +818,14 @@ class SermondistributorModelSermon extends JModelAdmin
return false; return false;
} }
// [Interpretation 4340] Get the new item ID // [Interpretation 4364] Get the new item ID
$newId = $this->table->get('id'); $newId = $this->table->get('id');
// [Interpretation 4343] Add the new ID to the array // [Interpretation 4367] Add the new ID to the array
$newIds[$pk] = $newId; $newIds[$pk] = $newId;
} }
// [Interpretation 4347] Clean the cache // [Interpretation 4371] Clean the cache
$this->cleanCache(); $this->cleanCache();
return $newIds; return $newIds;
@ -845,7 +846,7 @@ class SermondistributorModelSermon extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 3961] Set some needed variables. // [Interpretation 3985] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -860,12 +861,12 @@ class SermondistributorModelSermon extends JModelAdmin
return false; return false;
} }
// [Interpretation 3983] make sure published only updates if user has the permission. // [Interpretation 4007] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('sermon.edit.state')) if (isset($values['published']) && !$this->canDo->get('sermon.edit.state'))
{ {
unset($values['published']); unset($values['published']);
} }
// [Interpretation 3996] remove move_copy from array // [Interpretation 4020] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
if (isset($values['category']) && (int) $values['category'] > 0 && !static::checkCategoryId($values['category'])) if (isset($values['category']) && (int) $values['category'] > 0 && !static::checkCategoryId($values['category']))
@ -874,7 +875,7 @@ class SermondistributorModelSermon extends JModelAdmin
} }
elseif (isset($values['category']) && (int) $values['category'] > 0) elseif (isset($values['category']) && (int) $values['category'] > 0)
{ {
// [Interpretation 4007] move the category value to correct field name // [Interpretation 4031] move the category value to correct field name
$values['catid'] = $values['category']; $values['catid'] = $values['category'];
unset($values['category']); unset($values['category']);
} }
@ -884,7 +885,7 @@ class SermondistributorModelSermon extends JModelAdmin
} }
// [Interpretation 4017] Parent exists so we proceed // [Interpretation 4041] Parent exists so we proceed
foreach ($pks as $pk) foreach ($pks as $pk)
{ {
if (!$this->user->authorise('sermon.edit', $contexts[$pk])) if (!$this->user->authorise('sermon.edit', $contexts[$pk]))
@ -894,30 +895,30 @@ class SermondistributorModelSermon extends JModelAdmin
return false; return false;
} }
// [Interpretation 4034] Check that the row actually exists // [Interpretation 4058] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4039] Fatal error // [Interpretation 4063] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4046] Not fatal error // [Interpretation 4070] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
} }
// [Interpretation 4052] insert all set values. // [Interpretation 4076] insert all set values.
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
{ {
// [Interpretation 4057] Do special action for access. // [Interpretation 4081] Do special action for access.
if ('access' == $key && strlen($value) > 0) if ('access' == $key && strlen($value) > 0)
{ {
$this->table->$key = $value; $this->table->$key = $value;
@ -930,7 +931,7 @@ class SermondistributorModelSermon extends JModelAdmin
} }
// [Interpretation 4069] Check the row. // [Interpretation 4093] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -943,7 +944,7 @@ class SermondistributorModelSermon extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4082] Store the row. // [Interpretation 4106] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -952,7 +953,7 @@ class SermondistributorModelSermon extends JModelAdmin
} }
} }
// [Interpretation 4091] Clean the cache // [Interpretation 4115] Clean the cache
$this->cleanCache(); $this->cleanCache();
return true; return true;
@ -982,13 +983,13 @@ class SermondistributorModelSermon extends JModelAdmin
$data['metadata'] = (string) $metadata; $data['metadata'] = (string) $metadata;
} }
// [Interpretation 3273] Set the local_files string to JSON string. // [Interpretation 3297] Set the local_files string to JSON string.
if (isset($data['local_files'])) if (isset($data['local_files']))
{ {
$data['local_files'] = (string) json_encode($data['local_files']); $data['local_files'] = (string) json_encode($data['local_files']);
} }
// [Interpretation 3273] Set the manual_files string to JSON string. // [Interpretation 3297] Set the manual_files string to JSON string.
if (isset($data['manual_files'])) if (isset($data['manual_files']))
{ {
$data['manual_files'] = (string) json_encode($data['manual_files']); $data['manual_files'] = (string) json_encode($data['manual_files']);
@ -1002,7 +1003,7 @@ class SermondistributorModelSermon extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// [Interpretation 4373] Alter the name for save as copy // [Interpretation 4397] Alter the name for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
$origTable = clone $this->getTable(); $origTable = clone $this->getTable();
@ -1025,7 +1026,7 @@ class SermondistributorModelSermon extends JModelAdmin
$data['published'] = 0; $data['published'] = 0;
} }
// [Interpretation 4400] Automatic handling of alias for empty fields // [Interpretation 4424] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{ {
if ($data['alias'] == null) if ($data['alias'] == null)
@ -1056,10 +1057,10 @@ class SermondistributorModelSermon extends JModelAdmin
} }
} }
// [Interpretation 4439] Alter the uniqe field for save as copy // [Interpretation 4463] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
// [Interpretation 4442] Automatic handling of other uniqe fields // [Interpretation 4466] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
@ -1113,7 +1114,7 @@ class SermondistributorModelSermon extends JModelAdmin
protected function _generateNewTitle($alias, $title) protected function _generateNewTitle($alias, $title)
{ {
// [Interpretation 4473] Alter the title & alias // [Interpretation 4497] Alter the title & alias
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array('alias' => $alias))) while ($table->load(array('alias' => $alias)))

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermondistributor.php @subpackage sermondistributor.php
@ -45,7 +45,7 @@ class SermondistributorModelSermondistributor extends JModelList
$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.help_documents') 'main' => array('png.preacher.add', 'png.preachers', 'png.sermon.add', 'png.sermons', 'png.sermons.catid', 'png.series.add', 'png.series_list', 'png.statistics', 'png.help_documents')
); );
// [Interpretation 10225] view access array // [Interpretation 10340] view access array
$viewAccess = array( $viewAccess = array(
'preacher.create' => 'preacher.create', 'preacher.create' => 'preacher.create',
'preachers.access' => 'preacher.access', 'preachers.access' => 'preacher.access',

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermons.php @subpackage sermons.php
@ -129,16 +129,16 @@ class SermondistributorModelSermons extends JModelList
*/ */
public function getItems() public function getItems()
{ {
// [Interpretation 9768] check in items // [Interpretation 9883] check in items
$this->checkInNow(); $this->checkInNow();
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -152,14 +152,14 @@ class SermondistributorModelSermons extends JModelList
} }
} }
// [Interpretation 10109] set selection value to a translatable value // [Interpretation 10224] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
// [Interpretation 10116] convert link_type // [Interpretation 10231] convert link_type
$item->link_type = $this->selectionTranslation($item->link_type, 'link_type'); $item->link_type = $this->selectionTranslation($item->link_type, 'link_type');
// [Interpretation 10116] convert source // [Interpretation 10231] convert source
$item->source = $this->selectionTranslation($item->source, 'source'); $item->source = $this->selectionTranslation($item->source, 'source');
} }
} }
@ -176,20 +176,20 @@ class SermondistributorModelSermons extends JModelList
*/ */
public function selectionTranslation($value,$name) public function selectionTranslation($value,$name)
{ {
// [Interpretation 10142] Array of link_type language strings // [Interpretation 10257] Array of link_type language strings
if ($name == 'link_type') if ($name == 'link_type')
{ {
$link_typeArray = array( $link_typeArray = array(
1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED', 1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED',
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT' 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value])) if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value]))
{ {
return $link_typeArray[$value]; return $link_typeArray[$value];
} }
} }
// [Interpretation 10142] Array of source language strings // [Interpretation 10257] Array of source language strings
if ($name == 'source') if ($name == 'source')
{ {
$sourceArray = array( $sourceArray = array(
@ -198,7 +198,7 @@ class SermondistributorModelSermons extends JModelList
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX', 2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX',
3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL' 3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL'
); );
// [Interpretation 10173] Now check if value is found in this array // [Interpretation 10288] Now check if value is found in this array
if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value])) if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value]))
{ {
return $sourceArray[$value]; return $sourceArray[$value];
@ -214,29 +214,29 @@ class SermondistributorModelSermons extends JModelList
*/ */
protected function getListQuery() protected function getListQuery()
{ {
// [Interpretation 6723] Get the user object. // [Interpretation 6833] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6725] Create a new query object. // [Interpretation 6835] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6728] Select some fields // [Interpretation 6838] Select some fields
$query->select('a.*'); $query->select('a.*');
$query->select($db->quoteName('c.title','category_title')); $query->select($db->quoteName('c.title','category_title'));
// [Interpretation 6735] From the sermondistributor_item table // [Interpretation 6845] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a')); $query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')'); $query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')');
// [Interpretation 6876] From the sermondistributor_preacher table. // [Interpretation 6986] From the sermondistributor_preacher table.
$query->select($db->quoteName('g.name','preacher_name')); $query->select($db->quoteName('g.name','preacher_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'g') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('g.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'g') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('g.id') . ')');
// [Interpretation 6876] From the sermondistributor_series table. // [Interpretation 6986] From the sermondistributor_series table.
$query->select($db->quoteName('h.name','series_name')); $query->select($db->quoteName('h.name','series_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'h') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('h.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'h') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('h.id') . ')');
// [Interpretation 6749] Filter by published state // [Interpretation 6859] Filter by published state
$published = $this->getState('filter.published'); $published = $this->getState('filter.published');
if (is_numeric($published)) if (is_numeric($published))
{ {
@ -247,21 +247,21 @@ class SermondistributorModelSermons extends JModelList
$query->where('(a.published = 0 OR a.published = 1)'); $query->where('(a.published = 0 OR a.published = 1)');
} }
// [Interpretation 6761] Join over the asset groups. // [Interpretation 6871] Join over the asset groups.
$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');
// [Interpretation 6764] Filter by access level. // [Interpretation 6874] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6769] Implement View Level Access // [Interpretation 6879] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6846] Filter by search. // [Interpretation 6956] Filter by search.
$search = $this->getState('filter.search'); $search = $this->getState('filter.search');
if (!empty($search)) if (!empty($search))
{ {
@ -276,28 +276,28 @@ class SermondistributorModelSermons extends JModelList
} }
} }
// [Interpretation 6962] Filter by preacher. // [Interpretation 7072] Filter by preacher.
if ($preacher = $this->getState('filter.preacher')) if ($preacher = $this->getState('filter.preacher'))
{ {
$query->where('a.preacher = ' . $db->quote($db->escape($preacher, true))); $query->where('a.preacher = ' . $db->quote($db->escape($preacher, true)));
} }
// [Interpretation 6962] Filter by series. // [Interpretation 7072] Filter by series.
if ($series = $this->getState('filter.series')) if ($series = $this->getState('filter.series'))
{ {
$query->where('a.series = ' . $db->quote($db->escape($series, true))); $query->where('a.series = ' . $db->quote($db->escape($series, true)));
} }
// [Interpretation 6971] Filter by Link_type. // [Interpretation 7081] Filter by Link_type.
if ($link_type = $this->getState('filter.link_type')) if ($link_type = $this->getState('filter.link_type'))
{ {
$query->where('a.link_type = ' . $db->quote($db->escape($link_type, true))); $query->where('a.link_type = ' . $db->quote($db->escape($link_type, true)));
} }
// [Interpretation 6971] Filter by Source. // [Interpretation 7081] Filter by Source.
if ($source = $this->getState('filter.source')) if ($source = $this->getState('filter.source'))
{ {
$query->where('a.source = ' . $db->quote($db->escape($source, true))); $query->where('a.source = ' . $db->quote($db->escape($source, true)));
} }
// [Interpretation 6783] Filter by a single or group of categories. // [Interpretation 6893] Filter by a single or group of categories.
$baselevel = 1; $baselevel = 1;
$categoryId = $this->getState('filter.category_id'); $categoryId = $this->getState('filter.category_id');
@ -319,7 +319,7 @@ class SermondistributorModelSermons extends JModelList
} }
// [Interpretation 6805] Add the list ordering clause. // [Interpretation 6915] 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', 'asc');
if ($orderCol != '') if ($orderCol != '')
@ -337,42 +337,42 @@ class SermondistributorModelSermons extends JModelList
*/ */
public function getExportData($pks) public function getExportData($pks)
{ {
// [Interpretation 6513] setup the query // [Interpretation 6623] setup the query
if (SermondistributorHelper::checkArray($pks)) if (SermondistributorHelper::checkArray($pks))
{ {
// [Interpretation 6516] Get the user object. // [Interpretation 6626] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6518] Create a new query object. // [Interpretation 6628] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6521] Select some fields // [Interpretation 6631] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6523] From the sermondistributor_sermon table // [Interpretation 6633] 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) . ')'); $query->where('a.id IN (' . implode(',',$pks) . ')');
// [Interpretation 6533] Implement View Level Access // [Interpretation 6643] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6540] Order the results by ordering // [Interpretation 6650] Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6542] Load the items // [Interpretation 6652] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -383,13 +383,13 @@ class SermondistributorModelSermons extends JModelList
continue; continue;
} }
// [Interpretation 10056] unset the values we don't want exported. // [Interpretation 10171] unset the values we don't want exported.
unset($item->asset_id); unset($item->asset_id);
unset($item->checked_out); unset($item->checked_out);
unset($item->checked_out_time); unset($item->checked_out_time);
} }
} }
// [Interpretation 10065] Add headers to items array. // [Interpretation 10180] Add headers to items array.
$headers = $this->getExImPortHeaders(); $headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
@ -408,13 +408,13 @@ class SermondistributorModelSermons extends JModelList
*/ */
public function getExImPortHeaders() public function getExImPortHeaders()
{ {
// [Interpretation 6562] Get a db connection. // [Interpretation 6672] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 6564] get the columns // [Interpretation 6674] get the columns
$columns = $db->getTableColumns("#__sermondistributor_sermon"); $columns = $db->getTableColumns("#__sermondistributor_sermon");
if (SermondistributorHelper::checkArray($columns)) if (SermondistributorHelper::checkArray($columns))
{ {
// [Interpretation 6568] remove the headers you don't import/export. // [Interpretation 6678] remove the headers you don't import/export.
unset($columns['asset_id']); unset($columns['asset_id']);
unset($columns['checked_out']); unset($columns['checked_out']);
unset($columns['checked_out_time']); unset($columns['checked_out_time']);
@ -436,7 +436,7 @@ class SermondistributorModelSermons extends JModelList
*/ */
protected function getStoreId($id = '') protected function getStoreId($id = '')
{ {
// [Interpretation 9391] Compile the store id. // [Interpretation 9506] Compile the store id.
$id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.published');
@ -464,15 +464,15 @@ class SermondistributorModelSermons extends JModelList
*/ */
protected function checkInNow() protected function checkInNow()
{ {
// [Interpretation 9784] Get set check in time // [Interpretation 9899] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time) if ($time)
{ {
// [Interpretation 9789] Get a db connection. // [Interpretation 9904] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 9791] reset query // [Interpretation 9906] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select('*'); $query->select('*');
$query->from($db->quoteName('#__sermondistributor_sermon')); $query->from($db->quoteName('#__sermondistributor_sermon'));
@ -480,24 +480,24 @@ class SermondistributorModelSermons extends JModelList
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
// [Interpretation 9799] Get Yesterdays date // [Interpretation 9914] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql(); $date = JFactory::getDate()->modify($time)->toSql();
// [Interpretation 9801] reset query // [Interpretation 9916] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 9803] Fields to update. // [Interpretation 9918] Fields to update.
$fields = array( $fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0' $db->quoteName('checked_out') . '=0'
); );
// [Interpretation 9808] Conditions for which records should be updated. // [Interpretation 9923] Conditions for which records should be updated.
$conditions = array( $conditions = array(
$db->quoteName('checked_out') . '!=0', $db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\'' $db->quoteName('checked_out_time') . '<\''.$date.'\''
); );
// [Interpretation 9813] Check table // [Interpretation 9928] Check table
$query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions); $query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions);
$db->setQuery($query); $db->setQuery($query);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage statistic.php @subpackage statistic.php
@ -116,7 +116,7 @@ class SermondistributorModelStatistic extends JModelAdmin
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) public function getForm($data = array(), $loadData = true)
{ // [Interpretation 8774] Get the form. { // [Interpretation 8889] Get the form.
$form = $this->loadForm('com_sermondistributor.statistic', 'statistic', array('control' => 'jform', 'load_data' => $loadData)); $form = $this->loadForm('com_sermondistributor.statistic', 'statistic', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) if (empty($form))
@ -126,12 +126,12 @@ class SermondistributorModelStatistic extends JModelAdmin
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
// [Interpretation 8859] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. // [Interpretation 8974] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id')) if ($jinput->get('a_id'))
{ {
$id = $jinput->get('a_id', 0, 'INT'); $id = $jinput->get('a_id', 0, 'INT');
} }
// [Interpretation 8864] The back end uses id so we use that the rest of the time and set it to 0 by default. // [Interpretation 8979] The back end uses id so we use that the rest of the time and set it to 0 by default.
else else
{ {
$id = $jinput->get('id', 0, 'INT'); $id = $jinput->get('id', 0, 'INT');
@ -139,54 +139,54 @@ class SermondistributorModelStatistic extends JModelAdmin
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 8870] Check for existing item. // [Interpretation 8985] Check for existing item.
// [Interpretation 8871] Modify the form based on Edit State access controls. // [Interpretation 8986] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('statistic.edit.state', 'com_sermondistributor.statistic.' . (int) $id)) if ($id != 0 && (!$user->authorise('statistic.edit.state', 'com_sermondistributor.statistic.' . (int) $id))
|| ($id == 0 && !$user->authorise('statistic.edit.state', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('statistic.edit.state', 'com_sermondistributor')))
{ {
// [Interpretation 8884] Disable fields for display. // [Interpretation 8999] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true'); $form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true'); $form->setFieldAttribute('published', 'disabled', 'true');
// [Interpretation 8887] Disable fields while saving. // [Interpretation 9002] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset'); $form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset'); $form->setFieldAttribute('published', 'filter', 'unset');
} }
// [Interpretation 8892] If this is a new item insure the greated by is set. // [Interpretation 9007] If this is a new item insure the greated by is set.
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8895] Set the created_by to this user // [Interpretation 9010] Set the created_by to this user
$form->setValue('created_by', null, $user->id); $form->setValue('created_by', null, $user->id);
} }
// [Interpretation 8898] Modify the form based on Edit Creaded By access controls. // [Interpretation 9013] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('statistic.edit.created_by', 'com_sermondistributor.statistic.' . (int) $id)) if ($id != 0 && (!$user->authorise('statistic.edit.created_by', 'com_sermondistributor.statistic.' . (int) $id))
|| ($id == 0 && !$user->authorise('statistic.edit.created_by', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('statistic.edit.created_by', 'com_sermondistributor')))
{ {
// [Interpretation 8910] Disable fields for display. // [Interpretation 9025] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true'); $form->setFieldAttribute('created_by', 'disabled', 'true');
// [Interpretation 8912] Disable fields for display. // [Interpretation 9027] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true'); $form->setFieldAttribute('created_by', 'readonly', 'true');
// [Interpretation 8914] Disable fields while saving. // [Interpretation 9029] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset'); $form->setFieldAttribute('created_by', 'filter', 'unset');
} }
// [Interpretation 8917] Modify the form based on Edit Creaded Date access controls. // [Interpretation 9032] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('statistic.edit.created', 'com_sermondistributor.statistic.' . (int) $id)) if ($id != 0 && (!$user->authorise('statistic.edit.created', 'com_sermondistributor.statistic.' . (int) $id))
|| ($id == 0 && !$user->authorise('statistic.edit.created', 'com_sermondistributor'))) || ($id == 0 && !$user->authorise('statistic.edit.created', 'com_sermondistributor')))
{ {
// [Interpretation 8929] Disable fields for display. // [Interpretation 9044] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true'); $form->setFieldAttribute('created', 'disabled', 'true');
// [Interpretation 8931] Disable fields while saving. // [Interpretation 9046] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset'); $form->setFieldAttribute('created', 'filter', 'unset');
} }
// [Interpretation 8964] Only load these values if no id is found // [Interpretation 9079] Only load these values if no id is found
if (0 == $id) if (0 == $id)
{ {
// [Interpretation 8967] Set redirected field name // [Interpretation 9082] Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING'); $redirectedField = $jinput->get('ref', null, 'STRING');
// [Interpretation 8969] Set redirected field value // [Interpretation 9084] Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT'); $redirectedValue = $jinput->get('refid', 0, 'INT');
if (0 != $redirectedValue && $redirectedField) if (0 != $redirectedValue && $redirectedField)
{ {
// [Interpretation 8973] Now set the local-redirected field default value // [Interpretation 9088] Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue); $form->setValue($redirectedField, null, $redirectedValue);
} }
} }
@ -223,7 +223,7 @@ class SermondistributorModelStatistic extends JModelAdmin
} }
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 9095] The record has been set. Check the record permissions. // [Interpretation 9210] The record has been set. Check the record permissions.
return $user->authorise('statistic.delete', 'com_sermondistributor.statistic.' . (int) $record->id); return $user->authorise('statistic.delete', 'com_sermondistributor.statistic.' . (int) $record->id);
} }
return false; return false;
@ -245,14 +245,14 @@ class SermondistributorModelStatistic extends JModelAdmin
if ($recordId) if ($recordId)
{ {
// [Interpretation 9182] The record has been set. Check the record permissions. // [Interpretation 9297] The record has been set. Check the record permissions.
$permission = $user->authorise('statistic.edit.state', 'com_sermondistributor.statistic.' . (int) $recordId); $permission = $user->authorise('statistic.edit.state', 'com_sermondistributor.statistic.' . (int) $recordId);
if (!$permission && !is_null($permission)) if (!$permission && !is_null($permission))
{ {
return false; return false;
} }
} }
// [Interpretation 9199] In the absense of better information, revert to the component permissions. // [Interpretation 9314] In the absense of better information, revert to the component permissions.
return $user->authorise('statistic.edit.state', 'com_sermondistributor'); return $user->authorise('statistic.edit.state', 'com_sermondistributor');
} }
@ -267,7 +267,7 @@ class SermondistributorModelStatistic extends JModelAdmin
*/ */
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// [Interpretation 9007] Check specific edit permission then general edit permission. // [Interpretation 9122] Check specific edit permission then general edit permission.
$user = JFactory::getUser(); $user = JFactory::getUser();
return $user->authorise('statistic.edit', 'com_sermondistributor.statistic.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('statistic.edit', 'com_sermondistributor'); return $user->authorise('statistic.edit', 'com_sermondistributor.statistic.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('statistic.edit', 'com_sermondistributor');
@ -493,7 +493,7 @@ class SermondistributorModelStatistic extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 4159] Set some needed variables. // [Interpretation 4183] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -507,12 +507,12 @@ class SermondistributorModelStatistic extends JModelAdmin
return false; return false;
} }
// [Interpretation 4179] get list of uniqe fields // [Interpretation 4203] get list of uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
// [Interpretation 4181] remove move_copy from array // [Interpretation 4205] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4184] make sure published is set // [Interpretation 4208] make sure published is set
if (!isset($values['published'])) if (!isset($values['published']))
{ {
$values['published'] = 0; $values['published'] = 0;
@ -524,21 +524,21 @@ class SermondistributorModelStatistic extends JModelAdmin
$newIds = array(); $newIds = array();
// [Interpretation 4221] Parent exists so let's proceed // [Interpretation 4245] Parent exists so let's proceed
while (!empty($pks)) while (!empty($pks))
{ {
// [Interpretation 4224] Pop the first ID off the stack // [Interpretation 4248] Pop the first ID off the stack
$pk = array_shift($pks); $pk = array_shift($pks);
$this->table->reset(); $this->table->reset();
// [Interpretation 4229] only allow copy if user may edit this item. // [Interpretation 4253] only allow copy if user may edit this item.
if (!$this->user->authorise('statistic.edit', $contexts[$pk])) if (!$this->user->authorise('statistic.edit', $contexts[$pk]))
{ {
// [Interpretation 4239] Not fatal error // [Interpretation 4263] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@ -546,19 +546,19 @@ class SermondistributorModelStatistic extends JModelAdmin
} }
// [Interpretation 4244] Check that the row actually exists // [Interpretation 4268] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4249] Fatal error // [Interpretation 4273] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4256] Not fatal error // [Interpretation 4280] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
@ -566,7 +566,7 @@ class SermondistributorModelStatistic extends JModelAdmin
$this->table->filename = $this->generateUniqe('filename',$this->table->filename); $this->table->filename = $this->generateUniqe('filename',$this->table->filename);
// [Interpretation 4292] insert all set values // [Interpretation 4316] insert all set values
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
@ -578,7 +578,7 @@ class SermondistributorModelStatistic extends JModelAdmin
} }
} }
// [Interpretation 4304] update all uniqe fields // [Interpretation 4328] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
foreach ($uniqeFields as $uniqeField) foreach ($uniqeFields as $uniqeField)
@ -587,13 +587,13 @@ class SermondistributorModelStatistic extends JModelAdmin
} }
} }
// [Interpretation 4313] Reset the ID because we are making a copy // [Interpretation 4337] Reset the ID because we are making a copy
$this->table->id = 0; $this->table->id = 0;
// [Interpretation 4316] TODO: Deal with ordering? // [Interpretation 4340] TODO: Deal with ordering?
// [Interpretation 4317] $this->table->ordering = 1; // [Interpretation 4341] $this->table->ordering = 1;
// [Interpretation 4319] Check the row. // [Interpretation 4343] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -606,7 +606,7 @@ class SermondistributorModelStatistic extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4332] Store the row. // [Interpretation 4356] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -614,14 +614,14 @@ class SermondistributorModelStatistic extends JModelAdmin
return false; return false;
} }
// [Interpretation 4340] Get the new item ID // [Interpretation 4364] Get the new item ID
$newId = $this->table->get('id'); $newId = $this->table->get('id');
// [Interpretation 4343] Add the new ID to the array // [Interpretation 4367] Add the new ID to the array
$newIds[$pk] = $newId; $newIds[$pk] = $newId;
} }
// [Interpretation 4347] Clean the cache // [Interpretation 4371] Clean the cache
$this->cleanCache(); $this->cleanCache();
return $newIds; return $newIds;
@ -642,7 +642,7 @@ class SermondistributorModelStatistic extends JModelAdmin
{ {
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// [Interpretation 3961] Set some needed variables. // [Interpretation 3985] Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
@ -657,15 +657,15 @@ class SermondistributorModelStatistic extends JModelAdmin
return false; return false;
} }
// [Interpretation 3983] make sure published only updates if user has the permission. // [Interpretation 4007] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('statistic.edit.state')) if (isset($values['published']) && !$this->canDo->get('statistic.edit.state'))
{ {
unset($values['published']); unset($values['published']);
} }
// [Interpretation 3996] remove move_copy from array // [Interpretation 4020] remove move_copy from array
unset($values['move_copy']); unset($values['move_copy']);
// [Interpretation 4017] Parent exists so we proceed // [Interpretation 4041] Parent exists so we proceed
foreach ($pks as $pk) foreach ($pks as $pk)
{ {
if (!$this->user->authorise('statistic.edit', $contexts[$pk])) if (!$this->user->authorise('statistic.edit', $contexts[$pk]))
@ -675,30 +675,30 @@ class SermondistributorModelStatistic extends JModelAdmin
return false; return false;
} }
// [Interpretation 4034] Check that the row actually exists // [Interpretation 4058] Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
if ($error = $this->table->getError()) if ($error = $this->table->getError())
{ {
// [Interpretation 4039] Fatal error // [Interpretation 4063] Fatal error
$this->setError($error); $this->setError($error);
return false; return false;
} }
else else
{ {
// [Interpretation 4046] Not fatal error // [Interpretation 4070] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue; continue;
} }
} }
// [Interpretation 4052] insert all set values. // [Interpretation 4076] insert all set values.
if (SermondistributorHelper::checkArray($values)) if (SermondistributorHelper::checkArray($values))
{ {
foreach ($values as $key => $value) foreach ($values as $key => $value)
{ {
// [Interpretation 4057] Do special action for access. // [Interpretation 4081] Do special action for access.
if ('access' == $key && strlen($value) > 0) if ('access' == $key && strlen($value) > 0)
{ {
$this->table->$key = $value; $this->table->$key = $value;
@ -711,7 +711,7 @@ class SermondistributorModelStatistic extends JModelAdmin
} }
// [Interpretation 4069] Check the row. // [Interpretation 4093] Check the row.
if (!$this->table->check()) if (!$this->table->check())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -724,7 +724,7 @@ class SermondistributorModelStatistic extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
} }
// [Interpretation 4082] Store the row. // [Interpretation 4106] Store the row.
if (!$this->table->store()) if (!$this->table->store())
{ {
$this->setError($this->table->getError()); $this->setError($this->table->getError());
@ -733,7 +733,7 @@ class SermondistributorModelStatistic extends JModelAdmin
} }
} }
// [Interpretation 4091] Clean the cache // [Interpretation 4115] Clean the cache
$this->cleanCache(); $this->cleanCache();
return true; return true;
@ -771,10 +771,10 @@ class SermondistributorModelStatistic extends JModelAdmin
$data['params'] = (string) $params; $data['params'] = (string) $params;
} }
// [Interpretation 4439] Alter the uniqe field for save as copy // [Interpretation 4463] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy') if ($input->get('task') == 'save2copy')
{ {
// [Interpretation 4442] Automatic handling of other uniqe fields // [Interpretation 4466] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields(); $uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields)) if (SermondistributorHelper::checkArray($uniqeFields))
{ {
@ -827,7 +827,7 @@ class SermondistributorModelStatistic extends JModelAdmin
protected function _generateNewTitle($title) protected function _generateNewTitle($title)
{ {
// [Interpretation 4497] Alter the title // [Interpretation 4521] Alter the title
$table = $this->getTable(); $table = $this->getTable();
while ($table->load(array('title' => $title))) while ($table->load(array('title' => $title)))

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage statistics.php @subpackage statistics.php
@ -113,16 +113,16 @@ class SermondistributorModelStatistics extends JModelList
*/ */
public function getItems() public function getItems()
{ {
// [Interpretation 9768] check in items // [Interpretation 9883] check in items
$this->checkInNow(); $this->checkInNow();
// load parent items // load parent items
$items = parent::getItems(); $items = parent::getItems();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -147,31 +147,31 @@ class SermondistributorModelStatistics extends JModelList
*/ */
protected function getListQuery() protected function getListQuery()
{ {
// [Interpretation 6723] Get the user object. // [Interpretation 6833] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6725] Create a new query object. // [Interpretation 6835] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6728] Select some fields // [Interpretation 6838] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6735] From the sermondistributor_item table // [Interpretation 6845] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_statistic', 'a')); $query->from($db->quoteName('#__sermondistributor_statistic', 'a'));
// [Interpretation 6876] From the sermondistributor_sermon table. // [Interpretation 6986] From the sermondistributor_sermon table.
$query->select($db->quoteName('g.name','sermon_name')); $query->select($db->quoteName('g.name','sermon_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_sermon', 'g') . ' ON (' . $db->quoteName('a.sermon') . ' = ' . $db->quoteName('g.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_sermon', 'g') . ' ON (' . $db->quoteName('a.sermon') . ' = ' . $db->quoteName('g.id') . ')');
// [Interpretation 6876] From the sermondistributor_preacher table. // [Interpretation 6986] From the sermondistributor_preacher table.
$query->select($db->quoteName('h.name','preacher_name')); $query->select($db->quoteName('h.name','preacher_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'h') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('h.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_preacher', 'h') . ' ON (' . $db->quoteName('a.preacher') . ' = ' . $db->quoteName('h.id') . ')');
// [Interpretation 6876] From the sermondistributor_series table. // [Interpretation 6986] From the sermondistributor_series table.
$query->select($db->quoteName('i.name','series_name')); $query->select($db->quoteName('i.name','series_name'));
$query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'i') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('i.id') . ')'); $query->join('LEFT', $db->quoteName('#__sermondistributor_series', 'i') . ' ON (' . $db->quoteName('a.series') . ' = ' . $db->quoteName('i.id') . ')');
// [Interpretation 6749] Filter by published state // [Interpretation 6859] Filter by published state
$published = $this->getState('filter.published'); $published = $this->getState('filter.published');
if (is_numeric($published)) if (is_numeric($published))
{ {
@ -182,21 +182,21 @@ class SermondistributorModelStatistics extends JModelList
$query->where('(a.published = 0 OR a.published = 1)'); $query->where('(a.published = 0 OR a.published = 1)');
} }
// [Interpretation 6761] Join over the asset groups. // [Interpretation 6871] Join over the asset groups.
$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');
// [Interpretation 6764] Filter by access level. // [Interpretation 6874] Filter by access level.
if ($access = $this->getState('filter.access')) if ($access = $this->getState('filter.access'))
{ {
$query->where('a.access = ' . (int) $access); $query->where('a.access = ' . (int) $access);
} }
// [Interpretation 6769] Implement View Level Access // [Interpretation 6879] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6846] Filter by search. // [Interpretation 6956] Filter by search.
$search = $this->getState('filter.search'); $search = $this->getState('filter.search');
if (!empty($search)) if (!empty($search))
{ {
@ -211,23 +211,23 @@ class SermondistributorModelStatistics extends JModelList
} }
} }
// [Interpretation 6962] Filter by sermon. // [Interpretation 7072] Filter by sermon.
if ($sermon = $this->getState('filter.sermon')) if ($sermon = $this->getState('filter.sermon'))
{ {
$query->where('a.sermon = ' . $db->quote($db->escape($sermon, true))); $query->where('a.sermon = ' . $db->quote($db->escape($sermon, true)));
} }
// [Interpretation 6962] Filter by preacher. // [Interpretation 7072] Filter by preacher.
if ($preacher = $this->getState('filter.preacher')) if ($preacher = $this->getState('filter.preacher'))
{ {
$query->where('a.preacher = ' . $db->quote($db->escape($preacher, true))); $query->where('a.preacher = ' . $db->quote($db->escape($preacher, true)));
} }
// [Interpretation 6962] Filter by series. // [Interpretation 7072] Filter by series.
if ($series = $this->getState('filter.series')) if ($series = $this->getState('filter.series'))
{ {
$query->where('a.series = ' . $db->quote($db->escape($series, true))); $query->where('a.series = ' . $db->quote($db->escape($series, true)));
} }
// [Interpretation 6805] Add the list ordering clause. // [Interpretation 6915] 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', 'asc');
if ($orderCol != '') if ($orderCol != '')
@ -245,42 +245,42 @@ class SermondistributorModelStatistics extends JModelList
*/ */
public function getExportData($pks) public function getExportData($pks)
{ {
// [Interpretation 6513] setup the query // [Interpretation 6623] setup the query
if (SermondistributorHelper::checkArray($pks)) if (SermondistributorHelper::checkArray($pks))
{ {
// [Interpretation 6516] Get the user object. // [Interpretation 6626] Get the user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
// [Interpretation 6518] Create a new query object. // [Interpretation 6628] Create a new query object.
$db = JFactory::getDBO(); $db = JFactory::getDBO();
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 6521] Select some fields // [Interpretation 6631] Select some fields
$query->select('a.*'); $query->select('a.*');
// [Interpretation 6523] From the sermondistributor_statistic table // [Interpretation 6633] 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) . ')'); $query->where('a.id IN (' . implode(',',$pks) . ')');
// [Interpretation 6533] Implement View Level Access // [Interpretation 6643] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor')) if (!$user->authorise('core.options', 'com_sermondistributor'))
{ {
$groups = implode(',', $user->getAuthorisedViewLevels()); $groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')'); $query->where('a.access IN (' . $groups . ')');
} }
// [Interpretation 6540] Order the results by ordering // [Interpretation 6650] Order the results by ordering
$query->order('a.ordering ASC'); $query->order('a.ordering ASC');
// [Interpretation 6542] Load the items // [Interpretation 6652] Load the items
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
$items = $db->loadObjectList(); $items = $db->loadObjectList();
// [Interpretation 9843] set values to display correctly. // [Interpretation 9958] set values to display correctly.
if (SermondistributorHelper::checkArray($items)) if (SermondistributorHelper::checkArray($items))
{ {
// [Interpretation 9846] get user object. // [Interpretation 9961] get user object.
$user = JFactory::getUser(); $user = JFactory::getUser();
foreach ($items as $nr => &$item) foreach ($items as $nr => &$item)
{ {
@ -291,13 +291,13 @@ class SermondistributorModelStatistics extends JModelList
continue; continue;
} }
// [Interpretation 10056] unset the values we don't want exported. // [Interpretation 10171] unset the values we don't want exported.
unset($item->asset_id); unset($item->asset_id);
unset($item->checked_out); unset($item->checked_out);
unset($item->checked_out_time); unset($item->checked_out_time);
} }
} }
// [Interpretation 10065] Add headers to items array. // [Interpretation 10180] Add headers to items array.
$headers = $this->getExImPortHeaders(); $headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers)) if (SermondistributorHelper::checkObject($headers))
{ {
@ -316,13 +316,13 @@ class SermondistributorModelStatistics extends JModelList
*/ */
public function getExImPortHeaders() public function getExImPortHeaders()
{ {
// [Interpretation 6562] Get a db connection. // [Interpretation 6672] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 6564] get the columns // [Interpretation 6674] get the columns
$columns = $db->getTableColumns("#__sermondistributor_statistic"); $columns = $db->getTableColumns("#__sermondistributor_statistic");
if (SermondistributorHelper::checkArray($columns)) if (SermondistributorHelper::checkArray($columns))
{ {
// [Interpretation 6568] remove the headers you don't import/export. // [Interpretation 6678] remove the headers you don't import/export.
unset($columns['asset_id']); unset($columns['asset_id']);
unset($columns['checked_out']); unset($columns['checked_out']);
unset($columns['checked_out_time']); unset($columns['checked_out_time']);
@ -344,7 +344,7 @@ class SermondistributorModelStatistics extends JModelList
*/ */
protected function getStoreId($id = '') protected function getStoreId($id = '')
{ {
// [Interpretation 9391] Compile the store id. // [Interpretation 9506] Compile the store id.
$id .= ':' . $this->getState('filter.id'); $id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.published');
@ -368,15 +368,15 @@ class SermondistributorModelStatistics extends JModelList
*/ */
protected function checkInNow() protected function checkInNow()
{ {
// [Interpretation 9784] Get set check in time // [Interpretation 9899] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in'); $time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time) if ($time)
{ {
// [Interpretation 9789] Get a db connection. // [Interpretation 9904] Get a db connection.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// [Interpretation 9791] reset query // [Interpretation 9906] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select('*'); $query->select('*');
$query->from($db->quoteName('#__sermondistributor_statistic')); $query->from($db->quoteName('#__sermondistributor_statistic'));
@ -384,24 +384,24 @@ class SermondistributorModelStatistics extends JModelList
$db->execute(); $db->execute();
if ($db->getNumRows()) if ($db->getNumRows())
{ {
// [Interpretation 9799] Get Yesterdays date // [Interpretation 9914] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql(); $date = JFactory::getDate()->modify($time)->toSql();
// [Interpretation 9801] reset query // [Interpretation 9916] reset query
$query = $db->getQuery(true); $query = $db->getQuery(true);
// [Interpretation 9803] Fields to update. // [Interpretation 9918] Fields to update.
$fields = array( $fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0' $db->quoteName('checked_out') . '=0'
); );
// [Interpretation 9808] Conditions for which records should be updated. // [Interpretation 9923] Conditions for which records should be updated.
$conditions = array( $conditions = array(
$db->quoteName('checked_out') . '!=0', $db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\'' $db->quoteName('checked_out_time') . '<\''.$date.'\''
); );
// [Interpretation 9813] Check table // [Interpretation 9928] Check table
$query->update($db->quoteName('#__sermondistributor_statistic'))->set($fields)->where($conditions); $query->update($db->quoteName('#__sermondistributor_statistic'))->set($fields)->where($conditions);
$db->setQuery($query); $db->setQuery($query);

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage sermondistributor.php @subpackage sermondistributor.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage help_document.php @subpackage help_document.php
@ -53,7 +53,7 @@ class SermondistributorTableHelp_document extends JTable
{ {
parent::__construct('#__sermondistributor_help_document', 'id', $db); parent::__construct('#__sermondistributor_help_document', 'id', $db);
// [Interpretation 3381] Adding History Options // [Interpretation 3405] Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.help_document')); JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.help_document'));
} }

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.2 @version 1.3.2
@build 19th March, 2016 @build 11th April, 2016
@created 22nd October, 2015 @created 22nd October, 2015
@package Sermon Distributor @package Sermon Distributor
@subpackage preacher.php @subpackage preacher.php
@ -53,7 +53,7 @@ class SermondistributorTablePreacher extends JTable
{ {
parent::__construct('#__sermondistributor_preacher', 'id', $db); parent::__construct('#__sermondistributor_preacher', 'id', $db);
// [Interpretation 3381] Adding History Options // [Interpretation 3405] Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.preacher')); JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.preacher'));
} }

Some files were not shown because too many files have changed in this diff Show More