Quellcode durchsuchen

Ticket #2036 - Done for Text and Profile based modules.

AntonLV vor 7 Jahren
Ursprung
Commit
f8cf8c6925

+ 17 - 5
inc/classes/BxDolProfileUndefined.php

@@ -79,11 +79,23 @@ class BxDolProfileUndefined extends BxDolFactory implements iBxDolSingleton, iBx
      */
      */
     public function getUnit($iProfileId = 0, $aParams = array())
     public function getUnit($iProfileId = 0, $aParams = array())
     {
     {
-        $sTemplate = 'profile_' . (!empty($aParams['template']) ? $aParams['template'] : 'unit') . '.html';
-
-		return BxDolTemplate::getInstance()->parseHtmlByName($sTemplate, array(
-        	'thumb_url' => $this->getThumb(),
-        	'title' => $this->getDisplayName()
+        $sTemplate = 'profile_unit.html';
+        $aTemplateVars = array();
+        if(!empty($aParams['template'])) {
+            if(is_string($aParams['template']))
+                $sTemplate = 'profile_' . $aParams['template'] . '.html';
+            else if(is_array($aParams['template'])) {
+                if(!empty($aParams['template']['name']))
+                    $sTemplate = 'profile_' . $aParams['template']['name'] . '.html';
+
+                if(!empty($aParams['template']['vars']))
+                    $aTemplateVars = $aParams['template']['vars'];
+            }
+        }
+
+        return BxDolTemplate::getInstance()->parseHtmlByName($sTemplate, array(
+            'thumb_url' => $this->getThumb(),
+            'title' => $this->getDisplayName()
         ));
         ));
     }
     }
 
 

+ 9 - 1
modules/base/groups/classes/BxBaseModGroupsGridAdministration.php

@@ -18,7 +18,15 @@ class BxBaseModGroupsGridAdministration extends BxBaseModProfileGridAdministrati
 
 
     protected function _getCellName($mixedValue, $sKey, $aField, $aRow)
     protected function _getCellName($mixedValue, $sKey, $aField, $aRow)
     {
     {
-        return $this->_getCellFullname($mixedValue, $sKey, $aField, $aRow);
+    	$oProfile = $this->_getProfileObject($aRow['id']);
+
+        $mixedValue = $this->_oTemplate->parseHtmlByName('name_link.html', array(
+            'href' => $oProfile->getUrl(),
+            'title' => $mixedValue,
+            'content' => $mixedValue
+        ));
+
+        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
     }
     }
 }
 }
 
 

+ 1 - 7
modules/base/profile/classes/BxBaseModProfileGridAdministration.php

@@ -144,13 +144,7 @@ class BxBaseModProfileGridAdministration extends BxBaseModGeneralGridAdministrat
     {
     {
     	$oProfile = $this->_getProfileObject($aRow['id']);
     	$oProfile = $this->_getProfileObject($aRow['id']);
 
 
-        $mixedValue = $this->_oTemplate->parseHtmlByName('name_link.html', array(
-            'href' => $oProfile->getUrl(),
-            'title' => $mixedValue,
-            'content' => $mixedValue
-        ));
-
-        return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
+        return parent::_getCellDefault($oProfile->getUnit(), $sKey, $aField, $aRow);
     }
     }
 
 
     protected function _getCellLastOnline($mixedValue, $sKey, $aField, $aRow)
     protected function _getCellLastOnline($mixedValue, $sKey, $aField, $aRow)

+ 1 - 1
modules/base/profile/template/account_link.html

@@ -1 +1 @@
-<a href="__href__" title="__title__" target="_blank">__content__</a>
+<bx_include_base:../../../../template/account_link.html />

+ 13 - 16
modules/base/text/classes/BxBaseModTextGridAdministration.php

@@ -87,28 +87,25 @@ class BxBaseModTextGridAdministration extends BxBaseModGeneralGridAdministration
     	$oProfile = $this->_getProfileObject($aRow['author']);
     	$oProfile = $this->_getProfileObject($aRow['author']);
     	$sProfile = $oProfile->getDisplayName();
     	$sProfile = $oProfile->getDisplayName();
 
 
-		$oAcl = BxDolAcl::getInstance();
+        $oAcl = BxDolAcl::getInstance();
 
 
     	$sAccountEmail = '';
     	$sAccountEmail = '';
     	$sManageAccountUrl = '';
     	$sManageAccountUrl = '';
     	if($oProfile && $oProfile instanceof BxDolProfile && $oAcl->isMemberLevelInSet(128)) {
     	if($oProfile && $oProfile instanceof BxDolProfile && $oAcl->isMemberLevelInSet(128)) {
-    		$sAccountEmail = $oProfile->getAccountObject()->getEmail();
-	    	$sManageAccountUrl = $this->_getManageAccountUrl($sAccountEmail);
+            $sAccountEmail = $oProfile->getAccountObject()->getEmail();
+            $sManageAccountUrl = $this->_getManageAccountUrl($sAccountEmail);
     	}
     	}
 
 
-        $mixedValue = $this->_oTemplate->parseHtmlByName('author_link.html', array(
-            'href' => $oProfile->getUrl(),
-            'title' => $sProfile,
-            'content' => $sProfile,
-        	'bx_if:show_account' => array(
-        		'condition' => !empty($sManageAccountUrl), 
-        		'content' => array(
-        			'href' => $sManageAccountUrl,
-		        	'title' => _t($this->_oModule->_oConfig->CNF['T']['grid_txt_account_manager']),
-		        	'content' => $sAccountEmail
-        		)
-        	)
-        ));
+        $sAddon = '';
+        if(!empty($sManageAccountUrl))
+            $sAddon = $this->_oTemplate->parseHtmlByName('account_link.html', array(
+                'href' => $sManageAccountUrl,
+                'title' => _t($this->_oModule->_oConfig->CNF['T']['grid_txt_account_manager']),
+                'content' => $sAccountEmail,
+                'class' => 'bx-def-font-grayed'
+            ));
+
+        $mixedValue = $oProfile->getUnit(0, array('template' => array('vars' => array('addon' => $sAddon))));
 
 
         return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
         return parent::_getCellDefault($mixedValue, $sKey, $aField, $aRow);
     }
     }

+ 1 - 0
modules/base/text/template/account_link.html

@@ -0,0 +1 @@
+<bx_include_base:../../../../template/account_link.html />

+ 1 - 0
template/account_link.html

@@ -0,0 +1 @@
+<a href="__href__" title="__title__" target="_blank" class="__class__">__content__</a>