/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
- *Title: toString and fromString datatype functionality.
- *Note!!!!!!: This functionality is experimental so a lot of things(especialy the format of data)
- can be changed until the final reliese.
- *Documentation:
- To simplify writing of import export scripts we have added two functions
- to the ezcontentobjectattribute class. Aslso related functions with the
- same name have been added to the datype interfase and to all datatypes in
- standard eZ Publish distribution exept of ezenum which is now deprecated
- and ezpackage which is not used.
- To show possibilities of these functionality two scripts have been added
- under bin/php/. These scripts are very simple CSV import/export scripts:
- - ezcsvimport.php
- - ezcsvexport.php
- They are very basic and do not pretend to be fully functional CSV import/export
- for ezpublish though you can use them to do real import/export.
- Here is a description of formats which are accepted by the datatypes for
- fromString( &$contentObjectAttribute, $string ), and generated by
- toString( $contentObjectAttribute ) methods.
- ezauthor:
- to sparate one author from another '&' char is used, to separate parts of author data
- '|' is used. The system escapes '|','&','\' with the '\' char.
- example of toString result
- Administrator User|sp@ez.no|0&Sergiy|bla@fooo.tt|1&SP|sp@ez.od.ua|2
- to make it easy to parse such kind of strings the class ezstringutils is added under
- lib/ezutils. It has to functions as a members.
- explodeStr( $str, $delimiter = '|' ) and implodeStr( $str, $delimiter = '|' ). The first one
- explodes string to an array with delimiter char, the difference from PHP explode/implode is
- that these functions do propper escaping/unescaping of all values.
- ezbinaryfile:
- toString function of this datatype return string of next format:
- filepath|original_filename
- filepath is to a file so you can copy this file in a place you want,
- original_filename is the original filename of uploaded files. This might be needed for export
- since it is not nice to have file name as md5 of something.
- if you want to import binary file to the attribute you need to supply it with full path
- to the image argument.
- ezboolean:
- returns and accepts 1 or 0 for true and false relativly.
- ezcountry:
- returns coma-separated list of selected countries locale strings like for ex.:
- rus-RU,eng-GB,nor-NO
- ezdate:
- returns/accepts unix timestamp of the date.
- ezdatetime:
- returns/accepts unix timestamp of the date.
- ezemail
- returns/accepts email address.
- ezenum:
- not supported
- ezfloat
- returns/accepts floats.
- ezidentifier:
- hm.. though import/export is not needed feature for this datatype [to|from]String function
- return|accept identifier value
- ezimage
- returns path to original alias of an image. Accepts full path to the image you want to upload.
- ezinisetting
- returns accepts value of an inisetting.
- ezinteger
- just integer value both ways.
- ezisbn
- ISBN number as a string
- ezkeyword
- coma separated list of keywords
- ezmatrix
- uses similar format to ezauthor datatype. The columns are sparated with '|' and rows are separated with '&'
- ezmedia
- toString function of this datatype return string of next format:
- filepath|original_filename
- if you want to import media file to the attribute you need to supply it with full path
- to the media file.
- ezmultioption
- The first '&' separated value is the name of multioption set, then each '&' separated string represents
- each option in multioption set. This string it self is '|' separated value, consist of inorder:
- _name_ of the option and the _id_ of option item which should be selected by default. After these to
- values we have option_value and additional price for the option item.
- ezmultiprice
- The structure of a data handled by this data type is
- 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|
- Where currency_name is thre char currency name like EUR,USD and so on,
- value is the price in this currency,
- and type can be AUTO or CUSTOM dependin on if the price in this currency
- has been inserted by user or calculated automaticaly.
- ezobjectrelation
- ID of related object both ways.
- ezobjectrelationlist
- '-' separated list of related object ID'd.
- ezoption
- '|' separated list of option name of the option and then | sparated list of option_item|additional item price values.
- ezpackage
- Not supported.
- ezprice
- '|' separated list of price, VAT id, and flag wether VAT is included to the price or not.
- ezproductcategory
- '|' separated string with product category name and category id, though you can call fromString method with just category
- name as a papameter.
- ezrangeoption
- '|' separated string contains name of the option, start,stop and step values for the option.
- ezselection
- '|' separated list of selected election item names.
- ezstring
- just a string
- eztext
- the dat text from the attribute.
- eztime
- string with the time of the day like HH:MM in 24h format
- ezurl
- string containing the url
- ezuser
- '|' separated string with user login, email, password hash, and password hash type
- ezxmltext
- raturns valid ez publish xml, and expects the same as input.