Page principale | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe | 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 00037 class Webcal { 00038 var $localdb; 00039 var $heure = -1; 00040 var $duree = 0; 00041 00046 function Webcal() 00047 { 00048 global $conf; 00049 00050 $this->localdb = new Db($conf->webcal->db->type, 00051 $conf->webcal->db->host, 00052 $conf->webcal->db->user, 00053 $conf->webcal->db->pass, 00054 $conf->webcal->db->name); 00055 } 00056 00065 function add($user, $date, $texte, $desc) 00066 { 00067 00068 $id = $this->get_next_id(); 00069 00070 $cal_id = $id; 00071 $cal_create_by = $user->webcal_login; 00072 $cal_date = strftime('%Y%m%d', $date); 00073 $cal_time = $this->heure; 00074 $cal_mod_date = strftime('%Y%m%d', time()); 00075 $cal_mod_time = strftime('%H%M', time()); 00076 $cal_duration = $this->duree; 00077 $cal_priority = 2; 00078 $cal_type = "E"; 00079 $cal_access = "P"; 00080 $cal_name = $texte; 00081 $cal_description = $desc; 00082 00083 $sql = "INSERT INTO webcal_entry (cal_id, cal_create_by,cal_date,cal_time,cal_mod_date, 00084 cal_mod_time,cal_duration,cal_priority,cal_type, cal_access, cal_name,cal_description)"; 00085 00086 $sql .= " VALUES ($cal_id, '$cal_create_by', $cal_date, $cal_time,$cal_mod_date, $cal_mod_time, 00087 $cal_duration,$cal_priority,'$cal_type', '$cal_access', '$cal_name','$cal_description')"; 00088 00089 if ( $this->localdb->query($sql) ) 00090 { 00091 00092 $sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)"; 00093 $sql .= " VALUES ($cal_id, '$cal_create_by', 'A')"; 00094 00095 if ( $this->localdb->query($sql) ) 00096 { 00097 00098 } 00099 else 00100 { 00101 $error = $this->localdb->error() . '<br>' .$sql; 00102 } 00103 } 00104 else 00105 { 00106 $error = $this->localdb->error() . '<br>' .$sql; 00107 } 00108 00109 $this->localdb->close(); 00110 } 00111 00118 function get_next_id() 00119 { 00120 00121 $sql = "SELECT max(cal_id) FROM webcal_entry"; 00122 00123 if ($this->localdb->query($sql)) 00124 { 00125 $id = $this->localdb->result(0, 0) + 1; 00126 return $id; 00127 } 00128 else 00129 { 00130 print $this->localdb->error(); 00131 } 00132 } 00133 } 00134 ?>

Généré le Thu Jul 15 20:50:38 2004 pour dolibarr par doxygen 1.3.7