Gestion simplissime des Todo

crabs_todo-1.2 ©2008 - Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)

~~ / todo_list.php
Makefile todo.css index.php logout.php todo.php todo.js ihm.js filtre.js hr.js todo_list.php projet_list.php info.php suppr.php sauver.php todo.txt
    1 <?php
    2 //
    3 // =============================================================================
    4 //  crabs_todo-1.2 : Gestion simplissime des Todo
    5 //  Copyright (C) 2008 : Christophe Cazajus (crabs-mettre_le_signe_at-crabs-world.com)
    6 //
    7 //  Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    8 //  et/ou le modifier en respectant les termes de la GNU General Public License
    9 //  version 2 ou (suite a votre propre choix) une version ulterieure.
   10 //
   11 //  Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   12 //  sans aucune garantie, meme si il est associe a un produit qui vous en
   13 //  propose une. Conformez-vous a la GNU General Public License pour avoir
   14 //  plus de precisions.
   15 //
   16 //  L'auteur ne peut etre tenu responsable de l'utilisation faite des
   17 //  composantes associees a ce projet (en partie ou dans leur totalite).
   18 //
   19 //  Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   20 //  de ce projet sous le nom gnu_gpl.txt
   21 //
   22 // =============================================================================
   23 //
   24 // HTTP REQUEST...
   25 //  lignes séparées par <#>
   26 //  colonnes séparées par <>
   27 //  champs 0 : id du todo
   28 //  champs 1 : etat du todo
   29 //  champs 2 : projet
   30 //  champs 3 : titre
   31 //  champs 4 : createur
   32 //  champs 5 : date
   33 //  resultat trié par date (desc) et etat
   34 include( 'LIB/param.php' ) ;
   35 include( 'LIB/util.php' ) ;
   36 include( 'LIB/mysql.php' ) ;
   37 
   38 if ( !array_key_exists( 'PHPSESSID', $_REQUEST ) )
   39     { header( 'Location: '.$ROOT_URL ) ; exit ; }
   40 session_set_cookie_params(0,relative2absolute('.', true)) ;
   41 session_start() ;
   42 
   43 $etat = toMySQL( fromGET( 'e', 0 ) ) ;
   44 $projet = toMySQL( fromGET( 'p', 'Tous' ) ) ;
   45 $tri = toMySQL( fromGET( 't', 'etat' ) ) ;
   46 
   47 $where = "" ; $and = 'WHERE' ;
   48 if ( $etat != 0 ) { $where="WHERE etat_id='$etat'" ; $and=' AND' ; }
   49 if ( $projet != 'Tous' ) $where.="$and projet='$projet'" ;
   50 
   51 if ( $tri == 'etat' )
   52     $order_by = 'etat_id, derniere_action DESC' ;
   53 else
   54     $order_by = 'derniere_action DESC, etat_id' ;
   55 
   56 $sql = <<<SQL
   57     SELECT id, etat_id, projet, titre, pseudo,
   58         DATE_FORMAT( derniere_action, '%d/%m/%Y') as date
   59     FROM ${DB_PRFX}todo
   60     $where
   61     ORDER BY $order_by
   62 
   63 SQL;
   64 $todo = array() ;
   65 $c = new MYSQL ;
   66 $res = $c->query( $sql ) ;
   67 while ( $r = mysql_fetch_assoc( $res ) )
   68     {
   69     $attr = array() ;
   70     foreach( $r as $var => $val ) $attr[$var] = toJS( fromMySQL( $val ) ) ;
   71     $todo[] =  implode( '<>', $attr ) ;
   72     }
   73 if ( count( $todo ) > 0 ) echo implode( '<#>', $todo ) ;
   74 echo '' ;
   75 ?>
Makefile todo.css index.php logout.php todo.php todo.js ihm.js filtre.js hr.js todo_list.php projet_list.php info.php suppr.php sauver.php todo.txt
~~ / todo_list.php

Haut de page

Contacter crabs

Date de génération : 28/09/2009 22:45