BxCnlModule.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defdroup Channels Channels
  7. * @indroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Channels profiles module.
  13. */
  14. class BxCnlModule extends BxBaseModGroupsModule
  15. {
  16. function __construct(&$aModule)
  17. {
  18. parent::__construct($aModule);
  19. }
  20. public function _modGroupsCheckAllowedSubscribeAdd(&$aDataEntry, $isPerformAction = false)
  21. {
  22. return parent::_modProfileCheckAllowedSubscribeAdd($aDataEntry, $isPerformAction);
  23. }
  24. /**
  25. * Process Hash Tag
  26. *
  27. * @param string $sHashtag - hashtag to be processed.
  28. * @param string $sModuleName - module name.
  29. * @param integer $iContentId - ID of the content which has the hashtag.
  30. * @param integer $iSenderId - action's sender (author) id.
  31. */
  32. function processHashtag($sHashtag, $sModuleName, $iContentId, $iSenderId = 0)
  33. {
  34. $CNF = &$this->_oConfig->CNF;
  35. /*
  36. * Note! For now metatag object name is used here as module name, because usually it's equal to module's name. This should be changed in Ticket #1596
  37. * For now if module cannot be created then a channel for such tag shouldn't be created too.
  38. */
  39. $oModule = BxDolModule::getInstance($sModuleName);
  40. if(empty($oModule) && $sModuleName != 'sys_cmts')
  41. return;
  42. /*
  43. * Ticket #4640
  44. *
  45. * Before:
  46. * Use content's author profile when Author ID wasn't provided.
  47. * Usually it happens when tags were processed with cron.
  48. *
  49. * After:
  50. * Use content's author profile every time when it's possible. Otherwise use sender from alert.
  51. */
  52. $iAuthorId = 0;
  53. if(($sModuleMethod = 'get_author') && bx_is_srv($sModuleName, $sModuleMethod))
  54. $iAuthorId = abs(bx_srv($sModuleName, $sModuleMethod, [$iContentId]));
  55. if(empty($iAuthorId) && !empty($iSenderId))
  56. $iAuthorId = $iSenderId;
  57. $aCheck = checkActionModule($iAuthorId, 'create channel auto', $this->getName(), false);
  58. $mixedCnlId = $this->_oDb->getChannelIdByName($sHashtag);
  59. if(empty($mixedCnlId) && ($aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED)) {
  60. $iProfileId = (int)$this->_oDb->getParam($CNF['PARAM_DEFAULT_AUTHOR']);
  61. if(empty($iProfileId)) {
  62. $aOperators = BxDolAccountQuery::getInstance()->getOperators();
  63. if(count($aOperators) > 0)
  64. $iProfileId = BxDolProfile::getInstanceByAccount(array_shift($aOperators))->id();
  65. }
  66. $aContent = $this->serviceEntityAdd($iProfileId, array($CNF['FIELD_NAME'] => $sHashtag, $CNF['FIELD_CF'] => 1));
  67. checkActionModule($iAuthorId, 'create channel auto', $this->getName(), true);
  68. if(isset($aContent['content']) && isset($aContent['content']['id']))
  69. $mixedCnlId = $aContent['content']['id'];
  70. }
  71. if(empty($mixedCnlId) || (int)$this->_oDb->checkContentInChannel($iContentId, $mixedCnlId, $sModuleName, $iAuthorId) != 0)
  72. return;
  73. $iId = (int)$this->_oDb->addContentToChannel($iContentId, $mixedCnlId, $sModuleName, $iAuthorId);
  74. if($iId == 0)
  75. return;
  76. $oCnlProfile = BxDolProfile::getInstanceByContentAndType($mixedCnlId, $this->_oConfig->getName());
  77. if(!$oCnlProfile)
  78. return;
  79. $iCnlProfileId = $oCnlProfile->id();
  80. bx_alert($this->_aModule['name'], 'hashtag_added', $iId, $iCnlProfileId, array(
  81. 'object_author_id' => $iAuthorId,
  82. 'privacy_view' => -$iCnlProfileId,
  83. 'subobject_id' => $iId,
  84. 'content_module' => $sModuleName,
  85. 'content_id' => $iContentId,
  86. 'content_author_id' => $iAuthorId,
  87. 'timeline_group' => array(
  88. 'by' => $sModuleName . '_' . $iAuthorId . '_' . $iContentId,
  89. 'field' => 'owner_id'
  90. )
  91. ));
  92. $aParams = array(
  93. 'object_author_id' => $iAuthorId,
  94. 'privacy_view' => -$iCnlProfileId,
  95. 'subobject_id' => $iId,
  96. 'content_module' => $sModuleName,
  97. 'content_id' => $iContentId,
  98. 'content_author_id' => $iAuthorId
  99. );
  100. bx_alert('system', 'prepare_alert_params', 0, 0, array('unit'=> $this->_aModule['name'], 'action' => 'hashtag_added_notif', 'object_id' => $mixedCnlId, 'sender_id' => $iCnlProfileId, 'extras' => &$aParams));
  101. bx_alert($this->_aModule['name'], 'hashtag_added_notif', $mixedCnlId, $iCnlProfileId, $aParams);
  102. }
  103. function removeContentFromChannel($iContentId, $sModuleName)
  104. {
  105. $oDolProfileQuery = BxDolProfileQuery::getInstance();
  106. $aData = $this->_oDb->getDataByContent($iContentId, $sModuleName);
  107. foreach ($aData as $aRow) {
  108. $iProfileInfo = $oDolProfileQuery->getProfileByContentAndType($aRow['cnl_id'], $this->_aModule['name']);
  109. if(is_array($iProfileInfo)){
  110. bx_alert($this->_aModule['name'], 'hashtag_deleted', $aRow['id'], $iProfileInfo['id']);
  111. bx_alert($this->_aModule['name'], 'hashtag_deleted_notif', $aRow['cnl_id'], $iProfileInfo['id'], array('subobject_id' => $aRow['id']));
  112. }
  113. }
  114. return $this->_oDb->removeContentFromChannel($iContentId, $sModuleName);
  115. }
  116. public function serviceGetSafeServices()
  117. {
  118. $a = parent::serviceGetSafeServices();
  119. unset($a['GetCreatePostForm']);
  120. unset($a['EntityCreate']);
  121. return array_merge($a, array (
  122. 'EntityBreadcrumb' => '',
  123. 'EntityParent' => '',
  124. 'EntityChilds' => '',
  125. 'SearchResultByHashtag' => '',
  126. ));
  127. }
  128. public function serviceGetWidgetNotices()
  129. {
  130. $CNF = &$this->_oConfig->CNF;
  131. $iResult = 0;
  132. if(empty($this->_oDb->getParam($CNF['PARAM_DEFAULT_AUTHOR'])))
  133. $iResult += 1;
  134. return $iResult;
  135. }
  136. public function serviceGetOptionsDefaultAuthor()
  137. {
  138. $aResult = array(
  139. array('key' => '', 'value' => _t('_Select_one'))
  140. );
  141. $aAccountsIds = BxDolAccountQuery::getInstance()->getOperators();
  142. foreach($aAccountsIds as $iAccountId) {
  143. $aProfilesIds = BxDolAccount::getInstance($iAccountId)->getProfilesIds();
  144. foreach($aProfilesIds as $iProfileId)
  145. $aResult[] = array(
  146. 'key' => $iProfileId,
  147. 'value' => BxDolProfile::getInstance($iProfileId)->getDisplayName()
  148. );
  149. }
  150. return $aResult;
  151. }
  152. /**
  153. * @page service Service Calls
  154. * @section bx_channels Channels
  155. * @subsection bx_channels-page_blocks Page Blocks
  156. * @subsubsection bx_channels-entity_breadcrumb entity_breadcrumb
  157. *
  158. * @code bx_srv('bx_channels', 'entity_breadcrumb', [...]); @endcode
  159. *
  160. * Display channel breadcrumb
  161. * @param $iContentId channel content ID
  162. *
  163. * @see BxCnlModule::serviceEntityBreadcrumb
  164. */
  165. /**
  166. * @ref bx_channels-entity_breadcrumb "entity_breadcrumb"
  167. */
  168. public function serviceEntityBreadcrumb($iContentId = 0)
  169. {
  170. if(!$iContentId)
  171. $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
  172. if(!$iContentId)
  173. return false;
  174. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  175. if(!$aContentInfo)
  176. return false;
  177. return $this->_oTemplate->entryBreadcrumb($aContentInfo);
  178. }
  179. /**
  180. * @page service Service Calls
  181. * @section bx_channels Channels
  182. * @subsection bx_channels-page_blocks Page Blocks
  183. * @subsubsection bx_channels-entity_parent entity_parent
  184. *
  185. * @code bx_srv('bx_channels', 'entity_parent', [...]); @endcode
  186. *
  187. * Display block with parent channel
  188. * @param $iContentId channel content ID
  189. *
  190. * @see BxCnlModule::serviceEntityParent
  191. */
  192. /**
  193. * @ref bx_channels-entity_parent "entity_parent"
  194. */
  195. public function serviceEntityParent($iContentId = 0)
  196. {
  197. return $this->_serviceTemplateFunc('entryParent', $iContentId);
  198. }
  199. /**
  200. * @page service Service Calls
  201. * @section bx_channels Channels
  202. * @subsection bx_channels-page_blocks Page Blocks
  203. * @subsubsection bx_channels-entity_childs entity_childs
  204. *
  205. * @code bx_srv('bx_channels', 'entity_childs', [...]); @endcode
  206. *
  207. * Display block with child channels
  208. * @param $iContentId channel content ID
  209. *
  210. * @see BxCnlModule::serviceEntityChilds
  211. */
  212. /**
  213. * @ref bx_channels-entity_childs "entity_childs"
  214. */
  215. public function serviceEntityChilds($iContentId = 0)
  216. {
  217. return $this->_serviceTemplateFunc('entryChilds', $iContentId);
  218. }
  219. /**
  220. * @page service Service Calls
  221. * @section bx_channels Channels
  222. * @subsection bx_channels-page_blocks Page Blocks
  223. * @subsubsection bx_channels-search_result_by_hashtag search_result_by_hashtag
  224. *
  225. * @code bx_srv('bx_channels', 'search_result_by_hashtag', [...]); @endcode
  226. *
  227. * Display search results by hashtag for particular channel
  228. * @param $iContentId channel content ID
  229. *
  230. * @see BxCnlModule::serviceSearchResultByHashtag
  231. */
  232. /**
  233. * @ref bx_channels-search_result_by_hashtag "search_result_by_hashtag"
  234. */
  235. public function serviceSearchResultByHashtag($iContentId = 0)
  236. {
  237. $CNF = &$this->_oConfig->CNF;
  238. $oSearch = new BxTemplSearch();
  239. $oSearch->setLiveSearch(0);
  240. $oSearch->setMetaType('keyword');
  241. $aContentInfo = $this->_oDb->getContentInfoById(bx_get('id'));
  242. $_GET['keyword'] = $aContentInfo[$CNF['FIELD_NAME']];
  243. $sCode = $oSearch->response();
  244. if (!$sCode)
  245. $sCode = $oSearch->getEmptyResult();
  246. return $sCode;
  247. }
  248. /**
  249. * Data for Timeline module
  250. */
  251. public function serviceGetTimelineData()
  252. {
  253. $sModule = $this->_aModule['name'];
  254. return array(
  255. 'handlers' => array(
  256. array('group' => $sModule . '_hastag', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'hashtag_added', 'module_name' => $sModule, 'module_method' => 'get_timeline_post_hashtag', 'module_class' => 'Module', 'groupable' => 0, 'group_by' => ''),
  257. array('group' => $sModule . '_hastag', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'hashtag_deleted')
  258. ),
  259. 'alerts' => array(
  260. array('unit' => $sModule, 'action' => 'hashtag_added'),
  261. array('unit' => $sModule, 'action' => 'hashtag_deleted')
  262. )
  263. );
  264. }
  265. public function serviceGetTimelinePostAllowedView ($aEvent)
  266. {
  267. $sError = _t('_sys_txt_access_denied');
  268. if(empty($aEvent) || !is_array($aEvent))
  269. return $sError;
  270. $aEventContent = $this->_oDb->getContentById($aEvent['object_id']);
  271. if ($aEventContent['module_name'] == 'sys_cmts')
  272. return CHECK_ACTION_RESULT_ALLOWED;
  273. if(empty($aEventContent) || !is_array($aEventContent))
  274. return $sError;
  275. if(!BxDolRequest::serviceExists($aEventContent['module_name'], 'get_timeline_post_allowed_view'))
  276. return $sError;
  277. return BxDolService::call($aEventContent['module_name'], 'get_timeline_post_allowed_view', array(array('id' => $aEvent['id'], 'owner_id' => $aEventContent['author_id'], 'object_id' => $aEventContent['content_id'])));
  278. }
  279. public function serviceGetTimelinePostHashtag($aEvent, $aBrowseParams = [])
  280. {
  281. if(empty($aEvent) || !is_array($aEvent))
  282. return false;
  283. $aEventContent = $this->_oDb->getContentById($aEvent['object_id']);
  284. if(empty($aEventContent) || !is_array($aEventContent))
  285. return false;
  286. $sModule = $aEventContent['module_name'];
  287. $sClass = 'Module';
  288. if($sModule == 'sys_cmts') {
  289. $sModule = 'system';
  290. $sClass = 'TemplCmtsServices';
  291. }
  292. if(!BxDolRequest::serviceExists($sModule, 'get_timeline_post', $sClass))
  293. return false;
  294. $iContentId = (int)$aEventContent['content_id'];
  295. $iContentAuthor = 0;
  296. if(bx_is_srv($sModule, 'get_author', $sClass))
  297. $iContentAuthor = bx_srv($sModule, 'get_author', [$iContentId], $sClass);
  298. /**
  299. * Prepare fake event array (only mandatory parameters) to get
  300. * necessary data (related to an 'original' event with hashtag/label)
  301. * from associated content module.
  302. */
  303. $iOwnerId = $aEvent['owner_id'];
  304. $mixedObjectPrivacyView = BX_DOL_PG_ALL;
  305. if($iContentAuthor > 0) {
  306. $iOwnerId = (int)$aEventContent['author_id'];
  307. if(bx_is_srv($sModule, 'get_privacy_view', $sClass)) {
  308. $mixedAllowViewTo = bx_srv($sModule, 'get_privacy_view', [$iContentId]);
  309. if($mixedAllowViewTo !== false)
  310. $mixedObjectPrivacyView = $mixedAllowViewTo;
  311. if(is_numeric($mixedAllowViewTo) && (int)$mixedAllowViewTo < 0)
  312. $iOwnerId = abs($mixedAllowViewTo);
  313. }
  314. }
  315. $aResult = bx_srv($sModule, 'get_timeline_post', [[
  316. 'owner_id' => $iOwnerId,
  317. 'object_id' => $iContentId,
  318. 'object_privacy_view' => $mixedObjectPrivacyView
  319. ], $aBrowseParams], $sClass);
  320. if(empty($aResult) || !is_array($aResult))
  321. return $aResult;
  322. /**
  323. * Note. The context shouldn't be changed therefore
  324. * use input event's context (owner_id) in returned results.
  325. */
  326. return array_merge($aResult, [
  327. 'owner_id' => $aEvent['owner_id']
  328. ]);
  329. }
  330. /**
  331. * Data for Notifications module
  332. */
  333. public function serviceGetNotificationsData()
  334. {
  335. $a = parent::serviceGetNotificationsData();
  336. $sModule = $this->_aModule['name'];
  337. $a['handlers'][] = array('group' => $sModule . '_hastag_notif', 'type' => 'insert', 'alert_unit' => $sModule, 'alert_action' => 'hashtag_added_notif', 'module_name' => $sModule, 'module_method' => 'get_notifications_post_hashtag', 'module_class' => 'Module');
  338. $a['handlers'][] = array('group' => $sModule . '_hastag_notif', 'type' => 'delete', 'alert_unit' => $sModule, 'alert_action' => 'hashtag_deleted_notif');
  339. $a['settings'][] = array('group' => 'hastag', 'unit' => $sModule, 'action' => 'hashtag_added_notif', 'types' => array('follow_context'));
  340. $a['alerts'][] = array('unit' => $sModule, 'action' => 'hashtag_added_notif');
  341. $a['alerts'][] = array('unit' => $sModule, 'action' => 'hashtag_deleted_notif');
  342. return $a;
  343. }
  344. public function serviceGetNotificationsPostHashtag($aEvent)
  345. {
  346. if(empty($aEvent) || !is_array($aEvent))
  347. return '';
  348. $aContentEvent = $this->_oDb->getContentById($aEvent['subobject_id']);
  349. if(empty($aContentEvent) || !is_array($aContentEvent))
  350. return '';
  351. $oModule = BxDolModule::getInstance($aContentEvent['module_name']);
  352. if ($oModule) {
  353. if (isset($oModule->_oConfig->CNF['OBJECT_PRIVACY_VIEW'])){
  354. $oPrivacy = BxDolPrivacy::getObjectInstance($oModule->_oConfig->CNF['OBJECT_PRIVACY_VIEW']);
  355. if (!$oPrivacy->check($aContentEvent['content_id']))
  356. return '';
  357. }
  358. $aRv = $oModule->serviceGetNotificationsPost(array(
  359. 'object_id' => $aContentEvent['content_id']
  360. ));
  361. $aRv['lang_key'] = '_bx_channels_ntfs_txt_subobject_added';
  362. if(method_exists($oModule, 'serviceActAsProfile') && $oModule->serviceActAsProfile())
  363. $aRv['lang_key'] = '_bx_channels_ntfs_txt_subobject_added_profile';
  364. $aRv['entry_url'] = bx_absolute_url(str_replace(BX_DOL_URL_ROOT, '', $this->serviceGetLink($aContentEvent['cnl_id'])), '{bx_url_root}');
  365. return $aRv;
  366. }
  367. return '';
  368. }
  369. public function serviceBrowseByLevel ($iLevelId = 0, $bDisplayEmptyMsg = false)
  370. {
  371. return $this->_serviceBrowse ('level', array('level' => $iLevelId), BX_DB_PADDING_DEF, $bDisplayEmptyMsg);
  372. }
  373. public function serviceBrowseFollowed($iProfileId = 0, $aParams = array())
  374. {
  375. return $this->_serviceBrowseWithParam ('followed_entries', 'profile_id', $iProfileId, $aParams);
  376. }
  377. public function serviceBrowseAuthor($iProfileId = 0, $aParams = array())
  378. {
  379. $CNF = &$this->_oConfig->CNF;
  380. if(empty($iProfileId))
  381. $iProfileId = bx_get_logged_profile_id();
  382. $sResult = isset($aParams['empty_message']) && (bool)$aParams['empty_message'] === true ? MsgBox(_t('_Empty')) : '';
  383. $oConnection = BxDolConnection::getObjectInstance('sys_profiles_subscriptions');
  384. if(!$oConnection)
  385. return $sResult;
  386. $aProfiles = $oConnection->getConnectedContentByType($iProfileId, $this->getName());
  387. $aTmplVars = [];
  388. foreach ($aProfiles as $iProfileId) {
  389. $oProfile = BxDolProfile::getInstance($iProfileId);
  390. if(!$oProfile)
  391. continue;
  392. $aTmplVars[] = [
  393. 'unit' => $oProfile->getUnit(0, ['template' => 'unit_wo_cover'])
  394. ];
  395. }
  396. if(empty($aTmplVars) || !is_array($aTmplVars))
  397. return $sResult;
  398. return $this->_oTemplate->parseHtmlByName('my_channels.html', [
  399. 'bx_repeat:items' => $aTmplVars
  400. ]);
  401. }
  402. public function serviceDeleteProfileFromFansAndAdmins ($iProfileId)
  403. {
  404. return true;
  405. }
  406. public function serviceGetFollowingChannelsNames($iProfileId)
  407. {
  408. if (!($oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions')))
  409. return array();
  410. if (!($aIds = $oConn->getConnectedContent($iProfileId)))
  411. return array();
  412. $a = array();
  413. foreach ($aIds as $iId) {
  414. if (!($oProfile = BxDolProfile::getInstance($iId)))
  415. continue;
  416. if ($oProfile->getModule() != $this->getName())
  417. continue;
  418. $a[] = $oProfile->getDisplayName();
  419. }
  420. return $a;
  421. }
  422. public function checkAllowedCompose(&$aDataEntry, $isPerformAction = false)
  423. {
  424. return _t('_sys_txt_access_denied');
  425. }
  426. public function checkAllowedContact($aDataEntry, $isPerformAction = false)
  427. {
  428. return _t('_sys_txt_access_denied');
  429. }
  430. public function followLabels($sModule, $iContentId)
  431. {
  432. if (!getParam('bx_channels_labels_autofollow'))
  433. return;
  434. if (!($oModuleProfiles = BxDolModule::getInstance($sModule)))
  435. return;
  436. if (!($aContentInfo = $oModuleProfiles->_oDb->getContentInfoById($iContentId)) || !($oProfile = BxDolProfile::getInstanceByContentAndType($iContentId, $sModule)))
  437. return;
  438. $CNF = &$oModuleProfiles->_oConfig->CNF;
  439. if (!$oModuleProfiles->serviceActAsProfile() || !isset($CNF['FIELD_LABELS']) || empty($aContentInfo[$CNF['FIELD_ID']]))
  440. return;
  441. if (!($oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS'])) || !$oMetatags->keywordsIsEnabled() || !($aLabels = $oMetatags->keywordsGet($aContentInfo[$CNF['FIELD_ID']])))
  442. return;
  443. if (!($oConn = BxDolConnection::getObjectInstance('sys_profiles_subscriptions')))
  444. return;
  445. foreach ($aLabels as $sLabel) {
  446. if (!($iContentIdChannel = $this->_oDb->getChannelIdByName($sLabel)))
  447. continue;
  448. if (!($oProfileChannel = BxDolProfile::getInstanceByContentAndType($iContentIdChannel, 'bx_channels')))
  449. continue;
  450. $oConn->addConnection($oProfile->id(), $oProfileChannel->id());
  451. }
  452. }
  453. /** Returns profile's subscribed channels React Jot
  454. *
  455. * @param int $iProfileId
  456. * @param array $aParams
  457. * @return array
  458. */
  459. public function serviceBrowseAuthorChannels($iProfileId = 0, $aParams = array())
  460. {
  461. $CNF = &$this->_oConfig->CNF;
  462. if(empty($iProfileId))
  463. $iProfileId = bx_get_logged_profile_id();
  464. $oConnection = BxDolConnection::getObjectInstance('sys_profiles_subscriptions');
  465. $aProfile = $oConnection->getConnectedContent($iProfileId);
  466. $aVars = array();
  467. foreach ($aProfile as $iProfileId) {
  468. $oProfile = BxDolProfile::getInstance($iProfileId);
  469. if (!$oProfile || $oProfile->getModule() != $this->getName())
  470. continue;
  471. $iContentId = $oProfile->getContentId();
  472. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  473. if (isset($aContentInfo[$CNF['FIELD_NAME']]))
  474. array_push($aVars, array(
  475. 'title' => $aContentInfo[$CNF['FIELD_NAME']],
  476. 'link' => bx_absolute_url(BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $iContentId)),
  477. 'followers' => $oConnection -> getConnectedInitiatorsCount($iProfileId),
  478. 'id' => $iProfileId,
  479. 'icon' => $oProfile -> getThumb()
  480. ));
  481. }
  482. return $aVars;
  483. }
  484. }
  485. /** @} */