本文整理汇总了PHP中CTicket::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CTicket::GetByID方法的具体用法?PHP CTicket::GetByID怎么用?PHP CTicket::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTicket
的用法示例。
在下文中一共展示了CTicket::GetByID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: EMailMessageAdd
function EMailMessageAdd($arMessageFields, $ACTION_VARS)
{
$arActionVars = explode("&", $ACTION_VARS);
$countAr = count($arActionVars);
for ($i = 0; $i < $countAr; $i++) {
$v = $arActionVars[$i];
if ($pos = strpos($v, "=")) {
${substr($v, 0, $pos)} = urldecode(substr($v, $pos + 1));
}
}
if (!CModule::IncludeModule("support")) {
return false;
}
if (strlen($W_SUPPORT_SITE_ID) > 0) {
$rs = CSite::GetByID($W_SUPPORT_SITE_ID);
if ($ar = $rs->Fetch()) {
$SITE_ID = $ar["LID"];
}
}
if (strlen($SITE_ID) <= 0) {
$SITE_ID = $arMessageFields["LID"];
}
$sourceMail = COption::GetOptionString("support", "SOURCE_MAIL");
$dbr = CTicketDictionary::GetBySID($sourceMail, "SR", $SITE_ID);
if (!($ar = $dbr->Fetch())) {
return false;
}
$TICKET_SOURCE_ID = $ar["ID"];
$ID = $arMessageFields["ID"];
$message_email = strlen($arMessageFields["FIELD_REPLY_TO"]) > 0 ? $arMessageFields["FIELD_REPLY_TO"] : $arMessageFields["FIELD_FROM"];
$message_email_addr = strtolower(CMailUtil::ExtractMailAddress($message_email));
$TID = 0;
$arSubjects = explode("\n", trim($W_SUPPORT_SUBJECT));
$countAr = count($arSubjects);
for ($i = 0; $i < $countAr; $i++) {
$arSubjects[$i] = Trim($arSubjects[$i]);
if (strlen($arSubjects[$i]) > 0) {
if (preg_match("/" . $arSubjects[$i] . "/" . BX_UTF_PCRE_MODIFIER, $arMessageFields["SUBJECT"], $regs)) {
$TID = IntVal($regs[1]);
break;
}
}
}
if ($TID > 0) {
$db_ticket = CTicket::GetByID($TID, $SITE_ID, "N", "N", "N");
if ($ar_ticket = $db_ticket->Fetch()) {
//check user email address limits
if ($W_SUPPORT_SEC == "domain" || $W_SUPPORT_SEC == "email") {
$bEMailOK = false;
if ($TICKET_SOURCE_ID == $ar_ticket["SOURCE_ID"]) {
$ticket_email = strtolower(CMailUtil::ExtractMailAddress($ar_ticket["OWNER_SID"]));
if ($W_SUPPORT_SEC == "domain") {
$ticket_email = substr($ticket_email, strpos($ticket_email, "@"));
}
if (strpos($message_email_addr, $ticket_email) !== false) {
$bEMailOK = true;
}
}
if (!$bEMailOK && $ar_ticket["OWNER_USER_ID"] > 0) {
$db_user = CUser::GetByID($ar_ticket["OWNER_USER_ID"]);
if ($arUser = $db_user->Fetch()) {
$ticket_email = strtolower(CMailUtil::ExtractMailAddress($arUser["EMAIL"]));
if ($check_type == "domain") {
$ticket_email = substr($ticket_email, strpos($ticket_email, "@"));
}
if (strpos($message_email_addr, $ticket_email) !== false) {
$bEMailOK = true;
}
}
}
if (!$bEMailOK) {
$TID = 0;
}
}
} else {
$TID = 0;
}
}
//when message subject is empty - generate it from message body
$title = trim($arMessageFields["SUBJECT"]);
if (strlen($title) <= 0) {
$title = trim($arMessageFields["BODY"]);
$title = preg_replace("/[\n\r\t ]+/s" . BX_UTF_PCRE_MODIFIER, " ", $title);
$title = substr($title, 0, 50);
}
$arFieldsTicket = array("CLOSE" => "N", "TITLE" => $title, "MESSAGE" => $arMessageFields["BODY"], "MESSAGE_AUTHOR_SID" => $message_email, "MESSAGE_SOURCE_SID" => "email", "MODIFIED_MODULE_NAME" => "mail", "EXTERNAL_ID" => $ID, "EXTERNAL_FIELD_1" => $arMessageFields["HEADER"]);
if ($W_SUPPORT_USER_FIND == "Y") {
$o = "LAST_LOGIN";
$b = "DESC";
$res = CUser::GetList($o, $b, array("ACTIVE" => "Y", "=EMAIL" => $message_email_addr));
if (($arr = $res->Fetch()) && strtolower(CMailUtil::ExtractMailAddress($arr["EMAIL"])) == $message_email_addr) {
$AUTHOR_USER_ID = $arr["ID"];
}
}
// process attach files
$arFILES = array();
$rsAttach = CMailAttachment::GetList(array(), array("MESSAGE_ID" => $ID));
while ($arAttach = $rsAttach->Fetch()) {
// save from db to hdd
$filename = CTempFile::GetFileName(md5(uniqid("")) . ".tmp");
//.........这里部分代码省略.........
示例2: array
}
//Result array
$arResult = array("TICKET" => array(), "MESSAGES" => array(), "ONLINE" => array(), "DICTIONARY" => array("MARK" => array(), "CRITICALITY" => array(), "CRITICALITY_DEFAULT" => "", "CATEGORY" => array(), "CATEGORY_DEFAULT" => ""), "ERROR_MESSAGE" => $strError, "REAL_FILE_PATH" => strlen($_SERVER["REAL_FILE_PATH"]) > 0 ? htmlspecialcharsbx($_SERVER["REAL_FILE_PATH"]) : htmlspecialcharsbx($APPLICATION->GetCurPage()), "NAV_STRING" => "", "NAV_RESULT" => null, "OPTIONS" => array("ONLINE_INTERVAL" => intval(COption::GetOptionString("support", "ONLINE_INTERVAL")), "MAX_FILESIZE" => intval(COption::GetOptionString("support", "SUPPORT_MAX_FILESIZE"))));
$arParams["ID"] = intval($arParams["ID"]) > 0 ? intval($arParams["ID"]) : intval($_REQUEST["ID"]);
$UFA = array();
$UFAT = array();
if (isset($arParams["SET_SHOW_USER_FIELD"])) {
foreach ($arParams["SET_SHOW_USER_FIELD"] as $k => $v) {
if (strlen(trim($v)) > 0) {
$UFAT[$v] = array("NAME_C" => $arrUF[$v]["LIST_COLUMN_LABEL"], "NAME_F" => $arrUF[$v]["EDIT_FORM_LABEL"], "ALL" => $arrUF[$v]);
$UFA[] = $v;
}
}
}
$arParams["SET_SHOW_USER_FIELD_T"] = $UFAT;
$rsTicket = CTicket::GetByID($arParams["ID"], SITE_ID, $check_rights = "Y", $get_user_name = "N", $get_extra_names = "N", array("SELECT" => $UFA));
if ($arTicket = $rsTicket->GetNext()) {
foreach ($UFA as $k => $v) {
$arParams[$v] = $arTicket[$v];
}
//+Ticket and user names
$arResult["TICKET"] = $arTicket + _GetUserInfo($arTicket["RESPONSIBLE_USER_ID"], "RESPONSIBLE") + _GetUserInfo($arTicket["OWNER_USER_ID"], "OWNER") + _GetUserInfo($arTicket["CREATED_USER_ID"], "CREATED") + _GetUserInfo($arTicket["MODIFIED_USER_ID"], "MODIFIED_BY");
//Dictionary table
$arDictionary = array("C" => array("CATEGORY", intval($arTicket["CATEGORY_ID"])), "K" => array("CRITICALITY", intval($arTicket["CRITICALITY_ID"])), "S" => array("STATUS", intval($arTicket["STATUS_ID"])), "M" => array("MARK", intval($arTicket["MARK_ID"])), "SR" => array("SOURCE", intval($arTicket["SOURCE_ID"])));
//+Ticket dictionary
$arResult["TICKET"] += _GetDictionaryInfoEx($arDictionary);
//+Sla
$arResult["TICKET"]["SLA_NAME"] = $arResult["TICKET"]["SLA_DESCRIPTION"] = "";
$rsSla = CTicketSLA::GetByID($arTicket["SLA_ID"]);
if ($rsSla && ($arSla = $rsSla->Fetch())) {
$arResult["TICKET"]["SLA_NAME"] = htmlspecialcharsbx($arSla["NAME"]);
示例3: Set
//.........这里部分代码省略.........
}
if ($arFields["CLOSE"] == "Y" && strlen($v->arrOldFields["DATE_CLOSE"]) <= 0) {
$v->arChange["CLOSE"] = "Y";
} elseif ($arFields["CLOSE"] == "N" && strlen($v->arrOldFields["DATE_CLOSE"]) > 0) {
$v->arChange["OPEN"] = "Y";
}
if (array_key_exists("HOLD_ON", $arFields)) {
if ($v->arrOldFields["HOLD_ON"] == null) {
$v->arrOldFields["HOLD_ON"] = 'N';
}
if ($arFields["HOLD_ON"] == null) {
$arFields["HOLD_ON"] = 'N';
}
if ($v->arrOldFields["HOLD_ON"] != $arFields["HOLD_ON"]) {
if ($arFields["HOLD_ON"] == "Y") {
$v->arChange["HOLD_ON_ON"] = "Y";
} else {
$v->arChange["HOLD_ON_OFF"] = "Y";
}
}
unset($v->arrOldFields["HOLD_ON"]);
}
foreach ($v->arrOldFields as $key => $value) {
if (isset($arFields[$key])) {
if ($key === 'TITLE' && $value !== $arFields[$key]) {
$v->arChange[$key] = "Y";
} elseif (intval($value) != intval($arFields[$key])) {
$v->arChange[$key] = "Y";
}
}
}
// получим текущие значения обращения
CTimeZone::Disable();
$z = CTicket::GetByID($f->ID, $f->SITE_ID, "N");
CTimeZone::Enable();
if ($zr = $z->Fetch()) {
$nf = (object) $zr;
$rsSite = CSite::GetByID($nf->SITE_ID);
$v->arrSite = $rsSite->Fetch();
self::Set_sendMails($nf, $v, $arFields);
//if ($v->arChange['SLA_ID'] == 'Y' || $v->arChange['OPEN'] == 'Y') CTicketReminder::Update($nf->ID, true);
}
}
CTicket::ExecuteEvents('OnAfterTicketUpdate', $arFields, false);
}
} else {
// restrict to set SLA_ID directly, allow through events or automatically
if (isset($arFields['SLA_ID']) && !($v->bSupportTeam || $v->bAdmin || $v->bDemo || $v->bActiveCoupon)) {
unset($arFields['SLA_ID']);
}
$arFields = CTicket::ExecuteEvents('OnBeforeTicketAdd', $arFields, false);
if (!$arFields) {
return false;
}
if (!((strlen(trim($arFields["OWNER_SID"])) > 0 || intval($arFields["OWNER_USER_ID"]) > 0) && ($v->bSupportTeam || $v->bAdmin))) {
$f->OWNER_USER_ID = $v->uid > 0 ? $v->uid : null;
$f->OWNER_SID = null;
$f->OWNER_GUEST_ID = intval($_SESSION["SESS_GUEST_ID"]) > 0 ? intval($_SESSION["SESS_GUEST_ID"]) : null;
}
$f->FromArray($arFields, "CREATED_USER_ID,CREATED_MODULE_NAME,CATEGORY_ID,STATUS_ID,DIFFICULTY_ID,CRITICALITY_ID,SOURCE_ID,TITLE", array(CSupportTableFields::MORE0, CSupportTableFields::NOT_EMTY_STR));
if (!$f->CREATED_USER_ID) {
$f->set("CREATED_USER_ID", $v->uid, array(CSupportTableFields::MORE0));
}
$f->setCurrentTime("LAST_MESSAGE_DATE,DAY_CREATE,TIMESTAMP_X,DEADLINE_SOURCE_DATE");
$f->DATE_CREATE = time() + CTimeZone::GetOffset();
// если обращение создается сотрудником техподдержки, администратором или демо пользователем
示例4: CAdminException
if (!empty($arMsg)) {
$e = new CAdminException($arMsg);
$GLOBALS["APPLICATION"]->ThrowException($e);
return false;
}
return true;
}
/***************************************************************************
ќбработка GET | POST
***************************************************************************/
$TICKET_LIST_URL = strlen($TICKET_LIST_URL) > 0 ? $TICKET_LIST_URL : "ticket_list.php";
$TICKET_EDIT_URL = strlen($TICKET_EDIT_URL) > 0 ? $TICKET_EDIT_URL : "ticket_edit.php";
$TICKET_MESSAGE_EDIT_URL = strlen($TICKET_MESSAGE_EDIT_URL) > 0 ? $TICKET_MESSAGE_EDIT_URL : "ticket_message_edit.php";
$ID = intval($ID);
$TICKET_ID = intval($TICKET_ID);
$rsTicket = CTicket::GetByID($TICKET_ID, LANGUAGE_ID, "Y", "N", "N");
if ($arTicket = $rsTicket->Fetch()) {
CTicket::UpdateOnline($ID, $USER->GetID());
$arFiles = array();
if ($rsFiles = CTicket::GetFileList($v1 = "s_id", $v2 = "asc", array("MESSAGE_ID" => $ID))) {
while ($arFile = $rsFiles->Fetch()) {
$name = $arFile["ORIGINAL_NAME"];
if (strlen($arFile["EXTENSION_SUFFIX"]) > 0) {
$suffix_length = strlen($arFile["EXTENSION_SUFFIX"]);
$name = substr($name, 0, strlen($name) - $suffix_length);
}
$arFile["NAME"] = $name;
$arFiles[] = $arFile;
}
}
// если была нажата кнопка "save" на текущей странице
示例5: in_array
function in_array(needle, haystack)
{
for(k=0; k<haystack.length; k++) if (needle==haystack[k][0]) return true;
return false;
}
//-->
</script>
<?php
/***************************************************************************
SPLIT MESSAGE
****************************************************************************/
if (isset($_GET['TICKET_ID']) && isset($_GET['MESSAGE_ID'])) {
$_SESSION["TICKET_ID"] = IntVal($_GET['TICKET_ID']);
$_SESSION["MESSAGE_ID"] = IntVal($_GET['MESSAGE_ID']);
$ticket = CTicket::GetByID($_SESSION['TICKET_ID'], $site_id, "Y", $get_user_name, $get_extra_names);
if ($ticket && $ticket->ExtractFields()) {
$obUserTiket = $USER->GetByID($str_OWNER_USER_ID);
$arUserTiket = $obUserTiket->Fetch();
$str_OWNER_LOGIN = htmlspecialcharsbx($arUserTiket['LOGIN']);
$str_OWNER_NAME = htmlspecialcharsbx($arUserTiket['NAME']) . ' ' . htmlspecialcharsbx($arUserTiket['LAST_NAME']);
$str_lang = $TICKET_SITE = $str_SITE_ID;
$TICKET_SLA = $str_SLA_ID = CTicketSLA::GetForUser($str_SITE_ID, $str_OWNER_USER_ID);
$str_DIFFICULTY_ID = '';
$str_CRITICALITY_ID = '';
$obTicketMessage = CTicket::GetMessageByID($_SESSION['MESSAGE_ID']);
$arTicketMessage = $obTicketMessage->Fetch();
$MESSAGE = $arTicketMessage['MESSAGE'];
$_SESSION['MESSAGE_NUM'] = IntVal($arTicketMessage['C_NUMBER']);
$_SESSION['MESSAGE_DATE'] = $arTicketMessage['DATE_CREATE'];
$_SESSION["TICKET_TITLE"] = $str_TITLE;
示例6: Copyright
##############################################
# Bitrix: SiteManager #
# Copyright (c) 2002 Bitrix #
# http://www.bitrix.ru #
# mailto:admin@bitrix.ru #
##############################################
*/
define("STOP_STATISTICS", "Y");
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/include.php";
ClearVars();
$TICKET_ID = intval($TICKET_ID);
$url = $APPLICATION->GetCurPage() . "?TICKET_ID=" . $TICKET_ID . "&OWNER_USER_ID=" . intval($OWNER_USER_ID) . "&lang=" . LANGUAGE_ID . "&ONLINE_AUTO_REFRESH=" . intval($ONLINE_AUTO_REFRESH);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_popup_admin.php";
$lamp = CTicket::GetStatus($TICKET_ID);
$ticket = CTicket::GetByID($TICKET_ID);
$arTicket = $ticket->ExtractFields();
?>
<table cellspacing=0 cellpadding=0 class="support-online">
<?php
$mode = strlen($mode) > 0 ? $mode : false;
CTicket::UpdateOnline($TICKET_ID, false, $mode);
$rs = CTicket::GetOnline($TICKET_ID);
while ($ar = $rs->GetNext()) {
$is_support = "";
if (intval($OWNER_USER_ID) == $ar["USER_ID"]) {
$is_support = "N";
} elseif (CTicket::IsSupportTeam($ar["USER_ID"]) || CTicket::IsAdmin($ar["USER_ID"]) || CTicket::IsDemo($ar["USER_ID"])) {
$is_support = "Y";
}
?>
示例7: SupportDeadlineNotify
public static function SupportDeadlineNotify($arrTicket0)
{
//SUPPORT_DEADLINE_NOTIFY
//SUPPORT_DEADLINE = EXPIRATION_DATE
//SUPPORT_DEADLINE_STMP = EXPIRATION_DATE_STMP
$err_mess = CAllTicketReminder::err_mess() . "<br>Function: SupportDeadlineNotify<br>Line: ";
$rs = CTicket::GetByID($arrTicket0["ID"], false, "N");
if (!($arTicket = $rs->Fetch())) {
return false;
}
$rsMessage = CTicket::GetMessageByID(intval($arTicket["ID_1_USER_M_AFTER_SUP_M"]), "N", "N");
if (!($arMessage = $rsMessage->Fetch())) {
return false;
}
$arMessage["EXPIRATION_DATE"] = $arrTicket0["SUPPORT_DEADLINE"];
$arMessage["EXPIRATION_DATE_STMP"] = MakeTimeStamp($arMessage["EXPIRATION_DATE"]);
//$SUPPORT_DEADLINE_STMP = MakeTimeStamp($arrTicket0["SUPPORT_DEADLINE"]);
$rsSite = CSite::GetByID($arTicket["SITE_ID"]);
$arSite = $rsSite->Fetch();
global $MESS, $DB;
//$oldMess = $MESS;
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/support/classes/general/messages.php", $arSite["LANGUAGE_ID"]);
$sourceName = strlen($arTicket["SOURCE_NAME"]) <= 0 ? "" : "[" . $arTicket["SOURCE_NAME"] . "] ";
if (intval($arTicket["OWNER_USER_ID"]) > 0 || strlen(trim($arTicket["OWNER_LOGIN"])) > 0) {
$ownerText = "[" . $arTicket["OWNER_USER_ID"] . "] (" . $arTicket["OWNER_LOGIN"] . ") " . $arTicket["OWNER_NAME"];
//if(strlen(trim($OWNER_SID)) > 0 && $OWNER_SID != "null") $ownerText = " / " . $ownerText;
}
if (intval($arTicket["RESPONSIBLE_USER_ID"]) > 0) {
$responsibleText = "[" . $arTicket["RESPONSIBLE_USER_ID"] . "] (" . $arTicket["RESPONSIBLE_LOGIN"] . ") " . $arTicket["RESPONSIBLE_NAME"];
if (CTicket::IsSupportTeam($arTicket["RESPONSIBLE_USER_ID"]) || CTicket::IsAdmin($arTicket["RESPONSIBLE_USER_ID"])) {
$responsibleText .= " " . GetMessage("SUP_TECHSUPPORT_HINT");
}
}
$arAdminEMails = CTicket::GetAdminEmails();
if (count($arAdminEMails) > 0) {
$support_admin_email = implode(",", $arAdminEMails);
}
// prepare email to author
$arrOwnerEMail = array($arTicket["OWNER_EMAIL"]);
$arrEmails = explode(",", $arTicket["OWNER_SID"]);
if (is_array($arrEmails) && count($arrEmails) > 0) {
foreach ($arrEmails as $email) {
$email = trim($email);
if (strlen($email) > 0) {
preg_match_all("#[<\\[\\(](.*?)[>\\]\\)]#i" . BX_UTF_PCRE_MODIFIER, $email, $arr);
if (is_array($arr[1]) && count($arr[1]) > 0) {
foreach ($arr[1] as $email) {
$email = trim($email);
if (strlen($email) > 0 && !in_array($email, $arrOwnerEMail) && check_email($email)) {
$arrOwnerEMail[] = $email;
}
}
} elseif (!in_array($email, $arrOwnerEMail) && check_email($email)) {
$arrOwnerEMail[] = $email;
}
}
}
}
TrimArr($arrOwnerEMail);
$ownerEmail = implode(", ", $arrOwnerEMail);
// prepare email to support
$support_email = $arTicket["RESPONSIBLE_EMAIL"];
if (strlen($support_email) <= 0) {
$support_email = $support_admin_email;
}
if (strlen($support_email) <= 0) {
$support_email = COption::GetOptionString("main", "email_from", "");
}
$arr = explode(",", $support_email);
$arr = array_unique($arr);
$support_email = implode(",", $arr);
if (is_array($arr) && count($arr) > 0) {
foreach ($arr as $email) {
unset($arAdminEMails[$email]);
}
}
$support_admin_email = implode(",", $arAdminEMails);
$createdModuleName = "";
if ($arTicket["CREATED_MODULE_NAME"] == "support" || !strlen($arTicket["CREATED_MODULE_NAME"])) {
if (intval($arTicket["CREATED_USER_ID"]) > 0) {
$createdText = "[" . $arTicket["CREATED_USER_ID"] . "] (" . $arTicket["CREATED_LOGIN"] . ") " . $arTicket["CREATED_NAME"];
if (CTicket::IsSupportTeam($arTicket["CREATED_USER_ID"]) || CTicket::IsAdmin($arTicket["CREATED_USER_ID"])) {
$createdText .= " " . GetMessage("SUP_TECHSUPPORT_HINT");
}
}
} else {
$createdModuleName = "[" . $arTicket["CREATED_MODULE_NAME"] . "]";
}
$MESSAGE = PrepareTxtForEmail($arMessage["MESSAGE"], $arSite["LANGUAGE_ID"], false, false);
$remainedTime = $arMessage["EXPIRATION_DATE_STMP"] - time();
if ($remainedTime > 0) {
$strRemainedTime = "";
$hours = intval($remainedTime / 3600);
if ($hours > 0) {
$strRemainedTime .= $hours . " " . GetMessage("SUP_HOUR") . " ";
$remainedTime = $remainedTime - $hours * 3600;
}
$strRemainedTime .= intval($remainedTime / 60) . " " . GetMessage("SUP_MIN") . " ";
$strRemainedTime .= $remainedTime % 60 . " " . GetMessage("SUP_SEC");
}
//.........这里部分代码省略.........