|
|
@@ -9,6 +9,8 @@
|
|
|
* @{
|
|
|
*/
|
|
|
define('BX_ATTENDANT_ON_PROFILE_CREATION_METHOD', 'browse_recommended');
|
|
|
+define('BX_ATTENDANT_ON_PROFILE_CREATION_EVENT_AFTER_REGISTRATION', 'registration');
|
|
|
+define('BX_ATTENDANT_ON_PROFILE_CREATION_EVENT_AFTER_CONFIRMATION', 'confirmation');
|
|
|
|
|
|
class BxAttendantModule extends BxDolModule
|
|
|
{
|
|
|
@@ -51,6 +53,34 @@ class BxAttendantModule extends BxDolModule
|
|
|
return $aResult;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @page service Service Calls
|
|
|
+ * @section bx_attendant Attendant
|
|
|
+ * @subsection bx_attendant-other Other
|
|
|
+ * @subsubsection bx_attendant-on-profile get_popup_with_recommended_on_event_show
|
|
|
+ *
|
|
|
+ * @code bx_srv('bx_attendant', 'get_popup_with_recommended_on_event_show', [...]); @endcode
|
|
|
+ *
|
|
|
+ * Get list of events for on_profile_creation show
|
|
|
+ *
|
|
|
+ * @return an array with avaliable events.
|
|
|
+ *
|
|
|
+ * @see BxAttendantModule::serviceGetPopupWithRecommendedOnEventShow
|
|
|
+ */
|
|
|
+ /**
|
|
|
+ * @ref bx_attendant-get_popup_with_recommended_on_event_show "get_popup_with_recommended_on_event_show"
|
|
|
+ */
|
|
|
+ public function serviceGetPopupWithRecommendedOnEventShow()
|
|
|
+ {
|
|
|
+ $aResult = array();
|
|
|
+ $aChoices = array(BX_ATTENDANT_ON_PROFILE_CREATION_EVENT_AFTER_CONFIRMATION, BX_ATTENDANT_ON_PROFILE_CREATION_EVENT_AFTER_REGISTRATION);
|
|
|
+ foreach($aChoices as $sChoice)
|
|
|
+ $aResult[$sChoice] = _t('_bx_attendant_popup_event_after_' . $sChoice);
|
|
|
+
|
|
|
+ return $aResult;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @page service Service Calls
|
|
|
* @section bx_attendant Attendant
|
|
|
@@ -75,8 +105,11 @@ class BxAttendantModule extends BxDolModule
|
|
|
$sRv = '';
|
|
|
$aEvents = $this->_oDb->getEvents(array('type' => 'active_by_action_and_object_id', 'action' => 'view', 'object_id' => bx_get_logged_profile_id()));
|
|
|
foreach($aEvents as $aEvent){
|
|
|
- $sRv .= call_user_func_array(array($this, $aEvent['method']), array($aEvent['object_id']));
|
|
|
- //$this->_oDb->setEventProcessed($aEvent['id']);
|
|
|
+ $oRv = call_user_func_array(array($this, $aEvent['method']), array($aEvent['object_id']));
|
|
|
+ if ($oRv !== false){
|
|
|
+ $sRv .= $oRv;
|
|
|
+ $this->_oDb->setEventProcessed($aEvent['id']);
|
|
|
+ }
|
|
|
}
|
|
|
return $sRv;
|
|
|
}
|
|
|
@@ -99,17 +132,29 @@ class BxAttendantModule extends BxDolModule
|
|
|
public function processPopupWithRecommendedOnProfileAdd($iProfileId)
|
|
|
{
|
|
|
$sRv = '';
|
|
|
- $aModules = explode(',', getParam('bx_attendant_on_profile_creation_modules'));
|
|
|
- $aModulteData = array();
|
|
|
- foreach($aModules as $sModuleName){
|
|
|
- if(BxDolRequest::serviceExists($sModuleName, BX_ATTENDANT_ON_PROFILE_CREATION_METHOD)){
|
|
|
- $aTmp = BxDolService::call($sModuleName, BX_ATTENDANT_ON_PROFILE_CREATION_METHOD, array('unit_view' => 'showcase', 'empty_message' => false, "ajax_paginate" => false));
|
|
|
- if (isset($aTmp['content']))
|
|
|
- $aModulteData[$sModuleName] = $aTmp['content'];
|
|
|
+ $sEvent = getParam('bx_attendant_on_profile_event_list');
|
|
|
+ $oProfile = BxDolProfile::getInstance($iProfileId);
|
|
|
+ $oAccount = $oProfile ? $oProfile->getAccountObject() : null;
|
|
|
+ if ($sEvent == BX_ATTENDANT_ON_PROFILE_CREATION_EVENT_AFTER_REGISTRATION || ($sEvent == BX_ATTENDANT_ON_PROFILE_CREATION_EVENT_AFTER_CONFIRMATION && $oAccount != null && $oAccount->isConfirmed())){
|
|
|
+ $aModules = explode(',', getParam('bx_attendant_on_profile_creation_modules'));
|
|
|
+ $aModulteData = array();
|
|
|
+ foreach($aModules as $sModuleName){
|
|
|
+ if(BxDolRequest::serviceExists($sModuleName, BX_ATTENDANT_ON_PROFILE_CREATION_METHOD)){
|
|
|
+ $aTmp = BxDolService::call($sModuleName, BX_ATTENDANT_ON_PROFILE_CREATION_METHOD, array('unit_view' => 'showcase', 'empty_message' => false, "ajax_paginate" => false));
|
|
|
+ if (isset($aTmp['content'])){
|
|
|
+ $sTmp = $aTmp['content'];
|
|
|
+ $sTmp = str_replace("bx_conn_action", 'bx_attendant_conn_action', $sTmp);
|
|
|
+ $aModulteData[$sModuleName] = $sTmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ if (count($aModulteData) > 0)
|
|
|
+ $sRv = $this->_oTemplate->popupWithRecommendedOnProfileAdd($aModulteData);
|
|
|
+ return $sRv;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ return false;
|
|
|
}
|
|
|
- $sRv = $this->_oTemplate->popupWithRecommendedOnProfileAdd($aModulteData);
|
|
|
- return $sRv;
|
|
|
}
|
|
|
}
|
|
|
|