[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZDateTimeType class 4 // 5 // 6 // SOFTWARE NAME: eZ publish 7 // SOFTWARE RELEASE: 3.9.0 8 // BUILD VERSION: 17785 9 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 10 // SOFTWARE LICENSE: GNU General Public License v2.0 11 // NOTICE: > 12 // This program is free software; you can redistribute it and/or 13 // modify it under the terms of version 2.0 of the GNU General 14 // Public License as published by the Free Software Foundation. 15 // 16 // This program is distributed in the hope that it will be useful, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 // GNU General Public License for more details. 20 // 21 // You should have received a copy of version 2.0 of the GNU General 22 // Public License along with this program; if not, write to the Free 23 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 24 // MA 02110-1301, USA. 25 // 26 // 27 28 /*! 29 \class eZDateTimeType ezdatetimetype.php 30 \ingroup eZDatatype 31 \brief Stores a date and time value 32 33 */ 34 35 include_once ( "kernel/classes/ezdatatype.php" ); 36 include_once ( "lib/ezlocale/classes/ezdatetime.php" ); 37 38 define( 'EZ_DATATYPESTRING_DATETIME', 'ezdatetime' ); 39 define( 'EZ_DATATYPESTRING_DATETIME_DEFAULT', 'data_int1' ); 40 define( 'EZ_DATATYPESTRING_DATETIME_ADJUSTMENT_FIELD', 'data_text5' ); 41 define( 'EZ_DATATYPESTRING_DATETIME_DEFAULT_EMTPY', 0 ); 42 define( 'EZ_DATATYPESTRING_DATETIME_DEFAULT_CURRENT_DATE', 1 ); 43 define( 'EZ_DATATYPESTRING_DATETIME_DEFAULT_ADJUSTMENT', 2 ); 44 45 46 class eZDateTimeType extends eZDataType 47 { 48 function eZDateTimeType() 49 { 50 $this->eZDataType( EZ_DATATYPESTRING_DATETIME, ezi18n( 'kernel/classes/datatypes', "Date and time", 'Datatype name' ), 51 array( 'serialize_supported' => true ) ); 52 } 53 54 /*! 55 Private method only for use inside this class 56 */ 57 function validateDateTimeHTTPInput( $day, $month, $year, $hour, $minute, &$contentObjectAttribute ) 58 { 59 include_once ( 'lib/ezutils/classes/ezdatetimevalidator.php' ); 60 61 $state = eZDateTimeValidator::validateDate( $day, $month, $year ); 62 if ( $state == EZ_INPUT_VALIDATOR_STATE_INVALID ) 63 { 64 $contentObjectAttribute->setValidationError( ezi18n( 'kernel/classes/datatypes', 65 'Date is not valid.' ) ); 66 return EZ_INPUT_VALIDATOR_STATE_INVALID; 67 } 68 69 $state = eZDateTimeValidator::validateTime( $hour, $minute ); 70 if ( $state == EZ_INPUT_VALIDATOR_STATE_INVALID ) 71 { 72 $contentObjectAttribute->setValidationError( ezi18n( 'kernel/classes/datatypes', 73 'Time is not valid.' ) ); 74 return EZ_INPUT_VALIDATOR_STATE_INVALID; 75 } 76 return $state; 77 } 78 79 /*! 80 Validates the input and returns true if the input was 81 valid for this datatype. 82 */ 83 function validateObjectAttributeHTTPInput( &$http, $base, &$contentObjectAttribute ) 84 { 85 if ( $http->hasPostVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ) and 86 $http->hasPostVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ) and 87 $http->hasPostVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ) and 88 $http->hasPostVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ) and 89 $http->hasPostVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ) ) 90 { 91 $year = $http->postVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ); 92 $month = $http->postVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ); 93 $day = $http->postVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ); 94 $hour = $http->postVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ); 95 $minute = $http->postVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ); 96 $classAttribute =& $contentObjectAttribute->contentClassAttribute(); 97 98 if ( $year == '' or 99 $month == '' or 100 $day == '' or 101 $hour == '' or 102 $minute == '' ) 103 { 104 if ( !( $year == '' and 105 $month == '' and 106 $day == '' and 107 $hour == '' and 108 $minute == '') or 109 ( !$classAttribute->attribute( 'is_information_collector' ) and 110 $contentObjectAttribute->validateIsRequired() ) ) 111 { 112 $contentObjectAttribute->setValidationError( ezi18n( 'kernel/classes/datatypes', 113 'Missing datetime input.' ) ); 114 return EZ_INPUT_VALIDATOR_STATE_INVALID; 115 } 116 else 117 return EZ_INPUT_VALIDATOR_STATE_ACCEPTED; 118 } 119 else 120 { 121 return $this->validateDateTimeHTTPInput( $day, $month, $year, $hour, $minute, $contentObjectAttribute ); 122 } 123 } 124 else 125 return EZ_INPUT_VALIDATOR_STATE_ACCEPTED; 126 } 127 128 /*! 129 Fetches the http post var integer input and stores it in the data instance. 130 */ 131 function fetchObjectAttributeHTTPInput( &$http, $base, &$contentObjectAttribute ) 132 { 133 if ( $http->hasPostVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ) and 134 $http->hasPostVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ) and 135 $http->hasPostVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ) and 136 $http->hasPostVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ) and 137 $http->hasPostVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ) ) 138 { 139 $year = $http->postVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ); 140 $month = $http->postVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ); 141 $day = $http->postVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ); 142 $hour = $http->postVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ); 143 $minute = $http->postVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ); 144 145 $dateTime = new eZDateTime(); 146 $contentClassAttribute =& $contentObjectAttribute->contentClassAttribute(); 147 if ( ( $year == '' and $month == ''and $day == '' and 148 $hour == '' and $minute == '' ) or 149 !checkdate( $month, $day, $year ) or $year < 1970 ) 150 { 151 $dateTime->setTimeStamp( 0 ); 152 } 153 else 154 { 155 $dateTime->setMDYHMS( $month, $day, $year, $hour, $minute, 0 ); 156 } 157 158 $contentObjectAttribute->setAttribute( 'data_int', $dateTime->timeStamp() ); 159 return true; 160 } 161 return false; 162 } 163 164 /*! 165 \reimp 166 */ 167 function validateCollectionAttributeHTTPInput( &$http, $base, &$contentObjectAttribute ) 168 { 169 if ( $http->hasPostVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ) and 170 $http->hasPostVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ) and 171 $http->hasPostVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ) and 172 $http->hasPostVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ) and 173 $http->hasPostVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ) ) 174 { 175 $year = $http->postVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ); 176 $month = $http->postVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ); 177 $day = $http->postVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ); 178 $hour = $http->postVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ); 179 $minute = $http->postVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ); 180 $classAttribute =& $contentObjectAttribute->contentClassAttribute(); 181 182 if ( $year == '' or 183 $month == '' or 184 $day == '' or 185 $hour == '' or 186 $minute == '' ) 187 { 188 if ( !( $year == '' and 189 $month == '' and 190 $day == '' and 191 $hour == '' and 192 $minute == '') or 193 $contentObjectAttribute->validateIsRequired() ) 194 { 195 $contentObjectAttribute->setValidationError( ezi18n( 'kernel/classes/datatypes', 196 'Missing datetime input.' ) ); 197 return EZ_INPUT_VALIDATOR_STATE_INVALID; 198 } 199 else 200 return EZ_INPUT_VALIDATOR_STATE_ACCEPTED; 201 } 202 else 203 { 204 return $this->validateDateTimeHTTPInput( $day, $month, $year, $hour, $minute, $contentObjectAttribute ); 205 } 206 } 207 else 208 return EZ_INPUT_VALIDATOR_STATE_INVALID; 209 } 210 211 /*! 212 \reimp 213 Fetches the http post variables for collected information 214 */ 215 function fetchCollectionAttributeHTTPInput( &$collection, &$collectionAttribute, &$http, $base, &$contentObjectAttribute ) 216 { 217 if ( $http->hasPostVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ) and 218 $http->hasPostVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ) and 219 $http->hasPostVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ) and 220 $http->hasPostVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ) and 221 $http->hasPostVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ) ) 222 { 223 $year = $http->postVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ); 224 $month = $http->postVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ); 225 $day = $http->postVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ); 226 $hour = $http->postVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ); 227 $minute = $http->postVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ); 228 229 $dateTime = new eZDateTime(); 230 $contentClassAttribute =& $contentObjectAttribute->contentClassAttribute(); 231 if ( ( $year == '' and $month == ''and $day == '' and 232 $hour == '' and $minute == '' ) or 233 !checkdate( $month, $day, $year ) or $year < 1970 ) 234 { 235 $dateTime->setTimeStamp( 0 ); 236 } 237 else 238 { 239 $dateTime->setMDYHMS( $month, $day, $year, $hour, $minute, 0 ); 240 } 241 242 $collectionAttribute->setAttribute( 'data_int', $dateTime->timeStamp() ); 243 return true; 244 } 245 return false; 246 } 247 248 /*! 249 Returns the content. 250 */ 251 function &objectAttributeContent( &$contentObjectAttribute ) 252 { 253 $dateTime = new eZDateTime(); 254 $stamp = $contentObjectAttribute->attribute( 'data_int' ); 255 $dateTime->setTimeStamp( $stamp ); 256 return $dateTime; 257 } 258 259 /*! 260 \reimp 261 */ 262 function isIndexable() 263 { 264 return true; 265 } 266 267 /*! 268 \reimp 269 */ 270 function isInformationCollector() 271 { 272 return true; 273 } 274 275 /*! 276 Returns the meta data used for storing search indeces. 277 */ 278 function metaData( $contentObjectAttribute ) 279 { 280 return $contentObjectAttribute->attribute( 'data_int' ); 281 } 282 /*! 283 \return string representation of an contentobjectattribute data for simplified export 284 285 */ 286 function toString( $contentObjectAttribute ) 287 { 288 return $contentObjectAttribute->attribute( 'data_int' ); 289 } 290 291 function fromString( &$contentObjectAttribute, $string ) 292 { 293 return $contentObjectAttribute->setAttribute( 'data_int', $string ); 294 } 295 296 /*! 297 Set class attribute value for template version 298 */ 299 function initializeClassAttribute( &$classAttribute ) 300 { 301 if ( $classAttribute->attribute( EZ_DATATYPESTRING_DATETIME_DEFAULT ) == null ) 302 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_DEFAULT, 0 ); 303 $classAttribute->store(); 304 } 305 306 function &parseXML( $xmlText ) 307 { 308 include_once ( 'lib/ezxml/classes/ezxml.php' ); 309 $xml = new eZXML(); 310 $dom =& $xml->domTree( $xmlText ); 311 return $dom; 312 } 313 314 function &classAttributeContent( &$classAttribute ) 315 { 316 $xmlText = $classAttribute->attribute( 'data_text5' ); 317 if ( trim( $xmlText ) == '' ) 318 { 319 $classAttrContent = eZDateTimeType::defaultClassAttributeContent(); 320 return $classAttrContent; 321 } 322 $doc =& eZDateTimeType::parseXML( $xmlText ); 323 $root =& $doc->root(); 324 $type = $root->elementByName( 'year' ); 325 if ( $type ) 326 { 327 $content['year'] = $type->attributeValue( 'value' ); 328 } 329 $type = $root->elementByName( 'month' ); 330 if ( $type ) 331 { 332 $content['month'] = $type->attributeValue( 'value' ); 333 } 334 $type = $root->elementByName( 'day' ); 335 if ( $type ) 336 { 337 $content['day'] = $type->attributeValue( 'value' ); 338 } 339 $type = $root->elementByName( 'hour' ); 340 if ( $type ) 341 { 342 $content['hour'] = $type->attributeValue( 'value' ); 343 } 344 $type = $root->elementByName( 'minute' ); 345 if ( $type ) 346 { 347 $content['minute'] = $type->attributeValue( 'value' ); 348 } 349 return $content; 350 } 351 352 function defaultClassAttributeContent() 353 { 354 return array( 'year' => '', 355 'month' => '', 356 'day' => '', 357 'hour' => '', 358 'minute' => '' ); 359 } 360 361 /*! 362 Sets the default value. 363 */ 364 function initializeObjectAttribute( &$contentObjectAttribute, $currentVersion, &$originalContentObjectAttribute ) 365 { 366 if ( $currentVersion != false ) 367 { 368 $dataInt = $originalContentObjectAttribute->attribute( "data_int" ); 369 $contentObjectAttribute->setAttribute( "data_int", $dataInt ); 370 } 371 else 372 { 373 $contentClassAttribute =& $contentObjectAttribute->contentClassAttribute(); 374 $defaultType = $contentClassAttribute->attribute( EZ_DATATYPESTRING_DATETIME_DEFAULT ); 375 if ( $defaultType == EZ_DATATYPESTRING_DATETIME_DEFAULT_CURRENT_DATE ) 376 { 377 $contentObjectAttribute->setAttribute( "data_int", mktime() ); 378 } 379 else if ( $defaultType == EZ_DATATYPESTRING_DATETIME_DEFAULT_ADJUSTMENT ) 380 { 381 $adjustments = eZDateTimeType::classAttributeContent( $contentClassAttribute ); 382 $value = new eZDateTime(); 383 $value->adjustDateTime( $adjustments['hour'], $adjustments['minute'], 0, $adjustments['month'], $adjustments['day'], $adjustments['year'] ); 384 $contentObjectAttribute->setAttribute( "data_int", $value->timeStamp() ); 385 } 386 } 387 } 388 389 function fetchClassAttributeHTTPInput( &$http, $base, &$classAttribute ) 390 { 391 $default = $base . "_ezdatetime_default_" . $classAttribute->attribute( 'id' ); 392 if ( $http->hasPostVariable( $default ) ) 393 { 394 $defaultValue = $http->postVariable( $default ); 395 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_DEFAULT, $defaultValue ); 396 if ( $defaultValue == EZ_DATATYPESTRING_DATETIME_DEFAULT_ADJUSTMENT ) 397 { 398 $doc = new eZDOMDocument( 'DateTimeAdjustments' ); 399 $root = $doc->createElementNode( 'adjustment' ); 400 $contentList = eZDateTimeType::contentObjectArrayXMLMap(); 401 foreach ( $contentList as $key => $value ) 402 { 403 $postValue = $http->postVariable( $base . '_ezdatetime_' . $value . '_' . $classAttribute->attribute( 'id' ) ); 404 unset( $elementType ); 405 $elementType = $doc->createElementNode( $key, array( 'value' => $postValue ) ); 406 $root->appendChild( $elementType ); 407 } 408 $doc->setRoot( $root ); 409 $docText = $doc->toString(); 410 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_ADJUSTMENT_FIELD , $docText ); 411 } 412 } 413 return true; 414 } 415 416 function contentObjectArrayXMLMap() 417 { 418 return array( 'year' => 'year', 419 'month' => 'month', 420 'day' => 'day', 421 'hour' => 'hour', 422 'minute' => 'minute' ); 423 } 424 425 426 /*! 427 Returns the date. 428 */ 429 function title( &$contentObjectAttribute ) 430 { 431 $locale =& eZLocale::instance(); 432 $retVal = $contentObjectAttribute->attribute( "data_int" ) == 0 ? '' : $locale->formatDateTime( $contentObjectAttribute->attribute( "data_int" ) ); 433 return $retVal; 434 } 435 436 function hasObjectAttributeContent( &$contentObjectAttribute ) 437 { 438 return $contentObjectAttribute->attribute( "data_int" ) != 0; 439 } 440 441 /*! 442 \reimp 443 */ 444 function sortKey( &$contentObjectAttribute ) 445 { 446 return (int)$contentObjectAttribute->attribute( 'data_int' ); 447 } 448 449 /*! 450 \reimp 451 */ 452 function sortKeyType() 453 { 454 return 'int'; 455 } 456 457 /*! 458 \reimp 459 */ 460 function serializeContentClassAttribute( &$classAttribute, &$attributeNode, &$attributeParametersNode ) 461 { 462 $defaultValue = $classAttribute->attribute( EZ_DATATYPESTRING_DATETIME_DEFAULT ); 463 switch ( $defaultValue ) 464 { 465 case EZ_DATATYPESTRING_DATETIME_DEFAULT_CURRENT_DATE: 466 { 467 $attributeParametersNode->appendChild( eZDOMDocument::createElementNode( 'default-value', 468 array( 'type' => 'current-date' ) ) ); 469 } break; 470 case EZ_DATATYPESTRING_DATETIME_DEFAULT_ADJUSTMENT: 471 { 472 $xml = new eZXML(); 473 $adjustValue = $classAttribute->attribute( EZ_DATATYPESTRING_DATETIME_ADJUSTMENT_FIELD ); 474 $adjustDOMValue =& $xml->domTree( $adjustValue ); 475 $defaultNode = eZDOMDocument::createElementNode( 'default-value', array( 'type' => 'adjustment' ) ); 476 if ( $adjustDOMValue ) 477 { 478 $adjustmentNodeList =& $adjustDOMValue->elementsByName( 'adjustment' ); 479 if ( $adjustmentNodeList ) 480 { 481 $defaultNode->appendChild( $adjustmentNodeList[0] ); 482 } 483 } 484 $attributeParametersNode->appendChild( $defaultNode ); 485 } break; 486 case EZ_DATATYPESTRING_DATETIME_DEFAULT_EMTPY: 487 { 488 $attributeParametersNode->appendChild( eZDOMDocument::createElementNode( 'default-value', 489 array( 'type' => 'empty' ) ) ); 490 } break; 491 default: 492 { 493 eZDebug::writeError( 'Unknown type of DateTime default value. Empty type used instead.', 494 'eZDateTimeType::serializeContentClassAttribute()' ); 495 $attributeParametersNode->appendChild( eZDOMDocument::createElementNode( 'default-value', 496 array( 'type' => 'empty' ) ) ); 497 } break; 498 } 499 } 500 501 /*! 502 \reimp 503 */ 504 function unserializeContentClassAttribute( &$classAttribute, &$attributeNode, &$attributeParametersNode ) 505 { 506 $defaultValue = ''; 507 $defaultNode =& $attributeParametersNode->elementByName( 'default-value' ); 508 if ( $defaultNode ) 509 { 510 $defaultValue = strtolower( $defaultNode->attributeValue( 'type' ) ); 511 } 512 switch ( $defaultValue ) 513 { 514 case 'current-date': 515 { 516 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_DEFAULT, EZ_DATATYPESTRING_DATETIME_DEFAULT_CURRENT_DATE ); 517 } break; 518 case 'adjustment': 519 { 520 $adjustmentValue = ''; 521 $adjustmentNode =& $defaultNode->elementByName( 'adjustment' ); 522 if ( $adjustmentNode ) 523 { 524 $adjustmentDOMValue = new eZDOMDocument(); 525 $adjustmentDOMValue->setRoot( $adjustmentNode ); 526 $adjustmentValue = $adjustmentDOMValue->toString(); 527 } 528 529 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_DEFAULT, EZ_DATATYPESTRING_DATETIME_DEFAULT_ADJUSTMENT ); 530 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_ADJUSTMENT_FIELD, $adjustmentValue ); 531 } break; 532 case 'empty': 533 { 534 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_DEFAULT, EZ_DATATYPESTRING_DATETIME_DEFAULT_EMTPY ); 535 } break; 536 default: 537 { 538 eZDebug::writeError( 'Type of DateTime default value is not set. Empty type used as default.', 539 'eZDateTimeType::unserializeContentClassAttribute()' ); 540 $classAttribute->setAttribute( EZ_DATATYPESTRING_DATETIME_DEFAULT, EZ_DATATYPESTRING_DATETIME_DEFAULT_EMTPY ); 541 } break; 542 } 543 } 544 545 /*! 546 \reimp 547 \return a DOM representation of the content object attribute 548 */ 549 function serializeContentObjectAttribute( &$package, &$objectAttribute ) 550 { 551 $node = $this->createContentObjectAttributeDOMNode( $objectAttribute ); 552 $stamp = $objectAttribute->attribute( 'data_int' ); 553 554 if ( !is_null( $stamp ) ) 555 { 556 include_once ( 'lib/ezlocale/classes/ezdateutils.php' ); 557 $node->appendChild( eZDOMDocument::createElementTextNode( 'date_time', eZDateUtils::rfc1123Date( $stamp ) ) ); 558 } 559 560 return $node; 561 } 562 563 /*! 564 \reimp 565 */ 566 function unserializeContentObjectAttribute( &$package, &$objectAttribute, $attributeNode ) 567 { 568 $dateTimeNode = $attributeNode->elementByName( 'date_time' ); 569 if ( is_object( $dateTimeNode ) ) 570 $timestampNode = $dateTimeNode->firstChild(); 571 if ( is_object( $timestampNode ) ) 572 { 573 include_once ( 'lib/ezlocale/classes/ezdateutils.php' ); 574 $timestamp = eZDateUtils::textToDate( $timestampNode->content() ); 575 $objectAttribute->setAttribute( 'data_int', $timestamp ); 576 } 577 } 578 } 579 580 eZDataType::register( EZ_DATATYPESTRING_DATETIME, "ezdatetimetype" ); 581 582 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |