فهرست منبع

Merge remote-tracking branch 'origin/master'

Alexander 5 سال پیش
والد
کامیت
be45859706
100فایلهای تغییر یافته به همراه2193 افزوده شده و 260 حذف شده
  1. 10 3
      inc/classes/BxDolCmtsQuery.php
  2. 4 0
      inc/classes/BxDolFavorite.php
  3. 5 3
      inc/classes/BxDolFavoriteQuery.php
  4. 1 1
      inc/classes/BxDolObjectQuery.php
  5. 3 1
      inc/classes/BxDolSearchExtended.php
  6. 16 0
      inc/classes/BxDolStorage.php
  7. 2 2
      inc/js/classes/BxDolVoteReactions.js
  8. 8 2
      inc/utils.inc.php
  9. 0 14
      modules/base/groups/classes/BxBaseModGroupsFormPrice.php
  10. 2 1
      modules/base/groups/classes/BxBaseModGroupsGridConnections.php
  11. 1 1
      modules/base/groups/classes/BxBaseModGroupsGridPrices.php
  12. 9 4
      modules/base/groups/classes/BxBaseModGroupsGridPricesManage.php
  13. 29 6
      modules/base/groups/classes/BxBaseModGroupsGridPricesView.php
  14. 35 15
      modules/base/groups/classes/BxBaseModGroupsModule.php
  15. 13 0
      modules/base/groups/template/css/prices.css
  16. 2 0
      modules/boonex/ads/classes/BxAdsConfig.php
  17. 4 0
      modules/boonex/ads/classes/BxAdsDb.php
  18. 1 1
      modules/boonex/ads/classes/BxAdsMenuView.php
  19. 23 16
      modules/boonex/ads/classes/BxAdsModule.php
  20. 28 2
      modules/boonex/courses/classes/BxCoursesConfig.php
  21. 22 0
      modules/boonex/courses/classes/BxCoursesCronPruning.php
  22. 22 0
      modules/boonex/courses/classes/BxCoursesFormPrice.php
  23. 22 0
      modules/boonex/courses/classes/BxCoursesGridPricesManage.php
  24. 22 0
      modules/boonex/courses/classes/BxCoursesGridPricesView.php
  25. 10 0
      modules/boonex/courses/classes/BxCoursesMenuViewActionsAll.php
  26. 24 0
      modules/boonex/courses/classes/BxCoursesPageListEntry.php
  27. 77 4
      modules/boonex/courses/install/langs/en.xml
  28. 8 5
      modules/boonex/courses/install/sql/disable.sql
  29. 98 25
      modules/boonex/courses/install/sql/enable.sql
  30. 79 2
      modules/boonex/courses/install/sql/install.sql
  31. 3 3
      modules/boonex/courses/install/sql/uninstall.sql
  32. 59 0
      modules/boonex/courses/js/prices.js
  33. 1 0
      modules/boonex/courses/template/css/prices.css
  34. 1 0
      modules/boonex/courses/template/favorite-list-info.html
  35. 1 0
      modules/boonex/courses/template/favorite-lists.html
  36. 1 0
      modules/boonex/courses/template/popup_price.html
  37. 1 0
      modules/boonex/english/data/langs/system/en.xml
  38. 23 3
      modules/boonex/events/classes/BxEventsConfig.php
  39. 22 0
      modules/boonex/events/classes/BxEventsCronPruning.php
  40. 22 0
      modules/boonex/events/classes/BxEventsFormPrice.php
  41. 22 0
      modules/boonex/events/classes/BxEventsGridPricesManage.php
  42. 22 0
      modules/boonex/events/classes/BxEventsGridPricesView.php
  43. 10 0
      modules/boonex/events/classes/BxEventsMenuViewActionsAll.php
  44. 67 1
      modules/boonex/events/install/langs/en.xml
  45. 5 5
      modules/boonex/events/install/sql/disable.sql
  46. 86 28
      modules/boonex/events/install/sql/enable.sql
  47. 67 0
      modules/boonex/events/install/sql/install.sql
  48. 2 2
      modules/boonex/events/install/sql/uninstall.sql
  49. 59 0
      modules/boonex/events/js/prices.js
  50. 1 0
      modules/boonex/events/template/css/prices.css
  51. 1 0
      modules/boonex/events/template/popup_price.html
  52. 1 2
      modules/boonex/groups/classes/BxGroupsConfig.php
  53. 1 2
      modules/boonex/groups/install/langs/en.xml
  54. 1 1
      modules/boonex/groups/install/sql/disable.sql
  55. 1 1
      modules/boonex/groups/install/sql/enable.sql
  56. 1 7
      modules/boonex/groups/template/css/main.css
  57. 1 17
      modules/boonex/groups/template/css/prices.css
  58. 0 0
      modules/boonex/lucid/install/sql/install.sql
  59. 2 2
      modules/boonex/market/install/sql/enable.sql
  60. 1 0
      modules/boonex/market/js/entry.js
  61. 26 6
      modules/boonex/organizations/classes/BxOrgsConfig.php
  62. 22 0
      modules/boonex/organizations/classes/BxOrgsCronPruning.php
  63. 22 0
      modules/boonex/organizations/classes/BxOrgsFormPrice.php
  64. 22 0
      modules/boonex/organizations/classes/BxOrgsGridPricesManage.php
  65. 30 0
      modules/boonex/organizations/classes/BxOrgsGridPricesView.php
  66. 10 0
      modules/boonex/organizations/classes/BxOrgsMenuViewActionsAll.php
  67. 67 0
      modules/boonex/organizations/install/langs/en.xml
  68. 4 1
      modules/boonex/organizations/install/sql/disable.sql
  69. 92 28
      modules/boonex/organizations/install/sql/enable.sql
  70. 66 0
      modules/boonex/organizations/install/sql/install.sql
  71. 2 2
      modules/boonex/organizations/install/sql/uninstall.sql
  72. 59 0
      modules/boonex/organizations/js/prices.js
  73. 1 0
      modules/boonex/organizations/template/css/prices.css
  74. 1 0
      modules/boonex/organizations/template/popup_price.html
  75. 3 1
      modules/boonex/payment/classes/BxPaymentGridSbsAdministration.php
  76. 4 0
      modules/boonex/protean/data/template/system/css/menu.less
  77. 78 3
      modules/boonex/russian/data/langs/bx_courses/ru.xml
  78. 1 1
      modules/boonex/russian/data/langs/bx_events/ru.xml
  79. 2 2
      modules/boonex/russian/data/langs/bx_groups/ru.xml
  80. 67 0
      modules/boonex/russian/data/langs/bx_organizations/ru.xml
  81. 1 0
      modules/boonex/russian/data/langs/bx_payment/ru.xml
  82. 75 1
      modules/boonex/russian/data/langs/bx_spaces/ru.xml
  83. 1 0
      modules/boonex/russian/data/langs/system/ru.xml
  84. 25 2
      modules/boonex/spaces/classes/BxSpacesConfig.php
  85. 22 0
      modules/boonex/spaces/classes/BxSpacesCronPruning.php
  86. 22 0
      modules/boonex/spaces/classes/BxSpacesFormPrice.php
  87. 22 0
      modules/boonex/spaces/classes/BxSpacesGridPricesManage.php
  88. 22 0
      modules/boonex/spaces/classes/BxSpacesGridPricesView.php
  89. 10 0
      modules/boonex/spaces/classes/BxSpacesMenuViewActionsAll.php
  90. 24 0
      modules/boonex/spaces/classes/BxSpacesPageListEntry.php
  91. 75 1
      modules/boonex/spaces/install/langs/en.xml
  92. 8 5
      modules/boonex/spaces/install/sql/disable.sql
  93. 96 21
      modules/boonex/spaces/install/sql/enable.sql
  94. 81 2
      modules/boonex/spaces/install/sql/install.sql
  95. 2 2
      modules/boonex/spaces/install/sql/uninstall.sql
  96. 59 0
      modules/boonex/spaces/js/prices.js
  97. 1 0
      modules/boonex/spaces/template/css/prices.css
  98. 1 0
      modules/boonex/spaces/template/favorite-list-info.html
  99. 1 0
      modules/boonex/spaces/template/favorite-lists.html
  100. 1 0
      modules/boonex/spaces/template/popup_price.html

+ 10 - 3
inc/classes/BxDolCmtsQuery.php

@@ -156,6 +156,11 @@ class BxDolCmtsQuery extends BxDolDb
 
     function getCommentsCountAll ($iId)
     {
+        $iCount = false;
+		bx_alert('comment', 'get_comments_count', 0, bx_get_logged_profile_id(), array('system' => $this->_oMain->getSystemInfo(), 'object_id' => $iId, 'result' => &$iCount));
+		if ($iCount !== false)
+			return $iCount;
+        
         if ($this->_sTriggerFieldComments) {
             $sQuery = $this->prepare("SELECT `{$this->_sTriggerFieldComments}` FROM `{$this->_sTriggerTable}` WHERE `{$this->_sTriggerFieldId}` = ?", $iId);
             return (int)$this->getOne($sQuery);
@@ -312,9 +317,11 @@ class BxDolCmtsQuery extends BxDolDb
                 `{$this->_sTableIds}`.`id` AS `cmt_unique_id`
                 $sFields
             FROM `{$this->_sTable}`
-            LEFT JOIN `{$this->_sTableIds}` ON (`{$this->_sTable}`.`cmt_id` = `{$this->_sTableIds}`.`cmt_id` AND `{$this->_sTableIds}`.`system_id` = :system_id)
-            $sJoin
-            WHERE `{$this->_sTable}`.`cmt_object_id` = :cmt_object_id" . $sWhereParent . $sWhereFilter . $sOrder . $sLimit;
+            LEFT JOIN `{$this->_sTableIds}` ON (`{$this->_sTable}`.`cmt_id` = `{$this->_sTableIds}`.`cmt_id` AND `{$this->_sTableIds}`.`system_id` = :system_id) ";
+           
+        bx_alert('comment', 'get_comments', 0, bx_get_logged_profile_id(), array('system' => $this->_oMain->getSystemInfo(), 'select_clause' => &$sQuery, 'join_clause' => &$sJoin, 'where_clause' => &$sWhereParent, 'order_clause' => &$sOrder, 'limit_clause' => &$sLimit)); 
+        $sQuery = $sQuery . $sJoin . " WHERE `{$this->_sTable}`.`cmt_object_id` = :cmt_object_id" . $sWhereParent . $sOrder . $sLimit;
+        
         return $this->getAll($sQuery, $aBindings);
     }
 

+ 4 - 0
inc/classes/BxDolFavorite.php

@@ -49,6 +49,10 @@ class BxDolFavorite extends BxDolObject
 {
     protected $_sBaseUrl;
 
+    protected $_sFormObject;
+    protected $_sFormDisplayAdd;
+    protected $_sFormDisplayListEdit;
+
     protected function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
     {
         parent::__construct($sSystem, $iId, $iInit, $oTemplate);

+ 5 - 3
inc/classes/BxDolFavoriteQuery.php

@@ -36,13 +36,15 @@ class BxDolFavoriteQuery extends BxDolObjectQuery
         if(!empty($iPerPage))
             $sLimitClause = $this->prepareAsString(" LIMIT ?, ?", $iStart, $iPerPage);
 
-        $sQuery = $this->prepare("SELECT `author_id` FROM `{$this->_sTableTrack}` WHERE `object_id`=? ORDER BY `date` DESC" . $sLimitClause, $iObjectId);
+        $sQuery = $this->prepare("SELECT DISTINCT `author_id` FROM `{$this->_sTableTrack}` WHERE `object_id`=? ORDER BY `date` DESC" . $sLimitClause, $iObjectId);
         return $this->getAll($sQuery);
     }
 
-	public function getFavorite($iObjectId)
+    public function getFavorite($iObjectId)
     {
-        return array('count' => $this->getObjectCount($iObjectId));
+        return $this->getRow("SELECT COUNT(DISTINCT `author_id`) AS `count` FROM `{$this->_sTableTrack}` WHERE `object_id`=:object_id LIMIT 1", array(
+            'object_id' => $iObjectId
+        ));
     }
 
     public function clearFavorite($iObjectId, $iAuthorId)

+ 1 - 1
inc/classes/BxDolObjectQuery.php

@@ -223,7 +223,7 @@ class BxDolObjectQuery extends BxDolDb
     /**
      * Is used instead of 'updateTriggerTable' when trigger table contains 
      * only one field related to this object (View, Vote, Comment, etc).
-     * For example, it's used in Favourite and Feature objects.
+     * For example, it's used in Favourite (simple mode w\o lists) and Feature objects.
      */
     public function updateTriggerTableValue($iObjectId, $iValue)
     {

+ 3 - 1
inc/classes/BxDolSearchExtended.php

@@ -12,7 +12,7 @@ bx_import('BxDolForm');
 class BxDolSearchExtended extends BxDolFactory implements iBxDolFactoryObject
 {
     public static $SEARCHABLE_TYPES = array(
-        'text', 'textarea', 'number', 
+        'text', 'textarea', 'number', 'slider',
         'select', 'radio_set',
         'checkbox_set', 'select_multiple',
         'checkbox', 'switcher',
@@ -24,6 +24,7 @@ class BxDolSearchExtended extends BxDolFactory implements iBxDolFactoryObject
         'text' => array('text', 'text_range'),
         'textarea' => array('text'),
         'number' => array('text'),
+        'slider' => array('text_range', 'text'),
         'text_auto' => array('text_auto'),
         'select' => array('checkbox_set', 'select_multiple', 'select'),
         'radio_set' => array('checkbox_set', 'select_multiple', 'select'),
@@ -40,6 +41,7 @@ class BxDolSearchExtended extends BxDolFactory implements iBxDolFactoryObject
         'text' => array('like', '=', 'between'),
         'textarea' => array('like', '='),
         'number' => array('='),
+        'slider' => array('between', '='),
         'text_auto' => array('in'),
         'select' => array('in'),
         'radio_set' => array('in'),

+ 16 - 0
inc/classes/BxDolStorage.php

@@ -659,6 +659,22 @@ abstract class BxDolStorage extends BxDolFactory implements iBxDolFactoryObject
         return true;
     }
 
+    /**
+     * Get file url.
+     * @param $sRemoteId file remote id
+     * @return file url or false on error
+     */
+    public function getFileUrlByRemoteId($sRemoteId)
+    {
+        $aFile = $this->_oDb->getFileByRemoteId($sRemoteId);
+        if (!$aFile) {
+            $this->setErrorCode(BX_DOL_STORAGE_ERR_FILE_NOT_FOUND);
+            return false;
+        }
+
+        return $this->getFileUrlById($aFile['id']);
+    }
+
     /**
      * Get file url.
      * @param $iFileId file id

+ 2 - 2
inc/js/classes/BxDolVoteReactions.js

@@ -54,6 +54,8 @@ BxDolVoteReactions.prototype.vote = function(oLink, iValue, sReaction, onComplet
     oParams['value'] = iValue;
     oParams['reaction'] = sReaction;
 
+    $('#' + this._aHtmlIds['do_popup']).dolPopupHide({});
+
     $.post(
     	this._sActionsUrl,
     	oParams,
@@ -75,8 +77,6 @@ BxDolVoteReactions.prototype.onVote = function (oLink, oData, onComplete)
 
     if(oData && oData.code != 0)
         return;
-    
-    $('#' + this._aHtmlIds['do_popup']).dolPopupHide({});
 
     oLink = $('.' + this._aHtmlIds['main'] + ' .' + this._sClassDo);
 

+ 8 - 2
inc/utils.inc.php

@@ -935,8 +935,14 @@ function bx_file_get_contents($sFileUrl, $aParams = array(), $sMethod = 'get', $
             curl_setopt($rConnect, CURLOPT_HTTPHEADER, $aHeaders);
 
         $sAllCookies = '';
-        foreach($_COOKIE as $sKey=>$sValue){
-            $sAllCookies .= $sKey . '=' . $sValue . ';';
+        foreach($_COOKIE as $sKey => $mValue){
+            if(is_array($mValue)){
+                foreach ($mValue as $k => $v)
+                    $sAllCookies .= "{$sKey}[{$k}]={$v};";
+            }
+            else{
+                $sAllCookies .= $sKey . '=' . $mValue . ';';
+            }
         }
         curl_setopt($rConnect, CURLOPT_COOKIE, $sAllCookies);
 

+ 0 - 14
modules/base/groups/classes/BxBaseModGroupsFormPrice.php

@@ -53,20 +53,6 @@ class BxBaseModGroupsFormPrice extends BxTemplFormView
         }
     }
 
-    public function getCode($bDynamicMode = false)
-    {
-    	$sJs = $this->_oModule->_oTemplate->addJs(array('prices.js'), $bDynamicMode);
-
-        $sCode = '';
-        if($bDynamicMode)
-            $sCode .= $sJs;
-
-        $sCode .= $this->_oModule->_oTemplate->getJsCode('prices');
-        $sCode .= parent::getCode($bDynamicMode);
-
-        return $sCode;
-    }
-
     public function insert ($aValsToAdd = array(), $isIgnore = false)
     {
         $CNF = &$this->_oModule->_oConfig->CNF;

+ 2 - 1
modules/base/groups/classes/BxBaseModGroupsGridConnections.php

@@ -115,7 +115,8 @@ class BxBaseModGroupsGridConnections extends BxDolGridConnections
         else
             $sPopupContent = $this->_oModule->_oTemplate->getPopupSetRole($this->_aRoles, $iId, $iRole);
 
-        return echoJson(array('popup' => BxTemplFunctions::getInstance()->transBox(str_replace('_', '-', $this->_sContentModule) . '-set-role-popup', $sPopupContent)));
+        $oFunctions = BxTemplFunctions::getInstance();
+        return echoJson(array('popup' => $oFunctions->transBox(str_replace('_', '-', $this->_sContentModule) . '-set-role-popup', $oFunctions->simpleBoxContent($sPopupContent))));
     }
 
     public function performActionSetRoleSubmit()

+ 1 - 1
modules/base/groups/classes/BxBaseModGroupsGridPrices.php

@@ -33,7 +33,7 @@ class BxBaseModGroupsGridPrices extends BxTemplGrid
         $CNF = $this->_oModule->_oConfig->CNF;
 
         $this->_aRoles = BxDolFormQuery::getDataItems($CNF['OBJECT_PRE_LIST_ROLES']);
-        $this->_aPeriodUnits = BxDolForm::getDataItems($CNF['OBJECT_FORM_PRELISTS_PERIOD_UNITS']);
+        $this->_aPeriodUnits = BxDolForm::getDataItems($CNF['OBJECT_PRE_LIST_PERIOD_UNITS']);
 
         $this->_iGroupProfileId = 0;
         $this->_iGroupContentId = 0;

+ 9 - 4
modules/base/groups/classes/BxBaseModGroupsGridPricesManage.php

@@ -38,10 +38,15 @@ class BxBaseModGroupsGridPricesManage extends BxBaseModGroupsGridPrices
         if(empty($sResult))
             return $sResult;
 
-        $sJsCode = $this->_oModule->_oTemplate->getJsCode('prices', array(
-            'sObjNameGrid' => $this->_sObject, 
-            'aHtmlIds' => $this->_oModule->_oConfig->getHtmlIds()
-        ));
+        $sJsCode = '';
+        if($isDisplayHeader) {
+            $this->_oModule->_oTemplate->addJs(array('prices.js'));
+
+            $sJsCode = $this->_oModule->_oTemplate->getJsCode('prices', array(
+                'sObjNameGrid' => $this->_sObject, 
+                'aHtmlIds' => $this->_oModule->_oConfig->getHtmlIds()
+            ));
+        }
 
         return $sJsCode . $sResult;
     }

+ 29 - 6
modules/base/groups/classes/BxBaseModGroupsGridPricesView.php

@@ -31,20 +31,43 @@ class BxBaseModGroupsGridPricesView extends BxBaseModGroupsGridPrices
     {
         parent::__construct ($aOptions, $oTemplate);
 
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
         $this->_aJsCodes = array();
+    }
+
+    public function setClientId($iClientId = 0)
+    {
+        $this->_iClient = $iClientId;
+        if(empty($this->_iClient))
+            $this->_iClient = bx_get_logged_profile_id();
+
+        $this->_iClientRole = 0;
+        if(!empty($this->_iGroupProfileId))
+            $this->_iClientRole = $this->_oModule->getRole($this->_iGroupProfileId, $this->_iClient);
+    }
 
-        $this->_oPayment = BxDolPayments::getInstance();
+    public function setSellerId($iSellerId = 0)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
 
-        $this->_iSeller = $this->_aGroupContentInfo[$CNF['FIELD_AUTHOR']];
-        $this->_iClient = bx_get_logged_profile_id();
-        $this->_iClientRole = $this->_oModule->getRole($this->_iGroupProfileId, $this->_iClient);
+        $this->_iSeller = $iSellerId;
+        if(empty($this->_iSeller) && !empty($this->_aGroupContentInfo) && is_array($this->_aGroupContentInfo))
+            $this->_iSeller = $this->_aGroupContentInfo[$CNF['FIELD_AUTHOR']];
+
+        if(empty($this->_oPayment))
+            $this->_oPayment = BxDolPayments::getInstance();
 
         $this->_bTypeSingle = $this->_oPayment->isAcceptingPayments($this->_iSeller, BX_PAYMENT_TYPE_SINGLE);
         $this->_bTypeRecurring = $this->_oPayment->isAcceptingPayments($this->_iSeller, BX_PAYMENT_TYPE_RECURRING);
     }
 
+    public function setProfileId($iProfileId)
+    {
+        parent::setProfileId($iProfileId);
+
+        $this->setClientId();
+        $this->setSellerId();
+    }
+
     public function performActionChoose()
     {
         $CNF = &$this->_oModule->_oConfig->CNF;

+ 35 - 15
modules/base/groups/classes/BxBaseModGroupsModule.php

@@ -642,46 +642,66 @@ class BxBaseModGroupsModule extends BxBaseModProfileModule
         return true;
     }
 
-    public function serviceIsPaidJoinAvaliable($iProfileId)
+    public function serviceIsPaidJoinAvaliable($iGroupProfileId, $iProfileId = 0)
     {
-        return $this->isPaidJoinByProfile($iProfileId);
+        return $this->isPaidJoinByProfileForProfile($iGroupProfileId, $iProfileId);
     }
 
-    public function serviceIsPaidJoinAvaliableByContent($iContentId)
+    public function serviceIsPaidJoinAvaliableByContent($iGroupContentId, $iProfileId = 0)
     {
-        $oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName());
-        if(!$oProfile)
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iGroupContentId, $this->getName());
+        if(!$oGroupProfile)
             return false;
 
-        return $this->isPaidJoinByProfile($oProfile->id());
+        return $this->isPaidJoinByProfileForProfile($oGroupProfile->id(), $iProfileId);
     }
 
-    public function serviceIsFreeJoinAvaliable($iProfileId)
+    public function serviceIsFreeJoinAvaliable($iGroupProfileId, $iProfileId = 0)
     {
-        return !$this->isPaidJoinByProfile($iProfileId);
+        return !$this->isPaidJoinByProfileForProfile($iGroupProfileId, $iProfileId);
     }
 
-    public function serviceIsFreeJoinAvaliableByContent($iContentId)
+    public function serviceIsFreeJoinAvaliableByContent($iGroupContentId, $iProfileId = 0)
     {
-        $oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $this->getName());
-        if(!$oProfile)
+        $oGroupProfile = BxDolProfile::getInstanceByContentAndType($iGroupContentId, $this->getName());
+        if(!$oGroupProfile)
+            return false;
+
+        return !$this->isPaidJoinByProfileForProfile($oGroupProfile->id(), $iProfileId);
+    }
+
+    /**
+     * Is Paid Join enabled in the group and whether a profile can use it.
+     * 
+     * @param type $iGroupProfileId - Group profile ID.
+     * @param type $iProfileId - Profile ID of the user who wants to join.
+     * @return boolean
+     */
+    public function isPaidJoinByProfileForProfile($iGroupProfileId, $iProfileId = 0)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        if(empty($iProfileId))
+            $iProfileId = $this->_iProfileId;
+
+        if(BxDolConnection::getObjectInstance($CNF['OBJECT_CONNECTIONS'])->isConnected($iProfileId, $iGroupProfileId))
             return false;
 
-        return !$this->isPaidJoinByProfile($oProfile->id());
+        return $this->isPaidJoinByProfile($iGroupProfileId);
     }
 
     /**
      * Is Paid Join enabled as is and whether a group has pricing plans added.
      * 
-     * @param type $iProfileId - Group profile ID.
+     * @param type $iGroupProfileId - Group profile ID.
      * @return boolean
      */
-    public function isPaidJoinByProfile($iProfileId)
+    public function isPaidJoinByProfile($iGroupProfileId)
     {
         if(!$this->_oConfig->isPaidJoin())
             return false;
 
-        $aPrices = $this->_oDb->getPrices(array('type' => 'by_profile_id', 'profile_id' => $iProfileId));
+        $aPrices = $this->_oDb->getPrices(array('type' => 'by_profile_id', 'profile_id' => $iGroupProfileId));
         if(empty($aPrices) || !is_array($aPrices))
             return false;
 

+ 13 - 0
modules/base/groups/template/css/prices.css

@@ -0,0 +1,13 @@
+/*--- 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;
+}

+ 2 - 0
modules/boonex/ads/classes/BxAdsConfig.php

@@ -9,6 +9,8 @@
  * @{
  */
 
+bx_import('BxDolInformer');
+
 class BxAdsConfig extends BxBaseModTextConfig
 {
     protected $_oDb;

+ 4 - 0
modules/boonex/ads/classes/BxAdsDb.php

@@ -154,6 +154,8 @@ class BxAdsDb extends BxBaseModTextDb
                 $sWhereClause = " AND `tc`.`parent_id`=:parent_id";
                 if(isset($aParams['with_content']) && $aParams['with_content'] === true)
                     $sWhereClause .= " AND `tc`.`items`>0";
+                if(isset($aParams['active']) && $aParams['active'] === true)
+                    $sWhereClause .= " AND `tc`.`active`=1";
                 break;
 
             case 'parent_id_count':
@@ -164,6 +166,8 @@ class BxAdsDb extends BxBaseModTextDb
 
                 $sSelectClause = "COUNT(`tc`.`id`)";
                 $sWhereClause = " AND `tc`.`parent_id`=:parent_id";
+                if(isset($aParams['active']) && $aParams['active'] === true)
+                    $sWhereClause .= " AND `tc`.`active`=1";
                 break;
         
             case 'parent_id_order':

+ 1 - 1
modules/boonex/ads/classes/BxAdsMenuView.php

@@ -75,7 +75,7 @@ class BxAdsMenuView extends BxBaseModTextMenuView
 
                 $bResult = true;
                 $this->addMarkers(array(
-                    'add_to_cart_title' => _t('_bx_market_menu_item_title_add_to_cart', $aCurrency['sign'], $this->_aContentInfo[$CNF['FIELD_PRICE']]),
+                    'add_to_cart_title' => _t('_bx_ads_menu_item_title_add_to_cart', $aCurrency['sign'], $this->_aContentInfo[$CNF['FIELD_PRICE']]),
                     'add_to_cart_onclick' => $sJsMethod
                 ));
                 break;

+ 23 - 16
modules/boonex/ads/classes/BxAdsModule.php

@@ -57,23 +57,10 @@ class BxAdsModule extends BxBaseModTextModule
     {
         $CNF = &$this->_oConfig->CNF;
 
-        $sName = '';
-
-    	$sTitle = bx_process_input(bx_get($CNF['FIELD_TITLE']));
-    	if(empty($sTitle))
-            return echoJson(array());
-
         $iId = (int)bx_get($CNF['FIELD_ID']);
-        if(!empty($iId)) {
-            $aEntry = $this->_oDb->getContentInfoById($iId); 
-            if(strcmp($sTitle, $aEntry[$CNF['FIELD_NAME']]) == 0) 
-                $sName = $sTitle;
-        }
+    	$sTitle = bx_process_input(bx_get($CNF['FIELD_TITLE']));
 
-    	echoJson(array(
-            'title' => $sTitle,
-            'name' => !empty($sName) ? $sName : $this->_oConfig->getEntryName($sTitle, $iId)
-    	));
+    	echoJson($this->serviceCheckName($sTitle, $iId));
     }
 
     public function actionInterested()
@@ -195,6 +182,26 @@ class BxAdsModule extends BxBaseModTextModule
         ));
     }
 
+    public function serviceCheckName($sTitle, $iId = 0)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+    	if(empty($sTitle))
+            return array();
+
+        $sName = '';
+        if(!empty($iId)) {
+            $aEntry = $this->_oDb->getContentInfoById($iId); 
+            if(strcmp($sTitle, $aEntry[$CNF['FIELD_NAME']]) == 0) 
+                $sName = $sTitle;
+        }
+
+        return array(
+            'title' => $sTitle,
+            'name' => !empty($sName) ? $sName : $this->_oConfig->getEntryName($sTitle, $iId)
+    	);
+    }
+
     public function serviceUpdateCategoriesStats()
     {
         $aStats = $this->_oDb->getCategories(array('type' => 'collect_stats'));
@@ -1230,7 +1237,7 @@ class BxAdsModule extends BxBaseModTextModule
 
     protected function _getCategoryOptions($iParentId, &$aValues)
     {
-        $aCategories = $this->_oDb->getCategories(array('type' => 'parent_id', 'parent_id' => $iParentId));
+        $aCategories = $this->_oDb->getCategories(array('type' => 'parent_id', 'parent_id' => $iParentId, 'active' => true));
         foreach($aCategories as $aCategory) {
             $aValues[] = array('key' => $aCategory['id'], 'value' => str_repeat('--', (int)$aCategory['level']) . ' ' . _t($aCategory['title']));
 

+ 28 - 2
modules/boonex/courses/classes/BxCoursesConfig.php

@@ -33,6 +33,7 @@ class BxCoursesConfig 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',
@@ -55,12 +56,17 @@ class BxCoursesConfig extends BxBaseModGroupsConfig
             'FIELD_LABELS' => 'labels',
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
+            'FIELD_PRICE_ROLE_ID' => 'role_id',
+            'FIELD_PRICE_NAME' => 'name',
+
             // page URIs
             'URI_VIEW_ENTRY' => 'view-course-profile',
             'URI_EDIT_ENTRY' => 'edit-course-profile',
             'URI_EDIT_COVER' => 'edit-course-cover',
+            'URI_JOIN_ENTRY' => 'join-course-profile',
             'URI_JOINED_ENTRIES' => 'joined-courses',
             'URI_MANAGE_COMMON' => 'courses-manage',
+            'URI_FAVORITES_LIST' => 'courses-favorites',
 
             'URL_HOME' => 'page.php?i=courses-home',
             'URL_ENTRY_FANS' => 'page.php?i=course-fans',
@@ -69,10 +75,15 @@ class BxCoursesConfig extends BxBaseModGroupsConfig
 
             'PARAM_NUM_RSS' => 'bx_courses_num_rss',
             'PARAM_NUM_CONNECTIONS_QUICK' => 'bx_courses_num_connections_quick',
+
             'PARAM_SEARCHABLE_FIELDS' => 'bx_courses_searchable_fields',
             'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_courses_per_page_browse_showcase',
             'PARAM_PER_PAGE_BROWSE_RECOMMENDED' => 'bx_courses_per_page_browse_recommended',
+
             'PARAM_MMODE' => 'bx_courses_members_mode',
+            'PARAM_PAID_JOIN_ENABLED' => true,
+            'PARAM_RECURRING_RESERVE' => 3, // 3 days for recurring payment to be registered
+            'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_courses_per_page_for_favorites_lists',
             'PARAM_USE_IN' => 'bx_courses_internal_notifications',
 
             // objects
@@ -103,6 +114,9 @@ class BxCoursesConfig extends BxBaseModGroupsConfig
             'OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER' => 'bx_course_edit_cover',
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_course_delete',
             'OBJECT_FORM_ENTRY_DISPLAY_INVITE' => 'bx_course_invite',
+            'OBJECT_FORM_PRICE' => 'bx_courses_price',
+            'OBJECT_FORM_PRICE_DISPLAY_ADD' => 'bx_courses_price_add',
+            'OBJECT_FORM_PRICE_DISPLAY_EDIT' => 'bx_courses_price_edit',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_courses_view_actions', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_courses_view_actions_more', // actions menu on view entry page for "more" popup
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_courses_view_actions_all', // all actions menu on view entry page
@@ -116,16 +130,20 @@ class BxCoursesConfig extends BxBaseModGroupsConfig
             'OBJECT_PAGE_VIEW_ENTRY' => 'bx_courses_view_profile',
             'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_courses_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_courses_allow_view_to',
+            'OBJECT_PRIVACY_LIST_VIEW' => 'bx_courses_allow_view_favorite_list',
             'OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT' => 'bx_courses_allow_view_notification_to',
             'OBJECT_PRIVACY_POST' => 'bx_courses_allow_post_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_courses_administration',
             'OBJECT_GRID_COMMON' => 'bx_courses_common',
             'OBJECT_GRID_CONNECTIONS' => 'bx_courses_fans',
             'OBJECT_GRID_INVITES' => 'bx_courses_invites',
+            'OBJECT_GRID_PRICES_MANAGE' => 'bx_courses_prices_manage',
+            'OBJECT_GRID_PRICES_VIEW' => 'bx_courses_prices_view',
             'OBJECT_CONNECTIONS' => 'bx_courses_fans',
             'OBJECT_UPLOADERS_COVER' => array('bx_courses_cover_crop'),
             'OBJECT_UPLOADERS_PICTURE' => array('bx_courses_picture_crop'),
             'OBJECT_PRE_LIST_ROLES' => 'bx_courses_roles',
+            'OBJECT_PRE_LIST_PERIOD_UNITS' => 'bx_courses_period_units',
 
             'BADGES_AVALIABLE' => true,
             
@@ -204,6 +222,12 @@ class BxCoursesConfig extends BxBaseModGroupsConfig
                 'txt_invitation_popup_decline_button' => '_bx_courses_txt_invite_popup_button_decline',
                 'txt_invitation_popup_error_invitation_absent' => '_bx_courses_txt_invite_popup_error_invitation_absent',
                 'txt_invitation_popup_error_wrong_user' => '_bx_courses_txt_invite_popup_error_invitation_wrong_user',
+                'txt_n_unit' => '_bx_courses_txt_n_unit',
+                'txt_buy_title' => '_bx_courses_grid_action_title_buy_title',
+                'txt_cart_item_title' => '_bx_courses_txt_cart_item_title',
+                'txt_subscribe_title' => '_bx_courses_grid_action_title_subscribe_title',
+                'msg_performed' => '_bx_courses_msg_performed',
+                'err_cannot_perform' => '_bx_courses_err_cannot_perform',
             ),
 
         );
@@ -211,13 +235,15 @@ class BxCoursesConfig extends BxBaseModGroupsConfig
         $this->_aJsClasses = array(
             'main' => 'BxCoursesMain',
             'manage_tools' => 'BxCoursesManageTools',
-            'invite_popup' => 'BxCoursesInvitePopup'
+            'invite_popup' => 'BxCoursesInvitePopup',
+            'prices' => 'BxCoursesPrices'
         );
 
         $this->_aJsObjects = array(
             'main' => 'oBxCoursesMain',
             'manage_tools' => 'oBxCoursesManageTools',
-            'invite_popup' => 'oBxCoursesInvitePopup'
+            'invite_popup' => 'oBxCoursesInvitePopup',
+            'prices' => 'oBxCoursesPrices'
         );
 
         $this->_aGridObjects = array(

+ 22 - 0
modules/boonex/courses/classes/BxCoursesCronPruning.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    Courses Courses
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxCoursesCronPruning extends BxBaseModCoursesCronPruning
+{
+    public function __construct()
+    {
+        $this->_sModule = 'bx_courses';
+
+        parent::__construct();
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/courses/classes/BxCoursesFormPrice.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    Courses Courses
+ * @ingroup     UnaModules
+ * 
+ * @{
+ */
+
+class BxCoursesFormPrice extends BxBaseModGroupsFormPrice
+{
+    public function __construct($aInfo, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_courses';
+
+        parent::__construct($aInfo, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/courses/classes/BxCoursesGridPricesManage.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    Courses Courses
+ * @ingroup     UnaModules
+ * 
+ * @{
+ */
+
+class BxCoursesGridPricesManage extends BxBaseModGroupsGridPricesManage
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_courses';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/courses/classes/BxCoursesGridPricesView.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    Courses Courses
+ * @ingroup     UnaModules
+ * 
+ * @{
+ */
+
+class BxCoursesGridPricesView extends BxBaseModGroupsGridPricesView
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_courses';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 10 - 0
modules/boonex/courses/classes/BxCoursesMenuViewActionsAll.php

@@ -21,6 +21,11 @@ class BxCoursesMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         parent::__construct($aObject, $oTemplate);
     }
 
+    protected function _getMenuItemJoinCourseProfile($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
     protected function _getMenuItemEditCourseCover($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);
@@ -31,6 +36,11 @@ class BxCoursesMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         return $this->_getMenuItemByNameActionsMore($aItem);
     }
 
+    protected function _getMenuItemEditCoursePricing($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+
     protected function _getMenuItemInviteToCourse($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);

+ 24 - 0
modules/boonex/courses/classes/BxCoursesPageListEntry.php

@@ -0,0 +1,24 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Courses Courses
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+/**
+ * List entry page
+ */
+class BxCoursesPageListEntry extends BxBaseModGroupsPageListEntry
+{    
+    public function __construct($aObject, $oTemplate = false)
+    {
+        $this->MODULE = 'bx_courses';
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 77 - 4
modules/boonex/courses/install/langs/en.xml

@@ -9,6 +9,7 @@
     <string name="_bx_courses_option_searchable_fields"><![CDATA[Searchable fields]]></string>
     <string name="_bx_courses_option_members_mode"><![CDATA[Special mode for course members]]></string>
     <string name="_bx_courses_option_members_mode_multi_roles"><![CDATA[Multi Roles]]></string>
+    <string name="_bx_courses_option_per_page_for_favorites_lists"><![CDATA[Number of favorite lists per page]]></string>
     <string name="_bx_courses_option_internal_notifications"><![CDATA[Use internal notifications]]></string>
 
     <string name="_bx_courses_form_profile"><![CDATA[Courses]]></string>
@@ -25,6 +26,7 @@
     <string name="_bx_courses_form_profile_input_join_confirm"><![CDATA[Join confirmation]]></string>
     <string name="_bx_courses_form_profile_input_sys_allow_view_to"><![CDATA[Visible to]]></string>
     <string name="_bx_courses_form_profile_input_allow_view_to"><![CDATA[Visible to]]></string>
+    <string name="_bx_courses_form_profile_input_allow_view_favorite_list"><![CDATA[Visibility]]></string>
     <string name="_bx_courses_form_profile_input_allow_view_to_desc"><![CDATA[Closed - anyone can find the course and see who's in it, only students can see posts. Secret - only students can find the course and see posts.]]></string>
     <string name="_bx_courses_form_profile_input_sys_allow_post_to"><![CDATA[Who can post]]></string>
     <string name="_bx_courses_form_profile_input_allow_post_to"><![CDATA[Who can post]]></string>
@@ -48,11 +50,36 @@
     <string name="_bx_courses_form_profile_input_delete_confirm_info"><![CDATA[This action can not be undone.]]></string>
     <string name="_bx_courses_form_profile_input_delete_confirm_error"><![CDATA[Please check this checkbox if you really want to delete course.]]></string>
 
+    <string name="_bx_courses_form_price"><![CDATA[Price]]></string>
+    <string name="_bx_courses_form_price_display_add"><![CDATA[Add]]></string>
+    <string name="_bx_courses_form_price_display_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_courses_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_courses_form_price_input_sys_role_id"><![CDATA[Role ID]]></string>
+    <string name="_bx_courses_form_price_input_sys_name"><![CDATA[Name]]></string>
+    <string name="_bx_courses_form_price_input_name"><![CDATA[Name]]></string>
+    <string name="_bx_courses_form_price_input_inf_name"><![CDATA[Unique value which will be used in back end and API calls]]></string>
+    <string name="_bx_courses_form_price_input_err_name"><![CDATA[You need to enter a unique value here]]></string>
+    <string name="_bx_courses_form_price_input_sys_period"><![CDATA[Period]]></string>
+    <string name="_bx_courses_form_price_input_period"><![CDATA[Period]]></string>
+    <string name="_bx_courses_form_price_input_inf_period"><![CDATA[Use 0 for lifetime]]></string>
+    <string name="_bx_courses_form_price_input_sys_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_courses_form_price_input_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_courses_form_price_input_inf_period_unit"><![CDATA[Leave empty for lifetime level.]]></string>
+    <string name="_bx_courses_form_price_input_err_period_unit"><![CDATA[You need to select a period unit here.]]></string>
+    <string name="_bx_courses_form_price_input_sys_price"><![CDATA[Price]]></string>
+    <string name="_bx_courses_form_price_input_price"><![CDATA[Price]]></string>
+    <string name="_bx_courses_form_price_input_inf_price"><![CDATA[Use 0 or leave empty to create free level.]]></string>
+    <string name="_bx_courses_form_price_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_courses_form_price_input_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_courses_form_price_input_sys_do_cancel"><![CDATA[Cancel]]></string>
+    <string name="_bx_courses_form_price_input_do_cancel"><![CDATA[Cancel]]></string>
+
     <string name="_bx_courses_acl_action_create_profile"><![CDATA[Create Course]]></string>
+    <string name="_bx_courses_acl_action_use_paid_join"><![CDATA[Use paid join]]></string>
     <string name="_bx_courses_acl_action_delete_profile"><![CDATA[Delete Course]]></string>
     <string name="_bx_courses_acl_action_view_profile"><![CDATA[View Course]]></string>
     <string name="_bx_courses_acl_action_edit_any_profile"><![CDATA[Edit Any Course]]></string>
-	<string name="_bx_courses_acl_action_delete_any_profile"><![CDATA[Delete Any Course]]></string>
+    <string name="_bx_courses_acl_action_delete_any_profile"><![CDATA[Delete Any Course]]></string>
     <string name="_bx_courses_acl_action_delete_invites"><![CDATA[Delete Invites]]></string>
 
     <string name="_bx_courses_page_title_sys_joined_entries"><![CDATA[Profile Courses]]></string>
@@ -65,6 +92,8 @@
     <string name="_bx_courses_page_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
     <string name="_bx_courses_page_title_sys_delete_profile"><![CDATA[Delete Course]]></string>
     <string name="_bx_courses_page_title_delete_profile"><![CDATA[Delete Course]]></string>
+    <string name="_bx_courses_page_title_sys_join_profile"><![CDATA[Join Course]]></string>
+    <string name="_bx_courses_page_title_join_profile"><![CDATA[Join Course]]></string>
     <string name="_bx_courses_page_title_sys_view_profile_closed"><![CDATA[View Closed Course]]></string>
     <string name="_bx_courses_page_title_sys_view_profile"><![CDATA[View Course]]></string>
     <string name="_bx_courses_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -81,9 +110,11 @@
     <string name="_bx_courses_page_title_entry_fans"><![CDATA[Students]]></string>
     <string name="_bx_courses_page_title_sys_profile_comments"><![CDATA[Comments]]></string>
     <string name="_bx_courses_page_title_profile_comments"><![CDATA[Comments]]></string>
-	<string name="_bx_courses_page_block_title_entry_reports"><![CDATA[Reports]]></string>
+    <string name="_bx_courses_page_block_title_entry_reports"><![CDATA[Reports]]></string>
     <string name="_bx_courses_page_title_sys_profile_info"><![CDATA[Course Info]]></string>
     <string name="_bx_courses_page_title_profile_info"><![CDATA[Info about {display_name}]]></string>
+    <string name="_bx_courses_page_title_sys_profile_pricing"><![CDATA[Pricing]]></string>
+    <string name="_bx_courses_page_title_profile_pricing"><![CDATA[Pricing]]></string>
     <string name="_bx_courses_page_title_sys_recent"><![CDATA[New Courses]]></string>
     <string name="_bx_courses_page_title_recent"><![CDATA[New Courses]]></string>
     <string name="_bx_courses_page_title_sys_manage"><![CDATA[Manage Own Courses]]></string>
@@ -97,9 +128,14 @@
     <string name="_bx_courses_page_title_invite_to_course"><![CDATA[Invite Students to the Course]]></string>
     <string name="_bx_courses_page_title_sys_entries_search"><![CDATA[Search]]></string>
     <string name="_bx_courses_page_title_entries_search"><![CDATA[Search]]></string>
+    <string name="_bx_courses_page_title_sys_entries_favorites"><![CDATA[Favorives Courses]]></string>
+    <string name="_bx_courses_page_title_entries_favorites"><![CDATA[Favorives Courses]]></string>
 
     <string name="_bx_courses_page_block_title_sys_entries_actions"><![CDATA[Courses actions]]></string>
     <string name="_bx_courses_page_block_title_entries_actions"><![CDATA[Courses actions]]></string>
+    <string name="_bx_courses_page_block_title_favorites_entries"><![CDATA["{title}" List]]></string>
+    <string name="_bx_courses_page_block_title_favorites_entries_info"><![CDATA[Info]]></string>
+    <string name="_bx_courses_page_block_title_favorites_entries_actions"><![CDATA[Favorites List Actions]]></string>
     <string name="_bx_courses_page_block_title_sys_entries_of_author"><![CDATA[Courses of author]]></string>
     <string name="_bx_courses_page_block_title_entries_of_author"><![CDATA[Courses by {display_name}]]></string>
     <string name="_bx_courses_page_block_title_favorites_of_author"><![CDATA[Favorite Courses]]></string>
@@ -110,9 +146,13 @@
     <string name="_bx_courses_page_block_title_edit_profile"><![CDATA[Edit Course]]></string>
     <string name="_bx_courses_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
     <string name="_bx_courses_page_block_title_delete_profile"><![CDATA[Delete Course]]></string>
+    <string name="_bx_courses_page_block_title_join_profile"><![CDATA[Join Course]]></string>
     <string name="_bx_courses_page_block_title_profile_info_link"><![CDATA[About <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_courses_page_block_title_profile_info"><![CDATA[Info]]></string>
     <string name="_bx_courses_page_block_title_system_profile_info"><![CDATA[Info]]></string>
+    <string name="_bx_courses_page_block_title_system_profile_pricing"><![CDATA[Pricing]]></string>
+    <string name="_bx_courses_page_block_title_profile_pricing"><![CDATA[Pricing]]></string>
+    <string name="_bx_courses_page_block_title_profile_pricing_link"><![CDATA[Pricing of <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_courses_page_block_title_profile_description"><![CDATA[Description]]></string>
     <string name="_bx_courses_page_block_title_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_courses_page_block_title_profile_friends"><![CDATA[Friends]]></string>
@@ -175,6 +215,8 @@
     <string name="_bx_courses_menu_item_title_clear_reports"><![CDATA[Clear reports]]></string>
     <string name="_bx_courses_menu_item_title_system_edit_cover"><![CDATA[Edit Cover]]></string>
     <string name="_bx_courses_menu_item_title_edit_cover"><![CDATA[Edit Cover]]></string>
+    <string name="_bx_courses_menu_item_title_system_edit_pricing"><![CDATA[Edit Pricing]]></string>
+    <string name="_bx_courses_menu_item_title_edit_pricing"><![CDATA[Edit Pricing]]></string>
     <string name="_bx_courses_menu_item_title_system_edit_profile"><![CDATA[Edit Course]]></string>
     <string name="_bx_courses_menu_item_title_edit_profile"><![CDATA[Edit Course]]></string>
     <string name="_bx_courses_menu_item_title_system_delete_profile"><![CDATA[Delete Course]]></string>
@@ -220,6 +262,9 @@
     <string name="_bx_courses_menu_item_title_leave_entry_cancel_request"><![CDATA[Cancel Request]]></string>
     <string name="_bx_courses_menu_item_title_leave_entry_reject_request"><![CDATA[Reject Request]]></string>
 
+    <string name="_bx_courses_menu_item_title_system_pay_and_join"><![CDATA[Pay & Join]]></string>
+    <string name="_bx_courses_menu_item_title_pay_and_join"><![CDATA[Pay & Join]]></string>
+
     <string name="_bx_courses_menu_item_title_system_subscribe"><![CDATA[Follow]]></string>
     <string name="_bx_courses_menu_item_title_subscribe"><![CDATA[Follow]]></string>
     <string name="_bx_courses_menu_item_title_system_unsubscribe"><![CDATA[Unfollow]]></string>
@@ -274,6 +319,22 @@
     <string name="_bx_courses_grid_action_err_delete"><![CDATA[Cannot delete the selected course(s).]]></string>
     <string name="_bx_courses_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
 
+    <string name="_bx_courses_grid_column_title_name"><![CDATA[Name]]></string>
+    <string name="_bx_courses_grid_column_title_role_id"><![CDATA[Role]]></string>
+    <string name="_bx_courses_grid_column_title_period"><![CDATA[Period]]></string>
+    <string name="_bx_courses_grid_column_title_price"><![CDATA[Price]]></string>
+    <string name="_bx_courses_grid_action_title_add"><![CDATA[Add]]></string>
+    <string name="_bx_courses_grid_action_title_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_courses_grid_action_title_delete"><![CDATA[Delete]]></string>
+    <string name="_bx_courses_grid_action_title_buy"><![CDATA[Buy]]></string>
+    <string name="_bx_courses_grid_action_title_buy_title"><![CDATA[One-time payment]]></string>
+    <string name="_bx_courses_grid_action_title_subscribe"><![CDATA[Subscribe]]></string>
+    <string name="_bx_courses_grid_action_title_subscribe_title"><![CDATA[Create a subscription with recurring billing]]></string>
+    <string name="_bx_courses_grid_action_title_choose"><![CDATA[Choose]]></string>
+    <string name="_bx_courses_grid_action_title_choose_title"><![CDATA[Switch to the level for free]]></string>
+    <string name="_bx_courses_popup_title_price_add"><![CDATA[Add Pricing Plan]]></string>
+    <string name="_bx_courses_popup_title_price_edit"><![CDATA[Edit Pricing Plan]]></string>
+
     <string name="_bx_courses_chart_growth"><![CDATA[Courses: Growth]]></string>
     <string name="_bx_courses_chart_growth_speed"><![CDATA[Courses: Growth Speed]]></string>
 
@@ -284,6 +345,8 @@
     <string name="_bx_courses_txt_account_suspended"><![CDATA[This course is suspended.]]></string>
     <string name="_bx_courses_txt_N_fans"><![CDATA[{0} students]]></string>
     <string name="_bx_courses_txt_role"><![CDATA[Role]]></string>
+    <string name="_bx_courses_txt_role_added"><![CDATA[Added]]></string>
+    <string name="_bx_courses_txt_role_expired"><![CDATA[Expires]]></string>
     <string name="_bx_courses_txt_sample_single"><![CDATA[course]]></string>
     <string name="_bx_courses_txt_sample_single_with_article"><![CDATA[a course]]></string>
     <string name="_bx_courses_txt_sample_comment_single"><![CDATA[comment to course]]></string>
@@ -291,8 +354,6 @@
     <string name="_bx_courses_txt_sample_score_up_single"><![CDATA[score up vote to course]]></string>
     <string name="_bx_courses_txt_sample_score_down_single"><![CDATA[score down vote to course]]></string>
     <string name="_bx_courses_txt_set_role"><![CDATA[Set Role]]></string>
-    <string name="_bx_courses_txt_to_admins"><![CDATA[To Instructors]]></string>
-    <string name="_bx_courses_txt_from_admins"><![CDATA[From Instructors]]></string>
     <string name="_bx_courses_txt_private_entry"><![CDATA[Private course]]></string>
     <string name="_bx_courses_txt_invite_popup_text"><![CDATA[You have been invited to a course. Click the button below to accept the invitation.]]></string>
     <string name="_bx_courses_txt_invite_popup_title"><![CDATA[Invitation to a course]]></string>
@@ -300,6 +361,12 @@
     <string name="_bx_courses_txt_invite_popup_button_decline"><![CDATA[Decline]]></string>
     <string name="_bx_courses_txt_invite_popup_error_invitation_absent"><![CDATA[Sorry, an error has occurred. You can not join this course. The invitation is expired or deleted.]]></string>
     <string name="_bx_courses_txt_invite_popup_error_invitation_wrong_user"><![CDATA[Sorry, an error has occurred. You can not join this course. This invitation cannot be used by you.]]></string>
+    <string name="_bx_courses_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_courses_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_courses_msg_performed"><![CDATA[The action was successfully performed.]]></string>
+    <string name="_bx_courses_err_price_duplicate"><![CDATA[Similar pricing plan is already exists.]]></string>
+    <string name="_bx_courses_err_cannot_perform"><![CDATA[An error appeared. Please report.]]></string>
 
     <string name="_bx_courses_alert_action_fan_added"><![CDATA[member joined]]></string>
     <string name="_bx_courses_txt_ntfs_fan_added"><![CDATA[Course <b class="bx-ntfs-content-profile">{owner_name}</b> has got a member <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
@@ -317,6 +384,12 @@
     <string name="_bx_courses_role_administrator"><![CDATA[Instructor]]></string>
     <string name="_bx_courses_role_moderator"><![CDATA[Assistant]]></string>
 
+    <string name="_bx_courses_pre_lists_period_units"><![CDATA[Billing Interval]]></string>
+    <string name="_bx_courses_period_unit_day"><![CDATA[day]]></string>
+    <string name="_bx_courses_period_unit_week"><![CDATA[week]]></string>
+    <string name="_bx_courses_period_unit_month"><![CDATA[month]]></string>
+    <string name="_bx_courses_period_unit_year"><![CDATA[year]]></string>
+
     <string name="_bx_courses_email_join_request"><![CDATA[Course join request]]></string>
     <string name="_bx_courses_email_join_request_subject"><![CDATA[Request to join your course]]></string>
     <string name="_bx_courses_email_join_request_body"><![CDATA[{email_header}

+ 8 - 5
modules/boonex/courses/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_courses';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_courses' OR `object` IN('bx_courses_create_profile', 'bx_courses_delete_profile', 'bx_courses_edit_profile', 'bx_courses_edit_profile_cover', 'bx_courses_invite', 'bx_courses_view_profile', 'bx_courses_view_profile_closed', 'bx_courses_profile_info', 'bx_courses_profile_comments', 'bx_courses_home', 'bx_courses_fans', 'bx_courses_joined', 'bx_courses_top', 'bx_courses_search', 'bx_courses_manage', 'bx_courses_administration');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_courses' OR `object` IN('bx_courses_create_profile', 'bx_courses_delete_profile', 'bx_courses_join_profile', 'bx_courses_edit_profile', 'bx_courses_edit_profile_cover', 'bx_courses_invite', 'bx_courses_view_profile', 'bx_courses_view_profile_closed', 'bx_courses_profile_info', 'bx_courses_profile_pricing', 'bx_courses_profile_comments', 'bx_courses_home', 'bx_courses_fans', 'bx_courses_joined', 'bx_courses_favorites', 'bx_courses_top', 'bx_courses_search', 'bx_courses_manage', 'bx_courses_administration');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_courses';
@@ -38,9 +38,9 @@ DELETE FROM `sys_statistics` WHERE `name` LIKE 'bx_courses%';
 DELETE FROM `sys_objects_chart` WHERE `object` LIKE 'bx_courses%';
 
 -- GRIDS
-DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_courses_administration', 'bx_courses_moderation', 'bx_courses_common', 'bx_courses_fans', 'bx_courses_invites');
-DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_courses_administration', 'bx_courses_moderation', 'bx_courses_common', 'bx_courses_fans', 'bx_courses_invites');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_courses_administration', 'bx_courses_moderation', 'bx_courses_common', 'bx_courses_fans', 'bx_courses_invites');
+DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_courses_administration', 'bx_courses_moderation', 'bx_courses_common', 'bx_courses_fans', 'bx_courses_invites', 'bx_courses_prices_manage', 'bx_courses_prices_view');
+DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_courses_administration', 'bx_courses_moderation', 'bx_courses_common', 'bx_courses_fans', 'bx_courses_invites', 'bx_courses_prices_manage', 'bx_courses_prices_view');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_courses_administration', 'bx_courses_moderation', 'bx_courses_common', 'bx_courses_fans', 'bx_courses_invites', 'bx_courses_prices_manage', 'bx_courses_prices_view');
 
 -- ALERTS
 SET @iHandler := (SELECT `id` FROM `sys_alerts_handlers` WHERE `name` = 'bx_courses' LIMIT 1);
@@ -48,10 +48,13 @@ DELETE FROM `sys_alerts` WHERE `handler_id` = @iHandler;
 DELETE FROM `sys_alerts_handlers` WHERE `id` = @iHandler;
 
 -- PRIVACY 
-DELETE FROM `sys_objects_privacy` WHERE `object` IN ('bx_courses_allow_view_to', 'bx_courses_allow_view_notification_to', 'bx_courses_allow_post_to');
+DELETE FROM `sys_objects_privacy` WHERE `object` IN ('bx_courses_allow_view_to', 'bx_courses_allow_view_notification_to', 'bx_courses_allow_post_to', 'bx_courses_allow_view_favorite_list');
 
 -- EMAIL TEMPLATES
 DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_courses';
 
 -- UPLOADERS
 DELETE FROM `sys_objects_uploader` WHERE `object` IN ('bx_courses_cover_crop', 'bx_courses_picture_crop');
+
+-- CRON
+DELETE FROM `sys_cron_jobs` WHERE `name` IN ('bx_courses_pruning');

+ 98 - 25
modules/boonex/courses/install/sql/enable.sql

@@ -16,6 +16,7 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `e
 ('bx_courses_num_rss', '10', @iCategId, '_bx_courses_option_num_rss', 'digit', '', '', '', 12),
 ('bx_courses_per_page_browse_showcase', '32', @iCategId, '_sys_option_per_page_browse_showcase', 'digit', '', '', '', 15),
 ('bx_courses_per_page_browse_recommended', '10', @iCategId, '_sys_option_per_page_browse_recommended', 'digit', '', '', '', 16),
+('bx_courses_per_page_for_favorites_lists', '5', @iCategId, '_bx_courses_option_per_page_for_favorites_lists', 'digit', '', '', '', 17),
 ('bx_courses_searchable_fields', 'name,desc', @iCategId, '_bx_courses_option_searchable_fields', 'list', 'a:2:{s:6:"module";s:10:"bx_courses";s:6:"method";s:21:"get_searchable_fields";}', '', '', 30),
 ('bx_courses_members_mode', '', @iCategId, '_bx_courses_option_members_mode', 'select', 'a:2:{s:6:"module";s:10:"bx_courses";s:6:"method";s:24:"get_options_members_mode";}', '', '', 40), 
 ('bx_courses_internal_notifications', '', @iCategId, '_bx_courses_option_internal_notifications', 'checkbox', '', '', '', 50);
@@ -89,8 +90,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_courses_delete_profile', 1, 'bx_courses', '_bx_courses_page_block_title_delete_profile', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:10:"bx_courses";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_courses_join_profile', 'join-course-profile', '_bx_courses_page_title_sys_join_profile', '_bx_courses_page_title_join_profile', 'bx_courses', 5, 2147483647, 1, 'page.php?i=join-course-profile', '', '', '', 0, 1, 0, 'BxCoursesPageEntry', 'modules/boonex/courses/classes/BxCoursesPageEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_courses_join_profile', 1, 'bx_courses', '_bx_courses_page_block_title_join_profile', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:10:"bx_courses";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_courses_profile_info', 'course-profile-info', '_bx_courses_page_title_sys_profile_info', '_bx_courses_page_title_profile_info', 'bx_courses', 5, 2147483647, 1, 'page.php?i=course-profile-info', '', '', '', 0, 1, 0, 'BxCoursesPageEntry', 'modules/boonex/courses/classes/BxCoursesPageEntry.php');
 
@@ -98,8 +105,14 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_courses_profile_info', 1, 'bx_courses', '_bx_courses_page_block_title_system_profile_info', '_bx_courses_page_block_title_profile_info_link', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:10:"bx_courses";s:6:"method";s:16:"entity_info_full";}', 0, 0, 1, 1),
 ('bx_courses_profile_info', 1, 'bx_courses', '', '_bx_courses_page_block_title_profile_description', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:10:"bx_courses";s:6:"method";s:17:"entity_text_block";}', 0, 0, 1, 2);
 
--- PAGE: course 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_courses_profile_pricing', 'edit-course-pricing', '_bx_courses_page_title_sys_profile_pricing', '_bx_courses_page_title_profile_pricing', 'bx_courses', 5, 2147483647, 1, 'page.php?i=edit-course-pricing', '', '', '', 0, 1, 0, 'BxCoursesPageEntry', 'modules/boonex/courses/classes/BxCoursesPageEntry.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_courses_profile_pricing', 1, 'bx_courses', '_bx_courses_page_block_title_system_profile_pricing', '_bx_courses_page_block_title_profile_pricing_link', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:10:"bx_courses";s:6:"method";s:14:"entity_pricing";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 0, 1, 1);
+
+-- PAGE: course 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_courses_fans', 'course-fans', '_bx_courses_page_title_sys_entry_fans', '_bx_courses_page_title_entry_fans', 'bx_courses', 5, 2147483647, 1, 'page.php?i=course-fans', '', '', '', 0, 1, 0, 'BxCoursesPageEntry', 'modules/boonex/courses/classes/BxCoursesPageEntry.php');
 
@@ -174,6 +187,16 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_courses_joined', 1, 'bx_courses', '_bx_courses_page_block_title_sys_favorites_of_author', '_bx_courses_page_block_title_favorites_of_author', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:10:"bx_courses";s:6:"method";s:15:"browse_favorite";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 1, 1, 3),
 ('bx_courses_joined', 1, 'bx_courses', '_bx_courses_page_block_title_sys_joined_entries', '_bx_courses_page_block_title_joined_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:10:"bx_courses";s:6:"method";s:21:"browse_joined_entries";s:6:"params";a:2:{i:0;i:0;i:1;b:1;}}', 0, 0, 1, 4);
 
+-- PAGE: favorites by list
+INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_courses_favorites', '_bx_courses_page_title_sys_entries_favorites', '_bx_courses_page_title_entries_favorites', 'bx_courses', 12, 2147483647, 1, 'courses-favorites', 'page.php?i=courses-favorites', '', '', '', 0, 1, 0, 'BxCoursesPageListEntry', 'modules/boonex/courses/classes/BxCoursesPageListEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_courses_favorites', 2, 'bx_courses', '_bx_courses_page_block_title_favorites_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:10:"bx_courses";s:6:"method";s:15:"browse_favorite";s:6:"params";a:2:{s:10:"profile_id";s:12:"{profile_id}";s:6:"params";a:3:{s:9:"unit_view";s:7:"gallery";s:13:"empty_message";b:0;s:13:"ajax_paginate";b:0;}}}', 0, 1, 1),
+('bx_courses_favorites', 3, 'bx_courses', '_bx_courses_page_block_title_favorites_entries_info', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:10:"bx_courses";s:6:"method";s:19:"favorites_list_info";}', 0, 0, 0),
+('bx_courses_favorites', 3, 'bx_courses', '_bx_courses_page_block_title_favorites_entries_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:10:"bx_courses";s:6:"method";s:22:"favorites_list_actions";}', 0, 0, 1);
+
+
 -- PAGE: add block to homepage
 SET @iBlockOrder = (SELECT `order` FROM `sys_pages_blocks` WHERE `object` = 'sys_home' AND `cell_id` = 1 ORDER BY `order` DESC LIMIT 1);
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
@@ -217,6 +240,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_courses_view_actions', 'bx_courses', '_bx_courses_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_courses_view_actions', 'bx_courses', 'join-course-profile', '_bx_courses_menu_item_title_system_pay_and_join', '_bx_courses_menu_item_title_pay_and_join', 'page.php?i=join-course-profile&profile_id={profile_id}', '', '', 'sign-in-alt', '', 0, 2147483647, 'a:3:{s:6:"module";s:10:"bx_courses";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_courses_view_actions', 'bx_courses', 'profile-fan-add', '_bx_courses_menu_item_title_system_become_fan', '{title_add_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_courses_fans\', \'add\', \'{profile_id}\')', '', 'sign-in-alt', '', 0, 2147483647, '', 1, 0, 0, 5),
 ('bx_courses_view_actions', 'bx_courses', 'profile-subscribe-add', '_bx_courses_menu_item_title_system_subscribe', '_bx_courses_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_courses_view_actions', 'bx_courses', '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_courses'', content_id: {content_id}});', '', 'check-circle', '', 0, 192, 'a:2:{s:6:"module";s:10:"bx_courses";s:6:"method";s:19:"is_badges_avaliable";}', 1, 0, 1, 30),
@@ -231,13 +255,14 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_courses_view_actions_more', 'bx_courses', '_bx_courses_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_courses_view_actions_more', 'bx_courses', 'profile-fan-remove', '_bx_courses_menu_item_title_system_leave_entry', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_courses_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, 1, 0, 10),
-('bx_courses_view_actions_more', 'bx_courses', 'profile-subscribe-remove', '_bx_courses_menu_item_title_system_unsubscribe', '_bx_courses_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, 1, 0, 20),
-('bx_courses_view_actions_more', 'bx_courses', 'edit-course-cover', '_bx_courses_menu_item_title_system_edit_cover', '_bx_courses_menu_item_title_edit_cover', 'page.php?i=edit-course-cover&id={content_id}', '', '', 'edit', '', 2147483647, 1, 0, 30),
-('bx_courses_view_actions_more', 'bx_courses', 'edit-course-profile', '_bx_courses_menu_item_title_system_edit_profile', '_bx_courses_menu_item_title_edit_profile', 'page.php?i=edit-course-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 40),
-('bx_courses_view_actions_more', 'bx_courses', 'invite-to-course', '_bx_courses_menu_item_title_system_invite', '_bx_courses_menu_item_title_invite', 'page.php?i=invite-to-course&id={content_id}', '', '', 'user-friends', '', 2147483647, 1, 0, 42),
-('bx_courses_view_actions_more', 'bx_courses', 'delete-course-profile', '_bx_courses_menu_item_title_system_delete_profile', '_bx_courses_menu_item_title_delete_profile', 'page.php?i=delete-course-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_courses_view_actions_more', 'bx_courses', 'profile-fan-remove', '_bx_courses_menu_item_title_system_leave_entry', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_courses_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, '', 1, 0, 10),
+('bx_courses_view_actions_more', 'bx_courses', 'profile-subscribe-remove', '_bx_courses_menu_item_title_system_unsubscribe', '_bx_courses_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, '', 1, 0, 20),
+('bx_courses_view_actions_more', 'bx_courses', 'edit-course-cover', '_bx_courses_menu_item_title_system_edit_cover', '_bx_courses_menu_item_title_edit_cover', 'page.php?i=edit-course-cover&id={content_id}', '', '', 'edit', '', 2147483647, '', 1, 0, 30),
+('bx_courses_view_actions_more', 'bx_courses', 'edit-course-profile', '_bx_courses_menu_item_title_system_edit_profile', '_bx_courses_menu_item_title_edit_profile', 'page.php?i=edit-course-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, '', 1, 0, 40),
+('bx_courses_view_actions_more', 'bx_courses', 'edit-course-pricing', '_bx_courses_menu_item_title_system_edit_pricing', '_bx_courses_menu_item_title_edit_pricing', 'page.php?i=edit-course-pricing&profile_id={profile_id}', '', '', 'money-check-alt', '', 2147483647, 'a:3:{s:6:"module";s:10:"bx_courses";s:6:"method";s:20:"is_pricing_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 41),
+('bx_courses_view_actions_more', 'bx_courses', 'invite-to-course', '_bx_courses_menu_item_title_system_invite', '_bx_courses_menu_item_title_invite', 'page.php?i=invite-to-course&id={content_id}', '', '', 'user-friends', '', 2147483647, '', 1, 0, 42),
+('bx_courses_view_actions_more', 'bx_courses', 'delete-course-profile', '_bx_courses_menu_item_title_system_delete_profile', '_bx_courses_menu_item_title_delete_profile', 'page.php?i=delete-course-profile&id={content_id}', '', '', 'remove', '', 2147483647, '', 1, 0, 50);
 
 -- MENU: all actions menu for view entry 
 
@@ -248,6 +273,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_courses_view_actions_all', 'bx_courses', '_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_courses_view_actions_all', 'bx_courses', 'join-course-profile', '_bx_courses_menu_item_title_system_pay_and_join', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 5),
 ('bx_courses_view_actions_all', 'bx_courses', 'profile-fan-add', '_bx_courses_menu_item_title_system_become_fan', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 10),
 ('bx_courses_view_actions_all', 'bx_courses', 'profile-fan-remove', '_bx_courses_menu_item_title_system_leave_entry', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 20),
 ('bx_courses_view_actions_all', 'bx_courses', 'profile-subscribe-add', '_bx_courses_menu_item_title_system_subscribe', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 30),
@@ -268,6 +294,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_courses_view_actions_all', 'bx_courses', 'social-sharing-pinterest', '_sys_menu_item_title_system_social_sharing_pinterest', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 330),
 ('bx_courses_view_actions_all', 'bx_courses', 'edit-course-cover', '_bx_courses_menu_item_title_system_edit_cover', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 400),
 ('bx_courses_view_actions_all', 'bx_courses', 'edit-course-profile', '_bx_courses_menu_item_title_system_edit_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 410),
+('bx_courses_view_actions_all', 'bx_courses', 'edit-course-pricing', '_bx_courses_menu_item_title_system_edit_pricing', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 415),
 ('bx_courses_view_actions_all', 'bx_courses', 'invite-to-course', '_bx_courses_menu_item_title_system_invite', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 420),
 ('bx_courses_view_actions_all', 'bx_courses', 'delete-course-profile', '_bx_courses_menu_item_title_system_delete_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 430),
 ('bx_courses_view_actions_all', 'bx_courses', '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);
@@ -321,19 +348,20 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_courses_snippet_meta', 'bx_courses', '_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_courses_snippet_meta', 'bx_courses', 'privacy', '_bx_courses_menu_item_title_system_sm_privacy', '_bx_courses_menu_item_title_sm_privacy', '', '', '', '', '', 2147483647, 1, 0, 1, 1),
-('bx_courses_snippet_meta', 'bx_courses', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, 0, 0, 1, 2),
-('bx_courses_snippet_meta', 'bx_courses', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, 0, 0, 1, 3),
-('bx_courses_snippet_meta', 'bx_courses', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, 0, 0, 1, 4),
-('bx_courses_snippet_meta', 'bx_courses', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, 0, 0, 1, 5),
-('bx_courses_snippet_meta', 'bx_courses', 'members', '_bx_courses_menu_item_title_system_sm_members', '_bx_courses_menu_item_title_sm_members', '', '', '', '', '', 2147483647, 1, 0, 1, 6),
-('bx_courses_snippet_meta', 'bx_courses', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, 0, 0, 1, 7),
-('bx_courses_snippet_meta', 'bx_courses', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, 1, 0, 1, 8),
-('bx_courses_snippet_meta', 'bx_courses', 'join', '_bx_courses_menu_item_title_system_sm_join', '_bx_courses_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 1, 0, 1, 9),
-('bx_courses_snippet_meta', 'bx_courses', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, 0, 0, 1, 10),
-('bx_courses_snippet_meta', 'bx_courses', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 11),
-('bx_courses_snippet_meta', 'bx_courses', '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_courses_snippet_meta', 'bx_courses', 'privacy', '_bx_courses_menu_item_title_system_sm_privacy', '_bx_courses_menu_item_title_sm_privacy', '', '', '', '', '', 2147483647, '', 1, 0, 1, 1),
+('bx_courses_snippet_meta', 'bx_courses', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, '', 0, 0, 1, 2),
+('bx_courses_snippet_meta', 'bx_courses', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, '', 0, 0, 1, 3),
+('bx_courses_snippet_meta', 'bx_courses', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, '', 0, 0, 1, 4),
+('bx_courses_snippet_meta', 'bx_courses', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, '', 0, 0, 1, 5),
+('bx_courses_snippet_meta', 'bx_courses', 'members', '_bx_courses_menu_item_title_system_sm_members', '_bx_courses_menu_item_title_sm_members', '', '', '', '', '', 2147483647, '', 1, 0, 1, 6),
+('bx_courses_snippet_meta', 'bx_courses', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, '', 0, 0, 1, 7),
+('bx_courses_snippet_meta', 'bx_courses', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, '', 1, 0, 1, 8),
+('bx_courses_snippet_meta', 'bx_courses', 'join-paid', '_sys_menu_item_title_system_sm_join_paid', '_sys_menu_item_title_sm_join_paid', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:10:"bx_courses";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_courses_snippet_meta', 'bx_courses', 'join', '_bx_courses_menu_item_title_system_sm_join', '_bx_courses_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:10:"bx_courses";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_courses_snippet_meta', 'bx_courses', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, '', 0, 0, 1, 11),
+('bx_courses_snippet_meta', 'bx_courses', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 12),
+('bx_courses_snippet_meta', 'bx_courses', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 13);
 
 -- 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);
@@ -367,6 +395,10 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 ('bx_courses', 'create entry', NULL, '_bx_courses_acl_action_create_profile', '', 1, 1);
 SET @iIdActionProfileCreate = LAST_INSERT_ID();
 
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('bx_courses', 'use paid join', NULL, '_bx_courses_acl_action_use_paid_join', '', 1, 1);
+SET @iIdActionUsePaidJoin = LAST_INSERT_ID();
+
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
 ('bx_courses', 'delete entry', NULL, '_bx_courses_acl_action_delete_profile', '', 1, 1);
 SET @iIdActionProfileDelete = LAST_INSERT_ID();
@@ -408,6 +440,12 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iAdministrator, @iIdActionProfileCreate),
 (@iPremium, @iIdActionProfileCreate),
 
+-- use paid join
+(@iStandard, @iIdActionUsePaidJoin),
+(@iModerator, @iIdActionUsePaidJoin),
+(@iAdministrator, @iIdActionUsePaidJoin),
+(@iPremium, @iIdActionUsePaidJoin),
+
 -- profile delete
 (@iAccount, @iIdActionProfileDelete),
 (@iStandard, @iIdActionProfileDelete),
@@ -474,7 +512,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_courses_fans', 'name', '_sys_name', '50%', '', 10),
 ('bx_courses_fans', 'role', '_bx_courses_txt_role', '10%', '', 15),
-('bx_courses_fans', 'actions', '', '40%', '', 20);
+('bx_courses_fans', 'role_added', '_bx_courses_txt_role_added', '10%', '', 16),
+('bx_courses_fans', 'role_expired', '_bx_courses_txt_role_expired', '10%', '', 17),
+('bx_courses_fans', 'actions', '', '20%', '', 20);
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `confirm`, `order`) VALUES
 ('bx_courses_fans', 'single', 'accept', '_sys_accept', '', 0, 10),
@@ -526,6 +566,34 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_courses_common', 'bulk', 'delete_with_content', '_bx_courses_grid_action_title_adm_delete_with_content', '', 0, 1, 2),
 ('bx_courses_common', 'single', 'settings', '_bx_courses_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_courses_prices_manage', 'Sql', 'SELECT * FROM `bx_courses_prices` WHERE 1 ', 'bx_courses_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxCoursesGridPricesManage', 'modules/boonex/courses/classes/BxCoursesGridPricesManage.php'),
+('bx_courses_prices_view', 'Sql', 'SELECT * FROM `bx_courses_prices` WHERE 1 ', 'bx_courses_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxCoursesGridPricesView', 'modules/boonex/courses/classes/BxCoursesGridPricesView.php');
+
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('bx_courses_prices_manage', 'checkbox', '_sys_select', '1%', 0, '', '', 1),
+('bx_courses_prices_manage', 'order', '', '1%', 0, '', '', 2),
+('bx_courses_prices_manage', 'name', '_bx_courses_grid_column_title_name', '38%', 0, 32, '', 3),
+('bx_courses_prices_manage', 'price', '_bx_courses_grid_column_title_price', '20%', 0, 16, '', 4),
+('bx_courses_prices_manage', 'period', '_bx_courses_grid_column_title_period', '20%', 0, 16, '', 5),
+('bx_courses_prices_manage', 'actions', '', '20%', 0, '', '', 6),
+
+('bx_courses_prices_view', 'role_id', '_bx_courses_grid_column_title_role_id', '40%', 0, 32, '', 1),
+('bx_courses_prices_view', 'price', '_bx_courses_grid_column_title_price', '20%', 0, 16, '', 2),
+('bx_courses_prices_view', 'period', '_bx_courses_grid_column_title_period', '20%', 0, 16, '', 3),
+('bx_courses_prices_view', 'actions', '', '20%', 0, '', '', 4);
+
+INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
+('bx_courses_prices_manage', 'independent', 'add', '_bx_courses_grid_action_title_add', '', 0, 0, 1),
+('bx_courses_prices_manage', 'single', 'edit', '_bx_courses_grid_action_title_edit', 'pencil-alt', 1, 0, 1),
+('bx_courses_prices_manage', 'single', 'delete', '_bx_courses_grid_action_title_delete', 'remove', 1, 1, 2),
+('bx_courses_prices_manage', 'bulk', 'delete', '_bx_courses_grid_action_title_delete', '', 0, 1, 1),
+
+('bx_courses_prices_view', 'single', 'buy', '_bx_courses_grid_action_title_buy', 'cart-plus', 0, 0, 1),
+('bx_courses_prices_view', 'single', 'subscribe', '_bx_courses_grid_action_title_subscribe', 'credit-card', 0, 0, 2),
+('bx_courses_prices_view', 'single', 'choose', '_bx_courses_grid_action_title_choose', 'far check-square', 0, 0, 3);
+
 
 -- ALERTS
 
@@ -555,12 +623,13 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 ('bx_courses', 'timeline_pin', @iHandler),
 ('bx_courses', 'timeline_promote', @iHandler);
 
--- PRIVACY 
+-- PRIVACY
 
 INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `spaces`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
 ('bx_courses_allow_view_to', 'bx_courses', 'view', '_bx_courses_form_profile_input_allow_view_to', '3', '', 'bx_courses_data', 'id', 'author', 'BxCoursesPrivacy', 'modules/boonex/courses/classes/BxCoursesPrivacy.php'),
 ('bx_courses_allow_view_notification_to', 'bx_courses', 'view_event', '_bx_courses_form_profile_input_allow_view_notification_to', '3', '', 'bx_notifications_events', 'id', 'object_owner_id', 'BxCoursesPrivacyNotifications', 'modules/boonex/courses/classes/BxCoursesPrivacyNotifications.php'),
-('bx_courses_allow_post_to', 'bx_courses', 'post', '_bx_courses_form_profile_input_allow_post_to', 'p', '', 'bx_courses_data', 'id', 'author', 'BxCoursesPrivacyPost', 'modules/boonex/courses/classes/BxCoursesPrivacyPost.php');
+('bx_courses_allow_post_to', 'bx_courses', 'post', '_bx_courses_form_profile_input_allow_post_to', 'p', '', 'bx_courses_data', 'id', 'author', 'BxCoursesPrivacyPost', 'modules/boonex/courses/classes/BxCoursesPrivacyPost.php'),
+('bx_courses_allow_view_favorite_list', 'bx_courses', 'view_favorite_list', '_bx_courses_form_profile_input_allow_view_favorite_list', '3', '', 'bx_courses_favorites_lists', 'id', 'author_id', 'BxCoursesPrivacy', 'modules/boonex/courses/classes/BxCoursesPrivacy.php');
 
 -- EMAIL TEMPLATES
 
@@ -580,3 +649,7 @@ INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `
 ('bx_courses_cover_crop', 1, 'BxCoursesUploaderCoverCrop', 'modules/boonex/courses/classes/BxCoursesUploaderCoverCrop.php'),
 ('bx_courses_picture_crop', 1, 'BxCoursesUploaderPictureCrop', 'modules/boonex/courses/classes/BxCoursesUploaderPictureCrop.php');
 
+-- CRON
+
+INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
+('bx_courses_pruning', '0 0 * * *', 'BxCoursesCronPruning', 'modules/boonex/courses/classes/BxCoursesCronPruning.php', '');

+ 79 - 2
modules/boonex/courses/install/sql/install.sql

@@ -198,7 +198,9 @@ CREATE TABLE IF NOT EXISTS `bx_courses_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`)
 );
@@ -207,10 +209,21 @@ CREATE TABLE IF NOT EXISTS `bx_courses_admins` (
 CREATE TABLE IF NOT EXISTS `bx_courses_favorites_track` (
   `object_id` int(11) NOT NULL default '0',
   `author_id` int(11) NOT NULL default '0',
+  `list_id` int(11) NOT NULL default '0',
   `date` int(11) NOT NULL default '0',
   KEY `id` (`object_id`,`author_id`)
 );
 
+CREATE TABLE `bx_courses_favorites_lists` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `author_id` int(11) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  `allow_view_favorite_list_to` varchar(16) NOT NULL DEFAULT '3',
+   PRIMARY KEY (`id`)
+);
+
+
 -- TABLE: scores
 CREATE TABLE IF NOT EXISTS `bx_courses_scores` (
   `object_id` int(11) NOT NULL default '0',
@@ -240,6 +253,20 @@ CREATE TABLE IF NOT EXISTS `bx_courses_invites` (
   PRIMARY KEY (`id`)
 );
 
+-- TABLE: Pricing
+CREATE TABLE IF NOT EXISTS `bx_courses_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
@@ -330,6 +357,46 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_course_view_full', 'cat', 2147483647, 1, 2),
 ('bx_course_view_full', '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_courses_price', 'bx_courses', '_bx_courses_form_price', '', '', 'do_submit', 'bx_courses_prices', 'id', '', '', '', 0, 1, 'BxCoursesFormPrice', 'modules/boonex/courses/classes/BxCoursesFormPrice.php');
+
+INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
+('bx_courses_price_add', 'bx_courses', 'bx_courses_price', '_bx_courses_form_price_display_add', 0),
+('bx_courses_price_edit', 'bx_courses', 'bx_courses_price', '_bx_courses_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_courses_price', 'bx_courses', 'id', '', '', 0, 'hidden', '_bx_courses_form_price_input_sys_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'role_id', '', '', 0, 'hidden', '_bx_courses_form_price_input_sys_role_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'name', '', '', 0, 'text', '_bx_courses_form_price_input_sys_name', '_bx_courses_form_price_input_name', '_bx_courses_form_price_input_inf_name', 1, 0, 0, '', '', '', 'Avail', '', '_bx_courses_form_price_input_err_name', 'Xss', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'period', '', '', 0, 'text', '_bx_courses_form_price_input_sys_period', '_bx_courses_form_price_input_period', '_bx_courses_form_price_input_inf_period', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'period_unit', '', '#!bx_courses_period_units', 0, 'select', '_bx_courses_form_price_input_sys_period_unit', '_bx_courses_form_price_input_period_unit', '_bx_courses_form_price_input_inf_period_unit', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'price', '', '', 0, 'text', '_bx_courses_form_price_input_sys_price', '_bx_courses_form_price_input_price', '_bx_courses_form_price_input_inf_price', 1, 0, 0, '', '', '', '', '', '', 'Float', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'do_submit', '_bx_courses_form_price_input_do_submit', '', 0, 'submit', '_bx_courses_form_price_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_courses_price', 'bx_courses', 'do_cancel', '_bx_courses_form_price_input_do_cancel', '', 0, 'button', '_bx_courses_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_courses_price_add', 'id', 2147483647, 0, 1),
+('bx_courses_price_add', 'role_id', 2147483647, 1, 2),
+('bx_courses_price_add', 'name', 2147483647, 1, 3),
+('bx_courses_price_add', 'price', 2147483647, 1, 4),
+('bx_courses_price_add', 'period', 2147483647, 1, 5),
+('bx_courses_price_add', 'period_unit', 2147483647, 1, 6),
+('bx_courses_price_add', 'controls', 2147483647, 1, 7),
+('bx_courses_price_add', 'do_submit', 2147483647, 1, 8),
+('bx_courses_price_add', 'do_cancel', 2147483647, 1, 9),
+
+('bx_courses_price_edit', 'id', 2147483647, 1, 1),
+('bx_courses_price_edit', 'role_id', 2147483647, 1, 2),
+('bx_courses_price_edit', 'name', 2147483647, 1, 3),
+('bx_courses_price_edit', 'price', 2147483647, 1, 4),
+('bx_courses_price_edit', 'period', 2147483647, 1, 5),
+('bx_courses_price_edit', 'period_unit', 2147483647, 1, 6),
+('bx_courses_price_edit', 'controls', 2147483647, 1, 7),
+('bx_courses_price_edit', 'do_submit', 2147483647, 1, 8),
+('bx_courses_price_edit', 'do_cancel', 2147483647, 1, 9);
+
 -- PRE-VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
 ('bx_courses_cats', '_bx_courses_pre_lists_cats', 'bx_courses', '0');
@@ -346,6 +413,16 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALU
 ('bx_courses_roles', '1', 2, '_bx_courses_role_administrator', ''),
 ('bx_courses_roles', '2', 3, '_bx_courses_role_moderator', '');
 
+INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
+('bx_courses_period_units', '_bx_courses_pre_lists_period_units', 'bx_courses', '0');
+
+INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
+('bx_courses_period_units', '', 0, '_sys_please_select', ''),
+('bx_courses_period_units', 'day', 1, '_bx_courses_period_unit_day', ''),
+('bx_courses_period_units', 'week', 2, '_bx_courses_period_unit_week', ''),
+('bx_courses_period_units', 'month', 3, '_bx_courses_period_unit_month', ''),
+('bx_courses_period_units', 'year', 4, '_bx_courses_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_courses', 'bx_courses', 'bx_courses_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-course-profile&id={object_id}', '', 'bx_courses_data', 'id', 'author', 'name', 'comments', 'BxCoursesCmts', 'modules/boonex/courses/classes/BxCoursesCmts.php'),
@@ -368,8 +445,8 @@ INSERT INTO `sys_objects_report` (`name`, `module`, `table_main`, `table_track`,
 ('bx_courses', 'bx_courses', 'bx_courses_reports', 'bx_courses_reports_track', '1', 'page.php?i=view-course-profile&id={object_id}', 'bx_courses_data', 'id', 'author', 'reports', '', '');
 
 -- FAFORITES
-INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_courses', 'bx_courses_favorites_track', '1', '1', '1', 'page.php?i=view-course-profile&id={object_id}', 'bx_courses_data', 'id', 'author', 'favorites', '', '');
+INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `table_lists`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_courses', 'bx_courses_favorites_track', 'bx_courses_favorites_lists', '1', '1', '1', 'page.php?i=view-course-profile&id={object_id}', 'bx_courses_data', 'id', 'author', 'favorites', '', '');
 
 -- FEATURED
 INSERT INTO `sys_objects_feature` (`name`, `module`, `is_on`, `is_undo`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_flag`, `class_name`, `class_file`) VALUES 

+ 3 - 3
modules/boonex/courses/install/sql/uninstall.sql

@@ -1,7 +1,7 @@
 
 -- TABLES
 
-DROP TABLE IF EXISTS `bx_courses_data`, `bx_courses_pics`, `bx_courses_pics_resized`, `bx_courses_cmts`, `bx_courses_cmts_notes`, `bx_courses_views_track`, `bx_courses_meta_keywords`, `bx_courses_meta_locations`, `bx_courses_meta_mentions`, `bx_courses_fans`, `bx_courses_admins`, `bx_courses_votes`, `bx_courses_votes_track`, `bx_courses_reports`, `bx_courses_reports_track`, `bx_courses_favorites_track`, `bx_courses_scores`, `bx_courses_scores_track`, `bx_courses_invites`;
+DROP TABLE IF EXISTS `bx_courses_data`, `bx_courses_pics`, `bx_courses_pics_resized`, `bx_courses_cmts`, `bx_courses_cmts_notes`, `bx_courses_views_track`, `bx_courses_meta_keywords`, `bx_courses_meta_locations`, `bx_courses_meta_mentions`, `bx_courses_fans`, `bx_courses_admins`, `bx_courses_votes`, `bx_courses_votes_track`, `bx_courses_reports`, `bx_courses_reports_track`, `bx_courses_favorites_track`, `bx_courses_favorites_lists`, `bx_courses_scores`, `bx_courses_scores_track`, `bx_courses_invites`, `bx_courses_prices`;
 
 -- PROFILES
 
@@ -21,13 +21,13 @@ DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_cours
 DELETE FROM `sys_objects_form` WHERE `module` = 'bx_courses';
 DELETE FROM `sys_form_displays` WHERE `module` = 'bx_courses';
 DELETE FROM `sys_form_inputs` WHERE `module` = 'bx_courses';
-DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_course_add', 'bx_course_delete', 'bx_course_edit', 'bx_course_edit_cover', 'bx_course_view', 'bx_course_view_full', 'bx_course_invite');
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_course_add', 'bx_course_delete', 'bx_course_edit', 'bx_course_edit_cover', 'bx_course_view', 'bx_course_view_full', 'bx_course_invite', 'bx_courses_price_add', 'bx_courses_price_edit');
 
 -- PRE-VALUES
 
 DELETE FROM `sys_form_pre_lists` WHERE `module` = 'bx_courses';
 
-DELETE FROM `sys_form_pre_values` WHERE `Key` IN('bx_courses_cats', 'bx_courses_roles');
+DELETE FROM `sys_form_pre_values` WHERE `Key` LIKE 'bx_courses%';
 
 -- COMMENTS
 DELETE FROM `sys_objects_cmts` WHERE `Name` = 'bx_courses';

+ 59 - 0
modules/boonex/courses/js/prices.js

@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Courses Courses
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+
+function BxCoursesPrices(oOptions) {
+    this._sActionsUri = oOptions.sActionUri;
+    this._sActionsUrl = oOptions.sActionUrl;
+    this._sObjNameGrid = oOptions.sObjNameGrid;
+    this._sObjName = oOptions.sObjName == undefined ? 'oBxCoursesPrices' : oOptions.sObjName;
+    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
+    this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
+}
+
+BxCoursesPrices.prototype.checkName = function(sNameId, iId) {
+    var oDate = new Date();
+
+    var oName = jQuery("[name='" + sNameId + "']");
+    var sName = oName.val();
+
+    if(!sName.length)
+        return;
+
+    jQuery.get(
+        this._sActionsUrl + 'check_name',
+        {
+            name: sName,
+            id: iId && parseInt(iId) > 0 ? iId : 0,
+            _t: oDate.getTime()
+        },
+        function(oData) {
+            if(!oData || oData.name == undefined)
+                return;
+
+            oName.val(oData.name);
+        },
+        'json'
+    );
+};
+
+BxCoursesPrices.prototype.onChangeRole = function() {
+	this.reloadGrid($('#bx-grid-level-' + this._sObjNameGrid).val());
+};
+
+BxCoursesPrices.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);
+};
+
+/** @} */

+ 1 - 0
modules/boonex/courses/template/css/prices.css

@@ -0,0 +1 @@
+@import url(../../../../base/groups/template/css/prices.css);

+ 1 - 0
modules/boonex/courses/template/favorite-list-info.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/general/template/favorite-list-info.html />

+ 1 - 0
modules/boonex/courses/template/favorite-lists.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/general/template/favorite-lists.html />

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

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

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -945,6 +945,7 @@
 	<string name="_adm_form_txt_field_type_submit"><![CDATA[submit]]></string>
 	<string name="_adm_form_txt_field_type_switcher"><![CDATA[switcher]]></string>
 	<string name="_adm_form_txt_field_type_text"><![CDATA[text]]></string>
+        <string name="_adm_form_txt_field_type_text_range"><![CDATA[text (range)]]></string>
 	<string name="_adm_form_txt_field_type_text_auto"><![CDATA[auto text]]></string>
 	<string name="_adm_form_txt_field_type_textarea"><![CDATA[textarea]]></string>
         <string name="_adm_form_txt_field_type_time"><![CDATA[time]]></string>

+ 23 - 3
modules/boonex/events/classes/BxEventsConfig.php

@@ -33,6 +33,7 @@ class BxEventsConfig 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,11 +60,15 @@ class BxEventsConfig extends BxBaseModGroupsConfig
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
             'FIELD_LABELS' => 'labels',
 
+            'FIELD_PRICE_ROLE_ID' => 'role_id',
+            'FIELD_PRICE_NAME' => 'name',
+
             // page URIs
             'URI_VIEW_ENTRY' => 'view-event-profile',
             'URI_EDIT_ENTRY' => 'edit-event-profile',
             'URI_ENTRIES_BY_CONTEXT' => 'events-context',
             'URI_EDIT_COVER' => 'edit-event-cover',
+            'URI_JOIN_ENTRY' => 'join-event-profile',
             'URI_JOINED_ENTRIES' => 'joined-events',
             'URI_MANAGE_COMMON' => 'events-manage',
             'URI_FAVORITES_LIST' => 'events-favorites',
@@ -81,6 +86,8 @@ class BxEventsConfig extends BxBaseModGroupsConfig
             'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_events_per_page_browse_showcase',
             'PARAM_PER_PAGE_BROWSE_RECOMMENDED' => 'bx_events_per_page_browse_recommended',
             'PARAM_MMODE' => 'bx_events_members_mode',
+            'PARAM_PAID_JOIN_ENABLED' => true,
+            'PARAM_RECURRING_RESERVE' => 3, // 3 days for recurring payment to be registered
             'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_events_per_page_for_favorites_lists',
             'PARAM_USE_IN' => 'bx_events_internal_notifications',
 
@@ -112,6 +119,9 @@ class BxEventsConfig extends BxBaseModGroupsConfig
             'OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER' => 'bx_event_edit_cover',
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_event_delete',
             'OBJECT_FORM_ENTRY_DISPLAY_INVITE' => 'bx_event_invite',
+            'OBJECT_FORM_PRICE' => 'bx_events_price',
+            'OBJECT_FORM_PRICE_DISPLAY_ADD' => 'bx_events_price_add',
+            'OBJECT_FORM_PRICE_DISPLAY_EDIT' => 'bx_events_price_edit',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_events_view_actions', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_events_view_actions_more', // actions menu on view entry page for "more" popup
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_events_view_actions_all', // all actions menu on view entry page
@@ -132,10 +142,13 @@ class BxEventsConfig extends BxBaseModGroupsConfig
             'OBJECT_GRID_COMMON' => 'bx_events_common',
             'OBJECT_GRID_CONNECTIONS' => 'bx_events_fans',
             'OBJECT_GRID_INVITES' => 'bx_events_invites',
+            'OBJECT_GRID_PRICES_MANAGE' => 'bx_events_prices_manage',
+            'OBJECT_GRID_PRICES_VIEW' => 'bx_events_prices_view',
             'OBJECT_CONNECTIONS' => 'bx_events_fans',
             'OBJECT_UPLOADERS_COVER' => array('bx_events_cover_crop'),
             'OBJECT_UPLOADERS_PICTURE' => array('bx_events_picture_crop'),
             'OBJECT_PRE_LIST_ROLES' => 'bx_events_roles',
+            'OBJECT_PRE_LIST_PERIOD_UNITS' => 'bx_events_period_units',
             
             'BADGES_AVALIABLE' => true,
             'INVITES_KEYS_LIFETIME' => 86400,
@@ -211,7 +224,6 @@ class BxEventsConfig extends BxBaseModGroupsConfig
                 'menu_item_title_leave_group_cancel_request' => '_bx_events_menu_item_title_leave_group_cancel_request',
                 'menu_item_title_become_fan' => '_bx_events_menu_item_title_become_fan',
                 'menu_item_title_leave_group' => '_bx_events_menu_item_title_leave_group',
-                
                 'menu_item_title_become_fan_sent' => '_bx_events_menu_item_title_become_fan_sent',
                 'menu_item_title_become_fan' => '_bx_events_menu_item_title_become_fan',
             	'txt_all_entries_by_author' => '_bx_events_page_title_browse_by_author',
@@ -222,6 +234,12 @@ class BxEventsConfig extends BxBaseModGroupsConfig
                 'txt_invitation_popup_decline_button' => '_bx_events_txt_invite_popup_button_decline',
                 'txt_invitation_popup_error_invitation_absent' => '_bx_events_txt_invite_popup_error_invitation_absent',
                 'txt_invitation_popup_error_wrong_user' => '_bx_events_txt_invite_popup_error_invitation_wrong_user',
+                'txt_n_unit' => '_bx_events_txt_n_unit',
+                'txt_buy_title' => '_bx_events_grid_action_title_buy_title',
+                'txt_cart_item_title' => '_bx_events_txt_cart_item_title',
+                'txt_subscribe_title' => '_bx_events_grid_action_title_subscribe_title',
+                'msg_performed' => '_bx_events_msg_performed',
+                'err_cannot_perform' => '_bx_events_err_cannot_perform',
             ),
 
         );
@@ -230,14 +248,16 @@ class BxEventsConfig extends BxBaseModGroupsConfig
             'main' => 'BxEventsMain',
             'entry' => 'BxEventsEntry',
             'manage_tools' => 'BxEventsManageTools',
-            'invite_popup' => 'BxEventsInvitePopup'
+            'invite_popup' => 'BxEventsInvitePopup',
+            'prices' => 'BxEventsPrices'
         );
 
         $this->_aJsObjects = array(
             'main' => 'oBxEventsMain',
             'entry' => 'oBxEventsEntry',
             'manage_tools' => 'oBxEventsManageTools',
-            'invite_popup' => 'oBxEventsInvitePopup'
+            'invite_popup' => 'oBxEventsInvitePopup',
+            'prices' => 'oBxEventsPrices'
         );
 
         $this->_aGridObjects = array(

+ 22 - 0
modules/boonex/events/classes/BxEventsCronPruning.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    Events Events
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxEventsCronPruning extends BxBaseModGroupsCronPruning
+{
+    public function __construct()
+    {
+        $this->_sModule = 'bx_events';
+
+        parent::__construct();
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/events/classes/BxEventsFormPrice.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    Events Events
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxEventsFormPrice extends BxBaseModGroupsFormPrice
+{
+    public function __construct($aInfo, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_events';
+
+        parent::__construct($aInfo, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/events/classes/BxEventsGridPricesManage.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    Events Events
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxEventsGridPricesManage extends BxBaseModGroupsGridPricesManage
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_events';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/events/classes/BxEventsGridPricesView.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    Events Events
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxEventsGridPricesView extends BxBaseModGroupsGridPricesView
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_events';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 10 - 0
modules/boonex/events/classes/BxEventsMenuViewActionsAll.php

@@ -21,6 +21,11 @@ class BxEventsMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         parent::__construct($aObject, $oTemplate);
     }
 
+    protected function _getMenuItemJoinEventProfile($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
     protected function _getMenuItemEditEventCover($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);
@@ -31,6 +36,11 @@ class BxEventsMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         return $this->_getMenuItemByNameActionsMore($aItem);
     }
 
+    protected function _getMenuItemEditEventPricing($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+
     protected function _getMenuItemInviteToEvent($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);

+ 67 - 1
modules/boonex/events/install/langs/en.xml

@@ -31,7 +31,7 @@
     <string name="_bx_events_form_profile_input_join_confirm"><![CDATA[Join confirmation]]></string>
     <string name="_bx_events_form_profile_input_sys_allow_view_to"><![CDATA[Visible to]]></string>
     <string name="_bx_events_form_profile_input_allow_view_to"><![CDATA[Visible to]]></string>
-    <string name="_bx_events_form_entry_input_allow_view_favorite_list"><![CDATA[Visibility]]></string>
+    <string name="_bx_events_form_profile_input_allow_view_favorite_list"><![CDATA[Visibility]]></string>
     <string name="_bx_events_form_profile_input_allow_view_to_desc"><![CDATA[Closed - anyone can find the event and see who's in it, only members can see posts. Secret - only members can find the event and see posts.]]></string>
     <string name="_bx_events_form_profile_input_sys_allow_post_to"><![CDATA[Who can post]]></string>
     <string name="_bx_events_form_profile_input_allow_post_to"><![CDATA[Who can post]]></string>
@@ -78,7 +78,32 @@
     <string name="_bx_events_form_input_repeat_day_of_week"><![CDATA[Repeat day of week]]></string>
     <string name="_bx_events_form_input_stop_repeating"><![CDATA[Stop repeating]]></string>
 
+<string name="_bx_events_form_price"><![CDATA[Price]]></string>
+    <string name="_bx_events_form_price_display_add"><![CDATA[Add]]></string>
+    <string name="_bx_events_form_price_display_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_events_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_events_form_price_input_sys_role_id"><![CDATA[Role ID]]></string>
+    <string name="_bx_events_form_price_input_sys_name"><![CDATA[Name]]></string>
+    <string name="_bx_events_form_price_input_name"><![CDATA[Name]]></string>
+    <string name="_bx_events_form_price_input_inf_name"><![CDATA[Unique value which will be used in back end and API calls]]></string>
+    <string name="_bx_events_form_price_input_err_name"><![CDATA[You need to enter a unique value here]]></string>
+    <string name="_bx_events_form_price_input_sys_period"><![CDATA[Period]]></string>
+    <string name="_bx_events_form_price_input_period"><![CDATA[Period]]></string>
+    <string name="_bx_events_form_price_input_inf_period"><![CDATA[Use 0 for lifetime]]></string>
+    <string name="_bx_events_form_price_input_sys_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_events_form_price_input_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_events_form_price_input_inf_period_unit"><![CDATA[Leave empty for lifetime level.]]></string>
+    <string name="_bx_events_form_price_input_err_period_unit"><![CDATA[You need to select a period unit here.]]></string>
+    <string name="_bx_events_form_price_input_sys_price"><![CDATA[Price]]></string>
+    <string name="_bx_events_form_price_input_price"><![CDATA[Price]]></string>
+    <string name="_bx_events_form_price_input_inf_price"><![CDATA[Use 0 or leave empty to create free level.]]></string>
+    <string name="_bx_events_form_price_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_events_form_price_input_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_events_form_price_input_sys_do_cancel"><![CDATA[Cancel]]></string>
+    <string name="_bx_events_form_price_input_do_cancel"><![CDATA[Cancel]]></string>
+
   <string name="_bx_events_acl_action_create_profile"><![CDATA[Create Event]]></string>
+<string name="_bx_events_acl_action_use_paid_join"><![CDATA[Use paid join]]></string>
   <string name="_bx_events_acl_action_delete_profile"><![CDATA[Delete Event]]></string>
 	<string name="_bx_events_acl_action_view_profile"><![CDATA[View Event]]></string>
 	<string name="_bx_events_acl_action_edit_any_profile"><![CDATA[Edit Any Event]]></string>
@@ -97,6 +122,8 @@
 	<string name="_bx_events_page_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_events_page_title_sys_delete_profile"><![CDATA[Delete Event]]></string>
 	<string name="_bx_events_page_title_delete_profile"><![CDATA[Delete Event]]></string>
+        <string name="_bx_events_page_title_sys_join_profile"><![CDATA[Join Course]]></string>
+        <string name="_bx_events_page_title_join_profile"><![CDATA[Join Course]]></string>
 	<string name="_bx_events_page_title_sys_view_profile_closed"><![CDATA[View Closed Event]]></string>
 	<string name="_bx_events_page_title_sys_view_profile"><![CDATA[View Event]]></string>
 	<string name="_bx_events_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -118,6 +145,8 @@
     <string name="_bx_events_page_title_profile_comments"><![CDATA[Comments]]></string>
 	<string name="_bx_events_page_title_sys_profile_info"><![CDATA[Event Info]]></string>
 	<string name="_bx_events_page_title_profile_info"><![CDATA[Info about {display_name}]]></string>
+        <string name="_bx_events_page_title_sys_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_events_page_title_profile_pricing"><![CDATA[Pricing]]></string>
 	<string name="_bx_events_page_title_sys_recent"><![CDATA[New Events]]></string>
 	<string name="_bx_events_page_title_recent"><![CDATA[New Events]]></string>
 	<string name="_bx_events_page_title_sys_manage"><![CDATA[Manage Own Events]]></string>
@@ -159,9 +188,13 @@
     <string name="_bx_events_page_block_title_edit_profile"><![CDATA[Edit Event]]></string>
     <string name="_bx_events_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
     <string name="_bx_events_page_block_title_delete_profile"><![CDATA[Delete Event]]></string>
+    <string name="_bx_events_page_block_title_join_profile"><![CDATA[Join Event]]></string>
     <string name="_bx_events_page_block_title_profile_info_link"><![CDATA[About <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_events_page_block_title_profile_info"><![CDATA[Info]]></string>
     <string name="_bx_events_page_block_title_system_profile_info"><![CDATA[Info]]></string>
+<string name="_bx_events_page_block_title_system_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_events_page_block_title_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_events_page_block_title_profile_pricing_link"><![CDATA[Pricing of <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_events_page_block_title_profile_description"><![CDATA[Description]]></string>
     <string name="_bx_events_page_block_title_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_events_page_block_title_profile_friends"><![CDATA[Friends]]></string>
@@ -227,6 +260,8 @@
     <string name="_bx_events_menu_item_title_clear_reports"><![CDATA[Clear reports]]></string>
     <string name="_bx_events_menu_item_title_system_edit_cover"><![CDATA[Edit Cover]]></string>
     <string name="_bx_events_menu_item_title_edit_cover"><![CDATA[Edit Cover]]></string>
+    <string name="_bx_events_menu_item_title_system_edit_pricing"><![CDATA[Edit Pricing]]></string>
+    <string name="_bx_events_menu_item_title_edit_pricing"><![CDATA[Edit Pricing]]></string>
     <string name="_bx_events_menu_item_title_system_edit_profile"><![CDATA[Edit Event]]></string>
     <string name="_bx_events_menu_item_title_edit_profile"><![CDATA[Edit Event]]></string>
     <string name="_bx_events_menu_item_title_system_delete_profile"><![CDATA[Delete Event]]></string>
@@ -272,6 +307,9 @@
     <string name="_bx_events_menu_item_title_leave_group_cancel_request"><![CDATA[Cancel]]></string>
     <string name="_bx_events_menu_item_title_leave_group_reject_request"><![CDATA[Decline]]></string>
 
+<string name="_bx_events_menu_item_title_system_pay_and_join"><![CDATA[Pay & Join]]></string>
+    <string name="_bx_events_menu_item_title_pay_and_join"><![CDATA[Pay & Join]]></string>
+
     <string name="_bx_events_menu_item_title_system_subscribe"><![CDATA[Follow]]></string>
     <string name="_bx_events_menu_item_title_subscribe"><![CDATA[Interested]]></string>
     <string name="_bx_events_menu_item_title_system_view_entries_in_context"><![CDATA[Events]]></string>
@@ -329,6 +367,22 @@
 	<string name="_bx_events_grid_action_err_delete"><![CDATA[Cannot delete the selected event(s).]]></string>
 	<string name="_bx_events_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
 
+    <string name="_bx_events_grid_column_title_name"><![CDATA[Name]]></string>
+    <string name="_bx_events_grid_column_title_role_id"><![CDATA[Role]]></string>
+    <string name="_bx_events_grid_column_title_period"><![CDATA[Period]]></string>
+    <string name="_bx_events_grid_column_title_price"><![CDATA[Price]]></string>
+    <string name="_bx_events_grid_action_title_add"><![CDATA[Add]]></string>
+    <string name="_bx_events_grid_action_title_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_events_grid_action_title_delete"><![CDATA[Delete]]></string>
+    <string name="_bx_events_grid_action_title_buy"><![CDATA[Buy]]></string>
+    <string name="_bx_events_grid_action_title_buy_title"><![CDATA[One-time payment]]></string>
+    <string name="_bx_events_grid_action_title_subscribe"><![CDATA[Subscribe]]></string>
+    <string name="_bx_events_grid_action_title_subscribe_title"><![CDATA[Create a subscription with recurring billing]]></string>
+    <string name="_bx_events_grid_action_title_choose"><![CDATA[Choose]]></string>
+    <string name="_bx_events_grid_action_title_choose_title"><![CDATA[Switch to the level for free]]></string>
+    <string name="_bx_events_popup_title_price_add"><![CDATA[Add Pricing Plan]]></string>
+    <string name="_bx_events_popup_title_price_edit"><![CDATA[Edit Pricing Plan]]></string>
+
     <string name="_bx_events_chart_growth"><![CDATA[Events: Growth]]></string>
     <string name="_bx_events_chart_growth_speed"><![CDATA[Events: Growth Speed]]></string>
 
@@ -355,6 +409,12 @@
     <string name="_bx_events_txt_invite_popup_button_decline"><![CDATA[Decline]]></string>
     <string name="_bx_events_txt_invite_popup_error_invitation_absent"><![CDATA[Sorry, an error has occurred. You can not join this event. The invitation is expired or deleted.]]></string>
     <string name="_bx_events_txt_invite_popup_error_invitation_wrong_user"><![CDATA[Sorry, an error has occurred. You can not join this event. This invitation cannot be used by you.]]></string>
+    <string name="_bx_events_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_events_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_events_msg_performed"><![CDATA[The action was successfully performed.]]></string>
+    <string name="_bx_events_err_price_duplicate"><![CDATA[Similar pricing plan is already exists.]]></string>
+    <string name="_bx_events_err_cannot_perform"><![CDATA[An error appeared. Please report.]]></string>
 
     <string name="_bx_events_alert_action_fan_added"><![CDATA[member joined]]></string>
     <string name="_bx_events_txt_ntfs_fan_added"><![CDATA[Event <b class="bx-ntfs-content-profile">{owner_name}</b> has got a member <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
@@ -394,6 +454,12 @@
     <string name="_bx_events_role_administrator"><![CDATA[Administrator]]></string>
     <string name="_bx_events_role_moderator"><![CDATA[Moderator]]></string>
 
+    <string name="_bx_events_pre_lists_period_units"><![CDATA[Billing Interval]]></string>
+    <string name="_bx_events_period_unit_day"><![CDATA[day]]></string>
+    <string name="_bx_events_period_unit_week"><![CDATA[week]]></string>
+    <string name="_bx_events_period_unit_month"><![CDATA[month]]></string>
+    <string name="_bx_events_period_unit_year"><![CDATA[year]]></string>
+
     <string name="_bx_events_pre_lists_repeat_year"><![CDATA[Repeat year]]></string>
     <string name="_bx_events_cat_repeat_year_every_year"><![CDATA[Every year]]></string>
     <string name="_bx_events_cat_repeat_year_every_2_years"><![CDATA[Every 2 years]]></string>

+ 5 - 5
modules/boonex/events/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_events';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_events' OR `object` IN('bx_events_create_profile', 'bx_events_delete_profile', 'bx_events_edit_profile', 'bx_events_edit_profile_cover', 'bx_events_invite', 'bx_events_view_profile', 'bx_events_view_profile_closed', 'bx_events_profile_info', 'bx_events_profile_comments', 'bx_events_home', 'bx_events_fans', 'bx_events_joined', 'bx_events_top', 'bx_events_upcoming', 'bx_events_past', 'bx_events_search', 'bx_events_manage', 'bx_events_administration');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_events' OR `object` IN('bx_events_create_profile', 'bx_events_delete_profile', 'bx_events_join_profile', 'bx_events_edit_profile', 'bx_events_edit_profile_cover', 'bx_events_invite', 'bx_events_view_profile', 'bx_events_view_profile_closed', 'bx_events_profile_info', 'bx_events_profile_pricing', 'bx_events_profile_comments', 'bx_events_home', 'bx_events_fans', 'bx_events_joined', 'bx_events_favorites', 'bx_events_top', 'bx_events_upcoming', 'bx_events_past', 'bx_events_search', 'bx_events_manage', 'bx_events_administration');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_events';
@@ -38,9 +38,9 @@ DELETE FROM `sys_statistics` WHERE `name` LIKE 'bx_events%';
 DELETE FROM `sys_objects_chart` WHERE `object` LIKE 'bx_events%';
 
 -- GRIDS
-DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_events_administration', 'bx_events_moderation', 'bx_events_common', 'bx_events_fans', 'bx_events_invites');
-DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_events_administration', 'bx_events_moderation', 'bx_events_common', 'bx_events_fans', 'bx_events_invites');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_events_administration', 'bx_events_moderation', 'bx_events_common', 'bx_events_fans', 'bx_events_invites');
+DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_events_administration', 'bx_events_moderation', 'bx_events_common', 'bx_events_fans', 'bx_events_invites', 'bx_events_prices_manage', 'bx_events_prices_view');
+DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_events_administration', 'bx_events_moderation', 'bx_events_common', 'bx_events_fans', 'bx_events_invites', 'bx_events_prices_manage', 'bx_events_prices_view');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_events_administration', 'bx_events_moderation', 'bx_events_common', 'bx_events_fans', 'bx_events_invites', 'bx_events_prices_manage', 'bx_events_prices_view');
 
 -- ALERTS
 SET @iHandler := (SELECT `id` FROM `sys_alerts_handlers` WHERE `name` = 'bx_events' LIMIT 1);
@@ -57,4 +57,4 @@ DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_events';
 DELETE FROM `sys_objects_uploader` WHERE `object` IN ('bx_events_cover_crop', 'bx_events_picture_crop');
 
 -- CRON
-DELETE FROM `sys_cron_jobs` WHERE `name` = 'bx_events_process_reminders';
+DELETE FROM `sys_cron_jobs` WHERE `name` IN ('bx_events_process_reminders', 'bx_events_pruning');

+ 86 - 28
modules/boonex/events/install/sql/enable.sql

@@ -94,8 +94,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_events_delete_profile', 1, 'bx_events', '_bx_events_page_block_title_delete_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_events\";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_events_join_profile', 'join-event-profile', '_bx_events_page_title_sys_join_profile', '_bx_events_page_title_join_profile', 'bx_events', 5, 2147483647, 1, 'page.php?i=join-event-profile', '', '', '', 0, 1, 0, 'BxEventsPageEntry', 'modules/boonex/events/classes/BxEventsPageEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_events_join_profile', 1, 'bx_events', '_bx_events_page_block_title_join_profile', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_events";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_events_profile_info', 'event-profile-info', '_bx_events_page_title_sys_profile_info', '_bx_events_page_title_profile_info', 'bx_events', 5, 2147483647, 1, 'page.php?i=event-profile-info', '', '', '', 0, 1, 0, 'BxEventsPageEntry', 'modules/boonex/events/classes/BxEventsPageEntry.php');
 
@@ -105,8 +111,14 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_events_profile_info', 3, 'bx_events', '', '_bx_events_page_block_title_profile_calendar', 11, '', 2147483647, 'service', 'a:3:{s:6:\"module\";s:9:\"bx_events\";s:6:\"method\";s:8:\"calendar\";s:6:\"params\";a:2:{i:0;a:1:{s:5:\"event\";s:12:\"{content_id}\";}i:1;s:21:\"calendar_compact.html\";}}', 0, 0, 1, 0),
 ('bx_events_profile_info', 2, 'bx_events', '', '_bx_events_page_block_title_entry_location', 11, '', 2147483647, 'service', 'a:4:{s:6:\"module\";s:6:\"system\";s:6:\"method\";s:13:\"locations_map\";s:6:\"params\";a:2:{i:0;s:9:\"bx_events\";i:1;s:12:\"{content_id}\";}s:5:\"class\";s:20:\"TemplServiceMetatags\";}', 0, 0, 1, 1);
 
--- PAGE: event 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_events_profile_pricing', 'edit-event-pricing', '_bx_events_page_title_sys_profile_pricing', '_bx_events_page_title_profile_pricing', 'bx_events', 5, 2147483647, 1, 'page.php?i=edit-event-pricing', '', '', '', 0, 1, 0, 'BxEventsPageEntry', 'modules/boonex/events/classes/BxEventsPageEntry.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_events_profile_pricing', 1, 'bx_events', '_bx_events_page_block_title_system_profile_pricing', '_bx_events_page_block_title_profile_pricing_link', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_events";s:6:"method";s:14:"entity_pricing";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 0, 1, 1);
 
+-- PAGE: event 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_events_fans', 'event-fans', '_bx_events_page_title_sys_group_fans', '_bx_events_page_title_group_fans', 'bx_events', 5, 2147483647, 1, 'page.php?i=event-fans', '', '', '', 0, 1, 0, 'BxEventsPageEntry', 'modules/boonex/events/classes/BxEventsPageEntry.php');
 
@@ -276,6 +288,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_events_view_actions', 'bx_events', '_bx_events_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_events_view_actions', 'bx_events', 'join-event-profile', '_bx_events_menu_item_title_system_pay_and_join', '_bx_events_menu_item_title_pay_and_join', 'page.php?i=join-event-profile&profile_id={profile_id}', '', '', 'sign-in-alt', '', 0, 2147483647, 'a:3:{s:6:"module";s:9:"bx_events";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_events_view_actions', 'bx_events', 'profile-fan-add', '_bx_events_menu_item_title_system_become_fan', '{title_add_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_events_fans\', \'add\', \'{profile_id}\')', '', 'sign-in-alt', '', 0, 2147483647, '', 1, 0, 0, 5),
 ('bx_events_view_actions', 'bx_events', 'profile-subscribe-add', '_bx_events_menu_item_title_system_subscribe', '_bx_events_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_events_view_actions', 'bx_events', '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_events'', content_id: {content_id}});', '', 'check-circle', '', 0, 192, 'a:2:{s:6:"module";s:9:"bx_events";s:6:"method";s:19:"is_badges_avaliable";}', 1, 0, 1, 30),
@@ -289,13 +302,14 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_events_view_actions_more', 'bx_events', '_bx_events_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_events_view_actions_more', 'bx_events', 'profile-fan-remove', '_bx_events_menu_item_title_system_leave_group', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_events_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, 1, 0, 10),
-('bx_events_view_actions_more', 'bx_events', 'profile-subscribe-remove', '_bx_events_menu_item_title_system_unsubscribe', '_bx_events_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, 1, 0, 20),
-('bx_events_view_actions_more', 'bx_events', 'edit-event-cover', '_bx_events_menu_item_title_system_edit_cover', '_bx_events_menu_item_title_edit_cover', 'page.php?i=edit-event-cover&id={content_id}', '', '', 'edit', '', 2147483647, 1, 0, 30),
-('bx_events_view_actions_more', 'bx_events', 'edit-event-profile', '_bx_events_menu_item_title_system_edit_profile', '_bx_events_menu_item_title_edit_profile', 'page.php?i=edit-event-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 40),
-('bx_events_view_actions_more', 'bx_events', 'invite-to-event', '_bx_events_menu_item_title_system_invite', '_bx_events_menu_item_title_invite', 'page.php?i=invite-to-event&id={content_id}', '', '', 'user-friends', '', 2147483647, 1, 0, 42),
-('bx_events_view_actions_more', 'bx_events', 'delete-event-profile', '_bx_events_menu_item_title_system_delete_profile', '_bx_events_menu_item_title_delete_profile', 'page.php?i=delete-event-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_events_view_actions_more', 'bx_events', 'profile-fan-remove', '_bx_events_menu_item_title_system_leave_group', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_events_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, '', 1, 0, 10),
+('bx_events_view_actions_more', 'bx_events', 'profile-subscribe-remove', '_bx_events_menu_item_title_system_unsubscribe', '_bx_events_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, '', 1, 0, 20),
+('bx_events_view_actions_more', 'bx_events', 'edit-event-cover', '_bx_events_menu_item_title_system_edit_cover', '_bx_events_menu_item_title_edit_cover', 'page.php?i=edit-event-cover&id={content_id}', '', '', 'edit', '', 2147483647, '', 1, 0, 30),
+('bx_events_view_actions_more', 'bx_events', 'edit-event-profile', '_bx_events_menu_item_title_system_edit_profile', '_bx_events_menu_item_title_edit_profile', 'page.php?i=edit-event-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, '', 1, 0, 40),
+('bx_events_view_actions_more', 'bx_events', 'edit-event-pricing', '_bx_events_menu_item_title_system_edit_pricing', '_bx_events_menu_item_title_edit_pricing', 'page.php?i=edit-event-pricing&profile_id={profile_id}', '', '', 'money-check-alt', '', 2147483647, 'a:3:{s:6:"module";s:9:"bx_events";s:6:"method";s:20:"is_pricing_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 41),
+('bx_events_view_actions_more', 'bx_events', 'invite-to-event', '_bx_events_menu_item_title_system_invite', '_bx_events_menu_item_title_invite', 'page.php?i=invite-to-event&id={content_id}', '', '', 'user-friends', '', 2147483647, '', 1, 0, 42),
+('bx_events_view_actions_more', 'bx_events', 'delete-event-profile', '_bx_events_menu_item_title_system_delete_profile', '_bx_events_menu_item_title_delete_profile', 'page.php?i=delete-event-profile&id={content_id}', '', '', 'remove', '', 2147483647, '', 1, 0, 50);
 
 -- MENU: all actions menu for view entry 
 
@@ -306,6 +320,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_events_view_actions_all', 'bx_events', '_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_events_view_actions_all', 'bx_events', 'join-event-profile', '_bx_events_menu_item_title_system_pay_and_join', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 5),
 ('bx_events_view_actions_all', 'bx_events', 'profile-fan-add', '_bx_events_menu_item_title_system_become_fan', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 10),
 ('bx_events_view_actions_all', 'bx_events', 'profile-fan-remove', '_bx_events_menu_item_title_system_leave_group', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 20),
 ('bx_events_view_actions_all', 'bx_events', 'profile-subscribe-add', '_bx_events_menu_item_title_system_subscribe', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 30),
@@ -326,6 +341,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_events_view_actions_all', 'bx_events', 'social-sharing-pinterest', '_sys_menu_item_title_system_social_sharing_pinterest', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 330),
 ('bx_events_view_actions_all', 'bx_events', 'edit-event-cover', '_bx_events_menu_item_title_system_edit_cover', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 400),
 ('bx_events_view_actions_all', 'bx_events', 'edit-event-profile', '_bx_events_menu_item_title_system_edit_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 410),
+('bx_events_view_actions_all', 'bx_events', 'edit-event-pricing', '_bx_events_menu_item_title_system_edit_pricing', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 415),
 ('bx_events_view_actions_all', 'bx_events', 'invite-to-event', '_bx_events_menu_item_title_system_invite', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 420),
 ('bx_events_view_actions_all', 'bx_events', 'delete-event-profile', '_bx_events_menu_item_title_system_delete_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 430),
 ('bx_events_view_actions_all', 'bx_events', '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);
@@ -382,22 +398,23 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_events_snippet_meta', 'bx_events', '_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_events_snippet_meta', 'bx_events', 'date-start', '_bx_events_menu_item_title_system_sm_date_start', '_bx_events_menu_item_title_sm_date_start', '', '', '', '', '', 2147483647, 0, 0, 1, 0),
-('bx_events_snippet_meta', 'bx_events', 'date-end', '_bx_events_menu_item_title_system_sm_date_end', '_bx_events_menu_item_title_sm_date_end', '', '', '', '', '', 2147483647, 0, 0, 1, 0),
-('bx_events_snippet_meta', 'bx_events', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, 0, 0, 1, 1),
-('bx_events_snippet_meta', 'bx_events', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, 0, 0, 1, 2),
-('bx_events_snippet_meta', 'bx_events', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, 0, 0, 1, 3),
-('bx_events_snippet_meta', 'bx_events', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, 0, 0, 1, 4),
-('bx_events_snippet_meta', 'bx_events', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, 1, 0, 1, 5),
-('bx_events_snippet_meta', 'bx_events', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, 0, 0, 1, 6),
-('bx_events_snippet_meta', 'bx_events', 'country', '_sys_menu_item_title_system_sm_country', '_sys_menu_item_title_sm_country', '', '', '', '', '', 2147483647, 0, 0, 1, 7),
-('bx_events_snippet_meta', 'bx_events', 'country-city', '_sys_menu_item_title_system_sm_country_city', '_sys_menu_item_title_sm_country_city', '', '', '', '', '', 2147483647, 0, 0, 1, 8),
-('bx_events_snippet_meta', 'bx_events', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, 1, 0, 1, 9),
-('bx_events_snippet_meta', 'bx_events', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 1, 0, 1, 10),
-('bx_events_snippet_meta', 'bx_events', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, 0, 0, 1, 11),
-('bx_events_snippet_meta', 'bx_events', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 12),
-('bx_events_snippet_meta', 'bx_events', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 13);
+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_events_snippet_meta', 'bx_events', 'date-start', '_bx_events_menu_item_title_system_sm_date_start', '_bx_events_menu_item_title_sm_date_start', '', '', '', '', '', 2147483647, '', 0, 0, 1, 0),
+('bx_events_snippet_meta', 'bx_events', 'date-end', '_bx_events_menu_item_title_system_sm_date_end', '_bx_events_menu_item_title_sm_date_end', '', '', '', '', '', 2147483647, '', 0, 0, 1, 0),
+('bx_events_snippet_meta', 'bx_events', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, '', 0, 0, 1, 1),
+('bx_events_snippet_meta', 'bx_events', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, '', 0, 0, 1, 2),
+('bx_events_snippet_meta', 'bx_events', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, '', 0, 0, 1, 3),
+('bx_events_snippet_meta', 'bx_events', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, '', 0, 0, 1, 4),
+('bx_events_snippet_meta', 'bx_events', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, '', 1, 0, 1, 5),
+('bx_events_snippet_meta', 'bx_events', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, '', 0, 0, 1, 6),
+('bx_events_snippet_meta', 'bx_events', 'country', '_sys_menu_item_title_system_sm_country', '_sys_menu_item_title_sm_country', '', '', '', '', '', 2147483647, '', 0, 0, 1, 7),
+('bx_events_snippet_meta', 'bx_events', 'country-city', '_sys_menu_item_title_system_sm_country_city', '_sys_menu_item_title_sm_country_city', '', '', '', '', '', 2147483647, '', 0, 0, 1, 8),
+('bx_events_snippet_meta', 'bx_events', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, '', 1, 0, 1, 9),
+('bx_events_snippet_meta', 'bx_events', '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_events";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, 10),
+('bx_events_snippet_meta', 'bx_events', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:9:"bx_events";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, 11),
+('bx_events_snippet_meta', 'bx_events', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, '', 0, 0, 1, 12),
+('bx_events_snippet_meta', 'bx_events', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 13),
+('bx_events_snippet_meta', 'bx_events', '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);
@@ -433,6 +450,10 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 ('bx_events', 'create entry', NULL, '_bx_events_acl_action_create_profile', '', 1, 1);
 SET @iIdActionProfileCreate = LAST_INSERT_ID();
 
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('bx_events', 'use paid join', NULL, '_bx_events_acl_action_use_paid_join', '', 1, 1);
+SET @iIdActionUsePaidJoin = LAST_INSERT_ID();
+
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
 ('bx_events', 'delete entry', NULL, '_bx_events_acl_action_delete_profile', '', 1, 1);
 SET @iIdActionProfileDelete = LAST_INSERT_ID();
@@ -474,6 +495,12 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iAdministrator, @iIdActionProfileCreate),
 (@iPremium, @iIdActionProfileCreate),
 
+-- use paid join
+(@iStandard, @iIdActionUsePaidJoin),
+(@iModerator, @iIdActionUsePaidJoin),
+(@iAdministrator, @iIdActionUsePaidJoin),
+(@iPremium, @iIdActionUsePaidJoin),
+
 -- profile delete
 (@iAccount, @iIdActionProfileDelete),
 (@iStandard, @iIdActionProfileDelete),
@@ -539,7 +566,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_events_fans', 'name', '_sys_name', '50%', '', 10),
 ('bx_events_fans', 'role', '_bx_events_txt_role', '10%', '', 15),
-('bx_events_fans', 'actions', '', '40%', '', 20);
+('bx_events_fans', 'role_added', '_bx_events_txt_role_added', '10%', '', 16),
+('bx_events_fans', 'role_expired', '_bx_events_txt_role_expired', '10%', '', 17),
+('bx_events_fans', 'actions', '', '20%', '', 20);
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `confirm`, `order`) VALUES
 ('bx_events_fans', 'single', 'accept', '_sys_accept', '', 0, 10),
@@ -588,6 +617,34 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_events_common', 'bulk', 'delete_with_content', '_bx_events_grid_action_title_adm_delete_with_content', '', 0, 1, 2),
 ('bx_events_common', 'single', 'settings', '_bx_events_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_events_prices_manage', 'Sql', 'SELECT * FROM `bx_events_prices` WHERE 1 ', 'bx_events_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxEventsGridPricesManage', 'modules/boonex/events/classes/BxEventsGridPricesManage.php'),
+('bx_events_prices_view', 'Sql', 'SELECT * FROM `bx_events_prices` WHERE 1 ', 'bx_events_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxEventsGridPricesView', 'modules/boonex/events/classes/BxEventsGridPricesView.php');
+
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('bx_events_prices_manage', 'checkbox', '_sys_select', '1%', 0, '', '', 1),
+('bx_events_prices_manage', 'order', '', '1%', 0, '', '', 2),
+('bx_events_prices_manage', 'name', '_bx_events_grid_column_title_name', '38%', 0, 32, '', 3),
+('bx_events_prices_manage', 'price', '_bx_events_grid_column_title_price', '20%', 0, 16, '', 4),
+('bx_events_prices_manage', 'period', '_bx_events_grid_column_title_period', '20%', 0, 16, '', 5),
+('bx_events_prices_manage', 'actions', '', '20%', 0, '', '', 6),
+
+('bx_events_prices_view', 'role_id', '_bx_events_grid_column_title_role_id', '40%', 0, 32, '', 1),
+('bx_events_prices_view', 'price', '_bx_events_grid_column_title_price', '20%', 0, 16, '', 2),
+('bx_events_prices_view', 'period', '_bx_events_grid_column_title_period', '20%', 0, 16, '', 3),
+('bx_events_prices_view', 'actions', '', '20%', 0, '', '', 4);
+
+INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
+('bx_events_prices_manage', 'independent', 'add', '_bx_events_grid_action_title_add', '', 0, 0, 1),
+('bx_events_prices_manage', 'single', 'edit', '_bx_events_grid_action_title_edit', 'pencil-alt', 1, 0, 1),
+('bx_events_prices_manage', 'single', 'delete', '_bx_events_grid_action_title_delete', 'remove', 1, 1, 2),
+('bx_events_prices_manage', 'bulk', 'delete', '_bx_events_grid_action_title_delete', '', 0, 1, 1),
+
+('bx_events_prices_view', 'single', 'buy', '_bx_events_grid_action_title_buy', 'cart-plus', 0, 0, 1),
+('bx_events_prices_view', 'single', 'subscribe', '_bx_events_grid_action_title_subscribe', 'credit-card', 0, 0, 2),
+('bx_events_prices_view', 'single', 'choose', '_bx_events_grid_action_title_choose', 'far check-square', 0, 0, 3);
+
 
 -- ALERTS
 INSERT INTO `sys_alerts_handlers` (`name`, `class`, `file`, `service_call`) VALUES 
@@ -621,7 +678,7 @@ INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `defau
 ('bx_events_allow_view_to', 'bx_events', 'view', '_bx_events_form_profile_input_allow_view_to', '3', 'bx_groups,bx_spaces', 'bx_events_data', 'id', 'author', 'BxEventsPrivacy', 'modules/boonex/events/classes/BxEventsPrivacy.php'),
 ('bx_events_allow_view_notification_to', 'bx_events', 'view_event', '_bx_events_form_profile_input_allow_view_notification_to', '3', '', 'bx_notifications_events', 'id', 'object_owner_id', 'BxEventsPrivacyNotifications', 'modules/boonex/events/classes/BxEventsPrivacyNotifications.php'),
 ('bx_events_allow_post_to', 'bx_events', 'post', '_bx_events_form_profile_input_allow_post_to', 'p', '', 'bx_events_data', 'id', 'author', 'BxEventsPrivacyPost', 'modules/boonex/events/classes/BxEventsPrivacyPost.php'),
-('bx_events_allow_view_favorite_list', 'bx_events', 'view_favorite_list', '_bx_events_form_entry_input_allow_view_favorite_list', '3', '', 'bx_events_favorites_lists', 'id', 'author_id', 'BxEventsPrivacy', 'modules/boonex/events/classes/BxEventsPrivacy.php');
+('bx_events_allow_view_favorite_list', 'bx_events', 'view_favorite_list', '_bx_events_form_profile_input_allow_view_favorite_list', '3', '', 'bx_events_favorites_lists', 'id', 'author_id', 'BxEventsPrivacy', 'modules/boonex/events/classes/BxEventsPrivacy.php');
 
 
 -- EMAIL TEMPLATES
@@ -643,4 +700,5 @@ INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `
 
 -- CRON
 INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
-('bx_events_process_reminders', '55 * * * *', 'BxEventsCronProcessReminders', 'modules/boonex/events/classes/BxEventsCronProcessReminders.php', '');
+('bx_events_process_reminders', '55 * * * *', 'BxEventsCronProcessReminders', 'modules/boonex/events/classes/BxEventsCronProcessReminders.php', ''),
+('bx_events_pruning', '0 0 * * *', 'BxEventsCronPruning', 'modules/boonex/events/classes/BxEventsCronPruning.php', '');

+ 67 - 0
modules/boonex/events/install/sql/install.sql

@@ -217,7 +217,9 @@ CREATE TABLE IF NOT EXISTS `bx_events_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`)
 );
@@ -269,6 +271,21 @@ CREATE TABLE IF NOT EXISTS `bx_events_invites` (
   PRIMARY KEY (`id`)
 );
 
+-- TABLE: Pricing
+CREATE TABLE IF NOT EXISTS `bx_events_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
 ('bx_events_pics', @sStorageEngine, '', 360, 2592000, 3, 'bx_events_pics', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
@@ -426,6 +443,46 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_event_view_full', 'timezone', 2147483647, 1, 14),
 ('bx_event_view_full', 'event_desc', 2147483647, 0, 15);
 
+-- 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_events_price', 'bx_events', '_bx_events_form_price', '', '', 'do_submit', 'bx_events_prices', 'id', '', '', '', 0, 1, 'BxEventsFormPrice', 'modules/boonex/events/classes/BxEventsFormPrice.php');
+
+INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
+('bx_events_price_add', 'bx_events', 'bx_events_price', '_bx_events_form_price_display_add', 0),
+('bx_events_price_edit', 'bx_events', 'bx_events_price', '_bx_events_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_events_price', 'bx_events', 'id', '', '', 0, 'hidden', '_bx_events_form_price_input_sys_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_events_price', 'bx_events', 'role_id', '', '', 0, 'hidden', '_bx_events_form_price_input_sys_role_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_events_price', 'bx_events', 'name', '', '', 0, 'text', '_bx_events_form_price_input_sys_name', '_bx_events_form_price_input_name', '_bx_events_form_price_input_inf_name', 1, 0, 0, '', '', '', 'Avail', '', '_bx_events_form_price_input_err_name', 'Xss', '', 1, 0),
+('bx_events_price', 'bx_events', 'period', '', '', 0, 'text', '_bx_events_form_price_input_sys_period', '_bx_events_form_price_input_period', '_bx_events_form_price_input_inf_period', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_events_price', 'bx_events', 'period_unit', '', '#!bx_events_period_units', 0, 'select', '_bx_events_form_price_input_sys_period_unit', '_bx_events_form_price_input_period_unit', '_bx_events_form_price_input_inf_period_unit', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
+('bx_events_price', 'bx_events', 'price', '', '', 0, 'text', '_bx_events_form_price_input_sys_price', '_bx_events_form_price_input_price', '_bx_events_form_price_input_inf_price', 1, 0, 0, '', '', '', '', '', '', 'Float', '', 1, 0),
+('bx_events_price', 'bx_events', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_events_price', 'bx_events', 'do_submit', '_bx_events_form_price_input_do_submit', '', 0, 'submit', '_bx_events_form_price_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_events_price', 'bx_events', 'do_cancel', '_bx_events_form_price_input_do_cancel', '', 0, 'button', '_bx_events_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_events_price_add', 'id', 2147483647, 0, 1),
+('bx_events_price_add', 'role_id', 2147483647, 1, 2),
+('bx_events_price_add', 'name', 2147483647, 1, 3),
+('bx_events_price_add', 'price', 2147483647, 1, 4),
+('bx_events_price_add', 'period', 2147483647, 1, 5),
+('bx_events_price_add', 'period_unit', 2147483647, 1, 6),
+('bx_events_price_add', 'controls', 2147483647, 1, 7),
+('bx_events_price_add', 'do_submit', 2147483647, 1, 8),
+('bx_events_price_add', 'do_cancel', 2147483647, 1, 9),
+
+('bx_events_price_edit', 'id', 2147483647, 1, 1),
+('bx_events_price_edit', 'role_id', 2147483647, 1, 2),
+('bx_events_price_edit', 'name', 2147483647, 1, 3),
+('bx_events_price_edit', 'price', 2147483647, 1, 4),
+('bx_events_price_edit', 'period', 2147483647, 1, 5),
+('bx_events_price_edit', 'period_unit', 2147483647, 1, 6),
+('bx_events_price_edit', 'controls', 2147483647, 1, 7),
+('bx_events_price_edit', 'do_submit', 2147483647, 1, 8),
+('bx_events_price_edit', 'do_cancel', 2147483647, 1, 9);
+
 -- PRE-VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
 ('bx_events_reminder', '_bx_events_pre_lists_reminder', 'bx_events', '0');
@@ -464,6 +521,16 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALU
 ('bx_events_roles', '1', 2, '_bx_events_role_administrator', ''),
 ('bx_events_roles', '2', 3, '_bx_events_role_moderator', '');
 
+INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
+('bx_events_period_units', '_bx_events_pre_lists_period_units', 'bx_events', '0');
+
+INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
+('bx_events_period_units', '', 0, '_sys_please_select', ''),
+('bx_events_period_units', 'day', 1, '_bx_events_period_unit_day', ''),
+('bx_events_period_units', 'week', 2, '_bx_events_period_unit_week', ''),
+('bx_events_period_units', 'month', 3, '_bx_events_period_unit_month', ''),
+('bx_events_period_units', 'year', 4, '_bx_events_period_unit_year', '');
+
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
 ('bx_events_repeat_year', '_bx_events_pre_lists_repeat_year', 'bx_events', '0');
 

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

@@ -1,6 +1,6 @@
 
 -- TABLES
-DROP TABLE IF EXISTS `bx_events_data`, `bx_events_intervals`, `bx_events_pics`, `bx_events_pics_resized`, `bx_events_cmts`, `bx_events_cmts_notes`, `bx_events_views_track`, `bx_events_meta_keywords`, `bx_events_meta_locations`, `bx_events_meta_mentions`, `bx_events_fans`, `bx_events_admins`, `bx_events_votes`, `bx_events_votes_track`, `bx_events_reports`, `bx_events_reports_track`, `bx_events_favorites_track`, `bx_events_favorites_lists`, `bx_events_scores`, `bx_events_scores_track`, `bx_events_invites`;
+DROP TABLE IF EXISTS `bx_events_data`, `bx_events_intervals`, `bx_events_pics`, `bx_events_pics_resized`, `bx_events_cmts`, `bx_events_cmts_notes`, `bx_events_views_track`, `bx_events_meta_keywords`, `bx_events_meta_locations`, `bx_events_meta_mentions`, `bx_events_fans`, `bx_events_admins`, `bx_events_votes`, `bx_events_votes_track`, `bx_events_reports`, `bx_events_reports_track`, `bx_events_favorites_track`, `bx_events_favorites_lists`, `bx_events_scores`, `bx_events_scores_track`, `bx_events_invites`, `bx_events_prices`;
 
 -- PROFILES
 DELETE FROM sys_profiles WHERE `type` = 'bx_events';
@@ -17,7 +17,7 @@ DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_event
 DELETE FROM `sys_objects_form` WHERE `module` = 'bx_events';
 DELETE FROM `sys_form_displays` WHERE `module` = 'bx_events';
 DELETE FROM `sys_form_inputs` WHERE `module` = 'bx_events';
-DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_event_add', 'bx_event_delete', 'bx_event_edit', 'bx_event_edit_cover', 'bx_event_view', 'bx_event_view_full', 'bx_event_invite');
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_event_add', 'bx_event_delete', 'bx_event_edit', 'bx_event_edit_cover', 'bx_event_view', 'bx_event_view_full', 'bx_event_invite', 'bx_events_price_add', 'bx_events_price_edit');
 
 -- PRE-VALUES
 DELETE FROM `sys_form_pre_lists` WHERE `module` = 'bx_events';

+ 59 - 0
modules/boonex/events/js/prices.js

@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Groups Groups
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+
+function BxEventsPrices(oOptions) {
+    this._sActionsUri = oOptions.sActionUri;
+    this._sActionsUrl = oOptions.sActionUrl;
+    this._sObjNameGrid = oOptions.sObjNameGrid;
+    this._sObjName = oOptions.sObjName == undefined ? 'oBxEventsPrices' : oOptions.sObjName;
+    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
+    this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
+}
+
+BxEventsPrices.prototype.checkName = function(sNameId, iId) {
+    var oDate = new Date();
+
+    var oName = jQuery("[name='" + sNameId + "']");
+    var sName = oName.val();
+
+    if(!sName.length)
+        return;
+
+    jQuery.get(
+        this._sActionsUrl + 'check_name',
+        {
+            name: sName,
+            id: iId && parseInt(iId) > 0 ? iId : 0,
+            _t: oDate.getTime()
+        },
+        function(oData) {
+            if(!oData || oData.name == undefined)
+                return;
+
+            oName.val(oData.name);
+        },
+        'json'
+    );
+};
+
+BxEventsPrices.prototype.onChangeRole = function() {
+	this.reloadGrid($('#bx-grid-level-' + this._sObjNameGrid).val());
+};
+
+BxEventsPrices.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);
+};
+
+/** @} */

+ 1 - 0
modules/boonex/events/template/css/prices.css

@@ -0,0 +1 @@
+@import url(../../../../base/groups/template/css/prices.css);

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

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

+ 1 - 2
modules/boonex/groups/classes/BxGroupsConfig.php

@@ -144,7 +144,7 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
             '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',
+            'OBJECT_PRE_LIST_PERIOD_UNITS' => 'bx_groups_period_units',
             
             'BADGES_AVALIABLE' => true,
             'INVITES_KEYS_LIFETIME' => 86400,
@@ -197,7 +197,6 @@ class BxGroupsConfig extends BxBaseModGroupsConfig
                 'txt_ntfs_fan_added' => '_bx_groups_txt_ntfs_fan_added',
                 'txt_ntfs_timeline_post_common' => '_bx_groups_txt_ntfs_timeline_post_common',
                 'option_members_mode_multi_roles' => '_bx_groups_option_members_mode_multi_roles',
-                'option_members_mode_paid_join' => '_bx_groups_option_members_mode_paid_join',
                 'form_field_author' => '_bx_groups_form_entry_input_author',
                 'menu_item_title_befriend_sent' => '_bx_groups_menu_item_title_befriend_sent',
                 'menu_item_title_unfriend_cancel_request' => '_bx_groups_menu_item_title_unfriend_cancel_request',

+ 1 - 2
modules/boonex/groups/install/langs/en.xml

@@ -9,7 +9,6 @@
     <string name="_bx_groups_option_searchable_fields"><![CDATA[Searchable fields]]></string>
     <string name="_bx_groups_option_members_mode"><![CDATA[Special mode for group members]]></string>
     <string name="_bx_groups_option_members_mode_multi_roles"><![CDATA[Multi Roles]]></string>
-    <string name="_bx_groups_option_members_mode_paid_join"><![CDATA[Paid Join]]></string>
     <string name="_bx_groups_option_per_page_for_favorites_lists"><![CDATA[Number of favorite lists per page]]></string>
     <string name="_bx_groups_option_internal_notifications"><![CDATA[Use internal notifications]]></string>
 
@@ -27,7 +26,7 @@
     <string name="_bx_groups_form_profile_input_join_confirm"><![CDATA[Join confirmation]]></string>
     <string name="_bx_groups_form_profile_input_sys_allow_view_to"><![CDATA[Visible to]]></string>
     <string name="_bx_groups_form_profile_input_allow_view_to"><![CDATA[Visible to]]></string>
-    <string name="_bx_groups_form_entry_input_allow_view_favorite_list"><![CDATA[Visibility]]></string>
+    <string name="_bx_groups_form_profile_input_allow_view_favorite_list"><![CDATA[Visibility]]></string>
     <string name="_bx_groups_form_profile_input_allow_view_to_desc"><![CDATA[Closed - anyone can find the group and see who's in it, only members can see posts. Secret - only members can find the group and see posts.]]></string>
     <string name="_bx_groups_form_profile_input_sys_allow_post_to"><![CDATA[Who can post]]></string>
     <string name="_bx_groups_form_profile_input_allow_post_to"><![CDATA[Who can post]]></string>

+ 1 - 1
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_context', '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');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_groups' OR `object` IN('bx_groups_create_profile', 'bx_groups_delete_profile', 'bx_groups_context', '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_favorites', 'bx_groups_top', 'bx_groups_search', 'bx_groups_manage', 'bx_groups_administration');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_groups';

+ 1 - 1
modules/boonex/groups/install/sql/enable.sql

@@ -645,7 +645,7 @@ INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `defau
 ('bx_groups_allow_view_to', 'bx_groups', 'view', '_bx_groups_form_profile_input_allow_view_to', '3', 'bx_events,bx_spaces', 'bx_groups_data', 'id', 'author', 'BxGroupsPrivacy', 'modules/boonex/groups/classes/BxGroupsPrivacy.php'),
 ('bx_groups_allow_view_notification_to', 'bx_groups', 'view_event', '_bx_groups_form_profile_input_allow_view_notification_to', '3', '', 'bx_notifications_events', 'id', 'object_owner_id', 'BxGroupsPrivacyNotifications', 'modules/boonex/groups/classes/BxGroupsPrivacyNotifications.php'),
 ('bx_groups_allow_post_to', 'bx_groups', 'post', '_bx_groups_form_profile_input_allow_post_to', 'p', '', 'bx_groups_data', 'id', 'author', 'BxGroupsPrivacyPost', 'modules/boonex/groups/classes/BxGroupsPrivacyPost.php'),
-('bx_groups_allow_view_favorite_list', 'bx_groups', 'view_favorite_list', '_bx_groups_form_entry_input_allow_view_favorite_list', '3', '', 'bx_groups_favorites_lists', 'id', 'author_id', 'BxGroupsPrivacy', 'modules/boonex/groups/classes/BxGroupsPrivacy.php');
+('bx_groups_allow_view_favorite_list', 'bx_groups', 'view_favorite_list', '_bx_groups_form_profile_input_allow_view_favorite_list', '3', '', 'bx_groups_favorites_lists', 'id', 'author_id', 'BxGroupsPrivacy', 'modules/boonex/groups/classes/BxGroupsPrivacy.php');
 -- EMAIL TEMPLATES
 
 INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES

+ 1 - 7
modules/boonex/groups/template/css/main.css

@@ -1,7 +1 @@
-@import url(../../../../base/groups/template/css/main.css);
-
-
-/*-- Group Roles --*/
-#bx-groups-set-role-popup .bx-menu-ver {
-    margin: 0;
-}
+@import url(../../../../base/groups/template/css/main.css);

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

@@ -1,17 +1 @@
-/*--- 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 {}
+@import url(../../../../base/groups/template/css/prices.css);

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
modules/boonex/lucid/install/sql/install.sql


+ 2 - 2
modules/boonex/market/install/sql/enable.sql

@@ -437,8 +437,8 @@ INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `defau
 ('bx_market_allow_view_to', 'bx_market', 'view', '_bx_market_form_entry_input_allow_view_to', '3', 'all', 'bx_market_products', 'id', 'author', '', ''),
 ('bx_market_allow_purchase_to', 'bx_market', 'purchase', '_bx_market_form_entry_input_allow_purchase_to', '3', '', 'bx_market_products', 'id', 'author', '', ''),
 ('bx_market_allow_comment_to', 'bx_market', 'comment', '_bx_market_form_entry_input_allow_comment_to', 'c', '', 'bx_market_products', 'id', 'author', 'BxMarketPrivacy', 'modules/boonex/market/classes/BxMarketPrivacy.php'),
-('bx_market_allow_vote_to', 'bx_market', 'vote', '_bx_market_form_entry_input_allow_vote_to', 'c', '', 'bx_market_products', 'id', 'author', 'BxMarketPrivacy', 'modules/boonex/market/classes/BxMarketPrivacy.php');
-
+('bx_market_allow_vote_to', 'bx_market', 'vote', '_bx_market_form_entry_input_allow_vote_to', 'c', '', 'bx_market_products', 'id', 'author', 'BxMarketPrivacy', 'modules/boonex/market/classes/BxMarketPrivacy.php'),
+('bx_market_allow_view_favorite_list', 'bx_market', 'view_favorite_list', '_bx_market_form_entry_input_allow_view_favorite_list', '3', 'all', 'bx_market_favorites_lists', 'id', 'author_id', '', '');
 
 
 -- ACL

+ 1 - 0
modules/boonex/market/js/entry.js

@@ -104,6 +104,7 @@ BxMarketEntry.prototype.initScreenshots = function() {
 	var bBusy = false;
 
 	oItems.find('a[rel=group]').fancybox({
+            type: 'image',
             transitionIn: 'elastic',
             transitionOut: 'elastic',
             speedIn: 600,

+ 26 - 6
modules/boonex/organizations/classes/BxOrgsConfig.php

@@ -43,6 +43,7 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
             'TABLE_ENTRIES' => $aModule['db_prefix'] . 'data',
             'TABLE_ENTRIES_FULLTEXT' => 'search_fields',
             'TABLE_ADMINS' => $aModule['db_prefix'] . 'admins',
+            'TABLE_PRICES' => $aModule['db_prefix'] . 'prices',
 
             // database fields
             'FIELD_ID' => 'id',
@@ -67,6 +68,9 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
             'FIELD_MULTICAT' => 'multicat',
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
 
+            'FIELD_PRICE_ROLE_ID' => 'role_id',
+            'FIELD_PRICE_NAME' => 'name',
+
             // page URIs
             'URI_VIEW_ENTRY' => 'view-organization-profile',
             'URI_VIEW_FRIENDS' => 'organization-profile-friends',
@@ -74,6 +78,7 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
             'URI_VIEW_FAVORITES' => 'organization-profile-favorites',
             'URI_EDIT_ENTRY' => 'edit-organization-profile',
             'URI_EDIT_COVER' => 'edit-organization-cover',
+            'URI_JOIN_ENTRY' => 'join-organization-profile',
             'URI_JOINED_ENTRIES' => 'joined-organizations',
             'URI_MANAGE_COMMON' => 'organizations-manage',
             'URI_VIEW_SUBSCRIPTIONS' => 'organization-profile-subscriptions',
@@ -95,6 +100,8 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
             'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_organizations_per_page_browse_showcase',
             'PARAM_PER_PAGE_BROWSE_RECOMMENDED' => 'bx_organizations_per_page_browse_recommended',
             'PARAM_MMODE' => 'bx_organizations_members_mode',
+            'PARAM_PAID_JOIN_ENABLED' => true,
+            'PARAM_RECURRING_RESERVE' => 3, // 3 days for recurring payment to be registered
             'PARAM_PUBLIC_SBSN' => 'bx_organizations_public_subscriptions',
             'PARAM_PUBLIC_SBSD' => 'bx_organizations_public_subscribed_me',
             'PARAM_SBS_WO_JOIN' => 'bx_organizations_enable_subscribe_wo_join',
@@ -134,6 +141,9 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
             'OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER' => 'bx_organization_edit_cover',
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_organization_delete',
             'OBJECT_FORM_ENTRY_DISPLAY_INVITE' => 'bx_organization_invite',
+            'OBJECT_FORM_PRICE' => 'bx_organizations_price',
+            'OBJECT_FORM_PRICE_DISPLAY_ADD' => 'bx_organizations_price_add',
+            'OBJECT_FORM_PRICE_DISPLAY_EDIT' => 'bx_organizations_price_edit',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_organizations_view_actions', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_organizations_view_actions_more', // actions menu on view entry page for "more" popup
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_organizations_view_actions_all', // all actions menu on view entry page
@@ -154,10 +164,13 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
             'OBJECT_GRID_ADMINISTRATION' => 'bx_organizations_administration',
             'OBJECT_GRID_COMMON' => 'bx_organizations_common',
             'OBJECT_GRID_CONNECTIONS' => 'bx_organizations_fans',
+            'OBJECT_GRID_PRICES_MANAGE' => 'bx_organizations_prices_manage',
+            'OBJECT_GRID_PRICES_VIEW' => 'bx_organizations_prices_view',
             'OBJECT_CONNECTIONS' => 'bx_organizations_fans',
             'OBJECT_UPLOADERS_COVER' => array('bx_organizations_cover_crop'),
             'OBJECT_UPLOADERS_PICTURE' => array('bx_organizations_picture_crop'),
             'OBJECT_PRE_LIST_ROLES' => 'bx_organizations_roles',
+            'OBJECT_PRE_LIST_PERIOD_UNITS' => 'bx_organizations_period_units',
             
             'BADGES_AVALIABLE' => true,
 
@@ -253,26 +266,33 @@ class BxOrgsConfig extends BxBaseModGroupsConfig
                 'option_activation_on' => '_bx_orgs_option_activation_on',
             	'option_activation_off' => '_bx_orgs_option_activation_off',
             	'option_activation_add' => '_bx_orgs_option_activation_add',
-                'option_activation_edit' => '_bx_orgs_option_activation_edit'
+                'option_activation_edit' => '_bx_orgs_option_activation_edit',
+                'txt_n_unit' => '_bx_orgs_txt_n_unit',
+                'txt_buy_title' => '_bx_orgs_grid_action_title_buy_title',
+                'txt_cart_item_title' => '_bx_orgs_txt_cart_item_title',
+                'txt_subscribe_title' => '_bx_orgs_grid_action_title_subscribe_title',
+                'msg_performed' => '_bx_orgs_msg_performed',
+                'err_cannot_perform' => '_bx_orgs_err_cannot_perform',
             ),
         ));
 
         $this->_aJsClasses = array(
             'main' => 'BxOrgsMain',
             'manage_tools' => 'BxOrgsManageTools',
-            'categories' => 'BxDolCategories'
+            'categories' => 'BxDolCategories',
+            'prices' => 'BxOrgsPrices'
         );
 
         $this->_aJsObjects = array(
             'main' => 'oBxOrgsMain',
             'manage_tools' => 'oBxOrgsManageTools',
-            'categories' => 'oBxDolCategories'
+            'categories' => 'oBxDolCategories',
+            'prices' => 'oBxOrgsPrices'
         );
 
         $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/organizations/classes/BxOrgsCronPruning.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    Organizations Organizations
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxOrgsCronPruning extends BxBaseModGroupsCronPruning
+{
+    public function __construct()
+    {
+        $this->_sModule = 'bx_organizations';
+
+        parent::__construct();
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/organizations/classes/BxOrgsFormPrice.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    Organizations Organizations
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxOrgsFormPrice extends BxBaseModGroupsFormPrice
+{
+    public function __construct($aInfo, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_organizations';
+
+        parent::__construct($aInfo, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/organizations/classes/BxOrgsGridPricesManage.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    Organizations Organizations
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxOrgsGridPricesManage extends BxBaseModGroupsGridPricesManage
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_organizations';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 30 - 0
modules/boonex/organizations/classes/BxOrgsGridPricesView.php

@@ -0,0 +1,30 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Organizations Organizations
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxOrgsGridPricesView extends BxBaseModGroupsGridPricesView
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_organizations';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+    
+    public function setSellerId($iSellerId = 0)
+    {
+        if(empty($iSellerId) && !empty($this->_iGroupProfileId))
+            $iSellerId = $this->_iGroupProfileId;
+
+        parent::setSellerId($iSellerId);
+    }
+}
+
+/** @} */

+ 10 - 0
modules/boonex/organizations/classes/BxOrgsMenuViewActionsAll.php

@@ -21,6 +21,11 @@ class BxOrgsMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         parent::__construct($aObject, $oTemplate);
     }
 
+    protected function _getMenuItemJoinOrganizationProfile($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
     protected function _getMenuItemEditOrganizationCover($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);
@@ -31,6 +36,11 @@ class BxOrgsMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         return $this->_getMenuItemByNameActionsMore($aItem);
     }
 
+    protected function _getMenuItemEditOrganizationPricing($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+
     protected function _getMenuItemInviteToOrganization($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);

+ 67 - 0
modules/boonex/organizations/install/langs/en.xml

@@ -88,7 +88,32 @@
     <string name="_bx_orgs_form_profile_input_sys_followers_count"><![CDATA[Followers count]]></string>
     <string name="_bx_orgs_form_profile_input_followers_count"><![CDATA[Followers count]]></string>
 
+    <string name="_bx_orgs_form_price"><![CDATA[Price]]></string>
+    <string name="_bx_orgs_form_price_display_add"><![CDATA[Add]]></string>
+    <string name="_bx_orgs_form_price_display_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_orgs_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_orgs_form_price_input_sys_role_id"><![CDATA[Role ID]]></string>
+    <string name="_bx_orgs_form_price_input_sys_name"><![CDATA[Name]]></string>
+    <string name="_bx_orgs_form_price_input_name"><![CDATA[Name]]></string>
+    <string name="_bx_orgs_form_price_input_inf_name"><![CDATA[Unique value which will be used in back end and API calls]]></string>
+    <string name="_bx_orgs_form_price_input_err_name"><![CDATA[You need to enter a unique value here]]></string>
+    <string name="_bx_orgs_form_price_input_sys_period"><![CDATA[Period]]></string>
+    <string name="_bx_orgs_form_price_input_period"><![CDATA[Period]]></string>
+    <string name="_bx_orgs_form_price_input_inf_period"><![CDATA[Use 0 for lifetime]]></string>
+    <string name="_bx_orgs_form_price_input_sys_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_orgs_form_price_input_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_orgs_form_price_input_inf_period_unit"><![CDATA[Leave empty for lifetime level.]]></string>
+    <string name="_bx_orgs_form_price_input_err_period_unit"><![CDATA[You need to select a period unit here.]]></string>
+    <string name="_bx_orgs_form_price_input_sys_price"><![CDATA[Price]]></string>
+    <string name="_bx_orgs_form_price_input_price"><![CDATA[Price]]></string>
+    <string name="_bx_orgs_form_price_input_inf_price"><![CDATA[Use 0 or leave empty to create free level.]]></string>
+    <string name="_bx_orgs_form_price_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_orgs_form_price_input_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_orgs_form_price_input_sys_do_cancel"><![CDATA[Cancel]]></string>
+    <string name="_bx_orgs_form_price_input_do_cancel"><![CDATA[Cancel]]></string>
+
 	<string name="_bx_orgs_acl_action_create_profile"><![CDATA[Create Organization's Profile]]></string>
+        <string name="_bx_orgs_acl_action_use_paid_join"><![CDATA[Use paid join]]></string>
 	<string name="_bx_orgs_acl_action_delete_profile"><![CDATA[Delete Organization's Profile]]></string>
 	<string name="_bx_orgs_acl_action_view_profile"><![CDATA[View Organization's Profile]]></string>
 	<string name="_bx_orgs_acl_action_edit_any_profile"><![CDATA[Edit Any Organization's Profile]]></string>
@@ -101,6 +126,8 @@
 	<string name="_bx_orgs_page_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_orgs_page_title_sys_delete_profile"><![CDATA[Delete Profile]]></string>
 	<string name="_bx_orgs_page_title_delete_profile"><![CDATA[Delete Profile]]></string>
+        <string name="_bx_orgs_page_title_sys_join_profile"><![CDATA[Join Organization]]></string>
+	<string name="_bx_orgs_page_title_join_profile"><![CDATA[Join Organization]]></string>
 	<string name="_bx_orgs_page_title_sys_view_profile"><![CDATA[View Profile]]></string>
 	<string name="_bx_orgs_page_title_sys_view_profile_closed"><![CDATA[View Profile with Limited Visibility]]></string>
 	<string name="_bx_orgs_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -131,6 +158,8 @@
     <string name="_bx_orgs_page_title_profile_comments"><![CDATA[Comments]]></string>
 	<string name="_bx_orgs_page_title_sys_profile_info"><![CDATA[Profile Info]]></string>
 	<string name="_bx_orgs_page_title_profile_info"><![CDATA[Info about {display_name}]]></string>
+        <string name="_bx_orgs_page_title_sys_profile_pricing"><![CDATA[Pricing]]></string>
+	<string name="_bx_orgs_page_title_profile_pricing"><![CDATA[Pricing]]></string>
 	<string name="_bx_orgs_page_title_sys_recent"><![CDATA[New Organizations]]></string>
 	<string name="_bx_orgs_page_title_recent"><![CDATA[New Organizations]]></string>
 	<string name="_bx_orgs_page_title_sys_manage"><![CDATA[Manage Own Organizations]]></string>
@@ -156,11 +185,15 @@
 	<string name="_bx_orgs_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_orgs_page_block_title_delete_profile"><![CDATA[Delete Profile]]></string>
 	<string name="_bx_orgs_page_block_title_profile_all_actions"><![CDATA[All Actions]]></string>
+        <string name="_bx_orgs_page_block_title_join_profile"><![CDATA[Join Organization]]></string>
 	<string name="_bx_orgs_page_block_title_profile_info_link"><![CDATA[About <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_orgs_page_block_title_profile_info"><![CDATA[Info]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_info"><![CDATA[Info]]></string>
 	<string name="_bx_orgs_page_block_title_profile_membership"><![CDATA[Membership]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_membership"><![CDATA[Membership]]></string>
+        <string name="_bx_orgs_page_block_title_system_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_orgs_page_block_title_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_orgs_page_block_title_profile_pricing_link"><![CDATA[Pricing of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_orgs_page_block_title_profile_description"><![CDATA[Description]]></string>
 	<string name="_bx_orgs_page_block_title_profile_favorites"><![CDATA[Favorite Organizations]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_favorites"><![CDATA[Favorite Organizations]]></string>
@@ -239,6 +272,8 @@
     <string name="_bx_orgs_menu_item_title_clear_reports"><![CDATA[Clear reports]]></string>
     <string name="_bx_orgs_menu_item_title_system_edit_cover"><![CDATA[Edit Cover]]></string>
     <string name="_bx_orgs_menu_item_title_edit_cover"><![CDATA[Edit Cover]]></string>
+    <string name="_bx_orgs_menu_item_title_system_edit_pricing"><![CDATA[Edit Pricing]]></string>
+    <string name="_bx_orgs_menu_item_title_edit_pricing"><![CDATA[Edit Pricing]]></string>
     <string name="_bx_orgs_menu_item_title_system_edit_profile"><![CDATA[Edit Organization]]></string>
     <string name="_bx_orgs_menu_item_title_edit_profile"><![CDATA[Edit Profile]]></string>
     <string name="_bx_orgs_menu_item_title_system_delete_profile"><![CDATA[Delete Organization]]></string>
@@ -289,6 +324,8 @@
     <string name="_bx_orgs_menu_item_title_leave_organization"><![CDATA[Leave Organization]]></string>
     <string name="_bx_orgs_menu_item_title_leave_organization_cancel_request"><![CDATA[Cancel Request]]></string>
     <string name="_bx_orgs_menu_item_title_leave_organization_reject_request"><![CDATA[Reject Request]]></string>
+    <string name="_bx_orgs_menu_item_title_system_pay_and_join"><![CDATA[Pay & Join]]></string>
+    <string name="_bx_orgs_menu_item_title_pay_and_join"><![CDATA[Pay & Join]]></string>
     <string name="_bx_orgs_menu_item_title_system_subscribe"><![CDATA[Follow]]></string>
     <string name="_bx_orgs_menu_item_title_subscribe"><![CDATA[Follow]]></string>
     <string name="_bx_orgs_menu_item_title_system_unsubscribe"><![CDATA[Unfollow]]></string>
@@ -354,6 +391,22 @@
     <string name="_bx_orgs_grid_action_err_delete"><![CDATA[Cannot delete the selected organization(s).]]></string>
     <string name="_bx_orgs_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
 
+    <string name="_bx_orgs_grid_column_title_name"><![CDATA[Name]]></string>
+    <string name="_bx_orgs_grid_column_title_role_id"><![CDATA[Role]]></string>
+    <string name="_bx_orgs_grid_column_title_period"><![CDATA[Period]]></string>
+    <string name="_bx_orgs_grid_column_title_price"><![CDATA[Price]]></string>
+    <string name="_bx_orgs_grid_action_title_add"><![CDATA[Add]]></string>
+    <string name="_bx_orgs_grid_action_title_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_orgs_grid_action_title_delete"><![CDATA[Delete]]></string>
+    <string name="_bx_orgs_grid_action_title_buy"><![CDATA[Buy]]></string>
+    <string name="_bx_orgs_grid_action_title_buy_title"><![CDATA[One-time payment]]></string>
+    <string name="_bx_orgs_grid_action_title_subscribe"><![CDATA[Subscribe]]></string>
+    <string name="_bx_orgs_grid_action_title_subscribe_title"><![CDATA[Create a subscription with recurring billing]]></string>
+    <string name="_bx_orgs_grid_action_title_choose"><![CDATA[Choose]]></string>
+    <string name="_bx_orgs_grid_action_title_choose_title"><![CDATA[Switch to the level for free]]></string>
+    <string name="_bx_orgs_popup_title_price_add"><![CDATA[Add Pricing Plan]]></string>
+    <string name="_bx_orgs_popup_title_price_edit"><![CDATA[Edit Pricing Plan]]></string>
+
     <string name="_bx_orgs_chart_growth"><![CDATA[Organizations: Growth]]></string>
     <string name="_bx_orgs_chart_growth_speed"><![CDATA[Organizations: Growth Speed]]></string>
 
@@ -407,6 +460,12 @@
     <string name="_bx_orgs_role_administrator"><![CDATA[Administrator]]></string>
     <string name="_bx_orgs_role_moderator"><![CDATA[Moderator]]></string>
 
+    <string name="_bx_orgs_pre_lists_period_units"><![CDATA[Billing Interval]]></string>
+    <string name="_bx_orgs_period_unit_day"><![CDATA[day]]></string>
+    <string name="_bx_orgs_period_unit_week"><![CDATA[week]]></string>
+    <string name="_bx_orgs_period_unit_month"><![CDATA[month]]></string>
+    <string name="_bx_orgs_period_unit_year"><![CDATA[year]]></string>
+
     <string name="_bx_organizations_alert_action_fan_added"><![CDATA[member joined]]></string>
     <string name="_bx_organizations_alert_action_join_invitation_notif"><![CDATA[join invitation]]></string>
     <string name="_bx_organizations_alert_action_join_request"><![CDATA[join request]]></string>
@@ -430,9 +489,17 @@
     <string name="_bx_orgs_txt_sample_pi_action_user"><![CDATA[{0} changed {1}]]></string>
     <string name="_bx_orgs_txt_N_friends"><![CDATA[{0} friends]]></string>
     <string name="_bx_orgs_txt_role"><![CDATA[Role]]></string>
+    <string name="_bx_orgs_txt_role_added"><![CDATA[Added]]></string>
+    <string name="_bx_orgs_txt_role_expired"><![CDATA[Expires]]></string>
     <string name="_bx_orgs_txt_set_role"><![CDATA[Set Role]]></string>
     <string name="_bx_orgs_txt_private_organization"><![CDATA[Private organization]]></string>
     <string name="_bx_orgs_ps_group_title_participants"><![CDATA[Employees]]></string>
+    <string name="_bx_orgs_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_orgs_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_orgs_msg_performed"><![CDATA[The action was successfully performed.]]></string>
+    <string name="_bx_orgs_err_price_duplicate"><![CDATA[Similar pricing plan is already exists.]]></string>
+    <string name="_bx_orgs_err_cannot_perform"><![CDATA[An error appeared. Please report.]]></string>
 
     <string name="_bx_orgs_email_friend_request"><![CDATA[Friend request]]></string>
     <string name="_bx_orgs_email_friend_request_subject"><![CDATA[Friendship Request]]></string>

+ 4 - 1
modules/boonex/organizations/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_organizations';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_organizations' OR `object` IN('bx_organizations_create_profile', 'bx_organizations_delete_profile', 'bx_organizations_edit_profile', 'bx_organizations_edit_profile_cover', 'bx_organizations_invite', 'bx_organizations_view_profile', 'bx_organizations_view_profile_closed', 'bx_organizations_profile_info', 'bx_organizations_fans', 'bx_organizations_profile_friends', 'bx_organizations_friend_requests', 'bx_organizations_profile_favorites', 'bx_organizations_profile_subscriptions', 'bx_organizations_profile_comments', 'bx_organizations_home', 'bx_organizations_search', 'bx_organizations_manage', 'bx_organizations_joined');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_organizations' OR `object` IN('bx_organizations_create_profile', 'bx_organizations_delete_profile', 'bx_organizations_join_profile', 'bx_organizations_edit_profile', 'bx_organizations_edit_profile_cover', 'bx_organizations_invite', 'bx_organizations_view_profile', 'bx_organizations_view_profile_closed', 'bx_organizations_profile_info', 'bx_organizations_profile_pricing', 'bx_organizations_fans', 'bx_organizations_profile_friends', 'bx_organizations_friend_requests', 'bx_organizations_profile_favorites', 'bx_organizations_profile_subscriptions', 'bx_organizations_profile_comments', 'bx_organizations_home', 'bx_organizations_search', 'bx_organizations_manage', 'bx_organizations_joined');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_organizations';
@@ -58,3 +58,6 @@ DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_organizations';
 
 -- UPLOADERS
 DELETE FROM `sys_objects_uploader` WHERE `object` IN ('bx_organizations_cover_crop', 'bx_organizations_picture_crop');
+
+-- CRON
+DELETE FROM `sys_cron_jobs` WHERE `name` IN ('bx_organizations_pruning');

+ 92 - 28
modules/boonex/organizations/install/sql/enable.sql

@@ -98,6 +98,13 @@ 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_organizations_delete_profile', 1, 'bx_organizations', '_bx_orgs_page_block_title_delete_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:13:\"entity_delete\";}', 0, 0, 0);
 
+-- 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_organizations_join_profile', 'join-organization-profile', '_bx_orgs_page_title_sys_join_profile', '_bx_orgs_page_title_join_profile', 'bx_organizations', 5, 2147483647, 1, 'page.php?i=join-organization-profile', '', '', '', 0, 1, 0, 'BxOrgsPageEntry', 'modules/boonex/organizations/classes/BxOrgsPageEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_organizations_join_profile', 1, 'bx_organizations', '_bx_orgs_page_block_title_join_profile', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:16:"bx_organizations";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_organizations_profile_info', 'organization-profile-info', '_bx_orgs_page_title_sys_profile_info', '_bx_orgs_page_title_profile_info', 'bx_organizations', 5, 2147483647, 1, 'page.php?i=organization-profile-info', '', '', '', 0, 1, 0, 'BxOrgsPageEntry', 'modules/boonex/organizations/classes/BxOrgsPageEntry.php');
@@ -106,6 +113,13 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_organizations_profile_info', 1, 'bx_organizations', '_bx_orgs_page_block_title_system_profile_info', '_bx_orgs_page_block_title_profile_info_link', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:16:\"entity_info_full\";}', 0, 0, 1, 1),
 ('bx_organizations_profile_info', 1, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_description', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 1, 2);
 
+-- 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_organizations_profile_pricing', 'edit-organization-pricing', '_bx_orgs_page_title_sys_profile_pricing', '_bx_orgs_page_title_profile_pricing', 'bx_organizations', 5, 2147483647, 1, 'page.php?i=edit-organization-pricing', '', '', '', 0, 1, 0, 'BxOrgsPageEntry', 'modules/boonex/organizations/classes/BxOrgsPageEntry.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_organizations_profile_pricing', 1, 'bx_organizations', '_bx_orgs_page_block_title_system_profile_pricing', '_bx_orgs_page_block_title_profile_pricing_link', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:16:"bx_organizations";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_organizations_fans', 'organization-profile-fans', '_bx_orgs_page_title_sys_fans', '_bx_orgs_page_title_fans', 'bx_organizations', 5, 2147483647, 1, 'page.php?i=organization-profile-fans', '', '', '', 0, 1, 0, 'BxOrgsPageEntry', 'modules/boonex/organizations/classes/BxOrgsPageEntry.php');
@@ -274,6 +288,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_organizations_view_actions', 'bx_organizations', '_bx_orgs_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_organizations_view_actions', 'bx_organizations', 'join-organization-profile', '_bx_orgs_menu_item_title_system_pay_and_join', '_bx_orgs_menu_item_title_pay_and_join', 'page.php?i=join-organization-profile&profile_id={profile_id}', '', '', 'sign-in-alt', '', 0, 2147483647, 'a:3:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:22:"is_paid_join_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 0, 4),
 ('bx_organizations_view_actions', 'bx_organizations', 'profile-fan-add', '_bx_orgs_menu_item_title_system_become_fan', '{title_add_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_organizations_fans\', \'add\', \'{profile_id}\')', '', 'sign-in-alt', '', 0, 2147483647, '', 1, 0, 0, 5),
 ('bx_organizations_view_actions', 'bx_organizations', 'profile-friend-add', '_bx_orgs_menu_item_title_system_befriend', '{title_add_friend}', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_friends\', \'add\', \'{profile_id}\')', '', 'user-plus', '', 0, 2147483647, '', 1, 0, 1, 10),
 ('bx_organizations_view_actions', 'bx_organizations', 'profile-relation-add', '_bx_orgs_menu_item_title_system_relation_add', '_bx_orgs_menu_item_title_relation_add', 'javascript:void(0)', 'bx_menu_popup(''sys_add_relation'', window, {}, {profile_id: {profile_id}});', '', 'sync', '', 0, 2147483647, '', 1, 0, 1, 15),
@@ -289,17 +304,18 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_organizations_view_actions_more', 'bx_organizations', '_bx_orgs_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_organizations_view_actions_more', 'bx_organizations', 'profile-fan-remove', '_bx_orgs_menu_item_title_system_leave_organization', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_organizations_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, 1, 0, 10),
-('bx_organizations_view_actions_more', 'bx_organizations', 'profile-friend-remove', '_bx_orgs_menu_item_title_system_unfriend', '{title_remove_friend}', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_friends\', \'remove\', \'{profile_id}\')', '', 'user-minus', '', 2147483647, 1, 0, 10),
-('bx_organizations_view_actions_more', 'bx_organizations', 'profile-relation-remove', '_bx_orgs_menu_item_title_system_relation_delete', '_bx_orgs_menu_item_title_relation_delete', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_relations\', \'remove\', \'{profile_id}\')', '', 'sync', '', 2147483647, 1, 0, 15),
-('bx_organizations_view_actions_more', 'bx_organizations', 'profile-subscribe-remove', '_bx_orgs_menu_item_title_system_unsubscribe', '_bx_orgs_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, 1, 0, 20),
-('bx_organizations_view_actions_more', 'bx_organizations', 'edit-organization-cover', '_bx_orgs_menu_item_title_system_edit_cover', '_bx_orgs_menu_item_title_edit_cover', 'page.php?i=edit-organization-cover&id={content_id}', '', '', 'edit', '', 2147483647, 1, 0, 25),
-('bx_organizations_view_actions_more', 'bx_organizations', 'edit-organization-profile', '_bx_orgs_menu_item_title_system_edit_profile', '_bx_orgs_menu_item_title_edit_profile', 'page.php?i=edit-organization-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 30),
-('bx_organizations_view_actions_more', 'bx_organizations', 'invite-to-organization', '_bx_orgs_menu_item_title_system_invite', '_bx_orgs_menu_item_title_invite', 'page.php?i=invite-to-organization&id={content_id}', '', '', 'user-friends', '', 2147483647, 1, 0, 32),
-('bx_organizations_view_actions_more', 'bx_organizations', 'delete-organization-profile', '_bx_orgs_menu_item_title_system_delete_profile', '_bx_orgs_menu_item_title_delete_profile', 'page.php?i=delete-organization-profile&id={content_id}', '', '', 'remove', '', 2147483647, 1, 0, 40),
-('bx_organizations_view_actions_more', 'bx_organizations', 'delete-organization-account', '_bx_orgs_menu_item_title_system_delete_account', '_bx_orgs_menu_item_title_delete_account', 'page.php?i=account-settings-delete&id={account_id}', '', '', 'user-times', '', 128, 1, 0, 50),
-('bx_organizations_view_actions_more', 'bx_organizations', 'delete-organization-account-content', '_bx_orgs_menu_item_title_system_delete_account_content', '_bx_orgs_menu_item_title_delete_account_content', 'page.php?i=account-settings-delete&id={account_id}&content=1', '', '', 'trash', '', 128, 1, 0, 60);
+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_organizations_view_actions_more', 'bx_organizations', 'profile-fan-remove', '_bx_orgs_menu_item_title_system_leave_organization', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_organizations_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, '', 1, 0, 10),
+('bx_organizations_view_actions_more', 'bx_organizations', 'profile-friend-remove', '_bx_orgs_menu_item_title_system_unfriend', '{title_remove_friend}', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_friends\', \'remove\', \'{profile_id}\')', '', 'user-minus', '', 2147483647, '', 1, 0, 10),
+('bx_organizations_view_actions_more', 'bx_organizations', 'profile-relation-remove', '_bx_orgs_menu_item_title_system_relation_delete', '_bx_orgs_menu_item_title_relation_delete', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_relations\', \'remove\', \'{profile_id}\')', '', 'sync', '', 2147483647, '', 1, 0, 15),
+('bx_organizations_view_actions_more', 'bx_organizations', 'profile-subscribe-remove', '_bx_orgs_menu_item_title_system_unsubscribe', '_bx_orgs_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, '', 1, 0, 20),
+('bx_organizations_view_actions_more', 'bx_organizations', 'edit-organization-cover', '_bx_orgs_menu_item_title_system_edit_cover', '_bx_orgs_menu_item_title_edit_cover', 'page.php?i=edit-organization-cover&id={content_id}', '', '', 'edit', '', 2147483647, '', 1, 0, 25),
+('bx_organizations_view_actions_more', 'bx_organizations', 'edit-organization-profile', '_bx_orgs_menu_item_title_system_edit_profile', '_bx_orgs_menu_item_title_edit_profile', 'page.php?i=edit-organization-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, '', 1, 0, 30),
+('bx_organizations_view_actions_more', 'bx_organizations', 'edit-organization-pricing', '_bx_orgs_menu_item_title_system_edit_pricing', '_bx_orgs_menu_item_title_edit_pricing', 'page.php?i=edit-organization-pricing&profile_id={profile_id}', '', '', 'money-check-alt', '', 2147483647, 'a:3:{s:6:"module";s:16:"bx_organizations";s:6:"method";s:20:"is_pricing_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 41),
+('bx_organizations_view_actions_more', 'bx_organizations', 'invite-to-organization', '_bx_orgs_menu_item_title_system_invite', '_bx_orgs_menu_item_title_invite', 'page.php?i=invite-to-organization&id={content_id}', '', '', 'user-friends', '', 2147483647, '', 1, 0, 32),
+('bx_organizations_view_actions_more', 'bx_organizations', 'delete-organization-profile', '_bx_orgs_menu_item_title_system_delete_profile', '_bx_orgs_menu_item_title_delete_profile', 'page.php?i=delete-organization-profile&id={content_id}', '', '', 'remove', '', 2147483647, '', 1, 0, 40),
+('bx_organizations_view_actions_more', 'bx_organizations', 'delete-organization-account', '_bx_orgs_menu_item_title_system_delete_account', '_bx_orgs_menu_item_title_delete_account', 'page.php?i=account-settings-delete&id={account_id}', '', '', 'user-times', '', 128, '', 1, 0, 50),
+('bx_organizations_view_actions_more', 'bx_organizations', 'delete-organization-account-content', '_bx_orgs_menu_item_title_system_delete_account_content', '_bx_orgs_menu_item_title_delete_account_content', 'page.php?i=account-settings-delete&id={account_id}&content=1', '', '', 'trash', '', 128, '', 1, 0, 60);
 
 -- MENU: all actions menu for view entry 
 
@@ -310,6 +326,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_organizations_view_actions_all', 'bx_organizations', '_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_organizations_view_actions_all', 'bx_organizations', 'join-organization-profile', '_bx_orgs_menu_item_title_system_pay_and_join', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 5),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'profile-fan-add', '_bx_orgs_menu_item_title_system_become_fan', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 10),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'profile-fan-remove', '_bx_orgs_menu_item_title_system_leave_organization', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 20),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'profile-friend-add', '_bx_orgs_menu_item_title_system_befriend', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 30),
@@ -334,6 +351,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_organizations_view_actions_all', 'bx_organizations', 'social-sharing-pinterest', '_sys_menu_item_title_system_social_sharing_pinterest', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 330),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'edit-organization-cover', '_bx_orgs_menu_item_title_system_edit_cover', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 400),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'edit-organization-profile', '_bx_orgs_menu_item_title_system_edit_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 410),
+('bx_organizations_view_actions_all', 'bx_organizations', 'edit-organization-pricing', '_bx_orgs_menu_item_title_system_edit_pricing', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 415),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'invite-to-organization', '_bx_orgs_menu_item_title_system_invite', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 420),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'delete-organization-profile', '_bx_orgs_menu_item_title_system_delete_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 430),
 ('bx_organizations_view_actions_all', 'bx_organizations', 'delete-organization-account', '_bx_orgs_menu_item_title_system_delete_account', '', '', '', '', '', '', '', 0, 128, '', 1, 0, 440),
@@ -390,22 +408,23 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_organizations_snippet_meta', 'bx_organizations', '_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_organizations_snippet_meta', 'bx_organizations', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, 0, 0, 1, 1),
-('bx_organizations_snippet_meta', 'bx_organizations', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, 0, 0, 1, 2),
-('bx_organizations_snippet_meta', 'bx_organizations', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, 0, 0, 1, 3),
-('bx_organizations_snippet_meta', 'bx_organizations', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, 0, 0, 1, 4),
-('bx_organizations_snippet_meta', 'bx_organizations', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, 1, 0, 1, 5),
-('bx_organizations_snippet_meta', 'bx_organizations', 'friends', '_sys_menu_item_title_system_sm_friends', '_sys_menu_item_title_sm_friends', '', '', '', '', '', 2147483647, 1, 0, 1, 6),
-('bx_organizations_snippet_meta', 'bx_organizations', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, 0, 0, 1, 7),
-('bx_organizations_snippet_meta', 'bx_organizations', 'membership', '_sys_menu_item_title_system_sm_membership', '_sys_menu_item_title_sm_membership', '', '', '', '', '', 2147483647, 0, 0, 1, 8),
-('bx_organizations_snippet_meta', 'bx_organizations', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, 1, 0, 1, 9),
-('bx_organizations_snippet_meta', 'bx_organizations', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 1, 0, 1, 10),
-('bx_organizations_snippet_meta', 'bx_organizations', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, 0, 0, 1, 11),
-('bx_organizations_snippet_meta', 'bx_organizations', 'befriend', '_sys_menu_item_title_system_sm_befriend', '_sys_menu_item_title_sm_befriend', '', '', '', '', '', 2147483647, 1, 0, 1, 12),
-('bx_organizations_snippet_meta', 'bx_organizations', 'unfriend', '_sys_menu_item_title_system_sm_unfriend', '_sys_menu_item_title_sm_unfriend', '', '', '', '', '', 2147483647, 0, 0, 1, 13),
-('bx_organizations_snippet_meta', 'bx_organizations', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 14),
-('bx_organizations_snippet_meta', 'bx_organizations', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 15);
+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_organizations_snippet_meta', 'bx_organizations', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, '', 0, 0, 1, 1),
+('bx_organizations_snippet_meta', 'bx_organizations', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, '', 0, 0, 1, 2),
+('bx_organizations_snippet_meta', 'bx_organizations', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, '', 0, 0, 1, 3),
+('bx_organizations_snippet_meta', 'bx_organizations', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, '', 0, 0, 1, 4),
+('bx_organizations_snippet_meta', 'bx_organizations', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, '', 1, 0, 1, 5),
+('bx_organizations_snippet_meta', 'bx_organizations', 'friends', '_sys_menu_item_title_system_sm_friends', '_sys_menu_item_title_sm_friends', '', '', '', '', '', 2147483647, '', 1, 0, 1, 6),
+('bx_organizations_snippet_meta', 'bx_organizations', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, '', 0, 0, 1, 7),
+('bx_organizations_snippet_meta', 'bx_organizations', 'membership', '_sys_menu_item_title_system_sm_membership', '_sys_menu_item_title_sm_membership', '', '', '', '', '', 2147483647, '', 0, 0, 1, 8),
+('bx_organizations_snippet_meta', 'bx_organizations', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, '', 1, 0, 1, 9),
+('bx_organizations_snippet_meta', 'bx_organizations', 'join-paid', '_sys_menu_item_title_system_sm_join_paid', '_sys_menu_item_title_sm_join_paid', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:16:"bx_organizations";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, 10),
+('bx_organizations_snippet_meta', 'bx_organizations', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:16:"bx_organizations";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, 11),
+('bx_organizations_snippet_meta', 'bx_organizations', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, '', 0, 0, 1, 12),
+('bx_organizations_snippet_meta', 'bx_organizations', 'befriend', '_sys_menu_item_title_system_sm_befriend', '_sys_menu_item_title_sm_befriend', '', '', '', '', '', 2147483647, '', 1, 0, 1, 13),
+('bx_organizations_snippet_meta', 'bx_organizations', 'unfriend', '_sys_menu_item_title_system_sm_unfriend', '_sys_menu_item_title_sm_unfriend', '', '', '', '', '', 2147483647, '', 0, 0, 1, 14),
+('bx_organizations_snippet_meta', 'bx_organizations', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 15),
+('bx_organizations_snippet_meta', 'bx_organizations', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 16);
 
 -- MENU: notifications menu in account popup
 SET @iNotifMenuOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name` = 'sys_account_notifications' AND `active` = 1 AND `order` < 9999 ORDER BY `order` DESC LIMIT 1);
@@ -451,6 +470,10 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 ('bx_organizations', 'create entry', NULL, '_bx_orgs_acl_action_create_profile', '', 1, 1);
 SET @iIdActionProfileCreate = LAST_INSERT_ID();
 
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('bx_organizations', 'use paid join', NULL, '_bx_orgs_acl_action_use_paid_join', '', 1, 1);
+SET @iIdActionUsePaidJoin = LAST_INSERT_ID();
+
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
 ('bx_organizations', 'delete entry', NULL, '_bx_orgs_acl_action_delete_profile', '', 1, 1);
 SET @iIdActionProfileDelete = LAST_INSERT_ID();
@@ -488,6 +511,12 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iAdministrator, @iIdActionProfileCreate),
 (@iPremium, @iIdActionProfileCreate),
 
+-- use paid join
+(@iStandard, @iIdActionUsePaidJoin),
+(@iModerator, @iIdActionUsePaidJoin),
+(@iAdministrator, @iIdActionUsePaidJoin),
+(@iPremium, @iIdActionUsePaidJoin),
+
 -- profile delete
 (@iAccount, @iIdActionProfileDelete),
 (@iStandard, @iIdActionProfileDelete),
@@ -557,7 +586,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_organizations_fans', 'name', '_sys_name', '50%', '', 10),
 ('bx_organizations_fans', 'role', '_bx_orgs_txt_role', '10%', '', 15),
-('bx_organizations_fans', 'actions', '', '40%', '', 20);
+('bx_organizations_fans', 'role_added', '_bx_orgs_txt_role_added', '10%', '', 16),
+('bx_organizations_fans', 'role_expired', '_bx_orgs_txt_role_expired', '10%', '', 17),
+('bx_organizations_fans', 'actions', '', '20%', '', 20);
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `confirm`, `order`) VALUES
 ('bx_organizations_fans', 'single', 'accept', '_sys_accept', '', 0, 10),
@@ -596,6 +627,34 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_organizations_common', 'bulk', 'delete_with_content', '_bx_orgs_grid_action_title_adm_delete_with_content', '', 0, 1, 2),
 ('bx_organizations_common', 'single', 'settings', '_bx_orgs_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_organizations_prices_manage', 'Sql', 'SELECT * FROM `bx_organizations_prices` WHERE 1 ', 'bx_organizations_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxOrgsGridPricesManage', 'modules/boonex/organizations/classes/BxOrgsGridPricesManage.php'),
+('bx_organizations_prices_view', 'Sql', 'SELECT * FROM `bx_organizations_prices` WHERE 1 ', 'bx_organizations_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxOrgsGridPricesView', 'modules/boonex/organizations/classes/BxOrgsGridPricesView.php');
+
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('bx_organizations_prices_manage', 'checkbox', '_sys_select', '1%', 0, '', '', 1),
+('bx_organizations_prices_manage', 'order', '', '1%', 0, '', '', 2),
+('bx_organizations_prices_manage', 'name', '_bx_orgs_grid_column_title_name', '38%', 0, 32, '', 3),
+('bx_organizations_prices_manage', 'price', '_bx_orgs_grid_column_title_price', '20%', 0, 16, '', 4),
+('bx_organizations_prices_manage', 'period', '_bx_orgs_grid_column_title_period', '20%', 0, 16, '', 5),
+('bx_organizations_prices_manage', 'actions', '', '20%', 0, '', '', 6),
+
+('bx_organizations_prices_view', 'role_id', '_bx_orgs_grid_column_title_role_id', '40%', 0, 32, '', 1),
+('bx_organizations_prices_view', 'price', '_bx_orgs_grid_column_title_price', '20%', 0, 16, '', 2),
+('bx_organizations_prices_view', 'period', '_bx_orgs_grid_column_title_period', '20%', 0, 16, '', 3),
+('bx_organizations_prices_view', 'actions', '', '20%', 0, '', '', 4);
+
+INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
+('bx_organizations_prices_manage', 'independent', 'add', '_bx_orgs_grid_action_title_add', '', 0, 0, 1),
+('bx_organizations_prices_manage', 'single', 'edit', '_bx_orgs_grid_action_title_edit', 'pencil-alt', 1, 0, 1),
+('bx_organizations_prices_manage', 'single', 'delete', '_bx_orgs_grid_action_title_delete', 'remove', 1, 1, 2),
+('bx_organizations_prices_manage', 'bulk', 'delete', '_bx_orgs_grid_action_title_delete', '', 0, 1, 1),
+
+('bx_organizations_prices_view', 'single', 'buy', '_bx_orgs_grid_action_title_buy', 'cart-plus', 0, 0, 1),
+('bx_organizations_prices_view', 'single', 'subscribe', '_bx_orgs_grid_action_title_subscribe', 'credit-card', 0, 0, 2),
+('bx_organizations_prices_view', 'single', 'choose', '_bx_orgs_grid_action_title_choose', 'far check-square', 0, 0, 3);
+
 
 -- LIVE UPDATES
 INSERT INTO `sys_objects_live_updates`(`name`, `frequency`, `service_call`, `active`) VALUES
@@ -657,3 +716,8 @@ INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `B
 INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `override_class_file`) VALUES
 ('bx_organizations_cover_crop', 1, 'BxOrgsUploaderCoverCrop', 'modules/boonex/organizations/classes/BxOrgsUploaderCoverCrop.php'),
 ('bx_organizations_picture_crop', 1, 'BxOrgsUploaderPictureCrop', 'modules/boonex/organizations/classes/BxOrgsUploaderPictureCrop.php');
+
+
+-- CRON
+INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
+('bx_organizations_pruning', '0 0 * * *', 'BxOrgsCronPruning', 'modules/boonex/organizations/classes/BxOrgsCronPruning.php', '');

+ 66 - 0
modules/boonex/organizations/install/sql/install.sql

@@ -219,7 +219,9 @@ CREATE TABLE IF NOT EXISTS `bx_organizations_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`)
 );
@@ -243,6 +245,21 @@ CREATE TABLE IF NOT EXISTS `bx_organizations_scores_track` (
   KEY `vote` (`object_id`, `author_nip`)
 );
 
+-- TABLE: Pricing
+CREATE TABLE IF NOT EXISTS `bx_organizations_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
@@ -356,6 +373,45 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_view_full', 'profile_email', 192, 1, 4),
 ('bx_organization_view_full', 'profile_status', 192, 1, 5);
 
+-- 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_organizations_price', 'bx_organizations', '_bx_orgs_form_price', '', '', 'do_submit', 'bx_organizations_prices', 'id', '', '', '', 0, 1, 'BxOrgsFormPrice', 'modules/boonex/organizations/classes/BxOrgsFormPrice.php');
+
+INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
+('bx_organizations_price_add', 'bx_organizations', 'bx_organizations_price', '_bx_orgs_form_price_display_add', 0),
+('bx_organizations_price_edit', 'bx_organizations', 'bx_organizations_price', '_bx_orgs_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_organizations_price', 'bx_organizations', 'id', '', '', 0, 'hidden', '_bx_orgs_form_price_input_sys_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'role_id', '', '', 0, 'hidden', '_bx_orgs_form_price_input_sys_role_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'name', '', '', 0, 'text', '_bx_orgs_form_price_input_sys_name', '_bx_orgs_form_price_input_name', '_bx_orgs_form_price_input_inf_name', 1, 0, 0, '', '', '', 'Avail', '', '_bx_orgs_form_price_input_err_name', 'Xss', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'period', '', '', 0, 'text', '_bx_orgs_form_price_input_sys_period', '_bx_orgs_form_price_input_period', '_bx_orgs_form_price_input_inf_period', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'period_unit', '', '#!bx_organizations_period_units', 0, 'select', '_bx_orgs_form_price_input_sys_period_unit', '_bx_orgs_form_price_input_period_unit', '_bx_orgs_form_price_input_inf_period_unit', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'price', '', '', 0, 'text', '_bx_orgs_form_price_input_sys_price', '_bx_orgs_form_price_input_price', '_bx_orgs_form_price_input_inf_price', 1, 0, 0, '', '', '', '', '', '', 'Float', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'do_submit', '_bx_orgs_form_price_input_do_submit', '', 0, 'submit', '_bx_orgs_form_price_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_organizations_price', 'bx_organizations', 'do_cancel', '_bx_orgs_form_price_input_do_cancel', '', 0, 'button', '_bx_orgs_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_organizations_price_add', 'id', 2147483647, 0, 1),
+('bx_organizations_price_add', 'role_id', 2147483647, 1, 2),
+('bx_organizations_price_add', 'name', 2147483647, 1, 3),
+('bx_organizations_price_add', 'price', 2147483647, 1, 4),
+('bx_organizations_price_add', 'period', 2147483647, 1, 5),
+('bx_organizations_price_add', 'period_unit', 2147483647, 1, 6),
+('bx_organizations_price_add', 'controls', 2147483647, 1, 7),
+('bx_organizations_price_add', 'do_submit', 2147483647, 1, 8),
+('bx_organizations_price_add', 'do_cancel', 2147483647, 1, 9),
+
+('bx_organizations_price_edit', 'id', 2147483647, 1, 1),
+('bx_organizations_price_edit', 'role_id', 2147483647, 1, 2),
+('bx_organizations_price_edit', 'name', 2147483647, 1, 3),
+('bx_organizations_price_edit', 'price', 2147483647, 1, 4),
+('bx_organizations_price_edit', 'period', 2147483647, 1, 5),
+('bx_organizations_price_edit', 'period_unit', 2147483647, 1, 6),
+('bx_organizations_price_edit', 'controls', 2147483647, 1, 7),
+('bx_organizations_price_edit', 'do_submit', 2147483647, 1, 8),
+('bx_organizations_price_edit', 'do_cancel', 2147483647, 1, 9);
 
 -- PRE-VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
@@ -407,6 +463,16 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALU
 ('bx_organizations_roles', '1', 2, '_bx_orgs_role_administrator', ''),
 ('bx_organizations_roles', '2', 3, '_bx_orgs_role_moderator', '');
 
+INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
+('bx_organizations_period_units', '_bx_orgs_pre_lists_period_units', 'bx_organizations', '0');
+
+INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
+('bx_organizations_period_units', '', 0, '_sys_please_select', ''),
+('bx_organizations_period_units', 'day', 1, '_bx_orgs_period_unit_day', ''),
+('bx_organizations_period_units', 'week', 2, '_bx_orgs_period_unit_week', ''),
+('bx_organizations_period_units', 'month', 3, '_bx_orgs_period_unit_month', ''),
+('bx_organizations_period_units', 'year', 4, '_bx_orgs_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_organizations', 'bx_organizations', 'bx_organizations_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-organization-profile&id={object_id}', '', 'bx_organizations_data', 'id', 'author', 'org_name', 'comments', 'BxOrgsCmts', 'modules/boonex/organizations/classes/BxOrgsCmts.php'),

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

@@ -1,6 +1,6 @@
 
 -- TABLES
-DROP TABLE IF EXISTS `bx_organizations_data`, `bx_organizations_pics`, `bx_organizations_pics_resized`, `bx_organizations_cmts`, `bx_organizations_cmts_notes`, `bx_organizations_views_track`, `bx_organizations_votes`, `bx_organizations_votes_track`, `bx_organizations_favorites_track`, `bx_organizations_favorites_lists`, `bx_organizations_reports`, `bx_organizations_reports_track`, `bx_organizations_meta_keywords`, `bx_organizations_meta_locations`, `bx_organizations_meta_mentions`, `bx_organizations_fans`, `bx_organizations_admins`, `bx_organizations_scores`, `bx_organizations_scores_track`;
+DROP TABLE IF EXISTS `bx_organizations_data`, `bx_organizations_pics`, `bx_organizations_pics_resized`, `bx_organizations_cmts`, `bx_organizations_cmts_notes`, `bx_organizations_views_track`, `bx_organizations_votes`, `bx_organizations_votes_track`, `bx_organizations_favorites_track`, `bx_organizations_favorites_lists`, `bx_organizations_reports`, `bx_organizations_reports_track`, `bx_organizations_meta_keywords`, `bx_organizations_meta_locations`, `bx_organizations_meta_mentions`, `bx_organizations_fans`, `bx_organizations_admins`, `bx_organizations_scores`, `bx_organizations_scores_track`, `bx_organizations_prices`;
 
 -- PROFILES
 DELETE FROM sys_profiles WHERE `type` = 'bx_organizations';
@@ -17,7 +17,7 @@ DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_organ
 DELETE FROM `sys_objects_form` WHERE `module` = 'bx_organizations';
 DELETE FROM `sys_form_displays` WHERE `module` = 'bx_organizations';
 DELETE FROM `sys_form_inputs` WHERE `module` = 'bx_organizations';
-DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_organization_add', 'bx_organization_delete', 'bx_organization_edit', 'bx_organization_edit_cover', 'bx_organization_view', 'bx_organization_view_full', 'bx_organization_invite');
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_organization_add', 'bx_organization_delete', 'bx_organization_edit', 'bx_organization_edit_cover', 'bx_organization_view', 'bx_organization_view_full', 'bx_organization_invite', 'bx_organizations_price_add', 'bx_organizations_price_edit');
 
 -- PRE-VALUES
 DELETE FROM `sys_form_pre_lists` WHERE `module` = 'bx_organizations';

+ 59 - 0
modules/boonex/organizations/js/prices.js

@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Organizations Organizations
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+
+function BxOrgsPrices(oOptions) {
+    this._sActionsUri = oOptions.sActionUri;
+    this._sActionsUrl = oOptions.sActionUrl;
+    this._sObjNameGrid = oOptions.sObjNameGrid;
+    this._sObjName = oOptions.sObjName == undefined ? 'oBxOrgsPrices' : oOptions.sObjName;
+    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
+    this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
+}
+
+BxOrgsPrices.prototype.checkName = function(sNameId, iId) {
+    var oDate = new Date();
+
+    var oName = jQuery("[name='" + sNameId + "']");
+    var sName = oName.val();
+
+    if(!sName.length)
+        return;
+
+    jQuery.get(
+        this._sActionsUrl + 'check_name',
+        {
+            name: sName,
+            id: iId && parseInt(iId) > 0 ? iId : 0,
+            _t: oDate.getTime()
+        },
+        function(oData) {
+            if(!oData || oData.name == undefined)
+                return;
+
+            oName.val(oData.name);
+        },
+        'json'
+    );
+};
+
+BxOrgsPrices.prototype.onChangeRole = function() {
+    this.reloadGrid($('#bx-grid-level-' + this._sObjNameGrid).val());
+};
+
+BxOrgsPrices.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);
+};
+
+/** @} */

+ 1 - 0
modules/boonex/organizations/template/css/prices.css

@@ -0,0 +1 @@
+@import url(../../../../base/groups/template/css/prices.css);

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

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

+ 3 - 1
modules/boonex/payment/classes/BxPaymentGridSbsAdministration.php

@@ -12,6 +12,7 @@
 
 class BxPaymentGridSbsAdministration extends BxBaseModPaymentGridOrders
 {
+    protected $_iNow;
     protected $_sManageType;
 
     public function __construct ($aOptions, $oTemplate = false)
@@ -20,6 +21,7 @@ class BxPaymentGridSbsAdministration extends BxBaseModPaymentGridOrders
 
         parent::__construct ($aOptions, $oTemplate);
 
+        $this->_iNow = time();
         $this->_sOrdersType = BX_PAYMENT_ORDERS_TYPE_SUBSCRIPTION;
         $this->_sManageType = 'administration';
     }
@@ -75,7 +77,7 @@ class BxPaymentGridSbsAdministration extends BxBaseModPaymentGridOrders
     
     protected function _getCellDateNext($mixedValue, $sKey, $aField, $aRow)
     {
-        if(empty($mixedValue))
+        if(empty($mixedValue) || (is_numeric($mixedValue) && (int)$mixedValue < $this->_iNow))
             return parent::_getCellDefault(_t('_uknown'), $sKey, $aField, $aRow);
 
         return $this->_getCellDefaultDateTime($mixedValue, $sKey, $aField, $aRow);

+ 4 - 0
modules/boonex/protean/data/template/system/css/menu.less

@@ -53,6 +53,10 @@ ul.bx-menu-ver.bx-menu-profile-stats li.bx-menu-item-profile-stats-profile .bx-m
     margin-bottom: 0;
     border-top: @bx-border-width @bx-border-type @bx-border-color-hr;
 }
+.bx-popup ul.bx-menu-ver li,
+.bx-popup ul.bx-menu-custom.bx-menu-custom-ver li.bx-def-round-corners {
+    border-radius: 0;
+}
 .bx-popup ul.bx-menu-custom.bx-menu-custom-ver.bx-menu-submenu-more-auto li.bx-menu-item,
 .bx-menu-custom.bx-menu-custom-hor.bx-menu-more-auto .bx-menu-item.bx-menu-item-more-auto .bx-popup .bx-menu-item {
     padding: 0;

+ 78 - 3
modules/boonex/russian/data/langs/bx_courses/ru.xml

@@ -9,6 +9,7 @@
     <string name="_bx_courses_option_searchable_fields"><![CDATA[Поля для поиска]]></string>
     <string name="_bx_courses_option_members_mode"><![CDATA[Спец. режим для членов пространства]]></string>
     <string name="_bx_courses_option_members_mode_multi_roles"><![CDATA[Множественные роли]]></string>
+    <string name="_bx_courses_option_per_page_for_favorites_lists"><![CDATA[Количество списков избранного на странице]]></string>
     <string name="_bx_courses_option_internal_notifications"><![CDATA[Использовать встроенную нотификацию]]></string>
 
     <string name="_bx_courses_form_profile"><![CDATA[Курсы]]></string>
@@ -25,6 +26,7 @@
     <string name="_bx_courses_form_profile_input_join_confirm"><![CDATA[Подтверждение регистрации]]></string>
     <string name="_bx_courses_form_profile_input_sys_allow_view_to"><![CDATA[Доступена для]]></string>
     <string name="_bx_courses_form_profile_input_allow_view_to"><![CDATA[Доступена для]]></string>
+    <string name="_bx_courses_form_profile_input_allow_view_favorite_list"><![CDATA[Видимость]]></string>
     <string name="_bx_courses_form_profile_input_allow_view_to_desc"><![CDATA[Закрытый - все могут найти курс и видеть кто в нем состоит, только студенты могут видеть сообщения. Секретный - только студенты могут найти курс и видеть сообщения.]]></string>
     <string name="_bx_courses_form_profile_input_sys_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
     <string name="_bx_courses_form_profile_input_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
@@ -48,11 +50,36 @@
     <string name="_bx_courses_form_profile_input_delete_confirm_info"><![CDATA[Это действие не может быть отменено.]]></string>
     <string name="_bx_courses_form_profile_input_delete_confirm_error"><![CDATA[Пожалуйста, отметьте этот флажок, если действительно хотите удалить курс.]]></string>
 
+    <string name="_bx_courses_form_price"><![CDATA[Цена]]></string>
+    <string name="_bx_courses_form_price_display_add"><![CDATA[Добавление]]></string>
+    <string name="_bx_courses_form_price_display_edit"><![CDATA[Редактирование]]></string>
+    <string name="_bx_courses_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_courses_form_price_input_sys_role_id"><![CDATA[ID роли]]></string>
+    <string name="_bx_courses_form_price_input_sys_name"><![CDATA[Имя]]></string>
+    <string name="_bx_courses_form_price_input_name"><![CDATA[Имя]]></string>
+    <string name="_bx_courses_form_price_input_inf_name"><![CDATA[Уникальное значение, которое будет использоваться в серверной части и API запросах]]></string>
+    <string name="_bx_courses_form_price_input_err_name"><![CDATA[Введите уникальное значение]]></string>
+    <string name="_bx_courses_form_price_input_sys_period"><![CDATA[Период]]></string>
+    <string name="_bx_courses_form_price_input_period"><![CDATA[Период]]></string>
+    <string name="_bx_courses_form_price_input_inf_period"><![CDATA[Используйте 0 для пожизненного]]></string>
+    <string name="_bx_courses_form_price_input_sys_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_courses_form_price_input_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_courses_form_price_input_inf_period_unit"><![CDATA[Оставьте пустым для пожизненного уровня.]]></string>
+    <string name="_bx_courses_form_price_input_err_period_unit"><![CDATA[Здесь Вам необходимо выбрать единицу измерения периода.]]></string>
+    <string name="_bx_courses_form_price_input_sys_price"><![CDATA[Цена]]></string>
+    <string name="_bx_courses_form_price_input_price"><![CDATA[Цена]]></string>
+    <string name="_bx_courses_form_price_input_inf_price"><![CDATA[Введите 0 или оставьте пустым для создания бесплатного уровня.]]></string>
+    <string name="_bx_courses_form_price_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_courses_form_price_input_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_courses_form_price_input_sys_do_cancel"><![CDATA[Отменить]]></string>
+    <string name="_bx_courses_form_price_input_do_cancel"><![CDATA[Отменить]]></string>
+
     <string name="_bx_courses_acl_action_create_profile"><![CDATA[Создать курс]]></string>
+    <string name="_bx_courses_acl_action_use_paid_join"><![CDATA[Использовать платное посещение курса]]></string>
     <string name="_bx_courses_acl_action_delete_profile"><![CDATA[Удалить курс]]></string>
     <string name="_bx_courses_acl_action_view_profile"><![CDATA[Просмотреть курс]]></string>
     <string name="_bx_courses_acl_action_edit_any_profile"><![CDATA[Редактировать любой курс]]></string>
-	<string name="_bx_courses_acl_action_delete_any_profile"><![CDATA[Удалять любой курс]]></string>
+    <string name="_bx_courses_acl_action_delete_any_profile"><![CDATA[Удалять любой курс]]></string>
     <string name="_bx_courses_acl_action_delete_invites"><![CDATA[Удалять приглашения]]></string>
 
     <string name="_bx_courses_page_title_sys_joined_entries"><![CDATA[Курсы профиля]]></string>
@@ -65,6 +92,8 @@
     <string name="_bx_courses_page_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>
     <string name="_bx_courses_page_title_sys_delete_profile"><![CDATA[Удалить курс]]></string>
     <string name="_bx_courses_page_title_delete_profile"><![CDATA[Удалить курс]]></string>
+    <string name="_bx_courses_page_title_sys_join_profile"><![CDATA[Посещать курс]]></string>
+    <string name="_bx_courses_page_title_join_profile"><![CDATA[Посещать курс]]></string>
     <string name="_bx_courses_page_title_sys_view_profile_closed"><![CDATA[Просмотр закрытого курса]]></string>
     <string name="_bx_courses_page_title_sys_view_profile"><![CDATA[Просмотр курса]]></string>
     <string name="_bx_courses_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -83,6 +112,8 @@
     <string name="_bx_courses_page_title_profile_comments"><![CDATA[Комментарии]]></string>
     <string name="_bx_courses_page_title_sys_profile_info"><![CDATA[Инфо курса]]></string>
     <string name="_bx_courses_page_title_profile_info"><![CDATA[Инфо о {display_name}]]></string>
+    <string name="_bx_courses_page_title_sys_profile_pricing"><![CDATA[Цены]]></string>
+    <string name="_bx_courses_page_title_profile_pricing"><![CDATA[Цены]]></string>
     <string name="_bx_courses_page_title_sys_recent"><![CDATA[Новые курсы]]></string>
     <string name="_bx_courses_page_title_recent"><![CDATA[Новые курсы]]></string>
     <string name="_bx_courses_page_title_sys_manage"><![CDATA[Управление собственными курсами]]></string>
@@ -96,9 +127,14 @@
     <string name="_bx_courses_page_title_invite_to_course"><![CDATA[Пригласить студентов на курс]]></string>
     <string name="_bx_courses_page_title_sys_entries_search"><![CDATA[Поиск]]></string>
     <string name="_bx_courses_page_title_entries_search"><![CDATA[Поиск]]></string>
+    <string name="_bx_courses_page_title_sys_entries_favorites"><![CDATA[Избранные курсы]]></string>
+    <string name="_bx_courses_page_title_entries_favorites"><![CDATA[Избранные курсы]]></string>
 
     <string name="_bx_courses_page_block_title_sys_entries_actions"><![CDATA[Курсы - Действия]]></string>
     <string name="_bx_courses_page_block_title_entries_actions"><![CDATA[Курсы - Действия]]></string>
+    <string name="_bx_courses_page_block_title_favorites_entries"><![CDATA[Список "{title}"]]></string>
+    <string name="_bx_courses_page_block_title_favorites_entries_info"><![CDATA[Информация]]></string>
+    <string name="_bx_courses_page_block_title_favorites_entries_actions"><![CDATA[Действия]]></string>
     <string name="_bx_courses_page_block_title_sys_entries_of_author"><![CDATA[Курсы автора]]></string>
     <string name="_bx_courses_page_block_title_entries_of_author"><![CDATA[{display_name} - Курсы]]></string>
     <string name="_bx_courses_page_block_title_favorites_of_author"><![CDATA[Избранные курсы]]></string>   
@@ -109,9 +145,13 @@
     <string name="_bx_courses_page_block_title_edit_profile"><![CDATA[Редактировать курс]]></string>
     <string name="_bx_courses_page_block_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>
     <string name="_bx_courses_page_block_title_delete_profile"><![CDATA[Удалить курс]]></string>
+    <string name="_bx_courses_page_block_title_join_profile"><![CDATA[Посетить курс]]></string>
     <string name="_bx_courses_page_block_title_profile_info_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Инфо]]></string>
     <string name="_bx_courses_page_block_title_profile_info"><![CDATA[Инфо]]></string>
     <string name="_bx_courses_page_block_title_system_profile_info"><![CDATA[Инфо]]></string>
+    <string name="_bx_courses_page_block_title_system_profile_pricing"><![CDATA[Цены]]></string>
+    <string name="_bx_courses_page_block_title_profile_pricing"><![CDATA[Цены]]></string>
+    <string name="_bx_courses_page_block_title_profile_pricing_link"><![CDATA[Расценки курса: <a href="{profile_link}">{display_name}</a>]]></string>
     <string name="_bx_courses_page_block_title_profile_description"><![CDATA[Описание]]></string>
     <string name="_bx_courses_page_block_title_profile_friends_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Друзья]]></string>
     <string name="_bx_courses_page_block_title_profile_friends"><![CDATA[Друзья]]></string>
@@ -170,8 +210,12 @@
     <string name="_bx_courses_menu_item_title_delete"><![CDATA[Удалить]]></string>
     <string name="_bx_courses_menu_item_title_system_delete_with_content"><![CDATA[Удалить вместе с содержимым]]></string>
     <string name="_bx_courses_menu_item_title_delete_with_content"><![CDATA[Удалить вместе с содержимым]]></string>
+    <string name="_bx_courses_menu_item_title_system_clear_reports"><![CDATA[Очистить жалобы]]></string>
+    <string name="_bx_courses_menu_item_title_clear_reports"><![CDATA[Очистить жалобы]]></string>
     <string name="_bx_courses_menu_item_title_system_edit_cover"><![CDATA[Редактировать обложку]]></string>
     <string name="_bx_courses_menu_item_title_edit_cover"><![CDATA[Редактировать обложку]]></string>
+    <string name="_bx_courses_menu_item_title_system_edit_pricing"><![CDATA[Редактировать цены]]></string>
+    <string name="_bx_courses_menu_item_title_edit_pricing"><![CDATA[Редактировать цены]]></string>
     <string name="_bx_courses_menu_item_title_system_edit_profile"><![CDATA[Редактировать курс]]></string>
     <string name="_bx_courses_menu_item_title_edit_profile"><![CDATA[Редактировать курс]]></string>
     <string name="_bx_courses_menu_item_title_system_delete_profile"><![CDATA[Удалить курс]]></string>
@@ -217,6 +261,9 @@
     <string name="_bx_courses_menu_item_title_leave_entry_cancel_request"><![CDATA[Отменить присоединение]]></string>
     <string name="_bx_courses_menu_item_title_leave_entry_reject_request"><![CDATA[Отвергнуть присоединение]]></string>
 
+    <string name="_bx_courses_menu_item_title_system_pay_and_join"><![CDATA[Оплатить и посещать]]></string>
+    <string name="_bx_courses_menu_item_title_pay_and_join"><![CDATA[Оплатить и посещать]]></string>
+
     <string name="_bx_courses_menu_item_title_system_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_courses_menu_item_title_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_courses_menu_item_title_system_unsubscribe"><![CDATA[Отключить уведомления]]></string>
@@ -271,6 +318,22 @@
     <string name="_bx_courses_grid_action_err_delete"><![CDATA[Невозможно удалить выбранный(ные) курс(ы).]]></string>
     <string name="_bx_courses_grid_txt_account_manager"><![CDATA[Перенаправить в управление аккаунтом.]]></string>
 
+    <string name="_bx_courses_grid_column_title_name"><![CDATA[Название]]></string>
+    <string name="_bx_courses_grid_column_title_role_id"><![CDATA[Роль]]></string>
+    <string name="_bx_courses_grid_column_title_period"><![CDATA[Период]]></string>
+    <string name="_bx_courses_grid_column_title_price"><![CDATA[Цена]]></string>
+    <string name="_bx_courses_grid_action_title_add"><![CDATA[Добавить]]></string>
+    <string name="_bx_courses_grid_action_title_edit"><![CDATA[Изменить]]></string>
+    <string name="_bx_courses_grid_action_title_delete"><![CDATA[Удалить]]></string>
+    <string name="_bx_courses_grid_action_title_buy"><![CDATA[Купить]]></string>
+    <string name="_bx_courses_grid_action_title_buy_title"><![CDATA[Единовременный платеж]]></string>
+    <string name="_bx_courses_grid_action_title_subscribe"><![CDATA[Подписаться]]></string>
+    <string name="_bx_courses_grid_action_title_subscribe_title"><![CDATA[Создать подписку с регулярным выставлением счетов]]></string>
+    <string name="_bx_courses_grid_action_title_choose"><![CDATA[Выбирать]]></string>
+    <string name="_bx_courses_grid_action_title_choose_title"><![CDATA[Бесплатно переключиться на уровень]]></string>
+    <string name="_bx_courses_popup_title_price_add"><![CDATA[Добавить ценовой план]]></string>
+    <string name="_bx_courses_popup_title_price_edit"><![CDATA[Редактировать ценовой план]]></string>
+
     <string name="_bx_courses_chart_growth"><![CDATA[Курсы: Развитие]]></string>
     <string name="_bx_courses_chart_growth_speed"><![CDATA[Курсы: Скорость развития]]></string>
 
@@ -281,6 +344,8 @@
     <string name="_bx_courses_txt_account_suspended"><![CDATA[Этот курс заблокирован.]]></string>
     <string name="_bx_courses_txt_N_fans"><![CDATA[{0} студентов]]></string>
     <string name="_bx_courses_txt_role"><![CDATA[Роль]]></string>
+    <string name="_bx_courses_txt_role_added"><![CDATA[Начало]]></string>
+    <string name="_bx_courses_txt_role_expired"><![CDATA[Окончание]]></string>
     <string name="_bx_courses_txt_sample_single"><![CDATA[курс]]></string>
     <string name="_bx_courses_txt_sample_single_with_article"><![CDATA[курс]]></string>
     <string name="_bx_courses_txt_sample_comment_single"><![CDATA[комментарий к курсу]]></string>
@@ -288,8 +353,6 @@
     <string name="_bx_courses_txt_sample_score_up_single"><![CDATA[голос за курс]]></string>
     <string name="_bx_courses_txt_sample_score_down_single"><![CDATA[голос против курса]]></string>
     <string name="_bx_courses_txt_set_role"><![CDATA[Задать роль]]></string>
-    <string name="_bx_courses_txt_to_admins"><![CDATA[В преподаватели]]></string>
-    <string name="_bx_courses_txt_from_admins"><![CDATA[Из преподавателей]]></string>
     <string name="_bx_courses_txt_private_entry"><![CDATA[Приватный курс]]></string>
     <string name="_bx_courses_txt_invite_popup_text"><![CDATA[Вы были приглашены на этот курс. Нажмите кнопку ниже чтобы принять приглашение.]]></string>
     <string name="_bx_courses_txt_invite_popup_title"><![CDATA[Приглашение на курс]]></string>
@@ -297,6 +360,12 @@
     <string name="_bx_courses_txt_invite_popup_button_decline"><![CDATA[Отклонить]]></string>
     <string name="_bx_courses_txt_invite_popup_error_invitation_absent"><![CDATA[Извините, произошла ошибка. Вы не можете принять участие в курсе. Приглашение устарело или удалено.]]></string>
     <string name="_bx_courses_txt_invite_popup_error_invitation_wrong_user"><![CDATA[Извините, произошла ошибка. Вы не можете принять участие в курсе. Приглашение адресовано не Вам.]]></string>
+    <string name="_bx_courses_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_courses_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_courses_msg_performed"><![CDATA[Действие было успешно выполнено.]]></string>
+    <string name="_bx_courses_err_price_duplicate"><![CDATA[Аналогичный ценовой план уже существует.]]></string>
+    <string name="_bx_courses_err_cannot_perform"><![CDATA[Невозможно выполнить действие. Пожалуйста, оповестите нас об этой проблеме.]]></string>
 
     <string name="_bx_courses_alert_action_fan_added"><![CDATA[присоединение нового студента]]></string>
     <string name="_bx_courses_txt_ntfs_fan_added"><![CDATA[К курсу <b class="bx-ntfs-content-profile">{owner_name}</b> присоединился <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
@@ -314,6 +383,12 @@
     <string name="_bx_courses_role_administrator"><![CDATA[Преподаватель]]></string>
     <string name="_bx_courses_role_moderator"><![CDATA[Помощник]]></string>
 
+    <string name="_bx_courses_pre_lists_period_units"><![CDATA[Платежный интервал]]></string>
+    <string name="_bx_courses_period_unit_day"><![CDATA[день]]></string>
+    <string name="_bx_courses_period_unit_week"><![CDATA[неделя]]></string>
+    <string name="_bx_courses_period_unit_month"><![CDATA[месяц]]></string>
+    <string name="_bx_courses_period_unit_year"><![CDATA[год]]></string>
+
     <string name="_bx_courses_email_join_request"><![CDATA[Запрос на присоединение к курсу]]></string>
     <string name="_bx_courses_email_join_request_subject"><![CDATA[Запрос на присоединение к курсу]]></string>
     <string name="_bx_courses_email_join_request_body"><![CDATA[{email_header}

+ 1 - 1
modules/boonex/russian/data/langs/bx_events/ru.xml

@@ -69,7 +69,7 @@
     <string name="_bx_events_form_profile_input_time"><![CDATA[Время]]></string>
     <string name="_bx_events_form_profile_input_sys_reminder"><![CDATA[Напоминание]]></string>
     <string name="_bx_events_form_profile_input_reminder"><![CDATA[Напоминание]]></string>
-    <string name="_bx_events_form_entry_input_allow_view_favorite_list"><![CDATA[Видимость]]></string>
+    <string name="_bx_events_form_profile_input_allow_view_favorite_list"><![CDATA[Видимость]]></string>
     
     <string name="_bx_events_form_input_repeat_year"><![CDATA[Повторять: год]]></string>
     <string name="_bx_events_form_input_repeat_month"><![CDATA[Повторять: месяц]]></string>

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

@@ -9,7 +9,6 @@
     <string name="_bx_groups_option_searchable_fields"><![CDATA[Поля для поиска]]></string>
     <string name="_bx_groups_option_members_mode"><![CDATA[Спец. режим для членов группы]]></string>
     <string name="_bx_groups_option_members_mode_multi_roles"><![CDATA[Множественные роли]]></string>
-    <string name="_bx_groups_option_members_mode_paid_join"><![CDATA[Платное присоединение]]></string>
     <string name="_bx_groups_option_per_page_for_favorites_lists"><![CDATA[Количество списков избранного на странице]]></string>
     <string name="_bx_groups_option_internal_notifications"><![CDATA[Использовать встроенную нотификацию]]></string>
 
@@ -49,7 +48,7 @@
     <string name="_bx_groups_form_profile_input_delete_confirm"><![CDATA[Я уверен, что хочу удалить эту группу]]></string>
     <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_entry_input_allow_view_favorite_list"><![CDATA[Видимость]]></string>
+    <string name="_bx_groups_form_profile_input_allow_view_favorite_list"><![CDATA[Видимость]]></string>
 
     <string name="_bx_groups_form_price"><![CDATA[Цена]]></string>
     <string name="_bx_groups_form_price_display_add"><![CDATA[Добавление]]></string>
@@ -196,6 +195,7 @@
     <string name="_bx_groups_page_block_title_labels_breadcrumbs"><![CDATA[Путь по меткам]]></string>
     <string name="_bx_groups_page_block_title_favorites_entries"><![CDATA[Список "{title}"]]></string>
     <string name="_bx_groups_page_block_title_favorites_entries_info"><![CDATA[Информация]]></string>
+    <string name="_bx_groups_page_block_title_favorites_entries_actions"><![CDATA[Действия]]></string>
 
   <string name="_bx_groups_menu_title_submenu"><![CDATA[Группы - Подменю]]></string>
     <string name="_bx_groups_menu_set_title_submenu"><![CDATA[Группы - Подменю]]></string>

+ 67 - 0
modules/boonex/russian/data/langs/bx_organizations/ru.xml

@@ -85,7 +85,32 @@
     <string name="_bx_orgs_form_profile_input_followers_count"><![CDATA[Количество подписчиков]]></string>
     <string name="_bx_orgs_form_entry_input_allow_view_favorite_list"><![CDATA[Видимость]]></string>
 
+    <string name="_bx_orgs_form_price"><![CDATA[Цена]]></string>
+    <string name="_bx_orgs_form_price_display_add"><![CDATA[Добавление]]></string>
+    <string name="_bx_orgs_form_price_display_edit"><![CDATA[Редактирование]]></string>
+    <string name="_bx_orgs_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_orgs_form_price_input_sys_role_id"><![CDATA[ID роли]]></string>
+    <string name="_bx_orgs_form_price_input_sys_name"><![CDATA[Имя]]></string>
+    <string name="_bx_orgs_form_price_input_name"><![CDATA[Имя]]></string>
+    <string name="_bx_orgs_form_price_input_inf_name"><![CDATA[Уникальное значение, которое будет использоваться в серверной части и API запросах]]></string>
+    <string name="_bx_orgs_form_price_input_err_name"><![CDATA[Введите уникальное значение]]></string>
+    <string name="_bx_orgs_form_price_input_sys_period"><![CDATA[Период]]></string>
+    <string name="_bx_orgs_form_price_input_period"><![CDATA[Период]]></string>
+    <string name="_bx_orgs_form_price_input_inf_period"><![CDATA[Используйте 0 для пожизненного]]></string>
+    <string name="_bx_orgs_form_price_input_sys_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_orgs_form_price_input_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_orgs_form_price_input_inf_period_unit"><![CDATA[Оставьте пустым для пожизненного уровня.]]></string>
+    <string name="_bx_orgs_form_price_input_err_period_unit"><![CDATA[Здесь Вам необходимо выбрать единицу измерения периода.]]></string>
+    <string name="_bx_orgs_form_price_input_sys_price"><![CDATA[Цена]]></string>
+    <string name="_bx_orgs_form_price_input_price"><![CDATA[Цена]]></string>
+    <string name="_bx_orgs_form_price_input_inf_price"><![CDATA[Введите 0 или оставьте пустым для создания бесплатного уровня.]]></string>
+    <string name="_bx_orgs_form_price_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_orgs_form_price_input_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_orgs_form_price_input_sys_do_cancel"><![CDATA[Отменить]]></string>
+    <string name="_bx_orgs_form_price_input_do_cancel"><![CDATA[Отменить]]></string>
+    
 	<string name="_bx_orgs_acl_action_create_profile"><![CDATA[Создать профиль организации]]></string>
+        <string name="_bx_orgs_acl_action_use_paid_join"><![CDATA[Использовать платный вход в организацию]]></string>
 	<string name="_bx_orgs_acl_action_delete_profile"><![CDATA[Удалить профиль организации]]></string>
 	<string name="_bx_orgs_acl_action_view_profile"><![CDATA[Просмотреть профиль организации]]></string>
 	<string name="_bx_orgs_acl_action_edit_any_profile"><![CDATA[Редактировать профиль любой организации]]></string>
@@ -99,6 +124,8 @@
 	<string name="_bx_orgs_page_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>
 	<string name="_bx_orgs_page_title_sys_delete_profile"><![CDATA[Удалить профиль]]></string>
 	<string name="_bx_orgs_page_title_delete_profile"><![CDATA[Удалить профиль]]></string>
+        <string name="_bx_orgs_page_title_sys_join_profile"><![CDATA[Присоединиться к организации]]></string>
+        <string name="_bx_orgs_page_title_join_profile"><![CDATA[Присоединиться к организации]]></string>
     <string name="_bx_orgs_page_title_sys_view_profile"><![CDATA[Просмотр профиля]]></string>
     <string name="_bx_orgs_page_title_sys_view_profile_closed"><![CDATA[Просмотр профиля с ограничением доступа]]></string>
 	<string name="_bx_orgs_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -127,6 +154,8 @@
     <string name="_bx_orgs_page_title_fans"><![CDATA[Участники]]></string>
     <string name="_bx_orgs_page_title_sys_profile_comments"><![CDATA[Комментарии]]></string>
     <string name="_bx_orgs_page_title_profile_comments"><![CDATA[Комментарии]]></string>
+    <string name="_bx_orgs_page_title_sys_profile_pricing"><![CDATA[Цены]]></string>
+    <string name="_bx_orgs_page_title_profile_pricing"><![CDATA[Цены]]></string>
 	<string name="_bx_orgs_page_title_sys_profile_info"><![CDATA[Инфо профиля]]></string>
 	<string name="_bx_orgs_page_title_profile_info"><![CDATA[Инфо о {display_name}]]></string>
 	<string name="_bx_orgs_page_title_sys_recent"><![CDATA[Новые организации]]></string>
@@ -154,11 +183,15 @@
 	<string name="_bx_orgs_page_block_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>
 	<string name="_bx_orgs_page_block_title_delete_profile"><![CDATA[Удалить профиль]]></string>
 	<string name="_bx_orgs_page_block_title_profile_all_actions"><![CDATA[Все действия]]></string>
+        <string name="_bx_orgs_page_block_title_join_profile"><![CDATA[Присоединиться к организации]]></string>
 	<string name="_bx_orgs_page_block_title_profile_info_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Инфо]]></string>
 	<string name="_bx_orgs_page_block_title_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_orgs_page_block_title_profile_membership"><![CDATA[Членство]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_membership"><![CDATA[Членство]]></string>
+        <string name="_bx_orgs_page_block_title_system_profile_pricing"><![CDATA[Цены]]></string>
+        <string name="_bx_orgs_page_block_title_profile_pricing"><![CDATA[Цены]]></string>
+        <string name="_bx_orgs_page_block_title_profile_pricing_link"><![CDATA[Расценки организации: <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_orgs_page_block_title_profile_description"><![CDATA[Описание]]></string>
 	<string name="_bx_orgs_page_block_title_profile_favorites"><![CDATA[Избранные организации]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_favorites"><![CDATA[Избранные организации]]></string>
@@ -233,6 +266,8 @@
     <string name="_bx_orgs_menu_item_title_clear_reports"><![CDATA[Очистить жалобы]]></string>
     <string name="_bx_orgs_menu_item_title_system_edit_cover"><![CDATA[Редактировать обложку]]></string>
     <string name="_bx_orgs_menu_item_title_edit_cover"><![CDATA[Редактировать обложку]]></string>
+    <string name="_bx_orgs_menu_item_title_system_edit_pricing"><![CDATA[Редактировать цены]]></string>
+    <string name="_bx_orgs_menu_item_title_edit_pricing"><![CDATA[Редактировать цены]]></string>
     <string name="_bx_orgs_menu_item_title_system_edit_profile"><![CDATA[Редактировать организацию]]></string>
     <string name="_bx_orgs_menu_item_title_edit_profile"><![CDATA[Редактировать профиль]]></string>
     <string name="_bx_orgs_menu_item_title_system_delete_profile"><![CDATA[Удалить организацию]]></string>
@@ -283,6 +318,8 @@
     <string name="_bx_orgs_menu_item_title_leave_organization"><![CDATA[Покинуть организацию]]></string>
     <string name="_bx_orgs_menu_item_title_leave_organization_cancel_request"><![CDATA[Отменить присоединение]]></string>
     <string name="_bx_orgs_menu_item_title_leave_organization_reject_request"><![CDATA[Отвергнуть присоединение]]></string>
+    <string name="_bx_orgs_menu_item_title_system_pay_and_join"><![CDATA[Оплатить и присоединиться]]></string>
+    <string name="_bx_orgs_menu_item_title_pay_and_join"><![CDATA[Оплатить и присоединиться]]></string>
     <string name="_bx_orgs_menu_item_title_system_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_orgs_menu_item_title_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_orgs_menu_item_title_system_unsubscribe"><![CDATA[Отключить уведомления]]></string>
@@ -348,6 +385,22 @@
 	<string name="_bx_orgs_grid_action_err_delete"><![CDATA[Невозможно удалить выбранную(ные) организацию(ции).]]></string>
 	<string name="_bx_orgs_grid_txt_account_manager"><![CDATA[Перенаправить в Управление аккаунтом.]]></string>
 
+    <string name="_bx_orgs_grid_column_title_name"><![CDATA[Название]]></string>
+    <string name="_bx_orgs_grid_column_title_role_id"><![CDATA[Роль]]></string>
+    <string name="_bx_orgs_grid_column_title_period"><![CDATA[Период]]></string>
+    <string name="_bx_orgs_grid_column_title_price"><![CDATA[Цена]]></string>
+    <string name="_bx_orgs_grid_action_title_add"><![CDATA[Добавить]]></string>
+    <string name="_bx_orgs_grid_action_title_edit"><![CDATA[Изменить]]></string>
+    <string name="_bx_orgs_grid_action_title_delete"><![CDATA[Удалить]]></string>
+    <string name="_bx_orgs_grid_action_title_buy"><![CDATA[Купить]]></string>
+    <string name="_bx_orgs_grid_action_title_buy_title"><![CDATA[Единовременный платеж]]></string>
+    <string name="_bx_orgs_grid_action_title_subscribe"><![CDATA[Подписаться]]></string>
+    <string name="_bx_orgs_grid_action_title_subscribe_title"><![CDATA[Создать подписку с регулярным выставлением счетов]]></string>
+    <string name="_bx_orgs_grid_action_title_choose"><![CDATA[Выбирать]]></string>
+    <string name="_bx_orgs_grid_action_title_choose_title"><![CDATA[Бесплатно переключиться на уровень]]></string>
+    <string name="_bx_orgs_popup_title_price_add"><![CDATA[Добавить ценовой план]]></string>
+    <string name="_bx_orgs_popup_title_price_edit"><![CDATA[Редактировать ценовой план]]></string>
+
     <string name="_bx_orgs_chart_growth"><![CDATA[Организации: Развитие]]></string>
     <string name="_bx_orgs_chart_growth_speed"><![CDATA[Организации: Скорость развития]]></string>
 
@@ -401,6 +454,12 @@
     <string name="_bx_orgs_role_administrator"><![CDATA[Администратор]]></string>
     <string name="_bx_orgs_role_moderator"><![CDATA[Модератор]]></string>
 
+    <string name="_bx_orgs_pre_lists_period_units"><![CDATA[Платежный интервал]]></string>
+    <string name="_bx_orgs_period_unit_day"><![CDATA[день]]></string>
+    <string name="_bx_orgs_period_unit_week"><![CDATA[неделя]]></string>
+    <string name="_bx_orgs_period_unit_month"><![CDATA[месяц]]></string>
+    <string name="_bx_orgs_period_unit_year"><![CDATA[год]]></string>
+
     <string name="_bx_organizations_alert_action_fan_added"><![CDATA[присоединение нового участника]]></string>
     <string name="_bx_organizations_alert_action_join_invitation_notif"><![CDATA[приглашение вступить в группу]]></string>
     <string name="_bx_organizations_alert_action_join_request"><![CDATA[запрос на присоединение к организации]]></string>
@@ -424,9 +483,17 @@
     <string name="_bx_orgs_txt_sample_pi_action_user"><![CDATA[{0} сменила {1}]]></string>
     <string name="_bx_orgs_txt_N_friends"><![CDATA[Друзья: {0}]]></string>
     <string name="_bx_orgs_txt_role"><![CDATA[Роль]]></string>
+    <string name="_bx_orgs_txt_role_added"><![CDATA[Начало]]></string>
+    <string name="_bx_orgs_txt_role_expired"><![CDATA[Окончание]]></string>
     <string name="_bx_orgs_txt_set_role"><![CDATA[Задать роль]]></string>
     <string name="_bx_orgs_txt_private_organization"><![CDATA[Приватная организация]]></string>
     <string name="_bx_orgs_ps_group_title_participants"><![CDATA[Сотрудники]]></string>
+    <string name="_bx_orgs_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_orgs_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_orgs_msg_performed"><![CDATA[Действие было успешно выполнено.]]></string>
+    <string name="_bx_orgs_err_price_duplicate"><![CDATA[Аналогичный ценовой план уже существует.]]></string>
+    <string name="_bx_orgs_err_cannot_perform"><![CDATA[Невозможно выполнить действие. Пожалуйста, оповестите нас об этой проблеме.]]></string>
 
     <string name="_bx_orgs_email_friend_request"><![CDATA[Запрос на добавление в друзья]]></string>
     <string name="_bx_orgs_email_friend_request_subject"><![CDATA[Подружиться]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/bx_payment/ru.xml

@@ -423,6 +423,7 @@
     <string name="_bx_payment_cdt_active_cpt"><![CDATA[Активировать]]></string>
     <string name="_bx_payment_cdt_active_dsc"><![CDATA[Активировать(деактивировать) платежную систему.]]></string>
     <string name="_bx_payment_cdt_msg_charged"><![CDATA[Платеж успешно принят.]]></string>
+    <string name="_bx_payment_cdt_msg_subscribed"><![CDATA[Спасибо! Подписка создана. Пожалуйста, проверьте ваш email для получения дальнейших инструкций.]]></string>
     <string name="_bx_payment_cdt_err_not_available"><![CDATA[В данное время оплата Кредитами не доступна.]]></string>
     <string name="_bx_payment_cdt_err_wrong_transaction"><![CDATA[Не удалось верифицировать транзакцию.]]></string>
     <string name="_bx_payment_txt_name_credits"><![CDATA[Кредиты]]></string>

+ 75 - 1
modules/boonex/russian/data/langs/bx_spaces/ru.xml

@@ -10,6 +10,7 @@
     <string name="_bx_spaces_option_searchable_fields"><![CDATA[Поля для поиска]]></string>
     <string name="_bx_spaces_option_members_mode"><![CDATA[Спец. режим для членов пространства]]></string>
     <string name="_bx_spaces_option_members_mode_multi_roles"><![CDATA[Множественные роли]]></string>
+    <string name="_bx_spaces_option_per_page_for_favorites_lists"><![CDATA[Количество списков избранного на странице]]></string>
     <string name="_bx_spaces_option_internal_notifications"><![CDATA[Использовать встроенную нотификацию]]></string>
 
     <string name="_bx_spaces_form_profile"><![CDATA[Пространства]]></string>
@@ -26,6 +27,7 @@
     <string name="_bx_spaces_form_profile_input_join_confirm"><![CDATA[Подтверждение регистрации]]></string>
     <string name="_bx_spaces_form_profile_input_sys_allow_view_to"><![CDATA[Доступно для]]></string>
     <string name="_bx_spaces_form_profile_input_allow_view_to"><![CDATA[Доступно для]]></string>
+    <string name="_bx_spaces_form_profile_input_allow_view_favorite_list"><![CDATA[Видимость]]></string>
     <string name="_bx_spaces_form_profile_input_allow_view_to_desc"><![CDATA[Закрытая - все могут найти пространство и видеть кто в ней состоит, только участники могут видеть сообщения. Секретная - только участники могут найти пространство и видеть сообщения.]]></string>
     <string name="_bx_spaces_form_profile_input_sys_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
     <string name="_bx_spaces_form_profile_input_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
@@ -51,7 +53,32 @@
     <string name="_bx_spaces_form_profile_input_delete_confirm_info"><![CDATA[Это действие не может быть отменено.]]></string>
     <string name="_bx_spaces_form_profile_input_delete_confirm_error"><![CDATA[Пожалуйста, отметьте этот флажок, если действительно хотите удалить пространство.]]></string>
 
+    <string name="_bx_spaces_form_price"><![CDATA[Цена]]></string>
+    <string name="_bx_spaces_form_price_display_add"><![CDATA[Добавление]]></string>
+    <string name="_bx_spaces_form_price_display_edit"><![CDATA[Редактирование]]></string>
+    <string name="_bx_spaces_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_spaces_form_price_input_sys_role_id"><![CDATA[ID роли]]></string>
+    <string name="_bx_spaces_form_price_input_sys_name"><![CDATA[Имя]]></string>
+    <string name="_bx_spaces_form_price_input_name"><![CDATA[Имя]]></string>
+    <string name="_bx_spaces_form_price_input_inf_name"><![CDATA[Уникальное значение, которое будет использоваться в серверной части и API запросах]]></string>
+    <string name="_bx_spaces_form_price_input_err_name"><![CDATA[Введите уникальное значение]]></string>
+    <string name="_bx_spaces_form_price_input_sys_period"><![CDATA[Период]]></string>
+    <string name="_bx_spaces_form_price_input_period"><![CDATA[Период]]></string>
+    <string name="_bx_spaces_form_price_input_inf_period"><![CDATA[Используйте 0 для пожизненного]]></string>
+    <string name="_bx_spaces_form_price_input_sys_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_spaces_form_price_input_period_unit"><![CDATA[Единица измерения периода]]></string>
+    <string name="_bx_spaces_form_price_input_inf_period_unit"><![CDATA[Оставьте пустым для пожизненного уровня.]]></string>
+    <string name="_bx_spaces_form_price_input_err_period_unit"><![CDATA[Здесь Вам необходимо выбрать единицу измерения периода.]]></string>
+    <string name="_bx_spaces_form_price_input_sys_price"><![CDATA[Цена]]></string>
+    <string name="_bx_spaces_form_price_input_price"><![CDATA[Цена]]></string>
+    <string name="_bx_spaces_form_price_input_inf_price"><![CDATA[Введите 0 или оставьте пустым для создания бесплатного уровня.]]></string>
+    <string name="_bx_spaces_form_price_input_sys_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_spaces_form_price_input_do_submit"><![CDATA[Выполнить]]></string>
+    <string name="_bx_spaces_form_price_input_sys_do_cancel"><![CDATA[Отменить]]></string>
+    <string name="_bx_spaces_form_price_input_do_cancel"><![CDATA[Отменить]]></string>
+
 	<string name="_bx_spaces_acl_action_create_profile"><![CDATA[Создать пространство]]></string>
+        <string name="_bx_spaces_acl_action_use_paid_join"><![CDATA[Использовать платный вход в пространство]]></string>
 	<string name="_bx_spaces_acl_action_delete_profile"><![CDATA[Удалить пространство]]></string>
 	<string name="_bx_spaces_acl_action_view_profile"><![CDATA[Просмотреть пространство]]></string>
 	<string name="_bx_spaces_acl_action_edit_any_profile"><![CDATA[Редактировать любую пространство]]></string>
@@ -68,6 +95,8 @@
 	<string name="_bx_spaces_page_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>
 	<string name="_bx_spaces_page_title_sys_delete_profile"><![CDATA[Удалить пространство]]></string>
 	<string name="_bx_spaces_page_title_delete_profile"><![CDATA[Удалить пространство]]></string>
+        <string name="_bx_spaces_page_title_sys_join_profile"><![CDATA[Присоединиться к пространству]]></string>
+        <string name="_bx_spaces_page_title_join_profile"><![CDATA[Присоединиться к пространству]]></string>
 	<string name="_bx_spaces_page_title_sys_view_profile_closed"><![CDATA[Просмотр закрытой пространства]]></string>
 	<string name="_bx_spaces_page_title_sys_view_profile"><![CDATA[Просмотр пространства]]></string>
 	<string name="_bx_spaces_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -86,6 +115,8 @@
     <string name="_bx_spaces_page_title_profile_comments"><![CDATA[Комментарии]]></string>
 	<string name="_bx_spaces_page_title_sys_profile_info"><![CDATA[Инфо пространства]]></string>
 	<string name="_bx_spaces_page_title_profile_info"><![CDATA[Инфо о {display_name}]]></string>
+        <string name="_bx_spaces_page_title_sys_profile_pricing"><![CDATA[Цены]]></string>
+        <string name="_bx_spaces_page_title_profile_pricing"><![CDATA[Цены]]></string>
 	<string name="_bx_spaces_page_title_sys_recent"><![CDATA[Новые пространства]]></string>
 	<string name="_bx_spaces_page_title_recent"><![CDATA[Новые пространства]]></string>
 	<string name="_bx_spaces_page_title_sys_manage"><![CDATA[Управление собственными пространствами]]></string>
@@ -97,6 +128,8 @@
     <string name="_bx_spaces_page_title_invite_to_space"><![CDATA[Пригласить участников в пространство]]></string>
     <string name="_bx_spaces_page_title_sys_entries_search"><![CDATA[Поиск]]></string>
     <string name="_bx_spaces_page_title_entries_search"><![CDATA[Поиск]]></string>
+    <string name="_bx_spaces_page_title_sys_entries_favorites"><![CDATA[Избранные пространства]]></string>
+    <string name="_bx_spaces_page_title_entries_favorites"><![CDATA[Избранные пространства]]></string>
 
     <string name="_bx_spaces_page_block_title_sys_entries_actions"><![CDATA[Пространства - Действия]]></string>
     <string name="_bx_spaces_page_block_title_entries_actions"><![CDATA[Пространства - Действия]]></string>
@@ -115,6 +148,9 @@
 	<string name="_bx_spaces_page_block_title_profile_info_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Инфо]]></string>
 	<string name="_bx_spaces_page_block_title_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_spaces_page_block_title_system_profile_info"><![CDATA[Инфо]]></string>
+        <string name="_bx_spaces_page_block_title_system_profile_pricing"><![CDATA[Цены]]></string>
+        <string name="_bx_spaces_page_block_title_profile_pricing"><![CDATA[Цены]]></string>
+        <string name="_bx_spaces_page_block_title_profile_pricing_link"><![CDATA[Расценки пространства: <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_spaces_page_block_title_profile_description"><![CDATA[Описание]]></string>
 	<string name="_bx_spaces_page_block_title_profile_friends_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Друзья]]></string>
 	<string name="_bx_spaces_page_block_title_profile_friends"><![CDATA[Друзья]]></string>
@@ -149,6 +185,9 @@
     <string name="_bx_spaces_page_block_title_sys_recommended_entries_view_showcase"><![CDATA[Рекомендованные пространства (Витринный просмотр)]]></string>
     <string name="_bx_spaces_page_block_title_recommended_entries_view_showcase"><![CDATA[Рекомендованные пространства]]></string>
 	<string name="_bx_spaces_page_block_title_top_level_spaces"><![CDATA[Пространства верхнего уровня]]></string>
+    <string name="_bx_spaces_page_block_title_favorites_entries"><![CDATA[Список "{title}"]]></string>
+    <string name="_bx_spaces_page_block_title_favorites_entries_info"><![CDATA[Информация]]></string>
+    <string name="_bx_spaces_page_block_title_favorites_entries_actions"><![CDATA[Действия]]></string>
 
   <string name="_bx_spaces_menu_title_submenu"><![CDATA[Пространства - Подменю]]></string>
     <string name="_bx_spaces_menu_set_title_submenu"><![CDATA[Пространства - Подменю]]></string>
@@ -171,6 +210,8 @@
     <string name="_bx_spaces_menu_item_title_clear_reports"><![CDATA[Очистить жалобы]]></string>
     <string name="_bx_spaces_menu_item_title_system_edit_cover"><![CDATA[Редактировать обложку]]></string>
     <string name="_bx_spaces_menu_item_title_edit_cover"><![CDATA[Редактировать обложку]]></string>
+    <string name="_bx_spaces_menu_item_title_system_edit_pricing"><![CDATA[Редактировать цены]]></string>
+    <string name="_bx_spaces_menu_item_title_edit_pricing"><![CDATA[Редактировать цены]]></string>
     <string name="_bx_spaces_menu_item_title_system_edit_profile"><![CDATA[Редактировать пространство]]></string>
     <string name="_bx_spaces_menu_item_title_edit_profile"><![CDATA[Редактировать пространство]]></string>
     <string name="_bx_spaces_menu_item_title_system_delete_profile"><![CDATA[Удалить пространство]]></string>
@@ -216,6 +257,9 @@
     <string name="_bx_spaces_menu_item_title_leave_space_cancel_request"><![CDATA[Отменить присоединение]]></string>
     <string name="_bx_spaces_menu_item_title_leave_space_reject_request"><![CDATA[Отвергнуть присоединение]]></string>
 
+    <string name="_bx_spaces_menu_item_title_system_pay_and_join"><![CDATA[Оплатить и присоединиться]]></string>
+    <string name="_bx_spaces_menu_item_title_pay_and_join"><![CDATA[Оплатить и присоединиться]]></string>
+
     <string name="_bx_spaces_menu_item_title_system_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_spaces_menu_item_title_subscribe"><![CDATA[Получать уведомления]]></string>
     <string name="_bx_spaces_menu_item_title_system_unsubscribe"><![CDATA[Отключить уведомления]]></string>
@@ -260,6 +304,22 @@
 	  <string name="_bx_spaces_grid_action_err_delete"><![CDATA[Невозможно удалить выбранную(ные) пространство(ы).]]></string>
 	  <string name="_bx_spaces_grid_txt_account_manager"><![CDATA[Перенаправить в управление аккаунтом.]]></string>
 
+    <string name="_bx_spaces_grid_column_title_name"><![CDATA[Название]]></string>
+    <string name="_bx_spaces_grid_column_title_role_id"><![CDATA[Роль]]></string>
+    <string name="_bx_spaces_grid_column_title_period"><![CDATA[Период]]></string>
+    <string name="_bx_spaces_grid_column_title_price"><![CDATA[Цена]]></string>
+    <string name="_bx_spaces_grid_action_title_add"><![CDATA[Добавить]]></string>
+    <string name="_bx_spaces_grid_action_title_edit"><![CDATA[Изменить]]></string>
+    <string name="_bx_spaces_grid_action_title_delete"><![CDATA[Удалить]]></string>
+    <string name="_bx_spaces_grid_action_title_buy"><![CDATA[Купить]]></string>
+    <string name="_bx_spaces_grid_action_title_buy_title"><![CDATA[Единовременный платеж]]></string>
+    <string name="_bx_spaces_grid_action_title_subscribe"><![CDATA[Подписаться]]></string>
+    <string name="_bx_spaces_grid_action_title_subscribe_title"><![CDATA[Создать подписку с регулярным выставлением счетов]]></string>
+    <string name="_bx_spaces_grid_action_title_choose"><![CDATA[Выбирать]]></string>
+    <string name="_bx_spaces_grid_action_title_choose_title"><![CDATA[Бесплатно переключиться на уровень]]></string>
+    <string name="_bx_spaces_popup_title_price_add"><![CDATA[Добавить ценовой план]]></string>
+    <string name="_bx_spaces_popup_title_price_edit"><![CDATA[Редактировать ценовой план]]></string>
+
     <string name="_bx_spaces_chart_growth"><![CDATA[Пространства: Развитие]]></string>
     <string name="_bx_spaces_chart_growth_speed"><![CDATA[Пространства: Скорость развития]]></string>
 
@@ -271,6 +331,8 @@
     <string name="_bx_spaces_txt_account_suspended"><![CDATA[Эта пространство заблокирована.]]></string>
     <string name="_bx_spaces_txt_N_fans"><![CDATA[{0} участников]]></string>
     <string name="_bx_spaces_txt_role"><![CDATA[Роль]]></string>
+    <string name="_bx_spaces_txt_role_added"><![CDATA[Начало]]></string>
+    <string name="_bx_spaces_txt_role_expired"><![CDATA[Окончание]]></string>
     <string name="_bx_spaces_txt_sample_single"><![CDATA[пространство]]></string>
     <string name="_bx_spaces_txt_sample_single_with_article"><![CDATA[пространство]]></string>
     <string name="_bx_spaces_txt_sample_comment_single"><![CDATA[комментарий к пространству]]></string>
@@ -285,7 +347,13 @@
     <string name="_bx_spaces_txt_invite_popup_button_decline"><![CDATA[Отклонить]]></string>
     <string name="_bx_spaces_txt_invite_popup_error_invitation_absent"><![CDATA[Извините, произошла ошибка. Вы не можете вступить в это пространство. Приглашение устарело или удалено.]]></string>
     <string name="_bx_spaces_txt_invite_popup_error_invitation_wrong_user"><![CDATA[Извините, произошла ошибка. Вы не можете вступить в это пространство. Приглашение адресовано не Вам.]]></string>
-	
+    <string name="_bx_spaces_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_spaces_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_spaces_msg_performed"><![CDATA[Действие было успешно выполнено.]]></string>
+    <string name="_bx_spaces_err_price_duplicate"><![CDATA[Аналогичный ценовой план уже существует.]]></string>
+    <string name="_bx_spaces_err_cannot_perform"><![CDATA[Невозможно выполнить действие. Пожалуйста, оповестите нас об этой проблеме.]]></string>
+
     <string name="_bx_spaces_alert_action_fan_added"><![CDATA[присоединение нового участника]]></string>
     <string name="_bx_spaces_txt_ntfs_fan_added"><![CDATA[В пространство <b class="bx-ntfs-content-profile">{owner_name}</b> вступил <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
     <string name="_bx_spaces_alert_action_join_invitation_notif"><![CDATA[приглашение вступить в группу]]></string>
@@ -307,6 +375,12 @@
     <string name="_bx_spaces_role_administrator"><![CDATA[Администратор]]></string>
     <string name="_bx_spaces_role_moderator"><![CDATA[Модератор]]></string>
 
+    <string name="_bx_spaces_pre_lists_period_units"><![CDATA[Платежный интервал]]></string>
+    <string name="_bx_spaces_period_unit_day"><![CDATA[день]]></string>
+    <string name="_bx_spaces_period_unit_week"><![CDATA[неделя]]></string>
+    <string name="_bx_spaces_period_unit_month"><![CDATA[месяц]]></string>
+    <string name="_bx_spaces_period_unit_year"><![CDATA[год]]></string>
+
     <string name="_bx_spaces_email_join_request"><![CDATA[Запрос на присоединение к пространству]]></string>
     <string name="_bx_spaces_email_join_request_subject"><![CDATA[Запрос на присоединение к пространству]]></string>
     <string name="_bx_spaces_email_join_request_body"><![CDATA[{email_header}

+ 1 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -940,6 +940,7 @@
 	<string name="_adm_form_txt_field_type_submit"><![CDATA[отправка]]></string>
 	<string name="_adm_form_txt_field_type_switcher"><![CDATA[переключатель]]></string>
 	<string name="_adm_form_txt_field_type_text"><![CDATA[текст]]></string>
+        <string name="_adm_form_txt_field_type_text_range"><![CDATA[текст (диапазон)]]></string>
 	<string name="_adm_form_txt_field_type_text_auto"><![CDATA[авто текст]]></string>
 	<string name="_adm_form_txt_field_type_textarea"><![CDATA[текстовое поле]]></string>
         <string name="_adm_form_txt_field_type_time"><![CDATA[время]]></string>

+ 25 - 2
modules/boonex/spaces/classes/BxSpacesConfig.php

@@ -33,6 +33,7 @@ class BxSpacesConfig 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',
@@ -57,10 +58,14 @@ class BxSpacesConfig extends BxBaseModGroupsConfig
             'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
             'FIELD_LABELS' => 'labels',
 
+            'FIELD_PRICE_ROLE_ID' => 'role_id',
+            'FIELD_PRICE_NAME' => 'name',
+
             // page URIs
             'URI_VIEW_ENTRY' => 'view-space-profile',
             'URI_EDIT_ENTRY' => 'edit-space-profile',
             'URI_EDIT_COVER' => 'edit-space-cover',
+            'URI_JOIN_ENTRY' => 'join-space-profile',
             'URI_JOINED_ENTRIES' => 'joined-spaces',
             'URI_MANAGE_COMMON' => 'spaces-manage',
 
@@ -77,6 +82,9 @@ class BxSpacesConfig extends BxBaseModGroupsConfig
             'PARAM_PER_PAGE_BROWSE_RECOMMENDED' => 'bx_spaces_per_page_browse_recommended',
 
             'PARAM_MMODE' => 'bx_spaces_members_mode',
+            'PARAM_PAID_JOIN_ENABLED' => true,
+            'PARAM_RECURRING_RESERVE' => 3, // 3 days for recurring payment to be registered
+            'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_spaces_per_page_for_favorites_lists',
             'PARAM_USE_IN' => 'bx_spaces_internal_notifications',
 
             // objects
@@ -107,6 +115,9 @@ class BxSpacesConfig extends BxBaseModGroupsConfig
             'OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER' => 'bx_space_edit_cover',
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_space_delete',
             'OBJECT_FORM_ENTRY_DISPLAY_INVITE' => 'bx_space_invite',
+            'OBJECT_FORM_PRICE' => 'bx_spaces_price',
+            'OBJECT_FORM_PRICE_DISPLAY_ADD' => 'bx_spaces_price_add',
+            'OBJECT_FORM_PRICE_DISPLAY_EDIT' => 'bx_spaces_price_edit',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_spaces_view_actions', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_spaces_view_actions_more', // actions menu on view entry page for "more" popup
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_spaces_view_actions_all', // all actions menu on view entry page
@@ -120,16 +131,20 @@ class BxSpacesConfig extends BxBaseModGroupsConfig
             'OBJECT_PAGE_VIEW_ENTRY' => 'bx_spaces_view_profile',
             'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_spaces_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_spaces_allow_view_to',
+            'OBJECT_PRIVACY_LIST_VIEW' => 'bx_spaces_allow_view_favorite_list',
             'OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT' => 'bx_spaces_allow_view_notification_to',
             'OBJECT_PRIVACY_POST' => 'bx_spaces_allow_post_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_spaces_administration',
             'OBJECT_GRID_COMMON' => 'bx_spaces_common',
             'OBJECT_GRID_CONNECTIONS' => 'bx_spaces_fans',
             'OBJECT_GRID_INVITES' => 'bx_spaces_invites',
+            'OBJECT_GRID_PRICES_MANAGE' => 'bx_spaces_prices_manage',
+            'OBJECT_GRID_PRICES_VIEW' => 'bx_spaces_prices_view',
             'OBJECT_CONNECTIONS' => 'bx_spaces_fans',
             'OBJECT_UPLOADERS_COVER' => array('bx_spaces_cover_crop'),
             'OBJECT_UPLOADERS_PICTURE' => array('bx_spaces_picture_crop'),
             'OBJECT_PRE_LIST_ROLES' => 'bx_spaces_roles',
+            'OBJECT_PRE_LIST_PERIOD_UNITS' => 'bx_spaces_period_units',
 
             'BADGES_AVALIABLE' => true,
             'INVITES_KEYS_LIFETIME' => 86400,
@@ -207,6 +222,12 @@ class BxSpacesConfig extends BxBaseModGroupsConfig
 				'txt_invitation_popup_decline_button' => '_bx_spaces_txt_invite_popup_button_decline',
                 'txt_invitation_popup_error_invitation_absent' => '_bx_spaces_txt_invite_popup_error_invitation_absent',
 				'txt_invitation_popup_error_wrong_user' => '_bx_spaces_txt_invite_popup_error_invitation_wrong_user',
+                'txt_n_unit' => '_bx_spaces_txt_n_unit',
+                'txt_buy_title' => '_bx_spaces_grid_action_title_buy_title',
+                'txt_cart_item_title' => '_bx_spaces_txt_cart_item_title',
+                'txt_subscribe_title' => '_bx_spaces_grid_action_title_subscribe_title',
+                'msg_performed' => '_bx_spaces_msg_performed',
+                'err_cannot_perform' => '_bx_spaces_err_cannot_perform',
             ),
 
         );
@@ -214,13 +235,15 @@ class BxSpacesConfig extends BxBaseModGroupsConfig
         $this->_aJsClasses = array(
             'main' => 'BxSpacesMain',
             'manage_tools' => 'BxSpacesManageTools',
-            'invite_popup' => 'BxSpacesInvitePopup'
+            'invite_popup' => 'BxSpacesInvitePopup',
+            'prices' => 'BxSpacesPrices'
         );
 
         $this->_aJsObjects = array(
             'main' => 'oBxSpacesMain',
             'manage_tools' => 'oBxSpacesManageTools',
-            'invite_popup' => 'oBxSpacesInvitePopup'
+            'invite_popup' => 'oBxSpacesInvitePopup',
+            'prices' => 'oBxSpacesPrices'
         );
 
         $this->_aGridObjects = array(

+ 22 - 0
modules/boonex/spaces/classes/BxSpacesCronPruning.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    Spaces Spaces
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxSpacesCronPruning extends BxBaseModGroupsCronPruning
+{
+    public function __construct()
+    {
+        $this->_sModule = 'bx_spaces';
+
+        parent::__construct();
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/spaces/classes/BxSpacesFormPrice.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    Spaces Spaces
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxSpacesFormPrice extends BxBaseModGroupsFormPrice
+{
+    public function __construct($aInfo, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_spaces';
+
+        parent::__construct($aInfo, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/spaces/classes/BxSpacesGridPricesManage.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    Spaces Spaces
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxSpacesGridPricesManage extends BxBaseModGroupsGridPricesManage
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_spaces';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 22 - 0
modules/boonex/spaces/classes/BxSpacesGridPricesView.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    Spaces Spaces
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxSpacesGridPricesView extends BxBaseModGroupsGridPricesView
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_spaces';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

+ 10 - 0
modules/boonex/spaces/classes/BxSpacesMenuViewActionsAll.php

@@ -21,6 +21,11 @@ class BxSpacesMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         parent::__construct($aObject, $oTemplate);
     }
 
+    protected function _getMenuItemJoinSpaceProfile($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
     protected function _getMenuItemEditSpaceCover($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);
@@ -31,6 +36,11 @@ class BxSpacesMenuViewActionsAll extends BxBaseModGroupsMenuViewActionsAll
         return $this->_getMenuItemByNameActionsMore($aItem);
     }
 
+    protected function _getMenuItemEditSpacePricing($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+
     protected function _getMenuItemInviteToSpace($aItem)
     {
         return $this->_getMenuItemByNameActionsMore($aItem);

+ 24 - 0
modules/boonex/spaces/classes/BxSpacesPageListEntry.php

@@ -0,0 +1,24 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Spaces Spaces
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+/**
+ * List entry page
+ */
+class BxSpacesPageListEntry extends BxBaseModGroupsPageListEntry
+{    
+    public function __construct($aObject, $oTemplate = false)
+    {
+        $this->MODULE = 'bx_spaces';
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 75 - 1
modules/boonex/spaces/install/langs/en.xml

@@ -10,6 +10,7 @@
     <string name="_bx_spaces_option_searchable_fields"><![CDATA[Searchable fields]]></string>
     <string name="_bx_spaces_option_members_mode"><![CDATA[Special mode for space members]]></string>
     <string name="_bx_spaces_option_members_mode_multi_roles"><![CDATA[Multi Roles]]></string>
+    <string name="_bx_spaces_option_per_page_for_favorites_lists"><![CDATA[Number of favorite lists per page]]></string>
     <string name="_bx_spaces_option_internal_notifications"><![CDATA[Use internal notifications]]></string>
 
     <string name="_bx_spaces_form_profile"><![CDATA[Spaces]]></string>
@@ -26,6 +27,7 @@
     <string name="_bx_spaces_form_profile_input_join_confirm"><![CDATA[Join confirmation]]></string>
     <string name="_bx_spaces_form_profile_input_sys_allow_view_to"><![CDATA[Visible to]]></string>
     <string name="_bx_spaces_form_profile_input_allow_view_to"><![CDATA[Visible to]]></string>
+    <string name="_bx_spaces_form_profile_input_allow_view_favorite_list"><![CDATA[Visibility]]></string>
     <string name="_bx_spaces_form_profile_input_allow_view_to_desc"><![CDATA[Closed - anyone can find the space and see who's in it, only members can see posts. Secret - only members can find the space and see posts.]]></string>
     <string name="_bx_spaces_form_profile_input_sys_allow_post_to"><![CDATA[Who can post]]></string>
     <string name="_bx_spaces_form_profile_input_allow_post_to"><![CDATA[Who can post]]></string>
@@ -51,7 +53,32 @@
     <string name="_bx_spaces_form_profile_input_delete_confirm_info"><![CDATA[This action can not be undone.]]></string>
     <string name="_bx_spaces_form_profile_input_delete_confirm_error"><![CDATA[Please check this checkbox if you really want to delete space.]]></string>
 
+    <string name="_bx_spaces_form_price"><![CDATA[Price]]></string>
+    <string name="_bx_spaces_form_price_display_add"><![CDATA[Add]]></string>
+    <string name="_bx_spaces_form_price_display_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_spaces_form_price_input_sys_id"><![CDATA[ID]]></string>
+    <string name="_bx_spaces_form_price_input_sys_role_id"><![CDATA[Role ID]]></string>
+    <string name="_bx_spaces_form_price_input_sys_name"><![CDATA[Name]]></string>
+    <string name="_bx_spaces_form_price_input_name"><![CDATA[Name]]></string>
+    <string name="_bx_spaces_form_price_input_inf_name"><![CDATA[Unique value which will be used in back end and API calls]]></string>
+    <string name="_bx_spaces_form_price_input_err_name"><![CDATA[You need to enter a unique value here]]></string>
+    <string name="_bx_spaces_form_price_input_sys_period"><![CDATA[Period]]></string>
+    <string name="_bx_spaces_form_price_input_period"><![CDATA[Period]]></string>
+    <string name="_bx_spaces_form_price_input_inf_period"><![CDATA[Use 0 for lifetime]]></string>
+    <string name="_bx_spaces_form_price_input_sys_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_spaces_form_price_input_period_unit"><![CDATA[Period unit]]></string>
+    <string name="_bx_spaces_form_price_input_inf_period_unit"><![CDATA[Leave empty for lifetime level.]]></string>
+    <string name="_bx_spaces_form_price_input_err_period_unit"><![CDATA[You need to select a period unit here.]]></string>
+    <string name="_bx_spaces_form_price_input_sys_price"><![CDATA[Price]]></string>
+    <string name="_bx_spaces_form_price_input_price"><![CDATA[Price]]></string>
+    <string name="_bx_spaces_form_price_input_inf_price"><![CDATA[Use 0 or leave empty to create free level.]]></string>
+    <string name="_bx_spaces_form_price_input_sys_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_spaces_form_price_input_do_submit"><![CDATA[Submit]]></string>
+    <string name="_bx_spaces_form_price_input_sys_do_cancel"><![CDATA[Cancel]]></string>
+    <string name="_bx_spaces_form_price_input_do_cancel"><![CDATA[Cancel]]></string>
+
     <string name="_bx_spaces_acl_action_create_profile"><![CDATA[Create Space]]></string>
+    <string name="_bx_spaces_acl_action_use_paid_join"><![CDATA[Use paid join]]></string>
     <string name="_bx_spaces_acl_action_delete_profile"><![CDATA[Delete Space]]></string>
     <string name="_bx_spaces_acl_action_view_profile"><![CDATA[View Space]]></string>
     <string name="_bx_spaces_acl_action_edit_any_profile"><![CDATA[Edit Any Space]]></string>
@@ -68,6 +95,8 @@
 	<string name="_bx_spaces_page_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_spaces_page_title_sys_delete_profile"><![CDATA[Delete Space]]></string>
 	<string name="_bx_spaces_page_title_delete_profile"><![CDATA[Delete Space]]></string>
+        <string name="_bx_spaces_page_title_sys_join_profile"><![CDATA[Join Space]]></string>
+        <string name="_bx_spaces_page_title_join_profile"><![CDATA[Join Space]]></string>
 	<string name="_bx_spaces_page_title_sys_view_profile_closed"><![CDATA[View Closed Space]]></string>
 	<string name="_bx_spaces_page_title_sys_view_profile"><![CDATA[View Space]]></string>
 	<string name="_bx_spaces_page_title_view_profile"><![CDATA[{display_name}]]></string>
@@ -86,6 +115,8 @@
 	<string name="_bx_spaces_page_title_profile_comments"><![CDATA[Comments]]></string>
 	<string name="_bx_spaces_page_title_sys_profile_info"><![CDATA[Space Info]]></string>
 	<string name="_bx_spaces_page_title_profile_info"><![CDATA[Info about {display_name}]]></string>
+        <string name="_bx_spaces_page_title_sys_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_spaces_page_title_profile_pricing"><![CDATA[Pricing]]></string>
 	<string name="_bx_spaces_page_title_sys_recent"><![CDATA[New Spaces]]></string>
 	<string name="_bx_spaces_page_title_recent"><![CDATA[New Spaces]]></string>
 	<string name="_bx_spaces_page_title_sys_manage"><![CDATA[Manage Own Spaces]]></string>
@@ -93,10 +124,14 @@
 	<string name="_bx_spaces_page_title_manage"><![CDATA[Manage Spaces]]></string>
 	<string name="_bx_spaces_page_title_sys_top"><![CDATA[Top Spaces]]></string>
 	<string name="_bx_spaces_page_title_top"><![CDATA[Top Spaces]]></string>
+        <string name="_bx_spaces_page_title_sys_joined"><![CDATA[Joined  Spaces]]></string>
+        <string name="_bx_spaces_page_title_joined"><![CDATA[Joined Spaces]]></string>
 	<string name="_bx_spaces_page_title_sys_invite_to_space"><![CDATA[Invite Members to the Space]]></string>
 	<string name="_bx_spaces_page_title_invite_to_space"><![CDATA[Invite Members to the Space]]></string>
 	<string name="_bx_spaces_page_title_sys_entries_search"><![CDATA[Search]]></string>
 	<string name="_bx_spaces_page_title_entries_search"><![CDATA[Search]]></string>
+        <string name="_bx_spaces_page_title_sys_entries_favorites"><![CDATA[Favorives Groups]]></string>
+        <string name="_bx_spaces_page_title_entries_favorites"><![CDATA[Favorives Groups]]></string>
 	
 	<string name="_bx_spaces_page_block_title_sys_entries_actions"><![CDATA[Spaces actions]]></string>
 	<string name="_bx_spaces_page_block_title_entries_actions"><![CDATA[Spaces actions]]></string>
@@ -112,9 +147,13 @@
 	<string name="_bx_spaces_page_block_title_edit_profile"><![CDATA[Edit Space]]></string>
 	<string name="_bx_spaces_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_spaces_page_block_title_delete_profile"><![CDATA[Delete Space]]></string>
+        <string name="_bx_spaces_page_block_title_join_profile"><![CDATA[Join Space]]></string>
 	<string name="_bx_spaces_page_block_title_profile_info_link"><![CDATA[About <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_spaces_page_block_title_profile_info"><![CDATA[Info]]></string>
 	<string name="_bx_spaces_page_block_title_system_profile_info"><![CDATA[Info]]></string>
+        <string name="_bx_spaces_page_block_title_system_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_spaces_page_block_title_profile_pricing"><![CDATA[Pricing]]></string>
+        <string name="_bx_spaces_page_block_title_profile_pricing_link"><![CDATA[Pricing of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_spaces_page_block_title_profile_description"><![CDATA[Description]]></string>
 	<string name="_bx_spaces_page_block_title_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_spaces_page_block_title_profile_friends"><![CDATA[Friends]]></string>
@@ -172,6 +211,8 @@
   <string name="_bx_spaces_menu_item_title_clear_reports"><![CDATA[Clear reports]]></string>
 	<string name="_bx_spaces_menu_item_title_system_edit_cover"><![CDATA[Edit Cover]]></string>
 	<string name="_bx_spaces_menu_item_title_edit_cover"><![CDATA[Edit Cover]]></string>
+        <string name="_bx_spaces_menu_item_title_system_edit_pricing"><![CDATA[Edit Pricing]]></string>
+        <string name="_bx_spaces_menu_item_title_edit_pricing"><![CDATA[Edit Pricing]]></string>
 	<string name="_bx_spaces_menu_item_title_system_edit_profile"><![CDATA[Edit Space]]></string>
 	<string name="_bx_spaces_menu_item_title_edit_profile"><![CDATA[Edit Space]]></string>
 	<string name="_bx_spaces_menu_item_title_system_delete_profile"><![CDATA[Delete Space]]></string>
@@ -216,7 +257,10 @@
 	<string name="_bx_spaces_menu_item_title_leave_space"><![CDATA[Leave Space]]></string>
 	<string name="_bx_spaces_menu_item_title_leave_space_cancel_request"><![CDATA[Cancel Request]]></string>
 	<string name="_bx_spaces_menu_item_title_leave_space_reject_request"><![CDATA[Reject Request]]></string>
-	
+
+    <string name="_bx_spaces_menu_item_title_system_pay_and_join"><![CDATA[Pay & Join]]></string>
+    <string name="_bx_spaces_menu_item_title_pay_and_join"><![CDATA[Pay & Join]]></string>
+
 	<string name="_bx_spaces_menu_item_title_system_subscribe"><![CDATA[Follow]]></string>
 	<string name="_bx_spaces_menu_item_title_subscribe"><![CDATA[Follow]]></string>
 	<string name="_bx_spaces_menu_item_title_system_unsubscribe"><![CDATA[Unfollow]]></string>
@@ -261,6 +305,22 @@
 	<string name="_bx_spaces_grid_action_err_delete"><![CDATA[Cannot delete the selected space(s).]]></string>
 	<string name="_bx_spaces_grid_txt_account_manager"><![CDATA[Redirect to manage account.]]></string>
 	
+    <string name="_bx_spaces_grid_column_title_name"><![CDATA[Name]]></string>
+    <string name="_bx_spaces_grid_column_title_role_id"><![CDATA[Role]]></string>
+    <string name="_bx_spaces_grid_column_title_period"><![CDATA[Period]]></string>
+    <string name="_bx_spaces_grid_column_title_price"><![CDATA[Price]]></string>
+    <string name="_bx_spaces_grid_action_title_add"><![CDATA[Add]]></string>
+    <string name="_bx_spaces_grid_action_title_edit"><![CDATA[Edit]]></string>
+    <string name="_bx_spaces_grid_action_title_delete"><![CDATA[Delete]]></string>
+    <string name="_bx_spaces_grid_action_title_buy"><![CDATA[Buy]]></string>
+    <string name="_bx_spaces_grid_action_title_buy_title"><![CDATA[One-time payment]]></string>
+    <string name="_bx_spaces_grid_action_title_subscribe"><![CDATA[Subscribe]]></string>
+    <string name="_bx_spaces_grid_action_title_subscribe_title"><![CDATA[Create a subscription with recurring billing]]></string>
+    <string name="_bx_spaces_grid_action_title_choose"><![CDATA[Choose]]></string>
+    <string name="_bx_spaces_grid_action_title_choose_title"><![CDATA[Switch to the level for free]]></string>
+    <string name="_bx_spaces_popup_title_price_add"><![CDATA[Add Pricing Plan]]></string>
+    <string name="_bx_spaces_popup_title_price_edit"><![CDATA[Edit Pricing Plan]]></string>
+
 	<string name="_bx_spaces_chart_growth"><![CDATA[Spaces: Growth]]></string>
 	<string name="_bx_spaces_chart_growth_speed"><![CDATA[Spaces: Growth Speed]]></string>
 	
@@ -272,6 +332,8 @@
     <string name="_bx_spaces_txt_account_suspended"><![CDATA[This space is suspended.]]></string>
     <string name="_bx_spaces_txt_N_fans"><![CDATA[{0} members]]></string>
     <string name="_bx_spaces_txt_role"><![CDATA[Role]]></string>
+    <string name="_bx_spaces_txt_role_added"><![CDATA[Added]]></string>
+    <string name="_bx_spaces_txt_role_expired"><![CDATA[Expires]]></string>
     <string name="_bx_spaces_txt_sample_single"><![CDATA[space]]></string>
     <string name="_bx_spaces_txt_sample_single_with_article"><![CDATA[a space]]></string>
     <string name="_bx_spaces_txt_sample_comment_single"><![CDATA[comment to space]]></string>
@@ -286,6 +348,12 @@
     <string name="_bx_spaces_txt_invite_popup_button_decline"><![CDATA[Decline]]></string>
     <string name="_bx_spaces_txt_invite_popup_error_invitation_absent"><![CDATA[Sorry, an error has occurred. You can not join this space. The invitation is expired or deleted.]]></string>
     <string name="_bx_spaces_txt_invite_popup_error_invitation_wrong_user"><![CDATA[Sorry, an error has occurred. You can not join this space. This invitation cannot be used by you.]]></string>
+    <string name="_bx_spaces_txt_n_unit"><![CDATA[{0} ({1})]]></string>
+    <string name="_bx_spaces_txt_cart_item_title"><![CDATA[{0}: {1} ({2} {3})]]></string>
+
+    <string name="_bx_spaces_msg_performed"><![CDATA[The action was successfully performed.]]></string>
+    <string name="_bx_spaces_err_price_duplicate"><![CDATA[Similar pricing plan is already exists.]]></string>
+    <string name="_bx_spaces_err_cannot_perform"><![CDATA[An error appeared. Please report.]]></string>
 	
     <string name="_bx_spaces_alert_action_fan_added"><![CDATA[member joined]]></string>
     <string name="_bx_spaces_txt_ntfs_fan_added"><![CDATA[Space <b class="bx-ntfs-content-profile">{owner_name}</b> has got a member <b class="bx-ntfs-content-entry">{subentry_sample}</b>]]></string>
@@ -308,6 +376,12 @@
     <string name="_bx_spaces_role_administrator"><![CDATA[Administrator]]></string>
     <string name="_bx_spaces_role_moderator"><![CDATA[Moderator]]></string>
 
+    <string name="_bx_spaces_pre_lists_period_units"><![CDATA[Billing Interval]]></string>
+    <string name="_bx_spaces_period_unit_day"><![CDATA[day]]></string>
+    <string name="_bx_spaces_period_unit_week"><![CDATA[week]]></string>
+    <string name="_bx_spaces_period_unit_month"><![CDATA[month]]></string>
+    <string name="_bx_spaces_period_unit_year"><![CDATA[year]]></string>
+
     <string name="_bx_spaces_email_join_request"><![CDATA[Space join request]]></string>
     <string name="_bx_spaces_email_join_request_subject"><![CDATA[Request to join your space]]></string>
     <string name="_bx_spaces_email_join_request_body"><![CDATA[{email_header}

+ 8 - 5
modules/boonex/spaces/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_spaces';
-DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_spaces' OR `object` IN('bx_spaces_create_profile', 'bx_spaces_delete_profile', 'bx_spaces_edit_profile', 'bx_spaces_edit_profile_cover', 'bx_spaces_invite', 'bx_spaces_view_profile', 'bx_spaces_view_profile_closed', 'bx_spaces_profile_info', 'bx_spaces_profile_comments', 'bx_spaces_home', 'bx_spaces_fans', 'bx_spaces_joined', 'bx_spaces_top', 'bx_spaces_search', 'bx_spaces_manage', 'bx_spaces_administration');
+DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_spaces' OR `object` IN('bx_spaces_create_profile', 'bx_spaces_delete_profile', 'bx_spaces_join_profile', 'bx_spaces_edit_profile', 'bx_spaces_edit_profile_cover', 'bx_spaces_invite', 'bx_spaces_view_profile', 'bx_spaces_view_profile_closed', 'bx_spaces_profile_info', 'bx_spaces_profile_pricing', 'bx_spaces_profile_comments', 'bx_spaces_home', 'bx_spaces_fans', 'bx_spaces_joined', 'bx_spaces_favorites', 'bx_spaces_top', 'bx_spaces_search', 'bx_spaces_manage', 'bx_spaces_administration');
 
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_spaces';
@@ -38,9 +38,9 @@ DELETE FROM `sys_statistics` WHERE `name` LIKE 'bx_spaces%';
 DELETE FROM `sys_objects_chart` WHERE `object` LIKE 'bx_spaces%';
 
 -- GRIDS
-DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_spaces_administration', 'bx_spaces_moderation', 'bx_spaces_common', 'bx_spaces_fans', 'bx_spaces_invites');
-DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_spaces_administration', 'bx_spaces_moderation', 'bx_spaces_common', 'bx_spaces_fans', 'bx_spaces_invites');
-DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_spaces_administration', 'bx_spaces_moderation', 'bx_spaces_common', 'bx_spaces_fans', 'bx_spaces_invites');
+DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_spaces_administration', 'bx_spaces_moderation', 'bx_spaces_common', 'bx_spaces_fans', 'bx_spaces_invites', 'bx_spaces_prices_manage', 'bx_spaces_prices_view');
+DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_spaces_administration', 'bx_spaces_moderation', 'bx_spaces_common', 'bx_spaces_fans', 'bx_spaces_invites', 'bx_spaces_prices_manage', 'bx_spaces_prices_view');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_spaces_administration', 'bx_spaces_moderation', 'bx_spaces_common', 'bx_spaces_fans', 'bx_spaces_invites', 'bx_spaces_prices_manage', 'bx_spaces_prices_view');
 
 -- ALERTS
 SET @iHandler := (SELECT `id` FROM `sys_alerts_handlers` WHERE `name` = 'bx_spaces' LIMIT 1);
@@ -48,10 +48,13 @@ DELETE FROM `sys_alerts` WHERE `handler_id` = @iHandler;
 DELETE FROM `sys_alerts_handlers` WHERE `id` = @iHandler;
 
 -- PRIVACY 
-DELETE FROM `sys_objects_privacy` WHERE `object` IN ('bx_spaces_allow_view_to', 'bx_spaces_allow_view_notification_to', 'bx_spaces_allow_post_to');
+DELETE FROM `sys_objects_privacy` WHERE `object` IN ('bx_spaces_allow_view_to', 'bx_spaces_allow_view_notification_to', 'bx_spaces_allow_post_to', 'bx_spaces_allow_view_favorite_list');
 
 -- EMAIL TEMPLATES
 DELETE FROM `sys_email_templates` WHERE `Module` = 'bx_spaces';
 
 -- UPLOADERS
 DELETE FROM `sys_objects_uploader` WHERE `object` IN ('bx_spaces_cover_crop', 'bx_spaces_picture_crop');
+
+-- CRON
+DELETE FROM `sys_cron_jobs` WHERE `name` IN ('bx_spaces_pruning');

+ 96 - 21
modules/boonex/spaces/install/sql/enable.sql

@@ -17,6 +17,7 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `e
 ('bx_spaces_num_rss', '10', @iCategId, '_bx_spaces_option_num_rss', 'digit', '', '', '', 12),
 ('bx_spaces_per_page_browse_showcase', '32', @iCategId, '_sys_option_per_page_browse_showcase', 'digit', '', '', '', 15),
 ('bx_spaces_per_page_browse_recommended', '10', @iCategId, '_sys_option_per_page_browse_recommended', 'digit', '', '', '', 16),
+('bx_spaces_per_page_for_favorites_lists', '5', @iCategId, '_bx_spaces_option_per_page_for_favorites_lists', 'digit', '', '', '', 17),
 ('bx_spaces_searchable_fields', 'space_name,space_desc', @iCategId, '_bx_spaces_option_searchable_fields', 'list', 'a:2:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:21:"get_searchable_fields";}', '', '', 30),
 ('bx_spaces_members_mode', '', @iCategId, '_bx_spaces_option_members_mode', 'select', 'a:2:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:24:"get_options_members_mode";}', '', '', 40),
 ('bx_spaces_internal_notifications', '', @iCategId, '_bx_spaces_option_internal_notifications', 'checkbox', '', '', '', 50);
@@ -93,6 +94,13 @@ 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_spaces_delete_profile', 1, 'bx_spaces', '_bx_spaces_page_block_title_delete_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_spaces\";s:6:\"method\";s:13:\"entity_delete\";}', 0, 0, 0);
 
+-- 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_spaces_join_profile', 'join-space-profile', '_bx_spaces_page_title_sys_join_profile', '_bx_spaces_page_title_join_profile', 'bx_spaces', 5, 2147483647, 1, 'page.php?i=join-space-profile', '', '', '', 0, 1, 0, 'BxSpacesPageEntry', 'modules/boonex/spaces/classes/BxSpacesPageEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_spaces_join_profile', 1, 'bx_spaces', '_bx_spaces_page_block_title_join_profile', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_spaces";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 
@@ -102,6 +110,13 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_spaces_profile_info', 1, 'bx_spaces', '_bx_spaces_page_block_title_system_profile_info', '_bx_spaces_page_block_title_profile_info_link', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_spaces\";s:6:\"method\";s:16:\"entity_info_full\";}', 0, 0, 1, 1),
 ('bx_spaces_profile_info', 1, 'bx_spaces', '', '_bx_spaces_page_block_title_profile_description', 13, 2147483647, 'service', 'a:2:{s:6:\"module\";s:9:\"bx_spaces\";s:6:\"method\";s:17:\"entity_text_block\";}', 0, 0, 1, 2);
 
+-- 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_spaces_profile_pricing', 'edit-space-pricing', '_bx_spaces_page_title_sys_profile_pricing', '_bx_spaces_page_title_profile_pricing', 'bx_spaces', 5, 2147483647, 1, 'page.php?i=edit-space-pricing', '', '', '', 0, 1, 0, 'BxSpacesPageEntry', 'modules/boonex/spaces/classes/BxSpacesPageEntry.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_spaces_profile_pricing', 1, 'bx_spaces', '_bx_spaces_page_block_title_system_profile_pricing', '_bx_spaces_page_block_title_profile_pricing_link', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:14:"entity_pricing";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 0, 1, 1);
+
 -- PAGE: space 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 
@@ -179,11 +194,21 @@ INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `t
 ('bx_spaces_joined', 1, 'bx_spaces', '_bx_spaces_page_block_title_sys_favorites_of_author', '_bx_spaces_page_block_title_favorites_of_author', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:15:"browse_favorite";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 0, 1, 1, 3),
 ('bx_spaces_joined', 1, 'bx_spaces', '_bx_spaces_page_block_title_sys_joined_entries', '_bx_spaces_page_block_title_joined_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:21:"browse_joined_entries";s:6:"params";a:2:{i:0;i:0;i:1;b:1;}}', 0, 0, 1, 4);
 
+-- PAGE: favorites by list
+INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
+('bx_spaces_favorites', '_bx_spaces_page_title_sys_entries_favorites', '_bx_spaces_page_title_entries_favorites', 'bx_spaces', 12, 2147483647, 1, 'spaces-favorites', 'page.php?i=spaces-favorites', '', '', '', 0, 1, 0, 'BxSpacesPageListEntry', 'modules/boonex/spaces/classes/BxSpacesPageListEntry.php');
+
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('bx_spaces_favorites', 2, 'bx_spaces', '_bx_spaces_page_block_title_favorites_entries', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:15:"browse_favorite";s:6:"params";a:2:{s:10:"profile_id";s:12:"{profile_id}";s:6:"params";a:3:{s:9:"unit_view";s:7:"gallery";s:13:"empty_message";b:0;s:13:"ajax_paginate";b:0;}}}', 0, 1, 1),
+('bx_spaces_favorites', 3, 'bx_spaces', '_bx_spaces_page_block_title_favorites_entries_info', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:19:"favorites_list_info";}', 0, 0, 0),
+('bx_spaces_favorites', 3, 'bx_spaces', '_bx_spaces_page_block_title_favorites_entries_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:22:"favorites_list_actions";}', 0, 0, 1);
+
 -- PAGE: add block to homepage
 SET @iBlockOrder = (SELECT `order` FROM `sys_pages_blocks` WHERE `object` = 'sys_home' AND `cell_id` = 1 ORDER BY `order` DESC LIMIT 1);
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
 ('sys_home', 1, 'bx_spaces', '', '_bx_spaces_page_block_title_latest_profiles', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:22:"browse_recent_profiles";}', 1, 0, 0, IFNULL(@iBlockOrder, 0) + 1),
 ('sys_home', 1, 'bx_spaces', '_bx_spaces_page_block_title_sys_recommended_entries_view_showcase', '_bx_spaces_page_block_title_recommended_entries_view_showcase', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:18:"browse_recommended";}', 1, 0, 0, IFNULL(@iBlockOrder, 0) + 2);
+
 -- PAGE: service blocks
 SET @iBlockOrder = (SELECT `order` FROM `sys_pages_blocks` WHERE `object` = '' AND `cell_id` = 0 ORDER BY `order` DESC LIMIT 1);
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
@@ -220,6 +245,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_spaces_view_actions', 'bx_spaces', '_bx_spaces_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_spaces_view_actions', 'bx_spaces', 'join-space-profile', '_bx_spaces_menu_item_title_system_pay_and_join', '_bx_spaces_menu_item_title_pay_and_join', 'page.php?i=join-space-profile&profile_id={profile_id}', '', '', 'sign-in-alt', '', 0, 2147483647, 'a:3:{s:6:"module";s:9:"bx_spaces";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_spaces_view_actions', 'bx_spaces', 'profile-fan-add', '_bx_spaces_menu_item_title_system_become_fan', '{title_add_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_spaces_fans\', \'add\', \'{profile_id}\')', '', 'sign-in-alt', '', 0, 2147483647, '', 1, 0, 0, 5),
 ('bx_spaces_view_actions', 'bx_spaces', 'profile-subscribe-add', '_bx_spaces_menu_item_title_system_subscribe', '_bx_spaces_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_spaces_view_actions', 'bx_spaces', '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_spaces'', content_id: {content_id}});', '', 'check-circle', '', 0, 192, 'a:2:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:19:"is_badges_avaliable";}', 1, 0, 1, 30),
@@ -233,13 +259,14 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_spaces_view_actions_more', 'bx_spaces', '_bx_spaces_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_spaces_view_actions_more', 'bx_spaces', 'profile-fan-remove', '_bx_spaces_menu_item_title_system_leave_space', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_spaces_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, 1, 0, 10),
-('bx_spaces_view_actions_more', 'bx_spaces', 'profile-subscribe-remove', '_bx_spaces_menu_item_title_system_unsubscribe', '_bx_spaces_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, 1, 0, 20),
-('bx_spaces_view_actions_more', 'bx_spaces', 'edit-space-cover', '_bx_spaces_menu_item_title_system_edit_cover', '_bx_spaces_menu_item_title_edit_cover', 'page.php?i=edit-space-cover&id={content_id}', '', '', 'edit', '', 2147483647, 1, 0, 30),
-('bx_spaces_view_actions_more', 'bx_spaces', 'edit-space-profile', '_bx_spaces_menu_item_title_system_edit_profile', '_bx_spaces_menu_item_title_edit_profile', 'page.php?i=edit-space-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 40),
-('bx_spaces_view_actions_more', 'bx_spaces', 'invite-to-space', '_bx_spaces_menu_item_title_system_invite', '_bx_spaces_menu_item_title_invite', 'page.php?i=invite-to-space&id={content_id}', '', '', 'user-friends', '', 2147483647, 1, 0, 42),
-('bx_spaces_view_actions_more', 'bx_spaces', 'delete-space-profile', '_bx_spaces_menu_item_title_system_delete_profile', '_bx_spaces_menu_item_title_delete_profile', 'page.php?i=delete-space-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_spaces_view_actions_more', 'bx_spaces', 'profile-fan-remove', '_bx_spaces_menu_item_title_system_leave_space', '{title_remove_fan}', 'javascript:void(0)', 'bx_conn_action(this, \'bx_spaces_fans\', \'remove\', \'{profile_id}\')', '', 'sign-out-alt', '', 2147483647, '', 1, 0, 10),
+('bx_spaces_view_actions_more', 'bx_spaces', 'profile-subscribe-remove', '_bx_spaces_menu_item_title_system_unsubscribe', '_bx_spaces_menu_item_title_unsubscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'remove\', \'{profile_id}\')', '', 'check', '', 2147483647, '', 1, 0, 20),
+('bx_spaces_view_actions_more', 'bx_spaces', 'edit-space-cover', '_bx_spaces_menu_item_title_system_edit_cover', '_bx_spaces_menu_item_title_edit_cover', 'page.php?i=edit-space-cover&id={content_id}', '', '', 'edit', '', 2147483647, '', 1, 0, 30),
+('bx_spaces_view_actions_more', 'bx_spaces', 'edit-space-profile', '_bx_spaces_menu_item_title_system_edit_profile', '_bx_spaces_menu_item_title_edit_profile', 'page.php?i=edit-space-profile&id={content_id}', '', '', 'pencil-alt', '', 2147483647, '', 1, 0, 40),
+('bx_spaces_view_actions_more', 'bx_spaces', 'edit-space-pricing', '_bx_spaces_menu_item_title_system_edit_pricing', '_bx_spaces_menu_item_title_edit_pricing', 'page.php?i=edit-space-pricing&profile_id={profile_id}', '', '', 'money-check-alt', '', 2147483647, 'a:3:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:20:"is_pricing_avaliable";s:6:"params";a:1:{i:0;s:12:"{profile_id}";}}', 1, 0, 41),
+('bx_spaces_view_actions_more', 'bx_spaces', 'invite-to-space', '_bx_spaces_menu_item_title_system_invite', '_bx_spaces_menu_item_title_invite', 'page.php?i=invite-to-space&id={content_id}', '', '', 'user-friends', '', 2147483647, '', 1, 0, 42),
+('bx_spaces_view_actions_more', 'bx_spaces', 'delete-space-profile', '_bx_spaces_menu_item_title_system_delete_profile', '_bx_spaces_menu_item_title_delete_profile', 'page.php?i=delete-space-profile&id={content_id}', '', '', 'remove', '', 2147483647, '', 1, 0, 50);
 
 -- MENU: all actions menu for view entry 
 
@@ -250,6 +277,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_spaces_view_actions_all', 'bx_spaces', '_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_spaces_view_actions_all', 'bx_spaces', 'join-space-profile', '_bx_spaces_menu_item_title_system_pay_and_join', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 5),
 ('bx_spaces_view_actions_all', 'bx_spaces', 'profile-fan-add', '_bx_spaces_menu_item_title_system_become_fan', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 10),
 ('bx_spaces_view_actions_all', 'bx_spaces', 'profile-fan-remove', '_bx_spaces_menu_item_title_system_leave_group', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 20),
 ('bx_spaces_view_actions_all', 'bx_spaces', 'profile-subscribe-add', '_bx_spaces_menu_item_title_system_subscribe', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 30),
@@ -270,6 +298,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_spaces_view_actions_all', 'bx_spaces', 'social-sharing-pinterest', '_sys_menu_item_title_system_social_sharing_pinterest', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 330),
 ('bx_spaces_view_actions_all', 'bx_spaces', 'edit-space-cover', '_bx_spaces_menu_item_title_system_edit_cover', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 400),
 ('bx_spaces_view_actions_all', 'bx_spaces', 'edit-space-profile', '_bx_spaces_menu_item_title_system_edit_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 410),
+('bx_spaces_view_actions_all', 'bx_spaces', 'edit-space-pricing', '_bx_spaces_menu_item_title_system_edit_pricing', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 415),
 ('bx_spaces_view_actions_all', 'bx_spaces', 'invite-to-space', '_bx_spaces_menu_item_title_system_invite', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 420),
 ('bx_spaces_view_actions_all', 'bx_spaces', 'delete-space-profile', '_bx_spaces_menu_item_title_system_delete_profile', '', '', '', '', '', '', '', 0, 2147483647, '', 1, 0, 430),
 ('bx_spaces_view_actions_all', 'bx_spaces', '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);
@@ -323,18 +352,19 @@ INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `templat
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_spaces_snippet_meta', 'bx_spaces', '_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_spaces_snippet_meta', 'bx_spaces', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, 0, 0, 1, 1),
-('bx_spaces_snippet_meta', 'bx_spaces', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, 0, 0, 1, 2),
-('bx_spaces_snippet_meta', 'bx_spaces', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, 0, 0, 1, 3),
-('bx_spaces_snippet_meta', 'bx_spaces', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, 0, 0, 1, 4),
-('bx_spaces_snippet_meta', 'bx_spaces', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, 0, 0, 1, 5),
-('bx_spaces_snippet_meta', 'bx_spaces', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, 1, 0, 1, 6),
-('bx_spaces_snippet_meta', 'bx_spaces', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, 1, 0, 1, 7),
-('bx_spaces_snippet_meta', 'bx_spaces', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 0, 0, 1, 8),
-('bx_spaces_snippet_meta', 'bx_spaces', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, 0, 0, 1, 9),
-('bx_spaces_snippet_meta', 'bx_spaces', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, 1, 0, 1, 10),
-('bx_spaces_snippet_meta', 'bx_spaces', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, 0, 0, 1, 11);
+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_spaces_snippet_meta', 'bx_spaces', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', 2147483647, '', 0, 0, 1, 1),
+('bx_spaces_snippet_meta', 'bx_spaces', 'tags', '_sys_menu_item_title_system_sm_tags', '_sys_menu_item_title_sm_tags', '', '', '', '', '', 2147483647, '', 0, 0, 1, 2),
+('bx_spaces_snippet_meta', 'bx_spaces', 'views', '_sys_menu_item_title_system_sm_views', '_sys_menu_item_title_sm_views', '', '', '', '', '', 2147483647, '', 0, 0, 1, 3),
+('bx_spaces_snippet_meta', 'bx_spaces', 'comments', '_sys_menu_item_title_system_sm_comments', '_sys_menu_item_title_sm_comments', '', '', '', '', '', 2147483647, '', 0, 0, 1, 4),
+('bx_spaces_snippet_meta', 'bx_spaces', 'members', '_sys_menu_item_title_system_sm_members', '_sys_menu_item_title_sm_members', '', '', '', '', '', 2147483647, '', 0, 0, 1, 5),
+('bx_spaces_snippet_meta', 'bx_spaces', 'subscribers', '_sys_menu_item_title_system_sm_subscribers', '_sys_menu_item_title_sm_subscribers', '', '', '', '', '', 2147483647, '', 1, 0, 1, 6),
+('bx_spaces_snippet_meta', 'bx_spaces', 'nl', '_sys_menu_item_title_system_sm_nl', '_sys_menu_item_title_sm_nl', '', '', '', '', '', 2147483647, '', 1, 0, 1, 7),
+('bx_spaces_snippet_meta', 'bx_spaces', '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_spaces";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, 8),
+('bx_spaces_snippet_meta', 'bx_spaces', 'join', '_sys_menu_item_title_system_sm_join', '_sys_menu_item_title_sm_join', '', '', '', '', '', 2147483647, 'a:3:{s:6:"module";s:9:"bx_spaces";s:6:"method";s:33:"is_free_join_avaliable_by_content";s:6:"params";a:1:{i:0;s:12:"{content_id}";}}', 0, 0, 1, 9),
+('bx_spaces_snippet_meta', 'bx_spaces', 'leave', '_sys_menu_item_title_system_sm_leave', '_sys_menu_item_title_sm_leave', '', '', '', '', '', 2147483647, '', 0, 0, 1, 10),
+('bx_spaces_snippet_meta', 'bx_spaces', 'subscribe', '_sys_menu_item_title_system_sm_subscribe', '_sys_menu_item_title_sm_subscribe', '', '', '', '', '', 2147483647, '', 1, 0, 1, 11),
+('bx_spaces_snippet_meta', 'bx_spaces', 'unsubscribe', '_sys_menu_item_title_system_sm_unsubscribe', '_sys_menu_item_title_sm_unsubscribe', '', '', '', '', '', 2147483647, '', 0, 0, 1, 12);
 
 -- 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);
@@ -368,6 +398,10 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 ('bx_spaces', 'create entry', NULL, '_bx_spaces_acl_action_create_profile', '', 1, 1);
 SET @iIdActionProfileCreate = LAST_INSERT_ID();
 
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('bx_spaces', 'use paid join', NULL, '_bx_spaces_acl_action_use_paid_join', '', 1, 1);
+SET @iIdActionUsePaidJoin = LAST_INSERT_ID();
+
 INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
 ('bx_spaces', 'delete entry', NULL, '_bx_spaces_acl_action_delete_profile', '', 1, 1);
 SET @iIdActionProfileDelete = LAST_INSERT_ID();
@@ -409,6 +443,12 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iAdministrator, @iIdActionProfileCreate),
 (@iPremium, @iIdActionProfileCreate),
 
+-- use paid join
+(@iStandard, @iIdActionUsePaidJoin),
+(@iModerator, @iIdActionUsePaidJoin),
+(@iAdministrator, @iIdActionUsePaidJoin),
+(@iPremium, @iIdActionUsePaidJoin),
+
 -- profile delete
 (@iAccount, @iIdActionProfileDelete),
 (@iStandard, @iIdActionProfileDelete),
@@ -474,7 +514,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_spaces_fans', 'name', '_sys_name', '50%', '', 10),
 ('bx_spaces_fans', 'role', '_bx_spaces_txt_role', '10%', '', 15),
-('bx_spaces_fans', 'actions', '', '40%', '', 20);
+('bx_spaces_fans', 'role_added', '_bx_spaces_txt_role_added', '10%', '', 16),
+('bx_spaces_fans', 'role_expired', '_bx_spaces_txt_role_expired', '10%', '', 17),
+('bx_spaces_fans', 'actions', '', '20%', '', 20);
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `confirm`, `order`) VALUES
 ('bx_spaces_fans', 'single', 'accept', '_sys_accept', '', 0, 10),
@@ -524,6 +566,34 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_spaces_common', 'bulk', 'delete_with_content', '_bx_spaces_grid_action_title_adm_delete_with_content', '', 0, 1, 2),
 ('bx_spaces_common', 'single', 'settings', '_bx_spaces_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_spaces_prices_manage', 'Sql', 'SELECT * FROM `bx_spaces_prices` WHERE 1 ', 'bx_spaces_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxSpacesGridPricesManage', 'modules/boonex/spaces/classes/BxSpacesGridPricesManage.php'),
+('bx_spaces_prices_view', 'Sql', 'SELECT * FROM `bx_spaces_prices` WHERE 1 ', 'bx_spaces_prices', 'id', 'order', '', '', 100, NULL, 'start', '', 'period,period_unit,price', '', 'like', '', '', 2147483647, 'BxSpacesGridPricesView', 'modules/boonex/spaces/classes/BxSpacesGridPricesView.php');
+
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('bx_spaces_prices_manage', 'checkbox', '_sys_select', '1%', 0, '', '', 1),
+('bx_spaces_prices_manage', 'order', '', '1%', 0, '', '', 2),
+('bx_spaces_prices_manage', 'name', '_bx_spaces_grid_column_title_name', '38%', 0, 32, '', 3),
+('bx_spaces_prices_manage', 'price', '_bx_spaces_grid_column_title_price', '20%', 0, 16, '', 4),
+('bx_spaces_prices_manage', 'period', '_bx_spaces_grid_column_title_period', '20%', 0, 16, '', 5),
+('bx_spaces_prices_manage', 'actions', '', '20%', 0, '', '', 6),
+
+('bx_spaces_prices_view', 'role_id', '_bx_spaces_grid_column_title_role_id', '40%', 0, 32, '', 1),
+('bx_spaces_prices_view', 'price', '_bx_spaces_grid_column_title_price', '20%', 0, 16, '', 2),
+('bx_spaces_prices_view', 'period', '_bx_spaces_grid_column_title_period', '20%', 0, 16, '', 3),
+('bx_spaces_prices_view', 'actions', '', '20%', 0, '', '', 4);
+
+INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
+('bx_spaces_prices_manage', 'independent', 'add', '_bx_spaces_grid_action_title_add', '', 0, 0, 1),
+('bx_spaces_prices_manage', 'single', 'edit', '_bx_spaces_grid_action_title_edit', 'pencil-alt', 1, 0, 1),
+('bx_spaces_prices_manage', 'single', 'delete', '_bx_spaces_grid_action_title_delete', 'remove', 1, 1, 2),
+('bx_spaces_prices_manage', 'bulk', 'delete', '_bx_spaces_grid_action_title_delete', '', 0, 1, 1),
+
+('bx_spaces_prices_view', 'single', 'buy', '_bx_spaces_grid_action_title_buy', 'cart-plus', 0, 0, 1),
+('bx_spaces_prices_view', 'single', 'subscribe', '_bx_spaces_grid_action_title_subscribe', 'credit-card', 0, 0, 2),
+('bx_spaces_prices_view', 'single', 'choose', '_bx_spaces_grid_action_title_choose', 'far check-square', 0, 0, 3);
+
 
 -- ALERTS
 
@@ -558,7 +628,8 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `spaces`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
 ('bx_spaces_allow_view_to', 'bx_spaces', 'view', '_bx_spaces_form_profile_input_allow_view_to', '3', '', 'bx_spaces_data', 'id', 'author', 'BxSpacesPrivacy', 'modules/boonex/spaces/classes/BxSpacesPrivacy.php'),
 ('bx_spaces_allow_view_notification_to', 'bx_spaces', 'view_event', '_bx_spaces_form_profile_input_allow_view_notification_to', '3', '', 'bx_notifications_events', 'id', 'object_owner_id', 'BxSpacesPrivacyNotifications', 'modules/boonex/spaces/classes/BxSpacesPrivacyNotifications.php'),
-('bx_spaces_allow_post_to', 'bx_spaces', 'post', '_bx_spaces_form_profile_input_allow_post_to', '3', '', 'bx_spaces_data', 'id', 'author', 'BxSpacesPrivacyPost', 'modules/boonex/spaces/classes/BxSpacesPrivacyPost.php');
+('bx_spaces_allow_post_to', 'bx_spaces', 'post', '_bx_spaces_form_profile_input_allow_post_to', '3', '', 'bx_spaces_data', 'id', 'author', 'BxSpacesPrivacyPost', 'modules/boonex/spaces/classes/BxSpacesPrivacyPost.php'),
+('bx_spaces_allow_view_favorite_list', 'bx_spaces', 'view_favorite_list', '_bx_spaces_form_profile_input_allow_view_favorite_list', '3', '', 'bx_spaces_favorites_lists', 'id', 'author_id', 'BxSpacesPrivacy', 'modules/boonex/spaces/classes/BxSpacesPrivacy.php');
 
 -- EMAIL TEMPLATES
 
@@ -578,3 +649,7 @@ INSERT INTO `sys_objects_uploader` (`object`, `active`, `override_class_name`, `
 ('bx_spaces_cover_crop', 1, 'BxSpacesUploaderCoverCrop', 'modules/boonex/spaces/classes/BxSpacesUploaderCoverCrop.php'),
 ('bx_spaces_picture_crop', 1, 'BxSpacesUploaderPictureCrop', 'modules/boonex/spaces/classes/BxSpacesUploaderPictureCrop.php');
 
+
+-- CRON
+INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `service_call`) VALUES
+('bx_spaces_pruning', '0 0 * * *', 'BxSpacesCronPruning', 'modules/boonex/spaces/classes/BxSpacesCronPruning.php', '');

+ 81 - 2
modules/boonex/spaces/install/sql/install.sql

@@ -200,7 +200,9 @@ CREATE TABLE IF NOT EXISTS `bx_spaces_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`)
 );
@@ -209,10 +211,21 @@ CREATE TABLE IF NOT EXISTS `bx_spaces_admins` (
 CREATE TABLE `bx_spaces_favorites_track` (
   `object_id` int(11) NOT NULL default '0',
   `author_id` int(11) NOT NULL default '0',
+  `list_id` int(11) NOT NULL default '0',
   `date` int(11) NOT NULL default '0',
   KEY `id` (`object_id`,`author_id`)
 );
 
+CREATE TABLE `bx_spaces_favorites_lists` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `title` varchar(255) NOT NULL,
+  `author_id` int(11) NOT NULL default '0',
+  `date` int(11) NOT NULL default '0',
+  `allow_view_favorite_list_to` varchar(16) NOT NULL DEFAULT '3',
+   PRIMARY KEY (`id`)
+);
+
+
 -- TABLE: scores
 CREATE TABLE IF NOT EXISTS `bx_spaces_scores` (
   `object_id` int(11) NOT NULL default '0',
@@ -242,6 +255,21 @@ CREATE TABLE IF NOT EXISTS `bx_spaces_invites` (
   PRIMARY KEY (`id`)
 );
 
+-- TABLE: Pricing
+CREATE TABLE IF NOT EXISTS `bx_spaces_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
 ('bx_spaces_pics', @sStorageEngine, '', 360, 2592000, 3, 'bx_spaces_pics', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
@@ -334,6 +362,46 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_space_view_full', 'space_cat', 2147483647, 1, 2),
 ('bx_space_view_full', 'space_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_spaces_price', 'bx_spaces', '_bx_spaces_form_price', '', '', 'do_submit', 'bx_spaces_prices', 'id', '', '', '', 0, 1, 'BxSpacesFormPrice', 'modules/boonex/spaces/classes/BxSpacesFormPrice.php');
+
+INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
+('bx_spaces_price_add', 'bx_spaces', 'bx_spaces_price', '_bx_spaces_form_price_display_add', 0),
+('bx_spaces_price_edit', 'bx_spaces', 'bx_spaces_price', '_bx_spaces_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_spaces_price', 'bx_spaces', 'id', '', '', 0, 'hidden', '_bx_spaces_form_price_input_sys_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'role_id', '', '', 0, 'hidden', '_bx_spaces_form_price_input_sys_role_id', '', '', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'name', '', '', 0, 'text', '_bx_spaces_form_price_input_sys_name', '_bx_spaces_form_price_input_name', '_bx_spaces_form_price_input_inf_name', 1, 0, 0, '', '', '', 'Avail', '', '_bx_spaces_form_price_input_err_name', 'Xss', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'period', '', '', 0, 'text', '_bx_spaces_form_price_input_sys_period', '_bx_spaces_form_price_input_period', '_bx_spaces_form_price_input_inf_period', 1, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'period_unit', '', '#!bx_spaces_period_units', 0, 'select', '_bx_spaces_form_price_input_sys_period_unit', '_bx_spaces_form_price_input_period_unit', '_bx_spaces_form_price_input_inf_period_unit', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'price', '', '', 0, 'text', '_bx_spaces_form_price_input_sys_price', '_bx_spaces_form_price_input_price', '_bx_spaces_form_price_input_inf_price', 1, 0, 0, '', '', '', '', '', '', 'Float', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'do_submit', '_bx_spaces_form_price_input_do_submit', '', 0, 'submit', '_bx_spaces_form_price_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_spaces_price', 'bx_spaces', 'do_cancel', '_bx_spaces_form_price_input_do_cancel', '', 0, 'button', '_bx_spaces_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_spaces_price_add', 'id', 2147483647, 0, 1),
+('bx_spaces_price_add', 'role_id', 2147483647, 1, 2),
+('bx_spaces_price_add', 'name', 2147483647, 1, 3),
+('bx_spaces_price_add', 'price', 2147483647, 1, 4),
+('bx_spaces_price_add', 'period', 2147483647, 1, 5),
+('bx_spaces_price_add', 'period_unit', 2147483647, 1, 6),
+('bx_spaces_price_add', 'controls', 2147483647, 1, 7),
+('bx_spaces_price_add', 'do_submit', 2147483647, 1, 8),
+('bx_spaces_price_add', 'do_cancel', 2147483647, 1, 9),
+
+('bx_spaces_price_edit', 'id', 2147483647, 1, 1),
+('bx_spaces_price_edit', 'role_id', 2147483647, 1, 2),
+('bx_spaces_price_edit', 'name', 2147483647, 1, 3),
+('bx_spaces_price_edit', 'price', 2147483647, 1, 4),
+('bx_spaces_price_edit', 'period', 2147483647, 1, 5),
+('bx_spaces_price_edit', 'period_unit', 2147483647, 1, 6),
+('bx_spaces_price_edit', 'controls', 2147483647, 1, 7),
+('bx_spaces_price_edit', 'do_submit', 2147483647, 1, 8),
+('bx_spaces_price_edit', 'do_cancel', 2147483647, 1, 9);
+
 -- PRE-VALUES
 INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
 ('bx_spaces_cats', '_bx_spaces_pre_lists_cats', 'bx_spaces', '0');
@@ -355,6 +423,17 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALU
 ('bx_spaces_roles', '1', 2, '_bx_spaces_role_administrator', ''),
 ('bx_spaces_roles', '2', 3, '_bx_spaces_role_moderator', '');
 
+INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`) VALUES
+('bx_spaces_period_units', '_bx_spaces_pre_lists_period_units', 'bx_spaces', '0');
+
+INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`) VALUES
+('bx_spaces_period_units', '', 0, '_sys_please_select', ''),
+('bx_spaces_period_units', 'day', 1, '_bx_spaces_period_unit_day', ''),
+('bx_spaces_period_units', 'week', 2, '_bx_spaces_period_unit_week', ''),
+('bx_spaces_period_units', 'month', 3, '_bx_spaces_period_unit_month', ''),
+('bx_spaces_period_units', 'year', 4, '_bx_spaces_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_spaces', 'bx_spaces', 'bx_spaces_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-space-profile&id={object_id}', '', 'bx_spaces_data', 'id', 'author', 'space_name', 'comments', 'BxSpacesCmts', 'modules/boonex/spaces/classes/BxSpacesCmts.php'),
@@ -377,8 +456,8 @@ INSERT INTO `sys_objects_report` (`name`, `module`, `table_main`, `table_track`,
 ('bx_spaces', 'bx_spaces', 'bx_spaces_reports', 'bx_spaces_reports_track', '1', 'page.php?i=view-space-profile&id={object_id}', 'bx_spaces_notes', 'bx_spaces_data', 'id', 'author', 'reports', '', '');
 
 -- FAFORITES
-INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
-('bx_spaces', 'bx_spaces_favorites_track', '1', '1', '1', 'page.php?i=view-space-profile&id={object_id}', 'bx_spaces_data', 'id', 'author', 'favorites', '', '');
+INSERT INTO `sys_objects_favorite` (`name`, `table_track`, `table_lists`, `is_on`, `is_undo`, `is_public`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_count`, `class_name`, `class_file`) VALUES 
+('bx_spaces', 'bx_spaces_favorites_track', 'bx_spaces_favorites_lists', '1', '1', '1', 'page.php?i=view-space-profile&id={object_id}', 'bx_spaces_data', 'id', 'author', 'favorites', '', '');
 
 -- FEATURED
 INSERT INTO `sys_objects_feature` (`name`, `module`, `is_on`, `is_undo`, `base_url`, `trigger_table`, `trigger_field_id`, `trigger_field_author`, `trigger_field_flag`, `class_name`, `class_file`) VALUES 

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

@@ -1,7 +1,7 @@
 
 -- TABLES
 
-DROP TABLE IF EXISTS `bx_spaces_data`, `bx_spaces_pics`, `bx_spaces_pics_resized`, `bx_spaces_cmts`, `bx_spaces_cmts_notes`, `bx_spaces_views_track`, `bx_spaces_meta_keywords`, `bx_spaces_meta_locations`, `bx_spaces_meta_mentions`, `bx_spaces_fans`, `bx_spaces_admins`, `bx_spaces_votes`, `bx_spaces_votes_track`, `bx_spaces_reports`, `bx_spaces_reports_track`, `bx_spaces_favorites_track`, `bx_spaces_scores`, `bx_spaces_scores_track`, `bx_spaces_invites`;
+DROP TABLE IF EXISTS `bx_spaces_data`, `bx_spaces_pics`, `bx_spaces_pics_resized`, `bx_spaces_cmts`, `bx_spaces_cmts_notes`, `bx_spaces_views_track`, `bx_spaces_meta_keywords`, `bx_spaces_meta_locations`, `bx_spaces_meta_mentions`, `bx_spaces_fans`, `bx_spaces_admins`, `bx_spaces_votes`, `bx_spaces_votes_track`, `bx_spaces_reports`, `bx_spaces_reports_track`, `bx_spaces_favorites_track`, `bx_spaces_favorites_lists`, `bx_spaces_scores`, `bx_spaces_scores_track`, `bx_spaces_invites`, `bx_spaces_prices`;
 
 -- PROFILES
 
@@ -21,7 +21,7 @@ DELETE FROM `sys_transcoder_images_files` WHERE `transcoder_object` IN('bx_space
 DELETE FROM `sys_objects_form` WHERE `module` = 'bx_spaces';
 DELETE FROM `sys_form_displays` WHERE `module` = 'bx_spaces';
 DELETE FROM `sys_form_inputs` WHERE `module` = 'bx_spaces';
-DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_space_add', 'bx_space_delete', 'bx_space_edit', 'bx_space_edit_cover', 'bx_space_view', 'bx_space_view_full', 'bx_space_invite');
+DELETE FROM `sys_form_display_inputs` WHERE `display_name` IN('bx_space_add', 'bx_space_delete', 'bx_space_edit', 'bx_space_edit_cover', 'bx_space_view', 'bx_space_view_full', 'bx_space_invite', 'bx_space_invite', 'bx_spaces_price_add', 'bx_spaces_price_edit');
 
 -- PRE-VALUES
 DELETE FROM `sys_form_pre_lists` WHERE `module` = 'bx_spaces';

+ 59 - 0
modules/boonex/spaces/js/prices.js

@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Spaces Spaces
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+
+function BxSpacesPrices(oOptions) {
+    this._sActionsUri = oOptions.sActionUri;
+    this._sActionsUrl = oOptions.sActionUrl;
+    this._sObjNameGrid = oOptions.sObjNameGrid;
+    this._sObjName = oOptions.sObjName == undefined ? 'oBxSpacesPrices' : oOptions.sObjName;
+    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
+    this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
+}
+
+BxSpacesPrices.prototype.checkName = function(sNameId, iId) {
+    var oDate = new Date();
+
+    var oName = jQuery("[name='" + sNameId + "']");
+    var sName = oName.val();
+
+    if(!sName.length)
+        return;
+
+    jQuery.get(
+        this._sActionsUrl + 'check_name',
+        {
+            name: sName,
+            id: iId && parseInt(iId) > 0 ? iId : 0,
+            _t: oDate.getTime()
+        },
+        function(oData) {
+            if(!oData || oData.name == undefined)
+                return;
+
+            oName.val(oData.name);
+        },
+        'json'
+    );
+};
+
+BxSpacesPrices.prototype.onChangeRole = function() {
+	this.reloadGrid($('#bx-grid-level-' + this._sObjNameGrid).val());
+};
+
+BxSpacesPrices.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);
+};
+
+/** @} */

+ 1 - 0
modules/boonex/spaces/template/css/prices.css

@@ -0,0 +1 @@
+@import url(../../../../base/groups/template/css/prices.css);

+ 1 - 0
modules/boonex/spaces/template/favorite-list-info.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/general/template/favorite-list-info.html />

+ 1 - 0
modules/boonex/spaces/template/favorite-lists.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/general/template/favorite-lists.html />

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

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

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است