当前位置: 首页>>代码示例>>PHP>>正文


PHP CSocNetLogRights::getList方法代码示例

本文整理汇总了PHP中CSocNetLogRights::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetLogRights::getList方法的具体用法?PHP CSocNetLogRights::getList怎么用?PHP CSocNetLogRights::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSocNetLogRights的用法示例。


在下文中一共展示了CSocNetLogRights::getList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getRights

 protected static function getRights($users, $logId, $createdBy, $method)
 {
     $rights = array();
     $rights[] = 'SA';
     //socnet admin
     if (!empty($users)) {
         if ($method == 'post') {
             $users[] = $createdBy;
         }
         foreach ($users as $userId) {
             $rights[] = 'U' . $userId;
         }
     }
     if ($method == 'post') {
         $rightsQuery = CSocNetLogRights::getList(array(), array('LOG_ID' => $logId));
         while ($currentRights = $rightsQuery->fetch()) {
             $rights[] = $currentRights['GROUP_CODE'];
         }
         $rights = array_unique($rights);
     }
     return $rights;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:22,代码来源:livefeed.php

示例2: formatListsElement

 public static function formatListsElement($fields, $params, $mail = false)
 {
     $element = array('EVENT' => $fields, 'CREATED_BY' => array(), 'ENTITY' => array(), 'EVENT_FORMATTED' => array());
     $userObject = CUser::getByID($fields['ENTITY_ID']);
     $user = $userObject->fetch();
     if ($user) {
         if (!$mail) {
             global $APPLICATION;
             $rights = array();
             $rightsQuery = CSocNetLogRights::getList(array(), array('LOG_ID' => $fields['ID']));
             while ($right = $rightsQuery->fetch()) {
                 $rights[] = $right['GROUP_CODE'];
             }
             if (defined('BX_COMP_MANAGED_CACHE')) {
                 $GLOBALS['CACHE_MANAGER']->registerTag('LISTS_ELEMENT_LIVE_FEED');
             }
             $componentResult = $APPLICATION->includeComponent('bitrix:bizproc.workflow.livefeed', '', array('WORKFLOW_ID' => $fields['MESSAGE']), null, array('HIDE_ICONS' => 'Y'));
             $siteDir = rtrim(SITE_DIR, '/');
             $url = CSocNetLogTools::formatEvent_GetURL($fields, true);
             $url = str_replace('#SITE_DIR#', $siteDir, $url);
             $url .= '' . $fields['ID'] . '/';
             $element = array('EVENT' => $fields, 'EVENT_FORMATTED' => array('TITLE_24' => '<a href="' . $fields['TITLE_TEMPLATE'] . '" class="bx-lists-live-feed-title-link">' . $fields['TITLE'] . '</a>', 'MESSAGE' => $fields['TEXT_MESSAGE'] . $componentResult['MESSAGE'], 'IS_IMPORTANT' => false, 'STYLE' => 'new-employee', 'AVATAR_STYLE' => 'avatar-info', 'DESTINATION' => CSocNetLogTools::formatDestinationFromRights($rights, array_merge($params, array('CREATED_BY' => $fields['USER_ID']))), 'URL' => $url), 'CREATED_BY' => CSocNetLogTools::formatEvent_GetCreatedBy($fields, $params, $mail), 'AVATAR_SRC' => CSocNetLog::formatEvent_CreateAvatar($fields, $params), 'CACHED_JS_PATH' => $componentResult['CACHED_JS_PATH'], 'CACHED_CSS_PATH' => $componentResult['CACHED_CSS_PATH']);
             if ($params['MOBILE'] == 'Y') {
                 $element['EVENT_FORMATTED']['TITLE_24'] = Loc::getMessage('LISTS_LF_MOBILE_DESTINATION');
                 $element['EVENT_FORMATTED']['TITLE_24_2'] = $fields['TITLE'];
             }
             if (CModule::IncludeModule('bizproc')) {
                 $workflowId = \CBPStateService::getWorkflowByIntegerId($element['EVENT']['SOURCE_ID']);
             }
             if ($workflowId) {
                 $element['EVENT']['SOURCE_ID'] = $workflowId;
             }
         }
         return $element;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:livefeed.php

示例3: canRead

 /**
  * @param $userId
  * @return bool
  */
 public function canRead($userId)
 {
     if ($this->canRead !== null) {
         return $this->canRead;
     }
     if (($res = $this->getDataToCheck($this->entityId)) && !empty($res)) {
         list($message, $topic) = $res;
         $entityId = null;
         $entityType = null;
         if (!empty($topic["XML_ID"])) {
             $entityId = substr($topic["XML_ID"], strrpos($topic["XML_ID"], "_") + 1);
             $entityType = substr($topic["XML_ID"], 0, strrpos($topic["XML_ID"], "_"));
         }
         switch ($entityType) {
             case "TASK":
                 if (Loader::includeModule("tasks")) {
                     $connector = new TaskConnector($entityId, $this->attachedObject);
                     $this->canRead = $connector->canRead($userId);
                     return $this->canRead;
                 }
                 break;
             case "EVENT":
                 if (Loader::includeModule("calendar")) {
                     $connector = new CalendarEventConnector($entityId, $this->attachedObject);
                     $this->canRead = $connector->canRead($userId);
                     return $this->canRead;
                 }
                 break;
             case "IBLOCK":
                 if ((int) $topic["USER_ID"] > 0 && Loader::includeModule("socialnetwork")) {
                     $codes = array();
                     if (($res = \CSocNetLog::getList(array(), array("SOURCE_ID" => $entityId, "EVENT_ID" => array("photo_photo", "news", "wiki")), false, false, array("ID"))->fetch()) && $res) {
                         $db_res = \CSocNetLogRights::getList(array(), array("LOG_ID" => $res["ID"]));
                         while ($res = $db_res->fetch()) {
                             $codes[] = $res["GROUP_CODE"];
                         }
                     }
                     $this->canRead = $this->canAccess($userId, $codes);
                     return $this->canRead;
                 }
                 $this->canRead = true;
                 return $this->canRead;
             case "MEETING":
                 $this->canRead = (int) $message["FORUM_ID"] == (int) \COption::getOptionInt('meeting', 'comments_forum_id', 0, SITE_ID);
                 return $this->canRead;
             case "TIMEMAN_ENTRY":
                 if (Loader::includeModule("timeman")) {
                     $dbEntry = \CTimeManEntry::getList(array(), array("ID" => $entityId), false, false, array("ID", "USER_ID"));
                     if ($arEntry = $dbEntry->fetch()) {
                         if ($arEntry["USER_ID"] == $userId) {
                             $this->canRead = true;
                             return $this->canRead;
                         } else {
                             $arManagers = \CTimeMan::getUserManagers($arEntry["USER_ID"]);
                             $this->canRead = in_array($userId, $arManagers);
                             return $this->canRead;
                         }
                     }
                 }
                 $this->canRead = false;
                 return $this->canRead;
             case "TIMEMAN_REPORT":
                 if (Loader::includeModule("timeman")) {
                     $dbReport = \CTimeManReportFull::getList(array(), array("ID" => $entityId), array("ID", "USER_ID"));
                     if ($arReport = $dbReport->fetch()) {
                         if ($arReport["USER_ID"] == $userId) {
                             $this->canRead = true;
                             return $this->canRead;
                         } else {
                             $arManagers = \CTimeMan::getUserManagers($arReport["USER_ID"]);
                             $this->canRead = in_array($userId, $arManagers);
                             return $this->canRead;
                         }
                     }
                 }
                 $this->canRead = false;
                 return $this->canRead;
             case "WF":
                 $this->canRead = false;
                 if (Loader::includeModule("bizproc")) {
                     $currentUserId = (int) $this->getUser()->getId();
                     $participants = \CBPTaskService::getWorkflowParticipants($entityId);
                     if (in_array($currentUserId, $participants)) {
                         $this->canRead = true;
                     } else {
                         $state = \CBPStateService::getWorkflowStateInfo($entityId);
                         if ($state && $currentUserId === (int) $state['STARTED_BY']) {
                             $this->canRead = true;
                         }
                     }
                 }
                 return $this->canRead;
         }
         if ((!empty($topic["SOCNET_GROUP_ID"]) || !empty($topic["OWNER_ID"])) && Loader::includeModule("socialnetwork")) {
             if (!empty($topic["SOCNET_GROUP_ID"])) {
                 $this->canRead = \CSocNetFeatures::isActiveFeature(SONET_ENTITY_GROUP, $topic["SOCNET_GROUP_ID"], "forum") && \CSocNetFeaturesPerms::canPerformOperation($userId, SONET_ENTITY_GROUP, $topic["SOCNET_GROUP_ID"], "forum", "view");
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:forummessageconnector.php


注:本文中的CSocNetLogRights::getList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。