本文整理汇总了PHP中CSocNetLogRights::deleteByLogID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogRights::deleteByLogID方法的具体用法?PHP CSocNetLogRights::deleteByLogID怎么用?PHP CSocNetLogRights::deleteByLogID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetLogRights
的用法示例。
在下文中一共展示了CSocNetLogRights::deleteByLogID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setMessageLiveFeed
public static function setMessageLiveFeed($users, $elementId, $workflowId, $flagCompleteProcess)
{
$elementId = intval($elementId);
$elementObject = CIBlockElement::getList(array(), array('ID' => $elementId), false, false, array('ID', 'CREATED_BY', 'IBLOCK_NAME', 'NAME', 'IBLOCK_ID', 'LANG_DIR'));
$element = $elementObject->fetch();
if (!CLists::getLiveFeed($element["IBLOCK_ID"])) {
return false;
}
$params = serialize(array("ELEMENT_NAME" => $element['NAME']));
$element['NAME'] = preg_replace_callback('#^[^\\[\\]]+?\\[(\\d+)\\]#i', function ($matches) {
$userId = $matches[1];
$db = CUser::GetByID($userId);
if ($ar = $db->GetNext()) {
$ix = randString(5);
return '<a class="feed-post-user-name" id="bp_' . $userId . '_' . $ix . '" href="/company/personal/user/' . $userId . '/"
bx-post-author-id="' . $userId . '">' . CUser::FormatName(CSite::GetNameFormat(false), $ar, false, false) . '</a>
<script type="text/javascript">if (BX.tooltip) BX.tooltip(\'' . $userId . '\', "bp_' . $userId . '_' . $ix . '", "");</script>';
}
return $matches[0];
}, $element['NAME']);
$path = rtrim($element['LANG_DIR'], '/');
$urlElement = $path . COption::GetOptionString('lists', 'livefeed_url') . '?livefeed=y&list_id=' . $element["IBLOCK_ID"] . '&element_id=' . $elementId;
$createdBy = $element['CREATED_BY'];
if (!Loader::includeModule('socialnetwork') || $createdBy <= 0) {
return false;
}
$sourceId = CBPStateService::getWorkflowIntegerId($workflowId);
$logId = 0;
$userObject = CUser::getByID($createdBy);
$siteId = array();
$siteObject = CSite::getList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($site = $siteObject->fetch()) {
$siteId[] = $site['LID'];
}
if ($userObject->fetch()) {
global $DB;
$soFields = array('ENTITY_TYPE' => SONET_LISTS_NEW_POST_ENTITY, 'EVENT_ID' => 'lists_new_element', 'ENTITY_ID' => 1, '=LOG_UPDATE' => $DB->currentTimeFunction(), 'SOURCE_ID' => $sourceId, 'USER_ID' => $createdBy, 'MODULE_ID' => 'lists', 'TITLE_TEMPLATE' => $urlElement, 'TITLE' => $element['IBLOCK_NAME'], 'PARAMS' => $params, 'MESSAGE' => $workflowId, 'CALLBACK_FUNC' => false, 'SITE_ID' => $siteId, 'ENABLE_COMMENTS' => 'Y', 'RATING_TYPE_ID' => 'LISTS_NEW_ELEMENT', 'RATING_ENTITY_ID' => $sourceId, 'URL' => '#SITE_DIR#' . COption::GetOptionString('socialnetwork', 'user_page', false, SITE_ID) . 'log/');
$logObject = CSocNetLog::getList(array(), array('ENTITY_TYPE' => $soFields['ENTITY_TYPE'], 'ENTITY_ID' => $soFields['ENTITY_ID'], 'EVENT_ID' => $soFields['EVENT_ID'], 'SOURCE_ID' => $soFields['SOURCE_ID']));
$iblockPicture = CIBlock::getArrayByID($element['IBLOCK_ID'], 'PICTURE');
$imageFile = CFile::getFileArray($iblockPicture);
if ($imageFile !== false) {
$imageFile = CFile::ResizeImageGet($imageFile, array("width" => 36, "height" => 30), BX_RESIZE_IMAGE_PROPORTIONAL, false);
}
if (empty($imageFile['src'])) {
$imageFile['src'] = '/bitrix/images/lists/default.png';
}
$soFields['TEXT_MESSAGE'] = '
<span class="bp-title-desc">
<span class="bp-title-desc-icon">
<img src="' . $imageFile['src'] . '" width="36" height="30" border="0" />
</span>
' . $element['NAME'] . '
</span>
';
if ($log = $logObject->fetch()) {
if (intval($log['ID']) > 0) {
if (empty($users)) {
CSocNetLog::update($log['ID'], $soFields);
} else {
$activeUsers = CBPTaskService::getWorkflowParticipants($workflowId);
$rights = self::getRights($activeUsers, $log['ID'], $createdBy, 'post');
$usersRight = self::getUserIdForRight($rights);
self::setSocnetFollow($usersRight, $log['ID'], 'Y', true);
/* Recipients tasks bp */
CSocNetLog::update($log['ID'], $soFields);
/* Increment the counter for participants */
CSocNetLogRights::deleteByLogID($log['ID']);
$rightsCounter = self::getRights($users, $log['ID'], $createdBy, 'counter');
CSocNetLogRights::add($log['ID'], $rightsCounter, false, false);
CSocNetLog::counterIncrement($log['ID'], $soFields['EVENT_ID'], false, 'L', false);
/* Return previous state rights */
CSocNetLogRights::deleteByLogID($log['ID']);
CSocNetLogRights::add($log['ID'], $rights, false, false);
self::setSocnetFollow($users, $log['ID'], 'Y');
self::setSocnetFollow($users, $log['ID'], 'N');
}
/* Completion of the process for the author */
if ($flagCompleteProcess) {
$activeUsers = CBPTaskService::getWorkflowParticipants($workflowId);
$rights = self::getRights($activeUsers, $log['ID'], $createdBy, 'post');
$usersRight = self::getUserIdForRight($rights);
/* Increment the counter for author */
$users[] = $createdBy;
CSocNetLogRights::deleteByLogID($log['ID']);
$rightsCounter = self::getRights($users, $log['ID'], $createdBy, 'counter');
CSocNetLogRights::add($log['ID'], $rightsCounter, false, false);
CSocNetLog::counterIncrement($log['ID'], $soFields['EVENT_ID'], false, 'L', false);
/* Return previous state rights */
CSocNetLogRights::deleteByLogID($log['ID']);
CSocNetLogRights::add($log['ID'], $rights, false, false);
self::setSocnetFollow($users, $log['ID'], 'Y');
self::setSocnetFollow($usersRight, $log['ID'], 'N');
}
}
} else {
$activeUsers = CBPTaskService::getWorkflowParticipants($workflowId);
$soFields['=LOG_DATE'] = $DB->currentTimeFunction();
$logId = CSocNetLog::add($soFields, false);
if (intval($logId) > 0) {
$rights = self::getRights($activeUsers, $logId, $createdBy, 'post');
//.........这里部分代码省略.........