noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
ajax_todo_list.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief handle the ajax request for the todo_list (delete, update
00024  * and insert)
00025  * for add, needed parameters
00026  * - gDossier
00027  * - d date,
00028  * - t title
00029  * - de description
00030  * for update, same as ADD +
00031  * - i id
00032  * for delete
00033  * - gDossier
00034  * - i id
00035  */
00036 define ('ALLOWED',1);
00037 require_once '../include/constant.php';
00038 require_once ('class_dossier.php');
00039 require_once ('class_todo_list.php');
00040 require_once ('class_database.php');
00041 require_once ('class_user.php');
00042 mb_internal_encoding("UTF-8");
00043 
00044 $cn= Dossier::connect();
00045 global $g_user;
00046 $g_user=new User($cn);
00047 $g_user->check(true);
00048 $g_user->check_dossier(Dossier::id(),true);
00049 ajax_disconnected('add_todo_list');
00050 
00051 if (isset($_REQUEST['show']))
00052 {
00053     $cn=new Database(dossier::id());
00054     $todo=new Todo_list($cn);
00055     $todo->set_parameter('id',$_REQUEST['id']);
00056     $todo->load();
00057     header('Content-type: text/xml; charset=UTF-8');
00058     header ('<?xml version="1.0" encoding="UTF-8"?>');
00059     echo $todo->toXML();
00060     exit();
00061 }
00062 
00063 if (isset($_REQUEST['del']))
00064 {
00065     $cn=new Database(dossier::id());
00066     $todo=new Todo_list($cn);
00067     $todo->set_parameter('id',$_REQUEST['id']);
00068     $todo->delete();
00069     exit();
00070 }
 All Data Structures Namespaces Files Functions Variables Enumerations