Indentation du code
This commit is contained in:
parent
c180c0b9c9
commit
bc60f16778
@ -1,8 +1,5 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -18,80 +15,88 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
class Webcal {
|
||||
var $localdb;
|
||||
|
||||
var $heure = -1;
|
||||
var $duree = 0;
|
||||
|
||||
|
||||
|
||||
Function Webcal() {
|
||||
global $conf;
|
||||
|
||||
$this->localdb = new Db($conf->webcal->db->type,
|
||||
$conf->webcal->db->host,
|
||||
$conf->webcal->db->user,
|
||||
$conf->webcal->db->pass,
|
||||
$conf->webcal->db->name);
|
||||
}
|
||||
|
||||
|
||||
Function add($user, $date, $texte, $desc) {
|
||||
|
||||
$id = $this->get_next_id();
|
||||
|
||||
$cal_id = $id;
|
||||
$cal_create_by = $user->webcal_login;
|
||||
$cal_date = strftime('%Y%m%d', $date);
|
||||
$cal_time = $this->heure;
|
||||
$cal_mod_date = strftime('%Y%m%d', time());
|
||||
$cal_mod_time = strftime('%H%M', time());
|
||||
$cal_duration = $this->duree;
|
||||
$cal_priority = 2;
|
||||
$cal_type = "E";
|
||||
$cal_access = "P";
|
||||
$cal_name = $texte;
|
||||
$cal_description = $desc;
|
||||
|
||||
|
||||
$sql = "INSERT INTO webcal_entry (cal_id, cal_create_by,cal_date,cal_time,cal_mod_date, cal_mod_time,cal_duration,cal_priority,cal_type, cal_access, cal_name,cal_description)";
|
||||
|
||||
$sql .= " VALUES ($cal_id, '$cal_create_by', $cal_date, $cal_time,$cal_mod_date, $cal_mod_time, $cal_duration,$cal_priority,'$cal_type', '$cal_access', '$cal_name','$cal_description');";
|
||||
|
||||
if ( $this->localdb->query($sql) ) {
|
||||
|
||||
$sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)";
|
||||
$sql .= " VALUES ($cal_id, '$cal_create_by', 'A')";
|
||||
|
||||
if ( $this->localdb->query($sql) ) {
|
||||
|
||||
} else {
|
||||
print $this->localdb->error() . '<br>' .$sql;
|
||||
}
|
||||
} else {
|
||||
print $this->localdb->error() . '<br>' .$sql;
|
||||
Function Webcal()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->localdb = new Db($conf->webcal->db->type,
|
||||
$conf->webcal->db->host,
|
||||
$conf->webcal->db->user,
|
||||
$conf->webcal->db->pass,
|
||||
$conf->webcal->db->name);
|
||||
}
|
||||
|
||||
$this->localdb->close();
|
||||
}
|
||||
|
||||
|
||||
Function get_next_id() {
|
||||
|
||||
$sql = "SELECT max(cal_id) FROM webcal_entry";
|
||||
|
||||
if ($this->localdb->query($sql)) {
|
||||
$id = $this->localdb->result(0, 0) + 1;
|
||||
return $id;
|
||||
} else {
|
||||
print $this->localdb->error();
|
||||
|
||||
Function add($user, $date, $texte, $desc)
|
||||
{
|
||||
|
||||
$id = $this->get_next_id();
|
||||
|
||||
$cal_id = $id;
|
||||
$cal_create_by = $user->webcal_login;
|
||||
$cal_date = strftime('%Y%m%d', $date);
|
||||
$cal_time = $this->heure;
|
||||
$cal_mod_date = strftime('%Y%m%d', time());
|
||||
$cal_mod_time = strftime('%H%M', time());
|
||||
$cal_duration = $this->duree;
|
||||
$cal_priority = 2;
|
||||
$cal_type = "E";
|
||||
$cal_access = "P";
|
||||
$cal_name = $texte;
|
||||
$cal_description = $desc;
|
||||
|
||||
$sql = "INSERT INTO webcal_entry (cal_id, cal_create_by,cal_date,cal_time,cal_mod_date, cal_mod_time,cal_duration,cal_priority,cal_type, cal_access, cal_name,cal_description)";
|
||||
|
||||
$sql .= " VALUES ($cal_id, '$cal_create_by', $cal_date, $cal_time,$cal_mod_date, $cal_mod_time, $cal_duration,$cal_priority,'$cal_type', '$cal_access', '$cal_name','$cal_description');";
|
||||
|
||||
if ( $this->localdb->query($sql) )
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO webcal_entry_user (cal_id, cal_login, cal_status)";
|
||||
$sql .= " VALUES ($cal_id, '$cal_create_by', 'A')";
|
||||
|
||||
if ( $this->localdb->query($sql) )
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $this->localdb->error() . '<br>' .$sql;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = $this->localdb->error() . '<br>' .$sql;
|
||||
}
|
||||
|
||||
$this->localdb->close();
|
||||
}
|
||||
|
||||
|
||||
Function get_next_id()
|
||||
{
|
||||
|
||||
$sql = "SELECT max(cal_id) FROM webcal_entry";
|
||||
|
||||
}
|
||||
if ($this->localdb->query($sql))
|
||||
{
|
||||
$id = $this->localdb->result(0, 0) + 1;
|
||||
return $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->localdb->error();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user