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


PHP CCrmOwnerType::isOpened方法代码示例

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


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

示例1: GetSubSelect

 private static function GetSubSelect($arLogFields, $bDecrement = false)
 {
     global $DB;
     $author_id = CCrmSecurityHelper::GetCurrentUserID();
     if ($author_id <= 0 && isset($arLogFields["USER_ID"])) {
         $author_id = intval($arLogFields["USER_ID"]);
     }
     if ($author_id <= 0) {
         return "";
     }
     $entityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($arLogFields["ENTITY_TYPE"]);
     $entityID = $arLogFields["ENTITY_ID"];
     $arEntities = array();
     if ($entityTypeID == CCrmOwnerType::Activity) {
         if ($arActivity = CCrmActivity::GetByID($entityID)) {
             $entityTypeID = $arActivity["OWNER_TYPE_ID"];
             $entityID = $arActivity["OWNER_ID"];
             $entityName = CCrmOwnerType::ResolveName($entityTypeID);
             $bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
             $responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
             if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0) {
                 if (!array_key_exists($entityName, $arEntities)) {
                     $arEntities[$entityName] = array();
                 }
                 $arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
             }
             $arCommunications = CCrmActivity::GetCommunications($arActivity["ID"]);
             foreach ($arCommunications as $arActivityCommunication) {
                 $entityTypeID = $arActivityCommunication["ENTITY_TYPE_ID"];
                 $entityID = $arActivityCommunication["ENTITY_ID"];
                 $entityName = CCrmOwnerType::ResolveName($entityTypeID);
                 $bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
                 $responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
                 if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0) {
                     if (!array_key_exists($entityName, $arEntities)) {
                         $arEntities[$entityName] = array();
                     }
                     $arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
                 }
             }
         }
     } elseif ($entityTypeID == CCrmOwnerType::Invoice) {
         if ($arInvoice = CCrmInvoice::GetByID($entityID)) {
             $arBindings = array(CCrmOwnerType::Contact => $arInvoice["UF_CONTACT_ID"], CCrmOwnerType::Company => $arInvoice["UF_COMPANY_ID"], CCrmOwnerType::Deal => $arInvoice["UF_DEAL_ID"]);
             foreach ($arBindings as $entityTypeID => $entityID) {
                 if (intval($entityID) > 0) {
                     $entityName = CCrmOwnerType::ResolveName($entityTypeID);
                     $bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
                     $responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
                     if ($entityName && intval($responsible_id) > 0) {
                         if (!array_key_exists($entityName, $arEntities)) {
                             $arEntities[$entityName] = array();
                         }
                         $arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
                     }
                 }
             }
         }
     } else {
         $entityName = CCrmOwnerType::ResolveName($entityTypeID);
         $bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
         $responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
         if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0) {
             if (!array_key_exists($entityName, $arEntities)) {
                 $arEntities[$entityName] = array();
             }
             $arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
         }
     }
     if (intval($arLogFields["LOG_ID"]) > 0 && in_array($arLogFields["EVENT_ID"], array("crm_lead_message", "crm_deal_message", "crm_contact_message", "crm_company_message"))) {
         $dbRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arLogFields["LOG_ID"]));
         while ($arRight = $dbRight->Fetch()) {
             if (preg_match('/^(' . CCrmLiveFeedEntity::Contact . '|' . CCrmLiveFeedEntity::Lead . '|' . CCrmLiveFeedEntity::Company . '|' . CCrmLiveFeedEntity::Deal . ')(\\d+)$/', $arRight["GROUP_CODE"], $matches)) {
                 $entityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($matches[1]);
                 $entityID = $matches[2];
                 $entityName = CCrmOwnerType::ResolveName($entityTypeID);
                 $responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
                 if (!array_key_exists($entityName, $arEntities)) {
                     $arEntities[$entityName] = array();
                 }
                 if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0 && !array_key_exists($entityTypeID . "_" . $entityID, $arEntities[$entityName])) {
                     $arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => CCrmOwnerType::isOpened($entityTypeID, $entityID, false), "RESPONSIBLE_ID" => $responsible_id);
                 }
             }
         }
     }
     $arUserID = array();
     foreach ($arEntities as $entityName => $arTmp) {
         $sSql = "SELECT RL.RELATION, RP.ATTR \n\t\t\t\tFROM b_crm_role_relation RL \n\t\t\t\tINNER JOIN b_crm_role_perms RP ON RL.ROLE_ID = RP.ROLE_ID AND RP.ENTITY = '" . $entityName . "' AND RP.PERM_TYPE = 'READ'\n\t\t\t";
         $res = $DB->Query($sSql, false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
         while ($row = $res->Fetch()) {
             $user_id = false;
             switch ($row["ATTR"]) {
                 case BX_CRM_PERM_SELF:
                     foreach ($arTmp as $arEntity) {
                         $strSQL = "SELECT UA.USER_ID \n\t\t\t\t\t\t\tFROM b_user_access UA \n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tUA.USER_ID = " . intval($arEntity["RESPONSIBLE_ID"]) . "\n\t\t\t\t\t\t\t\tAND UA.ACCESS_CODE = '" . $DB->ForSQL($row["RELATION"]) . "'";
                         $rsUser = $DB->Query($strSQL, false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
                         if (($arUser = $rsUser->Fetch()) && !in_array($arUser["USER_ID"], $arUserID) && $arUser["USER_ID"] != $author_id) {
                             $arUserID[] = $arUser["USER_ID"];
                         }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:livefeed.php


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