Skip to content

Commit

Permalink
Modifying the sermons admin view to put the filters on top.
Browse files Browse the repository at this point in the history
  • Loading branch information
vistamedia committed Nov 12, 2020
1 parent 57dc233 commit c153288
Show file tree
Hide file tree
Showing 7 changed files with 654 additions and 516 deletions.
48 changes: 25 additions & 23 deletions admin/models/fields/preachers.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
/*-------------------------------------------------------------------------------------------------------------| www.vdm.io |------/
____ ____ __ __ __
/\ _`\ /\ _`\ __ /\ \__ __/\ \ /\ \__
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
}
150 changes: 150 additions & 0 deletions admin/models/forms/filter_sermons.xml
Original file line number Diff line number Diff line change
@@ -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>
Loading

0 comments on commit c153288

Please sign in to comment.