Explorar o código

#4926 Accounts: SSO column

Alex Trofimov hai 1 ano
pai
achega
9f67999de5

+ 16 - 1
modules/boonex/accounts/classes/BxAccntTemplate.php

@@ -11,10 +11,14 @@
 
 class BxAccntTemplate extends BxBaseModGeneralTemplate
 {
+    protected $aAuthTypes = [];
+
     function __construct(&$oConfig, &$oDb)
     {
     	$this->MODULE = 'bx_accounts';
         parent::__construct($oConfig, $oDb);
+
+        $this->aAuthTypes = BxDolDb::getInstance()->fromCache('sys_objects_auths', 'getAll', 'SELECT * FROM `sys_objects_auths`');
     }
 
     public function getProfilesByAccount($aContentInfo, $iMaxVisible = 2, $iMaxInPopup = 20)
@@ -54,12 +58,23 @@ class BxAccntTemplate extends BxBaseModGeneralTemplate
 
             $iId = $oProfile->id();
             $sName = $oProfile->getDisplayName();
+
+            $sAuthAccountsIcons = '';
+            foreach ($this->aAuthTypes as $r) {
+                $oModule = BxDolModule::getInstance($r['Name']);
+                if (!$oModule)
+                    continue;
+                if ($oModule->_oDb->getRemoteProfileId($iId))
+                    $sAuthAccountsIcons .= '<i title="' . bx_html_attribute(_t($r['Title'])) . '" class="sys-icon ' . ($r['Icon'] ? $r['Icon'] : 'circle-user') . '"></i> ';
+            }
+
             $aTmplVarsProfile = [
                 'html_id' => $this->_oConfig->getHtmlIds('profile') . $iId,
                 'id' => $iId,
                 'url' => $oProfile->getUrl(),
                 'name' => strmaxtextlen($sName, $CNF['PARAM_PROFILE_NAME_LENGTH_MAX'], '...'),
-                'name_attr' => bx_html_attribute($sName)
+                'name_attr' => bx_html_attribute($sName),
+                'auth_accounts_icons' => $sAuthAccountsIcons,
             ];
 
             if($i < $iMaxVisible)

+ 2 - 2
modules/boonex/accounts/template/profiles.html

@@ -2,7 +2,7 @@
 	<div class="bx-accnt-profiles-cnt__class_cnt__">
 	    <bx_repeat:profiles>
 	        <div id="__html_id____id__" class="bx-accnt-profile">
-	            <a href="__url__" target="_blank" title="__name_attr__">__name__</a>
+	            <a href="__url__" target="_blank" title="__name_attr__">__name__</a> __auth_accounts_icons__
 	        </div>
 	    </bx_repeat:profiles>
 	   
@@ -13,4 +13,4 @@
 	        <div id="__html_id__" style="display:none;">__popup__</div>
 	    </bx_if:profiles_more>
 	</div>
-</div>
+</div>

+ 2 - 2
modules/boonex/accounts/template/profiles_more.html

@@ -1,7 +1,7 @@
 <div class="bx-accnt-profiles-popup">
     <div class="bx-accnt-profiles-popup-cnt bx-def-padding">
         <bx_repeat:profiles>
-            <a href="__url__" target="_blank" title="__name_attr__">__name__</a><span>,</span>
+            <a href="__url__" target="_blank" title="__name_attr__">__name__</a> __auth_accounts_icons__<span>,</span>
         </bx_repeat:profiles>
     </div>
-</div>
+</div>