Преглед изворни кода

Ticket #255 - Clean up: Create a profile.

AntonLV пре 10 година
родитељ
комит
97273a344b

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

@@ -160,6 +160,15 @@ class BxBaseModProfileModule extends BxBaseModGeneralModule implements iBxDolPro
         return $aContentInfo[$this->_oConfig->CNF['FIELD_NAME']];
     }
 
+    public function serviceProfileCreateUrl ($bAbsolute = true)
+    {
+    	$CNF = $this->_oConfig->CNF;
+    	if(empty($CNF['URL_CREATE']))
+    		return false;
+
+    	return $bAbsolute ? BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($CNF['URL_CREATE']) : $CNF['URL_CREATE'];
+    }
+
     public function serviceProfileUrl ($iContentId)
     {
         if (!$iContentId)

+ 1 - 0
modules/boonex/organizations/classes/BxOrgsConfig.php

@@ -58,6 +58,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
         	'URI_MANAGE_COMMON' => 'organizations-manage',
 
             'URL_HOME' => 'page.php?i=organizations-home',
+        	'URL_CREATE' => 'page.php?i=create-organization-profile',
         	'URL_MANAGE_COMMON' => 'page.php?i=organizations-manage',
         	'URL_MANAGE_ADMINISTRATION' => 'page.php?i=organizations-administration',
 

+ 1 - 0
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -58,6 +58,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
         	'URI_MANAGE_COMMON' => 'persons-manage',
 
             'URL_HOME' => 'page.php?i=persons-home',
+        	'URL_CREATE' => 'page.php?i=create-persons-profile',
         	'URL_MANAGE_COMMON' => 'page.php?i=persons-manage',
         	'URL_MANAGE_ADMINISTRATION' => 'page.php?i=persons-administration',
 

+ 14 - 2
template/scripts/BxBaseAccountForms.php

@@ -82,8 +82,20 @@ class BxBaseAccountForms extends BxDolProfileForms
 
         $this->_iProfileId = bx_get_logged_profile_id();
 
-        // redirect
-        $this->_redirectAndExit(getParam('sys_redirect_after_account_added'), true, array(
+        // check and redirect
+        $aModulesProfile = array(); 
+        $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1));
+        foreach($aModules as $aModule) {
+        	$oModule = BxDolModule::getInstance($aModule['name']);
+        	if($oModule instanceof iBxDolProfileService && BxDolService::call($aModule['name'], 'act_as_profile') === true)
+        		$aModulesProfile[] = $aModule;
+        }
+
+        $sRedirectUrl = '';
+        if(count($aModulesProfile) == 1)
+        	$sRedirectUrl = BxDolService::call($aModulesProfile[0]['name'], 'profile_create_url', array(false));
+
+        $this->_redirectAndExit(!empty($sRedirectUrl) ? $sRedirectUrl : getParam('sys_redirect_after_account_added'), true, array(
             'account_id' => $iAccountId,
             'profile_id' => $iProfileId,
         ));

+ 3 - 3
template/scripts/BxBasePageAccount.php

@@ -72,11 +72,11 @@ class BxBasePageAccount extends BxTemplPage
 
     }
 
-    public function getCode()
+	protected function _addJsCss()
     {
-		BxDolTemplate::getInstance()->addCss('account.css');
+    	parent::_addJsCss();
 
-    	return parent::getCode();
+        $this->_oTemplate->addCss('account.css');
     }
 
     protected function _getPageCacheParams ()