Modifying the sermons admin view to put the filters on top.

This commit is contained in:
Emmanuel Danan 2020-11-12 14:51:05 +01:00
parent 57dc233c7f
commit c153288f78
7 changed files with 654 additions and 516 deletions

View File

@ -1,4 +1,4 @@
<?php
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
@ -14,12 +14,12 @@
@created 22nd October, 2015
@package Sermon Distributor
@subpackage preachers.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
@ -48,23 +48,25 @@ class JFormFieldPreachers extends JFormFieldList
*/
protected function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','preacher_request_id_name')));
$query->from($db->quoteName('#__sermondistributor_preacher', 'a'));
$query->where($db->quoteName('a.published') . ' = 1');
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select a preacher');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->preacher_request_id_name);
}
}
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','preacher_request_id_name')));
$query->from($db->quoteName('#__sermondistributor_preacher', 'a'));
$query->where($db->quoteName('a.published') . ' = 1');
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
if ($this->multiple === false) {
$options[] = JHtml::_('select.option', '', 'Select a preacher');
}
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->preacher_request_id_name);
}
}
return $options;
}
}

View File

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

View File

@ -1,81 +1,82 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermons.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Sermons Model
*/
class SermondistributorModelSermons extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage sermons.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Utilities\ArrayHelper;
/**
* Sermons Model
*/
class SermondistributorModelSermons extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by',
'a.access','access',
'a.name','name',
'g.name',
'h.name',
'g.name','preacher',
'h.name','series',
'a.short_description','short_description',
'c.title','category_title',
'c.id', 'category_id',
'a.catid', 'catid',
'a.link_type','link_type',
'a.source','source'
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* @return void
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
}
'a.source','source'
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* @return void
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
}
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
$preacher = $this->getUserStateFromRequest($this->context . '.filter.preacher', 'filter_preacher');
$this->setState('filter.preacher', $preacher);
// $preacher = $this->getUserStateFromRequest($this->context . '.filter.preacher', 'filter_preacher');
// $this->setState('filter.preacher', $preacher);
$series = $this->getUserStateFromRequest($this->context . '.filter.series', 'filter_series');
$this->setState('filter.series', $series);
@ -86,8 +87,8 @@ class SermondistributorModelSermons extends JModelList
$category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category');
$this->setState('filter.category', $category);
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
$this->setState('filter.category_id', $categoryId);
// $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
// $this->setState('filter.category_id', $categoryId);
$catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid');
$this->setState('filter.catid', $catid);
@ -96,41 +97,58 @@ class SermondistributorModelSermons extends JModelList
$this->setState('filter.link_type', $link_type);
$source = $this->getUserStateFromRequest($this->context . '.filter.source', 'filter_source');
$this->setState('filter.source', $source);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
$this->setState('filter.created_by', $created_by);
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created);
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
$this->setState('filter.source', $source);
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
$this->setState('filter.created_by', $created_by);
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created);
// Handle multiple fields -> original code commented above
$formSubmited = $app->input->post->get('form_submited');
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access');
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
$preacher = $this->getUserStateFromRequest($this->context . '.filter.preacher', 'filter_preacher');
if ($formSubmited)
{
$access = $app->input->post->get('access');
$this->setState('filter.access', $access);
$categoryId = $app->input->post->get('category_id');
$this->setState('filter.category_id', $categoryId);
$preacher = $app->input->post->get('preacher');
$this->setState('filter.preacher', $preacher);
}
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
// check in items
$this->checkInNow();
// load parent items
// load parent items
$items = parent::getItems();
// Set values to display correctly.
@ -165,10 +183,10 @@ class SermondistributorModelSermons extends JModelList
$item->source = $this->selectionTranslation($item->source, 'source');
}
}
// return items
return $items;
// return items
return $items;
}
/**
@ -207,15 +225,15 @@ class SermondistributorModelSermons extends JModelList
}
}
return $value;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
@ -253,10 +271,19 @@ class SermondistributorModelSermons extends JModelList
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
$access = $this->getState('filter.access');
if (is_numeric($access))
{
$query->where('a.access = ' . (int) $access);
}
elseif (is_array($access))
{
$access = ArrayHelper::toInteger($access);
$access = implode(',', $access);
$query->where('a.access IN (' . $access . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_sermondistributor'))
{
@ -279,9 +306,17 @@ class SermondistributorModelSermons extends JModelList
}
// Filter by preacher.
if ($preacher = $this->getState('filter.preacher'))
$preacher = $this->getState('filter.preacher');
if (is_numeric($preacher))
{
$query->where('a.preacher = ' . $db->quote($db->escape($preacher)));
$query->where('a.preacher = ' . (int) $preacher);
}
elseif (is_array($preacher))
{
$preacher = ArrayHelper::toInteger($preacher);
$preacher = implode(',', $preacher);
$query->where('a.preacher IN (' . $preacher . ')');
}
// Filter by series.
if ($series = $this->getState('filter.series'))
@ -294,9 +329,17 @@ class SermondistributorModelSermons extends JModelList
$query->where('a.link_type = ' . $db->quote($db->escape($link_type)));
}
// Filter by Source.
if ($source = $this->getState('filter.source'))
$source = $this->getState('filter.source');
if (is_numeric($source))
{
$query->where('a.source = ' . $db->quote($db->escape($source)));
$query->where('a.source = ' . (int) $source);
}
elseif (is_array($source))
{
$source = ArrayHelper::toInteger($source);
$source = implode(',', $source);
$query->where('a.source IN (' . $source . ')');
}
// Filter by a single or group of categories.
@ -317,7 +360,7 @@ class SermondistributorModelSermons extends JModelList
{
ArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
$query->where('a.category IN (' . $categoryId . ')');
$query->where('a.catid IN (' . $categoryId . ')');
}
@ -329,7 +372,7 @@ class SermondistributorModelSermons extends JModelList
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
return $query;
}
/**
@ -435,16 +478,16 @@ class SermondistributorModelSermons extends JModelList
return $headers;
}
return false;
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
@ -460,9 +503,9 @@ class SermondistributorModelSermons extends JModelList
$id .= ':' . $this->getState('filter.category_id');
$id .= ':' . $this->getState('filter.catid');
$id .= ':' . $this->getState('filter.link_type');
$id .= ':' . $this->getState('filter.source');
return parent::getStoreId($id);
$id .= ':' . $this->getState('filter.source');
return parent::getStoreId($id);
}
/**
@ -502,12 +545,12 @@ class SermondistributorModelSermons extends JModelList
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
$query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions);
$query->update($db->quoteName('#__sermondistributor_sermon'))->set($fields)->where($conditions);
$db->setQuery($query);
@ -516,5 +559,5 @@ class SermondistributorModelSermons extends JModelList
}
return false;
}
}
}
}

View File

@ -1,4 +1,4 @@
<?php
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
@ -14,21 +14,25 @@
@created 22nd October, 2015
@package Sermon Distributor
@subpackage default.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleCategories', null, array('placeholder_text_multiple' => JText::_('JOPTION_SELECT_CATEGORY')));
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => JText::_('JOPTION_SELECT_ACCESS')));
JHtml::_('formbehavior.chosen', '.multiplePreachers', null, array('placeholder_text_multiple' => JText::_('Select preachers')));
JHtml::_('formbehavior.chosen', '.multipleSource', null, array('placeholder_text_multiple' => JText::_('Select source')));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
@ -38,23 +42,6 @@ if ($this->saveOrder)
}
?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_sermondistributor&view=sermons'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
@ -64,13 +51,15 @@ if ($this->saveOrder)
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php
// Search tools bar
echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
?>
<?php if (empty($this->items)): ?>
<?php echo $this->loadTemplate('toolbar');?>
<div class="alert alert-no-items">
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<?php echo $this->loadTemplate('toolbar');?>
<table class="table table-striped" id="sermonList">
<thead><?php echo $this->loadTemplate('head');?></thead>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
@ -88,11 +77,9 @@ if ($this->saveOrder)
$this->loadTemplate('batch_body')
); ?>
<?php endif; ?>
<input type="hidden" name="filter_order" value="<?php echo $this->listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->listDirn; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div>
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
</form>

View File

@ -1,33 +1,33 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage default_body.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit";
?>
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage default_body.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit";
?>
<?php foreach ($this->items as $i => $item): ?>
<?php
$canCheckin = $this->user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0;
@ -40,7 +40,7 @@ $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit";
<?php
if ($this->saveOrder)
{
$iconClass = ' inactive';
$iconClass = '';
}
else
{
@ -140,4 +140,4 @@ $edit = "index.php?option=com_sermondistributor&view=sermons&task=sermon.edit";
<?php echo $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>

View File

@ -1,35 +1,35 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage default_head.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage default_head.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<tr>
<?php if ($this->canEdit&& $this->canState): ?>
<th width="1%" class="nowrap center hidden-phone">
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
<?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th>
<th width="20" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?>
@ -43,29 +43,29 @@ defined('_JEXEC') or die('Restricted access');
</th>
<?php endif; ?>
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL', 'g.name', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL', 'g.name', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL', 'h.name', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL', 'h.name', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL', 'a.short_description', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SHORT_DESCRIPTION_LABEL', 'a.short_description', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES', 'category_title', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SERMONS_CATEGORIES', 'category_title', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL', 'a.link_type', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL', 'a.link_type', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL', 'a.source', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL', 'a.source', $this->listDirn, $this->listOrder); ?>
</th>
<?php if ($this->canState): ?>
<th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th>
<?php else: ?>
<th width="10" class="nowrap center" >
@ -73,6 +73,6 @@ defined('_JEXEC') or die('Restricted access');
</th>
<?php endif; ?>
<th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_SERMONDISTRIBUTOR_SERMON_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_SERMONDISTRIBUTOR_SERMON_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th>
</tr>
</tr>

View File

@ -1,211 +1,195 @@
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Sermondistributor View class for the Sermons
*/
class SermondistributorViewSermons extends JViewLegacy
{
/**
* Sermons view display method
* @return void
*/
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
SermondistributorHelper::addSubmenu('sermons');
}
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
\ \,\L\_\ __ _ __ ___ ___ ___ ___ \ \ \/\ \/\_\ ____\ \ ,_\ _ __ /\_\ \ \____ __ __\ \ ,_\ ___ _ __
\/_\__ \ /'__`\/\`'__\/' __` __`\ / __`\ /' _ `\ \ \ \ \ \/\ \ /',__\\ \ \/ /\`'__\/\ \ \ '__`\/\ \/\ \\ \ \/ / __`\/\`'__\
/\ \L\ \/\ __/\ \ \/ /\ \/\ \/\ \/\ \L\ \/\ \/\ \ \ \ \_\ \ \ \/\__, `\\ \ \_\ \ \/ \ \ \ \ \L\ \ \ \_\ \\ \ \_/\ \L\ \ \ \/
\ `\____\ \____\\ \_\ \ \_\ \_\ \_\ \____/\ \_\ \_\ \ \____/\ \_\/\____/ \ \__\\ \_\ \ \_\ \_,__/\ \____/ \ \__\ \____/\ \_\
\/_____/\/____/ \/_/ \/_/\/_/\/_/\/___/ \/_/\/_/ \/___/ \/_/\/___/ \/__/ \/_/ \/_/\/___/ \/___/ \/__/\/___/ \/_/
/------------------------------------------------------------------------------------------------------------------------------------/
@version 2.0.x
@created 22nd October, 2015
@package Sermon Distributor
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
A sermon distributor that links to Dropbox.
/----------------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Sermondistributor View class for the Sermons
*/
class SermondistributorViewSermons extends JViewLegacy
{
/**
* Sermons view display method
* @return void
*/
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
// Include helper submenu
SermondistributorHelper::addSubmenu('sermons');
}
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->user = JFactory::getUser();
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc'));
$this->saveOrder = $this->listOrder == 'ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->listDirn = $this->escape($this->state->get('list.direction', 'asc'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
// get global action permissions
$this->canDo = SermondistributorHelper::getActions('sermon');
$this->canEdit = $this->canDo->get('sermon.edit');
$this->canState = $this->canDo->get('sermon.edit.state');
$this->canCreate = $this->canDo->get('sermon.create');
$this->canDelete = $this->canDo->get('sermon.delete');
$this->canBatch = $this->canDo->get('core.batch');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_SERMONS'), 'book');
JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=sermons');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
JToolBarHelper::addNew('sermon.add');
}
// Only load if there are items
if (SermondistributorHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('sermon.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('sermons.publish');
JToolBarHelper::unpublishList('sermons.unpublish');
JToolBarHelper::archiveList('sermons.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('sermons.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'sermons.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('sermons.trash');
$this->canBatch = $this->canDo->get('core.batch');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
// Display the template
parent::display($tpl);
// Set the document
$this->setDocument();
}
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_SERMONDISTRIBUTOR_SERMONS'), 'book');
JHtmlSidebar::setAction('index.php?option=com_sermondistributor&view=sermons');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
JToolBarHelper::addNew('sermon.add');
}
// Only load if there are items
if (SermondistributorHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('sermon.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('sermons.publish');
JToolBarHelper::unpublishList('sermons.unpublish');
JToolBarHelper::archiveList('sermons.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('sermons.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'sermons.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('sermons.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('sermon.export'))
{
JToolBarHelper::custom('sermons.exportData', 'download', '', 'COM_SERMONDISTRIBUTOR_EXPORT_DATA', true);
}
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('sermon.import'))
{
JToolBarHelper::custom('sermons.importData', 'upload', '', 'COM_SERMONDISTRIBUTOR_IMPORT_DATA', false);
}
// set help url for this view if found
$help_url = SermondistributorHelper::getHelpUrl('sermons');
if (SermondistributorHelper::checkString($help_url))
{
JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_sermondistributor');
}
if ($this->canState)
{
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
);
}
// Category Filter.
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_CATEGORY'),
'filter_category_id',
JHtml::_('select.options', JHtml::_('category.options', 'com_sermondistributor.sermon'), 'value', 'text', $this->state->get('filter.category_id'))
);
// set help url for this view if found
$help_url = SermondistributorHelper::getHelpUrl('sermons');
if (SermondistributorHelper::checkString($help_url))
{
JToolbarHelper::help('COM_SERMONDISTRIBUTOR_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_sermondistributor');
}
if ($this->canState)
{
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
JHtmlBatch_::addListSelection(
JText::_('COM_SERMONDISTRIBUTOR_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
);
}
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
@ -229,13 +213,6 @@ class SermondistributorViewSermons extends JViewLegacy
// Only load Preacher Name filter if it has values
if (SermondistributorHelper::checkArray($this->preacherNameOptions))
{
// Preacher Name Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_PREACHER_LABEL').' -',
'filter_preacher',
JHtml::_('select.options', $this->preacherNameOptions, 'value', 'text', $this->state->get('filter.preacher'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Preacher Name Batch Selection
@ -259,13 +236,6 @@ class SermondistributorViewSermons extends JViewLegacy
// Only load Series Name filter if it has values
if (SermondistributorHelper::checkArray($this->seriesNameOptions))
{
// Series Name Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SERIES_LABEL').' -',
'filter_series',
JHtml::_('select.options', $this->seriesNameOptions, 'value', 'text', $this->state->get('filter.series'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Series Name Batch Selection
@ -289,13 +259,6 @@ class SermondistributorViewSermons extends JViewLegacy
// Only load Link Type filter if it has values
if (SermondistributorHelper::checkArray($this->link_typeOptions))
{
// Link Type Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL').' -',
'filter_link_type',
JHtml::_('select.options', $this->link_typeOptions, 'value', 'text', $this->state->get('filter.link_type'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Link Type Batch Selection
@ -319,13 +282,6 @@ class SermondistributorViewSermons extends JViewLegacy
// Only load Source filter if it has values
if (SermondistributorHelper::checkArray($this->sourceOptions))
{
// Source Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL').' -',
'filter_source',
JHtml::_('select.options', $this->sourceOptions, 'value', 'text', $this->state->get('filter.source'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Source Batch Selection
@ -335,49 +291,49 @@ class SermondistributorViewSermons extends JViewLegacy
JHtml::_('select.options', $this->sourceOptions, 'value', 'text')
);
}
}
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_SERMONS'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/sermons.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
*
* @return mixed The escaped value.
*/
public function escape($var)
{
if(strlen($var) > 50)
{
// use the helper htmlEscape method instead and shorten the string
return SermondistributorHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
return SermondistributorHelper::htmlEscape($var, $this->_charset);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
*/
protected function getSortFields()
{
}
}
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_('COM_SERMONDISTRIBUTOR_SERMONS'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_sermondistributor/assets/css/sermons.css", (SermondistributorHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
*
* @return mixed The escaped value.
*/
public function escape($var)
{
if(strlen($var) > 50)
{
// use the helper htmlEscape method instead and shorten the string
return SermondistributorHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
return SermondistributorHelper::htmlEscape($var, $this->_charset);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array Array containing the field name to sort by as the key and display text as value
*/
protected function getSortFields()
{
return array(
'ordering' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
@ -389,7 +345,7 @@ class SermondistributorViewSermons extends JViewLegacy
'a.link_type' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_LINK_TYPE_LABEL'),
'a.source' => JText::_('COM_SERMONDISTRIBUTOR_SERMON_SOURCE_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
);
}
protected function getTheLink_typeSelections()
@ -462,5 +418,5 @@ class SermondistributorViewSermons extends JViewLegacy
return $_filter;
}
return false;
}
}
}
}