diff --git a/README.md b/README.md index 278491a..efc71e8 100644 --- a/README.md +++ b/README.md @@ -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**, diff --git a/admin/README.txt b/admin/README.txt index 278491a..efc71e8 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -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**, diff --git a/admin/language/en-GB/en-GB.com_membersmanager.ini b/admin/language/en-GB/en-GB.com_membersmanager.ini index acffc23..daef0da 100644 --- a/admin/language/en-GB/en-GB.com_membersmanager.ini +++ b/admin/language/en-GB/en-GB.com_membersmanager.ini @@ -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="%s 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="

Curl Not Found!

Please setup curl on your system, or membersmanager will not function correctly!

" @@ -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 %s could not be deleted and so you will have to manually delete the user in the Joomla Users 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 %s, 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." diff --git a/admin/layouts/trashhelper.php b/admin/layouts/trashhelper.php new file mode 100644 index 0000000..6ebcdcf --- /dev/null +++ b/admin/layouts/trashhelper.php @@ -0,0 +1,74 @@ + + * @github 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'); + + + +?> +state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?> + +
+ items)): ?> +

+ + +

+

+ +

+ + +

+

+ + + +
+ diff --git a/admin/models/fields/membersfilteraccount.php b/admin/models/fields/membersfilteraccount.php new file mode 100644 index 0000000..57c0c2c --- /dev/null +++ b/admin/models/fields/membersfilteraccount.php @@ -0,0 +1,72 @@ + + * @github 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; + } +} diff --git a/admin/models/fields/typesfilteraddrelationship.php b/admin/models/fields/typesfilteraddrelationship.php new file mode 100644 index 0000000..7042735 --- /dev/null +++ b/admin/models/fields/typesfilteraddrelationship.php @@ -0,0 +1,72 @@ + + * @github 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; + } +} diff --git a/admin/models/forms/filter_members.xml b/admin/models/forms/filter_members.xml new file mode 100644 index 0000000..0126eed --- /dev/null +++ b/admin/models/forms/filter_members.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/forms/filter_types.xml b/admin/models/forms/filter_types.xml new file mode 100644 index 0000000..588c1a2 --- /dev/null +++ b/admin/models/forms/filter_types.xml @@ -0,0 +1,74 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/admin/models/members.php b/admin/models/members.php index 49bd746..c8c4207 100644 --- a/admin/models/members.php +++ b/admin/models/members.php @@ -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'); diff --git a/admin/models/types.php b/admin/models/types.php index 3b4bc54..6b5e207 100644 --- a/admin/models/types.php +++ b/admin/models/types.php @@ -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'); diff --git a/admin/views/members/tmpl/default.php b/admin/views/members/tmpl/default.php index 123a01b..860561f 100644 --- a/admin/views/members/tmpl/default.php +++ b/admin/views/members/tmpl/default.php @@ -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); } ?> -
sidebar)): ?>
@@ -49,13 +33,17 @@ if ($this->saveOrder)
+ $this)); +?> items)): ?> - loadTemplate('toolbar');?>
- loadTemplate('toolbar');?> loadTemplate('head');?>loadTemplate('foot');?> @@ -73,8 +61,6 @@ if ($this->saveOrder) $this->loadTemplate('batch_body') ); ?> - - diff --git a/admin/views/members/tmpl/default_head.php b/admin/views/members/tmpl/default_head.php index f13c704..c4b9cd4 100644 --- a/admin/views/members/tmpl/default_head.php +++ b/admin/views/members/tmpl/default_head.php @@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> canState): ?> \ No newline at end of file diff --git a/admin/views/members/view.html.php b/admin/views/members/view.html.php index cbb573d..6248fb2 100644 --- a/admin/views/members/view.html.php +++ b/admin/views/members/view.html.php @@ -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').' -', @@ -274,40 +251,5 @@ class MembersmanagerViewMembers extends JViewLegacy 'a.account' => JText::_('COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL'), '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; } } diff --git a/admin/views/types/tmpl/default.php b/admin/views/types/tmpl/default.php index 02b27f2..371912f 100644 --- a/admin/views/types/tmpl/default.php +++ b/admin/views/types/tmpl/default.php @@ -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); } ?> -sidebar)): ?>
@@ -49,13 +33,17 @@ if ($this->saveOrder)
+ $this)); +?> items)): ?> - loadTemplate('toolbar');?>
- loadTemplate('toolbar');?>
- ', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -37,11 +37,11 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -49,6 +49,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?>
loadTemplate('head');?>loadTemplate('foot');?> @@ -73,8 +61,6 @@ if ($this->saveOrder) $this->loadTemplate('batch_body') ); ?> - - diff --git a/admin/views/types/tmpl/default_head.php b/admin/views/types/tmpl/default_head.php index e52b1c2..d3c99ff 100644 --- a/admin/views/types/tmpl/default_head.php +++ b/admin/views/types/tmpl/default_head.php @@ -17,7 +17,7 @@ defined('_JEXEC') or die('Restricted access'); canEdit&& $this->canState): ?> canState): ?> \ No newline at end of file diff --git a/admin/views/types/view.html.php b/admin/views/types/view.html.php index 3c5306c..2123b6e 100644 --- a/admin/views/types/view.html.php +++ b/admin/views/types/view.html.php @@ -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').' -', @@ -274,40 +251,5 @@ class MembersmanagerViewTypes extends JViewLegacy 'a.name' => JText::_('COM_MEMBERSMANAGER_TYPE_NAME_LABEL'), '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; } } diff --git a/membersmanager.xml b/membersmanager.xml index c3fe2be..692395a 100644 --- a/membersmanager.xml +++ b/membersmanager.xml @@ -1,7 +1,7 @@ COM_MEMBERSMANAGER - 7th February, 2021 + 8th February, 2021 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com https://www.joomlacomponentbuilder.com/ diff --git a/site/language/en-GB/en-GB.com_membersmanager.ini b/site/language/en-GB/en-GB.com_membersmanager.ini index df9b487..f978865 100644 --- a/site/language/en-GB/en-GB.com_membersmanager.ini +++ b/site/language/en-GB/en-GB.com_membersmanager.ini @@ -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!"
- ', 'a.ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> + listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?> @@ -31,7 +31,7 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -47,7 +47,7 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> @@ -55,6 +55,6 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?>