Esempio n. 1
0
 function encodeValueLight($name, $value)
 {
     global $xsd_simple_type;
     //AddMessage2Log($name."|".mydump($value));
     if (!$name) {
         ShowError("Tag name undefined (== 0) in encodeValueLight.");
         return false;
     }
     $node = CXMLCreator::createTagAttributed($name);
     $name = $node->tag;
     if (!$node) {
         ShowError("Can't create NODE object. Unable to parse tag name: " . $name);
         return false;
     }
     if (is_object($value) && strtolower(get_class($value)) == "cxmlcreator") {
         $node->addChild($value);
     } else {
         if (is_object($value)) {
             $ovars = get_object_vars($value);
             foreach ($ovars as $pn => $pv) {
                 $decode = CXMLCreator::encodeValueLight($pn, $pv);
                 if ($decode) {
                     $node->addChild($decode);
                 }
             }
         } else {
             if (is_array($value)) {
                 foreach ($value as $pn => $pv) {
                     $decode = CXMLCreator::encodeValueLight($pn, $pv);
                     if ($decode) {
                         $node->addChild($decode);
                     }
                 }
             } else {
                 if (!$value) {
                     $node->setData("");
                 } else {
                     if (!isset($xsd_simple_type[gettype($value)])) {
                         ShowError("Unknown param type.");
                         return false;
                     }
                 }
                 $node->setData($value);
             }
         }
     }
     return $node;
 }
Esempio n. 2
0
	public function GetList($listName)
	{
		global $APPLICATION, $USER;
		//todo: check read access for calendar

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

		$listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
		$arSections = CCalendarSect::GetList(
			array(
				'arFilter' => array('XML_ID' => strtolower($listName_original))
			)
		);

		if (!$arSections || !is_array($arSections[0]))
			return new CSoapFault(
				'List not found',
				'List with '.$listName.' GUID not found'
			);
		$arSection = $arSections[0];

		$data = new CXMLCreator('List');
		$data->setAttribute('ID', $listName);
		$data->setAttribute('Name', $listName);
		$data->setAttribute('Title', $arSection['NAME']);

		//$data->setAttribute('Created', date('Ymd H:i:s', MakeTimeStamp($arSection['DATE_CREATE'])));
		//$data->setAttribute('Modified', date('Ymd H:i:s', MakeTimeStamp($arSection['TIMESTAMP_X'])));
		$data->setAttribute('Direction', 'none'); // RTL, LTR
		$data->setAttribute('ReadSecurity', '2');
		$data->setAttribute('WriteSecurity', '2');

		$data->setAttribute('Author', $arSection['CREATED_BY'].';#'.CCalendar::GetUserName($arSection['CREATED_BY']));

		$data->addChild($this->__getFieldsDefinition());

		$data->addChild($obNode = new CXMLCreator('RegionalSettings'));

		//$obNode->addChild(CXMLCreator::createTagAttributed('Language', '1033'));
		//$obNode->addChild(CXMLCreator::createTagAttributed('Locale', '1033'));
		$obNode->addChild(CXMLCreator::createTagAttributed('AdvanceHijri', '0'));
		$obNode->addChild(CXMLCreator::createTagAttributed('CalendarType', '0'));
		$obNode->addChild(CXMLCreator::createTagAttributed('Time24', 'True'));
		//$obNode->addChild(CXMLCreator::createTagAttributed('TimeZone', '59'));
		$obNode->addChild(CXMLCreator::createTagAttributed('Presence', 'True'));

		$data->addChild($obNode = new CXMLCreator('ServerSettings'));

		$obNode->addChild(CXMLCreator::createTagAttributed('ServerVersion', '12.0.0.6219'));
		$obNode->addChild(CXMLCreator::createTagAttributed('RecycleBinEnabled', 'False'));
		$obNode->addChild(CXMLCreator::createTagAttributed('ServerRelativeUrl', '/company/absence.php'));

		return array('GetListResult' => $data);
	}
Esempio n. 3
0
 function GetList($listName)
 {
     global $APPLICATION;
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     $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 not found'
     	);
     }
     */
     //$dbAuthor = CUser::GetByID($arSection['CREATED_BY']);
     //$arAuthor = $dbAuthor->Fetch();
     $data = new CXMLCreator('List');
     $data->setAttribute('ID', $listName);
     $data->setAttribute('Name', $listName);
     //$data->setAttribute('Title', $arSection['NAME']);
     if (defined("IS_EXTRANET") && IS_EXTRANET == "Y" && defined("IS_EMPLOYEES") && IS_EMPLOYEES == "Y") {
         $data->setAttribute('Title', GetMessage('INTR_OUTLOOK_TITLE_CONTACTS'));
     } elseif (defined("IS_EXTRANET") && IS_EXTRANET == "Y") {
         $data->setAttribute('Title', GetMessage('INTR_OUTLOOK_TITLE_CONTACTS_EXTRANET'));
     } else {
         $data->setAttribute('Title', GetMessage('INTR_OUTLOOK_TITLE_CONTACTS'));
     }
     $data->setAttribute('Created', date('Ymd H:i:s'));
     $data->setAttribute('Modified', date('Ymd H:i:s'));
     $data->setAttribute('Direction', 'none');
     // RTL, LTR
     $data->setAttribute('ReadSecurity', '2');
     $data->setAttribute('WriteSecurity', '2');
     $data->setAttribute('Author', '1;#admin');
     $data->setAttribute('EnableAttachments', 'True');
     // it's strange and awful but this thing doesn't work at outlook.
     // he always make 2 additional hits: GetAttachmentCollection and direct attachment call, independently from this settings
     //$data->setAttribute('IncludeAttachmentUrls', 'True');
     //$data->setAttribute('IncludeAttachmentVersion', 'False');
     $data->addChild($this->__getFieldsDefinition());
     $data->addChild($obNode = new CXMLCreator('RegionalSettings'));
     //$obNode->addChild(CXMLCreator::createTagAttributed('Language', '1033'));
     //$obNode->addChild(CXMLCreator::createTagAttributed('Locale', '1033'));
     $obNode->addChild(CXMLCreator::createTagAttributed('AdvanceHijri', '0'));
     $obNode->addChild(CXMLCreator::createTagAttributed('CalendarType', '0'));
     $obNode->addChild(CXMLCreator::createTagAttributed('Time24', 'True'));
     //$obNode->addChild(CXMLCreator::createTagAttributed('TimeZone', '59'));
     $obNode->addChild(CXMLCreator::createTagAttributed('Presence', 'True'));
     $data->addChild($obNode = new CXMLCreator('ServerSettings'));
     $obNode->addChild(CXMLCreator::createTagAttributed('ServerVersion', '12.0.0.6219'));
     $obNode->addChild(CXMLCreator::createTagAttributed('RecycleBinEnabled', 'False'));
     $obNode->addChild(CXMLCreator::createTagAttributed('ServerRelativeUrl', '/company/'));
     return array('GetListResult' => $data);
 }
Esempio n. 4
0
 function GetFieldsList()
 {
     $fields = new CXMLCreator('Fields');
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="TITLE" name="' . GetMessage('CRM_FIELD_TITLE') . '" type="string" require="true" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="NAME" name="' . GetMessage('CRM_FIELD_NAME') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="LAST_NAME" name="' . GetMessage('CRM_FIELD_LAST_NAME') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="SECOND_NAME" name="' . GetMessage('CRM_FIELD_SECOND_NAME') . '" type="string" require="false" default=""', ''));
     $ar = CCrmFieldMulti::GetEntityComplexList();
     foreach ($ar as $fieldId => $fieldName) {
         $fields->addChild(CXMLCreator::createTagAttributed('Field id="' . $fieldId . '" name="' . $fieldName . '" type="string" require="false" default=""', ''));
     }
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="COMPANY_TITLE" name="' . GetMessage('CRM_FIELD_COMPANY_TITLE') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="POST" name="' . GetMessage('CRM_FIELD_POST') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="ADDRESS" name="' . GetMessage('CRM_FIELD_ADDRESS') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="COMMENTS" name="' . GetMessage('CRM_FIELD_COMMENTS') . '" type="string" require="false" default=""', ''));
     //$fieldList = CXMLCreator::createTagAttributed('Field id="PRODUCT_ID" name="'.GetMessage('CRM_FIELD_PRODUCT_ID').'" type="string" require="false" default=""', '');
     //	$fieldList->addChild(self::GetProductList());
     //$fields->addChild($fieldList);
     $fieldList = CXMLCreator::createTagAttributed('Field id="STATUS_ID" name="' . GetMessage('CRM_FIELD_STATUS_ID') . '" type="string" require="false" default=""', '');
     $fieldList->addChild(self::GetStatusList());
     $fields->addChild($fieldList);
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="OPPORTUNITY" name="' . GetMessage('CRM_FIELD_OPPORTUNITY') . '" type="double" require="false" default=""', ''));
     $fieldList = CXMLCreator::createTagAttributed('Field id="CURRENCY_ID" name="' . GetMessage('CRM_FIELD_CURRENCY_ID') . '" type="string" default=""', '');
     $fieldList->addChild(self::GetCurrencyList());
     $fields->addChild($fieldList);
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="STATUS_DESCRIPTION" name="' . GetMessage('CRM_FIELD_STATUS_DESCRIPTION') . '" type="text" default=""', ''));
     $fieldList = CXMLCreator::createTagAttributed('Field id="SOURCE_ID" name="' . GetMessage('CRM_FIELD_SOURCE_ID') . '" type="string" default=""', '');
     $fieldList->addChild(self::GetSourceList());
     $fields->addChild($fieldList);
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="SOURCE_DESCRIPTION" name="' . GetMessage('CRM_FIELD_SOURCE_DESCRIPTION') . '" type="text" default=""', ''));
     $CCrmUserType = new CCrmUserType($GLOBALS['USER_FIELD_MANAGER'], CCrmLead::$sUFEntityID);
     $CCrmUserType->AddWebserviceFields($fields);
     return array('GetFieldsListResult' => $fields);
 }
Esempio n. 5
0
 function GetFieldsList()
 {
     $fields = new CXMLCreator('Fields');
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="NAME" name="' . GetMessage('CRM_FIELD_NAME') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="LAST_NAME" name="' . GetMessage('CRM_FIELD_LAST_NAME') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="SECOND_NAME" name="' . GetMessage('CRM_FIELD_SECOND_NAME') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="PHOTO" name="' . GetMessage('CRM_FIELD_PHOTO') . '" type="file" require="false" default=""', ''));
     $ar = CCrmFieldMulti::GetEntityComplexList();
     foreach ($ar as $fieldId => $fieldName) {
         $fields->addChild(CXMLCreator::createTagAttributed('Field id="' . $fieldId . '" name="' . $fieldName . '" type="string" require="false" default=""', ''));
     }
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="POST" name="' . GetMessage('CRM_FIELD_POST') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="ADDRESS" name="' . GetMessage('CRM_FIELD_ADDRESS') . '" type="string" require="false" default=""', ''));
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="COMMENTS" name="' . GetMessage('CRM_FIELD_COMMENTS') . '" type="string" require="false" default=""', ''));
     $fieldList = CXMLCreator::createTagAttributed('Field id="TYPE_ID" name="' . GetMessage('CRM_FIELD_TYPE_ID') . '" type="int" default=""', '');
     $fieldList->addChild(self::GetTypeList());
     $fields->addChild($fieldList);
     $fieldList = CXMLCreator::createTagAttributed('Field id="SOURCE_ID" name="' . GetMessage('CRM_FIELD_SOURCE_ID') . '" type="int" default=""', '');
     $fieldList->addChild(self::GetSourceList());
     $fields->addChild($fieldList);
     $fields->addChild(CXMLCreator::createTagAttributed('Field id="SOURCE_DESCRIPTION" name="' . GetMessage('CRM_FIELD_SOURCE_DESCRIPTION') . '" type="text" default=""', ''));
     $CCrmUserType = new CCrmUserType($GLOBALS['USER_FIELD_MANAGER'], CCrmLead::$sUFEntityID);
     $CCrmUserType->AddWebserviceFields($fields);
     return array('GetFieldsListResult' => $fields);
 }
Esempio n. 6
0
 function AddAttachment($listName, $listItemID, $fileName, $attachment)
 {
     global $USER;
     if (!$this->__Init()) {
         return $this->error;
     }
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     if (strlen($attachment) <= 0) {
         return new CSoapFault('Wrong attachment', 'Wrong attachment');
     }
     $listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
     $listItemID = intval($listItemID);
     $dbRes = CTasks::GetByID($listItemID);
     if ($task = $dbRes->Fetch()) {
         $fileName = str_replace(array('/', '\\', '..'), '', $fileName);
         // minor security
         foreach ($task["FILES"] as $fileID) {
             $FILE = ToLower(basename(CFile::GetPath($fileID)));
             if ($FILE == ToLower($fileName)) {
                 Header('HTTP/1.1 500 Internal Server Error');
                 $obDetail = new CXMLCreator('detail');
                 $obDetail->addChild(CXMLCreator::createTagAttributed('errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/"', 'The specified name is already in use.'));
                 $obDetail->addChild(CXMLCreator::createTagAttributed('errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/"', '0x81020067'));
                 return new CSoapFault('soap::Server', 'Exception of type \'Microsoft.SharePoint.SoapServer.SoapServerException\' was thrown.', $obDetail);
             }
         }
         $tmpFileName = CTempFile::GetFileName('sheet_happens');
         RewriteFile($tmpFileName, $attachment);
         $arFile = CFile::MakeFileArray($tmpFileName);
         $arFile['name'] = basename($fileName);
         $arFile['MODULE_ID'] = 'tasks';
         $arValue = array($FILE_ID = CFile::SaveFile($arFile, 'outlook/Lists/' . $listItemID));
         CTasks::AddFiles($task["ID"], $arValue);
         return array('AddAttachmentResult' => '/tasks/getfile/' . (int) $listItemID . '/' . (int) $FILE_ID . '/' . urlencode(ToLower(basename(CFile::GetPath($FILE_ID)))));
     } else {
         return new CSoapFault('0x81020016', 'List item not found');
     }
 }
Esempio n. 7
0
 public function UpdateListItems($listName, $arChanges)
 {
     $arMethodParams = array('listName' => $listName);
     $updates = CXMLCreator::createTagAttributed('Batch OnError="Continue" DateInUtc="TRUE" Properties="TRUE"');
     $i = 0;
     foreach ($arChanges as $row) {
         $obRow = CXMLCreator::createTagAttributed('Method ID="' . $i++ . '"');
         if ($ID = intval($row['ID'])) {
             $obRow->setAttribute('Cmd', 'Update');
         } else {
             $obRow->setAttribute('Cmd', 'New');
             unset($row['ID']);
             $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="ID"', 'New'));
             $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="MetaInfo" Property="ReplicationID"', $row['ReplicationID']));
             unset($row['ReplicationID']);
         }
         foreach ($row as $fld => $value) {
             if (substr($fld, 0, 9) == 'MetaInfo_') {
                 $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="MetaInfo" Property="' . CDataXML::xmlspecialchars(substr($fld, 9)) . '"', $value));
             } else {
                 if ($fld) {
                     $obRow->addChild(CXMLCreator::createTagAttributed('Field Name="' . CDataXML::xmlspecialchars($fld) . '"', $value));
                 }
             }
         }
         $updates->addChild($obRow);
     }
     $arMethodParams['updates'] = $updates;
     $RESULT = false;
     if ($this->__initialize() && $this->Call('UpdateListItems', $arMethodParams) && ($DOM = $this->RESPONSE->DOMDocument)) {
         $RESULT = array();
         $arResults = $DOM->elementsByName('Result');
         foreach ($arResults as $resultNode) {
             $arRes = array('ErrorCode' => $resultNode->children[0]->textContent(), 'Row' => $this->ConvertRows($resultNode));
             if ($arRes['Row']) {
                 $arRes['Row'] = $arRes['Row'][0];
             }
             $RESULT[] = $arRes;
         }
     }
     $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/sp_client5.log', 'a');
     fwrite($fp, $this->getRawRequest());
     fwrite($fp, $this->getRawResponse());
     fwrite($fp, "\n==========================================\n\n");
     fclose($fp);
     return $RESULT;
 }
Esempio n. 8
0
 function AddAttachment($listName, $listItemID, $fileName, $attachment)
 {
     global $USER;
     if (!$this->__Init()) {
         return $this->error;
     }
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     if (strlen($attachment) <= 0) {
         return new CSoapFault('Wrong attachment', 'Wrong attachment');
     }
     $listName = ToUpper(CIntranetUtils::makeGUID($listName_original));
     $listItemID = intval($listItemID);
     $dbRes = CIBlockElement::GetByID($listItemID);
     if (($obElement = $dbRes->GetNextElement()) && CIntranetTasksDocument::CanUserOperateDocument(INTASK_DOCUMENT_OPERATION_WRITE_DOCUMENT, $USER->GetID(), $listItemID, array())) {
         $arElement = $obElement->GetFields();
         $arProperty = $obElement->GetProperty('TaskFiles');
         $fileName = str_replace(array('/', '\\', '..'), '', $fileName);
         // minor security
         $arValue = $arProperty['VALUE'];
         foreach ($arValue as $FILE_ID) {
             $FILE = ToLower(basename(CFile::GetPath($FILE_ID)));
             if ($FILE == ToLower($fileName)) {
                 Header('HTTP/1.1 500 Internal Server Error');
                 $obDetail = new CXMLCreator('detail');
                 $obDetail->addChild(CXMLCreator::createTagAttributed('errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/"', 'The specified name is already in use.'));
                 $obDetail->addChild(CXMLCreator::createTagAttributed('errorcode xmlns="http://schemas.microsoft.com/sharepoint/soap/"', '0x81020067'));
                 return new CSoapFault('soap::Server', 'Exception of type \'Microsoft.SharePoint.SoapServer.SoapServerException\' was thrown.', $obDetail);
             }
         }
         $path = '/upload/outlook/Lists/' . $listItemID;
         CheckDirPath($_SERVER['DOCUMENT_ROOT'] . $path);
         RewriteFile($_SERVER['DOCUMENT_ROOT'] . $path . '/' . $fileName, $attachment);
         $arFile = CFile::MakeFileArray($_SERVER['DOCUMENT_ROOT'] . $path . '/' . $fileName);
         $arFile['MODULE_ID'] = 'intranet';
         $arValue = array($FILE_ID = CFile::SaveFile($arFile, 'outlook/Lists/' . $listItemID));
         @unlink($arFile['tmp_name']);
         CIBlockElement::SetPropertyValues($arElement['ID'], $arElement['IBLOCK_ID'], $arValue, 'TaskFiles');
         return array('AddAttachmentResult' => CFile::GetPath($FILE_ID));
     } else {
         return new CSoapFault('0x81020016', 'List item not found');
     }
 }
Esempio n. 9
0
 public function AddWebserviceFields(&$obFields)
 {
     $arUserFields = $this->GetUserFields($this->sEntityID, 0, LANGUAGE_ID);
     foreach ($arUserFields as $FIELD_NAME => $arUserField) {
         $defVal = '';
         if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'employee') {
             continue;
         }
         if ($arUserField['USER_TYPE']['BASE_TYPE'] == 'enum') {
             $sType = 'int';
             if (is_callable(array($arUserField['USER_TYPE']['CLASS_NAME'], 'GetList'))) {
                 $rsEnum = call_user_func_array(array($arUserField['USER_TYPE']['CLASS_NAME'], 'GetList'), array($arUserField));
                 $obFieldValues = new CXMLCreator('CHOISES');
                 while ($ar = $rsEnum->GetNext()) {
                     $obFieldValue = new CXMLCreator('CHOISE', true);
                     $obFieldValue->setAttribute('id', $ar['ID']);
                     $obFieldValue->setData(htmlspecialcharsbx($ar['VALUE']));
                     $obFieldValues->addChild($obFieldValue);
                 }
             }
         } else {
             if ($arUserField['USER_TYPE']['BASE_TYPE'] == 'file') {
                 $sType = 'file';
             } else {
                 if ($arUserField['USER_TYPE']['BASE_TYPE'] == 'boolean') {
                     $sType = 'boolean';
                 } else {
                     if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'double' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'integer') {
                         $sType = 'int';
                     } else {
                         if ($arUserField['USER_TYPE']['BASE_TYPE'] == 'datetime') {
                             $defVal = $arUserField['SETTINGS']['DEFAULT_VALUE']['VALUE'];
                             $sType = 'datetime';
                         } else {
                             if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'string') {
                                 $sType = 'string';
                             } else {
                                 $sType = 'string';
                             }
                         }
                     }
                 }
             }
         }
         if (empty($defVal) && isset($arUserField['SETTINGS']['DEFAULT_VALUE']) && !is_array($arUserField['SETTINGS']['DEFAULT_VALUE'])) {
             $defVal = $arUserField['SETTINGS']['DEFAULT_VALUE'];
         }
         $obField = CXMLCreator::createTagAttributed('Field id="' . $FIELD_NAME . '" name="' . htmlspecialcharsbx($arUserField['EDIT_FORM_LABEL']) . '" type="' . $sType . '" default="' . $defVal . '" require="' . ($arUserField['MANDATORY'] == 'Y' ? 'true' : 'false') . '" multy="' . ($arUserField['MULTIPLE'] == 'Y' ? 'true' : 'false') . '"', '');
         if ($arUserField['USER_TYPE']['BASE_TYPE'] == 'enum' && $obFieldValues instanceof CXMLCreator) {
             $obField->addChild($obFieldValues);
             unset($obFieldValues);
         }
         $obFields->addChild($obField);
     }
 }
Esempio n. 10
0
 function GetList($listName)
 {
     global $APPLICATION;
     //todo: check read access for calendar
     if (!($listName_original = CIntranetUtils::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     $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 not found');
     }
     $dbAuthor = CUser::GetByID($arSection['CREATED_BY']);
     $arAuthor = $dbAuthor->Fetch();
     $data = new CXMLCreator('List');
     $data->setAttribute('ID', $listName);
     $data->setAttribute('Name', $listName);
     $data->setAttribute('Title', $arSection['NAME']);
     $data->setAttribute('Created', date('Ymd H:i:s', MakeTimeStamp($arSection['DATE_CREATE'])));
     $data->setAttribute('Modified', date('Ymd H:i:s', MakeTimeStamp($arSection['TIMESTAMP_X'])));
     $data->setAttribute('Direction', 'none');
     // RTL, LTR
     $data->setAttribute('ReadSecurity', '2');
     $data->setAttribute('WriteSecurity', '2');
     $name = $arAuthor['NAME'];
     if ($arAuthor['LAST_NAME']) {
         $name .= ' ' . $arAuthor['LAST_NAME'];
     }
     if (!$name) {
         $name .= $arAuthor['LOGIN'];
     }
     $data->setAttribute('Author', $arAuthor['ID'] . ';#' . $name);
     $data->addChild($this->__getFieldsDefinition());
     $data->addChild($obNode = new CXMLCreator('RegionalSettings'));
     //$obNode->addChild(CXMLCreator::createTagAttributed('Language', '1033'));
     //$obNode->addChild(CXMLCreator::createTagAttributed('Locale', '1033'));
     $obNode->addChild(CXMLCreator::createTagAttributed('AdvanceHijri', '0'));
     $obNode->addChild(CXMLCreator::createTagAttributed('CalendarType', '0'));
     $obNode->addChild(CXMLCreator::createTagAttributed('Time24', 'True'));
     //$obNode->addChild(CXMLCreator::createTagAttributed('TimeZone', '59'));
     $obNode->addChild(CXMLCreator::createTagAttributed('Presence', 'True'));
     $data->addChild($obNode = new CXMLCreator('ServerSettings'));
     $obNode->addChild(CXMLCreator::createTagAttributed('ServerVersion', '12.0.0.6219'));
     $obNode->addChild(CXMLCreator::createTagAttributed('RecycleBinEnabled', 'False'));
     $obNode->addChild(CXMLCreator::createTagAttributed('ServerRelativeUrl', '/company/absence.php'));
     return array('GetListResult' => $data);
 }