[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 3 include_once 'Horde/SyncML/State.php'; 4 include_once 'Horde/SyncML/Command/Sync/SyncElement.php'; 5 6 /** 7 * $Horde: framework/SyncML/SyncML/Command/Sync/ContentSyncElement.php,v 1.12 2004/07/02 19:24:44 chuck Exp $ 8 * 9 * Copyright 2003-2004 Anthony Mills <amills@pyramid6.com> 10 * 11 * See the enclosed file COPYING for license information (LGPL). If you 12 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 13 * 14 * @author Anthony Mills <amills@pyramid6.com> 15 * @version $Revision: 21683 $ 16 * @since Horde 3.0 17 * @package Horde_SyncML 18 */ 19 class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_Sync_SyncElement { 20 21 /** 22 * The content: vcard data, etc. 23 */ 24 var $_content; 25 26 /** 27 * Local to server: our Horde guid. 28 */ 29 var $_locURI; 30 31 var $_targetURI; 32 var $_contentType; 33 34 function setSourceURI($uri) 35 { 36 $this->_locURI = $uri; 37 } 38 39 function getSourceURI() 40 { 41 return $this->_locURI; 42 } 43 44 function setTargetURI($uri) 45 { 46 $this->_targetURI = $uri; 47 } 48 49 function getTargetURI() 50 { 51 return $this->_targetURI; 52 } 53 54 function setContentType($c) 55 { 56 $this->_contentType = $c; 57 } 58 59 function setContentFormat($_format) 60 { 61 $this->_contentFormat = $_format; 62 } 63 64 function getContentType() 65 { 66 return $this->_contentType; 67 } 68 69 function getContent() 70 { 71 return $this->_content; 72 } 73 74 function setContent($content) 75 { 76 $this->_content = $content; 77 } 78 79 function endElement($uri, $element) 80 { 81 switch ($this->_xmlStack) { 82 case 2: 83 if ($element == 'Data') { 84 $this->_content = trim($this->_chars); 85 } 86 break; 87 } 88 89 parent::endElement($uri, $element); 90 } 91 92 function outputCommand($currentCmdID, &$output, $command) 93 { 94 $state = $_SESSION['SyncML.state']; 95 96 $attrs = array(); 97 $output->startElement($state->getURI(), $command, $attrs); 98 99 $output->startElement($state->getURI(), 'CmdID', $attrs); 100 $chars = $currentCmdID; 101 $output->characters($chars); 102 $output->endElement($state->getURI(), 'CmdID'); 103 104 if (isset($this->_contentType)) { 105 $output->startElement($state->getURI(), 'Meta', $attrs); 106 $output->startElement($state->getURIMeta(), 'Type', $attrs); 107 $output->characters($this->_contentType); 108 $output->endElement($state->getURIMeta(), 'Type'); 109 $output->endElement($state->getURI(), 'Meta'); 110 } 111 112 if (isset($this->_content) 113 || isset($this->_locURI) || isset($this->targetURI)) { 114 $output->startElement($state->getURI(), 'Item', $attrs); 115 // send only when sending adds 116 if ($this->_locURI != null && (strtolower($command) == 'add')) { 117 $output->startElement($state->getURI(), 'Source', $attrs); 118 $output->startElement($state->getURI(), 'LocURI', $attrs); 119 $chars = substr($this->_locURI,0,39); 120 $output->characters($chars); 121 $output->endElement($state->getURI(), 'LocURI'); 122 $output->endElement($state->getURI(), 'Source'); 123 } 124 125 if(isset($this->_contentFormat)) { 126 $output->startElement($state->getURI(), 'Meta', $attrs); 127 $output->startElement($state->getURIMeta(), 'Format', $attrs); 128 $output->characters($this->_contentFormat); 129 $output->endElement($state->getURIMeta(), 'Format'); 130 $output->endElement($state->getURI(), 'Meta'); 131 } 132 133 if ($this->_targetURI != null) { 134 $output->startElement($state->getURI(), 'Target', $attrs); 135 $output->startElement($state->getURI(), 'LocURI', $attrs); 136 $chars = $this->_targetURI; 137 $output->characters($chars); 138 $output->endElement($state->getURI(), 'LocURI'); 139 $output->endElement($state->getURI(), 'Target'); 140 } 141 if (isset($this->_content)) { 142 $output->startElement($state->getURI(), 'Data', $attrs); 143 #$chars = '<![CDATA['.$this->_content.']]>'; 144 $chars = $this->_content; 145 $output->characters($chars); 146 $output->endElement($state->getURI(), 'Data'); 147 } 148 $output->endElement($state->getURI(), 'Item'); 149 } 150 151 $output->endElement($state->getURI(), $command); 152 153 $currentCmdID++; 154 155 return $currentCmdID; 156 } 157 158 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |