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


PHP CTicket::PrepareFields方法代码示例

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


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

示例1: Set

 public static function Set($arFields, $id, $checkRights = true)
 {
     $err_mess = CAllTicketSLA::err_mess() . "<br>Function: Set<br>Line: ";
     global $DB, $USER, $APPLICATION;
     $id = intval($id);
     $table = "b_ticket_sla";
     $isDemo = $isSupportClient = $isSupportTeam = $isAdmin = $isAccess = $userID = null;
     CTicket::GetRoles($isDemo, $isSupportClient, $isSupportTeam, $isAdmin, $isAccess, $userID, $checkRights);
     if ($isAdmin) {
         $validDeadlineSource = !isset($arFields['DEADLINE_SOURCE']) || in_array($arFields['DEADLINE_SOURCE'], array('', 'DATE_CREATE'), true);
         if (CTicket::CheckFields($arFields, $id, array("NAME", "TIMETABLE_ID")) && $validDeadlineSource) {
             $arFields_i = CTicket::PrepareFields($arFields, $table, $id);
             if (intval($id) > 0) {
                 $DB->Update($table, $arFields_i, "WHERE ID=" . intval($id), $err_mess . __LINE__);
             } else {
                 $id = $DB->Insert($table, $arFields_i, $err_mess . __LINE__);
             }
             if (intval($id) > 0) {
                 if (is_set($arFields, "arGROUPS")) {
                     $DB->Query("DELETE FROM b_ticket_sla_2_user_group WHERE SLA_ID = {$id}", false, $err_mess . __LINE__);
                     if (is_array($arFields["arGROUPS"]) && count($arFields["arGROUPS"]) > 0) {
                         foreach ($arFields["arGROUPS"] as $groupID) {
                             $groupID = intval($groupID);
                             if ($groupID > 0) {
                                 $strSql = "INSERT INTO b_ticket_sla_2_user_group (SLA_ID, GROUP_ID) VALUES ({$id}, {$groupID})";
                                 $DB->Query($strSql, false, $err_mess . __LINE__);
                             }
                         }
                     }
                 }
                 if (is_set($arFields, "arSITES")) {
                     $DB->Query("DELETE FROM b_ticket_sla_2_site WHERE SLA_ID = {$id}", false, $err_mess . __LINE__);
                     if (is_array($arFields["arSITES"]) && count($arFields["arSITES"]) > 0) {
                         foreach ($arFields["arSITES"] as $siteID) {
                             //if (strlen($FIRST_SITE_ID)<=0) $FIRST_SITE_ID = $siteID;
                             $FIRST_SITE_ID = $siteID;
                             $siteID = $DB->ForSql($siteID);
                             $strSql = "INSERT INTO b_ticket_sla_2_site (SLA_ID, SITE_ID) VALUES ({$id}, '{$siteID}')";
                             $DB->Query($strSql, false, $err_mess . __LINE__);
                         }
                     }
                 }
                 if (is_set($arFields, "arCATEGORIES")) {
                     $DB->Query("DELETE FROM b_ticket_sla_2_category WHERE SLA_ID = {$id}", false, $err_mess . __LINE__);
                     if (is_array($arFields["arCATEGORIES"]) && count($arFields["arCATEGORIES"]) > 0) {
                         foreach ($arFields["arCATEGORIES"] as $categoryID) {
                             $categoryID = intval($categoryID);
                             $strSql = "INSERT INTO b_ticket_sla_2_category (SLA_ID, CATEGORY_ID) VALUES ({$id}, {$categoryID})";
                             $DB->Query($strSql, false, $err_mess . __LINE__);
                         }
                     }
                 }
                 if (is_set($arFields, "arCRITICALITIES")) {
                     $DB->Query("DELETE FROM b_ticket_sla_2_criticality WHERE SLA_ID = {$id}", false, $err_mess . __LINE__);
                     if (is_array($arFields["arCRITICALITIES"]) && count($arFields["arCRITICALITIES"]) > 0) {
                         foreach ($arFields["arCRITICALITIES"] as $criticalityID) {
                             $criticalityID = intval($criticalityID);
                             $strSql = "INSERT INTO b_ticket_sla_2_criticality (SLA_ID, CRITICALITY_ID) VALUES ({$id}, {$criticalityID})";
                             $DB->Query($strSql, false, $err_mess . __LINE__);
                         }
                     }
                 }
                 if (is_set($arFields, "arMARKS")) {
                     $DB->Query("DELETE FROM b_ticket_sla_2_mark WHERE SLA_ID = {$id}", false, $err_mess . __LINE__);
                     if (is_array($arFields["arMARKS"]) && count($arFields["arMARKS"]) > 0) {
                         foreach ($arFields["arMARKS"] as $markID) {
                             $markID = intval($markID);
                             $strSql = "INSERT INTO b_ticket_sla_2_mark (SLA_ID, MARK_ID) VALUES ({$id}, {$markID})";
                             $DB->Query($strSql, false, $err_mess . __LINE__);
                         }
                     }
                 }
                 /*
                 if (is_set($arFields, "arSHEDULE"))
                 {
                 	$DB->Query("DELETE FROM b_ticket_sla_shedule WHERE SLA_ID = $id", false, $err_mess.__LINE__);
                 	if (is_array($arFields["arSHEDULE"]) && count($arFields["arSHEDULE"])>0)
                 	{
                 		while(list($weekday, $arSHEDULE) = each($arFields["arSHEDULE"]))
                 		{
                 			$arF = array(
                 				"SLA_ID"			=> $id,
                 				"WEEKDAY_NUMBER"	=> intval($weekday),
                 				"OPEN_TIME"			=> "'".$DB->ForSql($arSHEDULE["OPEN_TIME"], 10)."'",
                 				);
                 			if ($arSHEDULE["OPEN_TIME"]=="CUSTOM" && is_array($arSHEDULE["CUSTOM_TIME"]) && count($arSHEDULE["CUSTOM_TIME"])>0)
                 			{
                 				foreach($arSHEDULE["CUSTOM_TIME"] as $ar)
                 				{
                 					if (strlen(trim($ar["MINUTE_FROM"]))>0 || strlen(trim($ar["MINUTE_TILL"]))>0)
                 					{
                 						$minute_from = strlen($ar["MINUTE_FROM"])>0 ? $ar["MINUTE_FROM"] : "00:00";
                 						$a = explode(":",$minute_from);
                 						$minute_from = intval($a[0]*60 + $a[1]);
                 						$arF["MINUTE_FROM"] = $minute_from;
                 
                 						$minute_till = strlen($ar["MINUTE_TILL"])>0 ? $ar["MINUTE_TILL"] : "23:59";
                 						$a = explode(":",$minute_till);
                 						$minute_till = intval($a[0]*60 + $a[1]);
                 						$arF["MINUTE_TILL"] = $minute_till;
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:sla.php


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