common.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. Basic Concept
  2. Modules
  3. The basic unit is the module (class BxDolModule)
  4. Creating a module object: $oModule = BxDolModule::getInstance($sModuleName);
  5. Modules can inherit interfaces: profile, context, content; one module can inherit several interfaces:
  6. • To check whether a module inherits profile: bx_srv('system', 'is_module_profile', $sModuleName)
  7. • To check whether a module inherits context: bx_srv('system', 'is_module_ context', $sModuleName)
  8. • To check whether a module inherits content: bx_srv('system', 'is_module_content', $sModuleName)
  9. Example class declaration BxPostsModule extends BxBaseModTextModule
  10. There are several basic modules, you cannot make objects from them, they contain common functions for all objects that inherit them:
  11. • class BxBaseModGeneralModule extends BxDolModule
  12. • class BxBaseModGroupsModule extends BxBaseModProfileModule
  13. • class BxBaseModNotificationsModule extends BxBaseModGeneralModule
  14. • class BxBaseModProfileModule extends BxBaseModGeneralModule implements
  15. • iBxDolContentInfoService, iBxDolProfileService
  16. • class BxBaseModTextModule extends BxBaseModGeneralModule implements iBxDolContentInfoService
  17. Available modules
  18. • bx_timeline
  19. • bx_spaces
  20. • bx_posts
  21. • bx_polls
  22. • bx_photos
  23. • bx_persons
  24. • bx_notifications
  25. • bx_messenger
  26. • bx_invites
  27. • bx_groups
  28. • bx_files
  29. • bx_events
  30. • bx_channels
  31. available fields for bx_persons module :
  32. - id
  33. - fullname
  34. - last_name
  35. - gender
  36. - birthday (date)
  37. - added(timestamp)
  38. available fields for bx_organisations module:
  39. - id
  40. - org_name
  41. - added(timestamp)
  42. BxBaseModGeneralModule functions
  43. BxBaseModProfileModule functions
  44. • serviceGetContentInfoByProfileId($iProfileId) – return array with all object fields, example for post
  45. [‘title’ =>, ‘created’ => ‘text’ => ]
  46. Accounts/Profiles
  47. The basic unit of the system user is the account: class BxDolAccount
  48. Creating an account object: $oAccount = BxDolAccount::getInstance($iAccountId);
  49. Methods of the BxDolAccount class object
  50. • getInfo($iAccountId=false)
  51. return array with account info :
  52. - id,
  53. - name
  54. - email -
  55. - email_confirmed (bool)
  56. - added (timestamp)
  57. • id()
  58. • isConfirmed($iAccountId=false)
  59. • updateEmailConfirmed($isConfirmed,$isAutoSendConfrmationEmail=true,$iAccountId=false)
  60. • updatePhoneConfirmed($isConfirmed,$iAccountId=false)
  61. • updatePassword($sPassword,$iAccountId=false)
  62. • updatePhone($sPhone,$iAccountId=false)
  63. • updateProfileContextAuto($iProfileIdFilterOut=false,$iAccountId=false)
  64. • sendConfirmationEmail($iAccountId=false)
  65. • getDisplayName($iAccountId=false)
  66. • getUrl($iAccountId=false)
  67. • getUnit($iAccountId=false,$aParams=array())
  68. • getPicture($iAccountId=false)
  69. • getAvatarBig($iAccountId=false)
  70. • getAvatar($iAccountId=false)
  71. • getThumb($iAccountId=false)
  72. • getIcon($iAccountId=false)
  73. • getEmail($iAccountId=false)
  74. • getLanguageId($iAccountId=false)
  75. • isOnline($iAccountId=false)
  76. • isProfilesLimitReached()
  77. • getProfilesNumber($isFilterNonSwitchableProfiles=true)
  78. • getProfilesIds($isFilterNonSwitchableProfiles=true,$isFilterSystemProfiles=true)
  79. • getProfiles($isFilterNonSwitchableProfiles=true,$isFilterSystemProfiles=true)
  80. • delete($bDeleteWithContent=false)
  81. • addInformerPermanentMessages($oInformer)
  82. • getUnsubscribeLink($iEmailType,$iAccountId=false)
  83. 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).
  84. Creating a profile object: $oProfile = BxDolProfile::getInstance($iProfileId);
  85. Get the current $iProfileId for a user: bx_get_logged_profile_id()
  86. Methods of the BxDolProfile class object
  87. • getInfo ($iProfileId=0)
  88. return array with profile info :
  89. - id,
  90. - account_id
  91. - type - content module name for profile
  92. - content_id – id from content module
  93. - status, can be active/suspended, pending
  94. • id()
  95. • getAccountId ($iProfileId=false)
  96. • getAccountObject ($iProfileId=false)
  97. • getContentId()
  98. • isActive ($iProfileId=false)
  99. • isOnline ($iProfileId=false)
  100. • isActAsProfile ($iProfileId=false)
  101. • getStatus ($iProfileId=false)
  102. • getModule ($iProfileId=false)
  103. • getDisplayName ($iProfileId=0)
  104. • getUrl ($iProfileId=0)
  105. • getUnit ($iProfileId=0, $aParams=array())
  106. • getUnitAPI ($iProfileId=0, $aParams=array())
  107. • getBadges ($iProfileId=0)
  108. • hasImage ($iProfileId=0)
  109. • getPicture ($iProfileId=0)
  110. • getAvatar ($iProfileId=0)
  111. • getAvatarBig ($iProfileId=0)
  112. • getCover ($iProfileId=0)
  113. • getUnitCover ($iProfileId=0)
  114. • getThumb ($iProfileId=0)
  115. • getIcon ($iProfileId=0)
  116. • getIconModule ($iProfileId=0)
  117. • getEditUrl ($iProfileId=0)
  118. • checkAllowedProfileView ($iProfileId=0)
  119. • checkAllowedProfileContact ($iProfileId=0)
  120. • checkAllowedPostInProfile ($iProfileId=0, $sPostModule='')
  121. • delete ($ID=false, $bDeleteWithContent=false, $bForceDelete=false)
  122. • activate ($iAction, $iProfileId=0, $bSendEmailNotification=true)
  123. • approve ($iAction, $iProfileId=0, $bSendEmailNotification=true)
  124. • disapprove ($iAction, $iProfileId=0, $bSendEmailNotification=true)
  125. • move ($iAccountId, $iProfileId=0)
  126. • suspend ($iAction, $iProfileId=0, $bSendEmailNotification=true)
  127. • checkSwitchToProfile ($oTemplate=null, $iViewerAccountId=false, $iViewerProfileId=false)
  128. • addInformerPermanentMessages ($oInformer)
  129. System functions
  130. /**
  131. * Send email function
  132. ** @param $mRecipientEmails - Email where email should be send, can be array, string with one email or comma separated
  133. * @param $sMailSubject - subject of the message
  134. * @param $sMailBody - Body of the message
  135. * @param $iRecipientID - ID of recipient profile
  136. * @param $aPlus - Array of additional information
  137. * @param $iEmailType - email message type: BX_EMAIL_SYSTEM, BX_EMAIL_NOTIFY or BX_EMAIL_MASS
  138. * @param $sEmailFlag - use 'html' for HTML email message
  139. * @param $isDisableAlert - disable alert
  140. * @param $aCustomHeaders - custom email headers
  141. * @param $bAddToQueue - add message to email queue
  142. * @return true if message was send or false otherwise
  143. */
  144. function sendMail($mRecipientEmails, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $iEmailType = BX_EMAIL_NOTIFY, $sEmailFlag = 'html', $isDisableAlert = false, $aCustomHeaders = array(), $bAddToQueue = false)