cvs: peardoc /fr/package/datetime/calendar calendar-decorator-textual.xml calendar-decorator-uri.xml calendar-decorator-wrapper.xml
calendar-decorator.xml calendar-engine-interface.xml calendar-engine-peardate.xml calendar-engine-unixts.xml calendar-month-weekdays.xml
calendar-table-helper.xml calendar-validation-error.xml calendar-validator.xml calendar-week.xml calendar.xml constants.xml faq.xml
intro-decorators.xml intro-inahurry.xml intro-installing.xml intro-overview-methods.xml intro-overview.xml intro-purpose.xml
| From: | Mehdi Achour | Date: | Wed, 24 Mar 2004 14:55:22 +0000 |
| Subject: | cvs: peardoc /fr/package/datetime/calendar calendar-decorator-textual.xml calendar-decorator-uri.xml calendar-decorator-wrapper.xml calendar-decorator.xml calendar-engine-interface.xml calendar-engine-peardate.xml calendar-engine-unixts.xml calendar-month-weekdays.xml calendar-table-helper.xml calendar-validation-error.xml calendar-validator.xml calendar-week.xml calendar.xml constants.xml faq.xml intro-decorators.xml intro-inahurry.xml intro-installing.xml intro-overview-methods.xml intro-overview.xml intro-purpose.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-3078@lists.php.net to get a copy of this message | ||
didou Wed Mar 24 09:55:22 2004 EDT
Added files:
/peardoc/fr/package/datetime/calendar
calendar-decorator-textual.xml
calendar-decorator-uri.xml
calendar-decorator-wrapper.xml
calendar-decorator.xml
calendar-engine-interface.xml
calendar-engine-peardate.xml
calendar-engine-unixts.xml
calendar-month-weekdays.xml
calendar-table-helper.xml
calendar-validation-error.xml
calendar-validator.xml
calendar-week.xml
calendar.xml constants.xml
faq.xml intro-decorators.xml
intro-inahurry.xml
intro-installing.xml
intro-overview-methods.xml
intro-overview.xml
intro-purpose.xml
Log:
initial translation
http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator-textual.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator-textual.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator-textual.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-decorator-textual"> <refnamediv> <refname>Calendar_Decorator_Textual</refname> <refpurpose>API Calendar_Decorator_Textual</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator-textual.desc"> &title.desc; <para> API <classname>Calendar_Decorator_Textual</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator-uri.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator-uri.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator-uri.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-decorator-uri"> <refnamediv> <refname>Calendar_Decorator_Uri</refname> <refpurpose>API Calendar_Decorator_Uri</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator-uri.desc"> &title.desc; <para> API <classname>Calendar_Decorator_Uri</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator-wrapper.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator-wrapper.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator-wrapper.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-decorator-wrapper"> <refnamediv> <refname>Calendar_Decorator_Wrapper</refname> <refpurpose>API Calendar_Decorator_Wrapper</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator-wrapper.desc"> &title.desc; <para> API <classname>Calendar_Decorator_Wrapper</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar-decorator"> <refnamediv> <refname>Calendar_Decorator</refname> <refpurpose>API Calendar_Decorator</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator.desc"> &title.desc; <para> API <classname>Calendar_Decorator</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-engine-interface.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-engine-interface.xml +++ peardoc/fr/package/datetime/calendar/calendar-engine-interface.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-engine-interface"> <refnamediv> <refname>Calendar_Engine_Interface</refname> <refpurpose>API Calendar_Engine_Interface</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-engine-interface.desc"> &title.desc; <para> API <classname>Calendar_Engine_Interface</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-engine-peardate.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-engine-peardate.xml +++ peardoc/fr/package/datetime/calendar/calendar-engine-peardate.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-engine-peardate"> <refnamediv> <refname>Calendar_Engine_PearDate</refname> <refpurpose>API Calendar_Engine_PearDate</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-engine-peardate.desc"> &title.desc; <para> API <classname>Calendar_Engine_PearDate</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-engine-unixts.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-engine-unixts.xml +++ peardoc/fr/package/datetime/calendar/calendar-engine-unixts.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-engine-unixts"> <refnamediv> <refname>Calendar_Engine_UnixTs</refname> <refpurpose>API Calendar_Engine_UnixTs</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-engine-unixts.desc"> &title.desc; <para> API <classname>Calendar_Engine_UnixTs</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-month-weekdays.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-month-weekdays.xml +++ peardoc/fr/package/datetime/calendar/calendar-month-weekdays.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-month-weekdays"> <refnamediv> <refname>Calendar_Month_Weekdays</refname> <refpurpose>API Calendar_Month_Weekdays</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-month-weekdays.desc"> &title.desc; <para> API <classname>Calendar_Month_Weekdays</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-table-helper.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-table-helper.xml +++ peardoc/fr/package/datetime/calendar/calendar-table-helper.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-table-helper"> <refnamediv> <refname>Calendar_Table_Helper</refname> <refpurpose>API Calendar_Table_Helper</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-table-helper.desc"> &title.desc; <para> API <classname>Calendar_Table_Helper</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-validation-error.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-validation-error.xml +++ peardoc/fr/package/datetime/calendar/calendar-validation-error.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-validation-error"> <refnamediv> <refname>Calendar_Validation_Error</refname> <refpurpose>API Calendar_Validation_Error</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-validation-error.desc"> &title.desc; <para> API <classname>Calendar_Validation_Error</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-validator.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-validator.xml +++ peardoc/fr/package/datetime/calendar/calendar-validator.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-validator"> <refnamediv> <refname>Calendar_Validator</refname> <refpurpose>API Calendar_Validator</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-validator.desc"> &title.desc; <para> API <classname>Calendar_Validator</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-week.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-week.xml +++ peardoc/fr/package/datetime/calendar/calendar-week.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-week"> <refnamediv> <refname>Calendar_Week</refname> <refpurpose>API Calendar_Week</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-week.desc"> &title.desc; <para> API <classname>Calendar_Week</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar.xml +++ peardoc/fr/package/datetime/calendar/calendar.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar"> <refnamediv> <refname>Calendar</refname> <refpurpose>Classe de base Calendar</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar.desc"> &title.desc; <para> API <classname>Calendar</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/constants.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/constants.xml +++ peardoc/fr/package/datetime/calendar/constants.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.constants"> <refnamediv> <refname>Constantes du package Calendar</refname> <refpurpose>Constantes définies et utilisées dans Calendar</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.constants.details"> <title>Toutes les constantes</title> <refsect2 id="package.datetime.calendar.constants.details.calendar---php"> <title> Constantes définies dans Calendar.php </title> <para> <table> <title>Constantes définies dans Calendar.php</title> <tgroup cols="3"> <thead> <row> <entry>Nom</entry> <entry>Valeur</entry> <entry>Numéro de ligne</entry> </row> </thead> <tbody> <row> <entry>CALENDAR_ENGINE</entry> <entry>'UnixTS'</entry> <entry>39</entry> </row> <row> <entry>CALENDAR_ROOT</entry> <entry>'Calendar'.DIRECTORY_SEPARATOR</entry> <entry>32</entry> </row> </tbody> </tgroup> </table> </para> </refsect2> <refsect2 id="package.datetime.calendar.constants.details.validator---php"> <title> Constantes définies dans Validator.php </title> <para> <table> <title>Constantes définies dans Validator.php</title> <tgroup cols="3"> <thead> <row> <entry>Nom</entry> <entry>Valeur</entry> <entry>Numéro de ligne</entry> </row> </thead> <tbody> <row> <entry>CALENDAR_VALUE_TOOLARGE</entry> <entry>'Too large: max = '</entry> <entry>34</entry> </row> <row> <entry>CALENDAR_VALUE_TOOSMALL</entry> <entry>'Too small: min = '</entry> <entry>31</entry> </row> </tbody> </tgroup> </table> </para> </refsect2> <refsect2 id="package.datetime.calendar.constants.details.year---php"> <title> Constantes définies dans Year.php </title> <para> <table> <title>Constantes définies dans Year.php</title> <tgroup cols="3"> <thead> <row> <entry>Nom</entry> <entry>Valeur</entry> <entry>Numéro de ligne</entry> </row> </thead> <tbody> <row> <entry>CALENDAR_USE_MONTH</entry> <entry>1</entry> <entry>43</entry> </row> <row> <entry>CALENDAR_USE_MONTH_WEEKDAYS</entry> <entry>2</entry> <entry>44</entry> </row> <row> <entry>CALENDAR_USE_MONTH_WEEKS</entry> <entry>3</entry> <entry>45</entry> </row> </tbody> </tgroup> </table> </para> </refsect2> </refsect1> </refentry> <!-- Generated by phpDocumentor v 1.2.3 http://www.phpdoc.org --> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/faq.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/faq.xml +++ peardoc/fr/package/datetime/calendar/faq.xml <?xml version="1.0" ?> <!-- $Id: faq.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.5 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.faq"> <refnamediv> <refname>FAQ</refname> <refpurpose> Foire Aux Questions </refpurpose> </refnamediv> <refsect1> <title>Pourquoi ce n'est pas du HTML qui est généré ?</title> <para> Et si vous vouliez du WML, SOAP, PDF, GIF, ligne de commande, etc. etc.? PEAR::Calendar peut être utilisé pour générer le type de format que vous voulez (voyez les exemples pour SOAP et WML). Le contonner à un type particulier de rendu limiterai son utilisation (c'est le problème de toutes les librairies PHP de génération de calendriers que j'ai connu). Un package comme PEAR::HTML_Calendar pourrait être développé avec PEAR::Calendar. </para> </refsect1> <refsect1> <title>Il y'a trop d'objets, de classes et de fichiers, c'est une usine à gaz !</title> <para> En testant les exemples sur les serveurs de Sourceforge (qui sont toujours surchargés), example3.php s'exécute en 0.1 seconde (et même moins). Le code est extremement optimisé et chaque astuce connue a été appliquée pour être sûr que PHP n'exécute que la portion de code dont vous avez besoin. Si vous en doutez, utilisez <classname>Cache_Lite</classname> pour mettre en cache le rendu HTML. </para> </refsect1> <refsect1> <title>Vous utilisez des timestamps Unix pour calculer le calendrier, ce qui limite l'intervalle des années pouvant être générées. Peut-on changer cela ?</title> <para> All calculations are handled by a class implementing the Calendar_Engine interface. The default implemention is based on PHP's <function>date</function> and <function>mktime</function> functions (so timestamp Unixs are required for that engine). A second engine exists which uses PEAR::Date. It's slower but overcomes the limit on the range of Unixstamps. To switch between engines use the constant <constant>CALENDAR_ENGINE</constant> e.g. <programlisting role="php"> <![CDATA[ <?php // Le moteur par défaut est celui des timestamps UNIX (cet appel n'est pas requis) // define('CALENDAR_ENGINE', 'UnixTs'); // Passer au moteur PEAR::Date define('CALENDAR_ENGINE', 'PearDate'); ?> ]]> </programlisting> Notez que le moteur de PEAR::Date est basé sur la version 1.3 de PEAR Date (il manque un fichier essentiel dans la version 1.3.1beta, ce qui fait qu'elle ne fonctionne pas). </para> </refsect1> <refsect1> <title>Ces exemples utilisent la langue anglaise pour les noms. Peut-on changer la langue ?</title> <para> PEAR::Calendar only uses base 10 numbers for calculations - the names of months and days of the week and generated as the calendar is being rendered (by you). You should only need to change PHP's locale with <function>setlocale</function> and use the <function>strftime</function> function e.g.; <programlisting role="php"> <![CDATA[ $Day = & new Calendar_Day(2003, 10, 23); setlocale (LC_TIME, 'de_DE'); // German echo strftime('%A %d %B %Y', $Day->getTimeStamp()); ]]> </programlisting> Note that <classname>Calendar_Decorator_Textual</classname> provides help in generating month and day of week names in a manner which is independent of the Calendar Engine you are using and can be modified with <function>setlocale</function>. </para> </refsect1> <refsect1> <title>Que sont les EmptyDays?</title> <para> PEAR::Calendar makes it easy to render calendars in tabular format (like humans are used to) such as; <literallayout> October 2003 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 </literallayout> Notice the top left and botton right of this example - these are "EmptyDays". EmptyDays are generated only by two calendar classes: Calendar_Month_Weekdays and Calendar_Week. For example using Calendar_Month_Weekdays; <programlisting role="php"> <![CDATA[ <?php require_once 'Calendar/Month/Weekdays.php'; $Month = & new Calendar_Month_Weekdays(2003, 10); $Month->build(); while ($Day = & $Month->fetch()) { if ($Day->isFirst()) // Check for the start of a week echo "\n"; if ($Day->isEmpty()) // Check to see if day is empty echo "\t"; else echo $Day->thisDay()."\t"; if ($Day->isLast()) // Check for the end of a week echo "\n"; } ?> ]]> </programlisting> An empty day can still return values, the date it represents being from the previous or next month in the calendar. You may get empty days for <classname>Calendar_Month_Weekdays</classname> and <classname>Calendar_Week</classname>. Using <classname>Calendar_Week</classname>, you will only build 7 days (use <classname>Calendar_Month_Weeks</classname> to build <classname>Calendar_Week</classname> objects), so the <function>isFirst</function> and <function>isLast</function> methods are not applicable. </para> </refsect1> <refsect1> <title>How do I select some dates?</title> <para> All calendar objects (except <classname>Calendar_Second</classname>, which has no "children") have the method <function>build</function> to build the "children" of that object. For example <classname>Calendar_Year</classname>::<function>build</function> builds <classname>Calendar_Month</classname> objects while <classname>Calendar_Hour</classname>::<function>build</function> builds <classname>Calendar_Minute</classname> objects. You have the option of passing this method an indexed array of Calendar objects which will be used to "select" the matching built children. For example; <programlisting role="php"> <![CDATA[ $Month = & new Calendar_Month(2003, 10); // Oct 2003 $SelectedDay1 = & new Calendar_Day(2003, 10, 5); Oct 5th 2003 $SelectedDay2 = & new Calendar_Day(2003, 10, 21); Oct 21st 2003 // Place in an array... $selection = array($SelectedDay1, $SelectedDay2); $Month->build($selection); while ($Day = & $Month->fetch()) { if ($Day->isSelected()) echo $Day->thisYear().' '.$Day->thisMonth().' '.$Day->thisDay().' is selected'."\n"; } ]]> </programlisting> <emphasis>Note:</emphasis> date objects you pass to a <function>build</function> method replace the corresponding built date objects, allowing you to do things like attach your own subclass of <classname>Calendar_Decorator</classname> to them, then access the decorating functionality inside the loop which renders the calendar. You might display the contents from an "events database table" using this approach. </para> </refsect1> <refsect1> <title>Why do I have to call build() explicitly. Why can't children be built automatically?</title> <para> First and foremost, for performance. Building the children has a performance cost and you won't always need to have the children, so it should be called explicitly, otherwise you might have $Year->build(), expecting to get just months but behind the scenes, months built days, which built hours, which build minutes etc. Also calling <function>build</function> yourself give you a chance to "select" some of the children. </para> </refsect1> <refsect1> <title>How do I validate a date?</title> <para> Validity is determined by the Caalendar_Engine being used as well as the time the date object you're working with represents (e.g. $Month = & new Month(2003, 2, 29); is invalid, because Feb 2003 was not a leap year). For quick validation, you can call the method <function>isValid</function> on any date object, which will return FALSE if there's a problem. For more information of more detailed validation, you can call the method <function>getValidator</function> on any date object, which returns an instance of the class <classname>Calendar_Validator</classname>. For example; <programlisting role="php"> <![CDATA[ $Month = & new Month(2003, 2, 29); // 29th Feb 2003 (?!?) if (!$Month->isValid()) { $Validator = & $Month->getValidator(); while ($Error = $Validator->fetch()) { echo $Error->toString(); } } ]]> </programlisting> You can also begin validation by calling <function>getValidator</function> then either <function>isValidYear</function>, <function>isValidMonth</function>, <function>isValidDay</function>, <function>isValidHour</function>, <function>isValidMinute</function> and <function>isValidSecond</function> (or just <function>isValid</function> which calls all of the isValidxxx methods). </para> </refsect1> <refsect1> <title>Can I adjust invalid dates?</title> <para> If you're allowing end users to navigate your calendar via the URL, were they to modify the URL to something like calendar.php?year=2003&month=13, instead of throwing a validation error at them, you could call the <classname>Calendar</classname>::<function>adjust</function> method on the calendar object you create with that URL. You should then end up with January 2004 (in this example). This behaviour is possible thanks to <function>mktime</function> for the Unix Timestamp engine, while being built into the PEAR Date engine for you. </para> </refsect1> <refsect1> <title>Après avoir appelé build(), I just want to get a single child date object with looping through the lot. How?</title> <para> The method <function>fetchAll</function> can be called on any date object to get an indexed array of all the children which have been built, allowing you to reference them directly. Be careful with the first index of this array - in some cases it will be [1] not [0], depending on the type of date object built. For example; <programlisting role="php"> <![CDATA[ $Month = & new Calendar_Month(2003, 10); $Month->build(); $days = & $Month->fetchAll(); // Now all in array echo $days[1]->thisDay(); // The first day has index 1 $Hour = & new Calendar_Hour(2003, 10, 25, 15); // Oct 25th 2003, 3pm $Hour->build(); $hours = & $Hour->fetchAll(); // Now all in array echo $hours[0]->thisHour(); // The first hour has index 0 ]]> </programlisting> The following classes are always built to have the first index as 1: <classname>Calendar_Month </classname>, <classname>Calendar_Month_Weekdays</classname>, <classname>Calendar_Month_Weeks </classname>, <classname>Calendar_Week</classname> and <classname>Calendar_Day</classname> The following classes are always built to have the first index as 0: <classname>Calendar_Hour </classname>, <classname>Calendar_Minute</classname> and <classname>Calendar_Second</classname> Note also the method <function>size</function> can be called on any date object, after <function>build</function> has been called, to get the number of children. </para> </refsect1> <refsect1> <title>What does a week actually represent in PEAR::Calendar?</title> <para> Weeks are "pseudo" dates. They're useful for formatting the user interface for end users. Weeks are instantiated with a year, a month and a day of the month. You can then have the week tell you its timestamp (which will be the same as the timestamp for the first day in the week), its numeric position within the <emphasis>tabular</emphasis> month (see Empty Days above), its numeric position within the year (this is an ISO-8601 week number of year, weeks starting on Monday) or an array containing the numeric year, month and the first day of the week (as a number within the month). For example; <programlisting role="php"> <![CDATA[ $Week = & new Calendar_Week(2003, 10, 15); $Week = new Calendar_Week(2003, 10, 15); echo $Week->thisWeek(); // Displays 2 (week num in month) echo $Week->thisWeek('n_in_month'); // Display 2 - same as above echo $Week->thisWeek('n_in_year'); // Displays 41 (week in year) echo $Week->thisWeek('timestamp'); // Displays unix timestamp or an ISO-8601 datetime // (YYYY-MM-DD HH:MM:SS), depending on the engine. print_r $Week->thisWeek('array'); // [year] => 2003 [month] => 10 [day] => 12 ]]> </programlisting> </para> </refsect1> <refsect1> <title>How do I get a Calendar_Year to build Calendar_Month_Weekdays or Calendar_Month_Weeks, instead of the default Calendar_Month objects?</title> <para> When working with a <classname>Calendar_Year</classname>, the constants <constant> CALENDAR_MONTH_STATE</constant> controls what type of month object is built. You can define <constant>CALENDAR_MONTH_STATE</constant> to <constant>CALENDAR_USE_MONTH_WEEKDAYS</constant> or <constant>CALENDAR_USE_MONTH_WEEKS</constant> for the Calendar_Month_Weekdays and <classname> Calendar_Month_Week</classname> classes, respectively. </para> </refsect1> <refsect1> <title>Vous utilisez Lundi comme premier jour de la semaine, puis-je changer ?</title> <para> Yes. For the classes which are concerned with the notion of a "week", you can can pass a value which defines the first day of the week. For the default timestamp based Calendar engine, this is a number from 0 to 6, 0 being Sunday through to 6 being Saturday. This value can be passed to the following: <programlisting role="php"> <![CDATA[ $Year = new Calendar_Year(2003); $selection = array(); $Year->build($selection, 0); // the second argument is the first day of the week (Sunday) $MonthWeekdays = new Calendar_Month_Weekdays(2003, 10, 6); // Third argument - Saturday $MonthWeeks = new Calendar_Month_Weekdays(2003, 10, 2); // Third argument - Tuesday $Week = new Calendar_Week(2003, 10, 15, 5) // Fourth argument - Friday ]]> </programlisting> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-decorators.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-decorators.xml +++ peardoc/fr/package/datetime/calendar/intro-decorators.xml <?xml version="1.0" ?> <!-- $Id: intro-decorators.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.intro-decorators"> <refnamediv> <refname>Décorateurs de Calendar</refname> <refpurpose> A quoi sert <classname>Calendar_Decorator</classname> </refpurpose> </refnamediv> <refsect1> <title>Décorateurs de Calendar</title> <para> La classe <classname>Calendar_Decorator</classname> est fournie pour vous aider à ajouter des fonctionnalités à des objets Calendar existants sans avoir besoin de les dériver. Cela est utile dans plusieurs situations, comme par exemple, permettre d'afficher le résultat d'une requête sous forme d'un Calendrier ou encore pour modifier les valeurs retournées par les méthodes de Calendar (convertir un numéro de mois en nom de mois). </para> <para> Quelques décorateurs concrets sont fournis avec PEAR::Calendar, pour répondre aux problèmes communs que vous pouvez rencontrer en utilisant cette librairie. Ils ne sont pas faits pour répondre aux besoins particluiers de chacuns, mais ils pourront vous servir de base pour résoudre vos problèmes. Ils ne seront exécutés par PHP que si vous les incluez explicitement dans votre code. Un exemple d'utilité : <programlisting role="php"> <![CDATA[ <?php require_once 'Calendar/Day.php'; require_once 'Calendar/Decorator.php'; class WorkingDay extends Calendar_Decorator { function WorkingDay(& $Calendar) { parent::Calendar_Decorator($Calendar); } // On écrase la méthode fetch de l'objet Calendar function fetch() { if ( $Hour = parent::fetch() ) { // Mode récursif, on ne retourne que les heures entre 8 heure du matin et 6 heure du soir if ( $Hour->thisHour() < 8 || $Hour->thisHour() > 18 ) { return $this->fetch(); } else { return $Hour; } } else { // Assurez-vous de retourner FALSE lorsque la vrai méthode fetch n'a rien retourné // sinon vous aurez une boucle infinie return FALSE; } } } // On crée la date du jour et on construit les heures $Day = new Calendar_Day(date('Y'), date('n'), date('d')); $Day->build(); // On crée le décorateur en passant la date du jour $WorkingDay = new WorkingDay($Day); // Seule les heures de travail sont affichées while ( $Hour = $WorkingDay->fetch() ) { echo ( $Hour->thisHour().'<br>' ); } ?> ]]> </programlisting> </para> </refsect1> <refsect1> <title>La classe de base Calendar_Decorator</title> <para> La classe de base <classname>Calendar_Decorator</classname> "mirrors" the combined API of all the subclasses of <classname>Calendar</classname>. It accepts a Calendar object to it's constructor then "takes over" the API allowing you to make calls through it rather than directly to the original calendar object. The <classname>Calendar_Decorator</classname> simply routes calls through to the calendar object it is decorating and returns values where appropriate. </para> </refsect1> <refsect1> <title>Decorators and Date Selection</title> <para> One important use of decorators is to help "inject" data into the loop which renders the calendar. This helps with fetching data from some sort of "event" table in a database. When passing a selection array to any <function>build</function> method, the selected date objects will replace the default built objects, allowing you to get them back as inside the <function>fetch</function> loop, using the <function>isSelected</function> method. You'll find an example of this in the PEAR::Calendar download. It should always be possible to fetch the event data you need with a single database query... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-inahurry.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-inahurry.xml +++ peardoc/fr/package/datetime/calendar/intro-inahurry.xml <?xml version="1.0" ?> <!-- $Id: intro-inahurry.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.intro-inahurry"> <refnamediv> <refname>En rapide</refname> <refpurpose> Ajoutez juste de l'eau chaude.. </refpurpose> </refnamediv> <refsect1> <title>En rapide</title> <para> <programlisting role="php"> <![CDATA[ require_once 'Calendar/Month/Weekdays.php'; $Month = new Calendar_Month_Weekdays(date('Y'), date('n')); $Month->build(); echo "<table>\n"; while ($Day = $Month->fetch()) { if ($Day->isFirst()) { echo "<tr>\n"; } if ($Day->isEmpty()) { echo "<td> </td>\n"; } else { echo '<td>'.$Day->thisDay()."</td>\n"; } if ($Day->isLast()) { echo "</tr>\n"; } } echo "</table>\n"; ]]> </programlisting> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-installing.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-installing.xml +++ peardoc/fr/package/datetime/calendar/intro-installing.xml <?xml version="1.0" ?> <!-- $Id: intro-installing.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.2 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.intro-installing"> <refnamediv> <refname>Installation</refname> <refpurpose> Comment installer PEAR::Calendar </refpurpose> </refnamediv> <refsect1> <title>Installation</title> <para> <itemizedlist> <listitem> <para>Configurez le gestionnaire de paquets PEAR (si vous ne l'avez pas déjà) - voyez <ulink url="http://pear.php.net/manual/fr/installation.getting.php">Obtenir le gestionnaire</ulink> (version en ligne de commande) ou <ulink url="http://www.phpkitchen.com/article.php?story=20021201062516970">Getting Up and Running with the PEAR Web Installer</ulink>.</para> </listitem> <listitem> <para>Tappez <command>pear install Calendar</command> (en utilisant le gestionnaire en ligne de commande)</para> </listitem> <listitem> <para>PEAR::Calendar est maintenant installé.</para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-overview-methods.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-overview-methods.xml +++ peardoc/fr/package/datetime/calendar/intro-overview-methods.xml <?xml version="1.0" ?> <!-- $Id: intro-overview-methods.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.5 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.intro-overview-methods"> <refnamediv> <refname>Method Overview</refname> <refpurpose> Tour d'horizon de l'API Calendar </refpurpose> </refnamediv> <refsect1> <title>Method Overview</title> <para> For the main Calendar classes (the subclasses of <classname>Calendar</classname>) all share a common API (a common set of class methods). Although there are some minor variations in specific cases, you should find it intuitive and easy to remember, once you are familiar with what's available. This section summarizes the common methods and highlights the variations. For further information, consult the API documentation. </para> </refsect1> <refsect1> <title>Constructors</title> <para>The constructors of the Date classes accept integer date values as their arguments, beginning with the year (on the left) across to the second (on the right), depending on what class you're using, for example; <programlisting role="php"> <![CDATA[ // Natural Calendar Classes $Year = new Calendar_Year(2003); // 2003 $Month = new Calendar_Month(2003, 10); // October 2003 $Day = new Calendar_Day(2003, 10, 25); // 25th October 2003 $Hour = new Calendar_Hour(2003, 10, 25, 13); // 25th October 2003 13:00:00 $Minute = new Calendar_Minute(2003, 10, 25, 13, 31); // 25th October 2003 13:31:00 $Second = new Calendar_Second(2003, 10, 25, 13, 31, 45); // 25th October 2003 13:31:45 // Tabular Calendar Classes $Month = new Calendar_Month_Weekdays(2003, 10); // October 2003 $Month = new Calendar_Month_Weeks(2003, 10); // October 2003 $Week = new Calendar_Week(2003, 10, 25); // week containing 25th October 2003 ]]> </programlisting> Note that the tabular classes, <classname>Calendar_Month_Weekdays</classname> and <classname>Calendar_Month_Weeks</classname> both take an optional third argument (integer) which specifies the first day of the week and adjust tabular display (normally it defaults to Monday (1) - pass the integer value 0 to switch to Sunday as the first day, for example). <classname>Calendar_Week</classname> accepts the first day argument as the fourth to it's constructor. </para> </refsect1> <refsect1> <title>Location Methods</title> <para> All date and tabular date classes share the methods defined in the abstract base class <classname>Calendar</classname>. Among these are methods for an object of any of these classes to identify itself (what's it's date is) and the previous and next dates. For example; <programlisting role="php"> <![CDATA[ // Create a day $Day = new Calendar_Day(2003, 10, 1); // 1st October 2003 echo $Day->thisDay(); // Displays 1 echo $Day->prevDay(); // Displays 30 (the 30th of September) echo $Day->nextDay(); // Displays 2 echo $Day->thisMonth(); // Displays 10 echo $Day->prevMonth(); // Displays 9 echo $Day->nextMonth(); // Displays 11 ]]> </programlisting> Notice that from the <varname>$Day</varname> I can find out not just about the day itself but also the month (or year/hour/minute/second). Notice also how <function>prevDay</function> returned 30, taking care of working out that the previous day is in September for you. There are <function>this***</function>, <function>prev***</function> and <function>next***</function> methods for years, months, days, hours, minutes and seconds. </para> <para> Calling any of these methods and passing the value TRUE will result in a timestamp being returned (the type of timestamp depends on the Calendar Engine you are using - see the FAQ), for example; <programlisting role="php"> <![CDATA[ // Create a second $Second = new Calendar_Second(2003, 10, 25, 13, 32, 44); echo $Second->thisYear(TRUE); // Displays 1041375600 echo $Second->thisMonth(TRUE); // Displays 1064959200 echo $Second->thisDay(TRUE); // Displays 1067032800 echo $Second->thisHour(TRUE); // Displays 1067079600 echo $Second->thisMinute(TRUE); // Displays 1067081520 echo $Second->thisSecond(TRUE); // Displays 1067081564 ]]> </programlisting> Notice how the timestamp return increases, depending on the method that was called to obtain it. The first, obtained from <function>thisYear(TRUE)</function> is a timestamp for the beginning of the year 2003 (1st January 2003 in fact) while the third from <function>thisDay(TRUE)</function> is a timestamp for 25th October 2003. </para> <para> <warning> <simpara> The <function>prev***</function> and <function>next***</function> methods return values calculated relative to the <emphasis>current</emphasis> Calendar object you are working with. In the above example, if you wanted the day <emphasis>and</emphasis> month of the next day (which should be 2nd October 2003), calling <function>nextDay</function> then <function>nextMonth</function> would give you the 2nd of <emphasis>November</emphasis> not October. Instead you should call <function>nextDay</function> passing it the argument TRUE, to get back a timestamp from which the next day can be obtained. Be aware of the <classname>Calendar_Decorator_Uri</classname> which is designed to help build URLs for next / prev links. </simpara> </warning> </para> <para> There are also the methods <function>thisWeek</function>, <function>prevWeek</function> and <function>nextWeek</function> which only become available if you're using an instance of <classname>Calendar_Week</classname>. The returned value format can be chosen among 'timestamp', 'n_in_month', 'n_in_year' or 'array'. Be careful - if you select 'n_in_month', it will return NULL if it reaches the beginning or end of a month. </para> <para> Finally all Calendar objects provide the methods <function>getTimeStamp</function> and <function>setTimeStamp</function>. The former returns a timestamp in the format used by the calendar engine you are working with (i.e. Unix Timestamp if it's the default UnixTs engine or of format YYYY-MM-DD HH:MM:SS). The later excepts a timestamp which is used to replace the values the Calendar object was constructed with. </para> </refsect1> <refsect1> <title>Building and Fetching</title> <para> Every date and tabular date class has a <function>build</function> method which is used to generate the children of that date object. For example <classname>Calendar_Month</classname> builds <classname>Calendar_Day</classname> objects, the days being <emphasis>"children"</emphasis> of the month. </para> <para> Once <function>build</function> is called, the children can be fetched from the date object using the simple <function>fetch</function> iterator, for example; <programlisting role="php"> <![CDATA[ $Month = new Calendar_Month(2003, 10); $Month->build(); $i = 1; while ($Day = $Month->fetch()) { echo $Day->thisDay()."<br />\n"; $i++; } echo $i; // Displays 31 (31 days in October) ]]> </programlisting> The <function>fetch</function> method returns one child at a time, in ascending date order, and returns FALSE when there are no more children. It also automatically resets the internal collection of children, meaning you can loop over them as many times as you like. </para> <para> If you don't like the iterator, and wish to use your own, you can simply extract the children with the <function>fetchAll</function> method (returns an indexed array of child date objects) and check the number you got back with <function>size</function>. Be careful the index of the array you get back from <function>fetchAll</function>. For <classname>Calendar_Year</classname>, <classname>Calendar_Month</classname>, <classname>Calendar_Month_Weekdays</classname>, <classname>Calendar_Month_Weeks</classname> and <classname>Calendar_Week</classname>, the first index of the array is 1 while for <classname>Calendar_Day</classname>, <classname>Calendar_Hour</classname>, <classname>Calendar_Minute</classname> and <classname>Calendar_Second</classname> the index begins with 0. Why? Consider 2003-1-1 00:00:00 ... </para> <para>Note: Calendar_Second::build() doesn't do anything - it has no children.</para> </refsect1> <refsect1> <title>Selecting Children</title> <para> To help with rendering the calendar, the <function>build</function> methods accept an index array of date objects which is compares with the children it is building. If it finds that an object that was passed to it matches a child, it set's the childs state to selected, meaning the <function>isSelected</function> method (available on any date or tabular date objects) returns TRUE. For example; <programlisting role="php"> <![CDATA[ $Month = new Calendar_Month(2003, 10); $DayX = new Calendar_Day(2003, 10, 15); $DayY = new Calendar_Day(2003, 10, 23); $selection = array($DayX, $DayY); $Month->build($selection); while ($Day = $Month->fetch()) { if ($Day->isSelected()) { echo $Day->thisDay()."<br />\n"; // Displays 15 or 23 } } ]]> </programlisting> In the above example, only 15th October 2003 and 23rd October 2003 are displayed. </para> <para> The objects you pass to <function>build</function> which match children that are being built <emphasis>replace</emphasis> the child (i.e. if there was a match, you get your object back). This allows you to "inject" your own objects into the loop, best accomplished by extending <classname>Calendar_Decorator</classname>. </para> <para> Note: the <classname>Calendar_Year</classname>::<function>build</function> method takes a second argument to specify the first day of the week (see above discussion on Constructors). </para> </refsect1> <refsect1> <title>Tabular Days</title> <para> The <classname>Calendar_Day</classname> class has three unique methods, which don't appear elsewhere, and are used purely for building tabular calendars. The <function>isEmpty</function> is used to determine whether the day is an empty day or not (see FAQ for explaination of empty days). The methods <function>isFirst</function> and <function>isLast</function> are used to mark the beginning and and of a week. </para> <para> Whether you need to use these methods depends on which class was used to build the day objects. If the day was built with <classname>Calendar_Month_Weekdays</classname>, all three of these methods are applicable (you may have empty days and <classname>Calendar_Month_Weekdays</classname> builts a complete month but delimits the beginning and end of each week so you can find it with <function>isFirst</function> and <function>isLast</function>). If the day was built with <classname>Calendar_Week</classname>, only the <function>isEmpty</function> method is applicable (the first or last week in a month may contain empty days). For day objects built in any other manner, <function>isEmpty</function>, <function>isFirst</function> and <function>isLast</function> are meaningless. </para> </refsect1> <refsect1> <title>Validation</title> <para> All date objects and tabular objects (except weeks) are capable of validating themselves. By default they accept whatever arguments they are given on construction but you can validate the date with the <function>isValid</function> method, for example; <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); if (!$Day->isValid()) { die ('Invalid date'); } ]]> </programlisting> For more fine grained validation, you can first call the <function>getValidator</function> method, to return an instance of <classname>Calendar_Validator</classname> then list the validation errors; <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); if (!$Day->isValid()) { $Validator = & $Day->getValidator(); while ($Error = $Validator->fetch()) { echo $Error->getUnit().' is invalid<br>'; } } ]]> </programlisting> or... <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); $Validator = & $Day->getValidator(); if (!$Validator->isValid()) { while ($Error = $Validator->fetch()) { echo $Error->toString().'<br>'; } } ]]> </programlisting> </para> <para>Note that rather than validating dates, you may prefer to automatically adjust them with the <function>adjust</function> method, for example; <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); $Day->adjust(); echo $Day->thisYear(); // 2003 echo $Day->thisMonth(); // 11 (moved forward a month) echo $Day->thisDay(); // 1 (the first of the month) ]]> </programlisting> </para> <para> That summarizes all the methods available within PEAR::Calendar, apart from the those provided in the Decorator classes. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-overview.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-overview.xml +++ peardoc/fr/package/datetime/calendar/intro-overview.xml <?xml version="1.0" ?> <!-- $Id: intro-overview.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.intro-overview"> <refnamediv> <refname>Tour d'horizon du package</refname> <refpurpose> Tour d'horizon des classes de Calendar </refpurpose> </refnamediv> <refsect1> <title>Tour d'horizon du package</title> <para> Lorsque vous travaillez avec PEAR::Calendar, il y'a un total de 12 classes (publiques) disponibles pour vous aider à résoudre les problèmes que vous rencontrez. On peut les grouper en classes de dates, dates tabulaires, validation et décorations. </para> </refsect1> <refsect1> <title>Classes de dates</title> <para>Elles fournissent une représentation de toutes les unités humaines basiques de dates. Elles héritent toutes de <classname>Calendar</classname> et fournissent les méthodes définies par la suite :</para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Year</classname> - represents a year and can build <classname>Calendar_Month</classname>, <classname>Calendar_Month_Weekdays</classname> and <classname>Calendar_Month_Weeks</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Year.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Month</classname> - represents a month and can build <classname>Calendar_Day</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Month.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Day</classname> - represents a day and can build <classname>Calendar_Hour</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Day.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Hour</classname> - represents a hour and can build <classname>Calendar_Minute</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Hour.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Minute</classname> - represents a minute and can build <classname>Calendar_Second</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Minute.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Second</classname> - represents a second but cannot build anything. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Second.php'; ]]></programlisting>.</para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.datetime.calendar.intro-overview.tabular"> <title>Tabular Date Classes</title> <para>Designed for building calendars in tabular format. All are subclasses of <classname>Calendar</classname> so provide the methods defined there.</para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Month_Weekdays</classname> - builds <classname>Calendar_Day</classname> objects setting the <function>isFirst</function>, <function>isLast</function> and <function>isEmpty</function> states, to display a month in tabular form. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Month/Weekdays.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Month_Weeks</classname> - builds <classname>Calendar_Week</classname> objects, representing a month in terms of the tabular weeks in contains (see FAQ for what a week represents). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Month/Weeks.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Week</classname> - builds <classname>Calendar_Day</classname> objects, setting the <function>isEmpty</function> state if necessary and representing a tabular week in a month (i.e. you get 7 days from it). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Week.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Week</classname> - builds <classname>Calendar_Day</classname> objects, setting the <function>isEmpty</function> state if necessary and representing a tabular week in a month (i.e. you get 7 days from it). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Week.php'; ]]></programlisting>.</para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.datetime.calendar.intro-overview.validation"> <title>Validation Classes</title> <para>Used to validate dates. <classname>Calendar</classname> provides the methods <function>isValid</function> to perform a simple check on any date and <function>getValidator</function> to return an instance of <classname>Calendar_Validator</classname> for fine grained validation.</para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Validator</classname> - is not instantiated by your code directly (you need need specifically include / create it) but instead returned from the <classname>Calendar</classname>::<function>getValidator</function> method you can call on any subclass of <classname>Calendar</classname>. It is used to provide fine grained validation of a date to find out exactly what's wrong with it (for simple validation just call <function>isValid</function> on any Date object or Tabular Date object, to know if it was created with valid values. </para> </listitem> <listitem> <para><classname>Calendar_Validation_Error</classname> - represents a validation error, providing methods to determine what went wrong. Available methods are <function>getUnit</function> (e.g. returns Year or Month), <function>getValue</function> (the value it failed with), <function>getMessage</function> (the validation error message) and <function>toString</function> which returns a combination of all the three preceding methods. The default validation error messages are in English but stored in the constants <constant>CALENDAR_VALUE_TOOSMALL</constant> and <constant>CALENDAR_VALUE_TOOLARGE</constant> which you can redefine in your code. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.datetime.calendar.intro-overview.decorators"> <title>Decorators</title> <para>Provide a mechanism to add functionality to the main calendar objects (the subclasses of <classname>Calendar</classname>) without needing to directly extend them (and risk overwriting fields accidentally). When you create a decorator, you pass it's constructor an instance of an existing calendar object. You can then make calls to the decorator in exactly the same way as you make calls to the original calendar object. This allows you to "overwrite" calendar methods, add new methods or even apply multiple decorators to the same calendar object. Decorators a typically either "injected" (via selection or the <classname>Calendar_Decorator_Wrapper</classname> decorator) into the loop where the calendar is rendered and / or to alter the output content (e.g. convert a numeric month into a textual month: 1 => January).</para> <para> PEAR::Calendar provides some decorator implementations for you, to help with common tasks. These are not designed to suit everyone and hence are provided as optional code for you to use as needed (avoiding the performance cost associated with parsing code you're not using). </para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Decorator</classname> - this is the base decorator class which you should extend with your own. It provides the same API as the calendar object it is decorating, and simply routes calls through to it. Example; <programlisting role="php"> <![CDATA[ require_once 'Calendar/Decorator.php'; class ChristmasDecorator extends Calendar_Decorator { function ChristmasDecorator(&$Calendar) { parent::Calendar_Decorator($Calendar); } // Quelques méthodes ajoutées function getDaysToChristmas() { $today = parent::thisDay(true); $Christmas = new Calendar_Day(date('Y'), 12, 25); $xmasday = $Christmas->thisDay(TRUE); $diff = $xmasday - $today; if ($diff < 0) { $NextChristmas = new Calendar_Day($Christmas->nextYear(), 12, 25); $nextxmasday = $NextChristmas->thisDay(true); $diff = $today - $nextxmasday; } return ($diff / 86400); } } ]]> </programlisting> </para> </listitem> <listitem> <para><classname>Calendar_Decorator_Uri</classname> - provides a decorator to help with generating URLs (for example next / prev URLs). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Decorator/Uri.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Decorator_Textual</classname> - helps with obtaining textual month names and weekday names from a calendar object. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Decorator/Textual.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Decorator_Wrapper</classname> - is intended to help you add decorators to the children of the calendar object you are working with. It will wrap the children in the decorator you specify at the point <function>fetch</function> or <function>fetchAll</function> is called, after a build <function>build</function> call. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Decorator/Wrapper.php'; ]]></programlisting>.</para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-purpose.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-purpose.xml +++ peardoc/fr/package/datetime/calendar/intro-purpose.xml <?xml version="1.0" ?> <!-- $Id: intro-purpose.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.intro-purpose"> <refnamediv> <refname>Introduction</refname> <refpurpose> Ce que peut faire <classname>Calendar</classname> </refpurpose> </refnamediv> <refsect1> <title>Introduction</title> <para> <warning> <simpara> Quelques classes de PEAR::Calendar requièrent PEAR::Date. Il manque quelques fichiers à la version 1.3.1beta de PEAR::Date, ce qui fait qu'elle ne fonctionne pas. Assurez-vous d'avoir PEAR::Date 1.3 (stable) d'installé. </simpara> </warning> </para> <para> PEAR::Calendar est un package pour générer des calendriers en tant que structures de données. Il ne formate rien et ne se base sur aucune couche d'abstraction, ce qui permet de l'utiliser dans différents cas. En même temps, ce package fournit une API facile d'utilisation qui rend le formattage facile, par exemple un calendrier HTML, tout en permettant de "connecter" le calendrier à votre couche d'abstraction. </para> <para> PEAR::Calendar a été développé à cause de l'absence d'alternatives en PHP. Il existe plusieurs classes / utilitaires mais elles sont toutes dédiée à un rendu spécifique (typiquement du HTML avec des possibilités limitées de personnalisation sans avoir à retoucher le code) et dépendent souvent sur un type particulier de données (comprendre MySQL). Cela pose de grosses restrictions sur les cas où elles peuvent être appliquées. Par contraste, PEAR::Calendar se borne à éliminer les calculs de la génération de calendriers, permettant à l'utilisateur final de traverser simplement une structure de données préparée. </para> <para> Quelques bénéfices / fonctionnalités de PEAR::Calendar : <itemizedlist> <listitem> <simpara>Vous pouvez obtenir le rendu que vous voulez (comme du (X)HTML, WML, SOAP, XML-RPC, ASCII en ligne de commande ou ce que vous voulez).</simpara> </listitem> <listitem> <simpara>Générer un calendrier devient aussi simple que boucler sur le résultat d'une requête SQL.</simpara> </listitem> <listitem> <simpara>Tous les "objets date" sont traités de l'année à la seconde (cela signifie que vous pouvez générer un calendrier complet de l'année avec des mois et des jours tout comme vous pouvez générer un "agenda par semaine / jour")</simpara> </listitem> <listitem> <simpara>Permet de générer des calendriers "tabulaires" facilement.</simpara> </listitem> <listitem> <simpara>Toute date peut facilement être validée (est-ce que le 29 Fév 2003 est valide ?).</simpara> </listitem> <listitem> <simpara>Fonctionne bien avec de gros nombres et des API orientées objet.</simpara> </listitem> <listitem> <simpara>La navigation dans les calendriers est facile (fournir un lien du 1er Janvier 2004 au 31 décembre 2004 n'est pas un problème).</simpara> </listitem> <listitem> <simpara>Il retourne des valeurs numériques pour toutes les opérations, ce qui signifie que vous n'êtes pas obligés d'utiliser les noms anglais pour les mois par exemple. Vous les générerez vous-mêmes avec des fonctions PHP telles que strftime() et setlocale().</simpara> </listitem> <listitem> <simpara>La représentation des dates peut être obtenue sous un format lisible par l'homme, ou en tant que timestamp Unix, selon le moteur de calendrier que vous utilisez.</simpara> </listitem> <listitem> <simpara>Vous pouvez ajouter vos propres fonctionnalités au calendrier en créant des Decorators.</simpara> </listitem> <listitem> <simpara>Vous permet d'écrire des applications N-tierces, avec des couches.</simpara> </listitem> <listitem> <simpara>Le "moteur de calcul" du calendrier est abstrait, ce qui signifie que vous n'êtes pas obligés d'utiliser le calendrier Gregorien - vous pouvez écrire un calendrier Tolkiénien si vous voulez. Actuellement, des "moteurs" basés sur Unixtimestamps (par défaut) et PEAR::<classname>Date</classname> ont été implémentés.</simpara> </listitem> </itemizedlist> </para> <para> <example> <title>Un exemple simple</title> <programlisting role="php"> <![CDATA[ <?php require_once 'Calendar/Month.php'; $Month = new Calendar_Month(2003, 10); // October 2003 $Month->build(); // Construire les jours du mois // On boucle dans les jours.. while ($Day = $Month->fetch()) { echo $Day->thisDay(), '<br />'; } ?> ]]> </programlisting> </example> <emphasis>Note:</emphasis> il y'a plusieurs exemples complets fournis avec le package PEAR::Calendar. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator-textual.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator-textual.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator-textual.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-decorator-textual"> <refnamediv> <refname>Calendar_Decorator_Textual</refname> <refpurpose>API Calendar_Decorator_Textual</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator-textual.desc"> &title.desc; <para> API <classname>Calendar_Decorator_Textual</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator-uri.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator-uri.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator-uri.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-decorator-uri"> <refnamediv> <refname>Calendar_Decorator_Uri</refname> <refpurpose>API Calendar_Decorator_Uri</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator-uri.desc"> &title.desc; <para> API <classname>Calendar_Decorator_Uri</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator-wrapper.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator-wrapper.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator-wrapper.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-decorator-wrapper"> <refnamediv> <refname>Calendar_Decorator_Wrapper</refname> <refpurpose>API Calendar_Decorator_Wrapper</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator-wrapper.desc"> &title.desc; <para> API <classname>Calendar_Decorator_Wrapper</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-decorator.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-decorator.xml +++ peardoc/fr/package/datetime/calendar/calendar-decorator.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar-decorator"> <refnamediv> <refname>Calendar_Decorator</refname> <refpurpose>API Calendar_Decorator</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-decorator.desc"> &title.desc; <para> API <classname>Calendar_Decorator</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-engine-interface.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-engine-interface.xml +++ peardoc/fr/package/datetime/calendar/calendar-engine-interface.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-engine-interface"> <refnamediv> <refname>Calendar_Engine_Interface</refname> <refpurpose>API Calendar_Engine_Interface</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-engine-interface.desc"> &title.desc; <para> API <classname>Calendar_Engine_Interface</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-engine-peardate.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-engine-peardate.xml +++ peardoc/fr/package/datetime/calendar/calendar-engine-peardate.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-engine-peardate"> <refnamediv> <refname>Calendar_Engine_PearDate</refname> <refpurpose>API Calendar_Engine_PearDate</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-engine-peardate.desc"> &title.desc; <para> API <classname>Calendar_Engine_PearDate</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-engine-unixts.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-engine-unixts.xml +++ peardoc/fr/package/datetime/calendar/calendar-engine-unixts.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-engine-unixts"> <refnamediv> <refname>Calendar_Engine_UnixTs</refname> <refpurpose>API Calendar_Engine_UnixTs</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-engine-unixts.desc"> &title.desc; <para> API <classname>Calendar_Engine_UnixTs</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-month-weekdays.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-month-weekdays.xml +++ peardoc/fr/package/datetime/calendar/calendar-month-weekdays.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-month-weekdays"> <refnamediv> <refname>Calendar_Month_Weekdays</refname> <refpurpose>API Calendar_Month_Weekdays</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-month-weekdays.desc"> &title.desc; <para> API <classname>Calendar_Month_Weekdays</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-table-helper.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-table-helper.xml +++ peardoc/fr/package/datetime/calendar/calendar-table-helper.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-table-helper"> <refnamediv> <refname>Calendar_Table_Helper</refname> <refpurpose>API Calendar_Table_Helper</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-table-helper.desc"> &title.desc; <para> API <classname>Calendar_Table_Helper</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-validation-error.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-validation-error.xml +++ peardoc/fr/package/datetime/calendar/calendar-validation-error.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-validation-error"> <refnamediv> <refname>Calendar_Validation_Error</refname> <refpurpose>API Calendar_Validation_Error</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-validation-error.desc"> &title.desc; <para> API <classname>Calendar_Validation_Error</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-validator.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-validator.xml +++ peardoc/fr/package/datetime/calendar/calendar-validator.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-validator"> <refnamediv> <refname>Calendar_Validator</refname> <refpurpose>API Calendar_Validator</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-validator.desc"> &title.desc; <para> API <classname>Calendar_Validator</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar-week.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar-week.xml +++ peardoc/fr/package/datetime/calendar/calendar-week.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar-week"> <refnamediv> <refname>Calendar_Week</refname> <refpurpose>API Calendar_Week</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar-week.desc"> &title.desc; <para> API <classname>Calendar_Week</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/calendar.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/calendar.xml +++ peardoc/fr/package/datetime/calendar/calendar.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.calendar"> <refnamediv> <refname>Calendar</refname> <refpurpose>Classe de base Calendar</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.calendar.desc"> &title.desc; <para> API <classname>Calendar</classname>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/constants.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/constants.xml +++ peardoc/fr/package/datetime/calendar/constants.xml <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.1 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.constants"> <refnamediv> <refname>Constantes du package Calendar</refname> <refpurpose>Constantes définies et utilisées dans Calendar</refpurpose> </refnamediv> <refsect1 id="package.datetime.calendar.constants.details"> <title>Toutes les constantes</title> <refsect2 id="package.datetime.calendar.constants.details.calendar---php"> <title> Constantes définies dans Calendar.php </title> <para> <table> <title>Constantes définies dans Calendar.php</title> <tgroup cols="3"> <thead> <row> <entry>Nom</entry> <entry>Valeur</entry> <entry>Numéro de ligne</entry> </row> </thead> <tbody> <row> <entry>CALENDAR_ENGINE</entry> <entry>'UnixTS'</entry> <entry>39</entry> </row> <row> <entry>CALENDAR_ROOT</entry> <entry>'Calendar'.DIRECTORY_SEPARATOR</entry> <entry>32</entry> </row> </tbody> </tgroup> </table> </para> </refsect2> <refsect2 id="package.datetime.calendar.constants.details.validator---php"> <title> Constantes définies dans Validator.php </title> <para> <table> <title>Constantes définies dans Validator.php</title> <tgroup cols="3"> <thead> <row> <entry>Nom</entry> <entry>Valeur</entry> <entry>Numéro de ligne</entry> </row> </thead> <tbody> <row> <entry>CALENDAR_VALUE_TOOLARGE</entry> <entry>'Too large: max = '</entry> <entry>34</entry> </row> <row> <entry>CALENDAR_VALUE_TOOSMALL</entry> <entry>'Too small: min = '</entry> <entry>31</entry> </row> </tbody> </tgroup> </table> </para> </refsect2> <refsect2 id="package.datetime.calendar.constants.details.year---php"> <title> Constantes définies dans Year.php </title> <para> <table> <title>Constantes définies dans Year.php</title> <tgroup cols="3"> <thead> <row> <entry>Nom</entry> <entry>Valeur</entry> <entry>Numéro de ligne</entry> </row> </thead> <tbody> <row> <entry>CALENDAR_USE_MONTH</entry> <entry>1</entry> <entry>43</entry> </row> <row> <entry>CALENDAR_USE_MONTH_WEEKDAYS</entry> <entry>2</entry> <entry>44</entry> </row> <row> <entry>CALENDAR_USE_MONTH_WEEKS</entry> <entry>3</entry> <entry>45</entry> </row> </tbody> </tgroup> </table> </para> </refsect2> </refsect1> </refentry> <!-- Generated by phpDocumentor v 1.2.3 http://www.phpdoc.org --> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/faq.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/faq.xml +++ peardoc/fr/package/datetime/calendar/faq.xml <?xml version="1.0" ?> <!-- $Id: faq.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.5 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.faq"> <refnamediv> <refname>FAQ</refname> <refpurpose> Foire Aux Questions </refpurpose> </refnamediv> <refsect1> <title>Pourquoi ce n'est pas du HTML qui est généré ?</title> <para> Et si vous vouliez du WML, SOAP, PDF, GIF, ligne de commande, etc. etc.? PEAR::Calendar peut être utilisé pour générer le type de format que vous voulez (voyez les exemples pour SOAP et WML). Le contonner à un type particulier de rendu limiterai son utilisation (c'est le problème de toutes les librairies PHP de génération de calendriers que j'ai connu). Un package comme PEAR::HTML_Calendar pourrait être développé avec PEAR::Calendar. </para> </refsect1> <refsect1> <title>Il y'a trop d'objets, de classes et de fichiers, c'est une usine à gaz !</title> <para> En testant les exemples sur les serveurs de Sourceforge (qui sont toujours surchargés), example3.php s'exécute en 0.1 seconde (et même moins). Le code est extremement optimisé et chaque astuce connue a été appliquée pour être sûr que PHP n'exécute que la portion de code dont vous avez besoin. Si vous en doutez, utilisez <classname>Cache_Lite</classname> pour mettre en cache le rendu HTML. </para> </refsect1> <refsect1> <title>Vous utilisez des timestamps Unix pour calculer le calendrier, ce qui limite l'intervalle des années pouvant être générées. Peut-on changer cela ?</title> <para> All calculations are handled by a class implementing the Calendar_Engine interface. The default implemention is based on PHP's <function>date</function> and <function>mktime</function> functions (so timestamp Unixs are required for that engine). A second engine exists which uses PEAR::Date. It's slower but overcomes the limit on the range of Unixstamps. To switch between engines use the constant <constant>CALENDAR_ENGINE</constant> e.g. <programlisting role="php"> <![CDATA[ <?php // Le moteur par défaut est celui des timestamps UNIX (cet appel n'est pas requis) // define('CALENDAR_ENGINE', 'UnixTs'); // Passer au moteur PEAR::Date define('CALENDAR_ENGINE', 'PearDate'); ?> ]]> </programlisting> Notez que le moteur de PEAR::Date est basé sur la version 1.3 de PEAR Date (il manque un fichier essentiel dans la version 1.3.1beta, ce qui fait qu'elle ne fonctionne pas). </para> </refsect1> <refsect1> <title>Ces exemples utilisent la langue anglaise pour les noms. Peut-on changer la langue ?</title> <para> PEAR::Calendar only uses base 10 numbers for calculations - the names of months and days of the week and generated as the calendar is being rendered (by you). You should only need to change PHP's locale with <function>setlocale</function> and use the <function>strftime</function> function e.g.; <programlisting role="php"> <![CDATA[ $Day = & new Calendar_Day(2003, 10, 23); setlocale (LC_TIME, 'de_DE'); // German echo strftime('%A %d %B %Y', $Day->getTimeStamp()); ]]> </programlisting> Note that <classname>Calendar_Decorator_Textual</classname> provides help in generating month and day of week names in a manner which is independent of the Calendar Engine you are using and can be modified with <function>setlocale</function>. </para> </refsect1> <refsect1> <title>Que sont les EmptyDays?</title> <para> PEAR::Calendar makes it easy to render calendars in tabular format (like humans are used to) such as; <literallayout> October 2003 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 </literallayout> Notice the top left and botton right of this example - these are "EmptyDays". EmptyDays are generated only by two calendar classes: Calendar_Month_Weekdays and Calendar_Week. For example using Calendar_Month_Weekdays; <programlisting role="php"> <![CDATA[ <?php require_once 'Calendar/Month/Weekdays.php'; $Month = & new Calendar_Month_Weekdays(2003, 10); $Month->build(); while ($Day = & $Month->fetch()) { if ($Day->isFirst()) // Check for the start of a week echo "\n"; if ($Day->isEmpty()) // Check to see if day is empty echo "\t"; else echo $Day->thisDay()."\t"; if ($Day->isLast()) // Check for the end of a week echo "\n"; } ?> ]]> </programlisting> An empty day can still return values, the date it represents being from the previous or next month in the calendar. You may get empty days for <classname>Calendar_Month_Weekdays</classname> and <classname>Calendar_Week</classname>. Using <classname>Calendar_Week</classname>, you will only build 7 days (use <classname>Calendar_Month_Weeks</classname> to build <classname>Calendar_Week</classname> objects), so the <function>isFirst</function> and <function>isLast</function> methods are not applicable. </para> </refsect1> <refsect1> <title>How do I select some dates?</title> <para> All calendar objects (except <classname>Calendar_Second</classname>, which has no "children") have the method <function>build</function> to build the "children" of that object. For example <classname>Calendar_Year</classname>::<function>build</function> builds <classname>Calendar_Month</classname> objects while <classname>Calendar_Hour</classname>::<function>build</function> builds <classname>Calendar_Minute</classname> objects. You have the option of passing this method an indexed array of Calendar objects which will be used to "select" the matching built children. For example; <programlisting role="php"> <![CDATA[ $Month = & new Calendar_Month(2003, 10); // Oct 2003 $SelectedDay1 = & new Calendar_Day(2003, 10, 5); Oct 5th 2003 $SelectedDay2 = & new Calendar_Day(2003, 10, 21); Oct 21st 2003 // Place in an array... $selection = array($SelectedDay1, $SelectedDay2); $Month->build($selection); while ($Day = & $Month->fetch()) { if ($Day->isSelected()) echo $Day->thisYear().' '.$Day->thisMonth().' '.$Day->thisDay().' is selected'."\n"; } ]]> </programlisting> <emphasis>Note:</emphasis> date objects you pass to a <function>build</function> method replace the corresponding built date objects, allowing you to do things like attach your own subclass of <classname>Calendar_Decorator</classname> to them, then access the decorating functionality inside the loop which renders the calendar. You might display the contents from an "events database table" using this approach. </para> </refsect1> <refsect1> <title>Why do I have to call build() explicitly. Why can't children be built automatically?</title> <para> First and foremost, for performance. Building the children has a performance cost and you won't always need to have the children, so it should be called explicitly, otherwise you might have $Year->build(), expecting to get just months but behind the scenes, months built days, which built hours, which build minutes etc. Also calling <function>build</function> yourself give you a chance to "select" some of the children. </para> </refsect1> <refsect1> <title>How do I validate a date?</title> <para> Validity is determined by the Caalendar_Engine being used as well as the time the date object you're working with represents (e.g. $Month = & new Month(2003, 2, 29); is invalid, because Feb 2003 was not a leap year). For quick validation, you can call the method <function>isValid</function> on any date object, which will return FALSE if there's a problem. For more information of more detailed validation, you can call the method <function>getValidator</function> on any date object, which returns an instance of the class <classname>Calendar_Validator</classname>. For example; <programlisting role="php"> <![CDATA[ $Month = & new Month(2003, 2, 29); // 29th Feb 2003 (?!?) if (!$Month->isValid()) { $Validator = & $Month->getValidator(); while ($Error = $Validator->fetch()) { echo $Error->toString(); } } ]]> </programlisting> You can also begin validation by calling <function>getValidator</function> then either <function>isValidYear</function>, <function>isValidMonth</function>, <function>isValidDay</function>, <function>isValidHour</function>, <function>isValidMinute</function> and <function>isValidSecond</function> (or just <function>isValid</function> which calls all of the isValidxxx methods). </para> </refsect1> <refsect1> <title>Can I adjust invalid dates?</title> <para> If you're allowing end users to navigate your calendar via the URL, were they to modify the URL to something like calendar.php?year=2003&month=13, instead of throwing a validation error at them, you could call the <classname>Calendar</classname>::<function>adjust</function> method on the calendar object you create with that URL. You should then end up with January 2004 (in this example). This behaviour is possible thanks to <function>mktime</function> for the Unix Timestamp engine, while being built into the PEAR Date engine for you. </para> </refsect1> <refsect1> <title>Après avoir appelé build(), I just want to get a single child date object with looping through the lot. How?</title> <para> The method <function>fetchAll</function> can be called on any date object to get an indexed array of all the children which have been built, allowing you to reference them directly. Be careful with the first index of this array - in some cases it will be [1] not [0], depending on the type of date object built. For example; <programlisting role="php"> <![CDATA[ $Month = & new Calendar_Month(2003, 10); $Month->build(); $days = & $Month->fetchAll(); // Now all in array echo $days[1]->thisDay(); // The first day has index 1 $Hour = & new Calendar_Hour(2003, 10, 25, 15); // Oct 25th 2003, 3pm $Hour->build(); $hours = & $Hour->fetchAll(); // Now all in array echo $hours[0]->thisHour(); // The first hour has index 0 ]]> </programlisting> The following classes are always built to have the first index as 1: <classname>Calendar_Month </classname>, <classname>Calendar_Month_Weekdays</classname>, <classname>Calendar_Month_Weeks </classname>, <classname>Calendar_Week</classname> and <classname>Calendar_Day</classname> The following classes are always built to have the first index as 0: <classname>Calendar_Hour </classname>, <classname>Calendar_Minute</classname> and <classname>Calendar_Second</classname> Note also the method <function>size</function> can be called on any date object, after <function>build</function> has been called, to get the number of children. </para> </refsect1> <refsect1> <title>What does a week actually represent in PEAR::Calendar?</title> <para> Weeks are "pseudo" dates. They're useful for formatting the user interface for end users. Weeks are instantiated with a year, a month and a day of the month. You can then have the week tell you its timestamp (which will be the same as the timestamp for the first day in the week), its numeric position within the <emphasis>tabular</emphasis> month (see Empty Days above), its numeric position within the year (this is an ISO-8601 week number of year, weeks starting on Monday) or an array containing the numeric year, month and the first day of the week (as a number within the month). For example; <programlisting role="php"> <![CDATA[ $Week = & new Calendar_Week(2003, 10, 15); $Week = new Calendar_Week(2003, 10, 15); echo $Week->thisWeek(); // Displays 2 (week num in month) echo $Week->thisWeek('n_in_month'); // Display 2 - same as above echo $Week->thisWeek('n_in_year'); // Displays 41 (week in year) echo $Week->thisWeek('timestamp'); // Displays unix timestamp or an ISO-8601 datetime // (YYYY-MM-DD HH:MM:SS), depending on the engine. print_r $Week->thisWeek('array'); // [year] => 2003 [month] => 10 [day] => 12 ]]> </programlisting> </para> </refsect1> <refsect1> <title>How do I get a Calendar_Year to build Calendar_Month_Weekdays or Calendar_Month_Weeks, instead of the default Calendar_Month objects?</title> <para> When working with a <classname>Calendar_Year</classname>, the constants <constant> CALENDAR_MONTH_STATE</constant> controls what type of month object is built. You can define <constant>CALENDAR_MONTH_STATE</constant> to <constant>CALENDAR_USE_MONTH_WEEKDAYS</constant> or <constant>CALENDAR_USE_MONTH_WEEKS</constant> for the Calendar_Month_Weekdays and <classname> Calendar_Month_Week</classname> classes, respectively. </para> </refsect1> <refsect1> <title>Vous utilisez Lundi comme premier jour de la semaine, puis-je changer ?</title> <para> Yes. For the classes which are concerned with the notion of a "week", you can can pass a value which defines the first day of the week. For the default timestamp based Calendar engine, this is a number from 0 to 6, 0 being Sunday through to 6 being Saturday. This value can be passed to the following: <programlisting role="php"> <![CDATA[ $Year = new Calendar_Year(2003); $selection = array(); $Year->build($selection, 0); // the second argument is the first day of the week (Sunday) $MonthWeekdays = new Calendar_Month_Weekdays(2003, 10, 6); // Third argument - Saturday $MonthWeeks = new Calendar_Month_Weekdays(2003, 10, 2); // Third argument - Tuesday $Week = new Calendar_Week(2003, 10, 15, 5) // Fourth argument - Friday ]]> </programlisting> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-decorators.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-decorators.xml +++ peardoc/fr/package/datetime/calendar/intro-decorators.xml <?xml version="1.0" ?> <!-- $Id: intro-decorators.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.intro-decorators"> <refnamediv> <refname>Décorateurs de Calendar</refname> <refpurpose> A quoi sert <classname>Calendar_Decorator</classname> </refpurpose> </refnamediv> <refsect1> <title>Décorateurs de Calendar</title> <para> La classe <classname>Calendar_Decorator</classname> est fournie pour vous aider à ajouter des fonctionnalités à des objets Calendar existants sans avoir besoin de les dériver. Cela est utile dans plusieurs situations, comme par exemple, permettre d'afficher le résultat d'une requête sous forme d'un Calendrier ou encore pour modifier les valeurs retournées par les méthodes de Calendar (convertir un numéro de mois en nom de mois). </para> <para> Quelques décorateurs concrets sont fournis avec PEAR::Calendar, pour répondre aux problèmes communs que vous pouvez rencontrer en utilisant cette librairie. Ils ne sont pas faits pour répondre aux besoins particluiers de chacuns, mais ils pourront vous servir de base pour résoudre vos problèmes. Ils ne seront exécutés par PHP que si vous les incluez explicitement dans votre code. Un exemple d'utilité : <programlisting role="php"> <![CDATA[ <?php require_once 'Calendar/Day.php'; require_once 'Calendar/Decorator.php'; class WorkingDay extends Calendar_Decorator { function WorkingDay(& $Calendar) { parent::Calendar_Decorator($Calendar); } // On écrase la méthode fetch de l'objet Calendar function fetch() { if ( $Hour = parent::fetch() ) { // Mode récursif, on ne retourne que les heures entre 8 heure du matin et 6 heure du soir if ( $Hour->thisHour() < 8 || $Hour->thisHour() > 18 ) { return $this->fetch(); } else { return $Hour; } } else { // Assurez-vous de retourner FALSE lorsque la vrai méthode fetch n'a rien retourné // sinon vous aurez une boucle infinie return FALSE; } } } // On crée la date du jour et on construit les heures $Day = new Calendar_Day(date('Y'), date('n'), date('d')); $Day->build(); // On crée le décorateur en passant la date du jour $WorkingDay = new WorkingDay($Day); // Seule les heures de travail sont affichées while ( $Hour = $WorkingDay->fetch() ) { echo ( $Hour->thisHour().'<br>' ); } ?> ]]> </programlisting> </para> </refsect1> <refsect1> <title>La classe de base Calendar_Decorator</title> <para> La classe de base <classname>Calendar_Decorator</classname> "mirrors" the combined API of all the subclasses of <classname>Calendar</classname>. It accepts a Calendar object to it's constructor then "takes over" the API allowing you to make calls through it rather than directly to the original calendar object. The <classname>Calendar_Decorator</classname> simply routes calls through to the calendar object it is decorating and returns values where appropriate. </para> </refsect1> <refsect1> <title>Decorators and Date Selection</title> <para> One important use of decorators is to help "inject" data into the loop which renders the calendar. This helps with fetching data from some sort of "event" table in a database. When passing a selection array to any <function>build</function> method, the selected date objects will replace the default built objects, allowing you to get them back as inside the <function>fetch</function> loop, using the <function>isSelected</function> method. You'll find an example of this in the PEAR::Calendar download. It should always be possible to fetch the event data you need with a single database query... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-inahurry.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-inahurry.xml +++ peardoc/fr/package/datetime/calendar/intro-inahurry.xml <?xml version="1.0" ?> <!-- $Id: intro-inahurry.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.intro-inahurry"> <refnamediv> <refname>En rapide</refname> <refpurpose> Ajoutez juste de l'eau chaude.. </refpurpose> </refnamediv> <refsect1> <title>En rapide</title> <para> <programlisting role="php"> <![CDATA[ require_once 'Calendar/Month/Weekdays.php'; $Month = new Calendar_Month_Weekdays(date('Y'), date('n')); $Month->build(); echo "<table>\n"; while ($Day = $Month->fetch()) { if ($Day->isFirst()) { echo "<tr>\n"; } if ($Day->isEmpty()) { echo "<td> </td>\n"; } else { echo '<td>'.$Day->thisDay()."</td>\n"; } if ($Day->isLast()) { echo "</tr>\n"; } } echo "</table>\n"; ]]> </programlisting> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-installing.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-installing.xml +++ peardoc/fr/package/datetime/calendar/intro-installing.xml <?xml version="1.0" ?> <!-- $Id: intro-installing.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.2 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.intro-installing"> <refnamediv> <refname>Installation</refname> <refpurpose> Comment installer PEAR::Calendar </refpurpose> </refnamediv> <refsect1> <title>Installation</title> <para> <itemizedlist> <listitem> <para>Configurez le gestionnaire de paquets PEAR (si vous ne l'avez pas déjà) - voyez <ulink url="http://pear.php.net/manual/fr/installation.getting.php">Obtenir le gestionnaire</ulink> (version en ligne de commande) ou <ulink url="http://www.phpkitchen.com/article.php?story=20021201062516970">Getting Up and Running with the PEAR Web Installer</ulink>.</para> </listitem> <listitem> <para>Tappez <command>pear install Calendar</command> (en utilisant le gestionnaire en ligne de commande)</para> </listitem> <listitem> <para>PEAR::Calendar est maintenant installé.</para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-overview-methods.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-overview-methods.xml +++ peardoc/fr/package/datetime/calendar/intro-overview-methods.xml <?xml version="1.0" ?> <!-- $Id: intro-overview-methods.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.5 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.intro-overview-methods"> <refnamediv> <refname>Method Overview</refname> <refpurpose> Tour d'horizon de l'API Calendar </refpurpose> </refnamediv> <refsect1> <title>Method Overview</title> <para> For the main Calendar classes (the subclasses of <classname>Calendar</classname>) all share a common API (a common set of class methods). Although there are some minor variations in specific cases, you should find it intuitive and easy to remember, once you are familiar with what's available. This section summarizes the common methods and highlights the variations. For further information, consult the API documentation. </para> </refsect1> <refsect1> <title>Constructors</title> <para>The constructors of the Date classes accept integer date values as their arguments, beginning with the year (on the left) across to the second (on the right), depending on what class you're using, for example; <programlisting role="php"> <![CDATA[ // Natural Calendar Classes $Year = new Calendar_Year(2003); // 2003 $Month = new Calendar_Month(2003, 10); // October 2003 $Day = new Calendar_Day(2003, 10, 25); // 25th October 2003 $Hour = new Calendar_Hour(2003, 10, 25, 13); // 25th October 2003 13:00:00 $Minute = new Calendar_Minute(2003, 10, 25, 13, 31); // 25th October 2003 13:31:00 $Second = new Calendar_Second(2003, 10, 25, 13, 31, 45); // 25th October 2003 13:31:45 // Tabular Calendar Classes $Month = new Calendar_Month_Weekdays(2003, 10); // October 2003 $Month = new Calendar_Month_Weeks(2003, 10); // October 2003 $Week = new Calendar_Week(2003, 10, 25); // week containing 25th October 2003 ]]> </programlisting> Note that the tabular classes, <classname>Calendar_Month_Weekdays</classname> and <classname>Calendar_Month_Weeks</classname> both take an optional third argument (integer) which specifies the first day of the week and adjust tabular display (normally it defaults to Monday (1) - pass the integer value 0 to switch to Sunday as the first day, for example). <classname>Calendar_Week</classname> accepts the first day argument as the fourth to it's constructor. </para> </refsect1> <refsect1> <title>Location Methods</title> <para> All date and tabular date classes share the methods defined in the abstract base class <classname>Calendar</classname>. Among these are methods for an object of any of these classes to identify itself (what's it's date is) and the previous and next dates. For example; <programlisting role="php"> <![CDATA[ // Create a day $Day = new Calendar_Day(2003, 10, 1); // 1st October 2003 echo $Day->thisDay(); // Displays 1 echo $Day->prevDay(); // Displays 30 (the 30th of September) echo $Day->nextDay(); // Displays 2 echo $Day->thisMonth(); // Displays 10 echo $Day->prevMonth(); // Displays 9 echo $Day->nextMonth(); // Displays 11 ]]> </programlisting> Notice that from the <varname>$Day</varname> I can find out not just about the day itself but also the month (or year/hour/minute/second). Notice also how <function>prevDay</function> returned 30, taking care of working out that the previous day is in September for you. There are <function>this***</function>, <function>prev***</function> and <function>next***</function> methods for years, months, days, hours, minutes and seconds. </para> <para> Calling any of these methods and passing the value TRUE will result in a timestamp being returned (the type of timestamp depends on the Calendar Engine you are using - see the FAQ), for example; <programlisting role="php"> <![CDATA[ // Create a second $Second = new Calendar_Second(2003, 10, 25, 13, 32, 44); echo $Second->thisYear(TRUE); // Displays 1041375600 echo $Second->thisMonth(TRUE); // Displays 1064959200 echo $Second->thisDay(TRUE); // Displays 1067032800 echo $Second->thisHour(TRUE); // Displays 1067079600 echo $Second->thisMinute(TRUE); // Displays 1067081520 echo $Second->thisSecond(TRUE); // Displays 1067081564 ]]> </programlisting> Notice how the timestamp return increases, depending on the method that was called to obtain it. The first, obtained from <function>thisYear(TRUE)</function> is a timestamp for the beginning of the year 2003 (1st January 2003 in fact) while the third from <function>thisDay(TRUE)</function> is a timestamp for 25th October 2003. </para> <para> <warning> <simpara> The <function>prev***</function> and <function>next***</function> methods return values calculated relative to the <emphasis>current</emphasis> Calendar object you are working with. In the above example, if you wanted the day <emphasis>and</emphasis> month of the next day (which should be 2nd October 2003), calling <function>nextDay</function> then <function>nextMonth</function> would give you the 2nd of <emphasis>November</emphasis> not October. Instead you should call <function>nextDay</function> passing it the argument TRUE, to get back a timestamp from which the next day can be obtained. Be aware of the <classname>Calendar_Decorator_Uri</classname> which is designed to help build URLs for next / prev links. </simpara> </warning> </para> <para> There are also the methods <function>thisWeek</function>, <function>prevWeek</function> and <function>nextWeek</function> which only become available if you're using an instance of <classname>Calendar_Week</classname>. The returned value format can be chosen among 'timestamp', 'n_in_month', 'n_in_year' or 'array'. Be careful - if you select 'n_in_month', it will return NULL if it reaches the beginning or end of a month. </para> <para> Finally all Calendar objects provide the methods <function>getTimeStamp</function> and <function>setTimeStamp</function>. The former returns a timestamp in the format used by the calendar engine you are working with (i.e. Unix Timestamp if it's the default UnixTs engine or of format YYYY-MM-DD HH:MM:SS). The later excepts a timestamp which is used to replace the values the Calendar object was constructed with. </para> </refsect1> <refsect1> <title>Building and Fetching</title> <para> Every date and tabular date class has a <function>build</function> method which is used to generate the children of that date object. For example <classname>Calendar_Month</classname> builds <classname>Calendar_Day</classname> objects, the days being <emphasis>"children"</emphasis> of the month. </para> <para> Once <function>build</function> is called, the children can be fetched from the date object using the simple <function>fetch</function> iterator, for example; <programlisting role="php"> <![CDATA[ $Month = new Calendar_Month(2003, 10); $Month->build(); $i = 1; while ($Day = $Month->fetch()) { echo $Day->thisDay()."<br />\n"; $i++; } echo $i; // Displays 31 (31 days in October) ]]> </programlisting> The <function>fetch</function> method returns one child at a time, in ascending date order, and returns FALSE when there are no more children. It also automatically resets the internal collection of children, meaning you can loop over them as many times as you like. </para> <para> If you don't like the iterator, and wish to use your own, you can simply extract the children with the <function>fetchAll</function> method (returns an indexed array of child date objects) and check the number you got back with <function>size</function>. Be careful the index of the array you get back from <function>fetchAll</function>. For <classname>Calendar_Year</classname>, <classname>Calendar_Month</classname>, <classname>Calendar_Month_Weekdays</classname>, <classname>Calendar_Month_Weeks</classname> and <classname>Calendar_Week</classname>, the first index of the array is 1 while for <classname>Calendar_Day</classname>, <classname>Calendar_Hour</classname>, <classname>Calendar_Minute</classname> and <classname>Calendar_Second</classname> the index begins with 0. Why? Consider 2003-1-1 00:00:00 ... </para> <para>Note: Calendar_Second::build() doesn't do anything - it has no children.</para> </refsect1> <refsect1> <title>Selecting Children</title> <para> To help with rendering the calendar, the <function>build</function> methods accept an index array of date objects which is compares with the children it is building. If it finds that an object that was passed to it matches a child, it set's the childs state to selected, meaning the <function>isSelected</function> method (available on any date or tabular date objects) returns TRUE. For example; <programlisting role="php"> <![CDATA[ $Month = new Calendar_Month(2003, 10); $DayX = new Calendar_Day(2003, 10, 15); $DayY = new Calendar_Day(2003, 10, 23); $selection = array($DayX, $DayY); $Month->build($selection); while ($Day = $Month->fetch()) { if ($Day->isSelected()) { echo $Day->thisDay()."<br />\n"; // Displays 15 or 23 } } ]]> </programlisting> In the above example, only 15th October 2003 and 23rd October 2003 are displayed. </para> <para> The objects you pass to <function>build</function> which match children that are being built <emphasis>replace</emphasis> the child (i.e. if there was a match, you get your object back). This allows you to "inject" your own objects into the loop, best accomplished by extending <classname>Calendar_Decorator</classname>. </para> <para> Note: the <classname>Calendar_Year</classname>::<function>build</function> method takes a second argument to specify the first day of the week (see above discussion on Constructors). </para> </refsect1> <refsect1> <title>Tabular Days</title> <para> The <classname>Calendar_Day</classname> class has three unique methods, which don't appear elsewhere, and are used purely for building tabular calendars. The <function>isEmpty</function> is used to determine whether the day is an empty day or not (see FAQ for explaination of empty days). The methods <function>isFirst</function> and <function>isLast</function> are used to mark the beginning and and of a week. </para> <para> Whether you need to use these methods depends on which class was used to build the day objects. If the day was built with <classname>Calendar_Month_Weekdays</classname>, all three of these methods are applicable (you may have empty days and <classname>Calendar_Month_Weekdays</classname> builts a complete month but delimits the beginning and end of each week so you can find it with <function>isFirst</function> and <function>isLast</function>). If the day was built with <classname>Calendar_Week</classname>, only the <function>isEmpty</function> method is applicable (the first or last week in a month may contain empty days). For day objects built in any other manner, <function>isEmpty</function>, <function>isFirst</function> and <function>isLast</function> are meaningless. </para> </refsect1> <refsect1> <title>Validation</title> <para> All date objects and tabular objects (except weeks) are capable of validating themselves. By default they accept whatever arguments they are given on construction but you can validate the date with the <function>isValid</function> method, for example; <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); if (!$Day->isValid()) { die ('Invalid date'); } ]]> </programlisting> For more fine grained validation, you can first call the <function>getValidator</function> method, to return an instance of <classname>Calendar_Validator</classname> then list the validation errors; <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); if (!$Day->isValid()) { $Validator = & $Day->getValidator(); while ($Error = $Validator->fetch()) { echo $Error->getUnit().' is invalid<br>'; } } ]]> </programlisting> or... <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); $Validator = & $Day->getValidator(); if (!$Validator->isValid()) { while ($Error = $Validator->fetch()) { echo $Error->toString().'<br>'; } } ]]> </programlisting> </para> <para>Note that rather than validating dates, you may prefer to automatically adjust them with the <function>adjust</function> method, for example; <programlisting role="php"> <![CDATA[ $Day = new Calendar_Day(2003, 10, 32); $Day->adjust(); echo $Day->thisYear(); // 2003 echo $Day->thisMonth(); // 11 (moved forward a month) echo $Day->thisDay(); // 1 (the first of the month) ]]> </programlisting> </para> <para> That summarizes all the methods available within PEAR::Calendar, apart from the those provided in the Decorator classes. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-overview.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-overview.xml +++ peardoc/fr/package/datetime/calendar/intro-overview.xml <?xml version="1.0" ?> <!-- $Id: intro-overview.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.4 Maintainer: didou Status: partial --> <refentry id="package.datetime.calendar.intro-overview"> <refnamediv> <refname>Tour d'horizon du package</refname> <refpurpose> Tour d'horizon des classes de Calendar </refpurpose> </refnamediv> <refsect1> <title>Tour d'horizon du package</title> <para> Lorsque vous travaillez avec PEAR::Calendar, il y'a un total de 12 classes (publiques) disponibles pour vous aider à résoudre les problèmes que vous rencontrez. On peut les grouper en classes de dates, dates tabulaires, validation et décorations. </para> </refsect1> <refsect1> <title>Classes de dates</title> <para>Elles fournissent une représentation de toutes les unités humaines basiques de dates. Elles héritent toutes de <classname>Calendar</classname> et fournissent les méthodes définies par la suite :</para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Year</classname> - represents a year and can build <classname>Calendar_Month</classname>, <classname>Calendar_Month_Weekdays</classname> and <classname>Calendar_Month_Weeks</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Year.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Month</classname> - represents a month and can build <classname>Calendar_Day</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Month.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Day</classname> - represents a day and can build <classname>Calendar_Hour</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Day.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Hour</classname> - represents a hour and can build <classname>Calendar_Minute</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Hour.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Minute</classname> - represents a minute and can build <classname>Calendar_Second</classname> objects. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Minute.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Second</classname> - represents a second but cannot build anything. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Second.php'; ]]></programlisting>.</para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.datetime.calendar.intro-overview.tabular"> <title>Tabular Date Classes</title> <para>Designed for building calendars in tabular format. All are subclasses of <classname>Calendar</classname> so provide the methods defined there.</para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Month_Weekdays</classname> - builds <classname>Calendar_Day</classname> objects setting the <function>isFirst</function>, <function>isLast</function> and <function>isEmpty</function> states, to display a month in tabular form. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Month/Weekdays.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Month_Weeks</classname> - builds <classname>Calendar_Week</classname> objects, representing a month in terms of the tabular weeks in contains (see FAQ for what a week represents). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Month/Weeks.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Week</classname> - builds <classname>Calendar_Day</classname> objects, setting the <function>isEmpty</function> state if necessary and representing a tabular week in a month (i.e. you get 7 days from it). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Week.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Week</classname> - builds <classname>Calendar_Day</classname> objects, setting the <function>isEmpty</function> state if necessary and representing a tabular week in a month (i.e. you get 7 days from it). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Week.php'; ]]></programlisting>.</para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.datetime.calendar.intro-overview.validation"> <title>Validation Classes</title> <para>Used to validate dates. <classname>Calendar</classname> provides the methods <function>isValid</function> to perform a simple check on any date and <function>getValidator</function> to return an instance of <classname>Calendar_Validator</classname> for fine grained validation.</para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Validator</classname> - is not instantiated by your code directly (you need need specifically include / create it) but instead returned from the <classname>Calendar</classname>::<function>getValidator</function> method you can call on any subclass of <classname>Calendar</classname>. It is used to provide fine grained validation of a date to find out exactly what's wrong with it (for simple validation just call <function>isValid</function> on any Date object or Tabular Date object, to know if it was created with valid values. </para> </listitem> <listitem> <para><classname>Calendar_Validation_Error</classname> - represents a validation error, providing methods to determine what went wrong. Available methods are <function>getUnit</function> (e.g. returns Year or Month), <function>getValue</function> (the value it failed with), <function>getMessage</function> (the validation error message) and <function>toString</function> which returns a combination of all the three preceding methods. The default validation error messages are in English but stored in the constants <constant>CALENDAR_VALUE_TOOSMALL</constant> and <constant>CALENDAR_VALUE_TOOLARGE</constant> which you can redefine in your code. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="package.datetime.calendar.intro-overview.decorators"> <title>Decorators</title> <para>Provide a mechanism to add functionality to the main calendar objects (the subclasses of <classname>Calendar</classname>) without needing to directly extend them (and risk overwriting fields accidentally). When you create a decorator, you pass it's constructor an instance of an existing calendar object. You can then make calls to the decorator in exactly the same way as you make calls to the original calendar object. This allows you to "overwrite" calendar methods, add new methods or even apply multiple decorators to the same calendar object. Decorators a typically either "injected" (via selection or the <classname>Calendar_Decorator_Wrapper</classname> decorator) into the loop where the calendar is rendered and / or to alter the output content (e.g. convert a numeric month into a textual month: 1 => January).</para> <para> PEAR::Calendar provides some decorator implementations for you, to help with common tasks. These are not designed to suit everyone and hence are provided as optional code for you to use as needed (avoiding the performance cost associated with parsing code you're not using). </para> <para> <itemizedlist> <listitem> <para><classname>Calendar_Decorator</classname> - this is the base decorator class which you should extend with your own. It provides the same API as the calendar object it is decorating, and simply routes calls through to it. Example; <programlisting role="php"> <![CDATA[ require_once 'Calendar/Decorator.php'; class ChristmasDecorator extends Calendar_Decorator { function ChristmasDecorator(&$Calendar) { parent::Calendar_Decorator($Calendar); } // Quelques méthodes ajoutées function getDaysToChristmas() { $today = parent::thisDay(true); $Christmas = new Calendar_Day(date('Y'), 12, 25); $xmasday = $Christmas->thisDay(TRUE); $diff = $xmasday - $today; if ($diff < 0) { $NextChristmas = new Calendar_Day($Christmas->nextYear(), 12, 25); $nextxmasday = $NextChristmas->thisDay(true); $diff = $today - $nextxmasday; } return ($diff / 86400); } } ]]> </programlisting> </para> </listitem> <listitem> <para><classname>Calendar_Decorator_Uri</classname> - provides a decorator to help with generating URLs (for example next / prev URLs). </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Decorator/Uri.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Decorator_Textual</classname> - helps with obtaining textual month names and weekday names from a calendar object. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Decorator/Textual.php'; ]]></programlisting>.</para> </listitem> <listitem> <para><classname>Calendar_Decorator_Wrapper</classname> - is intended to help you add decorators to the children of the calendar object you are working with. It will wrap the children in the decorator you specify at the point <function>fetch</function> or <function>fetchAll</function> is called, after a build <function>build</function> call. </para> <para>Include with <programlisting role="php"><![CDATA[ require_once 'Calendar/Decorator/Wrapper.php'; ]]></programlisting>.</para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/peardoc/fr/package/datetime/calendar/intro-purpose.xml?r=1.1&p=1 Index: peardoc/fr/package/datetime/calendar/intro-purpose.xml +++ peardoc/fr/package/datetime/calendar/intro-purpose.xml <?xml version="1.0" ?> <!-- $Id: intro-purpose.xml,v 1.1 2004/03/24 14:55:22 didou Exp $ --> <!-- EN-Revision: 1.3 Maintainer: didou Status: ready --> <refentry id="package.datetime.calendar.intro-purpose"> <refnamediv> <refname>Introduction</refname> <refpurpose> Ce que peut faire <classname>Calendar</classname> </refpurpose> </refnamediv> <refsect1> <title>Introduction</title> <para> <warning> <simpara> Quelques classes de PEAR::Calendar requièrent PEAR::Date. Il manque quelques fichiers à la version 1.3.1beta de PEAR::Date, ce qui fait qu'elle ne fonctionne pas. Assurez-vous d'avoir PEAR::Date 1.3 (stable) d'installé. </simpara> </warning> </para> <para> PEAR::Calendar est un package pour générer des calendriers en tant que structures de données. Il ne formate rien et ne se base sur aucune couche d'abstraction, ce qui permet de l'utiliser dans différents cas. En même temps, ce package fournit une API facile d'utilisation qui rend le formattage facile, par exemple un calendrier HTML, tout en permettant de "connecter" le calendrier à votre couche d'abstraction. </para> <para> PEAR::Calendar a été développé à cause de l'absence d'alternatives en PHP. Il existe plusieurs classes / utilitaires mais elles sont toutes dédiée à un rendu spécifique (typiquement du HTML avec des possibilités limitées de personnalisation sans avoir à retoucher le code) et dépendent souvent sur un type particulier de données (comprendre MySQL). Cela pose de grosses restrictions sur les cas où elles peuvent être appliquées. Par contraste, PEAR::Calendar se borne à éliminer les calculs de la génération de calendriers, permettant à l'utilisateur final de traverser simplement une structure de données préparée. </para> <para> Quelques bénéfices / fonctionnalités de PEAR::Calendar : <itemizedlist> <listitem> <simpara>Vous pouvez obtenir le rendu que vous voulez (comme du (X)HTML, WML, SOAP, XML-RPC, ASCII en ligne de commande ou ce que vous voulez).</simpara> </listitem> <listitem> <simpara>Générer un calendrier devient aussi simple que boucler sur le résultat d'une requête SQL.</simpara> </listitem> <listitem> <simpara>Tous les "objets date" sont traités de l'année à la seconde (cela signifie que vous pouvez générer un calendrier complet de l'année avec des mois et des jours tout comme vous pouvez générer un "agenda par semaine / jour")</simpara> </listitem> <listitem> <simpara>Permet de générer des calendriers "tabulaires" facilement.</simpara> </listitem> <listitem> <simpara>Toute date peut facilement être validée (est-ce que le 29 Fév 2003 est valide ?).</simpara> </listitem> <listitem> <simpara>Fonctionne bien avec de gros nombres et des API orientées objet.</simpara> </listitem> <listitem> <simpara>La navigation dans les calendriers est facile (fournir un lien du 1er Janvier 2004 au 31 décembre 2004 n'est pas un problème).</simpara> </listitem> <listitem> <simpara>Il retourne des valeurs numériques pour toutes les opérations, ce qui signifie que vous n'êtes pas obligés d'utiliser les noms anglais pour les mois par exemple. Vous les générerez vous-mêmes avec des fonctions PHP telles que strftime() et setlocale().</simpara> </listitem> <listitem> <simpara>La représentation des dates peut être obtenue sous un format lisible par l'homme, ou en tant que timestamp Unix, selon le moteur de calendrier que vous utilisez.</simpara> </listitem> <listitem> <simpara>Vous pouvez ajouter vos propres fonctionnalités au calendrier en créant des Decorators.</simpara> </listitem> <listitem> <simpara>Vous permet d'écrire des applications N-tierces, avec des couches.</simpara> </listitem> <listitem> <simpara>Le "moteur de calcul" du calendrier est abstrait, ce qui signifie que vous n'êtes pas obligés d'utiliser le calendrier Gregorien - vous pouvez écrire un calendrier Tolkiénien si vous voulez. Actuellement, des "moteurs" basés sur Unixtimestamps (par défaut) et PEAR::<classname>Date</classname> ont été implémentés.</simpara> </listitem> </itemizedlist> </para> <para> <example> <title>Un exemple simple</title> <programlisting role="php"> <![CDATA[ <?php require_once 'Calendar/Month.php'; $Month = new Calendar_Month(2003, 10); // October 2003 $Month->build(); // Construire les jours du mois // On boucle dans les jours.. while ($Day = $Month->fetch()) { echo $Day->thisDay(), '<br />'; } ?> ]]> </programlisting> </example> <emphasis>Note:</emphasis> il y'a plusieurs exemples complets fournis avec le package PEAR::Calendar. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->