Adds the admin filters at the top of the page.

This commit is contained in:
Llewellyn van der Merwe 2021-02-08 12:26:08 +02:00
parent d9f85c9c7a
commit f21fdc5b3f
Signed by untrusted user: Llewellyn
GPG Key ID: EFC0C720A240551C
18 changed files with 503 additions and 210 deletions

View File

@ -13,7 +13,7 @@ Watch this [tutorial](https://youtu.be/lkE0ZiSWufg) to see how.
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Members Manager](https://www.joomlacomponentbuilder.com/)
+ *First Build*: 6th July, 2018
+ *Last Build*: 7th February, 2021
+ *Last Build*: 8th February, 2021
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -26,11 +26,11 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **48634**
+ *File count*: **254**
+ *Line count*: **48925**
+ *File count*: **259**
+ *Folder count*: **70**
**89 Hours** or **11 Eight Hour Days** (the actual time the author spent)
**90 Hours** or **11 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @34hours** = codingtime / 4;
@ -38,7 +38,7 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> **mapping @14hours** = codingtime / 10;
> **office @23hours** = codingtime / 6;)
**225 Hours** or **28 Eight Hour Days**
**226 Hours** or **28 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -13,7 +13,7 @@ Watch this [tutorial](https://youtu.be/lkE0ZiSWufg) to see how.
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Members Manager](https://www.joomlacomponentbuilder.com/)
+ *First Build*: 6th July, 2018
+ *Last Build*: 7th February, 2021
+ *Last Build*: 8th February, 2021
+ *Version*: 2.0.x
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -26,11 +26,11 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **48634**
+ *File count*: **254**
+ *Line count*: **48925**
+ *File count*: **259**
+ *Folder count*: **70**
**89 Hours** or **11 Eight Hour Days** (the actual time the author spent)
**90 Hours** or **11 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @34hours** = codingtime / 4;
@ -38,7 +38,7 @@ due to [Automated Component Builder](http://joomlacomponentbuilder.com))
> **mapping @14hours** = codingtime / 10;
> **office @23hours** = codingtime / 6;)
**225 Hours** or **28 Eight Hour Days**
**226 Hours** or **28 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,

View File

@ -7,6 +7,7 @@ COM_MEMBERSMANAGER_ALL_THE_MEMBERS_FOUND_WERE_SUCCESSFULLY_MAPPED_WITH_THE_TYPES
COM_MEMBERSMANAGER_ALL_THE_USERS_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED_INTO_RELATED_MEMBER_TYPE_RELATIONSHIPS="All the users found in Joomla were successfully imported into related member type relationships."
COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?"
COM_MEMBERSMANAGER_ARCHIVED="Archived"
COM_MEMBERSMANAGER_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS="Are you sure you want to delete? Confirming will permanently delete the selected item(s)!"
COM_MEMBERSMANAGER_AUTHOR="Author"
COM_MEMBERSMANAGER_BACK="Back"
COM_MEMBERSMANAGER_BSB_IS_ALREADY_IN_USE_PLEASE_TRY_ANOTHER="<b>%s</b> is already in use, please try another!"
@ -386,9 +387,24 @@ COM_MEMBERSMANAGER_EDIT_CREATED_DATE_DESC="Allows users in this group to edit cr
COM_MEMBERSMANAGER_EDIT_S="Edit %s"
COM_MEMBERSMANAGER_EDIT_VERSIONS="Edit Version"
COM_MEMBERSMANAGER_EDIT_VERSIONS_DESC="Allows users in this group to edit versions."
COM_MEMBERSMANAGER_EMPTY_TRASH="Empty trash"
COM_MEMBERSMANAGER_EXIT_TRASH="Exit trash"
COM_MEMBERSMANAGER_EXPORT_DATA="Export Data"
COM_MEMBERSMANAGER_EXPORT_DATA_DESC="Allows users in this group to export data."
COM_MEMBERSMANAGER_EXPORT_FAILED="Export Failed"
COM_MEMBERSMANAGER_FILTER_ACCOUNT_ASCENDING="Account ascending"
COM_MEMBERSMANAGER_FILTER_ACCOUNT_DESCENDING="Account descending"
COM_MEMBERSMANAGER_FILTER_NAME_ASCENDING="Name ascending"
COM_MEMBERSMANAGER_FILTER_NAME_DESCENDING="Name descending"
COM_MEMBERSMANAGER_FILTER_PUBLISHED="Status"
COM_MEMBERSMANAGER_FILTER_PUBLISHED_MEMBERS="Status options for members"
COM_MEMBERSMANAGER_FILTER_PUBLISHED_TYPES="Status options for types"
COM_MEMBERSMANAGER_FILTER_SEARCH="Searchmembers"
COM_MEMBERSMANAGER_FILTER_SEARCH_MEMBERS="Search the member items. Prefix with ID: to search for an item by ID."
COM_MEMBERSMANAGER_FILTER_SEARCH_TYPES="Search the type items. Prefix with ID: to search for an item by ID."
COM_MEMBERSMANAGER_FILTER_SELECT_ACCESS="Select Access"
COM_MEMBERSMANAGER_FILTER_SELECT_ACCOUNT="Select Account"
COM_MEMBERSMANAGER_FILTER_SELECT_ALLOW_RELATIONSHIPS="Select Allow Relationships"
COM_MEMBERSMANAGER_GREAT_SS_IS_AVAILABLE="Great, %s(%s) is available!"
COM_MEMBERSMANAGER_HELP_MANAGER="Help"
COM_MEMBERSMANAGER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BMEMBERSMANAGERB_WILL_NOT_FUNCTION_CORRECTLYP="<h2>Curl Not Found!</h2><p>Please setup curl on your system, or <b>membersmanager</b> will not function correctly!</p>"
@ -684,6 +700,8 @@ COM_MEMBERSMANAGER_THE_JOOMLA_USER_ACCOUNT_OF_BSB_COULD_NOT_BE_BUNBLOCKEDB_AND_S
COM_MEMBERSMANAGER_THE_JOOMLA_USER_ACCOUNT_OF_BSB_COULD_NOT_BE_DELETED_AND_SO_YOU_WILL_HAVE_TO_MANUALLY_DELETE_THE_USER_IN_THE_BJOOMLA_USERSB_AREA="The Joomla user account of <b>%s</b> could not be deleted and so you will have to manually delete the user in the <b>Joomla Users</b> area."
COM_MEMBERSMANAGER_THE_PROFILE_WILL_BE_CROPPED_TO_THIS_SIZE="The profile will be cropped to this size"
COM_MEMBERSMANAGER_TRASHED="Trashed"
COM_MEMBERSMANAGER_TRASHED_ITEMS="Trashed items"
COM_MEMBERSMANAGER_TRASH_AREA="Trash Area"
COM_MEMBERSMANAGER_TYPE="Type"
COM_MEMBERSMANAGER_TYPES="Types"
COM_MEMBERSMANAGER_TYPES_ACCESS="Types Access"
@ -819,6 +837,8 @@ COM_MEMBERSMANAGER_VERSION="Version"
COM_MEMBERSMANAGER_WARNING_IMPORT_FILE_ERROR="Warning, import file error."
COM_MEMBERSMANAGER_WARNING_IMPORT_UPLOAD_ERROR="Warning, import upload error."
COM_MEMBERSMANAGER_WEBSITE="Website"
COM_MEMBERSMANAGER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS="You are currently viewing the trashed items."
COM_MEMBERSMANAGER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT="You are currently viewing the trash area, and you don't have any items in trash at the moment!"
COM_MEMBERSMANAGER_YOU_CAN_NOT_DELETE_BSB_FIRST_MOVE_ALL_SUB_ACCOUNTS_TO_ANOTHER_MAIN_MEMBER_OR_CONVERT_EACH_TO_ITS_OWN_MAIN_MEMBER_ACCOUNT="You can not delete <b>%s</b>, first move all sub account/s to another main member, or convert each to its own main member account."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_ADD_DATA_TO_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to add data to %s, please contact your system administrator."
COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_CREATE_MEMBERS="You do not have permission to create members."

View File

@ -0,0 +1,74 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('JPATH_BASE') or die('Restricted access');
?>
<?php if ($displayData->state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?>
<script>
// change the class of the delete button
jQuery("#toolbar-delete button").toggleClass("btn-danger");
// function to empty the trash
function emptyTrash() {
if (document.adminForm.boxchecked.value == 0) {
// select all the items visable
document.adminForm.elements['checkall-toggle'].checked=1;
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
// check to confirm the deletion
if(confirm('<?= JText::_("COM_MEMBERSMANAGER_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
} else {
document.adminForm.elements['checkall-toggle'].checked=0;
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
}
} else {
// confirm deletion of those selected
if (confirm('<?= JText::_("COM_MEMBERSMANAGER_ARE_YOU_SURE_YOU_WANT_TO_DELETE_CONFIRMING_WILL_PERMANENTLY_DELETE_THE_SELECTED_ITEMS") ?>')) {
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
};
}
return false;
}
// function to exit the tash state
function exitTrash() {
document.adminForm.filter_published.selectedIndex = 0;
document.adminForm.submit();
return false;
}
</script>
<div class="alert alert-error">
<?php if (empty($displayData->items)): ?>
<h4 class="alert-heading">
<span class="icon-trash"></span>
<?= JText::_("COM_MEMBERSMANAGER_TRASH_AREA") ?>
</h4>
<p><?= JText::_("COM_MEMBERSMANAGER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASH_AREA_AND_YOU_DONT_HAVE_ANY_ITEMS_IN_TRASH_AT_THE_MOMENT") ?></p>
<?php else: ?>
<h4 class="alert-heading">
<span class="icon-trash"></span>
<?= JText::_("COM_MEMBERSMANAGER_TRASHED_ITEMS") ?>
</h4>
<p><?= JText::_("COM_MEMBERSMANAGER_YOU_ARE_CURRENTLY_VIEWING_THE_TRASHED_ITEMS") ?></p>
<button onclick="emptyTrash();" class="btn btn-small btn-danger">
<span class="icon-delete" aria-hidden="true"></span>
<?= JText::_("COM_MEMBERSMANAGER_EMPTY_TRASH") ?>
</button>
<?php endif; ?>
<button onclick="exitTrash();" class="btn btn-small">
<span class="icon-back" aria-hidden="true"></span>
<?= JText::_("COM_MEMBERSMANAGER_EXIT_TRASH") ?>
</button>
</div>
<?php endif; ?>

View File

@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Membersfilteraccount Form Field class for the Membersmanager component
*/
class JFormFieldMembersfilteraccount extends JFormFieldList
{
/**
* The membersfilteraccount field type.
*
* @var string
*/
public $type = 'membersfilteraccount';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('account'));
$query->from($db->quoteName('#__membersmanager_member'));
$query->order($db->quoteName('account') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_MEMBERSMANAGER_FILTER_SELECT_ACCOUNT') . ' -');
if ($results)
{
// get membersmodel
$model = MembersmanagerHelper::getModel('members');
$results = array_unique($results);
foreach ($results as $account)
{
// Translate the account selection
$text = $model->selectionTranslation($account,'account');
// Now add the account and its text to the options array
$_filter[] = JHtml::_('select.option', $account, JText::_($text));
}
}
return $_filter;
}
}

View File

@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Members.Manager
*
* @created 6th July, 2018
* @author Llewellyn van der Merwe <https://www.joomlacomponentbuilder.com/>
* @github Joomla Members Manager <https://github.com/vdm-io/Joomla-Members-Manager>
* @copyright Copyright (C) 2015. All Rights Reserved
* @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Typesfilteraddrelationship Form Field class for the Membersmanager component
*/
class JFormFieldTypesfilteraddrelationship extends JFormFieldList
{
/**
* The typesfilteraddrelationship field type.
*
* @var string
*/
public $type = 'typesfilteraddrelationship';
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
protected function getOptions()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('add_relationship'));
$query->from($db->quoteName('#__membersmanager_type'));
$query->order($db->quoteName('add_relationship') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_filter = array();
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_MEMBERSMANAGER_FILTER_SELECT_ALLOW_RELATIONSHIPS') . ' -');
if ($results)
{
// get typesmodel
$model = MembersmanagerHelper::getModel('types');
$results = array_unique($results);
foreach ($results as $add_relationship)
{
// Translate the add_relationship selection
$text = $model->selectionTranslation($add_relationship,'add_relationship');
// Now add the add_relationship and its text to the options array
$_filter[] = JHtml::_('select.option', $add_relationship, JText::_($text));
}
}
return $_filter;
}
}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_membersmanager/models/rules"
addfieldpath="/administrator/components/com_membersmanager/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_MEMBERSMANAGER_FILTER_SEARCH"
description="COM_MEMBERSMANAGER_FILTER_SEARCH_MEMBERS"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_MEMBERSMANAGER_FILTER_PUBLISHED"
description="COM_MEMBERSMANAGER_FILTER_PUBLISHED_MEMBERS"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="accesslevel"
name="access"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"
/>
<field
type="membersfilteraccount"
name="account"
label="COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.account ASC">COM_MEMBERSMANAGER_FILTER_ACCOUNT_ASCENDING</option>
<option value="a.account DESC">COM_MEMBERSMANAGER_FILTER_ACCOUNT_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_membersmanager/models/rules"
addfieldpath="/administrator/components/com_membersmanager/models/fields"
>
<fields name="filter">
<field
type="text"
name="search"
inputmode="search"
label="COM_MEMBERSMANAGER_FILTER_SEARCH"
description="COM_MEMBERSMANAGER_FILTER_SEARCH_TYPES"
hint="JSEARCH_FILTER"
/>
<field
type="status"
name="published"
label="COM_MEMBERSMANAGER_FILTER_PUBLISHED"
description="COM_MEMBERSMANAGER_FILTER_PUBLISHED_TYPES"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
<field
type="accesslevel"
name="access"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
multiple="true"
class="multipleAccessLevels"
onchange="this.form.submit();"
/>
<field
type="typesfilteraddrelationship"
name="add_relationship"
label="COM_MEMBERSMANAGER_TYPE_ADD_RELATIONSHIP_LABEL"
multiple="false"
onchange="this.form.submit();"
/>
<input type="hidden" name="form_submited" value="1"/>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="COM_CONTENT_LIST_FULL_ORDERING"
description="COM_CONTENT_LIST_FULL_ORDERING_DESC"
onchange="this.form.submit();"
default="a.id DESC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="a.published ASC">JSTATUS_ASC</option>
<option value="a.published DESC">JSTATUS_DESC</option>
<option value="a.name ASC">COM_MEMBERSMANAGER_FILTER_NAME_ASCENDING</option>
<option value="a.name DESC">COM_MEMBERSMANAGER_FILTER_NAME_DESCENDING</option>
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="COM_CONTENT_LIST_LIMIT"
description="COM_CONTENT_LIST_LIMIT_DESC"
class="input-mini"
default="25"
onchange="this.form.submit();"
/>
</fields>
</form>

View File

@ -253,8 +253,15 @@ class MembersmanagerModelMembers extends JModelList
$this->context .= '.' . $layout;
}
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
if ($formSubmited)
{
$access = $app->input->post->get('access');
$this->setState('filter.access', $access);
}
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
@ -272,7 +279,11 @@ class MembersmanagerModelMembers extends JModelList
$this->setState('filter.search', $search);
$account = $this->getUserStateFromRequest($this->context . '.filter.account', 'filter_account');
$this->setState('filter.account', $account);
if ($formSubmited)
{
$account = $app->input->post->get('account');
$this->setState('filter.account', $account);
}
// List state information.
parent::populateState($ordering, $direction);
@ -947,7 +958,18 @@ class MembersmanagerModelMembers extends JModelList
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
// Check if the value is an array
$_access = $this->getState('filter.access');
if (MembersmanagerHelper::checkArray($_access))
{
$id .= ':' . implode(':', $_access);
}
// Check if this is only an number or string
elseif (is_numeric($_access)
|| MembersmanagerHelper::checkString($_access))
{
$id .= ':' . $_access;
}
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');

View File

@ -106,8 +106,15 @@ class MembersmanagerModelTypes extends JModelList
$this->context .= '.' . $layout;
}
// Check if the form was submitted
$formSubmited = $app->input->post->get('form_submited');
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
if ($formSubmited)
{
$access = $app->input->post->get('access');
$this->setState('filter.access', $access);
}
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
@ -125,10 +132,18 @@ class MembersmanagerModelTypes extends JModelList
$this->setState('filter.search', $search);
$add_relationship = $this->getUserStateFromRequest($this->context . '.filter.add_relationship', 'filter_add_relationship');
$this->setState('filter.add_relationship', $add_relationship);
if ($formSubmited)
{
$add_relationship = $app->input->post->get('add_relationship');
$this->setState('filter.add_relationship', $add_relationship);
}
$name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name');
$this->setState('filter.name', $name);
if ($formSubmited)
{
$name = $app->input->post->get('name');
$this->setState('filter.name', $name);
}
// List state information.
parent::populateState($ordering, $direction);
@ -458,7 +473,18 @@ class MembersmanagerModelTypes extends JModelList
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.access');
// Check if the value is an array
$_access = $this->getState('filter.access');
if (MembersmanagerHelper::checkArray($_access))
{
$id .= ':' . implode(':', $_access);
}
// Check if this is only an number or string
elseif (is_numeric($_access)
|| MembersmanagerHelper::checkString($_access))
{
$id .= ':' . $_access;
}
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');

View File

@ -16,6 +16,7 @@ defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_MEMBERSMANAGER_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{
@ -23,23 +24,6 @@ if ($this->saveOrder)
JHtml::_('sortablelist.sortable', 'memberList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
}
?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&view=members'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
@ -49,13 +33,17 @@ if ($this->saveOrder)
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php
// Add the trash helper layout
echo JLayoutHelper::render('trashhelper', $this);
// Add the searchtools
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="memberList">
<thead><?php echo $this->loadTemplate('head');?></thead>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
@ -73,8 +61,6 @@ 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; ?>

View File

@ -17,7 +17,7 @@ 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>', 'a.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'); ?>
@ -37,11 +37,11 @@ defined('_JEXEC') or die('Restricted access');
<?php echo JText::_('COM_MEMBERSMANAGER_MEMBERS_EMAIL'); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL', 'a.account', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL', 'a.account', $this->listDirn, $this->listOrder); ?>
</th>
<?php if ($this->canState): ?>
<th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_MEMBERSMANAGER_MEMBER_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_MEMBERSMANAGER_MEMBER_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th>
<?php else: ?>
<th width="10" class="nowrap center" >
@ -49,6 +49,6 @@ defined('_JEXEC') or die('Restricted access');
</th>
<?php endif; ?>
<th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_MEMBERSMANAGER_MEMBER_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_MEMBERSMANAGER_MEMBER_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th>
</tr>

View File

@ -35,6 +35,10 @@ class MembersmanagerViewMembers extends JViewLegacy
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
@ -160,42 +164,6 @@ class MembersmanagerViewMembers extends JViewLegacy
JToolBarHelper::preferences('com_membersmanager');
}
// Only load publish filter if state change is allowed
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)
);
}
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
// Set Account Selection
$this->accountOptions = $this->getTheAccountSelections();
// We do some sanitation for Account filter
if (MembersmanagerHelper::checkArray($this->accountOptions) &&
isset($this->accountOptions[0]->value) &&
!MembersmanagerHelper::checkString($this->accountOptions[0]->value))
{
unset($this->accountOptions[0]);
}
// Only load Account filter if it has values
if (MembersmanagerHelper::checkArray($this->accountOptions))
{
// Account Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL').' -',
'filter_account',
JHtml::_('select.options', $this->accountOptions, 'value', 'text', $this->state->get('filter.account'))
);
}
// Only load published batch if state and batch is allowed
if ($this->canState && $this->canBatch)
{
@ -219,6 +187,15 @@ class MembersmanagerViewMembers extends JViewLegacy
// Only load Account batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Account Selection
$this->accountOptions = JFormHelper::loadFieldType('membersfilteraccount')->options;
// We do some sanitation for Account filter
if (MembersmanagerHelper::checkArray($this->accountOptions) &&
isset($this->accountOptions[0]->value) &&
!MembersmanagerHelper::checkString($this->accountOptions[0]->value))
{
unset($this->accountOptions[0]);
}
// Account Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL').' -',
@ -275,39 +252,4 @@ class MembersmanagerViewMembers extends JViewLegacy
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
protected function getTheAccountSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('account'));
$query->from($db->quoteName('#__membersmanager_member'));
$query->order($db->quoteName('account') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_filter = array();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
foreach ($results as $account)
{
// Translate the account selection
$text = $model->selectionTranslation($account,'account');
// Now add the account and its text to the options array
$_filter[] = JHtml::_('select.option', $account, JText::_($text));
}
}
return $_filter;
}
}

View File

@ -16,6 +16,7 @@ defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_MEMBERSMANAGER_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)
{
@ -23,23 +24,6 @@ if ($this->saveOrder)
JHtml::_('sortablelist.sortable', 'typeList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl);
}
?>
<script type="text/javascript">
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php echo $this->listOrder; ?>')
{
dirn = 'asc';
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_membersmanager&view=types'); ?>" method="post" name="adminForm" id="adminForm">
<?php if(!empty( $this->sidebar)): ?>
<div id="j-sidebar-container" class="span2">
@ -49,13 +33,17 @@ if ($this->saveOrder)
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php
// Add the trash helper layout
echo JLayoutHelper::render('trashhelper', $this);
// Add the searchtools
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="typeList">
<thead><?php echo $this->loadTemplate('head');?></thead>
<tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
@ -73,8 +61,6 @@ 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; ?>

View File

@ -17,7 +17,7 @@ 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>', 'a.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'); ?>
@ -31,7 +31,7 @@ defined('_JEXEC') or die('Restricted access');
</th>
<?php endif; ?>
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_MEMBERSMANAGER_TYPE_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_MEMBERSMANAGER_TYPE_NAME_LABEL', 'a.name', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JText::_('COM_MEMBERSMANAGER_TYPE_DESCRIPTION_LABEL'); ?>
@ -47,7 +47,7 @@ defined('_JEXEC') or die('Restricted access');
</th>
<?php if ($this->canState): ?>
<th width="10" class="nowrap center" >
<?php echo JHtml::_('grid.sort', 'COM_MEMBERSMANAGER_TYPE_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_MEMBERSMANAGER_TYPE_STATUS', 'a.published', $this->listDirn, $this->listOrder); ?>
</th>
<?php else: ?>
<th width="10" class="nowrap center" >
@ -55,6 +55,6 @@ defined('_JEXEC') or die('Restricted access');
</th>
<?php endif; ?>
<th width="5" class="nowrap center hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_MEMBERSMANAGER_TYPE_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('searchtools.sort', 'COM_MEMBERSMANAGER_TYPE_ID', 'a.id', $this->listDirn, $this->listOrder); ?>
</th>
</tr>

View File

@ -35,6 +35,10 @@ class MembersmanagerViewTypes extends JViewLegacy
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->user = JFactory::getUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
@ -160,42 +164,6 @@ class MembersmanagerViewTypes extends JViewLegacy
JToolBarHelper::preferences('com_membersmanager');
}
// Only load publish filter if state change is allowed
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)
);
}
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
// Set Add Relationship Selection
$this->add_relationshipOptions = $this->getTheAdd_relationshipSelections();
// We do some sanitation for Add Relationship filter
if (MembersmanagerHelper::checkArray($this->add_relationshipOptions) &&
isset($this->add_relationshipOptions[0]->value) &&
!MembersmanagerHelper::checkString($this->add_relationshipOptions[0]->value))
{
unset($this->add_relationshipOptions[0]);
}
// Only load Add Relationship filter if it has values
if (MembersmanagerHelper::checkArray($this->add_relationshipOptions))
{
// Add Relationship Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_MEMBERSMANAGER_TYPE_ADD_RELATIONSHIP_LABEL').' -',
'filter_add_relationship',
JHtml::_('select.options', $this->add_relationshipOptions, 'value', 'text', $this->state->get('filter.add_relationship'))
);
}
// Only load published batch if state and batch is allowed
if ($this->canState && $this->canBatch)
{
@ -219,6 +187,15 @@ class MembersmanagerViewTypes extends JViewLegacy
// Only load Add Relationship batch if create, edit, and batch is allowed
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Set Add Relationship Selection
$this->add_relationshipOptions = JFormHelper::loadFieldType('typesfilteraddrelationship')->options;
// We do some sanitation for Add Relationship filter
if (MembersmanagerHelper::checkArray($this->add_relationshipOptions) &&
isset($this->add_relationshipOptions[0]->value) &&
!MembersmanagerHelper::checkString($this->add_relationshipOptions[0]->value))
{
unset($this->add_relationshipOptions[0]);
}
// Add Relationship Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_MEMBERSMANAGER_TYPE_ADD_RELATIONSHIP_LABEL').' -',
@ -275,39 +252,4 @@ class MembersmanagerViewTypes extends JViewLegacy
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
protected function getTheAdd_relationshipSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('add_relationship'));
$query->from($db->quoteName('#__membersmanager_type'));
$query->order($db->quoteName('add_relationship') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
$_filter = array();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
foreach ($results as $add_relationship)
{
// Translate the add_relationship selection
$text = $model->selectionTranslation($add_relationship,'add_relationship');
// Now add the add_relationship and its text to the options array
$_filter[] = JHtml::_('select.option', $add_relationship, JText::_($text));
}
}
return $_filter;
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_MEMBERSMANAGER</name>
<creationDate>7th February, 2021</creationDate>
<creationDate>8th February, 2021</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>https://www.joomlacomponentbuilder.com/</authorUrl>

View File

@ -21,6 +21,9 @@ COM_MEMBERSMANAGER_DOES_NOT_HAVE_A_VALID_FILE_TYPE="Does not have a valid file t
COM_MEMBERSMANAGER_DOWNLOAD="Download"
COM_MEMBERSMANAGER_EDIT="Edit"
COM_MEMBERSMANAGER_EDIT_S="Edit %s"
COM_MEMBERSMANAGER_FILTER_ACCOUNT_ASCENDING="Account ascending"
COM_MEMBERSMANAGER_FILTER_ACCOUNT_DESCENDING="Account descending"
COM_MEMBERSMANAGER_FILTER_SELECT_ACCOUNT="Select Account"
COM_MEMBERSMANAGER_FORMS="Forms"
COM_MEMBERSMANAGER_GO_BACK="go Back"
COM_MEMBERSMANAGER_GREAT_SS_IS_AVAILABLE="Great, %s(%s) is available!"