Basic Concept Modules The basic unit is the module (class BxDolModule) Creating a module object: $oModule = BxDolModule::getInstance($sModuleName); Modules can inherit interfaces: profile, context, content; one module can inherit several interfaces: • To check whether a module inherits profile: bx_srv('system', 'is_module_profile', $sModuleName) • To check whether a module inherits context: bx_srv('system', 'is_module_ context', $sModuleName) • To check whether a module inherits content: bx_srv('system', 'is_module_content', $sModuleName) Example class declaration BxPostsModule extends BxBaseModTextModule There are several basic modules, you cannot make objects from them, they contain common functions for all objects that inherit them: • class BxBaseModGeneralModule extends BxDolModule • class BxBaseModGroupsModule extends BxBaseModProfileModule • class BxBaseModNotificationsModule extends BxBaseModGeneralModule • class BxBaseModProfileModule extends BxBaseModGeneralModule implements • iBxDolContentInfoService, iBxDolProfileService • class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolContentInfoService Available modules • bx_timeline • bx_spaces • bx_posts • bx_polls • bx_photos • bx_persons • bx_notifications • bx_messenger • bx_invites • bx_groups • bx_files • bx_events • bx_channels available fields for bx_persons module : - id - fullname - last_name - gender - birthday (date) - added(timestamp) available fields for bx_organisations module: - id - org_name - added(timestamp) BxBaseModGeneralModule functions BxBaseModProfileModule functions • serviceGetContentInfoByProfileId($iProfileId) – return array with all object fields, example for post [‘title’ =>, ‘created’ => ‘text’ => ] Accounts/Profiles The basic unit of the system user is the account: class BxDolAccount Creating an account object: $oAccount = BxDolAccount::getInstance($iAccountId); Methods of the BxDolAccount class object • getInfo($iAccountId=false) return array with account info : - id, - name - email - - email_confirmed (bool) - added (timestamp) • id() • isConfirmed($iAccountId=false) • updateEmailConfirmed($isConfirmed,$isAutoSendConfrmationEmail=true,$iAccountId=false) • updatePhoneConfirmed($isConfirmed,$iAccountId=false) • updatePassword($sPassword,$iAccountId=false) • updatePhone($sPhone,$iAccountId=false) • updateProfileContextAuto($iProfileIdFilterOut=false,$iAccountId=false) • sendConfirmationEmail($iAccountId=false) • getDisplayName($iAccountId=false) • getUrl($iAccountId=false) • getUnit($iAccountId=false,$aParams=array()) • getPicture($iAccountId=false) • getAvatarBig($iAccountId=false) • getAvatar($iAccountId=false) • getThumb($iAccountId=false) • getIcon($iAccountId=false) • getEmail($iAccountId=false) • getLanguageId($iAccountId=false) • isOnline($iAccountId=false) • isProfilesLimitReached() • getProfilesNumber($isFilterNonSwitchableProfiles=true) • getProfilesIds($isFilterNonSwitchableProfiles=true,$isFilterSystemProfiles=true) • getProfiles($isFilterNonSwitchableProfiles=true,$isFilterSystemProfiles=true) • delete($bDeleteWithContent=false) • addInformerPermanentMessages($oInformer) • getUnsubscribeLink($iEmailType,$iAccountId=false) One account can have many profiles (class BxDolProfile) of different types, for example, one person profile (bx_persons module) and one organization profile (bx_organisations module). Creating a profile object: $oProfile = BxDolProfile::getInstance($iProfileId); Get the current $iProfileId for a user: bx_get_logged_profile_id() Methods of the BxDolProfile class object • getInfo ($iProfileId=0) return array with profile info : - id, - account_id - type - content module name for profile - content_id – id from content module - status, can be active/suspended, pending • id() • getAccountId ($iProfileId=false) • getAccountObject ($iProfileId=false) • getContentId() • isActive ($iProfileId=false) • isOnline ($iProfileId=false) • isActAsProfile ($iProfileId=false) • getStatus ($iProfileId=false) • getModule ($iProfileId=false) • getDisplayName ($iProfileId=0) • getUrl ($iProfileId=0) • getUnit ($iProfileId=0, $aParams=array()) • getUnitAPI ($iProfileId=0, $aParams=array()) • getBadges ($iProfileId=0) • hasImage ($iProfileId=0) • getPicture ($iProfileId=0) • getAvatar ($iProfileId=0) • getAvatarBig ($iProfileId=0) • getCover ($iProfileId=0) • getUnitCover ($iProfileId=0) • getThumb ($iProfileId=0) • getIcon ($iProfileId=0) • getIconModule ($iProfileId=0) • getEditUrl ($iProfileId=0) • checkAllowedProfileView ($iProfileId=0) • checkAllowedProfileContact ($iProfileId=0) • checkAllowedPostInProfile ($iProfileId=0, $sPostModule='') • delete ($ID=false, $bDeleteWithContent=false, $bForceDelete=false) • activate ($iAction, $iProfileId=0, $bSendEmailNotification=true) • approve ($iAction, $iProfileId=0, $bSendEmailNotification=true) • disapprove ($iAction, $iProfileId=0, $bSendEmailNotification=true) • move ($iAccountId, $iProfileId=0) • suspend ($iAction, $iProfileId=0, $bSendEmailNotification=true) • checkSwitchToProfile ($oTemplate=null, $iViewerAccountId=false, $iViewerProfileId=false) • addInformerPermanentMessages ($oInformer) System functions /** * Send email function ** @param $mRecipientEmails - Email where email should be send, can be array, string with one email or comma separated * @param $sMailSubject - subject of the message * @param $sMailBody - Body of the message * @param $iRecipientID - ID of recipient profile * @param $aPlus - Array of additional information * @param $iEmailType - email message type: BX_EMAIL_SYSTEM, BX_EMAIL_NOTIFY or BX_EMAIL_MASS * @param $sEmailFlag - use 'html' for HTML email message * @param $isDisableAlert - disable alert * @param $aCustomHeaders - custom email headers * @param $bAddToQueue - add message to email queue * @return true if message was send or false otherwise */ function sendMail($mRecipientEmails, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $iEmailType = BX_EMAIL_NOTIFY, $sEmailFlag = 'html', $isDisableAlert = false, $aCustomHeaders = array(), $bAddToQueue = false)