當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CIntranetUtils::makeGUID方法代碼示例

本文整理匯總了PHP中CIntranetUtils::makeGUID方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIntranetUtils::makeGUID方法的具體用法?PHP CIntranetUtils::makeGUID怎麽用?PHP CIntranetUtils::makeGUID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CIntranetUtils的用法示例。


在下文中一共展示了CIntranetUtils::makeGUID方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: UpdateListItems

	public function UpdateListItems($listName, $updates)
	{
		global $USER;

		$arStatusValues = array_flip($this->arStatusValues);
		$arPriorityValues = array_flip($this->arPriorityValues);

		if (!$listName_original = CIntranetUtils::checkGUID($listName))
			return new CSoapFault('Data error', 'Wrong GUID - '.$listName);

		$obResponse = new CXMLCreator('Results');

		$listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
		$arSections = CCalendarSect::GetList(array('arFilter' => array('XML_ID' => $listName_original)));
		if (!$arSections || !is_array($arSections[0]))
			return new CSoapFault(
				'List not found',
				'List with '.$listName.' GUID not found'
			);
		$arSection = $arSections[0];

		$bGroup = $arSection['CAL_TYPE'] == 'group';
		$calType = $arSection['CAL_TYPE'];
		$ownerId = $arSection['OWNER_ID'];

		if ($bGroup)
		{
			CModule::IncludeModule('socialnetwork');
			$arGroupTmp = CSocNetGroup::GetByID($arSection['SOCNET_GROUP_ID']);
			if ($arGroupTmp["CLOSED"] == "Y")
				if (COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y")
					return new CSoapFault('Cannot modify archive group calendar', 'Cannot modify archive group calendar');
		}

		$obBatch = $updates->children[0];
		$atrONERROR = $obBatch->getAttribute('OnError');
		$atrDATEINUTC = $obBatch->getAttribute('DateInUtc');
		$atrPROPERTIES = $obBatch->getAttribute('Properties');

		$arChanges = $obBatch->children;

		$arResultIDs = array();
		$dateStart = ConvertTimeStamp(strtotime('-1 hour'), 'FULL');
		$arResponseRows = array();
		$arReplicationIDs = array();
		$userId = (is_object($USER) && $USER->GetID()) ? $USER->GetID() : 1;

		foreach ($arChanges as $obMethod)
		{
			$arData = array('_command' => $obMethod->getAttribute('Cmd'));

			foreach ($obMethod->children as $obField)
			{
				$name = $obField->getAttribute('Name');
				if ($name == 'MetaInfo')
					$name .= '_'.$obField->getAttribute('Property');

				$arData[$name] = $obField->content;
			}

			if ($arData['_command'] == 'Delete')
			{
				$obRes = new CXMLCreator('Result');
				$obRes->setAttribute('ID', $obMethod->getAttribute('ID').','.$arData['_command']);
				$obRes->setAttribute('List', $listName);
				$obRes->addChild($obNode = new CXMLCreator('ErrorCode'));

				$res = CCalendar::DeleteEvent($arData['ID']);
				if ($res === true)
					$obNode->setData('0x00000000');
				else
					$obNode->setData('0x81020014');

				/*
					0x00000000 - ok
					0x81020015 - data conflict
					0x81020014 - generic error such as invalid value for Field
					0x81020016 - item does not exist
				*/

				$obResponse->addChild($obRes);
			}
			elseif ($arData['_command'] == 'New' || $arData['_command'] == 'Update')
			{
				$q = ToLower($arData['Description']);
				if (($pos = strrpos($q, '</body>')) !== false) $arData['Description'] = substr($arData['Description'], 0, $pos);
				if (($pos = strpos($q, '<body>')) !== false) $arData['Description'] = substr($arData['Description'], $pos + 6);

				$arData['Description'] = str_replace('</DIV>', "\r\n</DIV>", $arData['Description']);
				$arData['Description'] = str_replace(array("&#10;", "&#13;"), "", $arData['Description']);
				$arData['Description'] = preg_replace("/<![^>]*>/", '', $arData['Description']);
				//$arData['Description'] = strip_tags($arData['Description']);
				$arData['Description'] = trim($arData['Description']);

				$arData['Location'] = trim($arData['Location']);

				if (isset($arData['EventDate']))
				{
					$arData['EventDate'] = $this->__makeTS($arData['EventDate']);
					$arData['EndDate'] = $this->__makeTS($arData['EndDate']) + ($arData['fAllDayEvent'] ? -86340 : 0);
//.........這裏部分代碼省略.........
開發者ID:ASDAFF,項目名稱:bxApiDocs,代碼行數:101,代碼來源:webservice.php

示例2: GetStsSyncURL

 function GetStsSyncURL($arSectionParams, $type = 'calendar', $employees = false)
 {
     global $USER, $APPLICATION;
     if (!is_array($arSectionParams)) {
         $arSectionParams = array('ID' => intval($arSectionParams));
     }
     //if (!$arSectionParams['ID'])
     //	return false;
     $arAllowedTypes = array('calendar', 'tasks', 'contacts');
     if (!in_array($type, $arAllowedTypes)) {
         $type = 'calendar';
     }
     if ($type == 'calendar') {
         $calendar2 = COption::GetOptionString("intranet", "calendar_2", "N") == "Y" && CModule::IncludeModule("calendar");
         $fld_EXTERNAL_ID = 'XML_ID';
         if ($calendar2) {
             // $arSectionParams = array(
             // 'ID' => int
             // 'XML_ID' => string
             // 'NAME' => string
             // 'PREFIX' => string
             // 'LINK_URL' => string
             // 'TYPE' => string
             // )
             if (strlen($arSectionParams['XML_ID']) !== 32) {
                 $arSectionParams[$fld_EXTERNAL_ID] = md5($arSectionParams['TYPE'] . '_' . $arSectionParams['ID'] . '_' . RandString(8));
                 // Set XML_ID
                 CCalendar::SaveSection(array('arFields' => array('ID' => $arSectionParams['ID'], 'XML_ID' => $arSectionParams[$fld_EXTERNAL_ID]), 'bAffectToDav' => false, 'bCheckPermissions' => false));
             }
         } else {
             if (!$arSectionParams['IBLOCK_ID'] || !$arSectionParams['NAME'] || !$arSectionParams[$fld_EXTERNAL_ID]) {
                 $dbRes = CIBlockSection::GetByID($arSectionParams['ID']);
                 $arSection = $dbRes->Fetch();
                 if ($arSection) {
                     $arSectionParams['IBLOCK_ID'] = $arSection['IBLOCK_ID'];
                     $arSectionParams['NAME'] = $arSection['NAME'];
                     $arSectionParams[$fld_EXTERNAL_ID] = $arSection[$fld_EXTERNAL_ID];
                 } else {
                     return false;
                 }
             }
             if (strlen($arSectionParams[$fld_EXTERNAL_ID]) !== 32) {
                 $arSectionParams[$fld_EXTERNAL_ID] = md5($arSectionParams['IBLOCK_ID'] . '_' . $arSectionParams['ID'] . '_' . RandString(8));
                 $obSect = new CIBlockSection();
                 if (!$obSect->Update($arSectionParams['ID'], array($fld_EXTERNAL_ID => $arSectionParams[$fld_EXTERNAL_ID]), false, false)) {
                     return false;
                 }
             }
         }
         if (!$arSectionParams['PREFIX']) {
             $rsSites = CSite::GetByID(SITE_ID);
             $arSite = $rsSites->Fetch();
             if (strlen($arSite["NAME"]) > 0) {
                 $arSectionParams['PREFIX'] = $arSite["NAME"];
             } else {
                 $arSectionParams['PREFIX'] = COption::GetOptionString('main', 'site_name', GetMessage('INTR_OUTLOOK_PREFIX_CONTACTS'));
             }
         }
         $GUID = CIntranetUtils::makeGUID($arSectionParams[$fld_EXTERNAL_ID]);
     } elseif ($type == 'contacts') {
         if (!$arSectionParams['LINK_URL']) {
             if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'contacts/';
             } else {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'company/';
             }
         }
         if (!$arSectionParams['NAME']) {
             if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite() && !$employees) {
                 $arSectionParams['NAME'] = GetMessage('INTR_OUTLOOK_TITLE_CONTACTS_EXTRANET');
             } else {
                 $arSectionParams['NAME'] = GetMessage('INTR_OUTLOOK_TITLE_CONTACTS');
             }
         }
         if (!$arSectionParams['PREFIX']) {
             $rsSites = CSite::GetByID(SITE_ID);
             $arSite = $rsSites->Fetch();
             if (strlen($arSite["NAME"]) > 0) {
                 $arSectionParams['PREFIX'] = $arSite["NAME"];
             } else {
                 $arSectionParams['PREFIX'] = COption::GetOptionString('main', 'site_name', GetMessage('INTR_OUTLOOK_PREFIX_CONTACTS'));
             }
         }
         $SERVER_NAME = $_SERVER['SERVER_NAME'];
         $GUID_DATA = $SERVER_NAME . '|' . $type;
         if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
             $GUID_DATA .= "|extranet";
             if ($employees) {
                 $GUID_DATA .= "|employees";
             }
         }
         $GUID = CIntranetUtils::makeGUID(md5($GUID_DATA));
     } elseif ($type == 'tasks') {
         if (!$arSectionParams['LINK_URL']) {
             if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'contacts/personal/user/' . $USER->GetID() . '/tasks/';
             } else {
                 $arSectionParams['LINK_URL'] = SITE_DIR . 'company/personal/user/' . $USER->GetID() . '/tasks/';
             }
         }
//.........這裏部分代碼省略.........
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:101,代碼來源:utils.php

示例3: GetAttachmentCollection

 function GetAttachmentCollection($listName, $listItemID)
 {
     $start = microtime(true);
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     $listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
     $listItemID = intval($listItemID);
     $dbRes = CUser::GetByID($listItemID);
     //$dbRes = CUser::GetList(($by="id"), ($order="asc"), array("ID_EQUAL_EXACT"=>IntVal($listItemID)));
     //$dbRes = $GLOBALS['DB']->Query('SELECT PERSONAL_PHOTO FROM b_user WHERE id=\''.$listItemID.'\'');
     $obData = new CXMLCreator('Attachments');
     if (($arUser = $dbRes->Fetch()) && $arUser['PERSONAL_PHOTO']) {
         $arImage = self::InitImage($arUser['PERSONAL_PHOTO'], 100, 100);
         $obData->addChild($obAttachment = new CXMLCreator('Attachment'));
         $obAttachment->setData(CHTTP::URN2URI($arImage['CACHE']['src']));
         //$data = '<Attachments><Attachment>http://'.$_SERVER['SERVER_NAME'].$arImage['CACHE']['src'].'</Attachment></Attachments>';
     }
     // else
     // {
     // $data = '<Attachments></Attachments>';
     // }
     //return array('GetAttachmentCollectionResult' => $data);
     return array('GetAttachmentCollectionResult' => $obData);
 }
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:25,代碼來源:ws_contacts.php

示例4: UpdateItems

 public static function UpdateItems($arRows)
 {
     list(, $row) = each($arRows);
     $IBLOCK_ID = $row['IBLOCK_ID'];
     $PRIORITY = $row['PRIORITY'];
     $dbRes = CIntranetSharepoint::GetByID($IBLOCK_ID, true);
     if ($arService = $dbRes->Fetch()) {
         if (!self::CheckService($arService, 'UpdateListItems')) {
             return false;
         }
         $arIDs = array();
         $arSelect = array('ID', 'XML_ID');
         foreach ($arRows as $row) {
             $arIDs[] = $row['ELEMENT_ID'];
         }
         foreach ($arService['FIELDS'] as $fld) {
             $arSelect[] = $fld['FIELD_ID'];
         }
         $dbRes = CIBlockElement::GetList(array(), array('IBLOCK_ID' => $IBLOCK_ID, 'ID' => $arIDs), false, false, $arSelect);
         $arChanges = array();
         $arChangesIDs = array();
         while ($obItem = $dbRes->GetNextElement()) {
             $arItem = $obItem->GetFields();
             $arProp = $obItem->GetProperties();
             $arChange = array();
             foreach ($arService['FIELDS'] as $fld) {
                 if (substr($fld['FIELD_ID'], 0, 9) === 'PROPERTY_') {
                     $fld['FIELD_ID'] .= '_VALUE';
                 }
                 if ($val = self::_UpdateGetValueByType($arItem[$fld['FIELD_ID']], $fld['SP_FIELD_TYPE'])) {
                     $arChange[$fld['SP_FIELD']] = $val;
                 }
             }
             if ($arItem['XML_ID'] && $arItem['XML_ID'] != $arItem['ID']) {
                 $arChangesIDs[] = $arItem['XML_ID'];
                 $arChange['UniqueId'] = $arItem['XML_ID'];
                 $arChange['ID'] = intval($arItem['XML_ID']);
             }
             foreach ($arProp as $prop) {
                 if ($prop['CODE'] == 'OWSHIDDENVERSION') {
                     $arChange['owshiddenversion'] = $prop['VALUE'];
                     $arChange['Metainfo_vti_versionhistory'] = md5($prop['VALUE'] . '|' . $arItem['XML_ID']) . ':' . $prop['VALUE'];
                 }
             }
             $arItemsMap = array();
             if (!$arChange['UniqueId']) {
                 $arChange['ReplicationID'] = CIntranetUtils::makeGUID(md5($arItem['ID']));
                 $arChanges[$arChange['ReplicationID']] = $arChange;
                 $arItemsMap[$arChange['ReplicationID']] = $arItem['ID'];
             } else {
                 $arChanges[$arChange['ID']] = $arChange;
                 $arItemsMap[$arChange['ID']] = $arItem['ID'];
             }
         }
         $handler = new $arService['HANDLER_CLASS']($arService['SP_URL']);
         $RESULT = $handler->GetByID(CIntranetUtils::makeGUID($arService['SP_LIST_ID']), $arChangesIDs);
         if (count($RESULT) > 0) {
             foreach ($RESULT as $sp_row) {
                 foreach ($sp_row as $fld => $val) {
                     if (!isset($arChanges[$sp_row['ID']][$fld])) {
                         $arChanges[$sp_row['ID']][$fld] = $val;
                     }
                 }
             }
         }
         $arSecondQuery = array();
         $arQueue = array();
         CIntranetSharepoint::$bUpdateInProgress = true;
         if ($RESULT = $handler->UpdateListItems(CIntranetUtils::makeGUID($arService['SP_LIST_ID']), $arChanges)) {
             foreach ($RESULT as $res) {
                 $ID = 0;
                 $arUpdateFields = array();
                 $arUpdateProps = array();
                 // version conflict
                 if ($res['ErrorCode'] == '0x81020015') {
                     if ($PRIORITY == 'B') {
                         $new_version = $res['Row']['owshiddenversion'];
                         $arChange = $arChanges[$res['Row']['ID']];
                         $arChange['owshiddenversion'] = $new_version;
                         $arSecondQuery[] = $arChange;
                         $arUpdateProps['OWSHIDDENVERSION'] = $new_version;
                         $ID = $arItemsMap[$res['Row']['ID']];
                     } else {
                         self::_Sync($arService, $res['Row'], $arQueue);
                     }
                 }
                 if ($res['Row']['MetaInfo_ReplicationID']) {
                     $arUpdateFields['XML_ID'] = $res['Row']['UniqueId'];
                     $arUpdateProps['OWSHIDDENVERSION'] = $res['Row']['owshiddenversion'];
                     $ID = $arItemsMap[$res['Row']['MetaInfo_ReplicationID']];
                 }
                 if ($ID > 0) {
                     if (count($arUpdateFields) > 0) {
                         $ob = new CIBlockElement();
                         $ob->Update($ID, $arUpdateFields);
                     }
                     if (count($arUpdateProps) > 0) {
                         CIBlockElement::SetPropertyValuesEx($ID, false, $arUpdateProps);
                     }
                 }
//.........這裏部分代碼省略.........
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:101,代碼來源:sharepoint.php

示例5: UpdateListItems

 function UpdateListItems($listName, $updates)
 {
     global $USER, $DB;
     $arPaths = array('user' => COption::GetOptionString('intranet', 'path_task_user_entry', '/company/personal/user/#USER_ID#/tasks/task/view/#TASK_ID#/'), 'group' => COption::GetOptionString('intranet', 'path_task_group_entry', '/workgroups/group/#GROUP_ID#/tasks/task/view/#TASK_ID#/'));
     if (!$this->__Init()) {
         return $this->error;
     }
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     $listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
     $obResponse = new CXMLCreator('Results');
     $obBatch = $updates->children[0];
     $atrONERROR = $obBatch->getAttribute('OnError');
     $atrDATEINUTC = $obBatch->getAttribute('DateInUtc');
     $atrPROPERTIES = $obBatch->getAttribute('Properties');
     $arChanges = $obBatch->children;
     $arResultIDs = array();
     $dateStart = ConvertTimeStamp(strtotime('-1 hour'), 'FULL');
     $arResponseRows = array();
     $arResponseRowsError = array();
     $arReplicationIDs = array();
     foreach ($arChanges as $obMethod) {
         $arData = array('_command' => $obMethod->getAttribute('Cmd'));
         $ID = false;
         $bUpdate = true;
         $arElement = false;
         $arSection = $this->arUsersSection;
         foreach ($obMethod->children as $obField) {
             $name = $obField->getAttribute('Name');
             if ($name == 'MetaInfo') {
                 $name .= '_' . $obField->getAttribute('Property');
             }
             $arData[$name] = $obField->content;
         }
         $obResponseRow = new CXMLCreator('Result');
         $obResponseRow->setAttribute('ID', $obMethod->getAttribute('ID') . ',' . $arData['_command']);
         $obResponseRow->setAttribute('List', $listName);
         $obResponseRow->addChild($obErrorCode = new CXMLCreator('ErrorCode'));
         if ($arData['ID'] > 0) {
             $rsElement = CTasks::GetById($arData['ID']);
             if ($rsElement && ($arElement = $rsElement->Fetch())) {
                 if (!is_array($arElement)) {
                     $obErrorCode->setData('0x81020016');
                     $bUpdate = false;
                 } else {
                     if ($arElement['taskType'] == "group") {
                         $arGroupTmp = CSocNetGroup::GetByID($arElement['ownerId']);
                         if ($arGroupTmp["CLOSED"] == "Y") {
                             if (COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y") {
                                 return new CSoapFault('Cannot modify archive group task', 'Cannot modify archive group task');
                             }
                         }
                     }
                     $arElement['arParams'] = array(intval($arElement['GROUP_ID']) > 0 ? 'PATH_TO_USER_TASKS_TASK' : 'PATH_TO_GROUP_TASKS_TASK' => str_replace(array('#USER_ID#', '#GROUP_ID#', '#TASK_ID#'), array($USER->GetID(), $arSection['XML_ID'], $arElement['ID']), $arPaths[$arElement['taskType']]));
                 }
             } else {
                 $obErrorCode->setData('0x81020016');
                 $bUpdate = false;
             }
         }
         if ($bUpdate) {
             if ($arData['_command'] == 'Delete' && $arElement["CREATED_BY"] == $USER->GetID()) {
                 $arError = false;
                 if (!CTasks::Delete($arElement['ID'])) {
                     $obErrorCode->setData('0x81020014');
                 } else {
                     $obErrorCode->setData('0x00000000');
                 }
             } elseif ($arData['_command'] == 'New' || $arData['_command'] == 'Update') {
                 $arData['Body'] = trim($arData['Body']);
                 $arData['Body'] = str_replace(array("&#10;", "&#13;", '&nbsp;'), "", $arData['Body']);
                 $arData['Body'] = preg_replace("/<![^>]*>/", '', $arData['Body']);
                 if (($pos = strpos($arData['Body'], '<BODY>')) !== false) {
                     $arData['Body'] = substr($arData['Body'], $pos + 6);
                 }
                 echo $pos . ' ';
                 if (($pos = strpos($arData['Body'], '</BODY>')) !== false) {
                     $arData['Body'] = substr($arData['Body'], 0, $pos);
                 }
                 echo $pos . ' ';
                 $TZBias = intval(date('Z'));
                 $arData['StartDate'] = $arData['StartDate'] ? $this->__makeTS($arData['StartDate']) + $TZBias : '';
                 $arData['DueDate'] = $arData['DueDate'] ? $this->__makeTS($arData['DueDate']) + $TZBias : '';
                 $arData['MetaInfo_DateComplete'] = $arData['MetaInfo_DateComplete'] ? $this->__makeTS($arData['EndDate']) + $TZBias : '';
                 $probablyHtmlInDescription = strpos($arData['Body'], '<') !== false && strpos($arData['Body'], '>');
                 $arFields = array('DESCRIPTION_IN_BBCODE' => $probablyHtmlInDescription ? 'N' : 'Y', 'CHANGED_BY' => $USER->GetID(), 'CHANGED_DATE' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), time()), 'SITE_ID' => SITE_ID, 'TITLE' => $arData['Title'], 'START_DATE_PLAN' => $arData['StartDate'] ? ConvertTimeStamp($arData['StartDate']) : '', 'DEADLINE' => $arData['DueDate'] ? ConvertTimeStamp($arData['DueDate']) : '', 'DESCRIPTION' => $arData['Body'], 'PRIORITY' => isset($arData['Priority']) ? intval($arData['Priority']) : 1, 'DURATION_PLAN' => $arData['MetaInfo_TotalWork'] / 60, 'DURATION_FACT' => $arData['MetaInfo_ActualWork'] / 60, 'CLOSED_DATE' => $arData['MetaInfo_DateComplete'] ? ConvertTimeStamp($arData['MetaInfo_DateComplete']) : '');
                 if (in_array($arData['Status'], $this->arStatuses)) {
                     $arFields["STATUS"] = $arData['Status'];
                 }
                 if ($assigned_to = $arData['AssignedTo']) {
                     if ($USER_ID = $this->__getUser($assigned_to)) {
                         $arFields['RESPONSIBLE_ID'] = $USER_ID;
                     } else {
                         $obErrorCode->setData('0x81020054');
                         $bUpdate = false;
                     }
                 } else {
                     $arFields['RESPONSIBLE_ID'] = $USER->getId();
                 }
//.........這裏部分代碼省略.........
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:101,代碼來源:taskwebservice.php

示例6: UpdateListItems

 function UpdateListItems($listName, $updates)
 {
     global $USER;
     $arPaths = array('user' => COption::GetOptionString('intranet', 'path_task_user_entry', '/company/personal/user/#USER_ID#/tasks/task/view/#TASK_ID#/'), 'group' => COption::GetOptionString('intranet', 'path_task_group_entry', '/workgroups/group/#GROUP_ID#/tasks/task/view/#TASK_ID#/'));
     if (!$this->__Init()) {
         return $this->error;
     }
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     $listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
     // one more dirty hack. now for bx.
     //define('BX_INTASKS_FROM_COMPONENT', true);
     //CModule::IncludeModule('socialnetwork');
     //include($_SERVER['DOCUMENT_ROOT'].BX_PERSONAL_ROOT.'/components/bitrix/intranet.tasks/init.php');
     //include($_SERVER['DOCUMENT_ROOT'].BX_PERSONAL_ROOT.'/components/bitrix/intranet.tasks/action.php');
     $obResponse = new CXMLCreator('Results');
     $arStatusValues = array();
     $obStatus = CIBlockProperty::GetPropertyEnum('TaskStatus', array('SORT' => 'asc'), array('IBLOCK_ID' => $this->IBLOCK_ID));
     while ($arStatus = $obStatus->Fetch()) {
         $arStatusValues[$arStatus['XML_ID']] = $arStatus['ID'];
         if ($arStatus['XML_ID'] == 'NotAccepted') {
             $arStatusValues[$arStatus['VALUE']] = $arStatus['ID'];
         }
     }
     /*
     $arPriorityValues = array();
     $obPriority = CIBlockProperty::GetPropertyEnum('TaskPriority', array('SORT' => 'asc'), array('IBLOCK_ID' => $this->IBLOCK_ID));
     while ($arPriority = $obPriority->Fetch())
     	$arPriorityValues[$arPriority['XML_ID']] = $arPriority['ID'];
     */
     $arPriorityValues = array_flip($this->arProperties['TaskPriority']['VARIANTS_ID']);
     $arStatusValues = array_flip($this->arProperties['TaskStatus']['VARIANTS_ID']);
     $arStatusXML_ID = array_flip($this->arProperties['TaskStatus']['VARIANTS']);
     $obBatch = $updates->children[0];
     $atrONERROR = $obBatch->getAttribute('OnError');
     $atrDATEINUTC = $obBatch->getAttribute('DateInUtc');
     $atrPROPERTIES = $obBatch->getAttribute('Properties');
     $arChanges = $obBatch->children;
     $arResultIDs = array();
     $dateStart = ConvertTimeStamp(strtotime('-1 hour'), 'FULL');
     $arResponseRows = array();
     $arResponseRowsError = array();
     $arReplicationIDs = array();
     foreach ($arChanges as $obMethod) {
         $arData = array('_command' => $obMethod->getAttribute('Cmd'));
         $ID = false;
         $bUpdate = true;
         $arElement = false;
         $arSection = $this->arUsersSection;
         foreach ($obMethod->children as $obField) {
             $name = $obField->getAttribute('Name');
             if ($name == 'MetaInfo') {
                 $name .= '_' . $obField->getAttribute('Property');
             }
             $arData[$name] = $obField->content;
         }
         $obResponseRow = new CXMLCreator('Result');
         $obResponseRow->setAttribute('ID', $obMethod->getAttribute('ID') . ',' . $arData['_command']);
         $obResponseRow->setAttribute('List', $listName);
         $obResponseRow->addChild($obErrorCode = new CXMLCreator('ErrorCode'));
         if ($arData['ID'] > 0) {
             //$dbRes = CIBlockElement::GetByID($arData['ID']);
             $arElement = CIntranetTasks::GetById($arData['ID']);
             if (!is_array($arElement)) {
                 $obErrorCode->setData('0x81020016');
                 $bUpdate = false;
             } else {
                 //$arElement = $obElement->GetFields();
                 //$arElement['prop'] = $obElement->GetProperties();
                 if ($arElement['IBLOCK_SECTION_ID'] != $arSection['ID']) {
                     if (!($arSection = $this->__getSection($arElement['IBLOCK_SECTION_ID']))) {
                         return new CSoapFault('Some error', 'Unknown error with iblock sections');
                     }
                 }
                 // don't forget about depth of sections, Max has modification
                 if ($arElement['taskType'] == "group") {
                     $arGroupTmp = CSocNetGroup::GetByID($arElement['ownerId']);
                     if ($arGroupTmp["CLOSED"] == "Y") {
                         if (COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y") {
                             return new CSoapFault('Cannot modify archive group task', 'Cannot modify archive group task');
                         }
                     }
                 }
                 $arElement['arParams'] = array($arElement['taskType'] == 'user' ? 'PATH_TO_USER_TASKS_TASK' : 'PATH_TO_GROUP_TASKS_TASK' => str_replace(array('#USER_ID#', '#GROUP_ID#', '#TASK_ID#'), array($USER->GetID(), $arSection['XML_ID'], $arElement['ID']), $arPaths[$arElement['taskType']]));
             }
         }
         if ($bUpdate) {
             if ($arData['_command'] == 'Delete') {
                 $arError = false;
                 if (CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_DELETE_DOCUMENT, $USER->GetID(), $arElement['ID'], array())) {
                     if (!CIntranetTasks::Delete($arElement['ID'], $arError)) {
                         $obErrorCode->setData('0x81020014');
                     } else {
                         $obErrorCode->setData('0x00000000');
                     }
                 } else {
                     $obErrorCode->setData('0x81020014');
                 }
                 /*
//.........這裏部分代碼省略.........
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:101,代碼來源:ws_tasks.php

示例7: GetMessage

: </td>
		<td>********</td>
	</tr>
	<tr class="section">
		<td colspan="2"><?php 
echo GetMessage('SL_SETTINGS_SECTION_SYNC');
?>
</td>
	</tr>
	<tr>
		<td class="bx-popup-label"><?php 
echo GetMessage('SL_SETTINGS_SYNC_LIST_ID');
?>
: </td>
		<td><?php 
echo CIntranetUtils::makeGUID($arResult['SERVICE']['SP_LIST_ID']);
?>
</td>
	</tr>
	<tr>
		<td class="bx-popup-label"><?php 
echo GetMessage('SL_FORM_LIST_INTERVAL');
?>
: </td>
		<td><?php 
echo GetMessage('SL_FORM_LIST_INTERVAL_' . intval($arResult['SERVICE']['SYNC_PERIOD']));
?>
</td>
	</tr>
	<tr>
		<td class="bx-popup-label"><?php 
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:31,代碼來源:settings.php

示例8: UpdateListItems

 function UpdateListItems($listName, $updates)
 {
     global $USER;
     $arStatusValues = array_flip($this->arStatusValues);
     $arPriorityValues = array_flip($this->arPriorityValues);
     $arWeekDays = array_flip($this->arWeekDays);
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     $obResponse = new CXMLCreator('Results');
     $listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
     $obRes = CIBlockSection::GetList(array('SORT' => 'ASC'), array('XML_ID' => $listName_original));
     if (!($arSection = $obRes->Fetch())) {
         return new CSoapFault('List not found', 'List with ' . $listName . ' GUID is not found');
     }
     $bGroup = $arSection['SOCNET_GROUP_ID'] != '';
     if ($bGroup) {
         CModule::IncludeModule('socialnetwork');
         $arGroupTmp = CSocNetGroup::GetByID($arSection['SOCNET_GROUP_ID']);
         if ($arGroupTmp["CLOSED"] == "Y") {
             if (COption::GetOptionString("socialnetwork", "work_with_closed_groups", "N") != "Y") {
                 return new CSoapFault('Cannot modify archive group calendar', 'Cannot modify archive group calendar');
             }
         }
     }
     $obCalendar = new CEventCalendar();
     $obCalendar->Init(array('ownerType' => $bGroup ? 'GROUP' : 'USER', 'ownerId' => $bGroup ? $arSection['SOCNET_GROUP_ID'] : (is_object($USER) && $USER->GetID() ? $USER->GetID() : false), 'bOwner' => true, 'iblockId' => $arSection['IBLOCK_ID'], 'bCache' => false));
     // dirty hack
     $arPermissions = $obCalendar->GetPermissions(array('setProperties' => true));
     $obBatch = $updates->children[0];
     $atrONERROR = $obBatch->getAttribute('OnError');
     $atrDATEINUTC = $obBatch->getAttribute('DateInUtc');
     $atrPROPERTIES = $obBatch->getAttribute('Properties');
     $arChanges = $obBatch->children;
     $arResultIDs = array();
     $dateStart = ConvertTimeStamp(strtotime('-1 hour'), 'FULL');
     $arResponseRows = array();
     $arReplicationIDs = array();
     foreach ($arChanges as $obMethod) {
         $arData = array('_command' => $obMethod->getAttribute('Cmd'));
         foreach ($obMethod->children as $obField) {
             $name = $obField->getAttribute('Name');
             if ($name == 'MetaInfo') {
                 $name .= '_' . $obField->getAttribute('Property');
             }
             $arData[$name] = $obField->content;
         }
         if ($arData['_command'] == 'Delete') {
             $obRes = new CXMLCreator('Result');
             $obRes->setAttribute('ID', $obMethod->getAttribute('ID') . ',' . $arData['_command']);
             $obRes->setAttribute('List', $listName);
             $obRes->addChild($obNode = new CXMLCreator('ErrorCode'));
             if (CECEvent::Delete(array('id' => $arData['ID'], 'ownerType' => $bGroup ? 'GROUP' : 'USER', 'ownerId' => $bGroup ? $arSection['SOCNET_GROUP_ID'] : (is_object($USER) && $USER->GetID() ? $USER->GetID() : false), 'bOwner' => true, 'iblockId' => $arSection['IBLOCK_ID'], 'RMiblockId' => $this->__getRMIblockID(), 'allowResMeeting' => true))) {
                 CEventCalendar::ClearCache('/event_calendar/events/' . $arSection['IBLOCK_ID'] . '/');
                 $obNode->setData('0x00000000');
             } else {
                 $obNode->setData('0x81020014');
             }
             /*
             	0x00000000 - ok
             	0x81020015 - data conflict
             	0x81020014 - generic error such as invalid value for Field
             	0x81020016 - item does not exist
             */
             $obResponse->addChild($obRes);
         } elseif ($arData['_command'] == 'New' || $arData['_command'] == 'Update') {
             $q = ToLower($arData['Description']);
             if (($pos = strrpos($q, '</body>')) !== false) {
                 $arData['Description'] = substr($arData['Description'], 0, $pos);
             }
             if (($pos = strpos($q, '<body>')) !== false) {
                 $arData['Description'] = substr($arData['Description'], $pos + 6);
             }
             $arData['Description'] = str_replace('</DIV>', "\r\n</DIV>", $arData['Description']);
             $arData['Description'] = str_replace(array("&#10;", "&#13;"), "", $arData['Description']);
             $arData['Description'] = preg_replace("/<![^>]*>/", '', $arData['Description']);
             //$arData['Description'] = strip_tags($arData['Description']);
             $arData['Description'] = trim($arData['Description']);
             $arData['Location'] = trim($arData['Location']);
             $arData['EventDate'] = $this->__makeTS($arData['EventDate']);
             $arData['EndDate'] = $this->__makeTS($arData['EndDate']) + ($arData['fAllDayEvent'] ? -86340 : 0);
             $TZBias = intval(date('Z', $arData['EventDate']));
             $arData['EventType'] = intval($arData['EventType']);
             if ($arData['EventType'] == 2) {
                 $arData['EventType'] = 0;
             }
             if ($arData['EventType'] > 2) {
                 return new CSoapFault('Unsupported event type', 'Event type unsupported');
             }
             $arData['fRecurrence'] = intval($arData['fRecurrence']);
             if ($arData['RecurrenceData']) {
                 //$xmlstr = $arData['XMLTZone'];
                 //$arData['XMLTZone'] = new CDataXML();
                 //$arData['XMLTZone']->LoadString($xmlstr);
                 $xmlstr = $arData['RecurrenceData'];
                 $obRecurData = new CDataXML();
                 $obRecurData->LoadString($xmlstr);
                 /*
                 <recurrence>
                 		<rule>
//.........這裏部分代碼省略.........
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:101,代碼來源:ws_calendar.php

示例9: CSPListsClient

 if (!$_REQUEST['list_id']) {
     $CLIENT = new CSPListsClient($arResult['URL']);
     if (!($arResult['LISTS'] = $CLIENT->GetListCollection())) {
         if ($ex = $APPLICATION->GetException()) {
             $arResult['ERROR'] = $ex->GetString();
         } else {
             $arResult['ERROR'] = 'STRANGE ERROR OCCURED!';
         }
     }
     $arResult['LISTS_CONNECTED'] = array();
     $dbRes = CIntranetSharepoint::GetList();
     while ($arRes = $dbRes->Fetch()) {
         $arResult['LISTS_CONNECTED'][] = $arRes['SP_LIST_ID'];
     }
 } else {
     $listID = CIntranetUtils::makeGUID($_REQUEST['list_id']);
     $listID_clear = CIntranetUtils::checkGUID($listID);
     if (!$_REQUEST['FIELDS']) {
         $STEP = 3;
         $CLIENT = new CSPListsClient($arResult['URL']);
         if (!($arResult['LIST'] = $CLIENT->GetList($listID_clear))) {
             if ($ex = $APPLICATION->GetException()) {
                 $arResult['ERROR'] = $ex->GetString();
             } else {
                 $arResult['ERROR'] = 'STRANGE ERROR OCCURED!';
             }
         }
         $_SESSION['SP_LIST_' . $listID_clear] = $arResult['LIST'];
     } else {
         $STEP = 4;
         $FIELDS = $_REQUEST['FIELDS'];
開發者ID:mrdeadmouse,項目名稱:u136006,代碼行數:31,代碼來源:component.php


注:本文中的CIntranetUtils::makeGUID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。