Explorar o código

Ticket #285 - Core changes.

AntonLV %!s(int64=10) %!d(string=hai) anos
pai
achega
8e076fc6f3

+ 14 - 48
inc/classes/BxDolAcl.php

@@ -361,19 +361,6 @@ class BxDolAcl extends BxDol implements iBxDolSingleton
         return $aLevel;
         return $aLevel;
     }
     }
 
 
-    /**
-     * Get pricing options for the given membership
-     *
-     * @param  int    $iLevelId membership to get prices for
-     * @return array( days1 => price1, days2 => price2, ...) if no prices set, then just array()
-     */
-    function getMembershipPrices($iLevelId)
-    {
-        $aPrice = array();
-        $this->oDb->getPrices(array('type' => 'by_level_id_pair', 'value' => $iLevelId), $aPrice, false);
-        return $aPrice;
-    }
-
     /**
     /**
      * Retrieves information about membership for a given profile at a given moment.
      * Retrieves information about membership for a given profile at a given moment.
      *
      *
@@ -426,37 +413,6 @@ class BxDolAcl extends BxDol implements iBxDolSingleton
         return $aMembershipCurrent;
         return $aMembershipCurrent;
     }
     }
 
 
-    /**
-     * Buy a membership for a profile
-     *
-     * @param  int     $iProfileId     profile that is going to get the membership
-     * @param  int     $iMembershipId  bought membership
-     * @param  int     $sTransactionId internal key of the transaction (ID from Transactions table)
-     * @param  boolean $bStartsNow     if true, the membership will start immediately; if false, the membership will start after the current membership expires
-     * @return boolean true in case of success, false in case of failure
-     */
-    function buyMembership($iProfileId, $iPriceId, $sTransactionId, $bStartsNow = false)
-    {
-        $aPrice = array();
-        $this->oDb->getPrices(array('type' => 'by_id', 'value' => (int)$iPriceId), $aPrice, false);
-        if(!is_array($aPrice) || empty($aPrice))
-            return false;
-
-        $aLevel = array();
-        $this->oDb->getLevels(array('type' => 'by_id', 'value' => $aPrice['level_id']), $aLevel, false);
-        if(!is_array($aLevel) || empty($aLevel))
-            return false;
-
-        $iLevelId = (int)$aLevel['id'];
-        if (isset($this->_aStandardMemberships[$iLevelId])) // check for predefined non-purchasable memberships
-            return false;
-
-        if($aLevel['active'] != 'yes' || $aLevel['purchasable'] != 'yes') // check if membership is active and purchasable
-            return false;
-
-        return $this->setMembership((int)$iProfileId, $iLevelId, $aPrice['days'], $bStartsNow, $sTransactionId);
-    }
-
     /**
     /**
      * Set a membership for a profile
      * Set a membership for a profile
      *
      *
@@ -513,12 +469,13 @@ class BxDolAcl extends BxDol implements iBxDolSingleton
 
 
         $iDateStarts = time();
         $iDateStarts = time();
         if (!$bStartsNow) {
         if (!$bStartsNow) {
-            // make the membership starts after the latest membership expires or return false if latest membership isn't Standard and is lifetime membership.
-            if(!is_null($aMembershipLatest['date_expires']))
+            // Make the membership starts after the latest membership expires or return false if latest membership isn't Standard and is lifetime membership.
+            if(!empty($aMembershipLatest['date_expires']))
                 $iDateStarts = $aMembershipLatest['date_expires'];
                 $iDateStarts = $aMembershipLatest['date_expires'];
-            else if(is_null($aMembershipLatest['date_expires']) && $aMembershipLatest['id'] != MEMBERSHIP_ID_STANDARD)
+            else if(empty($aMembershipLatest['date_expires']) && $aMembershipLatest['id'] != MEMBERSHIP_ID_STANDARD)
                 return false;
                 return false;
-        } else {
+        }
+        else {
             // Delete any profile's membership level and actions traces
             // Delete any profile's membership level and actions traces
             $this->oDb->deleteLevelByProfileId($iProfileId, true); 
             $this->oDb->deleteLevelByProfileId($iProfileId, true); 
             $this->oDb->clearActionsTracksForMember($iProfileId);
             $this->oDb->clearActionsTracksForMember($iProfileId);
@@ -541,6 +498,15 @@ class BxDolAcl extends BxDol implements iBxDolSingleton
         return true;
         return true;
     }
     }
 
 
+    function unsetMembership($iProfileId, $iLevelId, $sTransactionId)
+    {
+    	return $this->oDb->deleteLevelBy(array(
+    		'IDMember' => $iProfileId,
+    		'IDLevel' => $iLevelId,
+    		'TransactionID' => $sTransactionId
+    	));
+    }
+
     /**
     /**
      * get action id by module and name
      * get action id by module and name
      * @param $sAction action name
      * @param $sAction action name

+ 10 - 2
inc/classes/BxDolAclQuery.php

@@ -198,8 +198,7 @@ class BxDolAclQuery extends BxDolDb implements iBxDolSingleton
      * Fetch the last purchased/assigned membership that is still active for the given profile.
      * Fetch the last purchased/assigned membership that is still active for the given profile.
      *
      *
      * NOTE. Don't use cache here, because it's causing an error, if a number of memberrship levels are purchased at the same time.
      * NOTE. Don't use cache here, because it's causing an error, if a number of memberrship levels are purchased at the same time.
-     *
-     * fromMemory returns the same DateExpires because buyMembership function is called in cycle in the same session.
+     * fromMemory returns the same DateExpires because setMembership (old buyMembership) function is called in cycle in the same session.
      */
      */
     function getLevelCurrent($iProfileId, $iTime = 0)
     function getLevelCurrent($iProfileId, $iTime = 0)
     {
     {
@@ -305,6 +304,15 @@ class BxDolAclQuery extends BxDolDb implements iBxDolSingleton
         return (int)$this->query($sQuery) > 0;
         return (int)$this->query($sQuery) > 0;
     }
     }
 
 
+	function deleteLevelBy($aWhere)
+    {
+    	if(empty($aWhere))
+    		return false;
+
+        $sQuery = "DELETE FROM `sys_acl_levels_members` WHERE " . $this->arrayToSQL($aWhere, ' AND ');
+        return (int)$this->query($sQuery) > 0;
+    }
+
     function maintenance($iDaysToCleanMemLevels)
     function maintenance($iDaysToCleanMemLevels)
     {
     {
         $sQuery = $this->prepare("DELETE FROM `sys_acl_levels_members` WHERE `DateExpires` < NOW() - INTERVAL ? DAY", $iDaysToCleanMemLevels);
         $sQuery = $this->prepare("DELETE FROM `sys_acl_levels_members` WHERE `DateExpires` < NOW() - INTERVAL ? DAY", $iDaysToCleanMemLevels);

+ 72 - 1
inc/classes/BxDolTemplate.php

@@ -795,10 +795,81 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton
      * @param  string $sName - template name.
      * @param  string $sName - template name.
      * @return string template's content.
      * @return string template's content.
      */
      */
-    function getTemplate($sName)
+    public function getTemplate($sName)
     {
     {
         return $this->_aTemplates[$sName];
         return $this->_aTemplates[$sName];
     }
     }
+
+    /**
+     * Get icon template in dependence of a value, provided in $mixedId.
+     * 
+     * @param  mixed $mixedId numeric id from Storage, string with template's file name or string with font icon.
+     */
+	public function getIcon($mixedId, $aParams = array())
+    {
+        return $this->_getImage('icon', $mixedId, $aParams);
+    }
+
+    /**
+     * Get image template in dependence of a value, provided in $mixedId.
+     * 
+     * @param  mixed $mixedId numeric id from Storage, string with template's file name or string with font icon.
+     */
+    public function getImage($mixedId, $aParams = array())
+    {
+        return $this->_getImage('image', $mixedId, $aParams);
+    }
+
+	protected function _getImage($sType, $mixedId, $aParams = array())
+    {
+        $sUrl = "";
+        $aType2Method = array('image' => 'getImageUrl', 'icon' => 'getIconUrl');
+
+        //--- Check in System Storage.
+        if(is_numeric($mixedId) && (int)$mixedId > 0) {
+        	$sStorage = BX_DOL_STORAGE_OBJ_IMAGES;
+        	if(!empty($aParams['storage'])) {
+        		$sStorage = $aParams['storage'];
+        		unset($aParams['storage']);
+        	}
+
+            if(($sResult = BxDolStorage::getObjectInstance($sStorage)->getFileUrlById((int)$mixedId)) !== false)
+                $sUrl = $sResult;
+        }
+
+        //--- Check in template folders.
+        if($sUrl == "" && is_string($mixedId) && strpos($mixedId, '.') !== false)
+            $sUrl = $this->$aType2Method[$sType]($mixedId);
+
+        if($sUrl != "") {
+        	$bAlt = isset($aParams['alt']) && !empty($aParams['alt']);
+            $bClass = isset($aParams['class']) && !empty($aParams['class']);
+
+            $aAttrs = array();
+            if($bClass)
+            	$aAttrs[] = array('key' => 'class', 'value' => $aParams['class']);
+			if($bAlt)
+				$aAttrs[] = array('key' => 'alt', 'value' => $aParams['alt']);
+
+            return $this->parseHtmlByName('bx_img.html', array(
+                'bx_if:class' => array(
+                    'condition' => $bClass,
+                    'content' => array(
+                        'content' => $bClass ? $aParams['class'] : ''
+                    )
+                ),
+                'bx_repeat:attrs' => $aAttrs,
+                'src' => $sUrl,
+                'alt' => $bAlt ? $aParams['alt'] : ''
+            ));
+        }
+
+        //--- Use iconic font.
+        return $this->parseHtmlByName('bx_icon.html', array(
+            'name' => $mixedId
+        ));
+    }
+
     /**
     /**
      * Get full URL for the icon.
      * Get full URL for the icon.
      *
      *

+ 2 - 0
install/sql/system.sql

@@ -3366,6 +3366,8 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `
 
 
 ('sys_dashboard', 2, 'system', '', '_sys_page_block_title_profile_stats', 13, 2147483646, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:13:"profile_stats";s:6:"params";a:0:{}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 0),
 ('sys_dashboard', 2, 'system', '', '_sys_page_block_title_profile_stats', 13, 2147483646, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:13:"profile_stats";s:6:"params";a:0:{}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 0),
 
 
+('sys_dashboard', 2, 'system', '_sys_page_block_title_profile_membership', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:18:"profile_membership";s:6:"params";a:0:{}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1),
+
 ('sys_dashboard', 3, 'system', '', '_sys_page_block_title_manage_tools', 11, 192, 'menu', 'sys_account_dashboard_manage_tools', 0, 1, 0),
 ('sys_dashboard', 3, 'system', '', '_sys_page_block_title_manage_tools', 11, 192, 'menu', 'sys_account_dashboard_manage_tools', 0, 1, 0),
 
 
 ('sys_create_account', 1, 'system', '', '_sys_page_block_title_create_account', 11, 2147483647, 'service', 'a:4:{s:6:\"module\";s:6:\"system\";s:6:\"method\";s:19:\"create_account_form\";s:6:\"params\";a:0:{}s:5:\"class\";s:19:\"TemplServiceAccount\";}', 0, 1, 1),
 ('sys_create_account', 1, 'system', '', '_sys_page_block_title_create_account', 11, 2147483647, 'service', 'a:4:{s:6:\"module\";s:6:\"system\";s:6:\"method\";s:19:\"create_account_form\";s:6:\"params\";a:0:{}s:5:\"class\";s:19:\"TemplServiceAccount\";}', 0, 1, 1),

+ 13 - 0
modules/base/profile/classes/BxBaseModProfileModule.php

@@ -254,6 +254,19 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolPro
         return $this->_serviceEntityForm ('editDataForm', $iContentId, $this->_oConfig->CNF['OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER']);
         return $this->_serviceEntityForm ('editDataForm', $iContentId, $this->_oConfig->CNF['OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER']);
     }
     }
 
 
+    public function serviceProfileMembership ($iContentId = 0)
+    {
+    	if (!$iContentId)
+            $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
+        if (!$iContentId)
+            return false;
+
+		$aContentInfo = $this->_oDb->getContentInfoById($iContentId);
+        if (!$aContentInfo)
+            return false;
+
+		return BxDolAcl::getInstance()->getProfileMembership($aContentInfo['profile_id']);
+    }
     public function serviceProfileFriends ($iContentId = 0)
     public function serviceProfileFriends ($iContentId = 0)
     {
     {
         if (!$iContentId)
         if (!$iContentId)

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

@@ -1391,6 +1391,9 @@
 	<string name="_sys_acl_action_vote"><![CDATA[Vote]]></string>
 	<string name="_sys_acl_action_vote"><![CDATA[Vote]]></string>
 	<string name="_sys_acl_action_report"><![CDATA[Report]]></string>
 	<string name="_sys_acl_action_report"><![CDATA[Report]]></string>
 	<string name="_sys_acl_action_report_view"><![CDATA[View reports]]></string>
 	<string name="_sys_acl_action_report_view"><![CDATA[View reports]]></string>
+	<string name="_sys_acl_start"><![CDATA[Start: ]]></string>
+	<string name="_sys_acl_expire"><![CDATA[Expire: ]]></string>
+	<string name="_sys_acl_expire_never"><![CDATA[never]]></string>
 	<string name="_sys_add_friend"><![CDATA[Add friend]]></string>
 	<string name="_sys_add_friend"><![CDATA[Add friend]]></string>
 	<string name="_sys_adm_installed"><![CDATA[Installed]]></string>
 	<string name="_sys_adm_installed"><![CDATA[Installed]]></string>
 	<string name="_sys_admin_apply"><![CDATA[Apply]]></string>
 	<string name="_sys_admin_apply"><![CDATA[Apply]]></string>
@@ -1956,6 +1959,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_page_block_title_login"><![CDATA[Sign in]]></string>
 	<string name="_sys_page_block_title_login"><![CDATA[Sign in]]></string>
 	<string name="_sys_page_block_title_manage_tools"><![CDATA[Manage]]></string>
 	<string name="_sys_page_block_title_manage_tools"><![CDATA[Manage]]></string>
 	<string name="_sys_page_block_title_profile_stats"><![CDATA[Profile stats]]></string>
 	<string name="_sys_page_block_title_profile_stats"><![CDATA[Profile stats]]></string>
+	<string name="_sys_page_block_title_profile_membership"><![CDATA[Membership]]></string>
 	<string name="_sys_page_block_title_unsubscribe_news"><![CDATA[Unsubscribe From Site Newsletters]]></string>
 	<string name="_sys_page_block_title_unsubscribe_news"><![CDATA[Unsubscribe From Site Newsletters]]></string>
 	<string name="_sys_page_block_title_unsubscribe_notifications"><![CDATA[Unsubscribe From Site Notifications]]></string>
 	<string name="_sys_page_block_title_unsubscribe_notifications"><![CDATA[Unsubscribe From Site Notifications]]></string>
 	<string name="_sys_page_block_title_std_dash_version"><![CDATA[Version]]></string>
 	<string name="_sys_page_block_title_std_dash_version"><![CDATA[Version]]></string>

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

@@ -76,6 +76,8 @@
 	<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_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_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_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_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_orgs_page_block_title_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_orgs_page_block_title_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_orgs_page_block_title_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_friends"><![CDATA[Friends]]></string>

+ 1 - 0
modules/boonex/organizations/install/sql/enable.sql

@@ -33,6 +33,7 @@ INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module
 
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
 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_view_profile', 2, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_info', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:11:\"entity_info\";}', 0, 0, 1, 0),
 ('bx_organizations_view_profile', 2, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_info', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:11:\"entity_info\";}', 0, 0, 1, 0),
+('bx_organizations_view_profile', 2, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_membership', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:18:\"profile_membership\";}', 0, 0, 1, 1),
 ('bx_organizations_view_profile', 3, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_friends', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:15:\"profile_friends\";}', 0, 0, 1, 0);
 ('bx_organizations_view_profile', 3, 'bx_organizations', '', '_bx_orgs_page_block_title_profile_friends', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:15:\"profile_friends\";}', 0, 0, 1, 0);
 
 
 -- PAGE: edit profile
 -- PAGE: edit profile

+ 2 - 0
modules/boonex/persons/install/langs/en.xml

@@ -73,6 +73,8 @@
 	<string name="_bx_persons_page_block_title_profile_info_link"><![CDATA[About <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_persons_page_block_title_profile_info_link"><![CDATA[About <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_persons_page_block_title_profile_info"><![CDATA[Info]]></string>
 	<string name="_bx_persons_page_block_title_profile_info"><![CDATA[Info]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_info"><![CDATA[Info]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_info"><![CDATA[Info]]></string>
+	<string name="_bx_persons_page_block_title_profile_membership"><![CDATA[Membership]]></string>
+	<string name="_bx_persons_page_block_title_system_profile_membership"><![CDATA[Membership]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends_link"><![CDATA[Friends of <a href="{profile_link}">{display_name}</a>]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_friends"><![CDATA[Friends]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_friends"><![CDATA[Friends]]></string>

+ 1 - 0
modules/boonex/persons/install/sql/enable.sql

@@ -33,6 +33,7 @@ INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module
 
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
 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_persons_view_profile', 2, 'bx_persons', '', '_bx_persons_page_block_title_profile_info', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:11:\"entity_info\";}', 0, 0, 1, 0),
 ('bx_persons_view_profile', 2, 'bx_persons', '', '_bx_persons_page_block_title_profile_info', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:11:\"entity_info\";}', 0, 0, 1, 0),
+('bx_persons_view_profile', 2, 'bx_persons', '', '_bx_persons_page_block_title_profile_membership', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:18:\"profile_membership\";}', 0, 0, 1, 1),
 ('bx_persons_view_profile', 3, 'bx_persons', '', '_bx_persons_page_block_title_profile_friends', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:15:\"profile_friends\";}', 0, 0, 1, 0);
 ('bx_persons_view_profile', 3, 'bx_persons', '', '_bx_persons_page_block_title_profile_friends', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:15:\"profile_friends\";}', 0, 0, 1, 0);
 
 
 -- PAGE: edit profile
 -- PAGE: edit profile

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

@@ -77,6 +77,8 @@
 	<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_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_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_orgs_page_block_title_system_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_profile_friends_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Друзья]]></string>
 	<string name="_bx_orgs_page_block_title_profile_friends_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Друзья]]></string>
 	<string name="_bx_orgs_page_block_title_profile_friends"><![CDATA[Друзья]]></string>
 	<string name="_bx_orgs_page_block_title_profile_friends"><![CDATA[Друзья]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_friends"><![CDATA[Друзья]]></string>
 	<string name="_bx_orgs_page_block_title_system_profile_friends"><![CDATA[Друзья]]></string>

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

@@ -73,6 +73,8 @@
 	<string name="_bx_persons_page_block_title_profile_info_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Инфо]]></string>
 	<string name="_bx_persons_page_block_title_profile_info_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Инфо]]></string>
 	<string name="_bx_persons_page_block_title_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_persons_page_block_title_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_info"><![CDATA[Инфо]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_info"><![CDATA[Инфо]]></string>
+	<string name="_bx_persons_page_block_title_profile_membership"><![CDATA[Членство]]></string>
+	<string name="_bx_persons_page_block_title_system_profile_membership"><![CDATA[Членство]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Друзья]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends_link"><![CDATA[<a href="{profile_link}">{display_name}</a> - Друзья]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends"><![CDATA[Друзья]]></string>
 	<string name="_bx_persons_page_block_title_profile_friends"><![CDATA[Друзья]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_friends"><![CDATA[Друзья]]></string>
 	<string name="_bx_persons_page_block_title_system_profile_friends"><![CDATA[Друзья]]></string>

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

@@ -1391,6 +1391,9 @@
 	<string name="_sys_acl_action_vote"><![CDATA[Голосовать]]></string>
 	<string name="_sys_acl_action_vote"><![CDATA[Голосовать]]></string>
 	<string name="_sys_acl_action_report"><![CDATA[Жаловаться]]></string>
 	<string name="_sys_acl_action_report"><![CDATA[Жаловаться]]></string>
 	<string name="_sys_acl_action_report_view"><![CDATA[Просматривать жалобы]]></string>
 	<string name="_sys_acl_action_report_view"><![CDATA[Просматривать жалобы]]></string>
+	<string name="_sys_acl_start"><![CDATA[Начало: ]]></string>
+	<string name="_sys_acl_expire"><![CDATA[Окончание: ]]></string>
+	<string name="_sys_acl_expire_never"><![CDATA[никогда]]></string>
 	<string name="_sys_add_friend"><![CDATA[Добавить друга]]></string>
 	<string name="_sys_add_friend"><![CDATA[Добавить друга]]></string>
 	<string name="_sys_adm_installed"><![CDATA[Установленные]]></string>
 	<string name="_sys_adm_installed"><![CDATA[Установленные]]></string>
 	<string name="_sys_admin_apply"><![CDATA[Применить]]></string>
 	<string name="_sys_admin_apply"><![CDATA[Применить]]></string>
@@ -1956,6 +1959,7 @@
 	<string name="_sys_page_block_title_login"><![CDATA[Вход]]></string>
 	<string name="_sys_page_block_title_login"><![CDATA[Вход]]></string>
 	<string name="_sys_page_block_title_manage_tools"><![CDATA[Управление]]></string>
 	<string name="_sys_page_block_title_manage_tools"><![CDATA[Управление]]></string>
 	<string name="_sys_page_block_title_profile_stats"><![CDATA[Профиль - Статистика]]></string>
 	<string name="_sys_page_block_title_profile_stats"><![CDATA[Профиль - Статистика]]></string>
+	<string name="_sys_page_block_title_profile_membership"><![CDATA[Членство]]></string>
 	<string name="_sys_page_block_title_unsubscribe_news"><![CDATA[Отписаться от Новостей Сайта]]></string>
 	<string name="_sys_page_block_title_unsubscribe_news"><![CDATA[Отписаться от Новостей Сайта]]></string>
 	<string name="_sys_page_block_title_unsubscribe_notifications"><![CDATA[Отписаться от Уведомлений Сайта]]></string>
 	<string name="_sys_page_block_title_unsubscribe_notifications"><![CDATA[Отписаться от Уведомлений Сайта]]></string>
 	<string name="_sys_page_block_title_std_dash_version"><![CDATA[Версия]]></string>
 	<string name="_sys_page_block_title_std_dash_version"><![CDATA[Версия]]></string>

+ 0 - 45
studio/classes/BxDolStudioTemplate.php

@@ -150,51 +150,6 @@ class BxDolStudioTemplate extends BxDolTemplate implements iBxDolSingleton
         return $this->parseHtmlByName('breadcrumb.html', array('bx_repeat:items' => $aItems));
         return $this->parseHtmlByName('breadcrumb.html', array('bx_repeat:items' => $aItems));
     }
     }
 
 
-    function getIcon($mixedId, $aParams = array())
-    {
-        return $this->_getImage('icon', $mixedId, $aParams);
-    }
-
-    function getImage($mixedId, $aParams = array())
-    {
-        return $this->_getImage('image', $mixedId, $aParams);
-    }
-
-    protected function _getImage($sType, $mixedId, $aParams = array())
-    {
-        $sUrl = "";
-        $aType2Method = array('image' => 'getImageUrl', 'icon' => 'getIconUrl');
-
-        //--- Check in System Storage.
-        if(is_numeric($mixedId) && (int)$mixedId > 0)
-            if(($sResult = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES)->getFileUrlById((int)$mixedId)) !== false)
-                $sUrl = $sResult;
-
-        //--- Check in template folders.
-        if($sUrl == "" && is_string($mixedId) && strpos($mixedId, '.') !== false)
-            $sUrl = $this->$aType2Method[$sType]($mixedId);
-
-        if($sUrl != "") {
-            $bClass = isset($aParams['class']) && !empty($aParams['class']);
-
-            return $this->parseHtmlByName('bx_img.html', array(
-                'bx_if:class' => array(
-                    'condition' => $bClass,
-                    'content' => array(
-                        'content' => $bClass ? $aParams['class'] : ''
-                    )
-                ),
-                'src' => $sUrl,
-                'alt' => isset($aParams['alt']) ? $aParams['alt'] : ''
-            ));
-        }
-
-        //--- Use iconic font.
-        return $this->parseHtmlByName('bx_icon.html', array(
-            'name' => $mixedId
-        ));
-    }
-
     function displayMsg ($s, $bTranslate = false)
     function displayMsg ($s, $bTranslate = false)
     {
     {
         $sTitle = $bTranslate ? _t($s) : $s;
         $sTitle = $bTranslate ? _t($s) : $s;

+ 7 - 0
template/acl_membership.html

@@ -0,0 +1,7 @@
+<div class="bx-acl-membeship bx-def-font-align-center">
+	<h3 class="bx-acl-m-title">__level__</h3>
+	<p class="bx-acl-m-thumbnail">__thumbnail__</p>
+	<bx_if:show_private_info>
+		<p class="bx-acl-m-info bx-def-font-small"><bx_text:_sys_acl_start /> <b>__date_start__</b> <bx_text:_sys_acl_expire /> <b>__date_expire__</b></p>
+	</bx_if:show_private_info>
+</div>

+ 13 - 0
template/css/acl.css

@@ -0,0 +1,13 @@
+/*-- Profile Membership block --*/
+div.bx-acl-membeship .bx-acl-m-thumbnail .sys-icon {
+	width: 100px;
+	height: 100px;
+
+	line-height: 100px;
+	font-size: 96px;
+}
+
+div.bx-acl-membeship .bx-acl-m-thumbnail img {
+	width: 100px;
+	height: 100px;
+}

+ 23 - 0
template/scripts/BxBaseAcl.php

@@ -18,6 +18,29 @@ class BxBaseAcl extends BxDolAcl
         parent::__construct ();
         parent::__construct ();
     }
     }
 
 
+	public function getProfileMembership ($iProfileId)
+    {
+    	$aLevel = $this->getMemberMembershipInfo($iProfileId);
+    	if(empty($aLevel) || !is_array($aLevel))
+    		return '';
+
+		$aLevelInfo = $this->getMembershipInfo($aLevel['id']);
+
+   		$oTemplate = BxDolTemplate::getInstance();
+        $oTemplate->addCss(array('acl.css'));
+    	return $oTemplate->parseHtmlByName('acl_membership.html', array(
+    		'level' => _t($aLevel['name']),
+    		'thumbnail' => $oTemplate->getImage($aLevelInfo['icon'], array('class' => 'bx-acl-m-thumbnail bx-def-border')),
+    		'bx_if:show_private_info' => array(
+    			'condition' => $iProfileId == bx_get_logged_profile_id(),
+    			'content' => array(
+    				'date_start' => bx_time_js($aLevel['date_starts']),
+    				'date_expire' => (int)$aLevel['date_expires'] > 0 ? bx_time_js($aLevel['date_expires']) : _t('_sys_acl_expire_never')
+    			)
+    		)
+    	));
+    }
+
     /**
     /**
      * Print code for membership status
      * Print code for membership status
      * $iProfileId - ID of profile
      * $iProfileId - ID of profile

+ 8 - 0
template/scripts/BxBaseServiceProfiles.php

@@ -40,6 +40,14 @@ class BxBaseServiceProfiles extends BxDol
         return $oTemplate->parseHtmlByName('profile_stats.html', $aVars);
         return $oTemplate->parseHtmlByName('profile_stats.html', $aVars);
     }
     }
 
 
+    public function serviceProfileMembership ($iProfileId = 0)
+    {
+        if (!$iProfileId)
+            $iProfileId = bx_get_logged_profile_id();
+
+		return BxDolAcl::getInstance()->getProfileMembership($iProfileId);
+    }
+
     public function serviceProfileNotifications ($iProfileId = 0)
     public function serviceProfileNotifications ($iProfileId = 0)
     {
     {
         if (!$iProfileId)
         if (!$iProfileId)