PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links 
search for in the  
previousmb_substrmcal_append_eventnext
Last updated: Tue, 09 Jul 2002
view the printer friendly version or the printer friendly version with notes or change language to English | Brazilian Portuguese | Chinese | Czech | Dutch | Finnish | German | Hungarian | Italian | Japanese | Korean | Polish | Romanian | Russian | Spanish | Swedish | Turkish

LIV. MCAL

MCAL signifie Modular Calendar Access Library (librairie calendaire modulaire).

Libmcal est une librairie C de calendriers. Elle est �crite pour �tre tr�s modulaire, et dispose de nombreux modules. MCAL est l'�quivalent de IMAP pour les calendriers.

Avec mcal, un calendrier peut �tre ouvert comme une bo�te aux lettres. Les calendriers peuvent �tre des fichiers locaux, ou bien �tre sur des serveurs ICAP distants, ou encore tout autre format support� par la librairie.

Les �v�nements peuvent �tre lus, s�lectionn�s et enregistr�s. Il y a aussi la possibilit� d'ajouter des alarmes, et de placer des �v�n�ments r�curents.

Avec libmcal, les serveurs centralis�s peuvent �tre acc�d�s et utilis�s, et remplacent avantageusement tout d�veloppement sp�cifique de base de donn�es.

Pour faire fonctionner cette librairie, vous devez compiler PHP avec l'option --with-mcal. Il vous faudra alors avoir install� la librairie mcal. T�l�chargez la derni�re version � et compilez-la, puis installez-la.

Les constantes suivantes sont d�finies avec l'extension mcal. Pour les jours de la semaine :

  • MCAL_SUNDAY (Dimanche)

  • MCAL_MONDAY (Lundi)

  • MCAL_TUESDAY (Mardi)

  • MCAL_WEDNESDAY (Mercredi)

  • MCAL_THURSDAY (Jeudi)

  • MCAL_FRIDAY (Vendredi)

  • MCAL_SATURDAY (Samedi)

Pour les r�currences :

  • MCAL_RECUR_NONE (Aucune)

  • MCAL_RECUR_DAILY (Quotidienne)

  • MCAL_RECUR_WEEKLY (Hebdomadaire)

  • MCAL_RECUR_MONTHLY_MDAY (Mensuelle, date fixe)

  • MCAL_RECUR_MONTHLY_WDAY (Mensuelle, jour fixe )

  • MCAL_RECUR_YEARLY (Annuelle)

Pour les mois :

  • MCAL_JANUARY (Janvier)

  • MCAL_FEBRUARY (F�vrier)

  • MCAL_MARCH (Mars)

  • MCAL_APRIL (Avril)

  • MCAL_MAY (Mai)

  • MCAL_JUNE (Juin)

  • MCAL_JULY (Juillet)

  • MCAL_AUGUST (Ao�t)

  • MCAL_SEPTEMBER (Septembre)

  • MCAL_OCTOBER (Octobre)

  • MCAL_NOVEMBER (Novembre)

  • MCAL_DECEMBER (D�cembre)

La plupart des fonctions utilisent une structure d'�v�nement interne, qui est unique pour chaque connexion. Cela �vite d'avoir � passer des objets de grande taille entre les fonctions. Il y a des accesseurs bien pratiques pour cr�er, initialiser et lire des objets �v�nements.

Table des mati�res
mcal_append_event --  Enregistre un nouvel �v�nement dans un calendrier MCAL.
mcal_close -- Ferme une connexion MCAL.
mcal_create_calendar -- Cr�e un nouveau calendrier
mcal_date_compare -- Compare deux dates.
mcal_date_valid --  Valide une date.
mcal_day_of_week --  Le jour de la semaine.
mcal_day_of_year --  Le jour de l'ann�e.
mcal_days_in_month --  Retourne le nombre de jour d'un mois.
mcal_delete_calendar -- Efface un calendrier
mcal_delete_event --  Efface un �v�nement dans un calendrier MCAL.
mcal_event_add_attribute --  Ajoute un attribut et une valeur � la structure globale
mcal_event_init --  Initialise la structure globale d'un flot.
mcal_event_set_alarm --  Fixe l'alarme de la structure globale.
mcal_event_set_category --  Fixe la cat�gorie de la structure globale.
mcal_event_set_class --  Fixe la classe de la structure globale.
mcal_event_set_description --  Fixe la description de la structure globale.
mcal_event_set_end --  Fixe la date de fin de la structure globale.
mcal_event_set_recur_daily --  Fixe la r�currence quotidienne.
mcal_event_set_recur_monthly_mday --  Fixe la r�currence.
mcal_event_set_recur_monthly_wday --  Fixe la r�currence mensuelle.
mcal_event_set_recur_none --  Supprime la r�currence de la structure globale.
mcal_event_set_recur_weekly --  Fixe la r�currence hebdomadaire.
mcal_event_set_recur_yearly --  Fixe la r�currence annuelle.
mcal_event_set_start --  Fixe les dates de d�but et de fin de la structure globale.
mcal_event_set_title --  Fixe le titre de la structure globale.
mcal_expunge --  Supprime tous les �v�nements marqu�s pour l'effacement
mcal_fetch_current_stream_event --  Retourne un objet contenant la structure de date pour le flot courant.
mcal_fetch_event --  Recherche un �v�nement dans le calendrier.
mcal_is_leap_year --  V�rifie que l'ann�e est bissextile.
mcal_list_alarms --  Retourne une liste d'�v�nements qui ont une alarme pr�vue � une date.
mcal_list_events --  Retourne une liste d'�v�nement entre deux dates.
mcal_next_recurrence --  Retourne la prochaine occurrence d'un �v�nement.
mcal_open -- Ouvre une connexion MCAL.
mcal_popen -- Ouvre une connexion persistante MCAL.
mcal_rename_calendar -- Renomme un calendrier
mcal_reopen -- R�ouvre une connexion MCAL
mcal_snooze -- Eteint l'alarme d'un �v�nement.
mcal_store_event --  Modifie un �v�nement dans un calendrier MCAL.
mcal_time_valid --  Valide une heure.
mcal_week_of_year --  Returns the week number of the given date
User Contributed Notes
MCAL
add a note about notes
[email protected]
25-Mar-2000 09:59

MCAL is a great little package, but has changed quite a bit since the documentation has been updated. If you're having trouble stop by mcal.chek.com and pop a question onto the mcal users mailing list and we'll be happy to help you out.
[email protected]
23-Dec-2000 07:04

After a thorough search of the web for documentation of how recurence works in MCAL, or even for documentation of the recurence function parameters, I found nothing. So, I gave up and dove into the MCAL source code for answers, and this is what I have found. Please keep in mind that this is all "As far as I can tell" information.

First of all, I believe that mcal_list_events DOES return events that recur in the range being searched.

The mcal_event_set_recur_* functions take in an mcal stream, and date for the event to stop recuring by (given by day, month, year), and an "interval".

mcal_event_set_recur_weekly takes an additional integer parameter "weekdays" which is basicly a binary mask created by bitwise ANDing together integers representing the days of the week.

Sunday = 1
Monday = 2
Tuesday = 4
Wednesday = 8
Thursday = 16
Friday = 32
Saturday = 64

So if I wanted the value that represented "Monday, Wednesday, and Friday" I would do this:
$weekdays = 2 & 8 & 32;

Here is how to interpret "interval" and "weekdays".

For mcal_event_set_recur_daily:
This event should recur every "interval" days.

For mcal_event_set_recur_weekly:
This event should recur on every day specified in "weekdays", and should do so every "interval" weeks.

For mcal_event_set_recur_monthly_mday:
This event should recur on the "interval" day of every month.

For mcal_event_set_recur_monthly_wday:
This event should recur every on every Xday of the Yth week of the month, every "interval" months. (Where Xday is a day of the week, e.g. Monday, Tuesday, etc. Note: This is the one I am the least sure about though it seems to be the logical assumption for how it should work based on the fact that there are two monthly functions and the other one's operation is intuitive.)

For mcal_event_set_recur_yearly:
This event should recur every "interval" years.

[email protected]
11-Jan-2001 10:31

If you compile the libmcal tarball - be sure to copy all the .h files to /usr/local/mcal/include (or whatever) - the Makefile doesn't copy all of them.
[email protected]
11-Jan-2001 09:37

Lurker had it a bit wrong (I think)...
If you want Monday, Wednesday and Friday, you would do
2 | 8 | 64
Check out Kronolith (part of the horde project) for more information:

[email protected]
03-Jul-2001 06:03

As of 7/3/2001, libmcal can be built shared (libmcal.so), which should get rid of the linking problem with the MySQL driver. Check the latest version out of the repository if you're planning on building it this way.
[email protected]
12-May-2002 05:55

Correction to previous extensive note:
ANDing distinct bit values will always result in zero, so your weekly events won't ever be raised. You must use the bitwise-or operator (|) to combine several week days.

mcal_event_set_recur_weekly takes an additional integer parameter
"weekdays" which is basicly a binary mask created by bitwise
ORing together integers representing the days of the week.

Sunday = 1
Monday = 2
Tuesday = 4
Wednesday = 8
Thursday = 16
Friday = 32
Saturday = 64

So if I wanted the value needed to raise the event every "Monday, Wednesday, and Friday" I would do this:
$weekdays = 2 | 8 | 32;

[email protected]
24-May-2002 08:58

Warning to Redhat 7.3 users - the PhP rpms in redhat 7.3 seem to sugest that they have mcal suport - phpinfo() includes the entry '-enable-mcal' but mcal doesn't seem to work
add a note about notes
previousmb_substrmcal_append_eventnext
Last updated: Tue, 09 Jul 2002
show source | credits | stats | mirror sites
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Sat Aug 31 06:19:44 2002 CEST