/doc/features/3.9/to_from_string_datatype_functionality.txt

http://github.com/ezsystems/ezpublish · Plain Text · 154 lines · 112 code · 42 blank · 0 comment · 0 complexity · e493f4b8dcfc823ec5ebc9ad2525ad6f MD5 · raw file

  1. *Title: toString and fromString datatype functionality.
  2. *Note!!!!!!: This functionality is experimental so a lot of things(especialy the format of data)
  3. can be changed until the final reliese.
  4. *Documentation:
  5. To simplify writing of import export scripts we have added two functions
  6. to the ezcontentobjectattribute class. Aslso related functions with the
  7. same name have been added to the datype interfase and to all datatypes in
  8. standard eZ Publish distribution exept of ezenum which is now deprecated
  9. and ezpackage which is not used.
  10. To show possibilities of these functionality two scripts have been added
  11. under bin/php/. These scripts are very simple CSV import/export scripts:
  12. - ezcsvimport.php
  13. - ezcsvexport.php
  14. They are very basic and do not pretend to be fully functional CSV import/export
  15. for ezpublish though you can use them to do real import/export.
  16. Here is a description of formats which are accepted by the datatypes for
  17. fromString( &$contentObjectAttribute, $string ), and generated by
  18. toString( $contentObjectAttribute ) methods.
  19. ezauthor:
  20. to sparate one author from another '&' char is used, to separate parts of author data
  21. '|' is used. The system escapes '|','&','\' with the '\' char.
  22. example of toString result
  23. Administrator User|sp@ez.no|0&Sergiy|bla@fooo.tt|1&SP|sp@ez.od.ua|2
  24. to make it easy to parse such kind of strings the class ezstringutils is added under
  25. lib/ezutils. It has to functions as a members.
  26. explodeStr( $str, $delimiter = '|' ) and implodeStr( $str, $delimiter = '|' ). The first one
  27. explodes string to an array with delimiter char, the difference from PHP explode/implode is
  28. that these functions do propper escaping/unescaping of all values.
  29. ezbinaryfile:
  30. toString function of this datatype return string of next format:
  31. filepath|original_filename
  32. filepath is to a file so you can copy this file in a place you want,
  33. original_filename is the original filename of uploaded files. This might be needed for export
  34. since it is not nice to have file name as md5 of something.
  35. if you want to import binary file to the attribute you need to supply it with full path
  36. to the image argument.
  37. ezboolean:
  38. returns and accepts 1 or 0 for true and false relativly.
  39. ezcountry:
  40. returns coma-separated list of selected countries locale strings like for ex.:
  41. rus-RU,eng-GB,nor-NO
  42. ezdate:
  43. returns/accepts unix timestamp of the date.
  44. ezdatetime:
  45. returns/accepts unix timestamp of the date.
  46. ezemail
  47. returns/accepts email address.
  48. ezenum:
  49. not supported
  50. ezfloat
  51. returns/accepts floats.
  52. ezidentifier:
  53. hm.. though import/export is not needed feature for this datatype [to|from]String function
  54. return|accept identifier value
  55. ezimage
  56. returns path to original alias of an image. Accepts full path to the image you want to upload.
  57. ezinisetting
  58. returns accepts value of an inisetting.
  59. ezinteger
  60. just integer value both ways.
  61. ezisbn
  62. ISBN number as a string
  63. ezkeyword
  64. coma separated list of keywords
  65. ezmatrix
  66. uses similar format to ezauthor datatype. The columns are sparated with '|' and rows are separated with '&'
  67. ezmedia
  68. toString function of this datatype return string of next format:
  69. filepath|original_filename
  70. if you want to import media file to the attribute you need to supply it with full path
  71. to the media file.
  72. ezmultioption
  73. The first '&' separated value is the name of multioption set, then each '&' separated string represents
  74. each option in multioption set. This string it self is '|' separated value, consist of inorder:
  75. _name_ of the option and the _id_ of option item which should be selected by default. After these to
  76. values we have option_value and additional price for the option item.
  77. ezmultiprice
  78. The structure of a data handled by this data type is
  79. currency_name_1|value_1|type_of_price_1|currency_name_2|value_2|type_of_price_2|......currency_name_n|value_n|type_of_price_n|
  80. Where currency_name is thre char currency name like EUR,USD and so on,
  81. value is the price in this currency,
  82. and type can be AUTO or CUSTOM dependin on if the price in this currency
  83. has been inserted by user or calculated automaticaly.
  84. ezobjectrelation
  85. ID of related object both ways.
  86. ezobjectrelationlist
  87. '-' separated list of related object ID'd.
  88. ezoption
  89. '|' separated list of option name of the option and then | sparated list of option_item|additional item price values.
  90. ezpackage
  91. Not supported.
  92. ezprice
  93. '|' separated list of price, VAT id, and flag wether VAT is included to the price or not.
  94. ezproductcategory
  95. '|' separated string with product category name and category id, though you can call fromString method with just category
  96. name as a papameter.
  97. ezrangeoption
  98. '|' separated string contains name of the option, start,stop and step values for the option.
  99. ezselection
  100. '|' separated list of selected election item names.
  101. ezstring
  102. just a string
  103. eztext
  104. the dat text from the attribute.
  105. eztime
  106. string with the time of the day like HH:MM in 24h format
  107. ezurl
  108. string containing the url
  109. ezuser
  110. '|' separated string with user login, email, password hash, and password hash type
  111. ezxmltext
  112. raturns valid ez publish xml, and expects the same as input.