Răsfoiți Sursa

Ticket #1904 - Usage of 'Paid Join' in Groups module.

AntonLV 6 ani în urmă
părinte
comite
94033909f5

+ 27 - 10
modules/boonex/groups/classes/BxGroupsConfig.php

@@ -33,6 +33,7 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
             'TABLE_ENTRIES_FULLTEXT' => 'search_fields',
             'TABLE_ADMINS' => $aModule['db_prefix'] . 'admins',
             'TABLE_INVITES' => $aModule['db_prefix'] . 'invites',
+            'TABLE_PRICES' => $aModule['db_prefix'] . 'prices',
 
             // database fields
             'FIELD_ID' => 'id',
@@ -59,6 +60,7 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
             'URI_VIEW_ENTRY' => 'view-group-profile',
             'URI_EDIT_ENTRY' => 'edit-group-profile',
             'URI_EDIT_COVER' => 'edit-group-cover',
+            'URI_JOIN_ENTRY' => 'join-group-profile',
             'URI_JOINED_ENTRIES' => 'joined-groups',
             'URI_MANAGE_COMMON' => 'groups-manage',
 
@@ -73,6 +75,8 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
             'PARAM_SEARCHABLE_FIELDS' => 'bx_groups_searchable_fields',
             'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_groups_per_page_browse_showcase',
             'PARAM_PER_PAGE_BROWSE_RECOMMENDED' => 'bx_groups_per_page_browse_recommended',
+            'PARAM_PER_PAID_JOIN' => 'bx_groups_enable_paid_join',
+            'PARAM_RECURRING_RESERVE' => 3, // 3 days for recurring payment to be registered
 
             // objects
             'OBJECT_STORAGE' => 'bx_groups_pics',
@@ -102,6 +106,9 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
             'OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER' => 'bx_group_edit_cover',
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_group_delete',
             'OBJECT_FORM_ENTRY_DISPLAY_INVITE' => 'bx_group_invite',
+            'OBJECT_FORM_PRICE' => 'bx_groups_price',
+            'OBJECT_FORM_PRICE_DISPLAY_ADD' => 'bx_groups_price_add',
+            'OBJECT_FORM_PRICE_DISPLAY_EDIT' => 'bx_groups_price_edit',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_groups_view_actions', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_groups_view_actions_more', // actions menu on view entry page for "more" popup
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_groups_view_actions_all', // all actions menu on view entry page
@@ -121,10 +128,13 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
             'OBJECT_GRID_COMMON' => 'bx_groups_common',
             'OBJECT_GRID_CONNECTIONS' => 'bx_groups_fans',
             'OBJECT_GRID_INVITES' => 'bx_groups_invites',
+            'OBJECT_GRID_PRICES_MANAGE' => 'bx_groups_prices_manage',
+            'OBJECT_GRID_PRICES_VIEW' => 'bx_groups_prices_view',
             'OBJECT_CONNECTIONS' => 'bx_groups_fans',
             'OBJECT_UPLOADERS_COVER' => array('bx_groups_cover_crop'),
             'OBJECT_UPLOADERS_PICTURE' => array('bx_groups_picture_crop'),
             'OBJECT_PRE_LIST_ROLES' => 'bx_groups_roles',
+            'OBJECT_FORM_PRELISTS_PERIOD_UNITS' => 'bx_groups_period_units',
             
             'BADGES_AVALIABLE' => true,
             
@@ -196,11 +206,17 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
                 'menu_item_title_leave_group' => '_bx_groups_menu_item_title_leave_group',
                 'txt_all_entries_by_author' => '_bx_groups_page_title_browse_by_author',
                 'txt_invitation_popup_title' => '_bx_groups_txt_invite_popup_title',
-				'txt_invitation_popup_text' => '_bx_groups_txt_invite_popup_text',
-				'txt_invitation_popup_accept_button' => '_bx_groups_txt_invite_popup_button_accept',
-				'txt_invitation_popup_decline_button' => '_bx_groups_txt_invite_popup_button_decline',
-				'txt_invitation_popup_error_invitation_absent' => '_bx_groups_txt_invite_popup_error_invitation_absent',
-				'txt_invitation_popup_error_wrong_user' => '_bx_groups_txt_invite_popup_error_invitation_wrong_user',
+                'txt_invitation_popup_text' => '_bx_groups_txt_invite_popup_text',
+                'txt_invitation_popup_accept_button' => '_bx_groups_txt_invite_popup_button_accept',
+                'txt_invitation_popup_decline_button' => '_bx_groups_txt_invite_popup_button_decline',
+                'txt_invitation_popup_error_invitation_absent' => '_bx_groups_txt_invite_popup_error_invitation_absent',
+                'txt_invitation_popup_error_wrong_user' => '_bx_groups_txt_invite_popup_error_invitation_wrong_user',
+                'txt_n_unit' => '_bx_groups_txt_n_unit',
+                'txt_buy_title' => '_bx_groups_grid_action_title_buy_title',
+                'txt_cart_item_title' => '_bx_groups_txt_cart_item_title',
+                'txt_subscribe_title' => '_bx_groups_grid_action_title_subscribe_title',
+                'msg_performed' => '_bx_groups_msg_performed',
+                'err_cannot_perform' => '_bx_groups_err_cannot_perform',
             ),
 
         );
@@ -208,19 +224,20 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
         $this->_aJsClasses = array(
             'main' => 'BxGroupsMain',
             'manage_tools' => 'BxGroupsManageTools',
-            'invite_popup' => 'BxGroupsInvitePopup'
+            'invite_popup' => 'BxGroupsInvitePopup',
+            'prices' => 'BxGroupsPrices'
         );
 
         $this->_aJsObjects = array(
             'main' => 'oBxGroupsMain',
             'manage_tools' => 'oBxGroupsManageTools',
-            'invite_popup' => 'oBxGroupsInvitePopup'
+            'invite_popup' => 'oBxGroupsInvitePopup',
+            'prices' => 'oBxGroupsPrices'
         );
 
         $this->_aGridObjects = array(
-        	'common' => $this->CNF['OBJECT_GRID_COMMON'],
-        	'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
-        	
+            'common' => $this->CNF['OBJECT_GRID_COMMON'],
+            'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
         );
     }
 

+ 22 - 0
modules/boonex/groups/classes/BxGroupsCronPruning.php

@@ -0,0 +1,22 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Groups Groups
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxGroupsCronPruning extends BxBaseModGroupsCronPruning
+{
+    public function __construct()
+    {
+        $this->_sModule = 'bx_groups';
+
+        parent::__construct();
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/groups/classes/BxGroupsGridPricesManage.php

@@ -0,0 +1,22 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Groups Groups
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxGroupsGridPricesManage extends BxBaseModGroupsGridPricesManage
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_groups';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/groups/classes/BxGroupsGridPricesView.php

@@ -0,0 +1,22 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Groups Groups
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxGroupsGridPricesView extends BxBaseModGroupsGridPricesView
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_groups';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 10 - 0
modules/boonex/groups/classes/BxGroupsMenuViewActionsAll.php

@@ -21,6 +21,11 @@ class BxGroupsMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         parent::__construct($aObject, $oTemplate);
     }
 
+    protected function _getMenuItemJoinGroupProfile($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
     protected function _getMenuItemEditGroupCover($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);
@@ -31,6 +36,11 @@ class BxGroupsMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         return $this->_getMenuItemByNameActionsMore($aItem);
     }
 
+    protected function _getMenuItemEditGroupPricing($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+
     protected function _getMenuItemInviteToGroup($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);

+ 17 - 0
modules/boonex/groups/install/installer.php

@@ -15,6 +15,23 @@ class BxGroupsInstaller extends BxBaseModProfileInstaller
     {
         parent::__construct($aConfig);
     }
+
+    function enable($aParams)
+    {
+        $aResult = parent::enable($aParams);
+
+        if($aResult['result'])
+            BxDolPayments::getInstance()->updateDependentModules($this->_aConfig['name'], true);
+
+        return $aResult;
+    }
+
+    function disable($aParams)
+    {
+        BxDolPayments::getInstance()->updateDependentModules($this->_aConfig['name'], false);
+
+        return parent::disable($aParams);
+    }
 }
 
 /** @} */

+ 67 - 3
modules/boonex/groups/install/langs/en.xml

@@ -8,6 +8,7 @@
 	<string name="_bx_groups_option_per_page_browse"><![CDATA[Number of items per page]]></string>
     <string name="_bx_groups_option_num_rss"><![CDATA[Number of items in RSS feed]]></string>
     <string name="_bx_groups_option_searchable_fields"><![CDATA[Searchable fields]]></string>
+    <string name="_bx_groups_option_enable_paid_join"><![CDATA[Enable 'Paid Join']]></string>
 
 	<string name="_bx_groups_form_profile"><![CDATA[Groups]]></string>
 	<string name="_bx_groups_form_profile_display_add"><![CDATA[Add Group]]></string>
@@ -46,6 +47,26 @@
 	<string name="_bx_groups_form_profile_input_delete_confirm_info"><![CDATA[This action can not be undone.]]></string>
 	<string name="_bx_groups_form_profile_input_delete_confirm_error"><![CDATA[Please check this checkbox if you really want to delete group.]]></string>
 
+    <string name="_bx_groups_form_price"><![CDATA[Price]]></string>
+    <string name="_bx_groups_form_price_display_add"><![CDATA[Add]]></string>
+    <string name="_bx_groups_form_price_display_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_groups_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_groups_form_price_input_sys_role_id"><![CDATA[Role ID]]></string>
+    <string name="_bx_groups_form_price_input_sys_period"><![CDATA[Period]]></string>
+    <string name="_bx_groups_form_price_input_period"><![CDATA[Period]]></string>
+    <string name="_bx_groups_form_price_input_inf_period"><![CDATA[Use 0 for lifetime]]></string>
+    <string name="_bx_groups_form_price_input_sys_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_groups_form_price_input_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_groups_form_price_input_inf_period_unit"><![CDATA[Leave empty for lifetime level.]]></string>
+    <string name="_bx_groups_form_price_input_err_period_unit"><![CDATA[You need to select a period unit here.]]></string>
+    <string name="_bx_groups_form_price_input_sys_price"><![CDATA[Price]]></string>
+    <string name="_bx_groups_form_price_input_price"><![CDATA[Price]]></string>
+    <string name="_bx_groups_form_price_input_inf_price"><![CDATA[Use 0 or leave empty to create free level.]]></string>
+    <string name="_bx_groups_form_price_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_groups_form_price_input_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_groups_form_price_input_sys_do_cancel"><![CDATA[Cancel]]></string>
+    <string name="_bx_groups_form_price_input_do_cancel"><![CDATA[Cancel]]></string>
+
 	<string name="_bx_groups_acl_action_create_profile"><![CDATA[Create Group]]></string>
 	<string name="_bx_groups_acl_action_delete_profile"><![CDATA[Delete Group]]></string>
 	<string name="_bx_groups_acl_action_view_profile"><![CDATA[View Group]]></string>
@@ -62,6 +83,8 @@
 	<string name="_bx_groups_page_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_groups_page_title_sys_delete_profile"><![CDATA[Delete Group]]></string>
 	<string name="_bx_groups_page_title_delete_profile"><![CDATA[Delete Group]]></string>
+        <string name="_bx_groups_page_title_sys_join_profile"><![CDATA[Join Group]]></string>
+	<string name="_bx_groups_page_title_join_profile"><![CDATA[Join Group]]></string>
 	<string name="_bx_groups_page_title_sys_view_profile_closed"><![CDATA[View Closed Group]]></string>
 	<string name="_bx_groups_page_title_sys_view_profile"><![CDATA[View Group]]></string>
 	<string name="_bx_groups_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -80,6 +103,8 @@
     <string name="_bx_groups_page_title_profile_comments"><![CDATA[Comments]]></string>
 	<string name="_bx_groups_page_title_sys_profile_info"><![CDATA[Group Info]]></string>
 	<string name="_bx_groups_page_title_profile_info"><![CDATA[Info about {display_name}]]></string>
+        <string name="_bx_groups_page_title_sys_profile_pricing"><![CDATA[Pricing]]></string>
+	<string name="_bx_groups_page_title_profile_pricing"><![CDATA[Pricing]]></string>
 	<string name="_bx_groups_page_title_sys_recent"><![CDATA[New Groups]]></string>
 	<string name="_bx_groups_page_title_recent"><![CDATA[New Groups]]></string>
 	<string name="_bx_groups_page_title_sys_manage"><![CDATA[Manage Own Groups]]></string>
@@ -106,9 +131,13 @@
 	<string name="_bx_groups_page_block_title_edit_profile"><![CDATA[Edit Group]]></string>
 	<string name="_bx_groups_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_groups_page_block_title_delete_profile"><![CDATA[Delete Group]]></string>
+        <string name="_bx_groups_page_block_title_join_profile"><![CDATA[Join Group]]></string>
 	<string name="_bx_groups_page_block_title_profile_info_link"><![CDATA[About <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_groups_page_block_title_profile_info"><![CDATA[Info]]></string>
 	<string name="_bx_groups_page_block_title_system_profile_info"><![CDATA[Info]]></string>
+        <string name="_bx_groups_page_block_title_system_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_groups_page_block_title_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_groups_page_block_title_profile_pricing_link"><![CDATA[Pricing of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_groups_page_block_title_profile_description"><![CDATA[Description]]></string>
 	<string name="_bx_groups_page_block_title_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_groups_page_block_title_profile_friends"><![CDATA[Friends]]></string>
@@ -169,6 +198,8 @@
     <string name="_bx_groups_menu_item_title_delete_with_content"><![CDATA[Delete With Content]]></string>
     <string name="_bx_groups_menu_item_title_system_edit_cover"><![CDATA[Edit Cover]]></string>
     <string name="_bx_groups_menu_item_title_edit_cover"><![CDATA[Edit Cover]]></string>
+    <string name="_bx_groups_menu_item_title_system_edit_pricing"><![CDATA[Edit Pricing]]></string>
+    <string name="_bx_groups_menu_item_title_edit_pricing"><![CDATA[Edit Pricing]]></string>
     <string name="_bx_groups_menu_item_title_system_edit_profile"><![CDATA[Edit Group]]></string>
     <string name="_bx_groups_menu_item_title_edit_profile"><![CDATA[Edit Group]]></string>
     <string name="_bx_groups_menu_item_title_system_delete_profile"><![CDATA[Delete Group]]></string>
@@ -214,6 +245,9 @@
     <string name="_bx_groups_menu_item_title_leave_group_cancel_request"><![CDATA[Cancel Request]]></string>
     <string name="_bx_groups_menu_item_title_leave_group_reject_request"><![CDATA[Reject Request]]></string>
 
+    <string name="_bx_groups_menu_item_title_system_pay_and_join"><![CDATA[Pay & Join]]></string>
+    <string name="_bx_groups_menu_item_title_pay_and_join"><![CDATA[Pay & Join]]></string>
+
     <string name="_bx_groups_menu_item_title_system_subscribe"><![CDATA[Follow]]></string>
     <string name="_bx_groups_menu_item_title_subscribe"><![CDATA[Follow]]></string>
     <string name="_bx_groups_menu_item_title_system_unsubscribe"><![CDATA[Unfollow]]></string>
@@ -256,8 +290,24 @@
     <string name="_bx_groups_grid_action_title_adm_delete"><![CDATA[Delete]]></string>
     <string name="_bx_groups_grid_action_title_adm_delete_with_content"><![CDATA[Delete With Content]]></string>
     <string name="_bx_groups_grid_action_title_adm_more_actions"><![CDATA[More Actions]]></string>
-	<string name="_bx_groups_grid_action_err_delete"><![CDATA[Cannot delete the selected group(s).]]></string>
-	<string name="_bx_groups_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
+    <string name="_bx_groups_grid_action_err_delete"><![CDATA[Cannot delete the selected group(s).]]></string>
+    <string name="_bx_groups_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
+
+    <string name="_bx_groups_grid_column_title_name"><![CDATA[Name]]></string>
+    <string name="_bx_groups_grid_column_title_role_id"><![CDATA[Role]]></string>
+    <string name="_bx_groups_grid_column_title_period"><![CDATA[Period]]></string>
+    <string name="_bx_groups_grid_column_title_price"><![CDATA[Price]]></string>
+    <string name="_bx_groups_grid_action_title_add"><![CDATA[Add]]></string>
+    <string name="_bx_groups_grid_action_title_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_groups_grid_action_title_delete"><![CDATA[Delete]]></string>
+    <string name="_bx_groups_grid_action_title_buy"><![CDATA[Buy]]></string>
+    <string name="_bx_groups_grid_action_title_buy_title"><![CDATA[One-time payment]]></string>
+    <string name="_bx_groups_grid_action_title_subscribe"><![CDATA[Rent]]></string>
+    <string name="_bx_groups_grid_action_title_subscribe_title"><![CDATA[Subscribe on recurring payments]]></string>
+    <string name="_bx_groups_grid_action_title_choose"><![CDATA[Choose]]></string>
+    <string name="_bx_groups_grid_action_title_choose_title"><![CDATA[Switch to the level for free]]></string>
+    <string name="_bx_groups_popup_title_price_add"><![CDATA[Add Pricing Plan]]></string>
+    <string name="_bx_groups_popup_title_price_edit"><![CDATA[Edit Pricing Plan]]></string>
 
     <string name="_bx_groups_chart_growth"><![CDATA[Groups: Growth]]></string>
     <string name="_bx_groups_chart_growth_speed"><![CDATA[Groups: Growth Speed]]></string>
@@ -269,6 +319,8 @@
     <string name="_bx_groups_txt_account_suspended"><![CDATA[This group is suspended.]]></string>
     <string name="_bx_groups_txt_N_fans"><![CDATA[{0} members]]></string>
     <string name="_bx_groups_txt_role"><![CDATA[Role]]></string>
+    <string name="_bx_groups_txt_role_added"><![CDATA[Added]]></string>
+    <string name="_bx_groups_txt_role_expired"><![CDATA[Expires]]></string>
     <string name="_bx_groups_txt_sample_single"><![CDATA[group]]></string>
     <string name="_bx_groups_txt_sample_single_with_article"><![CDATA[a group]]></string>
     <string name="_bx_groups_txt_sample_comment_single"><![CDATA[comment to group]]></string>
@@ -283,8 +335,14 @@
     <string name="_bx_groups_txt_invite_popup_button_decline"><![CDATA[Decline]]></string>
     <string name="_bx_groups_txt_invite_popup_error_invitation_absent"><![CDATA[Sorry, an error has occurred. You can not join this group. The invitation is expired or deleted.]]></string>
     <string name="_bx_groups_txt_invite_popup_error_invitation_wrong_user"><![CDATA[Sorry, an error has occurred. You can not join this group. This invitation cannot be used by you.]]></string>
+    <string name="_bx_groups_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_groups_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
 
-	  <string name="_bx_groups_alert_action_fan_added"><![CDATA[member joined]]></string>
+    <string name="_bx_groups_msg_performed"><![CDATA[The action was successfully performed.]]></string>
+    <string name="_bx_groups_err_price_duplicate"><![CDATA[Similar pricing plan is already exists.]]></string>
+    <string name="_bx_groups_err_cannot_perform"><![CDATA[An error appeared. Please report.]]></string>
+
+    <string name="_bx_groups_alert_action_fan_added"><![CDATA[member joined]]></string>
     <string name="_bx_groups_txt_ntfs_fan_added"><![CDATA[Group <b class="bx-ntfs-content-profile">{owner_name}</b> has got a member <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
     <string name="_bx_groups_alert_action_join_request"><![CDATA[join request]]></string>
     <string name="_bx_groups_txt_ntfs_join_request"><![CDATA[Group <b class="bx-ntfs-content-profile">{owner_name}</b> has a join request from <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
@@ -303,6 +361,12 @@
     <string name="_bx_groups_role_administrator"><![CDATA[Administrator]]></string>
     <string name="_bx_groups_role_moderator"><![CDATA[Moderator]]></string>
 
+    <string name="_bx_groups_pre_lists_period_units"><![CDATA[Billing Interval]]></string>
+    <string name="_bx_groups_period_unit_day"><![CDATA[day]]></string>
+    <string name="_bx_groups_period_unit_week"><![CDATA[week]]></string>
+    <string name="_bx_groups_period_unit_month"><![CDATA[month]]></string>
+    <string name="_bx_groups_period_unit_year"><![CDATA[year]]></string>
+
     <string name="_bx_groups_email_join_request"><![CDATA[Group join request]]></string>
     <string name="_bx_groups_email_join_request_subject"><![CDATA[Request to join your group]]></string>
     <string name="_bx_groups_email_join_request_body"><![CDATA[{email_header}

+ 7 - 4
modules/boonex/groups/install/sql/disable.sql

@@ -8,7 +8,7 @@ DELETE FROM `sys_options_types` WHERE `id` = @iTypeId;
 
 -- PAGES
 DELETE FROM `sys_objects_page` WHERE `module` = 'bx_groups';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_groups' OR `object` IN('bx_groups_create_profile', 'bx_groups_delete_profile', 'bx_groups_edit_profile', 'bx_groups_edit_profile_cover', 'bx_groups_invite', 'bx_groups_view_profile', 'bx_groups_view_profile_closed', 'bx_groups_profile_info', 'bx_groups_profile_comments', 'bx_groups_home', 'bx_groups_fans', 'bx_groups_joined', 'bx_groups_top', 'bx_groups_search', 'bx_groups_manage', 'bx_groups_administration');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_groups' OR `object` IN('bx_groups_create_profile', 'bx_groups_delete_profile', 'bx_groups_join_profile', 'bx_groups_edit_profile', 'bx_groups_edit_profile_cover', 'bx_groups_invite', 'bx_groups_view_profile', 'bx_groups_view_profile_closed', 'bx_groups_profile_info', 'bx_groups_profile_pricing', 'bx_groups_profile_comments', 'bx_groups_home', 'bx_groups_fans', 'bx_groups_joined', 'bx_groups_top', 'bx_groups_search', 'bx_groups_manage', 'bx_groups_administration');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_groups';
@@ -38,9 +38,9 @@ DELETE FROM `sys_statistics` WHERE `name` LIKE 'bx_groups%';
 DELETE FROM `sys_objects_chart` WHERE `object` LIKE 'bx_groups%';
 
 -- GRIDS
-DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_groups_administration', 'bx_groups_moderation', 'bx_groups_common', 'bx_groups_fans', 'bx_groups_invites');
-DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_groups_administration', 'bx_groups_moderation', 'bx_groups_common', 'bx_groups_fans', 'bx_groups_invites');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_groups_administration', 'bx_groups_moderation', 'bx_groups_common', 'bx_groups_fans', 'bx_groups_invites');
+DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_groups_administration', 'bx_groups_moderation', 'bx_groups_common', 'bx_groups_fans', 'bx_groups_invites', 'bx_groups_prices_manage', 'bx_groups_prices_view');
+DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_groups_administration', 'bx_groups_moderation', 'bx_groups_common', 'bx_groups_fans', 'bx_groups_invites', 'bx_groups_prices_manage', 'bx_groups_prices_view');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_groups_administration', 'bx_groups_moderation', 'bx_groups_common', 'bx_groups_fans', 'bx_groups_invites', 'bx_groups_prices_manage', 'bx_groups_prices_view');
 
 -- ALERTS
 SET @iHandler := (SELECT `id` FROM `sys_alerts_handlers` WHERE `name` = 'bx_groups' LIMIT 1);
@@ -55,3 +55,6 @@ DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_groups';
 
 -- UPLOADERS
 DELETE FROM `sys_objects_uploader` WHERE `object` IN ('bx_groups_cover_crop', 'bx_groups_picture_crop');
+
+-- CRON
+DELETE FROM `sys_cron_jobs` WHERE `name` IN ('bx_groups_pruning');

+ 77 - 25
modules/boonex/groups/install/sql/enable.sql

@@ -16,7 +16,8 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `e
 ('bx_groups_num_rss', '10', @iCategId, '_bx_groups_option_num_rss', 'digit', '', '', '', 12),
 ('bx_groups_per_page_browse_showcase', '32', @iCategId, '_sys_option_per_page_browse_showcase', 'digit', '', '', '', 15),
 ('bx_groups_per_page_browse_recommended', '10', @iCategId, '_sys_option_per_page_browse_recommended', 'digit', '', '', '', 16),
-('bx_groups_searchable_fields', 'group_name,group_desc', @iCategId, '_bx_groups_option_searchable_fields', 'list', 'a:2:{s:6:"module";s:9:"bx_groups";s:6:"method";s:21:"get_searchable_fields";}', '', '', 30);
+('bx_groups_searchable_fields', 'group_name,group_desc', @iCategId, '_bx_groups_option_searchable_fields', 'list', 'a:2:{s:6:"module";s:9:"bx_groups";s:6:"method";s:21:"get_searchable_fields";}', '', '', 30),
+('bx_groups_enable_paid_join', 'on', @iCategId, '_bx_groups_option_enable_paid_join', 'checkbox', '', '', '', 40);
 
 -- PAGES
 
@@ -85,8 +86,14 @@ INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
 ('bx_groups_delete_profile', 1, 'bx_groups', '_bx_groups_page_block_title_delete_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_groups\";s:6:\"method\";s:13:\"entity_delete\";}', 0, 0, 0);
 
--- PAGE: profile info
+-- PAGE: join profile
+INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_groups_join_profile', 'join-group-profile', '_bx_groups_page_title_sys_join_profile', '_bx_groups_page_title_join_profile', 'bx_groups', 5, 2147483647, 1, 'page.php?i=join-group-profile', '', '', '', 0, 1, 0, 'BxGroupsPageEntry', 'modules/boonex/groups/classes/BxGroupsPageEntry.php');
 
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_groups_join_profile', 1, 'bx_groups', '_bx_groups_page_block_title_join_profile', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:11:"entity_join";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 0, 0);
+
+-- PAGE: profile info
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_groups_profile_info', 'group-profile-info', '_bx_groups_page_title_sys_profile_info', '_bx_groups_page_title_profile_info', 'bx_groups', 5, 2147483647, 1, 'page.php?i=group-profile-info', '', '', '', 0, 1, 0, 'BxGroupsPageEntry', 'modules/boonex/groups/classes/BxGroupsPageEntry.php');
 
@@ -94,8 +101,14 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_groups_profile_info', 1, 'bx_groups', '_bx_groups_page_block_title_system_profile_info', '_bx_groups_page_block_title_profile_info_link', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_groups\";s:6:\"method\";s:16:\"entity_info_full\";}', 0, 0, 1, 1),
 ('bx_groups_profile_info', 1, 'bx_groups', '', '_bx_groups_page_block_title_profile_description', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_groups\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 1, 2);
 
--- PAGE: group fans
+-- PAGE: manage profile pricing
+INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_groups_profile_pricing', 'edit-group-pricing', '_bx_groups_page_title_sys_profile_pricing', '_bx_groups_page_title_profile_pricing', 'bx_groups', 5, 2147483647, 1, 'page.php?i=edit-group-pricing', '', '', '', 0, 1, 0, 'BxGroupsPageEntry', 'modules/boonex/groups/classes/BxGroupsPageEntry.php');
 
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
+('bx_groups_profile_pricing', 1, 'bx_groups', '_bx_groups_page_block_title_system_profile_pricing', '_bx_groups_page_block_title_profile_pricing_link', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:14:"entity_pricing";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 0, 1, 1);
+
+-- PAGE: group fans
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_groups_fans', 'group-fans', '_bx_groups_page_title_sys_group_fans', '_bx_groups_page_title_group_fans', 'bx_groups', 5, 2147483647, 1, 'page.php?i=group-fans', '', '', '', 0, 1, 0, 'BxGroupsPageEntry', 'modules/boonex/groups/classes/BxGroupsPageEntry.php');
 
@@ -213,7 +226,8 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_groups_view_actions', 'bx_groups', '_bx_groups_menu_set_title_view_profile_actions', 0);
 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `submenu_popup`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `editable`, `order`) VALUES 
-('bx_groups_view_actions', 'bx_groups', 'profile-fan-add', '_bx_groups_menu_item_title_system_become_fan', '{title_add_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_groups_fans\', \'add\', \'{profile_id}\')', '', 'sign-in-alt', '', 0, 2147483647, '', 1, 0, 0, 5),
+('bx_groups_view_actions', 'bx_groups', 'join-group-profile', '_bx_groups_menu_item_title_system_pay_and_join', '_bx_groups_menu_item_title_pay_and_join', 'page.php?i=join-group-profile&profile_id={profile_id}', '', '', 'sign-in-alt', '', 0, 2147483647, 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:22:"is_paid_join_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 0, 5),
+('bx_groups_view_actions', 'bx_groups', 'profile-fan-add', '_bx_groups_menu_item_title_system_become_fan', '{title_add_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_groups_fans\', \'add\', \'{profile_id}\')', '', 'sign-in-alt', '', 0, 2147483647, 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:22:"is_free_join_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 0, 10),
 ('bx_groups_view_actions', 'bx_groups', 'profile-subscribe-add', '_bx_groups_menu_item_title_system_subscribe', '_bx_groups_menu_item_title_subscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'add\', \'{profile_id}\')', '', 'check', '', 0, 2147483647, '', 1, 0, 1, 20),
 ('bx_groups_view_actions', 'bx_groups', 'profile-set-badges', '_sys_menu_item_title_system_set_badges', '_sys_menu_item_title_set_badges', 'javascript:void(0)', 'bx_menu_popup(''sys_set_badges'', window, {}, {module: ''bx_groups'', content_id: {content_id}});', '', 'check-circle', '', 0, 192, 'a:2:{s:6:"module";s:9:"bx_groups";s:6:"method";s:19:"is_badges_avaliable";}', 1, 0, 1, 30),
 ('bx_groups_view_actions', 'bx_groups', 'profile-actions-more', '_bx_groups_menu_item_title_system_more_actions', '_bx_groups_menu_item_title_more_actions', 'javascript:void(0)', 'bx_menu_popup(''bx_groups_view_actions_more'', this, {}, {profile_id:{profile_id}});', '', 'cog', 'bx_groups_view_actions_more', 1, 2147483647, '', 1, 0, 1, 9999);
@@ -226,13 +240,14 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_groups_view_actions_more', 'bx_groups', '_bx_groups_menu_set_title_view_profile_actions_more', 0);
 
-INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
-('bx_groups_view_actions_more', 'bx_groups', 'profile-fan-remove', '_bx_groups_menu_item_title_system_leave_group', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_groups_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, 1, 0, 10),
-('bx_groups_view_actions_more', 'bx_groups', 'profile-subscribe-remove', '_bx_groups_menu_item_title_system_unsubscribe', '_bx_groups_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, 1, 0, 20),
-('bx_groups_view_actions_more', 'bx_groups', 'edit-group-cover', '_bx_groups_menu_item_title_system_edit_cover', '_bx_groups_menu_item_title_edit_cover', 'page.php?i=edit-group-cover&id={content_id}', '', '', 'edit', '', 2147483647, 1, 0, 30),
-('bx_groups_view_actions_more', 'bx_groups', 'edit-group-profile', '_bx_groups_menu_item_title_system_edit_profile', '_bx_groups_menu_item_title_edit_profile', 'page.php?i=edit-group-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 40),
-('bx_groups_view_actions_more', 'bx_groups', 'invite-to-group', '_bx_groups_menu_item_title_system_invite', '_bx_groups_menu_item_title_invite', 'page.php?i=invite-to-group&id={content_id}', '', '', 'user-friends', '', 2147483647, 1, 0, 42),
-('bx_groups_view_actions_more', 'bx_groups', 'delete-group-profile', '_bx_groups_menu_item_title_system_delete_profile', '_bx_groups_menu_item_title_delete_profile', 'page.php?i=delete-group-profile&id={content_id}', '', '', 'remove', '', 2147483647, 1, 0, 50);
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `order`) VALUES 
+('bx_groups_view_actions_more', 'bx_groups', 'profile-fan-remove', '_bx_groups_menu_item_title_system_leave_group', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_groups_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, '', 1, 0, 10),
+('bx_groups_view_actions_more', 'bx_groups', 'profile-subscribe-remove', '_bx_groups_menu_item_title_system_unsubscribe', '_bx_groups_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, '', 1, 0, 20),
+('bx_groups_view_actions_more', 'bx_groups', 'edit-group-cover', '_bx_groups_menu_item_title_system_edit_cover', '_bx_groups_menu_item_title_edit_cover', 'page.php?i=edit-group-cover&id={content_id}', '', '', 'edit', '', 2147483647, '', 1, 0, 30),
+('bx_groups_view_actions_more', 'bx_groups', 'edit-group-profile', '_bx_groups_menu_item_title_system_edit_profile', '_bx_groups_menu_item_title_edit_profile', 'page.php?i=edit-group-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, '', 1, 0, 40),
+('bx_groups_view_actions_more', 'bx_groups', 'edit-group-pricing', '_bx_groups_menu_item_title_system_edit_pricing', '_bx_groups_menu_item_title_edit_pricing', 'page.php?i=edit-group-pricing&profile_id={profile_id}', '', '', 'money-check-alt', '', 2147483647, 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:20:"is_pricing_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 41),
+('bx_groups_view_actions_more', 'bx_groups', 'invite-to-group', '_bx_groups_menu_item_title_system_invite', '_bx_groups_menu_item_title_invite', 'page.php?i=invite-to-group&id={content_id}', '', '', 'user-friends', '', 2147483647, '', 1, 0, 42),
+('bx_groups_view_actions_more', 'bx_groups', 'delete-group-profile', '_bx_groups_menu_item_title_system_delete_profile', '_bx_groups_menu_item_title_delete_profile', 'page.php?i=delete-group-profile&id={content_id}', '', '', 'remove', '', 2147483647, '', 1, 0, 50);
 
 -- MENU: all actions menu for view entry 
 
@@ -243,6 +258,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_groups_view_actions_all', 'bx_groups', '_sys_menu_set_title_view_actions', 0);
 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `submenu_popup`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `order`) VALUES 
+('bx_groups_view_actions_all', 'bx_groups', 'join-group-profile', '_bx_groups_menu_item_title_system_become_fan_paid', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 5),
 ('bx_groups_view_actions_all', 'bx_groups', 'profile-fan-add', '_bx_groups_menu_item_title_system_become_fan', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 10),
 ('bx_groups_view_actions_all', 'bx_groups', 'profile-fan-remove', '_bx_groups_menu_item_title_system_leave_group', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 20),
 ('bx_groups_view_actions_all', 'bx_groups', 'profile-subscribe-add', '_bx_groups_menu_item_title_system_subscribe', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 30),
@@ -262,6 +278,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_groups_view_actions_all', 'bx_groups', 'social-sharing-pinterest', '_sys_menu_item_title_system_social_sharing_pinterest', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 330),
 ('bx_groups_view_actions_all', 'bx_groups', 'edit-group-cover', '_bx_groups_menu_item_title_system_edit_cover', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 400),
 ('bx_groups_view_actions_all', 'bx_groups', 'edit-group-profile', '_bx_groups_menu_item_title_system_edit_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 410),
+('bx_groups_view_actions_all', 'bx_groups', 'edit-group-pricing', '_bx_groups_menu_item_title_system_profile_pricing', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 415),
 ('bx_groups_view_actions_all', 'bx_groups', 'invite-to-group', '_bx_groups_menu_item_title_system_invite', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 420),
 ('bx_groups_view_actions_all', 'bx_groups', 'delete-group-profile', '_bx_groups_menu_item_title_system_delete_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 430),
 ('bx_groups_view_actions_all', 'bx_groups', 'more-auto', '_sys_menu_item_title_system_va_more_auto', '_sys_menu_item_title_va_more_auto', 'javascript:void(0)', '', '', 'ellipsis-v', '', '', 0, 2147483647, '', 1, 0, 9999);
@@ -315,19 +332,20 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_groups_snippet_meta', 'bx_groups', '_sys_menu_set_title_snippet_meta', 0);
 
-INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `editable`, `order`) VALUES
-('bx_groups_snippet_meta', 'bx_groups', 'privacy', '_bx_groups_menu_item_title_system_sm_privacy', '_bx_groups_menu_item_title_sm_privacy', '', '', '', '', '', 2147483647, 1, 0, 1, 1),
-('bx_groups_snippet_meta', 'bx_groups', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, 0, 0, 1, 2),
-('bx_groups_snippet_meta', 'bx_groups', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, 0, 0, 1, 3),
-('bx_groups_snippet_meta', 'bx_groups', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, 0, 0, 1, 4),
-('bx_groups_snippet_meta', 'bx_groups', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, 0, 0, 1, 5),
-('bx_groups_snippet_meta', 'bx_groups', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, 1, 0, 1, 6),
-('bx_groups_snippet_meta', 'bx_groups', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, 0, 0, 1, 7),
-('bx_groups_snippet_meta', 'bx_groups', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, 1, 0, 1, 8),
-('bx_groups_snippet_meta', 'bx_groups', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 1, 0, 1, 9),
-('bx_groups_snippet_meta', 'bx_groups', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, 0, 0, 1, 10),
-('bx_groups_snippet_meta', 'bx_groups', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 11),
-('bx_groups_snippet_meta', 'bx_groups', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 12);
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `visibility_custom`, `active`, `copyable`, `editable`, `order`) VALUES
+('bx_groups_snippet_meta', 'bx_groups', 'privacy', '_bx_groups_menu_item_title_system_sm_privacy', '_bx_groups_menu_item_title_sm_privacy', '', '', '', '', '', 2147483647, '', 1, 0, 1, 1),
+('bx_groups_snippet_meta', 'bx_groups', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, '', 0, 0, 1, 2),
+('bx_groups_snippet_meta', 'bx_groups', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, '', 0, 0, 1, 3),
+('bx_groups_snippet_meta', 'bx_groups', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, '', 0, 0, 1, 4),
+('bx_groups_snippet_meta', 'bx_groups', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, '', 0, 0, 1, 5),
+('bx_groups_snippet_meta', 'bx_groups', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, '', 1, 0, 1, 6),
+('bx_groups_snippet_meta', 'bx_groups', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, '', 0, 0, 1, 7),
+('bx_groups_snippet_meta', 'bx_groups', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, '', 1, 0, 1, 8),
+('bx_groups_snippet_meta', 'bx_groups', 'join-paid', '_sys_menu_item_title_system_sm_join_paid', '_sys_menu_item_title_sm_join_paid', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:33:"is_paid_join_avaliable_by_content";s:6:"params";a:1:{i:0;s:12:"{content_id}";}}', 1, 0, 1, 9),
+('bx_groups_snippet_meta', 'bx_groups', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:9:"bx_groups";s:6:"method";s:33:"is_free_join_avaliable_by_content";s:6:"params";a:1:{i:0;s:12:"{content_id}";}}', 1, 0, 1, 10),
+('bx_groups_snippet_meta', 'bx_groups', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, '', 0, 0, 1, 12),
+('bx_groups_snippet_meta', 'bx_groups', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 13),
+('bx_groups_snippet_meta', 'bx_groups', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 14);
 
 -- MENU: profile stats
 SET @iNotifMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name` = 'sys_profile_stats' AND `active` = 1 LIMIT 1);
@@ -460,7 +478,9 @@ INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `fie
 INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `params`, `order`) VALUES
 ('bx_groups_fans', 'name', '_sys_name', '50%', '', 10),
 ('bx_groups_fans', 'role', '_bx_groups_txt_role', '10%', '', 15),
-('bx_groups_fans', 'actions', '', '40%', '', 20);
+('bx_groups_fans', 'role_added', '_bx_groups_txt_role_added', '10%', '', 16),
+('bx_groups_fans', 'role_expired', '_bx_groups_txt_role_expired', '10%', '', 17),
+('bx_groups_fans', 'actions', '', '20%', '', 20);
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `confirm`, `order`) VALUES
 ('bx_groups_fans', 'single', 'accept', '_sys_accept', '', 0, 10),
@@ -511,6 +531,34 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_groups_common', 'bulk', 'delete_with_content', '_bx_groups_grid_action_title_adm_delete_with_content', '', 0, 1, 2),
 ('bx_groups_common', 'single', 'settings', '_bx_groups_grid_action_title_adm_more_actions', 'cog', 1, 0, 1);
 
+-- GRIDS: Pricing
+INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `visible_for_levels`, `override_class_name`, `override_class_file`) VALUES
+('bx_groups_prices_manage', 'Sql', 'SELECT * FROM `bx_groups_prices` WHERE 1 ', 'bx_groups_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxGroupsGridPricesManage', 'modules/boonex/groups/classes/BxGroupsGridPricesManage.php'),
+('bx_groups_prices_view', 'Sql', 'SELECT * FROM `bx_groups_prices` WHERE 1 ', 'bx_groups_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxGroupsGridPricesView', 'modules/boonex/groups/classes/BxGroupsGridPricesView.php');
+
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('bx_groups_prices_manage', 'checkbox', '_sys_select', '1%', 0, '', '', 1),
+('bx_groups_prices_manage', 'order', '', '1%', 0, '', '', 2),
+('bx_groups_prices_manage', 'name', '_bx_groups_grid_column_title_name', '38%', 0, 32, '', 3),
+('bx_groups_prices_manage', 'price', '_bx_groups_grid_column_title_price', '20%', 0, 16, '', 4),
+('bx_groups_prices_manage', 'period', '_bx_groups_grid_column_title_period', '20%', 0, 16, '', 5),
+('bx_groups_prices_manage', 'actions', '', '20%', 0, '', '', 6),
+
+('bx_groups_prices_view', 'role_id', '_bx_groups_grid_column_title_role_id', '40%', 0, 32, '', 1),
+('bx_groups_prices_view', 'price', '_bx_groups_grid_column_title_price', '20%', 0, 16, '', 2),
+('bx_groups_prices_view', 'period', '_bx_groups_grid_column_title_period', '20%', 0, 16, '', 3),
+('bx_groups_prices_view', 'actions', '', '20%', 0, '', '', 4);
+
+INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
+('bx_groups_prices_manage', 'independent', 'add', '_bx_groups_grid_action_title_add', '', 0, 0, 1),
+('bx_groups_prices_manage', 'single', 'edit', '_bx_groups_grid_action_title_edit', 'pencil-alt', 1, 0, 1),
+('bx_groups_prices_manage', 'single', 'delete', '_bx_groups_grid_action_title_delete', 'remove', 1, 1, 2),
+('bx_groups_prices_manage', 'bulk', 'delete', '_bx_groups_grid_action_title_delete', '', 0, 1, 1),
+
+('bx_groups_prices_view', 'single', 'buy', '_bx_groups_grid_action_title_buy', 'cart-plus', 0, 0, 1),
+('bx_groups_prices_view', 'single', 'subscribe', '_bx_groups_grid_action_title_subscribe', 'credit-card', 0, 0, 2),
+('bx_groups_prices_view', 'single', 'choose', '_bx_groups_grid_action_title_choose', 'far check-square', 0, 0, 3);
+
 
 -- ALERTS
 
@@ -565,3 +613,7 @@ INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `
 ('bx_groups_cover_crop', 1, 'BxGroupsUploaderCoverCrop', 'modules/boonex/groups/classes/BxGroupsUploaderCoverCrop.php'),
 ('bx_groups_picture_crop', 1, 'BxGroupsUploaderPictureCrop', 'modules/boonex/groups/classes/BxGroupsUploaderPictureCrop.php');
 
+
+-- CRON
+INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
+('bx_groups_pruning', '0 0 * * *', 'BxGroupsCronPruning', 'modules/boonex/groups/classes/BxGroupsCronPruning.php', '');

+ 64 - 0
modules/boonex/groups/install/sql/install.sql

@@ -194,6 +194,9 @@ CREATE TABLE IF NOT EXISTS `bx_groups_admins` (
   `group_profile_id` int(10) unsigned NOT NULL,
   `fan_id` int(10) unsigned NOT NULL,
   `role` int(10) unsigned NOT NULL default '0',
+  `order` varchar(32) NOT NULL default '',
+  `added` int(11) unsigned NOT NULL default '0',
+  `expired` int(11) unsigned NOT NULL default '0',
   PRIMARY KEY (`id`),
   UNIQUE KEY `admin` (`group_profile_id`,`fan_id`)
 );
@@ -235,6 +238,20 @@ CREATE TABLE IF NOT EXISTS `bx_groups_invites` (
   PRIMARY KEY (`id`)
 );
 
+-- TABLE: Pricing
+CREATE TABLE IF NOT EXISTS `bx_groups_prices` (
+  `id` int(11) NOT NULL auto_increment,
+  `profile_id` int(11) NOT NULL default '0',
+  `role_id` int(11) unsigned NOT NULL default '0',
+  `name` varchar(128) NOT NULL default '',
+  `period` int(11) unsigned NOT NULL default '1',
+  `period_unit` varchar(32) NOT NULL default '',
+  `price` float unsigned NOT NULL default '1',
+  `order` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `name` (`name`),
+  UNIQUE KEY `type` (`profile_id`, `role_id`,`period`, `period_unit`)
+);
 
 -- STORAGES & TRANSCODERS
 INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
@@ -325,6 +342,43 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_group_view_full', 'group_cat', 2147483647, 1, 2),
 ('bx_group_view_full', 'group_desc', 2147483647, 1, 3);
 
+-- FORMS: Price
+INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
+('bx_groups_price', 'bx_groups', '_bx_groups_form_price', '', '', 'do_submit', 'bx_groups_prices', 'id', '', '', '', 0, 1, '', '');
+
+INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
+('bx_groups_price_add', 'bx_groups', 'bx_groups_price', '_bx_groups_form_price_display_add', 0),
+('bx_groups_price_edit', 'bx_groups', 'bx_groups_price', '_bx_groups_form_price_display_edit', 0);
+
+INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
+('bx_groups_price', 'bx_groups', 'id', '', '', 0, 'hidden', '_bx_groups_form_price_input_sys_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_groups_price', 'bx_groups', 'role_id', '', '', 0, 'hidden', '_bx_groups_form_price_input_sys_role_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_groups_price', 'bx_groups', 'period', '', '', 0, 'text', '_bx_groups_form_price_input_sys_period', '_bx_groups_form_price_input_period', '_bx_groups_form_price_input_inf_period', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_groups_price', 'bx_groups', 'period_unit', '', '#!bx_groups_period_units', 0, 'select', '_bx_groups_form_price_input_sys_period_unit', '_bx_groups_form_price_input_period_unit', '_bx_groups_form_price_input_inf_period_unit', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
+('bx_groups_price', 'bx_groups', 'price', '', '', 0, 'text', '_bx_groups_form_price_input_sys_price', '_bx_groups_form_price_input_price', '_bx_groups_form_price_input_inf_price', 1, 0, 0, '', '', '', '', '', '', 'Float', '', 1, 0),
+('bx_groups_price', 'bx_groups', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_groups_price', 'bx_groups', 'do_submit', '_bx_groups_form_price_input_do_submit', '', 0, 'submit', '_bx_groups_form_price_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_groups_price', 'bx_groups', 'do_cancel', '_bx_groups_form_price_input_do_cancel', '', 0, 'button', '_bx_groups_form_price_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0);
+
+INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
+('bx_groups_price_add', 'id', 2147483647, 0, 1),
+('bx_groups_price_add', 'role_id', 2147483647, 1, 2),
+('bx_groups_price_add', 'price', 2147483647, 1, 3),
+('bx_groups_price_add', 'period', 2147483647, 1, 4),
+('bx_groups_price_add', 'period_unit', 2147483647, 1, 5),
+('bx_groups_price_add', 'controls', 2147483647, 1, 6),
+('bx_groups_price_add', 'do_submit', 2147483647, 1, 7),
+('bx_groups_price_add', 'do_cancel', 2147483647, 1, 8),
+
+('bx_groups_price_edit', 'id', 2147483647, 1, 1),
+('bx_groups_price_edit', 'role_id', 2147483647, 1, 2),
+('bx_groups_price_edit', 'price', 2147483647, 1, 3),
+('bx_groups_price_edit', 'period', 2147483647, 1, 4),
+('bx_groups_price_edit', 'period_unit', 2147483647, 1, 5),
+('bx_groups_price_edit', 'controls', 2147483647, 1, 6),
+('bx_groups_price_edit', 'do_submit', 2147483647, 1, 7),
+('bx_groups_price_edit', 'do_cancel', 2147483647, 1, 8);
+
 -- PRE-VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
 ('bx_groups_cats', '_bx_groups_pre_lists_cats', 'bx_groups', '0');
@@ -346,6 +400,16 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALU
 ('bx_groups_roles', '1', 2, '_bx_groups_role_administrator', ''),
 ('bx_groups_roles', '2', 3, '_bx_groups_role_moderator', '');
 
+INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
+('bx_groups_period_units', '_bx_groups_pre_lists_period_units', 'bx_groups', '0');
+
+INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
+('bx_groups_period_units', '', 0, '_sys_please_select', ''),
+('bx_groups_period_units', 'day', 1, '_bx_groups_period_unit_day', ''),
+('bx_groups_period_units', 'week', 2, '_bx_groups_period_unit_week', ''),
+('bx_groups_period_units', 'month', 3, '_bx_groups_period_unit_month', ''),
+('bx_groups_period_units', 'year', 4, '_bx_groups_period_unit_year', '');
+
 -- COMMENTS
 INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Html`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `BaseUrl`, `ObjectVote`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldTitle`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
 ('bx_groups', 'bx_groups', 'bx_groups_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-group-profile&id={object_id}', '', 'bx_groups_data', 'id', 'author', 'group_name', 'comments', '', ''),

+ 2 - 2
modules/boonex/groups/install/sql/uninstall.sql

@@ -1,7 +1,7 @@
 
 -- TABLES
 
-DROP TABLE IF EXISTS `bx_groups_data`, `bx_groups_pics`, `bx_groups_pics_resized`, `bx_groups_cmts`, `bx_groups_cmts_notes`, `bx_groups_views_track`, `bx_groups_meta_keywords`, `bx_groups_meta_locations`, `bx_groups_meta_mentions`, `bx_groups_fans`, `bx_groups_admins`, `bx_groups_votes`, `bx_groups_votes_track`, `bx_groups_reports`, `bx_groups_reports_track`, `bx_groups_favorites_track`, `bx_groups_scores`, `bx_groups_scores_track`, `bx_groups_invites`;
+DROP TABLE IF EXISTS `bx_groups_data`, `bx_groups_pics`, `bx_groups_pics_resized`, `bx_groups_cmts`, `bx_groups_cmts_notes`, `bx_groups_views_track`, `bx_groups_meta_keywords`, `bx_groups_meta_locations`, `bx_groups_meta_mentions`, `bx_groups_fans`, `bx_groups_admins`, `bx_groups_votes`, `bx_groups_votes_track`, `bx_groups_reports`, `bx_groups_reports_track`, `bx_groups_favorites_track`, `bx_groups_scores`, `bx_groups_scores_track`, `bx_groups_invites`, `bx_groups_prices`;
 
 -- PROFILES
 
@@ -21,7 +21,7 @@ DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_group
 DELETE FROM `sys_objects_form` WHERE `module` = 'bx_groups';
 DELETE FROM `sys_form_displays` WHERE `module` = 'bx_groups';
 DELETE FROM `sys_form_inputs` WHERE `module` = 'bx_groups';
-DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_group_add', 'bx_group_delete', 'bx_group_edit', 'bx_group_edit_cover', 'bx_group_view', 'bx_group_view_full', 'bx_group_invite');
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_group_add', 'bx_group_delete', 'bx_group_edit', 'bx_group_edit_cover', 'bx_group_view', 'bx_group_view_full', 'bx_group_invite', 'bx_groups_price_add', 'bx_groups_price_edit');
 
 -- PRE-VALUES
 

+ 33 - 0
modules/boonex/groups/js/prices.js

@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Groups Groups
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+
+function BxGroupsPrices(oOptions) {
+    this._sActionsUri = oOptions.sActionUri;
+    this._sActionsUrl = oOptions.sActionUrl;
+    this._sObjNameGrid = oOptions.sObjNameGrid;
+    this._sObjName = oOptions.sObjName == undefined ? 'oBxGroupsPrices' : oOptions.sObjName;
+    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
+    this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
+}
+
+BxGroupsPrices.prototype.onChangeRole = function() {
+	this.reloadGrid($('#bx-grid-level-' + this._sObjNameGrid).val());
+};
+
+BxGroupsPrices.prototype.reloadGrid = function(iRoleId) {
+    if(glGrids[this._sObjNameGrid]._oQueryAppend['role_id'] == iRoleId)
+        return;
+
+    glGrids[this._sObjNameGrid]._oQueryAppend['role_id'] = iRoleId;
+    glGrids[this._sObjNameGrid].reload(0);
+};
+
+/** @} */

+ 17 - 0
modules/boonex/groups/template/css/prices.css

@@ -0,0 +1,17 @@
+/*--- Top Controls ---*/
+div.bx-grid-header div.bx-form-element-wrapper {
+    position: relative;
+    float: left;
+}
+
+div.bx-grid-header div#bx-form-element-role {
+    margin-right: 20px;
+}
+div.bx-grid-header div#bx-form-element-role,
+div.bx-grid-header div#bx-form-element-keyword {
+    margin-top: 0px;
+}
+
+/*--- Add Price Popup ---*/
+div.bx-groups-pricing-form {}
+div.bx-groups-pricing-form-cnt {}

+ 1 - 0
modules/boonex/groups/template/popup_price.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/groups/template/popup_price.html />

+ 66 - 2
modules/boonex/russian/data/langs/bx_groups/ru.xml

@@ -8,6 +8,7 @@
 	<string name="_bx_groups_option_per_page_browse"><![CDATA[Количество элементов на странице]]></string>
     <string name="_bx_groups_option_num_rss"><![CDATA[Количество элементов в ленте RSS]]></string>
     <string name="_bx_groups_option_searchable_fields"><![CDATA[Поля для поиска]]></string>
+    <string name="_bx_groups_option_enable_paid_join"><![CDATA[Активировать 'Платное присоединение']]></string>
 
 	<string name="_bx_groups_form_profile"><![CDATA[Группы]]></string>
 	<string name="_bx_groups_form_profile_display_add"><![CDATA[Добавление группы]]></string>
@@ -46,6 +47,26 @@
 	<string name="_bx_groups_form_profile_input_delete_confirm_info"><![CDATA[Это действие не может быть отменено.]]></string>
 	<string name="_bx_groups_form_profile_input_delete_confirm_error"><![CDATA[Пожалуйста, отметьте этот флажок, если действительно хотите удалить группу.]]></string>
 
+    <string name="_bx_groups_form_price"><![CDATA[Цена]]></string>
+    <string name="_bx_groups_form_price_display_add"><![CDATA[Добавление]]></string>
+    <string name="_bx_groups_form_price_display_edit"><![CDATA[Редактирование]]></string>
+    <string name="_bx_groups_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_groups_form_price_input_sys_role_id"><![CDATA[ID роли]]></string>
+    <string name="_bx_groups_form_price_input_sys_period"><![CDATA[Период]]></string>
+    <string name="_bx_groups_form_price_input_period"><![CDATA[Период]]></string>
+    <string name="_bx_groups_form_price_input_inf_period"><![CDATA[Используйте 0 для пожизненного]]></string>
+    <string name="_bx_groups_form_price_input_sys_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_groups_form_price_input_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_groups_form_price_input_inf_period_unit"><![CDATA[Оставьте пустым для пожизненного уровня.]]></string>
+    <string name="_bx_groups_form_price_input_err_period_unit"><![CDATA[Здесь Вам необходимо выбрать единицу измерения периода.]]></string>
+    <string name="_bx_groups_form_price_input_sys_price"><![CDATA[Цена]]></string>
+    <string name="_bx_groups_form_price_input_price"><![CDATA[Цена]]></string>
+    <string name="_bx_groups_form_price_input_inf_price"><![CDATA[Введите 0 или оставьте пустым для создания бесплатного уровня.]]></string>
+    <string name="_bx_groups_form_price_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_groups_form_price_input_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_groups_form_price_input_sys_do_cancel"><![CDATA[Отменить]]></string>
+    <string name="_bx_groups_form_price_input_do_cancel"><![CDATA[Отменить]]></string>
+
 	<string name="_bx_groups_acl_action_create_profile"><![CDATA[Создать группу]]></string>
 	<string name="_bx_groups_acl_action_delete_profile"><![CDATA[Удалить группу]]></string>
 	<string name="_bx_groups_acl_action_view_profile"><![CDATA[Просмотреть группу]]></string>
@@ -62,6 +83,8 @@
 	<string name="_bx_groups_page_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>
 	<string name="_bx_groups_page_title_sys_delete_profile"><![CDATA[Удалить группу]]></string>
 	<string name="_bx_groups_page_title_delete_profile"><![CDATA[Удалить группу]]></string>
+        <string name="_bx_groups_page_title_sys_join_profile"><![CDATA[Присоединиться к группе]]></string>
+	<string name="_bx_groups_page_title_join_profile"><![CDATA[Присоединиться к группе]]></string>
 	<string name="_bx_groups_page_title_sys_view_profile_closed"><![CDATA[Просмотр закрытой группы]]></string>
 	<string name="_bx_groups_page_title_sys_view_profile"><![CDATA[Просмотр группы]]></string>
 	<string name="_bx_groups_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -80,6 +103,8 @@
     <string name="_bx_groups_page_title_profile_comments"><![CDATA[Комментарии]]></string>
 	<string name="_bx_groups_page_title_sys_profile_info"><![CDATA[Инфо группы]]></string>
 	<string name="_bx_groups_page_title_profile_info"><![CDATA[Инфо о {display_name}]]></string>
+        <string name="_bx_groups_page_title_sys_profile_pricing"><![CDATA[Цены]]></string>
+	<string name="_bx_groups_page_title_profile_pricing"><![CDATA[Цены]]></string>
 	<string name="_bx_groups_page_title_sys_recent"><![CDATA[Новые группы]]></string>
 	<string name="_bx_groups_page_title_recent"><![CDATA[Новые группы]]></string>
 	<string name="_bx_groups_page_title_sys_manage"><![CDATA[Управление собственными группами]]></string>
@@ -104,9 +129,13 @@
 	<string name="_bx_groups_page_block_title_edit_profile"><![CDATA[Редактировать группу]]></string>
 	<string name="_bx_groups_page_block_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>
 	<string name="_bx_groups_page_block_title_delete_profile"><![CDATA[Удалить группу]]></string>
+        <string name="_bx_groups_page_block_title_join_profile"><![CDATA[Присоединиться к группе]]></string>
 	<string name="_bx_groups_page_block_title_profile_info_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Инфо]]></string>
 	<string name="_bx_groups_page_block_title_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_groups_page_block_title_system_profile_info"><![CDATA[Инфо]]></string>
+        <string name="_bx_groups_page_block_title_system_profile_pricing"><![CDATA[Цены]]></string>
+        <string name="_bx_groups_page_block_title_profile_pricing"><![CDATA[Цены]]></string>
+        <string name="_bx_groups_page_block_title_profile_pricing_link"><![CDATA[Расценки группы: <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_groups_page_block_title_profile_description"><![CDATA[Описание]]></string>
 	<string name="_bx_groups_page_block_title_profile_friends_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Друзья]]></string>
 	<string name="_bx_groups_page_block_title_profile_friends"><![CDATA[Друзья]]></string>
@@ -166,6 +195,8 @@
     <string name="_bx_groups_menu_item_title_delete_with_content"><![CDATA[Удалить вместе с содержимым]]></string>
     <string name="_bx_groups_menu_item_title_system_edit_cover"><![CDATA[Редактировать обложку]]></string>
     <string name="_bx_groups_menu_item_title_edit_cover"><![CDATA[Редактировать обложку]]></string>
+    <string name="_bx_groups_menu_item_title_system_edit_pricing"><![CDATA[Редактировать цены]]></string>
+    <string name="_bx_groups_menu_item_title_edit_pricing"><![CDATA[Редактировать цены]]></string>
     <string name="_bx_groups_menu_item_title_system_edit_profile"><![CDATA[Редактировать группу]]></string>
     <string name="_bx_groups_menu_item_title_edit_profile"><![CDATA[Редактировать группу]]></string>
     <string name="_bx_groups_menu_item_title_system_delete_profile"><![CDATA[Удалить группу]]></string>
@@ -211,6 +242,9 @@
     <string name="_bx_groups_menu_item_title_leave_group_cancel_request"><![CDATA[Отменить присоединение]]></string>
     <string name="_bx_groups_menu_item_title_leave_group_reject_request"><![CDATA[Отвергнуть присоединение]]></string>
 
+    <string name="_bx_groups_menu_item_title_system_pay_and_join"><![CDATA[Оплатить и присоединиться]]></string>
+    <string name="_bx_groups_menu_item_title_pay_and_join"><![CDATA[Оплатить и присоединиться]]></string>
+
     <string name="_bx_groups_menu_item_title_system_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_groups_menu_item_title_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_groups_menu_item_title_system_unsubscribe"><![CDATA[Отключить уведомления]]></string>
@@ -254,8 +288,24 @@
     <string name="_bx_groups_grid_action_title_adm_audit_context"><![CDATA[Аудит действий в контексте]]></string>
     <string name="_bx_groups_grid_action_title_adm_audit_content"><![CDATA[Аудит действий над контентом]]></string>
   
-	<string name="_bx_groups_grid_action_err_delete"><![CDATA[Невозможно удалить выбранную(ные) группу(ы).]]></string>
-	<string name="_bx_groups_grid_txt_account_manager"><![CDATA[Перенаправить в управление аккаунтом.]]></string>
+    <string name="_bx_groups_grid_action_err_delete"><![CDATA[Невозможно удалить выбранную(ные) группу(ы).]]></string>
+    <string name="_bx_groups_grid_txt_account_manager"><![CDATA[Перенаправить в управление аккаунтом.]]></string>
+
+    <string name="_bx_groups_grid_column_title_name"><![CDATA[Название]]></string>
+    <string name="_bx_groups_grid_column_title_role_id"><![CDATA[Роль]]></string>
+    <string name="_bx_groups_grid_column_title_period"><![CDATA[Период]]></string>
+    <string name="_bx_groups_grid_column_title_price"><![CDATA[Цена]]></string>
+    <string name="_bx_groups_grid_action_title_add"><![CDATA[Добавить]]></string>
+    <string name="_bx_groups_grid_action_title_edit"><![CDATA[Изменить]]></string>
+    <string name="_bx_groups_grid_action_title_delete"><![CDATA[Удалить]]></string>
+    <string name="_bx_groups_grid_action_title_buy"><![CDATA[Купить]]></string>
+    <string name="_bx_groups_grid_action_title_buy_title"><![CDATA[Единовременный платеж]]></string>
+    <string name="_bx_groups_grid_action_title_subscribe"><![CDATA[Арендовать]]></string>
+    <string name="_bx_groups_grid_action_title_subscribe_title"><![CDATA[Подписка на периодические платежи]]></string>
+    <string name="_bx_groups_grid_action_title_choose"><![CDATA[Выбирать]]></string>
+    <string name="_bx_groups_grid_action_title_choose_title"><![CDATA[Бесплатно переключиться на уровень]]></string>
+    <string name="_bx_groups_popup_title_price_add"><![CDATA[Добавить ценовой план]]></string>
+    <string name="_bx_groups_popup_title_price_edit"><![CDATA[Редактировать ценовой план]]></string>
 
     <string name="_bx_groups_chart_growth"><![CDATA[Группы: Развитие]]></string>
     <string name="_bx_groups_chart_growth_speed"><![CDATA[Группы: Скорость развития]]></string>
@@ -267,6 +317,8 @@
     <string name="_bx_groups_txt_account_suspended"><![CDATA[Эта группа заблокирована.]]></string>
     <string name="_bx_groups_txt_N_fans"><![CDATA[{0} участников]]></string>
     <string name="_bx_groups_txt_role"><![CDATA[Роль]]></string>
+    <string name="_bx_groups_txt_role_added"><![CDATA[Начало]]></string>
+    <string name="_bx_groups_txt_role_expired"><![CDATA[Окончание]]></string>
     <string name="_bx_groups_txt_sample_single"><![CDATA[группа]]></string>
     <string name="_bx_groups_txt_sample_single_with_article"><![CDATA[группа]]></string>
     <string name="_bx_groups_txt_sample_comment_single"><![CDATA[комментарий к группе]]></string>
@@ -281,6 +333,12 @@
     <string name="_bx_groups_txt_invite_popup_button_decline"><![CDATA[Отклонить]]></string>
     <string name="_bx_groups_txt_invite_popup_error_invitation_absent"><![CDATA[Извините, произошла ошибка. Вы не можете вступить в эту группу. Приглашение устарело или удалено.]]></string>
     <string name="_bx_groups_txt_invite_popup_error_invitation_wrong_user"><![CDATA[Извините, произошла ошибка. Вы не можете вступить в эту группу. Приглашение адресовано не Вам.]]></string>
+    <string name="_bx_groups_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_groups_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_groups_msg_performed"><![CDATA[Действие было успешно выполнено.]]></string>
+    <string name="_bx_groups_err_price_duplicate"><![CDATA[Аналогичный ценовой план уже существует.]]></string>
+    <string name="_bx_groups_err_cannot_perform"><![CDATA[Невозможно выполнить действие. Пожалуйста, оповестите нас об этой проблеме.]]></string>
 
     <string name="_bx_groups_alert_action_fan_added"><![CDATA[присоединение нового участника]]></string>
     <string name="_bx_groups_txt_ntfs_fan_added"><![CDATA[В группу <b class="bx-ntfs-content-profile">{owner_name}</b> вступил <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
@@ -301,6 +359,12 @@
     <string name="_bx_groups_role_administrator"><![CDATA[Администратор]]></string>
     <string name="_bx_groups_role_moderator"><![CDATA[Модератор]]></string>
 
+    <string name="_bx_groups_pre_lists_period_units"><![CDATA[Платежный интервал]]></string>
+    <string name="_bx_groups_period_unit_day"><![CDATA[день]]></string>
+    <string name="_bx_groups_period_unit_week"><![CDATA[неделя]]></string>
+    <string name="_bx_groups_period_unit_month"><![CDATA[месяц]]></string>
+    <string name="_bx_groups_period_unit_year"><![CDATA[год]]></string>
+
     <string name="_bx_groups_email_join_request"><![CDATA[Запрос на присоединение к группе]]></string>
     <string name="_bx_groups_email_join_request_subject"><![CDATA[Запрос на присоединение к группе]]></string>
     <string name="_bx_groups_email_join_request_body"><![CDATA[{email_header}