Page principale | Liste des fichiers | Membres de fichier

htdocs/lib/webcal.class.php

Aller à la documentation de ce fichier.
00001 <?PHP 00002 /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 * $Id$ 00019 * $Source$ 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 doxygen 1.3.7