htdocs/lib/webcal.class.php
Aller à la documentation de ce fichier.00001 <?PHP
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00031 class Webcal {
00032 var $localdb;
00033 var $heure = -1;
00034 var $duree = 0;
00035
00040 function Webcal()
00041 {
00042 global $conf;
00043
00044 $this->localdb = new Db($conf->webcal->db->type,
00045 $conf->webcal->db->host,
00046 $conf->webcal->db->user,
00047 $conf->webcal->db->pass,
00048 $conf->webcal->db->name);
00049 }
00050
00059 function add($user, $date, $texte, $desc)
00060 {
00061
00062 $id = $this->get_next_id();
00063
00064 $cal_id = $id;
00065 $cal_create_by = $user->webcal_login;
00066 $cal_date = strftime('%Y%m%d', $date);
00067 $cal_time = $this->heure;
00068 $cal_mod_date = strftime('%Y%m%d', time());
00069 $cal_mod_time = strftime('%H%M', time());
00070 $cal_duration = $this->duree;
00071 $cal_priority = 2;
00072 $cal_type = "E";
00073 $cal_access = "P";
00074 $cal_name = $texte;
00075 $cal_description = $desc;
00076
00077 $sql = "INSERT INTO webcal_entry (cal_id, cal_create_by,cal_date,cal_time,cal_mod_date,
00078 cal_mod_time,cal_duration,cal_priority,cal_type, cal_access, cal_name,cal_description)";
00079
00080 $sql .= " VALUES ($cal_id, '$cal_create_by', $cal_date, $cal_time,$cal_mod_date, $cal_mod_time,
00081 $cal_duration,$cal_priority,'$cal_type', '$cal_access', '$cal_name','$cal_description')";
00082
00083 if ( $this->localdb->query($sql) )
00084 {
00085
00086 $sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)";
00087 $sql .= " VALUES ($cal_id, '$cal_create_by', 'A')";
00088
00089 if ( $this->localdb->query($sql) )
00090 {
00091
00092 }
00093 else
00094 {
00095 $error = $this->localdb->error() . '<br>' .$sql;
00096 }
00097 }
00098 else
00099 {
00100 $error = $this->localdb->error() . '<br>' .$sql;
00101 }
00102
00103 $this->localdb->close();
00104 }
00105
00112 function get_next_id()
00113 {
00114
00115 $sql = "SELECT max(cal_id) FROM webcal_entry";
00116
00117 if ($this->localdb->query($sql))
00118 {
00119 $id = $this->localdb->result(0, 0) + 1;
00120 return $id;
00121 }
00122 else
00123 {
00124 print $this->localdb->error();
00125 }
00126 }
00127 }
00128 ?>
Généré le Thu Jul 15 14:51:57 2004 pour dolibarr par
1.3.7