groups))
{
- // [4270] JSON Decode groups.
+ // [4559] JSON Decode groups.
$item->groups = json_decode($item->groups,true);
}
@@ -122,7 +122,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
- { // [9865] Get the form.
+ { // [10254] Get the form.
$form = $this->loadForm('com_sermondistributor.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@@ -132,12 +132,12 @@ class SermondistributorModelHelp_document extends JModelAdmin
$jinput = JFactory::getApplication()->input;
- // [9950] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ // [10339] 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'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
- // [9955] The back end uses id so we use that the rest of the time and set it to 0 by default.
+ // [10344] The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
@@ -145,36 +145,55 @@ class SermondistributorModelHelp_document extends JModelAdmin
$user = JFactory::getUser();
- // [9961] Check for existing item.
- // [9962] Modify the form based on Edit State access controls.
+ // [10350] Check for existing item.
+ // [10351] Modify the form based on Edit State access controls.
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')))
{
- // [9975] Disable fields for display.
+ // [10364] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
- // [9978] Disable fields while saving.
+ // [10367] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
- // [9983] Modify the form based on Edit Creaded By access controls.
+ // [10372] If this is a new item insure the greated by is set
+ if (0 == $id)
+ {
+ // [10375] Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // [10378] Modify the form based on Edit Creaded By access controls.
if (!$user->authorise('core.edit.created_by', 'com_sermondistributor'))
{
- // [9995] Disable fields for display.
+ // [10390] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
- // [9997] Disable fields for display.
+ // [10392] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
- // [9999] Disable fields while saving.
+ // [10394] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
- // [10002] Modify the form based on Edit Creaded Date access controls.
+ // [10397] Modify the form based on Edit Creaded Date access controls.
if (!$user->authorise('core.edit.created', 'com_sermondistributor'))
{
- // [10014] Disable fields for display.
+ // [10409] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
- // [10016] Disable fields while saving.
+ // [10411] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
+ // [10444] Only load these values if no id is found
+ if (0 == $id)
+ {
+ // [10447] Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // [10449] Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // [10453] Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
return $form;
}
@@ -208,7 +227,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
}
$user = JFactory::getUser();
- // [10166] The record has been set. Check the record permissions.
+ // [10575] The record has been set. Check the record permissions.
return $user->authorise('help_document.delete', 'com_sermondistributor.help_document.' . (int) $record->id);
}
return false;
@@ -230,14 +249,14 @@ class SermondistributorModelHelp_document extends JModelAdmin
if ($recordId)
{
- // [10253] The record has been set. Check the record permissions.
+ // [10662] The record has been set. Check the record permissions.
$permission = $user->authorise('help_document.edit.state', 'com_sermondistributor.help_document.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
- // [10270] In the absense of better information, revert to the component permissions.
+ // [10679] In the absense of better information, revert to the component permissions.
return $user->authorise('help_document.edit.state', 'com_sermondistributor');
}
@@ -252,7 +271,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
*/
protected function allowEdit($data = array(), $key = 'id')
{
- // [10078] Check specific edit permission then general edit permission.
+ // [10487] Check specific edit permission then general edit permission.
$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');
@@ -351,20 +370,20 @@ class SermondistributorModelHelp_document extends JModelAdmin
*/
public function validate($form, $data, $group = null)
{
- // [9069] check if the not_required field is set
+ // [9458] check if the not_required field is set
if (SermondistributorHelper::checkString($data['not_required']))
{
$requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields);
- // [9074] now change the required field attributes value
+ // [9463] now change the required field attributes value
foreach ($requiredFields as $requiredField)
{
- // [9077] make sure there is a string value
+ // [9466] make sure there is a string value
if (SermondistributorHelper::checkString($requiredField))
{
- // [9080] change to false
+ // [9469] change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
- // [9082] also clear the data set
+ // [9471] also clear the data set
$data[$requiredField] = '';
}
}
@@ -514,7 +533,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5226] Set some needed variables.
+ // [5552] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -528,12 +547,12 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false;
}
- // [5246] get list of uniqe fields
+ // [5572] get list of uniqe fields
$uniqeFields = $this->getUniqeFields();
- // [5248] remove move_copy from array
+ // [5574] remove move_copy from array
unset($values['move_copy']);
- // [5251] make sure published is set
+ // [5577] make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
@@ -545,21 +564,21 @@ class SermondistributorModelHelp_document extends JModelAdmin
$newIds = array();
- // [5288] Parent exists so let's proceed
+ // [5614] Parent exists so let's proceed
while (!empty($pks))
{
- // [5291] Pop the first ID off the stack
+ // [5617] Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
- // [5296] only allow copy if user may edit this item.
+ // [5622] only allow copy if user may edit this item.
if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
{
- // [5306] Not fatal error
+ // [5632] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@@ -567,19 +586,19 @@ class SermondistributorModelHelp_document extends JModelAdmin
}
- // [5311] Check that the row actually exists
+ // [5637] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5316] Fatal error
+ // [5642] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5323] Not fatal error
+ // [5649] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
@@ -587,7 +606,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
list($this->table->title, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->title);
- // [5359] insert all set values
+ // [5685] insert all set values
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
@@ -599,7 +618,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
}
}
- // [5371] update all uniqe fields
+ // [5697] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
@@ -608,13 +627,13 @@ class SermondistributorModelHelp_document extends JModelAdmin
}
}
- // [5380] Reset the ID because we are making a copy
+ // [5706] Reset the ID because we are making a copy
$this->table->id = 0;
- // [5383] TODO: Deal with ordering?
- // [5384] $this->table->ordering = 1;
+ // [5709] TODO: Deal with ordering?
+ // [5710] $this->table->ordering = 1;
- // [5386] Check the row.
+ // [5712] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -627,7 +646,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5399] Store the row.
+ // [5725] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -635,14 +654,14 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false;
}
- // [5407] Get the new item ID
+ // [5733] Get the new item ID
$newId = $this->table->get('id');
- // [5410] Add the new ID to the array
+ // [5736] Add the new ID to the array
$newIds[$pk] = $newId;
}
- // [5414] Clean the cache
+ // [5740] Clean the cache
$this->cleanCache();
return $newIds;
@@ -663,7 +682,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5028] Set some needed variables.
+ // [5354] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -678,15 +697,15 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false;
}
- // [5050] make sure published only updates if user has the permission.
+ // [5376] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('help_document.edit.state'))
{
unset($values['published']);
}
- // [5063] remove move_copy from array
+ // [5389] remove move_copy from array
unset($values['move_copy']);
- // [5084] Parent exists so we proceed
+ // [5410] Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
@@ -696,30 +715,30 @@ class SermondistributorModelHelp_document extends JModelAdmin
return false;
}
- // [5101] Check that the row actually exists
+ // [5427] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5106] Fatal error
+ // [5432] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5113] Not fatal error
+ // [5439] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
- // [5119] insert all set values.
+ // [5445] insert all set values.
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
- // [5124] Do special action for access.
+ // [5450] Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
@@ -732,7 +751,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
}
- // [5136] Check the row.
+ // [5462] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -745,7 +764,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5149] Store the row.
+ // [5475] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -754,7 +773,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
}
}
- // [5158] Clean the cache
+ // [5484] Clean the cache
$this->cleanCache();
return true;
@@ -784,7 +803,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
- // [4380] Set the groups string to JSON string.
+ // [4669] Set the groups string to JSON string.
if (isset($data['groups']))
{
$data['groups'] = (string) json_encode($data['groups']);
@@ -798,7 +817,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$data['params'] = (string) $params;
}
- // [5440] Alter the title for save as copy
+ // [5766] Alter the title for save as copy
if ($input->get('task') == 'save2copy')
{
$origTable = clone $this->getTable();
@@ -821,7 +840,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
$data['published'] = 0;
}
- // [5467] Automatic handling of alias for empty fields
+ // [5793] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null)
@@ -852,10 +871,10 @@ class SermondistributorModelHelp_document extends JModelAdmin
}
}
- // [5506] Alter the uniqe field for save as copy
+ // [5832] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy')
{
- // [5509] Automatic handling of other uniqe fields
+ // [5835] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields))
{
@@ -909,7 +928,7 @@ class SermondistributorModelHelp_document extends JModelAdmin
protected function _generateNewTitle($alias, $title)
{
- // [5540] Alter the title & alias
+ // [5866] Alter the title & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
diff --git a/admin/models/help_documents.php b/admin/models/help_documents.php
index 0bca55b9..65d9e2a1 100644
--- a/admin/models/help_documents.php
+++ b/admin/models/help_documents.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage help_documents.php
@@ -113,16 +113,16 @@ class SermondistributorModelHelp_documents extends JModelList
*/
public function getItems()
{
- // [10839] check in items
+ // [11248] check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -133,7 +133,7 @@ class SermondistributorModelHelp_documents extends JModelList
continue;
}
- // [10985] decode groups
+ // [11394] decode groups
$groupsArray = json_decode($item->groups, true);
if (SermondistributorHelper::checkArray($groupsArray))
{
@@ -156,14 +156,14 @@ class SermondistributorModelHelp_documents extends JModelList
}
}
- // [11180] set selection value to a translatable value
+ // [11589] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- // [11187] convert type
+ // [11596] convert type
$item->type = $this->selectionTranslation($item->type, 'type');
- // [11187] convert location
+ // [11596] convert location
$item->location = $this->selectionTranslation($item->location, 'location');
}
}
@@ -180,7 +180,7 @@ class SermondistributorModelHelp_documents extends JModelList
*/
public function selectionTranslation($value,$name)
{
- // [11213] Array of type language strings
+ // [11622] Array of type language strings
if ($name == 'type')
{
$typeArray = array(
@@ -189,20 +189,20 @@ class SermondistributorModelHelp_documents extends JModelList
2 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_TEXT',
3 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_URL'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($typeArray[$value]) && SermondistributorHelper::checkString($typeArray[$value]))
{
return $typeArray[$value];
}
}
- // [11213] Array of location language strings
+ // [11622] Array of location language strings
if ($name == 'location')
{
$locationArray = array(
1 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_ADMIN',
2 => 'COM_SERMONDISTRIBUTOR_HELP_DOCUMENT_SITE'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($locationArray[$value]) && SermondistributorHelper::checkString($locationArray[$value]))
{
return $locationArray[$value];
@@ -218,19 +218,19 @@ class SermondistributorModelHelp_documents extends JModelList
*/
protected function getListQuery()
{
- // [7696] Get the user object.
+ // [8085] Get the user object.
$user = JFactory::getUser();
- // [7698] Create a new query object.
+ // [8087] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7701] Select some fields
+ // [8090] Select some fields
$query->select('a.*');
- // [7708] From the sermondistributor_item table
+ // [8097] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_help_document', 'a'));
- // [7722] Filter by published state
+ // [8111] Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
@@ -241,21 +241,21 @@ class SermondistributorModelHelp_documents extends JModelList
$query->where('(a.published = 0 OR a.published = 1)');
}
- // [7734] Join over the asset groups.
+ // [8123] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7737] Filter by access level.
+ // [8126] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7742] Implement View Level Access
+ // [8131] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7819] Filter by search.
+ // [8208] Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
@@ -270,28 +270,28 @@ class SermondistributorModelHelp_documents extends JModelList
}
}
- // [8062] Filter by Type.
+ // [8451] Filter by Type.
if ($type = $this->getState('filter.type'))
{
$query->where('a.type = ' . $db->quote($db->escape($type, true)));
}
- // [8062] Filter by Location.
+ // [8451] Filter by Location.
if ($location = $this->getState('filter.location'))
{
$query->where('a.location = ' . $db->quote($db->escape($location, true)));
}
- // [8062] Filter by Admin_view.
+ // [8451] Filter by Admin_view.
if ($admin_view = $this->getState('filter.admin_view'))
{
$query->where('a.admin_view = ' . $db->quote($db->escape($admin_view, true)));
}
- // [8062] Filter by Site_view.
+ // [8451] Filter by Site_view.
if ($site_view = $this->getState('filter.site_view'))
{
$query->where('a.site_view = ' . $db->quote($db->escape($site_view, true)));
}
- // [7778] Add the list ordering clause.
+ // [8167] Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '')
@@ -309,42 +309,42 @@ class SermondistributorModelHelp_documents extends JModelList
*/
public function getExportData($pks)
{
- // [7486] setup the query
+ // [7875] setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // [7489] Get the user object.
+ // [7878] Get the user object.
$user = JFactory::getUser();
- // [7491] Create a new query object.
+ // [7880] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7494] Select some fields
+ // [7883] Select some fields
$query->select('a.*');
- // [7496] From the sermondistributor_help_document table
+ // [7885] From the sermondistributor_help_document table
$query->from($db->quoteName('#__sermondistributor_help_document', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
- // [7506] Implement View Level Access
+ // [7895] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7513] Order the results by ordering
+ // [7902] Order the results by ordering
$query->order('a.ordering ASC');
- // [7515] Load the items
+ // [7904] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -355,13 +355,13 @@ class SermondistributorModelHelp_documents extends JModelList
continue;
}
- // [11127] unset the values we don't want exported.
+ // [11536] unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
- // [11136] Add headers to items array.
+ // [11545] Add headers to items array.
$headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers))
{
@@ -380,13 +380,13 @@ class SermondistributorModelHelp_documents extends JModelList
*/
public function getExImPortHeaders()
{
- // [7535] Get a db connection.
+ // [7924] Get a db connection.
$db = JFactory::getDbo();
- // [7537] get the columns
+ // [7926] get the columns
$columns = $db->getTableColumns("#__sermondistributor_help_document");
if (SermondistributorHelper::checkArray($columns))
{
- // [7541] remove the headers you don't import/export.
+ // [7930] remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
@@ -408,7 +408,7 @@ class SermondistributorModelHelp_documents extends JModelList
*/
protected function getStoreId($id = '')
{
- // [10462] Compile the store id.
+ // [10871] Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
@@ -432,15 +432,15 @@ class SermondistributorModelHelp_documents extends JModelList
*/
protected function checkInNow()
{
- // [10855] Get set check in time
+ // [11264] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time)
{
- // [10860] Get a db connection.
+ // [11269] Get a db connection.
$db = JFactory::getDbo();
- // [10862] reset query
+ // [11271] reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__sermondistributor_help_document'));
@@ -448,24 +448,24 @@ class SermondistributorModelHelp_documents extends JModelList
$db->execute();
if ($db->getNumRows())
{
- // [10870] Get Yesterdays date
+ // [11279] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
- // [10872] reset query
+ // [11281] reset query
$query = $db->getQuery(true);
- // [10874] Fields to update.
+ // [11283] Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
- // [10879] Conditions for which records should be updated.
+ // [11288] Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
- // [10884] Check table
+ // [11293] Check table
$query->update($db->quoteName('#__sermondistributor_help_document'))->set($fields)->where($conditions);
$db->setQuery($query);
diff --git a/admin/models/import.php b/admin/models/import.php
index b78b9e71..94e16e0d 100644
--- a/admin/models/import.php
+++ b/admin/models/import.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage import.php
diff --git a/admin/models/preacher.php b/admin/models/preacher.php
index 9c7e348d..6e4f93d0 100644
--- a/admin/models/preacher.php
+++ b/admin/models/preacher.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage preacher.php
@@ -101,7 +101,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$item->tags->getTagIds($item->id, 'com_sermondistributor.preacher');
}
}
- $this->preachercqfb = $item->id;
+ $this->preacherhzzb = $item->id;
return $item;
}
@@ -111,74 +111,74 @@ class SermondistributorModelPreacher extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
- public function getNnrsermons()
+ public function getJhasermons()
{
- // [7244] Get the user object.
+ // [7633] Get the user object.
$user = JFactory::getUser();
- // [7246] Create a new query object.
+ // [7635] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7249] Select some fields
+ // [7638] Select some fields
$query->select('a.*');
$query->select($db->quoteName('c.title','category_title'));
- // [7256] From the sermondistributor_sermon table
+ // [7645] From the sermondistributor_sermon table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')');
- // [7849] From the sermondistributor_preacher table.
+ // [8238] From the sermondistributor_preacher table.
$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') . ')');
- // [7849] From the sermondistributor_series table.
+ // [8238] From the sermondistributor_series table.
$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') . ')');
- // [7272] Filter by preachercqfb global.
- $preachercqfb = $this->preachercqfb;
- if (is_numeric($preachercqfb ))
+ // [7661] Filter by preacherhzzb global.
+ $preacherhzzb = $this->preacherhzzb;
+ if (is_numeric($preacherhzzb ))
{
- $query->where('a.preacher = ' . (int) $preachercqfb );
+ $query->where('a.preacher = ' . (int) $preacherhzzb );
}
- elseif (is_string($preachercqfb))
+ elseif (is_string($preacherhzzb))
{
- $query->where('a.preacher = ' . $db->quote($preachercqfb));
+ $query->where('a.preacher = ' . $db->quote($preacherhzzb));
}
else
{
$query->where('a.preacher = -5');
}
- // [7289] Join over the asset groups.
+ // [7678] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7292] Filter by access level.
+ // [7681] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7297] Implement View Level Access
+ // [7686] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7304] Order the results by ordering
+ // [7693] Order the results by ordering
$query->order('a.ordering ASC');
- // [7306] Load the items
+ // [7695] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -192,15 +192,15 @@ class SermondistributorModelPreacher extends JModelAdmin
}
}
- // [11180] set selection value to a translatable value
+ // [11589] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- // [11187] convert link_type
- $item->link_type = $this->selectionTranslationNnrsermons($item->link_type, 'link_type');
- // [11187] convert source
- $item->source = $this->selectionTranslationNnrsermons($item->source, 'source');
+ // [11596] convert link_type
+ $item->link_type = $this->selectionTranslationJhasermons($item->link_type, 'link_type');
+ // [11596] convert source
+ $item->source = $this->selectionTranslationJhasermons($item->source, 'source');
}
}
@@ -214,22 +214,22 @@ class SermondistributorModelPreacher extends JModelAdmin
*
* @return translatable string
*/
- public function selectionTranslationNnrsermons($value,$name)
+ public function selectionTranslationJhasermons($value,$name)
{
- // [11213] Array of link_type language strings
+ // [11622] Array of link_type language strings
if ($name == 'link_type')
{
$link_typeArray = array(
1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED',
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value]))
{
return $link_typeArray[$value];
}
}
- // [11213] Array of source language strings
+ // [11622] Array of source language strings
if ($name == 'source')
{
$sourceArray = array(
@@ -238,7 +238,7 @@ class SermondistributorModelPreacher extends JModelAdmin
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX',
3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value]))
{
return $sourceArray[$value];
@@ -258,7 +258,7 @@ class SermondistributorModelPreacher extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
- { // [9865] Get the form.
+ { // [10254] Get the form.
$form = $this->loadForm('com_sermondistributor.preacher', 'preacher', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@@ -268,12 +268,12 @@ class SermondistributorModelPreacher extends JModelAdmin
$jinput = JFactory::getApplication()->input;
- // [9950] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ // [10339] 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'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
- // [9955] The back end uses id so we use that the rest of the time and set it to 0 by default.
+ // [10344] The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
@@ -281,38 +281,57 @@ class SermondistributorModelPreacher extends JModelAdmin
$user = JFactory::getUser();
- // [9961] Check for existing item.
- // [9962] Modify the form based on Edit State access controls.
+ // [10350] Check for existing item.
+ // [10351] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('preacher.edit.state', 'com_sermondistributor.preacher.' . (int) $id))
|| ($id == 0 && !$user->authorise('preacher.edit.state', 'com_sermondistributor')))
{
- // [9975] Disable fields for display.
+ // [10364] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
- // [9978] Disable fields while saving.
+ // [10367] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
- // [9983] Modify the form based on Edit Creaded By access controls.
+ // [10372] If this is a new item insure the greated by is set
+ if (0 == $id)
+ {
+ // [10375] Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // [10378] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('preacher.edit.created_by', 'com_sermondistributor.preacher.' . (int) $id))
|| ($id == 0 && !$user->authorise('preacher.edit.created_by', 'com_sermondistributor')))
{
- // [9995] Disable fields for display.
+ // [10390] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
- // [9997] Disable fields for display.
+ // [10392] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
- // [9999] Disable fields while saving.
+ // [10394] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
- // [10002] Modify the form based on Edit Creaded Date access controls.
+ // [10397] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('preacher.edit.created', 'com_sermondistributor.preacher.' . (int) $id))
|| ($id == 0 && !$user->authorise('preacher.edit.created', 'com_sermondistributor')))
{
- // [10014] Disable fields for display.
+ // [10409] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
- // [10016] Disable fields while saving.
+ // [10411] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
+ // [10444] Only load these values if no id is found
+ if (0 == $id)
+ {
+ // [10447] Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // [10449] Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // [10453] Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
return $form;
}
@@ -346,7 +365,7 @@ class SermondistributorModelPreacher extends JModelAdmin
}
$user = JFactory::getUser();
- // [10166] The record has been set. Check the record permissions.
+ // [10575] The record has been set. Check the record permissions.
return $user->authorise('preacher.delete', 'com_sermondistributor.preacher.' . (int) $record->id);
}
return false;
@@ -368,14 +387,14 @@ class SermondistributorModelPreacher extends JModelAdmin
if ($recordId)
{
- // [10253] The record has been set. Check the record permissions.
+ // [10662] The record has been set. Check the record permissions.
$permission = $user->authorise('preacher.edit.state', 'com_sermondistributor.preacher.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
- // [10270] In the absense of better information, revert to the component permissions.
+ // [10679] In the absense of better information, revert to the component permissions.
return $user->authorise('preacher.edit.state', 'com_sermondistributor');
}
@@ -390,7 +409,7 @@ class SermondistributorModelPreacher extends JModelAdmin
*/
protected function allowEdit($data = array(), $key = 'id')
{
- // [10078] Check specific edit permission then general edit permission.
+ // [10487] Check specific edit permission then general edit permission.
$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');
@@ -616,7 +635,7 @@ class SermondistributorModelPreacher extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5226] Set some needed variables.
+ // [5552] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -630,12 +649,12 @@ class SermondistributorModelPreacher extends JModelAdmin
return false;
}
- // [5246] get list of uniqe fields
+ // [5572] get list of uniqe fields
$uniqeFields = $this->getUniqeFields();
- // [5248] remove move_copy from array
+ // [5574] remove move_copy from array
unset($values['move_copy']);
- // [5251] make sure published is set
+ // [5577] make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
@@ -647,21 +666,21 @@ class SermondistributorModelPreacher extends JModelAdmin
$newIds = array();
- // [5288] Parent exists so let's proceed
+ // [5614] Parent exists so let's proceed
while (!empty($pks))
{
- // [5291] Pop the first ID off the stack
+ // [5617] Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
- // [5296] only allow copy if user may edit this item.
+ // [5622] only allow copy if user may edit this item.
if (!$this->user->authorise('preacher.edit', $contexts[$pk]))
{
- // [5306] Not fatal error
+ // [5632] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@@ -669,19 +688,19 @@ class SermondistributorModelPreacher extends JModelAdmin
}
- // [5311] Check that the row actually exists
+ // [5637] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5316] Fatal error
+ // [5642] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5323] Not fatal error
+ // [5649] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
@@ -689,7 +708,7 @@ class SermondistributorModelPreacher extends JModelAdmin
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
- // [5359] insert all set values
+ // [5685] insert all set values
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
@@ -701,7 +720,7 @@ class SermondistributorModelPreacher extends JModelAdmin
}
}
- // [5371] update all uniqe fields
+ // [5697] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
@@ -710,13 +729,13 @@ class SermondistributorModelPreacher extends JModelAdmin
}
}
- // [5380] Reset the ID because we are making a copy
+ // [5706] Reset the ID because we are making a copy
$this->table->id = 0;
- // [5383] TODO: Deal with ordering?
- // [5384] $this->table->ordering = 1;
+ // [5709] TODO: Deal with ordering?
+ // [5710] $this->table->ordering = 1;
- // [5386] Check the row.
+ // [5712] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -729,7 +748,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5399] Store the row.
+ // [5725] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -737,14 +756,14 @@ class SermondistributorModelPreacher extends JModelAdmin
return false;
}
- // [5407] Get the new item ID
+ // [5733] Get the new item ID
$newId = $this->table->get('id');
- // [5410] Add the new ID to the array
+ // [5736] Add the new ID to the array
$newIds[$pk] = $newId;
}
- // [5414] Clean the cache
+ // [5740] Clean the cache
$this->cleanCache();
return $newIds;
@@ -765,7 +784,7 @@ class SermondistributorModelPreacher extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5028] Set some needed variables.
+ // [5354] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -780,15 +799,15 @@ class SermondistributorModelPreacher extends JModelAdmin
return false;
}
- // [5050] make sure published only updates if user has the permission.
+ // [5376] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('preacher.edit.state'))
{
unset($values['published']);
}
- // [5063] remove move_copy from array
+ // [5389] remove move_copy from array
unset($values['move_copy']);
- // [5084] Parent exists so we proceed
+ // [5410] Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('preacher.edit', $contexts[$pk]))
@@ -798,30 +817,30 @@ class SermondistributorModelPreacher extends JModelAdmin
return false;
}
- // [5101] Check that the row actually exists
+ // [5427] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5106] Fatal error
+ // [5432] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5113] Not fatal error
+ // [5439] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
- // [5119] insert all set values.
+ // [5445] insert all set values.
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
- // [5124] Do special action for access.
+ // [5450] Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
@@ -834,7 +853,7 @@ class SermondistributorModelPreacher extends JModelAdmin
}
- // [5136] Check the row.
+ // [5462] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -847,7 +866,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5149] Store the row.
+ // [5475] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -856,7 +875,7 @@ class SermondistributorModelPreacher extends JModelAdmin
}
}
- // [5158] Clean the cache
+ // [5484] Clean the cache
$this->cleanCache();
return true;
@@ -894,7 +913,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$data['params'] = (string) $params;
}
- // [5440] Alter the name for save as copy
+ // [5766] Alter the name for save as copy
if ($input->get('task') == 'save2copy')
{
$origTable = clone $this->getTable();
@@ -917,7 +936,7 @@ class SermondistributorModelPreacher extends JModelAdmin
$data['published'] = 0;
}
- // [5467] Automatic handling of alias for empty fields
+ // [5793] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null)
@@ -948,10 +967,10 @@ class SermondistributorModelPreacher extends JModelAdmin
}
}
- // [5506] Alter the uniqe field for save as copy
+ // [5832] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy')
{
- // [5509] Automatic handling of other uniqe fields
+ // [5835] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields))
{
@@ -1005,7 +1024,7 @@ class SermondistributorModelPreacher extends JModelAdmin
protected function _generateNewTitle($alias, $title)
{
- // [5540] Alter the title & alias
+ // [5866] Alter the title & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
diff --git a/admin/models/preachers.php b/admin/models/preachers.php
index 91a53e9f..9ca15043 100644
--- a/admin/models/preachers.php
+++ b/admin/models/preachers.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage preachers.php
@@ -101,16 +101,16 @@ class SermondistributorModelPreachers extends JModelList
*/
public function getItems()
{
- // [10839] check in items
+ // [11248] check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -135,19 +135,19 @@ class SermondistributorModelPreachers extends JModelList
*/
protected function getListQuery()
{
- // [7696] Get the user object.
+ // [8085] Get the user object.
$user = JFactory::getUser();
- // [7698] Create a new query object.
+ // [8087] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7701] Select some fields
+ // [8090] Select some fields
$query->select('a.*');
- // [7708] From the sermondistributor_item table
+ // [8097] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_preacher', 'a'));
- // [7722] Filter by published state
+ // [8111] Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
@@ -158,21 +158,21 @@ class SermondistributorModelPreachers extends JModelList
$query->where('(a.published = 0 OR a.published = 1)');
}
- // [7734] Join over the asset groups.
+ // [8123] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7737] Filter by access level.
+ // [8126] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7742] Implement View Level Access
+ // [8131] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7819] Filter by search.
+ // [8208] Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
@@ -188,7 +188,7 @@ class SermondistributorModelPreachers extends JModelList
}
- // [7778] Add the list ordering clause.
+ // [8167] Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '')
@@ -206,42 +206,42 @@ class SermondistributorModelPreachers extends JModelList
*/
public function getExportData($pks)
{
- // [7486] setup the query
+ // [7875] setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // [7489] Get the user object.
+ // [7878] Get the user object.
$user = JFactory::getUser();
- // [7491] Create a new query object.
+ // [7880] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7494] Select some fields
+ // [7883] Select some fields
$query->select('a.*');
- // [7496] From the sermondistributor_preacher table
+ // [7885] From the sermondistributor_preacher table
$query->from($db->quoteName('#__sermondistributor_preacher', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
- // [7506] Implement View Level Access
+ // [7895] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7513] Order the results by ordering
+ // [7902] Order the results by ordering
$query->order('a.ordering ASC');
- // [7515] Load the items
+ // [7904] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -252,13 +252,13 @@ class SermondistributorModelPreachers extends JModelList
continue;
}
- // [11127] unset the values we don't want exported.
+ // [11536] unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
- // [11136] Add headers to items array.
+ // [11545] Add headers to items array.
$headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers))
{
@@ -277,13 +277,13 @@ class SermondistributorModelPreachers extends JModelList
*/
public function getExImPortHeaders()
{
- // [7535] Get a db connection.
+ // [7924] Get a db connection.
$db = JFactory::getDbo();
- // [7537] get the columns
+ // [7926] get the columns
$columns = $db->getTableColumns("#__sermondistributor_preacher");
if (SermondistributorHelper::checkArray($columns))
{
- // [7541] remove the headers you don't import/export.
+ // [7930] remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
@@ -305,7 +305,7 @@ class SermondistributorModelPreachers extends JModelList
*/
protected function getStoreId($id = '')
{
- // [10462] Compile the store id.
+ // [10871] Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
@@ -326,15 +326,15 @@ class SermondistributorModelPreachers extends JModelList
*/
protected function checkInNow()
{
- // [10855] Get set check in time
+ // [11264] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time)
{
- // [10860] Get a db connection.
+ // [11269] Get a db connection.
$db = JFactory::getDbo();
- // [10862] reset query
+ // [11271] reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__sermondistributor_preacher'));
@@ -342,24 +342,24 @@ class SermondistributorModelPreachers extends JModelList
$db->execute();
if ($db->getNumRows())
{
- // [10870] Get Yesterdays date
+ // [11279] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
- // [10872] reset query
+ // [11281] reset query
$query = $db->getQuery(true);
- // [10874] Fields to update.
+ // [11283] Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
- // [10879] Conditions for which records should be updated.
+ // [11288] Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
- // [10884] Check table
+ // [11293] Check table
$query->update($db->quoteName('#__sermondistributor_preacher'))->set($fields)->where($conditions);
$db->setQuery($query);
diff --git a/admin/models/series.php b/admin/models/series.php
index 03040473..e0a06dc2 100644
--- a/admin/models/series.php
+++ b/admin/models/series.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage series.php
@@ -101,7 +101,7 @@ class SermondistributorModelSeries extends JModelAdmin
$item->tags->getTagIds($item->id, 'com_sermondistributor.series');
}
}
- $this->seriesxzcp = $item->id;
+ $this->seriesozxh = $item->id;
return $item;
}
@@ -111,74 +111,74 @@ class SermondistributorModelSeries extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
- public function getRbksermons()
+ public function getVmlsermons()
{
- // [7244] Get the user object.
+ // [7633] Get the user object.
$user = JFactory::getUser();
- // [7246] Create a new query object.
+ // [7635] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7249] Select some fields
+ // [7638] Select some fields
$query->select('a.*');
$query->select($db->quoteName('c.title','category_title'));
- // [7256] From the sermondistributor_sermon table
+ // [7645] From the sermondistributor_sermon table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')');
- // [7849] From the sermondistributor_preacher table.
+ // [8238] From the sermondistributor_preacher table.
$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') . ')');
- // [7849] From the sermondistributor_series table.
+ // [8238] From the sermondistributor_series table.
$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') . ')');
- // [7272] Filter by seriesxzcp global.
- $seriesxzcp = $this->seriesxzcp;
- if (is_numeric($seriesxzcp ))
+ // [7661] Filter by seriesozxh global.
+ $seriesozxh = $this->seriesozxh;
+ if (is_numeric($seriesozxh ))
{
- $query->where('a.series = ' . (int) $seriesxzcp );
+ $query->where('a.series = ' . (int) $seriesozxh );
}
- elseif (is_string($seriesxzcp))
+ elseif (is_string($seriesozxh))
{
- $query->where('a.series = ' . $db->quote($seriesxzcp));
+ $query->where('a.series = ' . $db->quote($seriesozxh));
}
else
{
$query->where('a.series = -5');
}
- // [7289] Join over the asset groups.
+ // [7678] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7292] Filter by access level.
+ // [7681] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7297] Implement View Level Access
+ // [7686] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7304] Order the results by ordering
+ // [7693] Order the results by ordering
$query->order('a.ordering ASC');
- // [7306] Load the items
+ // [7695] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -192,15 +192,15 @@ class SermondistributorModelSeries extends JModelAdmin
}
}
- // [11180] set selection value to a translatable value
+ // [11589] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- // [11187] convert link_type
- $item->link_type = $this->selectionTranslationRbksermons($item->link_type, 'link_type');
- // [11187] convert source
- $item->source = $this->selectionTranslationRbksermons($item->source, 'source');
+ // [11596] convert link_type
+ $item->link_type = $this->selectionTranslationVmlsermons($item->link_type, 'link_type');
+ // [11596] convert source
+ $item->source = $this->selectionTranslationVmlsermons($item->source, 'source');
}
}
@@ -214,22 +214,22 @@ class SermondistributorModelSeries extends JModelAdmin
*
* @return translatable string
*/
- public function selectionTranslationRbksermons($value,$name)
+ public function selectionTranslationVmlsermons($value,$name)
{
- // [11213] Array of link_type language strings
+ // [11622] Array of link_type language strings
if ($name == 'link_type')
{
$link_typeArray = array(
1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED',
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value]))
{
return $link_typeArray[$value];
}
}
- // [11213] Array of source language strings
+ // [11622] Array of source language strings
if ($name == 'source')
{
$sourceArray = array(
@@ -238,7 +238,7 @@ class SermondistributorModelSeries extends JModelAdmin
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX',
3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value]))
{
return $sourceArray[$value];
@@ -258,7 +258,7 @@ class SermondistributorModelSeries extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
- { // [9865] Get the form.
+ { // [10254] Get the form.
$form = $this->loadForm('com_sermondistributor.series', 'series', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@@ -268,12 +268,12 @@ class SermondistributorModelSeries extends JModelAdmin
$jinput = JFactory::getApplication()->input;
- // [9950] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ // [10339] 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'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
- // [9955] The back end uses id so we use that the rest of the time and set it to 0 by default.
+ // [10344] The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
@@ -281,38 +281,57 @@ class SermondistributorModelSeries extends JModelAdmin
$user = JFactory::getUser();
- // [9961] Check for existing item.
- // [9962] Modify the form based on Edit State access controls.
+ // [10350] Check for existing item.
+ // [10351] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('series.edit.state', 'com_sermondistributor.series.' . (int) $id))
|| ($id == 0 && !$user->authorise('series.edit.state', 'com_sermondistributor')))
{
- // [9975] Disable fields for display.
+ // [10364] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
- // [9978] Disable fields while saving.
+ // [10367] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
- // [9983] Modify the form based on Edit Creaded By access controls.
+ // [10372] If this is a new item insure the greated by is set
+ if (0 == $id)
+ {
+ // [10375] Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // [10378] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('series.edit.created_by', 'com_sermondistributor.series.' . (int) $id))
|| ($id == 0 && !$user->authorise('series.edit.created_by', 'com_sermondistributor')))
{
- // [9995] Disable fields for display.
+ // [10390] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
- // [9997] Disable fields for display.
+ // [10392] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
- // [9999] Disable fields while saving.
+ // [10394] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
- // [10002] Modify the form based on Edit Creaded Date access controls.
+ // [10397] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('series.edit.created', 'com_sermondistributor.series.' . (int) $id))
|| ($id == 0 && !$user->authorise('series.edit.created', 'com_sermondistributor')))
{
- // [10014] Disable fields for display.
+ // [10409] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
- // [10016] Disable fields while saving.
+ // [10411] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
+ // [10444] Only load these values if no id is found
+ if (0 == $id)
+ {
+ // [10447] Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // [10449] Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // [10453] Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
return $form;
}
@@ -346,7 +365,7 @@ class SermondistributorModelSeries extends JModelAdmin
}
$user = JFactory::getUser();
- // [10166] The record has been set. Check the record permissions.
+ // [10575] The record has been set. Check the record permissions.
return $user->authorise('series.delete', 'com_sermondistributor.series.' . (int) $record->id);
}
return false;
@@ -368,14 +387,14 @@ class SermondistributorModelSeries extends JModelAdmin
if ($recordId)
{
- // [10253] The record has been set. Check the record permissions.
+ // [10662] The record has been set. Check the record permissions.
$permission = $user->authorise('series.edit.state', 'com_sermondistributor.series.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
- // [10270] In the absense of better information, revert to the component permissions.
+ // [10679] In the absense of better information, revert to the component permissions.
return $user->authorise('series.edit.state', 'com_sermondistributor');
}
@@ -390,7 +409,7 @@ class SermondistributorModelSeries extends JModelAdmin
*/
protected function allowEdit($data = array(), $key = 'id')
{
- // [10078] Check specific edit permission then general edit permission.
+ // [10487] Check specific edit permission then general edit permission.
$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');
@@ -616,7 +635,7 @@ class SermondistributorModelSeries extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5226] Set some needed variables.
+ // [5552] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -630,12 +649,12 @@ class SermondistributorModelSeries extends JModelAdmin
return false;
}
- // [5246] get list of uniqe fields
+ // [5572] get list of uniqe fields
$uniqeFields = $this->getUniqeFields();
- // [5248] remove move_copy from array
+ // [5574] remove move_copy from array
unset($values['move_copy']);
- // [5251] make sure published is set
+ // [5577] make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
@@ -647,21 +666,21 @@ class SermondistributorModelSeries extends JModelAdmin
$newIds = array();
- // [5288] Parent exists so let's proceed
+ // [5614] Parent exists so let's proceed
while (!empty($pks))
{
- // [5291] Pop the first ID off the stack
+ // [5617] Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
- // [5296] only allow copy if user may edit this item.
+ // [5622] only allow copy if user may edit this item.
if (!$this->user->authorise('series.edit', $contexts[$pk]))
{
- // [5306] Not fatal error
+ // [5632] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@@ -669,19 +688,19 @@ class SermondistributorModelSeries extends JModelAdmin
}
- // [5311] Check that the row actually exists
+ // [5637] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5316] Fatal error
+ // [5642] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5323] Not fatal error
+ // [5649] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
@@ -689,7 +708,7 @@ class SermondistributorModelSeries extends JModelAdmin
list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name);
- // [5359] insert all set values
+ // [5685] insert all set values
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
@@ -701,7 +720,7 @@ class SermondistributorModelSeries extends JModelAdmin
}
}
- // [5371] update all uniqe fields
+ // [5697] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
@@ -710,13 +729,13 @@ class SermondistributorModelSeries extends JModelAdmin
}
}
- // [5380] Reset the ID because we are making a copy
+ // [5706] Reset the ID because we are making a copy
$this->table->id = 0;
- // [5383] TODO: Deal with ordering?
- // [5384] $this->table->ordering = 1;
+ // [5709] TODO: Deal with ordering?
+ // [5710] $this->table->ordering = 1;
- // [5386] Check the row.
+ // [5712] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -729,7 +748,7 @@ class SermondistributorModelSeries extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5399] Store the row.
+ // [5725] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -737,14 +756,14 @@ class SermondistributorModelSeries extends JModelAdmin
return false;
}
- // [5407] Get the new item ID
+ // [5733] Get the new item ID
$newId = $this->table->get('id');
- // [5410] Add the new ID to the array
+ // [5736] Add the new ID to the array
$newIds[$pk] = $newId;
}
- // [5414] Clean the cache
+ // [5740] Clean the cache
$this->cleanCache();
return $newIds;
@@ -765,7 +784,7 @@ class SermondistributorModelSeries extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5028] Set some needed variables.
+ // [5354] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -780,15 +799,15 @@ class SermondistributorModelSeries extends JModelAdmin
return false;
}
- // [5050] make sure published only updates if user has the permission.
+ // [5376] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('series.edit.state'))
{
unset($values['published']);
}
- // [5063] remove move_copy from array
+ // [5389] remove move_copy from array
unset($values['move_copy']);
- // [5084] Parent exists so we proceed
+ // [5410] Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('series.edit', $contexts[$pk]))
@@ -798,30 +817,30 @@ class SermondistributorModelSeries extends JModelAdmin
return false;
}
- // [5101] Check that the row actually exists
+ // [5427] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5106] Fatal error
+ // [5432] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5113] Not fatal error
+ // [5439] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
- // [5119] insert all set values.
+ // [5445] insert all set values.
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
- // [5124] Do special action for access.
+ // [5450] Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
@@ -834,7 +853,7 @@ class SermondistributorModelSeries extends JModelAdmin
}
- // [5136] Check the row.
+ // [5462] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -847,7 +866,7 @@ class SermondistributorModelSeries extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5149] Store the row.
+ // [5475] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -856,7 +875,7 @@ class SermondistributorModelSeries extends JModelAdmin
}
}
- // [5158] Clean the cache
+ // [5484] Clean the cache
$this->cleanCache();
return true;
@@ -894,7 +913,7 @@ class SermondistributorModelSeries extends JModelAdmin
$data['params'] = (string) $params;
}
- // [5440] Alter the name for save as copy
+ // [5766] Alter the name for save as copy
if ($input->get('task') == 'save2copy')
{
$origTable = clone $this->getTable();
@@ -917,7 +936,7 @@ class SermondistributorModelSeries extends JModelAdmin
$data['published'] = 0;
}
- // [5467] Automatic handling of alias for empty fields
+ // [5793] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null)
@@ -948,10 +967,10 @@ class SermondistributorModelSeries extends JModelAdmin
}
}
- // [5506] Alter the uniqe field for save as copy
+ // [5832] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy')
{
- // [5509] Automatic handling of other uniqe fields
+ // [5835] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields))
{
@@ -1005,7 +1024,7 @@ class SermondistributorModelSeries extends JModelAdmin
protected function _generateNewTitle($alias, $title)
{
- // [5540] Alter the title & alias
+ // [5866] Alter the title & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
diff --git a/admin/models/series_list.php b/admin/models/series_list.php
index 2bd23e00..a885d20e 100644
--- a/admin/models/series_list.php
+++ b/admin/models/series_list.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage series_list.php
@@ -97,16 +97,16 @@ class SermondistributorModelSeries_list extends JModelList
*/
public function getItems()
{
- // [10839] check in items
+ // [11248] check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -131,19 +131,19 @@ class SermondistributorModelSeries_list extends JModelList
*/
protected function getListQuery()
{
- // [7696] Get the user object.
+ // [8085] Get the user object.
$user = JFactory::getUser();
- // [7698] Create a new query object.
+ // [8087] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7701] Select some fields
+ // [8090] Select some fields
$query->select('a.*');
- // [7708] From the sermondistributor_item table
+ // [8097] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_series', 'a'));
- // [7722] Filter by published state
+ // [8111] Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
@@ -154,21 +154,21 @@ class SermondistributorModelSeries_list extends JModelList
$query->where('(a.published = 0 OR a.published = 1)');
}
- // [7734] Join over the asset groups.
+ // [8123] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7737] Filter by access level.
+ // [8126] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7742] Implement View Level Access
+ // [8131] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7819] Filter by search.
+ // [8208] Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
@@ -184,7 +184,7 @@ class SermondistributorModelSeries_list extends JModelList
}
- // [7778] Add the list ordering clause.
+ // [8167] Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '')
@@ -202,42 +202,42 @@ class SermondistributorModelSeries_list extends JModelList
*/
public function getExportData($pks)
{
- // [7486] setup the query
+ // [7875] setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // [7489] Get the user object.
+ // [7878] Get the user object.
$user = JFactory::getUser();
- // [7491] Create a new query object.
+ // [7880] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7494] Select some fields
+ // [7883] Select some fields
$query->select('a.*');
- // [7496] From the sermondistributor_series table
+ // [7885] From the sermondistributor_series table
$query->from($db->quoteName('#__sermondistributor_series', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
- // [7506] Implement View Level Access
+ // [7895] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7513] Order the results by ordering
+ // [7902] Order the results by ordering
$query->order('a.ordering ASC');
- // [7515] Load the items
+ // [7904] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -248,13 +248,13 @@ class SermondistributorModelSeries_list extends JModelList
continue;
}
- // [11127] unset the values we don't want exported.
+ // [11536] unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
- // [11136] Add headers to items array.
+ // [11545] Add headers to items array.
$headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers))
{
@@ -273,13 +273,13 @@ class SermondistributorModelSeries_list extends JModelList
*/
public function getExImPortHeaders()
{
- // [7535] Get a db connection.
+ // [7924] Get a db connection.
$db = JFactory::getDbo();
- // [7537] get the columns
+ // [7926] get the columns
$columns = $db->getTableColumns("#__sermondistributor_series");
if (SermondistributorHelper::checkArray($columns))
{
- // [7541] remove the headers you don't import/export.
+ // [7930] remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
@@ -301,7 +301,7 @@ class SermondistributorModelSeries_list extends JModelList
*/
protected function getStoreId($id = '')
{
- // [10462] Compile the store id.
+ // [10871] Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
@@ -321,15 +321,15 @@ class SermondistributorModelSeries_list extends JModelList
*/
protected function checkInNow()
{
- // [10855] Get set check in time
+ // [11264] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time)
{
- // [10860] Get a db connection.
+ // [11269] Get a db connection.
$db = JFactory::getDbo();
- // [10862] reset query
+ // [11271] reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__sermondistributor_series'));
@@ -337,24 +337,24 @@ class SermondistributorModelSeries_list extends JModelList
$db->execute();
if ($db->getNumRows())
{
- // [10870] Get Yesterdays date
+ // [11279] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
- // [10872] reset query
+ // [11281] reset query
$query = $db->getQuery(true);
- // [10874] Fields to update.
+ // [11283] Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
- // [10879] Conditions for which records should be updated.
+ // [11288] Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
- // [10884] Check table
+ // [11293] Check table
$query->update($db->quoteName('#__sermondistributor_series'))->set($fields)->where($conditions);
$db->setQuery($query);
diff --git a/admin/models/sermon.php b/admin/models/sermon.php
index b0562e77..0ad1dfaf 100644
--- a/admin/models/sermon.php
+++ b/admin/models/sermon.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermon.php
@@ -97,13 +97,13 @@ class SermondistributorModelSermon extends JModelAdmin
if (!empty($item->local_files))
{
- // [4270] JSON Decode local_files.
+ // [4559] JSON Decode local_files.
$item->local_files = json_decode($item->local_files);
}
if (!empty($item->manual_files))
{
- // [4270] JSON Decode manual_files.
+ // [4559] JSON Decode manual_files.
$item->manual_files = json_decode($item->manual_files);
}
@@ -113,7 +113,7 @@ class SermondistributorModelSermon extends JModelAdmin
$item->tags->getTagIds($item->id, 'com_sermondistributor.sermon');
}
}
- $this->sermonjwig = $item->id;
+ $this->sermonhlbv = $item->id;
return $item;
}
@@ -123,76 +123,76 @@ class SermondistributorModelSermon extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
- public function getDvastastics()
+ public function getUxwstastics()
{
- // [7244] Get the user object.
+ // [7633] Get the user object.
$user = JFactory::getUser();
- // [7246] Create a new query object.
+ // [7635] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7249] Select some fields
+ // [7638] Select some fields
$query->select('a.*');
- // [7256] From the sermondistributor_statistic table
+ // [7645] From the sermondistributor_statistic table
$query->from($db->quoteName('#__sermondistributor_statistic', 'a'));
- // [7849] From the sermondistributor_sermon table.
+ // [8238] From the sermondistributor_sermon table.
$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') . ')');
- // [7849] From the sermondistributor_preacher table.
+ // [8238] From the sermondistributor_preacher table.
$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') . ')');
- // [7849] From the sermondistributor_series table.
+ // [8238] From the sermondistributor_series table.
$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') . ')');
- // [7272] Filter by sermonjwig global.
- $sermonjwig = $this->sermonjwig;
- if (is_numeric($sermonjwig ))
+ // [7661] Filter by sermonhlbv global.
+ $sermonhlbv = $this->sermonhlbv;
+ if (is_numeric($sermonhlbv ))
{
- $query->where('a.sermon = ' . (int) $sermonjwig );
+ $query->where('a.sermon = ' . (int) $sermonhlbv );
}
- elseif (is_string($sermonjwig))
+ elseif (is_string($sermonhlbv))
{
- $query->where('a.sermon = ' . $db->quote($sermonjwig));
+ $query->where('a.sermon = ' . $db->quote($sermonhlbv));
}
else
{
$query->where('a.sermon = -5');
}
- // [7289] Join over the asset groups.
+ // [7678] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7292] Filter by access level.
+ // [7681] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7297] Implement View Level Access
+ // [7686] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7304] Order the results by ordering
+ // [7693] Order the results by ordering
$query->order('a.ordering ASC');
- // [7306] Load the items
+ // [7695] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -221,7 +221,7 @@ class SermondistributorModelSermon extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
- { // [9865] Get the form.
+ { // [10254] Get the form.
$form = $this->loadForm('com_sermondistributor.sermon', 'sermon', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@@ -231,17 +231,17 @@ class SermondistributorModelSermon extends JModelAdmin
$jinput = JFactory::getApplication()->input;
- // [9892] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ // [10281] 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'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
- // [9897] The back end uses id so we use that the rest of the time and set it to 0 by default.
+ // [10286] The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
}
- // [9902] Determine correct permissions to check.
+ // [10291] Determine correct permissions to check.
if ($this->getState('sermon.id'))
{
$id = $this->getState('sermon.id');
@@ -249,58 +249,77 @@ class SermondistributorModelSermon extends JModelAdmin
$catid = 0;
if (isset($this->getItem($id)->catid))
{
- // [9909] set catagory id
+ // [10298] set catagory id
$catid = $this->getItem($id)->catid;
- // [9911] Existing record. Can only edit in selected categories.
+ // [10300] Existing record. Can only edit in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit');
- // [9913] Existing record. Can only edit own items in selected categories.
+ // [10302] Existing record. Can only edit own items in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.edit.own');
}
}
else
{
- // [9919] New record. Can only create in selected categories.
+ // [10308] New record. Can only create in selected categories.
$form->setFieldAttribute('catid', 'action', 'core.create');
}
$user = JFactory::getUser();
- // [9923] Check for existing item.
- // [9924] Modify the form based on Edit State access controls.
+ // [10312] Check for existing item.
+ // [10313] Modify the form based on Edit State access controls.
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))
|| ($id == 0 && !$user->authorise('sermon.edit.state', 'com_sermondistributor')))
{
- // [9939] Disable fields for display.
+ // [10328] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
- // [9942] Disable fields while saving.
+ // [10331] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
- // [9983] Modify the form based on Edit Creaded By access controls.
+ // [10372] If this is a new item insure the greated by is set
+ if (0 == $id)
+ {
+ // [10375] Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // [10378] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('sermon.edit.created_by', 'com_sermondistributor.sermon.' . (int) $id))
|| ($id == 0 && !$user->authorise('sermon.edit.created_by', 'com_sermondistributor')))
{
- // [9995] Disable fields for display.
+ // [10390] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
- // [9997] Disable fields for display.
+ // [10392] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
- // [9999] Disable fields while saving.
+ // [10394] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
- // [10002] Modify the form based on Edit Creaded Date access controls.
+ // [10397] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('sermon.edit.created', 'com_sermondistributor.sermon.' . (int) $id))
|| ($id == 0 && !$user->authorise('sermon.edit.created', 'com_sermondistributor')))
{
- // [10014] Disable fields for display.
+ // [10409] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
- // [10016] Disable fields while saving.
+ // [10411] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
+ // [10444] Only load these values if no id is found
+ if (0 == $id)
+ {
+ // [10447] Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // [10449] Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // [10453] Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
return $form;
}
@@ -338,7 +357,7 @@ class SermondistributorModelSermon extends JModelAdmin
if ($allow)
{
- // [10137] The record has been set. Check the record permissions.
+ // [10546] The record has been set. Check the record permissions.
return $user->authorise('sermon.delete', 'com_sermondistributor.sermon.' . (int) $record->id);
}
return $allow;
@@ -362,14 +381,14 @@ class SermondistributorModelSermon extends JModelAdmin
if ($recordId)
{
- // [10210] The record has been set. Check the record permissions.
+ // [10619] The record has been set. Check the record permissions.
$permission = $user->authorise('sermon.edit.state', 'com_sermondistributor.sermon.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
- // [10226] Check against the category.
+ // [10635] Check against the category.
if (!empty($record->catid))
{
$catpermission = $user->authorise('core.edit.state', 'com_sermondistributor.sermons.category.' . (int) $record->catid);
@@ -378,7 +397,7 @@ class SermondistributorModelSermon extends JModelAdmin
return false;
}
}
- // [10237] In the absense of better information, revert to the component permissions.
+ // [10646] In the absense of better information, revert to the component permissions.
return $user->authorise('sermon.edit.state', 'com_sermondistributor');
}
@@ -393,7 +412,7 @@ class SermondistributorModelSermon extends JModelAdmin
*/
protected function allowEdit($data = array(), $key = 'id')
{
- // [10078] Check specific edit permission then general edit permission.
+ // [10487] Check specific edit permission then general edit permission.
$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');
@@ -492,20 +511,20 @@ class SermondistributorModelSermon extends JModelAdmin
*/
public function validate($form, $data, $group = null)
{
- // [9069] check if the not_required field is set
+ // [9458] check if the not_required field is set
if (SermondistributorHelper::checkString($data['not_required']))
{
$requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields);
- // [9074] now change the required field attributes value
+ // [9463] now change the required field attributes value
foreach ($requiredFields as $requiredField)
{
- // [9077] make sure there is a string value
+ // [9466] make sure there is a string value
if (SermondistributorHelper::checkString($requiredField))
{
- // [9080] change to false
+ // [9469] change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
- // [9082] also clear the data set
+ // [9471] also clear the data set
$data[$requiredField] = '';
}
}
@@ -655,7 +674,7 @@ class SermondistributorModelSermon extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5226] Set some needed variables.
+ // [5552] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -669,12 +688,12 @@ class SermondistributorModelSermon extends JModelAdmin
return false;
}
- // [5246] get list of uniqe fields
+ // [5572] get list of uniqe fields
$uniqeFields = $this->getUniqeFields();
- // [5248] remove move_copy from array
+ // [5574] remove move_copy from array
unset($values['move_copy']);
- // [5251] make sure published is set
+ // [5577] make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
@@ -690,7 +709,7 @@ class SermondistributorModelSermon extends JModelAdmin
}
elseif (isset($values['category']) && (int) $values['category'] > 0)
{
- // [5276] move the category value to correct field name
+ // [5602] move the category value to correct field name
$values['catid'] = $values['category'];
unset($values['category']);
}
@@ -701,21 +720,21 @@ class SermondistributorModelSermon extends JModelAdmin
$newIds = array();
- // [5288] Parent exists so let's proceed
+ // [5614] Parent exists so let's proceed
while (!empty($pks))
{
- // [5291] Pop the first ID off the stack
+ // [5617] Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
- // [5296] only allow copy if user may edit this item.
+ // [5622] only allow copy if user may edit this item.
if (!$this->user->authorise('sermon.edit', $contexts[$pk]))
{
- // [5306] Not fatal error
+ // [5632] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@@ -723,19 +742,19 @@ class SermondistributorModelSermon extends JModelAdmin
}
- // [5311] Check that the row actually exists
+ // [5637] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5316] Fatal error
+ // [5642] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5323] Not fatal error
+ // [5649] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
@@ -750,7 +769,7 @@ class SermondistributorModelSermon extends JModelAdmin
list($this->table->name, $this->table->alias) = $this->generateNewTitle($this->table->catid, $this->table->alias, $this->table->name);
}
- // [5359] insert all set values
+ // [5685] insert all set values
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
@@ -762,7 +781,7 @@ class SermondistributorModelSermon extends JModelAdmin
}
}
- // [5371] update all uniqe fields
+ // [5697] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
@@ -771,13 +790,13 @@ class SermondistributorModelSermon extends JModelAdmin
}
}
- // [5380] Reset the ID because we are making a copy
+ // [5706] Reset the ID because we are making a copy
$this->table->id = 0;
- // [5383] TODO: Deal with ordering?
- // [5384] $this->table->ordering = 1;
+ // [5709] TODO: Deal with ordering?
+ // [5710] $this->table->ordering = 1;
- // [5386] Check the row.
+ // [5712] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -790,7 +809,7 @@ class SermondistributorModelSermon extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5399] Store the row.
+ // [5725] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -798,14 +817,14 @@ class SermondistributorModelSermon extends JModelAdmin
return false;
}
- // [5407] Get the new item ID
+ // [5733] Get the new item ID
$newId = $this->table->get('id');
- // [5410] Add the new ID to the array
+ // [5736] Add the new ID to the array
$newIds[$pk] = $newId;
}
- // [5414] Clean the cache
+ // [5740] Clean the cache
$this->cleanCache();
return $newIds;
@@ -826,7 +845,7 @@ class SermondistributorModelSermon extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5028] Set some needed variables.
+ // [5354] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -841,12 +860,12 @@ class SermondistributorModelSermon extends JModelAdmin
return false;
}
- // [5050] make sure published only updates if user has the permission.
+ // [5376] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('sermon.edit.state'))
{
unset($values['published']);
}
- // [5063] remove move_copy from array
+ // [5389] remove move_copy from array
unset($values['move_copy']);
if (isset($values['category']) && (int) $values['category'] > 0 && !static::checkCategoryId($values['category']))
@@ -855,7 +874,7 @@ class SermondistributorModelSermon extends JModelAdmin
}
elseif (isset($values['category']) && (int) $values['category'] > 0)
{
- // [5074] move the category value to correct field name
+ // [5400] move the category value to correct field name
$values['catid'] = $values['category'];
unset($values['category']);
}
@@ -865,7 +884,7 @@ class SermondistributorModelSermon extends JModelAdmin
}
- // [5084] Parent exists so we proceed
+ // [5410] Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('sermon.edit', $contexts[$pk]))
@@ -875,30 +894,30 @@ class SermondistributorModelSermon extends JModelAdmin
return false;
}
- // [5101] Check that the row actually exists
+ // [5427] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5106] Fatal error
+ // [5432] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5113] Not fatal error
+ // [5439] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
- // [5119] insert all set values.
+ // [5445] insert all set values.
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
- // [5124] Do special action for access.
+ // [5450] Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
@@ -911,7 +930,7 @@ class SermondistributorModelSermon extends JModelAdmin
}
- // [5136] Check the row.
+ // [5462] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -924,7 +943,7 @@ class SermondistributorModelSermon extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5149] Store the row.
+ // [5475] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -933,7 +952,7 @@ class SermondistributorModelSermon extends JModelAdmin
}
}
- // [5158] Clean the cache
+ // [5484] Clean the cache
$this->cleanCache();
return true;
@@ -963,13 +982,13 @@ class SermondistributorModelSermon extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
- // [4380] Set the local_files string to JSON string.
+ // [4669] Set the local_files string to JSON string.
if (isset($data['local_files']))
{
$data['local_files'] = (string) json_encode($data['local_files']);
}
- // [4380] Set the manual_files string to JSON string.
+ // [4669] Set the manual_files string to JSON string.
if (isset($data['manual_files']))
{
$data['manual_files'] = (string) json_encode($data['manual_files']);
@@ -983,7 +1002,7 @@ class SermondistributorModelSermon extends JModelAdmin
$data['params'] = (string) $params;
}
- // [5440] Alter the name for save as copy
+ // [5766] Alter the name for save as copy
if ($input->get('task') == 'save2copy')
{
$origTable = clone $this->getTable();
@@ -1006,7 +1025,7 @@ class SermondistributorModelSermon extends JModelAdmin
$data['published'] = 0;
}
- // [5467] Automatic handling of alias for empty fields
+ // [5793] Automatic handling of alias for empty fields
if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0)
{
if ($data['alias'] == null)
@@ -1037,10 +1056,10 @@ class SermondistributorModelSermon extends JModelAdmin
}
}
- // [5506] Alter the uniqe field for save as copy
+ // [5832] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy')
{
- // [5509] Automatic handling of other uniqe fields
+ // [5835] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields))
{
@@ -1094,7 +1113,7 @@ class SermondistributorModelSermon extends JModelAdmin
protected function _generateNewTitle($alias, $title)
{
- // [5540] Alter the title & alias
+ // [5866] Alter the title & alias
$table = $this->getTable();
while ($table->load(array('alias' => $alias)))
diff --git a/admin/models/sermondistributor.php b/admin/models/sermondistributor.php
index 40188a22..557f3749 100644
--- a/admin/models/sermondistributor.php
+++ b/admin/models/sermondistributor.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermondistributor.php
@@ -45,7 +45,7 @@ class SermondistributorModelSermondistributor extends JModelList
$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')
);
- // [12485] view access array
+ // [12897] view access array
$viewAccess = array(
'preacher.create' => 'preacher.create',
'preachers.access' => 'preacher.access',
diff --git a/admin/models/sermons.php b/admin/models/sermons.php
index c33a65f7..6e0a1c16 100644
--- a/admin/models/sermons.php
+++ b/admin/models/sermons.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermons.php
@@ -129,16 +129,16 @@ class SermondistributorModelSermons extends JModelList
*/
public function getItems()
{
- // [10839] check in items
+ // [11248] check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -152,14 +152,14 @@ class SermondistributorModelSermons extends JModelList
}
}
- // [11180] set selection value to a translatable value
+ // [11589] set selection value to a translatable value
if (SermondistributorHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
- // [11187] convert link_type
+ // [11596] convert link_type
$item->link_type = $this->selectionTranslation($item->link_type, 'link_type');
- // [11187] convert source
+ // [11596] convert source
$item->source = $this->selectionTranslation($item->source, 'source');
}
}
@@ -176,20 +176,20 @@ class SermondistributorModelSermons extends JModelList
*/
public function selectionTranslation($value,$name)
{
- // [11213] Array of link_type language strings
+ // [11622] Array of link_type language strings
if ($name == 'link_type')
{
$link_typeArray = array(
1 => 'COM_SERMONDISTRIBUTOR_SERMON_ENCRYPTED',
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DIRECT'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($link_typeArray[$value]) && SermondistributorHelper::checkString($link_typeArray[$value]))
{
return $link_typeArray[$value];
}
}
- // [11213] Array of source language strings
+ // [11622] Array of source language strings
if ($name == 'source')
{
$sourceArray = array(
@@ -198,7 +198,7 @@ class SermondistributorModelSermons extends JModelList
2 => 'COM_SERMONDISTRIBUTOR_SERMON_DROPBOX',
3 => 'COM_SERMONDISTRIBUTOR_SERMON_URL'
);
- // [11244] Now check if value is found in this array
+ // [11653] Now check if value is found in this array
if (isset($sourceArray[$value]) && SermondistributorHelper::checkString($sourceArray[$value]))
{
return $sourceArray[$value];
@@ -214,29 +214,29 @@ class SermondistributorModelSermons extends JModelList
*/
protected function getListQuery()
{
- // [7696] Get the user object.
+ // [8085] Get the user object.
$user = JFactory::getUser();
- // [7698] Create a new query object.
+ // [8087] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7701] Select some fields
+ // [8090] Select some fields
$query->select('a.*');
$query->select($db->quoteName('c.title','category_title'));
- // [7708] From the sermondistributor_item table
+ // [8097] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->join('LEFT', $db->quoteName('#__categories', 'c') . ' ON (' . $db->quoteName('a.catid') . ' = ' . $db->quoteName('c.id') . ')');
- // [7849] From the sermondistributor_preacher table.
+ // [8238] From the sermondistributor_preacher table.
$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') . ')');
- // [7849] From the sermondistributor_series table.
+ // [8238] From the sermondistributor_series table.
$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') . ')');
- // [7722] Filter by published state
+ // [8111] Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
@@ -247,21 +247,21 @@ class SermondistributorModelSermons extends JModelList
$query->where('(a.published = 0 OR a.published = 1)');
}
- // [7734] Join over the asset groups.
+ // [8123] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7737] Filter by access level.
+ // [8126] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7742] Implement View Level Access
+ // [8131] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7819] Filter by search.
+ // [8208] Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
@@ -276,28 +276,28 @@ class SermondistributorModelSermons extends JModelList
}
}
- // [8053] Filter by preacher.
+ // [8442] Filter by preacher.
if ($preacher = $this->getState('filter.preacher'))
{
$query->where('a.preacher = ' . $db->quote($db->escape($preacher, true)));
}
- // [8053] Filter by series.
+ // [8442] Filter by series.
if ($series = $this->getState('filter.series'))
{
$query->where('a.series = ' . $db->quote($db->escape($series, true)));
}
- // [8062] Filter by Link_type.
+ // [8451] Filter by Link_type.
if ($link_type = $this->getState('filter.link_type'))
{
$query->where('a.link_type = ' . $db->quote($db->escape($link_type, true)));
}
- // [8062] Filter by Source.
+ // [8451] Filter by Source.
if ($source = $this->getState('filter.source'))
{
$query->where('a.source = ' . $db->quote($db->escape($source, true)));
}
- // [7756] Filter by a single or group of categories.
+ // [8145] Filter by a single or group of categories.
$baselevel = 1;
$categoryId = $this->getState('filter.category_id');
@@ -319,7 +319,7 @@ class SermondistributorModelSermons extends JModelList
}
- // [7778] Add the list ordering clause.
+ // [8167] Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '')
@@ -337,42 +337,42 @@ class SermondistributorModelSermons extends JModelList
*/
public function getExportData($pks)
{
- // [7486] setup the query
+ // [7875] setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // [7489] Get the user object.
+ // [7878] Get the user object.
$user = JFactory::getUser();
- // [7491] Create a new query object.
+ // [7880] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7494] Select some fields
+ // [7883] Select some fields
$query->select('a.*');
- // [7496] From the sermondistributor_sermon table
+ // [7885] From the sermondistributor_sermon table
$query->from($db->quoteName('#__sermondistributor_sermon', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
- // [7506] Implement View Level Access
+ // [7895] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7513] Order the results by ordering
+ // [7902] Order the results by ordering
$query->order('a.ordering ASC');
- // [7515] Load the items
+ // [7904] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -383,13 +383,13 @@ class SermondistributorModelSermons extends JModelList
continue;
}
- // [11127] unset the values we don't want exported.
+ // [11536] unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
- // [11136] Add headers to items array.
+ // [11545] Add headers to items array.
$headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers))
{
@@ -408,13 +408,13 @@ class SermondistributorModelSermons extends JModelList
*/
public function getExImPortHeaders()
{
- // [7535] Get a db connection.
+ // [7924] Get a db connection.
$db = JFactory::getDbo();
- // [7537] get the columns
+ // [7926] get the columns
$columns = $db->getTableColumns("#__sermondistributor_sermon");
if (SermondistributorHelper::checkArray($columns))
{
- // [7541] remove the headers you don't import/export.
+ // [7930] remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
@@ -436,7 +436,7 @@ class SermondistributorModelSermons extends JModelList
*/
protected function getStoreId($id = '')
{
- // [10462] Compile the store id.
+ // [10871] Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
@@ -464,15 +464,15 @@ class SermondistributorModelSermons extends JModelList
*/
protected function checkInNow()
{
- // [10855] Get set check in time
+ // [11264] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time)
{
- // [10860] Get a db connection.
+ // [11269] Get a db connection.
$db = JFactory::getDbo();
- // [10862] reset query
+ // [11271] reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__sermondistributor_sermon'));
@@ -480,24 +480,24 @@ class SermondistributorModelSermons extends JModelList
$db->execute();
if ($db->getNumRows())
{
- // [10870] Get Yesterdays date
+ // [11279] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
- // [10872] reset query
+ // [11281] reset query
$query = $db->getQuery(true);
- // [10874] Fields to update.
+ // [11283] Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
- // [10879] Conditions for which records should be updated.
+ // [11288] Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
- // [10884] Check table
+ // [11293] Check table
$query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions);
$db->setQuery($query);
diff --git a/admin/models/statistic.php b/admin/models/statistic.php
index 5e75f142..f2db3c30 100644
--- a/admin/models/statistic.php
+++ b/admin/models/statistic.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage statistic.php
@@ -116,7 +116,7 @@ class SermondistributorModelStatistic extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
- { // [9865] Get the form.
+ { // [10254] Get the form.
$form = $this->loadForm('com_sermondistributor.statistic', 'statistic', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@@ -126,12 +126,12 @@ class SermondistributorModelStatistic extends JModelAdmin
$jinput = JFactory::getApplication()->input;
- // [9950] The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
+ // [10339] 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'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
- // [9955] The back end uses id so we use that the rest of the time and set it to 0 by default.
+ // [10344] The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
@@ -139,38 +139,57 @@ class SermondistributorModelStatistic extends JModelAdmin
$user = JFactory::getUser();
- // [9961] Check for existing item.
- // [9962] Modify the form based on Edit State access controls.
+ // [10350] Check for existing item.
+ // [10351] Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('statistic.edit.state', 'com_sermondistributor.statistic.' . (int) $id))
|| ($id == 0 && !$user->authorise('statistic.edit.state', 'com_sermondistributor')))
{
- // [9975] Disable fields for display.
+ // [10364] Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
- // [9978] Disable fields while saving.
+ // [10367] Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
- // [9983] Modify the form based on Edit Creaded By access controls.
+ // [10372] If this is a new item insure the greated by is set
+ if (0 == $id)
+ {
+ // [10375] Set the created_by to this user
+ $form->setValue('created_by', null, $user->id);
+ }
+ // [10378] Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('statistic.edit.created_by', 'com_sermondistributor.statistic.' . (int) $id))
|| ($id == 0 && !$user->authorise('statistic.edit.created_by', 'com_sermondistributor')))
{
- // [9995] Disable fields for display.
+ // [10390] Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
- // [9997] Disable fields for display.
+ // [10392] Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
- // [9999] Disable fields while saving.
+ // [10394] Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
- // [10002] Modify the form based on Edit Creaded Date access controls.
+ // [10397] Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('statistic.edit.created', 'com_sermondistributor.statistic.' . (int) $id))
|| ($id == 0 && !$user->authorise('statistic.edit.created', 'com_sermondistributor')))
{
- // [10014] Disable fields for display.
+ // [10409] Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
- // [10016] Disable fields while saving.
+ // [10411] Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
+ // [10444] Only load these values if no id is found
+ if (0 == $id)
+ {
+ // [10447] Set redirected field name
+ $redirectedField = $jinput->get('ref', null, 'STRING');
+ // [10449] Set redirected field value
+ $redirectedValue = $jinput->get('refid', 0, 'INT');
+ if (0 != $redirectedValue && $redirectedField)
+ {
+ // [10453] Now set the local-redirected field default value
+ $form->setValue($redirectedField, null, $redirectedValue);
+ }
+ }
return $form;
}
@@ -204,7 +223,7 @@ class SermondistributorModelStatistic extends JModelAdmin
}
$user = JFactory::getUser();
- // [10166] The record has been set. Check the record permissions.
+ // [10575] The record has been set. Check the record permissions.
return $user->authorise('statistic.delete', 'com_sermondistributor.statistic.' . (int) $record->id);
}
return false;
@@ -226,14 +245,14 @@ class SermondistributorModelStatistic extends JModelAdmin
if ($recordId)
{
- // [10253] The record has been set. Check the record permissions.
+ // [10662] The record has been set. Check the record permissions.
$permission = $user->authorise('statistic.edit.state', 'com_sermondistributor.statistic.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
- // [10270] In the absense of better information, revert to the component permissions.
+ // [10679] In the absense of better information, revert to the component permissions.
return $user->authorise('statistic.edit.state', 'com_sermondistributor');
}
@@ -248,7 +267,7 @@ class SermondistributorModelStatistic extends JModelAdmin
*/
protected function allowEdit($data = array(), $key = 'id')
{
- // [10078] Check specific edit permission then general edit permission.
+ // [10487] Check specific edit permission then general edit permission.
$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');
@@ -474,7 +493,7 @@ class SermondistributorModelStatistic extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5226] Set some needed variables.
+ // [5552] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -488,12 +507,12 @@ class SermondistributorModelStatistic extends JModelAdmin
return false;
}
- // [5246] get list of uniqe fields
+ // [5572] get list of uniqe fields
$uniqeFields = $this->getUniqeFields();
- // [5248] remove move_copy from array
+ // [5574] remove move_copy from array
unset($values['move_copy']);
- // [5251] make sure published is set
+ // [5577] make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
@@ -505,21 +524,21 @@ class SermondistributorModelStatistic extends JModelAdmin
$newIds = array();
- // [5288] Parent exists so let's proceed
+ // [5614] Parent exists so let's proceed
while (!empty($pks))
{
- // [5291] Pop the first ID off the stack
+ // [5617] Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
- // [5296] only allow copy if user may edit this item.
+ // [5622] only allow copy if user may edit this item.
if (!$this->user->authorise('statistic.edit', $contexts[$pk]))
{
- // [5306] Not fatal error
+ // [5632] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
@@ -527,19 +546,19 @@ class SermondistributorModelStatistic extends JModelAdmin
}
- // [5311] Check that the row actually exists
+ // [5637] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5316] Fatal error
+ // [5642] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5323] Not fatal error
+ // [5649] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
@@ -547,7 +566,7 @@ class SermondistributorModelStatistic extends JModelAdmin
$this->table->filename = $this->generateUniqe('filename',$this->table->filename);
- // [5359] insert all set values
+ // [5685] insert all set values
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
@@ -559,7 +578,7 @@ class SermondistributorModelStatistic extends JModelAdmin
}
}
- // [5371] update all uniqe fields
+ // [5697] update all uniqe fields
if (SermondistributorHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
@@ -568,13 +587,13 @@ class SermondistributorModelStatistic extends JModelAdmin
}
}
- // [5380] Reset the ID because we are making a copy
+ // [5706] Reset the ID because we are making a copy
$this->table->id = 0;
- // [5383] TODO: Deal with ordering?
- // [5384] $this->table->ordering = 1;
+ // [5709] TODO: Deal with ordering?
+ // [5710] $this->table->ordering = 1;
- // [5386] Check the row.
+ // [5712] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -587,7 +606,7 @@ class SermondistributorModelStatistic extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5399] Store the row.
+ // [5725] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -595,14 +614,14 @@ class SermondistributorModelStatistic extends JModelAdmin
return false;
}
- // [5407] Get the new item ID
+ // [5733] Get the new item ID
$newId = $this->table->get('id');
- // [5410] Add the new ID to the array
+ // [5736] Add the new ID to the array
$newIds[$pk] = $newId;
}
- // [5414] Clean the cache
+ // [5740] Clean the cache
$this->cleanCache();
return $newIds;
@@ -623,7 +642,7 @@ class SermondistributorModelStatistic extends JModelAdmin
{
if (empty($this->batchSet))
{
- // [5028] Set some needed variables.
+ // [5354] Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
@@ -638,15 +657,15 @@ class SermondistributorModelStatistic extends JModelAdmin
return false;
}
- // [5050] make sure published only updates if user has the permission.
+ // [5376] make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('statistic.edit.state'))
{
unset($values['published']);
}
- // [5063] remove move_copy from array
+ // [5389] remove move_copy from array
unset($values['move_copy']);
- // [5084] Parent exists so we proceed
+ // [5410] Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('statistic.edit', $contexts[$pk]))
@@ -656,30 +675,30 @@ class SermondistributorModelStatistic extends JModelAdmin
return false;
}
- // [5101] Check that the row actually exists
+ // [5427] Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
- // [5106] Fatal error
+ // [5432] Fatal error
$this->setError($error);
return false;
}
else
{
- // [5113] Not fatal error
+ // [5439] Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
- // [5119] insert all set values.
+ // [5445] insert all set values.
if (SermondistributorHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
- // [5124] Do special action for access.
+ // [5450] Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
@@ -692,7 +711,7 @@ class SermondistributorModelStatistic extends JModelAdmin
}
- // [5136] Check the row.
+ // [5462] Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
@@ -705,7 +724,7 @@ class SermondistributorModelStatistic extends JModelAdmin
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
- // [5149] Store the row.
+ // [5475] Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
@@ -714,7 +733,7 @@ class SermondistributorModelStatistic extends JModelAdmin
}
}
- // [5158] Clean the cache
+ // [5484] Clean the cache
$this->cleanCache();
return true;
@@ -752,10 +771,10 @@ class SermondistributorModelStatistic extends JModelAdmin
$data['params'] = (string) $params;
}
- // [5506] Alter the uniqe field for save as copy
+ // [5832] Alter the uniqe field for save as copy
if ($input->get('task') == 'save2copy')
{
- // [5509] Automatic handling of other uniqe fields
+ // [5835] Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields();
if (SermondistributorHelper::checkArray($uniqeFields))
{
@@ -808,7 +827,7 @@ class SermondistributorModelStatistic extends JModelAdmin
protected function _generateNewTitle($title)
{
- // [5564] Alter the title
+ // [5890] Alter the title
$table = $this->getTable();
while ($table->load(array('title' => $title)))
diff --git a/admin/models/statistics.php b/admin/models/statistics.php
index 1e28263c..2605853d 100644
--- a/admin/models/statistics.php
+++ b/admin/models/statistics.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage statistics.php
@@ -113,16 +113,16 @@ class SermondistributorModelStatistics extends JModelList
*/
public function getItems()
{
- // [10839] check in items
+ // [11248] check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -147,31 +147,31 @@ class SermondistributorModelStatistics extends JModelList
*/
protected function getListQuery()
{
- // [7696] Get the user object.
+ // [8085] Get the user object.
$user = JFactory::getUser();
- // [7698] Create a new query object.
+ // [8087] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7701] Select some fields
+ // [8090] Select some fields
$query->select('a.*');
- // [7708] From the sermondistributor_item table
+ // [8097] From the sermondistributor_item table
$query->from($db->quoteName('#__sermondistributor_statistic', 'a'));
- // [7849] From the sermondistributor_sermon table.
+ // [8238] From the sermondistributor_sermon table.
$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') . ')');
- // [7849] From the sermondistributor_preacher table.
+ // [8238] From the sermondistributor_preacher table.
$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') . ')');
- // [7849] From the sermondistributor_series table.
+ // [8238] From the sermondistributor_series table.
$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') . ')');
- // [7722] Filter by published state
+ // [8111] Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
@@ -182,21 +182,21 @@ class SermondistributorModelStatistics extends JModelList
$query->where('(a.published = 0 OR a.published = 1)');
}
- // [7734] Join over the asset groups.
+ // [8123] Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
- // [7737] Filter by access level.
+ // [8126] Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
- // [7742] Implement View Level Access
+ // [8131] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7819] Filter by search.
+ // [8208] Filter by search.
$search = $this->getState('filter.search');
if (!empty($search))
{
@@ -211,23 +211,23 @@ class SermondistributorModelStatistics extends JModelList
}
}
- // [8053] Filter by sermon.
+ // [8442] Filter by sermon.
if ($sermon = $this->getState('filter.sermon'))
{
$query->where('a.sermon = ' . $db->quote($db->escape($sermon, true)));
}
- // [8053] Filter by preacher.
+ // [8442] Filter by preacher.
if ($preacher = $this->getState('filter.preacher'))
{
$query->where('a.preacher = ' . $db->quote($db->escape($preacher, true)));
}
- // [8053] Filter by series.
+ // [8442] Filter by series.
if ($series = $this->getState('filter.series'))
{
$query->where('a.series = ' . $db->quote($db->escape($series, true)));
}
- // [7778] Add the list ordering clause.
+ // [8167] Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '')
@@ -245,42 +245,42 @@ class SermondistributorModelStatistics extends JModelList
*/
public function getExportData($pks)
{
- // [7486] setup the query
+ // [7875] setup the query
if (SermondistributorHelper::checkArray($pks))
{
- // [7489] Get the user object.
+ // [7878] Get the user object.
$user = JFactory::getUser();
- // [7491] Create a new query object.
+ // [7880] Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
- // [7494] Select some fields
+ // [7883] Select some fields
$query->select('a.*');
- // [7496] From the sermondistributor_statistic table
+ // [7885] From the sermondistributor_statistic table
$query->from($db->quoteName('#__sermondistributor_statistic', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
- // [7506] Implement View Level Access
+ // [7895] Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
- // [7513] Order the results by ordering
+ // [7902] Order the results by ordering
$query->order('a.ordering ASC');
- // [7515] Load the items
+ // [7904] Load the items
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$items = $db->loadObjectList();
- // [10914] set values to display correctly.
+ // [11323] set values to display correctly.
if (SermondistributorHelper::checkArray($items))
{
- // [10917] get user object.
+ // [11326] get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
@@ -291,13 +291,13 @@ class SermondistributorModelStatistics extends JModelList
continue;
}
- // [11127] unset the values we don't want exported.
+ // [11536] unset the values we don't want exported.
unset($item->asset_id);
unset($item->checked_out);
unset($item->checked_out_time);
}
}
- // [11136] Add headers to items array.
+ // [11545] Add headers to items array.
$headers = $this->getExImPortHeaders();
if (SermondistributorHelper::checkObject($headers))
{
@@ -316,13 +316,13 @@ class SermondistributorModelStatistics extends JModelList
*/
public function getExImPortHeaders()
{
- // [7535] Get a db connection.
+ // [7924] Get a db connection.
$db = JFactory::getDbo();
- // [7537] get the columns
+ // [7926] get the columns
$columns = $db->getTableColumns("#__sermondistributor_statistic");
if (SermondistributorHelper::checkArray($columns))
{
- // [7541] remove the headers you don't import/export.
+ // [7930] remove the headers you don't import/export.
unset($columns['asset_id']);
unset($columns['checked_out']);
unset($columns['checked_out_time']);
@@ -344,7 +344,7 @@ class SermondistributorModelStatistics extends JModelList
*/
protected function getStoreId($id = '')
{
- // [10462] Compile the store id.
+ // [10871] Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
@@ -368,15 +368,15 @@ class SermondistributorModelStatistics extends JModelList
*/
protected function checkInNow()
{
- // [10855] Get set check in time
+ // [11264] Get set check in time
$time = JComponentHelper::getParams('com_sermondistributor')->get('check_in');
if ($time)
{
- // [10860] Get a db connection.
+ // [11269] Get a db connection.
$db = JFactory::getDbo();
- // [10862] reset query
+ // [11271] reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__sermondistributor_statistic'));
@@ -384,24 +384,24 @@ class SermondistributorModelStatistics extends JModelList
$db->execute();
if ($db->getNumRows())
{
- // [10870] Get Yesterdays date
+ // [11279] Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
- // [10872] reset query
+ // [11281] reset query
$query = $db->getQuery(true);
- // [10874] Fields to update.
+ // [11283] Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
- // [10879] Conditions for which records should be updated.
+ // [11288] Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
- // [10884] Check table
+ // [11293] Check table
$query->update($db->quoteName('#__sermondistributor_statistic'))->set($fields)->where($conditions);
$db->setQuery($query);
diff --git a/admin/sermondistributor.php b/admin/sermondistributor.php
index 63d9c005..8fe875c6 100644
--- a/admin/sermondistributor.php
+++ b/admin/sermondistributor.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermondistributor.php
diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php
index 1cc22363..7b96fbc4 100644
--- a/admin/tables/help_document.php
+++ b/admin/tables/help_document.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage help_document.php
@@ -53,7 +53,7 @@ class SermondistributorTableHelp_document extends JTable
{
parent::__construct('#__sermondistributor_help_document', 'id', $db);
- // [4488] Adding History Options
+ // [4777] Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.help_document'));
}
diff --git a/admin/tables/preacher.php b/admin/tables/preacher.php
index 2ab26daf..a347bd99 100644
--- a/admin/tables/preacher.php
+++ b/admin/tables/preacher.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage preacher.php
@@ -53,7 +53,7 @@ class SermondistributorTablePreacher extends JTable
{
parent::__construct('#__sermondistributor_preacher', 'id', $db);
- // [4488] Adding History Options
+ // [4777] Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.preacher'));
}
diff --git a/admin/tables/series.php b/admin/tables/series.php
index 388bcc8e..803223a1 100644
--- a/admin/tables/series.php
+++ b/admin/tables/series.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage series.php
@@ -53,7 +53,7 @@ class SermondistributorTableSeries extends JTable
{
parent::__construct('#__sermondistributor_series', 'id', $db);
- // [4488] Adding History Options
+ // [4777] Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.series'));
}
diff --git a/admin/tables/sermon.php b/admin/tables/sermon.php
index ea6250b7..bc219090 100644
--- a/admin/tables/sermon.php
+++ b/admin/tables/sermon.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermon.php
@@ -53,10 +53,10 @@ class SermondistributorTableSermon extends JTable
{
parent::__construct('#__sermondistributor_sermon', 'id', $db);
- // [4482] Adding Tag Options
+ // [4771] Adding Tag Options
JTableObserverTags::createObserver($this, array('typeAlias' => 'com_sermondistributor.sermon'));
- // [4488] Adding History Options
+ // [4777] Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.sermon'));
}
diff --git a/admin/tables/statistic.php b/admin/tables/statistic.php
index 53b4f527..4008bf43 100644
--- a/admin/tables/statistic.php
+++ b/admin/tables/statistic.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage statistic.php
@@ -53,7 +53,7 @@ class SermondistributorTableStatistic extends JTable
{
parent::__construct('#__sermondistributor_statistic', 'id', $db);
- // [4488] Adding History Options
+ // [4777] Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_sermondistributor.statistic'));
}
diff --git a/admin/views/help_document/submitbutton.js b/admin/views/help_document/submitbutton.js
index ab00355d..d7527ff4 100644
--- a/admin/views/help_document/submitbutton.js
+++ b/admin/views/help_document/submitbutton.js
@@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage submitbutton.js
diff --git a/admin/views/help_document/tmpl/edit.php b/admin/views/help_document/tmpl/edit.php
index 155451bd..4043d65a 100644
--- a/admin/views/help_document/tmpl/edit.php
+++ b/admin/views/help_document/tmpl/edit.php
@@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version 1.3.0
- @build 11th January, 2016
+ @build 20th February, 2016
@created 22nd October, 2015
@package Sermon Distributor
@subpackage edit.php
@@ -56,6 +56,7 @@ $componentParams = JComponentHelper::getParams('com_sermondistributor');
+ canDo->get('help_document.delete') || $this->canDo->get('core.edit.created_by') || $this->canDo->get('help_document.edit.state') || $this->canDo->get('core.edit.created')) : ?>
+
canDo->get('core.admin')) : ?>
@@ -100,93 +102,93 @@ $componentParams = JComponentHelper::getParams('com_sermondistributor');