_serviceProfileFunc('getUnit', $iContentId, $aParams); } public function serviceHasImage ($iContentId) { return false; } public function serviceProfilePicture ($iContentId) { return $this->_serviceProfileFunc('getPicture', $iContentId); } public function serviceProfileAvatar ($iContentId) { return $this->_serviceProfileFunc('getAvatar', $iContentId); } public function serviceProfileCover ($iContentId) { return $this->_serviceTemplateFunc('urlCover', $iContentId); } public function serviceProfileEditUrl ($iContentId) { return BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=account-settings-info'); } public function serviceProfileThumb ($iContentId) { return $this->_serviceProfileFunc('getThumb', $iContentId); } public function serviceProfileIcon ($iContentId) { return $this->_serviceProfileFunc('getIcon', $iContentId); } public function serviceProfileName ($iContentId) { return $this->_serviceProfileFunc('getDisplayName', $iContentId); } public function serviceProfileUrl ($iContentId) { return $this->_serviceProfileFunc('getUrl', $iContentId); } /** * @see iBxDolProfileService::serviceCheckAllowedProfileView */ public function serviceCheckAllowedProfileView($iContentId) { return _t('_Access denied'); } /** * @see iBxDolProfileService::serviceCheckAllowedProfileContact */ public function serviceCheckAllowedProfileContact($iContentId) { return _t('_Access denied'); } /** * @see iBxDolProfileService::serviceCheckAllowedPostInProfile */ public function serviceCheckAllowedPostInProfile($iContentId) { return _t('_Access denied'); } /** * @see iBxDolProfileService::serviceGetSpaceTitle */ public function serviceGetSpaceTitle() { return ''; } /** * @see iBxDolProfileService::serviceGetParticipatingProfiles */ public function serviceGetParticipatingProfiles($iProfileId, $aConnectionObject = false) { return array(); } /** * Get United Create Post form. * * @param type $mixedContextId - context which the post will be created in: * false = 'Public' post form; * 0 = 'Account' post form, which allows to post in your own profile and connections; * n = 'Context' post form, which allows to post in context (3d party profile, group, event, etc). * @param type $sDefault - tab selected by default. * @param type $aCustom - an array with custom paramaters. * @return string */ public function serviceGetCreatePostForm($mixedContextId = false, $sDefault = '', $aCustom = array()) { if(!isLogged() || ($mixedContextId !== false && !is_numeric($mixedContextId))) return ''; if($mixedContextId !== false) $mixedContextId = (int)(!empty($mixedContextId) ? -$mixedContextId : bx_get_logged_profile_id()); $bContext = $mixedContextId !== false; if($bContext && ($oContextProfile = BxDolProfile::getInstance(abs($mixedContextId))) !== false) if($oContextProfile->checkAllowedPostInProfile() !== CHECK_ACTION_RESULT_ALLOWED) return ''; $sTitle = _t('_sys_page_block_title_create_post' . (!$bContext ? '_public' : ($mixedContextId < 0 ? '_context' : ''))); $sPlaceholder = _t('_sys_txt_create_post_placeholder', BxDolProfile::getInstance()->getDisplayName()); $oMenu = BxDolMenu::getObjectInstance('sys_create_post'); $aMenuItems = $oMenu->getMenuItems(); if(empty($aMenuItems) || !is_array($aMenuItems)) return ''; if(empty($sDefault)) { $aDefault = array_shift($aMenuItems); $sDefault = $aDefault['module']; } $oMenu->setSelected($sDefault, $sDefault); $oTemplate = BxDolTemplate::getInstance(); $oTemplate->addJs(array('BxDolCreatePost.js')); $sJsObject = 'oBxDolCreatePost'; $sJsContent = $oTemplate->_wrapInTagJsCode("var " . $sJsObject . " = new BxDolCreatePost(" . json_encode(array( 'sObjName' => $sJsObject, 'sRootUrl' => BX_DOL_URL_ROOT, 'sDefault' => $sDefault, 'iContextId' => $bContext ? $mixedContextId : 0, 'oCustom' => $aCustom )) . ");"); return array('content' => BxDolTemplate::getInstance()->parseHtmlByName('create_post_form.html', array( 'default' => $sDefault, 'title' => $sTitle, 'placeholder' => $sPlaceholder, 'user_thumb' => BxDolProfile::getInstance()->getUnit(0, array('template' => 'unit_wo_info')), 'menu' => $oMenu->getCode(), 'form' => BxDolService::call($sDefault, 'get_create_post_form', array(array('context_id' => $mixedContextId, 'ajax_mode' => true, 'absolute_action_url' => true, 'custom' => $aCustom))), 'js_object' => $sJsObject, 'js_content' => $sJsContent ))); } /** * @see iBxDolProfileService::serviceCheckSpacePrivacy */ public function serviceCheckSpacePrivacy($iContentId) { return _t('_Access denied'); } public function serviceFormsHelper () { return new BxTemplAccountForms(); } public function serviceActAsProfile () { return false; } public function servicePrepareFields ($aFieldsProfile) { return $aFieldsProfile; } public function serviceProfilesSearch ($sTerm, $iLimit) { $oDb = BxDolAccountQuery::getInstance(); $aRet = array(); $a = $oDb->searchByTerm($sTerm, $iLimit); foreach ($a as $r) $aRet[] = array ('label' => $this->serviceProfileName($r['content_id']), 'value' => $r['profile_id']); return $aRet; } public function serviceKeywordSearch ($sSection, $aCondition, $sTemplate = '', $iStart = 0, $iPerPage = 0, $bLiveSearch = 0) { if (!$sSection || !isset($aCondition['keyword'])) return ''; $sClass = 'BxTemplSearch'; $sElsName = 'bx_elasticsearch'; $sElsMethod = 'is_configured'; if(BxDolRequest::serviceExists($sElsName, $sElsMethod) && BxDolService::call($sElsName, $sElsMethod)) { $oModule = BxDolModule::getInstance($sElsName); bx_import('Search', $oModule->_aModule); $sClass = 'BxElsSearch'; } $oSearch = new $sClass(array($sSection)); $oSearch->setLiveSearch($bLiveSearch); $oSearch->setMetaType(isset($aCondition['meta_type']) ? $aCondition['meta_type'] : ''); $oSearch->setCategoryObject(isset($aCondition['cat']) ? $aCondition['cat'] : ''); $oSearch->setCustomSearchCondition($aCondition); $oSearch->setRawProcessing(true); $oSearch->setCustomCurrentCondition(array( 'paginate' => array ( 'start' => $iStart, 'perPage' => $iPerPage ? $iPerPage : BX_DOL_SEARCH_RESULTS_PER_PAGE_DEFAULT, ))); if ($sTemplate) $oSearch->setUnitTemplate($sTemplate); return $oSearch->response(); } public function _serviceProfileFunc ($sFunc, $iContentId, $aParams = array()) { if (!$iContentId) return false; if (!($oAccount = BxDolAccount::getInstance($iContentId))) return false; return $oAccount->$sFunc(false, $aParams); } public function serviceAlertResponseProcessInstalled() { BxDolTranscoderImage::registerHandlersSystem(); } public function serviceAlertResponseProcessStorageChange ($oAlert) { if ('sys_storage_default' != $oAlert->aExtras['option']) return; $aStorages = BxDolStorageQuery::getStorageObjects(); foreach ($aStorages as $r) { if (0 == $r['current_size'] && 0 == $r['current_number'] && ($oStorage = BxDolStorage::getObjectInstance($r['object']))) $oStorage->changeStorageEngine($oAlert->aExtras['value']); } } /** * This service adds notification for users which open your site on mobile devices * and suggest to add your site to their mobile homepage. */ public function serviceAddToMobileHomepage () { BxDolTemplate::getInstance()->addJs('cubiq-add-to-homescreen/addtohomescreen.min.js'); BxDolTemplate::getInstance()->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'cubiq-add-to-homescreen/style/|addtohomescreen.css'); return ""; } public function serviceGetOptionsEmbedDefault() { $aResults = array( '' => _t('_None') ); $aObjects = BxDolEmbedQuery::getObjects(); foreach($aObjects as $aObject) $aResults[$aObject['object']] = $aObject['title']; return $aResults; } public function serviceGetOptionsRelations() { $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'modules', 'active' => 1)); $aProfiles = array(); foreach($aModules as $aModule) { $sMethod = 'act_as_profile'; if(!BxDolRequest::serviceExists($aModule['name'], $sMethod) || !BxDolService::call($aModule['name'], $sMethod)) continue; $aProfiles[$aModule['name']] = _t('_' . $aModule['name']); } $aResults = array(); foreach($aProfiles as $sName1 => $sTitle1) foreach($aProfiles as $sName2 => $sTitle2) $aResults[$sName1 . '_' . $sName2] = $sTitle1 . ' - ' . $sTitle2; return $aResults; } } /** @} */