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


PHP CForumFiles::getList方法代码示例

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


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

示例1: addCommentLists

 public static function addCommentLists($fields)
 {
     if (!CModule::IncludeModule('forum') || !CModule::IncludeModule('bizproc')) {
         return false;
     }
     $ufFileId = array();
     $ufDocId = array();
     $fieldsMessage = array();
     $messageId = array();
     $error = array();
     $note = array();
     $sonetLogQuery = CSocNetLog::GetList(array(), array('ID' => $fields['LOG_ID']), false, false, array('ID', 'SOURCE_ID', 'SITE_ID', 'MESSAGE', 'USER_ID'));
     if ($sonetLog = $sonetLogQuery->fetch()) {
         $users = CBPTaskService::getWorkflowParticipants($sonetLog['MESSAGE'], CBPTaskUserStatus::Waiting);
         if (preg_match_all("/(?<=\\[USER=)(?P<id>[0-9]+)(?=\\])/", $fields['TEXT_MESSAGE'], $matches)) {
             $users = array_unique(array_merge($users, $matches['id']));
         }
         $users[] = $sonetLog['USER_ID'];
         self::setSocnetFollow($users, $sonetLog['ID'], 'Y', false, true);
         $forumId = CBPHelper::getForumId();
         if ($forumId) {
             $topicQuery = CForumTopic::GetList(array(), array('FORUM_ID' => $forumId, 'XML_ID' => 'WF_' . $sonetLog['MESSAGE']));
             if ($topicQuery && ($topic = $topicQuery->fetch())) {
                 $topicId = $topic['ID'];
             } else {
                 $arTopic = array('AUTHOR_ID' => 0, 'TITLE' => 'WF_' . $sonetLog['MESSAGE'], 'TAGS' => '', 'MESSAGE' => 'WF_' . $sonetLog['MESSAGE'], 'XML_ID' => 'WF_' . $sonetLog['MESSAGE']);
                 $arUserStart = array("ID" => $arTopic["AUTHOR_ID"], "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
                 $GLOBALS["DB"]->StartTransaction();
                 $arTopicFields = array("TITLE" => $arTopic["TITLE"], "TAGS" => $arTopic["TAGS"], "FORUM_ID" => $forumId, "USER_START_ID" => $arUserStart["ID"], "USER_START_NAME" => $arUserStart["NAME"], "LAST_POSTER_NAME" => $arUserStart["NAME"], "XML_ID" => $arTopic["XML_ID"], "APPROVED" => "Y", "PERMISSION_EXTERNAL" => 'Q', "PERMISSION" => 'Y');
                 $topicId = CForumTopic::Add($arTopicFields);
                 if (intval($topicId) > 0) {
                     $arTopic['MESSAGE'] = strip_tags($arTopic['MESSAGE']);
                     $arFields = array("POST_MESSAGE" => $arTopic['MESSAGE'], "AUTHOR_ID" => $arUserStart["ID"], "AUTHOR_NAME" => $arUserStart["NAME"], "FORUM_ID" => $forumId, "TOPIC_ID" => $topicId, "APPROVED" => "Y", "NEW_TOPIC" => "Y", "PARAM1" => "WF", "PARAM2" => 0, "PERMISSION_EXTERNAL" => 'Q', "PERMISSION" => 'Y');
                     $startMessageId = CForumMessage::Add($arFields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N"));
                     if (intVal($startMessageId) <= 0) {
                         CForumTopic::Delete($topicId);
                         $topicId = 0;
                     }
                 }
                 if (intval($topicId) <= 0) {
                     $GLOBALS["DB"]->Rollback();
                 } else {
                     $GLOBALS["DB"]->Commit();
                 }
             }
             if ($topicId) {
                 $fieldsMessage = array('POST_MESSAGE' => $fields['TEXT_MESSAGE'], 'USE_SMILES' => 'Y', 'PERMISSION_EXTERNAL' => 'Q', 'PERMISSION' => 'Y', 'APPROVED' => 'Y');
                 $tmp = false;
                 $GLOBALS['USER_FIELD_MANAGER']->editFormAddFields('SONET_COMMENT', $tmp);
                 if (is_array($tmp)) {
                     if (array_key_exists('UF_SONET_COM_DOC', $tmp)) {
                         $GLOBALS['UF_FORUM_MESSAGE_DOC'] = $tmp['UF_SONET_COM_DOC'];
                     } elseif (array_key_exists('UF_SONET_COM_FILE', $tmp)) {
                         $fieldsMessage['FILES'] = array();
                         foreach ($tmp['UF_SONET_COM_FILE'] as $fileId) {
                             $fieldsMessage['FILES'][] = array('FILE_ID' => $fileId);
                         }
                     }
                     if (array_key_exists("UF_SONET_COM_URL_PRV", $tmp)) {
                         $GLOBALS["UF_FORUM_MES_URL_PRV"] = $tmp["UF_SONET_COM_URL_PRV"];
                     }
                 }
                 $messageId = ForumAddMessage("REPLY", $forumId, $topicId, 0, $fieldsMessage, $error, $note);
                 if ($messageId > 0) {
                     $addedMessageFilesQuery = CForumFiles::getList(array('ID' => 'ASC'), array('MESSAGE_ID' => $messageId));
                     while ($addedMessageFiles = $addedMessageFilesQuery->fetch()) {
                         $ufFileId[] = $addedMessageFiles['FILE_ID'];
                     }
                     $ufDocId = $GLOBALS['USER_FIELD_MANAGER']->getUserFieldValue('FORUM_MESSAGE', 'UF_FORUM_MESSAGE_DOC', $messageId, LANGUAGE_ID);
                     $ufUrlPreview = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFieldValue("FORUM_MESSAGE", "UF_FORUM_MES_URL_PRV", $messageID, LANGUAGE_ID);
                 }
             }
         }
     }
     if (!$messageId) {
         $error = Loc::getMessage('LISTS_LF_ADD_COMMENT_SOURCE_ERROR');
     }
     return array('SOURCE_ID' => $messageId, 'MESSAGE' => $fieldsMessage ? $fieldsMessage['POST_MESSAGE'] : false, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => $messageId, 'ERROR' => $error, 'NOTES' => $note, 'UF' => array('FILE' => $ufFileId, 'DOC' => $ufDocId, 'URL_PREVIEW' => $ufUrlPreview));
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:79,代码来源:livefeed.php

示例2: addCommentLists

 public static function addCommentLists($fields)
 {
     if (!CModule::IncludeModule('forum') || !CModule::IncludeModule('bizproc')) {
         return false;
     }
     $ufFileId = array();
     $ufDocId = array();
     $fieldsMessage = array();
     $messageId = array();
     $error = array();
     $note = array();
     $sonetLogQuery = CSocNetLog::GetList(array(), array('ID' => $fields['LOG_ID']), false, false, array('ID', 'SOURCE_ID', 'SITE_ID', 'MESSAGE', 'USER_ID'));
     if ($sonetLog = $sonetLogQuery->fetch()) {
         self::setSocnetFollow(array($sonetLog['USER_ID']), $sonetLog['ID'], 'Y');
         $forumId = CBPHelper::getForumId();
         if ($forumId) {
             $topicQuery = CForumTopic::GetList(array(), array('FORUM_ID' => $forumId, 'XML_ID' => 'WF_' . $sonetLog['MESSAGE']));
             if ($topicQuery && ($topic = $topicQuery->fetch())) {
                 $topicId = $topic['ID'];
             } else {
                 $topicId = 0;
             }
             $fieldsMessage = array('POST_MESSAGE' => $fields['TEXT_MESSAGE'], 'USE_SMILES' => 'Y', 'PERMISSION_EXTERNAL' => 'Q', 'PERMISSION' => 'Y', 'APPROVED' => 'Y');
             if ($topicId === 0) {
                 $fieldsMessage['TITLE'] = 'WF_' . $sonetLog['MESSAGE'];
                 $fieldsMessage['TOPIC_XML_ID'] = 'WF_' . $sonetLog['MESSAGE'];
             }
             $tmp = false;
             $GLOBALS['USER_FIELD_MANAGER']->editFormAddFields('SONET_COMMENT', $tmp);
             if (is_array($tmp)) {
                 if (array_key_exists('UF_SONET_COM_DOC', $tmp)) {
                     $GLOBALS['UF_FORUM_MESSAGE_DOC'] = $tmp['UF_SONET_COM_DOC'];
                 } elseif (array_key_exists('UF_SONET_COM_FILE', $tmp)) {
                     $fieldsMessage['FILES'] = array();
                     foreach ($tmp['UF_SONET_COM_FILE'] as $fileId) {
                         $fieldsMessage['FILES'][] = array('FILE_ID' => $fileId);
                     }
                 }
             }
             $messageId = ForumAddMessage($topicId > 0 ? "REPLY" : "NEW", $forumId, $topicId, 0, $fieldsMessage, $error, $note);
             if ($messageId > 0) {
                 $addedMessageFilesQuery = CForumFiles::getList(array('ID' => 'ASC'), array('MESSAGE_ID' => $messageId));
                 while ($addedMessageFiles = $addedMessageFilesQuery->fetch()) {
                     $ufFileId[] = $addedMessageFiles['FILE_ID'];
                 }
                 $ufDocId = $GLOBALS['USER_FIELD_MANAGER']->getUserFieldValue('FORUM_MESSAGE', 'UF_FORUM_MESSAGE_DOC', $messageId, LANGUAGE_ID);
             }
         }
     }
     if (!$messageId) {
         $error = Loc::getMessage('LISTS_LF_ADD_COMMENT_SOURCE_ERROR');
     }
     return array('SOURCE_ID' => $messageId, 'MESSAGE' => $fieldsMessage ? $fieldsMessage['POST_MESSAGE'] : false, 'RATING_TYPE_ID' => 'FORUM_POST', 'RATING_ENTITY_ID' => $messageId, 'ERROR' => $error, 'NOTES' => $note, 'UF' => array('FILE' => $ufFileId, 'DOC' => $ufDocId));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:54,代码来源:livefeed.php


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