AntonLV 9 лет назад
Родитель
Сommit
de2c65ea17

+ 1 - 0
inc/classes/BxDol.php

@@ -168,6 +168,7 @@ interface iBxDolProfile
     public function getDisplayName();
     public function getUrl();
     public function getUnit();
+    public function hasImage();
     public function getPicture();
     public function getAvatar();
     public function getThumb();

+ 54 - 12
inc/classes/BxDolCronAccount.php

@@ -40,9 +40,9 @@ class BxDolCronAccount extends BxDolCron
         $aSent = array();
         $aProfiles = BxDolAclQuery::getInstance()->getProfilesByMembership(array(MEMBERSHIP_ID_MODERATOR, MEMBERSHIP_ID_ADMINISTRATOR));
         foreach($aProfiles as $aProfile) {
-        	$oProfile = BxDolProfile::getInstance($aProfile['id']);
-        	if(!$oProfile)
-        		continue;
+            $oProfile = BxDolProfile::getInstance($aProfile['id']);
+            if(!$oProfile)
+                continue;
         	
         	$oAccount = $oProfile->getAccountObject();
         	if(!$oAccount || !$oAccount->isConfirmed())
@@ -67,21 +67,63 @@ class BxDolCronAccount extends BxDolCron
             return;
 
         $iAccounts = 0;
-        $sAccounts = "";
+        $aTmplVarsItems = array();
         foreach($aAccounts as $aAccount) {
-        	$oProfile = BxDolProfile::getInstance($aAccount['profile_id']);
-        	if(!$oProfile)
-        	    continue;
-
-        	$sAccounts .= _t('_sys_notification_account_link', $oProfile->getUrl(), $oProfile->getDisplayName(), $aAccount['email']);
-        	$iAccounts += 1;
+            $oProfile = BxDolProfile::getInstance($aAccount['profile_id']);
+            if(!$oProfile)
+                continue;
+
+            $sUrl = $oProfile->getUrl();
+            $bUrl = $oProfile->getModule() != 'system';
+
+            $sTitle = $oProfile->getDisplayName();
+            $sTitleAttr = bx_html_attribute($sTitle);
+
+            $sThumbUrl = $oProfile->getThumb();
+            $bThumbUrl = $oProfile->hasImage();
+
+            $aTmplVarsItems[] = array(
+                'bx_if:show_thumb_image' => array(
+                    'condition' => $bThumbUrl,
+                    'content' => array(
+                        'thumb_url' => $sThumbUrl
+                    )
+                ),
+                'bx_if:show_thumb_letter' => array(
+                    'condition' => !$bThumbUrl,
+                    'content' => array(
+                        'color' => implode(', ', BxDolTemplate::getColorCode('', 0.5)),
+                        'letter' => strtoupper(mb_substr($sTitle, 0, 1))
+                    )
+                ),
+                'bx_if:show_title_link' => array(
+                    'condition' => $bUrl,
+                    'content' => array(
+                        'content_url' => $sUrl,
+                        'content_title' => $sTitle,
+                        'content_title_attr' => $sTitleAttr
+                    )
+                ),
+                'bx_if:show_title_text' => array(
+                    'condition' => !$bUrl,
+                    'content' => array(
+                        'content_title' => $sTitle,
+                        'content_title_attr' => $sTitleAttr
+                    )
+                ),
+                'email' => $aAccount['email']
+            );
+
+            $iAccounts += 1;
         }
 
-        if(!$sAccounts)
+        if(empty($aTmplVarsItems))
             return;
 
         $this->_aParseParams['account_count'] = $iAccounts;
-        $this->_aParseParams['account_output'] = _t('_sys_notification_account', $sAccounts);
+        $this->_aParseParams['account_output'] = BxDolTemplate::getInstance()->parseHtmlByName('et_account.html', array(
+            'bx_repeat:items' => $aTmplVarsItems
+        ));
     }
 }
 

+ 9 - 0
inc/classes/BxDolProfile.php

@@ -239,6 +239,15 @@ class BxDolProfile extends BxDolFactory implements iBxDolProfile
         return BxDolService::call($aInfo['type'], 'profile_unit', array($aInfo['content_id'], $aParams));
     }
 
+	/**
+     * Check whether a profile has real image uploaded by user.
+     */
+    public function hasImage($iProfileId = 0)
+    {
+        $aInfo = $this->getInfo($iProfileId);
+        return BxDolService::call($aInfo['type'], 'has_image', array($aInfo['content_id']));
+    }
+
     /**
      * Get picture url
      */

+ 8 - 0
inc/classes/BxDolProfileUndefined.php

@@ -87,6 +87,14 @@ class BxDolProfileUndefined extends BxDolFactory implements iBxDolSingleton, iBx
         ));
     }
 
+    /**
+     * Check whether a profile has real image uploaded by user.
+     */
+    public function hasImage()
+    {
+        return false;
+    }
+
     /**
      * Get picture url
      */

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

@@ -188,6 +188,19 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolCon
         return $this->_oTemplate->unit($aContentInfo, $bCheckPrivateContent, $sTemplate);
     }
 
+    public function serviceHasImage ($iContentId)
+    {
+        $CNF = &$this->_oConfig->CNF;
+
+        $mixedContent = $this->_getContent($iContentId, 'getContentInfoById');
+        if($mixedContent === false)
+            return false;
+
+        list($iContentId, $aContentInfo) = $mixedContent;
+
+        return !empty($aContentInfo[$CNF['FIELD_PICTURE']]);
+    }
+
     public function serviceProfilePicture ($iContentId)
     {
         return $this->_serviceTemplateFunc('urlPicture', $iContentId);

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

@@ -2192,8 +2192,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_mobile_status"><![CDATA[Status]]></string>
     <string name="_sys_name"><![CDATA[Name]]></string>
     <string name="_sys_next"><![CDATA[Next]]></string>
-    <string name="_sys_notification_account"><![CDATA[<h3>Accounts created in the last 24 hours:</h3><ul>{0}</ul>]]></string>
-	<string name="_sys_notification_account_link"><![CDATA[<li><a href="{0}">{1}</a> ({2})</li>]]></string>
+    <string name="_sys_notification_account"><![CDATA[Accounts created in the last 24 hours:]]></string>
     <string name="_sys_not_specified"><![CDATA[Not Specified]]></string>
     <string name="_sys_on"><![CDATA[on]]></string>
     <string name="_sys_off"><![CDATA[off]]></string>

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

@@ -2191,8 +2191,7 @@
 	<string name="_sys_mobile_status"><![CDATA[Статус]]></string>
     <string name="_sys_name"><![CDATA[Имя]]></string>
     <string name="_sys_next"><![CDATA[Ещё]]></string>
-    <string name="_sys_notification_account"><![CDATA[<h3>Аккаунты, созданные за последние 24 часа:</h3><ul>{0}</ul>]]></string>
-    <string name="_sys_notification_account_link"><![CDATA[<li><a href="{0}">{1}</a> ({2})</li>]]></string>
+    <string name="_sys_notification_account"><![CDATA[Аккаунты, созданные за последние 24 часа:]]></string>
     <string name="_sys_not_specified"><![CDATA[Не указано]]></string>
     <string name="_sys_on"><![CDATA[вкл.]]></string>
     <string name="_sys_off"><![CDATA[выкл.]]></string>

+ 81 - 0
template/et_account.html

@@ -0,0 +1,81 @@
+<style>
+    .et-item {
+        position: relative;
+        display: inline-block;
+        width: 240px;
+    }
+    .et-item-cnt {
+        position: relative;
+        margin: 5px;
+    }
+    .et-item-img,
+    .et-item-img p,
+    .et-item-img img {
+        width: 48px;
+        height: 48px;
+        line-height: 48px;
+        border-radius: 80px;
+    }
+    .et-item-img {
+    	position: absolute;
+        top: 0px;
+        left: 0px;
+        background-clip: padding-box;
+        text-align: center;
+        overflow: hidden;
+    }
+	.et-item-img p {
+	    display: block;
+        box-sizing: border-box;
+	    margin: 0px;
+        border: 1px solid #ccc;
+	    line-height: 46px;
+	    line-height: 2.9rem;
+	    font-size: 20px;
+	    font-size: 1.2rem;
+	    font-weight: 700;
+	    color: #d0d0d0;
+	}
+    .et-item-info {
+    	position: relative;
+        min-height: 48px;
+        margin-left: 58px;
+    }
+    .et-item-info-cnt {
+        padding: 5px 0px;
+        white-space: nowrap;
+        text-overflow: ellipsis;
+        overflow: hidden;
+    }
+    .et-item-info-cnt a {
+	   font-weight: bold;
+    }
+</style>
+<h3><bx_text:_sys_notification_account /></h3>
+<div>
+    <bx_repeat:items>
+        <div class="et-item">
+            <div class="et-item-cnt">
+			    <div class="et-item-img">
+		            <bx_if:show_thumb_image>
+		                <img src="__thumb_url__" />
+		            </bx_if:show_thumb_image>
+		            <bx_if:show_thumb_letter>
+		                <p style="background-color:rgba(__color__)">__letter__</p>
+		            </bx_if:show_thumb_letter>
+			    </div>
+			    <div class="et-item-info">
+			        <div class="et-item-info-cnt">
+	                    <bx_if:show_title_link>
+	                        <a href="__content_url__" title="__content_title_attr__">__content_title__</a>
+			            </bx_if:show_title_link>
+			            <bx_if:show_title_text>
+	                        <b title="__content_title_attr__">__content_title__</b>
+			            </bx_if:show_title_text>
+	                    <br />__email__
+			        </div>
+			    </div>
+            </div>
+		</div>
+    </bx_repeat:items>
+</div>

+ 5 - 0
template/scripts/BxBaseServices.php

@@ -22,6 +22,11 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
         return $this->_serviceProfileFunc('getUnit', $iContentId);
     }
 
+    public function serviceHasImage ($iContentId)
+    {
+        return false;
+    }
+
     public function serviceProfilePicture ($iContentId)
     {
         return $this->_serviceProfileFunc('getPicture', $iContentId);